@wraps.dev/cli 2.11.8 → 2.11.9

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
@@ -95,7 +95,7 @@ async function stateBucketExists(accountId, region) {
95
95
  await client.send(new HeadBucketCommand({ Bucket: bucketName }));
96
96
  return true;
97
97
  } catch (error) {
98
- if (error.name === "NotFound" || error.name === "NoSuchBucket" || error.$metadata?.httpStatusCode === 404) {
98
+ if (error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || error.$metadata?.httpStatusCode === 404)) {
99
99
  return false;
100
100
  }
101
101
  throw error;
@@ -117,7 +117,8 @@ async function ensureStateBucket(accountId, region) {
117
117
  await client.send(new HeadBucketCommand({ Bucket: bucketName }));
118
118
  return bucketName;
119
119
  } catch (error) {
120
- if (error.name !== "NotFound" && error.name !== "NoSuchBucket" && error.$metadata?.httpStatusCode !== 404) {
120
+ const isNotFound = error instanceof Error && (error.name === "NotFound" || error.name === "NoSuchBucket" || error.$metadata?.httpStatusCode === 404);
121
+ if (!isNotFound) {
121
122
  throw error;
122
123
  }
123
124
  }
@@ -204,7 +205,7 @@ async function downloadMetadata(bucketName, accountId, region) {
204
205
  }
205
206
  return JSON.parse(body);
206
207
  } catch (error) {
207
- if (error.name === "NoSuchKey" || error.$metadata?.httpStatusCode === 404) {
208
+ if (error instanceof Error && (error.name === "NoSuchKey" || error.$metadata?.httpStatusCode === 404)) {
208
209
  return null;
209
210
  }
210
211
  throw error;
@@ -277,7 +278,7 @@ async function migrateLocalPulumiState(localPulumiDir, bucketName, accountId, re
277
278
  await s3Stack.importStack(state);
278
279
  } catch (error) {
279
280
  console.error(
280
- `Warning: Failed to migrate stack ${stackName}: ${error.message}`
281
+ `Warning: Failed to migrate stack ${stackName}: ${error instanceof Error ? error.message : error}`
281
282
  );
282
283
  }
283
284
  }
@@ -351,7 +352,7 @@ async function ensurePulumiWorkDir(options) {
351
352
  } catch (error) {
352
353
  const clack47 = await import("@clack/prompts");
353
354
  clack47.log.warn(
354
- `S3 state backend unavailable (${error.message}). Using local state.`
355
+ `S3 state backend unavailable (${error instanceof Error ? error.message : error}). Using local state.`
355
356
  );
356
357
  }
357
358
  }
@@ -1815,7 +1816,7 @@ async function isSESSandbox(region) {
1815
1816
  );
1816
1817
  return false;
1817
1818
  } catch (error) {
1818
- if (error.name === "InvalidParameterValue") {
1819
+ if (error instanceof Error && error.name === "InvalidParameterValue") {
1819
1820
  return true;
1820
1821
  }
1821
1822
  throw error;
@@ -4057,7 +4058,10 @@ async function loadConnectionMetadata(accountId, region) {
4057
4058
  localData = data;
4058
4059
  }
4059
4060
  } catch (error) {
4060
- console.error("Error loading connection metadata:", error.message);
4061
+ console.error(
4062
+ "Error loading connection metadata:",
4063
+ error instanceof Error ? error.message : error
4064
+ );
4061
4065
  }
4062
4066
  }
4063
4067
  if (process.env.WRAPS_LOCAL_ONLY !== "1") {
@@ -4115,7 +4119,10 @@ async function saveConnectionMetadata(metadata) {
4115
4119
  const content = JSON.stringify(metadata, null, 2);
4116
4120
  await writeFile3(metadataPath, content, "utf-8");
4117
4121
  } catch (error) {
4118
- console.error("Error saving connection metadata:", error.message);
4122
+ console.error(
4123
+ "Error saving connection metadata:",
4124
+ error instanceof Error ? error.message : error
4125
+ );
4119
4126
  throw error;
4120
4127
  }
4121
4128
  if (process.env.WRAPS_LOCAL_ONLY !== "1") {
@@ -4165,7 +4172,10 @@ async function listConnections() {
4165
4172
  }
4166
4173
  return connections;
4167
4174
  } catch (error) {
4168
- console.error("Error listing connections:", error.message);
4175
+ console.error(
4176
+ "Error listing connections:",
4177
+ error instanceof Error ? error.message : error
4178
+ );
4169
4179
  return [];
4170
4180
  }
4171
4181
  }
@@ -15335,7 +15345,7 @@ async function configurationSetExists(configSetName, region) {
15335
15345
  );
15336
15346
  return true;
15337
15347
  } catch (error) {
15338
- if (error.name === "NotFoundException") {
15348
+ if (error instanceof Error && error.name === "NotFoundException") {
15339
15349
  return false;
15340
15350
  }
15341
15351
  console.error("Error checking for existing configuration set:", error);
@@ -15353,7 +15363,7 @@ async function eventDestinationExists(configSetName, eventDestName, region) {
15353
15363
  );
15354
15364
  return response.EventDestinations?.some((dest) => dest.Name === eventDestName) ?? false;
15355
15365
  } catch (error) {
15356
- if (error.name === "NotFoundException") {
15366
+ if (error instanceof Error && error.name === "NotFoundException") {
15357
15367
  return false;
15358
15368
  }
15359
15369
  return false;
@@ -15368,7 +15378,7 @@ async function emailIdentityExists(emailIdentity, region) {
15368
15378
  );
15369
15379
  return true;
15370
15380
  } catch (error) {
15371
- if (error.name === "NotFoundException") {
15381
+ if (error instanceof Error && error.name === "NotFoundException") {
15372
15382
  return false;
15373
15383
  }
15374
15384
  console.error("Error checking for existing email identity:", error);
@@ -15543,7 +15553,7 @@ async function userExists(userName) {
15543
15553
  await iam9.send(new GetUserCommand({ UserName: userName }));
15544
15554
  return true;
15545
15555
  } catch (error) {
15546
- if (error.name === "NoSuchEntityException" || error.Code === "NoSuchEntity") {
15556
+ if (error instanceof Error && (error.name === "NoSuchEntityException" || error.Code === "NoSuchEntity")) {
15547
15557
  return false;
15548
15558
  }
15549
15559
  return false;
@@ -16194,7 +16204,10 @@ async function scanSESIdentities(region) {
16194
16204
  }
16195
16205
  return identities;
16196
16206
  } catch (error) {
16197
- console.error("Error scanning SES identities:", error.message);
16207
+ console.error(
16208
+ "Error scanning SES identities:",
16209
+ error instanceof Error ? error.message : error
16210
+ );
16198
16211
  return [];
16199
16212
  }
16200
16213
  }
@@ -16221,12 +16234,18 @@ async function scanSESConfigurationSets(region) {
16221
16234
  eventDestinations
16222
16235
  });
16223
16236
  } catch (error) {
16224
- console.error(`Error describing config set ${name}:`, error.message);
16237
+ console.error(
16238
+ `Error describing config set ${name}:`,
16239
+ error instanceof Error ? error.message : error
16240
+ );
16225
16241
  }
16226
16242
  }
16227
16243
  return configSets;
16228
16244
  } catch (error) {
16229
- console.error("Error scanning SES configuration sets:", error.message);
16245
+ console.error(
16246
+ "Error scanning SES configuration sets:",
16247
+ error instanceof Error ? error.message : error
16248
+ );
16230
16249
  return [];
16231
16250
  }
16232
16251
  }
@@ -16254,13 +16273,16 @@ async function scanSNSTopics(region) {
16254
16273
  } catch (error) {
16255
16274
  console.error(
16256
16275
  `Error getting topic attributes for ${arn}:`,
16257
- error.message
16276
+ error instanceof Error ? error.message : error
16258
16277
  );
16259
16278
  }
16260
16279
  }
16261
16280
  return topics;
16262
16281
  } catch (error) {
16263
- console.error("Error scanning SNS topics:", error.message);
16282
+ console.error(
16283
+ "Error scanning SNS topics:",
16284
+ error instanceof Error ? error.message : error
16285
+ );
16264
16286
  return [];
16265
16287
  }
16266
16288
  }
@@ -16285,12 +16307,18 @@ async function scanDynamoTables(region) {
16285
16307
  });
16286
16308
  }
16287
16309
  } catch (error) {
16288
- console.error(`Error describing table ${name}:`, error.message);
16310
+ console.error(
16311
+ `Error describing table ${name}:`,
16312
+ error instanceof Error ? error.message : error
16313
+ );
16289
16314
  }
16290
16315
  }
16291
16316
  return tables;
16292
16317
  } catch (error) {
16293
- console.error("Error scanning DynamoDB tables:", error.message);
16318
+ console.error(
16319
+ "Error scanning DynamoDB tables:",
16320
+ error instanceof Error ? error.message : error
16321
+ );
16294
16322
  return [];
16295
16323
  }
16296
16324
  }
@@ -16312,7 +16340,10 @@ async function scanLambdaFunctions(region) {
16312
16340
  }
16313
16341
  return functions;
16314
16342
  } catch (error) {
16315
- console.error("Error scanning Lambda functions:", error.message);
16343
+ console.error(
16344
+ "Error scanning Lambda functions:",
16345
+ error instanceof Error ? error.message : error
16346
+ );
16316
16347
  return [];
16317
16348
  }
16318
16349
  }
@@ -16344,7 +16375,10 @@ async function scanIAMRoles(region) {
16344
16375
  }
16345
16376
  return roles;
16346
16377
  } catch (error) {
16347
- console.error("Error scanning IAM roles:", error.message);
16378
+ console.error(
16379
+ "Error scanning IAM roles:",
16380
+ error instanceof Error ? error.message : error
16381
+ );
16348
16382
  return [];
16349
16383
  }
16350
16384
  }
@@ -27035,7 +27069,7 @@ function createSettingsRouter(config2) {
27035
27069
  });
27036
27070
  } catch (error) {
27037
27071
  console.error("[Verify] Error verifying tracking domain:", error);
27038
- if (error.code === "ENODATA" || error.code === "ENOTFOUND") {
27072
+ if (error instanceof Error && (error.code === "ENODATA" || error.code === "ENOTFOUND")) {
27039
27073
  return res.json({
27040
27074
  verified: false,
27041
27075
  error: "No CNAME record found for this domain"
@@ -27069,7 +27103,7 @@ function createSettingsRouter(config2) {
27069
27103
  });
27070
27104
  } catch (error) {
27071
27105
  console.error("[Verify] Error verifying DMARC:", error);
27072
- if (error.code === "ENODATA" || error.code === "ENOTFOUND") {
27106
+ if (error instanceof Error && (error.code === "ENODATA" || error.code === "ENOTFOUND")) {
27073
27107
  return res.json({
27074
27108
  verified: false,
27075
27109
  error: "No DMARC record found for this domain"