@wraps.dev/cli 1.1.2 → 1.1.4
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 +113 -25
- package/dist/cli.js.map +1 -1
- package/dist/lambda/event-processor/.bundled +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -598,7 +598,7 @@ To remove: wraps destroy --stack ${stackName}`,
|
|
|
598
598
|
noStack: () => new WrapsError(
|
|
599
599
|
"No Wraps infrastructure found in this AWS account",
|
|
600
600
|
"NO_STACK",
|
|
601
|
-
"Run: wraps init\nTo deploy new infrastructure",
|
|
601
|
+
"Run: wraps email init\nTo deploy new infrastructure",
|
|
602
602
|
"https://wraps.dev/docs/cli/init"
|
|
603
603
|
),
|
|
604
604
|
pulumiNotInstalled: () => new WrapsError(
|
|
@@ -2225,7 +2225,9 @@ import * as aws from "@pulumi/aws";
|
|
|
2225
2225
|
async function tableExists(tableName) {
|
|
2226
2226
|
try {
|
|
2227
2227
|
const { DynamoDBClient: DynamoDBClient4, DescribeTableCommand: DescribeTableCommand2 } = await import("@aws-sdk/client-dynamodb");
|
|
2228
|
-
const dynamodb2 = new DynamoDBClient4({
|
|
2228
|
+
const dynamodb2 = new DynamoDBClient4({
|
|
2229
|
+
region: process.env.AWS_REGION || "us-east-1"
|
|
2230
|
+
});
|
|
2229
2231
|
await dynamodb2.send(new DescribeTableCommand2({ TableName: tableName }));
|
|
2230
2232
|
return true;
|
|
2231
2233
|
} catch (error) {
|
|
@@ -2362,7 +2364,9 @@ import * as pulumi2 from "@pulumi/pulumi";
|
|
|
2362
2364
|
async function roleExists(roleName) {
|
|
2363
2365
|
try {
|
|
2364
2366
|
const { IAMClient: IAMClient2, GetRoleCommand } = await import("@aws-sdk/client-iam");
|
|
2365
|
-
const iam4 = new IAMClient2({
|
|
2367
|
+
const iam4 = new IAMClient2({
|
|
2368
|
+
region: process.env.AWS_REGION || "us-east-1"
|
|
2369
|
+
});
|
|
2366
2370
|
await iam4.send(new GetRoleCommand({ RoleName: roleName }));
|
|
2367
2371
|
return true;
|
|
2368
2372
|
} catch (error) {
|
|
@@ -2545,7 +2549,9 @@ function getPackageRoot() {
|
|
|
2545
2549
|
async function lambdaFunctionExists(functionName) {
|
|
2546
2550
|
try {
|
|
2547
2551
|
const { LambdaClient: LambdaClient2, GetFunctionCommand } = await import("@aws-sdk/client-lambda");
|
|
2548
|
-
const lambda2 = new LambdaClient2({
|
|
2552
|
+
const lambda2 = new LambdaClient2({
|
|
2553
|
+
region: process.env.AWS_REGION || "us-east-1"
|
|
2554
|
+
});
|
|
2549
2555
|
await lambda2.send(new GetFunctionCommand({ FunctionName: functionName }));
|
|
2550
2556
|
return true;
|
|
2551
2557
|
} catch (error) {
|
|
@@ -2559,7 +2565,9 @@ async function lambdaFunctionExists(functionName) {
|
|
|
2559
2565
|
async function findEventSourceMapping(functionName, queueArn) {
|
|
2560
2566
|
try {
|
|
2561
2567
|
const { LambdaClient: LambdaClient2, ListEventSourceMappingsCommand } = await import("@aws-sdk/client-lambda");
|
|
2562
|
-
const lambda2 = new LambdaClient2({
|
|
2568
|
+
const lambda2 = new LambdaClient2({
|
|
2569
|
+
region: process.env.AWS_REGION || "us-east-1"
|
|
2570
|
+
});
|
|
2563
2571
|
const response = await lambda2.send(
|
|
2564
2572
|
new ListEventSourceMappingsCommand({
|
|
2565
2573
|
FunctionName: functionName,
|
|
@@ -2969,7 +2977,9 @@ import * as aws7 from "@pulumi/aws";
|
|
|
2969
2977
|
async function getExistingOIDCProviderArn(url) {
|
|
2970
2978
|
try {
|
|
2971
2979
|
const { IAMClient: IAMClient2, ListOpenIDConnectProvidersCommand } = await import("@aws-sdk/client-iam");
|
|
2972
|
-
const iam4 = new IAMClient2({
|
|
2980
|
+
const iam4 = new IAMClient2({
|
|
2981
|
+
region: process.env.AWS_REGION || "us-east-1"
|
|
2982
|
+
});
|
|
2973
2983
|
const response = await iam4.send(new ListOpenIDConnectProvidersCommand({}));
|
|
2974
2984
|
const expectedArnSuffix = url.replace("https://", "");
|
|
2975
2985
|
const provider = response.OpenIDConnectProviderList?.find(
|
|
@@ -3679,7 +3689,7 @@ async function config(options) {
|
|
|
3679
3689
|
`No Wraps connection found for account ${pc3.cyan(identity.accountId)} in region ${pc3.cyan(region)}`
|
|
3680
3690
|
);
|
|
3681
3691
|
clack3.log.info(
|
|
3682
|
-
`Use ${pc3.cyan("wraps init")} to create new infrastructure or ${pc3.cyan("wraps connect")} to connect existing.`
|
|
3692
|
+
`Use ${pc3.cyan("wraps email init")} to create new infrastructure or ${pc3.cyan("wraps email connect")} to connect existing.`
|
|
3683
3693
|
);
|
|
3684
3694
|
process.exit(1);
|
|
3685
3695
|
}
|
|
@@ -3771,7 +3781,8 @@ ${pc3.bold("Current Configuration:")}
|
|
|
3771
3781
|
{
|
|
3772
3782
|
workDir: getPulumiWorkDir(),
|
|
3773
3783
|
envVars: {
|
|
3774
|
-
PULUMI_CONFIG_PASSPHRASE: ""
|
|
3784
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
3785
|
+
AWS_REGION: region
|
|
3775
3786
|
},
|
|
3776
3787
|
secretsProvider: "passphrase"
|
|
3777
3788
|
}
|
|
@@ -4114,7 +4125,7 @@ async function connect(options) {
|
|
|
4114
4125
|
if (scan.identities.length === 0) {
|
|
4115
4126
|
clack5.log.warn("No SES identities found in this region.");
|
|
4116
4127
|
clack5.log.info(
|
|
4117
|
-
`Use ${pc5.cyan("wraps init")} to create new email infrastructure instead.`
|
|
4128
|
+
`Use ${pc5.cyan("wraps email init")} to create new email infrastructure instead.`
|
|
4118
4129
|
);
|
|
4119
4130
|
process.exit(0);
|
|
4120
4131
|
}
|
|
@@ -4146,6 +4157,10 @@ async function connect(options) {
|
|
|
4146
4157
|
const emailConfig = preset === "custom" ? await Promise.resolve().then(() => (init_prompts(), prompts_exports)).then(
|
|
4147
4158
|
(m) => m.promptCustomConfig()
|
|
4148
4159
|
) : getPreset(preset);
|
|
4160
|
+
const domainIdentities = selectedIdentities.filter((id) => !id.includes("@"));
|
|
4161
|
+
if (domainIdentities.length > 0) {
|
|
4162
|
+
emailConfig.domain = domainIdentities[0];
|
|
4163
|
+
}
|
|
4149
4164
|
if (!options.yes) {
|
|
4150
4165
|
const confirmed = await confirmConnect();
|
|
4151
4166
|
if (!confirmed) {
|
|
@@ -4186,7 +4201,8 @@ async function connect(options) {
|
|
|
4186
4201
|
{
|
|
4187
4202
|
workDir: getPulumiWorkDir(),
|
|
4188
4203
|
envVars: {
|
|
4189
|
-
PULUMI_CONFIG_PASSPHRASE: ""
|
|
4204
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
4205
|
+
AWS_REGION: region
|
|
4190
4206
|
},
|
|
4191
4207
|
secretsProvider: "passphrase"
|
|
4192
4208
|
}
|
|
@@ -4216,7 +4232,7 @@ async function connect(options) {
|
|
|
4216
4232
|
clack5.log.warn("\nThe Pulumi stack is locked from a previous run.");
|
|
4217
4233
|
clack5.log.info("To fix this, run:");
|
|
4218
4234
|
clack5.log.info(` ${pc5.cyan("rm -rf ~/.wraps/pulumi/.pulumi/locks")}`);
|
|
4219
|
-
clack5.log.info("\nThen try running wraps connect again.");
|
|
4235
|
+
clack5.log.info("\nThen try running wraps email connect again.");
|
|
4220
4236
|
}
|
|
4221
4237
|
throw new Error(`Pulumi deployment failed: ${error.message}`);
|
|
4222
4238
|
}
|
|
@@ -4818,8 +4834,9 @@ ${pc7.yellow(pc7.bold("Configuration Warnings:"))}`);
|
|
|
4818
4834
|
workDir: getPulumiWorkDir(),
|
|
4819
4835
|
// Use local file-based backend (no Pulumi Cloud login required)
|
|
4820
4836
|
envVars: {
|
|
4821
|
-
PULUMI_CONFIG_PASSPHRASE: ""
|
|
4837
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
4822
4838
|
// Use empty passphrase for local state
|
|
4839
|
+
AWS_REGION: region
|
|
4823
4840
|
},
|
|
4824
4841
|
secretsProvider: "passphrase"
|
|
4825
4842
|
}
|
|
@@ -4853,7 +4870,7 @@ ${pc7.yellow(pc7.bold("Configuration Warnings:"))}`);
|
|
|
4853
4870
|
clack7.log.warn("\nThe Pulumi stack is locked from a previous run.");
|
|
4854
4871
|
clack7.log.info("To fix this, run:");
|
|
4855
4872
|
clack7.log.info(` ${pc7.cyan("rm -rf ~/.wraps/pulumi/.pulumi/locks")}`);
|
|
4856
|
-
clack7.log.info("\nThen try running wraps init again.");
|
|
4873
|
+
clack7.log.info("\nThen try running wraps email init again.");
|
|
4857
4874
|
}
|
|
4858
4875
|
throw new Error(`Pulumi deployment failed: ${error.message}`);
|
|
4859
4876
|
}
|
|
@@ -4938,7 +4955,7 @@ async function restore(options) {
|
|
|
4938
4955
|
`No Wraps connection found for account ${pc8.cyan(identity.accountId)} in region ${pc8.cyan(region)}`
|
|
4939
4956
|
);
|
|
4940
4957
|
clack8.log.info(
|
|
4941
|
-
`Use ${pc8.cyan("wraps init")} or ${pc8.cyan("wraps connect")} to create a connection first.`
|
|
4958
|
+
`Use ${pc8.cyan("wraps email init")} or ${pc8.cyan("wraps email connect")} to create a connection first.`
|
|
4942
4959
|
);
|
|
4943
4960
|
process.exit(1);
|
|
4944
4961
|
}
|
|
@@ -4988,7 +5005,8 @@ ${pc8.bold("The following Wraps resources will be removed:")}
|
|
|
4988
5005
|
{
|
|
4989
5006
|
workDir: getPulumiWorkDir(),
|
|
4990
5007
|
envVars: {
|
|
4991
|
-
PULUMI_CONFIG_PASSPHRASE: ""
|
|
5008
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
5009
|
+
AWS_REGION: region
|
|
4992
5010
|
},
|
|
4993
5011
|
secretsProvider: "passphrase"
|
|
4994
5012
|
}
|
|
@@ -5052,7 +5070,7 @@ async function upgrade(options) {
|
|
|
5052
5070
|
`No Wraps connection found for account ${pc9.cyan(identity.accountId)} in region ${pc9.cyan(region)}`
|
|
5053
5071
|
);
|
|
5054
5072
|
clack9.log.info(
|
|
5055
|
-
`Use ${pc9.cyan("wraps init")} to create new infrastructure or ${pc9.cyan("wraps connect")} to connect existing.`
|
|
5073
|
+
`Use ${pc9.cyan("wraps email init")} to create new infrastructure or ${pc9.cyan("wraps email connect")} to connect existing.`
|
|
5056
5074
|
);
|
|
5057
5075
|
process.exit(1);
|
|
5058
5076
|
}
|
|
@@ -5367,7 +5385,7 @@ ${pc9.bold("Current Configuration:")}
|
|
|
5367
5385
|
"No sending domain configured. You must configure a sending domain before adding a custom tracking domain."
|
|
5368
5386
|
);
|
|
5369
5387
|
clack9.log.info(
|
|
5370
|
-
`Use ${pc9.cyan("wraps init")} to set up a sending domain first.`
|
|
5388
|
+
`Use ${pc9.cyan("wraps email init")} to set up a sending domain first.`
|
|
5371
5389
|
);
|
|
5372
5390
|
process.exit(1);
|
|
5373
5391
|
}
|
|
@@ -5712,7 +5730,8 @@ ${pc9.bold("Cost Impact:")}`);
|
|
|
5712
5730
|
{
|
|
5713
5731
|
workDir: getPulumiWorkDir(),
|
|
5714
5732
|
envVars: {
|
|
5715
|
-
PULUMI_CONFIG_PASSPHRASE: ""
|
|
5733
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
5734
|
+
AWS_REGION: region
|
|
5716
5735
|
},
|
|
5717
5736
|
secretsProvider: "passphrase"
|
|
5718
5737
|
}
|
|
@@ -7080,7 +7099,7 @@ async function dashboard(options) {
|
|
|
7080
7099
|
progress.stop();
|
|
7081
7100
|
clack10.log.error("No Wraps infrastructure found");
|
|
7082
7101
|
console.log(
|
|
7083
|
-
`\\nRun ${pc10.cyan("wraps init")} to deploy infrastructure first.\\n`
|
|
7102
|
+
`\\nRun ${pc10.cyan("wraps email init")} to deploy infrastructure first.\\n`
|
|
7084
7103
|
);
|
|
7085
7104
|
process.exit(1);
|
|
7086
7105
|
}
|
|
@@ -7174,7 +7193,7 @@ async function destroy(options) {
|
|
|
7174
7193
|
clack11.outro(pc11.green("All Wraps infrastructure has been removed"));
|
|
7175
7194
|
console.log(
|
|
7176
7195
|
`
|
|
7177
|
-
Run ${pc11.cyan("wraps init")} to deploy infrastructure again.
|
|
7196
|
+
Run ${pc11.cyan("wraps email init")} to deploy infrastructure again.
|
|
7178
7197
|
`
|
|
7179
7198
|
);
|
|
7180
7199
|
}
|
|
@@ -7203,9 +7222,11 @@ async function status(_options) {
|
|
|
7203
7222
|
} catch (_error) {
|
|
7204
7223
|
progress.stop();
|
|
7205
7224
|
clack12.log.error("No Wraps infrastructure found");
|
|
7206
|
-
console.log(
|
|
7207
|
-
|
|
7208
|
-
|
|
7225
|
+
console.log(
|
|
7226
|
+
`
|
|
7227
|
+
Run ${pc12.cyan("wraps email init")} to deploy infrastructure.
|
|
7228
|
+
`
|
|
7229
|
+
);
|
|
7209
7230
|
process.exit(1);
|
|
7210
7231
|
}
|
|
7211
7232
|
const domains = await listSESDomains(region);
|
|
@@ -7270,7 +7291,7 @@ function printCompletionScript() {
|
|
|
7270
7291
|
console.log("# For now, here are the available commands:\n");
|
|
7271
7292
|
console.log("# Commands:");
|
|
7272
7293
|
console.log(
|
|
7273
|
-
"# wraps init [--provider vercel|aws|railway|other] [--region <region>] [--domain <domain>]"
|
|
7294
|
+
"# wraps email init [--provider vercel|aws|railway|other] [--region <region>] [--domain <domain>]"
|
|
7274
7295
|
);
|
|
7275
7296
|
console.log("# wraps status [--account <account-id>]");
|
|
7276
7297
|
console.log("# wraps completion\n");
|
|
@@ -7402,7 +7423,74 @@ args.options([
|
|
|
7402
7423
|
var flags = args.parse(process.argv);
|
|
7403
7424
|
var [primaryCommand, subCommand] = args.sub;
|
|
7404
7425
|
if (!primaryCommand) {
|
|
7405
|
-
|
|
7426
|
+
async function selectService() {
|
|
7427
|
+
clack13.intro(pc13.bold(`WRAPS CLI v${VERSION}`));
|
|
7428
|
+
console.log("Welcome! Let's get started deploying your infrastructure.\n");
|
|
7429
|
+
const service = await clack13.select({
|
|
7430
|
+
message: "Which service would you like to set up?",
|
|
7431
|
+
options: [
|
|
7432
|
+
{
|
|
7433
|
+
value: "email",
|
|
7434
|
+
label: "Email",
|
|
7435
|
+
hint: "AWS SES email infrastructure"
|
|
7436
|
+
},
|
|
7437
|
+
{
|
|
7438
|
+
value: "sms",
|
|
7439
|
+
label: "SMS",
|
|
7440
|
+
hint: "Coming soon - AWS End User Messaging"
|
|
7441
|
+
}
|
|
7442
|
+
]
|
|
7443
|
+
});
|
|
7444
|
+
if (clack13.isCancel(service)) {
|
|
7445
|
+
clack13.cancel("Operation cancelled.");
|
|
7446
|
+
process.exit(0);
|
|
7447
|
+
}
|
|
7448
|
+
if (service === "sms") {
|
|
7449
|
+
clack13.log.warn("SMS infrastructure is coming soon!");
|
|
7450
|
+
console.log(
|
|
7451
|
+
`
|
|
7452
|
+
Check back soon or follow our progress at ${pc13.cyan("https://github.com/wraps-team/wraps")}
|
|
7453
|
+
`
|
|
7454
|
+
);
|
|
7455
|
+
process.exit(0);
|
|
7456
|
+
}
|
|
7457
|
+
const action = await clack13.select({
|
|
7458
|
+
message: "What would you like to do?",
|
|
7459
|
+
options: [
|
|
7460
|
+
{
|
|
7461
|
+
value: "init",
|
|
7462
|
+
label: "Deploy new infrastructure",
|
|
7463
|
+
hint: "Create new AWS SES infrastructure"
|
|
7464
|
+
},
|
|
7465
|
+
{
|
|
7466
|
+
value: "connect",
|
|
7467
|
+
label: "Connect existing infrastructure",
|
|
7468
|
+
hint: "Connect to existing AWS SES setup"
|
|
7469
|
+
}
|
|
7470
|
+
]
|
|
7471
|
+
});
|
|
7472
|
+
if (clack13.isCancel(action)) {
|
|
7473
|
+
clack13.cancel("Operation cancelled.");
|
|
7474
|
+
process.exit(0);
|
|
7475
|
+
}
|
|
7476
|
+
if (action === "init") {
|
|
7477
|
+
await init({
|
|
7478
|
+
provider: flags.provider,
|
|
7479
|
+
region: flags.region,
|
|
7480
|
+
domain: flags.domain,
|
|
7481
|
+
preset: flags.preset,
|
|
7482
|
+
yes: flags.yes
|
|
7483
|
+
});
|
|
7484
|
+
} else {
|
|
7485
|
+
await connect({
|
|
7486
|
+
provider: flags.provider,
|
|
7487
|
+
region: flags.region,
|
|
7488
|
+
yes: flags.yes
|
|
7489
|
+
});
|
|
7490
|
+
}
|
|
7491
|
+
}
|
|
7492
|
+
selectService().catch(handleCLIError);
|
|
7493
|
+
process.exit(0);
|
|
7406
7494
|
}
|
|
7407
7495
|
async function run() {
|
|
7408
7496
|
try {
|