@wraps.dev/cli 2.21.16 → 2.21.18
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
|
@@ -1748,8 +1748,8 @@ async function ensurePulumiWorkDir(options) {
|
|
|
1748
1748
|
);
|
|
1749
1749
|
return;
|
|
1750
1750
|
} catch (error) {
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1751
|
+
const clack63 = await import("@clack/prompts");
|
|
1752
|
+
clack63.log.warn(
|
|
1753
1753
|
`S3 state backend unavailable (${error instanceof Error ? error.message : error}). Using local state.`
|
|
1754
1754
|
);
|
|
1755
1755
|
}
|
|
@@ -6855,23 +6855,23 @@ async function withLockRetry(fn, options) {
|
|
|
6855
6855
|
if (parsed.code !== "STACK_LOCKED") {
|
|
6856
6856
|
throw error;
|
|
6857
6857
|
}
|
|
6858
|
-
const
|
|
6859
|
-
const
|
|
6858
|
+
const clack63 = await import("@clack/prompts");
|
|
6859
|
+
const pc67 = (await import("picocolors")).default;
|
|
6860
6860
|
if (options.autoConfirm) {
|
|
6861
|
-
|
|
6861
|
+
clack63.log.warn(
|
|
6862
6862
|
"Stack is locked from a previous interrupted run. Auto-clearing..."
|
|
6863
6863
|
);
|
|
6864
6864
|
} else {
|
|
6865
|
-
const shouldClear = await
|
|
6866
|
-
message: `Stack is locked from a previous interrupted run. ${
|
|
6865
|
+
const shouldClear = await clack63.confirm({
|
|
6866
|
+
message: `Stack is locked from a previous interrupted run. ${pc67.yellow("Clear the stale lock and retry?")}`,
|
|
6867
6867
|
initialValue: true
|
|
6868
6868
|
});
|
|
6869
|
-
if (
|
|
6869
|
+
if (clack63.isCancel(shouldClear) || !shouldClear) {
|
|
6870
6870
|
throw errors.stackLocked();
|
|
6871
6871
|
}
|
|
6872
6872
|
}
|
|
6873
6873
|
const cleared = await clearStackLocks(options.accountId, options.region);
|
|
6874
|
-
|
|
6874
|
+
clack63.log.info(
|
|
6875
6875
|
`Cleared ${cleared} lock file${cleared === 1 ? "" : "s"}. Retrying...`
|
|
6876
6876
|
);
|
|
6877
6877
|
return fn();
|
|
@@ -9286,8 +9286,8 @@ async function pollDomainVerification(domain, region, options) {
|
|
|
9286
9286
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_DOMAIN_POLL_TIMEOUT_MS;
|
|
9287
9287
|
const startTime = Date.now();
|
|
9288
9288
|
const sesv22 = new SESv2Client6({ region });
|
|
9289
|
-
const
|
|
9290
|
-
|
|
9289
|
+
const spinner11 = clack25.spinner();
|
|
9290
|
+
spinner11.start(
|
|
9291
9291
|
`Waiting for ${pc27.cyan(domain)} DNS verification (this can take a few minutes)...`
|
|
9292
9292
|
);
|
|
9293
9293
|
while (Date.now() - startTime < timeoutMs) {
|
|
@@ -9301,19 +9301,19 @@ async function pollDomainVerification(domain, region, options) {
|
|
|
9301
9301
|
const elapsed = Math.round((Date.now() - startTime) / 1e3);
|
|
9302
9302
|
const elapsedStr = elapsed >= 60 ? `${Math.floor(elapsed / 60)}m ${elapsed % 60}s` : `${elapsed}s`;
|
|
9303
9303
|
if (verified) {
|
|
9304
|
-
|
|
9304
|
+
spinner11.stop(
|
|
9305
9305
|
pc27.green(`\u2713 Domain ${domain} is verified! (${elapsedStr})`)
|
|
9306
9306
|
);
|
|
9307
9307
|
return true;
|
|
9308
9308
|
}
|
|
9309
|
-
|
|
9309
|
+
spinner11.message(
|
|
9310
9310
|
`DKIM: ${dkimStatus} \u2014 ${elapsedStr} elapsed, checking every ${intervalMs / 1e3}s...`
|
|
9311
9311
|
);
|
|
9312
9312
|
} catch {
|
|
9313
9313
|
}
|
|
9314
9314
|
}
|
|
9315
9315
|
const totalElapsed = Math.round((Date.now() - startTime) / 1e3);
|
|
9316
|
-
|
|
9316
|
+
spinner11.stop(
|
|
9317
9317
|
pc27.yellow(
|
|
9318
9318
|
`\u23F1 Timed out after ${Math.round(totalElapsed / 60)}m waiting for DNS verification`
|
|
9319
9319
|
)
|
|
@@ -9330,8 +9330,8 @@ async function verifySandboxRecipient(email, region, options) {
|
|
|
9330
9330
|
const msg = error instanceof Error ? error.message : String(error);
|
|
9331
9331
|
return { verified: false, email, error: msg };
|
|
9332
9332
|
}
|
|
9333
|
-
const
|
|
9334
|
-
|
|
9333
|
+
const spinner11 = clack25.spinner();
|
|
9334
|
+
spinner11.start(
|
|
9335
9335
|
`Verification email sent to ${pc27.cyan(email)} \u2014 waiting for confirmation...`
|
|
9336
9336
|
);
|
|
9337
9337
|
const startTime = Date.now();
|
|
@@ -9347,16 +9347,16 @@ async function verifySandboxRecipient(email, region, options) {
|
|
|
9347
9347
|
const elapsed = Math.round((Date.now() - startTime) / 1e3);
|
|
9348
9348
|
const elapsedStr = elapsed >= 60 ? `${Math.floor(elapsed / 60)}m ${elapsed % 60}s` : `${elapsed}s`;
|
|
9349
9349
|
if (attrs?.VerificationStatus === "Success") {
|
|
9350
|
-
|
|
9350
|
+
spinner11.stop(pc27.green(`\u2713 ${email} verified! (${elapsedStr})`));
|
|
9351
9351
|
return { verified: true, email };
|
|
9352
9352
|
}
|
|
9353
|
-
|
|
9353
|
+
spinner11.message(
|
|
9354
9354
|
`Waiting for ${email} to click verification link (${elapsedStr} elapsed)...`
|
|
9355
9355
|
);
|
|
9356
9356
|
} catch {
|
|
9357
9357
|
}
|
|
9358
9358
|
}
|
|
9359
|
-
|
|
9359
|
+
spinner11.stop(pc27.yellow(`\u23F1 Timed out waiting for ${email} to verify`));
|
|
9360
9360
|
return { verified: false, email };
|
|
9361
9361
|
}
|
|
9362
9362
|
var DEFAULT_DOMAIN_POLL_INTERVAL_MS, DEFAULT_DOMAIN_POLL_TIMEOUT_MS, DEFAULT_RECIPIENT_POLL_INTERVAL_MS, DEFAULT_RECIPIENT_POLL_TIMEOUT_MS;
|
|
@@ -10205,8 +10205,8 @@ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
|
|
|
10205
10205
|
import { join as join23 } from "path";
|
|
10206
10206
|
import { Readable } from "stream";
|
|
10207
10207
|
import { pipeline } from "stream/promises";
|
|
10208
|
-
import { cancel as cancel35, confirm as confirm29, intro as
|
|
10209
|
-
import
|
|
10208
|
+
import { cancel as cancel35, confirm as confirm29, intro as intro58, isCancel as isCancel40, log as log56 } from "@clack/prompts";
|
|
10209
|
+
import pc65 from "picocolors";
|
|
10210
10210
|
function isStandaloneInstall() {
|
|
10211
10211
|
return process.execPath.includes(".wraps/runtime");
|
|
10212
10212
|
}
|
|
@@ -10235,7 +10235,7 @@ function detectPlatformArch() {
|
|
|
10235
10235
|
return { platform: platform2, arch };
|
|
10236
10236
|
}
|
|
10237
10237
|
async function update(currentVersion) {
|
|
10238
|
-
|
|
10238
|
+
intro58(pc65.bold("Wraps CLI Update"));
|
|
10239
10239
|
const progress = new DeploymentProgress();
|
|
10240
10240
|
const result = await progress.execute(
|
|
10241
10241
|
"Checking for updates...",
|
|
@@ -10247,20 +10247,20 @@ async function update(currentVersion) {
|
|
|
10247
10247
|
}
|
|
10248
10248
|
const { version: latestVersion, release } = result;
|
|
10249
10249
|
if (currentVersion === latestVersion) {
|
|
10250
|
-
progress.succeed(`Already up to date ${
|
|
10250
|
+
progress.succeed(`Already up to date ${pc65.dim(`(v${currentVersion})`)}`);
|
|
10251
10251
|
return;
|
|
10252
10252
|
}
|
|
10253
10253
|
console.log();
|
|
10254
|
-
|
|
10255
|
-
`Current version: ${
|
|
10256
|
-
Latest version: ${
|
|
10254
|
+
log56.info(
|
|
10255
|
+
`Current version: ${pc65.dim(`v${currentVersion}`)}
|
|
10256
|
+
Latest version: ${pc65.cyan(`v${latestVersion}`)}`
|
|
10257
10257
|
);
|
|
10258
10258
|
console.log();
|
|
10259
10259
|
if (!isStandaloneInstall()) {
|
|
10260
|
-
|
|
10260
|
+
log56.info(
|
|
10261
10261
|
`You installed Wraps via npm. Update with:
|
|
10262
10262
|
|
|
10263
|
-
${
|
|
10263
|
+
${pc65.cyan("npm update -g @wraps.dev/cli")}`
|
|
10264
10264
|
);
|
|
10265
10265
|
return;
|
|
10266
10266
|
}
|
|
@@ -10335,7 +10335,7 @@ async function update(currentVersion) {
|
|
|
10335
10335
|
});
|
|
10336
10336
|
console.log();
|
|
10337
10337
|
progress.succeed(
|
|
10338
|
-
`Updated to ${
|
|
10338
|
+
`Updated to ${pc65.cyan(`v${latestVersion}`)} successfully!`
|
|
10339
10339
|
);
|
|
10340
10340
|
} finally {
|
|
10341
10341
|
rmSync(tmp, { recursive: true, force: true });
|
|
@@ -10358,8 +10358,8 @@ init_esm_shims();
|
|
|
10358
10358
|
import { readFileSync as readFileSync3 } from "fs";
|
|
10359
10359
|
import { dirname as dirname7, join as join24 } from "path";
|
|
10360
10360
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
10361
|
-
import * as
|
|
10362
|
-
import
|
|
10361
|
+
import * as clack62 from "@clack/prompts";
|
|
10362
|
+
import pc66 from "picocolors";
|
|
10363
10363
|
|
|
10364
10364
|
// src/commands/auth/login.ts
|
|
10365
10365
|
init_esm_shims();
|
|
@@ -10424,7 +10424,7 @@ async function login(options) {
|
|
|
10424
10424
|
clack2.intro(pc3.bold("Wraps \u203A Sign In"));
|
|
10425
10425
|
const baseURL = getAppBaseUrl();
|
|
10426
10426
|
const authClient = createCliAuthClient(baseURL);
|
|
10427
|
-
const
|
|
10427
|
+
const spinner11 = clack2.spinner();
|
|
10428
10428
|
const { data: codeData, error: codeError } = await authClient.device.code({
|
|
10429
10429
|
client_id: "wraps-cli"
|
|
10430
10430
|
});
|
|
@@ -10453,7 +10453,7 @@ async function login(options) {
|
|
|
10453
10453
|
clack2.log.info("Opening browser...");
|
|
10454
10454
|
} catch {
|
|
10455
10455
|
}
|
|
10456
|
-
|
|
10456
|
+
spinner11.start("Waiting for approval...");
|
|
10457
10457
|
const pollInterval = (interval || 3) * 1e3;
|
|
10458
10458
|
const expiresAt = Date.now() + (expires_in || 900) * 1e3;
|
|
10459
10459
|
while (Date.now() < expiresAt) {
|
|
@@ -10464,7 +10464,7 @@ async function login(options) {
|
|
|
10464
10464
|
client_id: "wraps-cli"
|
|
10465
10465
|
});
|
|
10466
10466
|
if (tokenData?.access_token) {
|
|
10467
|
-
|
|
10467
|
+
spinner11.stop("Approved!");
|
|
10468
10468
|
const organizations = await fetchOrganizations(
|
|
10469
10469
|
baseURL,
|
|
10470
10470
|
tokenData.access_token
|
|
@@ -10517,7 +10517,7 @@ async function login(options) {
|
|
|
10517
10517
|
method: "device"
|
|
10518
10518
|
});
|
|
10519
10519
|
trackError("ACCESS_DENIED", "auth:login", { step: "poll_token" });
|
|
10520
|
-
|
|
10520
|
+
spinner11.stop("Denied.");
|
|
10521
10521
|
clack2.log.error("Authorization was denied.");
|
|
10522
10522
|
throw new Error("Authorization was denied.");
|
|
10523
10523
|
}
|
|
@@ -10532,7 +10532,7 @@ async function login(options) {
|
|
|
10532
10532
|
method: "device"
|
|
10533
10533
|
});
|
|
10534
10534
|
trackError("DEVICE_CODE_EXPIRED", "auth:login", { step: "poll_token" });
|
|
10535
|
-
|
|
10535
|
+
spinner11.stop("Expired.");
|
|
10536
10536
|
clack2.log.error("Device code expired. Run `wraps auth login` to try again.");
|
|
10537
10537
|
throw new Error("Device code expired.");
|
|
10538
10538
|
}
|
|
@@ -10907,11 +10907,11 @@ async function doctor() {
|
|
|
10907
10907
|
if (!isJsonMode()) {
|
|
10908
10908
|
clack5.intro(pc6.bold("AWS Setup Diagnostics"));
|
|
10909
10909
|
}
|
|
10910
|
-
const
|
|
10911
|
-
|
|
10910
|
+
const spinner11 = isJsonMode() ? null : clack5.spinner();
|
|
10911
|
+
spinner11?.start("Running diagnostics...");
|
|
10912
10912
|
const state = await detectAWSState();
|
|
10913
10913
|
const results = await runDiagnostics(state);
|
|
10914
|
-
|
|
10914
|
+
spinner11?.stop("Diagnostics complete");
|
|
10915
10915
|
const failCount = results.filter((r) => r.status === "fail").length;
|
|
10916
10916
|
const warnCount = results.filter((r) => r.status === "warn").length;
|
|
10917
10917
|
const passCount = results.filter((r) => r.status === "pass").length;
|
|
@@ -11515,10 +11515,10 @@ function showNextSteps(_state) {
|
|
|
11515
11515
|
async function setup(_options = {}) {
|
|
11516
11516
|
const startTime = Date.now();
|
|
11517
11517
|
clack7.intro(pc9.bold("AWS Setup Wizard"));
|
|
11518
|
-
const
|
|
11519
|
-
|
|
11518
|
+
const spinner11 = clack7.spinner();
|
|
11519
|
+
spinner11.start("Checking your AWS setup...");
|
|
11520
11520
|
const state = await detectAWSState();
|
|
11521
|
-
|
|
11521
|
+
spinner11.stop("AWS setup check complete");
|
|
11522
11522
|
displayCurrentState(state);
|
|
11523
11523
|
if (!state.cliInstalled) {
|
|
11524
11524
|
await runFullSetup();
|
|
@@ -17007,8 +17007,8 @@ async function check(options) {
|
|
|
17007
17007
|
clack15.intro(pc17.bold("Wraps Email Check"));
|
|
17008
17008
|
console.log();
|
|
17009
17009
|
}
|
|
17010
|
-
const
|
|
17011
|
-
|
|
17010
|
+
const spinner11 = isJsonMode() ? null : clack15.spinner();
|
|
17011
|
+
spinner11?.start(`Checking ${pc17.cyan(domain)}...`);
|
|
17012
17012
|
let dkimSelectors;
|
|
17013
17013
|
if (!options.dkimSelector) {
|
|
17014
17014
|
const sesTokens = await tryGetSesDkimTokens(domain);
|
|
@@ -17027,7 +17027,7 @@ async function check(options) {
|
|
|
17027
17027
|
skipTls: options.skipTls,
|
|
17028
17028
|
timeout: options.timeout
|
|
17029
17029
|
});
|
|
17030
|
-
|
|
17030
|
+
spinner11?.stop(`Check complete in ${result.duration}ms`);
|
|
17031
17031
|
if (isJsonMode()) {
|
|
17032
17032
|
jsonSuccess("email.check", result);
|
|
17033
17033
|
} else {
|
|
@@ -17041,7 +17041,7 @@ async function check(options) {
|
|
|
17041
17041
|
});
|
|
17042
17042
|
process.exit(getExitCode(result.score.grade));
|
|
17043
17043
|
} catch (error) {
|
|
17044
|
-
|
|
17044
|
+
spinner11?.stop("Check failed");
|
|
17045
17045
|
const msg = error instanceof Error ? error.message : String(error);
|
|
17046
17046
|
if (isJsonMode()) {
|
|
17047
17047
|
jsonError("email.check", { code: "CHECK_FAILED", message: msg });
|
|
@@ -22856,8 +22856,8 @@ Enable it: ${pc25.cyan("wraps email inbound init")}
|
|
|
22856
22856
|
});
|
|
22857
22857
|
const { S3Client: S3Client2, ListObjectsV2Command: ListObjectsV2Command2, GetObjectCommand: GetObjectCommand2 } = await import("@aws-sdk/client-s3");
|
|
22858
22858
|
const s34 = new S3Client2({ region });
|
|
22859
|
-
const
|
|
22860
|
-
|
|
22859
|
+
const spinner11 = clack23.spinner();
|
|
22860
|
+
spinner11.start("Waiting for email to be processed...");
|
|
22861
22861
|
let found = false;
|
|
22862
22862
|
const startTime = Date.now();
|
|
22863
22863
|
const timeout = 3e4;
|
|
@@ -22891,7 +22891,7 @@ Enable it: ${pc25.cyan("wraps email inbound init")}
|
|
|
22891
22891
|
const parsed = JSON.parse(body);
|
|
22892
22892
|
if (parsed.subject === testSubject) {
|
|
22893
22893
|
found = true;
|
|
22894
|
-
|
|
22894
|
+
spinner11.stop("Email received and processed!");
|
|
22895
22895
|
console.log();
|
|
22896
22896
|
console.log(` ${pc25.dim("Email ID:")} ${pc25.cyan(parsed.emailId)}`);
|
|
22897
22897
|
console.log(
|
|
@@ -22916,7 +22916,7 @@ Enable it: ${pc25.cyan("wraps email inbound init")}
|
|
|
22916
22916
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
22917
22917
|
}
|
|
22918
22918
|
if (!found) {
|
|
22919
|
-
|
|
22919
|
+
spinner11.stop("Timed out waiting for email.");
|
|
22920
22920
|
if (isJsonMode()) {
|
|
22921
22921
|
jsonSuccess("email.inbound.test", {
|
|
22922
22922
|
sent: true,
|
|
@@ -32520,9 +32520,9 @@ Run ${pc43.cyan("wraps email init")} or ${pc43.cyan("wraps sms init")} first.
|
|
|
32520
32520
|
let webhookSecret;
|
|
32521
32521
|
let needsDeployment = false;
|
|
32522
32522
|
if (hasEmail) {
|
|
32523
|
-
const
|
|
32523
|
+
const emailConfig2 = metadata.services.email?.config;
|
|
32524
32524
|
const existingSecret = metadata.services.email?.webhookSecret;
|
|
32525
|
-
if (!
|
|
32525
|
+
if (!emailConfig2?.eventTracking?.enabled) {
|
|
32526
32526
|
progress.stop();
|
|
32527
32527
|
log37.warn(
|
|
32528
32528
|
"Event tracking must be enabled to connect to the Wraps Platform."
|
|
@@ -32539,7 +32539,7 @@ Run ${pc43.cyan("wraps email init")} or ${pc43.cyan("wraps sms init")} first.
|
|
|
32539
32539
|
process.exit(0);
|
|
32540
32540
|
}
|
|
32541
32541
|
metadata.services.email.config = {
|
|
32542
|
-
...
|
|
32542
|
+
...emailConfig2,
|
|
32543
32543
|
eventTracking: {
|
|
32544
32544
|
enabled: true,
|
|
32545
32545
|
eventBridge: true,
|
|
@@ -32551,8 +32551,8 @@ Run ${pc43.cyan("wraps email init")} or ${pc43.cyan("wraps sms init")} first.
|
|
|
32551
32551
|
"BOUNCE",
|
|
32552
32552
|
"COMPLAINT"
|
|
32553
32553
|
],
|
|
32554
|
-
dynamoDBHistory:
|
|
32555
|
-
archiveRetention:
|
|
32554
|
+
dynamoDBHistory: emailConfig2?.eventTracking?.dynamoDBHistory ?? false,
|
|
32555
|
+
archiveRetention: emailConfig2?.eventTracking?.archiveRetention ?? "90days"
|
|
32556
32556
|
}
|
|
32557
32557
|
};
|
|
32558
32558
|
needsDeployment = true;
|
|
@@ -32661,6 +32661,7 @@ Run ${pc43.cyan("wraps email init")} or ${pc43.cyan("wraps sms init")} first.
|
|
|
32661
32661
|
}
|
|
32662
32662
|
const roleName = "wraps-console-access-role";
|
|
32663
32663
|
const iam11 = new IAMClient3({ region: "us-east-1" });
|
|
32664
|
+
const trustedAccountId = metadata.services?.selfhost ? metadata.accountId : WRAPS_PLATFORM_ACCOUNT_ID;
|
|
32664
32665
|
let roleExists2 = false;
|
|
32665
32666
|
try {
|
|
32666
32667
|
await iam11.send(new GetRoleCommand({ RoleName: roleName }));
|
|
@@ -32671,20 +32672,66 @@ Run ${pc43.cyan("wraps email init")} or ${pc43.cyan("wraps sms init")} first.
|
|
|
32671
32672
|
throw error;
|
|
32672
32673
|
}
|
|
32673
32674
|
}
|
|
32675
|
+
const emailConfig = metadata.services.email?.config;
|
|
32676
|
+
const smsConfig = metadata.services.sms?.config;
|
|
32677
|
+
const consolePolicy = buildConsolePolicyDocument(emailConfig, smsConfig);
|
|
32674
32678
|
if (roleExists2) {
|
|
32675
|
-
const emailConfig = metadata.services.email?.config;
|
|
32676
|
-
const smsConfig = metadata.services.sms?.config;
|
|
32677
|
-
const policy = buildConsolePolicyDocument(emailConfig, smsConfig);
|
|
32678
32679
|
await progress.execute("Updating platform access role", async () => {
|
|
32679
32680
|
await iam11.send(
|
|
32680
32681
|
new PutRolePolicyCommand({
|
|
32681
32682
|
RoleName: roleName,
|
|
32682
32683
|
PolicyName: "wraps-console-access-policy",
|
|
32683
|
-
PolicyDocument: JSON.stringify(
|
|
32684
|
+
PolicyDocument: JSON.stringify(consolePolicy, null, 2)
|
|
32684
32685
|
})
|
|
32685
32686
|
);
|
|
32687
|
+
if (metadata.services?.selfhost) {
|
|
32688
|
+
const trustPolicy = {
|
|
32689
|
+
Version: "2012-10-17",
|
|
32690
|
+
Statement: [
|
|
32691
|
+
{
|
|
32692
|
+
Effect: "Allow",
|
|
32693
|
+
Principal: { AWS: `arn:aws:iam::${trustedAccountId}:root` },
|
|
32694
|
+
Action: "sts:AssumeRole"
|
|
32695
|
+
}
|
|
32696
|
+
]
|
|
32697
|
+
};
|
|
32698
|
+
await iam11.send(
|
|
32699
|
+
new UpdateAssumeRolePolicyCommand({
|
|
32700
|
+
RoleName: roleName,
|
|
32701
|
+
PolicyDocument: JSON.stringify(trustPolicy)
|
|
32702
|
+
})
|
|
32703
|
+
);
|
|
32704
|
+
}
|
|
32686
32705
|
});
|
|
32687
32706
|
progress.succeed("Platform access role updated");
|
|
32707
|
+
} else if (metadata.services?.selfhost) {
|
|
32708
|
+
const trustPolicy = {
|
|
32709
|
+
Version: "2012-10-17",
|
|
32710
|
+
Statement: [
|
|
32711
|
+
{
|
|
32712
|
+
Effect: "Allow",
|
|
32713
|
+
Principal: { AWS: `arn:aws:iam::${trustedAccountId}:root` },
|
|
32714
|
+
Action: "sts:AssumeRole"
|
|
32715
|
+
}
|
|
32716
|
+
]
|
|
32717
|
+
};
|
|
32718
|
+
await progress.execute("Creating platform access role", async () => {
|
|
32719
|
+
await iam11.send(
|
|
32720
|
+
new CreateRoleCommand({
|
|
32721
|
+
RoleName: roleName,
|
|
32722
|
+
AssumeRolePolicyDocument: JSON.stringify(trustPolicy),
|
|
32723
|
+
Description: "Wraps Platform console access role"
|
|
32724
|
+
})
|
|
32725
|
+
);
|
|
32726
|
+
await iam11.send(
|
|
32727
|
+
new PutRolePolicyCommand({
|
|
32728
|
+
RoleName: roleName,
|
|
32729
|
+
PolicyName: "wraps-console-access-policy",
|
|
32730
|
+
PolicyDocument: JSON.stringify(consolePolicy, null, 2)
|
|
32731
|
+
})
|
|
32732
|
+
);
|
|
32733
|
+
});
|
|
32734
|
+
progress.succeed("Platform access role created");
|
|
32688
32735
|
} else {
|
|
32689
32736
|
progress.info(
|
|
32690
32737
|
`IAM role ${pc43.cyan(roleName)} will be created when you add your AWS account in the dashboard`
|
|
@@ -33583,7 +33630,12 @@ async function selfhostDeploy(options) {
|
|
|
33583
33630
|
if (dbChoice === "url") {
|
|
33584
33631
|
const dbUrlAnswer = await clack43.text({
|
|
33585
33632
|
message: "Postgres connection string:",
|
|
33586
|
-
placeholder: "postgres://user:pass@host:5432/dbname"
|
|
33633
|
+
placeholder: "postgres://user:pass@host:5432/dbname",
|
|
33634
|
+
validate: (v) => {
|
|
33635
|
+
if (!v.trim()) return "Connection string cannot be empty";
|
|
33636
|
+
if (!v.startsWith("postgres://") && !v.startsWith("postgresql://"))
|
|
33637
|
+
return "Must be a valid postgres:// or postgresql:// connection string";
|
|
33638
|
+
}
|
|
33587
33639
|
});
|
|
33588
33640
|
if (clack43.isCancel(dbUrlAnswer)) {
|
|
33589
33641
|
clack43.cancel("Operation cancelled.");
|
|
@@ -33895,6 +33947,16 @@ Run ${pc47.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
33895
33947
|
return;
|
|
33896
33948
|
}
|
|
33897
33949
|
const { config: config2, apiUrl } = metadata.services.selfhost;
|
|
33950
|
+
if (!apiUrl) {
|
|
33951
|
+
clack44.log.error("Self-hosted deployment is incomplete \u2014 API URL is not available yet.");
|
|
33952
|
+
console.log(
|
|
33953
|
+
`
|
|
33954
|
+
The deployment may have failed partway through. Re-run ${pc47.cyan("wraps selfhost deploy")} to complete it.
|
|
33955
|
+
`
|
|
33956
|
+
);
|
|
33957
|
+
process.exit(1);
|
|
33958
|
+
return;
|
|
33959
|
+
}
|
|
33898
33960
|
const env = {
|
|
33899
33961
|
DATABASE_URL: config2.databaseUrl,
|
|
33900
33962
|
NEXT_PUBLIC_APP_URL: config2.appUrl,
|
|
@@ -33947,6 +34009,167 @@ Run ${pc47.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
33947
34009
|
});
|
|
33948
34010
|
}
|
|
33949
34011
|
|
|
34012
|
+
// src/commands/selfhost/login.ts
|
|
34013
|
+
init_esm_shims();
|
|
34014
|
+
init_events();
|
|
34015
|
+
init_config();
|
|
34016
|
+
init_json_output();
|
|
34017
|
+
init_metadata();
|
|
34018
|
+
init_region_resolver();
|
|
34019
|
+
init_aws();
|
|
34020
|
+
import * as clack45 from "@clack/prompts";
|
|
34021
|
+
import { createAuthClient as createAuthClient2 } from "better-auth/client";
|
|
34022
|
+
import {
|
|
34023
|
+
deviceAuthorizationClient as deviceAuthorizationClient2,
|
|
34024
|
+
organizationClient as organizationClient2
|
|
34025
|
+
} from "better-auth/client/plugins";
|
|
34026
|
+
import open2 from "open";
|
|
34027
|
+
import pc48 from "picocolors";
|
|
34028
|
+
function createCliAuthClient2(baseURL) {
|
|
34029
|
+
return createAuthClient2({
|
|
34030
|
+
baseURL,
|
|
34031
|
+
plugins: [deviceAuthorizationClient2(), organizationClient2()]
|
|
34032
|
+
});
|
|
34033
|
+
}
|
|
34034
|
+
async function fetchOrganizations2(baseURL, token) {
|
|
34035
|
+
try {
|
|
34036
|
+
const client = createCliAuthClient2(baseURL);
|
|
34037
|
+
const { data } = await client.organization.list({
|
|
34038
|
+
fetchOptions: {
|
|
34039
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
34040
|
+
}
|
|
34041
|
+
});
|
|
34042
|
+
if (!data) return [];
|
|
34043
|
+
return data.map((org) => ({
|
|
34044
|
+
id: org.id,
|
|
34045
|
+
name: org.name,
|
|
34046
|
+
slug: org.slug
|
|
34047
|
+
}));
|
|
34048
|
+
} catch {
|
|
34049
|
+
return [];
|
|
34050
|
+
}
|
|
34051
|
+
}
|
|
34052
|
+
async function selfhostLogin(options) {
|
|
34053
|
+
const startTime = Date.now();
|
|
34054
|
+
if (!isJsonMode()) {
|
|
34055
|
+
clack45.intro(pc48.bold("Wraps Self-Hosted \u203A Sign In"));
|
|
34056
|
+
}
|
|
34057
|
+
const identity = await validateAWSCredentials();
|
|
34058
|
+
const region = await resolveRegionForCommand({
|
|
34059
|
+
accountId: identity.accountId,
|
|
34060
|
+
optionRegion: options.region,
|
|
34061
|
+
service: "selfhost",
|
|
34062
|
+
label: "self-hosted deployment"
|
|
34063
|
+
});
|
|
34064
|
+
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34065
|
+
if (!metadata?.services?.selfhost) {
|
|
34066
|
+
clack45.log.error("No self-hosted deployment found.");
|
|
34067
|
+
console.log(
|
|
34068
|
+
`
|
|
34069
|
+
Run ${pc48.cyan("wraps selfhost deploy")} to deploy the self-hosted control plane first.
|
|
34070
|
+
`
|
|
34071
|
+
);
|
|
34072
|
+
process.exit(1);
|
|
34073
|
+
return;
|
|
34074
|
+
}
|
|
34075
|
+
const { appUrl } = metadata.services.selfhost.config;
|
|
34076
|
+
const baseURL = appUrl;
|
|
34077
|
+
clack45.log.info(`Connecting to: ${pc48.cyan(baseURL)}`);
|
|
34078
|
+
const authClient = createCliAuthClient2(baseURL);
|
|
34079
|
+
const spinner11 = clack45.spinner();
|
|
34080
|
+
const { data: codeData, error: codeError } = await authClient.device.code({
|
|
34081
|
+
client_id: "wraps-cli"
|
|
34082
|
+
});
|
|
34083
|
+
if (codeError || !codeData) {
|
|
34084
|
+
trackError("DEVICE_AUTH_FAILED", "selfhost:login", {
|
|
34085
|
+
step: "request_code"
|
|
34086
|
+
});
|
|
34087
|
+
clack45.log.error(
|
|
34088
|
+
`Failed to reach ${pc48.cyan(baseURL)}. Make sure the dashboard is deployed and reachable.`
|
|
34089
|
+
);
|
|
34090
|
+
throw new Error("Failed to start device authorization.");
|
|
34091
|
+
}
|
|
34092
|
+
const { device_code, user_code, interval, expires_in } = codeData;
|
|
34093
|
+
const formatted = `${user_code.slice(0, 4)}-${user_code.slice(4)}`;
|
|
34094
|
+
clack45.log.info(`Your code: ${pc48.bold(pc48.cyan(formatted))}`);
|
|
34095
|
+
clack45.log.info(`Visit: ${pc48.underline(`${baseURL}/device`)}`);
|
|
34096
|
+
try {
|
|
34097
|
+
await open2(`${baseURL}/device?user_code=${user_code}`);
|
|
34098
|
+
clack45.log.info("Opening browser...");
|
|
34099
|
+
} catch {
|
|
34100
|
+
}
|
|
34101
|
+
spinner11.start("Waiting for approval...");
|
|
34102
|
+
const pollInterval = (interval || 3) * 1e3;
|
|
34103
|
+
const expiresAt = Date.now() + (expires_in || 900) * 1e3;
|
|
34104
|
+
while (Date.now() < expiresAt) {
|
|
34105
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
34106
|
+
const { data: tokenData, error: tokenError } = await authClient.device.token({
|
|
34107
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
34108
|
+
device_code,
|
|
34109
|
+
client_id: "wraps-cli"
|
|
34110
|
+
});
|
|
34111
|
+
if (tokenData?.access_token) {
|
|
34112
|
+
spinner11.stop("Approved!");
|
|
34113
|
+
const organizations = await fetchOrganizations2(
|
|
34114
|
+
baseURL,
|
|
34115
|
+
tokenData.access_token
|
|
34116
|
+
);
|
|
34117
|
+
await saveAuthConfig({
|
|
34118
|
+
auth: {
|
|
34119
|
+
token: tokenData.access_token,
|
|
34120
|
+
tokenType: "session",
|
|
34121
|
+
expiresAt: tokenData.expires_in ? new Date(
|
|
34122
|
+
Date.now() + tokenData.expires_in * 1e3
|
|
34123
|
+
).toISOString() : void 0,
|
|
34124
|
+
organizations: organizations.length > 0 ? organizations : void 0
|
|
34125
|
+
}
|
|
34126
|
+
});
|
|
34127
|
+
trackCommand("selfhost:login", {
|
|
34128
|
+
success: true,
|
|
34129
|
+
duration_ms: Date.now() - startTime
|
|
34130
|
+
});
|
|
34131
|
+
clack45.log.success("Signed in to your self-hosted Wraps instance.");
|
|
34132
|
+
if (organizations.length === 1) {
|
|
34133
|
+
clack45.log.info(`Organization: ${pc48.cyan(organizations[0].name)}`);
|
|
34134
|
+
} else if (organizations.length > 1) {
|
|
34135
|
+
clack45.log.info(`${organizations.length} organizations available`);
|
|
34136
|
+
} else {
|
|
34137
|
+
clack45.log.info(
|
|
34138
|
+
`No organizations found. Create one at ${pc48.underline(`${baseURL}/onboarding`)} and run ${pc48.cyan("wraps selfhost login")} again.`
|
|
34139
|
+
);
|
|
34140
|
+
}
|
|
34141
|
+
if (isJsonMode()) {
|
|
34142
|
+
jsonSuccess("selfhost.login", { tokenType: "session", organizations });
|
|
34143
|
+
} else {
|
|
34144
|
+
clack45.outro(pc48.green("Done!"));
|
|
34145
|
+
}
|
|
34146
|
+
return;
|
|
34147
|
+
}
|
|
34148
|
+
if (tokenError) {
|
|
34149
|
+
const err = tokenError;
|
|
34150
|
+
const errorCode = err.error || err.code;
|
|
34151
|
+
if (errorCode === "authorization_pending") continue;
|
|
34152
|
+
if (errorCode === "slow_down") {
|
|
34153
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
34154
|
+
continue;
|
|
34155
|
+
}
|
|
34156
|
+
if (errorCode === "access_denied") {
|
|
34157
|
+
trackError("ACCESS_DENIED", "selfhost:login", { step: "poll_token" });
|
|
34158
|
+
spinner11.stop("Denied.");
|
|
34159
|
+
clack45.log.error("Authorization was denied.");
|
|
34160
|
+
throw new Error("Authorization was denied.");
|
|
34161
|
+
}
|
|
34162
|
+
if (errorCode === "expired_token") break;
|
|
34163
|
+
}
|
|
34164
|
+
}
|
|
34165
|
+
trackError("DEVICE_CODE_EXPIRED", "selfhost:login", { step: "poll_token" });
|
|
34166
|
+
spinner11.stop("Expired.");
|
|
34167
|
+
clack45.log.error(
|
|
34168
|
+
"Device code expired. Run `wraps selfhost login` to try again."
|
|
34169
|
+
);
|
|
34170
|
+
throw new Error("Device code expired.");
|
|
34171
|
+
}
|
|
34172
|
+
|
|
33950
34173
|
// src/commands/selfhost/status.ts
|
|
33951
34174
|
init_esm_shims();
|
|
33952
34175
|
init_events();
|
|
@@ -33955,30 +34178,30 @@ init_json_output();
|
|
|
33955
34178
|
init_metadata();
|
|
33956
34179
|
init_output();
|
|
33957
34180
|
init_region_resolver();
|
|
33958
|
-
import * as
|
|
33959
|
-
import
|
|
34181
|
+
import * as clack46 from "@clack/prompts";
|
|
34182
|
+
import pc49 from "picocolors";
|
|
33960
34183
|
function displaySelfhostStatus(options) {
|
|
33961
34184
|
const lines = [];
|
|
33962
|
-
lines.push(
|
|
34185
|
+
lines.push(pc49.bold(pc49.green("Self-Hosted Control Plane Active")));
|
|
33963
34186
|
lines.push("");
|
|
33964
|
-
lines.push(
|
|
33965
|
-
lines.push(` URL: ${
|
|
33966
|
-
lines.push(` Region: ${
|
|
33967
|
-
lines.push(` Deployed: ${
|
|
34187
|
+
lines.push(pc49.bold("API"));
|
|
34188
|
+
lines.push(` URL: ${pc49.cyan(options.apiUrl)}`);
|
|
34189
|
+
lines.push(` Region: ${pc49.cyan(options.region)}`);
|
|
34190
|
+
lines.push(` Deployed: ${pc49.dim(options.deployedAt)}`);
|
|
33968
34191
|
lines.push("");
|
|
33969
|
-
lines.push(
|
|
33970
|
-
lines.push(` App URL: ${
|
|
33971
|
-
lines.push(` License Key: ${
|
|
34192
|
+
lines.push(pc49.bold("Configuration"));
|
|
34193
|
+
lines.push(` App URL: ${pc49.cyan(options.appUrl)}`);
|
|
34194
|
+
lines.push(` License Key: ${pc49.dim(`${options.licenseKeyPrefix}...`)}`);
|
|
33972
34195
|
if (options.neonProjectId) {
|
|
33973
|
-
lines.push(` Neon Project: ${
|
|
34196
|
+
lines.push(` Neon Project: ${pc49.dim(options.neonProjectId)}`);
|
|
33974
34197
|
}
|
|
33975
|
-
|
|
34198
|
+
clack46.note(lines.join("\n"), "Self-Hosted Status");
|
|
33976
34199
|
}
|
|
33977
34200
|
async function selfhostStatus(options) {
|
|
33978
34201
|
const startTime = Date.now();
|
|
33979
34202
|
const progress = new DeploymentProgress();
|
|
33980
34203
|
if (!isJsonMode()) {
|
|
33981
|
-
|
|
34204
|
+
clack46.intro(pc49.bold("Wraps Self-Hosted Status"));
|
|
33982
34205
|
}
|
|
33983
34206
|
const identity = await progress.execute(
|
|
33984
34207
|
"Loading self-hosted status",
|
|
@@ -33993,10 +34216,10 @@ async function selfhostStatus(options) {
|
|
|
33993
34216
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
33994
34217
|
if (!metadata?.services?.selfhost) {
|
|
33995
34218
|
progress.stop();
|
|
33996
|
-
|
|
34219
|
+
clack46.log.error("No self-hosted deployment found");
|
|
33997
34220
|
console.log(
|
|
33998
34221
|
`
|
|
33999
|
-
Run ${
|
|
34222
|
+
Run ${pc49.cyan("wraps selfhost deploy")} to deploy the self-hosted control plane.
|
|
34000
34223
|
`
|
|
34001
34224
|
);
|
|
34002
34225
|
process.exit(1);
|
|
@@ -34018,15 +34241,15 @@ Run ${pc48.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34018
34241
|
}
|
|
34019
34242
|
displaySelfhostStatus(statusData);
|
|
34020
34243
|
console.log("");
|
|
34021
|
-
|
|
34244
|
+
clack46.log.info(pc49.bold("Commands:"));
|
|
34022
34245
|
console.log(
|
|
34023
|
-
` ${
|
|
34246
|
+
` ${pc49.cyan("wraps selfhost upgrade")} - Rebuild and redeploy the API Lambda`
|
|
34024
34247
|
);
|
|
34025
34248
|
trackCommand("selfhost:status", {
|
|
34026
34249
|
success: true,
|
|
34027
34250
|
duration_ms: Date.now() - startTime
|
|
34028
34251
|
});
|
|
34029
|
-
|
|
34252
|
+
clack46.outro(pc49.dim("Self-hosted deployment is active"));
|
|
34030
34253
|
}
|
|
34031
34254
|
|
|
34032
34255
|
// src/commands/selfhost/upgrade.ts
|
|
@@ -34034,9 +34257,9 @@ init_esm_shims();
|
|
|
34034
34257
|
import { existsSync as existsSync19 } from "fs";
|
|
34035
34258
|
import { dirname as dirname6, join as join21 } from "path";
|
|
34036
34259
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
34037
|
-
import * as
|
|
34260
|
+
import * as clack47 from "@clack/prompts";
|
|
34038
34261
|
import * as pulumi27 from "@pulumi/pulumi";
|
|
34039
|
-
import
|
|
34262
|
+
import pc50 from "picocolors";
|
|
34040
34263
|
init_events();
|
|
34041
34264
|
init_aws();
|
|
34042
34265
|
init_errors();
|
|
@@ -34052,7 +34275,7 @@ var bundledLambdaZip2 = join21(cliDir2, "api-lambda.zip");
|
|
|
34052
34275
|
async function selfhostUpgrade(options) {
|
|
34053
34276
|
const startTime = Date.now();
|
|
34054
34277
|
if (!isJsonMode()) {
|
|
34055
|
-
|
|
34278
|
+
clack47.intro(pc50.bold("Wraps Self-Hosted Control Plane Upgrade"));
|
|
34056
34279
|
}
|
|
34057
34280
|
const progress = new DeploymentProgress();
|
|
34058
34281
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -34067,7 +34290,7 @@ async function selfhostUpgrade(options) {
|
|
|
34067
34290
|
async () => validateAWSCredentialsWithDetails()
|
|
34068
34291
|
);
|
|
34069
34292
|
const identity = credentialResult.identity;
|
|
34070
|
-
progress.info(`Connected to AWS account: ${
|
|
34293
|
+
progress.info(`Connected to AWS account: ${pc50.cyan(identity.accountId)}`);
|
|
34071
34294
|
const region = await resolveRegionForCommand({
|
|
34072
34295
|
accountId: identity.accountId,
|
|
34073
34296
|
optionRegion: options.region,
|
|
@@ -34076,20 +34299,20 @@ async function selfhostUpgrade(options) {
|
|
|
34076
34299
|
});
|
|
34077
34300
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34078
34301
|
if (!metadata?.services?.selfhost) {
|
|
34079
|
-
|
|
34080
|
-
|
|
34302
|
+
clack47.log.error("No self-hosted deployment found.");
|
|
34303
|
+
clack47.log.info(`Run ${pc50.cyan("wraps selfhost deploy")} first.`);
|
|
34081
34304
|
process.exit(1);
|
|
34082
34305
|
}
|
|
34083
34306
|
const selfhostService = metadata.services.selfhost;
|
|
34084
34307
|
progress.info(`Found deployment from: ${selfhostService.deployedAt}`);
|
|
34085
|
-
progress.info(`API URL: ${
|
|
34308
|
+
progress.info(`API URL: ${pc50.cyan(selfhostService.apiUrl)}`);
|
|
34086
34309
|
if (!(options.yes || options.preview)) {
|
|
34087
|
-
const confirmed = await
|
|
34088
|
-
message: `Upgrade self-hosted deployment in ${
|
|
34310
|
+
const confirmed = await clack47.confirm({
|
|
34311
|
+
message: `Upgrade self-hosted deployment in ${pc50.cyan(identity.accountId)} / ${pc50.cyan(region)}?`,
|
|
34089
34312
|
initialValue: true
|
|
34090
34313
|
});
|
|
34091
|
-
if (
|
|
34092
|
-
|
|
34314
|
+
if (clack47.isCancel(confirmed) || !confirmed) {
|
|
34315
|
+
clack47.cancel("Upgrade cancelled.");
|
|
34093
34316
|
process.exit(0);
|
|
34094
34317
|
}
|
|
34095
34318
|
}
|
|
@@ -34163,8 +34386,8 @@ async function selfhostUpgrade(options) {
|
|
|
34163
34386
|
resourceChanges: previewResult.resourceChanges,
|
|
34164
34387
|
commandName: "wraps selfhost upgrade"
|
|
34165
34388
|
});
|
|
34166
|
-
|
|
34167
|
-
|
|
34389
|
+
clack47.outro(
|
|
34390
|
+
pc50.green("Preview complete. Run without --preview to upgrade.")
|
|
34168
34391
|
);
|
|
34169
34392
|
return;
|
|
34170
34393
|
} catch (error) {
|
|
@@ -34235,28 +34458,28 @@ async function selfhostUpgrade(options) {
|
|
|
34235
34458
|
}
|
|
34236
34459
|
progress.info("Deployment metadata updated");
|
|
34237
34460
|
console.log("\n");
|
|
34238
|
-
|
|
34461
|
+
clack47.log.success(pc50.green(pc50.bold("Self-hosted Wraps API upgraded!")));
|
|
34239
34462
|
console.log("\n");
|
|
34240
|
-
|
|
34463
|
+
clack47.note(
|
|
34241
34464
|
[
|
|
34242
|
-
`${
|
|
34243
|
-
`${
|
|
34244
|
-
`${
|
|
34465
|
+
`${pc50.bold("API URL:")} ${pc50.cyan(outputs.apiUrl || selfhostService.apiUrl)}`,
|
|
34466
|
+
`${pc50.bold("Region:")} ${pc50.cyan(region)}`,
|
|
34467
|
+
`${pc50.bold("Lambda ARN:")} ${pc50.dim(outputs.lambdaArn)}`
|
|
34245
34468
|
].join("\n"),
|
|
34246
34469
|
"Self-Hosted Deployment"
|
|
34247
34470
|
);
|
|
34248
|
-
|
|
34249
|
-
|
|
34471
|
+
clack47.outro(
|
|
34472
|
+
pc50.green(`Upgraded in ${((Date.now() - startTime) / 1e3).toFixed(1)}s`)
|
|
34250
34473
|
);
|
|
34251
34474
|
}
|
|
34252
34475
|
|
|
34253
34476
|
// src/commands/shared/dashboard.ts
|
|
34254
34477
|
init_esm_shims();
|
|
34255
|
-
import * as
|
|
34478
|
+
import * as clack48 from "@clack/prompts";
|
|
34256
34479
|
import * as pulumi28 from "@pulumi/pulumi";
|
|
34257
34480
|
import getPort from "get-port";
|
|
34258
|
-
import
|
|
34259
|
-
import
|
|
34481
|
+
import open3 from "open";
|
|
34482
|
+
import pc51 from "picocolors";
|
|
34260
34483
|
|
|
34261
34484
|
// src/console/server.ts
|
|
34262
34485
|
init_esm_shims();
|
|
@@ -35456,13 +35679,13 @@ function createMetricsRouter(config2) {
|
|
|
35456
35679
|
const router = createRouter5();
|
|
35457
35680
|
router.get("/stream", async (req, res) => {
|
|
35458
35681
|
const connectionId = randomUUID().slice(0, 8);
|
|
35459
|
-
const
|
|
35682
|
+
const log58 = (msg, data) => {
|
|
35460
35683
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
35461
35684
|
};
|
|
35462
35685
|
res.setHeader("Content-Type", "text/event-stream");
|
|
35463
35686
|
res.setHeader("Cache-Control", "no-cache");
|
|
35464
35687
|
res.setHeader("Connection", "keep-alive");
|
|
35465
|
-
|
|
35688
|
+
log58("SSE connected");
|
|
35466
35689
|
res.write('data: {"type":"connected"}\n\n');
|
|
35467
35690
|
const { startTime, endTime } = req.query;
|
|
35468
35691
|
const getTimeRange = () => ({
|
|
@@ -35472,7 +35695,7 @@ function createMetricsRouter(config2) {
|
|
|
35472
35695
|
const sendMetrics = async () => {
|
|
35473
35696
|
try {
|
|
35474
35697
|
const timeRange = getTimeRange();
|
|
35475
|
-
|
|
35698
|
+
log58("Fetching metrics", {
|
|
35476
35699
|
start: timeRange.start.toISOString(),
|
|
35477
35700
|
end: timeRange.end.toISOString()
|
|
35478
35701
|
});
|
|
@@ -35485,7 +35708,7 @@ function createMetricsRouter(config2) {
|
|
|
35485
35708
|
),
|
|
35486
35709
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
35487
35710
|
]);
|
|
35488
|
-
|
|
35711
|
+
log58("Metrics fetched successfully");
|
|
35489
35712
|
const data = {
|
|
35490
35713
|
type: "metrics",
|
|
35491
35714
|
timestamp: Date.now(),
|
|
@@ -35515,7 +35738,7 @@ function createMetricsRouter(config2) {
|
|
|
35515
35738
|
const interval = setInterval(sendMetrics, 6e4);
|
|
35516
35739
|
req.on("close", () => {
|
|
35517
35740
|
clearInterval(interval);
|
|
35518
|
-
|
|
35741
|
+
log58("SSE disconnected");
|
|
35519
35742
|
});
|
|
35520
35743
|
});
|
|
35521
35744
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -36910,7 +37133,7 @@ init_output();
|
|
|
36910
37133
|
init_pulumi();
|
|
36911
37134
|
async function dashboard(options) {
|
|
36912
37135
|
await ensurePulumiInstalled();
|
|
36913
|
-
|
|
37136
|
+
clack48.intro(pc51.bold("Wraps Dashboard"));
|
|
36914
37137
|
const progress = new DeploymentProgress();
|
|
36915
37138
|
const identity = await progress.execute(
|
|
36916
37139
|
"Validating AWS credentials",
|
|
@@ -36951,9 +37174,9 @@ async function dashboard(options) {
|
|
|
36951
37174
|
}
|
|
36952
37175
|
} catch (_error) {
|
|
36953
37176
|
progress.stop();
|
|
36954
|
-
|
|
37177
|
+
clack48.log.error("No Wraps infrastructure found");
|
|
36955
37178
|
console.log(
|
|
36956
|
-
`\\nRun ${
|
|
37179
|
+
`\\nRun ${pc51.cyan("wraps email init")}, ${pc51.cyan("wraps sms init")}, or ${pc51.cyan("wraps storage init")} to deploy infrastructure first.\\n`
|
|
36957
37180
|
);
|
|
36958
37181
|
process.exit(1);
|
|
36959
37182
|
}
|
|
@@ -36995,9 +37218,9 @@ async function dashboard(options) {
|
|
|
36995
37218
|
}
|
|
36996
37219
|
const port = options.port || await getPort({ port: [5555, 5556, 5557, 5558, 5559] });
|
|
36997
37220
|
progress.stop();
|
|
36998
|
-
|
|
37221
|
+
clack48.log.success("Starting dashboard server...");
|
|
36999
37222
|
console.log(
|
|
37000
|
-
`${
|
|
37223
|
+
`${pc51.dim("Using current AWS credentials (no role assumption)")}\\n`
|
|
37001
37224
|
);
|
|
37002
37225
|
const { url } = await startConsoleServer({
|
|
37003
37226
|
port,
|
|
@@ -37030,11 +37253,11 @@ async function dashboard(options) {
|
|
|
37030
37253
|
cdnCustomDomain,
|
|
37031
37254
|
cdnCertificateArn
|
|
37032
37255
|
});
|
|
37033
|
-
console.log(`\\n${
|
|
37034
|
-
console.log(`${
|
|
37256
|
+
console.log(`\\n${pc51.bold("Dashboard:")} ${pc51.cyan(url)}`);
|
|
37257
|
+
console.log(`${pc51.dim("Press Ctrl+C to stop")}\\n`);
|
|
37035
37258
|
getTelemetryClient().showFooterOnce();
|
|
37036
37259
|
if (!options.noOpen) {
|
|
37037
|
-
await
|
|
37260
|
+
await open3(url);
|
|
37038
37261
|
}
|
|
37039
37262
|
trackCommand("console", {
|
|
37040
37263
|
success: true,
|
|
@@ -37052,8 +37275,8 @@ init_aws();
|
|
|
37052
37275
|
init_errors();
|
|
37053
37276
|
init_json_output();
|
|
37054
37277
|
init_metadata();
|
|
37055
|
-
import * as
|
|
37056
|
-
import
|
|
37278
|
+
import * as clack49 from "@clack/prompts";
|
|
37279
|
+
import pc52 from "picocolors";
|
|
37057
37280
|
async function destroy(options) {
|
|
37058
37281
|
trackCommand("destroy", { success: true });
|
|
37059
37282
|
if (isJsonMode() && !options.force) {
|
|
@@ -37064,16 +37287,16 @@ async function destroy(options) {
|
|
|
37064
37287
|
);
|
|
37065
37288
|
}
|
|
37066
37289
|
if (!isJsonMode()) {
|
|
37067
|
-
|
|
37290
|
+
clack49.intro(pc52.bold("Wraps Infrastructure Teardown"));
|
|
37068
37291
|
}
|
|
37069
|
-
const
|
|
37070
|
-
|
|
37292
|
+
const spinner11 = clack49.spinner();
|
|
37293
|
+
spinner11.start("Validating AWS credentials");
|
|
37071
37294
|
let identity;
|
|
37072
37295
|
try {
|
|
37073
37296
|
identity = await validateAWSCredentials();
|
|
37074
|
-
|
|
37297
|
+
spinner11.stop("AWS credentials validated");
|
|
37075
37298
|
} catch (error) {
|
|
37076
|
-
|
|
37299
|
+
spinner11.stop("AWS credentials validation failed");
|
|
37077
37300
|
throw error;
|
|
37078
37301
|
}
|
|
37079
37302
|
const region = options.region || await getAWSRegion();
|
|
@@ -37083,17 +37306,17 @@ async function destroy(options) {
|
|
|
37083
37306
|
deployedServices.push("email");
|
|
37084
37307
|
}
|
|
37085
37308
|
if (deployedServices.length === 0) {
|
|
37086
|
-
|
|
37309
|
+
clack49.log.warn("No Wraps services found in this region");
|
|
37087
37310
|
console.log(
|
|
37088
37311
|
`
|
|
37089
|
-
Run ${
|
|
37312
|
+
Run ${pc52.cyan("wraps email init")} to deploy infrastructure.
|
|
37090
37313
|
`
|
|
37091
37314
|
);
|
|
37092
37315
|
process.exit(0);
|
|
37093
37316
|
}
|
|
37094
37317
|
if (deployedServices.length === 1) {
|
|
37095
37318
|
const service = deployedServices[0];
|
|
37096
|
-
|
|
37319
|
+
clack49.log.info(`Found ${pc52.cyan(service)} service deployed`);
|
|
37097
37320
|
if (service === "email") {
|
|
37098
37321
|
await emailDestroy(options);
|
|
37099
37322
|
return;
|
|
@@ -37108,7 +37331,7 @@ Run ${pc51.cyan("wraps email init")} to deploy infrastructure.
|
|
|
37108
37331
|
jsonSuccess("destroy", { destroyed: true });
|
|
37109
37332
|
return;
|
|
37110
37333
|
}
|
|
37111
|
-
const serviceToDestroy = await
|
|
37334
|
+
const serviceToDestroy = await clack49.select({
|
|
37112
37335
|
message: "Which service would you like to destroy?",
|
|
37113
37336
|
options: [
|
|
37114
37337
|
...deployedServices.map((s) => ({
|
|
@@ -37123,15 +37346,15 @@ Run ${pc51.cyan("wraps email init")} to deploy infrastructure.
|
|
|
37123
37346
|
}
|
|
37124
37347
|
]
|
|
37125
37348
|
});
|
|
37126
|
-
if (
|
|
37127
|
-
|
|
37349
|
+
if (clack49.isCancel(serviceToDestroy)) {
|
|
37350
|
+
clack49.cancel("Operation cancelled.");
|
|
37128
37351
|
process.exit(0);
|
|
37129
37352
|
}
|
|
37130
37353
|
if ((serviceToDestroy === "email" || serviceToDestroy === "all") && deployedServices.includes("email")) {
|
|
37131
37354
|
await emailDestroy(options);
|
|
37132
37355
|
}
|
|
37133
37356
|
if (serviceToDestroy === "all") {
|
|
37134
|
-
|
|
37357
|
+
clack49.outro(pc52.green("All Wraps infrastructure has been removed"));
|
|
37135
37358
|
}
|
|
37136
37359
|
}
|
|
37137
37360
|
|
|
@@ -37143,26 +37366,26 @@ init_fs();
|
|
|
37143
37366
|
init_json_output();
|
|
37144
37367
|
init_output();
|
|
37145
37368
|
init_pulumi();
|
|
37146
|
-
import * as
|
|
37369
|
+
import * as clack50 from "@clack/prompts";
|
|
37147
37370
|
import * as pulumi29 from "@pulumi/pulumi";
|
|
37148
|
-
import
|
|
37371
|
+
import pc53 from "picocolors";
|
|
37149
37372
|
async function status(options) {
|
|
37150
37373
|
await ensurePulumiInstalled();
|
|
37151
37374
|
const startTime = Date.now();
|
|
37152
37375
|
const progress = new DeploymentProgress();
|
|
37153
37376
|
if (!isJsonMode()) {
|
|
37154
|
-
|
|
37377
|
+
clack50.intro(pc53.bold("Wraps Infrastructure Status"));
|
|
37155
37378
|
}
|
|
37156
37379
|
const identity = await progress.execute(
|
|
37157
37380
|
"Loading infrastructure status",
|
|
37158
37381
|
async () => validateAWSCredentials()
|
|
37159
37382
|
);
|
|
37160
37383
|
if (!isJsonMode()) {
|
|
37161
|
-
progress.info(`AWS Account: ${
|
|
37384
|
+
progress.info(`AWS Account: ${pc53.cyan(identity.accountId)}`);
|
|
37162
37385
|
}
|
|
37163
37386
|
const region = options.region || await getAWSRegion();
|
|
37164
37387
|
if (!isJsonMode()) {
|
|
37165
|
-
progress.info(`Region: ${
|
|
37388
|
+
progress.info(`Region: ${pc53.cyan(region)}`);
|
|
37166
37389
|
}
|
|
37167
37390
|
const services = [];
|
|
37168
37391
|
try {
|
|
@@ -37214,35 +37437,35 @@ async function status(options) {
|
|
|
37214
37437
|
return;
|
|
37215
37438
|
}
|
|
37216
37439
|
console.log();
|
|
37217
|
-
|
|
37440
|
+
clack50.note(
|
|
37218
37441
|
services.map((s) => {
|
|
37219
37442
|
if (s.status === "deployed") {
|
|
37220
|
-
const details = s.details ?
|
|
37221
|
-
return ` ${
|
|
37443
|
+
const details = s.details ? pc53.dim(` (${s.details})`) : "";
|
|
37444
|
+
return ` ${pc53.green("\u2713")} ${s.name}${details}`;
|
|
37222
37445
|
}
|
|
37223
|
-
return ` ${
|
|
37446
|
+
return ` ${pc53.dim("\u25CB")} ${s.name} ${pc53.dim("(not deployed)")}`;
|
|
37224
37447
|
}).join("\n"),
|
|
37225
37448
|
"Services"
|
|
37226
37449
|
);
|
|
37227
37450
|
const hasDeployedServices = services.some((s) => s.status === "deployed");
|
|
37228
37451
|
if (hasDeployedServices) {
|
|
37229
37452
|
console.log(`
|
|
37230
|
-
${
|
|
37453
|
+
${pc53.bold("Details:")}`);
|
|
37231
37454
|
if (services.find((s) => s.name === "Email")?.status === "deployed") {
|
|
37232
|
-
console.log(` ${
|
|
37455
|
+
console.log(` ${pc53.dim("Email:")} ${pc53.cyan("wraps email status")}`);
|
|
37233
37456
|
}
|
|
37234
37457
|
if (services.find((s) => s.name === "SMS")?.status === "deployed") {
|
|
37235
|
-
console.log(` ${
|
|
37458
|
+
console.log(` ${pc53.dim("SMS:")} ${pc53.cyan("wraps sms status")}`);
|
|
37236
37459
|
}
|
|
37237
37460
|
} else {
|
|
37238
37461
|
console.log(`
|
|
37239
|
-
${
|
|
37240
|
-
console.log(` ${
|
|
37241
|
-
console.log(` ${
|
|
37462
|
+
${pc53.bold("Get started:")}`);
|
|
37463
|
+
console.log(` ${pc53.dim("Deploy email:")} ${pc53.cyan("wraps email init")}`);
|
|
37464
|
+
console.log(` ${pc53.dim("Deploy SMS:")} ${pc53.cyan("wraps sms init")}`);
|
|
37242
37465
|
}
|
|
37243
37466
|
console.log(`
|
|
37244
|
-
${
|
|
37245
|
-
console.log(`${
|
|
37467
|
+
${pc53.bold("Dashboard:")} ${pc53.blue("https://app.wraps.dev")}`);
|
|
37468
|
+
console.log(`${pc53.bold("Docs:")} ${pc53.blue("https://wraps.dev/docs")}
|
|
37246
37469
|
`);
|
|
37247
37470
|
trackCommand("status", {
|
|
37248
37471
|
success: true,
|
|
@@ -37253,9 +37476,9 @@ ${pc52.bold("Dashboard:")} ${pc52.blue("https://app.wraps.dev")}`);
|
|
|
37253
37476
|
|
|
37254
37477
|
// src/commands/sms/destroy.ts
|
|
37255
37478
|
init_esm_shims();
|
|
37256
|
-
import * as
|
|
37479
|
+
import * as clack51 from "@clack/prompts";
|
|
37257
37480
|
import * as pulumi31 from "@pulumi/pulumi";
|
|
37258
|
-
import
|
|
37481
|
+
import pc54 from "picocolors";
|
|
37259
37482
|
|
|
37260
37483
|
// src/infrastructure/sms-stack.ts
|
|
37261
37484
|
init_esm_shims();
|
|
@@ -37946,18 +38169,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
37946
38169
|
const existing = await client.send(
|
|
37947
38170
|
new DescribeProtectConfigurationsCommand({})
|
|
37948
38171
|
);
|
|
37949
|
-
for (const
|
|
37950
|
-
if (!(
|
|
38172
|
+
for (const pc67 of existing.ProtectConfigurations || []) {
|
|
38173
|
+
if (!(pc67.ProtectConfigurationArn && pc67.ProtectConfigurationId)) {
|
|
37951
38174
|
continue;
|
|
37952
38175
|
}
|
|
37953
38176
|
const tagsResponse = await client.send(
|
|
37954
38177
|
new ListTagsForResourceCommand({
|
|
37955
|
-
ResourceArn:
|
|
38178
|
+
ResourceArn: pc67.ProtectConfigurationArn
|
|
37956
38179
|
})
|
|
37957
38180
|
);
|
|
37958
38181
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
37959
38182
|
if (nameTag?.Value === protectConfigName) {
|
|
37960
|
-
existingProtectConfigId =
|
|
38183
|
+
existingProtectConfigId = pc67.ProtectConfigurationId;
|
|
37961
38184
|
break;
|
|
37962
38185
|
}
|
|
37963
38186
|
}
|
|
@@ -38053,13 +38276,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
38053
38276
|
new DescribeProtectConfigurationsCommand({})
|
|
38054
38277
|
);
|
|
38055
38278
|
if (existing.ProtectConfigurations) {
|
|
38056
|
-
for (const
|
|
38057
|
-
if (!(
|
|
38279
|
+
for (const pc67 of existing.ProtectConfigurations) {
|
|
38280
|
+
if (!(pc67.ProtectConfigurationArn && pc67.ProtectConfigurationId)) {
|
|
38058
38281
|
continue;
|
|
38059
38282
|
}
|
|
38060
38283
|
const tagsResponse = await client.send(
|
|
38061
38284
|
new ListTagsForResourceCommand({
|
|
38062
|
-
ResourceArn:
|
|
38285
|
+
ResourceArn: pc67.ProtectConfigurationArn
|
|
38063
38286
|
})
|
|
38064
38287
|
);
|
|
38065
38288
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -38068,7 +38291,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
38068
38291
|
if (isWrapsManaged) {
|
|
38069
38292
|
await client.send(
|
|
38070
38293
|
new DeleteProtectConfigurationCommand({
|
|
38071
|
-
ProtectConfigurationId:
|
|
38294
|
+
ProtectConfigurationId: pc67.ProtectConfigurationId
|
|
38072
38295
|
})
|
|
38073
38296
|
);
|
|
38074
38297
|
}
|
|
@@ -38103,8 +38326,8 @@ async function smsDestroy(options) {
|
|
|
38103
38326
|
);
|
|
38104
38327
|
}
|
|
38105
38328
|
if (!isJsonMode()) {
|
|
38106
|
-
|
|
38107
|
-
|
|
38329
|
+
clack51.intro(
|
|
38330
|
+
pc54.bold(
|
|
38108
38331
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
38109
38332
|
)
|
|
38110
38333
|
);
|
|
@@ -38130,15 +38353,15 @@ async function smsDestroy(options) {
|
|
|
38130
38353
|
`Available regions: ${smsConnections.map((c) => c.region).join(", ")}`
|
|
38131
38354
|
);
|
|
38132
38355
|
}
|
|
38133
|
-
const selectedRegion = await
|
|
38356
|
+
const selectedRegion = await clack51.select({
|
|
38134
38357
|
message: "Multiple SMS deployments found. Which region to destroy?",
|
|
38135
38358
|
options: smsConnections.map((conn) => ({
|
|
38136
38359
|
value: conn.region,
|
|
38137
38360
|
label: conn.region
|
|
38138
38361
|
}))
|
|
38139
38362
|
});
|
|
38140
|
-
if (
|
|
38141
|
-
|
|
38363
|
+
if (clack51.isCancel(selectedRegion)) {
|
|
38364
|
+
clack51.cancel("Operation cancelled");
|
|
38142
38365
|
process.exit(0);
|
|
38143
38366
|
}
|
|
38144
38367
|
region = selectedRegion;
|
|
@@ -38149,18 +38372,18 @@ async function smsDestroy(options) {
|
|
|
38149
38372
|
const storedStackName = smsService?.pulumiStackName;
|
|
38150
38373
|
if (!smsService) {
|
|
38151
38374
|
progress.stop();
|
|
38152
|
-
|
|
38375
|
+
clack51.log.warn("No SMS infrastructure found");
|
|
38153
38376
|
process.exit(0);
|
|
38154
38377
|
}
|
|
38155
38378
|
if (!(options.force || options.preview)) {
|
|
38156
|
-
const confirmed = await
|
|
38157
|
-
message:
|
|
38379
|
+
const confirmed = await clack51.confirm({
|
|
38380
|
+
message: pc54.red(
|
|
38158
38381
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
38159
38382
|
),
|
|
38160
38383
|
initialValue: false
|
|
38161
38384
|
});
|
|
38162
|
-
if (
|
|
38163
|
-
|
|
38385
|
+
if (clack51.isCancel(confirmed) || !confirmed) {
|
|
38386
|
+
clack51.cancel("Destruction cancelled.");
|
|
38164
38387
|
process.exit(0);
|
|
38165
38388
|
}
|
|
38166
38389
|
}
|
|
@@ -38192,8 +38415,8 @@ async function smsDestroy(options) {
|
|
|
38192
38415
|
costEstimate: "Monthly cost after destruction: $0.00",
|
|
38193
38416
|
commandName: "wraps sms destroy"
|
|
38194
38417
|
});
|
|
38195
|
-
|
|
38196
|
-
|
|
38418
|
+
clack51.outro(
|
|
38419
|
+
pc54.green("Preview complete. Run without --preview to destroy.")
|
|
38197
38420
|
);
|
|
38198
38421
|
trackServiceRemoved("sms", {
|
|
38199
38422
|
preview: true,
|
|
@@ -38204,7 +38427,7 @@ async function smsDestroy(options) {
|
|
|
38204
38427
|
progress.stop();
|
|
38205
38428
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38206
38429
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
38207
|
-
|
|
38430
|
+
clack51.log.warn("No SMS infrastructure found to preview");
|
|
38208
38431
|
process.exit(0);
|
|
38209
38432
|
}
|
|
38210
38433
|
trackError("PREVIEW_FAILED", "sms destroy", { step: "preview" });
|
|
@@ -38253,7 +38476,7 @@ async function smsDestroy(options) {
|
|
|
38253
38476
|
progress.stop();
|
|
38254
38477
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38255
38478
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
38256
|
-
|
|
38479
|
+
clack51.log.warn("No SMS infrastructure found");
|
|
38257
38480
|
if (metadata) {
|
|
38258
38481
|
removeServiceFromConnection(metadata, "sms");
|
|
38259
38482
|
await saveConnectionMetadata(metadata);
|
|
@@ -38266,7 +38489,7 @@ async function smsDestroy(options) {
|
|
|
38266
38489
|
}
|
|
38267
38490
|
trackError("DESTROY_FAILED", "sms destroy", { step: "destroy" });
|
|
38268
38491
|
destroyFailed = true;
|
|
38269
|
-
|
|
38492
|
+
clack51.log.warn(
|
|
38270
38493
|
"Some resources may not have been fully removed. You can re-run this command or clean up manually in the AWS console."
|
|
38271
38494
|
);
|
|
38272
38495
|
}
|
|
@@ -38289,21 +38512,21 @@ async function smsDestroy(options) {
|
|
|
38289
38512
|
return;
|
|
38290
38513
|
}
|
|
38291
38514
|
if (destroyFailed) {
|
|
38292
|
-
|
|
38293
|
-
|
|
38515
|
+
clack51.outro(
|
|
38516
|
+
pc54.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
38294
38517
|
);
|
|
38295
38518
|
} else {
|
|
38296
|
-
|
|
38519
|
+
clack51.outro(pc54.green("SMS infrastructure has been removed"));
|
|
38297
38520
|
console.log(`
|
|
38298
|
-
${
|
|
38299
|
-
console.log(` ${
|
|
38300
|
-
console.log(` ${
|
|
38301
|
-
console.log(` ${
|
|
38302
|
-
console.log(` ${
|
|
38521
|
+
${pc54.bold("Cleaned up:")}`);
|
|
38522
|
+
console.log(` ${pc54.green("\u2713")} Phone number released`);
|
|
38523
|
+
console.log(` ${pc54.green("\u2713")} Configuration set deleted`);
|
|
38524
|
+
console.log(` ${pc54.green("\u2713")} Event processing infrastructure removed`);
|
|
38525
|
+
console.log(` ${pc54.green("\u2713")} IAM role deleted`);
|
|
38303
38526
|
}
|
|
38304
38527
|
console.log(
|
|
38305
38528
|
`
|
|
38306
|
-
Run ${
|
|
38529
|
+
Run ${pc54.cyan("wraps sms init")} to deploy infrastructure again.
|
|
38307
38530
|
`
|
|
38308
38531
|
);
|
|
38309
38532
|
trackServiceRemoved("sms", {
|
|
@@ -38315,9 +38538,9 @@ Run ${pc53.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
38315
38538
|
|
|
38316
38539
|
// src/commands/sms/init.ts
|
|
38317
38540
|
init_esm_shims();
|
|
38318
|
-
import * as
|
|
38541
|
+
import * as clack52 from "@clack/prompts";
|
|
38319
38542
|
import * as pulumi32 from "@pulumi/pulumi";
|
|
38320
|
-
import
|
|
38543
|
+
import pc55 from "picocolors";
|
|
38321
38544
|
init_events();
|
|
38322
38545
|
init_aws();
|
|
38323
38546
|
init_fs();
|
|
@@ -38736,7 +38959,7 @@ function validateSMSConfig(config2) {
|
|
|
38736
38959
|
|
|
38737
38960
|
// src/commands/sms/init.ts
|
|
38738
38961
|
async function promptPhoneNumberType() {
|
|
38739
|
-
const result = await
|
|
38962
|
+
const result = await clack52.select({
|
|
38740
38963
|
message: "Select phone number type:",
|
|
38741
38964
|
options: [
|
|
38742
38965
|
{
|
|
@@ -38756,14 +38979,14 @@ async function promptPhoneNumberType() {
|
|
|
38756
38979
|
}
|
|
38757
38980
|
]
|
|
38758
38981
|
});
|
|
38759
|
-
if (
|
|
38760
|
-
|
|
38982
|
+
if (clack52.isCancel(result)) {
|
|
38983
|
+
clack52.cancel("Operation cancelled.");
|
|
38761
38984
|
process.exit(0);
|
|
38762
38985
|
}
|
|
38763
38986
|
return result;
|
|
38764
38987
|
}
|
|
38765
38988
|
async function promptSMSPreset() {
|
|
38766
|
-
const result = await
|
|
38989
|
+
const result = await clack52.select({
|
|
38767
38990
|
message: "Choose configuration preset:",
|
|
38768
38991
|
options: [
|
|
38769
38992
|
{
|
|
@@ -38788,8 +39011,8 @@ async function promptSMSPreset() {
|
|
|
38788
39011
|
}
|
|
38789
39012
|
]
|
|
38790
39013
|
});
|
|
38791
|
-
if (
|
|
38792
|
-
|
|
39014
|
+
if (clack52.isCancel(result)) {
|
|
39015
|
+
clack52.cancel("Operation cancelled.");
|
|
38793
39016
|
process.exit(0);
|
|
38794
39017
|
}
|
|
38795
39018
|
return result;
|
|
@@ -38809,7 +39032,7 @@ var COMMON_COUNTRIES = [
|
|
|
38809
39032
|
{ code: "IN", name: "India" }
|
|
38810
39033
|
];
|
|
38811
39034
|
async function promptAllowedCountries() {
|
|
38812
|
-
const result = await
|
|
39035
|
+
const result = await clack52.multiselect({
|
|
38813
39036
|
message: "Select countries to allow SMS delivery (blocks all others):",
|
|
38814
39037
|
options: COMMON_COUNTRIES.map((c) => ({
|
|
38815
39038
|
value: c.code,
|
|
@@ -38818,14 +39041,14 @@ async function promptAllowedCountries() {
|
|
|
38818
39041
|
initialValues: ["US"],
|
|
38819
39042
|
required: true
|
|
38820
39043
|
});
|
|
38821
|
-
if (
|
|
38822
|
-
|
|
39044
|
+
if (clack52.isCancel(result)) {
|
|
39045
|
+
clack52.cancel("Operation cancelled.");
|
|
38823
39046
|
process.exit(0);
|
|
38824
39047
|
}
|
|
38825
39048
|
return result;
|
|
38826
39049
|
}
|
|
38827
39050
|
async function promptEstimatedSMSVolume() {
|
|
38828
|
-
const result = await
|
|
39051
|
+
const result = await clack52.select({
|
|
38829
39052
|
message: "Estimated messages per month:",
|
|
38830
39053
|
options: [
|
|
38831
39054
|
{ value: 100, label: "< 100 (Testing)" },
|
|
@@ -38835,8 +39058,8 @@ async function promptEstimatedSMSVolume() {
|
|
|
38835
39058
|
{ value: 1e5, label: "50,000+" }
|
|
38836
39059
|
]
|
|
38837
39060
|
});
|
|
38838
|
-
if (
|
|
38839
|
-
|
|
39061
|
+
if (clack52.isCancel(result)) {
|
|
39062
|
+
clack52.cancel("Operation cancelled.");
|
|
38840
39063
|
process.exit(0);
|
|
38841
39064
|
}
|
|
38842
39065
|
return result;
|
|
@@ -38844,7 +39067,7 @@ async function promptEstimatedSMSVolume() {
|
|
|
38844
39067
|
async function init3(options) {
|
|
38845
39068
|
const startTime = Date.now();
|
|
38846
39069
|
if (!isJsonMode()) {
|
|
38847
|
-
|
|
39070
|
+
clack52.intro(pc55.bold("Wraps SMS Infrastructure Setup"));
|
|
38848
39071
|
}
|
|
38849
39072
|
const progress = new DeploymentProgress();
|
|
38850
39073
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -38858,7 +39081,7 @@ async function init3(options) {
|
|
|
38858
39081
|
"Validating AWS credentials",
|
|
38859
39082
|
async () => validateAWSCredentials()
|
|
38860
39083
|
);
|
|
38861
|
-
progress.info(`Connected to AWS account: ${
|
|
39084
|
+
progress.info(`Connected to AWS account: ${pc55.cyan(identity.accountId)}`);
|
|
38862
39085
|
const provider = options.provider || await promptProvider();
|
|
38863
39086
|
const region = options.region || await promptRegion(await getAWSRegion());
|
|
38864
39087
|
let vercelConfig;
|
|
@@ -38870,10 +39093,10 @@ async function init3(options) {
|
|
|
38870
39093
|
region
|
|
38871
39094
|
);
|
|
38872
39095
|
if (existingConnection?.services?.sms) {
|
|
38873
|
-
|
|
38874
|
-
`SMS already configured for account ${
|
|
39096
|
+
clack52.log.warn(
|
|
39097
|
+
`SMS already configured for account ${pc55.cyan(identity.accountId)} in region ${pc55.cyan(region)}`
|
|
38875
39098
|
);
|
|
38876
|
-
|
|
39099
|
+
clack52.log.info(`Use ${pc55.cyan("wraps sms status")} to view current setup`);
|
|
38877
39100
|
process.exit(0);
|
|
38878
39101
|
}
|
|
38879
39102
|
let preset = options.preset;
|
|
@@ -38890,12 +39113,12 @@ async function init3(options) {
|
|
|
38890
39113
|
optOutManagement: true,
|
|
38891
39114
|
sendingEnabled: true
|
|
38892
39115
|
};
|
|
38893
|
-
const enableEventTracking = await
|
|
39116
|
+
const enableEventTracking = await clack52.confirm({
|
|
38894
39117
|
message: "Enable event tracking (EventBridge + DynamoDB)?",
|
|
38895
39118
|
initialValue: false
|
|
38896
39119
|
});
|
|
38897
|
-
if (
|
|
38898
|
-
|
|
39120
|
+
if (clack52.isCancel(enableEventTracking)) {
|
|
39121
|
+
clack52.cancel("Operation cancelled.");
|
|
38899
39122
|
process.exit(0);
|
|
38900
39123
|
}
|
|
38901
39124
|
if (enableEventTracking) {
|
|
@@ -38915,17 +39138,17 @@ async function init3(options) {
|
|
|
38915
39138
|
}
|
|
38916
39139
|
progress.info(
|
|
38917
39140
|
`
|
|
38918
|
-
${
|
|
39141
|
+
${pc55.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
38919
39142
|
);
|
|
38920
39143
|
const allowedCountries = await promptAllowedCountries();
|
|
38921
39144
|
let aitFiltering = false;
|
|
38922
39145
|
if (smsConfig.phoneNumberType !== "simulator") {
|
|
38923
|
-
const enableAIT = await
|
|
39146
|
+
const enableAIT = await clack52.confirm({
|
|
38924
39147
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
38925
39148
|
initialValue: false
|
|
38926
39149
|
});
|
|
38927
|
-
if (
|
|
38928
|
-
|
|
39150
|
+
if (clack52.isCancel(enableAIT)) {
|
|
39151
|
+
clack52.cancel("Operation cancelled.");
|
|
38929
39152
|
process.exit(0);
|
|
38930
39153
|
}
|
|
38931
39154
|
aitFiltering = enableAIT;
|
|
@@ -38937,21 +39160,21 @@ ${pc54.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
38937
39160
|
};
|
|
38938
39161
|
const estimatedVolume = await promptEstimatedSMSVolume();
|
|
38939
39162
|
progress.info(`
|
|
38940
|
-
${
|
|
39163
|
+
${pc55.bold("Cost Estimate:")}`);
|
|
38941
39164
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
38942
|
-
|
|
39165
|
+
clack52.log.info(costSummary);
|
|
38943
39166
|
const warnings = validateSMSConfig(smsConfig);
|
|
38944
39167
|
if (warnings.length > 0) {
|
|
38945
39168
|
progress.info(`
|
|
38946
|
-
${
|
|
39169
|
+
${pc55.yellow(pc55.bold("Important Notes:"))}`);
|
|
38947
39170
|
for (const warning of warnings) {
|
|
38948
|
-
|
|
39171
|
+
clack52.log.warn(warning);
|
|
38949
39172
|
}
|
|
38950
39173
|
}
|
|
38951
39174
|
if (!(options.yes || options.preview)) {
|
|
38952
39175
|
const confirmed = await confirmDeploy();
|
|
38953
39176
|
if (!confirmed) {
|
|
38954
|
-
|
|
39177
|
+
clack52.cancel("Deployment cancelled.");
|
|
38955
39178
|
process.exit(0);
|
|
38956
39179
|
}
|
|
38957
39180
|
}
|
|
@@ -39011,8 +39234,8 @@ ${pc54.yellow(pc54.bold("Important Notes:"))}`);
|
|
|
39011
39234
|
costEstimate: getSMSCostSummary(smsConfig, 0),
|
|
39012
39235
|
commandName: "wraps sms init"
|
|
39013
39236
|
});
|
|
39014
|
-
|
|
39015
|
-
|
|
39237
|
+
clack52.outro(
|
|
39238
|
+
pc55.green("Preview complete. Run without --preview to deploy.")
|
|
39016
39239
|
);
|
|
39017
39240
|
trackServiceInit("sms", true, {
|
|
39018
39241
|
provider,
|
|
@@ -39061,9 +39284,9 @@ ${pc54.yellow(pc54.bold("Important Notes:"))}`);
|
|
|
39061
39284
|
} catch (sdkError) {
|
|
39062
39285
|
sdkResourceWarning = true;
|
|
39063
39286
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39064
|
-
|
|
39065
|
-
|
|
39066
|
-
`Run ${
|
|
39287
|
+
clack52.log.warn(`Phone pool creation failed: ${msg}`);
|
|
39288
|
+
clack52.log.info(
|
|
39289
|
+
`Run ${pc55.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39067
39290
|
);
|
|
39068
39291
|
}
|
|
39069
39292
|
}
|
|
@@ -39079,9 +39302,9 @@ ${pc54.yellow(pc54.bold("Important Notes:"))}`);
|
|
|
39079
39302
|
} catch (sdkError) {
|
|
39080
39303
|
sdkResourceWarning = true;
|
|
39081
39304
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39082
|
-
|
|
39083
|
-
|
|
39084
|
-
`Run ${
|
|
39305
|
+
clack52.log.warn(`Event destination creation failed: ${msg}`);
|
|
39306
|
+
clack52.log.info(
|
|
39307
|
+
`Run ${pc55.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39085
39308
|
);
|
|
39086
39309
|
}
|
|
39087
39310
|
}
|
|
@@ -39100,14 +39323,14 @@ ${pc54.yellow(pc54.bold("Important Notes:"))}`);
|
|
|
39100
39323
|
} catch (sdkError) {
|
|
39101
39324
|
sdkResourceWarning = true;
|
|
39102
39325
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39103
|
-
|
|
39104
|
-
|
|
39105
|
-
`Run ${
|
|
39326
|
+
clack52.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
39327
|
+
clack52.log.info(
|
|
39328
|
+
`Run ${pc55.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39106
39329
|
);
|
|
39107
39330
|
}
|
|
39108
39331
|
}
|
|
39109
39332
|
if (sdkResourceWarning) {
|
|
39110
|
-
|
|
39333
|
+
clack52.log.warn(
|
|
39111
39334
|
"Some SDK resources failed to create. Core infrastructure is deployed."
|
|
39112
39335
|
);
|
|
39113
39336
|
}
|
|
@@ -39152,47 +39375,47 @@ ${pc54.yellow(pc54.bold("Important Notes:"))}`);
|
|
|
39152
39375
|
return;
|
|
39153
39376
|
}
|
|
39154
39377
|
console.log("\n");
|
|
39155
|
-
|
|
39378
|
+
clack52.log.success(pc55.green(pc55.bold("SMS infrastructure deployed!")));
|
|
39156
39379
|
console.log("\n");
|
|
39157
|
-
|
|
39380
|
+
clack52.note(
|
|
39158
39381
|
[
|
|
39159
|
-
`${
|
|
39160
|
-
`${
|
|
39161
|
-
`${
|
|
39162
|
-
`${
|
|
39163
|
-
outputs.tableName ? `${
|
|
39382
|
+
`${pc55.bold("Phone Number:")} ${pc55.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
39383
|
+
`${pc55.bold("Phone Type:")} ${pc55.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
39384
|
+
`${pc55.bold("Config Set:")} ${pc55.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
39385
|
+
`${pc55.bold("Region:")} ${pc55.cyan(outputs.region)}`,
|
|
39386
|
+
outputs.tableName ? `${pc55.bold("History Table:")} ${pc55.cyan(outputs.tableName)}` : "",
|
|
39164
39387
|
"",
|
|
39165
|
-
|
|
39166
|
-
|
|
39388
|
+
pc55.dim("IAM Role:"),
|
|
39389
|
+
pc55.dim(` ${outputs.roleArn}`)
|
|
39167
39390
|
].filter(Boolean).join("\n"),
|
|
39168
39391
|
"SMS Infrastructure"
|
|
39169
39392
|
);
|
|
39170
39393
|
const nextSteps = [];
|
|
39171
39394
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
39172
39395
|
nextSteps.push(
|
|
39173
|
-
`${
|
|
39396
|
+
`${pc55.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
39174
39397
|
);
|
|
39175
39398
|
}
|
|
39176
39399
|
nextSteps.push(
|
|
39177
|
-
`${
|
|
39400
|
+
`${pc55.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
39178
39401
|
);
|
|
39179
|
-
nextSteps.push(`${
|
|
39402
|
+
nextSteps.push(`${pc55.cyan("wraps sms status")} - View SMS configuration`);
|
|
39180
39403
|
console.log("\n");
|
|
39181
|
-
|
|
39404
|
+
clack52.log.info(pc55.bold("Next steps:"));
|
|
39182
39405
|
for (const step of nextSteps) {
|
|
39183
39406
|
console.log(` ${step}`);
|
|
39184
39407
|
}
|
|
39185
39408
|
console.log("\n");
|
|
39186
|
-
|
|
39187
|
-
console.log(
|
|
39409
|
+
clack52.log.info(pc55.bold("SDK Usage:"));
|
|
39410
|
+
console.log(pc55.dim(" npm install @wraps.dev/sms"));
|
|
39188
39411
|
console.log("");
|
|
39189
|
-
console.log(
|
|
39190
|
-
console.log(
|
|
39191
|
-
console.log(
|
|
39192
|
-
console.log(
|
|
39193
|
-
console.log(
|
|
39194
|
-
console.log(
|
|
39195
|
-
|
|
39412
|
+
console.log(pc55.dim(" import { Wraps } from '@wraps.dev/sms';"));
|
|
39413
|
+
console.log(pc55.dim(" const wraps = new Wraps();"));
|
|
39414
|
+
console.log(pc55.dim(" await wraps.sms.send({"));
|
|
39415
|
+
console.log(pc55.dim(" to: '+14155551234',"));
|
|
39416
|
+
console.log(pc55.dim(" message: 'Your code is 123456',"));
|
|
39417
|
+
console.log(pc55.dim(" });"));
|
|
39418
|
+
clack52.outro(pc55.green("Setup complete!"));
|
|
39196
39419
|
const duration = Date.now() - startTime;
|
|
39197
39420
|
const enabledFeatures = [];
|
|
39198
39421
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -39228,8 +39451,8 @@ init_aws();
|
|
|
39228
39451
|
init_json_output();
|
|
39229
39452
|
init_metadata();
|
|
39230
39453
|
init_output();
|
|
39231
|
-
import * as
|
|
39232
|
-
import
|
|
39454
|
+
import * as clack53 from "@clack/prompts";
|
|
39455
|
+
import pc56 from "picocolors";
|
|
39233
39456
|
async function getPhoneNumberDetails(region) {
|
|
39234
39457
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
39235
39458
|
const client = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -39249,7 +39472,7 @@ async function getPhoneNumberDetails(region) {
|
|
|
39249
39472
|
return null;
|
|
39250
39473
|
} catch (error) {
|
|
39251
39474
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
39252
|
-
|
|
39475
|
+
clack53.log.error(`Error fetching phone number: ${errorMessage}`);
|
|
39253
39476
|
return null;
|
|
39254
39477
|
}
|
|
39255
39478
|
}
|
|
@@ -39270,7 +39493,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
39270
39493
|
async function smsRegister(options) {
|
|
39271
39494
|
const startTime = Date.now();
|
|
39272
39495
|
if (!isJsonMode()) {
|
|
39273
|
-
|
|
39496
|
+
clack53.intro(pc56.bold("Wraps SMS - Toll-Free Registration"));
|
|
39274
39497
|
}
|
|
39275
39498
|
const progress = new DeploymentProgress();
|
|
39276
39499
|
const identity = await progress.execute(
|
|
@@ -39283,8 +39506,8 @@ async function smsRegister(options) {
|
|
|
39283
39506
|
}
|
|
39284
39507
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
39285
39508
|
if (!metadata?.services?.sms) {
|
|
39286
|
-
|
|
39287
|
-
|
|
39509
|
+
clack53.log.error("No SMS infrastructure found.");
|
|
39510
|
+
clack53.log.info(`Run ${pc56.cyan("wraps sms init")} first.`);
|
|
39288
39511
|
process.exit(1);
|
|
39289
39512
|
}
|
|
39290
39513
|
const phoneDetails = await progress.execute(
|
|
@@ -39292,7 +39515,7 @@ async function smsRegister(options) {
|
|
|
39292
39515
|
async () => getPhoneNumberDetails(region)
|
|
39293
39516
|
);
|
|
39294
39517
|
if (!phoneDetails) {
|
|
39295
|
-
|
|
39518
|
+
clack53.log.error("No phone number found.");
|
|
39296
39519
|
process.exit(1);
|
|
39297
39520
|
}
|
|
39298
39521
|
let registrationStatus = null;
|
|
@@ -39318,53 +39541,53 @@ async function smsRegister(options) {
|
|
|
39318
39541
|
}
|
|
39319
39542
|
console.log("");
|
|
39320
39543
|
console.log(
|
|
39321
|
-
`${
|
|
39544
|
+
`${pc56.bold("Phone Number:")} ${pc56.cyan(phoneDetails.phoneNumber)}`
|
|
39322
39545
|
);
|
|
39323
|
-
console.log(`${
|
|
39546
|
+
console.log(`${pc56.bold("Type:")} ${pc56.cyan(phoneDetails.type)}`);
|
|
39324
39547
|
console.log(
|
|
39325
|
-
`${
|
|
39548
|
+
`${pc56.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc56.green(phoneDetails.status) : pc56.yellow(phoneDetails.status)}`
|
|
39326
39549
|
);
|
|
39327
39550
|
if (registrationStatus) {
|
|
39328
|
-
console.log(`${
|
|
39551
|
+
console.log(`${pc56.bold("Registration:")} ${pc56.cyan(registrationStatus)}`);
|
|
39329
39552
|
}
|
|
39330
39553
|
console.log("");
|
|
39331
39554
|
if (phoneDetails.status === "ACTIVE") {
|
|
39332
|
-
|
|
39555
|
+
clack53.log.success("Your phone number is already ACTIVE and ready to use!");
|
|
39333
39556
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePoolsCommand } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
39334
39557
|
const client = new PinpointSMSVoiceV2Client5({ region });
|
|
39335
39558
|
const pools = await client.send(new DescribePoolsCommand({}));
|
|
39336
39559
|
if (!pools.Pools?.length) {
|
|
39337
|
-
|
|
39560
|
+
clack53.log.info("Run `wraps sms sync` to create the phone pool.");
|
|
39338
39561
|
}
|
|
39339
39562
|
process.exit(0);
|
|
39340
39563
|
}
|
|
39341
39564
|
if (phoneDetails.type !== "TOLL_FREE") {
|
|
39342
|
-
|
|
39343
|
-
|
|
39565
|
+
clack53.log.info("Only toll-free numbers require registration.");
|
|
39566
|
+
clack53.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
39344
39567
|
process.exit(0);
|
|
39345
39568
|
}
|
|
39346
|
-
console.log(
|
|
39569
|
+
console.log(pc56.bold("Toll-Free Registration Required"));
|
|
39347
39570
|
console.log("");
|
|
39348
39571
|
console.log(
|
|
39349
|
-
|
|
39572
|
+
pc56.dim("To send SMS at scale, you must register your toll-free number.")
|
|
39350
39573
|
);
|
|
39351
|
-
console.log(
|
|
39574
|
+
console.log(pc56.dim("This process typically takes 1-15 business days."));
|
|
39352
39575
|
console.log("");
|
|
39353
|
-
console.log(
|
|
39354
|
-
console.log(` ${
|
|
39576
|
+
console.log(pc56.bold("You'll need to provide:"));
|
|
39577
|
+
console.log(` ${pc56.dim("\u2022")} Business name and address`);
|
|
39355
39578
|
console.log(
|
|
39356
|
-
` ${
|
|
39579
|
+
` ${pc56.dim("\u2022")} Use case description (what messages you're sending)`
|
|
39357
39580
|
);
|
|
39358
|
-
console.log(` ${
|
|
39359
|
-
console.log(` ${
|
|
39360
|
-
console.log(` ${
|
|
39581
|
+
console.log(` ${pc56.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
39582
|
+
console.log(` ${pc56.dim("\u2022")} How users opt-in to receive messages`);
|
|
39583
|
+
console.log(` ${pc56.dim("\u2022")} Expected monthly message volume`);
|
|
39361
39584
|
console.log("");
|
|
39362
|
-
const openConsole = await
|
|
39585
|
+
const openConsole = await clack53.confirm({
|
|
39363
39586
|
message: "Open AWS Console to start registration?",
|
|
39364
39587
|
initialValue: true
|
|
39365
39588
|
});
|
|
39366
|
-
if (
|
|
39367
|
-
|
|
39589
|
+
if (clack53.isCancel(openConsole)) {
|
|
39590
|
+
clack53.cancel("Registration cancelled.");
|
|
39368
39591
|
process.exit(0);
|
|
39369
39592
|
}
|
|
39370
39593
|
if (openConsole) {
|
|
@@ -39374,41 +39597,41 @@ async function smsRegister(options) {
|
|
|
39374
39597
|
const execAsync2 = promisify2(exec2);
|
|
39375
39598
|
try {
|
|
39376
39599
|
await execAsync2(`open "${consoleUrl}"`);
|
|
39377
|
-
|
|
39600
|
+
clack53.log.success("Opened AWS Console in your browser.");
|
|
39378
39601
|
} catch {
|
|
39379
39602
|
try {
|
|
39380
39603
|
await execAsync2(`xdg-open "${consoleUrl}"`);
|
|
39381
|
-
|
|
39604
|
+
clack53.log.success("Opened AWS Console in your browser.");
|
|
39382
39605
|
} catch {
|
|
39383
|
-
|
|
39606
|
+
clack53.log.info("Open this URL in your browser:");
|
|
39384
39607
|
console.log(`
|
|
39385
|
-
${
|
|
39608
|
+
${pc56.cyan(consoleUrl)}
|
|
39386
39609
|
`);
|
|
39387
39610
|
}
|
|
39388
39611
|
}
|
|
39389
39612
|
console.log("");
|
|
39390
|
-
console.log(
|
|
39613
|
+
console.log(pc56.bold("Next Steps:"));
|
|
39391
39614
|
console.log(
|
|
39392
|
-
` 1. Click ${
|
|
39615
|
+
` 1. Click ${pc56.cyan("Create registration")} in the AWS Console`
|
|
39393
39616
|
);
|
|
39394
|
-
console.log(` 2. Select ${
|
|
39617
|
+
console.log(` 2. Select ${pc56.cyan("Toll-free number registration")}`);
|
|
39395
39618
|
console.log(" 3. Fill out the business information form");
|
|
39396
39619
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
39397
39620
|
console.log("");
|
|
39398
39621
|
console.log(
|
|
39399
|
-
|
|
39622
|
+
pc56.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
39400
39623
|
);
|
|
39401
39624
|
} else {
|
|
39402
39625
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
39403
39626
|
console.log("");
|
|
39404
39627
|
console.log("When you're ready, go to:");
|
|
39405
|
-
console.log(` ${
|
|
39628
|
+
console.log(` ${pc56.cyan(consoleUrl)}`);
|
|
39406
39629
|
}
|
|
39407
39630
|
trackCommand("sms:register", {
|
|
39408
39631
|
success: true,
|
|
39409
39632
|
duration_ms: Date.now() - startTime
|
|
39410
39633
|
});
|
|
39411
|
-
|
|
39634
|
+
clack53.outro(pc56.dim("Good luck with your registration!"));
|
|
39412
39635
|
}
|
|
39413
39636
|
|
|
39414
39637
|
// src/commands/sms/status.ts
|
|
@@ -39421,54 +39644,54 @@ init_metadata();
|
|
|
39421
39644
|
init_output();
|
|
39422
39645
|
init_pulumi();
|
|
39423
39646
|
init_region_resolver();
|
|
39424
|
-
import * as
|
|
39647
|
+
import * as clack54 from "@clack/prompts";
|
|
39425
39648
|
import * as pulumi33 from "@pulumi/pulumi";
|
|
39426
|
-
import
|
|
39649
|
+
import pc57 from "picocolors";
|
|
39427
39650
|
function displaySMSStatus(options) {
|
|
39428
39651
|
const lines = [];
|
|
39429
|
-
lines.push(
|
|
39652
|
+
lines.push(pc57.bold(pc57.green("SMS Infrastructure Active")));
|
|
39430
39653
|
lines.push("");
|
|
39431
|
-
lines.push(
|
|
39654
|
+
lines.push(pc57.bold("Phone Number"));
|
|
39432
39655
|
if (options.phoneNumber) {
|
|
39433
|
-
lines.push(` Number: ${
|
|
39656
|
+
lines.push(` Number: ${pc57.cyan(options.phoneNumber)}`);
|
|
39434
39657
|
} else {
|
|
39435
|
-
lines.push(` Number: ${
|
|
39658
|
+
lines.push(` Number: ${pc57.yellow("Provisioning...")}`);
|
|
39436
39659
|
}
|
|
39437
|
-
lines.push(` Type: ${
|
|
39660
|
+
lines.push(` Type: ${pc57.cyan(options.phoneNumberType || "simulator")}`);
|
|
39438
39661
|
lines.push("");
|
|
39439
|
-
lines.push(
|
|
39440
|
-
lines.push(` Region: ${
|
|
39662
|
+
lines.push(pc57.bold("Configuration"));
|
|
39663
|
+
lines.push(` Region: ${pc57.cyan(options.region)}`);
|
|
39441
39664
|
if (options.preset) {
|
|
39442
|
-
lines.push(` Preset: ${
|
|
39665
|
+
lines.push(` Preset: ${pc57.cyan(options.preset)}`);
|
|
39443
39666
|
}
|
|
39444
39667
|
if (options.configSetName) {
|
|
39445
|
-
lines.push(` Config Set: ${
|
|
39668
|
+
lines.push(` Config Set: ${pc57.cyan(options.configSetName)}`);
|
|
39446
39669
|
}
|
|
39447
39670
|
lines.push("");
|
|
39448
|
-
lines.push(
|
|
39671
|
+
lines.push(pc57.bold("Features"));
|
|
39449
39672
|
lines.push(
|
|
39450
|
-
` Event Tracking: ${options.eventTracking ?
|
|
39673
|
+
` Event Tracking: ${options.eventTracking ? pc57.green("Enabled") : pc57.dim("Disabled")}`
|
|
39451
39674
|
);
|
|
39452
39675
|
if (options.tableName) {
|
|
39453
|
-
lines.push(` Message History: ${
|
|
39454
|
-
lines.push(` Table: ${
|
|
39676
|
+
lines.push(` Message History: ${pc57.green("Enabled")}`);
|
|
39677
|
+
lines.push(` Table: ${pc57.dim(options.tableName)}`);
|
|
39455
39678
|
}
|
|
39456
39679
|
if (options.queueUrl) {
|
|
39457
|
-
lines.push(` Event Queue: ${
|
|
39680
|
+
lines.push(` Event Queue: ${pc57.green("Enabled")}`);
|
|
39458
39681
|
}
|
|
39459
39682
|
lines.push("");
|
|
39460
39683
|
if (options.roleArn) {
|
|
39461
|
-
lines.push(
|
|
39462
|
-
lines.push(` ${
|
|
39684
|
+
lines.push(pc57.bold("IAM Role"));
|
|
39685
|
+
lines.push(` ${pc57.dim(options.roleArn)}`);
|
|
39463
39686
|
}
|
|
39464
|
-
|
|
39687
|
+
clack54.note(lines.join("\n"), "SMS Status");
|
|
39465
39688
|
}
|
|
39466
39689
|
async function smsStatus(options) {
|
|
39467
39690
|
await ensurePulumiInstalled();
|
|
39468
39691
|
const startTime = Date.now();
|
|
39469
39692
|
const progress = new DeploymentProgress();
|
|
39470
39693
|
if (!isJsonMode()) {
|
|
39471
|
-
|
|
39694
|
+
clack54.intro(pc57.bold("Wraps SMS Status"));
|
|
39472
39695
|
}
|
|
39473
39696
|
const identity = await progress.execute(
|
|
39474
39697
|
"Loading SMS infrastructure status",
|
|
@@ -39483,10 +39706,10 @@ async function smsStatus(options) {
|
|
|
39483
39706
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
39484
39707
|
if (!metadata?.services?.sms) {
|
|
39485
39708
|
progress.stop();
|
|
39486
|
-
|
|
39709
|
+
clack54.log.error("No SMS infrastructure found");
|
|
39487
39710
|
console.log(
|
|
39488
39711
|
`
|
|
39489
|
-
Run ${
|
|
39712
|
+
Run ${pc57.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
39490
39713
|
`
|
|
39491
39714
|
);
|
|
39492
39715
|
process.exit(1);
|
|
@@ -39522,25 +39745,25 @@ Run ${pc56.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39522
39745
|
}
|
|
39523
39746
|
displaySMSStatus(smsStatusData);
|
|
39524
39747
|
console.log("");
|
|
39525
|
-
|
|
39748
|
+
clack54.log.info(pc57.bold("Commands:"));
|
|
39526
39749
|
console.log(
|
|
39527
|
-
` ${
|
|
39750
|
+
` ${pc57.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
39528
39751
|
);
|
|
39529
|
-
console.log(` ${
|
|
39752
|
+
console.log(` ${pc57.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
39530
39753
|
trackCommand("sms:status", {
|
|
39531
39754
|
success: true,
|
|
39532
39755
|
phone_type: smsConfig?.phoneNumberType,
|
|
39533
39756
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
39534
39757
|
duration_ms: Date.now() - startTime
|
|
39535
39758
|
});
|
|
39536
|
-
|
|
39759
|
+
clack54.outro(pc57.dim("SMS infrastructure is ready"));
|
|
39537
39760
|
}
|
|
39538
39761
|
|
|
39539
39762
|
// src/commands/sms/sync.ts
|
|
39540
39763
|
init_esm_shims();
|
|
39541
|
-
import * as
|
|
39764
|
+
import * as clack55 from "@clack/prompts";
|
|
39542
39765
|
import * as pulumi34 from "@pulumi/pulumi";
|
|
39543
|
-
import
|
|
39766
|
+
import pc58 from "picocolors";
|
|
39544
39767
|
init_events();
|
|
39545
39768
|
init_aws();
|
|
39546
39769
|
init_errors();
|
|
@@ -39553,7 +39776,7 @@ async function smsSync(options) {
|
|
|
39553
39776
|
await ensurePulumiInstalled();
|
|
39554
39777
|
const startTime = Date.now();
|
|
39555
39778
|
if (!isJsonMode()) {
|
|
39556
|
-
|
|
39779
|
+
clack55.intro(pc58.bold("Wraps SMS Infrastructure Sync"));
|
|
39557
39780
|
}
|
|
39558
39781
|
const progress = new DeploymentProgress();
|
|
39559
39782
|
const identity = await progress.execute(
|
|
@@ -39565,10 +39788,10 @@ async function smsSync(options) {
|
|
|
39565
39788
|
const smsService = metadata?.services?.sms;
|
|
39566
39789
|
if (!smsService?.config) {
|
|
39567
39790
|
progress.stop();
|
|
39568
|
-
|
|
39791
|
+
clack55.log.error("No SMS infrastructure found to sync");
|
|
39569
39792
|
console.log(
|
|
39570
39793
|
`
|
|
39571
|
-
Run ${
|
|
39794
|
+
Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
39572
39795
|
`
|
|
39573
39796
|
);
|
|
39574
39797
|
process.exit(1);
|
|
@@ -39577,18 +39800,18 @@ Run ${pc57.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
39577
39800
|
const storedStackName = smsService.pulumiStackName;
|
|
39578
39801
|
progress.info("Found existing SMS configuration");
|
|
39579
39802
|
progress.info(
|
|
39580
|
-
`Phone type: ${
|
|
39803
|
+
`Phone type: ${pc58.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
39581
39804
|
);
|
|
39582
39805
|
progress.info(
|
|
39583
|
-
`Event tracking: ${
|
|
39806
|
+
`Event tracking: ${pc58.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
39584
39807
|
);
|
|
39585
39808
|
if (!options.yes) {
|
|
39586
|
-
const confirmed = await
|
|
39809
|
+
const confirmed = await clack55.confirm({
|
|
39587
39810
|
message: "Sync SMS infrastructure? This will update Lambda code and recreate any missing resources.",
|
|
39588
39811
|
initialValue: true
|
|
39589
39812
|
});
|
|
39590
|
-
if (
|
|
39591
|
-
|
|
39813
|
+
if (clack55.isCancel(confirmed) || !confirmed) {
|
|
39814
|
+
clack55.cancel("Sync cancelled.");
|
|
39592
39815
|
process.exit(0);
|
|
39593
39816
|
}
|
|
39594
39817
|
}
|
|
@@ -39693,7 +39916,7 @@ Run ${pc57.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
39693
39916
|
throw errors.stackLocked();
|
|
39694
39917
|
}
|
|
39695
39918
|
trackError("SYNC_FAILED", "sms:sync", { step: "sync" });
|
|
39696
|
-
|
|
39919
|
+
clack55.log.error(`SMS sync failed: ${errorMessage}`);
|
|
39697
39920
|
process.exit(1);
|
|
39698
39921
|
}
|
|
39699
39922
|
if (metadata && smsService) {
|
|
@@ -39713,7 +39936,7 @@ Run ${pc57.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
39713
39936
|
return;
|
|
39714
39937
|
}
|
|
39715
39938
|
console.log("\n");
|
|
39716
|
-
|
|
39939
|
+
clack55.log.success(pc58.green("SMS infrastructure synced successfully!"));
|
|
39717
39940
|
const changes = [];
|
|
39718
39941
|
if (outputs.lambdaFunctions?.length) {
|
|
39719
39942
|
changes.push("Lambda functions updated");
|
|
@@ -39721,13 +39944,13 @@ Run ${pc57.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
39721
39944
|
changes.push("SDK resources verified");
|
|
39722
39945
|
console.log("");
|
|
39723
39946
|
for (const change of changes) {
|
|
39724
|
-
console.log(` ${
|
|
39947
|
+
console.log(` ${pc58.green("\u2713")} ${change}`);
|
|
39725
39948
|
}
|
|
39726
39949
|
trackCommand("sms:sync", {
|
|
39727
39950
|
success: true,
|
|
39728
39951
|
duration_ms: Date.now() - startTime
|
|
39729
39952
|
});
|
|
39730
|
-
|
|
39953
|
+
clack55.outro(pc58.green("Sync complete!"));
|
|
39731
39954
|
}
|
|
39732
39955
|
|
|
39733
39956
|
// src/commands/sms/test.ts
|
|
@@ -39742,8 +39965,8 @@ import {
|
|
|
39742
39965
|
PinpointSMSVoiceV2Client as PinpointSMSVoiceV2Client3,
|
|
39743
39966
|
SendTextMessageCommand
|
|
39744
39967
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
39745
|
-
import * as
|
|
39746
|
-
import
|
|
39968
|
+
import * as clack56 from "@clack/prompts";
|
|
39969
|
+
import pc59 from "picocolors";
|
|
39747
39970
|
|
|
39748
39971
|
// src/utils/sms/validation.ts
|
|
39749
39972
|
init_esm_shims();
|
|
@@ -39766,7 +39989,7 @@ async function smsTest(options) {
|
|
|
39766
39989
|
const startTime = Date.now();
|
|
39767
39990
|
const progress = new DeploymentProgress();
|
|
39768
39991
|
if (!isJsonMode()) {
|
|
39769
|
-
|
|
39992
|
+
clack56.intro(pc59.bold("Wraps SMS Test"));
|
|
39770
39993
|
}
|
|
39771
39994
|
const identity = await progress.execute(
|
|
39772
39995
|
"Validating AWS credentials",
|
|
@@ -39776,10 +39999,10 @@ async function smsTest(options) {
|
|
|
39776
39999
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
39777
40000
|
if (!metadata?.services?.sms) {
|
|
39778
40001
|
progress.stop();
|
|
39779
|
-
|
|
40002
|
+
clack56.log.error("No SMS infrastructure found");
|
|
39780
40003
|
console.log(
|
|
39781
40004
|
`
|
|
39782
|
-
Run ${
|
|
40005
|
+
Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
39783
40006
|
`
|
|
39784
40007
|
);
|
|
39785
40008
|
process.exit(1);
|
|
@@ -39793,7 +40016,7 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39793
40016
|
);
|
|
39794
40017
|
}
|
|
39795
40018
|
if (!toNumber) {
|
|
39796
|
-
const destinationType = await
|
|
40019
|
+
const destinationType = await clack56.select({
|
|
39797
40020
|
message: "Choose destination number:",
|
|
39798
40021
|
options: [
|
|
39799
40022
|
{
|
|
@@ -39808,25 +40031,25 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39808
40031
|
}
|
|
39809
40032
|
]
|
|
39810
40033
|
});
|
|
39811
|
-
if (
|
|
39812
|
-
|
|
40034
|
+
if (clack56.isCancel(destinationType)) {
|
|
40035
|
+
clack56.cancel("Operation cancelled.");
|
|
39813
40036
|
process.exit(0);
|
|
39814
40037
|
}
|
|
39815
40038
|
if (destinationType === "simulator") {
|
|
39816
|
-
const simResult = await
|
|
40039
|
+
const simResult = await clack56.select({
|
|
39817
40040
|
message: "Select simulator destination:",
|
|
39818
40041
|
options: SIMULATOR_DESTINATIONS.map((sim) => ({
|
|
39819
40042
|
value: sim.number,
|
|
39820
40043
|
label: `${sim.number} | ${sim.country}`
|
|
39821
40044
|
}))
|
|
39822
40045
|
});
|
|
39823
|
-
if (
|
|
39824
|
-
|
|
40046
|
+
if (clack56.isCancel(simResult)) {
|
|
40047
|
+
clack56.cancel("Operation cancelled.");
|
|
39825
40048
|
process.exit(0);
|
|
39826
40049
|
}
|
|
39827
40050
|
toNumber = simResult;
|
|
39828
40051
|
} else {
|
|
39829
|
-
const result = await
|
|
40052
|
+
const result = await clack56.text({
|
|
39830
40053
|
message: "Enter destination phone number (E.164 format):",
|
|
39831
40054
|
placeholder: "+14155551234",
|
|
39832
40055
|
validate: (value) => {
|
|
@@ -39839,22 +40062,22 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39839
40062
|
return;
|
|
39840
40063
|
}
|
|
39841
40064
|
});
|
|
39842
|
-
if (
|
|
39843
|
-
|
|
40065
|
+
if (clack56.isCancel(result)) {
|
|
40066
|
+
clack56.cancel("Operation cancelled.");
|
|
39844
40067
|
process.exit(0);
|
|
39845
40068
|
}
|
|
39846
40069
|
toNumber = result;
|
|
39847
40070
|
}
|
|
39848
40071
|
} else if (!isValidPhoneNumber(toNumber)) {
|
|
39849
40072
|
progress.stop();
|
|
39850
|
-
|
|
40073
|
+
clack56.log.error(
|
|
39851
40074
|
`Invalid phone number format: ${toNumber}. Use E.164 format (e.g., +14155551234)`
|
|
39852
40075
|
);
|
|
39853
40076
|
process.exit(1);
|
|
39854
40077
|
}
|
|
39855
40078
|
let message = options.message;
|
|
39856
40079
|
if (!message) {
|
|
39857
|
-
const result = await
|
|
40080
|
+
const result = await clack56.text({
|
|
39858
40081
|
message: "Enter test message:",
|
|
39859
40082
|
placeholder: "Hello from Wraps SMS!",
|
|
39860
40083
|
defaultValue: "Hello from Wraps SMS! This is a test message.",
|
|
@@ -39868,8 +40091,8 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39868
40091
|
return;
|
|
39869
40092
|
}
|
|
39870
40093
|
});
|
|
39871
|
-
if (
|
|
39872
|
-
|
|
40094
|
+
if (clack56.isCancel(result)) {
|
|
40095
|
+
clack56.cancel("Operation cancelled.");
|
|
39873
40096
|
process.exit(0);
|
|
39874
40097
|
}
|
|
39875
40098
|
message = result;
|
|
@@ -39908,16 +40131,16 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39908
40131
|
return;
|
|
39909
40132
|
}
|
|
39910
40133
|
console.log("\n");
|
|
39911
|
-
|
|
40134
|
+
clack56.log.success(pc59.green("Test SMS sent successfully!"));
|
|
39912
40135
|
console.log("");
|
|
39913
|
-
|
|
40136
|
+
clack56.note(
|
|
39914
40137
|
[
|
|
39915
|
-
`${
|
|
39916
|
-
`${
|
|
39917
|
-
`${
|
|
39918
|
-
`${
|
|
40138
|
+
`${pc59.bold("Message ID:")} ${pc59.cyan(messageId || "unknown")}`,
|
|
40139
|
+
`${pc59.bold("To:")} ${pc59.cyan(toNumber)}`,
|
|
40140
|
+
`${pc59.bold("Message:")} ${message}`,
|
|
40141
|
+
`${pc59.bold("Type:")} ${pc59.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
39919
40142
|
"",
|
|
39920
|
-
|
|
40143
|
+
pc59.dim(
|
|
39921
40144
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
39922
40145
|
)
|
|
39923
40146
|
].join("\n"),
|
|
@@ -39925,11 +40148,11 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39925
40148
|
);
|
|
39926
40149
|
if (smsConfig?.eventTracking?.enabled) {
|
|
39927
40150
|
console.log("");
|
|
39928
|
-
|
|
39929
|
-
|
|
40151
|
+
clack56.log.info(
|
|
40152
|
+
pc59.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
39930
40153
|
);
|
|
39931
40154
|
}
|
|
39932
|
-
|
|
40155
|
+
clack56.outro(pc59.green("Test complete!"));
|
|
39933
40156
|
} catch (error) {
|
|
39934
40157
|
progress.stop();
|
|
39935
40158
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -39941,33 +40164,33 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39941
40164
|
});
|
|
39942
40165
|
const errorName = error instanceof Error ? error.name : "";
|
|
39943
40166
|
if (errorName === "ConflictException" || errorMessage.includes("opt-out")) {
|
|
39944
|
-
|
|
40167
|
+
clack56.log.error("Destination number has opted out of messages");
|
|
39945
40168
|
console.log("\nThe recipient has opted out of receiving SMS messages.\n");
|
|
39946
40169
|
} else if (errorName === "ThrottlingException" || errorMessage.includes("spending limit")) {
|
|
39947
|
-
|
|
40170
|
+
clack56.log.error("SMS rate or spending limit reached");
|
|
39948
40171
|
console.log(
|
|
39949
40172
|
"\nCheck your AWS account SMS spending limits in the console.\n"
|
|
39950
40173
|
);
|
|
39951
40174
|
} else if (errorName === "ValidationException") {
|
|
39952
|
-
|
|
40175
|
+
clack56.log.error(`Invalid request: ${errorMessage}`);
|
|
39953
40176
|
} else if (errorMessage.includes("not verified") || errorMessage.includes("not registered")) {
|
|
39954
|
-
|
|
40177
|
+
clack56.log.error("Toll-free number registration is not complete");
|
|
39955
40178
|
console.log(
|
|
39956
40179
|
`
|
|
39957
|
-
Run ${
|
|
40180
|
+
Run ${pc59.cyan("wraps sms register")} to check registration status.
|
|
39958
40181
|
`
|
|
39959
40182
|
);
|
|
39960
40183
|
} else if (errorName === "AccessDeniedException") {
|
|
39961
|
-
|
|
40184
|
+
clack56.log.error(
|
|
39962
40185
|
"Permission denied \u2014 IAM role may be missing SMS send permissions"
|
|
39963
40186
|
);
|
|
39964
40187
|
console.log(
|
|
39965
40188
|
`
|
|
39966
|
-
Run ${
|
|
40189
|
+
Run ${pc59.cyan("wraps sms upgrade")} to update IAM policies.
|
|
39967
40190
|
`
|
|
39968
40191
|
);
|
|
39969
40192
|
} else {
|
|
39970
|
-
|
|
40193
|
+
clack56.log.error(`Failed to send SMS: ${errorMessage}`);
|
|
39971
40194
|
}
|
|
39972
40195
|
process.exit(1);
|
|
39973
40196
|
}
|
|
@@ -39975,9 +40198,9 @@ Run ${pc58.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
39975
40198
|
|
|
39976
40199
|
// src/commands/sms/upgrade.ts
|
|
39977
40200
|
init_esm_shims();
|
|
39978
|
-
import * as
|
|
40201
|
+
import * as clack57 from "@clack/prompts";
|
|
39979
40202
|
import * as pulumi35 from "@pulumi/pulumi";
|
|
39980
|
-
import
|
|
40203
|
+
import pc60 from "picocolors";
|
|
39981
40204
|
init_events();
|
|
39982
40205
|
init_aws();
|
|
39983
40206
|
init_errors();
|
|
@@ -39992,7 +40215,7 @@ async function smsUpgrade(options) {
|
|
|
39992
40215
|
const startTime = Date.now();
|
|
39993
40216
|
let upgradeAction = "";
|
|
39994
40217
|
if (!isJsonMode()) {
|
|
39995
|
-
|
|
40218
|
+
clack57.intro(pc60.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
39996
40219
|
}
|
|
39997
40220
|
const progress = new DeploymentProgress();
|
|
39998
40221
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -40006,7 +40229,7 @@ async function smsUpgrade(options) {
|
|
|
40006
40229
|
"Validating AWS credentials",
|
|
40007
40230
|
async () => validateAWSCredentials()
|
|
40008
40231
|
);
|
|
40009
|
-
progress.info(`Connected to AWS account: ${
|
|
40232
|
+
progress.info(`Connected to AWS account: ${pc60.cyan(identity.accountId)}`);
|
|
40010
40233
|
const region = await resolveRegionForCommand({
|
|
40011
40234
|
accountId: identity.accountId,
|
|
40012
40235
|
optionRegion: options.region,
|
|
@@ -40015,35 +40238,35 @@ async function smsUpgrade(options) {
|
|
|
40015
40238
|
});
|
|
40016
40239
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
40017
40240
|
if (!metadata) {
|
|
40018
|
-
|
|
40019
|
-
`No Wraps connection found for account ${
|
|
40241
|
+
clack57.log.error(
|
|
40242
|
+
`No Wraps connection found for account ${pc60.cyan(identity.accountId)} in region ${pc60.cyan(region)}`
|
|
40020
40243
|
);
|
|
40021
|
-
|
|
40022
|
-
`Use ${
|
|
40244
|
+
clack57.log.info(
|
|
40245
|
+
`Use ${pc60.cyan("wraps sms init")} to create new infrastructure.`
|
|
40023
40246
|
);
|
|
40024
40247
|
process.exit(1);
|
|
40025
40248
|
}
|
|
40026
40249
|
if (!metadata.services.sms) {
|
|
40027
|
-
|
|
40028
|
-
|
|
40029
|
-
`Use ${
|
|
40250
|
+
clack57.log.error("No SMS infrastructure found");
|
|
40251
|
+
clack57.log.info(
|
|
40252
|
+
`Use ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
40030
40253
|
);
|
|
40031
40254
|
process.exit(1);
|
|
40032
40255
|
}
|
|
40033
40256
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
40034
40257
|
console.log(`
|
|
40035
|
-
${
|
|
40258
|
+
${pc60.bold("Current Configuration:")}
|
|
40036
40259
|
`);
|
|
40037
40260
|
if (metadata.services.sms.preset) {
|
|
40038
|
-
console.log(` Preset: ${
|
|
40261
|
+
console.log(` Preset: ${pc60.cyan(metadata.services.sms.preset)}`);
|
|
40039
40262
|
} else {
|
|
40040
|
-
console.log(` Preset: ${
|
|
40263
|
+
console.log(` Preset: ${pc60.cyan("custom")}`);
|
|
40041
40264
|
}
|
|
40042
40265
|
const config2 = metadata.services.sms.config;
|
|
40043
40266
|
if (!config2) {
|
|
40044
|
-
|
|
40045
|
-
|
|
40046
|
-
`Use ${
|
|
40267
|
+
clack57.log.error("No SMS configuration found in metadata");
|
|
40268
|
+
clack57.log.info(
|
|
40269
|
+
`Use ${pc60.cyan("wraps sms init")} to create new infrastructure.`
|
|
40047
40270
|
);
|
|
40048
40271
|
process.exit(1);
|
|
40049
40272
|
}
|
|
@@ -40055,45 +40278,45 @@ ${pc59.bold("Current Configuration:")}
|
|
|
40055
40278
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
40056
40279
|
};
|
|
40057
40280
|
console.log(
|
|
40058
|
-
` Phone Type: ${
|
|
40281
|
+
` Phone Type: ${pc60.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
40059
40282
|
);
|
|
40060
40283
|
}
|
|
40061
40284
|
if (config2.tracking?.enabled) {
|
|
40062
|
-
console.log(` ${
|
|
40285
|
+
console.log(` ${pc60.green("\u2713")} Delivery Tracking`);
|
|
40063
40286
|
if (config2.tracking.linkTracking) {
|
|
40064
|
-
console.log(` ${
|
|
40287
|
+
console.log(` ${pc60.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
40065
40288
|
}
|
|
40066
40289
|
}
|
|
40067
40290
|
if (config2.eventTracking?.enabled) {
|
|
40068
|
-
console.log(` ${
|
|
40291
|
+
console.log(` ${pc60.green("\u2713")} Event Tracking (SNS)`);
|
|
40069
40292
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
40070
40293
|
console.log(
|
|
40071
|
-
` ${
|
|
40294
|
+
` ${pc60.dim("\u2514\u2500")} Message History: ${pc60.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
40072
40295
|
);
|
|
40073
40296
|
}
|
|
40074
40297
|
}
|
|
40075
40298
|
if (config2.messageArchiving?.enabled) {
|
|
40076
40299
|
console.log(
|
|
40077
|
-
` ${
|
|
40300
|
+
` ${pc60.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
40078
40301
|
);
|
|
40079
40302
|
}
|
|
40080
40303
|
if (config2.optOutManagement) {
|
|
40081
|
-
console.log(` ${
|
|
40304
|
+
console.log(` ${pc60.green("\u2713")} Opt-out Management`);
|
|
40082
40305
|
}
|
|
40083
40306
|
if (config2.protectConfiguration?.enabled) {
|
|
40084
40307
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
40085
|
-
console.log(` ${
|
|
40086
|
-
console.log(` ${
|
|
40308
|
+
console.log(` ${pc60.green("\u2713")} Fraud Protection`);
|
|
40309
|
+
console.log(` ${pc60.dim("\u2514\u2500")} Allowed countries: ${pc60.cyan(countries)}`);
|
|
40087
40310
|
if (config2.protectConfiguration.aitFiltering) {
|
|
40088
|
-
console.log(` ${
|
|
40311
|
+
console.log(` ${pc60.dim("\u2514\u2500")} AIT filtering: ${pc60.cyan("enabled")}`);
|
|
40089
40312
|
}
|
|
40090
40313
|
} else {
|
|
40091
|
-
console.log(` ${
|
|
40314
|
+
console.log(` ${pc60.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
40092
40315
|
}
|
|
40093
40316
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
40094
40317
|
console.log(
|
|
40095
40318
|
`
|
|
40096
|
-
Estimated Cost: ${
|
|
40319
|
+
Estimated Cost: ${pc60.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
40097
40320
|
);
|
|
40098
40321
|
console.log("");
|
|
40099
40322
|
const phoneTypeLabels = {
|
|
@@ -40102,7 +40325,7 @@ ${pc59.bold("Current Configuration:")}
|
|
|
40102
40325
|
"10dlc": "10DLC",
|
|
40103
40326
|
"short-code": "Short code"
|
|
40104
40327
|
};
|
|
40105
|
-
upgradeAction = await
|
|
40328
|
+
upgradeAction = await clack57.select({
|
|
40106
40329
|
message: "What would you like to do?",
|
|
40107
40330
|
options: [
|
|
40108
40331
|
{
|
|
@@ -40142,8 +40365,8 @@ ${pc59.bold("Current Configuration:")}
|
|
|
40142
40365
|
}
|
|
40143
40366
|
]
|
|
40144
40367
|
});
|
|
40145
|
-
if (
|
|
40146
|
-
|
|
40368
|
+
if (clack57.isCancel(upgradeAction)) {
|
|
40369
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40147
40370
|
process.exit(0);
|
|
40148
40371
|
}
|
|
40149
40372
|
let updatedConfig = { ...config2 };
|
|
@@ -40184,65 +40407,65 @@ ${pc59.bold("Current Configuration:")}
|
|
|
40184
40407
|
hint: p.hint
|
|
40185
40408
|
}));
|
|
40186
40409
|
if (availableTypes.length === 0) {
|
|
40187
|
-
|
|
40410
|
+
clack57.log.warn(
|
|
40188
40411
|
"Already on highest phone number tier. Contact AWS for dedicated short codes."
|
|
40189
40412
|
);
|
|
40190
40413
|
process.exit(0);
|
|
40191
40414
|
}
|
|
40192
|
-
const selectedType = await
|
|
40415
|
+
const selectedType = await clack57.select({
|
|
40193
40416
|
message: "Select new phone number type:",
|
|
40194
40417
|
options: availableTypes
|
|
40195
40418
|
});
|
|
40196
|
-
if (
|
|
40197
|
-
|
|
40419
|
+
if (clack57.isCancel(selectedType)) {
|
|
40420
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40198
40421
|
process.exit(0);
|
|
40199
40422
|
}
|
|
40200
40423
|
if (selectedType === "toll-free") {
|
|
40201
40424
|
console.log(
|
|
40202
40425
|
`
|
|
40203
|
-
${
|
|
40426
|
+
${pc60.yellow("\u26A0")} ${pc60.bold("Toll-free Registration Required")}
|
|
40204
40427
|
`
|
|
40205
40428
|
);
|
|
40206
40429
|
console.log(
|
|
40207
|
-
|
|
40430
|
+
pc60.dim("Toll-free numbers require carrier registration before")
|
|
40208
40431
|
);
|
|
40209
40432
|
console.log(
|
|
40210
|
-
|
|
40433
|
+
pc60.dim("they can send messages at scale. After deployment:\n")
|
|
40211
40434
|
);
|
|
40212
40435
|
console.log(
|
|
40213
|
-
` 1. Run ${
|
|
40436
|
+
` 1. Run ${pc60.cyan("wraps sms register")} to start registration`
|
|
40214
40437
|
);
|
|
40215
40438
|
console.log(" 2. Submit your business use case information");
|
|
40216
40439
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
40217
40440
|
console.log(
|
|
40218
|
-
|
|
40441
|
+
pc60.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
40219
40442
|
);
|
|
40220
|
-
const confirmTollFree = await
|
|
40443
|
+
const confirmTollFree = await clack57.confirm({
|
|
40221
40444
|
message: "Continue with toll-free number request?",
|
|
40222
40445
|
initialValue: true
|
|
40223
40446
|
});
|
|
40224
|
-
if (
|
|
40225
|
-
|
|
40447
|
+
if (clack57.isCancel(confirmTollFree) || !confirmTollFree) {
|
|
40448
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40226
40449
|
process.exit(0);
|
|
40227
40450
|
}
|
|
40228
40451
|
}
|
|
40229
40452
|
if (selectedType === "10dlc") {
|
|
40230
40453
|
console.log(
|
|
40231
40454
|
`
|
|
40232
|
-
${
|
|
40455
|
+
${pc60.yellow("\u26A0")} ${pc60.bold("10DLC Campaign Registration Required")}
|
|
40233
40456
|
`
|
|
40234
40457
|
);
|
|
40235
|
-
console.log(
|
|
40458
|
+
console.log(pc60.dim("10DLC requires brand and campaign registration:"));
|
|
40236
40459
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
40237
40460
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
40238
40461
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
40239
40462
|
console.log("");
|
|
40240
|
-
const confirm10DLC = await
|
|
40463
|
+
const confirm10DLC = await clack57.confirm({
|
|
40241
40464
|
message: "Continue with 10DLC number request?",
|
|
40242
40465
|
initialValue: true
|
|
40243
40466
|
});
|
|
40244
|
-
if (
|
|
40245
|
-
|
|
40467
|
+
if (clack57.isCancel(confirm10DLC) || !confirm10DLC) {
|
|
40468
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40246
40469
|
process.exit(0);
|
|
40247
40470
|
}
|
|
40248
40471
|
}
|
|
@@ -40267,15 +40490,15 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40267
40490
|
disabled: currentPresetIdx >= 0 && idx <= currentPresetIdx ? "Current or lower tier" : void 0
|
|
40268
40491
|
})).filter((p) => !p.disabled && p.value !== "custom");
|
|
40269
40492
|
if (availablePresets.length === 0) {
|
|
40270
|
-
|
|
40493
|
+
clack57.log.warn("Already on highest preset (Enterprise)");
|
|
40271
40494
|
process.exit(0);
|
|
40272
40495
|
}
|
|
40273
|
-
const selectedPreset = await
|
|
40496
|
+
const selectedPreset = await clack57.select({
|
|
40274
40497
|
message: "Select new preset:",
|
|
40275
40498
|
options: availablePresets
|
|
40276
40499
|
});
|
|
40277
|
-
if (
|
|
40278
|
-
|
|
40500
|
+
if (clack57.isCancel(selectedPreset)) {
|
|
40501
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40279
40502
|
process.exit(0);
|
|
40280
40503
|
}
|
|
40281
40504
|
const presetConfig = getSMSPreset(selectedPreset);
|
|
@@ -40291,7 +40514,7 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40291
40514
|
}
|
|
40292
40515
|
case "event-tracking": {
|
|
40293
40516
|
if (config2.eventTracking?.enabled) {
|
|
40294
|
-
const eventAction = await
|
|
40517
|
+
const eventAction = await clack57.select({
|
|
40295
40518
|
message: "What would you like to do with event tracking?",
|
|
40296
40519
|
options: [
|
|
40297
40520
|
{
|
|
@@ -40306,17 +40529,17 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40306
40529
|
}
|
|
40307
40530
|
]
|
|
40308
40531
|
});
|
|
40309
|
-
if (
|
|
40310
|
-
|
|
40532
|
+
if (clack57.isCancel(eventAction)) {
|
|
40533
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40311
40534
|
process.exit(0);
|
|
40312
40535
|
}
|
|
40313
40536
|
if (eventAction === "disable") {
|
|
40314
|
-
const confirmDisable = await
|
|
40537
|
+
const confirmDisable = await clack57.confirm({
|
|
40315
40538
|
message: "Are you sure? Existing history will remain, but new events won't be tracked.",
|
|
40316
40539
|
initialValue: false
|
|
40317
40540
|
});
|
|
40318
|
-
if (
|
|
40319
|
-
|
|
40541
|
+
if (clack57.isCancel(confirmDisable) || !confirmDisable) {
|
|
40542
|
+
clack57.cancel("Event tracking not disabled.");
|
|
40320
40543
|
process.exit(0);
|
|
40321
40544
|
}
|
|
40322
40545
|
updatedConfig = {
|
|
@@ -40326,7 +40549,7 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40326
40549
|
}
|
|
40327
40550
|
};
|
|
40328
40551
|
} else {
|
|
40329
|
-
const retention = await
|
|
40552
|
+
const retention = await clack57.select({
|
|
40330
40553
|
message: "Message history retention period:",
|
|
40331
40554
|
options: [
|
|
40332
40555
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40353,8 +40576,8 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40353
40576
|
],
|
|
40354
40577
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
40355
40578
|
});
|
|
40356
|
-
if (
|
|
40357
|
-
|
|
40579
|
+
if (clack57.isCancel(retention)) {
|
|
40580
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40358
40581
|
process.exit(0);
|
|
40359
40582
|
}
|
|
40360
40583
|
updatedConfig = {
|
|
@@ -40366,19 +40589,19 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40366
40589
|
};
|
|
40367
40590
|
}
|
|
40368
40591
|
} else {
|
|
40369
|
-
const enableTracking = await
|
|
40592
|
+
const enableTracking = await clack57.confirm({
|
|
40370
40593
|
message: "Enable event tracking? (Track SMS events with history)",
|
|
40371
40594
|
initialValue: true
|
|
40372
40595
|
});
|
|
40373
|
-
if (
|
|
40374
|
-
|
|
40596
|
+
if (clack57.isCancel(enableTracking)) {
|
|
40597
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40375
40598
|
process.exit(0);
|
|
40376
40599
|
}
|
|
40377
40600
|
if (!enableTracking) {
|
|
40378
|
-
|
|
40601
|
+
clack57.log.info("Event tracking not enabled.");
|
|
40379
40602
|
process.exit(0);
|
|
40380
40603
|
}
|
|
40381
|
-
const retention = await
|
|
40604
|
+
const retention = await clack57.select({
|
|
40382
40605
|
message: "Message history retention period:",
|
|
40383
40606
|
options: [
|
|
40384
40607
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40401,8 +40624,8 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40401
40624
|
],
|
|
40402
40625
|
initialValue: "90days"
|
|
40403
40626
|
});
|
|
40404
|
-
if (
|
|
40405
|
-
|
|
40627
|
+
if (clack57.isCancel(retention)) {
|
|
40628
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40406
40629
|
process.exit(0);
|
|
40407
40630
|
}
|
|
40408
40631
|
updatedConfig = {
|
|
@@ -40421,12 +40644,12 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40421
40644
|
}
|
|
40422
40645
|
case "retention": {
|
|
40423
40646
|
if (!config2.eventTracking?.enabled) {
|
|
40424
|
-
|
|
40647
|
+
clack57.log.error(
|
|
40425
40648
|
"Event tracking is not enabled. Enable it first to change retention."
|
|
40426
40649
|
);
|
|
40427
40650
|
process.exit(1);
|
|
40428
40651
|
}
|
|
40429
|
-
const retention = await
|
|
40652
|
+
const retention = await clack57.select({
|
|
40430
40653
|
message: "Message history retention period (event data in DynamoDB):",
|
|
40431
40654
|
options: [
|
|
40432
40655
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40445,8 +40668,8 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40445
40668
|
],
|
|
40446
40669
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
40447
40670
|
});
|
|
40448
|
-
if (
|
|
40449
|
-
|
|
40671
|
+
if (clack57.isCancel(retention)) {
|
|
40672
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40450
40673
|
process.exit(0);
|
|
40451
40674
|
}
|
|
40452
40675
|
updatedConfig = {
|
|
@@ -40464,21 +40687,21 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40464
40687
|
case "link-tracking": {
|
|
40465
40688
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
40466
40689
|
if (enableLinkTracking) {
|
|
40467
|
-
|
|
40468
|
-
|
|
40690
|
+
clack57.log.info(
|
|
40691
|
+
pc60.dim(
|
|
40469
40692
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
40470
40693
|
)
|
|
40471
40694
|
);
|
|
40472
|
-
|
|
40473
|
-
|
|
40695
|
+
clack57.log.info(
|
|
40696
|
+
pc60.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
40474
40697
|
);
|
|
40475
40698
|
}
|
|
40476
|
-
const confirmed = await
|
|
40699
|
+
const confirmed = await clack57.confirm({
|
|
40477
40700
|
message: enableLinkTracking ? "Enable link click tracking?" : "Disable link click tracking?",
|
|
40478
40701
|
initialValue: enableLinkTracking
|
|
40479
40702
|
});
|
|
40480
|
-
if (
|
|
40481
|
-
|
|
40703
|
+
if (clack57.isCancel(confirmed) || !confirmed) {
|
|
40704
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40482
40705
|
process.exit(0);
|
|
40483
40706
|
}
|
|
40484
40707
|
updatedConfig = {
|
|
@@ -40495,7 +40718,7 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40495
40718
|
}
|
|
40496
40719
|
case "archiving": {
|
|
40497
40720
|
if (config2.messageArchiving?.enabled) {
|
|
40498
|
-
const archivingAction = await
|
|
40721
|
+
const archivingAction = await clack57.select({
|
|
40499
40722
|
message: "What would you like to do with message archiving?",
|
|
40500
40723
|
options: [
|
|
40501
40724
|
{
|
|
@@ -40510,17 +40733,17 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40510
40733
|
}
|
|
40511
40734
|
]
|
|
40512
40735
|
});
|
|
40513
|
-
if (
|
|
40514
|
-
|
|
40736
|
+
if (clack57.isCancel(archivingAction)) {
|
|
40737
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40515
40738
|
process.exit(0);
|
|
40516
40739
|
}
|
|
40517
40740
|
if (archivingAction === "disable") {
|
|
40518
|
-
const confirmDisable = await
|
|
40741
|
+
const confirmDisable = await clack57.confirm({
|
|
40519
40742
|
message: "Are you sure? Existing archived messages will remain, but new messages won't be archived.",
|
|
40520
40743
|
initialValue: false
|
|
40521
40744
|
});
|
|
40522
|
-
if (
|
|
40523
|
-
|
|
40745
|
+
if (clack57.isCancel(confirmDisable) || !confirmDisable) {
|
|
40746
|
+
clack57.cancel("Archiving not disabled.");
|
|
40524
40747
|
process.exit(0);
|
|
40525
40748
|
}
|
|
40526
40749
|
updatedConfig = {
|
|
@@ -40531,7 +40754,7 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40531
40754
|
}
|
|
40532
40755
|
};
|
|
40533
40756
|
} else {
|
|
40534
|
-
const retention = await
|
|
40757
|
+
const retention = await clack57.select({
|
|
40535
40758
|
message: "Message archive retention period:",
|
|
40536
40759
|
options: [
|
|
40537
40760
|
{
|
|
@@ -40562,8 +40785,8 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40562
40785
|
],
|
|
40563
40786
|
initialValue: config2.messageArchiving.retention
|
|
40564
40787
|
});
|
|
40565
|
-
if (
|
|
40566
|
-
|
|
40788
|
+
if (clack57.isCancel(retention)) {
|
|
40789
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40567
40790
|
process.exit(0);
|
|
40568
40791
|
}
|
|
40569
40792
|
updatedConfig = {
|
|
@@ -40575,19 +40798,19 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40575
40798
|
};
|
|
40576
40799
|
}
|
|
40577
40800
|
} else {
|
|
40578
|
-
const enableArchiving = await
|
|
40801
|
+
const enableArchiving = await clack57.confirm({
|
|
40579
40802
|
message: "Enable message archiving? (Store full message content for viewing)",
|
|
40580
40803
|
initialValue: true
|
|
40581
40804
|
});
|
|
40582
|
-
if (
|
|
40583
|
-
|
|
40805
|
+
if (clack57.isCancel(enableArchiving)) {
|
|
40806
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40584
40807
|
process.exit(0);
|
|
40585
40808
|
}
|
|
40586
40809
|
if (!enableArchiving) {
|
|
40587
|
-
|
|
40810
|
+
clack57.log.info("Message archiving not enabled.");
|
|
40588
40811
|
process.exit(0);
|
|
40589
40812
|
}
|
|
40590
|
-
const retention = await
|
|
40813
|
+
const retention = await clack57.select({
|
|
40591
40814
|
message: "Message archive retention period:",
|
|
40592
40815
|
options: [
|
|
40593
40816
|
{ value: "7days", label: "7 days", hint: "~$1-2/mo for 10k msgs" },
|
|
@@ -40614,8 +40837,8 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40614
40837
|
],
|
|
40615
40838
|
initialValue: "90days"
|
|
40616
40839
|
});
|
|
40617
|
-
if (
|
|
40618
|
-
|
|
40840
|
+
if (clack57.isCancel(retention)) {
|
|
40841
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40619
40842
|
process.exit(0);
|
|
40620
40843
|
}
|
|
40621
40844
|
updatedConfig = {
|
|
@@ -40647,7 +40870,7 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40647
40870
|
const currentAllowed = config2.protectConfiguration?.allowedCountries || [
|
|
40648
40871
|
"US"
|
|
40649
40872
|
];
|
|
40650
|
-
const selectedCountries = await
|
|
40873
|
+
const selectedCountries = await clack57.multiselect({
|
|
40651
40874
|
message: "Select countries to allow SMS delivery (all others blocked):",
|
|
40652
40875
|
options: commonCountries.map((c) => ({
|
|
40653
40876
|
value: c.code,
|
|
@@ -40656,16 +40879,16 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40656
40879
|
initialValues: currentAllowed,
|
|
40657
40880
|
required: true
|
|
40658
40881
|
});
|
|
40659
|
-
if (
|
|
40660
|
-
|
|
40882
|
+
if (clack57.isCancel(selectedCountries)) {
|
|
40883
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40661
40884
|
process.exit(0);
|
|
40662
40885
|
}
|
|
40663
|
-
const enableAIT = await
|
|
40886
|
+
const enableAIT = await clack57.confirm({
|
|
40664
40887
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
40665
40888
|
initialValue: config2.protectConfiguration?.aitFiltering ?? false
|
|
40666
40889
|
});
|
|
40667
|
-
if (
|
|
40668
|
-
|
|
40890
|
+
if (clack57.isCancel(enableAIT)) {
|
|
40891
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40669
40892
|
process.exit(0);
|
|
40670
40893
|
}
|
|
40671
40894
|
updatedConfig = {
|
|
@@ -40683,28 +40906,28 @@ ${pc59.yellow("\u26A0")} ${pc59.bold("10DLC Campaign Registration Required")}
|
|
|
40683
40906
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
40684
40907
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
40685
40908
|
console.log(`
|
|
40686
|
-
${
|
|
40909
|
+
${pc60.bold("Cost Impact:")}`);
|
|
40687
40910
|
console.log(
|
|
40688
|
-
` Current: ${
|
|
40911
|
+
` Current: ${pc60.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
40689
40912
|
);
|
|
40690
40913
|
console.log(
|
|
40691
|
-
` New: ${
|
|
40914
|
+
` New: ${pc60.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
40692
40915
|
);
|
|
40693
40916
|
if (costDiff > 0) {
|
|
40694
|
-
console.log(` Change: ${
|
|
40917
|
+
console.log(` Change: ${pc60.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
40695
40918
|
} else if (costDiff < 0) {
|
|
40696
40919
|
console.log(
|
|
40697
|
-
` Change: ${
|
|
40920
|
+
` Change: ${pc60.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
40698
40921
|
);
|
|
40699
40922
|
}
|
|
40700
40923
|
console.log("");
|
|
40701
40924
|
if (!(options.yes || options.preview)) {
|
|
40702
|
-
const confirmed = await
|
|
40925
|
+
const confirmed = await clack57.confirm({
|
|
40703
40926
|
message: "Proceed with upgrade?",
|
|
40704
40927
|
initialValue: true
|
|
40705
40928
|
});
|
|
40706
|
-
if (
|
|
40707
|
-
|
|
40929
|
+
if (clack57.isCancel(confirmed) || !confirmed) {
|
|
40930
|
+
clack57.cancel("Upgrade cancelled.");
|
|
40708
40931
|
process.exit(0);
|
|
40709
40932
|
}
|
|
40710
40933
|
}
|
|
@@ -40773,8 +40996,8 @@ ${pc59.bold("Cost Impact:")}`);
|
|
|
40773
40996
|
resourceChanges: previewResult.resourceChanges,
|
|
40774
40997
|
commandName: "wraps sms upgrade"
|
|
40775
40998
|
});
|
|
40776
|
-
|
|
40777
|
-
|
|
40999
|
+
clack57.outro(
|
|
41000
|
+
pc60.green("Preview complete. Run without --preview to upgrade.")
|
|
40778
41001
|
);
|
|
40779
41002
|
trackServiceUpgrade("sms", {
|
|
40780
41003
|
region,
|
|
@@ -40879,43 +41102,43 @@ ${pc59.bold("Cost Impact:")}`);
|
|
|
40879
41102
|
}
|
|
40880
41103
|
progress.info("Connection metadata updated");
|
|
40881
41104
|
console.log("\n");
|
|
40882
|
-
|
|
41105
|
+
clack57.log.success(pc60.green(pc60.bold("SMS infrastructure upgraded!")));
|
|
40883
41106
|
console.log("\n");
|
|
40884
|
-
|
|
41107
|
+
clack57.note(
|
|
40885
41108
|
[
|
|
40886
|
-
`${
|
|
40887
|
-
`${
|
|
40888
|
-
`${
|
|
40889
|
-
`${
|
|
40890
|
-
outputs.tableName ? `${
|
|
41109
|
+
`${pc60.bold("Phone Number:")} ${pc60.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
41110
|
+
`${pc60.bold("Phone Type:")} ${pc60.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
41111
|
+
`${pc60.bold("Config Set:")} ${pc60.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
41112
|
+
`${pc60.bold("Region:")} ${pc60.cyan(outputs.region)}`,
|
|
41113
|
+
outputs.tableName ? `${pc60.bold("History Table:")} ${pc60.cyan(outputs.tableName)}` : "",
|
|
40891
41114
|
"",
|
|
40892
|
-
|
|
40893
|
-
|
|
41115
|
+
pc60.dim("IAM Role:"),
|
|
41116
|
+
pc60.dim(` ${outputs.roleArn}`)
|
|
40894
41117
|
].filter(Boolean).join("\n"),
|
|
40895
41118
|
"SMS Infrastructure"
|
|
40896
41119
|
);
|
|
40897
41120
|
console.log(`
|
|
40898
|
-
${
|
|
41121
|
+
${pc60.green("\u2713")} ${pc60.bold("Upgrade complete!")}
|
|
40899
41122
|
`);
|
|
40900
41123
|
if (upgradeAction === "phone-number") {
|
|
40901
41124
|
console.log(
|
|
40902
|
-
`Upgraded to ${
|
|
41125
|
+
`Upgraded to ${pc60.cyan(updatedConfig.phoneNumberType)} number (${pc60.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
40903
41126
|
`
|
|
40904
41127
|
);
|
|
40905
41128
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
40906
|
-
console.log(`${
|
|
41129
|
+
console.log(`${pc60.bold("Next Steps:")}`);
|
|
40907
41130
|
console.log(
|
|
40908
|
-
` 1. Run ${
|
|
41131
|
+
` 1. Run ${pc60.cyan("wraps sms register")} to start toll-free registration`
|
|
40909
41132
|
);
|
|
40910
41133
|
console.log(" 2. Submit your business information and use case");
|
|
40911
41134
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
40912
41135
|
console.log("");
|
|
40913
41136
|
console.log(
|
|
40914
|
-
|
|
41137
|
+
pc60.dim("Until verified, your number can only send limited messages.")
|
|
40915
41138
|
);
|
|
40916
41139
|
console.log("");
|
|
40917
41140
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
40918
|
-
console.log(`${
|
|
41141
|
+
console.log(`${pc60.bold("Next Steps:")}`);
|
|
40919
41142
|
console.log(" 1. Register your brand in the AWS Console");
|
|
40920
41143
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
40921
41144
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -40923,16 +41146,16 @@ ${pc59.green("\u2713")} ${pc59.bold("Upgrade complete!")}
|
|
|
40923
41146
|
}
|
|
40924
41147
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
40925
41148
|
console.log(
|
|
40926
|
-
`Upgraded to ${
|
|
41149
|
+
`Upgraded to ${pc60.cyan(newPreset)} preset (${pc60.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
40927
41150
|
`
|
|
40928
41151
|
);
|
|
40929
41152
|
} else {
|
|
40930
41153
|
console.log(
|
|
40931
|
-
`Updated configuration (${
|
|
41154
|
+
`Updated configuration (${pc60.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
40932
41155
|
`
|
|
40933
41156
|
);
|
|
40934
41157
|
}
|
|
40935
|
-
console.log(
|
|
41158
|
+
console.log(pc60.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
40936
41159
|
const enabledFeatures = [];
|
|
40937
41160
|
if (updatedConfig.tracking?.enabled) {
|
|
40938
41161
|
enabledFeatures.push("tracking");
|
|
@@ -40956,7 +41179,7 @@ ${pc59.green("\u2713")} ${pc59.bold("Upgrade complete!")}
|
|
|
40956
41179
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
40957
41180
|
duration_ms: Date.now() - startTime
|
|
40958
41181
|
});
|
|
40959
|
-
|
|
41182
|
+
clack57.outro(pc60.green("Upgrade complete!"));
|
|
40960
41183
|
}
|
|
40961
41184
|
|
|
40962
41185
|
// src/commands/sms/verify-number.ts
|
|
@@ -40975,13 +41198,13 @@ import {
|
|
|
40975
41198
|
SendDestinationNumberVerificationCodeCommand,
|
|
40976
41199
|
VerifyDestinationNumberCommand
|
|
40977
41200
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
40978
|
-
import * as
|
|
40979
|
-
import
|
|
41201
|
+
import * as clack58 from "@clack/prompts";
|
|
41202
|
+
import pc61 from "picocolors";
|
|
40980
41203
|
async function smsVerifyNumber(options) {
|
|
40981
41204
|
const startTime = Date.now();
|
|
40982
41205
|
const progress = new DeploymentProgress();
|
|
40983
41206
|
if (!isJsonMode()) {
|
|
40984
|
-
|
|
41207
|
+
clack58.intro(pc61.bold("Wraps SMS - Verify Destination Number"));
|
|
40985
41208
|
}
|
|
40986
41209
|
const identity = await progress.execute(
|
|
40987
41210
|
"Validating AWS credentials",
|
|
@@ -40991,10 +41214,10 @@ async function smsVerifyNumber(options) {
|
|
|
40991
41214
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
40992
41215
|
if (!metadata?.services?.sms) {
|
|
40993
41216
|
progress.stop();
|
|
40994
|
-
|
|
41217
|
+
clack58.log.error("No SMS infrastructure found");
|
|
40995
41218
|
console.log(
|
|
40996
41219
|
`
|
|
40997
|
-
Run ${
|
|
41220
|
+
Run ${pc61.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
40998
41221
|
`
|
|
40999
41222
|
);
|
|
41000
41223
|
process.exit(1);
|
|
@@ -41008,19 +41231,19 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
41008
41231
|
);
|
|
41009
41232
|
progress.stop();
|
|
41010
41233
|
if (!response.VerifiedDestinationNumbers || response.VerifiedDestinationNumbers.length === 0) {
|
|
41011
|
-
|
|
41234
|
+
clack58.log.info("No verified destination numbers found");
|
|
41012
41235
|
console.log(
|
|
41013
41236
|
`
|
|
41014
|
-
Run ${
|
|
41237
|
+
Run ${pc61.cyan("wraps sms verify-number")} to verify a number.
|
|
41015
41238
|
`
|
|
41016
41239
|
);
|
|
41017
41240
|
} else {
|
|
41018
41241
|
console.log("\n");
|
|
41019
|
-
|
|
41242
|
+
clack58.log.info(pc61.bold("Verified Destination Numbers:"));
|
|
41020
41243
|
console.log("");
|
|
41021
41244
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
41022
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
41023
|
-
console.log(` ${
|
|
41245
|
+
const status2 = num.Status === "VERIFIED" ? pc61.green("\u2713 Verified") : pc61.yellow("\u29D6 Pending");
|
|
41246
|
+
console.log(` ${pc61.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
41024
41247
|
}
|
|
41025
41248
|
console.log("");
|
|
41026
41249
|
}
|
|
@@ -41038,7 +41261,7 @@ Run ${pc60.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41038
41261
|
});
|
|
41039
41262
|
return;
|
|
41040
41263
|
}
|
|
41041
|
-
|
|
41264
|
+
clack58.outro(pc61.green("Done!"));
|
|
41042
41265
|
return;
|
|
41043
41266
|
} catch (error) {
|
|
41044
41267
|
progress.stop();
|
|
@@ -41046,7 +41269,7 @@ Run ${pc60.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41046
41269
|
trackError("SMS_LIST_VERIFIED_FAILED", "sms:verify-number:list", {
|
|
41047
41270
|
error: errorMessage
|
|
41048
41271
|
});
|
|
41049
|
-
|
|
41272
|
+
clack58.log.error(`Failed to list verified numbers: ${errorMessage}`);
|
|
41050
41273
|
process.exit(1);
|
|
41051
41274
|
}
|
|
41052
41275
|
}
|
|
@@ -41054,10 +41277,10 @@ Run ${pc60.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41054
41277
|
const phoneNumber2 = options.phoneNumber;
|
|
41055
41278
|
if (!phoneNumber2) {
|
|
41056
41279
|
progress.stop();
|
|
41057
|
-
|
|
41280
|
+
clack58.log.error("Phone number is required for deletion");
|
|
41058
41281
|
console.log(
|
|
41059
41282
|
`
|
|
41060
|
-
Usage: ${
|
|
41283
|
+
Usage: ${pc61.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
41061
41284
|
`
|
|
41062
41285
|
);
|
|
41063
41286
|
process.exit(1);
|
|
@@ -41071,7 +41294,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41071
41294
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41072
41295
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41073
41296
|
progress.stop();
|
|
41074
|
-
|
|
41297
|
+
clack58.log.error(`Number ${phoneNumber2} is not in verified list`);
|
|
41075
41298
|
process.exit(1);
|
|
41076
41299
|
}
|
|
41077
41300
|
await progress.execute(`Removing ${phoneNumber2}`, async () => {
|
|
@@ -41082,7 +41305,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41082
41305
|
);
|
|
41083
41306
|
});
|
|
41084
41307
|
progress.stop();
|
|
41085
|
-
|
|
41308
|
+
clack58.log.success(`Removed ${pc61.cyan(phoneNumber2)} from verified list`);
|
|
41086
41309
|
trackCommand("sms:verify-number:delete", {
|
|
41087
41310
|
success: true,
|
|
41088
41311
|
duration_ms: Date.now() - startTime
|
|
@@ -41094,7 +41317,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41094
41317
|
});
|
|
41095
41318
|
return;
|
|
41096
41319
|
}
|
|
41097
|
-
|
|
41320
|
+
clack58.outro(pc61.green("Done!"));
|
|
41098
41321
|
return;
|
|
41099
41322
|
} catch (error) {
|
|
41100
41323
|
progress.stop();
|
|
@@ -41102,7 +41325,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41102
41325
|
trackError("SMS_DELETE_VERIFIED_FAILED", "sms:verify-number:delete", {
|
|
41103
41326
|
error: errorMessage
|
|
41104
41327
|
});
|
|
41105
|
-
|
|
41328
|
+
clack58.log.error(`Failed to delete verified number: ${errorMessage}`);
|
|
41106
41329
|
process.exit(1);
|
|
41107
41330
|
}
|
|
41108
41331
|
}
|
|
@@ -41115,7 +41338,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41115
41338
|
);
|
|
41116
41339
|
}
|
|
41117
41340
|
if (!phoneNumber) {
|
|
41118
|
-
const result = await
|
|
41341
|
+
const result = await clack58.text({
|
|
41119
41342
|
message: "Enter phone number to verify (E.164 format):",
|
|
41120
41343
|
placeholder: "+14155551234",
|
|
41121
41344
|
validate: (value) => {
|
|
@@ -41128,14 +41351,14 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41128
41351
|
return;
|
|
41129
41352
|
}
|
|
41130
41353
|
});
|
|
41131
|
-
if (
|
|
41132
|
-
|
|
41354
|
+
if (clack58.isCancel(result)) {
|
|
41355
|
+
clack58.cancel("Operation cancelled.");
|
|
41133
41356
|
process.exit(0);
|
|
41134
41357
|
}
|
|
41135
41358
|
phoneNumber = result;
|
|
41136
41359
|
} else if (!isValidPhoneNumber(phoneNumber)) {
|
|
41137
41360
|
progress.stop();
|
|
41138
|
-
|
|
41361
|
+
clack58.log.error(
|
|
41139
41362
|
`Invalid phone number format: ${phoneNumber}. Use E.164 format (e.g., +14155551234)`
|
|
41140
41363
|
);
|
|
41141
41364
|
process.exit(1);
|
|
@@ -41150,7 +41373,7 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41150
41373
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41151
41374
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41152
41375
|
progress.stop();
|
|
41153
|
-
|
|
41376
|
+
clack58.log.error(
|
|
41154
41377
|
`Number ${phoneNumber} not found. Run without --code first.`
|
|
41155
41378
|
);
|
|
41156
41379
|
process.exit(1);
|
|
@@ -41165,12 +41388,12 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41165
41388
|
});
|
|
41166
41389
|
progress.stop();
|
|
41167
41390
|
console.log("\n");
|
|
41168
|
-
|
|
41169
|
-
|
|
41391
|
+
clack58.log.success(
|
|
41392
|
+
pc61.green(`Phone number ${pc61.cyan(phoneNumber)} verified!`)
|
|
41170
41393
|
);
|
|
41171
41394
|
console.log("");
|
|
41172
41395
|
console.log(
|
|
41173
|
-
`You can now send test messages to this number with ${
|
|
41396
|
+
`You can now send test messages to this number with ${pc61.cyan("wraps sms test")}`
|
|
41174
41397
|
);
|
|
41175
41398
|
trackCommand("sms:verify-number:confirm", {
|
|
41176
41399
|
success: true,
|
|
@@ -41183,23 +41406,23 @@ Usage: ${pc60.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41183
41406
|
});
|
|
41184
41407
|
return;
|
|
41185
41408
|
}
|
|
41186
|
-
|
|
41409
|
+
clack58.outro(pc61.green("Verification complete!"));
|
|
41187
41410
|
return;
|
|
41188
41411
|
} catch (error) {
|
|
41189
41412
|
progress.stop();
|
|
41190
41413
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
41191
41414
|
if (errorMessage.includes("Invalid verification code")) {
|
|
41192
|
-
|
|
41415
|
+
clack58.log.error("Invalid verification code. Please try again.");
|
|
41193
41416
|
console.log(
|
|
41194
41417
|
`
|
|
41195
|
-
Run ${
|
|
41418
|
+
Run ${pc61.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
41196
41419
|
`
|
|
41197
41420
|
);
|
|
41198
41421
|
} else {
|
|
41199
41422
|
trackError("SMS_VERIFY_CODE_FAILED", "sms:verify-number:confirm", {
|
|
41200
41423
|
error: errorMessage
|
|
41201
41424
|
});
|
|
41202
|
-
|
|
41425
|
+
clack58.log.error(`Verification failed: ${errorMessage}`);
|
|
41203
41426
|
}
|
|
41204
41427
|
process.exit(1);
|
|
41205
41428
|
}
|
|
@@ -41214,7 +41437,7 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41214
41437
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41215
41438
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41216
41439
|
progress.stop();
|
|
41217
|
-
|
|
41440
|
+
clack58.log.error(
|
|
41218
41441
|
`Number ${phoneNumber} not found. Run without --resend first.`
|
|
41219
41442
|
);
|
|
41220
41443
|
process.exit(1);
|
|
@@ -41228,11 +41451,11 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41228
41451
|
);
|
|
41229
41452
|
});
|
|
41230
41453
|
progress.stop();
|
|
41231
|
-
|
|
41454
|
+
clack58.log.success(`Verification code resent to ${pc61.cyan(phoneNumber)}`);
|
|
41232
41455
|
console.log("");
|
|
41233
41456
|
console.log(
|
|
41234
41457
|
`Once you receive the code, run:
|
|
41235
|
-
${
|
|
41458
|
+
${pc61.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
41236
41459
|
);
|
|
41237
41460
|
trackCommand("sms:verify-number:resend", {
|
|
41238
41461
|
success: true,
|
|
@@ -41245,7 +41468,7 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41245
41468
|
});
|
|
41246
41469
|
return;
|
|
41247
41470
|
}
|
|
41248
|
-
|
|
41471
|
+
clack58.outro(pc61.green("Code sent!"));
|
|
41249
41472
|
return;
|
|
41250
41473
|
} catch (error) {
|
|
41251
41474
|
progress.stop();
|
|
@@ -41253,7 +41476,7 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41253
41476
|
trackError("SMS_RESEND_CODE_FAILED", "sms:verify-number:resend", {
|
|
41254
41477
|
error: errorMessage
|
|
41255
41478
|
});
|
|
41256
|
-
|
|
41479
|
+
clack58.log.error(`Failed to resend code: ${errorMessage}`);
|
|
41257
41480
|
process.exit(1);
|
|
41258
41481
|
}
|
|
41259
41482
|
}
|
|
@@ -41273,10 +41496,10 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41273
41496
|
});
|
|
41274
41497
|
return;
|
|
41275
41498
|
}
|
|
41276
|
-
|
|
41277
|
-
`Number ${
|
|
41499
|
+
clack58.log.info(
|
|
41500
|
+
`Number ${pc61.cyan(phoneNumber)} is already verified and ready to use!`
|
|
41278
41501
|
);
|
|
41279
|
-
|
|
41502
|
+
clack58.outro(pc61.green("Done!"));
|
|
41280
41503
|
return;
|
|
41281
41504
|
}
|
|
41282
41505
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -41300,15 +41523,15 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41300
41523
|
});
|
|
41301
41524
|
return;
|
|
41302
41525
|
}
|
|
41303
|
-
|
|
41304
|
-
`Verification already in progress. New code sent to ${
|
|
41526
|
+
clack58.log.info(
|
|
41527
|
+
`Verification already in progress. New code sent to ${pc61.cyan(phoneNumber)}`
|
|
41305
41528
|
);
|
|
41306
41529
|
console.log("");
|
|
41307
41530
|
console.log(
|
|
41308
41531
|
`Once you receive the code, run:
|
|
41309
|
-
${
|
|
41532
|
+
${pc61.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
41310
41533
|
);
|
|
41311
|
-
|
|
41534
|
+
clack58.outro(pc61.green("Code sent!"));
|
|
41312
41535
|
return;
|
|
41313
41536
|
}
|
|
41314
41537
|
const createResponse = await progress.execute(
|
|
@@ -41329,18 +41552,18 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41329
41552
|
});
|
|
41330
41553
|
progress.stop();
|
|
41331
41554
|
console.log("\n");
|
|
41332
|
-
|
|
41333
|
-
`Verification code sent to ${
|
|
41555
|
+
clack58.log.success(
|
|
41556
|
+
`Verification code sent to ${pc61.cyan(phoneNumber)} via SMS`
|
|
41334
41557
|
);
|
|
41335
41558
|
console.log("");
|
|
41336
|
-
|
|
41559
|
+
clack58.note(
|
|
41337
41560
|
[
|
|
41338
41561
|
"1. Check your phone for the verification code",
|
|
41339
41562
|
"",
|
|
41340
41563
|
"2. Complete verification with:",
|
|
41341
|
-
` ${
|
|
41564
|
+
` ${pc61.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
41342
41565
|
"",
|
|
41343
|
-
|
|
41566
|
+
pc61.dim("The code expires in 24 hours")
|
|
41344
41567
|
].join("\n"),
|
|
41345
41568
|
"Next Steps"
|
|
41346
41569
|
);
|
|
@@ -41356,22 +41579,22 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41356
41579
|
});
|
|
41357
41580
|
return;
|
|
41358
41581
|
}
|
|
41359
|
-
|
|
41582
|
+
clack58.outro(pc61.green("Verification started!"));
|
|
41360
41583
|
} catch (error) {
|
|
41361
41584
|
progress.stop();
|
|
41362
41585
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
41363
41586
|
if (errorMessage.includes("already exists")) {
|
|
41364
|
-
|
|
41587
|
+
clack58.log.error("This number is already being verified");
|
|
41365
41588
|
console.log(
|
|
41366
41589
|
`
|
|
41367
|
-
Run ${
|
|
41590
|
+
Run ${pc61.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
41368
41591
|
`
|
|
41369
41592
|
);
|
|
41370
41593
|
} else {
|
|
41371
41594
|
trackError("SMS_CREATE_VERIFIED_FAILED", "sms:verify-number:start", {
|
|
41372
41595
|
error: errorMessage
|
|
41373
41596
|
});
|
|
41374
|
-
|
|
41597
|
+
clack58.log.error(`Failed to start verification: ${errorMessage}`);
|
|
41375
41598
|
}
|
|
41376
41599
|
process.exit(1);
|
|
41377
41600
|
}
|
|
@@ -41380,88 +41603,88 @@ Run ${pc60.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41380
41603
|
// src/commands/support.ts
|
|
41381
41604
|
init_esm_shims();
|
|
41382
41605
|
init_events();
|
|
41383
|
-
import * as
|
|
41384
|
-
import
|
|
41606
|
+
import * as clack59 from "@clack/prompts";
|
|
41607
|
+
import pc62 from "picocolors";
|
|
41385
41608
|
async function support() {
|
|
41386
41609
|
trackCommand("support", { success: true });
|
|
41387
|
-
|
|
41610
|
+
clack59.intro(pc62.bold("Get Help with Wraps"));
|
|
41388
41611
|
console.log();
|
|
41389
|
-
console.log(` ${
|
|
41612
|
+
console.log(` ${pc62.bold("Email:")} ${pc62.cyan("hey@wraps.sh")}`);
|
|
41390
41613
|
console.log(
|
|
41391
|
-
` ${
|
|
41614
|
+
` ${pc62.bold("GitHub:")} ${pc62.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
41392
41615
|
);
|
|
41393
|
-
console.log(` ${
|
|
41616
|
+
console.log(` ${pc62.bold("Docs:")} ${pc62.cyan("https://wraps.dev/docs")}`);
|
|
41394
41617
|
console.log();
|
|
41395
|
-
console.log(
|
|
41618
|
+
console.log(pc62.dim(" Response time: Usually within 24 hours"));
|
|
41396
41619
|
console.log();
|
|
41397
41620
|
}
|
|
41398
41621
|
|
|
41399
41622
|
// src/commands/telemetry.ts
|
|
41400
41623
|
init_esm_shims();
|
|
41401
41624
|
init_client();
|
|
41402
|
-
import * as
|
|
41403
|
-
import
|
|
41625
|
+
import * as clack60 from "@clack/prompts";
|
|
41626
|
+
import pc63 from "picocolors";
|
|
41404
41627
|
async function telemetryEnable() {
|
|
41405
41628
|
const client = getTelemetryClient();
|
|
41406
41629
|
const override = client.enable();
|
|
41407
41630
|
if (override) {
|
|
41408
|
-
|
|
41631
|
+
clack60.log.warn(
|
|
41409
41632
|
"Telemetry enabled in config, but overridden by environment"
|
|
41410
41633
|
);
|
|
41411
|
-
console.log(` Reason: ${
|
|
41412
|
-
console.log(` Config: ${
|
|
41634
|
+
console.log(` Reason: ${pc63.yellow(override)}`);
|
|
41635
|
+
console.log(` Config: ${pc63.dim(client.getConfigPath())}`);
|
|
41413
41636
|
console.log();
|
|
41414
41637
|
} else {
|
|
41415
|
-
|
|
41416
|
-
console.log(` Config: ${
|
|
41638
|
+
clack60.log.success(pc63.green("Telemetry enabled"));
|
|
41639
|
+
console.log(` Config: ${pc63.dim(client.getConfigPath())}`);
|
|
41417
41640
|
console.log(`
|
|
41418
|
-
${
|
|
41641
|
+
${pc63.dim("Thank you for helping improve Wraps!")}
|
|
41419
41642
|
`);
|
|
41420
41643
|
}
|
|
41421
41644
|
}
|
|
41422
41645
|
async function telemetryDisable() {
|
|
41423
41646
|
const client = getTelemetryClient();
|
|
41424
41647
|
client.disable();
|
|
41425
|
-
|
|
41426
|
-
console.log(` Config: ${
|
|
41648
|
+
clack60.log.success(pc63.green("Telemetry disabled"));
|
|
41649
|
+
console.log(` Config: ${pc63.dim(client.getConfigPath())}`);
|
|
41427
41650
|
console.log(
|
|
41428
41651
|
`
|
|
41429
|
-
${
|
|
41652
|
+
${pc63.dim("You can re-enable with:")} wraps telemetry enable
|
|
41430
41653
|
`
|
|
41431
41654
|
);
|
|
41432
41655
|
}
|
|
41433
41656
|
async function telemetryStatus() {
|
|
41434
41657
|
const client = getTelemetryClient();
|
|
41435
|
-
|
|
41658
|
+
clack60.intro(pc63.bold("Telemetry Status"));
|
|
41436
41659
|
const override = client.getEnvOverride();
|
|
41437
|
-
const status2 = client.isEnabled() ?
|
|
41660
|
+
const status2 = client.isEnabled() ? pc63.green("Enabled") : pc63.red("Disabled");
|
|
41438
41661
|
console.log();
|
|
41439
|
-
console.log(` ${
|
|
41662
|
+
console.log(` ${pc63.bold("Status:")} ${status2}`);
|
|
41440
41663
|
if (!client.isEnabled() && override) {
|
|
41441
|
-
console.log(` ${
|
|
41664
|
+
console.log(` ${pc63.bold("Reason:")} ${pc63.yellow(override)}`);
|
|
41442
41665
|
}
|
|
41443
|
-
console.log(` ${
|
|
41666
|
+
console.log(` ${pc63.bold("Config file:")} ${pc63.dim(client.getConfigPath())}`);
|
|
41444
41667
|
if (client.isEnabled()) {
|
|
41445
41668
|
console.log();
|
|
41446
|
-
console.log(
|
|
41447
|
-
console.log(` ${
|
|
41669
|
+
console.log(pc63.bold(" How to opt-out:"));
|
|
41670
|
+
console.log(` ${pc63.cyan("wraps telemetry disable")}`);
|
|
41448
41671
|
console.log(
|
|
41449
|
-
` ${
|
|
41672
|
+
` ${pc63.dim("Or set:")} ${pc63.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
41450
41673
|
);
|
|
41451
|
-
console.log(` ${
|
|
41674
|
+
console.log(` ${pc63.dim("Or set:")} ${pc63.cyan("DO_NOT_TRACK=1")}`);
|
|
41452
41675
|
} else {
|
|
41453
41676
|
console.log();
|
|
41454
|
-
console.log(
|
|
41455
|
-
console.log(` ${
|
|
41677
|
+
console.log(pc63.bold(" How to opt-in:"));
|
|
41678
|
+
console.log(` ${pc63.cyan("wraps telemetry enable")}`);
|
|
41456
41679
|
}
|
|
41457
41680
|
console.log();
|
|
41458
|
-
console.log(
|
|
41681
|
+
console.log(pc63.bold(" Debug mode:"));
|
|
41459
41682
|
console.log(
|
|
41460
|
-
` ${
|
|
41683
|
+
` ${pc63.dim("See what would be sent:")} ${pc63.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
41461
41684
|
);
|
|
41462
41685
|
console.log();
|
|
41463
41686
|
console.log(
|
|
41464
|
-
` ${
|
|
41687
|
+
` ${pc63.dim("Learn more:")} ${pc63.cyan("https://wraps.dev/docs/telemetry")}`
|
|
41465
41688
|
);
|
|
41466
41689
|
console.log();
|
|
41467
41690
|
}
|
|
@@ -41470,8 +41693,8 @@ async function telemetryStatus() {
|
|
|
41470
41693
|
init_esm_shims();
|
|
41471
41694
|
import { existsSync as existsSync20, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
41472
41695
|
import { join as join22 } from "path";
|
|
41473
|
-
import * as
|
|
41474
|
-
import
|
|
41696
|
+
import * as clack61 from "@clack/prompts";
|
|
41697
|
+
import pc64 from "picocolors";
|
|
41475
41698
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
41476
41699
|
defineWorkflow,
|
|
41477
41700
|
sendEmail,
|
|
@@ -41566,30 +41789,30 @@ export default defineConfig({
|
|
|
41566
41789
|
});
|
|
41567
41790
|
`;
|
|
41568
41791
|
async function workflowInit(options = {}) {
|
|
41569
|
-
|
|
41792
|
+
clack61.intro(pc64.bgCyan(pc64.black(" wraps workflow init ")));
|
|
41570
41793
|
const wrapsDir = join22(process.cwd(), "wraps");
|
|
41571
41794
|
const workflowsDir = join22(wrapsDir, "workflows");
|
|
41572
41795
|
const configPath = join22(wrapsDir, "wraps.config.ts");
|
|
41573
41796
|
if (existsSync20(workflowsDir)) {
|
|
41574
|
-
|
|
41575
|
-
`Workflows directory already exists at ${
|
|
41797
|
+
clack61.log.info(
|
|
41798
|
+
`Workflows directory already exists at ${pc64.cyan("wraps/workflows/")}`
|
|
41576
41799
|
);
|
|
41577
41800
|
const files = existsSync20(join22(workflowsDir, "cart-recovery.ts")) || existsSync20(join22(workflowsDir, "welcome-sequence.ts"));
|
|
41578
41801
|
if (files && !options.yes) {
|
|
41579
|
-
const shouldContinue = await
|
|
41802
|
+
const shouldContinue = await clack61.confirm({
|
|
41580
41803
|
message: "Example files may already exist. Overwrite them?",
|
|
41581
41804
|
initialValue: false
|
|
41582
41805
|
});
|
|
41583
|
-
if (
|
|
41584
|
-
|
|
41806
|
+
if (clack61.isCancel(shouldContinue) || !shouldContinue) {
|
|
41807
|
+
clack61.log.info("Skipping file creation.");
|
|
41585
41808
|
showNextSteps2();
|
|
41586
|
-
|
|
41809
|
+
clack61.outro("Done!");
|
|
41587
41810
|
return;
|
|
41588
41811
|
}
|
|
41589
41812
|
}
|
|
41590
41813
|
}
|
|
41591
41814
|
try {
|
|
41592
|
-
const s =
|
|
41815
|
+
const s = clack61.spinner();
|
|
41593
41816
|
s.start("Creating workflows directory...");
|
|
41594
41817
|
mkdirSync2(workflowsDir, { recursive: true });
|
|
41595
41818
|
s.stop("Created wraps/workflows/");
|
|
@@ -41607,34 +41830,34 @@ async function workflowInit(options = {}) {
|
|
|
41607
41830
|
s.stop("Created 2 example workflows");
|
|
41608
41831
|
if (!existsSync20(configPath)) {
|
|
41609
41832
|
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
41610
|
-
|
|
41833
|
+
clack61.log.info(`Created ${pc64.cyan("wraps/wraps.config.ts")}`);
|
|
41611
41834
|
}
|
|
41612
|
-
|
|
41613
|
-
`${
|
|
41614
|
-
${
|
|
41615
|
-
${
|
|
41616
|
-
${
|
|
41835
|
+
clack61.log.success(
|
|
41836
|
+
`${pc64.bold("Workflows scaffolded!")} Created:
|
|
41837
|
+
${pc64.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
41838
|
+
${pc64.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
41839
|
+
${pc64.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
41617
41840
|
);
|
|
41618
41841
|
showNextSteps2();
|
|
41619
|
-
|
|
41842
|
+
clack61.outro(pc64.green("Happy orchestrating!"));
|
|
41620
41843
|
} catch (error) {
|
|
41621
|
-
|
|
41844
|
+
clack61.log.error(
|
|
41622
41845
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
41623
41846
|
);
|
|
41624
|
-
|
|
41847
|
+
clack61.outro(pc64.red("Scaffolding failed."));
|
|
41625
41848
|
process.exitCode = 1;
|
|
41626
41849
|
}
|
|
41627
41850
|
}
|
|
41628
41851
|
function showNextSteps2() {
|
|
41629
|
-
|
|
41630
|
-
`${
|
|
41852
|
+
clack61.log.info(
|
|
41853
|
+
`${pc64.bold("Next steps:")}
|
|
41631
41854
|
|
|
41632
|
-
1. Edit ${
|
|
41633
|
-
2. Edit your workflows in ${
|
|
41634
|
-
3. Validate: ${
|
|
41635
|
-
4. Push: ${
|
|
41855
|
+
1. Edit ${pc64.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
41856
|
+
2. Edit your workflows in ${pc64.cyan("wraps/workflows/")}
|
|
41857
|
+
3. Validate: ${pc64.cyan("wraps email workflows validate")}
|
|
41858
|
+
4. Push: ${pc64.cyan("wraps email workflows push")}
|
|
41636
41859
|
|
|
41637
|
-
${
|
|
41860
|
+
${pc64.dim("Docs:")} ${pc64.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
41638
41861
|
);
|
|
41639
41862
|
}
|
|
41640
41863
|
|
|
@@ -41829,208 +42052,211 @@ function showVersion() {
|
|
|
41829
42052
|
process.exit(0);
|
|
41830
42053
|
}
|
|
41831
42054
|
function showHelp() {
|
|
41832
|
-
|
|
42055
|
+
clack62.intro(pc66.bold(`WRAPS CLI v${VERSION}`));
|
|
41833
42056
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
41834
42057
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
41835
42058
|
console.log("Services:");
|
|
41836
|
-
console.log(` ${
|
|
42059
|
+
console.log(` ${pc66.cyan("email")} Email infrastructure (AWS SES)`);
|
|
41837
42060
|
console.log(
|
|
41838
|
-
` ${
|
|
42061
|
+
` ${pc66.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
41839
42062
|
);
|
|
41840
42063
|
console.log(
|
|
41841
|
-
` ${
|
|
42064
|
+
` ${pc66.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)`
|
|
41842
42065
|
);
|
|
41843
42066
|
console.log(
|
|
41844
|
-
` ${
|
|
42067
|
+
` ${pc66.cyan("selfhost")} Self-hosted Wraps control plane (enterprise)`
|
|
41845
42068
|
);
|
|
41846
42069
|
console.log(
|
|
41847
|
-
` ${
|
|
42070
|
+
` ${pc66.cyan("license")} License key management (Wraps team only)
|
|
41848
42071
|
`
|
|
41849
42072
|
);
|
|
41850
42073
|
console.log("Email Commands:");
|
|
41851
42074
|
console.log(
|
|
41852
|
-
` ${
|
|
42075
|
+
` ${pc66.cyan("email init")} Deploy new email infrastructure`
|
|
41853
42076
|
);
|
|
41854
42077
|
console.log(
|
|
41855
|
-
` ${
|
|
42078
|
+
` ${pc66.cyan("email check")} Check email deliverability for a domain`
|
|
41856
42079
|
);
|
|
41857
42080
|
console.log(
|
|
41858
|
-
` ${
|
|
42081
|
+
` ${pc66.cyan("email connect")} Connect to existing AWS SES`
|
|
41859
42082
|
);
|
|
41860
42083
|
console.log(
|
|
41861
|
-
` ${
|
|
42084
|
+
` ${pc66.cyan("email status")} Show email infrastructure details`
|
|
41862
42085
|
);
|
|
41863
|
-
console.log(` ${
|
|
41864
|
-
console.log(` ${
|
|
42086
|
+
console.log(` ${pc66.cyan("email test")} Send a test email`);
|
|
42087
|
+
console.log(` ${pc66.cyan("email verify")} Verify domain DNS records`);
|
|
41865
42088
|
console.log(
|
|
41866
|
-
` ${
|
|
42089
|
+
` ${pc66.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
41867
42090
|
);
|
|
41868
|
-
console.log(` ${
|
|
42091
|
+
console.log(` ${pc66.cyan("email upgrade")} Add features`);
|
|
41869
42092
|
console.log(
|
|
41870
|
-
` ${
|
|
42093
|
+
` ${pc66.cyan("email restore")} Restore original configuration`
|
|
41871
42094
|
);
|
|
41872
42095
|
console.log(
|
|
41873
|
-
` ${
|
|
42096
|
+
` ${pc66.cyan("email destroy")} Remove email infrastructure`
|
|
41874
42097
|
);
|
|
41875
42098
|
console.log(
|
|
41876
|
-
` ${
|
|
42099
|
+
` ${pc66.cyan("email doctor")} Diagnose and clean up email infrastructure`
|
|
41877
42100
|
);
|
|
41878
|
-
console.log(` ${
|
|
41879
|
-
console.log(` ${
|
|
41880
|
-
console.log(` ${
|
|
42101
|
+
console.log(` ${pc66.cyan("email domains add")} Add a domain to SES`);
|
|
42102
|
+
console.log(` ${pc66.cyan("email domains list")} List all domains`);
|
|
42103
|
+
console.log(` ${pc66.cyan("email domains remove")} Remove a domain`);
|
|
41881
42104
|
console.log(
|
|
41882
|
-
` ${
|
|
42105
|
+
` ${pc66.cyan("email inbound init")} Enable inbound email receiving`
|
|
41883
42106
|
);
|
|
41884
|
-
console.log(` ${
|
|
42107
|
+
console.log(` ${pc66.cyan("email inbound status")} Show inbound email status`);
|
|
41885
42108
|
console.log(
|
|
41886
|
-
` ${
|
|
42109
|
+
` ${pc66.cyan("email inbound verify")} Verify inbound DNS records`
|
|
41887
42110
|
);
|
|
41888
42111
|
console.log(
|
|
41889
|
-
` ${
|
|
42112
|
+
` ${pc66.cyan("email inbound test")} Send test email and verify receipt`
|
|
41890
42113
|
);
|
|
41891
42114
|
console.log(
|
|
41892
|
-
` ${
|
|
42115
|
+
` ${pc66.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
41893
42116
|
`
|
|
41894
42117
|
);
|
|
41895
42118
|
console.log("Template Commands:");
|
|
41896
42119
|
console.log(
|
|
41897
|
-
` ${
|
|
42120
|
+
` ${pc66.cyan("email templates init")} Initialize templates-as-code`
|
|
41898
42121
|
);
|
|
41899
42122
|
console.log(
|
|
41900
|
-
` ${
|
|
42123
|
+
` ${pc66.cyan("email templates push")} Push templates to SES + dashboard`
|
|
41901
42124
|
);
|
|
41902
42125
|
console.log(
|
|
41903
|
-
` ${
|
|
42126
|
+
` ${pc66.cyan("email templates preview")} Preview templates in browser`
|
|
41904
42127
|
);
|
|
41905
42128
|
console.log(
|
|
41906
|
-
` ${
|
|
42129
|
+
` ${pc66.cyan("push")} ${pc66.dim("(alias for email templates push)")}
|
|
41907
42130
|
`
|
|
41908
42131
|
);
|
|
41909
42132
|
console.log("Workflow Commands:");
|
|
41910
42133
|
console.log(
|
|
41911
|
-
` ${
|
|
42134
|
+
` ${pc66.cyan("email workflows init")} Initialize workflows-as-code`
|
|
41912
42135
|
);
|
|
41913
42136
|
console.log(
|
|
41914
|
-
` ${
|
|
42137
|
+
` ${pc66.cyan("email workflows validate")} Validate workflow files`
|
|
41915
42138
|
);
|
|
41916
42139
|
console.log(
|
|
41917
|
-
` ${
|
|
42140
|
+
` ${pc66.cyan("email workflows push")} Push workflows to dashboard
|
|
41918
42141
|
`
|
|
41919
42142
|
);
|
|
41920
42143
|
console.log("SMS Commands:");
|
|
41921
|
-
console.log(` ${
|
|
42144
|
+
console.log(` ${pc66.cyan("sms init")} Deploy SMS infrastructure`);
|
|
41922
42145
|
console.log(
|
|
41923
|
-
` ${
|
|
42146
|
+
` ${pc66.cyan("sms status")} Show SMS infrastructure details`
|
|
41924
42147
|
);
|
|
41925
|
-
console.log(` ${
|
|
42148
|
+
console.log(` ${pc66.cyan("sms test")} Send a test SMS message`);
|
|
41926
42149
|
console.log(
|
|
41927
|
-
` ${
|
|
42150
|
+
` ${pc66.cyan("sms verify-number")} Verify a destination phone number`
|
|
41928
42151
|
);
|
|
41929
42152
|
console.log(
|
|
41930
|
-
` ${
|
|
42153
|
+
` ${pc66.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
41931
42154
|
);
|
|
41932
|
-
console.log(` ${
|
|
41933
|
-
console.log(` ${
|
|
42155
|
+
console.log(` ${pc66.cyan("sms upgrade")} Upgrade SMS features`);
|
|
42156
|
+
console.log(` ${pc66.cyan("sms register")} Register toll-free number`);
|
|
41934
42157
|
console.log(
|
|
41935
|
-
` ${
|
|
42158
|
+
` ${pc66.cyan("sms destroy")} Remove SMS infrastructure
|
|
41936
42159
|
`
|
|
41937
42160
|
);
|
|
41938
42161
|
console.log("CDN Commands:");
|
|
41939
42162
|
console.log(
|
|
41940
|
-
` ${
|
|
42163
|
+
` ${pc66.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
41941
42164
|
);
|
|
41942
42165
|
console.log(
|
|
41943
|
-
` ${
|
|
42166
|
+
` ${pc66.cyan("cdn status")} Show CDN infrastructure details`
|
|
41944
42167
|
);
|
|
41945
42168
|
console.log(
|
|
41946
|
-
` ${
|
|
42169
|
+
` ${pc66.cyan("cdn verify")} Check DNS and certificate status`
|
|
41947
42170
|
);
|
|
41948
42171
|
console.log(
|
|
41949
|
-
` ${
|
|
42172
|
+
` ${pc66.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
41950
42173
|
);
|
|
41951
42174
|
console.log(
|
|
41952
|
-
` ${
|
|
42175
|
+
` ${pc66.cyan("cdn sync")} Sync infrastructure with current config`
|
|
41953
42176
|
);
|
|
41954
42177
|
console.log(
|
|
41955
|
-
` ${
|
|
42178
|
+
` ${pc66.cyan("cdn destroy")} Remove CDN infrastructure
|
|
41956
42179
|
`
|
|
41957
42180
|
);
|
|
41958
42181
|
console.log("Self-Hosted Commands:");
|
|
41959
42182
|
console.log(
|
|
41960
|
-
` ${
|
|
42183
|
+
` ${pc66.cyan("selfhost deploy")} Deploy Wraps API to your AWS account`
|
|
41961
42184
|
);
|
|
41962
42185
|
console.log(
|
|
41963
|
-
` ${
|
|
42186
|
+
` ${pc66.cyan("selfhost login")} Sign in to your self-hosted Wraps instance`
|
|
41964
42187
|
);
|
|
41965
42188
|
console.log(
|
|
41966
|
-
` ${
|
|
42189
|
+
` ${pc66.cyan("selfhost upgrade")} Rebuild and redeploy the self-hosted API`
|
|
42190
|
+
);
|
|
42191
|
+
console.log(
|
|
42192
|
+
` ${pc66.cyan("selfhost status")} Show self-hosted deployment details
|
|
41967
42193
|
`
|
|
41968
42194
|
);
|
|
41969
42195
|
console.log("Local Development:");
|
|
41970
42196
|
console.log(
|
|
41971
|
-
` ${
|
|
42197
|
+
` ${pc66.cyan("console")} Start local web console
|
|
41972
42198
|
`
|
|
41973
42199
|
);
|
|
41974
42200
|
console.log("Platform:");
|
|
41975
42201
|
console.log(
|
|
41976
|
-
` ${
|
|
42202
|
+
` ${pc66.cyan("platform")} Show platform info and pricing`
|
|
41977
42203
|
);
|
|
41978
42204
|
console.log(
|
|
41979
|
-
` ${
|
|
42205
|
+
` ${pc66.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
41980
42206
|
);
|
|
41981
42207
|
console.log(
|
|
41982
|
-
` ${
|
|
42208
|
+
` ${pc66.cyan("platform update-role")} Update platform IAM permissions
|
|
41983
42209
|
`
|
|
41984
42210
|
);
|
|
41985
42211
|
console.log("Auth:");
|
|
41986
42212
|
console.log(
|
|
41987
|
-
` ${
|
|
42213
|
+
` ${pc66.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
41988
42214
|
);
|
|
41989
|
-
console.log(` ${
|
|
42215
|
+
console.log(` ${pc66.cyan("auth status")} Show current auth state`);
|
|
41990
42216
|
console.log(
|
|
41991
|
-
` ${
|
|
42217
|
+
` ${pc66.cyan("auth logout")} Sign out and remove stored token
|
|
41992
42218
|
`
|
|
41993
42219
|
);
|
|
41994
42220
|
console.log("AWS Setup:");
|
|
41995
42221
|
console.log(
|
|
41996
|
-
` ${
|
|
42222
|
+
` ${pc66.cyan("aws setup")} Interactive AWS setup wizard`
|
|
41997
42223
|
);
|
|
41998
42224
|
console.log(
|
|
41999
|
-
` ${
|
|
42225
|
+
` ${pc66.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
42000
42226
|
`
|
|
42001
42227
|
);
|
|
42002
42228
|
console.log("Global Commands:");
|
|
42003
|
-
console.log(` ${
|
|
42004
|
-
console.log(` ${
|
|
42005
|
-
console.log(` ${
|
|
42006
|
-
console.log(` ${
|
|
42229
|
+
console.log(` ${pc66.cyan("status")} Show overview of all services`);
|
|
42230
|
+
console.log(` ${pc66.cyan("destroy")} Remove deployed infrastructure`);
|
|
42231
|
+
console.log(` ${pc66.cyan("permissions")} Show required AWS IAM permissions`);
|
|
42232
|
+
console.log(` ${pc66.cyan("completion")} Generate shell completion script`);
|
|
42007
42233
|
console.log(
|
|
42008
|
-
` ${
|
|
42234
|
+
` ${pc66.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
42009
42235
|
);
|
|
42010
|
-
console.log(` ${
|
|
42011
|
-
console.log(` ${
|
|
42236
|
+
console.log(` ${pc66.cyan("update")} Update CLI to latest version`);
|
|
42237
|
+
console.log(` ${pc66.cyan("news")} Show recent Wraps updates`);
|
|
42012
42238
|
console.log(
|
|
42013
|
-
` ${
|
|
42239
|
+
` ${pc66.cyan("support")} Get help and support contact info
|
|
42014
42240
|
`
|
|
42015
42241
|
);
|
|
42016
42242
|
console.log("Options:");
|
|
42017
42243
|
console.log(
|
|
42018
|
-
` ${
|
|
42019
|
-
);
|
|
42020
|
-
console.log(` ${
|
|
42021
|
-
console.log(` ${
|
|
42022
|
-
console.log(` ${
|
|
42023
|
-
console.log(` ${
|
|
42024
|
-
console.log(` ${
|
|
42025
|
-
console.log(` ${
|
|
42026
|
-
console.log(` ${
|
|
42244
|
+
` ${pc66.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
42245
|
+
);
|
|
42246
|
+
console.log(` ${pc66.dim("-r, --region")} AWS region`);
|
|
42247
|
+
console.log(` ${pc66.dim("-d, --domain")} Domain name`);
|
|
42248
|
+
console.log(` ${pc66.dim("--account")} AWS account ID or alias`);
|
|
42249
|
+
console.log(` ${pc66.dim("--preset")} Configuration preset`);
|
|
42250
|
+
console.log(` ${pc66.dim("--token")} API key or token for auth`);
|
|
42251
|
+
console.log(` ${pc66.dim("-y, --yes")} Skip confirmation prompts`);
|
|
42252
|
+
console.log(` ${pc66.dim("-f, --force")} Force destructive operations`);
|
|
42027
42253
|
console.log(
|
|
42028
|
-
` ${
|
|
42254
|
+
` ${pc66.dim("--preview")} Preview changes without deploying`
|
|
42029
42255
|
);
|
|
42030
|
-
console.log(` ${
|
|
42256
|
+
console.log(` ${pc66.dim("-v, --version")} Show version number
|
|
42031
42257
|
`);
|
|
42032
42258
|
console.log(
|
|
42033
|
-
`Run ${
|
|
42259
|
+
`Run ${pc66.cyan("wraps <service> <command> --help")} for more information.
|
|
42034
42260
|
`
|
|
42035
42261
|
);
|
|
42036
42262
|
}
|
|
@@ -42052,27 +42278,27 @@ if (!primaryCommand) {
|
|
|
42052
42278
|
const telemetry = getTelemetryClient();
|
|
42053
42279
|
if (telemetry.shouldShowNotification()) {
|
|
42054
42280
|
console.log();
|
|
42055
|
-
|
|
42281
|
+
clack62.log.info(pc66.bold("Anonymous Telemetry"));
|
|
42056
42282
|
console.log(
|
|
42057
|
-
` Wraps collects ${
|
|
42283
|
+
` Wraps collects ${pc66.cyan("anonymous usage data")} to improve the CLI.`
|
|
42058
42284
|
);
|
|
42059
42285
|
console.log(
|
|
42060
|
-
` We ${
|
|
42286
|
+
` We ${pc66.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
42061
42287
|
);
|
|
42062
42288
|
console.log(
|
|
42063
|
-
` We ${
|
|
42289
|
+
` We ${pc66.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
42064
42290
|
);
|
|
42065
42291
|
console.log();
|
|
42066
|
-
console.log(` Opt-out anytime: ${
|
|
42067
|
-
console.log(` Or set: ${
|
|
42068
|
-
console.log(` Learn more: ${
|
|
42292
|
+
console.log(` Opt-out anytime: ${pc66.cyan("wraps telemetry disable")}`);
|
|
42293
|
+
console.log(` Or set: ${pc66.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
42294
|
+
console.log(` Learn more: ${pc66.cyan("https://wraps.dev/docs")}`);
|
|
42069
42295
|
console.log();
|
|
42070
42296
|
telemetry.markNotificationShown();
|
|
42071
42297
|
}
|
|
42072
42298
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
42073
|
-
|
|
42299
|
+
clack62.intro(pc66.bold(`WRAPS CLI v${VERSION}`));
|
|
42074
42300
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
42075
|
-
const action = await
|
|
42301
|
+
const action = await clack62.select({
|
|
42076
42302
|
message: "What would you like to do?",
|
|
42077
42303
|
options: [
|
|
42078
42304
|
{
|
|
@@ -42122,13 +42348,13 @@ if (!primaryCommand) {
|
|
|
42122
42348
|
}
|
|
42123
42349
|
]
|
|
42124
42350
|
});
|
|
42125
|
-
if (
|
|
42351
|
+
if (clack62.isCancel(action)) {
|
|
42126
42352
|
trackCommand("interactive:cancel", {
|
|
42127
42353
|
success: true,
|
|
42128
42354
|
duration_ms: Date.now() - startTime
|
|
42129
42355
|
});
|
|
42130
42356
|
await telemetry.shutdown();
|
|
42131
|
-
|
|
42357
|
+
clack62.cancel("Operation cancelled.");
|
|
42132
42358
|
process.exit(0);
|
|
42133
42359
|
}
|
|
42134
42360
|
trackCommand(`interactive:${action}`, {
|
|
@@ -42208,20 +42434,20 @@ async function run() {
|
|
|
42208
42434
|
const telemetry = getTelemetryClient();
|
|
42209
42435
|
if (telemetry.shouldShowNotification()) {
|
|
42210
42436
|
console.log();
|
|
42211
|
-
|
|
42437
|
+
clack62.log.info(pc66.bold("Anonymous Telemetry"));
|
|
42212
42438
|
console.log(
|
|
42213
|
-
` Wraps collects ${
|
|
42439
|
+
` Wraps collects ${pc66.cyan("anonymous usage data")} to improve the CLI.`
|
|
42214
42440
|
);
|
|
42215
42441
|
console.log(
|
|
42216
|
-
` We ${
|
|
42442
|
+
` We ${pc66.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
42217
42443
|
);
|
|
42218
42444
|
console.log(
|
|
42219
|
-
` We ${
|
|
42445
|
+
` We ${pc66.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
42220
42446
|
);
|
|
42221
42447
|
console.log();
|
|
42222
|
-
console.log(` Opt-out anytime: ${
|
|
42223
|
-
console.log(` Or set: ${
|
|
42224
|
-
console.log(` Learn more: ${
|
|
42448
|
+
console.log(` Opt-out anytime: ${pc66.cyan("wraps telemetry disable")}`);
|
|
42449
|
+
console.log(` Or set: ${pc66.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
42450
|
+
console.log(` Learn more: ${pc66.cyan("https://wraps.dev/docs")}`);
|
|
42225
42451
|
console.log();
|
|
42226
42452
|
telemetry.markNotificationShown();
|
|
42227
42453
|
}
|
|
@@ -42305,10 +42531,10 @@ async function run() {
|
|
|
42305
42531
|
break;
|
|
42306
42532
|
case "verify": {
|
|
42307
42533
|
if (!flags.domain) {
|
|
42308
|
-
|
|
42534
|
+
clack62.log.error("--domain flag is required");
|
|
42309
42535
|
console.log(
|
|
42310
42536
|
`
|
|
42311
|
-
Usage: ${
|
|
42537
|
+
Usage: ${pc66.cyan("wraps email verify --domain yourapp.com")}
|
|
42312
42538
|
`
|
|
42313
42539
|
);
|
|
42314
42540
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42380,12 +42606,12 @@ Usage: ${pc65.cyan("wraps email verify --domain yourapp.com")}
|
|
|
42380
42606
|
});
|
|
42381
42607
|
break;
|
|
42382
42608
|
default:
|
|
42383
|
-
|
|
42609
|
+
clack62.log.error(
|
|
42384
42610
|
`Unknown inbound command: ${inboundSubCommand || "(none)"}`
|
|
42385
42611
|
);
|
|
42386
42612
|
console.log(
|
|
42387
42613
|
`
|
|
42388
|
-
Available commands: ${
|
|
42614
|
+
Available commands: ${pc66.cyan("init")}, ${pc66.cyan("destroy")}, ${pc66.cyan("status")}, ${pc66.cyan("verify")}, ${pc66.cyan("test")}, ${pc66.cyan("add")}, ${pc66.cyan("remove")}
|
|
42389
42615
|
`
|
|
42390
42616
|
);
|
|
42391
42617
|
throw new Error(
|
|
@@ -42437,12 +42663,12 @@ Available commands: ${pc65.cyan("init")}, ${pc65.cyan("destroy")}, ${pc65.cyan("
|
|
|
42437
42663
|
break;
|
|
42438
42664
|
}
|
|
42439
42665
|
default:
|
|
42440
|
-
|
|
42666
|
+
clack62.log.error(
|
|
42441
42667
|
`Unknown reply command: ${replySubCommand || "(none)"}`
|
|
42442
42668
|
);
|
|
42443
42669
|
console.log(
|
|
42444
42670
|
`
|
|
42445
|
-
Available commands: ${
|
|
42671
|
+
Available commands: ${pc66.cyan("init")}, ${pc66.cyan("rotate")}, ${pc66.cyan("status")}, ${pc66.cyan("destroy")}, ${pc66.cyan("decode")}
|
|
42446
42672
|
`
|
|
42447
42673
|
);
|
|
42448
42674
|
throw new Error(
|
|
@@ -42467,10 +42693,10 @@ Available commands: ${pc65.cyan("init")}, ${pc65.cyan("rotate")}, ${pc65.cyan("s
|
|
|
42467
42693
|
break;
|
|
42468
42694
|
case "verify": {
|
|
42469
42695
|
if (!flags.domain) {
|
|
42470
|
-
|
|
42696
|
+
clack62.log.error("--domain flag is required");
|
|
42471
42697
|
console.log(
|
|
42472
42698
|
`
|
|
42473
|
-
Usage: ${
|
|
42699
|
+
Usage: ${pc66.cyan("wraps email domains verify --domain yourapp.com")}
|
|
42474
42700
|
`
|
|
42475
42701
|
);
|
|
42476
42702
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42480,10 +42706,10 @@ Usage: ${pc65.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
42480
42706
|
}
|
|
42481
42707
|
case "get-dkim": {
|
|
42482
42708
|
if (!flags.domain) {
|
|
42483
|
-
|
|
42709
|
+
clack62.log.error("--domain flag is required");
|
|
42484
42710
|
console.log(
|
|
42485
42711
|
`
|
|
42486
|
-
Usage: ${
|
|
42712
|
+
Usage: ${pc66.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
42487
42713
|
`
|
|
42488
42714
|
);
|
|
42489
42715
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42493,10 +42719,10 @@ Usage: ${pc65.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
42493
42719
|
}
|
|
42494
42720
|
case "remove": {
|
|
42495
42721
|
if (!flags.domain) {
|
|
42496
|
-
|
|
42722
|
+
clack62.log.error("--domain flag is required");
|
|
42497
42723
|
console.log(
|
|
42498
42724
|
`
|
|
42499
|
-
Usage: ${
|
|
42725
|
+
Usage: ${pc66.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
42500
42726
|
`
|
|
42501
42727
|
);
|
|
42502
42728
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42526,12 +42752,12 @@ Usage: ${pc65.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
42526
42752
|
break;
|
|
42527
42753
|
}
|
|
42528
42754
|
default:
|
|
42529
|
-
|
|
42755
|
+
clack62.log.error(
|
|
42530
42756
|
`Unknown domains command: ${domainsSubCommand || "(none)"}`
|
|
42531
42757
|
);
|
|
42532
42758
|
console.log(
|
|
42533
42759
|
`
|
|
42534
|
-
Available commands: ${
|
|
42760
|
+
Available commands: ${pc66.cyan("add")}, ${pc66.cyan("list")}, ${pc66.cyan("verify")}, ${pc66.cyan("get-dkim")}, ${pc66.cyan("remove")}, ${pc66.cyan("config")}
|
|
42535
42761
|
`
|
|
42536
42762
|
);
|
|
42537
42763
|
throw new Error(
|
|
@@ -42573,12 +42799,12 @@ Available commands: ${pc65.cyan("add")}, ${pc65.cyan("list")}, ${pc65.cyan("veri
|
|
|
42573
42799
|
});
|
|
42574
42800
|
break;
|
|
42575
42801
|
default:
|
|
42576
|
-
|
|
42802
|
+
clack62.log.error(
|
|
42577
42803
|
`Unknown templates command: ${templatesSubCommand || "(none)"}`
|
|
42578
42804
|
);
|
|
42579
42805
|
console.log(
|
|
42580
42806
|
`
|
|
42581
|
-
Available commands: ${
|
|
42807
|
+
Available commands: ${pc66.cyan("init")}, ${pc66.cyan("push")}, ${pc66.cyan("preview")}
|
|
42582
42808
|
`
|
|
42583
42809
|
);
|
|
42584
42810
|
throw new Error(
|
|
@@ -42617,12 +42843,12 @@ Available commands: ${pc65.cyan("init")}, ${pc65.cyan("push")}, ${pc65.cyan("pre
|
|
|
42617
42843
|
});
|
|
42618
42844
|
break;
|
|
42619
42845
|
default:
|
|
42620
|
-
|
|
42846
|
+
clack62.log.error(
|
|
42621
42847
|
`Unknown workflows command: ${workflowsSubCommand || "(none)"}`
|
|
42622
42848
|
);
|
|
42623
42849
|
console.log(
|
|
42624
42850
|
`
|
|
42625
|
-
Available commands: ${
|
|
42851
|
+
Available commands: ${pc66.cyan("init")}, ${pc66.cyan("validate")}, ${pc66.cyan("push")}
|
|
42626
42852
|
`
|
|
42627
42853
|
);
|
|
42628
42854
|
throw new Error(
|
|
@@ -42647,10 +42873,10 @@ Available commands: ${pc65.cyan("init")}, ${pc65.cyan("validate")}, ${pc65.cyan(
|
|
|
42647
42873
|
});
|
|
42648
42874
|
break;
|
|
42649
42875
|
default:
|
|
42650
|
-
|
|
42876
|
+
clack62.log.error(`Unknown email command: ${subCommand}`);
|
|
42651
42877
|
console.log(
|
|
42652
42878
|
`
|
|
42653
|
-
Run ${
|
|
42879
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
42654
42880
|
`
|
|
42655
42881
|
);
|
|
42656
42882
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -42675,10 +42901,10 @@ Run ${pc65.cyan("wraps --help")} for available commands.
|
|
|
42675
42901
|
});
|
|
42676
42902
|
break;
|
|
42677
42903
|
default:
|
|
42678
|
-
|
|
42904
|
+
clack62.log.error(`Unknown license command: ${subCommand}`);
|
|
42679
42905
|
console.log(
|
|
42680
42906
|
`
|
|
42681
|
-
Run ${
|
|
42907
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
42682
42908
|
`
|
|
42683
42909
|
);
|
|
42684
42910
|
throw new Error(`Unknown license command: ${subCommand}`);
|
|
@@ -42725,11 +42951,17 @@ Run ${pc65.cyan("wraps --help")} for available commands.
|
|
|
42725
42951
|
json: flags.json
|
|
42726
42952
|
});
|
|
42727
42953
|
break;
|
|
42954
|
+
case "login":
|
|
42955
|
+
await selfhostLogin({
|
|
42956
|
+
region: flags.region,
|
|
42957
|
+
json: flags.json
|
|
42958
|
+
});
|
|
42959
|
+
break;
|
|
42728
42960
|
default:
|
|
42729
|
-
|
|
42961
|
+
clack62.log.error(`Unknown selfhost command: ${subCommand}`);
|
|
42730
42962
|
console.log(
|
|
42731
42963
|
`
|
|
42732
|
-
Run ${
|
|
42964
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
42733
42965
|
`
|
|
42734
42966
|
);
|
|
42735
42967
|
throw new Error(`Unknown selfhost command: ${subCommand}`);
|
|
@@ -42809,10 +43041,10 @@ Run ${pc65.cyan("wraps --help")} for available commands.
|
|
|
42809
43041
|
});
|
|
42810
43042
|
break;
|
|
42811
43043
|
default:
|
|
42812
|
-
|
|
43044
|
+
clack62.log.error(`Unknown sms command: ${subCommand}`);
|
|
42813
43045
|
console.log(
|
|
42814
43046
|
`
|
|
42815
|
-
Run ${
|
|
43047
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
42816
43048
|
`
|
|
42817
43049
|
);
|
|
42818
43050
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -42873,10 +43105,10 @@ Run ${pc65.cyan("wraps --help")} for available commands.
|
|
|
42873
43105
|
});
|
|
42874
43106
|
break;
|
|
42875
43107
|
default:
|
|
42876
|
-
|
|
43108
|
+
clack62.log.error(`Unknown cdn command: ${subCommand}`);
|
|
42877
43109
|
console.log(
|
|
42878
43110
|
`
|
|
42879
|
-
Run ${
|
|
43111
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
42880
43112
|
`
|
|
42881
43113
|
);
|
|
42882
43114
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -42898,13 +43130,13 @@ Run ${pc65.cyan("wraps --help")} for available commands.
|
|
|
42898
43130
|
});
|
|
42899
43131
|
break;
|
|
42900
43132
|
default:
|
|
42901
|
-
|
|
43133
|
+
clack62.log.error(
|
|
42902
43134
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
42903
43135
|
);
|
|
42904
43136
|
console.log(`
|
|
42905
|
-
Available commands: ${
|
|
43137
|
+
Available commands: ${pc66.cyan("init")}
|
|
42906
43138
|
`);
|
|
42907
|
-
console.log(`Run ${
|
|
43139
|
+
console.log(`Run ${pc66.cyan("wraps --help")} for more information.
|
|
42908
43140
|
`);
|
|
42909
43141
|
throw new Error(
|
|
42910
43142
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -42946,14 +43178,14 @@ Available commands: ${pc65.cyan("init")}
|
|
|
42946
43178
|
});
|
|
42947
43179
|
break;
|
|
42948
43180
|
default:
|
|
42949
|
-
|
|
43181
|
+
clack62.log.error(`Unknown platform command: ${subCommand}`);
|
|
42950
43182
|
console.log(
|
|
42951
43183
|
`
|
|
42952
|
-
Available commands: ${
|
|
43184
|
+
Available commands: ${pc66.cyan("connect")}, ${pc66.cyan("update-role")}
|
|
42953
43185
|
`
|
|
42954
43186
|
);
|
|
42955
43187
|
console.log(
|
|
42956
|
-
`Run ${
|
|
43188
|
+
`Run ${pc66.cyan("wraps platform")} for more information.
|
|
42957
43189
|
`
|
|
42958
43190
|
);
|
|
42959
43191
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -42978,10 +43210,10 @@ Available commands: ${pc65.cyan("connect")}, ${pc65.cyan("update-role")}
|
|
|
42978
43210
|
await logout();
|
|
42979
43211
|
break;
|
|
42980
43212
|
default:
|
|
42981
|
-
|
|
43213
|
+
clack62.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
42982
43214
|
console.log(
|
|
42983
43215
|
`
|
|
42984
|
-
Available commands: ${
|
|
43216
|
+
Available commands: ${pc66.cyan("login")}, ${pc66.cyan("status")}, ${pc66.cyan("logout")}
|
|
42985
43217
|
`
|
|
42986
43218
|
);
|
|
42987
43219
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -42999,13 +43231,13 @@ Available commands: ${pc65.cyan("login")}, ${pc65.cyan("status")}, ${pc65.cyan("
|
|
|
42999
43231
|
await doctor();
|
|
43000
43232
|
break;
|
|
43001
43233
|
default:
|
|
43002
|
-
|
|
43234
|
+
clack62.log.error(`Unknown aws command: ${subCommand}`);
|
|
43003
43235
|
console.log(
|
|
43004
43236
|
`
|
|
43005
|
-
Available commands: ${
|
|
43237
|
+
Available commands: ${pc66.cyan("setup")}, ${pc66.cyan("doctor")}
|
|
43006
43238
|
`
|
|
43007
43239
|
);
|
|
43008
|
-
console.log(`Run ${
|
|
43240
|
+
console.log(`Run ${pc66.cyan("wraps --help")} for more information.
|
|
43009
43241
|
`);
|
|
43010
43242
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
43011
43243
|
}
|
|
@@ -43086,10 +43318,10 @@ Available commands: ${pc65.cyan("setup")}, ${pc65.cyan("doctor")}
|
|
|
43086
43318
|
await telemetryStatus();
|
|
43087
43319
|
break;
|
|
43088
43320
|
default:
|
|
43089
|
-
|
|
43321
|
+
clack62.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
43090
43322
|
console.log(
|
|
43091
43323
|
`
|
|
43092
|
-
Available commands: ${
|
|
43324
|
+
Available commands: ${pc66.cyan("enable")}, ${pc66.cyan("disable")}, ${pc66.cyan("status")}
|
|
43093
43325
|
`
|
|
43094
43326
|
);
|
|
43095
43327
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -43113,10 +43345,10 @@ Please specify a command for ${primaryCommand} service.
|
|
|
43113
43345
|
showHelp();
|
|
43114
43346
|
break;
|
|
43115
43347
|
default:
|
|
43116
|
-
|
|
43348
|
+
clack62.log.error(`Unknown command: ${primaryCommand}`);
|
|
43117
43349
|
console.log(
|
|
43118
43350
|
`
|
|
43119
|
-
Run ${
|
|
43351
|
+
Run ${pc66.cyan("wraps --help")} for available commands.
|
|
43120
43352
|
`
|
|
43121
43353
|
);
|
|
43122
43354
|
throw new Error(`Unknown command: ${primaryCommand}`);
|