@stamhoofd/models 2.79.8 → 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/dist/src/factories/EmailTemplateFactory.d.ts +18 -0
- package/dist/src/factories/EmailTemplateFactory.d.ts.map +1 -0
- package/dist/src/factories/EmailTemplateFactory.js +43 -0
- package/dist/src/factories/EmailTemplateFactory.js.map +1 -0
- package/dist/src/factories/EventFactory.d.ts +17 -0
- package/dist/src/factories/EventFactory.d.ts.map +1 -0
- package/dist/src/factories/EventFactory.js +30 -0
- package/dist/src/factories/EventFactory.js.map +1 -0
- package/dist/src/factories/EventNotificationFactory.d.ts +21 -0
- package/dist/src/factories/EventNotificationFactory.d.ts.map +1 -0
- package/dist/src/factories/EventNotificationFactory.js +44 -0
- package/dist/src/factories/EventNotificationFactory.js.map +1 -0
- package/dist/src/factories/EventNotificationTypeFactory.d.ts +11 -0
- package/dist/src/factories/EventNotificationTypeFactory.d.ts.map +1 -0
- package/dist/src/factories/EventNotificationTypeFactory.js +25 -0
- package/dist/src/factories/EventNotificationTypeFactory.js.map +1 -0
- package/dist/src/factories/PlatformEventTypeFactory.d.ts +10 -0
- package/dist/src/factories/PlatformEventTypeFactory.d.ts.map +1 -0
- package/dist/src/factories/PlatformEventTypeFactory.js +23 -0
- package/dist/src/factories/PlatformEventTypeFactory.js.map +1 -0
- package/dist/src/factories/RecordAnswerFactory.d.ts +17 -0
- package/dist/src/factories/RecordAnswerFactory.d.ts.map +1 -0
- package/dist/src/factories/RecordAnswerFactory.js +95 -0
- package/dist/src/factories/RecordAnswerFactory.js.map +1 -0
- package/dist/src/factories/RecordCategoryFactory.d.ts +11 -0
- package/dist/src/factories/RecordCategoryFactory.d.ts.map +1 -0
- package/dist/src/factories/RecordCategoryFactory.js +23 -0
- package/dist/src/factories/RecordCategoryFactory.js.map +1 -0
- package/dist/src/factories/RecordFactory.d.ts +7 -6
- package/dist/src/factories/RecordFactory.d.ts.map +1 -1
- package/dist/src/factories/RecordFactory.js +10 -4
- package/dist/src/factories/RecordFactory.js.map +1 -1
- package/dist/src/factories/RegistrationPeriodFactory.d.ts +1 -0
- package/dist/src/factories/RegistrationPeriodFactory.d.ts.map +1 -1
- package/dist/src/factories/RegistrationPeriodFactory.js +2 -0
- package/dist/src/factories/RegistrationPeriodFactory.js.map +1 -1
- package/dist/src/factories/index.d.ts +7 -0
- package/dist/src/factories/index.d.ts.map +1 -1
- package/dist/src/factories/index.js +7 -0
- package/dist/src/factories/index.js.map +1 -1
- package/dist/src/helpers/DNSValidator.d.ts.map +1 -1
- package/dist/src/helpers/DNSValidator.js +57 -55
- package/dist/src/helpers/DNSValidator.js.map +1 -1
- package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
- package/dist/src/helpers/EmailBuilder.js +2 -1
- package/dist/src/helpers/EmailBuilder.js.map +1 -1
- package/dist/src/migrations/1741954610-event-notifications-accepted-record-answers.sql +2 -0
- package/dist/src/migrations/1742393831-default-template-partially-accepted-event-notification.sql +2 -0
- package/dist/src/migrations/1742579832-audit-log-longer-object-size.sql +3 -0
- package/dist/src/models/EventNotification.d.ts +4 -0
- package/dist/src/models/EventNotification.d.ts.map +1 -1
- package/dist/src/models/EventNotification.js +7 -0
- package/dist/src/models/EventNotification.js.map +1 -1
- package/dist/src/models/Organization.d.ts +1 -0
- package/dist/src/models/Organization.d.ts.map +1 -1
- package/dist/src/models/Organization.js +13 -4
- package/dist/src/models/Organization.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/factories/EmailTemplateFactory.ts +47 -0
- package/src/factories/EventFactory.ts +31 -0
- package/src/factories/EventNotificationFactory.ts +51 -0
- package/src/factories/EventNotificationTypeFactory.ts +26 -0
- package/src/factories/PlatformEventTypeFactory.ts +23 -0
- package/src/factories/RecordAnswerFactory.ts +113 -0
- package/src/factories/RecordCategoryFactory.ts +23 -0
- package/src/factories/RecordFactory.ts +14 -8
- package/src/factories/RegistrationPeriodFactory.ts +2 -0
- package/src/factories/index.ts +7 -0
- package/src/helpers/DNSValidator.ts +62 -56
- package/src/helpers/EmailBuilder.ts +2 -1
- package/src/migrations/1741954610-event-notifications-accepted-record-answers.sql +2 -0
- package/src/migrations/1742393831-default-template-partially-accepted-event-notification.sql +2 -0
- package/src/migrations/1742579832-audit-log-longer-object-size.sql +3 -0
- package/src/models/EventNotification.ts +6 -0
- package/src/models/Organization.ts +15 -5
|
@@ -41,6 +41,12 @@ export class EventNotification extends QueryableModel {
|
|
|
41
41
|
@column({ type: 'json', decoder: new MapDecoder(StringDecoder, RecordAnswerDecoder) })
|
|
42
42
|
recordAnswers: Map<string, RecordAnswer> = new Map();
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Contains the answers of an event notification that were accepted
|
|
46
|
+
*/
|
|
47
|
+
@column({ type: 'json', decoder: new MapDecoder(StringDecoder, RecordAnswerDecoder) })
|
|
48
|
+
acceptedRecordAnswers: Map<string, RecordAnswer> = new Map();
|
|
49
|
+
|
|
44
50
|
@column({ type: 'string', nullable: true })
|
|
45
51
|
createdBy: string | null = null;
|
|
46
52
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { column, Database } from '@simonbackx/simple-database';
|
|
2
2
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
3
3
|
import { I18n } from '@stamhoofd/backend-i18n';
|
|
4
|
-
import {
|
|
4
|
+
import { EmailInterfaceRecipient } from '@stamhoofd/email';
|
|
5
5
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
6
6
|
import { Address, Country, DNSRecordStatus, EmailTemplateType, OrganizationEmail, OrganizationMetaData, OrganizationPrivateMetaData, Organization as OrganizationStruct, PaymentMethod, PaymentProvider, PrivatePaymentConfiguration, Recipient, Replacement, STPackageType, TransferSettings } from '@stamhoofd/structures';
|
|
7
7
|
import { AWSError } from 'aws-sdk';
|
|
@@ -10,6 +10,7 @@ import { PromiseResult } from 'aws-sdk/lib/request';
|
|
|
10
10
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
11
|
|
|
12
12
|
import { QueueHandler } from '@stamhoofd/queues';
|
|
13
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
13
14
|
import { validateDNSRecords } from '../helpers/DNSValidator';
|
|
14
15
|
import { sendEmailTemplate } from '../helpers/EmailBuilder';
|
|
15
16
|
import { OrganizationServerMetaData } from '../structures/OrganizationServerMetaData';
|
|
@@ -460,9 +461,17 @@ export class Organization extends QueryableModel {
|
|
|
460
461
|
});
|
|
461
462
|
}
|
|
462
463
|
|
|
464
|
+
static get forbiddenEmailDomains() {
|
|
465
|
+
return [
|
|
466
|
+
STAMHOOFD.domains.dashboard,
|
|
467
|
+
...Object.values(STAMHOOFD.domains.defaultBroadcastEmail ?? {}),
|
|
468
|
+
...Object.values(STAMHOOFD.domains.defaultTransactionalEmail ?? {}),
|
|
469
|
+
];
|
|
470
|
+
}
|
|
471
|
+
|
|
463
472
|
async deleteAWSMailIdenitity(mailDomain: string) {
|
|
464
473
|
// Protect specific domain names
|
|
465
|
-
if (
|
|
474
|
+
if (Organization.forbiddenEmailDomains.includes(mailDomain.toLowerCase())) {
|
|
466
475
|
return;
|
|
467
476
|
}
|
|
468
477
|
|
|
@@ -523,6 +532,7 @@ export class Organization extends QueryableModel {
|
|
|
523
532
|
}
|
|
524
533
|
|
|
525
534
|
const sesv2 = new SES();
|
|
535
|
+
const expectedConfigurationSetName = Formatter.slug(STAMHOOFD.platformName + '-domains');
|
|
526
536
|
|
|
527
537
|
// Check if mail identitiy already exists..
|
|
528
538
|
let exists = false;
|
|
@@ -535,7 +545,7 @@ export class Organization extends QueryableModel {
|
|
|
535
545
|
|
|
536
546
|
console.log('AWS mail idenitiy exists already: just checking the verification status in AWS @' + this.id);
|
|
537
547
|
|
|
538
|
-
if (existing.ConfigurationSetName !==
|
|
548
|
+
if (existing.ConfigurationSetName !== expectedConfigurationSetName) {
|
|
539
549
|
// Not allowed to use this identity
|
|
540
550
|
this.privateMeta.mailDomainActive = false;
|
|
541
551
|
console.error('Organization is not allowed to use email identity ' + this.privateMeta.mailDomain + ' @' + this.id + ', got ' + existing.ConfigurationSetName);
|
|
@@ -567,10 +577,10 @@ export class Organization extends QueryableModel {
|
|
|
567
577
|
|
|
568
578
|
const result = await sesv2.createEmailIdentity({
|
|
569
579
|
EmailIdentity: this.privateMeta.mailDomain,
|
|
570
|
-
ConfigurationSetName:
|
|
580
|
+
ConfigurationSetName: expectedConfigurationSetName,
|
|
571
581
|
DkimSigningAttributes: {
|
|
572
582
|
DomainSigningPrivateKey: this.serverMeta.privateDKIMKey!,
|
|
573
|
-
DomainSigningSelector:
|
|
583
|
+
DomainSigningSelector: Formatter.slug(STAMHOOFD.platformName),
|
|
574
584
|
},
|
|
575
585
|
Tags: [
|
|
576
586
|
{
|