@wraps.dev/cli 1.5.2 → 1.5.3

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
@@ -146,7 +146,7 @@ var require_package = __commonJS({
146
146
  "package.json"(exports, module) {
147
147
  module.exports = {
148
148
  name: "@wraps.dev/cli",
149
- version: "1.5.2",
149
+ version: "1.5.3",
150
150
  description: "CLI for deploying Wraps email infrastructure to your AWS account",
151
151
  type: "module",
152
152
  main: "./dist/cli.js",
@@ -5301,6 +5301,7 @@ ${pc6.dim("Example:")}`);
5301
5301
  init_esm_shims();
5302
5302
  init_events();
5303
5303
  init_aws();
5304
+ init_errors();
5304
5305
  import * as clack6 from "@clack/prompts";
5305
5306
  import * as pulumi7 from "@pulumi/pulumi";
5306
5307
  import pc7 from "picocolors";
@@ -5381,16 +5382,19 @@ async function deleteDNSRecords(hostedZoneId, domain, dkimTokens, region, custom
5381
5382
  }
5382
5383
 
5383
5384
  // src/commands/email/destroy.ts
5384
- async function getDkimTokensFromSES(domain, region) {
5385
+ async function getEmailIdentityInfo(domain, region) {
5385
5386
  try {
5386
5387
  const { SESv2Client: SESv2Client5, GetEmailIdentityCommand: GetEmailIdentityCommand4 } = await import("@aws-sdk/client-sesv2");
5387
5388
  const ses = new SESv2Client5({ region });
5388
5389
  const response = await ses.send(
5389
5390
  new GetEmailIdentityCommand4({ EmailIdentity: domain })
5390
5391
  );
5391
- return response.DkimAttributes?.Tokens || [];
5392
+ return {
5393
+ dkimTokens: response.DkimAttributes?.Tokens || [],
5394
+ mailFromDomain: response.MailFromAttributes?.MailFromDomain
5395
+ };
5392
5396
  } catch (_error) {
5393
- return [];
5397
+ return { dkimTokens: [] };
5394
5398
  }
5395
5399
  }
5396
5400
  async function emailDestroy(options) {
@@ -5426,10 +5430,15 @@ async function emailDestroy(options) {
5426
5430
  let shouldCleanDNS = false;
5427
5431
  let hostedZone = null;
5428
5432
  let dkimTokens = [];
5433
+ let mailFromDomain = emailConfig?.mailFromDomain;
5429
5434
  if (domain && !options.preview) {
5430
5435
  hostedZone = await findHostedZone2(domain, region);
5431
5436
  if (hostedZone) {
5432
- dkimTokens = await getDkimTokensFromSES(domain, region);
5437
+ const identityInfo = await getEmailIdentityInfo(domain, region);
5438
+ dkimTokens = identityInfo.dkimTokens;
5439
+ if (!mailFromDomain && identityInfo.mailFromDomain) {
5440
+ mailFromDomain = identityInfo.mailFromDomain;
5441
+ }
5433
5442
  if (!options.force) {
5434
5443
  const cleanDNS = await clack6.confirm({
5435
5444
  message: `Found Route53 hosted zone for ${pc7.cyan(domain)}. Delete DNS records (DKIM, DMARC, MAIL FROM)?`,
@@ -5507,7 +5516,7 @@ async function emailDestroy(options) {
5507
5516
  dkimTokens,
5508
5517
  region,
5509
5518
  emailConfig?.tracking?.customRedirectDomain,
5510
- emailConfig?.mailFromDomain
5519
+ mailFromDomain
5511
5520
  );
5512
5521
  }
5513
5522
  );
@@ -5543,6 +5552,10 @@ async function emailDestroy(options) {
5543
5552
  await deleteConnectionMetadata(identity.accountId, region);
5544
5553
  process.exit(0);
5545
5554
  }
5555
+ if (error.message?.includes("stack is currently locked")) {
5556
+ trackError("STACK_LOCKED", "email destroy", { step: "destroy" });
5557
+ throw errors.stackLocked();
5558
+ }
5546
5559
  trackError("DESTROY_FAILED", "email destroy", { step: "destroy" });
5547
5560
  clack6.log.error("Email infrastructure destruction failed");
5548
5561
  throw error;
@@ -6281,6 +6294,12 @@ ${pc9.yellow(pc9.bold("Configuration Warnings:"))}`);
6281
6294
  }
6282
6295
  if (metadata.services.email) {
6283
6296
  metadata.services.email.pulumiStackName = `wraps-${identity.accountId}-${region}`;
6297
+ if (outputs.mailFromDomain) {
6298
+ metadata.services.email.config.mailFromDomain = outputs.mailFromDomain;
6299
+ }
6300
+ if (outputs.customTrackingDomain && metadata.services.email.config.tracking) {
6301
+ metadata.services.email.config.tracking.customRedirectDomain = outputs.customTrackingDomain;
6302
+ }
6284
6303
  }
6285
6304
  await saveConnectionMetadata(metadata);
6286
6305
  progress.info("Connection metadata saved for upgrade and restore capability");