@wraps.dev/cli 2.22.1 → 2.22.3
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 clack65 = await import("@clack/prompts");
|
|
1752
|
+
clack65.log.warn(
|
|
1753
1753
|
`S3 state backend unavailable (${error instanceof Error ? error.message : error}). Using local state.`
|
|
1754
1754
|
);
|
|
1755
1755
|
}
|
|
@@ -1803,6 +1803,40 @@ async function clearAuthConfig() {
|
|
|
1803
1803
|
await saveAuthConfig(existing);
|
|
1804
1804
|
}
|
|
1805
1805
|
}
|
|
1806
|
+
function normalizeInstanceKey(baseURL) {
|
|
1807
|
+
return baseURL.trim().replace(/\/+$/, "").toLowerCase();
|
|
1808
|
+
}
|
|
1809
|
+
async function saveSelfhostAuth(baseURL, auth) {
|
|
1810
|
+
const existing = await readAuthConfig();
|
|
1811
|
+
const selfhost = { ...existing?.selfhost };
|
|
1812
|
+
selfhost[normalizeInstanceKey(baseURL)] = auth;
|
|
1813
|
+
await saveAuthConfig({ ...existing, selfhost });
|
|
1814
|
+
}
|
|
1815
|
+
async function readSelfhostAuth(baseURL) {
|
|
1816
|
+
const config2 = await readAuthConfig();
|
|
1817
|
+
return config2?.selfhost?.[normalizeInstanceKey(baseURL)] ?? null;
|
|
1818
|
+
}
|
|
1819
|
+
async function clearSelfhostAuth(baseURL) {
|
|
1820
|
+
const existing = await readAuthConfig();
|
|
1821
|
+
if (!existing?.selfhost) {
|
|
1822
|
+
return;
|
|
1823
|
+
}
|
|
1824
|
+
delete existing.selfhost[normalizeInstanceKey(baseURL)];
|
|
1825
|
+
await saveAuthConfig(existing);
|
|
1826
|
+
}
|
|
1827
|
+
async function resolveSelfhostToken(baseURL, flags2) {
|
|
1828
|
+
if (flags2?.token) {
|
|
1829
|
+
return flags2.token;
|
|
1830
|
+
}
|
|
1831
|
+
const session = await readSelfhostAuth(baseURL);
|
|
1832
|
+
if (!session?.token) {
|
|
1833
|
+
return null;
|
|
1834
|
+
}
|
|
1835
|
+
if (session.expiresAt && new Date(session.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
1836
|
+
return null;
|
|
1837
|
+
}
|
|
1838
|
+
return session.token;
|
|
1839
|
+
}
|
|
1806
1840
|
function resolveToken(flags2) {
|
|
1807
1841
|
return flags2?.token || process.env.WRAPS_API_KEY || null;
|
|
1808
1842
|
}
|
|
@@ -6855,23 +6889,23 @@ async function withLockRetry(fn, options) {
|
|
|
6855
6889
|
if (parsed.code !== "STACK_LOCKED") {
|
|
6856
6890
|
throw error;
|
|
6857
6891
|
}
|
|
6858
|
-
const
|
|
6859
|
-
const
|
|
6892
|
+
const clack65 = await import("@clack/prompts");
|
|
6893
|
+
const pc69 = (await import("picocolors")).default;
|
|
6860
6894
|
if (options.autoConfirm) {
|
|
6861
|
-
|
|
6895
|
+
clack65.log.warn(
|
|
6862
6896
|
"Stack is locked from a previous interrupted run. Auto-clearing..."
|
|
6863
6897
|
);
|
|
6864
6898
|
} else {
|
|
6865
|
-
const shouldClear = await
|
|
6866
|
-
message: `Stack is locked from a previous interrupted run. ${
|
|
6899
|
+
const shouldClear = await clack65.confirm({
|
|
6900
|
+
message: `Stack is locked from a previous interrupted run. ${pc69.yellow("Clear the stale lock and retry?")}`,
|
|
6867
6901
|
initialValue: true
|
|
6868
6902
|
});
|
|
6869
|
-
if (
|
|
6903
|
+
if (clack65.isCancel(shouldClear) || !shouldClear) {
|
|
6870
6904
|
throw errors.stackLocked();
|
|
6871
6905
|
}
|
|
6872
6906
|
}
|
|
6873
6907
|
const cleared = await clearStackLocks(options.accountId, options.region);
|
|
6874
|
-
|
|
6908
|
+
clack65.log.info(
|
|
6875
6909
|
`Cleared ${cleared} lock file${cleared === 1 ? "" : "s"}. Retrying...`
|
|
6876
6910
|
);
|
|
6877
6911
|
return fn();
|
|
@@ -10205,8 +10239,8 @@ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
|
|
|
10205
10239
|
import { join as join23 } from "path";
|
|
10206
10240
|
import { Readable } from "stream";
|
|
10207
10241
|
import { pipeline } from "stream/promises";
|
|
10208
|
-
import { cancel as cancel35, confirm as confirm29, intro as
|
|
10209
|
-
import
|
|
10242
|
+
import { cancel as cancel35, confirm as confirm29, intro as intro59, isCancel as isCancel40, log as log58 } from "@clack/prompts";
|
|
10243
|
+
import pc67 from "picocolors";
|
|
10210
10244
|
function isStandaloneInstall() {
|
|
10211
10245
|
return process.execPath.includes(".wraps/runtime");
|
|
10212
10246
|
}
|
|
@@ -10235,7 +10269,7 @@ function detectPlatformArch() {
|
|
|
10235
10269
|
return { platform: platform2, arch };
|
|
10236
10270
|
}
|
|
10237
10271
|
async function update(currentVersion) {
|
|
10238
|
-
|
|
10272
|
+
intro59(pc67.bold("Wraps CLI Update"));
|
|
10239
10273
|
const progress = new DeploymentProgress();
|
|
10240
10274
|
const result = await progress.execute(
|
|
10241
10275
|
"Checking for updates...",
|
|
@@ -10247,20 +10281,20 @@ async function update(currentVersion) {
|
|
|
10247
10281
|
}
|
|
10248
10282
|
const { version: latestVersion, release } = result;
|
|
10249
10283
|
if (currentVersion === latestVersion) {
|
|
10250
|
-
progress.succeed(`Already up to date ${
|
|
10284
|
+
progress.succeed(`Already up to date ${pc67.dim(`(v${currentVersion})`)}`);
|
|
10251
10285
|
return;
|
|
10252
10286
|
}
|
|
10253
10287
|
console.log();
|
|
10254
|
-
|
|
10255
|
-
`Current version: ${
|
|
10256
|
-
Latest version: ${
|
|
10288
|
+
log58.info(
|
|
10289
|
+
`Current version: ${pc67.dim(`v${currentVersion}`)}
|
|
10290
|
+
Latest version: ${pc67.cyan(`v${latestVersion}`)}`
|
|
10257
10291
|
);
|
|
10258
10292
|
console.log();
|
|
10259
10293
|
if (!isStandaloneInstall()) {
|
|
10260
|
-
|
|
10294
|
+
log58.info(
|
|
10261
10295
|
`You installed Wraps via npm. Update with:
|
|
10262
10296
|
|
|
10263
|
-
${
|
|
10297
|
+
${pc67.cyan("npm update -g @wraps.dev/cli")}`
|
|
10264
10298
|
);
|
|
10265
10299
|
return;
|
|
10266
10300
|
}
|
|
@@ -10335,7 +10369,7 @@ async function update(currentVersion) {
|
|
|
10335
10369
|
});
|
|
10336
10370
|
console.log();
|
|
10337
10371
|
progress.succeed(
|
|
10338
|
-
`Updated to ${
|
|
10372
|
+
`Updated to ${pc67.cyan(`v${latestVersion}`)} successfully!`
|
|
10339
10373
|
);
|
|
10340
10374
|
} finally {
|
|
10341
10375
|
rmSync(tmp, { recursive: true, force: true });
|
|
@@ -10358,8 +10392,8 @@ init_esm_shims();
|
|
|
10358
10392
|
import { readFileSync as readFileSync3 } from "fs";
|
|
10359
10393
|
import { dirname as dirname7, join as join24 } from "path";
|
|
10360
10394
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
10361
|
-
import * as
|
|
10362
|
-
import
|
|
10395
|
+
import * as clack64 from "@clack/prompts";
|
|
10396
|
+
import pc68 from "picocolors";
|
|
10363
10397
|
|
|
10364
10398
|
// src/commands/auth/login.ts
|
|
10365
10399
|
init_esm_shims();
|
|
@@ -24180,12 +24214,12 @@ async function emailLogsList(options) {
|
|
|
24180
24214
|
}
|
|
24181
24215
|
const COL = { time: 8, status: 11, to: 28, subject: 40, msgId: 18 };
|
|
24182
24216
|
const header = pc30.bold("Time".padEnd(COL.time)) + " " + pc30.bold("Status".padEnd(COL.status)) + " " + pc30.bold("To".padEnd(COL.to)) + " " + pc30.bold("Subject".padEnd(COL.subject)) + " " + pc30.bold("Message ID");
|
|
24183
|
-
const rows = data.logs.map((
|
|
24184
|
-
const time = relativeTime(
|
|
24185
|
-
const status2 = padVisible(colorStatus(
|
|
24186
|
-
const to = padVisible(truncate(
|
|
24187
|
-
const subject = padVisible(truncate(
|
|
24188
|
-
const msgId = truncate(
|
|
24217
|
+
const rows = data.logs.map((log60) => {
|
|
24218
|
+
const time = relativeTime(log60.createdAt).padEnd(COL.time);
|
|
24219
|
+
const status2 = padVisible(colorStatus(log60.status), COL.status);
|
|
24220
|
+
const to = padVisible(truncate(log60.recipient, COL.to), COL.to);
|
|
24221
|
+
const subject = padVisible(truncate(log60.subject, COL.subject), COL.subject);
|
|
24222
|
+
const msgId = truncate(log60.messageId, COL.msgId);
|
|
24189
24223
|
return `${time} ${status2} ${to} ${subject} ${msgId}`;
|
|
24190
24224
|
});
|
|
24191
24225
|
clack28.note(
|
|
@@ -24241,32 +24275,32 @@ async function emailLogsGet(options) {
|
|
|
24241
24275
|
}
|
|
24242
24276
|
return;
|
|
24243
24277
|
}
|
|
24244
|
-
const
|
|
24278
|
+
const log60 = await resp.json();
|
|
24245
24279
|
if (isJsonMode()) {
|
|
24246
|
-
jsonSuccess("email.logs.get",
|
|
24280
|
+
jsonSuccess("email.logs.get", log60);
|
|
24247
24281
|
return;
|
|
24248
24282
|
}
|
|
24249
24283
|
const kv = (label, value) => `${pc30.dim(label.padEnd(16))} ${value ?? pc30.dim("\u2014")}`;
|
|
24250
|
-
const sentAt =
|
|
24251
|
-
const deliveredAt =
|
|
24252
|
-
const bouncedAt =
|
|
24253
|
-
const createdAt = new Date(
|
|
24284
|
+
const sentAt = log60.sentAt ? new Date(log60.sentAt).toLocaleString() : null;
|
|
24285
|
+
const deliveredAt = log60.deliveredAt ? new Date(log60.deliveredAt).toLocaleString() : null;
|
|
24286
|
+
const bouncedAt = log60.bouncedAt ? new Date(log60.bouncedAt).toLocaleString() : null;
|
|
24287
|
+
const createdAt = new Date(log60.createdAt).toLocaleString();
|
|
24254
24288
|
const lines = [
|
|
24255
|
-
kv("Message ID:",
|
|
24256
|
-
kv("Status:",
|
|
24257
|
-
kv("To:",
|
|
24258
|
-
kv("From:",
|
|
24259
|
-
kv("Subject:",
|
|
24260
|
-
kv("Source:",
|
|
24289
|
+
kv("Message ID:", log60.messageId),
|
|
24290
|
+
kv("Status:", log60.status ? colorStatus(log60.status) : null),
|
|
24291
|
+
kv("To:", log60.recipient),
|
|
24292
|
+
kv("From:", log60.from),
|
|
24293
|
+
kv("Subject:", log60.subject),
|
|
24294
|
+
kv("Source:", log60.sourceType),
|
|
24261
24295
|
kv("Sent:", sentAt),
|
|
24262
24296
|
kv("Delivered:", deliveredAt),
|
|
24263
24297
|
kv("Bounced:", bouncedAt),
|
|
24264
|
-
...
|
|
24298
|
+
...log60.bouncedSubType ? [kv("Bounce type:", log60.bouncedSubType)] : [],
|
|
24265
24299
|
kv("Created:", createdAt)
|
|
24266
24300
|
];
|
|
24267
24301
|
clack28.note(
|
|
24268
24302
|
lines.join("\n"),
|
|
24269
|
-
`Log Detail \u2014 ${
|
|
24303
|
+
`Log Detail \u2014 ${log60.messageId ?? "(no message id)"}`
|
|
24270
24304
|
);
|
|
24271
24305
|
}
|
|
24272
24306
|
|
|
@@ -32060,6 +32094,44 @@ import { confirm as confirm19, intro as intro36, isCancel as isCancel27, log as
|
|
|
32060
32094
|
import * as pulumi24 from "@pulumi/pulumi";
|
|
32061
32095
|
import pc44 from "picocolors";
|
|
32062
32096
|
init_events();
|
|
32097
|
+
|
|
32098
|
+
// src/utils/selfhost/api-url.ts
|
|
32099
|
+
init_esm_shims();
|
|
32100
|
+
init_metadata();
|
|
32101
|
+
var SELFHOST_API_FUNCTION_NAME = "wraps-selfhost-api";
|
|
32102
|
+
async function resolveSelfhostApiUrl(region) {
|
|
32103
|
+
try {
|
|
32104
|
+
const { LambdaClient: LambdaClient3, GetFunctionUrlConfigCommand } = await import("@aws-sdk/client-lambda");
|
|
32105
|
+
const lambda5 = new LambdaClient3({ region });
|
|
32106
|
+
const result = await lambda5.send(
|
|
32107
|
+
new GetFunctionUrlConfigCommand({
|
|
32108
|
+
FunctionName: SELFHOST_API_FUNCTION_NAME
|
|
32109
|
+
})
|
|
32110
|
+
);
|
|
32111
|
+
return result.FunctionUrl ?? null;
|
|
32112
|
+
} catch {
|
|
32113
|
+
return null;
|
|
32114
|
+
}
|
|
32115
|
+
}
|
|
32116
|
+
async function reconcileSelfhostApiUrl(metadata, region) {
|
|
32117
|
+
const selfhost = metadata.services.selfhost;
|
|
32118
|
+
if (!selfhost) {
|
|
32119
|
+
return null;
|
|
32120
|
+
}
|
|
32121
|
+
if (selfhost.apiUrl) {
|
|
32122
|
+
return selfhost.apiUrl;
|
|
32123
|
+
}
|
|
32124
|
+
const recovered = await resolveSelfhostApiUrl(region);
|
|
32125
|
+
if (!recovered) {
|
|
32126
|
+
return null;
|
|
32127
|
+
}
|
|
32128
|
+
selfhost.apiUrl = recovered;
|
|
32129
|
+
metadata.timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
32130
|
+
await saveConnectionMetadata(metadata);
|
|
32131
|
+
return recovered;
|
|
32132
|
+
}
|
|
32133
|
+
|
|
32134
|
+
// src/commands/platform/connect.ts
|
|
32063
32135
|
init_aws();
|
|
32064
32136
|
init_config();
|
|
32065
32137
|
init_errors();
|
|
@@ -32428,9 +32500,7 @@ async function updatePlatformRole(metadata, progress, externalId) {
|
|
|
32428
32500
|
);
|
|
32429
32501
|
}
|
|
32430
32502
|
}
|
|
32431
|
-
async function resolveOrganization() {
|
|
32432
|
-
const config2 = await readAuthConfig();
|
|
32433
|
-
const orgs = config2?.auth?.organizations;
|
|
32503
|
+
async function resolveOrganization(orgs) {
|
|
32434
32504
|
if (!orgs || orgs.length === 0) {
|
|
32435
32505
|
return null;
|
|
32436
32506
|
}
|
|
@@ -32474,7 +32544,7 @@ async function registerConnection(params) {
|
|
|
32474
32544
|
}
|
|
32475
32545
|
return data;
|
|
32476
32546
|
}
|
|
32477
|
-
async function authenticatedConnect(
|
|
32547
|
+
async function authenticatedConnect(options, saasToken) {
|
|
32478
32548
|
const startTime = Date.now();
|
|
32479
32549
|
const selfhosted = options.selfhosted === true;
|
|
32480
32550
|
if (!isJsonMode()) {
|
|
@@ -32491,6 +32561,9 @@ async function authenticatedConnect(token, options) {
|
|
|
32491
32561
|
progress
|
|
32492
32562
|
);
|
|
32493
32563
|
const selfhostService = metadata.services.selfhost;
|
|
32564
|
+
if (selfhosted && selfhostService) {
|
|
32565
|
+
await reconcileSelfhostApiUrl(metadata, region);
|
|
32566
|
+
}
|
|
32494
32567
|
if (selfhosted && !selfhostService?.apiUrl) {
|
|
32495
32568
|
progress.stop();
|
|
32496
32569
|
log38.error(
|
|
@@ -32506,11 +32579,50 @@ Run ${pc44.cyan("wraps selfhost deploy")} to finish deploying the self-hosted co
|
|
|
32506
32579
|
const apiBaseUrl = selfhosted && selfhostService ? selfhostService.apiUrl : getApiBaseUrl();
|
|
32507
32580
|
const dashboardUrl = selfhosted && selfhostService ? selfhostService.config.appUrl : getAppBaseUrl();
|
|
32508
32581
|
const hasEmail = !!metadata.services.email?.config;
|
|
32509
|
-
|
|
32582
|
+
let token;
|
|
32583
|
+
let organizations;
|
|
32584
|
+
if (selfhosted) {
|
|
32585
|
+
const instanceToken = await resolveSelfhostToken(dashboardUrl);
|
|
32586
|
+
if (!instanceToken) {
|
|
32587
|
+
progress.stop();
|
|
32588
|
+
if (isJsonMode()) {
|
|
32589
|
+
jsonError("platform.connect", {
|
|
32590
|
+
code: "NOT_AUTHENTICATED",
|
|
32591
|
+
message: "Not signed in to the self-hosted instance.",
|
|
32592
|
+
suggestion: "Run `wraps selfhost login` first."
|
|
32593
|
+
});
|
|
32594
|
+
} else {
|
|
32595
|
+
log38.error("You need to sign in to your self-hosted instance first.");
|
|
32596
|
+
console.log(`
|
|
32597
|
+
Run ${pc44.cyan("wraps selfhost login")} first.
|
|
32598
|
+
`);
|
|
32599
|
+
}
|
|
32600
|
+
process.exit(1);
|
|
32601
|
+
}
|
|
32602
|
+
token = instanceToken;
|
|
32603
|
+
organizations = (await readSelfhostAuth(dashboardUrl))?.organizations;
|
|
32604
|
+
} else {
|
|
32605
|
+
if (!saasToken) {
|
|
32606
|
+
progress.stop();
|
|
32607
|
+
if (isJsonMode()) {
|
|
32608
|
+
jsonError("platform.connect", {
|
|
32609
|
+
code: "NOT_AUTHENTICATED",
|
|
32610
|
+
message: "Not signed in.",
|
|
32611
|
+
suggestion: "Run `wraps auth login` first."
|
|
32612
|
+
});
|
|
32613
|
+
} else {
|
|
32614
|
+
log38.error("Not signed in. Run `wraps auth login` first.");
|
|
32615
|
+
}
|
|
32616
|
+
process.exit(1);
|
|
32617
|
+
}
|
|
32618
|
+
token = saasToken;
|
|
32619
|
+
organizations = (await readAuthConfig())?.auth?.organizations;
|
|
32620
|
+
}
|
|
32621
|
+
const org = await resolveOrganization(organizations);
|
|
32510
32622
|
if (!org) {
|
|
32511
32623
|
progress.stop();
|
|
32512
32624
|
log38.error(
|
|
32513
|
-
`No organizations found. Sign in at ${dashboardUrl} to create one.`
|
|
32625
|
+
selfhosted ? `No organizations found. Sign in at ${dashboardUrl} and run ${pc44.cyan("wraps selfhost login")} again.` : `No organizations found. Sign in at ${dashboardUrl} to create one.`
|
|
32514
32626
|
);
|
|
32515
32627
|
process.exit(1);
|
|
32516
32628
|
}
|
|
@@ -32660,27 +32772,15 @@ You can try the manual flow: ${pc44.cyan("wraps auth logout")} then ${pc44.cyan(
|
|
|
32660
32772
|
}
|
|
32661
32773
|
}
|
|
32662
32774
|
async function connect3(options) {
|
|
32775
|
+
if (options.selfhosted) {
|
|
32776
|
+
await authenticatedConnect(options, null);
|
|
32777
|
+
return;
|
|
32778
|
+
}
|
|
32663
32779
|
const token = await resolveTokenAsync();
|
|
32664
32780
|
if (token) {
|
|
32665
|
-
await authenticatedConnect(
|
|
32781
|
+
await authenticatedConnect(options, token);
|
|
32666
32782
|
return;
|
|
32667
32783
|
}
|
|
32668
|
-
if (options.selfhosted) {
|
|
32669
|
-
if (isJsonMode()) {
|
|
32670
|
-
jsonError("platform.connect", {
|
|
32671
|
-
code: "NOT_AUTHENTICATED",
|
|
32672
|
-
message: "Not signed in to the self-hosted instance.",
|
|
32673
|
-
suggestion: "Run `wraps selfhost login` first."
|
|
32674
|
-
});
|
|
32675
|
-
} else {
|
|
32676
|
-
intro36(pc44.bold("Connect to Self-Hosted Wraps"));
|
|
32677
|
-
log38.error("You need to sign in to your self-hosted instance first.");
|
|
32678
|
-
console.log(`
|
|
32679
|
-
Run ${pc44.cyan("wraps selfhost login")} first.
|
|
32680
|
-
`);
|
|
32681
|
-
}
|
|
32682
|
-
process.exit(1);
|
|
32683
|
-
}
|
|
32684
32784
|
const startTime = Date.now();
|
|
32685
32785
|
intro36(pc44.bold("Connect to Wraps Platform"));
|
|
32686
32786
|
const progress = new DeploymentProgress();
|
|
@@ -33959,12 +34059,13 @@ async function selfhostDeploy(options) {
|
|
|
33959
34059
|
timestamp: deployedAt,
|
|
33960
34060
|
services: {}
|
|
33961
34061
|
};
|
|
34062
|
+
const priorApiUrl = savedMetadata.services.selfhost?.apiUrl ?? "";
|
|
33962
34063
|
savedMetadata.services.selfhost = {
|
|
33963
34064
|
deployedAt,
|
|
33964
34065
|
pulumiStackName: stackName,
|
|
33965
34066
|
config: selfhostConfig,
|
|
33966
|
-
apiUrl:
|
|
33967
|
-
//
|
|
34067
|
+
apiUrl: priorApiUrl
|
|
34068
|
+
// Refreshed from Pulumi outputs after deploy succeeds
|
|
33968
34069
|
};
|
|
33969
34070
|
savedMetadata.timestamp = deployedAt;
|
|
33970
34071
|
await saveConnectionMetadata(savedMetadata);
|
|
@@ -34130,12 +34231,12 @@ async function selfhostDeploy(options) {
|
|
|
34130
34231
|
// src/commands/selfhost/env.ts
|
|
34131
34232
|
init_esm_shims();
|
|
34132
34233
|
init_events();
|
|
34234
|
+
import * as clack45 from "@clack/prompts";
|
|
34235
|
+
import pc48 from "picocolors";
|
|
34133
34236
|
init_aws();
|
|
34134
34237
|
init_json_output();
|
|
34135
34238
|
init_metadata();
|
|
34136
34239
|
init_region_resolver();
|
|
34137
|
-
import * as clack45 from "@clack/prompts";
|
|
34138
|
-
import pc48 from "picocolors";
|
|
34139
34240
|
async function selfhostEnv(options) {
|
|
34140
34241
|
const startTime = Date.now();
|
|
34141
34242
|
if (!isJsonMode()) {
|
|
@@ -34159,7 +34260,8 @@ Run ${pc48.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34159
34260
|
process.exit(1);
|
|
34160
34261
|
return;
|
|
34161
34262
|
}
|
|
34162
|
-
const { config: config2
|
|
34263
|
+
const { config: config2 } = metadata.services.selfhost;
|
|
34264
|
+
const apiUrl = await reconcileSelfhostApiUrl(metadata, region);
|
|
34163
34265
|
if (!apiUrl) {
|
|
34164
34266
|
clack45.log.error(
|
|
34165
34267
|
"Self-hosted deployment is incomplete \u2014 API URL is not available yet."
|
|
@@ -34316,13 +34418,11 @@ Run ${pc49.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34316
34418
|
baseURL,
|
|
34317
34419
|
tokenData.access_token
|
|
34318
34420
|
);
|
|
34319
|
-
await
|
|
34320
|
-
|
|
34321
|
-
|
|
34322
|
-
|
|
34323
|
-
|
|
34324
|
-
organizations: organizations.length > 0 ? organizations : void 0
|
|
34325
|
-
}
|
|
34421
|
+
await saveSelfhostAuth(baseURL, {
|
|
34422
|
+
token: tokenData.access_token,
|
|
34423
|
+
tokenType: "session",
|
|
34424
|
+
expiresAt: tokenData.expires_in ? new Date(Date.now() + tokenData.expires_in * 1e3).toISOString() : void 0,
|
|
34425
|
+
organizations: organizations.length > 0 ? organizations : void 0
|
|
34326
34426
|
});
|
|
34327
34427
|
trackCommand("selfhost:login", {
|
|
34328
34428
|
success: true,
|
|
@@ -34381,38 +34481,95 @@ Run ${pc49.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34381
34481
|
throw new Error("Device code expired.");
|
|
34382
34482
|
}
|
|
34383
34483
|
|
|
34384
|
-
// src/commands/selfhost/
|
|
34484
|
+
// src/commands/selfhost/logout.ts
|
|
34385
34485
|
init_esm_shims();
|
|
34386
34486
|
init_events();
|
|
34387
34487
|
init_aws();
|
|
34488
|
+
init_config();
|
|
34388
34489
|
init_json_output();
|
|
34389
34490
|
init_metadata();
|
|
34390
|
-
init_output();
|
|
34391
34491
|
init_region_resolver();
|
|
34392
34492
|
import * as clack47 from "@clack/prompts";
|
|
34393
34493
|
import pc50 from "picocolors";
|
|
34494
|
+
async function selfhostLogout(options) {
|
|
34495
|
+
if (!isJsonMode()) {
|
|
34496
|
+
clack47.intro(pc50.bold("Wraps Self-Hosted \u203A Sign Out"));
|
|
34497
|
+
}
|
|
34498
|
+
const identity = await validateAWSCredentials();
|
|
34499
|
+
const region = await resolveRegionForCommand({
|
|
34500
|
+
accountId: identity.accountId,
|
|
34501
|
+
optionRegion: options.region,
|
|
34502
|
+
service: "selfhost",
|
|
34503
|
+
label: "self-hosted deployment"
|
|
34504
|
+
});
|
|
34505
|
+
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34506
|
+
if (!metadata?.services?.selfhost) {
|
|
34507
|
+
clack47.log.error("No self-hosted deployment found.");
|
|
34508
|
+
console.log(
|
|
34509
|
+
`
|
|
34510
|
+
Run ${pc50.cyan("wraps selfhost deploy")} to deploy the self-hosted control plane first.
|
|
34511
|
+
`
|
|
34512
|
+
);
|
|
34513
|
+
process.exit(1);
|
|
34514
|
+
return;
|
|
34515
|
+
}
|
|
34516
|
+
const { appUrl: baseURL } = metadata.services.selfhost.config;
|
|
34517
|
+
if (!await readSelfhostAuth(baseURL)) {
|
|
34518
|
+
trackCommand("selfhost:logout", {
|
|
34519
|
+
success: true,
|
|
34520
|
+
already_logged_out: true
|
|
34521
|
+
});
|
|
34522
|
+
if (isJsonMode()) {
|
|
34523
|
+
jsonSuccess("selfhost.logout", {
|
|
34524
|
+
loggedOut: false,
|
|
34525
|
+
alreadyLoggedOut: true
|
|
34526
|
+
});
|
|
34527
|
+
return;
|
|
34528
|
+
}
|
|
34529
|
+
clack47.log.info(`Not signed in to ${pc50.cyan(baseURL)}.`);
|
|
34530
|
+
return;
|
|
34531
|
+
}
|
|
34532
|
+
await clearSelfhostAuth(baseURL);
|
|
34533
|
+
trackCommand("selfhost:logout", { success: true });
|
|
34534
|
+
if (isJsonMode()) {
|
|
34535
|
+
jsonSuccess("selfhost.logout", { loggedOut: true });
|
|
34536
|
+
return;
|
|
34537
|
+
}
|
|
34538
|
+
clack47.log.success(`Signed out of ${pc50.cyan(baseURL)}.`);
|
|
34539
|
+
}
|
|
34540
|
+
|
|
34541
|
+
// src/commands/selfhost/status.ts
|
|
34542
|
+
init_esm_shims();
|
|
34543
|
+
init_events();
|
|
34544
|
+
import * as clack48 from "@clack/prompts";
|
|
34545
|
+
import pc51 from "picocolors";
|
|
34546
|
+
init_aws();
|
|
34547
|
+
init_json_output();
|
|
34548
|
+
init_metadata();
|
|
34549
|
+
init_output();
|
|
34550
|
+
init_region_resolver();
|
|
34394
34551
|
function displaySelfhostStatus(options) {
|
|
34395
34552
|
const lines = [];
|
|
34396
|
-
lines.push(
|
|
34553
|
+
lines.push(pc51.bold(pc51.green("Self-Hosted Control Plane Active")));
|
|
34397
34554
|
lines.push("");
|
|
34398
|
-
lines.push(
|
|
34399
|
-
lines.push(` URL: ${
|
|
34400
|
-
lines.push(` Region: ${
|
|
34401
|
-
lines.push(` Deployed: ${
|
|
34555
|
+
lines.push(pc51.bold("API"));
|
|
34556
|
+
lines.push(` URL: ${pc51.cyan(options.apiUrl)}`);
|
|
34557
|
+
lines.push(` Region: ${pc51.cyan(options.region)}`);
|
|
34558
|
+
lines.push(` Deployed: ${pc51.dim(options.deployedAt)}`);
|
|
34402
34559
|
lines.push("");
|
|
34403
|
-
lines.push(
|
|
34404
|
-
lines.push(` App URL: ${
|
|
34405
|
-
lines.push(` License Key: ${
|
|
34560
|
+
lines.push(pc51.bold("Configuration"));
|
|
34561
|
+
lines.push(` App URL: ${pc51.cyan(options.appUrl)}`);
|
|
34562
|
+
lines.push(` License Key: ${pc51.dim(`${options.licenseKeyPrefix}...`)}`);
|
|
34406
34563
|
if (options.neonProjectId) {
|
|
34407
|
-
lines.push(` Neon Project: ${
|
|
34564
|
+
lines.push(` Neon Project: ${pc51.dim(options.neonProjectId)}`);
|
|
34408
34565
|
}
|
|
34409
|
-
|
|
34566
|
+
clack48.note(lines.join("\n"), "Self-Hosted Status");
|
|
34410
34567
|
}
|
|
34411
34568
|
async function selfhostStatus(options) {
|
|
34412
34569
|
const startTime = Date.now();
|
|
34413
34570
|
const progress = new DeploymentProgress();
|
|
34414
34571
|
if (!isJsonMode()) {
|
|
34415
|
-
|
|
34572
|
+
clack48.intro(pc51.bold("Wraps Self-Hosted Status"));
|
|
34416
34573
|
}
|
|
34417
34574
|
const identity = await progress.execute(
|
|
34418
34575
|
"Loading self-hosted status",
|
|
@@ -34427,10 +34584,10 @@ async function selfhostStatus(options) {
|
|
|
34427
34584
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34428
34585
|
if (!metadata?.services?.selfhost) {
|
|
34429
34586
|
progress.stop();
|
|
34430
|
-
|
|
34587
|
+
clack48.log.error("No self-hosted deployment found");
|
|
34431
34588
|
console.log(
|
|
34432
34589
|
`
|
|
34433
|
-
Run ${
|
|
34590
|
+
Run ${pc51.cyan("wraps selfhost deploy")} to deploy the self-hosted control plane.
|
|
34434
34591
|
`
|
|
34435
34592
|
);
|
|
34436
34593
|
process.exit(1);
|
|
@@ -34438,9 +34595,10 @@ Run ${pc50.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34438
34595
|
progress.stop();
|
|
34439
34596
|
const selfhostService = metadata.services.selfhost;
|
|
34440
34597
|
const config2 = selfhostService.config;
|
|
34598
|
+
const apiUrl = await reconcileSelfhostApiUrl(metadata, region) ?? selfhostService.apiUrl;
|
|
34441
34599
|
const statusData = {
|
|
34442
34600
|
region,
|
|
34443
|
-
apiUrl
|
|
34601
|
+
apiUrl,
|
|
34444
34602
|
deployedAt: selfhostService.deployedAt,
|
|
34445
34603
|
neonProjectId: config2.neonProjectId,
|
|
34446
34604
|
appUrl: config2.appUrl,
|
|
@@ -34452,15 +34610,15 @@ Run ${pc50.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
34452
34610
|
}
|
|
34453
34611
|
displaySelfhostStatus(statusData);
|
|
34454
34612
|
console.log("");
|
|
34455
|
-
|
|
34613
|
+
clack48.log.info(pc51.bold("Commands:"));
|
|
34456
34614
|
console.log(
|
|
34457
|
-
` ${
|
|
34615
|
+
` ${pc51.cyan("wraps selfhost upgrade")} - Rebuild and redeploy the API Lambda`
|
|
34458
34616
|
);
|
|
34459
34617
|
trackCommand("selfhost:status", {
|
|
34460
34618
|
success: true,
|
|
34461
34619
|
duration_ms: Date.now() - startTime
|
|
34462
34620
|
});
|
|
34463
|
-
|
|
34621
|
+
clack48.outro(pc51.dim("Self-hosted deployment is active"));
|
|
34464
34622
|
}
|
|
34465
34623
|
|
|
34466
34624
|
// src/commands/selfhost/upgrade.ts
|
|
@@ -34468,9 +34626,9 @@ init_esm_shims();
|
|
|
34468
34626
|
import { existsSync as existsSync19 } from "fs";
|
|
34469
34627
|
import { dirname as dirname6, join as join21 } from "path";
|
|
34470
34628
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
34471
|
-
import * as
|
|
34629
|
+
import * as clack49 from "@clack/prompts";
|
|
34472
34630
|
import * as pulumi27 from "@pulumi/pulumi";
|
|
34473
|
-
import
|
|
34631
|
+
import pc52 from "picocolors";
|
|
34474
34632
|
init_events();
|
|
34475
34633
|
init_aws();
|
|
34476
34634
|
init_errors();
|
|
@@ -34486,7 +34644,7 @@ var bundledLambdaZip2 = join21(cliDir2, "api-lambda.zip");
|
|
|
34486
34644
|
async function selfhostUpgrade(options) {
|
|
34487
34645
|
const startTime = Date.now();
|
|
34488
34646
|
if (!isJsonMode()) {
|
|
34489
|
-
|
|
34647
|
+
clack49.intro(pc52.bold("Wraps Self-Hosted Control Plane Upgrade"));
|
|
34490
34648
|
}
|
|
34491
34649
|
const progress = new DeploymentProgress();
|
|
34492
34650
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -34501,7 +34659,7 @@ async function selfhostUpgrade(options) {
|
|
|
34501
34659
|
async () => validateAWSCredentialsWithDetails()
|
|
34502
34660
|
);
|
|
34503
34661
|
const identity = credentialResult.identity;
|
|
34504
|
-
progress.info(`Connected to AWS account: ${
|
|
34662
|
+
progress.info(`Connected to AWS account: ${pc52.cyan(identity.accountId)}`);
|
|
34505
34663
|
const region = await resolveRegionForCommand({
|
|
34506
34664
|
accountId: identity.accountId,
|
|
34507
34665
|
optionRegion: options.region,
|
|
@@ -34510,20 +34668,20 @@ async function selfhostUpgrade(options) {
|
|
|
34510
34668
|
});
|
|
34511
34669
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34512
34670
|
if (!metadata?.services?.selfhost) {
|
|
34513
|
-
|
|
34514
|
-
|
|
34671
|
+
clack49.log.error("No self-hosted deployment found.");
|
|
34672
|
+
clack49.log.info(`Run ${pc52.cyan("wraps selfhost deploy")} first.`);
|
|
34515
34673
|
process.exit(1);
|
|
34516
34674
|
}
|
|
34517
34675
|
const selfhostService = metadata.services.selfhost;
|
|
34518
34676
|
progress.info(`Found deployment from: ${selfhostService.deployedAt}`);
|
|
34519
|
-
progress.info(`API URL: ${
|
|
34677
|
+
progress.info(`API URL: ${pc52.cyan(selfhostService.apiUrl)}`);
|
|
34520
34678
|
if (!(options.yes || options.preview)) {
|
|
34521
|
-
const confirmed = await
|
|
34522
|
-
message: `Upgrade self-hosted deployment in ${
|
|
34679
|
+
const confirmed = await clack49.confirm({
|
|
34680
|
+
message: `Upgrade self-hosted deployment in ${pc52.cyan(identity.accountId)} / ${pc52.cyan(region)}?`,
|
|
34523
34681
|
initialValue: true
|
|
34524
34682
|
});
|
|
34525
|
-
if (
|
|
34526
|
-
|
|
34683
|
+
if (clack49.isCancel(confirmed) || !confirmed) {
|
|
34684
|
+
clack49.cancel("Upgrade cancelled.");
|
|
34527
34685
|
process.exit(0);
|
|
34528
34686
|
}
|
|
34529
34687
|
}
|
|
@@ -34597,8 +34755,8 @@ async function selfhostUpgrade(options) {
|
|
|
34597
34755
|
resourceChanges: previewResult.resourceChanges,
|
|
34598
34756
|
commandName: "wraps selfhost upgrade"
|
|
34599
34757
|
});
|
|
34600
|
-
|
|
34601
|
-
|
|
34758
|
+
clack49.outro(
|
|
34759
|
+
pc52.green("Preview complete. Run without --preview to upgrade.")
|
|
34602
34760
|
);
|
|
34603
34761
|
return;
|
|
34604
34762
|
} catch (error) {
|
|
@@ -34669,28 +34827,28 @@ async function selfhostUpgrade(options) {
|
|
|
34669
34827
|
}
|
|
34670
34828
|
progress.info("Deployment metadata updated");
|
|
34671
34829
|
console.log("\n");
|
|
34672
|
-
|
|
34830
|
+
clack49.log.success(pc52.green(pc52.bold("Self-hosted Wraps API upgraded!")));
|
|
34673
34831
|
console.log("\n");
|
|
34674
|
-
|
|
34832
|
+
clack49.note(
|
|
34675
34833
|
[
|
|
34676
|
-
`${
|
|
34677
|
-
`${
|
|
34678
|
-
`${
|
|
34834
|
+
`${pc52.bold("API URL:")} ${pc52.cyan(outputs.apiUrl || selfhostService.apiUrl)}`,
|
|
34835
|
+
`${pc52.bold("Region:")} ${pc52.cyan(region)}`,
|
|
34836
|
+
`${pc52.bold("Lambda ARN:")} ${pc52.dim(outputs.lambdaArn)}`
|
|
34679
34837
|
].join("\n"),
|
|
34680
34838
|
"Self-Hosted Deployment"
|
|
34681
34839
|
);
|
|
34682
|
-
|
|
34683
|
-
|
|
34840
|
+
clack49.outro(
|
|
34841
|
+
pc52.green(`Upgraded in ${((Date.now() - startTime) / 1e3).toFixed(1)}s`)
|
|
34684
34842
|
);
|
|
34685
34843
|
}
|
|
34686
34844
|
|
|
34687
34845
|
// src/commands/shared/dashboard.ts
|
|
34688
34846
|
init_esm_shims();
|
|
34689
|
-
import * as
|
|
34847
|
+
import * as clack50 from "@clack/prompts";
|
|
34690
34848
|
import * as pulumi28 from "@pulumi/pulumi";
|
|
34691
34849
|
import getPort from "get-port";
|
|
34692
34850
|
import open3 from "open";
|
|
34693
|
-
import
|
|
34851
|
+
import pc53 from "picocolors";
|
|
34694
34852
|
|
|
34695
34853
|
// src/console/server.ts
|
|
34696
34854
|
init_esm_shims();
|
|
@@ -35890,13 +36048,13 @@ function createMetricsRouter(config2) {
|
|
|
35890
36048
|
const router = createRouter5();
|
|
35891
36049
|
router.get("/stream", async (req, res) => {
|
|
35892
36050
|
const connectionId = randomUUID().slice(0, 8);
|
|
35893
|
-
const
|
|
36051
|
+
const log60 = (msg, data) => {
|
|
35894
36052
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
35895
36053
|
};
|
|
35896
36054
|
res.setHeader("Content-Type", "text/event-stream");
|
|
35897
36055
|
res.setHeader("Cache-Control", "no-cache");
|
|
35898
36056
|
res.setHeader("Connection", "keep-alive");
|
|
35899
|
-
|
|
36057
|
+
log60("SSE connected");
|
|
35900
36058
|
res.write('data: {"type":"connected"}\n\n');
|
|
35901
36059
|
const { startTime, endTime } = req.query;
|
|
35902
36060
|
const getTimeRange = () => ({
|
|
@@ -35906,7 +36064,7 @@ function createMetricsRouter(config2) {
|
|
|
35906
36064
|
const sendMetrics = async () => {
|
|
35907
36065
|
try {
|
|
35908
36066
|
const timeRange = getTimeRange();
|
|
35909
|
-
|
|
36067
|
+
log60("Fetching metrics", {
|
|
35910
36068
|
start: timeRange.start.toISOString(),
|
|
35911
36069
|
end: timeRange.end.toISOString()
|
|
35912
36070
|
});
|
|
@@ -35919,7 +36077,7 @@ function createMetricsRouter(config2) {
|
|
|
35919
36077
|
),
|
|
35920
36078
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
35921
36079
|
]);
|
|
35922
|
-
|
|
36080
|
+
log60("Metrics fetched successfully");
|
|
35923
36081
|
const data = {
|
|
35924
36082
|
type: "metrics",
|
|
35925
36083
|
timestamp: Date.now(),
|
|
@@ -35949,7 +36107,7 @@ function createMetricsRouter(config2) {
|
|
|
35949
36107
|
const interval = setInterval(sendMetrics, 6e4);
|
|
35950
36108
|
req.on("close", () => {
|
|
35951
36109
|
clearInterval(interval);
|
|
35952
|
-
|
|
36110
|
+
log60("SSE disconnected");
|
|
35953
36111
|
});
|
|
35954
36112
|
});
|
|
35955
36113
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -37344,7 +37502,7 @@ init_output();
|
|
|
37344
37502
|
init_pulumi();
|
|
37345
37503
|
async function dashboard(options) {
|
|
37346
37504
|
await ensurePulumiInstalled();
|
|
37347
|
-
|
|
37505
|
+
clack50.intro(pc53.bold("Wraps Dashboard"));
|
|
37348
37506
|
const progress = new DeploymentProgress();
|
|
37349
37507
|
const identity = await progress.execute(
|
|
37350
37508
|
"Validating AWS credentials",
|
|
@@ -37385,9 +37543,9 @@ async function dashboard(options) {
|
|
|
37385
37543
|
}
|
|
37386
37544
|
} catch (_error) {
|
|
37387
37545
|
progress.stop();
|
|
37388
|
-
|
|
37546
|
+
clack50.log.error("No Wraps infrastructure found");
|
|
37389
37547
|
console.log(
|
|
37390
|
-
`\\nRun ${
|
|
37548
|
+
`\\nRun ${pc53.cyan("wraps email init")}, ${pc53.cyan("wraps sms init")}, or ${pc53.cyan("wraps storage init")} to deploy infrastructure first.\\n`
|
|
37391
37549
|
);
|
|
37392
37550
|
process.exit(1);
|
|
37393
37551
|
}
|
|
@@ -37429,9 +37587,9 @@ async function dashboard(options) {
|
|
|
37429
37587
|
}
|
|
37430
37588
|
const port = options.port || await getPort({ port: [5555, 5556, 5557, 5558, 5559] });
|
|
37431
37589
|
progress.stop();
|
|
37432
|
-
|
|
37590
|
+
clack50.log.success("Starting dashboard server...");
|
|
37433
37591
|
console.log(
|
|
37434
|
-
`${
|
|
37592
|
+
`${pc53.dim("Using current AWS credentials (no role assumption)")}\\n`
|
|
37435
37593
|
);
|
|
37436
37594
|
const { url } = await startConsoleServer({
|
|
37437
37595
|
port,
|
|
@@ -37464,8 +37622,8 @@ async function dashboard(options) {
|
|
|
37464
37622
|
cdnCustomDomain,
|
|
37465
37623
|
cdnCertificateArn
|
|
37466
37624
|
});
|
|
37467
|
-
console.log(`\\n${
|
|
37468
|
-
console.log(`${
|
|
37625
|
+
console.log(`\\n${pc53.bold("Dashboard:")} ${pc53.cyan(url)}`);
|
|
37626
|
+
console.log(`${pc53.dim("Press Ctrl+C to stop")}\\n`);
|
|
37469
37627
|
getTelemetryClient().showFooterOnce();
|
|
37470
37628
|
if (!options.noOpen) {
|
|
37471
37629
|
await open3(url);
|
|
@@ -37486,8 +37644,8 @@ init_aws();
|
|
|
37486
37644
|
init_errors();
|
|
37487
37645
|
init_json_output();
|
|
37488
37646
|
init_metadata();
|
|
37489
|
-
import * as
|
|
37490
|
-
import
|
|
37647
|
+
import * as clack51 from "@clack/prompts";
|
|
37648
|
+
import pc54 from "picocolors";
|
|
37491
37649
|
async function destroy(options) {
|
|
37492
37650
|
trackCommand("destroy", { success: true });
|
|
37493
37651
|
if (isJsonMode() && !options.force) {
|
|
@@ -37498,9 +37656,9 @@ async function destroy(options) {
|
|
|
37498
37656
|
);
|
|
37499
37657
|
}
|
|
37500
37658
|
if (!isJsonMode()) {
|
|
37501
|
-
|
|
37659
|
+
clack51.intro(pc54.bold("Wraps Infrastructure Teardown"));
|
|
37502
37660
|
}
|
|
37503
|
-
const spinner11 =
|
|
37661
|
+
const spinner11 = clack51.spinner();
|
|
37504
37662
|
spinner11.start("Validating AWS credentials");
|
|
37505
37663
|
let identity;
|
|
37506
37664
|
try {
|
|
@@ -37517,17 +37675,17 @@ async function destroy(options) {
|
|
|
37517
37675
|
deployedServices.push("email");
|
|
37518
37676
|
}
|
|
37519
37677
|
if (deployedServices.length === 0) {
|
|
37520
|
-
|
|
37678
|
+
clack51.log.warn("No Wraps services found in this region");
|
|
37521
37679
|
console.log(
|
|
37522
37680
|
`
|
|
37523
|
-
Run ${
|
|
37681
|
+
Run ${pc54.cyan("wraps email init")} to deploy infrastructure.
|
|
37524
37682
|
`
|
|
37525
37683
|
);
|
|
37526
37684
|
process.exit(0);
|
|
37527
37685
|
}
|
|
37528
37686
|
if (deployedServices.length === 1) {
|
|
37529
37687
|
const service = deployedServices[0];
|
|
37530
|
-
|
|
37688
|
+
clack51.log.info(`Found ${pc54.cyan(service)} service deployed`);
|
|
37531
37689
|
if (service === "email") {
|
|
37532
37690
|
await emailDestroy(options);
|
|
37533
37691
|
return;
|
|
@@ -37542,7 +37700,7 @@ Run ${pc53.cyan("wraps email init")} to deploy infrastructure.
|
|
|
37542
37700
|
jsonSuccess("destroy", { destroyed: true });
|
|
37543
37701
|
return;
|
|
37544
37702
|
}
|
|
37545
|
-
const serviceToDestroy = await
|
|
37703
|
+
const serviceToDestroy = await clack51.select({
|
|
37546
37704
|
message: "Which service would you like to destroy?",
|
|
37547
37705
|
options: [
|
|
37548
37706
|
...deployedServices.map((s) => ({
|
|
@@ -37557,15 +37715,15 @@ Run ${pc53.cyan("wraps email init")} to deploy infrastructure.
|
|
|
37557
37715
|
}
|
|
37558
37716
|
]
|
|
37559
37717
|
});
|
|
37560
|
-
if (
|
|
37561
|
-
|
|
37718
|
+
if (clack51.isCancel(serviceToDestroy)) {
|
|
37719
|
+
clack51.cancel("Operation cancelled.");
|
|
37562
37720
|
process.exit(0);
|
|
37563
37721
|
}
|
|
37564
37722
|
if ((serviceToDestroy === "email" || serviceToDestroy === "all") && deployedServices.includes("email")) {
|
|
37565
37723
|
await emailDestroy(options);
|
|
37566
37724
|
}
|
|
37567
37725
|
if (serviceToDestroy === "all") {
|
|
37568
|
-
|
|
37726
|
+
clack51.outro(pc54.green("All Wraps infrastructure has been removed"));
|
|
37569
37727
|
}
|
|
37570
37728
|
}
|
|
37571
37729
|
|
|
@@ -37577,26 +37735,26 @@ init_fs();
|
|
|
37577
37735
|
init_json_output();
|
|
37578
37736
|
init_output();
|
|
37579
37737
|
init_pulumi();
|
|
37580
|
-
import * as
|
|
37738
|
+
import * as clack52 from "@clack/prompts";
|
|
37581
37739
|
import * as pulumi29 from "@pulumi/pulumi";
|
|
37582
|
-
import
|
|
37740
|
+
import pc55 from "picocolors";
|
|
37583
37741
|
async function status(options) {
|
|
37584
37742
|
await ensurePulumiInstalled();
|
|
37585
37743
|
const startTime = Date.now();
|
|
37586
37744
|
const progress = new DeploymentProgress();
|
|
37587
37745
|
if (!isJsonMode()) {
|
|
37588
|
-
|
|
37746
|
+
clack52.intro(pc55.bold("Wraps Infrastructure Status"));
|
|
37589
37747
|
}
|
|
37590
37748
|
const identity = await progress.execute(
|
|
37591
37749
|
"Loading infrastructure status",
|
|
37592
37750
|
async () => validateAWSCredentials()
|
|
37593
37751
|
);
|
|
37594
37752
|
if (!isJsonMode()) {
|
|
37595
|
-
progress.info(`AWS Account: ${
|
|
37753
|
+
progress.info(`AWS Account: ${pc55.cyan(identity.accountId)}`);
|
|
37596
37754
|
}
|
|
37597
37755
|
const region = options.region || await getAWSRegion();
|
|
37598
37756
|
if (!isJsonMode()) {
|
|
37599
|
-
progress.info(`Region: ${
|
|
37757
|
+
progress.info(`Region: ${pc55.cyan(region)}`);
|
|
37600
37758
|
}
|
|
37601
37759
|
const services = [];
|
|
37602
37760
|
try {
|
|
@@ -37648,35 +37806,35 @@ async function status(options) {
|
|
|
37648
37806
|
return;
|
|
37649
37807
|
}
|
|
37650
37808
|
console.log();
|
|
37651
|
-
|
|
37809
|
+
clack52.note(
|
|
37652
37810
|
services.map((s) => {
|
|
37653
37811
|
if (s.status === "deployed") {
|
|
37654
|
-
const details = s.details ?
|
|
37655
|
-
return ` ${
|
|
37812
|
+
const details = s.details ? pc55.dim(` (${s.details})`) : "";
|
|
37813
|
+
return ` ${pc55.green("\u2713")} ${s.name}${details}`;
|
|
37656
37814
|
}
|
|
37657
|
-
return ` ${
|
|
37815
|
+
return ` ${pc55.dim("\u25CB")} ${s.name} ${pc55.dim("(not deployed)")}`;
|
|
37658
37816
|
}).join("\n"),
|
|
37659
37817
|
"Services"
|
|
37660
37818
|
);
|
|
37661
37819
|
const hasDeployedServices = services.some((s) => s.status === "deployed");
|
|
37662
37820
|
if (hasDeployedServices) {
|
|
37663
37821
|
console.log(`
|
|
37664
|
-
${
|
|
37822
|
+
${pc55.bold("Details:")}`);
|
|
37665
37823
|
if (services.find((s) => s.name === "Email")?.status === "deployed") {
|
|
37666
|
-
console.log(` ${
|
|
37824
|
+
console.log(` ${pc55.dim("Email:")} ${pc55.cyan("wraps email status")}`);
|
|
37667
37825
|
}
|
|
37668
37826
|
if (services.find((s) => s.name === "SMS")?.status === "deployed") {
|
|
37669
|
-
console.log(` ${
|
|
37827
|
+
console.log(` ${pc55.dim("SMS:")} ${pc55.cyan("wraps sms status")}`);
|
|
37670
37828
|
}
|
|
37671
37829
|
} else {
|
|
37672
37830
|
console.log(`
|
|
37673
|
-
${
|
|
37674
|
-
console.log(` ${
|
|
37675
|
-
console.log(` ${
|
|
37831
|
+
${pc55.bold("Get started:")}`);
|
|
37832
|
+
console.log(` ${pc55.dim("Deploy email:")} ${pc55.cyan("wraps email init")}`);
|
|
37833
|
+
console.log(` ${pc55.dim("Deploy SMS:")} ${pc55.cyan("wraps sms init")}`);
|
|
37676
37834
|
}
|
|
37677
37835
|
console.log(`
|
|
37678
|
-
${
|
|
37679
|
-
console.log(`${
|
|
37836
|
+
${pc55.bold("Dashboard:")} ${pc55.blue("https://app.wraps.dev")}`);
|
|
37837
|
+
console.log(`${pc55.bold("Docs:")} ${pc55.blue("https://wraps.dev/docs")}
|
|
37680
37838
|
`);
|
|
37681
37839
|
trackCommand("status", {
|
|
37682
37840
|
success: true,
|
|
@@ -37687,9 +37845,9 @@ ${pc54.bold("Dashboard:")} ${pc54.blue("https://app.wraps.dev")}`);
|
|
|
37687
37845
|
|
|
37688
37846
|
// src/commands/sms/destroy.ts
|
|
37689
37847
|
init_esm_shims();
|
|
37690
|
-
import * as
|
|
37848
|
+
import * as clack53 from "@clack/prompts";
|
|
37691
37849
|
import * as pulumi31 from "@pulumi/pulumi";
|
|
37692
|
-
import
|
|
37850
|
+
import pc56 from "picocolors";
|
|
37693
37851
|
|
|
37694
37852
|
// src/infrastructure/sms-stack.ts
|
|
37695
37853
|
init_esm_shims();
|
|
@@ -38380,18 +38538,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
38380
38538
|
const existing = await client.send(
|
|
38381
38539
|
new DescribeProtectConfigurationsCommand({})
|
|
38382
38540
|
);
|
|
38383
|
-
for (const
|
|
38384
|
-
if (!(
|
|
38541
|
+
for (const pc69 of existing.ProtectConfigurations || []) {
|
|
38542
|
+
if (!(pc69.ProtectConfigurationArn && pc69.ProtectConfigurationId)) {
|
|
38385
38543
|
continue;
|
|
38386
38544
|
}
|
|
38387
38545
|
const tagsResponse = await client.send(
|
|
38388
38546
|
new ListTagsForResourceCommand({
|
|
38389
|
-
ResourceArn:
|
|
38547
|
+
ResourceArn: pc69.ProtectConfigurationArn
|
|
38390
38548
|
})
|
|
38391
38549
|
);
|
|
38392
38550
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
38393
38551
|
if (nameTag?.Value === protectConfigName) {
|
|
38394
|
-
existingProtectConfigId =
|
|
38552
|
+
existingProtectConfigId = pc69.ProtectConfigurationId;
|
|
38395
38553
|
break;
|
|
38396
38554
|
}
|
|
38397
38555
|
}
|
|
@@ -38487,13 +38645,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
38487
38645
|
new DescribeProtectConfigurationsCommand({})
|
|
38488
38646
|
);
|
|
38489
38647
|
if (existing.ProtectConfigurations) {
|
|
38490
|
-
for (const
|
|
38491
|
-
if (!(
|
|
38648
|
+
for (const pc69 of existing.ProtectConfigurations) {
|
|
38649
|
+
if (!(pc69.ProtectConfigurationArn && pc69.ProtectConfigurationId)) {
|
|
38492
38650
|
continue;
|
|
38493
38651
|
}
|
|
38494
38652
|
const tagsResponse = await client.send(
|
|
38495
38653
|
new ListTagsForResourceCommand({
|
|
38496
|
-
ResourceArn:
|
|
38654
|
+
ResourceArn: pc69.ProtectConfigurationArn
|
|
38497
38655
|
})
|
|
38498
38656
|
);
|
|
38499
38657
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -38502,7 +38660,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
38502
38660
|
if (isWrapsManaged) {
|
|
38503
38661
|
await client.send(
|
|
38504
38662
|
new DeleteProtectConfigurationCommand({
|
|
38505
|
-
ProtectConfigurationId:
|
|
38663
|
+
ProtectConfigurationId: pc69.ProtectConfigurationId
|
|
38506
38664
|
})
|
|
38507
38665
|
);
|
|
38508
38666
|
}
|
|
@@ -38537,8 +38695,8 @@ async function smsDestroy(options) {
|
|
|
38537
38695
|
);
|
|
38538
38696
|
}
|
|
38539
38697
|
if (!isJsonMode()) {
|
|
38540
|
-
|
|
38541
|
-
|
|
38698
|
+
clack53.intro(
|
|
38699
|
+
pc56.bold(
|
|
38542
38700
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
38543
38701
|
)
|
|
38544
38702
|
);
|
|
@@ -38564,15 +38722,15 @@ async function smsDestroy(options) {
|
|
|
38564
38722
|
`Available regions: ${smsConnections.map((c) => c.region).join(", ")}`
|
|
38565
38723
|
);
|
|
38566
38724
|
}
|
|
38567
|
-
const selectedRegion = await
|
|
38725
|
+
const selectedRegion = await clack53.select({
|
|
38568
38726
|
message: "Multiple SMS deployments found. Which region to destroy?",
|
|
38569
38727
|
options: smsConnections.map((conn) => ({
|
|
38570
38728
|
value: conn.region,
|
|
38571
38729
|
label: conn.region
|
|
38572
38730
|
}))
|
|
38573
38731
|
});
|
|
38574
|
-
if (
|
|
38575
|
-
|
|
38732
|
+
if (clack53.isCancel(selectedRegion)) {
|
|
38733
|
+
clack53.cancel("Operation cancelled");
|
|
38576
38734
|
process.exit(0);
|
|
38577
38735
|
}
|
|
38578
38736
|
region = selectedRegion;
|
|
@@ -38583,18 +38741,18 @@ async function smsDestroy(options) {
|
|
|
38583
38741
|
const storedStackName = smsService?.pulumiStackName;
|
|
38584
38742
|
if (!smsService) {
|
|
38585
38743
|
progress.stop();
|
|
38586
|
-
|
|
38744
|
+
clack53.log.warn("No SMS infrastructure found");
|
|
38587
38745
|
process.exit(0);
|
|
38588
38746
|
}
|
|
38589
38747
|
if (!(options.force || options.preview)) {
|
|
38590
|
-
const confirmed = await
|
|
38591
|
-
message:
|
|
38748
|
+
const confirmed = await clack53.confirm({
|
|
38749
|
+
message: pc56.red(
|
|
38592
38750
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
38593
38751
|
),
|
|
38594
38752
|
initialValue: false
|
|
38595
38753
|
});
|
|
38596
|
-
if (
|
|
38597
|
-
|
|
38754
|
+
if (clack53.isCancel(confirmed) || !confirmed) {
|
|
38755
|
+
clack53.cancel("Destruction cancelled.");
|
|
38598
38756
|
process.exit(0);
|
|
38599
38757
|
}
|
|
38600
38758
|
}
|
|
@@ -38626,8 +38784,8 @@ async function smsDestroy(options) {
|
|
|
38626
38784
|
costEstimate: "Monthly cost after destruction: $0.00",
|
|
38627
38785
|
commandName: "wraps sms destroy"
|
|
38628
38786
|
});
|
|
38629
|
-
|
|
38630
|
-
|
|
38787
|
+
clack53.outro(
|
|
38788
|
+
pc56.green("Preview complete. Run without --preview to destroy.")
|
|
38631
38789
|
);
|
|
38632
38790
|
trackServiceRemoved("sms", {
|
|
38633
38791
|
preview: true,
|
|
@@ -38638,7 +38796,7 @@ async function smsDestroy(options) {
|
|
|
38638
38796
|
progress.stop();
|
|
38639
38797
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38640
38798
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
38641
|
-
|
|
38799
|
+
clack53.log.warn("No SMS infrastructure found to preview");
|
|
38642
38800
|
process.exit(0);
|
|
38643
38801
|
}
|
|
38644
38802
|
trackError("PREVIEW_FAILED", "sms destroy", { step: "preview" });
|
|
@@ -38687,7 +38845,7 @@ async function smsDestroy(options) {
|
|
|
38687
38845
|
progress.stop();
|
|
38688
38846
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38689
38847
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
38690
|
-
|
|
38848
|
+
clack53.log.warn("No SMS infrastructure found");
|
|
38691
38849
|
if (metadata) {
|
|
38692
38850
|
removeServiceFromConnection(metadata, "sms");
|
|
38693
38851
|
await saveConnectionMetadata(metadata);
|
|
@@ -38700,7 +38858,7 @@ async function smsDestroy(options) {
|
|
|
38700
38858
|
}
|
|
38701
38859
|
trackError("DESTROY_FAILED", "sms destroy", { step: "destroy" });
|
|
38702
38860
|
destroyFailed = true;
|
|
38703
|
-
|
|
38861
|
+
clack53.log.warn(
|
|
38704
38862
|
"Some resources may not have been fully removed. You can re-run this command or clean up manually in the AWS console."
|
|
38705
38863
|
);
|
|
38706
38864
|
}
|
|
@@ -38723,21 +38881,21 @@ async function smsDestroy(options) {
|
|
|
38723
38881
|
return;
|
|
38724
38882
|
}
|
|
38725
38883
|
if (destroyFailed) {
|
|
38726
|
-
|
|
38727
|
-
|
|
38884
|
+
clack53.outro(
|
|
38885
|
+
pc56.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
38728
38886
|
);
|
|
38729
38887
|
} else {
|
|
38730
|
-
|
|
38888
|
+
clack53.outro(pc56.green("SMS infrastructure has been removed"));
|
|
38731
38889
|
console.log(`
|
|
38732
|
-
${
|
|
38733
|
-
console.log(` ${
|
|
38734
|
-
console.log(` ${
|
|
38735
|
-
console.log(` ${
|
|
38736
|
-
console.log(` ${
|
|
38890
|
+
${pc56.bold("Cleaned up:")}`);
|
|
38891
|
+
console.log(` ${pc56.green("\u2713")} Phone number released`);
|
|
38892
|
+
console.log(` ${pc56.green("\u2713")} Configuration set deleted`);
|
|
38893
|
+
console.log(` ${pc56.green("\u2713")} Event processing infrastructure removed`);
|
|
38894
|
+
console.log(` ${pc56.green("\u2713")} IAM role deleted`);
|
|
38737
38895
|
}
|
|
38738
38896
|
console.log(
|
|
38739
38897
|
`
|
|
38740
|
-
Run ${
|
|
38898
|
+
Run ${pc56.cyan("wraps sms init")} to deploy infrastructure again.
|
|
38741
38899
|
`
|
|
38742
38900
|
);
|
|
38743
38901
|
trackServiceRemoved("sms", {
|
|
@@ -38749,9 +38907,9 @@ Run ${pc55.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
38749
38907
|
|
|
38750
38908
|
// src/commands/sms/init.ts
|
|
38751
38909
|
init_esm_shims();
|
|
38752
|
-
import * as
|
|
38910
|
+
import * as clack54 from "@clack/prompts";
|
|
38753
38911
|
import * as pulumi32 from "@pulumi/pulumi";
|
|
38754
|
-
import
|
|
38912
|
+
import pc57 from "picocolors";
|
|
38755
38913
|
init_events();
|
|
38756
38914
|
init_aws();
|
|
38757
38915
|
init_fs();
|
|
@@ -39170,7 +39328,7 @@ function validateSMSConfig(config2) {
|
|
|
39170
39328
|
|
|
39171
39329
|
// src/commands/sms/init.ts
|
|
39172
39330
|
async function promptPhoneNumberType() {
|
|
39173
|
-
const result = await
|
|
39331
|
+
const result = await clack54.select({
|
|
39174
39332
|
message: "Select phone number type:",
|
|
39175
39333
|
options: [
|
|
39176
39334
|
{
|
|
@@ -39190,14 +39348,14 @@ async function promptPhoneNumberType() {
|
|
|
39190
39348
|
}
|
|
39191
39349
|
]
|
|
39192
39350
|
});
|
|
39193
|
-
if (
|
|
39194
|
-
|
|
39351
|
+
if (clack54.isCancel(result)) {
|
|
39352
|
+
clack54.cancel("Operation cancelled.");
|
|
39195
39353
|
process.exit(0);
|
|
39196
39354
|
}
|
|
39197
39355
|
return result;
|
|
39198
39356
|
}
|
|
39199
39357
|
async function promptSMSPreset() {
|
|
39200
|
-
const result = await
|
|
39358
|
+
const result = await clack54.select({
|
|
39201
39359
|
message: "Choose configuration preset:",
|
|
39202
39360
|
options: [
|
|
39203
39361
|
{
|
|
@@ -39222,8 +39380,8 @@ async function promptSMSPreset() {
|
|
|
39222
39380
|
}
|
|
39223
39381
|
]
|
|
39224
39382
|
});
|
|
39225
|
-
if (
|
|
39226
|
-
|
|
39383
|
+
if (clack54.isCancel(result)) {
|
|
39384
|
+
clack54.cancel("Operation cancelled.");
|
|
39227
39385
|
process.exit(0);
|
|
39228
39386
|
}
|
|
39229
39387
|
return result;
|
|
@@ -39243,7 +39401,7 @@ var COMMON_COUNTRIES = [
|
|
|
39243
39401
|
{ code: "IN", name: "India" }
|
|
39244
39402
|
];
|
|
39245
39403
|
async function promptAllowedCountries() {
|
|
39246
|
-
const result = await
|
|
39404
|
+
const result = await clack54.multiselect({
|
|
39247
39405
|
message: "Select countries to allow SMS delivery (blocks all others):",
|
|
39248
39406
|
options: COMMON_COUNTRIES.map((c) => ({
|
|
39249
39407
|
value: c.code,
|
|
@@ -39252,14 +39410,14 @@ async function promptAllowedCountries() {
|
|
|
39252
39410
|
initialValues: ["US"],
|
|
39253
39411
|
required: true
|
|
39254
39412
|
});
|
|
39255
|
-
if (
|
|
39256
|
-
|
|
39413
|
+
if (clack54.isCancel(result)) {
|
|
39414
|
+
clack54.cancel("Operation cancelled.");
|
|
39257
39415
|
process.exit(0);
|
|
39258
39416
|
}
|
|
39259
39417
|
return result;
|
|
39260
39418
|
}
|
|
39261
39419
|
async function promptEstimatedSMSVolume() {
|
|
39262
|
-
const result = await
|
|
39420
|
+
const result = await clack54.select({
|
|
39263
39421
|
message: "Estimated messages per month:",
|
|
39264
39422
|
options: [
|
|
39265
39423
|
{ value: 100, label: "< 100 (Testing)" },
|
|
@@ -39269,8 +39427,8 @@ async function promptEstimatedSMSVolume() {
|
|
|
39269
39427
|
{ value: 1e5, label: "50,000+" }
|
|
39270
39428
|
]
|
|
39271
39429
|
});
|
|
39272
|
-
if (
|
|
39273
|
-
|
|
39430
|
+
if (clack54.isCancel(result)) {
|
|
39431
|
+
clack54.cancel("Operation cancelled.");
|
|
39274
39432
|
process.exit(0);
|
|
39275
39433
|
}
|
|
39276
39434
|
return result;
|
|
@@ -39278,7 +39436,7 @@ async function promptEstimatedSMSVolume() {
|
|
|
39278
39436
|
async function init3(options) {
|
|
39279
39437
|
const startTime = Date.now();
|
|
39280
39438
|
if (!isJsonMode()) {
|
|
39281
|
-
|
|
39439
|
+
clack54.intro(pc57.bold("Wraps SMS Infrastructure Setup"));
|
|
39282
39440
|
}
|
|
39283
39441
|
const progress = new DeploymentProgress();
|
|
39284
39442
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -39292,7 +39450,7 @@ async function init3(options) {
|
|
|
39292
39450
|
"Validating AWS credentials",
|
|
39293
39451
|
async () => validateAWSCredentials()
|
|
39294
39452
|
);
|
|
39295
|
-
progress.info(`Connected to AWS account: ${
|
|
39453
|
+
progress.info(`Connected to AWS account: ${pc57.cyan(identity.accountId)}`);
|
|
39296
39454
|
const provider = options.provider || await promptProvider();
|
|
39297
39455
|
const region = options.region || await promptRegion(await getAWSRegion());
|
|
39298
39456
|
let vercelConfig;
|
|
@@ -39304,10 +39462,10 @@ async function init3(options) {
|
|
|
39304
39462
|
region
|
|
39305
39463
|
);
|
|
39306
39464
|
if (existingConnection?.services?.sms) {
|
|
39307
|
-
|
|
39308
|
-
`SMS already configured for account ${
|
|
39465
|
+
clack54.log.warn(
|
|
39466
|
+
`SMS already configured for account ${pc57.cyan(identity.accountId)} in region ${pc57.cyan(region)}`
|
|
39309
39467
|
);
|
|
39310
|
-
|
|
39468
|
+
clack54.log.info(`Use ${pc57.cyan("wraps sms status")} to view current setup`);
|
|
39311
39469
|
process.exit(0);
|
|
39312
39470
|
}
|
|
39313
39471
|
let preset = options.preset;
|
|
@@ -39324,12 +39482,12 @@ async function init3(options) {
|
|
|
39324
39482
|
optOutManagement: true,
|
|
39325
39483
|
sendingEnabled: true
|
|
39326
39484
|
};
|
|
39327
|
-
const enableEventTracking = await
|
|
39485
|
+
const enableEventTracking = await clack54.confirm({
|
|
39328
39486
|
message: "Enable event tracking (EventBridge + DynamoDB)?",
|
|
39329
39487
|
initialValue: false
|
|
39330
39488
|
});
|
|
39331
|
-
if (
|
|
39332
|
-
|
|
39489
|
+
if (clack54.isCancel(enableEventTracking)) {
|
|
39490
|
+
clack54.cancel("Operation cancelled.");
|
|
39333
39491
|
process.exit(0);
|
|
39334
39492
|
}
|
|
39335
39493
|
if (enableEventTracking) {
|
|
@@ -39349,17 +39507,17 @@ async function init3(options) {
|
|
|
39349
39507
|
}
|
|
39350
39508
|
progress.info(
|
|
39351
39509
|
`
|
|
39352
|
-
${
|
|
39510
|
+
${pc57.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
39353
39511
|
);
|
|
39354
39512
|
const allowedCountries = await promptAllowedCountries();
|
|
39355
39513
|
let aitFiltering = false;
|
|
39356
39514
|
if (smsConfig.phoneNumberType !== "simulator") {
|
|
39357
|
-
const enableAIT = await
|
|
39515
|
+
const enableAIT = await clack54.confirm({
|
|
39358
39516
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
39359
39517
|
initialValue: false
|
|
39360
39518
|
});
|
|
39361
|
-
if (
|
|
39362
|
-
|
|
39519
|
+
if (clack54.isCancel(enableAIT)) {
|
|
39520
|
+
clack54.cancel("Operation cancelled.");
|
|
39363
39521
|
process.exit(0);
|
|
39364
39522
|
}
|
|
39365
39523
|
aitFiltering = enableAIT;
|
|
@@ -39371,21 +39529,21 @@ ${pc56.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
39371
39529
|
};
|
|
39372
39530
|
const estimatedVolume = await promptEstimatedSMSVolume();
|
|
39373
39531
|
progress.info(`
|
|
39374
|
-
${
|
|
39532
|
+
${pc57.bold("Cost Estimate:")}`);
|
|
39375
39533
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
39376
|
-
|
|
39534
|
+
clack54.log.info(costSummary);
|
|
39377
39535
|
const warnings = validateSMSConfig(smsConfig);
|
|
39378
39536
|
if (warnings.length > 0) {
|
|
39379
39537
|
progress.info(`
|
|
39380
|
-
${
|
|
39538
|
+
${pc57.yellow(pc57.bold("Important Notes:"))}`);
|
|
39381
39539
|
for (const warning of warnings) {
|
|
39382
|
-
|
|
39540
|
+
clack54.log.warn(warning);
|
|
39383
39541
|
}
|
|
39384
39542
|
}
|
|
39385
39543
|
if (!(options.yes || options.preview)) {
|
|
39386
39544
|
const confirmed = await confirmDeploy();
|
|
39387
39545
|
if (!confirmed) {
|
|
39388
|
-
|
|
39546
|
+
clack54.cancel("Deployment cancelled.");
|
|
39389
39547
|
process.exit(0);
|
|
39390
39548
|
}
|
|
39391
39549
|
}
|
|
@@ -39445,8 +39603,8 @@ ${pc56.yellow(pc56.bold("Important Notes:"))}`);
|
|
|
39445
39603
|
costEstimate: getSMSCostSummary(smsConfig, 0),
|
|
39446
39604
|
commandName: "wraps sms init"
|
|
39447
39605
|
});
|
|
39448
|
-
|
|
39449
|
-
|
|
39606
|
+
clack54.outro(
|
|
39607
|
+
pc57.green("Preview complete. Run without --preview to deploy.")
|
|
39450
39608
|
);
|
|
39451
39609
|
trackServiceInit("sms", true, {
|
|
39452
39610
|
provider,
|
|
@@ -39495,9 +39653,9 @@ ${pc56.yellow(pc56.bold("Important Notes:"))}`);
|
|
|
39495
39653
|
} catch (sdkError) {
|
|
39496
39654
|
sdkResourceWarning = true;
|
|
39497
39655
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39498
|
-
|
|
39499
|
-
|
|
39500
|
-
`Run ${
|
|
39656
|
+
clack54.log.warn(`Phone pool creation failed: ${msg}`);
|
|
39657
|
+
clack54.log.info(
|
|
39658
|
+
`Run ${pc57.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39501
39659
|
);
|
|
39502
39660
|
}
|
|
39503
39661
|
}
|
|
@@ -39513,9 +39671,9 @@ ${pc56.yellow(pc56.bold("Important Notes:"))}`);
|
|
|
39513
39671
|
} catch (sdkError) {
|
|
39514
39672
|
sdkResourceWarning = true;
|
|
39515
39673
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39516
|
-
|
|
39517
|
-
|
|
39518
|
-
`Run ${
|
|
39674
|
+
clack54.log.warn(`Event destination creation failed: ${msg}`);
|
|
39675
|
+
clack54.log.info(
|
|
39676
|
+
`Run ${pc57.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39519
39677
|
);
|
|
39520
39678
|
}
|
|
39521
39679
|
}
|
|
@@ -39534,14 +39692,14 @@ ${pc56.yellow(pc56.bold("Important Notes:"))}`);
|
|
|
39534
39692
|
} catch (sdkError) {
|
|
39535
39693
|
sdkResourceWarning = true;
|
|
39536
39694
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
39537
|
-
|
|
39538
|
-
|
|
39539
|
-
`Run ${
|
|
39695
|
+
clack54.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
39696
|
+
clack54.log.info(
|
|
39697
|
+
`Run ${pc57.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
39540
39698
|
);
|
|
39541
39699
|
}
|
|
39542
39700
|
}
|
|
39543
39701
|
if (sdkResourceWarning) {
|
|
39544
|
-
|
|
39702
|
+
clack54.log.warn(
|
|
39545
39703
|
"Some SDK resources failed to create. Core infrastructure is deployed."
|
|
39546
39704
|
);
|
|
39547
39705
|
}
|
|
@@ -39586,47 +39744,47 @@ ${pc56.yellow(pc56.bold("Important Notes:"))}`);
|
|
|
39586
39744
|
return;
|
|
39587
39745
|
}
|
|
39588
39746
|
console.log("\n");
|
|
39589
|
-
|
|
39747
|
+
clack54.log.success(pc57.green(pc57.bold("SMS infrastructure deployed!")));
|
|
39590
39748
|
console.log("\n");
|
|
39591
|
-
|
|
39749
|
+
clack54.note(
|
|
39592
39750
|
[
|
|
39593
|
-
`${
|
|
39594
|
-
`${
|
|
39595
|
-
`${
|
|
39596
|
-
`${
|
|
39597
|
-
outputs.tableName ? `${
|
|
39751
|
+
`${pc57.bold("Phone Number:")} ${pc57.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
39752
|
+
`${pc57.bold("Phone Type:")} ${pc57.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
39753
|
+
`${pc57.bold("Config Set:")} ${pc57.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
39754
|
+
`${pc57.bold("Region:")} ${pc57.cyan(outputs.region)}`,
|
|
39755
|
+
outputs.tableName ? `${pc57.bold("History Table:")} ${pc57.cyan(outputs.tableName)}` : "",
|
|
39598
39756
|
"",
|
|
39599
|
-
|
|
39600
|
-
|
|
39757
|
+
pc57.dim("IAM Role:"),
|
|
39758
|
+
pc57.dim(` ${outputs.roleArn}`)
|
|
39601
39759
|
].filter(Boolean).join("\n"),
|
|
39602
39760
|
"SMS Infrastructure"
|
|
39603
39761
|
);
|
|
39604
39762
|
const nextSteps = [];
|
|
39605
39763
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
39606
39764
|
nextSteps.push(
|
|
39607
|
-
`${
|
|
39765
|
+
`${pc57.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
39608
39766
|
);
|
|
39609
39767
|
}
|
|
39610
39768
|
nextSteps.push(
|
|
39611
|
-
`${
|
|
39769
|
+
`${pc57.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
39612
39770
|
);
|
|
39613
|
-
nextSteps.push(`${
|
|
39771
|
+
nextSteps.push(`${pc57.cyan("wraps sms status")} - View SMS configuration`);
|
|
39614
39772
|
console.log("\n");
|
|
39615
|
-
|
|
39773
|
+
clack54.log.info(pc57.bold("Next steps:"));
|
|
39616
39774
|
for (const step of nextSteps) {
|
|
39617
39775
|
console.log(` ${step}`);
|
|
39618
39776
|
}
|
|
39619
39777
|
console.log("\n");
|
|
39620
|
-
|
|
39621
|
-
console.log(
|
|
39778
|
+
clack54.log.info(pc57.bold("SDK Usage:"));
|
|
39779
|
+
console.log(pc57.dim(" npm install @wraps.dev/sms"));
|
|
39622
39780
|
console.log("");
|
|
39623
|
-
console.log(
|
|
39624
|
-
console.log(
|
|
39625
|
-
console.log(
|
|
39626
|
-
console.log(
|
|
39627
|
-
console.log(
|
|
39628
|
-
console.log(
|
|
39629
|
-
|
|
39781
|
+
console.log(pc57.dim(" import { Wraps } from '@wraps.dev/sms';"));
|
|
39782
|
+
console.log(pc57.dim(" const wraps = new Wraps();"));
|
|
39783
|
+
console.log(pc57.dim(" await wraps.sms.send({"));
|
|
39784
|
+
console.log(pc57.dim(" to: '+14155551234',"));
|
|
39785
|
+
console.log(pc57.dim(" message: 'Your code is 123456',"));
|
|
39786
|
+
console.log(pc57.dim(" });"));
|
|
39787
|
+
clack54.outro(pc57.green("Setup complete!"));
|
|
39630
39788
|
const duration = Date.now() - startTime;
|
|
39631
39789
|
const enabledFeatures = [];
|
|
39632
39790
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -39662,8 +39820,8 @@ init_aws();
|
|
|
39662
39820
|
init_json_output();
|
|
39663
39821
|
init_metadata();
|
|
39664
39822
|
init_output();
|
|
39665
|
-
import * as
|
|
39666
|
-
import
|
|
39823
|
+
import * as clack55 from "@clack/prompts";
|
|
39824
|
+
import pc58 from "picocolors";
|
|
39667
39825
|
async function getPhoneNumberDetails(region) {
|
|
39668
39826
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
39669
39827
|
const client = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -39683,7 +39841,7 @@ async function getPhoneNumberDetails(region) {
|
|
|
39683
39841
|
return null;
|
|
39684
39842
|
} catch (error) {
|
|
39685
39843
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
39686
|
-
|
|
39844
|
+
clack55.log.error(`Error fetching phone number: ${errorMessage}`);
|
|
39687
39845
|
return null;
|
|
39688
39846
|
}
|
|
39689
39847
|
}
|
|
@@ -39704,7 +39862,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
39704
39862
|
async function smsRegister(options) {
|
|
39705
39863
|
const startTime = Date.now();
|
|
39706
39864
|
if (!isJsonMode()) {
|
|
39707
|
-
|
|
39865
|
+
clack55.intro(pc58.bold("Wraps SMS - Toll-Free Registration"));
|
|
39708
39866
|
}
|
|
39709
39867
|
const progress = new DeploymentProgress();
|
|
39710
39868
|
const identity = await progress.execute(
|
|
@@ -39717,8 +39875,8 @@ async function smsRegister(options) {
|
|
|
39717
39875
|
}
|
|
39718
39876
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
39719
39877
|
if (!metadata?.services?.sms) {
|
|
39720
|
-
|
|
39721
|
-
|
|
39878
|
+
clack55.log.error("No SMS infrastructure found.");
|
|
39879
|
+
clack55.log.info(`Run ${pc58.cyan("wraps sms init")} first.`);
|
|
39722
39880
|
process.exit(1);
|
|
39723
39881
|
}
|
|
39724
39882
|
const phoneDetails = await progress.execute(
|
|
@@ -39726,7 +39884,7 @@ async function smsRegister(options) {
|
|
|
39726
39884
|
async () => getPhoneNumberDetails(region)
|
|
39727
39885
|
);
|
|
39728
39886
|
if (!phoneDetails) {
|
|
39729
|
-
|
|
39887
|
+
clack55.log.error("No phone number found.");
|
|
39730
39888
|
process.exit(1);
|
|
39731
39889
|
}
|
|
39732
39890
|
let registrationStatus = null;
|
|
@@ -39752,53 +39910,53 @@ async function smsRegister(options) {
|
|
|
39752
39910
|
}
|
|
39753
39911
|
console.log("");
|
|
39754
39912
|
console.log(
|
|
39755
|
-
`${
|
|
39913
|
+
`${pc58.bold("Phone Number:")} ${pc58.cyan(phoneDetails.phoneNumber)}`
|
|
39756
39914
|
);
|
|
39757
|
-
console.log(`${
|
|
39915
|
+
console.log(`${pc58.bold("Type:")} ${pc58.cyan(phoneDetails.type)}`);
|
|
39758
39916
|
console.log(
|
|
39759
|
-
`${
|
|
39917
|
+
`${pc58.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc58.green(phoneDetails.status) : pc58.yellow(phoneDetails.status)}`
|
|
39760
39918
|
);
|
|
39761
39919
|
if (registrationStatus) {
|
|
39762
|
-
console.log(`${
|
|
39920
|
+
console.log(`${pc58.bold("Registration:")} ${pc58.cyan(registrationStatus)}`);
|
|
39763
39921
|
}
|
|
39764
39922
|
console.log("");
|
|
39765
39923
|
if (phoneDetails.status === "ACTIVE") {
|
|
39766
|
-
|
|
39924
|
+
clack55.log.success("Your phone number is already ACTIVE and ready to use!");
|
|
39767
39925
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePoolsCommand } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
39768
39926
|
const client = new PinpointSMSVoiceV2Client5({ region });
|
|
39769
39927
|
const pools = await client.send(new DescribePoolsCommand({}));
|
|
39770
39928
|
if (!pools.Pools?.length) {
|
|
39771
|
-
|
|
39929
|
+
clack55.log.info("Run `wraps sms sync` to create the phone pool.");
|
|
39772
39930
|
}
|
|
39773
39931
|
process.exit(0);
|
|
39774
39932
|
}
|
|
39775
39933
|
if (phoneDetails.type !== "TOLL_FREE") {
|
|
39776
|
-
|
|
39777
|
-
|
|
39934
|
+
clack55.log.info("Only toll-free numbers require registration.");
|
|
39935
|
+
clack55.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
39778
39936
|
process.exit(0);
|
|
39779
39937
|
}
|
|
39780
|
-
console.log(
|
|
39938
|
+
console.log(pc58.bold("Toll-Free Registration Required"));
|
|
39781
39939
|
console.log("");
|
|
39782
39940
|
console.log(
|
|
39783
|
-
|
|
39941
|
+
pc58.dim("To send SMS at scale, you must register your toll-free number.")
|
|
39784
39942
|
);
|
|
39785
|
-
console.log(
|
|
39943
|
+
console.log(pc58.dim("This process typically takes 1-15 business days."));
|
|
39786
39944
|
console.log("");
|
|
39787
|
-
console.log(
|
|
39788
|
-
console.log(` ${
|
|
39945
|
+
console.log(pc58.bold("You'll need to provide:"));
|
|
39946
|
+
console.log(` ${pc58.dim("\u2022")} Business name and address`);
|
|
39789
39947
|
console.log(
|
|
39790
|
-
` ${
|
|
39948
|
+
` ${pc58.dim("\u2022")} Use case description (what messages you're sending)`
|
|
39791
39949
|
);
|
|
39792
|
-
console.log(` ${
|
|
39793
|
-
console.log(` ${
|
|
39794
|
-
console.log(` ${
|
|
39950
|
+
console.log(` ${pc58.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
39951
|
+
console.log(` ${pc58.dim("\u2022")} How users opt-in to receive messages`);
|
|
39952
|
+
console.log(` ${pc58.dim("\u2022")} Expected monthly message volume`);
|
|
39795
39953
|
console.log("");
|
|
39796
|
-
const openConsole = await
|
|
39954
|
+
const openConsole = await clack55.confirm({
|
|
39797
39955
|
message: "Open AWS Console to start registration?",
|
|
39798
39956
|
initialValue: true
|
|
39799
39957
|
});
|
|
39800
|
-
if (
|
|
39801
|
-
|
|
39958
|
+
if (clack55.isCancel(openConsole)) {
|
|
39959
|
+
clack55.cancel("Registration cancelled.");
|
|
39802
39960
|
process.exit(0);
|
|
39803
39961
|
}
|
|
39804
39962
|
if (openConsole) {
|
|
@@ -39808,41 +39966,41 @@ async function smsRegister(options) {
|
|
|
39808
39966
|
const execAsync2 = promisify2(exec2);
|
|
39809
39967
|
try {
|
|
39810
39968
|
await execAsync2(`open "${consoleUrl}"`);
|
|
39811
|
-
|
|
39969
|
+
clack55.log.success("Opened AWS Console in your browser.");
|
|
39812
39970
|
} catch {
|
|
39813
39971
|
try {
|
|
39814
39972
|
await execAsync2(`xdg-open "${consoleUrl}"`);
|
|
39815
|
-
|
|
39973
|
+
clack55.log.success("Opened AWS Console in your browser.");
|
|
39816
39974
|
} catch {
|
|
39817
|
-
|
|
39975
|
+
clack55.log.info("Open this URL in your browser:");
|
|
39818
39976
|
console.log(`
|
|
39819
|
-
${
|
|
39977
|
+
${pc58.cyan(consoleUrl)}
|
|
39820
39978
|
`);
|
|
39821
39979
|
}
|
|
39822
39980
|
}
|
|
39823
39981
|
console.log("");
|
|
39824
|
-
console.log(
|
|
39982
|
+
console.log(pc58.bold("Next Steps:"));
|
|
39825
39983
|
console.log(
|
|
39826
|
-
` 1. Click ${
|
|
39984
|
+
` 1. Click ${pc58.cyan("Create registration")} in the AWS Console`
|
|
39827
39985
|
);
|
|
39828
|
-
console.log(` 2. Select ${
|
|
39986
|
+
console.log(` 2. Select ${pc58.cyan("Toll-free number registration")}`);
|
|
39829
39987
|
console.log(" 3. Fill out the business information form");
|
|
39830
39988
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
39831
39989
|
console.log("");
|
|
39832
39990
|
console.log(
|
|
39833
|
-
|
|
39991
|
+
pc58.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
39834
39992
|
);
|
|
39835
39993
|
} else {
|
|
39836
39994
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
39837
39995
|
console.log("");
|
|
39838
39996
|
console.log("When you're ready, go to:");
|
|
39839
|
-
console.log(` ${
|
|
39997
|
+
console.log(` ${pc58.cyan(consoleUrl)}`);
|
|
39840
39998
|
}
|
|
39841
39999
|
trackCommand("sms:register", {
|
|
39842
40000
|
success: true,
|
|
39843
40001
|
duration_ms: Date.now() - startTime
|
|
39844
40002
|
});
|
|
39845
|
-
|
|
40003
|
+
clack55.outro(pc58.dim("Good luck with your registration!"));
|
|
39846
40004
|
}
|
|
39847
40005
|
|
|
39848
40006
|
// src/commands/sms/status.ts
|
|
@@ -39855,54 +40013,54 @@ init_metadata();
|
|
|
39855
40013
|
init_output();
|
|
39856
40014
|
init_pulumi();
|
|
39857
40015
|
init_region_resolver();
|
|
39858
|
-
import * as
|
|
40016
|
+
import * as clack56 from "@clack/prompts";
|
|
39859
40017
|
import * as pulumi33 from "@pulumi/pulumi";
|
|
39860
|
-
import
|
|
40018
|
+
import pc59 from "picocolors";
|
|
39861
40019
|
function displaySMSStatus(options) {
|
|
39862
40020
|
const lines = [];
|
|
39863
|
-
lines.push(
|
|
40021
|
+
lines.push(pc59.bold(pc59.green("SMS Infrastructure Active")));
|
|
39864
40022
|
lines.push("");
|
|
39865
|
-
lines.push(
|
|
40023
|
+
lines.push(pc59.bold("Phone Number"));
|
|
39866
40024
|
if (options.phoneNumber) {
|
|
39867
|
-
lines.push(` Number: ${
|
|
40025
|
+
lines.push(` Number: ${pc59.cyan(options.phoneNumber)}`);
|
|
39868
40026
|
} else {
|
|
39869
|
-
lines.push(` Number: ${
|
|
40027
|
+
lines.push(` Number: ${pc59.yellow("Provisioning...")}`);
|
|
39870
40028
|
}
|
|
39871
|
-
lines.push(` Type: ${
|
|
40029
|
+
lines.push(` Type: ${pc59.cyan(options.phoneNumberType || "simulator")}`);
|
|
39872
40030
|
lines.push("");
|
|
39873
|
-
lines.push(
|
|
39874
|
-
lines.push(` Region: ${
|
|
40031
|
+
lines.push(pc59.bold("Configuration"));
|
|
40032
|
+
lines.push(` Region: ${pc59.cyan(options.region)}`);
|
|
39875
40033
|
if (options.preset) {
|
|
39876
|
-
lines.push(` Preset: ${
|
|
40034
|
+
lines.push(` Preset: ${pc59.cyan(options.preset)}`);
|
|
39877
40035
|
}
|
|
39878
40036
|
if (options.configSetName) {
|
|
39879
|
-
lines.push(` Config Set: ${
|
|
40037
|
+
lines.push(` Config Set: ${pc59.cyan(options.configSetName)}`);
|
|
39880
40038
|
}
|
|
39881
40039
|
lines.push("");
|
|
39882
|
-
lines.push(
|
|
40040
|
+
lines.push(pc59.bold("Features"));
|
|
39883
40041
|
lines.push(
|
|
39884
|
-
` Event Tracking: ${options.eventTracking ?
|
|
40042
|
+
` Event Tracking: ${options.eventTracking ? pc59.green("Enabled") : pc59.dim("Disabled")}`
|
|
39885
40043
|
);
|
|
39886
40044
|
if (options.tableName) {
|
|
39887
|
-
lines.push(` Message History: ${
|
|
39888
|
-
lines.push(` Table: ${
|
|
40045
|
+
lines.push(` Message History: ${pc59.green("Enabled")}`);
|
|
40046
|
+
lines.push(` Table: ${pc59.dim(options.tableName)}`);
|
|
39889
40047
|
}
|
|
39890
40048
|
if (options.queueUrl) {
|
|
39891
|
-
lines.push(` Event Queue: ${
|
|
40049
|
+
lines.push(` Event Queue: ${pc59.green("Enabled")}`);
|
|
39892
40050
|
}
|
|
39893
40051
|
lines.push("");
|
|
39894
40052
|
if (options.roleArn) {
|
|
39895
|
-
lines.push(
|
|
39896
|
-
lines.push(` ${
|
|
40053
|
+
lines.push(pc59.bold("IAM Role"));
|
|
40054
|
+
lines.push(` ${pc59.dim(options.roleArn)}`);
|
|
39897
40055
|
}
|
|
39898
|
-
|
|
40056
|
+
clack56.note(lines.join("\n"), "SMS Status");
|
|
39899
40057
|
}
|
|
39900
40058
|
async function smsStatus(options) {
|
|
39901
40059
|
await ensurePulumiInstalled();
|
|
39902
40060
|
const startTime = Date.now();
|
|
39903
40061
|
const progress = new DeploymentProgress();
|
|
39904
40062
|
if (!isJsonMode()) {
|
|
39905
|
-
|
|
40063
|
+
clack56.intro(pc59.bold("Wraps SMS Status"));
|
|
39906
40064
|
}
|
|
39907
40065
|
const identity = await progress.execute(
|
|
39908
40066
|
"Loading SMS infrastructure status",
|
|
@@ -39917,10 +40075,10 @@ async function smsStatus(options) {
|
|
|
39917
40075
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
39918
40076
|
if (!metadata?.services?.sms) {
|
|
39919
40077
|
progress.stop();
|
|
39920
|
-
|
|
40078
|
+
clack56.log.error("No SMS infrastructure found");
|
|
39921
40079
|
console.log(
|
|
39922
40080
|
`
|
|
39923
|
-
Run ${
|
|
40081
|
+
Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
39924
40082
|
`
|
|
39925
40083
|
);
|
|
39926
40084
|
process.exit(1);
|
|
@@ -39956,25 +40114,25 @@ Run ${pc58.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
39956
40114
|
}
|
|
39957
40115
|
displaySMSStatus(smsStatusData);
|
|
39958
40116
|
console.log("");
|
|
39959
|
-
|
|
40117
|
+
clack56.log.info(pc59.bold("Commands:"));
|
|
39960
40118
|
console.log(
|
|
39961
|
-
` ${
|
|
40119
|
+
` ${pc59.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
39962
40120
|
);
|
|
39963
|
-
console.log(` ${
|
|
40121
|
+
console.log(` ${pc59.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
39964
40122
|
trackCommand("sms:status", {
|
|
39965
40123
|
success: true,
|
|
39966
40124
|
phone_type: smsConfig?.phoneNumberType,
|
|
39967
40125
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
39968
40126
|
duration_ms: Date.now() - startTime
|
|
39969
40127
|
});
|
|
39970
|
-
|
|
40128
|
+
clack56.outro(pc59.dim("SMS infrastructure is ready"));
|
|
39971
40129
|
}
|
|
39972
40130
|
|
|
39973
40131
|
// src/commands/sms/sync.ts
|
|
39974
40132
|
init_esm_shims();
|
|
39975
|
-
import * as
|
|
40133
|
+
import * as clack57 from "@clack/prompts";
|
|
39976
40134
|
import * as pulumi34 from "@pulumi/pulumi";
|
|
39977
|
-
import
|
|
40135
|
+
import pc60 from "picocolors";
|
|
39978
40136
|
init_events();
|
|
39979
40137
|
init_aws();
|
|
39980
40138
|
init_errors();
|
|
@@ -39987,7 +40145,7 @@ async function smsSync(options) {
|
|
|
39987
40145
|
await ensurePulumiInstalled();
|
|
39988
40146
|
const startTime = Date.now();
|
|
39989
40147
|
if (!isJsonMode()) {
|
|
39990
|
-
|
|
40148
|
+
clack57.intro(pc60.bold("Wraps SMS Infrastructure Sync"));
|
|
39991
40149
|
}
|
|
39992
40150
|
const progress = new DeploymentProgress();
|
|
39993
40151
|
const identity = await progress.execute(
|
|
@@ -39999,10 +40157,10 @@ async function smsSync(options) {
|
|
|
39999
40157
|
const smsService = metadata?.services?.sms;
|
|
40000
40158
|
if (!smsService?.config) {
|
|
40001
40159
|
progress.stop();
|
|
40002
|
-
|
|
40160
|
+
clack57.log.error("No SMS infrastructure found to sync");
|
|
40003
40161
|
console.log(
|
|
40004
40162
|
`
|
|
40005
|
-
Run ${
|
|
40163
|
+
Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
40006
40164
|
`
|
|
40007
40165
|
);
|
|
40008
40166
|
process.exit(1);
|
|
@@ -40011,18 +40169,18 @@ Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
40011
40169
|
const storedStackName = smsService.pulumiStackName;
|
|
40012
40170
|
progress.info("Found existing SMS configuration");
|
|
40013
40171
|
progress.info(
|
|
40014
|
-
`Phone type: ${
|
|
40172
|
+
`Phone type: ${pc60.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
40015
40173
|
);
|
|
40016
40174
|
progress.info(
|
|
40017
|
-
`Event tracking: ${
|
|
40175
|
+
`Event tracking: ${pc60.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
40018
40176
|
);
|
|
40019
40177
|
if (!options.yes) {
|
|
40020
|
-
const confirmed = await
|
|
40178
|
+
const confirmed = await clack57.confirm({
|
|
40021
40179
|
message: "Sync SMS infrastructure? This will update Lambda code and recreate any missing resources.",
|
|
40022
40180
|
initialValue: true
|
|
40023
40181
|
});
|
|
40024
|
-
if (
|
|
40025
|
-
|
|
40182
|
+
if (clack57.isCancel(confirmed) || !confirmed) {
|
|
40183
|
+
clack57.cancel("Sync cancelled.");
|
|
40026
40184
|
process.exit(0);
|
|
40027
40185
|
}
|
|
40028
40186
|
}
|
|
@@ -40127,7 +40285,7 @@ Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
40127
40285
|
throw errors.stackLocked();
|
|
40128
40286
|
}
|
|
40129
40287
|
trackError("SYNC_FAILED", "sms:sync", { step: "sync" });
|
|
40130
|
-
|
|
40288
|
+
clack57.log.error(`SMS sync failed: ${errorMessage}`);
|
|
40131
40289
|
process.exit(1);
|
|
40132
40290
|
}
|
|
40133
40291
|
if (metadata && smsService) {
|
|
@@ -40147,7 +40305,7 @@ Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
40147
40305
|
return;
|
|
40148
40306
|
}
|
|
40149
40307
|
console.log("\n");
|
|
40150
|
-
|
|
40308
|
+
clack57.log.success(pc60.green("SMS infrastructure synced successfully!"));
|
|
40151
40309
|
const changes = [];
|
|
40152
40310
|
if (outputs.lambdaFunctions?.length) {
|
|
40153
40311
|
changes.push("Lambda functions updated");
|
|
@@ -40155,13 +40313,13 @@ Run ${pc59.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
40155
40313
|
changes.push("SDK resources verified");
|
|
40156
40314
|
console.log("");
|
|
40157
40315
|
for (const change of changes) {
|
|
40158
|
-
console.log(` ${
|
|
40316
|
+
console.log(` ${pc60.green("\u2713")} ${change}`);
|
|
40159
40317
|
}
|
|
40160
40318
|
trackCommand("sms:sync", {
|
|
40161
40319
|
success: true,
|
|
40162
40320
|
duration_ms: Date.now() - startTime
|
|
40163
40321
|
});
|
|
40164
|
-
|
|
40322
|
+
clack57.outro(pc60.green("Sync complete!"));
|
|
40165
40323
|
}
|
|
40166
40324
|
|
|
40167
40325
|
// src/commands/sms/test.ts
|
|
@@ -40176,8 +40334,8 @@ import {
|
|
|
40176
40334
|
PinpointSMSVoiceV2Client as PinpointSMSVoiceV2Client3,
|
|
40177
40335
|
SendTextMessageCommand
|
|
40178
40336
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
40179
|
-
import * as
|
|
40180
|
-
import
|
|
40337
|
+
import * as clack58 from "@clack/prompts";
|
|
40338
|
+
import pc61 from "picocolors";
|
|
40181
40339
|
|
|
40182
40340
|
// src/utils/sms/validation.ts
|
|
40183
40341
|
init_esm_shims();
|
|
@@ -40200,7 +40358,7 @@ async function smsTest(options) {
|
|
|
40200
40358
|
const startTime = Date.now();
|
|
40201
40359
|
const progress = new DeploymentProgress();
|
|
40202
40360
|
if (!isJsonMode()) {
|
|
40203
|
-
|
|
40361
|
+
clack58.intro(pc61.bold("Wraps SMS Test"));
|
|
40204
40362
|
}
|
|
40205
40363
|
const identity = await progress.execute(
|
|
40206
40364
|
"Validating AWS credentials",
|
|
@@ -40210,10 +40368,10 @@ async function smsTest(options) {
|
|
|
40210
40368
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
40211
40369
|
if (!metadata?.services?.sms) {
|
|
40212
40370
|
progress.stop();
|
|
40213
|
-
|
|
40371
|
+
clack58.log.error("No SMS infrastructure found");
|
|
40214
40372
|
console.log(
|
|
40215
40373
|
`
|
|
40216
|
-
Run ${
|
|
40374
|
+
Run ${pc61.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
40217
40375
|
`
|
|
40218
40376
|
);
|
|
40219
40377
|
process.exit(1);
|
|
@@ -40227,7 +40385,7 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40227
40385
|
);
|
|
40228
40386
|
}
|
|
40229
40387
|
if (!toNumber) {
|
|
40230
|
-
const destinationType = await
|
|
40388
|
+
const destinationType = await clack58.select({
|
|
40231
40389
|
message: "Choose destination number:",
|
|
40232
40390
|
options: [
|
|
40233
40391
|
{
|
|
@@ -40242,25 +40400,25 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40242
40400
|
}
|
|
40243
40401
|
]
|
|
40244
40402
|
});
|
|
40245
|
-
if (
|
|
40246
|
-
|
|
40403
|
+
if (clack58.isCancel(destinationType)) {
|
|
40404
|
+
clack58.cancel("Operation cancelled.");
|
|
40247
40405
|
process.exit(0);
|
|
40248
40406
|
}
|
|
40249
40407
|
if (destinationType === "simulator") {
|
|
40250
|
-
const simResult = await
|
|
40408
|
+
const simResult = await clack58.select({
|
|
40251
40409
|
message: "Select simulator destination:",
|
|
40252
40410
|
options: SIMULATOR_DESTINATIONS.map((sim) => ({
|
|
40253
40411
|
value: sim.number,
|
|
40254
40412
|
label: `${sim.number} | ${sim.country}`
|
|
40255
40413
|
}))
|
|
40256
40414
|
});
|
|
40257
|
-
if (
|
|
40258
|
-
|
|
40415
|
+
if (clack58.isCancel(simResult)) {
|
|
40416
|
+
clack58.cancel("Operation cancelled.");
|
|
40259
40417
|
process.exit(0);
|
|
40260
40418
|
}
|
|
40261
40419
|
toNumber = simResult;
|
|
40262
40420
|
} else {
|
|
40263
|
-
const result = await
|
|
40421
|
+
const result = await clack58.text({
|
|
40264
40422
|
message: "Enter destination phone number (E.164 format):",
|
|
40265
40423
|
placeholder: "+14155551234",
|
|
40266
40424
|
validate: (value) => {
|
|
@@ -40273,22 +40431,22 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40273
40431
|
return;
|
|
40274
40432
|
}
|
|
40275
40433
|
});
|
|
40276
|
-
if (
|
|
40277
|
-
|
|
40434
|
+
if (clack58.isCancel(result)) {
|
|
40435
|
+
clack58.cancel("Operation cancelled.");
|
|
40278
40436
|
process.exit(0);
|
|
40279
40437
|
}
|
|
40280
40438
|
toNumber = result;
|
|
40281
40439
|
}
|
|
40282
40440
|
} else if (!isValidPhoneNumber(toNumber)) {
|
|
40283
40441
|
progress.stop();
|
|
40284
|
-
|
|
40442
|
+
clack58.log.error(
|
|
40285
40443
|
`Invalid phone number format: ${toNumber}. Use E.164 format (e.g., +14155551234)`
|
|
40286
40444
|
);
|
|
40287
40445
|
process.exit(1);
|
|
40288
40446
|
}
|
|
40289
40447
|
let message = options.message;
|
|
40290
40448
|
if (!message) {
|
|
40291
|
-
const result = await
|
|
40449
|
+
const result = await clack58.text({
|
|
40292
40450
|
message: "Enter test message:",
|
|
40293
40451
|
placeholder: "Hello from Wraps SMS!",
|
|
40294
40452
|
defaultValue: "Hello from Wraps SMS! This is a test message.",
|
|
@@ -40302,8 +40460,8 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40302
40460
|
return;
|
|
40303
40461
|
}
|
|
40304
40462
|
});
|
|
40305
|
-
if (
|
|
40306
|
-
|
|
40463
|
+
if (clack58.isCancel(result)) {
|
|
40464
|
+
clack58.cancel("Operation cancelled.");
|
|
40307
40465
|
process.exit(0);
|
|
40308
40466
|
}
|
|
40309
40467
|
message = result;
|
|
@@ -40342,16 +40500,16 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40342
40500
|
return;
|
|
40343
40501
|
}
|
|
40344
40502
|
console.log("\n");
|
|
40345
|
-
|
|
40503
|
+
clack58.log.success(pc61.green("Test SMS sent successfully!"));
|
|
40346
40504
|
console.log("");
|
|
40347
|
-
|
|
40505
|
+
clack58.note(
|
|
40348
40506
|
[
|
|
40349
|
-
`${
|
|
40350
|
-
`${
|
|
40351
|
-
`${
|
|
40352
|
-
`${
|
|
40507
|
+
`${pc61.bold("Message ID:")} ${pc61.cyan(messageId || "unknown")}`,
|
|
40508
|
+
`${pc61.bold("To:")} ${pc61.cyan(toNumber)}`,
|
|
40509
|
+
`${pc61.bold("Message:")} ${message}`,
|
|
40510
|
+
`${pc61.bold("Type:")} ${pc61.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
40353
40511
|
"",
|
|
40354
|
-
|
|
40512
|
+
pc61.dim(
|
|
40355
40513
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
40356
40514
|
)
|
|
40357
40515
|
].join("\n"),
|
|
@@ -40359,11 +40517,11 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40359
40517
|
);
|
|
40360
40518
|
if (smsConfig?.eventTracking?.enabled) {
|
|
40361
40519
|
console.log("");
|
|
40362
|
-
|
|
40363
|
-
|
|
40520
|
+
clack58.log.info(
|
|
40521
|
+
pc61.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
40364
40522
|
);
|
|
40365
40523
|
}
|
|
40366
|
-
|
|
40524
|
+
clack58.outro(pc61.green("Test complete!"));
|
|
40367
40525
|
} catch (error) {
|
|
40368
40526
|
progress.stop();
|
|
40369
40527
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -40375,33 +40533,33 @@ Run ${pc60.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
40375
40533
|
});
|
|
40376
40534
|
const errorName = error instanceof Error ? error.name : "";
|
|
40377
40535
|
if (errorName === "ConflictException" || errorMessage.includes("opt-out")) {
|
|
40378
|
-
|
|
40536
|
+
clack58.log.error("Destination number has opted out of messages");
|
|
40379
40537
|
console.log("\nThe recipient has opted out of receiving SMS messages.\n");
|
|
40380
40538
|
} else if (errorName === "ThrottlingException" || errorMessage.includes("spending limit")) {
|
|
40381
|
-
|
|
40539
|
+
clack58.log.error("SMS rate or spending limit reached");
|
|
40382
40540
|
console.log(
|
|
40383
40541
|
"\nCheck your AWS account SMS spending limits in the console.\n"
|
|
40384
40542
|
);
|
|
40385
40543
|
} else if (errorName === "ValidationException") {
|
|
40386
|
-
|
|
40544
|
+
clack58.log.error(`Invalid request: ${errorMessage}`);
|
|
40387
40545
|
} else if (errorMessage.includes("not verified") || errorMessage.includes("not registered")) {
|
|
40388
|
-
|
|
40546
|
+
clack58.log.error("Toll-free number registration is not complete");
|
|
40389
40547
|
console.log(
|
|
40390
40548
|
`
|
|
40391
|
-
Run ${
|
|
40549
|
+
Run ${pc61.cyan("wraps sms register")} to check registration status.
|
|
40392
40550
|
`
|
|
40393
40551
|
);
|
|
40394
40552
|
} else if (errorName === "AccessDeniedException") {
|
|
40395
|
-
|
|
40553
|
+
clack58.log.error(
|
|
40396
40554
|
"Permission denied \u2014 IAM role may be missing SMS send permissions"
|
|
40397
40555
|
);
|
|
40398
40556
|
console.log(
|
|
40399
40557
|
`
|
|
40400
|
-
Run ${
|
|
40558
|
+
Run ${pc61.cyan("wraps sms upgrade")} to update IAM policies.
|
|
40401
40559
|
`
|
|
40402
40560
|
);
|
|
40403
40561
|
} else {
|
|
40404
|
-
|
|
40562
|
+
clack58.log.error(`Failed to send SMS: ${errorMessage}`);
|
|
40405
40563
|
}
|
|
40406
40564
|
process.exit(1);
|
|
40407
40565
|
}
|
|
@@ -40409,9 +40567,9 @@ Run ${pc60.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
40409
40567
|
|
|
40410
40568
|
// src/commands/sms/upgrade.ts
|
|
40411
40569
|
init_esm_shims();
|
|
40412
|
-
import * as
|
|
40570
|
+
import * as clack59 from "@clack/prompts";
|
|
40413
40571
|
import * as pulumi35 from "@pulumi/pulumi";
|
|
40414
|
-
import
|
|
40572
|
+
import pc62 from "picocolors";
|
|
40415
40573
|
init_events();
|
|
40416
40574
|
init_aws();
|
|
40417
40575
|
init_errors();
|
|
@@ -40426,7 +40584,7 @@ async function smsUpgrade(options) {
|
|
|
40426
40584
|
const startTime = Date.now();
|
|
40427
40585
|
let upgradeAction = "";
|
|
40428
40586
|
if (!isJsonMode()) {
|
|
40429
|
-
|
|
40587
|
+
clack59.intro(pc62.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
40430
40588
|
}
|
|
40431
40589
|
const progress = new DeploymentProgress();
|
|
40432
40590
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -40440,7 +40598,7 @@ async function smsUpgrade(options) {
|
|
|
40440
40598
|
"Validating AWS credentials",
|
|
40441
40599
|
async () => validateAWSCredentials()
|
|
40442
40600
|
);
|
|
40443
|
-
progress.info(`Connected to AWS account: ${
|
|
40601
|
+
progress.info(`Connected to AWS account: ${pc62.cyan(identity.accountId)}`);
|
|
40444
40602
|
const region = await resolveRegionForCommand({
|
|
40445
40603
|
accountId: identity.accountId,
|
|
40446
40604
|
optionRegion: options.region,
|
|
@@ -40449,35 +40607,35 @@ async function smsUpgrade(options) {
|
|
|
40449
40607
|
});
|
|
40450
40608
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
40451
40609
|
if (!metadata) {
|
|
40452
|
-
|
|
40453
|
-
`No Wraps connection found for account ${
|
|
40610
|
+
clack59.log.error(
|
|
40611
|
+
`No Wraps connection found for account ${pc62.cyan(identity.accountId)} in region ${pc62.cyan(region)}`
|
|
40454
40612
|
);
|
|
40455
|
-
|
|
40456
|
-
`Use ${
|
|
40613
|
+
clack59.log.info(
|
|
40614
|
+
`Use ${pc62.cyan("wraps sms init")} to create new infrastructure.`
|
|
40457
40615
|
);
|
|
40458
40616
|
process.exit(1);
|
|
40459
40617
|
}
|
|
40460
40618
|
if (!metadata.services.sms) {
|
|
40461
|
-
|
|
40462
|
-
|
|
40463
|
-
`Use ${
|
|
40619
|
+
clack59.log.error("No SMS infrastructure found");
|
|
40620
|
+
clack59.log.info(
|
|
40621
|
+
`Use ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
40464
40622
|
);
|
|
40465
40623
|
process.exit(1);
|
|
40466
40624
|
}
|
|
40467
40625
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
40468
40626
|
console.log(`
|
|
40469
|
-
${
|
|
40627
|
+
${pc62.bold("Current Configuration:")}
|
|
40470
40628
|
`);
|
|
40471
40629
|
if (metadata.services.sms.preset) {
|
|
40472
|
-
console.log(` Preset: ${
|
|
40630
|
+
console.log(` Preset: ${pc62.cyan(metadata.services.sms.preset)}`);
|
|
40473
40631
|
} else {
|
|
40474
|
-
console.log(` Preset: ${
|
|
40632
|
+
console.log(` Preset: ${pc62.cyan("custom")}`);
|
|
40475
40633
|
}
|
|
40476
40634
|
const config2 = metadata.services.sms.config;
|
|
40477
40635
|
if (!config2) {
|
|
40478
|
-
|
|
40479
|
-
|
|
40480
|
-
`Use ${
|
|
40636
|
+
clack59.log.error("No SMS configuration found in metadata");
|
|
40637
|
+
clack59.log.info(
|
|
40638
|
+
`Use ${pc62.cyan("wraps sms init")} to create new infrastructure.`
|
|
40481
40639
|
);
|
|
40482
40640
|
process.exit(1);
|
|
40483
40641
|
}
|
|
@@ -40489,45 +40647,45 @@ ${pc61.bold("Current Configuration:")}
|
|
|
40489
40647
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
40490
40648
|
};
|
|
40491
40649
|
console.log(
|
|
40492
|
-
` Phone Type: ${
|
|
40650
|
+
` Phone Type: ${pc62.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
40493
40651
|
);
|
|
40494
40652
|
}
|
|
40495
40653
|
if (config2.tracking?.enabled) {
|
|
40496
|
-
console.log(` ${
|
|
40654
|
+
console.log(` ${pc62.green("\u2713")} Delivery Tracking`);
|
|
40497
40655
|
if (config2.tracking.linkTracking) {
|
|
40498
|
-
console.log(` ${
|
|
40656
|
+
console.log(` ${pc62.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
40499
40657
|
}
|
|
40500
40658
|
}
|
|
40501
40659
|
if (config2.eventTracking?.enabled) {
|
|
40502
|
-
console.log(` ${
|
|
40660
|
+
console.log(` ${pc62.green("\u2713")} Event Tracking (SNS)`);
|
|
40503
40661
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
40504
40662
|
console.log(
|
|
40505
|
-
` ${
|
|
40663
|
+
` ${pc62.dim("\u2514\u2500")} Message History: ${pc62.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
40506
40664
|
);
|
|
40507
40665
|
}
|
|
40508
40666
|
}
|
|
40509
40667
|
if (config2.messageArchiving?.enabled) {
|
|
40510
40668
|
console.log(
|
|
40511
|
-
` ${
|
|
40669
|
+
` ${pc62.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
40512
40670
|
);
|
|
40513
40671
|
}
|
|
40514
40672
|
if (config2.optOutManagement) {
|
|
40515
|
-
console.log(` ${
|
|
40673
|
+
console.log(` ${pc62.green("\u2713")} Opt-out Management`);
|
|
40516
40674
|
}
|
|
40517
40675
|
if (config2.protectConfiguration?.enabled) {
|
|
40518
40676
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
40519
|
-
console.log(` ${
|
|
40520
|
-
console.log(` ${
|
|
40677
|
+
console.log(` ${pc62.green("\u2713")} Fraud Protection`);
|
|
40678
|
+
console.log(` ${pc62.dim("\u2514\u2500")} Allowed countries: ${pc62.cyan(countries)}`);
|
|
40521
40679
|
if (config2.protectConfiguration.aitFiltering) {
|
|
40522
|
-
console.log(` ${
|
|
40680
|
+
console.log(` ${pc62.dim("\u2514\u2500")} AIT filtering: ${pc62.cyan("enabled")}`);
|
|
40523
40681
|
}
|
|
40524
40682
|
} else {
|
|
40525
|
-
console.log(` ${
|
|
40683
|
+
console.log(` ${pc62.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
40526
40684
|
}
|
|
40527
40685
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
40528
40686
|
console.log(
|
|
40529
40687
|
`
|
|
40530
|
-
Estimated Cost: ${
|
|
40688
|
+
Estimated Cost: ${pc62.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
40531
40689
|
);
|
|
40532
40690
|
console.log("");
|
|
40533
40691
|
const phoneTypeLabels = {
|
|
@@ -40536,7 +40694,7 @@ ${pc61.bold("Current Configuration:")}
|
|
|
40536
40694
|
"10dlc": "10DLC",
|
|
40537
40695
|
"short-code": "Short code"
|
|
40538
40696
|
};
|
|
40539
|
-
upgradeAction = await
|
|
40697
|
+
upgradeAction = await clack59.select({
|
|
40540
40698
|
message: "What would you like to do?",
|
|
40541
40699
|
options: [
|
|
40542
40700
|
{
|
|
@@ -40576,8 +40734,8 @@ ${pc61.bold("Current Configuration:")}
|
|
|
40576
40734
|
}
|
|
40577
40735
|
]
|
|
40578
40736
|
});
|
|
40579
|
-
if (
|
|
40580
|
-
|
|
40737
|
+
if (clack59.isCancel(upgradeAction)) {
|
|
40738
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40581
40739
|
process.exit(0);
|
|
40582
40740
|
}
|
|
40583
40741
|
let updatedConfig = { ...config2 };
|
|
@@ -40618,65 +40776,65 @@ ${pc61.bold("Current Configuration:")}
|
|
|
40618
40776
|
hint: p.hint
|
|
40619
40777
|
}));
|
|
40620
40778
|
if (availableTypes.length === 0) {
|
|
40621
|
-
|
|
40779
|
+
clack59.log.warn(
|
|
40622
40780
|
"Already on highest phone number tier. Contact AWS for dedicated short codes."
|
|
40623
40781
|
);
|
|
40624
40782
|
process.exit(0);
|
|
40625
40783
|
}
|
|
40626
|
-
const selectedType = await
|
|
40784
|
+
const selectedType = await clack59.select({
|
|
40627
40785
|
message: "Select new phone number type:",
|
|
40628
40786
|
options: availableTypes
|
|
40629
40787
|
});
|
|
40630
|
-
if (
|
|
40631
|
-
|
|
40788
|
+
if (clack59.isCancel(selectedType)) {
|
|
40789
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40632
40790
|
process.exit(0);
|
|
40633
40791
|
}
|
|
40634
40792
|
if (selectedType === "toll-free") {
|
|
40635
40793
|
console.log(
|
|
40636
40794
|
`
|
|
40637
|
-
${
|
|
40795
|
+
${pc62.yellow("\u26A0")} ${pc62.bold("Toll-free Registration Required")}
|
|
40638
40796
|
`
|
|
40639
40797
|
);
|
|
40640
40798
|
console.log(
|
|
40641
|
-
|
|
40799
|
+
pc62.dim("Toll-free numbers require carrier registration before")
|
|
40642
40800
|
);
|
|
40643
40801
|
console.log(
|
|
40644
|
-
|
|
40802
|
+
pc62.dim("they can send messages at scale. After deployment:\n")
|
|
40645
40803
|
);
|
|
40646
40804
|
console.log(
|
|
40647
|
-
` 1. Run ${
|
|
40805
|
+
` 1. Run ${pc62.cyan("wraps sms register")} to start registration`
|
|
40648
40806
|
);
|
|
40649
40807
|
console.log(" 2. Submit your business use case information");
|
|
40650
40808
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
40651
40809
|
console.log(
|
|
40652
|
-
|
|
40810
|
+
pc62.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
40653
40811
|
);
|
|
40654
|
-
const confirmTollFree = await
|
|
40812
|
+
const confirmTollFree = await clack59.confirm({
|
|
40655
40813
|
message: "Continue with toll-free number request?",
|
|
40656
40814
|
initialValue: true
|
|
40657
40815
|
});
|
|
40658
|
-
if (
|
|
40659
|
-
|
|
40816
|
+
if (clack59.isCancel(confirmTollFree) || !confirmTollFree) {
|
|
40817
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40660
40818
|
process.exit(0);
|
|
40661
40819
|
}
|
|
40662
40820
|
}
|
|
40663
40821
|
if (selectedType === "10dlc") {
|
|
40664
40822
|
console.log(
|
|
40665
40823
|
`
|
|
40666
|
-
${
|
|
40824
|
+
${pc62.yellow("\u26A0")} ${pc62.bold("10DLC Campaign Registration Required")}
|
|
40667
40825
|
`
|
|
40668
40826
|
);
|
|
40669
|
-
console.log(
|
|
40827
|
+
console.log(pc62.dim("10DLC requires brand and campaign registration:"));
|
|
40670
40828
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
40671
40829
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
40672
40830
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
40673
40831
|
console.log("");
|
|
40674
|
-
const confirm10DLC = await
|
|
40832
|
+
const confirm10DLC = await clack59.confirm({
|
|
40675
40833
|
message: "Continue with 10DLC number request?",
|
|
40676
40834
|
initialValue: true
|
|
40677
40835
|
});
|
|
40678
|
-
if (
|
|
40679
|
-
|
|
40836
|
+
if (clack59.isCancel(confirm10DLC) || !confirm10DLC) {
|
|
40837
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40680
40838
|
process.exit(0);
|
|
40681
40839
|
}
|
|
40682
40840
|
}
|
|
@@ -40701,15 +40859,15 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40701
40859
|
disabled: currentPresetIdx >= 0 && idx <= currentPresetIdx ? "Current or lower tier" : void 0
|
|
40702
40860
|
})).filter((p) => !p.disabled && p.value !== "custom");
|
|
40703
40861
|
if (availablePresets.length === 0) {
|
|
40704
|
-
|
|
40862
|
+
clack59.log.warn("Already on highest preset (Enterprise)");
|
|
40705
40863
|
process.exit(0);
|
|
40706
40864
|
}
|
|
40707
|
-
const selectedPreset = await
|
|
40865
|
+
const selectedPreset = await clack59.select({
|
|
40708
40866
|
message: "Select new preset:",
|
|
40709
40867
|
options: availablePresets
|
|
40710
40868
|
});
|
|
40711
|
-
if (
|
|
40712
|
-
|
|
40869
|
+
if (clack59.isCancel(selectedPreset)) {
|
|
40870
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40713
40871
|
process.exit(0);
|
|
40714
40872
|
}
|
|
40715
40873
|
const presetConfig = getSMSPreset(selectedPreset);
|
|
@@ -40725,7 +40883,7 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40725
40883
|
}
|
|
40726
40884
|
case "event-tracking": {
|
|
40727
40885
|
if (config2.eventTracking?.enabled) {
|
|
40728
|
-
const eventAction = await
|
|
40886
|
+
const eventAction = await clack59.select({
|
|
40729
40887
|
message: "What would you like to do with event tracking?",
|
|
40730
40888
|
options: [
|
|
40731
40889
|
{
|
|
@@ -40740,17 +40898,17 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40740
40898
|
}
|
|
40741
40899
|
]
|
|
40742
40900
|
});
|
|
40743
|
-
if (
|
|
40744
|
-
|
|
40901
|
+
if (clack59.isCancel(eventAction)) {
|
|
40902
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40745
40903
|
process.exit(0);
|
|
40746
40904
|
}
|
|
40747
40905
|
if (eventAction === "disable") {
|
|
40748
|
-
const confirmDisable = await
|
|
40906
|
+
const confirmDisable = await clack59.confirm({
|
|
40749
40907
|
message: "Are you sure? Existing history will remain, but new events won't be tracked.",
|
|
40750
40908
|
initialValue: false
|
|
40751
40909
|
});
|
|
40752
|
-
if (
|
|
40753
|
-
|
|
40910
|
+
if (clack59.isCancel(confirmDisable) || !confirmDisable) {
|
|
40911
|
+
clack59.cancel("Event tracking not disabled.");
|
|
40754
40912
|
process.exit(0);
|
|
40755
40913
|
}
|
|
40756
40914
|
updatedConfig = {
|
|
@@ -40760,7 +40918,7 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40760
40918
|
}
|
|
40761
40919
|
};
|
|
40762
40920
|
} else {
|
|
40763
|
-
const retention = await
|
|
40921
|
+
const retention = await clack59.select({
|
|
40764
40922
|
message: "Message history retention period:",
|
|
40765
40923
|
options: [
|
|
40766
40924
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40787,8 +40945,8 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40787
40945
|
],
|
|
40788
40946
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
40789
40947
|
});
|
|
40790
|
-
if (
|
|
40791
|
-
|
|
40948
|
+
if (clack59.isCancel(retention)) {
|
|
40949
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40792
40950
|
process.exit(0);
|
|
40793
40951
|
}
|
|
40794
40952
|
updatedConfig = {
|
|
@@ -40800,19 +40958,19 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40800
40958
|
};
|
|
40801
40959
|
}
|
|
40802
40960
|
} else {
|
|
40803
|
-
const enableTracking = await
|
|
40961
|
+
const enableTracking = await clack59.confirm({
|
|
40804
40962
|
message: "Enable event tracking? (Track SMS events with history)",
|
|
40805
40963
|
initialValue: true
|
|
40806
40964
|
});
|
|
40807
|
-
if (
|
|
40808
|
-
|
|
40965
|
+
if (clack59.isCancel(enableTracking)) {
|
|
40966
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40809
40967
|
process.exit(0);
|
|
40810
40968
|
}
|
|
40811
40969
|
if (!enableTracking) {
|
|
40812
|
-
|
|
40970
|
+
clack59.log.info("Event tracking not enabled.");
|
|
40813
40971
|
process.exit(0);
|
|
40814
40972
|
}
|
|
40815
|
-
const retention = await
|
|
40973
|
+
const retention = await clack59.select({
|
|
40816
40974
|
message: "Message history retention period:",
|
|
40817
40975
|
options: [
|
|
40818
40976
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40835,8 +40993,8 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40835
40993
|
],
|
|
40836
40994
|
initialValue: "90days"
|
|
40837
40995
|
});
|
|
40838
|
-
if (
|
|
40839
|
-
|
|
40996
|
+
if (clack59.isCancel(retention)) {
|
|
40997
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40840
40998
|
process.exit(0);
|
|
40841
40999
|
}
|
|
40842
41000
|
updatedConfig = {
|
|
@@ -40855,12 +41013,12 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40855
41013
|
}
|
|
40856
41014
|
case "retention": {
|
|
40857
41015
|
if (!config2.eventTracking?.enabled) {
|
|
40858
|
-
|
|
41016
|
+
clack59.log.error(
|
|
40859
41017
|
"Event tracking is not enabled. Enable it first to change retention."
|
|
40860
41018
|
);
|
|
40861
41019
|
process.exit(1);
|
|
40862
41020
|
}
|
|
40863
|
-
const retention = await
|
|
41021
|
+
const retention = await clack59.select({
|
|
40864
41022
|
message: "Message history retention period (event data in DynamoDB):",
|
|
40865
41023
|
options: [
|
|
40866
41024
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -40879,8 +41037,8 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40879
41037
|
],
|
|
40880
41038
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
40881
41039
|
});
|
|
40882
|
-
if (
|
|
40883
|
-
|
|
41040
|
+
if (clack59.isCancel(retention)) {
|
|
41041
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40884
41042
|
process.exit(0);
|
|
40885
41043
|
}
|
|
40886
41044
|
updatedConfig = {
|
|
@@ -40898,21 +41056,21 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40898
41056
|
case "link-tracking": {
|
|
40899
41057
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
40900
41058
|
if (enableLinkTracking) {
|
|
40901
|
-
|
|
40902
|
-
|
|
41059
|
+
clack59.log.info(
|
|
41060
|
+
pc62.dim(
|
|
40903
41061
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
40904
41062
|
)
|
|
40905
41063
|
);
|
|
40906
|
-
|
|
40907
|
-
|
|
41064
|
+
clack59.log.info(
|
|
41065
|
+
pc62.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
40908
41066
|
);
|
|
40909
41067
|
}
|
|
40910
|
-
const confirmed = await
|
|
41068
|
+
const confirmed = await clack59.confirm({
|
|
40911
41069
|
message: enableLinkTracking ? "Enable link click tracking?" : "Disable link click tracking?",
|
|
40912
41070
|
initialValue: enableLinkTracking
|
|
40913
41071
|
});
|
|
40914
|
-
if (
|
|
40915
|
-
|
|
41072
|
+
if (clack59.isCancel(confirmed) || !confirmed) {
|
|
41073
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40916
41074
|
process.exit(0);
|
|
40917
41075
|
}
|
|
40918
41076
|
updatedConfig = {
|
|
@@ -40929,7 +41087,7 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40929
41087
|
}
|
|
40930
41088
|
case "archiving": {
|
|
40931
41089
|
if (config2.messageArchiving?.enabled) {
|
|
40932
|
-
const archivingAction = await
|
|
41090
|
+
const archivingAction = await clack59.select({
|
|
40933
41091
|
message: "What would you like to do with message archiving?",
|
|
40934
41092
|
options: [
|
|
40935
41093
|
{
|
|
@@ -40944,17 +41102,17 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40944
41102
|
}
|
|
40945
41103
|
]
|
|
40946
41104
|
});
|
|
40947
|
-
if (
|
|
40948
|
-
|
|
41105
|
+
if (clack59.isCancel(archivingAction)) {
|
|
41106
|
+
clack59.cancel("Upgrade cancelled.");
|
|
40949
41107
|
process.exit(0);
|
|
40950
41108
|
}
|
|
40951
41109
|
if (archivingAction === "disable") {
|
|
40952
|
-
const confirmDisable = await
|
|
41110
|
+
const confirmDisable = await clack59.confirm({
|
|
40953
41111
|
message: "Are you sure? Existing archived messages will remain, but new messages won't be archived.",
|
|
40954
41112
|
initialValue: false
|
|
40955
41113
|
});
|
|
40956
|
-
if (
|
|
40957
|
-
|
|
41114
|
+
if (clack59.isCancel(confirmDisable) || !confirmDisable) {
|
|
41115
|
+
clack59.cancel("Archiving not disabled.");
|
|
40958
41116
|
process.exit(0);
|
|
40959
41117
|
}
|
|
40960
41118
|
updatedConfig = {
|
|
@@ -40965,7 +41123,7 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40965
41123
|
}
|
|
40966
41124
|
};
|
|
40967
41125
|
} else {
|
|
40968
|
-
const retention = await
|
|
41126
|
+
const retention = await clack59.select({
|
|
40969
41127
|
message: "Message archive retention period:",
|
|
40970
41128
|
options: [
|
|
40971
41129
|
{
|
|
@@ -40996,8 +41154,8 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
40996
41154
|
],
|
|
40997
41155
|
initialValue: config2.messageArchiving.retention
|
|
40998
41156
|
});
|
|
40999
|
-
if (
|
|
41000
|
-
|
|
41157
|
+
if (clack59.isCancel(retention)) {
|
|
41158
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41001
41159
|
process.exit(0);
|
|
41002
41160
|
}
|
|
41003
41161
|
updatedConfig = {
|
|
@@ -41009,19 +41167,19 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
41009
41167
|
};
|
|
41010
41168
|
}
|
|
41011
41169
|
} else {
|
|
41012
|
-
const enableArchiving = await
|
|
41170
|
+
const enableArchiving = await clack59.confirm({
|
|
41013
41171
|
message: "Enable message archiving? (Store full message content for viewing)",
|
|
41014
41172
|
initialValue: true
|
|
41015
41173
|
});
|
|
41016
|
-
if (
|
|
41017
|
-
|
|
41174
|
+
if (clack59.isCancel(enableArchiving)) {
|
|
41175
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41018
41176
|
process.exit(0);
|
|
41019
41177
|
}
|
|
41020
41178
|
if (!enableArchiving) {
|
|
41021
|
-
|
|
41179
|
+
clack59.log.info("Message archiving not enabled.");
|
|
41022
41180
|
process.exit(0);
|
|
41023
41181
|
}
|
|
41024
|
-
const retention = await
|
|
41182
|
+
const retention = await clack59.select({
|
|
41025
41183
|
message: "Message archive retention period:",
|
|
41026
41184
|
options: [
|
|
41027
41185
|
{ value: "7days", label: "7 days", hint: "~$1-2/mo for 10k msgs" },
|
|
@@ -41048,8 +41206,8 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
41048
41206
|
],
|
|
41049
41207
|
initialValue: "90days"
|
|
41050
41208
|
});
|
|
41051
|
-
if (
|
|
41052
|
-
|
|
41209
|
+
if (clack59.isCancel(retention)) {
|
|
41210
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41053
41211
|
process.exit(0);
|
|
41054
41212
|
}
|
|
41055
41213
|
updatedConfig = {
|
|
@@ -41081,7 +41239,7 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
41081
41239
|
const currentAllowed = config2.protectConfiguration?.allowedCountries || [
|
|
41082
41240
|
"US"
|
|
41083
41241
|
];
|
|
41084
|
-
const selectedCountries = await
|
|
41242
|
+
const selectedCountries = await clack59.multiselect({
|
|
41085
41243
|
message: "Select countries to allow SMS delivery (all others blocked):",
|
|
41086
41244
|
options: commonCountries.map((c) => ({
|
|
41087
41245
|
value: c.code,
|
|
@@ -41090,16 +41248,16 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
41090
41248
|
initialValues: currentAllowed,
|
|
41091
41249
|
required: true
|
|
41092
41250
|
});
|
|
41093
|
-
if (
|
|
41094
|
-
|
|
41251
|
+
if (clack59.isCancel(selectedCountries)) {
|
|
41252
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41095
41253
|
process.exit(0);
|
|
41096
41254
|
}
|
|
41097
|
-
const enableAIT = await
|
|
41255
|
+
const enableAIT = await clack59.confirm({
|
|
41098
41256
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
41099
41257
|
initialValue: config2.protectConfiguration?.aitFiltering ?? false
|
|
41100
41258
|
});
|
|
41101
|
-
if (
|
|
41102
|
-
|
|
41259
|
+
if (clack59.isCancel(enableAIT)) {
|
|
41260
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41103
41261
|
process.exit(0);
|
|
41104
41262
|
}
|
|
41105
41263
|
updatedConfig = {
|
|
@@ -41117,28 +41275,28 @@ ${pc61.yellow("\u26A0")} ${pc61.bold("10DLC Campaign Registration Required")}
|
|
|
41117
41275
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
41118
41276
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
41119
41277
|
console.log(`
|
|
41120
|
-
${
|
|
41278
|
+
${pc62.bold("Cost Impact:")}`);
|
|
41121
41279
|
console.log(
|
|
41122
|
-
` Current: ${
|
|
41280
|
+
` Current: ${pc62.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
41123
41281
|
);
|
|
41124
41282
|
console.log(
|
|
41125
|
-
` New: ${
|
|
41283
|
+
` New: ${pc62.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
41126
41284
|
);
|
|
41127
41285
|
if (costDiff > 0) {
|
|
41128
|
-
console.log(` Change: ${
|
|
41286
|
+
console.log(` Change: ${pc62.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
41129
41287
|
} else if (costDiff < 0) {
|
|
41130
41288
|
console.log(
|
|
41131
|
-
` Change: ${
|
|
41289
|
+
` Change: ${pc62.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
41132
41290
|
);
|
|
41133
41291
|
}
|
|
41134
41292
|
console.log("");
|
|
41135
41293
|
if (!(options.yes || options.preview)) {
|
|
41136
|
-
const confirmed = await
|
|
41294
|
+
const confirmed = await clack59.confirm({
|
|
41137
41295
|
message: "Proceed with upgrade?",
|
|
41138
41296
|
initialValue: true
|
|
41139
41297
|
});
|
|
41140
|
-
if (
|
|
41141
|
-
|
|
41298
|
+
if (clack59.isCancel(confirmed) || !confirmed) {
|
|
41299
|
+
clack59.cancel("Upgrade cancelled.");
|
|
41142
41300
|
process.exit(0);
|
|
41143
41301
|
}
|
|
41144
41302
|
}
|
|
@@ -41207,8 +41365,8 @@ ${pc61.bold("Cost Impact:")}`);
|
|
|
41207
41365
|
resourceChanges: previewResult.resourceChanges,
|
|
41208
41366
|
commandName: "wraps sms upgrade"
|
|
41209
41367
|
});
|
|
41210
|
-
|
|
41211
|
-
|
|
41368
|
+
clack59.outro(
|
|
41369
|
+
pc62.green("Preview complete. Run without --preview to upgrade.")
|
|
41212
41370
|
);
|
|
41213
41371
|
trackServiceUpgrade("sms", {
|
|
41214
41372
|
region,
|
|
@@ -41313,43 +41471,43 @@ ${pc61.bold("Cost Impact:")}`);
|
|
|
41313
41471
|
}
|
|
41314
41472
|
progress.info("Connection metadata updated");
|
|
41315
41473
|
console.log("\n");
|
|
41316
|
-
|
|
41474
|
+
clack59.log.success(pc62.green(pc62.bold("SMS infrastructure upgraded!")));
|
|
41317
41475
|
console.log("\n");
|
|
41318
|
-
|
|
41476
|
+
clack59.note(
|
|
41319
41477
|
[
|
|
41320
|
-
`${
|
|
41321
|
-
`${
|
|
41322
|
-
`${
|
|
41323
|
-
`${
|
|
41324
|
-
outputs.tableName ? `${
|
|
41478
|
+
`${pc62.bold("Phone Number:")} ${pc62.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
41479
|
+
`${pc62.bold("Phone Type:")} ${pc62.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
41480
|
+
`${pc62.bold("Config Set:")} ${pc62.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
41481
|
+
`${pc62.bold("Region:")} ${pc62.cyan(outputs.region)}`,
|
|
41482
|
+
outputs.tableName ? `${pc62.bold("History Table:")} ${pc62.cyan(outputs.tableName)}` : "",
|
|
41325
41483
|
"",
|
|
41326
|
-
|
|
41327
|
-
|
|
41484
|
+
pc62.dim("IAM Role:"),
|
|
41485
|
+
pc62.dim(` ${outputs.roleArn}`)
|
|
41328
41486
|
].filter(Boolean).join("\n"),
|
|
41329
41487
|
"SMS Infrastructure"
|
|
41330
41488
|
);
|
|
41331
41489
|
console.log(`
|
|
41332
|
-
${
|
|
41490
|
+
${pc62.green("\u2713")} ${pc62.bold("Upgrade complete!")}
|
|
41333
41491
|
`);
|
|
41334
41492
|
if (upgradeAction === "phone-number") {
|
|
41335
41493
|
console.log(
|
|
41336
|
-
`Upgraded to ${
|
|
41494
|
+
`Upgraded to ${pc62.cyan(updatedConfig.phoneNumberType)} number (${pc62.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
41337
41495
|
`
|
|
41338
41496
|
);
|
|
41339
41497
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
41340
|
-
console.log(`${
|
|
41498
|
+
console.log(`${pc62.bold("Next Steps:")}`);
|
|
41341
41499
|
console.log(
|
|
41342
|
-
` 1. Run ${
|
|
41500
|
+
` 1. Run ${pc62.cyan("wraps sms register")} to start toll-free registration`
|
|
41343
41501
|
);
|
|
41344
41502
|
console.log(" 2. Submit your business information and use case");
|
|
41345
41503
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
41346
41504
|
console.log("");
|
|
41347
41505
|
console.log(
|
|
41348
|
-
|
|
41506
|
+
pc62.dim("Until verified, your number can only send limited messages.")
|
|
41349
41507
|
);
|
|
41350
41508
|
console.log("");
|
|
41351
41509
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
41352
|
-
console.log(`${
|
|
41510
|
+
console.log(`${pc62.bold("Next Steps:")}`);
|
|
41353
41511
|
console.log(" 1. Register your brand in the AWS Console");
|
|
41354
41512
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
41355
41513
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -41357,16 +41515,16 @@ ${pc61.green("\u2713")} ${pc61.bold("Upgrade complete!")}
|
|
|
41357
41515
|
}
|
|
41358
41516
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
41359
41517
|
console.log(
|
|
41360
|
-
`Upgraded to ${
|
|
41518
|
+
`Upgraded to ${pc62.cyan(newPreset)} preset (${pc62.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
41361
41519
|
`
|
|
41362
41520
|
);
|
|
41363
41521
|
} else {
|
|
41364
41522
|
console.log(
|
|
41365
|
-
`Updated configuration (${
|
|
41523
|
+
`Updated configuration (${pc62.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
41366
41524
|
`
|
|
41367
41525
|
);
|
|
41368
41526
|
}
|
|
41369
|
-
console.log(
|
|
41527
|
+
console.log(pc62.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
41370
41528
|
const enabledFeatures = [];
|
|
41371
41529
|
if (updatedConfig.tracking?.enabled) {
|
|
41372
41530
|
enabledFeatures.push("tracking");
|
|
@@ -41390,7 +41548,7 @@ ${pc61.green("\u2713")} ${pc61.bold("Upgrade complete!")}
|
|
|
41390
41548
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
41391
41549
|
duration_ms: Date.now() - startTime
|
|
41392
41550
|
});
|
|
41393
|
-
|
|
41551
|
+
clack59.outro(pc62.green("Upgrade complete!"));
|
|
41394
41552
|
}
|
|
41395
41553
|
|
|
41396
41554
|
// src/commands/sms/verify-number.ts
|
|
@@ -41409,13 +41567,13 @@ import {
|
|
|
41409
41567
|
SendDestinationNumberVerificationCodeCommand,
|
|
41410
41568
|
VerifyDestinationNumberCommand
|
|
41411
41569
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
41412
|
-
import * as
|
|
41413
|
-
import
|
|
41570
|
+
import * as clack60 from "@clack/prompts";
|
|
41571
|
+
import pc63 from "picocolors";
|
|
41414
41572
|
async function smsVerifyNumber(options) {
|
|
41415
41573
|
const startTime = Date.now();
|
|
41416
41574
|
const progress = new DeploymentProgress();
|
|
41417
41575
|
if (!isJsonMode()) {
|
|
41418
|
-
|
|
41576
|
+
clack60.intro(pc63.bold("Wraps SMS - Verify Destination Number"));
|
|
41419
41577
|
}
|
|
41420
41578
|
const identity = await progress.execute(
|
|
41421
41579
|
"Validating AWS credentials",
|
|
@@ -41425,10 +41583,10 @@ async function smsVerifyNumber(options) {
|
|
|
41425
41583
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
41426
41584
|
if (!metadata?.services?.sms) {
|
|
41427
41585
|
progress.stop();
|
|
41428
|
-
|
|
41586
|
+
clack60.log.error("No SMS infrastructure found");
|
|
41429
41587
|
console.log(
|
|
41430
41588
|
`
|
|
41431
|
-
Run ${
|
|
41589
|
+
Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
41432
41590
|
`
|
|
41433
41591
|
);
|
|
41434
41592
|
process.exit(1);
|
|
@@ -41442,19 +41600,19 @@ Run ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
41442
41600
|
);
|
|
41443
41601
|
progress.stop();
|
|
41444
41602
|
if (!response.VerifiedDestinationNumbers || response.VerifiedDestinationNumbers.length === 0) {
|
|
41445
|
-
|
|
41603
|
+
clack60.log.info("No verified destination numbers found");
|
|
41446
41604
|
console.log(
|
|
41447
41605
|
`
|
|
41448
|
-
Run ${
|
|
41606
|
+
Run ${pc63.cyan("wraps sms verify-number")} to verify a number.
|
|
41449
41607
|
`
|
|
41450
41608
|
);
|
|
41451
41609
|
} else {
|
|
41452
41610
|
console.log("\n");
|
|
41453
|
-
|
|
41611
|
+
clack60.log.info(pc63.bold("Verified Destination Numbers:"));
|
|
41454
41612
|
console.log("");
|
|
41455
41613
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
41456
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
41457
|
-
console.log(` ${
|
|
41614
|
+
const status2 = num.Status === "VERIFIED" ? pc63.green("\u2713 Verified") : pc63.yellow("\u29D6 Pending");
|
|
41615
|
+
console.log(` ${pc63.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
41458
41616
|
}
|
|
41459
41617
|
console.log("");
|
|
41460
41618
|
}
|
|
@@ -41472,7 +41630,7 @@ Run ${pc62.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41472
41630
|
});
|
|
41473
41631
|
return;
|
|
41474
41632
|
}
|
|
41475
|
-
|
|
41633
|
+
clack60.outro(pc63.green("Done!"));
|
|
41476
41634
|
return;
|
|
41477
41635
|
} catch (error) {
|
|
41478
41636
|
progress.stop();
|
|
@@ -41480,7 +41638,7 @@ Run ${pc62.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41480
41638
|
trackError("SMS_LIST_VERIFIED_FAILED", "sms:verify-number:list", {
|
|
41481
41639
|
error: errorMessage
|
|
41482
41640
|
});
|
|
41483
|
-
|
|
41641
|
+
clack60.log.error(`Failed to list verified numbers: ${errorMessage}`);
|
|
41484
41642
|
process.exit(1);
|
|
41485
41643
|
}
|
|
41486
41644
|
}
|
|
@@ -41488,10 +41646,10 @@ Run ${pc62.cyan("wraps sms verify-number")} to verify a number.
|
|
|
41488
41646
|
const phoneNumber2 = options.phoneNumber;
|
|
41489
41647
|
if (!phoneNumber2) {
|
|
41490
41648
|
progress.stop();
|
|
41491
|
-
|
|
41649
|
+
clack60.log.error("Phone number is required for deletion");
|
|
41492
41650
|
console.log(
|
|
41493
41651
|
`
|
|
41494
|
-
Usage: ${
|
|
41652
|
+
Usage: ${pc63.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
41495
41653
|
`
|
|
41496
41654
|
);
|
|
41497
41655
|
process.exit(1);
|
|
@@ -41505,7 +41663,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41505
41663
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41506
41664
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41507
41665
|
progress.stop();
|
|
41508
|
-
|
|
41666
|
+
clack60.log.error(`Number ${phoneNumber2} is not in verified list`);
|
|
41509
41667
|
process.exit(1);
|
|
41510
41668
|
}
|
|
41511
41669
|
await progress.execute(`Removing ${phoneNumber2}`, async () => {
|
|
@@ -41516,7 +41674,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41516
41674
|
);
|
|
41517
41675
|
});
|
|
41518
41676
|
progress.stop();
|
|
41519
|
-
|
|
41677
|
+
clack60.log.success(`Removed ${pc63.cyan(phoneNumber2)} from verified list`);
|
|
41520
41678
|
trackCommand("sms:verify-number:delete", {
|
|
41521
41679
|
success: true,
|
|
41522
41680
|
duration_ms: Date.now() - startTime
|
|
@@ -41528,7 +41686,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41528
41686
|
});
|
|
41529
41687
|
return;
|
|
41530
41688
|
}
|
|
41531
|
-
|
|
41689
|
+
clack60.outro(pc63.green("Done!"));
|
|
41532
41690
|
return;
|
|
41533
41691
|
} catch (error) {
|
|
41534
41692
|
progress.stop();
|
|
@@ -41536,7 +41694,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41536
41694
|
trackError("SMS_DELETE_VERIFIED_FAILED", "sms:verify-number:delete", {
|
|
41537
41695
|
error: errorMessage
|
|
41538
41696
|
});
|
|
41539
|
-
|
|
41697
|
+
clack60.log.error(`Failed to delete verified number: ${errorMessage}`);
|
|
41540
41698
|
process.exit(1);
|
|
41541
41699
|
}
|
|
41542
41700
|
}
|
|
@@ -41549,7 +41707,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41549
41707
|
);
|
|
41550
41708
|
}
|
|
41551
41709
|
if (!phoneNumber) {
|
|
41552
|
-
const result = await
|
|
41710
|
+
const result = await clack60.text({
|
|
41553
41711
|
message: "Enter phone number to verify (E.164 format):",
|
|
41554
41712
|
placeholder: "+14155551234",
|
|
41555
41713
|
validate: (value) => {
|
|
@@ -41562,14 +41720,14 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41562
41720
|
return;
|
|
41563
41721
|
}
|
|
41564
41722
|
});
|
|
41565
|
-
if (
|
|
41566
|
-
|
|
41723
|
+
if (clack60.isCancel(result)) {
|
|
41724
|
+
clack60.cancel("Operation cancelled.");
|
|
41567
41725
|
process.exit(0);
|
|
41568
41726
|
}
|
|
41569
41727
|
phoneNumber = result;
|
|
41570
41728
|
} else if (!isValidPhoneNumber(phoneNumber)) {
|
|
41571
41729
|
progress.stop();
|
|
41572
|
-
|
|
41730
|
+
clack60.log.error(
|
|
41573
41731
|
`Invalid phone number format: ${phoneNumber}. Use E.164 format (e.g., +14155551234)`
|
|
41574
41732
|
);
|
|
41575
41733
|
process.exit(1);
|
|
@@ -41584,7 +41742,7 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41584
41742
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41585
41743
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41586
41744
|
progress.stop();
|
|
41587
|
-
|
|
41745
|
+
clack60.log.error(
|
|
41588
41746
|
`Number ${phoneNumber} not found. Run without --code first.`
|
|
41589
41747
|
);
|
|
41590
41748
|
process.exit(1);
|
|
@@ -41599,12 +41757,12 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41599
41757
|
});
|
|
41600
41758
|
progress.stop();
|
|
41601
41759
|
console.log("\n");
|
|
41602
|
-
|
|
41603
|
-
|
|
41760
|
+
clack60.log.success(
|
|
41761
|
+
pc63.green(`Phone number ${pc63.cyan(phoneNumber)} verified!`)
|
|
41604
41762
|
);
|
|
41605
41763
|
console.log("");
|
|
41606
41764
|
console.log(
|
|
41607
|
-
`You can now send test messages to this number with ${
|
|
41765
|
+
`You can now send test messages to this number with ${pc63.cyan("wraps sms test")}`
|
|
41608
41766
|
);
|
|
41609
41767
|
trackCommand("sms:verify-number:confirm", {
|
|
41610
41768
|
success: true,
|
|
@@ -41617,23 +41775,23 @@ Usage: ${pc62.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
41617
41775
|
});
|
|
41618
41776
|
return;
|
|
41619
41777
|
}
|
|
41620
|
-
|
|
41778
|
+
clack60.outro(pc63.green("Verification complete!"));
|
|
41621
41779
|
return;
|
|
41622
41780
|
} catch (error) {
|
|
41623
41781
|
progress.stop();
|
|
41624
41782
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
41625
41783
|
if (errorMessage.includes("Invalid verification code")) {
|
|
41626
|
-
|
|
41784
|
+
clack60.log.error("Invalid verification code. Please try again.");
|
|
41627
41785
|
console.log(
|
|
41628
41786
|
`
|
|
41629
|
-
Run ${
|
|
41787
|
+
Run ${pc63.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
41630
41788
|
`
|
|
41631
41789
|
);
|
|
41632
41790
|
} else {
|
|
41633
41791
|
trackError("SMS_VERIFY_CODE_FAILED", "sms:verify-number:confirm", {
|
|
41634
41792
|
error: errorMessage
|
|
41635
41793
|
});
|
|
41636
|
-
|
|
41794
|
+
clack60.log.error(`Verification failed: ${errorMessage}`);
|
|
41637
41795
|
}
|
|
41638
41796
|
process.exit(1);
|
|
41639
41797
|
}
|
|
@@ -41648,7 +41806,7 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41648
41806
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
41649
41807
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
41650
41808
|
progress.stop();
|
|
41651
|
-
|
|
41809
|
+
clack60.log.error(
|
|
41652
41810
|
`Number ${phoneNumber} not found. Run without --resend first.`
|
|
41653
41811
|
);
|
|
41654
41812
|
process.exit(1);
|
|
@@ -41662,11 +41820,11 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41662
41820
|
);
|
|
41663
41821
|
});
|
|
41664
41822
|
progress.stop();
|
|
41665
|
-
|
|
41823
|
+
clack60.log.success(`Verification code resent to ${pc63.cyan(phoneNumber)}`);
|
|
41666
41824
|
console.log("");
|
|
41667
41825
|
console.log(
|
|
41668
41826
|
`Once you receive the code, run:
|
|
41669
|
-
${
|
|
41827
|
+
${pc63.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
41670
41828
|
);
|
|
41671
41829
|
trackCommand("sms:verify-number:resend", {
|
|
41672
41830
|
success: true,
|
|
@@ -41679,7 +41837,7 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41679
41837
|
});
|
|
41680
41838
|
return;
|
|
41681
41839
|
}
|
|
41682
|
-
|
|
41840
|
+
clack60.outro(pc63.green("Code sent!"));
|
|
41683
41841
|
return;
|
|
41684
41842
|
} catch (error) {
|
|
41685
41843
|
progress.stop();
|
|
@@ -41687,7 +41845,7 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41687
41845
|
trackError("SMS_RESEND_CODE_FAILED", "sms:verify-number:resend", {
|
|
41688
41846
|
error: errorMessage
|
|
41689
41847
|
});
|
|
41690
|
-
|
|
41848
|
+
clack60.log.error(`Failed to resend code: ${errorMessage}`);
|
|
41691
41849
|
process.exit(1);
|
|
41692
41850
|
}
|
|
41693
41851
|
}
|
|
@@ -41707,10 +41865,10 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41707
41865
|
});
|
|
41708
41866
|
return;
|
|
41709
41867
|
}
|
|
41710
|
-
|
|
41711
|
-
`Number ${
|
|
41868
|
+
clack60.log.info(
|
|
41869
|
+
`Number ${pc63.cyan(phoneNumber)} is already verified and ready to use!`
|
|
41712
41870
|
);
|
|
41713
|
-
|
|
41871
|
+
clack60.outro(pc63.green("Done!"));
|
|
41714
41872
|
return;
|
|
41715
41873
|
}
|
|
41716
41874
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -41734,15 +41892,15 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41734
41892
|
});
|
|
41735
41893
|
return;
|
|
41736
41894
|
}
|
|
41737
|
-
|
|
41738
|
-
`Verification already in progress. New code sent to ${
|
|
41895
|
+
clack60.log.info(
|
|
41896
|
+
`Verification already in progress. New code sent to ${pc63.cyan(phoneNumber)}`
|
|
41739
41897
|
);
|
|
41740
41898
|
console.log("");
|
|
41741
41899
|
console.log(
|
|
41742
41900
|
`Once you receive the code, run:
|
|
41743
|
-
${
|
|
41901
|
+
${pc63.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
41744
41902
|
);
|
|
41745
|
-
|
|
41903
|
+
clack60.outro(pc63.green("Code sent!"));
|
|
41746
41904
|
return;
|
|
41747
41905
|
}
|
|
41748
41906
|
const createResponse = await progress.execute(
|
|
@@ -41763,18 +41921,18 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41763
41921
|
});
|
|
41764
41922
|
progress.stop();
|
|
41765
41923
|
console.log("\n");
|
|
41766
|
-
|
|
41767
|
-
`Verification code sent to ${
|
|
41924
|
+
clack60.log.success(
|
|
41925
|
+
`Verification code sent to ${pc63.cyan(phoneNumber)} via SMS`
|
|
41768
41926
|
);
|
|
41769
41927
|
console.log("");
|
|
41770
|
-
|
|
41928
|
+
clack60.note(
|
|
41771
41929
|
[
|
|
41772
41930
|
"1. Check your phone for the verification code",
|
|
41773
41931
|
"",
|
|
41774
41932
|
"2. Complete verification with:",
|
|
41775
|
-
` ${
|
|
41933
|
+
` ${pc63.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
41776
41934
|
"",
|
|
41777
|
-
|
|
41935
|
+
pc63.dim("The code expires in 24 hours")
|
|
41778
41936
|
].join("\n"),
|
|
41779
41937
|
"Next Steps"
|
|
41780
41938
|
);
|
|
@@ -41790,22 +41948,22 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41790
41948
|
});
|
|
41791
41949
|
return;
|
|
41792
41950
|
}
|
|
41793
|
-
|
|
41951
|
+
clack60.outro(pc63.green("Verification started!"));
|
|
41794
41952
|
} catch (error) {
|
|
41795
41953
|
progress.stop();
|
|
41796
41954
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
41797
41955
|
if (errorMessage.includes("already exists")) {
|
|
41798
|
-
|
|
41956
|
+
clack60.log.error("This number is already being verified");
|
|
41799
41957
|
console.log(
|
|
41800
41958
|
`
|
|
41801
|
-
Run ${
|
|
41959
|
+
Run ${pc63.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
41802
41960
|
`
|
|
41803
41961
|
);
|
|
41804
41962
|
} else {
|
|
41805
41963
|
trackError("SMS_CREATE_VERIFIED_FAILED", "sms:verify-number:start", {
|
|
41806
41964
|
error: errorMessage
|
|
41807
41965
|
});
|
|
41808
|
-
|
|
41966
|
+
clack60.log.error(`Failed to start verification: ${errorMessage}`);
|
|
41809
41967
|
}
|
|
41810
41968
|
process.exit(1);
|
|
41811
41969
|
}
|
|
@@ -41814,88 +41972,88 @@ Run ${pc62.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
41814
41972
|
// src/commands/support.ts
|
|
41815
41973
|
init_esm_shims();
|
|
41816
41974
|
init_events();
|
|
41817
|
-
import * as
|
|
41818
|
-
import
|
|
41975
|
+
import * as clack61 from "@clack/prompts";
|
|
41976
|
+
import pc64 from "picocolors";
|
|
41819
41977
|
async function support() {
|
|
41820
41978
|
trackCommand("support", { success: true });
|
|
41821
|
-
|
|
41979
|
+
clack61.intro(pc64.bold("Get Help with Wraps"));
|
|
41822
41980
|
console.log();
|
|
41823
|
-
console.log(` ${
|
|
41981
|
+
console.log(` ${pc64.bold("Email:")} ${pc64.cyan("hey@wraps.sh")}`);
|
|
41824
41982
|
console.log(
|
|
41825
|
-
` ${
|
|
41983
|
+
` ${pc64.bold("GitHub:")} ${pc64.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
41826
41984
|
);
|
|
41827
|
-
console.log(` ${
|
|
41985
|
+
console.log(` ${pc64.bold("Docs:")} ${pc64.cyan("https://wraps.dev/docs")}`);
|
|
41828
41986
|
console.log();
|
|
41829
|
-
console.log(
|
|
41987
|
+
console.log(pc64.dim(" Response time: Usually within 24 hours"));
|
|
41830
41988
|
console.log();
|
|
41831
41989
|
}
|
|
41832
41990
|
|
|
41833
41991
|
// src/commands/telemetry.ts
|
|
41834
41992
|
init_esm_shims();
|
|
41835
41993
|
init_client();
|
|
41836
|
-
import * as
|
|
41837
|
-
import
|
|
41994
|
+
import * as clack62 from "@clack/prompts";
|
|
41995
|
+
import pc65 from "picocolors";
|
|
41838
41996
|
async function telemetryEnable() {
|
|
41839
41997
|
const client = getTelemetryClient();
|
|
41840
41998
|
const override = client.enable();
|
|
41841
41999
|
if (override) {
|
|
41842
|
-
|
|
42000
|
+
clack62.log.warn(
|
|
41843
42001
|
"Telemetry enabled in config, but overridden by environment"
|
|
41844
42002
|
);
|
|
41845
|
-
console.log(` Reason: ${
|
|
41846
|
-
console.log(` Config: ${
|
|
42003
|
+
console.log(` Reason: ${pc65.yellow(override)}`);
|
|
42004
|
+
console.log(` Config: ${pc65.dim(client.getConfigPath())}`);
|
|
41847
42005
|
console.log();
|
|
41848
42006
|
} else {
|
|
41849
|
-
|
|
41850
|
-
console.log(` Config: ${
|
|
42007
|
+
clack62.log.success(pc65.green("Telemetry enabled"));
|
|
42008
|
+
console.log(` Config: ${pc65.dim(client.getConfigPath())}`);
|
|
41851
42009
|
console.log(`
|
|
41852
|
-
${
|
|
42010
|
+
${pc65.dim("Thank you for helping improve Wraps!")}
|
|
41853
42011
|
`);
|
|
41854
42012
|
}
|
|
41855
42013
|
}
|
|
41856
42014
|
async function telemetryDisable() {
|
|
41857
42015
|
const client = getTelemetryClient();
|
|
41858
42016
|
client.disable();
|
|
41859
|
-
|
|
41860
|
-
console.log(` Config: ${
|
|
42017
|
+
clack62.log.success(pc65.green("Telemetry disabled"));
|
|
42018
|
+
console.log(` Config: ${pc65.dim(client.getConfigPath())}`);
|
|
41861
42019
|
console.log(
|
|
41862
42020
|
`
|
|
41863
|
-
${
|
|
42021
|
+
${pc65.dim("You can re-enable with:")} wraps telemetry enable
|
|
41864
42022
|
`
|
|
41865
42023
|
);
|
|
41866
42024
|
}
|
|
41867
42025
|
async function telemetryStatus() {
|
|
41868
42026
|
const client = getTelemetryClient();
|
|
41869
|
-
|
|
42027
|
+
clack62.intro(pc65.bold("Telemetry Status"));
|
|
41870
42028
|
const override = client.getEnvOverride();
|
|
41871
|
-
const status2 = client.isEnabled() ?
|
|
42029
|
+
const status2 = client.isEnabled() ? pc65.green("Enabled") : pc65.red("Disabled");
|
|
41872
42030
|
console.log();
|
|
41873
|
-
console.log(` ${
|
|
42031
|
+
console.log(` ${pc65.bold("Status:")} ${status2}`);
|
|
41874
42032
|
if (!client.isEnabled() && override) {
|
|
41875
|
-
console.log(` ${
|
|
42033
|
+
console.log(` ${pc65.bold("Reason:")} ${pc65.yellow(override)}`);
|
|
41876
42034
|
}
|
|
41877
|
-
console.log(` ${
|
|
42035
|
+
console.log(` ${pc65.bold("Config file:")} ${pc65.dim(client.getConfigPath())}`);
|
|
41878
42036
|
if (client.isEnabled()) {
|
|
41879
42037
|
console.log();
|
|
41880
|
-
console.log(
|
|
41881
|
-
console.log(` ${
|
|
42038
|
+
console.log(pc65.bold(" How to opt-out:"));
|
|
42039
|
+
console.log(` ${pc65.cyan("wraps telemetry disable")}`);
|
|
41882
42040
|
console.log(
|
|
41883
|
-
` ${
|
|
42041
|
+
` ${pc65.dim("Or set:")} ${pc65.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
41884
42042
|
);
|
|
41885
|
-
console.log(` ${
|
|
42043
|
+
console.log(` ${pc65.dim("Or set:")} ${pc65.cyan("DO_NOT_TRACK=1")}`);
|
|
41886
42044
|
} else {
|
|
41887
42045
|
console.log();
|
|
41888
|
-
console.log(
|
|
41889
|
-
console.log(` ${
|
|
42046
|
+
console.log(pc65.bold(" How to opt-in:"));
|
|
42047
|
+
console.log(` ${pc65.cyan("wraps telemetry enable")}`);
|
|
41890
42048
|
}
|
|
41891
42049
|
console.log();
|
|
41892
|
-
console.log(
|
|
42050
|
+
console.log(pc65.bold(" Debug mode:"));
|
|
41893
42051
|
console.log(
|
|
41894
|
-
` ${
|
|
42052
|
+
` ${pc65.dim("See what would be sent:")} ${pc65.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
41895
42053
|
);
|
|
41896
42054
|
console.log();
|
|
41897
42055
|
console.log(
|
|
41898
|
-
` ${
|
|
42056
|
+
` ${pc65.dim("Learn more:")} ${pc65.cyan("https://wraps.dev/docs/telemetry")}`
|
|
41899
42057
|
);
|
|
41900
42058
|
console.log();
|
|
41901
42059
|
}
|
|
@@ -41904,8 +42062,8 @@ async function telemetryStatus() {
|
|
|
41904
42062
|
init_esm_shims();
|
|
41905
42063
|
import { existsSync as existsSync20, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
41906
42064
|
import { join as join22 } from "path";
|
|
41907
|
-
import * as
|
|
41908
|
-
import
|
|
42065
|
+
import * as clack63 from "@clack/prompts";
|
|
42066
|
+
import pc66 from "picocolors";
|
|
41909
42067
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
41910
42068
|
defineWorkflow,
|
|
41911
42069
|
sendEmail,
|
|
@@ -42000,30 +42158,30 @@ export default defineConfig({
|
|
|
42000
42158
|
});
|
|
42001
42159
|
`;
|
|
42002
42160
|
async function workflowInit(options = {}) {
|
|
42003
|
-
|
|
42161
|
+
clack63.intro(pc66.bgCyan(pc66.black(" wraps workflow init ")));
|
|
42004
42162
|
const wrapsDir = join22(process.cwd(), "wraps");
|
|
42005
42163
|
const workflowsDir = join22(wrapsDir, "workflows");
|
|
42006
42164
|
const configPath = join22(wrapsDir, "wraps.config.ts");
|
|
42007
42165
|
if (existsSync20(workflowsDir)) {
|
|
42008
|
-
|
|
42009
|
-
`Workflows directory already exists at ${
|
|
42166
|
+
clack63.log.info(
|
|
42167
|
+
`Workflows directory already exists at ${pc66.cyan("wraps/workflows/")}`
|
|
42010
42168
|
);
|
|
42011
42169
|
const files = existsSync20(join22(workflowsDir, "cart-recovery.ts")) || existsSync20(join22(workflowsDir, "welcome-sequence.ts"));
|
|
42012
42170
|
if (files && !options.yes) {
|
|
42013
|
-
const shouldContinue = await
|
|
42171
|
+
const shouldContinue = await clack63.confirm({
|
|
42014
42172
|
message: "Example files may already exist. Overwrite them?",
|
|
42015
42173
|
initialValue: false
|
|
42016
42174
|
});
|
|
42017
|
-
if (
|
|
42018
|
-
|
|
42175
|
+
if (clack63.isCancel(shouldContinue) || !shouldContinue) {
|
|
42176
|
+
clack63.log.info("Skipping file creation.");
|
|
42019
42177
|
showNextSteps2();
|
|
42020
|
-
|
|
42178
|
+
clack63.outro("Done!");
|
|
42021
42179
|
return;
|
|
42022
42180
|
}
|
|
42023
42181
|
}
|
|
42024
42182
|
}
|
|
42025
42183
|
try {
|
|
42026
|
-
const s =
|
|
42184
|
+
const s = clack63.spinner();
|
|
42027
42185
|
s.start("Creating workflows directory...");
|
|
42028
42186
|
mkdirSync2(workflowsDir, { recursive: true });
|
|
42029
42187
|
s.stop("Created wraps/workflows/");
|
|
@@ -42041,34 +42199,34 @@ async function workflowInit(options = {}) {
|
|
|
42041
42199
|
s.stop("Created 2 example workflows");
|
|
42042
42200
|
if (!existsSync20(configPath)) {
|
|
42043
42201
|
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
42044
|
-
|
|
42202
|
+
clack63.log.info(`Created ${pc66.cyan("wraps/wraps.config.ts")}`);
|
|
42045
42203
|
}
|
|
42046
|
-
|
|
42047
|
-
`${
|
|
42048
|
-
${
|
|
42049
|
-
${
|
|
42050
|
-
${
|
|
42204
|
+
clack63.log.success(
|
|
42205
|
+
`${pc66.bold("Workflows scaffolded!")} Created:
|
|
42206
|
+
${pc66.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
42207
|
+
${pc66.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
42208
|
+
${pc66.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
42051
42209
|
);
|
|
42052
42210
|
showNextSteps2();
|
|
42053
|
-
|
|
42211
|
+
clack63.outro(pc66.green("Happy orchestrating!"));
|
|
42054
42212
|
} catch (error) {
|
|
42055
|
-
|
|
42213
|
+
clack63.log.error(
|
|
42056
42214
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
42057
42215
|
);
|
|
42058
|
-
|
|
42216
|
+
clack63.outro(pc66.red("Scaffolding failed."));
|
|
42059
42217
|
process.exitCode = 1;
|
|
42060
42218
|
}
|
|
42061
42219
|
}
|
|
42062
42220
|
function showNextSteps2() {
|
|
42063
|
-
|
|
42064
|
-
`${
|
|
42221
|
+
clack63.log.info(
|
|
42222
|
+
`${pc66.bold("Next steps:")}
|
|
42065
42223
|
|
|
42066
|
-
1. Edit ${
|
|
42067
|
-
2. Edit your workflows in ${
|
|
42068
|
-
3. Validate: ${
|
|
42069
|
-
4. Push: ${
|
|
42224
|
+
1. Edit ${pc66.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
42225
|
+
2. Edit your workflows in ${pc66.cyan("wraps/workflows/")}
|
|
42226
|
+
3. Validate: ${pc66.cyan("wraps email workflows validate")}
|
|
42227
|
+
4. Push: ${pc66.cyan("wraps email workflows push")}
|
|
42070
42228
|
|
|
42071
|
-
${
|
|
42229
|
+
${pc66.dim("Docs:")} ${pc66.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
42072
42230
|
);
|
|
42073
42231
|
}
|
|
42074
42232
|
|
|
@@ -42266,214 +42424,217 @@ function showVersion() {
|
|
|
42266
42424
|
process.exit(0);
|
|
42267
42425
|
}
|
|
42268
42426
|
function showHelp() {
|
|
42269
|
-
|
|
42427
|
+
clack64.intro(pc68.bold(`WRAPS CLI v${VERSION}`));
|
|
42270
42428
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
42271
42429
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
42272
42430
|
console.log("Services:");
|
|
42273
|
-
console.log(` ${
|
|
42431
|
+
console.log(` ${pc68.cyan("email")} Email infrastructure (AWS SES)`);
|
|
42274
42432
|
console.log(
|
|
42275
|
-
` ${
|
|
42433
|
+
` ${pc68.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
42276
42434
|
);
|
|
42277
42435
|
console.log(
|
|
42278
|
-
` ${
|
|
42436
|
+
` ${pc68.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)`
|
|
42279
42437
|
);
|
|
42280
42438
|
console.log(
|
|
42281
|
-
` ${
|
|
42439
|
+
` ${pc68.cyan("selfhost")} Self-hosted Wraps control plane (enterprise)`
|
|
42282
42440
|
);
|
|
42283
42441
|
console.log(
|
|
42284
|
-
` ${
|
|
42442
|
+
` ${pc68.cyan("license")} License key management (Wraps team only)
|
|
42285
42443
|
`
|
|
42286
42444
|
);
|
|
42287
42445
|
console.log("Email Commands:");
|
|
42288
42446
|
console.log(
|
|
42289
|
-
` ${
|
|
42447
|
+
` ${pc68.cyan("email init")} Deploy new email infrastructure`
|
|
42290
42448
|
);
|
|
42291
42449
|
console.log(
|
|
42292
|
-
` ${
|
|
42450
|
+
` ${pc68.cyan("email check")} Check email deliverability for a domain`
|
|
42293
42451
|
);
|
|
42294
42452
|
console.log(
|
|
42295
|
-
` ${
|
|
42453
|
+
` ${pc68.cyan("email connect")} Connect to existing AWS SES`
|
|
42296
42454
|
);
|
|
42297
42455
|
console.log(
|
|
42298
|
-
` ${
|
|
42456
|
+
` ${pc68.cyan("email status")} Show email infrastructure details`
|
|
42299
42457
|
);
|
|
42300
|
-
console.log(` ${
|
|
42301
|
-
console.log(` ${
|
|
42458
|
+
console.log(` ${pc68.cyan("email test")} Send a test email`);
|
|
42459
|
+
console.log(` ${pc68.cyan("email verify")} Verify domain DNS records`);
|
|
42302
42460
|
console.log(
|
|
42303
|
-
` ${
|
|
42461
|
+
` ${pc68.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
42304
42462
|
);
|
|
42305
|
-
console.log(` ${
|
|
42463
|
+
console.log(` ${pc68.cyan("email upgrade")} Add features`);
|
|
42306
42464
|
console.log(
|
|
42307
|
-
` ${
|
|
42465
|
+
` ${pc68.cyan("email restore")} Restore original configuration`
|
|
42308
42466
|
);
|
|
42309
42467
|
console.log(
|
|
42310
|
-
` ${
|
|
42468
|
+
` ${pc68.cyan("email destroy")} Remove email infrastructure`
|
|
42311
42469
|
);
|
|
42312
42470
|
console.log(
|
|
42313
|
-
` ${
|
|
42471
|
+
` ${pc68.cyan("email doctor")} Diagnose and clean up email infrastructure`
|
|
42314
42472
|
);
|
|
42315
|
-
console.log(` ${
|
|
42316
|
-
console.log(` ${
|
|
42317
|
-
console.log(` ${
|
|
42473
|
+
console.log(` ${pc68.cyan("email domains add")} Add a domain to SES`);
|
|
42474
|
+
console.log(` ${pc68.cyan("email domains list")} List all domains`);
|
|
42475
|
+
console.log(` ${pc68.cyan("email domains remove")} Remove a domain`);
|
|
42318
42476
|
console.log(
|
|
42319
|
-
` ${
|
|
42477
|
+
` ${pc68.cyan("email inbound init")} Enable inbound email receiving`
|
|
42320
42478
|
);
|
|
42321
|
-
console.log(` ${
|
|
42479
|
+
console.log(` ${pc68.cyan("email inbound status")} Show inbound email status`);
|
|
42322
42480
|
console.log(
|
|
42323
|
-
` ${
|
|
42481
|
+
` ${pc68.cyan("email inbound verify")} Verify inbound DNS records`
|
|
42324
42482
|
);
|
|
42325
42483
|
console.log(
|
|
42326
|
-
` ${
|
|
42484
|
+
` ${pc68.cyan("email inbound test")} Send test email and verify receipt`
|
|
42327
42485
|
);
|
|
42328
42486
|
console.log(
|
|
42329
|
-
` ${
|
|
42487
|
+
` ${pc68.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
42330
42488
|
`
|
|
42331
42489
|
);
|
|
42332
42490
|
console.log("Template Commands:");
|
|
42333
42491
|
console.log(
|
|
42334
|
-
` ${
|
|
42492
|
+
` ${pc68.cyan("email templates init")} Initialize templates-as-code`
|
|
42335
42493
|
);
|
|
42336
42494
|
console.log(
|
|
42337
|
-
` ${
|
|
42495
|
+
` ${pc68.cyan("email templates push")} Push templates to SES + dashboard`
|
|
42338
42496
|
);
|
|
42339
42497
|
console.log(
|
|
42340
|
-
` ${
|
|
42498
|
+
` ${pc68.cyan("email templates preview")} Preview templates in browser`
|
|
42341
42499
|
);
|
|
42342
42500
|
console.log(
|
|
42343
|
-
` ${
|
|
42501
|
+
` ${pc68.cyan("push")} ${pc68.dim("(alias for email templates push)")}
|
|
42344
42502
|
`
|
|
42345
42503
|
);
|
|
42346
42504
|
console.log("Workflow Commands:");
|
|
42347
42505
|
console.log(
|
|
42348
|
-
` ${
|
|
42506
|
+
` ${pc68.cyan("email workflows init")} Initialize workflows-as-code`
|
|
42349
42507
|
);
|
|
42350
42508
|
console.log(
|
|
42351
|
-
` ${
|
|
42509
|
+
` ${pc68.cyan("email workflows validate")} Validate workflow files`
|
|
42352
42510
|
);
|
|
42353
42511
|
console.log(
|
|
42354
|
-
` ${
|
|
42512
|
+
` ${pc68.cyan("email workflows push")} Push workflows to dashboard
|
|
42355
42513
|
`
|
|
42356
42514
|
);
|
|
42357
42515
|
console.log("SMS Commands:");
|
|
42358
|
-
console.log(` ${
|
|
42516
|
+
console.log(` ${pc68.cyan("sms init")} Deploy SMS infrastructure`);
|
|
42359
42517
|
console.log(
|
|
42360
|
-
` ${
|
|
42518
|
+
` ${pc68.cyan("sms status")} Show SMS infrastructure details`
|
|
42361
42519
|
);
|
|
42362
|
-
console.log(` ${
|
|
42520
|
+
console.log(` ${pc68.cyan("sms test")} Send a test SMS message`);
|
|
42363
42521
|
console.log(
|
|
42364
|
-
` ${
|
|
42522
|
+
` ${pc68.cyan("sms verify-number")} Verify a destination phone number`
|
|
42365
42523
|
);
|
|
42366
42524
|
console.log(
|
|
42367
|
-
` ${
|
|
42525
|
+
` ${pc68.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
42368
42526
|
);
|
|
42369
|
-
console.log(` ${
|
|
42370
|
-
console.log(` ${
|
|
42527
|
+
console.log(` ${pc68.cyan("sms upgrade")} Upgrade SMS features`);
|
|
42528
|
+
console.log(` ${pc68.cyan("sms register")} Register toll-free number`);
|
|
42371
42529
|
console.log(
|
|
42372
|
-
` ${
|
|
42530
|
+
` ${pc68.cyan("sms destroy")} Remove SMS infrastructure
|
|
42373
42531
|
`
|
|
42374
42532
|
);
|
|
42375
42533
|
console.log("CDN Commands:");
|
|
42376
42534
|
console.log(
|
|
42377
|
-
` ${
|
|
42535
|
+
` ${pc68.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
42378
42536
|
);
|
|
42379
42537
|
console.log(
|
|
42380
|
-
` ${
|
|
42538
|
+
` ${pc68.cyan("cdn status")} Show CDN infrastructure details`
|
|
42381
42539
|
);
|
|
42382
42540
|
console.log(
|
|
42383
|
-
` ${
|
|
42541
|
+
` ${pc68.cyan("cdn verify")} Check DNS and certificate status`
|
|
42384
42542
|
);
|
|
42385
42543
|
console.log(
|
|
42386
|
-
` ${
|
|
42544
|
+
` ${pc68.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
42387
42545
|
);
|
|
42388
42546
|
console.log(
|
|
42389
|
-
` ${
|
|
42547
|
+
` ${pc68.cyan("cdn sync")} Sync infrastructure with current config`
|
|
42390
42548
|
);
|
|
42391
42549
|
console.log(
|
|
42392
|
-
` ${
|
|
42550
|
+
` ${pc68.cyan("cdn destroy")} Remove CDN infrastructure
|
|
42393
42551
|
`
|
|
42394
42552
|
);
|
|
42395
42553
|
console.log("Self-Hosted Commands:");
|
|
42396
42554
|
console.log(
|
|
42397
|
-
` ${
|
|
42555
|
+
` ${pc68.cyan("selfhost deploy")} Deploy Wraps API to your AWS account`
|
|
42398
42556
|
);
|
|
42399
42557
|
console.log(
|
|
42400
|
-
` ${
|
|
42558
|
+
` ${pc68.cyan("selfhost login")} Sign in to your self-hosted Wraps instance`
|
|
42401
42559
|
);
|
|
42402
42560
|
console.log(
|
|
42403
|
-
` ${
|
|
42561
|
+
` ${pc68.cyan("selfhost logout")} Sign out of your self-hosted Wraps instance`
|
|
42404
42562
|
);
|
|
42405
42563
|
console.log(
|
|
42406
|
-
` ${
|
|
42564
|
+
` ${pc68.cyan("selfhost upgrade")} Rebuild and redeploy the self-hosted API`
|
|
42407
42565
|
);
|
|
42408
42566
|
console.log(
|
|
42409
|
-
` ${
|
|
42567
|
+
` ${pc68.cyan("selfhost status")} Show self-hosted deployment details`
|
|
42568
|
+
);
|
|
42569
|
+
console.log(
|
|
42570
|
+
` ${pc68.cyan("selfhost connect")} Connect your AWS account to your self-hosted instance
|
|
42410
42571
|
`
|
|
42411
42572
|
);
|
|
42412
42573
|
console.log("Local Development:");
|
|
42413
42574
|
console.log(
|
|
42414
|
-
` ${
|
|
42575
|
+
` ${pc68.cyan("console")} Start local web console
|
|
42415
42576
|
`
|
|
42416
42577
|
);
|
|
42417
42578
|
console.log("Platform:");
|
|
42418
42579
|
console.log(
|
|
42419
|
-
` ${
|
|
42580
|
+
` ${pc68.cyan("platform")} Show platform info and pricing`
|
|
42420
42581
|
);
|
|
42421
42582
|
console.log(
|
|
42422
|
-
` ${
|
|
42583
|
+
` ${pc68.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
42423
42584
|
);
|
|
42424
42585
|
console.log(
|
|
42425
|
-
` ${
|
|
42586
|
+
` ${pc68.cyan("platform update-role")} Update platform IAM permissions
|
|
42426
42587
|
`
|
|
42427
42588
|
);
|
|
42428
42589
|
console.log("Auth:");
|
|
42429
42590
|
console.log(
|
|
42430
|
-
` ${
|
|
42591
|
+
` ${pc68.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
42431
42592
|
);
|
|
42432
|
-
console.log(` ${
|
|
42593
|
+
console.log(` ${pc68.cyan("auth status")} Show current auth state`);
|
|
42433
42594
|
console.log(
|
|
42434
|
-
` ${
|
|
42595
|
+
` ${pc68.cyan("auth logout")} Sign out and remove stored token
|
|
42435
42596
|
`
|
|
42436
42597
|
);
|
|
42437
42598
|
console.log("AWS Setup:");
|
|
42438
42599
|
console.log(
|
|
42439
|
-
` ${
|
|
42600
|
+
` ${pc68.cyan("aws setup")} Interactive AWS setup wizard`
|
|
42440
42601
|
);
|
|
42441
42602
|
console.log(
|
|
42442
|
-
` ${
|
|
42603
|
+
` ${pc68.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
42443
42604
|
`
|
|
42444
42605
|
);
|
|
42445
42606
|
console.log("Global Commands:");
|
|
42446
|
-
console.log(` ${
|
|
42447
|
-
console.log(` ${
|
|
42448
|
-
console.log(` ${
|
|
42449
|
-
console.log(` ${
|
|
42607
|
+
console.log(` ${pc68.cyan("status")} Show overview of all services`);
|
|
42608
|
+
console.log(` ${pc68.cyan("destroy")} Remove deployed infrastructure`);
|
|
42609
|
+
console.log(` ${pc68.cyan("permissions")} Show required AWS IAM permissions`);
|
|
42610
|
+
console.log(` ${pc68.cyan("completion")} Generate shell completion script`);
|
|
42450
42611
|
console.log(
|
|
42451
|
-
` ${
|
|
42612
|
+
` ${pc68.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
42452
42613
|
);
|
|
42453
|
-
console.log(` ${
|
|
42454
|
-
console.log(` ${
|
|
42614
|
+
console.log(` ${pc68.cyan("update")} Update CLI to latest version`);
|
|
42615
|
+
console.log(` ${pc68.cyan("news")} Show recent Wraps updates`);
|
|
42455
42616
|
console.log(
|
|
42456
|
-
` ${
|
|
42617
|
+
` ${pc68.cyan("support")} Get help and support contact info
|
|
42457
42618
|
`
|
|
42458
42619
|
);
|
|
42459
42620
|
console.log("Options:");
|
|
42460
42621
|
console.log(
|
|
42461
|
-
` ${
|
|
42462
|
-
);
|
|
42463
|
-
console.log(` ${
|
|
42464
|
-
console.log(` ${
|
|
42465
|
-
console.log(` ${
|
|
42466
|
-
console.log(` ${
|
|
42467
|
-
console.log(` ${
|
|
42468
|
-
console.log(` ${
|
|
42469
|
-
console.log(` ${
|
|
42622
|
+
` ${pc68.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
42623
|
+
);
|
|
42624
|
+
console.log(` ${pc68.dim("-r, --region")} AWS region`);
|
|
42625
|
+
console.log(` ${pc68.dim("-d, --domain")} Domain name`);
|
|
42626
|
+
console.log(` ${pc68.dim("--account")} AWS account ID or alias`);
|
|
42627
|
+
console.log(` ${pc68.dim("--preset")} Configuration preset`);
|
|
42628
|
+
console.log(` ${pc68.dim("--token")} API key or token for auth`);
|
|
42629
|
+
console.log(` ${pc68.dim("-y, --yes")} Skip confirmation prompts`);
|
|
42630
|
+
console.log(` ${pc68.dim("-f, --force")} Force destructive operations`);
|
|
42470
42631
|
console.log(
|
|
42471
|
-
` ${
|
|
42632
|
+
` ${pc68.dim("--preview")} Preview changes without deploying`
|
|
42472
42633
|
);
|
|
42473
|
-
console.log(` ${
|
|
42634
|
+
console.log(` ${pc68.dim("-v, --version")} Show version number
|
|
42474
42635
|
`);
|
|
42475
42636
|
console.log(
|
|
42476
|
-
`Run ${
|
|
42637
|
+
`Run ${pc68.cyan("wraps <service> <command> --help")} for more information.
|
|
42477
42638
|
`
|
|
42478
42639
|
);
|
|
42479
42640
|
}
|
|
@@ -42495,27 +42656,27 @@ if (!primaryCommand) {
|
|
|
42495
42656
|
const telemetry = getTelemetryClient();
|
|
42496
42657
|
if (telemetry.shouldShowNotification()) {
|
|
42497
42658
|
console.log();
|
|
42498
|
-
|
|
42659
|
+
clack64.log.info(pc68.bold("Anonymous Telemetry"));
|
|
42499
42660
|
console.log(
|
|
42500
|
-
` Wraps collects ${
|
|
42661
|
+
` Wraps collects ${pc68.cyan("anonymous usage data")} to improve the CLI.`
|
|
42501
42662
|
);
|
|
42502
42663
|
console.log(
|
|
42503
|
-
` We ${
|
|
42664
|
+
` We ${pc68.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
42504
42665
|
);
|
|
42505
42666
|
console.log(
|
|
42506
|
-
` We ${
|
|
42667
|
+
` We ${pc68.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
42507
42668
|
);
|
|
42508
42669
|
console.log();
|
|
42509
|
-
console.log(` Opt-out anytime: ${
|
|
42510
|
-
console.log(` Or set: ${
|
|
42511
|
-
console.log(` Learn more: ${
|
|
42670
|
+
console.log(` Opt-out anytime: ${pc68.cyan("wraps telemetry disable")}`);
|
|
42671
|
+
console.log(` Or set: ${pc68.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
42672
|
+
console.log(` Learn more: ${pc68.cyan("https://wraps.dev/docs")}`);
|
|
42512
42673
|
console.log();
|
|
42513
42674
|
telemetry.markNotificationShown();
|
|
42514
42675
|
}
|
|
42515
42676
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
42516
|
-
|
|
42677
|
+
clack64.intro(pc68.bold(`WRAPS CLI v${VERSION}`));
|
|
42517
42678
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
42518
|
-
const action = await
|
|
42679
|
+
const action = await clack64.select({
|
|
42519
42680
|
message: "What would you like to do?",
|
|
42520
42681
|
options: [
|
|
42521
42682
|
{
|
|
@@ -42565,13 +42726,13 @@ if (!primaryCommand) {
|
|
|
42565
42726
|
}
|
|
42566
42727
|
]
|
|
42567
42728
|
});
|
|
42568
|
-
if (
|
|
42729
|
+
if (clack64.isCancel(action)) {
|
|
42569
42730
|
trackCommand("interactive:cancel", {
|
|
42570
42731
|
success: true,
|
|
42571
42732
|
duration_ms: Date.now() - startTime
|
|
42572
42733
|
});
|
|
42573
42734
|
await telemetry.shutdown();
|
|
42574
|
-
|
|
42735
|
+
clack64.cancel("Operation cancelled.");
|
|
42575
42736
|
process.exit(0);
|
|
42576
42737
|
}
|
|
42577
42738
|
trackCommand(`interactive:${action}`, {
|
|
@@ -42651,20 +42812,20 @@ async function run() {
|
|
|
42651
42812
|
const telemetry = getTelemetryClient();
|
|
42652
42813
|
if (telemetry.shouldShowNotification()) {
|
|
42653
42814
|
console.log();
|
|
42654
|
-
|
|
42815
|
+
clack64.log.info(pc68.bold("Anonymous Telemetry"));
|
|
42655
42816
|
console.log(
|
|
42656
|
-
` Wraps collects ${
|
|
42817
|
+
` Wraps collects ${pc68.cyan("anonymous usage data")} to improve the CLI.`
|
|
42657
42818
|
);
|
|
42658
42819
|
console.log(
|
|
42659
|
-
` We ${
|
|
42820
|
+
` We ${pc68.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
42660
42821
|
);
|
|
42661
42822
|
console.log(
|
|
42662
|
-
` We ${
|
|
42823
|
+
` We ${pc68.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
42663
42824
|
);
|
|
42664
42825
|
console.log();
|
|
42665
|
-
console.log(` Opt-out anytime: ${
|
|
42666
|
-
console.log(` Or set: ${
|
|
42667
|
-
console.log(` Learn more: ${
|
|
42826
|
+
console.log(` Opt-out anytime: ${pc68.cyan("wraps telemetry disable")}`);
|
|
42827
|
+
console.log(` Or set: ${pc68.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
42828
|
+
console.log(` Learn more: ${pc68.cyan("https://wraps.dev/docs")}`);
|
|
42668
42829
|
console.log();
|
|
42669
42830
|
telemetry.markNotificationShown();
|
|
42670
42831
|
}
|
|
@@ -42748,10 +42909,10 @@ async function run() {
|
|
|
42748
42909
|
break;
|
|
42749
42910
|
case "verify": {
|
|
42750
42911
|
if (!flags.domain) {
|
|
42751
|
-
|
|
42912
|
+
clack64.log.error("--domain flag is required");
|
|
42752
42913
|
console.log(
|
|
42753
42914
|
`
|
|
42754
|
-
Usage: ${
|
|
42915
|
+
Usage: ${pc68.cyan("wraps email verify --domain yourapp.com")}
|
|
42755
42916
|
`
|
|
42756
42917
|
);
|
|
42757
42918
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42823,12 +42984,12 @@ Usage: ${pc67.cyan("wraps email verify --domain yourapp.com")}
|
|
|
42823
42984
|
});
|
|
42824
42985
|
break;
|
|
42825
42986
|
default:
|
|
42826
|
-
|
|
42987
|
+
clack64.log.error(
|
|
42827
42988
|
`Unknown inbound command: ${inboundSubCommand || "(none)"}`
|
|
42828
42989
|
);
|
|
42829
42990
|
console.log(
|
|
42830
42991
|
`
|
|
42831
|
-
Available commands: ${
|
|
42992
|
+
Available commands: ${pc68.cyan("init")}, ${pc68.cyan("destroy")}, ${pc68.cyan("status")}, ${pc68.cyan("verify")}, ${pc68.cyan("test")}, ${pc68.cyan("add")}, ${pc68.cyan("remove")}
|
|
42832
42993
|
`
|
|
42833
42994
|
);
|
|
42834
42995
|
throw new Error(
|
|
@@ -42880,12 +43041,12 @@ Available commands: ${pc67.cyan("init")}, ${pc67.cyan("destroy")}, ${pc67.cyan("
|
|
|
42880
43041
|
break;
|
|
42881
43042
|
}
|
|
42882
43043
|
default:
|
|
42883
|
-
|
|
43044
|
+
clack64.log.error(
|
|
42884
43045
|
`Unknown reply command: ${replySubCommand || "(none)"}`
|
|
42885
43046
|
);
|
|
42886
43047
|
console.log(
|
|
42887
43048
|
`
|
|
42888
|
-
Available commands: ${
|
|
43049
|
+
Available commands: ${pc68.cyan("init")}, ${pc68.cyan("rotate")}, ${pc68.cyan("status")}, ${pc68.cyan("destroy")}, ${pc68.cyan("decode")}
|
|
42889
43050
|
`
|
|
42890
43051
|
);
|
|
42891
43052
|
throw new Error(
|
|
@@ -42910,10 +43071,10 @@ Available commands: ${pc67.cyan("init")}, ${pc67.cyan("rotate")}, ${pc67.cyan("s
|
|
|
42910
43071
|
break;
|
|
42911
43072
|
case "verify": {
|
|
42912
43073
|
if (!flags.domain) {
|
|
42913
|
-
|
|
43074
|
+
clack64.log.error("--domain flag is required");
|
|
42914
43075
|
console.log(
|
|
42915
43076
|
`
|
|
42916
|
-
Usage: ${
|
|
43077
|
+
Usage: ${pc68.cyan("wraps email domains verify --domain yourapp.com")}
|
|
42917
43078
|
`
|
|
42918
43079
|
);
|
|
42919
43080
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42923,10 +43084,10 @@ Usage: ${pc67.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
42923
43084
|
}
|
|
42924
43085
|
case "get-dkim": {
|
|
42925
43086
|
if (!flags.domain) {
|
|
42926
|
-
|
|
43087
|
+
clack64.log.error("--domain flag is required");
|
|
42927
43088
|
console.log(
|
|
42928
43089
|
`
|
|
42929
|
-
Usage: ${
|
|
43090
|
+
Usage: ${pc68.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
42930
43091
|
`
|
|
42931
43092
|
);
|
|
42932
43093
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42936,10 +43097,10 @@ Usage: ${pc67.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
42936
43097
|
}
|
|
42937
43098
|
case "remove": {
|
|
42938
43099
|
if (!flags.domain) {
|
|
42939
|
-
|
|
43100
|
+
clack64.log.error("--domain flag is required");
|
|
42940
43101
|
console.log(
|
|
42941
43102
|
`
|
|
42942
|
-
Usage: ${
|
|
43103
|
+
Usage: ${pc68.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
42943
43104
|
`
|
|
42944
43105
|
);
|
|
42945
43106
|
throw new Error("Missing required flag: --domain");
|
|
@@ -42969,12 +43130,12 @@ Usage: ${pc67.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
42969
43130
|
break;
|
|
42970
43131
|
}
|
|
42971
43132
|
default:
|
|
42972
|
-
|
|
43133
|
+
clack64.log.error(
|
|
42973
43134
|
`Unknown domains command: ${domainsSubCommand || "(none)"}`
|
|
42974
43135
|
);
|
|
42975
43136
|
console.log(
|
|
42976
43137
|
`
|
|
42977
|
-
Available commands: ${
|
|
43138
|
+
Available commands: ${pc68.cyan("add")}, ${pc68.cyan("list")}, ${pc68.cyan("verify")}, ${pc68.cyan("get-dkim")}, ${pc68.cyan("remove")}, ${pc68.cyan("config")}
|
|
42978
43139
|
`
|
|
42979
43140
|
);
|
|
42980
43141
|
throw new Error(
|
|
@@ -43016,12 +43177,12 @@ Available commands: ${pc67.cyan("add")}, ${pc67.cyan("list")}, ${pc67.cyan("veri
|
|
|
43016
43177
|
});
|
|
43017
43178
|
break;
|
|
43018
43179
|
default:
|
|
43019
|
-
|
|
43180
|
+
clack64.log.error(
|
|
43020
43181
|
`Unknown templates command: ${templatesSubCommand || "(none)"}`
|
|
43021
43182
|
);
|
|
43022
43183
|
console.log(
|
|
43023
43184
|
`
|
|
43024
|
-
Available commands: ${
|
|
43185
|
+
Available commands: ${pc68.cyan("init")}, ${pc68.cyan("push")}, ${pc68.cyan("preview")}
|
|
43025
43186
|
`
|
|
43026
43187
|
);
|
|
43027
43188
|
throw new Error(
|
|
@@ -43060,12 +43221,12 @@ Available commands: ${pc67.cyan("init")}, ${pc67.cyan("push")}, ${pc67.cyan("pre
|
|
|
43060
43221
|
});
|
|
43061
43222
|
break;
|
|
43062
43223
|
default:
|
|
43063
|
-
|
|
43224
|
+
clack64.log.error(
|
|
43064
43225
|
`Unknown workflows command: ${workflowsSubCommand || "(none)"}`
|
|
43065
43226
|
);
|
|
43066
43227
|
console.log(
|
|
43067
43228
|
`
|
|
43068
|
-
Available commands: ${
|
|
43229
|
+
Available commands: ${pc68.cyan("init")}, ${pc68.cyan("validate")}, ${pc68.cyan("push")}
|
|
43069
43230
|
`
|
|
43070
43231
|
);
|
|
43071
43232
|
throw new Error(
|
|
@@ -43090,7 +43251,7 @@ Available commands: ${pc67.cyan("init")}, ${pc67.cyan("validate")}, ${pc67.cyan(
|
|
|
43090
43251
|
case "get": {
|
|
43091
43252
|
const messageId = sub[3];
|
|
43092
43253
|
if (!messageId) {
|
|
43093
|
-
|
|
43254
|
+
clack64.log.error("Usage: wraps email logs get <message-id>");
|
|
43094
43255
|
throw new Error("Missing required argument: <message-id>");
|
|
43095
43256
|
}
|
|
43096
43257
|
await emailLogsGet({
|
|
@@ -43102,12 +43263,12 @@ Available commands: ${pc67.cyan("init")}, ${pc67.cyan("validate")}, ${pc67.cyan(
|
|
|
43102
43263
|
break;
|
|
43103
43264
|
}
|
|
43104
43265
|
default:
|
|
43105
|
-
|
|
43266
|
+
clack64.log.error(
|
|
43106
43267
|
`Unknown logs command: ${logsSubCommand || "(none)"}`
|
|
43107
43268
|
);
|
|
43108
43269
|
console.log(
|
|
43109
43270
|
`
|
|
43110
|
-
Available commands: ${
|
|
43271
|
+
Available commands: ${pc68.cyan("list")}, ${pc68.cyan("get <message-id>")}
|
|
43111
43272
|
`
|
|
43112
43273
|
);
|
|
43113
43274
|
throw new Error(
|
|
@@ -43132,10 +43293,10 @@ Available commands: ${pc67.cyan("list")}, ${pc67.cyan("get <message-id>")}
|
|
|
43132
43293
|
});
|
|
43133
43294
|
break;
|
|
43134
43295
|
default:
|
|
43135
|
-
|
|
43296
|
+
clack64.log.error(`Unknown email command: ${subCommand}`);
|
|
43136
43297
|
console.log(
|
|
43137
43298
|
`
|
|
43138
|
-
Run ${
|
|
43299
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43139
43300
|
`
|
|
43140
43301
|
);
|
|
43141
43302
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -43160,10 +43321,10 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43160
43321
|
});
|
|
43161
43322
|
break;
|
|
43162
43323
|
default:
|
|
43163
|
-
|
|
43324
|
+
clack64.log.error(`Unknown license command: ${subCommand}`);
|
|
43164
43325
|
console.log(
|
|
43165
43326
|
`
|
|
43166
|
-
Run ${
|
|
43327
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43167
43328
|
`
|
|
43168
43329
|
);
|
|
43169
43330
|
throw new Error(`Unknown license command: ${subCommand}`);
|
|
@@ -43216,6 +43377,12 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43216
43377
|
json: flags.json
|
|
43217
43378
|
});
|
|
43218
43379
|
break;
|
|
43380
|
+
case "logout":
|
|
43381
|
+
await selfhostLogout({
|
|
43382
|
+
region: flags.region,
|
|
43383
|
+
json: flags.json
|
|
43384
|
+
});
|
|
43385
|
+
break;
|
|
43219
43386
|
case "connect":
|
|
43220
43387
|
await connect3({
|
|
43221
43388
|
region: flags.region,
|
|
@@ -43226,10 +43393,10 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43226
43393
|
});
|
|
43227
43394
|
break;
|
|
43228
43395
|
default:
|
|
43229
|
-
|
|
43396
|
+
clack64.log.error(`Unknown selfhost command: ${subCommand}`);
|
|
43230
43397
|
console.log(
|
|
43231
43398
|
`
|
|
43232
|
-
Run ${
|
|
43399
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43233
43400
|
`
|
|
43234
43401
|
);
|
|
43235
43402
|
throw new Error(`Unknown selfhost command: ${subCommand}`);
|
|
@@ -43309,10 +43476,10 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43309
43476
|
});
|
|
43310
43477
|
break;
|
|
43311
43478
|
default:
|
|
43312
|
-
|
|
43479
|
+
clack64.log.error(`Unknown sms command: ${subCommand}`);
|
|
43313
43480
|
console.log(
|
|
43314
43481
|
`
|
|
43315
|
-
Run ${
|
|
43482
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43316
43483
|
`
|
|
43317
43484
|
);
|
|
43318
43485
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -43373,10 +43540,10 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43373
43540
|
});
|
|
43374
43541
|
break;
|
|
43375
43542
|
default:
|
|
43376
|
-
|
|
43543
|
+
clack64.log.error(`Unknown cdn command: ${subCommand}`);
|
|
43377
43544
|
console.log(
|
|
43378
43545
|
`
|
|
43379
|
-
Run ${
|
|
43546
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43380
43547
|
`
|
|
43381
43548
|
);
|
|
43382
43549
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -43398,13 +43565,13 @@ Run ${pc67.cyan("wraps --help")} for available commands.
|
|
|
43398
43565
|
});
|
|
43399
43566
|
break;
|
|
43400
43567
|
default:
|
|
43401
|
-
|
|
43568
|
+
clack64.log.error(
|
|
43402
43569
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
43403
43570
|
);
|
|
43404
43571
|
console.log(`
|
|
43405
|
-
Available commands: ${
|
|
43572
|
+
Available commands: ${pc68.cyan("init")}
|
|
43406
43573
|
`);
|
|
43407
|
-
console.log(`Run ${
|
|
43574
|
+
console.log(`Run ${pc68.cyan("wraps --help")} for more information.
|
|
43408
43575
|
`);
|
|
43409
43576
|
throw new Error(
|
|
43410
43577
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -43446,14 +43613,14 @@ Available commands: ${pc67.cyan("init")}
|
|
|
43446
43613
|
});
|
|
43447
43614
|
break;
|
|
43448
43615
|
default:
|
|
43449
|
-
|
|
43616
|
+
clack64.log.error(`Unknown platform command: ${subCommand}`);
|
|
43450
43617
|
console.log(
|
|
43451
43618
|
`
|
|
43452
|
-
Available commands: ${
|
|
43619
|
+
Available commands: ${pc68.cyan("connect")}, ${pc68.cyan("update-role")}
|
|
43453
43620
|
`
|
|
43454
43621
|
);
|
|
43455
43622
|
console.log(
|
|
43456
|
-
`Run ${
|
|
43623
|
+
`Run ${pc68.cyan("wraps platform")} for more information.
|
|
43457
43624
|
`
|
|
43458
43625
|
);
|
|
43459
43626
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -43478,10 +43645,10 @@ Available commands: ${pc67.cyan("connect")}, ${pc67.cyan("update-role")}
|
|
|
43478
43645
|
await logout();
|
|
43479
43646
|
break;
|
|
43480
43647
|
default:
|
|
43481
|
-
|
|
43648
|
+
clack64.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
43482
43649
|
console.log(
|
|
43483
43650
|
`
|
|
43484
|
-
Available commands: ${
|
|
43651
|
+
Available commands: ${pc68.cyan("login")}, ${pc68.cyan("status")}, ${pc68.cyan("logout")}
|
|
43485
43652
|
`
|
|
43486
43653
|
);
|
|
43487
43654
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -43499,13 +43666,13 @@ Available commands: ${pc67.cyan("login")}, ${pc67.cyan("status")}, ${pc67.cyan("
|
|
|
43499
43666
|
await doctor();
|
|
43500
43667
|
break;
|
|
43501
43668
|
default:
|
|
43502
|
-
|
|
43669
|
+
clack64.log.error(`Unknown aws command: ${subCommand}`);
|
|
43503
43670
|
console.log(
|
|
43504
43671
|
`
|
|
43505
|
-
Available commands: ${
|
|
43672
|
+
Available commands: ${pc68.cyan("setup")}, ${pc68.cyan("doctor")}
|
|
43506
43673
|
`
|
|
43507
43674
|
);
|
|
43508
|
-
console.log(`Run ${
|
|
43675
|
+
console.log(`Run ${pc68.cyan("wraps --help")} for more information.
|
|
43509
43676
|
`);
|
|
43510
43677
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
43511
43678
|
}
|
|
@@ -43586,10 +43753,10 @@ Available commands: ${pc67.cyan("setup")}, ${pc67.cyan("doctor")}
|
|
|
43586
43753
|
await telemetryStatus();
|
|
43587
43754
|
break;
|
|
43588
43755
|
default:
|
|
43589
|
-
|
|
43756
|
+
clack64.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
43590
43757
|
console.log(
|
|
43591
43758
|
`
|
|
43592
|
-
Available commands: ${
|
|
43759
|
+
Available commands: ${pc68.cyan("enable")}, ${pc68.cyan("disable")}, ${pc68.cyan("status")}
|
|
43593
43760
|
`
|
|
43594
43761
|
);
|
|
43595
43762
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -43613,10 +43780,10 @@ Please specify a command for ${primaryCommand} service.
|
|
|
43613
43780
|
showHelp();
|
|
43614
43781
|
break;
|
|
43615
43782
|
default:
|
|
43616
|
-
|
|
43783
|
+
clack64.log.error(`Unknown command: ${primaryCommand}`);
|
|
43617
43784
|
console.log(
|
|
43618
43785
|
`
|
|
43619
|
-
Run ${
|
|
43786
|
+
Run ${pc68.cyan("wraps --help")} for available commands.
|
|
43620
43787
|
`
|
|
43621
43788
|
);
|
|
43622
43789
|
throw new Error(`Unknown command: ${primaryCommand}`);
|