@wraps.dev/cli 2.18.12 → 2.18.13

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
@@ -461,7 +461,9 @@ function classifyDNSError(error) {
461
461
  return "unknown";
462
462
  }
463
463
  function isAWSNotFoundError(error) {
464
- if (!(error instanceof Error)) return false;
464
+ if (!(error instanceof Error)) {
465
+ return false;
466
+ }
465
467
  const awsError = error;
466
468
  return error.name === "NotFoundException" || error.name === "NoSuchEntityException" || error.name === "NoSuchEntity" || error.name === "ResourceNotFoundException" || awsError.$metadata?.httpStatusCode === 404;
467
469
  }
@@ -3616,7 +3618,9 @@ var init_cloudflare = __esm({
3616
3618
  */
3617
3619
  async getCAARecords() {
3618
3620
  const zoneName = await this.getZoneName();
3619
- if (!zoneName) return [];
3621
+ if (!zoneName) {
3622
+ return [];
3623
+ }
3620
3624
  const result = await this.request(
3621
3625
  "/dns_records?type=CAA"
3622
3626
  );
@@ -3659,7 +3663,9 @@ var init_cloudflare = __esm({
3659
3663
  */
3660
3664
  async addAmazonCAARecord() {
3661
3665
  const zoneName = await this.getZoneName();
3662
- if (!zoneName) return false;
3666
+ if (!zoneName) {
3667
+ return false;
3668
+ }
3663
3669
  const body = {
3664
3670
  name: zoneName,
3665
3671
  type: "CAA",
@@ -4198,6 +4204,7 @@ async function createDNSRecordsForProvider(credentials, data, selectedCategories
4198
4204
  "dkim",
4199
4205
  "spf",
4200
4206
  "dmarc",
4207
+ "tracking",
4201
4208
  "mailfrom_mx",
4202
4209
  "mailfrom_spf",
4203
4210
  "inbound_mx",
@@ -4223,6 +4230,9 @@ async function createDNSRecordsForProvider(credentials, data, selectedCategories
4223
4230
  if (categories.has("dmarc")) {
4224
4231
  recordsCreated += 1;
4225
4232
  }
4233
+ if (data.customTrackingDomain && categories.has("tracking")) {
4234
+ recordsCreated += 1;
4235
+ }
4226
4236
  if (data.mailFromDomain) {
4227
4237
  if (categories.has("mailfrom_mx")) {
4228
4238
  recordsCreated += 1;
@@ -6552,7 +6562,9 @@ var init_output = __esm({
6552
6562
  * Start a spinner with a message
6553
6563
  */
6554
6564
  start(message) {
6555
- if (this.silent) return;
6565
+ if (this.silent) {
6566
+ return;
6567
+ }
6556
6568
  if (this.currentSpinner) {
6557
6569
  this.currentSpinner.stop("");
6558
6570
  this.currentSpinner = null;
@@ -6564,7 +6576,9 @@ var init_output = __esm({
6564
6576
  * Mark current step as succeeded
6565
6577
  */
6566
6578
  succeed(message) {
6567
- if (this.silent) return;
6579
+ if (this.silent) {
6580
+ return;
6581
+ }
6568
6582
  if (this.currentSpinner) {
6569
6583
  this.currentSpinner.stop(message);
6570
6584
  }
@@ -6574,7 +6588,9 @@ var init_output = __esm({
6574
6588
  * Mark current step as failed
6575
6589
  */
6576
6590
  fail(message) {
6577
- if (this.silent) return;
6591
+ if (this.silent) {
6592
+ return;
6593
+ }
6578
6594
  if (this.currentSpinner) {
6579
6595
  this.currentSpinner.stop(message);
6580
6596
  }
@@ -6584,14 +6600,18 @@ var init_output = __esm({
6584
6600
  * Show info message
6585
6601
  */
6586
6602
  info(message) {
6587
- if (this.silent) return;
6603
+ if (this.silent) {
6604
+ return;
6605
+ }
6588
6606
  clack8.log.info(message);
6589
6607
  }
6590
6608
  /**
6591
6609
  * Show step message
6592
6610
  */
6593
6611
  step(message) {
6594
- if (this.silent) return;
6612
+ if (this.silent) {
6613
+ return;
6614
+ }
6595
6615
  clack8.log.step(message);
6596
6616
  }
6597
6617
  /**
@@ -6616,7 +6636,9 @@ var init_output = __esm({
6616
6636
  * Stop the spinner
6617
6637
  */
6618
6638
  stop(message) {
6619
- if (this.silent) return;
6639
+ if (this.silent) {
6640
+ return;
6641
+ }
6620
6642
  if (this.currentSpinner) {
6621
6643
  this.currentSpinner.stop(message || "");
6622
6644
  }
@@ -6642,11 +6664,15 @@ import { promisify } from "util";
6642
6664
  import { PulumiCommand } from "@pulumi/pulumi/automation/index.js";
6643
6665
  function findSdkInstalledPulumi() {
6644
6666
  const versionsDir = join7(homedir3(), ".pulumi", "versions");
6645
- if (!existsSync6(versionsDir)) return;
6667
+ if (!existsSync6(versionsDir)) {
6668
+ return;
6669
+ }
6646
6670
  const versions = readdirSync2(versionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort().reverse();
6647
6671
  for (const version of versions) {
6648
6672
  const binPath = join7(versionsDir, version, "bin", "pulumi");
6649
- if (existsSync6(binPath)) return dirname2(binPath);
6673
+ if (existsSync6(binPath)) {
6674
+ return dirname2(binPath);
6675
+ }
6650
6676
  }
6651
6677
  return;
6652
6678
  }
@@ -7447,7 +7473,7 @@ async function checkCertificateValidation(domain) {
7447
7473
  return describeResponse.Certificate?.Status === "ISSUED";
7448
7474
  }
7449
7475
  return false;
7450
- } catch (error) {
7476
+ } catch (_error) {
7451
7477
  return false;
7452
7478
  }
7453
7479
  }
@@ -7524,7 +7550,9 @@ async function getCertificateValidationRecords(domain) {
7524
7550
  })
7525
7551
  );
7526
7552
  const options = describeResponse.Certificate?.DomainValidationOptions ?? [];
7527
- return options.filter((opt) => opt.ResourceRecord?.Name && opt.ResourceRecord?.Value).map((opt) => ({
7553
+ return options.filter(
7554
+ (opt) => !!opt.ResourceRecord?.Name && !!opt.ResourceRecord?.Value
7555
+ ).map((opt) => ({
7528
7556
  name: opt.ResourceRecord.Name,
7529
7557
  type: opt.ResourceRecord.Type ?? "CNAME",
7530
7558
  value: opt.ResourceRecord.Value
@@ -8854,11 +8882,21 @@ async function runPreflightScan(region, domain) {
8854
8882
  const existing = checkWrapsResourcesExist(filtered);
8855
8883
  let hasConflicts = false;
8856
8884
  const resourceTypes = [];
8857
- if (existing.hasConfigSet) resourceTypes.push("config set");
8858
- if (existing.hasSNSTopics) resourceTypes.push("SNS topic");
8859
- if (existing.hasDynamoTable) resourceTypes.push("DynamoDB table");
8860
- if (existing.hasLambdaFunctions) resourceTypes.push("Lambda function");
8861
- if (existing.hasIAMRole) resourceTypes.push("IAM role");
8885
+ if (existing.hasConfigSet) {
8886
+ resourceTypes.push("config set");
8887
+ }
8888
+ if (existing.hasSNSTopics) {
8889
+ resourceTypes.push("SNS topic");
8890
+ }
8891
+ if (existing.hasDynamoTable) {
8892
+ resourceTypes.push("DynamoDB table");
8893
+ }
8894
+ if (existing.hasLambdaFunctions) {
8895
+ resourceTypes.push("Lambda function");
8896
+ }
8897
+ if (existing.hasIAMRole) {
8898
+ resourceTypes.push("IAM role");
8899
+ }
8862
8900
  if (resourceTypes.length > 0) {
8863
8901
  hasConflicts = true;
8864
8902
  clack23.log.warn(
@@ -9137,6 +9175,9 @@ Run ${pc27.cyan("wraps email init")} to set up a domain.
9137
9175
  let domain;
9138
9176
  if (trackedDomains.length === 1) {
9139
9177
  domain = trackedDomains[0].domain;
9178
+ } else if (isJsonMode()) {
9179
+ const primaryTrackedDomain = trackedDomains.find((trackedDomain) => trackedDomain.isPrimary) || trackedDomains[0];
9180
+ domain = primaryTrackedDomain.domain;
9140
9181
  } else {
9141
9182
  const selected = await clack25.select({
9142
9183
  message: "Which domain do you want to send from?",
@@ -11880,7 +11921,7 @@ async function createServiceIAMRole(config2) {
11880
11921
  const serviceStatement = JSON.stringify({
11881
11922
  Effect: "Allow",
11882
11923
  Principal: {
11883
- Service: config2.additionalVercelPrincipals.length === 1 ? config2.additionalVercelPrincipals[0] : config2.additionalVercelPrincipals
11924
+ Service: config2.additionalVercelPrincipals?.length === 1 ? config2.additionalVercelPrincipals?.[0] : config2.additionalVercelPrincipals
11884
11925
  },
11885
11926
  Action: "sts:AssumeRole"
11886
11927
  });
@@ -15449,11 +15490,13 @@ function formatX509Name(name) {
15449
15490
  return "";
15450
15491
  }
15451
15492
  const parts = [];
15452
- if (name.O) {
15453
- parts.push(name.O);
15493
+ const o = Array.isArray(name.O) ? name.O[0] : name.O;
15494
+ if (o) {
15495
+ parts.push(o);
15454
15496
  }
15455
- if (name.CN) {
15456
- parts.push(name.CN);
15497
+ const cn = Array.isArray(name.CN) ? name.CN[0] : name.CN;
15498
+ if (cn) {
15499
+ parts.push(cn);
15457
15500
  }
15458
15501
  return parts.join(" - ") || JSON.stringify(name);
15459
15502
  }
@@ -16056,9 +16099,15 @@ function calculateScore(checks) {
16056
16099
  };
16057
16100
  }
16058
16101
  function assessSpf(spf) {
16059
- if (!spf.exists || spf.multipleRecords || !spf.valid) return "missing";
16060
- if (spf.allMechanism === "+all" || spf.hasCircularInclude) return "missing";
16061
- if (spf.allMechanism === "?all") return "weak";
16102
+ if (!spf.exists || spf.multipleRecords || !spf.valid) {
16103
+ return "missing";
16104
+ }
16105
+ if (spf.allMechanism === "+all" || spf.hasCircularInclude) {
16106
+ return "missing";
16107
+ }
16108
+ if (spf.allMechanism === "?all") {
16109
+ return "weak";
16110
+ }
16062
16111
  return "present";
16063
16112
  }
16064
16113
  function assessDkim(checks) {
@@ -16072,17 +16121,25 @@ function assessDkim(checks) {
16072
16121
  return usesAwsSes ? "weak" : "missing";
16073
16122
  }
16074
16123
  function assessDmarc(dmarc) {
16075
- if (!(dmarc.exists && dmarc.valid)) return "missing";
16076
- if (dmarc.policy === "reject" || dmarc.policy === "quarantine") return "good";
16124
+ if (!(dmarc.exists && dmarc.valid)) {
16125
+ return "missing";
16126
+ }
16127
+ if (dmarc.policy === "reject" || dmarc.policy === "quarantine") {
16128
+ return "good";
16129
+ }
16077
16130
  return "present";
16078
16131
  }
16079
16132
  function determineGrade(checks) {
16080
- if (checks.spf.allMechanism === "+all") return "F";
16133
+ if (checks.spf.allMechanism === "+all") {
16134
+ return "F";
16135
+ }
16081
16136
  const hasSpamhausListing = [
16082
16137
  ...checks.blacklist.domainChecks.listed,
16083
16138
  ...checks.blacklist.ipChecks.listed
16084
16139
  ].some((l) => l.zone.includes("spamhaus"));
16085
- if (hasSpamhausListing) return "F";
16140
+ if (hasSpamhausListing) {
16141
+ return "F";
16142
+ }
16086
16143
  const spf = assessSpf(checks.spf);
16087
16144
  const dkim = assessDkim(checks);
16088
16145
  const dmarc = assessDmarc(checks.dmarc);
@@ -16090,9 +16147,15 @@ function determineGrade(checks) {
16090
16147
  if (spf === "present" && (dkim === "present" || dkim === "good") && dmarc === "good") {
16091
16148
  return "A";
16092
16149
  }
16093
- if (presentCount === 3) return "B";
16094
- if (presentCount === 2) return "C";
16095
- if (presentCount === 1) return "D";
16150
+ if (presentCount === 3) {
16151
+ return "B";
16152
+ }
16153
+ if (presentCount === 2) {
16154
+ return "C";
16155
+ }
16156
+ if (presentCount === 1) {
16157
+ return "D";
16158
+ }
16096
16159
  return "F";
16097
16160
  }
16098
16161
  function collectSpfIssues(spf, deductions) {
@@ -20730,6 +20793,9 @@ async function inboundInit(options) {
20730
20793
  let domain;
20731
20794
  if (trackedDomains.length === 1) {
20732
20795
  domain = trackedDomains[0].domain;
20796
+ } else if (options.yes || isJsonMode()) {
20797
+ const primaryTrackedDomain = trackedDomains.find((trackedDomain) => trackedDomain.isPrimary) || trackedDomains[0];
20798
+ domain = primaryTrackedDomain.domain;
20733
20799
  } else {
20734
20800
  const selected = await clack22.select({
20735
20801
  message: "Which domain do you want to receive email on?",
@@ -24969,7 +25035,7 @@ ${pc34.bold("Current Configuration:")}
24969
25035
  upgradeOptions.push({
24970
25036
  value: "finish-tracking-domain",
24971
25037
  label: "Finish setting up custom tracking domain",
24972
- hint: `Complete HTTPS setup for ${config2.tracking.customRedirectDomain}`
25038
+ hint: `Complete HTTPS setup for ${config2.tracking?.customRedirectDomain}`
24973
25039
  });
24974
25040
  }
24975
25041
  upgradeOptions.push(
@@ -25051,7 +25117,7 @@ ${pc34.bold("Current Configuration:")}
25051
25117
  switch (upgradeAction) {
25052
25118
  case "finish-tracking-domain": {
25053
25119
  clack32.log.info(
25054
- `Checking certificate status for ${pc34.cyan(config2.tracking.customRedirectDomain)}...`
25120
+ `Checking certificate status for ${pc34.cyan(config2.tracking?.customRedirectDomain ?? "")}...`
25055
25121
  );
25056
25122
  updatedConfig = { ...config2 };
25057
25123
  newPreset = metadata.services.email?.preset;
@@ -31525,7 +31591,9 @@ function createInboundRouter(config2) {
31525
31591
  })
31526
31592
  );
31527
31593
  const body = await getResponse.Body?.transformToString();
31528
- if (!body) throw new Error("Empty body");
31594
+ if (!body) {
31595
+ throw new Error("Empty body");
31596
+ }
31529
31597
  const parsed = JSON.parse(body);
31530
31598
  return {
31531
31599
  emailId: parsed.emailId,
@@ -31569,7 +31637,9 @@ function createInboundRouter(config2) {
31569
31637
  })
31570
31638
  );
31571
31639
  const body = await getResponse.Body?.transformToString();
31572
- if (!body) throw new Error("Empty body");
31640
+ if (!body) {
31641
+ throw new Error("Empty body");
31642
+ }
31573
31643
  const parsed = JSON.parse(body);
31574
31644
  res.json(parsed);
31575
31645
  } catch (error) {