@wraps.dev/cli 2.18.0 → 2.18.2
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
|
@@ -3245,10 +3245,11 @@ var init_cloudflare = __esm({
|
|
|
3245
3245
|
return response.json();
|
|
3246
3246
|
}
|
|
3247
3247
|
async createRecord(name, type, content, priority) {
|
|
3248
|
+
const recordContent = type === "TXT" ? `"${content}"` : content;
|
|
3248
3249
|
const body = {
|
|
3249
3250
|
name,
|
|
3250
3251
|
type,
|
|
3251
|
-
content,
|
|
3252
|
+
content: recordContent,
|
|
3252
3253
|
ttl: 1800,
|
|
3253
3254
|
proxied: false
|
|
3254
3255
|
// Must not be proxied for email records
|
|
@@ -8470,10 +8471,14 @@ async function promptDNSToken(provider) {
|
|
|
8470
8471
|
console.log();
|
|
8471
8472
|
clack20.log.info(pc22.bold(`${providerName} API Token`));
|
|
8472
8473
|
if (isVercel) {
|
|
8473
|
-
clack20.log.info(
|
|
8474
|
+
clack20.log.info(
|
|
8475
|
+
pc22.dim("Scope: Full Access, or a scoped token with DNS access")
|
|
8476
|
+
);
|
|
8474
8477
|
} else {
|
|
8475
8478
|
clack20.log.info(pc22.dim("Scope: Zone \u2192 DNS \u2192 Edit (for your domain's zone)"));
|
|
8476
|
-
clack20.log.info(
|
|
8479
|
+
clack20.log.info(
|
|
8480
|
+
pc22.dim('Use the "Edit zone DNS" template when creating your token')
|
|
8481
|
+
);
|
|
8477
8482
|
}
|
|
8478
8483
|
clack20.log.info(pc22.dim(`Create one at: ${pc22.cyan(tokenUrl)}`));
|
|
8479
8484
|
const token = await clack20.password({
|
|
@@ -9690,7 +9695,7 @@ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
|
|
|
9690
9695
|
import { join as join21 } from "path";
|
|
9691
9696
|
import { Readable } from "stream";
|
|
9692
9697
|
import { pipeline } from "stream/promises";
|
|
9693
|
-
import { cancel as
|
|
9698
|
+
import { cancel as cancel30, confirm as confirm25, intro as intro50, isCancel as isCancel34, log as log49 } from "@clack/prompts";
|
|
9694
9699
|
import pc57 from "picocolors";
|
|
9695
9700
|
function isStandaloneInstall() {
|
|
9696
9701
|
return process.execPath.includes(".wraps/runtime");
|
|
@@ -9753,7 +9758,7 @@ async function update(currentVersion) {
|
|
|
9753
9758
|
message: `Update to v${latestVersion}?`
|
|
9754
9759
|
});
|
|
9755
9760
|
if (isCancel34(shouldUpdate) || !shouldUpdate) {
|
|
9756
|
-
|
|
9761
|
+
cancel30("Update cancelled.");
|
|
9757
9762
|
return;
|
|
9758
9763
|
}
|
|
9759
9764
|
const { platform: platform2, arch } = detectPlatformArch();
|
|
@@ -18990,6 +18995,7 @@ init_events();
|
|
|
18990
18995
|
init_aws();
|
|
18991
18996
|
init_fs();
|
|
18992
18997
|
init_json_output();
|
|
18998
|
+
init_metadata();
|
|
18993
18999
|
init_output();
|
|
18994
19000
|
init_scanner();
|
|
18995
19001
|
import { DeleteTableCommand, DynamoDBClient as DynamoDBClient2 } from "@aws-sdk/client-dynamodb";
|
|
@@ -19101,7 +19107,29 @@ async function emailDoctor(options) {
|
|
|
19101
19107
|
"Validating AWS credentials",
|
|
19102
19108
|
async () => validateAWSCredentials()
|
|
19103
19109
|
);
|
|
19104
|
-
|
|
19110
|
+
let region = options.region || await getAWSRegion();
|
|
19111
|
+
if (!(options.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION)) {
|
|
19112
|
+
const emailConnections = await findConnectionsWithService(
|
|
19113
|
+
identity.accountId,
|
|
19114
|
+
"email"
|
|
19115
|
+
);
|
|
19116
|
+
if (emailConnections.length === 1) {
|
|
19117
|
+
region = emailConnections[0].region;
|
|
19118
|
+
} else if (emailConnections.length > 1 && !isJsonMode()) {
|
|
19119
|
+
const selectedRegion = await clack19.select({
|
|
19120
|
+
message: "Multiple email deployments found. Which region?",
|
|
19121
|
+
options: emailConnections.map((conn) => ({
|
|
19122
|
+
value: conn.region,
|
|
19123
|
+
label: conn.region
|
|
19124
|
+
}))
|
|
19125
|
+
});
|
|
19126
|
+
if (clack19.isCancel(selectedRegion)) {
|
|
19127
|
+
clack19.cancel("Operation cancelled");
|
|
19128
|
+
process.exit(0);
|
|
19129
|
+
}
|
|
19130
|
+
region = selectedRegion;
|
|
19131
|
+
}
|
|
19132
|
+
}
|
|
19105
19133
|
const scan = await progress.execute(
|
|
19106
19134
|
"Scanning AWS resources",
|
|
19107
19135
|
async () => scanAWSResources(region)
|
|
@@ -19116,9 +19144,8 @@ async function emailDoctor(options) {
|
|
|
19116
19144
|
workDir: getPulumiWorkDir()
|
|
19117
19145
|
});
|
|
19118
19146
|
hasStack = true;
|
|
19119
|
-
} catch (
|
|
19120
|
-
|
|
19121
|
-
if (!isStackNotFound) throw error;
|
|
19147
|
+
} catch (_error) {
|
|
19148
|
+
hasStack = false;
|
|
19122
19149
|
}
|
|
19123
19150
|
progress.stop();
|
|
19124
19151
|
const results = runResourceDiagnostics(wrapsResources, hasStack);
|
|
@@ -22007,9 +22034,7 @@ ${pc28.yellow(pc28.bold("Configuration Warnings:"))}`);
|
|
|
22007
22034
|
);
|
|
22008
22035
|
const { shouldCreate, selectedCategories } = await promptDNSRecordSelection2(records, providerDisplayName);
|
|
22009
22036
|
if (shouldCreate && selectedCategories.size > 0) {
|
|
22010
|
-
progress.start(
|
|
22011
|
-
`Creating DNS records in ${providerDisplayName}`
|
|
22012
|
-
);
|
|
22037
|
+
progress.start(`Creating DNS records in ${providerDisplayName}`);
|
|
22013
22038
|
const result = await createDNSRecordsForProvider2(
|
|
22014
22039
|
credentials,
|
|
22015
22040
|
recordData,
|
|
@@ -22050,7 +22075,10 @@ ${pc28.yellow(pc28.bold("Configuration Warnings:"))}`);
|
|
|
22050
22075
|
}
|
|
22051
22076
|
}
|
|
22052
22077
|
if (outputs.domain && outputs.dkimTokens && outputs.dkimTokens.length > 0 && !dnsAutoCreated) {
|
|
22053
|
-
const {
|
|
22078
|
+
const {
|
|
22079
|
+
buildEmailDNSRecords: buildRecords,
|
|
22080
|
+
formatManualDNSInstructions: formatManual
|
|
22081
|
+
} = await Promise.resolve().then(() => (init_dns(), dns_exports));
|
|
22054
22082
|
const allRecords = buildRecords({
|
|
22055
22083
|
domain: outputs.domain,
|
|
22056
22084
|
dkimTokens: outputs.dkimTokens,
|
|
@@ -22415,19 +22443,16 @@ async function emailStatus(options) {
|
|
|
22415
22443
|
workDir: getPulumiWorkDir()
|
|
22416
22444
|
});
|
|
22417
22445
|
stackOutputs = await stack.outputs();
|
|
22418
|
-
} catch (
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
`
|
|
22446
|
+
} catch (_error) {
|
|
22447
|
+
progress.stop();
|
|
22448
|
+
clack28.log.error("No email infrastructure found");
|
|
22449
|
+
console.log(
|
|
22450
|
+
`
|
|
22424
22451
|
Run ${pc30.cyan("wraps email init")} to deploy email infrastructure.
|
|
22425
22452
|
`
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
}
|
|
22430
|
-
throw error;
|
|
22453
|
+
);
|
|
22454
|
+
process.exit(1);
|
|
22455
|
+
return;
|
|
22431
22456
|
}
|
|
22432
22457
|
const domains = await listSESDomains(region);
|
|
22433
22458
|
const { SESv2Client: SESv2Client9, GetEmailIdentityCommand: GetEmailIdentityCommand7 } = await import("@aws-sdk/client-sesv2");
|
|
@@ -28775,7 +28800,7 @@ import {
|
|
|
28775
28800
|
IAMClient as IAMClient3,
|
|
28776
28801
|
PutRolePolicyCommand
|
|
28777
28802
|
} from "@aws-sdk/client-iam";
|
|
28778
|
-
import { confirm as confirm17, intro as intro33, isCancel as isCancel23, log as log35, outro as outro20, select as
|
|
28803
|
+
import { confirm as confirm17, intro as intro33, isCancel as isCancel23, log as log35, outro as outro20, select as select16 } from "@clack/prompts";
|
|
28779
28804
|
import * as pulumi22 from "@pulumi/pulumi";
|
|
28780
28805
|
import pc40 from "picocolors";
|
|
28781
28806
|
init_events();
|
|
@@ -29126,7 +29151,7 @@ async function resolveOrganization() {
|
|
|
29126
29151
|
if (orgs.length === 1) {
|
|
29127
29152
|
return orgs[0];
|
|
29128
29153
|
}
|
|
29129
|
-
const selected = await
|
|
29154
|
+
const selected = await select16({
|
|
29130
29155
|
message: "Which organization should this AWS account connect to?",
|
|
29131
29156
|
options: orgs.map((org) => ({
|
|
29132
29157
|
value: org.id,
|
|
@@ -29422,7 +29447,7 @@ Run ${pc40.cyan("wraps email init")} or ${pc40.cyan("wraps sms init")} first.
|
|
|
29422
29447
|
log35.info(
|
|
29423
29448
|
`Already connected to Wraps Platform (AWS Account: ${pc40.cyan(metadata.accountId)})`
|
|
29424
29449
|
);
|
|
29425
|
-
const action = await
|
|
29450
|
+
const action = await select16({
|
|
29426
29451
|
message: "What would you like to do?",
|
|
29427
29452
|
options: [
|
|
29428
29453
|
{
|
|
@@ -29823,11 +29848,9 @@ ${pc42.bold("Permissions:")}`);
|
|
|
29823
29848
|
if (sendingEnabled) {
|
|
29824
29849
|
console.log(` ${pc42.green("\u2713")} Email sending via SES`);
|
|
29825
29850
|
}
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
|
|
29829
|
-
);
|
|
29830
|
-
}
|
|
29851
|
+
console.log(
|
|
29852
|
+
` ${pc42.green("\u2713")} DynamoDB read access (including DescribeTable)`
|
|
29853
|
+
);
|
|
29831
29854
|
if (eventTracking?.enabled) {
|
|
29832
29855
|
console.log(` ${pc42.green("\u2713")} EventBridge and SQS access`);
|
|
29833
29856
|
}
|
|
@@ -29921,24 +29944,21 @@ function buildConsolePolicyDocument2(emailConfig, smsConfig) {
|
|
|
29921
29944
|
Resource: "*"
|
|
29922
29945
|
});
|
|
29923
29946
|
}
|
|
29947
|
+
statements.push({
|
|
29948
|
+
Effect: "Allow",
|
|
29949
|
+
Action: [
|
|
29950
|
+
"dynamodb:DescribeTable",
|
|
29951
|
+
"dynamodb:Query",
|
|
29952
|
+
"dynamodb:Scan",
|
|
29953
|
+
"dynamodb:GetItem",
|
|
29954
|
+
"dynamodb:BatchGetItem"
|
|
29955
|
+
],
|
|
29956
|
+
Resource: [
|
|
29957
|
+
"arn:aws:dynamodb:*:*:table/wraps-email-*",
|
|
29958
|
+
"arn:aws:dynamodb:*:*:table/wraps-email-*/index/*"
|
|
29959
|
+
]
|
|
29960
|
+
});
|
|
29924
29961
|
const eventTracking = emailConfig?.eventTracking;
|
|
29925
|
-
if (eventTracking?.dynamoDBHistory) {
|
|
29926
|
-
statements.push({
|
|
29927
|
-
Effect: "Allow",
|
|
29928
|
-
Action: [
|
|
29929
|
-
"dynamodb:PutItem",
|
|
29930
|
-
"dynamodb:GetItem",
|
|
29931
|
-
"dynamodb:Query",
|
|
29932
|
-
"dynamodb:Scan",
|
|
29933
|
-
"dynamodb:BatchGetItem",
|
|
29934
|
-
"dynamodb:DescribeTable"
|
|
29935
|
-
],
|
|
29936
|
-
Resource: [
|
|
29937
|
-
"arn:aws:dynamodb:*:*:table/wraps-email-*",
|
|
29938
|
-
"arn:aws:dynamodb:*:*:table/wraps-email-*/index/*"
|
|
29939
|
-
]
|
|
29940
|
-
});
|
|
29941
|
-
}
|
|
29942
29962
|
if (eventTracking?.enabled) {
|
|
29943
29963
|
statements.push({
|
|
29944
29964
|
Effect: "Allow",
|