@wraps.dev/cli 2.19.5 → 2.19.7
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/cli.js
CHANGED
|
@@ -7869,6 +7869,7 @@ __export(mail_manager_exports, {
|
|
|
7869
7869
|
createMailManagerArchive: () => createMailManagerArchive
|
|
7870
7870
|
});
|
|
7871
7871
|
import {
|
|
7872
|
+
ArchiveState,
|
|
7872
7873
|
CreateArchiveCommand,
|
|
7873
7874
|
GetArchiveCommand,
|
|
7874
7875
|
ListArchivesCommand,
|
|
@@ -7918,73 +7919,62 @@ function retentionToAWSPeriod2(retention) {
|
|
|
7918
7919
|
}
|
|
7919
7920
|
async function createMailManagerArchive(config2) {
|
|
7920
7921
|
const region = config2.region;
|
|
7921
|
-
const
|
|
7922
|
+
const baseArchiveName = `wraps-${config2.name}-archive`;
|
|
7923
|
+
const namePattern = new RegExp(`^${baseArchiveName}(-\\d+)?$`);
|
|
7924
|
+
const MAX_NAME_ATTEMPTS = 10;
|
|
7922
7925
|
const mailManagerClient = new MailManagerClient({ region });
|
|
7923
7926
|
const sesClient = new SESv2Client3({ region });
|
|
7924
7927
|
const kmsKeyArn = config2.kmsKeyArn;
|
|
7925
|
-
if (!kmsKeyArn) {
|
|
7926
|
-
}
|
|
7927
7928
|
const awsRetention = retentionToAWSPeriod2(config2.retention);
|
|
7928
7929
|
let archiveId;
|
|
7929
7930
|
let archiveArn;
|
|
7930
7931
|
try {
|
|
7931
|
-
const
|
|
7932
|
-
const
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
)
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7932
|
+
const listResult = await mailManagerClient.send(new ListArchivesCommand({}));
|
|
7933
|
+
const existing = listResult.Archives?.find(
|
|
7934
|
+
(a) => a.ArchiveState === ArchiveState.ACTIVE && a.ArchiveName !== void 0 && namePattern.test(a.ArchiveName)
|
|
7935
|
+
);
|
|
7936
|
+
if (existing?.ArchiveId) {
|
|
7937
|
+
console.log(`Using existing Mail Manager archive: ${existing.ArchiveName}`);
|
|
7938
|
+
archiveId = existing.ArchiveId;
|
|
7939
|
+
const getResult = await mailManagerClient.send(
|
|
7940
|
+
new GetArchiveCommand({ ArchiveId: archiveId })
|
|
7941
|
+
);
|
|
7941
7942
|
archiveArn = getResult.ArchiveArn;
|
|
7942
7943
|
}
|
|
7943
7944
|
} catch (error) {
|
|
7944
7945
|
console.log("Error checking for existing archive:", error);
|
|
7945
7946
|
}
|
|
7946
7947
|
if (!archiveId) {
|
|
7947
|
-
|
|
7948
|
-
const
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
archiveId = archiveResult.ArchiveId;
|
|
7962
|
-
if (!archiveId) {
|
|
7963
|
-
throw new Error(
|
|
7964
|
-
"Failed to create Mail Manager Archive: No ArchiveId returned"
|
|
7965
|
-
);
|
|
7966
|
-
}
|
|
7967
|
-
console.log(`Created new Mail Manager archive: ${archiveName}`);
|
|
7968
|
-
} catch (error) {
|
|
7969
|
-
if (error instanceof Error && error.name === "ConflictException" && error.message.includes("Archive already exists")) {
|
|
7970
|
-
console.log(
|
|
7971
|
-
"Archive was created concurrently, fetching existing archive..."
|
|
7972
|
-
);
|
|
7973
|
-
const listCommand = new ListArchivesCommand({});
|
|
7974
|
-
const listResult = await mailManagerClient.send(listCommand);
|
|
7975
|
-
const existingArchive = listResult.Archives?.find(
|
|
7976
|
-
(archive) => archive.ArchiveName === archiveName
|
|
7948
|
+
for (let attempt = 1; attempt <= MAX_NAME_ATTEMPTS; attempt++) {
|
|
7949
|
+
const archiveName = attempt === 1 ? baseArchiveName : `${baseArchiveName}-${attempt}`;
|
|
7950
|
+
try {
|
|
7951
|
+
const result = await mailManagerClient.send(
|
|
7952
|
+
new CreateArchiveCommand({
|
|
7953
|
+
ArchiveName: archiveName,
|
|
7954
|
+
Retention: { RetentionPeriod: awsRetention },
|
|
7955
|
+
...kmsKeyArn && { KmsKeyArn: kmsKeyArn },
|
|
7956
|
+
Tags: [
|
|
7957
|
+
{ Key: "ManagedBy", Value: "wraps-cli" },
|
|
7958
|
+
{ Key: "Name", Value: archiveName },
|
|
7959
|
+
{ Key: "Retention", Value: config2.retention }
|
|
7960
|
+
]
|
|
7961
|
+
})
|
|
7977
7962
|
);
|
|
7978
|
-
|
|
7963
|
+
archiveId = result.ArchiveId;
|
|
7964
|
+
if (!archiveId) {
|
|
7979
7965
|
throw new Error(
|
|
7980
|
-
|
|
7966
|
+
"Failed to create Mail Manager Archive: No ArchiveId returned"
|
|
7981
7967
|
);
|
|
7982
7968
|
}
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7969
|
+
console.log(`Created new Mail Manager archive: ${archiveName}`);
|
|
7970
|
+
break;
|
|
7971
|
+
} catch (error) {
|
|
7972
|
+
if (error instanceof Error && error.name === "ConflictException" && attempt < MAX_NAME_ATTEMPTS) {
|
|
7973
|
+
console.log(
|
|
7974
|
+
`Archive '${archiveName}' is unavailable, trying '${baseArchiveName}-${attempt + 1}'...`
|
|
7975
|
+
);
|
|
7976
|
+
continue;
|
|
7977
|
+
}
|
|
7988
7978
|
throw error;
|
|
7989
7979
|
}
|
|
7990
7980
|
}
|
|
@@ -7993,25 +7983,23 @@ async function createMailManagerArchive(config2) {
|
|
|
7993
7983
|
const identity = await import("@aws-sdk/client-sts").then(
|
|
7994
7984
|
(m) => new m.STSClient({ region }).send(new m.GetCallerIdentityCommand({}))
|
|
7995
7985
|
);
|
|
7996
|
-
|
|
7997
|
-
archiveArn = `arn:aws:ses:${region}:${accountId}:mailmanager-archive/${archiveId}`;
|
|
7986
|
+
archiveArn = `arn:aws:ses:${region}:${identity.Account}:mailmanager-archive/${archiveId}`;
|
|
7998
7987
|
}
|
|
7999
7988
|
const configSetName = await new Promise((resolve) => {
|
|
8000
|
-
config2.configSetName.apply((name) =>
|
|
8001
|
-
resolve(name);
|
|
8002
|
-
});
|
|
7989
|
+
config2.configSetName.apply((name) => resolve(name));
|
|
8003
7990
|
});
|
|
8004
7991
|
if (!configSetName) {
|
|
8005
7992
|
throw new Error(
|
|
8006
7993
|
"Failed to resolve SES configuration set name from Pulumi output"
|
|
8007
7994
|
);
|
|
8008
7995
|
}
|
|
8009
|
-
const putArchivingOptionsCommand = new PutConfigurationSetArchivingOptionsCommand({
|
|
8010
|
-
ConfigurationSetName: configSetName,
|
|
8011
|
-
ArchiveArn: archiveArn
|
|
8012
|
-
});
|
|
8013
7996
|
try {
|
|
8014
|
-
await sesClient.send(
|
|
7997
|
+
await sesClient.send(
|
|
7998
|
+
new PutConfigurationSetArchivingOptionsCommand({
|
|
7999
|
+
ConfigurationSetName: configSetName,
|
|
8000
|
+
ArchiveArn: archiveArn
|
|
8001
|
+
})
|
|
8002
|
+
);
|
|
8015
8003
|
} catch (error) {
|
|
8016
8004
|
const detail = error instanceof Error ? error.message : String(error);
|
|
8017
8005
|
throw new Error(
|
|
@@ -8021,11 +8009,7 @@ async function createMailManagerArchive(config2) {
|
|
|
8021
8009
|
if (!(archiveId && archiveArn)) {
|
|
8022
8010
|
throw new Error("Failed to get archive ID or ARN");
|
|
8023
8011
|
}
|
|
8024
|
-
return {
|
|
8025
|
-
archiveId,
|
|
8026
|
-
archiveArn,
|
|
8027
|
-
kmsKeyArn
|
|
8028
|
-
};
|
|
8012
|
+
return { archiveId, archiveArn, kmsKeyArn };
|
|
8029
8013
|
}
|
|
8030
8014
|
var init_mail_manager = __esm({
|
|
8031
8015
|
"src/infrastructure/resources/mail-manager.ts"() {
|
|
@@ -14609,7 +14593,15 @@ var DOMAIN_BLACKLISTS = [
|
|
|
14609
14593
|
{ name: "FRESH URI", zone: "fresh.spameatingmonkey.net", priority: "low" },
|
|
14610
14594
|
{ name: "Mailspike Z", zone: "z.mailspike.net", priority: "medium" },
|
|
14611
14595
|
{ name: "SEM Fresh", zone: "fresh.spameatingmonkey.net", priority: "low" },
|
|
14612
|
-
{ name: "SEM URI", zone: "uribl.spameatingmonkey.net", priority: "medium" }
|
|
14596
|
+
{ name: "SEM URI", zone: "uribl.spameatingmonkey.net", priority: "medium" },
|
|
14597
|
+
{ name: "0spam Domain", zone: "bl.0spam.org", priority: "medium" },
|
|
14598
|
+
{ name: "ZapBL RHSBL", zone: "rhsbl.zapbl.net", priority: "low" },
|
|
14599
|
+
{ name: "Swinog URI", zone: "uribl.swinog.ch", priority: "low" },
|
|
14600
|
+
{
|
|
14601
|
+
name: "ScientificSpam RHSBL",
|
|
14602
|
+
zone: "rhsbl.scientificspam.net",
|
|
14603
|
+
priority: "medium"
|
|
14604
|
+
}
|
|
14613
14605
|
];
|
|
14614
14606
|
var IP_BLACKLISTS = [
|
|
14615
14607
|
// Spamhaus (most important)
|
|
@@ -14639,6 +14631,8 @@ var IP_BLACKLISTS = [
|
|
|
14639
14631
|
{ name: "WPBL", zone: "db.wpbl.info", priority: "medium" },
|
|
14640
14632
|
{ name: "Mailspike BL", zone: "bl.mailspike.net", priority: "medium" },
|
|
14641
14633
|
{ name: "Mailspike Z", zone: "z.mailspike.net", priority: "medium" },
|
|
14634
|
+
{ name: "0spam IP", zone: "rbl.0spam.org", priority: "medium" },
|
|
14635
|
+
{ name: "ZapBL", zone: "dnsbl.zapbl.net", priority: "medium" },
|
|
14642
14636
|
// Additional lists
|
|
14643
14637
|
{ name: "JustSpam", zone: "dnsbl.justspam.org", priority: "low" },
|
|
14644
14638
|
{
|
|
@@ -14655,8 +14649,12 @@ var IP_BLACKLISTS = [
|
|
|
14655
14649
|
{ name: "BlockList.de", zone: "bl.blocklist.de", priority: "medium" },
|
|
14656
14650
|
{ name: "DroneBL", zone: "dnsbl.dronebl.org", priority: "low" },
|
|
14657
14651
|
{ name: "InterServer", zone: "rbl.interserver.net", priority: "low" },
|
|
14652
|
+
{ name: "Suomispam", zone: "bl.suomispam.net", priority: "medium" },
|
|
14653
|
+
{ name: "ScientificSpam", zone: "bl.scientificspam.net", priority: "medium" },
|
|
14654
|
+
{ name: "Swinog IP", zone: "dnsrbl.swinog.ch", priority: "medium" },
|
|
14655
|
+
{ name: "Kempt.net", zone: "dnsbl.kempt.net", priority: "low" },
|
|
14656
|
+
{ name: "Anonmails", zone: "spam.dnsbl.anonmails.de", priority: "low" },
|
|
14658
14657
|
// Reputation lists
|
|
14659
|
-
{ name: "NiX Spam", zone: "ix.dnsbl.manitu.net", priority: "low" },
|
|
14660
14658
|
{ name: "Composite BL", zone: "cbl.anti-spam.org.cn", priority: "low" }
|
|
14661
14659
|
];
|
|
14662
14660
|
var DEFAULT_TIMEOUT2 = 5e3;
|
|
@@ -17628,8 +17626,10 @@ async function createDynamoDBTables(config2) {
|
|
|
17628
17626
|
globalSecondaryIndexes: [
|
|
17629
17627
|
{
|
|
17630
17628
|
name: "accountId-sentAt-index",
|
|
17631
|
-
|
|
17632
|
-
|
|
17629
|
+
keySchemas: [
|
|
17630
|
+
{ attributeName: "accountId", keyType: "HASH" },
|
|
17631
|
+
{ attributeName: "sentAt", keyType: "RANGE" }
|
|
17632
|
+
],
|
|
17633
17633
|
projectionType: "ALL"
|
|
17634
17634
|
}
|
|
17635
17635
|
],
|
|
@@ -17659,8 +17659,10 @@ async function createDynamoDBTables(config2) {
|
|
|
17659
17659
|
globalSecondaryIndexes: [
|
|
17660
17660
|
{
|
|
17661
17661
|
name: "accountId-sentAt-index",
|
|
17662
|
-
|
|
17663
|
-
|
|
17662
|
+
keySchemas: [
|
|
17663
|
+
{ attributeName: "accountId", keyType: "HASH" },
|
|
17664
|
+
{ attributeName: "sentAt", keyType: "RANGE" }
|
|
17665
|
+
],
|
|
17664
17666
|
projectionType: "ALL"
|
|
17665
17667
|
}
|
|
17666
17668
|
],
|