@wraps.dev/cli 2.20.0 → 2.20.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/cli.js CHANGED
@@ -7270,7 +7270,8 @@ function domainToConfigSetName(domain) {
7270
7270
  return `${PREFIX}${slug}`;
7271
7271
  }
7272
7272
  const hash = createHash("sha256").update(domain).digest("hex").slice(0, 8);
7273
- const slugPart = slug.length > MAX_SLUG_WITH_HASH ? slug.slice(0, MAX_SLUG_WITH_HASH) : slug;
7273
+ const rawSlugPart = slug.length > MAX_SLUG_WITH_HASH ? slug.slice(0, MAX_SLUG_WITH_HASH) : slug;
7274
+ const slugPart = rawSlugPart.replace(/-+$/, "");
7274
7275
  return `${PREFIX}${slugPart}-${hash}`;
7275
7276
  }
7276
7277
  var PREFIX, MAX_LENGTH, MAX_SLUG, MAX_SLUG_WITH_HASH;
@@ -9710,9 +9711,9 @@ var init_test = __esm({
9710
9711
  "use strict";
9711
9712
  init_esm_shims();
9712
9713
  init_events();
9714
+ init_config_set_slug();
9713
9715
  init_ses_simulator();
9714
9716
  init_verification();
9715
- init_config_set_slug();
9716
9717
  init_aws();
9717
9718
  init_errors();
9718
9719
  init_json_output();
@@ -19587,7 +19588,10 @@ async function emailDestroy(options) {
19587
19588
  try {
19588
19589
  const { SQSClient, GetQueueUrlCommand, DeleteQueueCommand } = await import("@aws-sdk/client-sqs");
19589
19590
  const sqsClient = new SQSClient({ region });
19590
- for (const queueName of ["wraps-email-events", "wraps-email-events-dlq"]) {
19591
+ for (const queueName of [
19592
+ "wraps-email-events",
19593
+ "wraps-email-events-dlq"
19594
+ ]) {
19591
19595
  try {
19592
19596
  const { QueueUrl } = await sqsClient.send(
19593
19597
  new GetQueueUrlCommand({ QueueName: queueName })
@@ -19601,6 +19605,21 @@ async function emailDestroy(options) {
19601
19605
  } catch {
19602
19606
  }
19603
19607
  }
19608
+ try {
19609
+ const { SESv2Client: SESv2Client9, DeleteConfigurationSetCommand: DeleteConfigSet } = await import("@aws-sdk/client-sesv2");
19610
+ const sesv22 = new SESv2Client9({ region });
19611
+ const additionalDomains = emailConfig?.additionalDomains ?? [];
19612
+ for (const d of additionalDomains) {
19613
+ if (!d.configSetName) continue;
19614
+ try {
19615
+ await sesv22.send(
19616
+ new DeleteConfigSet({ ConfigurationSetName: d.configSetName })
19617
+ );
19618
+ } catch {
19619
+ }
19620
+ }
19621
+ } catch {
19622
+ }
19604
19623
  await deleteConnectionMetadata(identity.accountId, region);
19605
19624
  progress.stop();
19606
19625
  if (isJsonMode()) {
@@ -19968,13 +19987,13 @@ init_esm_shims();
19968
19987
  init_client();
19969
19988
  init_events();
19970
19989
  init_dns();
19990
+ init_config_set_slug();
19971
19991
  init_aws();
19972
19992
  init_errors();
19973
19993
  init_json_output();
19974
19994
  init_metadata();
19975
19995
  init_output();
19976
19996
  init_prompts();
19977
- init_config_set_slug();
19978
19997
  import { Resolver as Resolver2 } from "dns/promises";
19979
19998
  import {
19980
19999
  CreateConfigurationSetCommand,
@@ -20465,7 +20484,8 @@ Run ${pc23.cyan("wraps email init")} first to deploy email infrastructure.
20465
20484
  })
20466
20485
  );
20467
20486
  } catch (err) {
20468
- if (err.name !== "AlreadyExistsException") throw err;
20487
+ if (err.name !== "AlreadyExistsException")
20488
+ throw err;
20469
20489
  }
20470
20490
  try {
20471
20491
  await sesClient.send(
@@ -20480,7 +20500,8 @@ Run ${pc23.cyan("wraps email init")} first to deploy email infrastructure.
20480
20500
  })
20481
20501
  );
20482
20502
  } catch (err) {
20483
- if (err.name !== "AlreadyExistsException") throw err;
20503
+ if (err.name !== "AlreadyExistsException")
20504
+ throw err;
20484
20505
  }
20485
20506
  });
20486
20507
  if (domainAlreadyExists) {
@@ -22631,9 +22652,17 @@ async function init2(options) {
22631
22652
  if (!options.quick && preset !== "custom" && emailConfig.tracking?.enabled) {
22632
22653
  const purpose = await promptDomainPurpose();
22633
22654
  if (purpose === "transactional") {
22634
- emailConfig.tracking = { ...emailConfig.tracking, opens: false, clicks: false };
22655
+ emailConfig.tracking = {
22656
+ ...emailConfig.tracking,
22657
+ opens: false,
22658
+ clicks: false
22659
+ };
22635
22660
  } else if (purpose === "marketing" || purpose === "notifications") {
22636
- emailConfig.tracking = { ...emailConfig.tracking, opens: true, clicks: true };
22661
+ emailConfig.tracking = {
22662
+ ...emailConfig.tracking,
22663
+ opens: true,
22664
+ clicks: true
22665
+ };
22637
22666
  } else {
22638
22667
  const trackOpens = await clack26.confirm({
22639
22668
  message: "Track email opens?",
@@ -27735,14 +27764,19 @@ ${pc35.bold("SMTP Credentials for Legacy Systems")}
27735
27764
  await progress.execute(
27736
27765
  `Creating config set for ${d.domain}`,
27737
27766
  async () => {
27738
- await sesClient.send(
27739
- new CreateConfigurationSetCommand2({
27740
- ConfigurationSetName: configSetName,
27741
- SuppressionOptions: {
27742
- SuppressedReasons: ["BOUNCE", "COMPLAINT"]
27743
- }
27744
- })
27745
- );
27767
+ try {
27768
+ await sesClient.send(
27769
+ new CreateConfigurationSetCommand2({
27770
+ ConfigurationSetName: configSetName,
27771
+ SuppressionOptions: {
27772
+ SuppressedReasons: ["BOUNCE", "COMPLAINT"]
27773
+ }
27774
+ })
27775
+ );
27776
+ } catch (err) {
27777
+ if (err.name !== "AlreadyExistsException")
27778
+ throw err;
27779
+ }
27746
27780
  }
27747
27781
  );
27748
27782
  const allEvents = [
@@ -27765,17 +27799,22 @@ ${pc35.bold("SMTP Credentials for Legacy Systems")}
27765
27799
  await progress.execute(
27766
27800
  `Adding EventBridge destination for ${d.domain}`,
27767
27801
  async () => {
27768
- await sesClient.send(
27769
- new CreateConfigurationSetEventDestinationCommand2({
27770
- ConfigurationSetName: configSetName,
27771
- EventDestinationName: "wraps-eventbridge",
27772
- EventDestination: {
27773
- Enabled: true,
27774
- MatchingEventTypes: matchingEventTypes,
27775
- EventBridgeDestination: { EventBusArn: eventBusArn }
27776
- }
27777
- })
27778
- );
27802
+ try {
27803
+ await sesClient.send(
27804
+ new CreateConfigurationSetEventDestinationCommand2({
27805
+ ConfigurationSetName: configSetName,
27806
+ EventDestinationName: "wraps-email-eventbridge",
27807
+ EventDestination: {
27808
+ Enabled: true,
27809
+ MatchingEventTypes: matchingEventTypes,
27810
+ EventBridgeDestination: { EventBusArn: eventBusArn }
27811
+ }
27812
+ })
27813
+ );
27814
+ } catch (err) {
27815
+ if (err.name !== "AlreadyExistsException")
27816
+ throw err;
27817
+ }
27779
27818
  }
27780
27819
  );
27781
27820
  d.configSetName = configSetName;