@wraps.dev/cli 2.17.14 → 2.17.16

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
@@ -83,6 +83,13 @@ __export(s3_state_exports, {
83
83
  import { existsSync, statSync } from "fs";
84
84
  import { readdir, writeFile } from "fs/promises";
85
85
  import { join } from "path";
86
+ function has404StatusCode(error) {
87
+ if (!(error instanceof Error)) {
88
+ return false;
89
+ }
90
+ const metadataError = error;
91
+ return metadataError.$metadata?.httpStatusCode === 404;
92
+ }
86
93
  function getStateBucketName(accountId, region) {
87
94
  return `wraps-state-${accountId}-${region}`;
88
95
  }
@@ -97,7 +104,7 @@ async function stateBucketExists(accountId, region) {
97
104
  await client.send(new HeadBucketCommand({ Bucket: bucketName }));
98
105
  return true;
99
106
  } catch (error) {
100
- if (error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || error.$metadata?.httpStatusCode === 404)) {
107
+ if (error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || has404StatusCode(error))) {
101
108
  return false;
102
109
  }
103
110
  throw error;
@@ -119,7 +126,7 @@ async function ensureStateBucket(accountId, region) {
119
126
  await client.send(new HeadBucketCommand({ Bucket: bucketName }));
120
127
  return bucketName;
121
128
  } catch (error) {
122
- const isNotFound = error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || error.$metadata?.httpStatusCode === 404);
129
+ const isNotFound = error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || has404StatusCode(error));
123
130
  if (!isNotFound) {
124
131
  throw error;
125
132
  }
@@ -239,7 +246,7 @@ async function downloadMetadata(bucketName, accountId, region) {
239
246
  }
240
247
  return JSON.parse(body);
241
248
  } catch (error) {
242
- if (error instanceof Error && (error.name === "NoSuchKey" || error.$metadata?.httpStatusCode === 404)) {
249
+ if (error instanceof Error && (error.name === "NoSuchKey" || has404StatusCode(error))) {
243
250
  return null;
244
251
  }
245
252
  throw error;
@@ -1291,7 +1298,8 @@ function classifyDNSError(error) {
1291
1298
  }
1292
1299
  function isAWSNotFoundError(error) {
1293
1300
  if (!(error instanceof Error)) return false;
1294
- return error.name === "NotFoundException" || error.name === "NoSuchEntityException" || error.name === "NoSuchEntity" || error.name === "ResourceNotFoundException" || error.$metadata?.httpStatusCode === 404;
1301
+ const awsError = error;
1302
+ return error.name === "NotFoundException" || error.name === "NoSuchEntityException" || error.name === "NoSuchEntity" || error.name === "ResourceNotFoundException" || awsError.$metadata?.httpStatusCode === 404;
1295
1303
  }
1296
1304
  function isPulumiError(error) {
1297
1305
  if (!(error instanceof Error)) {
@@ -4416,9 +4424,13 @@ function createConnectionMetadata(accountId, region, provider, emailConfig, pres
4416
4424
  }
4417
4425
  };
4418
4426
  }
4427
+ function setConfigValue(config2, key, value) {
4428
+ config2[key] = value;
4429
+ }
4419
4430
  function applyConfigUpdates(existingConfig, updates) {
4420
4431
  const result = { ...existingConfig };
4421
- for (const [key, value] of Object.entries(updates)) {
4432
+ for (const key of Object.keys(updates)) {
4433
+ const value = updates[key];
4422
4434
  if (value === void 0) {
4423
4435
  continue;
4424
4436
  }
@@ -4472,7 +4484,7 @@ function applyConfigUpdates(existingConfig, updates) {
4472
4484
  ...value
4473
4485
  };
4474
4486
  } else {
4475
- result[key] = value;
4487
+ setConfigValue(result, key, value);
4476
4488
  }
4477
4489
  }
4478
4490
  return result;
@@ -17077,7 +17089,8 @@ async function userExists(userName) {
17077
17089
  await iam10.send(new GetUserCommand({ UserName: userName }));
17078
17090
  return true;
17079
17091
  } catch (error) {
17080
- if (error instanceof Error && (error.name === "NoSuchEntityException" || error.Code === "NoSuchEntity")) {
17092
+ const iamError = error;
17093
+ if (error instanceof Error && (iamError.name === "NoSuchEntityException" || iamError.Code === "NoSuchEntity")) {
17081
17094
  return false;
17082
17095
  }
17083
17096
  return false;
@@ -30815,6 +30828,13 @@ async function fetchEmailSettings(roleArn, region, configSetName, domain) {
30815
30828
  }
30816
30829
 
30817
30830
  // src/console/routes/settings.ts
30831
+ function isMissingDnsRecordError(error) {
30832
+ if (!(error instanceof Error)) {
30833
+ return false;
30834
+ }
30835
+ const dnsError = error;
30836
+ return dnsError.code === "ENODATA" || dnsError.code === "ENOTFOUND";
30837
+ }
30818
30838
  function createSettingsRouter(config2) {
30819
30839
  const router = createRouter6();
30820
30840
  router.get("/deployment", async (_req, res) => {
@@ -30883,7 +30903,7 @@ function createSettingsRouter(config2) {
30883
30903
  });
30884
30904
  } catch (error) {
30885
30905
  console.error("[Verify] Error verifying tracking domain:", error);
30886
- if (error instanceof Error && (error.code === "ENODATA" || error.code === "ENOTFOUND")) {
30906
+ if (isMissingDnsRecordError(error)) {
30887
30907
  return res.json({
30888
30908
  verified: false,
30889
30909
  error: "No CNAME record found for this domain"
@@ -30917,7 +30937,7 @@ function createSettingsRouter(config2) {
30917
30937
  });
30918
30938
  } catch (error) {
30919
30939
  console.error("[Verify] Error verifying DMARC:", error);
30920
- if (error instanceof Error && (error.code === "ENODATA" || error.code === "ENOTFOUND")) {
30940
+ if (isMissingDnsRecordError(error)) {
30921
30941
  return res.json({
30922
30942
  verified: false,
30923
30943
  error: "No DMARC record found for this domain"