@wraps.dev/cli 2.29.1 → 2.30.0
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/api-lambda.zip +0 -0
- package/dist/cli.js +1492 -732
- package/dist/cli.js.map +1 -1
- package/dist/lambda/agent-enforcer/.bundled +1 -1
- package/dist/lambda/event-processor/.bundled +1 -1
- package/dist/lambda/inbound-processor/.bundled +1 -1
- package/dist/lambda/sms-event-processor/.bundled +1 -1
- package/package.json +4 -3
package/dist/cli.js
CHANGED
|
@@ -1253,6 +1253,50 @@ If you believe this is a Wraps bug, report it at:
|
|
|
1253
1253
|
"Your IAM user/role needs SQS permissions.\nRequired actions: CreateQueue, DeleteQueue, GetQueueAttributes\n\nView required permissions:\n wraps permissions --json",
|
|
1254
1254
|
"https://wraps.dev/docs/guides/aws-setup/permissions"
|
|
1255
1255
|
),
|
|
1256
|
+
cloudWatchLogsPermissionDenied: (action) => new WrapsError(
|
|
1257
|
+
"CloudWatch Logs permission denied",
|
|
1258
|
+
"CLOUDWATCH_LOGS_PERMISSION_DENIED",
|
|
1259
|
+
`Your IAM user/role is not allowed to call ${action}.
|
|
1260
|
+
Required actions: logs:DescribeLogGroups, logs:FilterLogEvents, logs:StartLiveTail
|
|
1261
|
+
|
|
1262
|
+
View required permissions:
|
|
1263
|
+
wraps permissions --json`,
|
|
1264
|
+
"https://wraps.dev/docs/guides/aws-setup/permissions"
|
|
1265
|
+
),
|
|
1266
|
+
// Discovery scans for /aws/lambda/wraps-selfhost*, which both the Pulumi and
|
|
1267
|
+
// SST variants create — no groups means no deployment in this region, not an
|
|
1268
|
+
// unsupported variant.
|
|
1269
|
+
noSelfhostLogGroups: (region) => new WrapsError(
|
|
1270
|
+
`No self-hosted log groups found in ${region}`,
|
|
1271
|
+
"SELFHOST_NO_LOG_GROUPS",
|
|
1272
|
+
"Nothing matching /aws/lambda/wraps-selfhost* exists in this region. The deployment may live in another region, or may not have run yet.\n\nCheck the deployment:\n wraps selfhost status\n\nOr target a different region:\n wraps selfhost logs --region <region>",
|
|
1273
|
+
"https://wraps.dev/docs/self-hosting"
|
|
1274
|
+
),
|
|
1275
|
+
invalidLogSource: (value) => new WrapsError(
|
|
1276
|
+
`Unknown --source value: ${value}`,
|
|
1277
|
+
"INVALID_LOG_SOURCE",
|
|
1278
|
+
"Valid sources are: api, web, workers, other, all.\n\nExample:\n wraps selfhost logs --source api",
|
|
1279
|
+
"https://wraps.dev/docs/self-hosting"
|
|
1280
|
+
),
|
|
1281
|
+
// The Pulumi variant deploys the API Lambda only, so `--source web` is a
|
|
1282
|
+
// legitimate request with no matching groups rather than a typo.
|
|
1283
|
+
noLogGroupsForSource: (source, available) => new WrapsError(
|
|
1284
|
+
`No ${source} log groups in this deployment`,
|
|
1285
|
+
"SELFHOST_NO_LOG_GROUPS_FOR_SOURCE",
|
|
1286
|
+
`This deployment has: ${available}.
|
|
1287
|
+
|
|
1288
|
+
The API-only control plane (wraps selfhost deploy) has no dashboard or worker Lambdas \u2014 those ship with the full SST platform.
|
|
1289
|
+
|
|
1290
|
+
Drop the filter to see everything:
|
|
1291
|
+
wraps selfhost logs`,
|
|
1292
|
+
"https://wraps.dev/docs/self-hosting"
|
|
1293
|
+
),
|
|
1294
|
+
invalidLogWindow: (value) => new WrapsError(
|
|
1295
|
+
`Invalid --since value: ${value}`,
|
|
1296
|
+
"INVALID_LOG_WINDOW",
|
|
1297
|
+
"Use a positive number followed by s, m, h, or d.\n\nExamples:\n wraps selfhost logs --since 30m\n wraps selfhost logs --since 6h\n wraps selfhost logs --since 2d",
|
|
1298
|
+
"https://wraps.dev/docs/self-hosting"
|
|
1299
|
+
),
|
|
1256
1300
|
route53PermissionDenied: () => new WrapsError(
|
|
1257
1301
|
"Route53 permission denied",
|
|
1258
1302
|
"ROUTE53_PERMISSION_DENIED",
|
|
@@ -1974,8 +2018,8 @@ async function ensurePulumiWorkDir(options) {
|
|
|
1974
2018
|
);
|
|
1975
2019
|
return;
|
|
1976
2020
|
} catch (error) {
|
|
1977
|
-
const
|
|
1978
|
-
|
|
2021
|
+
const clack69 = await import("@clack/prompts");
|
|
2022
|
+
clack69.log.warn(
|
|
1979
2023
|
`S3 state backend unavailable (${error instanceof Error ? error.message : error}). Using local state.`
|
|
1980
2024
|
);
|
|
1981
2025
|
}
|
|
@@ -7160,23 +7204,23 @@ async function withLockRetry(fn, options) {
|
|
|
7160
7204
|
if (parsed.code !== "STACK_LOCKED") {
|
|
7161
7205
|
throw error;
|
|
7162
7206
|
}
|
|
7163
|
-
const
|
|
7164
|
-
const
|
|
7207
|
+
const clack69 = await import("@clack/prompts");
|
|
7208
|
+
const pc73 = (await import("picocolors")).default;
|
|
7165
7209
|
if (options.autoConfirm) {
|
|
7166
|
-
|
|
7210
|
+
clack69.log.warn(
|
|
7167
7211
|
"Stack is locked from a previous interrupted run. Auto-clearing..."
|
|
7168
7212
|
);
|
|
7169
7213
|
} else {
|
|
7170
|
-
const shouldClear = await
|
|
7171
|
-
message: `Stack is locked from a previous interrupted run. ${
|
|
7214
|
+
const shouldClear = await clack69.confirm({
|
|
7215
|
+
message: `Stack is locked from a previous interrupted run. ${pc73.yellow("Clear the stale lock and retry?")}`,
|
|
7172
7216
|
initialValue: true
|
|
7173
7217
|
});
|
|
7174
|
-
if (
|
|
7218
|
+
if (clack69.isCancel(shouldClear) || !shouldClear) {
|
|
7175
7219
|
throw errors.stackLocked();
|
|
7176
7220
|
}
|
|
7177
7221
|
}
|
|
7178
7222
|
const cleared = await clearStackLocks(options.accountId, options.region);
|
|
7179
|
-
|
|
7223
|
+
clack69.log.info(
|
|
7180
7224
|
`Cleared ${cleared} lock file${cleared === 1 ? "" : "s"}. Retrying...`
|
|
7181
7225
|
);
|
|
7182
7226
|
return fn();
|
|
@@ -31348,8 +31392,8 @@ import { homedir as homedir6, tmpdir as tmpdir2 } from "os";
|
|
|
31348
31392
|
import { join as join26 } from "path";
|
|
31349
31393
|
import { Readable as Readable5 } from "stream";
|
|
31350
31394
|
import { pipeline } from "stream/promises";
|
|
31351
|
-
import { cancel as cancel38, confirm as confirm32, intro as
|
|
31352
|
-
import
|
|
31395
|
+
import { cancel as cancel38, confirm as confirm32, intro as intro63, isCancel as isCancel43, log as log62 } from "@clack/prompts";
|
|
31396
|
+
import pc71 from "picocolors";
|
|
31353
31397
|
function isStandaloneInstall() {
|
|
31354
31398
|
return process.execPath.includes(".wraps/runtime");
|
|
31355
31399
|
}
|
|
@@ -31378,7 +31422,7 @@ function detectPlatformArch() {
|
|
|
31378
31422
|
return { platform: platform3, arch };
|
|
31379
31423
|
}
|
|
31380
31424
|
async function update(currentVersion) {
|
|
31381
|
-
|
|
31425
|
+
intro63(pc71.bold("Wraps CLI Update"));
|
|
31382
31426
|
const progress = new DeploymentProgress();
|
|
31383
31427
|
const result = await progress.execute(
|
|
31384
31428
|
"Checking for updates...",
|
|
@@ -31390,20 +31434,20 @@ async function update(currentVersion) {
|
|
|
31390
31434
|
}
|
|
31391
31435
|
const { version: latestVersion, release: release2 } = result;
|
|
31392
31436
|
if (currentVersion === latestVersion) {
|
|
31393
|
-
progress.succeed(`Already up to date ${
|
|
31437
|
+
progress.succeed(`Already up to date ${pc71.dim(`(v${currentVersion})`)}`);
|
|
31394
31438
|
return;
|
|
31395
31439
|
}
|
|
31396
31440
|
console.log();
|
|
31397
|
-
|
|
31398
|
-
`Current version: ${
|
|
31399
|
-
Latest version: ${
|
|
31441
|
+
log62.info(
|
|
31442
|
+
`Current version: ${pc71.dim(`v${currentVersion}`)}
|
|
31443
|
+
Latest version: ${pc71.cyan(`v${latestVersion}`)}`
|
|
31400
31444
|
);
|
|
31401
31445
|
console.log();
|
|
31402
31446
|
if (!isStandaloneInstall()) {
|
|
31403
|
-
|
|
31447
|
+
log62.info(
|
|
31404
31448
|
`You installed Wraps via npm. Update with:
|
|
31405
31449
|
|
|
31406
|
-
${
|
|
31450
|
+
${pc71.cyan("npm update -g @wraps.dev/cli")}`
|
|
31407
31451
|
);
|
|
31408
31452
|
return;
|
|
31409
31453
|
}
|
|
@@ -31478,7 +31522,7 @@ async function update(currentVersion) {
|
|
|
31478
31522
|
});
|
|
31479
31523
|
console.log();
|
|
31480
31524
|
progress.succeed(
|
|
31481
|
-
`Updated to ${
|
|
31525
|
+
`Updated to ${pc71.cyan(`v${latestVersion}`)} successfully!`
|
|
31482
31526
|
);
|
|
31483
31527
|
} finally {
|
|
31484
31528
|
rmSync(tmp, { recursive: true, force: true });
|
|
@@ -31501,8 +31545,8 @@ init_esm_shims();
|
|
|
31501
31545
|
import { readFileSync as readFileSync4 } from "fs";
|
|
31502
31546
|
import { dirname as dirname8, join as join27 } from "path";
|
|
31503
31547
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
31504
|
-
import * as
|
|
31505
|
-
import
|
|
31548
|
+
import * as clack68 from "@clack/prompts";
|
|
31549
|
+
import pc72 from "picocolors";
|
|
31506
31550
|
|
|
31507
31551
|
// src/commands/auth/login.ts
|
|
31508
31552
|
init_esm_shims();
|
|
@@ -46769,12 +46813,12 @@ async function emailLogsList(options) {
|
|
|
46769
46813
|
}
|
|
46770
46814
|
const COL = { time: 8, status: 11, to: 28, subject: 40, msgId: 18 };
|
|
46771
46815
|
const header = pc31.bold("Time".padEnd(COL.time)) + " " + pc31.bold("Status".padEnd(COL.status)) + " " + pc31.bold("To".padEnd(COL.to)) + " " + pc31.bold("Subject".padEnd(COL.subject)) + " " + pc31.bold("Message ID");
|
|
46772
|
-
const rows = data.logs.map((
|
|
46773
|
-
const time2 = relativeTime(
|
|
46774
|
-
const status2 = padVisible(colorStatus(
|
|
46775
|
-
const to = padVisible(truncate(
|
|
46776
|
-
const subject = padVisible(truncate(
|
|
46777
|
-
const msgId = truncate(
|
|
46816
|
+
const rows = data.logs.map((log64) => {
|
|
46817
|
+
const time2 = relativeTime(log64.createdAt).padEnd(COL.time);
|
|
46818
|
+
const status2 = padVisible(colorStatus(log64.status), COL.status);
|
|
46819
|
+
const to = padVisible(truncate(log64.recipient, COL.to), COL.to);
|
|
46820
|
+
const subject = padVisible(truncate(log64.subject, COL.subject), COL.subject);
|
|
46821
|
+
const msgId = truncate(log64.messageId, COL.msgId);
|
|
46778
46822
|
return `${time2} ${status2} ${to} ${subject} ${msgId}`;
|
|
46779
46823
|
});
|
|
46780
46824
|
clack29.note(
|
|
@@ -46830,32 +46874,32 @@ async function emailLogsGet(options) {
|
|
|
46830
46874
|
}
|
|
46831
46875
|
return;
|
|
46832
46876
|
}
|
|
46833
|
-
const
|
|
46877
|
+
const log64 = await resp.json();
|
|
46834
46878
|
if (isJsonMode()) {
|
|
46835
|
-
jsonSuccess("email.logs.get",
|
|
46879
|
+
jsonSuccess("email.logs.get", log64);
|
|
46836
46880
|
return;
|
|
46837
46881
|
}
|
|
46838
46882
|
const kv = (label, value) => `${pc31.dim(label.padEnd(16))} ${value ?? pc31.dim("\u2014")}`;
|
|
46839
|
-
const sentAt =
|
|
46840
|
-
const deliveredAt =
|
|
46841
|
-
const bouncedAt =
|
|
46842
|
-
const createdAt = new Date(
|
|
46883
|
+
const sentAt = log64.sentAt ? new Date(log64.sentAt).toLocaleString() : null;
|
|
46884
|
+
const deliveredAt = log64.deliveredAt ? new Date(log64.deliveredAt).toLocaleString() : null;
|
|
46885
|
+
const bouncedAt = log64.bouncedAt ? new Date(log64.bouncedAt).toLocaleString() : null;
|
|
46886
|
+
const createdAt = new Date(log64.createdAt).toLocaleString();
|
|
46843
46887
|
const lines = [
|
|
46844
|
-
kv("Message ID:",
|
|
46845
|
-
kv("Status:",
|
|
46846
|
-
kv("To:",
|
|
46847
|
-
kv("From:",
|
|
46848
|
-
kv("Subject:",
|
|
46849
|
-
kv("Source:",
|
|
46888
|
+
kv("Message ID:", log64.messageId),
|
|
46889
|
+
kv("Status:", log64.status ? colorStatus(log64.status) : null),
|
|
46890
|
+
kv("To:", log64.recipient),
|
|
46891
|
+
kv("From:", log64.from),
|
|
46892
|
+
kv("Subject:", log64.subject),
|
|
46893
|
+
kv("Source:", log64.sourceType),
|
|
46850
46894
|
kv("Sent:", sentAt),
|
|
46851
46895
|
kv("Delivered:", deliveredAt),
|
|
46852
46896
|
kv("Bounced:", bouncedAt),
|
|
46853
|
-
...
|
|
46897
|
+
...log64.bouncedSubType ? [kv("Bounce type:", log64.bouncedSubType)] : [],
|
|
46854
46898
|
kv("Created:", createdAt)
|
|
46855
46899
|
];
|
|
46856
46900
|
clack29.note(
|
|
46857
46901
|
lines.join("\n"),
|
|
46858
|
-
`Log Detail \u2014 ${
|
|
46902
|
+
`Log Detail \u2014 ${log64.messageId ?? "(no message id)"}`
|
|
46859
46903
|
);
|
|
46860
46904
|
}
|
|
46861
46905
|
|
|
@@ -57947,11 +57991,696 @@ Run ${pc53.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
|
|
|
57947
57991
|
clack50.log.success(`Signed out of ${pc53.cyan(baseURL)}.`);
|
|
57948
57992
|
}
|
|
57949
57993
|
|
|
57950
|
-
// src/commands/selfhost/
|
|
57994
|
+
// src/commands/selfhost/logs.ts
|
|
57951
57995
|
init_esm_shims();
|
|
57952
|
-
init_events();
|
|
57953
57996
|
import * as clack51 from "@clack/prompts";
|
|
57954
57997
|
import pc54 from "picocolors";
|
|
57998
|
+
|
|
57999
|
+
// src/utils/selfhost/logs.ts
|
|
58000
|
+
init_esm_shims();
|
|
58001
|
+
init_errors();
|
|
58002
|
+
var SELFHOST_LOG_GROUP_PREFIX = "/aws/lambda/wraps-selfhost";
|
|
58003
|
+
var LIVE_TAIL_MAX_GROUPS = 10;
|
|
58004
|
+
var POLL_OVERLAP_MS = 15e3;
|
|
58005
|
+
var MAX_SEEN_KEYS = 5e3;
|
|
58006
|
+
var ERROR_FILTER_PATTERN = '?ERROR ?Error ?error ?FATAL ?fatal ?Exception ?exception ?Traceback ?"Task timed out" ?"UnhandledPromiseRejection" ?"Runtime."';
|
|
58007
|
+
var ERROR_LEVELS = /* @__PURE__ */ new Set(["error", "fatal", "critical"]);
|
|
58008
|
+
var PLATFORM_LINE = /^(START|END|REPORT|INIT_START|INIT_REPORT|XRAY) /;
|
|
58009
|
+
var ERROR_TEXT = /(^|\s)(ERROR|FATAL|CRITICAL)(\s|:|$)|Task timed out|UnhandledPromiseRejection|Unhandled Rejection|Runtime\.\w*Error|Traceback \(most recent call last\)/;
|
|
58010
|
+
var LEVEL_TEXT = /(^|\s)(ERROR|WARN|WARNING|INFO|DEBUG|TRACE|FATAL)(\s|:|$)/;
|
|
58011
|
+
var SINCE_DURATION = /^(\d+)(s|m|h|d)$/i;
|
|
58012
|
+
var ARN_WILDCARD_SUFFIX = /:?\*$/;
|
|
58013
|
+
var SOURCE_LABELS = {
|
|
58014
|
+
api: "api",
|
|
58015
|
+
web: "web",
|
|
58016
|
+
workers: "workers",
|
|
58017
|
+
other: "other"
|
|
58018
|
+
};
|
|
58019
|
+
var SELFHOST_LOG_SOURCES = Object.keys(
|
|
58020
|
+
SOURCE_LABELS
|
|
58021
|
+
);
|
|
58022
|
+
function classifyLogGroup(logGroupName) {
|
|
58023
|
+
const name = logGroupName.toLowerCase();
|
|
58024
|
+
if (name.endsWith("wraps-selfhost-api") || name.includes("selfhostapi")) {
|
|
58025
|
+
return "api";
|
|
58026
|
+
}
|
|
58027
|
+
if (name.includes("selfhostweb")) {
|
|
58028
|
+
return "web";
|
|
58029
|
+
}
|
|
58030
|
+
if (name.includes("batch") || name.includes("workflow")) {
|
|
58031
|
+
return "workers";
|
|
58032
|
+
}
|
|
58033
|
+
return "other";
|
|
58034
|
+
}
|
|
58035
|
+
function logSourceLabel(source) {
|
|
58036
|
+
return SOURCE_LABELS[source];
|
|
58037
|
+
}
|
|
58038
|
+
function isValidLogSource(value) {
|
|
58039
|
+
return value in SOURCE_LABELS;
|
|
58040
|
+
}
|
|
58041
|
+
function parseSince(value) {
|
|
58042
|
+
const match = SINCE_DURATION.exec(value.trim());
|
|
58043
|
+
if (!match) {
|
|
58044
|
+
throw errors.invalidLogWindow(value);
|
|
58045
|
+
}
|
|
58046
|
+
const amount = Number.parseInt(match[1], 10);
|
|
58047
|
+
if (amount <= 0) {
|
|
58048
|
+
throw errors.invalidLogWindow(value);
|
|
58049
|
+
}
|
|
58050
|
+
const unit = match[2].toLowerCase();
|
|
58051
|
+
const multipliers = {
|
|
58052
|
+
s: 1e3,
|
|
58053
|
+
m: 6e4,
|
|
58054
|
+
h: 36e5,
|
|
58055
|
+
d: 864e5
|
|
58056
|
+
};
|
|
58057
|
+
return amount * multipliers[unit];
|
|
58058
|
+
}
|
|
58059
|
+
function isPlatformLine(message) {
|
|
58060
|
+
return PLATFORM_LINE.test(message);
|
|
58061
|
+
}
|
|
58062
|
+
function parseStructured(message) {
|
|
58063
|
+
const start = message.indexOf("{");
|
|
58064
|
+
if (start === -1) {
|
|
58065
|
+
return null;
|
|
58066
|
+
}
|
|
58067
|
+
try {
|
|
58068
|
+
const parsed = JSON.parse(message.slice(start));
|
|
58069
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
58070
|
+
} catch {
|
|
58071
|
+
return null;
|
|
58072
|
+
}
|
|
58073
|
+
}
|
|
58074
|
+
function isErrorLine(message) {
|
|
58075
|
+
const structured = parseStructured(message);
|
|
58076
|
+
const level = structured?.level;
|
|
58077
|
+
if (typeof level === "string") {
|
|
58078
|
+
return ERROR_LEVELS.has(level.toLowerCase());
|
|
58079
|
+
}
|
|
58080
|
+
if (typeof level === "number") {
|
|
58081
|
+
return level >= 50;
|
|
58082
|
+
}
|
|
58083
|
+
return ERROR_TEXT.test(message);
|
|
58084
|
+
}
|
|
58085
|
+
function detectLevel(message) {
|
|
58086
|
+
const structured = parseStructured(message);
|
|
58087
|
+
const level = structured?.level;
|
|
58088
|
+
if (typeof level === "string") {
|
|
58089
|
+
return level.toUpperCase();
|
|
58090
|
+
}
|
|
58091
|
+
if (typeof level === "number") {
|
|
58092
|
+
if (level >= 60) {
|
|
58093
|
+
return "FATAL";
|
|
58094
|
+
}
|
|
58095
|
+
if (level >= 50) {
|
|
58096
|
+
return "ERROR";
|
|
58097
|
+
}
|
|
58098
|
+
if (level >= 40) {
|
|
58099
|
+
return "WARN";
|
|
58100
|
+
}
|
|
58101
|
+
if (level >= 30) {
|
|
58102
|
+
return "INFO";
|
|
58103
|
+
}
|
|
58104
|
+
return "DEBUG";
|
|
58105
|
+
}
|
|
58106
|
+
if (isPlatformLine(message)) {
|
|
58107
|
+
return null;
|
|
58108
|
+
}
|
|
58109
|
+
const match = LEVEL_TEXT.exec(message);
|
|
58110
|
+
if (match) {
|
|
58111
|
+
return match[2] === "WARNING" ? "WARN" : match[2];
|
|
58112
|
+
}
|
|
58113
|
+
return ERROR_TEXT.test(message) ? "ERROR" : null;
|
|
58114
|
+
}
|
|
58115
|
+
function formatMessageBody(message) {
|
|
58116
|
+
const structured = parseStructured(message);
|
|
58117
|
+
if (!structured) {
|
|
58118
|
+
return message;
|
|
58119
|
+
}
|
|
58120
|
+
const body = structured.msg ?? structured.message;
|
|
58121
|
+
if (typeof body !== "string" || body.length === 0) {
|
|
58122
|
+
return message;
|
|
58123
|
+
}
|
|
58124
|
+
const err = structured.err ?? structured.error;
|
|
58125
|
+
if (err && typeof err === "object") {
|
|
58126
|
+
const detail = err.message;
|
|
58127
|
+
if (typeof detail === "string" && detail !== body) {
|
|
58128
|
+
return `${body} \u2014 ${detail}`;
|
|
58129
|
+
}
|
|
58130
|
+
}
|
|
58131
|
+
return body;
|
|
58132
|
+
}
|
|
58133
|
+
async function getLogsClient(region) {
|
|
58134
|
+
const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
58135
|
+
return new CloudWatchLogsClient({ region });
|
|
58136
|
+
}
|
|
58137
|
+
function toLogsError(error, action) {
|
|
58138
|
+
if (!isAWSError(error)) {
|
|
58139
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
58140
|
+
}
|
|
58141
|
+
if (error.name === "AccessDeniedException" || error.name === "AccessDenied" || error.message.includes("AccessDenied") || error.message.includes("not authorized")) {
|
|
58142
|
+
return errors.cloudWatchLogsPermissionDenied(action);
|
|
58143
|
+
}
|
|
58144
|
+
return error;
|
|
58145
|
+
}
|
|
58146
|
+
async function discoverSelfhostLogGroups(region) {
|
|
58147
|
+
const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
58148
|
+
const client2 = await getLogsClient(region);
|
|
58149
|
+
const groups = [];
|
|
58150
|
+
let nextToken;
|
|
58151
|
+
try {
|
|
58152
|
+
do {
|
|
58153
|
+
const result = await client2.send(
|
|
58154
|
+
new DescribeLogGroupsCommand({
|
|
58155
|
+
logGroupNamePrefix: SELFHOST_LOG_GROUP_PREFIX,
|
|
58156
|
+
nextToken
|
|
58157
|
+
})
|
|
58158
|
+
);
|
|
58159
|
+
for (const group3 of result.logGroups ?? []) {
|
|
58160
|
+
if (group3.logGroupName && group3.arn) {
|
|
58161
|
+
groups.push({
|
|
58162
|
+
name: group3.logGroupName,
|
|
58163
|
+
arn: group3.arn,
|
|
58164
|
+
source: classifyLogGroup(group3.logGroupName)
|
|
58165
|
+
});
|
|
58166
|
+
}
|
|
58167
|
+
}
|
|
58168
|
+
nextToken = result.nextToken;
|
|
58169
|
+
} while (nextToken);
|
|
58170
|
+
} catch (error) {
|
|
58171
|
+
throw toLogsError(error, "logs:DescribeLogGroups");
|
|
58172
|
+
}
|
|
58173
|
+
return groups.sort((a6, b6) => a6.name.localeCompare(b6.name));
|
|
58174
|
+
}
|
|
58175
|
+
function toEntries(events, group3) {
|
|
58176
|
+
return events.map((event) => ({
|
|
58177
|
+
timestamp: event.timestamp ?? Date.now(),
|
|
58178
|
+
message: (event.message ?? "").trimEnd(),
|
|
58179
|
+
logStream: event.logStreamName ?? "",
|
|
58180
|
+
logGroup: group3.name,
|
|
58181
|
+
source: group3.source
|
|
58182
|
+
}));
|
|
58183
|
+
}
|
|
58184
|
+
function eventKey(event, groupName) {
|
|
58185
|
+
return event.eventId ?? `${groupName}:${event.timestamp}:${event.message ?? ""}`;
|
|
58186
|
+
}
|
|
58187
|
+
async function fetchGroupEvents(options) {
|
|
58188
|
+
const { FilterLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
58189
|
+
const client2 = await getLogsClient(options.region);
|
|
58190
|
+
const collected = [];
|
|
58191
|
+
let nextToken;
|
|
58192
|
+
try {
|
|
58193
|
+
do {
|
|
58194
|
+
const result = await client2.send(
|
|
58195
|
+
new FilterLogEventsCommand({
|
|
58196
|
+
logGroupName: options.group.name,
|
|
58197
|
+
startTime: options.startTime,
|
|
58198
|
+
endTime: options.endTime,
|
|
58199
|
+
filterPattern: options.filterPattern,
|
|
58200
|
+
nextToken,
|
|
58201
|
+
limit: 200
|
|
58202
|
+
})
|
|
58203
|
+
);
|
|
58204
|
+
for (const event of result.events ?? []) {
|
|
58205
|
+
if (options.onKey && !options.onKey(eventKey(event, options.group.name))) {
|
|
58206
|
+
continue;
|
|
58207
|
+
}
|
|
58208
|
+
collected.push(event);
|
|
58209
|
+
}
|
|
58210
|
+
nextToken = result.nextToken;
|
|
58211
|
+
} while (nextToken && collected.length < options.maxEntries);
|
|
58212
|
+
} catch (error) {
|
|
58213
|
+
if (isAWSError(error) && error.name === "ResourceNotFoundException") {
|
|
58214
|
+
return [];
|
|
58215
|
+
}
|
|
58216
|
+
throw toLogsError(error, "logs:FilterLogEvents");
|
|
58217
|
+
}
|
|
58218
|
+
return toEntries(collected.slice(0, options.maxEntries), options.group);
|
|
58219
|
+
}
|
|
58220
|
+
async function fetchLogs(options) {
|
|
58221
|
+
const maxEntries = options.maxEntries ?? 1e3;
|
|
58222
|
+
const perGroup = await Promise.all(
|
|
58223
|
+
options.groups.map(
|
|
58224
|
+
(group3) => fetchGroupEvents({
|
|
58225
|
+
region: options.region,
|
|
58226
|
+
group: group3,
|
|
58227
|
+
startTime: options.startTime,
|
|
58228
|
+
endTime: options.endTime,
|
|
58229
|
+
filterPattern: options.filterPattern,
|
|
58230
|
+
maxEntries
|
|
58231
|
+
})
|
|
58232
|
+
)
|
|
58233
|
+
);
|
|
58234
|
+
return perGroup.flat().sort((a6, b6) => a6.timestamp - b6.timestamp).slice(-maxEntries);
|
|
58235
|
+
}
|
|
58236
|
+
function createLogPoller(options) {
|
|
58237
|
+
const now = options.now ?? (() => Date.now());
|
|
58238
|
+
const seen = /* @__PURE__ */ new Set();
|
|
58239
|
+
const order = [];
|
|
58240
|
+
let nextStart = options.since;
|
|
58241
|
+
const remember = (key) => {
|
|
58242
|
+
if (seen.has(key)) {
|
|
58243
|
+
return false;
|
|
58244
|
+
}
|
|
58245
|
+
seen.add(key);
|
|
58246
|
+
order.push(key);
|
|
58247
|
+
if (order.length > MAX_SEEN_KEYS) {
|
|
58248
|
+
const evicted = order.splice(0, order.length - MAX_SEEN_KEYS);
|
|
58249
|
+
for (const stale of evicted) {
|
|
58250
|
+
seen.delete(stale);
|
|
58251
|
+
}
|
|
58252
|
+
}
|
|
58253
|
+
return true;
|
|
58254
|
+
};
|
|
58255
|
+
return async function poll() {
|
|
58256
|
+
const windowStart = Math.max(0, nextStart - POLL_OVERLAP_MS);
|
|
58257
|
+
const tickStart = now();
|
|
58258
|
+
const perGroup = await Promise.all(
|
|
58259
|
+
options.groups.map(
|
|
58260
|
+
(group3) => fetchGroupEvents({
|
|
58261
|
+
region: options.region,
|
|
58262
|
+
group: group3,
|
|
58263
|
+
startTime: windowStart,
|
|
58264
|
+
filterPattern: options.filterPattern,
|
|
58265
|
+
maxEntries: 1e3,
|
|
58266
|
+
onKey: remember
|
|
58267
|
+
})
|
|
58268
|
+
)
|
|
58269
|
+
);
|
|
58270
|
+
nextStart = tickStart;
|
|
58271
|
+
return perGroup.flat().sort((a6, b6) => a6.timestamp - b6.timestamp);
|
|
58272
|
+
};
|
|
58273
|
+
}
|
|
58274
|
+
function liveTailIdentifier(arn) {
|
|
58275
|
+
return arn.replace(ARN_WILDCARD_SUFFIX, "");
|
|
58276
|
+
}
|
|
58277
|
+
function startSelfhostLiveTail(options) {
|
|
58278
|
+
const abortController = new AbortController();
|
|
58279
|
+
const bySource = new Map(
|
|
58280
|
+
options.groups.map((group3) => [liveTailIdentifier(group3.arn), group3])
|
|
58281
|
+
);
|
|
58282
|
+
const stream = (async function* () {
|
|
58283
|
+
const { StartLiveTailCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
58284
|
+
const client2 = await getLogsClient(options.region);
|
|
58285
|
+
const response = await client2.send(
|
|
58286
|
+
new StartLiveTailCommand({
|
|
58287
|
+
logGroupIdentifiers: [...bySource.keys()].slice(
|
|
58288
|
+
0,
|
|
58289
|
+
LIVE_TAIL_MAX_GROUPS
|
|
58290
|
+
),
|
|
58291
|
+
logEventFilterPattern: options.filterPattern ?? ""
|
|
58292
|
+
}),
|
|
58293
|
+
{ abortSignal: abortController.signal }
|
|
58294
|
+
);
|
|
58295
|
+
if (!response.responseStream) {
|
|
58296
|
+
return;
|
|
58297
|
+
}
|
|
58298
|
+
for await (const event of response.responseStream) {
|
|
58299
|
+
const results = event.sessionUpdate?.sessionResults;
|
|
58300
|
+
if (!results?.length) {
|
|
58301
|
+
continue;
|
|
58302
|
+
}
|
|
58303
|
+
yield results.map((result) => {
|
|
58304
|
+
const identifier = result.logGroupIdentifier ?? "";
|
|
58305
|
+
const group3 = bySource.get(identifier);
|
|
58306
|
+
return {
|
|
58307
|
+
timestamp: result.timestamp ?? Date.now(),
|
|
58308
|
+
message: (result.message ?? "").trimEnd(),
|
|
58309
|
+
logStream: result.logStreamName ?? "",
|
|
58310
|
+
logGroup: group3?.name ?? identifier,
|
|
58311
|
+
source: group3?.source ?? classifyLogGroup(identifier)
|
|
58312
|
+
};
|
|
58313
|
+
});
|
|
58314
|
+
}
|
|
58315
|
+
})();
|
|
58316
|
+
return { stream, abort: () => abortController.abort() };
|
|
58317
|
+
}
|
|
58318
|
+
function liveTailGroupLimit() {
|
|
58319
|
+
return LIVE_TAIL_MAX_GROUPS;
|
|
58320
|
+
}
|
|
58321
|
+
|
|
58322
|
+
// src/commands/selfhost/logs.ts
|
|
58323
|
+
init_aws();
|
|
58324
|
+
init_errors();
|
|
58325
|
+
init_json_output();
|
|
58326
|
+
init_metadata();
|
|
58327
|
+
init_output();
|
|
58328
|
+
init_region_resolver();
|
|
58329
|
+
var DEFAULT_SINCE = "1h";
|
|
58330
|
+
var DEFAULT_INTERVAL_SECONDS = 3;
|
|
58331
|
+
var MIN_INTERVAL_SECONDS = 1;
|
|
58332
|
+
var MAX_INTERVAL_SECONDS = 60;
|
|
58333
|
+
var FOLLOW_BACKFILL_MS = 5 * 60 * 1e3;
|
|
58334
|
+
var MAX_ENTRIES = 1e3;
|
|
58335
|
+
var SOURCE_COLORS = {
|
|
58336
|
+
api: pc54.cyan,
|
|
58337
|
+
web: pc54.magenta,
|
|
58338
|
+
workers: pc54.blue,
|
|
58339
|
+
other: pc54.gray
|
|
58340
|
+
};
|
|
58341
|
+
function formatTime(timestamp) {
|
|
58342
|
+
const date2 = new Date(timestamp);
|
|
58343
|
+
const pad = (n3) => String(n3).padStart(2, "0");
|
|
58344
|
+
return `${pad(date2.getHours())}:${pad(date2.getMinutes())}:${pad(date2.getSeconds())}`;
|
|
58345
|
+
}
|
|
58346
|
+
function colorLevel(level) {
|
|
58347
|
+
if (!level) {
|
|
58348
|
+
return pc54.dim(" ");
|
|
58349
|
+
}
|
|
58350
|
+
const padded = level.padEnd(5).slice(0, 5);
|
|
58351
|
+
if (level === "ERROR" || level === "FATAL" || level === "CRITICAL") {
|
|
58352
|
+
return pc54.red(padded);
|
|
58353
|
+
}
|
|
58354
|
+
if (level === "WARN") {
|
|
58355
|
+
return pc54.yellow(padded);
|
|
58356
|
+
}
|
|
58357
|
+
if (level === "INFO") {
|
|
58358
|
+
return pc54.green(padded);
|
|
58359
|
+
}
|
|
58360
|
+
return pc54.dim(padded);
|
|
58361
|
+
}
|
|
58362
|
+
function renderEntry(entry, options) {
|
|
58363
|
+
const level = detectLevel(entry.message);
|
|
58364
|
+
const label = logSourceLabel(entry.source).padEnd(options.sourceWidth);
|
|
58365
|
+
const body = options.verbose ? entry.message : formatMessageBody(entry.message);
|
|
58366
|
+
return `${pc54.dim(formatTime(entry.timestamp))} ${SOURCE_COLORS[entry.source](label)} ${colorLevel(level)} ${body}`;
|
|
58367
|
+
}
|
|
58368
|
+
function toJsonEntry(entry) {
|
|
58369
|
+
return {
|
|
58370
|
+
timestamp: entry.timestamp,
|
|
58371
|
+
time: new Date(entry.timestamp).toISOString(),
|
|
58372
|
+
source: entry.source,
|
|
58373
|
+
level: detectLevel(entry.message),
|
|
58374
|
+
logGroup: entry.logGroup,
|
|
58375
|
+
logStream: entry.logStream,
|
|
58376
|
+
message: entry.message
|
|
58377
|
+
};
|
|
58378
|
+
}
|
|
58379
|
+
function refine(entries, options) {
|
|
58380
|
+
return entries.filter((entry) => {
|
|
58381
|
+
if (entry.message.length === 0) {
|
|
58382
|
+
return false;
|
|
58383
|
+
}
|
|
58384
|
+
if (!options.platform && isPlatformLine(entry.message)) {
|
|
58385
|
+
return false;
|
|
58386
|
+
}
|
|
58387
|
+
if (options.errorsOnly && !isErrorLine(entry.message)) {
|
|
58388
|
+
return false;
|
|
58389
|
+
}
|
|
58390
|
+
return true;
|
|
58391
|
+
});
|
|
58392
|
+
}
|
|
58393
|
+
function parseInterval(value) {
|
|
58394
|
+
if (!value) {
|
|
58395
|
+
return DEFAULT_INTERVAL_SECONDS;
|
|
58396
|
+
}
|
|
58397
|
+
const parsed = Number.parseInt(value, 10);
|
|
58398
|
+
if (Number.isNaN(parsed)) {
|
|
58399
|
+
return DEFAULT_INTERVAL_SECONDS;
|
|
58400
|
+
}
|
|
58401
|
+
return Math.min(Math.max(parsed, MIN_INTERVAL_SECONDS), MAX_INTERVAL_SECONDS);
|
|
58402
|
+
}
|
|
58403
|
+
function selectGroups(groups, source) {
|
|
58404
|
+
if (!source || source === "all") {
|
|
58405
|
+
return groups;
|
|
58406
|
+
}
|
|
58407
|
+
if (!isValidLogSource(source)) {
|
|
58408
|
+
throw errors.invalidLogSource(source);
|
|
58409
|
+
}
|
|
58410
|
+
return groups.filter((group3) => group3.source === source);
|
|
58411
|
+
}
|
|
58412
|
+
function createInterruptibleSleep() {
|
|
58413
|
+
let wake = null;
|
|
58414
|
+
return {
|
|
58415
|
+
sleep: (ms) => new Promise((resolve) => {
|
|
58416
|
+
const timer = setTimeout(() => {
|
|
58417
|
+
wake = null;
|
|
58418
|
+
resolve();
|
|
58419
|
+
}, ms);
|
|
58420
|
+
wake = () => {
|
|
58421
|
+
clearTimeout(timer);
|
|
58422
|
+
wake = null;
|
|
58423
|
+
resolve();
|
|
58424
|
+
};
|
|
58425
|
+
}),
|
|
58426
|
+
interrupt: () => wake?.()
|
|
58427
|
+
};
|
|
58428
|
+
}
|
|
58429
|
+
function printGroupSummary(groups) {
|
|
58430
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
58431
|
+
for (const group3 of groups) {
|
|
58432
|
+
const existing = bySource.get(group3.source) ?? [];
|
|
58433
|
+
existing.push(group3.name);
|
|
58434
|
+
bySource.set(group3.source, existing);
|
|
58435
|
+
}
|
|
58436
|
+
const parts = [...bySource.entries()].map(
|
|
58437
|
+
([source, names]) => `${SOURCE_COLORS[source](logSourceLabel(source))} ${pc54.dim(`(${names.length})`)}`
|
|
58438
|
+
);
|
|
58439
|
+
console.log(
|
|
58440
|
+
`${pc54.dim("Sources:")} ${parts.join(pc54.dim(" \xB7 "))} ${pc54.dim(`${groups.length} log group${groups.length === 1 ? "" : "s"}`)}`
|
|
58441
|
+
);
|
|
58442
|
+
}
|
|
58443
|
+
async function selfhostLogs(options) {
|
|
58444
|
+
const progress = new DeploymentProgress();
|
|
58445
|
+
const json = isJsonMode();
|
|
58446
|
+
if (!json) {
|
|
58447
|
+
clack51.intro(pc54.bold("Wraps Self-Hosted Logs"));
|
|
58448
|
+
}
|
|
58449
|
+
const sinceMs = parseSince(options.since ?? DEFAULT_SINCE);
|
|
58450
|
+
const intervalSeconds = parseInterval(options.interval);
|
|
58451
|
+
const identity = await progress.execute(
|
|
58452
|
+
"Checking AWS credentials",
|
|
58453
|
+
async () => validateAWSCredentials()
|
|
58454
|
+
);
|
|
58455
|
+
const region = await resolveRegionForCommand({
|
|
58456
|
+
accountId: identity.accountId,
|
|
58457
|
+
optionRegion: options.region,
|
|
58458
|
+
service: "selfhost",
|
|
58459
|
+
label: "self-hosted deployment"
|
|
58460
|
+
});
|
|
58461
|
+
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
58462
|
+
const allGroups = await progress.execute(
|
|
58463
|
+
"Locating log groups",
|
|
58464
|
+
async () => discoverSelfhostLogGroups(region)
|
|
58465
|
+
);
|
|
58466
|
+
const groups = selectGroups(allGroups, options.source);
|
|
58467
|
+
progress.stop();
|
|
58468
|
+
if (!(metadata?.services?.selfhost || json)) {
|
|
58469
|
+
clack51.log.warn(
|
|
58470
|
+
"No self-hosted deployment recorded on this machine \u2014 reading log groups directly from AWS."
|
|
58471
|
+
);
|
|
58472
|
+
}
|
|
58473
|
+
if (allGroups.length === 0) {
|
|
58474
|
+
throw errors.noSelfhostLogGroups(region);
|
|
58475
|
+
}
|
|
58476
|
+
if (groups.length === 0) {
|
|
58477
|
+
throw errors.noLogGroupsForSource(
|
|
58478
|
+
options.source ?? "all",
|
|
58479
|
+
[...new Set(allGroups.map((group3) => group3.source))].join(", ")
|
|
58480
|
+
);
|
|
58481
|
+
}
|
|
58482
|
+
const filterPattern = options.filter ?? (options.errors ? ERROR_FILTER_PATTERN : void 0);
|
|
58483
|
+
const refineOptions = {
|
|
58484
|
+
errorsOnly: Boolean(options.errors),
|
|
58485
|
+
platform: Boolean(options.platform)
|
|
58486
|
+
};
|
|
58487
|
+
const sourceWidth = Math.max(
|
|
58488
|
+
...groups.map((group3) => logSourceLabel(group3.source).length)
|
|
58489
|
+
);
|
|
58490
|
+
const renderOptions = {
|
|
58491
|
+
sourceWidth,
|
|
58492
|
+
verbose: Boolean(options.verbose)
|
|
58493
|
+
};
|
|
58494
|
+
const emit = (entries) => {
|
|
58495
|
+
for (const entry of entries) {
|
|
58496
|
+
console.log(
|
|
58497
|
+
json ? JSON.stringify(toJsonEntry(entry)) : renderEntry(entry, renderOptions)
|
|
58498
|
+
);
|
|
58499
|
+
}
|
|
58500
|
+
};
|
|
58501
|
+
const context = {
|
|
58502
|
+
region,
|
|
58503
|
+
groups,
|
|
58504
|
+
filterPattern,
|
|
58505
|
+
refineOptions,
|
|
58506
|
+
emit,
|
|
58507
|
+
json,
|
|
58508
|
+
live: Boolean(options.live),
|
|
58509
|
+
intervalSeconds
|
|
58510
|
+
};
|
|
58511
|
+
if (options.follow) {
|
|
58512
|
+
await follow(context);
|
|
58513
|
+
return;
|
|
58514
|
+
}
|
|
58515
|
+
await printWindow(context, {
|
|
58516
|
+
sinceMs,
|
|
58517
|
+
sinceLabel: options.since ?? DEFAULT_SINCE,
|
|
58518
|
+
errorsOnly: refineOptions.errorsOnly
|
|
58519
|
+
});
|
|
58520
|
+
}
|
|
58521
|
+
async function printWindow(context, window) {
|
|
58522
|
+
const entries = refine(
|
|
58523
|
+
await fetchLogs({
|
|
58524
|
+
region: context.region,
|
|
58525
|
+
groups: context.groups,
|
|
58526
|
+
startTime: Date.now() - window.sinceMs,
|
|
58527
|
+
filterPattern: context.filterPattern,
|
|
58528
|
+
maxEntries: MAX_ENTRIES
|
|
58529
|
+
}),
|
|
58530
|
+
context.refineOptions
|
|
58531
|
+
);
|
|
58532
|
+
if (context.json) {
|
|
58533
|
+
jsonSuccess("selfhost.logs", {
|
|
58534
|
+
region: context.region,
|
|
58535
|
+
groups: context.groups.map((group3) => ({
|
|
58536
|
+
name: group3.name,
|
|
58537
|
+
source: group3.source
|
|
58538
|
+
})),
|
|
58539
|
+
entries: entries.map(toJsonEntry)
|
|
58540
|
+
});
|
|
58541
|
+
return;
|
|
58542
|
+
}
|
|
58543
|
+
printGroupSummary(context.groups);
|
|
58544
|
+
console.log("");
|
|
58545
|
+
if (entries.length === 0) {
|
|
58546
|
+
clack51.log.info(
|
|
58547
|
+
window.errorsOnly ? `No errors in the last ${window.sinceLabel}.` : `No log events in the last ${window.sinceLabel}.`
|
|
58548
|
+
);
|
|
58549
|
+
clack51.outro(pc54.dim("Nothing to report"));
|
|
58550
|
+
return;
|
|
58551
|
+
}
|
|
58552
|
+
context.emit(entries);
|
|
58553
|
+
console.log("");
|
|
58554
|
+
if (entries.length >= MAX_ENTRIES) {
|
|
58555
|
+
clack51.log.warn(
|
|
58556
|
+
`Showing the most recent ${MAX_ENTRIES} events \u2014 narrow the window with ${pc54.cyan("--since")} to see more.`
|
|
58557
|
+
);
|
|
58558
|
+
}
|
|
58559
|
+
clack51.outro(
|
|
58560
|
+
pc54.dim(
|
|
58561
|
+
`${entries.length} event${entries.length === 1 ? "" : "s"} from the last ${window.sinceLabel}`
|
|
58562
|
+
)
|
|
58563
|
+
);
|
|
58564
|
+
}
|
|
58565
|
+
function printFollowHeader(context) {
|
|
58566
|
+
printGroupSummary(context.groups);
|
|
58567
|
+
if (context.live) {
|
|
58568
|
+
console.log(
|
|
58569
|
+
pc54.yellow(
|
|
58570
|
+
"\u26A0 CloudWatch Live Tail bills ~$0.01/min for as long as this session is open."
|
|
58571
|
+
)
|
|
58572
|
+
);
|
|
58573
|
+
console.log(
|
|
58574
|
+
pc54.dim(`Live tailing \xB7 ${pc54.reset(pc54.bold("Ctrl+C"))} to stop`)
|
|
58575
|
+
);
|
|
58576
|
+
} else {
|
|
58577
|
+
console.log(
|
|
58578
|
+
pc54.dim(
|
|
58579
|
+
`Polling every ${context.intervalSeconds}s \xB7 ${pc54.reset(pc54.bold("Ctrl+C"))} to stop`
|
|
58580
|
+
)
|
|
58581
|
+
);
|
|
58582
|
+
}
|
|
58583
|
+
console.log("");
|
|
58584
|
+
}
|
|
58585
|
+
async function follow(context) {
|
|
58586
|
+
let stopped = false;
|
|
58587
|
+
const timer = createInterruptibleSleep();
|
|
58588
|
+
let abortStream = null;
|
|
58589
|
+
const onSigint = () => {
|
|
58590
|
+
stopped = true;
|
|
58591
|
+
abortStream?.();
|
|
58592
|
+
timer.interrupt();
|
|
58593
|
+
};
|
|
58594
|
+
process.on("SIGINT", onSigint);
|
|
58595
|
+
try {
|
|
58596
|
+
if (!context.json) {
|
|
58597
|
+
printFollowHeader(context);
|
|
58598
|
+
}
|
|
58599
|
+
context.emit(
|
|
58600
|
+
refine(
|
|
58601
|
+
await fetchLogs({
|
|
58602
|
+
region: context.region,
|
|
58603
|
+
groups: context.groups,
|
|
58604
|
+
startTime: Date.now() - FOLLOW_BACKFILL_MS,
|
|
58605
|
+
filterPattern: context.filterPattern,
|
|
58606
|
+
maxEntries: MAX_ENTRIES
|
|
58607
|
+
}),
|
|
58608
|
+
context.refineOptions
|
|
58609
|
+
)
|
|
58610
|
+
);
|
|
58611
|
+
if (context.live) {
|
|
58612
|
+
await runLiveTail(context, {
|
|
58613
|
+
isStopped: () => stopped,
|
|
58614
|
+
onSession: (abort) => {
|
|
58615
|
+
abortStream = abort;
|
|
58616
|
+
}
|
|
58617
|
+
});
|
|
58618
|
+
} else {
|
|
58619
|
+
await runPolling(context, {
|
|
58620
|
+
isStopped: () => stopped,
|
|
58621
|
+
sleep: timer.sleep
|
|
58622
|
+
});
|
|
58623
|
+
}
|
|
58624
|
+
} finally {
|
|
58625
|
+
process.off("SIGINT", onSigint);
|
|
58626
|
+
}
|
|
58627
|
+
if (!context.json) {
|
|
58628
|
+
console.log("");
|
|
58629
|
+
clack51.outro(pc54.dim("Stopped"));
|
|
58630
|
+
}
|
|
58631
|
+
}
|
|
58632
|
+
async function runLiveTail(context, control) {
|
|
58633
|
+
if (context.groups.length > liveTailGroupLimit() && !context.json) {
|
|
58634
|
+
clack51.log.warn(
|
|
58635
|
+
`Live Tail supports ${liveTailGroupLimit()} log groups per session \u2014 tailing the first ${liveTailGroupLimit()}. Use ${pc54.cyan("--source")} to choose which.`
|
|
58636
|
+
);
|
|
58637
|
+
}
|
|
58638
|
+
const session = startSelfhostLiveTail({
|
|
58639
|
+
region: context.region,
|
|
58640
|
+
groups: context.groups,
|
|
58641
|
+
filterPattern: context.filterPattern
|
|
58642
|
+
});
|
|
58643
|
+
control.onSession(session.abort);
|
|
58644
|
+
try {
|
|
58645
|
+
for await (const batch of session.stream) {
|
|
58646
|
+
context.emit(refine(batch, context.refineOptions));
|
|
58647
|
+
}
|
|
58648
|
+
} catch (error) {
|
|
58649
|
+
if (!(control.isStopped() && isAbortError(error))) {
|
|
58650
|
+
throw error;
|
|
58651
|
+
}
|
|
58652
|
+
return;
|
|
58653
|
+
}
|
|
58654
|
+
if (!(control.isStopped() || context.json)) {
|
|
58655
|
+
clack51.log.warn(
|
|
58656
|
+
`Live Tail session ended (AWS caps sessions at ~3 hours). Run ${pc54.cyan("wraps selfhost logs --follow --live")} again to resume.`
|
|
58657
|
+
);
|
|
58658
|
+
}
|
|
58659
|
+
}
|
|
58660
|
+
async function runPolling(context, control) {
|
|
58661
|
+
const poll = createLogPoller({
|
|
58662
|
+
region: context.region,
|
|
58663
|
+
groups: context.groups,
|
|
58664
|
+
filterPattern: context.filterPattern,
|
|
58665
|
+
since: Date.now()
|
|
58666
|
+
});
|
|
58667
|
+
while (!control.isStopped()) {
|
|
58668
|
+
await control.sleep(context.intervalSeconds * 1e3);
|
|
58669
|
+
if (control.isStopped()) {
|
|
58670
|
+
break;
|
|
58671
|
+
}
|
|
58672
|
+
context.emit(refine(await poll(), context.refineOptions));
|
|
58673
|
+
}
|
|
58674
|
+
}
|
|
58675
|
+
function isAbortError(error) {
|
|
58676
|
+
return error instanceof Error && (error.name === "AbortError" || error.message.includes("aborted"));
|
|
58677
|
+
}
|
|
58678
|
+
|
|
58679
|
+
// src/commands/selfhost/status.ts
|
|
58680
|
+
init_esm_shims();
|
|
58681
|
+
init_events();
|
|
58682
|
+
import * as clack52 from "@clack/prompts";
|
|
58683
|
+
import pc55 from "picocolors";
|
|
57955
58684
|
init_aws();
|
|
57956
58685
|
init_json_output();
|
|
57957
58686
|
init_metadata();
|
|
@@ -57961,39 +58690,39 @@ function displaySelfhostStatus(options) {
|
|
|
57961
58690
|
const lines = [];
|
|
57962
58691
|
const incomplete = !(options.apiUrl && options.appUrl);
|
|
57963
58692
|
lines.push(
|
|
57964
|
-
incomplete ?
|
|
58693
|
+
incomplete ? pc55.bold(pc55.yellow("Self-Hosted Control Plane Incomplete")) : pc55.bold(pc55.green("Self-Hosted Control Plane Active"))
|
|
57965
58694
|
);
|
|
57966
58695
|
if (incomplete) {
|
|
57967
58696
|
lines.push(
|
|
57968
|
-
|
|
57969
|
-
`A previous deploy did not finish. Run ${
|
|
58697
|
+
pc55.yellow(
|
|
58698
|
+
`A previous deploy did not finish. Run ${pc55.cyan("pnpm selfhost:upgrade")} from your fork to complete it.`
|
|
57970
58699
|
)
|
|
57971
58700
|
);
|
|
57972
58701
|
}
|
|
57973
58702
|
lines.push("");
|
|
57974
|
-
lines.push(
|
|
57975
|
-
lines.push(` URL: ${
|
|
57976
|
-
lines.push(` Region: ${
|
|
57977
|
-
lines.push(` Deployed: ${
|
|
58703
|
+
lines.push(pc55.bold("API"));
|
|
58704
|
+
lines.push(` URL: ${pc55.cyan(options.apiUrl || "(not deployed)")}`);
|
|
58705
|
+
lines.push(` Region: ${pc55.cyan(options.region)}`);
|
|
58706
|
+
lines.push(` Deployed: ${pc55.dim(options.deployedAt)}`);
|
|
57978
58707
|
if (options.variant) {
|
|
57979
58708
|
lines.push(
|
|
57980
|
-
` Type: ${
|
|
58709
|
+
` Type: ${pc55.cyan(options.variant === "sst" ? "Full platform (SST, deployed from fork)" : "API-only control plane (CLI)")}`
|
|
57981
58710
|
);
|
|
57982
58711
|
}
|
|
57983
58712
|
lines.push("");
|
|
57984
|
-
lines.push(
|
|
57985
|
-
lines.push(` App URL: ${
|
|
57986
|
-
lines.push(` License Key: ${
|
|
58713
|
+
lines.push(pc55.bold("Configuration"));
|
|
58714
|
+
lines.push(` App URL: ${pc55.cyan(options.appUrl || "(not deployed)")}`);
|
|
58715
|
+
lines.push(` License Key: ${pc55.dim(`${options.licenseKeyPrefix}...`)}`);
|
|
57987
58716
|
if (options.neonProjectId) {
|
|
57988
|
-
lines.push(` Neon Project: ${
|
|
58717
|
+
lines.push(` Neon Project: ${pc55.dim(options.neonProjectId)}`);
|
|
57989
58718
|
}
|
|
57990
|
-
|
|
58719
|
+
clack52.note(lines.join("\n"), "Self-Hosted Status");
|
|
57991
58720
|
}
|
|
57992
58721
|
async function selfhostStatus(options) {
|
|
57993
58722
|
const startTime = Date.now();
|
|
57994
58723
|
const progress = new DeploymentProgress();
|
|
57995
58724
|
if (!isJsonMode()) {
|
|
57996
|
-
|
|
58725
|
+
clack52.intro(pc55.bold("Wraps Self-Hosted Status"));
|
|
57997
58726
|
}
|
|
57998
58727
|
const identity = await progress.execute(
|
|
57999
58728
|
"Loading self-hosted status",
|
|
@@ -58008,11 +58737,11 @@ async function selfhostStatus(options) {
|
|
|
58008
58737
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
58009
58738
|
if (!metadata?.services?.selfhost) {
|
|
58010
58739
|
progress.stop();
|
|
58011
|
-
|
|
58740
|
+
clack52.log.error("No self-hosted deployment found");
|
|
58012
58741
|
console.log(
|
|
58013
58742
|
`
|
|
58014
|
-
Run ${
|
|
58015
|
-
or ${
|
|
58743
|
+
Run ${pc55.cyan("pnpm selfhost:deploy")} from your fork to deploy the full platform (API + dashboard),
|
|
58744
|
+
or ${pc55.cyan("wraps selfhost deploy")} for the API-only control plane.
|
|
58016
58745
|
`
|
|
58017
58746
|
);
|
|
58018
58747
|
process.exit(1);
|
|
@@ -58045,15 +58774,15 @@ or ${pc54.cyan("wraps selfhost deploy")} for the API-only control plane.
|
|
|
58045
58774
|
}
|
|
58046
58775
|
displaySelfhostStatus(statusData);
|
|
58047
58776
|
console.log("");
|
|
58048
|
-
|
|
58777
|
+
clack52.log.info(pc55.bold("Commands:"));
|
|
58049
58778
|
console.log(
|
|
58050
|
-
variant === "sst" ? ` ${
|
|
58779
|
+
variant === "sst" ? ` ${pc55.cyan("pnpm selfhost:upgrade")} (from your fork) - Redeploy the platform and run migrations` : ` ${pc55.cyan("wraps selfhost upgrade")} - Rebuild and redeploy the API Lambda`
|
|
58051
58780
|
);
|
|
58052
58781
|
trackCommand("selfhost:status", {
|
|
58053
58782
|
success: true,
|
|
58054
58783
|
duration_ms: Date.now() - startTime
|
|
58055
58784
|
});
|
|
58056
|
-
|
|
58785
|
+
clack52.outro(pc55.dim("Self-hosted deployment is active"));
|
|
58057
58786
|
}
|
|
58058
58787
|
|
|
58059
58788
|
// src/commands/selfhost/upgrade.ts
|
|
@@ -58061,9 +58790,9 @@ init_esm_shims();
|
|
|
58061
58790
|
import { existsSync as existsSync19 } from "fs";
|
|
58062
58791
|
import { dirname as dirname7, join as join24 } from "path";
|
|
58063
58792
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
58064
|
-
import * as
|
|
58793
|
+
import * as clack53 from "@clack/prompts";
|
|
58065
58794
|
import * as pulumi30 from "@pulumi/pulumi";
|
|
58066
|
-
import
|
|
58795
|
+
import pc56 from "picocolors";
|
|
58067
58796
|
init_events();
|
|
58068
58797
|
init_aws();
|
|
58069
58798
|
init_errors();
|
|
@@ -58079,7 +58808,7 @@ var bundledLambdaZip2 = join24(cliDir2, "api-lambda.zip");
|
|
|
58079
58808
|
async function selfhostUpgrade(options) {
|
|
58080
58809
|
const startTime = Date.now();
|
|
58081
58810
|
if (!isJsonMode()) {
|
|
58082
|
-
|
|
58811
|
+
clack53.intro(pc56.bold("Wraps Self-Hosted Control Plane Upgrade"));
|
|
58083
58812
|
}
|
|
58084
58813
|
const progress = new DeploymentProgress();
|
|
58085
58814
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -58094,7 +58823,7 @@ async function selfhostUpgrade(options) {
|
|
|
58094
58823
|
async () => validateAWSCredentialsWithDetails()
|
|
58095
58824
|
);
|
|
58096
58825
|
const identity = credentialResult.identity;
|
|
58097
|
-
progress.info(`Connected to AWS account: ${
|
|
58826
|
+
progress.info(`Connected to AWS account: ${pc56.cyan(identity.accountId)}`);
|
|
58098
58827
|
const region = await resolveRegionForCommand({
|
|
58099
58828
|
accountId: identity.accountId,
|
|
58100
58829
|
optionRegion: options.region,
|
|
@@ -58103,20 +58832,20 @@ async function selfhostUpgrade(options) {
|
|
|
58103
58832
|
});
|
|
58104
58833
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
58105
58834
|
if (!metadata?.services?.selfhost) {
|
|
58106
|
-
|
|
58107
|
-
|
|
58835
|
+
clack53.log.error("No self-hosted deployment found.");
|
|
58836
|
+
clack53.log.info(`Run ${pc56.cyan("wraps selfhost deploy")} first.`);
|
|
58108
58837
|
process.exit(1);
|
|
58109
58838
|
}
|
|
58110
58839
|
const selfhostService = metadata.services.selfhost;
|
|
58111
58840
|
progress.info(`Found deployment from: ${selfhostService.deployedAt}`);
|
|
58112
|
-
progress.info(`API URL: ${
|
|
58841
|
+
progress.info(`API URL: ${pc56.cyan(selfhostService.apiUrl)}`);
|
|
58113
58842
|
if (!(options.yes || options.preview)) {
|
|
58114
|
-
const confirmed = await
|
|
58115
|
-
message: `Upgrade self-hosted deployment in ${
|
|
58843
|
+
const confirmed = await clack53.confirm({
|
|
58844
|
+
message: `Upgrade self-hosted deployment in ${pc56.cyan(identity.accountId)} / ${pc56.cyan(region)}?`,
|
|
58116
58845
|
initialValue: true
|
|
58117
58846
|
});
|
|
58118
|
-
if (
|
|
58119
|
-
|
|
58847
|
+
if (clack53.isCancel(confirmed) || !confirmed) {
|
|
58848
|
+
clack53.cancel("Upgrade cancelled.");
|
|
58120
58849
|
process.exit(0);
|
|
58121
58850
|
}
|
|
58122
58851
|
}
|
|
@@ -58190,8 +58919,8 @@ async function selfhostUpgrade(options) {
|
|
|
58190
58919
|
resourceChanges: previewResult.resourceChanges,
|
|
58191
58920
|
commandName: "wraps selfhost upgrade"
|
|
58192
58921
|
});
|
|
58193
|
-
|
|
58194
|
-
|
|
58922
|
+
clack53.outro(
|
|
58923
|
+
pc56.green("Preview complete. Run without --preview to upgrade.")
|
|
58195
58924
|
);
|
|
58196
58925
|
return;
|
|
58197
58926
|
} catch (error) {
|
|
@@ -58267,28 +58996,28 @@ async function selfhostUpgrade(options) {
|
|
|
58267
58996
|
}
|
|
58268
58997
|
progress.info("Deployment metadata updated");
|
|
58269
58998
|
console.log("\n");
|
|
58270
|
-
|
|
58999
|
+
clack53.log.success(pc56.green(pc56.bold("Self-hosted Wraps API upgraded!")));
|
|
58271
59000
|
console.log("\n");
|
|
58272
|
-
|
|
59001
|
+
clack53.note(
|
|
58273
59002
|
[
|
|
58274
|
-
`${
|
|
58275
|
-
`${
|
|
58276
|
-
`${
|
|
59003
|
+
`${pc56.bold("API URL:")} ${pc56.cyan(outputs.apiUrl || selfhostService.apiUrl)}`,
|
|
59004
|
+
`${pc56.bold("Region:")} ${pc56.cyan(region)}`,
|
|
59005
|
+
`${pc56.bold("Lambda ARN:")} ${pc56.dim(outputs.lambdaArn)}`
|
|
58277
59006
|
].join("\n"),
|
|
58278
59007
|
"Self-Hosted Deployment"
|
|
58279
59008
|
);
|
|
58280
|
-
|
|
58281
|
-
|
|
59009
|
+
clack53.outro(
|
|
59010
|
+
pc56.green(`Upgraded in ${((Date.now() - startTime) / 1e3).toFixed(1)}s`)
|
|
58282
59011
|
);
|
|
58283
59012
|
}
|
|
58284
59013
|
|
|
58285
59014
|
// src/commands/shared/dashboard.ts
|
|
58286
59015
|
init_esm_shims();
|
|
58287
|
-
import * as
|
|
59016
|
+
import * as clack54 from "@clack/prompts";
|
|
58288
59017
|
import * as pulumi31 from "@pulumi/pulumi";
|
|
58289
59018
|
import getPort from "get-port";
|
|
58290
59019
|
import open3 from "open";
|
|
58291
|
-
import
|
|
59020
|
+
import pc57 from "picocolors";
|
|
58292
59021
|
|
|
58293
59022
|
// src/console/server.ts
|
|
58294
59023
|
init_esm_shims();
|
|
@@ -59488,13 +60217,13 @@ function createMetricsRouter(config2) {
|
|
|
59488
60217
|
const router = createRouter5();
|
|
59489
60218
|
router.get("/stream", async (req, res) => {
|
|
59490
60219
|
const connectionId = randomUUID().slice(0, 8);
|
|
59491
|
-
const
|
|
60220
|
+
const log64 = (msg, data) => {
|
|
59492
60221
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
59493
60222
|
};
|
|
59494
60223
|
res.setHeader("Content-Type", "text/event-stream");
|
|
59495
60224
|
res.setHeader("Cache-Control", "no-cache");
|
|
59496
60225
|
res.setHeader("Connection", "keep-alive");
|
|
59497
|
-
|
|
60226
|
+
log64("SSE connected");
|
|
59498
60227
|
res.write('data: {"type":"connected"}\n\n');
|
|
59499
60228
|
const { startTime, endTime } = req.query;
|
|
59500
60229
|
const getTimeRange = () => ({
|
|
@@ -59504,7 +60233,7 @@ function createMetricsRouter(config2) {
|
|
|
59504
60233
|
const sendMetrics = async () => {
|
|
59505
60234
|
try {
|
|
59506
60235
|
const timeRange = getTimeRange();
|
|
59507
|
-
|
|
60236
|
+
log64("Fetching metrics", {
|
|
59508
60237
|
start: timeRange.start.toISOString(),
|
|
59509
60238
|
end: timeRange.end.toISOString()
|
|
59510
60239
|
});
|
|
@@ -59517,7 +60246,7 @@ function createMetricsRouter(config2) {
|
|
|
59517
60246
|
),
|
|
59518
60247
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
59519
60248
|
]);
|
|
59520
|
-
|
|
60249
|
+
log64("Metrics fetched successfully");
|
|
59521
60250
|
const data = {
|
|
59522
60251
|
type: "metrics",
|
|
59523
60252
|
timestamp: Date.now(),
|
|
@@ -59547,7 +60276,7 @@ function createMetricsRouter(config2) {
|
|
|
59547
60276
|
const interval = setInterval(sendMetrics, 6e4);
|
|
59548
60277
|
req.on("close", () => {
|
|
59549
60278
|
clearInterval(interval);
|
|
59550
|
-
|
|
60279
|
+
log64("SSE disconnected");
|
|
59551
60280
|
});
|
|
59552
60281
|
});
|
|
59553
60282
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -60942,7 +61671,7 @@ init_output();
|
|
|
60942
61671
|
init_pulumi();
|
|
60943
61672
|
async function dashboard(options) {
|
|
60944
61673
|
await ensurePulumiInstalled();
|
|
60945
|
-
|
|
61674
|
+
clack54.intro(pc57.bold("Wraps Dashboard"));
|
|
60946
61675
|
const progress = new DeploymentProgress();
|
|
60947
61676
|
const identity = await progress.execute(
|
|
60948
61677
|
"Validating AWS credentials",
|
|
@@ -60983,9 +61712,9 @@ async function dashboard(options) {
|
|
|
60983
61712
|
}
|
|
60984
61713
|
} catch (_error) {
|
|
60985
61714
|
progress.stop();
|
|
60986
|
-
|
|
61715
|
+
clack54.log.error("No Wraps infrastructure found");
|
|
60987
61716
|
console.log(
|
|
60988
|
-
`\\nRun ${
|
|
61717
|
+
`\\nRun ${pc57.cyan("wraps email init")}, ${pc57.cyan("wraps sms init")}, or ${pc57.cyan("wraps storage init")} to deploy infrastructure first.\\n`
|
|
60989
61718
|
);
|
|
60990
61719
|
process.exit(1);
|
|
60991
61720
|
}
|
|
@@ -61027,9 +61756,9 @@ async function dashboard(options) {
|
|
|
61027
61756
|
}
|
|
61028
61757
|
const port = options.port || await getPort({ port: [5555, 5556, 5557, 5558, 5559] });
|
|
61029
61758
|
progress.stop();
|
|
61030
|
-
|
|
61759
|
+
clack54.log.success("Starting dashboard server...");
|
|
61031
61760
|
console.log(
|
|
61032
|
-
`${
|
|
61761
|
+
`${pc57.dim("Using current AWS credentials (no role assumption)")}\\n`
|
|
61033
61762
|
);
|
|
61034
61763
|
const { url } = await startConsoleServer({
|
|
61035
61764
|
port,
|
|
@@ -61062,8 +61791,8 @@ async function dashboard(options) {
|
|
|
61062
61791
|
cdnCustomDomain,
|
|
61063
61792
|
cdnCertificateArn
|
|
61064
61793
|
});
|
|
61065
|
-
console.log(`\\n${
|
|
61066
|
-
console.log(`${
|
|
61794
|
+
console.log(`\\n${pc57.bold("Dashboard:")} ${pc57.cyan(url)}`);
|
|
61795
|
+
console.log(`${pc57.dim("Press Ctrl+C to stop")}\\n`);
|
|
61067
61796
|
getTelemetryClient().showFooterOnce();
|
|
61068
61797
|
if (!options.noOpen) {
|
|
61069
61798
|
await open3(url);
|
|
@@ -61084,8 +61813,8 @@ init_aws();
|
|
|
61084
61813
|
init_errors();
|
|
61085
61814
|
init_json_output();
|
|
61086
61815
|
init_metadata();
|
|
61087
|
-
import * as
|
|
61088
|
-
import
|
|
61816
|
+
import * as clack55 from "@clack/prompts";
|
|
61817
|
+
import pc58 from "picocolors";
|
|
61089
61818
|
async function destroy(options) {
|
|
61090
61819
|
trackCommand("destroy", { success: true });
|
|
61091
61820
|
if (isJsonMode() && !options.force) {
|
|
@@ -61096,9 +61825,9 @@ async function destroy(options) {
|
|
|
61096
61825
|
);
|
|
61097
61826
|
}
|
|
61098
61827
|
if (!isJsonMode()) {
|
|
61099
|
-
|
|
61828
|
+
clack55.intro(pc58.bold("Wraps Infrastructure Teardown"));
|
|
61100
61829
|
}
|
|
61101
|
-
const spinner11 =
|
|
61830
|
+
const spinner11 = clack55.spinner();
|
|
61102
61831
|
spinner11.start("Validating AWS credentials");
|
|
61103
61832
|
let identity;
|
|
61104
61833
|
try {
|
|
@@ -61115,17 +61844,17 @@ async function destroy(options) {
|
|
|
61115
61844
|
deployedServices.push("email");
|
|
61116
61845
|
}
|
|
61117
61846
|
if (deployedServices.length === 0) {
|
|
61118
|
-
|
|
61847
|
+
clack55.log.warn("No Wraps services found in this region");
|
|
61119
61848
|
console.log(
|
|
61120
61849
|
`
|
|
61121
|
-
Run ${
|
|
61850
|
+
Run ${pc58.cyan("wraps email init")} to deploy infrastructure.
|
|
61122
61851
|
`
|
|
61123
61852
|
);
|
|
61124
61853
|
process.exit(0);
|
|
61125
61854
|
}
|
|
61126
61855
|
if (deployedServices.length === 1) {
|
|
61127
61856
|
const service = deployedServices[0];
|
|
61128
|
-
|
|
61857
|
+
clack55.log.info(`Found ${pc58.cyan(service)} service deployed`);
|
|
61129
61858
|
if (service === "email") {
|
|
61130
61859
|
await emailDestroy(options);
|
|
61131
61860
|
return;
|
|
@@ -61140,7 +61869,7 @@ Run ${pc57.cyan("wraps email init")} to deploy infrastructure.
|
|
|
61140
61869
|
jsonSuccess("destroy", { destroyed: true });
|
|
61141
61870
|
return;
|
|
61142
61871
|
}
|
|
61143
|
-
const serviceToDestroy = await
|
|
61872
|
+
const serviceToDestroy = await clack55.select({
|
|
61144
61873
|
message: "Which service would you like to destroy?",
|
|
61145
61874
|
options: [
|
|
61146
61875
|
...deployedServices.map((s2) => ({
|
|
@@ -61155,15 +61884,15 @@ Run ${pc57.cyan("wraps email init")} to deploy infrastructure.
|
|
|
61155
61884
|
}
|
|
61156
61885
|
]
|
|
61157
61886
|
});
|
|
61158
|
-
if (
|
|
61159
|
-
|
|
61887
|
+
if (clack55.isCancel(serviceToDestroy)) {
|
|
61888
|
+
clack55.cancel("Operation cancelled.");
|
|
61160
61889
|
process.exit(0);
|
|
61161
61890
|
}
|
|
61162
61891
|
if ((serviceToDestroy === "email" || serviceToDestroy === "all") && deployedServices.includes("email")) {
|
|
61163
61892
|
await emailDestroy(options);
|
|
61164
61893
|
}
|
|
61165
61894
|
if (serviceToDestroy === "all") {
|
|
61166
|
-
|
|
61895
|
+
clack55.outro(pc58.green("All Wraps infrastructure has been removed"));
|
|
61167
61896
|
}
|
|
61168
61897
|
}
|
|
61169
61898
|
|
|
@@ -61175,26 +61904,26 @@ init_fs();
|
|
|
61175
61904
|
init_json_output();
|
|
61176
61905
|
init_output();
|
|
61177
61906
|
init_pulumi();
|
|
61178
|
-
import * as
|
|
61907
|
+
import * as clack56 from "@clack/prompts";
|
|
61179
61908
|
import * as pulumi32 from "@pulumi/pulumi";
|
|
61180
|
-
import
|
|
61909
|
+
import pc59 from "picocolors";
|
|
61181
61910
|
async function status(options) {
|
|
61182
61911
|
await ensurePulumiInstalled();
|
|
61183
61912
|
const startTime = Date.now();
|
|
61184
61913
|
const progress = new DeploymentProgress();
|
|
61185
61914
|
if (!isJsonMode()) {
|
|
61186
|
-
|
|
61915
|
+
clack56.intro(pc59.bold("Wraps Infrastructure Status"));
|
|
61187
61916
|
}
|
|
61188
61917
|
const identity = await progress.execute(
|
|
61189
61918
|
"Loading infrastructure status",
|
|
61190
61919
|
async () => validateAWSCredentials()
|
|
61191
61920
|
);
|
|
61192
61921
|
if (!isJsonMode()) {
|
|
61193
|
-
progress.info(`AWS Account: ${
|
|
61922
|
+
progress.info(`AWS Account: ${pc59.cyan(identity.accountId)}`);
|
|
61194
61923
|
}
|
|
61195
61924
|
const region = options.region || await getAWSRegion();
|
|
61196
61925
|
if (!isJsonMode()) {
|
|
61197
|
-
progress.info(`Region: ${
|
|
61926
|
+
progress.info(`Region: ${pc59.cyan(region)}`);
|
|
61198
61927
|
}
|
|
61199
61928
|
const services = [];
|
|
61200
61929
|
try {
|
|
@@ -61246,35 +61975,35 @@ async function status(options) {
|
|
|
61246
61975
|
return;
|
|
61247
61976
|
}
|
|
61248
61977
|
console.log();
|
|
61249
|
-
|
|
61978
|
+
clack56.note(
|
|
61250
61979
|
services.map((s2) => {
|
|
61251
61980
|
if (s2.status === "deployed") {
|
|
61252
|
-
const details = s2.details ?
|
|
61253
|
-
return ` ${
|
|
61981
|
+
const details = s2.details ? pc59.dim(` (${s2.details})`) : "";
|
|
61982
|
+
return ` ${pc59.green("\u2713")} ${s2.name}${details}`;
|
|
61254
61983
|
}
|
|
61255
|
-
return ` ${
|
|
61984
|
+
return ` ${pc59.dim("\u25CB")} ${s2.name} ${pc59.dim("(not deployed)")}`;
|
|
61256
61985
|
}).join("\n"),
|
|
61257
61986
|
"Services"
|
|
61258
61987
|
);
|
|
61259
61988
|
const hasDeployedServices = services.some((s2) => s2.status === "deployed");
|
|
61260
61989
|
if (hasDeployedServices) {
|
|
61261
61990
|
console.log(`
|
|
61262
|
-
${
|
|
61991
|
+
${pc59.bold("Details:")}`);
|
|
61263
61992
|
if (services.find((s2) => s2.name === "Email")?.status === "deployed") {
|
|
61264
|
-
console.log(` ${
|
|
61993
|
+
console.log(` ${pc59.dim("Email:")} ${pc59.cyan("wraps email status")}`);
|
|
61265
61994
|
}
|
|
61266
61995
|
if (services.find((s2) => s2.name === "SMS")?.status === "deployed") {
|
|
61267
|
-
console.log(` ${
|
|
61996
|
+
console.log(` ${pc59.dim("SMS:")} ${pc59.cyan("wraps sms status")}`);
|
|
61268
61997
|
}
|
|
61269
61998
|
} else {
|
|
61270
61999
|
console.log(`
|
|
61271
|
-
${
|
|
61272
|
-
console.log(` ${
|
|
61273
|
-
console.log(` ${
|
|
62000
|
+
${pc59.bold("Get started:")}`);
|
|
62001
|
+
console.log(` ${pc59.dim("Deploy email:")} ${pc59.cyan("wraps email init")}`);
|
|
62002
|
+
console.log(` ${pc59.dim("Deploy SMS:")} ${pc59.cyan("wraps sms init")}`);
|
|
61274
62003
|
}
|
|
61275
62004
|
console.log(`
|
|
61276
|
-
${
|
|
61277
|
-
console.log(`${
|
|
62005
|
+
${pc59.bold("Dashboard:")} ${pc59.blue("https://app.wraps.dev")}`);
|
|
62006
|
+
console.log(`${pc59.bold("Docs:")} ${pc59.blue("https://wraps.dev/docs")}
|
|
61278
62007
|
`);
|
|
61279
62008
|
trackCommand("status", {
|
|
61280
62009
|
success: true,
|
|
@@ -61285,9 +62014,9 @@ ${pc58.bold("Dashboard:")} ${pc58.blue("https://app.wraps.dev")}`);
|
|
|
61285
62014
|
|
|
61286
62015
|
// src/commands/sms/destroy.ts
|
|
61287
62016
|
init_esm_shims();
|
|
61288
|
-
import * as
|
|
62017
|
+
import * as clack57 from "@clack/prompts";
|
|
61289
62018
|
import * as pulumi34 from "@pulumi/pulumi";
|
|
61290
|
-
import
|
|
62019
|
+
import pc60 from "picocolors";
|
|
61291
62020
|
|
|
61292
62021
|
// src/infrastructure/sms-stack.ts
|
|
61293
62022
|
init_esm_shims();
|
|
@@ -61978,18 +62707,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
61978
62707
|
const existing = await client2.send(
|
|
61979
62708
|
new DescribeProtectConfigurationsCommand({})
|
|
61980
62709
|
);
|
|
61981
|
-
for (const
|
|
61982
|
-
if (!(
|
|
62710
|
+
for (const pc73 of existing.ProtectConfigurations || []) {
|
|
62711
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
61983
62712
|
continue;
|
|
61984
62713
|
}
|
|
61985
62714
|
const tagsResponse = await client2.send(
|
|
61986
62715
|
new ListTagsForResourceCommand({
|
|
61987
|
-
ResourceArn:
|
|
62716
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
61988
62717
|
})
|
|
61989
62718
|
);
|
|
61990
62719
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
61991
62720
|
if (nameTag?.Value === protectConfigName) {
|
|
61992
|
-
existingProtectConfigId =
|
|
62721
|
+
existingProtectConfigId = pc73.ProtectConfigurationId;
|
|
61993
62722
|
break;
|
|
61994
62723
|
}
|
|
61995
62724
|
}
|
|
@@ -62085,13 +62814,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62085
62814
|
new DescribeProtectConfigurationsCommand({})
|
|
62086
62815
|
);
|
|
62087
62816
|
if (existing.ProtectConfigurations) {
|
|
62088
|
-
for (const
|
|
62089
|
-
if (!(
|
|
62817
|
+
for (const pc73 of existing.ProtectConfigurations) {
|
|
62818
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
62090
62819
|
continue;
|
|
62091
62820
|
}
|
|
62092
62821
|
const tagsResponse = await client2.send(
|
|
62093
62822
|
new ListTagsForResourceCommand({
|
|
62094
|
-
ResourceArn:
|
|
62823
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
62095
62824
|
})
|
|
62096
62825
|
);
|
|
62097
62826
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -62100,7 +62829,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62100
62829
|
if (isWrapsManaged) {
|
|
62101
62830
|
await client2.send(
|
|
62102
62831
|
new DeleteProtectConfigurationCommand({
|
|
62103
|
-
ProtectConfigurationId:
|
|
62832
|
+
ProtectConfigurationId: pc73.ProtectConfigurationId
|
|
62104
62833
|
})
|
|
62105
62834
|
);
|
|
62106
62835
|
}
|
|
@@ -62135,8 +62864,8 @@ async function smsDestroy(options) {
|
|
|
62135
62864
|
);
|
|
62136
62865
|
}
|
|
62137
62866
|
if (!isJsonMode()) {
|
|
62138
|
-
|
|
62139
|
-
|
|
62867
|
+
clack57.intro(
|
|
62868
|
+
pc60.bold(
|
|
62140
62869
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
62141
62870
|
)
|
|
62142
62871
|
);
|
|
@@ -62162,15 +62891,15 @@ async function smsDestroy(options) {
|
|
|
62162
62891
|
`Available regions: ${smsConnections.map((c6) => c6.region).join(", ")}`
|
|
62163
62892
|
);
|
|
62164
62893
|
}
|
|
62165
|
-
const selectedRegion = await
|
|
62894
|
+
const selectedRegion = await clack57.select({
|
|
62166
62895
|
message: "Multiple SMS deployments found. Which region to destroy?",
|
|
62167
62896
|
options: smsConnections.map((conn) => ({
|
|
62168
62897
|
value: conn.region,
|
|
62169
62898
|
label: conn.region
|
|
62170
62899
|
}))
|
|
62171
62900
|
});
|
|
62172
|
-
if (
|
|
62173
|
-
|
|
62901
|
+
if (clack57.isCancel(selectedRegion)) {
|
|
62902
|
+
clack57.cancel("Operation cancelled");
|
|
62174
62903
|
process.exit(0);
|
|
62175
62904
|
}
|
|
62176
62905
|
region = selectedRegion;
|
|
@@ -62181,18 +62910,18 @@ async function smsDestroy(options) {
|
|
|
62181
62910
|
const storedStackName = smsService?.pulumiStackName;
|
|
62182
62911
|
if (!smsService) {
|
|
62183
62912
|
progress.stop();
|
|
62184
|
-
|
|
62913
|
+
clack57.log.warn("No SMS infrastructure found");
|
|
62185
62914
|
process.exit(0);
|
|
62186
62915
|
}
|
|
62187
62916
|
if (!(options.force || options.preview)) {
|
|
62188
|
-
const confirmed = await
|
|
62189
|
-
message:
|
|
62917
|
+
const confirmed = await clack57.confirm({
|
|
62918
|
+
message: pc60.red(
|
|
62190
62919
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
62191
62920
|
),
|
|
62192
62921
|
initialValue: false
|
|
62193
62922
|
});
|
|
62194
|
-
if (
|
|
62195
|
-
|
|
62923
|
+
if (clack57.isCancel(confirmed) || !confirmed) {
|
|
62924
|
+
clack57.cancel("Destruction cancelled.");
|
|
62196
62925
|
process.exit(0);
|
|
62197
62926
|
}
|
|
62198
62927
|
}
|
|
@@ -62224,8 +62953,8 @@ async function smsDestroy(options) {
|
|
|
62224
62953
|
costEstimate: "Monthly cost after destruction: $0.00",
|
|
62225
62954
|
commandName: "wraps sms destroy"
|
|
62226
62955
|
});
|
|
62227
|
-
|
|
62228
|
-
|
|
62956
|
+
clack57.outro(
|
|
62957
|
+
pc60.green("Preview complete. Run without --preview to destroy.")
|
|
62229
62958
|
);
|
|
62230
62959
|
trackServiceRemoved("sms", {
|
|
62231
62960
|
preview: true,
|
|
@@ -62236,7 +62965,7 @@ async function smsDestroy(options) {
|
|
|
62236
62965
|
progress.stop();
|
|
62237
62966
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62238
62967
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
62239
|
-
|
|
62968
|
+
clack57.log.warn("No SMS infrastructure found to preview");
|
|
62240
62969
|
process.exit(0);
|
|
62241
62970
|
}
|
|
62242
62971
|
trackError("PREVIEW_FAILED", "sms destroy", { step: "preview" });
|
|
@@ -62285,7 +63014,7 @@ async function smsDestroy(options) {
|
|
|
62285
63014
|
progress.stop();
|
|
62286
63015
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62287
63016
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
62288
|
-
|
|
63017
|
+
clack57.log.warn("No SMS infrastructure found");
|
|
62289
63018
|
if (metadata) {
|
|
62290
63019
|
removeServiceFromConnection(metadata, "sms");
|
|
62291
63020
|
await saveConnectionMetadata(metadata);
|
|
@@ -62298,7 +63027,7 @@ async function smsDestroy(options) {
|
|
|
62298
63027
|
}
|
|
62299
63028
|
trackError("DESTROY_FAILED", "sms destroy", { step: "destroy" });
|
|
62300
63029
|
destroyFailed = true;
|
|
62301
|
-
|
|
63030
|
+
clack57.log.warn(
|
|
62302
63031
|
"Some resources may not have been fully removed. You can re-run this command or clean up manually in the AWS console."
|
|
62303
63032
|
);
|
|
62304
63033
|
}
|
|
@@ -62321,21 +63050,21 @@ async function smsDestroy(options) {
|
|
|
62321
63050
|
return;
|
|
62322
63051
|
}
|
|
62323
63052
|
if (destroyFailed) {
|
|
62324
|
-
|
|
62325
|
-
|
|
63053
|
+
clack57.outro(
|
|
63054
|
+
pc60.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
62326
63055
|
);
|
|
62327
63056
|
} else {
|
|
62328
|
-
|
|
63057
|
+
clack57.outro(pc60.green("SMS infrastructure has been removed"));
|
|
62329
63058
|
console.log(`
|
|
62330
|
-
${
|
|
62331
|
-
console.log(` ${
|
|
62332
|
-
console.log(` ${
|
|
62333
|
-
console.log(` ${
|
|
62334
|
-
console.log(` ${
|
|
63059
|
+
${pc60.bold("Cleaned up:")}`);
|
|
63060
|
+
console.log(` ${pc60.green("\u2713")} Phone number released`);
|
|
63061
|
+
console.log(` ${pc60.green("\u2713")} Configuration set deleted`);
|
|
63062
|
+
console.log(` ${pc60.green("\u2713")} Event processing infrastructure removed`);
|
|
63063
|
+
console.log(` ${pc60.green("\u2713")} IAM role deleted`);
|
|
62335
63064
|
}
|
|
62336
63065
|
console.log(
|
|
62337
63066
|
`
|
|
62338
|
-
Run ${
|
|
63067
|
+
Run ${pc60.cyan("wraps sms init")} to deploy infrastructure again.
|
|
62339
63068
|
`
|
|
62340
63069
|
);
|
|
62341
63070
|
trackServiceRemoved("sms", {
|
|
@@ -62347,9 +63076,9 @@ Run ${pc59.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
62347
63076
|
|
|
62348
63077
|
// src/commands/sms/init.ts
|
|
62349
63078
|
init_esm_shims();
|
|
62350
|
-
import * as
|
|
63079
|
+
import * as clack58 from "@clack/prompts";
|
|
62351
63080
|
import * as pulumi35 from "@pulumi/pulumi";
|
|
62352
|
-
import
|
|
63081
|
+
import pc61 from "picocolors";
|
|
62353
63082
|
init_events();
|
|
62354
63083
|
init_aws();
|
|
62355
63084
|
init_fs();
|
|
@@ -62768,7 +63497,7 @@ function validateSMSConfig(config2) {
|
|
|
62768
63497
|
|
|
62769
63498
|
// src/commands/sms/init.ts
|
|
62770
63499
|
async function promptPhoneNumberType() {
|
|
62771
|
-
const result = await
|
|
63500
|
+
const result = await clack58.select({
|
|
62772
63501
|
message: "Select phone number type:",
|
|
62773
63502
|
options: [
|
|
62774
63503
|
{
|
|
@@ -62788,14 +63517,14 @@ async function promptPhoneNumberType() {
|
|
|
62788
63517
|
}
|
|
62789
63518
|
]
|
|
62790
63519
|
});
|
|
62791
|
-
if (
|
|
62792
|
-
|
|
63520
|
+
if (clack58.isCancel(result)) {
|
|
63521
|
+
clack58.cancel("Operation cancelled.");
|
|
62793
63522
|
process.exit(0);
|
|
62794
63523
|
}
|
|
62795
63524
|
return result;
|
|
62796
63525
|
}
|
|
62797
63526
|
async function promptSMSPreset() {
|
|
62798
|
-
const result = await
|
|
63527
|
+
const result = await clack58.select({
|
|
62799
63528
|
message: "Choose configuration preset:",
|
|
62800
63529
|
options: [
|
|
62801
63530
|
{
|
|
@@ -62820,8 +63549,8 @@ async function promptSMSPreset() {
|
|
|
62820
63549
|
}
|
|
62821
63550
|
]
|
|
62822
63551
|
});
|
|
62823
|
-
if (
|
|
62824
|
-
|
|
63552
|
+
if (clack58.isCancel(result)) {
|
|
63553
|
+
clack58.cancel("Operation cancelled.");
|
|
62825
63554
|
process.exit(0);
|
|
62826
63555
|
}
|
|
62827
63556
|
return result;
|
|
@@ -62841,7 +63570,7 @@ var COMMON_COUNTRIES = [
|
|
|
62841
63570
|
{ code: "IN", name: "India" }
|
|
62842
63571
|
];
|
|
62843
63572
|
async function promptAllowedCountries() {
|
|
62844
|
-
const result = await
|
|
63573
|
+
const result = await clack58.multiselect({
|
|
62845
63574
|
message: "Select countries to allow SMS delivery (blocks all others):",
|
|
62846
63575
|
options: COMMON_COUNTRIES.map((c6) => ({
|
|
62847
63576
|
value: c6.code,
|
|
@@ -62850,14 +63579,14 @@ async function promptAllowedCountries() {
|
|
|
62850
63579
|
initialValues: ["US"],
|
|
62851
63580
|
required: true
|
|
62852
63581
|
});
|
|
62853
|
-
if (
|
|
62854
|
-
|
|
63582
|
+
if (clack58.isCancel(result)) {
|
|
63583
|
+
clack58.cancel("Operation cancelled.");
|
|
62855
63584
|
process.exit(0);
|
|
62856
63585
|
}
|
|
62857
63586
|
return result;
|
|
62858
63587
|
}
|
|
62859
63588
|
async function promptEstimatedSMSVolume() {
|
|
62860
|
-
const result = await
|
|
63589
|
+
const result = await clack58.select({
|
|
62861
63590
|
message: "Estimated messages per month:",
|
|
62862
63591
|
options: [
|
|
62863
63592
|
{ value: 100, label: "< 100 (Testing)" },
|
|
@@ -62867,8 +63596,8 @@ async function promptEstimatedSMSVolume() {
|
|
|
62867
63596
|
{ value: 1e5, label: "50,000+" }
|
|
62868
63597
|
]
|
|
62869
63598
|
});
|
|
62870
|
-
if (
|
|
62871
|
-
|
|
63599
|
+
if (clack58.isCancel(result)) {
|
|
63600
|
+
clack58.cancel("Operation cancelled.");
|
|
62872
63601
|
process.exit(0);
|
|
62873
63602
|
}
|
|
62874
63603
|
return result;
|
|
@@ -62876,14 +63605,14 @@ async function promptEstimatedSMSVolume() {
|
|
|
62876
63605
|
async function init3(options) {
|
|
62877
63606
|
const startTime = Date.now();
|
|
62878
63607
|
if (!isJsonMode()) {
|
|
62879
|
-
|
|
63608
|
+
clack58.intro(pc61.bold("Wraps SMS Infrastructure Setup"));
|
|
62880
63609
|
}
|
|
62881
63610
|
const progress = new DeploymentProgress();
|
|
62882
63611
|
const identity = await progress.execute(
|
|
62883
63612
|
"Validating AWS credentials",
|
|
62884
63613
|
async () => validateAWSCredentials()
|
|
62885
63614
|
);
|
|
62886
|
-
progress.info(`Connected to AWS account: ${
|
|
63615
|
+
progress.info(`Connected to AWS account: ${pc61.cyan(identity.accountId)}`);
|
|
62887
63616
|
const wasAutoInstalled = await progress.execute(
|
|
62888
63617
|
"Checking Pulumi CLI installation",
|
|
62889
63618
|
async () => await ensurePulumiInstalled()
|
|
@@ -62902,10 +63631,10 @@ async function init3(options) {
|
|
|
62902
63631
|
region
|
|
62903
63632
|
);
|
|
62904
63633
|
if (existingConnection?.services?.sms) {
|
|
62905
|
-
|
|
62906
|
-
`SMS already configured for account ${
|
|
63634
|
+
clack58.log.warn(
|
|
63635
|
+
`SMS already configured for account ${pc61.cyan(identity.accountId)} in region ${pc61.cyan(region)}`
|
|
62907
63636
|
);
|
|
62908
|
-
|
|
63637
|
+
clack58.log.info(`Use ${pc61.cyan("wraps sms status")} to view current setup`);
|
|
62909
63638
|
process.exit(0);
|
|
62910
63639
|
}
|
|
62911
63640
|
let preset = options.preset;
|
|
@@ -62922,12 +63651,12 @@ async function init3(options) {
|
|
|
62922
63651
|
optOutManagement: true,
|
|
62923
63652
|
sendingEnabled: true
|
|
62924
63653
|
};
|
|
62925
|
-
const enableEventTracking = await
|
|
63654
|
+
const enableEventTracking = await clack58.confirm({
|
|
62926
63655
|
message: "Enable event tracking (EventBridge + DynamoDB)?",
|
|
62927
63656
|
initialValue: false
|
|
62928
63657
|
});
|
|
62929
|
-
if (
|
|
62930
|
-
|
|
63658
|
+
if (clack58.isCancel(enableEventTracking)) {
|
|
63659
|
+
clack58.cancel("Operation cancelled.");
|
|
62931
63660
|
process.exit(0);
|
|
62932
63661
|
}
|
|
62933
63662
|
if (enableEventTracking) {
|
|
@@ -62947,17 +63676,17 @@ async function init3(options) {
|
|
|
62947
63676
|
}
|
|
62948
63677
|
progress.info(
|
|
62949
63678
|
`
|
|
62950
|
-
${
|
|
63679
|
+
${pc61.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
62951
63680
|
);
|
|
62952
63681
|
const allowedCountries = await promptAllowedCountries();
|
|
62953
63682
|
let aitFiltering = false;
|
|
62954
63683
|
if (smsConfig.phoneNumberType !== "simulator") {
|
|
62955
|
-
const enableAIT = await
|
|
63684
|
+
const enableAIT = await clack58.confirm({
|
|
62956
63685
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
62957
63686
|
initialValue: false
|
|
62958
63687
|
});
|
|
62959
|
-
if (
|
|
62960
|
-
|
|
63688
|
+
if (clack58.isCancel(enableAIT)) {
|
|
63689
|
+
clack58.cancel("Operation cancelled.");
|
|
62961
63690
|
process.exit(0);
|
|
62962
63691
|
}
|
|
62963
63692
|
aitFiltering = enableAIT;
|
|
@@ -62969,21 +63698,21 @@ ${pc60.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
62969
63698
|
};
|
|
62970
63699
|
const estimatedVolume = await promptEstimatedSMSVolume();
|
|
62971
63700
|
progress.info(`
|
|
62972
|
-
${
|
|
63701
|
+
${pc61.bold("Cost Estimate:")}`);
|
|
62973
63702
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
62974
|
-
|
|
63703
|
+
clack58.log.info(costSummary);
|
|
62975
63704
|
const warnings = validateSMSConfig(smsConfig);
|
|
62976
63705
|
if (warnings.length > 0) {
|
|
62977
63706
|
progress.info(`
|
|
62978
|
-
${
|
|
63707
|
+
${pc61.yellow(pc61.bold("Important Notes:"))}`);
|
|
62979
63708
|
for (const warning2 of warnings) {
|
|
62980
|
-
|
|
63709
|
+
clack58.log.warn(warning2);
|
|
62981
63710
|
}
|
|
62982
63711
|
}
|
|
62983
63712
|
if (!(options.yes || options.preview)) {
|
|
62984
63713
|
const confirmed = await confirmDeploy();
|
|
62985
63714
|
if (!confirmed) {
|
|
62986
|
-
|
|
63715
|
+
clack58.cancel("Deployment cancelled.");
|
|
62987
63716
|
process.exit(0);
|
|
62988
63717
|
}
|
|
62989
63718
|
}
|
|
@@ -63043,8 +63772,8 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63043
63772
|
costEstimate: getSMSCostSummary(smsConfig, 0),
|
|
63044
63773
|
commandName: "wraps sms init"
|
|
63045
63774
|
});
|
|
63046
|
-
|
|
63047
|
-
|
|
63775
|
+
clack58.outro(
|
|
63776
|
+
pc61.green("Preview complete. Run without --preview to deploy.")
|
|
63048
63777
|
);
|
|
63049
63778
|
trackServiceInit("sms", true, {
|
|
63050
63779
|
provider,
|
|
@@ -63093,9 +63822,9 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63093
63822
|
} catch (sdkError) {
|
|
63094
63823
|
sdkResourceWarning = true;
|
|
63095
63824
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63096
|
-
|
|
63097
|
-
|
|
63098
|
-
`Run ${
|
|
63825
|
+
clack58.log.warn(`Phone pool creation failed: ${msg}`);
|
|
63826
|
+
clack58.log.info(
|
|
63827
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63099
63828
|
);
|
|
63100
63829
|
}
|
|
63101
63830
|
}
|
|
@@ -63111,9 +63840,9 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63111
63840
|
} catch (sdkError) {
|
|
63112
63841
|
sdkResourceWarning = true;
|
|
63113
63842
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63114
|
-
|
|
63115
|
-
|
|
63116
|
-
`Run ${
|
|
63843
|
+
clack58.log.warn(`Event destination creation failed: ${msg}`);
|
|
63844
|
+
clack58.log.info(
|
|
63845
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63117
63846
|
);
|
|
63118
63847
|
}
|
|
63119
63848
|
}
|
|
@@ -63132,14 +63861,14 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63132
63861
|
} catch (sdkError) {
|
|
63133
63862
|
sdkResourceWarning = true;
|
|
63134
63863
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63135
|
-
|
|
63136
|
-
|
|
63137
|
-
`Run ${
|
|
63864
|
+
clack58.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
63865
|
+
clack58.log.info(
|
|
63866
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63138
63867
|
);
|
|
63139
63868
|
}
|
|
63140
63869
|
}
|
|
63141
63870
|
if (sdkResourceWarning) {
|
|
63142
|
-
|
|
63871
|
+
clack58.log.warn(
|
|
63143
63872
|
"Some SDK resources failed to create. Core infrastructure is deployed."
|
|
63144
63873
|
);
|
|
63145
63874
|
}
|
|
@@ -63184,47 +63913,47 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63184
63913
|
return;
|
|
63185
63914
|
}
|
|
63186
63915
|
console.log("\n");
|
|
63187
|
-
|
|
63916
|
+
clack58.log.success(pc61.green(pc61.bold("SMS infrastructure deployed!")));
|
|
63188
63917
|
console.log("\n");
|
|
63189
|
-
|
|
63918
|
+
clack58.note(
|
|
63190
63919
|
[
|
|
63191
|
-
`${
|
|
63192
|
-
`${
|
|
63193
|
-
`${
|
|
63194
|
-
`${
|
|
63195
|
-
outputs.tableName ? `${
|
|
63920
|
+
`${pc61.bold("Phone Number:")} ${pc61.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
63921
|
+
`${pc61.bold("Phone Type:")} ${pc61.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
63922
|
+
`${pc61.bold("Config Set:")} ${pc61.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
63923
|
+
`${pc61.bold("Region:")} ${pc61.cyan(outputs.region)}`,
|
|
63924
|
+
outputs.tableName ? `${pc61.bold("History Table:")} ${pc61.cyan(outputs.tableName)}` : "",
|
|
63196
63925
|
"",
|
|
63197
|
-
|
|
63198
|
-
|
|
63926
|
+
pc61.dim("IAM Role:"),
|
|
63927
|
+
pc61.dim(` ${outputs.roleArn}`)
|
|
63199
63928
|
].filter(Boolean).join("\n"),
|
|
63200
63929
|
"SMS Infrastructure"
|
|
63201
63930
|
);
|
|
63202
63931
|
const nextSteps = [];
|
|
63203
63932
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
63204
63933
|
nextSteps.push(
|
|
63205
|
-
`${
|
|
63934
|
+
`${pc61.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
63206
63935
|
);
|
|
63207
63936
|
}
|
|
63208
63937
|
nextSteps.push(
|
|
63209
|
-
`${
|
|
63938
|
+
`${pc61.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
63210
63939
|
);
|
|
63211
|
-
nextSteps.push(`${
|
|
63940
|
+
nextSteps.push(`${pc61.cyan("wraps sms status")} - View SMS configuration`);
|
|
63212
63941
|
console.log("\n");
|
|
63213
|
-
|
|
63942
|
+
clack58.log.info(pc61.bold("Next steps:"));
|
|
63214
63943
|
for (const step of nextSteps) {
|
|
63215
63944
|
console.log(` ${step}`);
|
|
63216
63945
|
}
|
|
63217
63946
|
console.log("\n");
|
|
63218
|
-
|
|
63219
|
-
console.log(
|
|
63947
|
+
clack58.log.info(pc61.bold("SDK Usage:"));
|
|
63948
|
+
console.log(pc61.dim(" npm install @wraps.dev/sms"));
|
|
63220
63949
|
console.log("");
|
|
63221
|
-
console.log(
|
|
63222
|
-
console.log(
|
|
63223
|
-
console.log(
|
|
63224
|
-
console.log(
|
|
63225
|
-
console.log(
|
|
63226
|
-
console.log(
|
|
63227
|
-
|
|
63950
|
+
console.log(pc61.dim(" import { Wraps } from '@wraps.dev/sms';"));
|
|
63951
|
+
console.log(pc61.dim(" const wraps = new Wraps();"));
|
|
63952
|
+
console.log(pc61.dim(" await wraps.sms.send({"));
|
|
63953
|
+
console.log(pc61.dim(" to: '+14155551234',"));
|
|
63954
|
+
console.log(pc61.dim(" message: 'Your code is 123456',"));
|
|
63955
|
+
console.log(pc61.dim(" });"));
|
|
63956
|
+
clack58.outro(pc61.green("Setup complete!"));
|
|
63228
63957
|
const duration = Date.now() - startTime;
|
|
63229
63958
|
const enabledFeatures = [];
|
|
63230
63959
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -63260,8 +63989,8 @@ init_aws();
|
|
|
63260
63989
|
init_json_output();
|
|
63261
63990
|
init_metadata();
|
|
63262
63991
|
init_output();
|
|
63263
|
-
import * as
|
|
63264
|
-
import
|
|
63992
|
+
import * as clack59 from "@clack/prompts";
|
|
63993
|
+
import pc62 from "picocolors";
|
|
63265
63994
|
async function getPhoneNumberDetails(region) {
|
|
63266
63995
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
63267
63996
|
const client2 = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -63281,7 +64010,7 @@ async function getPhoneNumberDetails(region) {
|
|
|
63281
64010
|
return null;
|
|
63282
64011
|
} catch (error) {
|
|
63283
64012
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
63284
|
-
|
|
64013
|
+
clack59.log.error(`Error fetching phone number: ${errorMessage}`);
|
|
63285
64014
|
return null;
|
|
63286
64015
|
}
|
|
63287
64016
|
}
|
|
@@ -63302,7 +64031,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
63302
64031
|
async function smsRegister(options) {
|
|
63303
64032
|
const startTime = Date.now();
|
|
63304
64033
|
if (!isJsonMode()) {
|
|
63305
|
-
|
|
64034
|
+
clack59.intro(pc62.bold("Wraps SMS - Toll-Free Registration"));
|
|
63306
64035
|
}
|
|
63307
64036
|
const progress = new DeploymentProgress();
|
|
63308
64037
|
const identity = await progress.execute(
|
|
@@ -63315,8 +64044,8 @@ async function smsRegister(options) {
|
|
|
63315
64044
|
}
|
|
63316
64045
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63317
64046
|
if (!metadata?.services?.sms) {
|
|
63318
|
-
|
|
63319
|
-
|
|
64047
|
+
clack59.log.error("No SMS infrastructure found.");
|
|
64048
|
+
clack59.log.info(`Run ${pc62.cyan("wraps sms init")} first.`);
|
|
63320
64049
|
process.exit(1);
|
|
63321
64050
|
}
|
|
63322
64051
|
const phoneDetails = await progress.execute(
|
|
@@ -63324,7 +64053,7 @@ async function smsRegister(options) {
|
|
|
63324
64053
|
async () => getPhoneNumberDetails(region)
|
|
63325
64054
|
);
|
|
63326
64055
|
if (!phoneDetails) {
|
|
63327
|
-
|
|
64056
|
+
clack59.log.error("No phone number found.");
|
|
63328
64057
|
process.exit(1);
|
|
63329
64058
|
}
|
|
63330
64059
|
let registrationStatus = null;
|
|
@@ -63350,53 +64079,53 @@ async function smsRegister(options) {
|
|
|
63350
64079
|
}
|
|
63351
64080
|
console.log("");
|
|
63352
64081
|
console.log(
|
|
63353
|
-
`${
|
|
64082
|
+
`${pc62.bold("Phone Number:")} ${pc62.cyan(phoneDetails.phoneNumber)}`
|
|
63354
64083
|
);
|
|
63355
|
-
console.log(`${
|
|
64084
|
+
console.log(`${pc62.bold("Type:")} ${pc62.cyan(phoneDetails.type)}`);
|
|
63356
64085
|
console.log(
|
|
63357
|
-
`${
|
|
64086
|
+
`${pc62.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc62.green(phoneDetails.status) : pc62.yellow(phoneDetails.status)}`
|
|
63358
64087
|
);
|
|
63359
64088
|
if (registrationStatus) {
|
|
63360
|
-
console.log(`${
|
|
64089
|
+
console.log(`${pc62.bold("Registration:")} ${pc62.cyan(registrationStatus)}`);
|
|
63361
64090
|
}
|
|
63362
64091
|
console.log("");
|
|
63363
64092
|
if (phoneDetails.status === "ACTIVE") {
|
|
63364
|
-
|
|
64093
|
+
clack59.log.success("Your phone number is already ACTIVE and ready to use!");
|
|
63365
64094
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePoolsCommand } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
63366
64095
|
const client2 = new PinpointSMSVoiceV2Client5({ region });
|
|
63367
64096
|
const pools = await client2.send(new DescribePoolsCommand({}));
|
|
63368
64097
|
if (!pools.Pools?.length) {
|
|
63369
|
-
|
|
64098
|
+
clack59.log.info("Run `wraps sms sync` to create the phone pool.");
|
|
63370
64099
|
}
|
|
63371
64100
|
process.exit(0);
|
|
63372
64101
|
}
|
|
63373
64102
|
if (phoneDetails.type !== "TOLL_FREE") {
|
|
63374
|
-
|
|
63375
|
-
|
|
64103
|
+
clack59.log.info("Only toll-free numbers require registration.");
|
|
64104
|
+
clack59.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
63376
64105
|
process.exit(0);
|
|
63377
64106
|
}
|
|
63378
|
-
console.log(
|
|
64107
|
+
console.log(pc62.bold("Toll-Free Registration Required"));
|
|
63379
64108
|
console.log("");
|
|
63380
64109
|
console.log(
|
|
63381
|
-
|
|
64110
|
+
pc62.dim("To send SMS at scale, you must register your toll-free number.")
|
|
63382
64111
|
);
|
|
63383
|
-
console.log(
|
|
64112
|
+
console.log(pc62.dim("This process typically takes 1-15 business days."));
|
|
63384
64113
|
console.log("");
|
|
63385
|
-
console.log(
|
|
63386
|
-
console.log(` ${
|
|
64114
|
+
console.log(pc62.bold("You'll need to provide:"));
|
|
64115
|
+
console.log(` ${pc62.dim("\u2022")} Business name and address`);
|
|
63387
64116
|
console.log(
|
|
63388
|
-
` ${
|
|
64117
|
+
` ${pc62.dim("\u2022")} Use case description (what messages you're sending)`
|
|
63389
64118
|
);
|
|
63390
|
-
console.log(` ${
|
|
63391
|
-
console.log(` ${
|
|
63392
|
-
console.log(` ${
|
|
64119
|
+
console.log(` ${pc62.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
64120
|
+
console.log(` ${pc62.dim("\u2022")} How users opt-in to receive messages`);
|
|
64121
|
+
console.log(` ${pc62.dim("\u2022")} Expected monthly message volume`);
|
|
63393
64122
|
console.log("");
|
|
63394
|
-
const openConsole = await
|
|
64123
|
+
const openConsole = await clack59.confirm({
|
|
63395
64124
|
message: "Open AWS Console to start registration?",
|
|
63396
64125
|
initialValue: true
|
|
63397
64126
|
});
|
|
63398
|
-
if (
|
|
63399
|
-
|
|
64127
|
+
if (clack59.isCancel(openConsole)) {
|
|
64128
|
+
clack59.cancel("Registration cancelled.");
|
|
63400
64129
|
process.exit(0);
|
|
63401
64130
|
}
|
|
63402
64131
|
if (openConsole) {
|
|
@@ -63406,41 +64135,41 @@ async function smsRegister(options) {
|
|
|
63406
64135
|
const execAsync2 = promisify3(exec3);
|
|
63407
64136
|
try {
|
|
63408
64137
|
await execAsync2(`open "${consoleUrl}"`);
|
|
63409
|
-
|
|
64138
|
+
clack59.log.success("Opened AWS Console in your browser.");
|
|
63410
64139
|
} catch {
|
|
63411
64140
|
try {
|
|
63412
64141
|
await execAsync2(`xdg-open "${consoleUrl}"`);
|
|
63413
|
-
|
|
64142
|
+
clack59.log.success("Opened AWS Console in your browser.");
|
|
63414
64143
|
} catch {
|
|
63415
|
-
|
|
64144
|
+
clack59.log.info("Open this URL in your browser:");
|
|
63416
64145
|
console.log(`
|
|
63417
|
-
${
|
|
64146
|
+
${pc62.cyan(consoleUrl)}
|
|
63418
64147
|
`);
|
|
63419
64148
|
}
|
|
63420
64149
|
}
|
|
63421
64150
|
console.log("");
|
|
63422
|
-
console.log(
|
|
64151
|
+
console.log(pc62.bold("Next Steps:"));
|
|
63423
64152
|
console.log(
|
|
63424
|
-
` 1. Click ${
|
|
64153
|
+
` 1. Click ${pc62.cyan("Create registration")} in the AWS Console`
|
|
63425
64154
|
);
|
|
63426
|
-
console.log(` 2. Select ${
|
|
64155
|
+
console.log(` 2. Select ${pc62.cyan("Toll-free number registration")}`);
|
|
63427
64156
|
console.log(" 3. Fill out the business information form");
|
|
63428
64157
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
63429
64158
|
console.log("");
|
|
63430
64159
|
console.log(
|
|
63431
|
-
|
|
64160
|
+
pc62.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
63432
64161
|
);
|
|
63433
64162
|
} else {
|
|
63434
64163
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
63435
64164
|
console.log("");
|
|
63436
64165
|
console.log("When you're ready, go to:");
|
|
63437
|
-
console.log(` ${
|
|
64166
|
+
console.log(` ${pc62.cyan(consoleUrl)}`);
|
|
63438
64167
|
}
|
|
63439
64168
|
trackCommand("sms:register", {
|
|
63440
64169
|
success: true,
|
|
63441
64170
|
duration_ms: Date.now() - startTime
|
|
63442
64171
|
});
|
|
63443
|
-
|
|
64172
|
+
clack59.outro(pc62.dim("Good luck with your registration!"));
|
|
63444
64173
|
}
|
|
63445
64174
|
|
|
63446
64175
|
// src/commands/sms/status.ts
|
|
@@ -63453,54 +64182,54 @@ init_metadata();
|
|
|
63453
64182
|
init_output();
|
|
63454
64183
|
init_pulumi();
|
|
63455
64184
|
init_region_resolver();
|
|
63456
|
-
import * as
|
|
64185
|
+
import * as clack60 from "@clack/prompts";
|
|
63457
64186
|
import * as pulumi36 from "@pulumi/pulumi";
|
|
63458
|
-
import
|
|
64187
|
+
import pc63 from "picocolors";
|
|
63459
64188
|
function displaySMSStatus(options) {
|
|
63460
64189
|
const lines = [];
|
|
63461
|
-
lines.push(
|
|
64190
|
+
lines.push(pc63.bold(pc63.green("SMS Infrastructure Active")));
|
|
63462
64191
|
lines.push("");
|
|
63463
|
-
lines.push(
|
|
64192
|
+
lines.push(pc63.bold("Phone Number"));
|
|
63464
64193
|
if (options.phoneNumber) {
|
|
63465
|
-
lines.push(` Number: ${
|
|
64194
|
+
lines.push(` Number: ${pc63.cyan(options.phoneNumber)}`);
|
|
63466
64195
|
} else {
|
|
63467
|
-
lines.push(` Number: ${
|
|
64196
|
+
lines.push(` Number: ${pc63.yellow("Provisioning...")}`);
|
|
63468
64197
|
}
|
|
63469
|
-
lines.push(` Type: ${
|
|
64198
|
+
lines.push(` Type: ${pc63.cyan(options.phoneNumberType || "simulator")}`);
|
|
63470
64199
|
lines.push("");
|
|
63471
|
-
lines.push(
|
|
63472
|
-
lines.push(` Region: ${
|
|
64200
|
+
lines.push(pc63.bold("Configuration"));
|
|
64201
|
+
lines.push(` Region: ${pc63.cyan(options.region)}`);
|
|
63473
64202
|
if (options.preset) {
|
|
63474
|
-
lines.push(` Preset: ${
|
|
64203
|
+
lines.push(` Preset: ${pc63.cyan(options.preset)}`);
|
|
63475
64204
|
}
|
|
63476
64205
|
if (options.configSetName) {
|
|
63477
|
-
lines.push(` Config Set: ${
|
|
64206
|
+
lines.push(` Config Set: ${pc63.cyan(options.configSetName)}`);
|
|
63478
64207
|
}
|
|
63479
64208
|
lines.push("");
|
|
63480
|
-
lines.push(
|
|
64209
|
+
lines.push(pc63.bold("Features"));
|
|
63481
64210
|
lines.push(
|
|
63482
|
-
` Event Tracking: ${options.eventTracking ?
|
|
64211
|
+
` Event Tracking: ${options.eventTracking ? pc63.green("Enabled") : pc63.dim("Disabled")}`
|
|
63483
64212
|
);
|
|
63484
64213
|
if (options.tableName) {
|
|
63485
|
-
lines.push(` Message History: ${
|
|
63486
|
-
lines.push(` Table: ${
|
|
64214
|
+
lines.push(` Message History: ${pc63.green("Enabled")}`);
|
|
64215
|
+
lines.push(` Table: ${pc63.dim(options.tableName)}`);
|
|
63487
64216
|
}
|
|
63488
64217
|
if (options.queueUrl) {
|
|
63489
|
-
lines.push(` Event Queue: ${
|
|
64218
|
+
lines.push(` Event Queue: ${pc63.green("Enabled")}`);
|
|
63490
64219
|
}
|
|
63491
64220
|
lines.push("");
|
|
63492
64221
|
if (options.roleArn) {
|
|
63493
|
-
lines.push(
|
|
63494
|
-
lines.push(` ${
|
|
64222
|
+
lines.push(pc63.bold("IAM Role"));
|
|
64223
|
+
lines.push(` ${pc63.dim(options.roleArn)}`);
|
|
63495
64224
|
}
|
|
63496
|
-
|
|
64225
|
+
clack60.note(lines.join("\n"), "SMS Status");
|
|
63497
64226
|
}
|
|
63498
64227
|
async function smsStatus(options) {
|
|
63499
64228
|
await ensurePulumiInstalled();
|
|
63500
64229
|
const startTime = Date.now();
|
|
63501
64230
|
const progress = new DeploymentProgress();
|
|
63502
64231
|
if (!isJsonMode()) {
|
|
63503
|
-
|
|
64232
|
+
clack60.intro(pc63.bold("Wraps SMS Status"));
|
|
63504
64233
|
}
|
|
63505
64234
|
const identity = await progress.execute(
|
|
63506
64235
|
"Loading SMS infrastructure status",
|
|
@@ -63515,10 +64244,10 @@ async function smsStatus(options) {
|
|
|
63515
64244
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63516
64245
|
if (!metadata?.services?.sms) {
|
|
63517
64246
|
progress.stop();
|
|
63518
|
-
|
|
64247
|
+
clack60.log.error("No SMS infrastructure found");
|
|
63519
64248
|
console.log(
|
|
63520
64249
|
`
|
|
63521
|
-
Run ${
|
|
64250
|
+
Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
63522
64251
|
`
|
|
63523
64252
|
);
|
|
63524
64253
|
process.exit(1);
|
|
@@ -63554,25 +64283,25 @@ Run ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63554
64283
|
}
|
|
63555
64284
|
displaySMSStatus(smsStatusData);
|
|
63556
64285
|
console.log("");
|
|
63557
|
-
|
|
64286
|
+
clack60.log.info(pc63.bold("Commands:"));
|
|
63558
64287
|
console.log(
|
|
63559
|
-
` ${
|
|
64288
|
+
` ${pc63.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
63560
64289
|
);
|
|
63561
|
-
console.log(` ${
|
|
64290
|
+
console.log(` ${pc63.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
63562
64291
|
trackCommand("sms:status", {
|
|
63563
64292
|
success: true,
|
|
63564
64293
|
phone_type: smsConfig?.phoneNumberType,
|
|
63565
64294
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
63566
64295
|
duration_ms: Date.now() - startTime
|
|
63567
64296
|
});
|
|
63568
|
-
|
|
64297
|
+
clack60.outro(pc63.dim("SMS infrastructure is ready"));
|
|
63569
64298
|
}
|
|
63570
64299
|
|
|
63571
64300
|
// src/commands/sms/sync.ts
|
|
63572
64301
|
init_esm_shims();
|
|
63573
|
-
import * as
|
|
64302
|
+
import * as clack61 from "@clack/prompts";
|
|
63574
64303
|
import * as pulumi37 from "@pulumi/pulumi";
|
|
63575
|
-
import
|
|
64304
|
+
import pc64 from "picocolors";
|
|
63576
64305
|
init_events();
|
|
63577
64306
|
init_aws();
|
|
63578
64307
|
init_errors();
|
|
@@ -63585,7 +64314,7 @@ async function smsSync(options) {
|
|
|
63585
64314
|
await ensurePulumiInstalled();
|
|
63586
64315
|
const startTime = Date.now();
|
|
63587
64316
|
if (!isJsonMode()) {
|
|
63588
|
-
|
|
64317
|
+
clack61.intro(pc64.bold("Wraps SMS Infrastructure Sync"));
|
|
63589
64318
|
}
|
|
63590
64319
|
const progress = new DeploymentProgress();
|
|
63591
64320
|
const identity = await progress.execute(
|
|
@@ -63597,10 +64326,10 @@ async function smsSync(options) {
|
|
|
63597
64326
|
const smsService = metadata?.services?.sms;
|
|
63598
64327
|
if (!smsService?.config) {
|
|
63599
64328
|
progress.stop();
|
|
63600
|
-
|
|
64329
|
+
clack61.log.error("No SMS infrastructure found to sync");
|
|
63601
64330
|
console.log(
|
|
63602
64331
|
`
|
|
63603
|
-
Run ${
|
|
64332
|
+
Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
63604
64333
|
`
|
|
63605
64334
|
);
|
|
63606
64335
|
process.exit(1);
|
|
@@ -63609,18 +64338,18 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63609
64338
|
const storedStackName = smsService.pulumiStackName;
|
|
63610
64339
|
progress.info("Found existing SMS configuration");
|
|
63611
64340
|
progress.info(
|
|
63612
|
-
`Phone type: ${
|
|
64341
|
+
`Phone type: ${pc64.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
63613
64342
|
);
|
|
63614
64343
|
progress.info(
|
|
63615
|
-
`Event tracking: ${
|
|
64344
|
+
`Event tracking: ${pc64.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
63616
64345
|
);
|
|
63617
64346
|
if (!options.yes) {
|
|
63618
|
-
const confirmed = await
|
|
64347
|
+
const confirmed = await clack61.confirm({
|
|
63619
64348
|
message: "Sync SMS infrastructure? This will update Lambda code and recreate any missing resources.",
|
|
63620
64349
|
initialValue: true
|
|
63621
64350
|
});
|
|
63622
|
-
if (
|
|
63623
|
-
|
|
64351
|
+
if (clack61.isCancel(confirmed) || !confirmed) {
|
|
64352
|
+
clack61.cancel("Sync cancelled.");
|
|
63624
64353
|
process.exit(0);
|
|
63625
64354
|
}
|
|
63626
64355
|
}
|
|
@@ -63725,7 +64454,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63725
64454
|
throw errors.stackLocked();
|
|
63726
64455
|
}
|
|
63727
64456
|
trackError("SYNC_FAILED", "sms:sync", { step: "sync" });
|
|
63728
|
-
|
|
64457
|
+
clack61.log.error(`SMS sync failed: ${errorMessage}`);
|
|
63729
64458
|
process.exit(1);
|
|
63730
64459
|
}
|
|
63731
64460
|
if (metadata && smsService) {
|
|
@@ -63745,7 +64474,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63745
64474
|
return;
|
|
63746
64475
|
}
|
|
63747
64476
|
console.log("\n");
|
|
63748
|
-
|
|
64477
|
+
clack61.log.success(pc64.green("SMS infrastructure synced successfully!"));
|
|
63749
64478
|
const changes = [];
|
|
63750
64479
|
if (outputs.lambdaFunctions?.length) {
|
|
63751
64480
|
changes.push("Lambda functions updated");
|
|
@@ -63753,13 +64482,13 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63753
64482
|
changes.push("SDK resources verified");
|
|
63754
64483
|
console.log("");
|
|
63755
64484
|
for (const change of changes) {
|
|
63756
|
-
console.log(` ${
|
|
64485
|
+
console.log(` ${pc64.green("\u2713")} ${change}`);
|
|
63757
64486
|
}
|
|
63758
64487
|
trackCommand("sms:sync", {
|
|
63759
64488
|
success: true,
|
|
63760
64489
|
duration_ms: Date.now() - startTime
|
|
63761
64490
|
});
|
|
63762
|
-
|
|
64491
|
+
clack61.outro(pc64.green("Sync complete!"));
|
|
63763
64492
|
}
|
|
63764
64493
|
|
|
63765
64494
|
// src/commands/sms/test.ts
|
|
@@ -63774,8 +64503,8 @@ import {
|
|
|
63774
64503
|
PinpointSMSVoiceV2Client as PinpointSMSVoiceV2Client3,
|
|
63775
64504
|
SendTextMessageCommand
|
|
63776
64505
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
63777
|
-
import * as
|
|
63778
|
-
import
|
|
64506
|
+
import * as clack62 from "@clack/prompts";
|
|
64507
|
+
import pc65 from "picocolors";
|
|
63779
64508
|
|
|
63780
64509
|
// src/utils/sms/validation.ts
|
|
63781
64510
|
init_esm_shims();
|
|
@@ -63798,7 +64527,7 @@ async function smsTest(options) {
|
|
|
63798
64527
|
const startTime = Date.now();
|
|
63799
64528
|
const progress = new DeploymentProgress();
|
|
63800
64529
|
if (!isJsonMode()) {
|
|
63801
|
-
|
|
64530
|
+
clack62.intro(pc65.bold("Wraps SMS Test"));
|
|
63802
64531
|
}
|
|
63803
64532
|
const identity = await progress.execute(
|
|
63804
64533
|
"Validating AWS credentials",
|
|
@@ -63808,10 +64537,10 @@ async function smsTest(options) {
|
|
|
63808
64537
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63809
64538
|
if (!metadata?.services?.sms) {
|
|
63810
64539
|
progress.stop();
|
|
63811
|
-
|
|
64540
|
+
clack62.log.error("No SMS infrastructure found");
|
|
63812
64541
|
console.log(
|
|
63813
64542
|
`
|
|
63814
|
-
Run ${
|
|
64543
|
+
Run ${pc65.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
63815
64544
|
`
|
|
63816
64545
|
);
|
|
63817
64546
|
process.exit(1);
|
|
@@ -63825,7 +64554,7 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63825
64554
|
);
|
|
63826
64555
|
}
|
|
63827
64556
|
if (!toNumber) {
|
|
63828
|
-
const destinationType = await
|
|
64557
|
+
const destinationType = await clack62.select({
|
|
63829
64558
|
message: "Choose destination number:",
|
|
63830
64559
|
options: [
|
|
63831
64560
|
{
|
|
@@ -63840,25 +64569,25 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63840
64569
|
}
|
|
63841
64570
|
]
|
|
63842
64571
|
});
|
|
63843
|
-
if (
|
|
63844
|
-
|
|
64572
|
+
if (clack62.isCancel(destinationType)) {
|
|
64573
|
+
clack62.cancel("Operation cancelled.");
|
|
63845
64574
|
process.exit(0);
|
|
63846
64575
|
}
|
|
63847
64576
|
if (destinationType === "simulator") {
|
|
63848
|
-
const simResult = await
|
|
64577
|
+
const simResult = await clack62.select({
|
|
63849
64578
|
message: "Select simulator destination:",
|
|
63850
64579
|
options: SIMULATOR_DESTINATIONS.map((sim) => ({
|
|
63851
64580
|
value: sim.number,
|
|
63852
64581
|
label: `${sim.number} | ${sim.country}`
|
|
63853
64582
|
}))
|
|
63854
64583
|
});
|
|
63855
|
-
if (
|
|
63856
|
-
|
|
64584
|
+
if (clack62.isCancel(simResult)) {
|
|
64585
|
+
clack62.cancel("Operation cancelled.");
|
|
63857
64586
|
process.exit(0);
|
|
63858
64587
|
}
|
|
63859
64588
|
toNumber = simResult;
|
|
63860
64589
|
} else {
|
|
63861
|
-
const result = await
|
|
64590
|
+
const result = await clack62.text({
|
|
63862
64591
|
message: "Enter destination phone number (E.164 format):",
|
|
63863
64592
|
placeholder: "+14155551234",
|
|
63864
64593
|
validate: (value) => {
|
|
@@ -63871,22 +64600,22 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63871
64600
|
return;
|
|
63872
64601
|
}
|
|
63873
64602
|
});
|
|
63874
|
-
if (
|
|
63875
|
-
|
|
64603
|
+
if (clack62.isCancel(result)) {
|
|
64604
|
+
clack62.cancel("Operation cancelled.");
|
|
63876
64605
|
process.exit(0);
|
|
63877
64606
|
}
|
|
63878
64607
|
toNumber = result;
|
|
63879
64608
|
}
|
|
63880
64609
|
} else if (!isValidPhoneNumber(toNumber)) {
|
|
63881
64610
|
progress.stop();
|
|
63882
|
-
|
|
64611
|
+
clack62.log.error(
|
|
63883
64612
|
`Invalid phone number format: ${toNumber}. Use E.164 format (e.g., +14155551234)`
|
|
63884
64613
|
);
|
|
63885
64614
|
process.exit(1);
|
|
63886
64615
|
}
|
|
63887
64616
|
let message = options.message;
|
|
63888
64617
|
if (!message) {
|
|
63889
|
-
const result = await
|
|
64618
|
+
const result = await clack62.text({
|
|
63890
64619
|
message: "Enter test message:",
|
|
63891
64620
|
placeholder: "Hello from Wraps SMS!",
|
|
63892
64621
|
defaultValue: "Hello from Wraps SMS! This is a test message.",
|
|
@@ -63900,8 +64629,8 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63900
64629
|
return;
|
|
63901
64630
|
}
|
|
63902
64631
|
});
|
|
63903
|
-
if (
|
|
63904
|
-
|
|
64632
|
+
if (clack62.isCancel(result)) {
|
|
64633
|
+
clack62.cancel("Operation cancelled.");
|
|
63905
64634
|
process.exit(0);
|
|
63906
64635
|
}
|
|
63907
64636
|
message = result;
|
|
@@ -63940,16 +64669,16 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63940
64669
|
return;
|
|
63941
64670
|
}
|
|
63942
64671
|
console.log("\n");
|
|
63943
|
-
|
|
64672
|
+
clack62.log.success(pc65.green("Test SMS sent successfully!"));
|
|
63944
64673
|
console.log("");
|
|
63945
|
-
|
|
64674
|
+
clack62.note(
|
|
63946
64675
|
[
|
|
63947
|
-
`${
|
|
63948
|
-
`${
|
|
63949
|
-
`${
|
|
63950
|
-
`${
|
|
64676
|
+
`${pc65.bold("Message ID:")} ${pc65.cyan(messageId || "unknown")}`,
|
|
64677
|
+
`${pc65.bold("To:")} ${pc65.cyan(toNumber)}`,
|
|
64678
|
+
`${pc65.bold("Message:")} ${message}`,
|
|
64679
|
+
`${pc65.bold("Type:")} ${pc65.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
63951
64680
|
"",
|
|
63952
|
-
|
|
64681
|
+
pc65.dim(
|
|
63953
64682
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
63954
64683
|
)
|
|
63955
64684
|
].join("\n"),
|
|
@@ -63957,11 +64686,11 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63957
64686
|
);
|
|
63958
64687
|
if (smsConfig?.eventTracking?.enabled) {
|
|
63959
64688
|
console.log("");
|
|
63960
|
-
|
|
63961
|
-
|
|
64689
|
+
clack62.log.info(
|
|
64690
|
+
pc65.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
63962
64691
|
);
|
|
63963
64692
|
}
|
|
63964
|
-
|
|
64693
|
+
clack62.outro(pc65.green("Test complete!"));
|
|
63965
64694
|
} catch (error) {
|
|
63966
64695
|
progress.stop();
|
|
63967
64696
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -63973,33 +64702,33 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63973
64702
|
});
|
|
63974
64703
|
const errorName = error instanceof Error ? error.name : "";
|
|
63975
64704
|
if (errorName === "ConflictException" || errorMessage.includes("opt-out")) {
|
|
63976
|
-
|
|
64705
|
+
clack62.log.error("Destination number has opted out of messages");
|
|
63977
64706
|
console.log("\nThe recipient has opted out of receiving SMS messages.\n");
|
|
63978
64707
|
} else if (errorName === "ThrottlingException" || errorMessage.includes("spending limit")) {
|
|
63979
|
-
|
|
64708
|
+
clack62.log.error("SMS rate or spending limit reached");
|
|
63980
64709
|
console.log(
|
|
63981
64710
|
"\nCheck your AWS account SMS spending limits in the console.\n"
|
|
63982
64711
|
);
|
|
63983
64712
|
} else if (errorName === "ValidationException") {
|
|
63984
|
-
|
|
64713
|
+
clack62.log.error(`Invalid request: ${errorMessage}`);
|
|
63985
64714
|
} else if (errorMessage.includes("not verified") || errorMessage.includes("not registered")) {
|
|
63986
|
-
|
|
64715
|
+
clack62.log.error("Toll-free number registration is not complete");
|
|
63987
64716
|
console.log(
|
|
63988
64717
|
`
|
|
63989
|
-
Run ${
|
|
64718
|
+
Run ${pc65.cyan("wraps sms register")} to check registration status.
|
|
63990
64719
|
`
|
|
63991
64720
|
);
|
|
63992
64721
|
} else if (errorName === "AccessDeniedException") {
|
|
63993
|
-
|
|
64722
|
+
clack62.log.error(
|
|
63994
64723
|
"Permission denied \u2014 IAM role may be missing SMS send permissions"
|
|
63995
64724
|
);
|
|
63996
64725
|
console.log(
|
|
63997
64726
|
`
|
|
63998
|
-
Run ${
|
|
64727
|
+
Run ${pc65.cyan("wraps sms upgrade")} to update IAM policies.
|
|
63999
64728
|
`
|
|
64000
64729
|
);
|
|
64001
64730
|
} else {
|
|
64002
|
-
|
|
64731
|
+
clack62.log.error(`Failed to send SMS: ${errorMessage}`);
|
|
64003
64732
|
}
|
|
64004
64733
|
process.exit(1);
|
|
64005
64734
|
}
|
|
@@ -64007,9 +64736,9 @@ Run ${pc64.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
64007
64736
|
|
|
64008
64737
|
// src/commands/sms/upgrade.ts
|
|
64009
64738
|
init_esm_shims();
|
|
64010
|
-
import * as
|
|
64739
|
+
import * as clack63 from "@clack/prompts";
|
|
64011
64740
|
import * as pulumi38 from "@pulumi/pulumi";
|
|
64012
|
-
import
|
|
64741
|
+
import pc66 from "picocolors";
|
|
64013
64742
|
init_events();
|
|
64014
64743
|
init_aws();
|
|
64015
64744
|
init_errors();
|
|
@@ -64024,7 +64753,7 @@ async function smsUpgrade(options) {
|
|
|
64024
64753
|
const startTime = Date.now();
|
|
64025
64754
|
let upgradeAction = "";
|
|
64026
64755
|
if (!isJsonMode()) {
|
|
64027
|
-
|
|
64756
|
+
clack63.intro(pc66.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
64028
64757
|
}
|
|
64029
64758
|
const progress = new DeploymentProgress();
|
|
64030
64759
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -64038,7 +64767,7 @@ async function smsUpgrade(options) {
|
|
|
64038
64767
|
"Validating AWS credentials",
|
|
64039
64768
|
async () => validateAWSCredentials()
|
|
64040
64769
|
);
|
|
64041
|
-
progress.info(`Connected to AWS account: ${
|
|
64770
|
+
progress.info(`Connected to AWS account: ${pc66.cyan(identity.accountId)}`);
|
|
64042
64771
|
const region = await resolveRegionForCommand({
|
|
64043
64772
|
accountId: identity.accountId,
|
|
64044
64773
|
optionRegion: options.region,
|
|
@@ -64047,35 +64776,35 @@ async function smsUpgrade(options) {
|
|
|
64047
64776
|
});
|
|
64048
64777
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
64049
64778
|
if (!metadata) {
|
|
64050
|
-
|
|
64051
|
-
`No Wraps connection found for account ${
|
|
64779
|
+
clack63.log.error(
|
|
64780
|
+
`No Wraps connection found for account ${pc66.cyan(identity.accountId)} in region ${pc66.cyan(region)}`
|
|
64052
64781
|
);
|
|
64053
|
-
|
|
64054
|
-
`Use ${
|
|
64782
|
+
clack63.log.info(
|
|
64783
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64055
64784
|
);
|
|
64056
64785
|
process.exit(1);
|
|
64057
64786
|
}
|
|
64058
64787
|
if (!metadata.services.sms) {
|
|
64059
|
-
|
|
64060
|
-
|
|
64061
|
-
`Use ${
|
|
64788
|
+
clack63.log.error("No SMS infrastructure found");
|
|
64789
|
+
clack63.log.info(
|
|
64790
|
+
`Use ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
64062
64791
|
);
|
|
64063
64792
|
process.exit(1);
|
|
64064
64793
|
}
|
|
64065
64794
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
64066
64795
|
console.log(`
|
|
64067
|
-
${
|
|
64796
|
+
${pc66.bold("Current Configuration:")}
|
|
64068
64797
|
`);
|
|
64069
64798
|
if (metadata.services.sms.preset) {
|
|
64070
|
-
console.log(` Preset: ${
|
|
64799
|
+
console.log(` Preset: ${pc66.cyan(metadata.services.sms.preset)}`);
|
|
64071
64800
|
} else {
|
|
64072
|
-
console.log(` Preset: ${
|
|
64801
|
+
console.log(` Preset: ${pc66.cyan("custom")}`);
|
|
64073
64802
|
}
|
|
64074
64803
|
const config2 = metadata.services.sms.config;
|
|
64075
64804
|
if (!config2) {
|
|
64076
|
-
|
|
64077
|
-
|
|
64078
|
-
`Use ${
|
|
64805
|
+
clack63.log.error("No SMS configuration found in metadata");
|
|
64806
|
+
clack63.log.info(
|
|
64807
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64079
64808
|
);
|
|
64080
64809
|
process.exit(1);
|
|
64081
64810
|
}
|
|
@@ -64087,45 +64816,45 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64087
64816
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
64088
64817
|
};
|
|
64089
64818
|
console.log(
|
|
64090
|
-
` Phone Type: ${
|
|
64819
|
+
` Phone Type: ${pc66.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
64091
64820
|
);
|
|
64092
64821
|
}
|
|
64093
64822
|
if (config2.tracking?.enabled) {
|
|
64094
|
-
console.log(` ${
|
|
64823
|
+
console.log(` ${pc66.green("\u2713")} Delivery Tracking`);
|
|
64095
64824
|
if (config2.tracking.linkTracking) {
|
|
64096
|
-
console.log(` ${
|
|
64825
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
64097
64826
|
}
|
|
64098
64827
|
}
|
|
64099
64828
|
if (config2.eventTracking?.enabled) {
|
|
64100
|
-
console.log(` ${
|
|
64829
|
+
console.log(` ${pc66.green("\u2713")} Event Tracking (SNS)`);
|
|
64101
64830
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
64102
64831
|
console.log(
|
|
64103
|
-
` ${
|
|
64832
|
+
` ${pc66.dim("\u2514\u2500")} Message History: ${pc66.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
64104
64833
|
);
|
|
64105
64834
|
}
|
|
64106
64835
|
}
|
|
64107
64836
|
if (config2.messageArchiving?.enabled) {
|
|
64108
64837
|
console.log(
|
|
64109
|
-
` ${
|
|
64838
|
+
` ${pc66.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
64110
64839
|
);
|
|
64111
64840
|
}
|
|
64112
64841
|
if (config2.optOutManagement) {
|
|
64113
|
-
console.log(` ${
|
|
64842
|
+
console.log(` ${pc66.green("\u2713")} Opt-out Management`);
|
|
64114
64843
|
}
|
|
64115
64844
|
if (config2.protectConfiguration?.enabled) {
|
|
64116
64845
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
64117
|
-
console.log(` ${
|
|
64118
|
-
console.log(` ${
|
|
64846
|
+
console.log(` ${pc66.green("\u2713")} Fraud Protection`);
|
|
64847
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Allowed countries: ${pc66.cyan(countries)}`);
|
|
64119
64848
|
if (config2.protectConfiguration.aitFiltering) {
|
|
64120
|
-
console.log(` ${
|
|
64849
|
+
console.log(` ${pc66.dim("\u2514\u2500")} AIT filtering: ${pc66.cyan("enabled")}`);
|
|
64121
64850
|
}
|
|
64122
64851
|
} else {
|
|
64123
|
-
console.log(` ${
|
|
64852
|
+
console.log(` ${pc66.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
64124
64853
|
}
|
|
64125
64854
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
64126
64855
|
console.log(
|
|
64127
64856
|
`
|
|
64128
|
-
Estimated Cost: ${
|
|
64857
|
+
Estimated Cost: ${pc66.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
64129
64858
|
);
|
|
64130
64859
|
console.log("");
|
|
64131
64860
|
const phoneTypeLabels = {
|
|
@@ -64134,7 +64863,7 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64134
64863
|
"10dlc": "10DLC",
|
|
64135
64864
|
"short-code": "Short code"
|
|
64136
64865
|
};
|
|
64137
|
-
upgradeAction = await
|
|
64866
|
+
upgradeAction = await clack63.select({
|
|
64138
64867
|
message: "What would you like to do?",
|
|
64139
64868
|
options: [
|
|
64140
64869
|
{
|
|
@@ -64174,8 +64903,8 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64174
64903
|
}
|
|
64175
64904
|
]
|
|
64176
64905
|
});
|
|
64177
|
-
if (
|
|
64178
|
-
|
|
64906
|
+
if (clack63.isCancel(upgradeAction)) {
|
|
64907
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64179
64908
|
process.exit(0);
|
|
64180
64909
|
}
|
|
64181
64910
|
let updatedConfig = { ...config2 };
|
|
@@ -64216,65 +64945,65 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64216
64945
|
hint: p3.hint
|
|
64217
64946
|
}));
|
|
64218
64947
|
if (availableTypes.length === 0) {
|
|
64219
|
-
|
|
64948
|
+
clack63.log.warn(
|
|
64220
64949
|
"Already on highest phone number tier. Contact AWS for dedicated short codes."
|
|
64221
64950
|
);
|
|
64222
64951
|
process.exit(0);
|
|
64223
64952
|
}
|
|
64224
|
-
const selectedType = await
|
|
64953
|
+
const selectedType = await clack63.select({
|
|
64225
64954
|
message: "Select new phone number type:",
|
|
64226
64955
|
options: availableTypes
|
|
64227
64956
|
});
|
|
64228
|
-
if (
|
|
64229
|
-
|
|
64957
|
+
if (clack63.isCancel(selectedType)) {
|
|
64958
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64230
64959
|
process.exit(0);
|
|
64231
64960
|
}
|
|
64232
64961
|
if (selectedType === "toll-free") {
|
|
64233
64962
|
console.log(
|
|
64234
64963
|
`
|
|
64235
|
-
${
|
|
64964
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("Toll-free Registration Required")}
|
|
64236
64965
|
`
|
|
64237
64966
|
);
|
|
64238
64967
|
console.log(
|
|
64239
|
-
|
|
64968
|
+
pc66.dim("Toll-free numbers require carrier registration before")
|
|
64240
64969
|
);
|
|
64241
64970
|
console.log(
|
|
64242
|
-
|
|
64971
|
+
pc66.dim("they can send messages at scale. After deployment:\n")
|
|
64243
64972
|
);
|
|
64244
64973
|
console.log(
|
|
64245
|
-
` 1. Run ${
|
|
64974
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start registration`
|
|
64246
64975
|
);
|
|
64247
64976
|
console.log(" 2. Submit your business use case information");
|
|
64248
64977
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
64249
64978
|
console.log(
|
|
64250
|
-
|
|
64979
|
+
pc66.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
64251
64980
|
);
|
|
64252
|
-
const confirmTollFree = await
|
|
64981
|
+
const confirmTollFree = await clack63.confirm({
|
|
64253
64982
|
message: "Continue with toll-free number request?",
|
|
64254
64983
|
initialValue: true
|
|
64255
64984
|
});
|
|
64256
|
-
if (
|
|
64257
|
-
|
|
64985
|
+
if (clack63.isCancel(confirmTollFree) || !confirmTollFree) {
|
|
64986
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64258
64987
|
process.exit(0);
|
|
64259
64988
|
}
|
|
64260
64989
|
}
|
|
64261
64990
|
if (selectedType === "10dlc") {
|
|
64262
64991
|
console.log(
|
|
64263
64992
|
`
|
|
64264
|
-
${
|
|
64993
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("10DLC Campaign Registration Required")}
|
|
64265
64994
|
`
|
|
64266
64995
|
);
|
|
64267
|
-
console.log(
|
|
64996
|
+
console.log(pc66.dim("10DLC requires brand and campaign registration:"));
|
|
64268
64997
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
64269
64998
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
64270
64999
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
64271
65000
|
console.log("");
|
|
64272
|
-
const confirm10DLC = await
|
|
65001
|
+
const confirm10DLC = await clack63.confirm({
|
|
64273
65002
|
message: "Continue with 10DLC number request?",
|
|
64274
65003
|
initialValue: true
|
|
64275
65004
|
});
|
|
64276
|
-
if (
|
|
64277
|
-
|
|
65005
|
+
if (clack63.isCancel(confirm10DLC) || !confirm10DLC) {
|
|
65006
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64278
65007
|
process.exit(0);
|
|
64279
65008
|
}
|
|
64280
65009
|
}
|
|
@@ -64299,15 +65028,15 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64299
65028
|
disabled: currentPresetIdx >= 0 && idx <= currentPresetIdx ? "Current or lower tier" : void 0
|
|
64300
65029
|
})).filter((p3) => !p3.disabled && p3.value !== "custom");
|
|
64301
65030
|
if (availablePresets.length === 0) {
|
|
64302
|
-
|
|
65031
|
+
clack63.log.warn("Already on highest preset (Enterprise)");
|
|
64303
65032
|
process.exit(0);
|
|
64304
65033
|
}
|
|
64305
|
-
const selectedPreset = await
|
|
65034
|
+
const selectedPreset = await clack63.select({
|
|
64306
65035
|
message: "Select new preset:",
|
|
64307
65036
|
options: availablePresets
|
|
64308
65037
|
});
|
|
64309
|
-
if (
|
|
64310
|
-
|
|
65038
|
+
if (clack63.isCancel(selectedPreset)) {
|
|
65039
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64311
65040
|
process.exit(0);
|
|
64312
65041
|
}
|
|
64313
65042
|
const presetConfig = getSMSPreset(selectedPreset);
|
|
@@ -64323,7 +65052,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64323
65052
|
}
|
|
64324
65053
|
case "event-tracking": {
|
|
64325
65054
|
if (config2.eventTracking?.enabled) {
|
|
64326
|
-
const eventAction = await
|
|
65055
|
+
const eventAction = await clack63.select({
|
|
64327
65056
|
message: "What would you like to do with event tracking?",
|
|
64328
65057
|
options: [
|
|
64329
65058
|
{
|
|
@@ -64338,17 +65067,17 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64338
65067
|
}
|
|
64339
65068
|
]
|
|
64340
65069
|
});
|
|
64341
|
-
if (
|
|
64342
|
-
|
|
65070
|
+
if (clack63.isCancel(eventAction)) {
|
|
65071
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64343
65072
|
process.exit(0);
|
|
64344
65073
|
}
|
|
64345
65074
|
if (eventAction === "disable") {
|
|
64346
|
-
const confirmDisable = await
|
|
65075
|
+
const confirmDisable = await clack63.confirm({
|
|
64347
65076
|
message: "Are you sure? Existing history will remain, but new events won't be tracked.",
|
|
64348
65077
|
initialValue: false
|
|
64349
65078
|
});
|
|
64350
|
-
if (
|
|
64351
|
-
|
|
65079
|
+
if (clack63.isCancel(confirmDisable) || !confirmDisable) {
|
|
65080
|
+
clack63.cancel("Event tracking not disabled.");
|
|
64352
65081
|
process.exit(0);
|
|
64353
65082
|
}
|
|
64354
65083
|
updatedConfig = {
|
|
@@ -64358,7 +65087,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64358
65087
|
}
|
|
64359
65088
|
};
|
|
64360
65089
|
} else {
|
|
64361
|
-
const retention = await
|
|
65090
|
+
const retention = await clack63.select({
|
|
64362
65091
|
message: "Message history retention period:",
|
|
64363
65092
|
options: [
|
|
64364
65093
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64385,8 +65114,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64385
65114
|
],
|
|
64386
65115
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
64387
65116
|
});
|
|
64388
|
-
if (
|
|
64389
|
-
|
|
65117
|
+
if (clack63.isCancel(retention)) {
|
|
65118
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64390
65119
|
process.exit(0);
|
|
64391
65120
|
}
|
|
64392
65121
|
updatedConfig = {
|
|
@@ -64398,19 +65127,19 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64398
65127
|
};
|
|
64399
65128
|
}
|
|
64400
65129
|
} else {
|
|
64401
|
-
const enableTracking = await
|
|
65130
|
+
const enableTracking = await clack63.confirm({
|
|
64402
65131
|
message: "Enable event tracking? (Track SMS events with history)",
|
|
64403
65132
|
initialValue: true
|
|
64404
65133
|
});
|
|
64405
|
-
if (
|
|
64406
|
-
|
|
65134
|
+
if (clack63.isCancel(enableTracking)) {
|
|
65135
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64407
65136
|
process.exit(0);
|
|
64408
65137
|
}
|
|
64409
65138
|
if (!enableTracking) {
|
|
64410
|
-
|
|
65139
|
+
clack63.log.info("Event tracking not enabled.");
|
|
64411
65140
|
process.exit(0);
|
|
64412
65141
|
}
|
|
64413
|
-
const retention = await
|
|
65142
|
+
const retention = await clack63.select({
|
|
64414
65143
|
message: "Message history retention period:",
|
|
64415
65144
|
options: [
|
|
64416
65145
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64433,8 +65162,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64433
65162
|
],
|
|
64434
65163
|
initialValue: "90days"
|
|
64435
65164
|
});
|
|
64436
|
-
if (
|
|
64437
|
-
|
|
65165
|
+
if (clack63.isCancel(retention)) {
|
|
65166
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64438
65167
|
process.exit(0);
|
|
64439
65168
|
}
|
|
64440
65169
|
updatedConfig = {
|
|
@@ -64453,12 +65182,12 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64453
65182
|
}
|
|
64454
65183
|
case "retention": {
|
|
64455
65184
|
if (!config2.eventTracking?.enabled) {
|
|
64456
|
-
|
|
65185
|
+
clack63.log.error(
|
|
64457
65186
|
"Event tracking is not enabled. Enable it first to change retention."
|
|
64458
65187
|
);
|
|
64459
65188
|
process.exit(1);
|
|
64460
65189
|
}
|
|
64461
|
-
const retention = await
|
|
65190
|
+
const retention = await clack63.select({
|
|
64462
65191
|
message: "Message history retention period (event data in DynamoDB):",
|
|
64463
65192
|
options: [
|
|
64464
65193
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64477,8 +65206,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64477
65206
|
],
|
|
64478
65207
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
64479
65208
|
});
|
|
64480
|
-
if (
|
|
64481
|
-
|
|
65209
|
+
if (clack63.isCancel(retention)) {
|
|
65210
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64482
65211
|
process.exit(0);
|
|
64483
65212
|
}
|
|
64484
65213
|
updatedConfig = {
|
|
@@ -64496,21 +65225,21 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64496
65225
|
case "link-tracking": {
|
|
64497
65226
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
64498
65227
|
if (enableLinkTracking) {
|
|
64499
|
-
|
|
64500
|
-
|
|
65228
|
+
clack63.log.info(
|
|
65229
|
+
pc66.dim(
|
|
64501
65230
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
64502
65231
|
)
|
|
64503
65232
|
);
|
|
64504
|
-
|
|
64505
|
-
|
|
65233
|
+
clack63.log.info(
|
|
65234
|
+
pc66.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
64506
65235
|
);
|
|
64507
65236
|
}
|
|
64508
|
-
const confirmed = await
|
|
65237
|
+
const confirmed = await clack63.confirm({
|
|
64509
65238
|
message: enableLinkTracking ? "Enable link click tracking?" : "Disable link click tracking?",
|
|
64510
65239
|
initialValue: enableLinkTracking
|
|
64511
65240
|
});
|
|
64512
|
-
if (
|
|
64513
|
-
|
|
65241
|
+
if (clack63.isCancel(confirmed) || !confirmed) {
|
|
65242
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64514
65243
|
process.exit(0);
|
|
64515
65244
|
}
|
|
64516
65245
|
updatedConfig = {
|
|
@@ -64527,7 +65256,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64527
65256
|
}
|
|
64528
65257
|
case "archiving": {
|
|
64529
65258
|
if (config2.messageArchiving?.enabled) {
|
|
64530
|
-
const archivingAction = await
|
|
65259
|
+
const archivingAction = await clack63.select({
|
|
64531
65260
|
message: "What would you like to do with message archiving?",
|
|
64532
65261
|
options: [
|
|
64533
65262
|
{
|
|
@@ -64542,17 +65271,17 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64542
65271
|
}
|
|
64543
65272
|
]
|
|
64544
65273
|
});
|
|
64545
|
-
if (
|
|
64546
|
-
|
|
65274
|
+
if (clack63.isCancel(archivingAction)) {
|
|
65275
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64547
65276
|
process.exit(0);
|
|
64548
65277
|
}
|
|
64549
65278
|
if (archivingAction === "disable") {
|
|
64550
|
-
const confirmDisable = await
|
|
65279
|
+
const confirmDisable = await clack63.confirm({
|
|
64551
65280
|
message: "Are you sure? Existing archived messages will remain, but new messages won't be archived.",
|
|
64552
65281
|
initialValue: false
|
|
64553
65282
|
});
|
|
64554
|
-
if (
|
|
64555
|
-
|
|
65283
|
+
if (clack63.isCancel(confirmDisable) || !confirmDisable) {
|
|
65284
|
+
clack63.cancel("Archiving not disabled.");
|
|
64556
65285
|
process.exit(0);
|
|
64557
65286
|
}
|
|
64558
65287
|
updatedConfig = {
|
|
@@ -64563,7 +65292,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64563
65292
|
}
|
|
64564
65293
|
};
|
|
64565
65294
|
} else {
|
|
64566
|
-
const retention = await
|
|
65295
|
+
const retention = await clack63.select({
|
|
64567
65296
|
message: "Message archive retention period:",
|
|
64568
65297
|
options: [
|
|
64569
65298
|
{
|
|
@@ -64594,8 +65323,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64594
65323
|
],
|
|
64595
65324
|
initialValue: config2.messageArchiving.retention
|
|
64596
65325
|
});
|
|
64597
|
-
if (
|
|
64598
|
-
|
|
65326
|
+
if (clack63.isCancel(retention)) {
|
|
65327
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64599
65328
|
process.exit(0);
|
|
64600
65329
|
}
|
|
64601
65330
|
updatedConfig = {
|
|
@@ -64607,19 +65336,19 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64607
65336
|
};
|
|
64608
65337
|
}
|
|
64609
65338
|
} else {
|
|
64610
|
-
const enableArchiving = await
|
|
65339
|
+
const enableArchiving = await clack63.confirm({
|
|
64611
65340
|
message: "Enable message archiving? (Store full message content for viewing)",
|
|
64612
65341
|
initialValue: true
|
|
64613
65342
|
});
|
|
64614
|
-
if (
|
|
64615
|
-
|
|
65343
|
+
if (clack63.isCancel(enableArchiving)) {
|
|
65344
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64616
65345
|
process.exit(0);
|
|
64617
65346
|
}
|
|
64618
65347
|
if (!enableArchiving) {
|
|
64619
|
-
|
|
65348
|
+
clack63.log.info("Message archiving not enabled.");
|
|
64620
65349
|
process.exit(0);
|
|
64621
65350
|
}
|
|
64622
|
-
const retention = await
|
|
65351
|
+
const retention = await clack63.select({
|
|
64623
65352
|
message: "Message archive retention period:",
|
|
64624
65353
|
options: [
|
|
64625
65354
|
{ value: "7days", label: "7 days", hint: "~$1-2/mo for 10k msgs" },
|
|
@@ -64646,8 +65375,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64646
65375
|
],
|
|
64647
65376
|
initialValue: "90days"
|
|
64648
65377
|
});
|
|
64649
|
-
if (
|
|
64650
|
-
|
|
65378
|
+
if (clack63.isCancel(retention)) {
|
|
65379
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64651
65380
|
process.exit(0);
|
|
64652
65381
|
}
|
|
64653
65382
|
updatedConfig = {
|
|
@@ -64679,7 +65408,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64679
65408
|
const currentAllowed = config2.protectConfiguration?.allowedCountries || [
|
|
64680
65409
|
"US"
|
|
64681
65410
|
];
|
|
64682
|
-
const selectedCountries = await
|
|
65411
|
+
const selectedCountries = await clack63.multiselect({
|
|
64683
65412
|
message: "Select countries to allow SMS delivery (all others blocked):",
|
|
64684
65413
|
options: commonCountries.map((c6) => ({
|
|
64685
65414
|
value: c6.code,
|
|
@@ -64688,16 +65417,16 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64688
65417
|
initialValues: currentAllowed,
|
|
64689
65418
|
required: true
|
|
64690
65419
|
});
|
|
64691
|
-
if (
|
|
64692
|
-
|
|
65420
|
+
if (clack63.isCancel(selectedCountries)) {
|
|
65421
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64693
65422
|
process.exit(0);
|
|
64694
65423
|
}
|
|
64695
|
-
const enableAIT = await
|
|
65424
|
+
const enableAIT = await clack63.confirm({
|
|
64696
65425
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
64697
65426
|
initialValue: config2.protectConfiguration?.aitFiltering ?? false
|
|
64698
65427
|
});
|
|
64699
|
-
if (
|
|
64700
|
-
|
|
65428
|
+
if (clack63.isCancel(enableAIT)) {
|
|
65429
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64701
65430
|
process.exit(0);
|
|
64702
65431
|
}
|
|
64703
65432
|
updatedConfig = {
|
|
@@ -64715,28 +65444,28 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64715
65444
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
64716
65445
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
64717
65446
|
console.log(`
|
|
64718
|
-
${
|
|
65447
|
+
${pc66.bold("Cost Impact:")}`);
|
|
64719
65448
|
console.log(
|
|
64720
|
-
` Current: ${
|
|
65449
|
+
` Current: ${pc66.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
64721
65450
|
);
|
|
64722
65451
|
console.log(
|
|
64723
|
-
` New: ${
|
|
65452
|
+
` New: ${pc66.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
64724
65453
|
);
|
|
64725
65454
|
if (costDiff > 0) {
|
|
64726
|
-
console.log(` Change: ${
|
|
65455
|
+
console.log(` Change: ${pc66.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
64727
65456
|
} else if (costDiff < 0) {
|
|
64728
65457
|
console.log(
|
|
64729
|
-
` Change: ${
|
|
65458
|
+
` Change: ${pc66.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
64730
65459
|
);
|
|
64731
65460
|
}
|
|
64732
65461
|
console.log("");
|
|
64733
65462
|
if (!(options.yes || options.preview)) {
|
|
64734
|
-
const confirmed = await
|
|
65463
|
+
const confirmed = await clack63.confirm({
|
|
64735
65464
|
message: "Proceed with upgrade?",
|
|
64736
65465
|
initialValue: true
|
|
64737
65466
|
});
|
|
64738
|
-
if (
|
|
64739
|
-
|
|
65467
|
+
if (clack63.isCancel(confirmed) || !confirmed) {
|
|
65468
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64740
65469
|
process.exit(0);
|
|
64741
65470
|
}
|
|
64742
65471
|
}
|
|
@@ -64805,8 +65534,8 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
64805
65534
|
resourceChanges: previewResult.resourceChanges,
|
|
64806
65535
|
commandName: "wraps sms upgrade"
|
|
64807
65536
|
});
|
|
64808
|
-
|
|
64809
|
-
|
|
65537
|
+
clack63.outro(
|
|
65538
|
+
pc66.green("Preview complete. Run without --preview to upgrade.")
|
|
64810
65539
|
);
|
|
64811
65540
|
trackServiceUpgrade("sms", {
|
|
64812
65541
|
region,
|
|
@@ -64911,43 +65640,43 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
64911
65640
|
}
|
|
64912
65641
|
progress.info("Connection metadata updated");
|
|
64913
65642
|
console.log("\n");
|
|
64914
|
-
|
|
65643
|
+
clack63.log.success(pc66.green(pc66.bold("SMS infrastructure upgraded!")));
|
|
64915
65644
|
console.log("\n");
|
|
64916
|
-
|
|
65645
|
+
clack63.note(
|
|
64917
65646
|
[
|
|
64918
|
-
`${
|
|
64919
|
-
`${
|
|
64920
|
-
`${
|
|
64921
|
-
`${
|
|
64922
|
-
outputs.tableName ? `${
|
|
65647
|
+
`${pc66.bold("Phone Number:")} ${pc66.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
65648
|
+
`${pc66.bold("Phone Type:")} ${pc66.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
65649
|
+
`${pc66.bold("Config Set:")} ${pc66.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
65650
|
+
`${pc66.bold("Region:")} ${pc66.cyan(outputs.region)}`,
|
|
65651
|
+
outputs.tableName ? `${pc66.bold("History Table:")} ${pc66.cyan(outputs.tableName)}` : "",
|
|
64923
65652
|
"",
|
|
64924
|
-
|
|
64925
|
-
|
|
65653
|
+
pc66.dim("IAM Role:"),
|
|
65654
|
+
pc66.dim(` ${outputs.roleArn}`)
|
|
64926
65655
|
].filter(Boolean).join("\n"),
|
|
64927
65656
|
"SMS Infrastructure"
|
|
64928
65657
|
);
|
|
64929
65658
|
console.log(`
|
|
64930
|
-
${
|
|
65659
|
+
${pc66.green("\u2713")} ${pc66.bold("Upgrade complete!")}
|
|
64931
65660
|
`);
|
|
64932
65661
|
if (upgradeAction === "phone-number") {
|
|
64933
65662
|
console.log(
|
|
64934
|
-
`Upgraded to ${
|
|
65663
|
+
`Upgraded to ${pc66.cyan(updatedConfig.phoneNumberType)} number (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64935
65664
|
`
|
|
64936
65665
|
);
|
|
64937
65666
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
64938
|
-
console.log(`${
|
|
65667
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
64939
65668
|
console.log(
|
|
64940
|
-
` 1. Run ${
|
|
65669
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start toll-free registration`
|
|
64941
65670
|
);
|
|
64942
65671
|
console.log(" 2. Submit your business information and use case");
|
|
64943
65672
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
64944
65673
|
console.log("");
|
|
64945
65674
|
console.log(
|
|
64946
|
-
|
|
65675
|
+
pc66.dim("Until verified, your number can only send limited messages.")
|
|
64947
65676
|
);
|
|
64948
65677
|
console.log("");
|
|
64949
65678
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
64950
|
-
console.log(`${
|
|
65679
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
64951
65680
|
console.log(" 1. Register your brand in the AWS Console");
|
|
64952
65681
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
64953
65682
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -64955,16 +65684,16 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
64955
65684
|
}
|
|
64956
65685
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
64957
65686
|
console.log(
|
|
64958
|
-
`Upgraded to ${
|
|
65687
|
+
`Upgraded to ${pc66.cyan(newPreset)} preset (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64959
65688
|
`
|
|
64960
65689
|
);
|
|
64961
65690
|
} else {
|
|
64962
65691
|
console.log(
|
|
64963
|
-
`Updated configuration (${
|
|
65692
|
+
`Updated configuration (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64964
65693
|
`
|
|
64965
65694
|
);
|
|
64966
65695
|
}
|
|
64967
|
-
console.log(
|
|
65696
|
+
console.log(pc66.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
64968
65697
|
const enabledFeatures = [];
|
|
64969
65698
|
if (updatedConfig.tracking?.enabled) {
|
|
64970
65699
|
enabledFeatures.push("tracking");
|
|
@@ -64988,7 +65717,7 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
64988
65717
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
64989
65718
|
duration_ms: Date.now() - startTime
|
|
64990
65719
|
});
|
|
64991
|
-
|
|
65720
|
+
clack63.outro(pc66.green("Upgrade complete!"));
|
|
64992
65721
|
}
|
|
64993
65722
|
|
|
64994
65723
|
// src/commands/sms/verify-number.ts
|
|
@@ -65007,13 +65736,13 @@ import {
|
|
|
65007
65736
|
SendDestinationNumberVerificationCodeCommand,
|
|
65008
65737
|
VerifyDestinationNumberCommand
|
|
65009
65738
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
65010
|
-
import * as
|
|
65011
|
-
import
|
|
65739
|
+
import * as clack64 from "@clack/prompts";
|
|
65740
|
+
import pc67 from "picocolors";
|
|
65012
65741
|
async function smsVerifyNumber(options) {
|
|
65013
65742
|
const startTime = Date.now();
|
|
65014
65743
|
const progress = new DeploymentProgress();
|
|
65015
65744
|
if (!isJsonMode()) {
|
|
65016
|
-
|
|
65745
|
+
clack64.intro(pc67.bold("Wraps SMS - Verify Destination Number"));
|
|
65017
65746
|
}
|
|
65018
65747
|
const identity = await progress.execute(
|
|
65019
65748
|
"Validating AWS credentials",
|
|
@@ -65023,10 +65752,10 @@ async function smsVerifyNumber(options) {
|
|
|
65023
65752
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
65024
65753
|
if (!metadata?.services?.sms) {
|
|
65025
65754
|
progress.stop();
|
|
65026
|
-
|
|
65755
|
+
clack64.log.error("No SMS infrastructure found");
|
|
65027
65756
|
console.log(
|
|
65028
65757
|
`
|
|
65029
|
-
Run ${
|
|
65758
|
+
Run ${pc67.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
65030
65759
|
`
|
|
65031
65760
|
);
|
|
65032
65761
|
process.exit(1);
|
|
@@ -65040,19 +65769,19 @@ Run ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
65040
65769
|
);
|
|
65041
65770
|
progress.stop();
|
|
65042
65771
|
if (!response.VerifiedDestinationNumbers || response.VerifiedDestinationNumbers.length === 0) {
|
|
65043
|
-
|
|
65772
|
+
clack64.log.info("No verified destination numbers found");
|
|
65044
65773
|
console.log(
|
|
65045
65774
|
`
|
|
65046
|
-
Run ${
|
|
65775
|
+
Run ${pc67.cyan("wraps sms verify-number")} to verify a number.
|
|
65047
65776
|
`
|
|
65048
65777
|
);
|
|
65049
65778
|
} else {
|
|
65050
65779
|
console.log("\n");
|
|
65051
|
-
|
|
65780
|
+
clack64.log.info(pc67.bold("Verified Destination Numbers:"));
|
|
65052
65781
|
console.log("");
|
|
65053
65782
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
65054
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
65055
|
-
console.log(` ${
|
|
65783
|
+
const status2 = num.Status === "VERIFIED" ? pc67.green("\u2713 Verified") : pc67.yellow("\u29D6 Pending");
|
|
65784
|
+
console.log(` ${pc67.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
65056
65785
|
}
|
|
65057
65786
|
console.log("");
|
|
65058
65787
|
}
|
|
@@ -65070,7 +65799,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65070
65799
|
});
|
|
65071
65800
|
return;
|
|
65072
65801
|
}
|
|
65073
|
-
|
|
65802
|
+
clack64.outro(pc67.green("Done!"));
|
|
65074
65803
|
return;
|
|
65075
65804
|
} catch (error) {
|
|
65076
65805
|
progress.stop();
|
|
@@ -65078,7 +65807,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65078
65807
|
trackError("SMS_LIST_VERIFIED_FAILED", "sms:verify-number:list", {
|
|
65079
65808
|
error: errorMessage
|
|
65080
65809
|
});
|
|
65081
|
-
|
|
65810
|
+
clack64.log.error(`Failed to list verified numbers: ${errorMessage}`);
|
|
65082
65811
|
process.exit(1);
|
|
65083
65812
|
}
|
|
65084
65813
|
}
|
|
@@ -65086,10 +65815,10 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65086
65815
|
const phoneNumber2 = options.phoneNumber;
|
|
65087
65816
|
if (!phoneNumber2) {
|
|
65088
65817
|
progress.stop();
|
|
65089
|
-
|
|
65818
|
+
clack64.log.error("Phone number is required for deletion");
|
|
65090
65819
|
console.log(
|
|
65091
65820
|
`
|
|
65092
|
-
Usage: ${
|
|
65821
|
+
Usage: ${pc67.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
65093
65822
|
`
|
|
65094
65823
|
);
|
|
65095
65824
|
process.exit(1);
|
|
@@ -65103,7 +65832,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65103
65832
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65104
65833
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65105
65834
|
progress.stop();
|
|
65106
|
-
|
|
65835
|
+
clack64.log.error(`Number ${phoneNumber2} is not in verified list`);
|
|
65107
65836
|
process.exit(1);
|
|
65108
65837
|
}
|
|
65109
65838
|
await progress.execute(`Removing ${phoneNumber2}`, async () => {
|
|
@@ -65114,7 +65843,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65114
65843
|
);
|
|
65115
65844
|
});
|
|
65116
65845
|
progress.stop();
|
|
65117
|
-
|
|
65846
|
+
clack64.log.success(`Removed ${pc67.cyan(phoneNumber2)} from verified list`);
|
|
65118
65847
|
trackCommand("sms:verify-number:delete", {
|
|
65119
65848
|
success: true,
|
|
65120
65849
|
duration_ms: Date.now() - startTime
|
|
@@ -65126,7 +65855,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65126
65855
|
});
|
|
65127
65856
|
return;
|
|
65128
65857
|
}
|
|
65129
|
-
|
|
65858
|
+
clack64.outro(pc67.green("Done!"));
|
|
65130
65859
|
return;
|
|
65131
65860
|
} catch (error) {
|
|
65132
65861
|
progress.stop();
|
|
@@ -65134,7 +65863,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65134
65863
|
trackError("SMS_DELETE_VERIFIED_FAILED", "sms:verify-number:delete", {
|
|
65135
65864
|
error: errorMessage
|
|
65136
65865
|
});
|
|
65137
|
-
|
|
65866
|
+
clack64.log.error(`Failed to delete verified number: ${errorMessage}`);
|
|
65138
65867
|
process.exit(1);
|
|
65139
65868
|
}
|
|
65140
65869
|
}
|
|
@@ -65147,7 +65876,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65147
65876
|
);
|
|
65148
65877
|
}
|
|
65149
65878
|
if (!phoneNumber) {
|
|
65150
|
-
const result = await
|
|
65879
|
+
const result = await clack64.text({
|
|
65151
65880
|
message: "Enter phone number to verify (E.164 format):",
|
|
65152
65881
|
placeholder: "+14155551234",
|
|
65153
65882
|
validate: (value) => {
|
|
@@ -65160,14 +65889,14 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65160
65889
|
return;
|
|
65161
65890
|
}
|
|
65162
65891
|
});
|
|
65163
|
-
if (
|
|
65164
|
-
|
|
65892
|
+
if (clack64.isCancel(result)) {
|
|
65893
|
+
clack64.cancel("Operation cancelled.");
|
|
65165
65894
|
process.exit(0);
|
|
65166
65895
|
}
|
|
65167
65896
|
phoneNumber = result;
|
|
65168
65897
|
} else if (!isValidPhoneNumber(phoneNumber)) {
|
|
65169
65898
|
progress.stop();
|
|
65170
|
-
|
|
65899
|
+
clack64.log.error(
|
|
65171
65900
|
`Invalid phone number format: ${phoneNumber}. Use E.164 format (e.g., +14155551234)`
|
|
65172
65901
|
);
|
|
65173
65902
|
process.exit(1);
|
|
@@ -65182,7 +65911,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65182
65911
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65183
65912
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65184
65913
|
progress.stop();
|
|
65185
|
-
|
|
65914
|
+
clack64.log.error(
|
|
65186
65915
|
`Number ${phoneNumber} not found. Run without --code first.`
|
|
65187
65916
|
);
|
|
65188
65917
|
process.exit(1);
|
|
@@ -65197,12 +65926,12 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65197
65926
|
});
|
|
65198
65927
|
progress.stop();
|
|
65199
65928
|
console.log("\n");
|
|
65200
|
-
|
|
65201
|
-
|
|
65929
|
+
clack64.log.success(
|
|
65930
|
+
pc67.green(`Phone number ${pc67.cyan(phoneNumber)} verified!`)
|
|
65202
65931
|
);
|
|
65203
65932
|
console.log("");
|
|
65204
65933
|
console.log(
|
|
65205
|
-
`You can now send test messages to this number with ${
|
|
65934
|
+
`You can now send test messages to this number with ${pc67.cyan("wraps sms test")}`
|
|
65206
65935
|
);
|
|
65207
65936
|
trackCommand("sms:verify-number:confirm", {
|
|
65208
65937
|
success: true,
|
|
@@ -65215,23 +65944,23 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65215
65944
|
});
|
|
65216
65945
|
return;
|
|
65217
65946
|
}
|
|
65218
|
-
|
|
65947
|
+
clack64.outro(pc67.green("Verification complete!"));
|
|
65219
65948
|
return;
|
|
65220
65949
|
} catch (error) {
|
|
65221
65950
|
progress.stop();
|
|
65222
65951
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65223
65952
|
if (errorMessage.includes("Invalid verification code")) {
|
|
65224
|
-
|
|
65953
|
+
clack64.log.error("Invalid verification code. Please try again.");
|
|
65225
65954
|
console.log(
|
|
65226
65955
|
`
|
|
65227
|
-
Run ${
|
|
65956
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
65228
65957
|
`
|
|
65229
65958
|
);
|
|
65230
65959
|
} else {
|
|
65231
65960
|
trackError("SMS_VERIFY_CODE_FAILED", "sms:verify-number:confirm", {
|
|
65232
65961
|
error: errorMessage
|
|
65233
65962
|
});
|
|
65234
|
-
|
|
65963
|
+
clack64.log.error(`Verification failed: ${errorMessage}`);
|
|
65235
65964
|
}
|
|
65236
65965
|
process.exit(1);
|
|
65237
65966
|
}
|
|
@@ -65246,7 +65975,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65246
65975
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65247
65976
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65248
65977
|
progress.stop();
|
|
65249
|
-
|
|
65978
|
+
clack64.log.error(
|
|
65250
65979
|
`Number ${phoneNumber} not found. Run without --resend first.`
|
|
65251
65980
|
);
|
|
65252
65981
|
process.exit(1);
|
|
@@ -65260,11 +65989,11 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65260
65989
|
);
|
|
65261
65990
|
});
|
|
65262
65991
|
progress.stop();
|
|
65263
|
-
|
|
65992
|
+
clack64.log.success(`Verification code resent to ${pc67.cyan(phoneNumber)}`);
|
|
65264
65993
|
console.log("");
|
|
65265
65994
|
console.log(
|
|
65266
65995
|
`Once you receive the code, run:
|
|
65267
|
-
${
|
|
65996
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
65268
65997
|
);
|
|
65269
65998
|
trackCommand("sms:verify-number:resend", {
|
|
65270
65999
|
success: true,
|
|
@@ -65277,7 +66006,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65277
66006
|
});
|
|
65278
66007
|
return;
|
|
65279
66008
|
}
|
|
65280
|
-
|
|
66009
|
+
clack64.outro(pc67.green("Code sent!"));
|
|
65281
66010
|
return;
|
|
65282
66011
|
} catch (error) {
|
|
65283
66012
|
progress.stop();
|
|
@@ -65285,7 +66014,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65285
66014
|
trackError("SMS_RESEND_CODE_FAILED", "sms:verify-number:resend", {
|
|
65286
66015
|
error: errorMessage
|
|
65287
66016
|
});
|
|
65288
|
-
|
|
66017
|
+
clack64.log.error(`Failed to resend code: ${errorMessage}`);
|
|
65289
66018
|
process.exit(1);
|
|
65290
66019
|
}
|
|
65291
66020
|
}
|
|
@@ -65305,10 +66034,10 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65305
66034
|
});
|
|
65306
66035
|
return;
|
|
65307
66036
|
}
|
|
65308
|
-
|
|
65309
|
-
`Number ${
|
|
66037
|
+
clack64.log.info(
|
|
66038
|
+
`Number ${pc67.cyan(phoneNumber)} is already verified and ready to use!`
|
|
65310
66039
|
);
|
|
65311
|
-
|
|
66040
|
+
clack64.outro(pc67.green("Done!"));
|
|
65312
66041
|
return;
|
|
65313
66042
|
}
|
|
65314
66043
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -65332,15 +66061,15 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65332
66061
|
});
|
|
65333
66062
|
return;
|
|
65334
66063
|
}
|
|
65335
|
-
|
|
65336
|
-
`Verification already in progress. New code sent to ${
|
|
66064
|
+
clack64.log.info(
|
|
66065
|
+
`Verification already in progress. New code sent to ${pc67.cyan(phoneNumber)}`
|
|
65337
66066
|
);
|
|
65338
66067
|
console.log("");
|
|
65339
66068
|
console.log(
|
|
65340
66069
|
`Once you receive the code, run:
|
|
65341
|
-
${
|
|
66070
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
65342
66071
|
);
|
|
65343
|
-
|
|
66072
|
+
clack64.outro(pc67.green("Code sent!"));
|
|
65344
66073
|
return;
|
|
65345
66074
|
}
|
|
65346
66075
|
const createResponse = await progress.execute(
|
|
@@ -65361,18 +66090,18 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65361
66090
|
});
|
|
65362
66091
|
progress.stop();
|
|
65363
66092
|
console.log("\n");
|
|
65364
|
-
|
|
65365
|
-
`Verification code sent to ${
|
|
66093
|
+
clack64.log.success(
|
|
66094
|
+
`Verification code sent to ${pc67.cyan(phoneNumber)} via SMS`
|
|
65366
66095
|
);
|
|
65367
66096
|
console.log("");
|
|
65368
|
-
|
|
66097
|
+
clack64.note(
|
|
65369
66098
|
[
|
|
65370
66099
|
"1. Check your phone for the verification code",
|
|
65371
66100
|
"",
|
|
65372
66101
|
"2. Complete verification with:",
|
|
65373
|
-
` ${
|
|
66102
|
+
` ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
65374
66103
|
"",
|
|
65375
|
-
|
|
66104
|
+
pc67.dim("The code expires in 24 hours")
|
|
65376
66105
|
].join("\n"),
|
|
65377
66106
|
"Next Steps"
|
|
65378
66107
|
);
|
|
@@ -65388,22 +66117,22 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65388
66117
|
});
|
|
65389
66118
|
return;
|
|
65390
66119
|
}
|
|
65391
|
-
|
|
66120
|
+
clack64.outro(pc67.green("Verification started!"));
|
|
65392
66121
|
} catch (error) {
|
|
65393
66122
|
progress.stop();
|
|
65394
66123
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65395
66124
|
if (errorMessage.includes("already exists")) {
|
|
65396
|
-
|
|
66125
|
+
clack64.log.error("This number is already being verified");
|
|
65397
66126
|
console.log(
|
|
65398
66127
|
`
|
|
65399
|
-
Run ${
|
|
66128
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
65400
66129
|
`
|
|
65401
66130
|
);
|
|
65402
66131
|
} else {
|
|
65403
66132
|
trackError("SMS_CREATE_VERIFIED_FAILED", "sms:verify-number:start", {
|
|
65404
66133
|
error: errorMessage
|
|
65405
66134
|
});
|
|
65406
|
-
|
|
66135
|
+
clack64.log.error(`Failed to start verification: ${errorMessage}`);
|
|
65407
66136
|
}
|
|
65408
66137
|
process.exit(1);
|
|
65409
66138
|
}
|
|
@@ -65412,91 +66141,91 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65412
66141
|
// src/commands/support.ts
|
|
65413
66142
|
init_esm_shims();
|
|
65414
66143
|
init_events();
|
|
65415
|
-
import * as
|
|
65416
|
-
import
|
|
66144
|
+
import * as clack65 from "@clack/prompts";
|
|
66145
|
+
import pc68 from "picocolors";
|
|
65417
66146
|
async function support() {
|
|
65418
66147
|
trackCommand("support", { success: true });
|
|
65419
|
-
|
|
66148
|
+
clack65.intro(pc68.bold("Get Help with Wraps"));
|
|
65420
66149
|
console.log();
|
|
65421
|
-
console.log(` ${
|
|
66150
|
+
console.log(` ${pc68.bold("Email:")} ${pc68.cyan("hey@wraps.dev")}`);
|
|
65422
66151
|
console.log(
|
|
65423
|
-
` ${
|
|
66152
|
+
` ${pc68.bold("GitHub:")} ${pc68.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
65424
66153
|
);
|
|
65425
|
-
console.log(` ${
|
|
66154
|
+
console.log(` ${pc68.bold("Docs:")} ${pc68.cyan("https://wraps.dev/docs")}`);
|
|
65426
66155
|
console.log(
|
|
65427
|
-
` ${
|
|
66156
|
+
` ${pc68.bold("AI docs:")} ${pc68.cyan("https://wraps.dev/llms-full.txt")} ${pc68.dim("(complete docs, one file)")}`
|
|
65428
66157
|
);
|
|
65429
66158
|
console.log();
|
|
65430
|
-
console.log(
|
|
66159
|
+
console.log(pc68.dim(" Response time: Usually within 24 hours"));
|
|
65431
66160
|
console.log();
|
|
65432
66161
|
}
|
|
65433
66162
|
|
|
65434
66163
|
// src/commands/telemetry.ts
|
|
65435
66164
|
init_esm_shims();
|
|
65436
66165
|
init_client();
|
|
65437
|
-
import * as
|
|
65438
|
-
import
|
|
66166
|
+
import * as clack66 from "@clack/prompts";
|
|
66167
|
+
import pc69 from "picocolors";
|
|
65439
66168
|
async function telemetryEnable() {
|
|
65440
66169
|
const client2 = getTelemetryClient();
|
|
65441
66170
|
const override = client2.enable();
|
|
65442
66171
|
if (override) {
|
|
65443
|
-
|
|
66172
|
+
clack66.log.warn(
|
|
65444
66173
|
"Telemetry enabled in config, but overridden by environment"
|
|
65445
66174
|
);
|
|
65446
|
-
console.log(` Reason: ${
|
|
65447
|
-
console.log(` Config: ${
|
|
66175
|
+
console.log(` Reason: ${pc69.yellow(override)}`);
|
|
66176
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65448
66177
|
console.log();
|
|
65449
66178
|
} else {
|
|
65450
|
-
|
|
65451
|
-
console.log(` Config: ${
|
|
66179
|
+
clack66.log.success(pc69.green("Telemetry enabled"));
|
|
66180
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65452
66181
|
console.log(`
|
|
65453
|
-
${
|
|
66182
|
+
${pc69.dim("Thank you for helping improve Wraps!")}
|
|
65454
66183
|
`);
|
|
65455
66184
|
}
|
|
65456
66185
|
}
|
|
65457
66186
|
async function telemetryDisable() {
|
|
65458
66187
|
const client2 = getTelemetryClient();
|
|
65459
66188
|
client2.disable();
|
|
65460
|
-
|
|
65461
|
-
console.log(` Config: ${
|
|
66189
|
+
clack66.log.success(pc69.green("Telemetry disabled"));
|
|
66190
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65462
66191
|
console.log(
|
|
65463
66192
|
`
|
|
65464
|
-
${
|
|
66193
|
+
${pc69.dim("You can re-enable with:")} wraps telemetry enable
|
|
65465
66194
|
`
|
|
65466
66195
|
);
|
|
65467
66196
|
}
|
|
65468
66197
|
async function telemetryStatus() {
|
|
65469
66198
|
const client2 = getTelemetryClient();
|
|
65470
|
-
|
|
66199
|
+
clack66.intro(pc69.bold("Telemetry Status"));
|
|
65471
66200
|
const override = client2.getEnvOverride();
|
|
65472
|
-
const status2 = client2.isEnabled() ?
|
|
66201
|
+
const status2 = client2.isEnabled() ? pc69.green("Enabled") : pc69.red("Disabled");
|
|
65473
66202
|
console.log();
|
|
65474
|
-
console.log(` ${
|
|
66203
|
+
console.log(` ${pc69.bold("Status:")} ${status2}`);
|
|
65475
66204
|
if (!client2.isEnabled() && override) {
|
|
65476
|
-
console.log(` ${
|
|
66205
|
+
console.log(` ${pc69.bold("Reason:")} ${pc69.yellow(override)}`);
|
|
65477
66206
|
}
|
|
65478
|
-
console.log(` ${
|
|
66207
|
+
console.log(` ${pc69.bold("Config file:")} ${pc69.dim(client2.getConfigPath())}`);
|
|
65479
66208
|
if (client2.isEnabled()) {
|
|
65480
66209
|
console.log();
|
|
65481
|
-
console.log(
|
|
65482
|
-
console.log(` ${
|
|
66210
|
+
console.log(pc69.bold(" How to opt-out:"));
|
|
66211
|
+
console.log(` ${pc69.cyan("wraps telemetry disable")}`);
|
|
65483
66212
|
console.log(
|
|
65484
|
-
` ${
|
|
66213
|
+
` ${pc69.dim("Or set:")} ${pc69.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
65485
66214
|
);
|
|
65486
|
-
console.log(` ${
|
|
66215
|
+
console.log(` ${pc69.dim("Or set:")} ${pc69.cyan("DO_NOT_TRACK=1")}`);
|
|
65487
66216
|
} else {
|
|
65488
66217
|
console.log();
|
|
65489
|
-
console.log(
|
|
65490
|
-
console.log(` ${
|
|
66218
|
+
console.log(pc69.bold(" How to opt-in:"));
|
|
66219
|
+
console.log(` ${pc69.cyan("wraps telemetry enable")}`);
|
|
65491
66220
|
}
|
|
65492
66221
|
console.log();
|
|
65493
|
-
console.log(
|
|
66222
|
+
console.log(pc69.bold(" Debug mode:"));
|
|
65494
66223
|
console.log(
|
|
65495
|
-
` ${
|
|
66224
|
+
` ${pc69.dim("See what would be sent:")} ${pc69.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
65496
66225
|
);
|
|
65497
66226
|
console.log();
|
|
65498
66227
|
console.log(
|
|
65499
|
-
` ${
|
|
66228
|
+
` ${pc69.dim("Learn more:")} ${pc69.cyan("https://wraps.dev/docs/telemetry")}`
|
|
65500
66229
|
);
|
|
65501
66230
|
console.log();
|
|
65502
66231
|
}
|
|
@@ -65505,8 +66234,8 @@ async function telemetryStatus() {
|
|
|
65505
66234
|
init_esm_shims();
|
|
65506
66235
|
import { existsSync as existsSync20, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
65507
66236
|
import { join as join25 } from "path";
|
|
65508
|
-
import * as
|
|
65509
|
-
import
|
|
66237
|
+
import * as clack67 from "@clack/prompts";
|
|
66238
|
+
import pc70 from "picocolors";
|
|
65510
66239
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
65511
66240
|
defineWorkflow,
|
|
65512
66241
|
sendEmail,
|
|
@@ -65601,30 +66330,30 @@ export default defineConfig({
|
|
|
65601
66330
|
});
|
|
65602
66331
|
`;
|
|
65603
66332
|
async function workflowInit(options = {}) {
|
|
65604
|
-
|
|
66333
|
+
clack67.intro(pc70.bgCyan(pc70.black(" wraps workflow init ")));
|
|
65605
66334
|
const wrapsDir = join25(process.cwd(), "wraps");
|
|
65606
66335
|
const workflowsDir = join25(wrapsDir, "workflows");
|
|
65607
66336
|
const configPath = join25(wrapsDir, "wraps.config.ts");
|
|
65608
66337
|
if (existsSync20(workflowsDir)) {
|
|
65609
|
-
|
|
65610
|
-
`Workflows directory already exists at ${
|
|
66338
|
+
clack67.log.info(
|
|
66339
|
+
`Workflows directory already exists at ${pc70.cyan("wraps/workflows/")}`
|
|
65611
66340
|
);
|
|
65612
66341
|
const files = existsSync20(join25(workflowsDir, "cart-recovery.ts")) || existsSync20(join25(workflowsDir, "welcome-sequence.ts"));
|
|
65613
66342
|
if (files && !options.yes) {
|
|
65614
|
-
const shouldContinue = await
|
|
66343
|
+
const shouldContinue = await clack67.confirm({
|
|
65615
66344
|
message: "Example files may already exist. Overwrite them?",
|
|
65616
66345
|
initialValue: false
|
|
65617
66346
|
});
|
|
65618
|
-
if (
|
|
65619
|
-
|
|
66347
|
+
if (clack67.isCancel(shouldContinue) || !shouldContinue) {
|
|
66348
|
+
clack67.log.info("Skipping file creation.");
|
|
65620
66349
|
showNextSteps2();
|
|
65621
|
-
|
|
66350
|
+
clack67.outro("Done!");
|
|
65622
66351
|
return;
|
|
65623
66352
|
}
|
|
65624
66353
|
}
|
|
65625
66354
|
}
|
|
65626
66355
|
try {
|
|
65627
|
-
const s2 =
|
|
66356
|
+
const s2 = clack67.spinner();
|
|
65628
66357
|
s2.start("Creating workflows directory...");
|
|
65629
66358
|
mkdirSync2(workflowsDir, { recursive: true });
|
|
65630
66359
|
s2.stop("Created wraps/workflows/");
|
|
@@ -65642,34 +66371,34 @@ async function workflowInit(options = {}) {
|
|
|
65642
66371
|
s2.stop("Created 2 example workflows");
|
|
65643
66372
|
if (!existsSync20(configPath)) {
|
|
65644
66373
|
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
65645
|
-
|
|
66374
|
+
clack67.log.info(`Created ${pc70.cyan("wraps/wraps.config.ts")}`);
|
|
65646
66375
|
}
|
|
65647
|
-
|
|
65648
|
-
`${
|
|
65649
|
-
${
|
|
65650
|
-
${
|
|
65651
|
-
${
|
|
66376
|
+
clack67.log.success(
|
|
66377
|
+
`${pc70.bold("Workflows scaffolded!")} Created:
|
|
66378
|
+
${pc70.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
66379
|
+
${pc70.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
66380
|
+
${pc70.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
65652
66381
|
);
|
|
65653
66382
|
showNextSteps2();
|
|
65654
|
-
|
|
66383
|
+
clack67.outro(pc70.green("Happy orchestrating!"));
|
|
65655
66384
|
} catch (error) {
|
|
65656
|
-
|
|
66385
|
+
clack67.log.error(
|
|
65657
66386
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
65658
66387
|
);
|
|
65659
|
-
|
|
66388
|
+
clack67.outro(pc70.red("Scaffolding failed."));
|
|
65660
66389
|
process.exitCode = 1;
|
|
65661
66390
|
}
|
|
65662
66391
|
}
|
|
65663
66392
|
function showNextSteps2() {
|
|
65664
|
-
|
|
65665
|
-
`${
|
|
66393
|
+
clack67.log.info(
|
|
66394
|
+
`${pc70.bold("Next steps:")}
|
|
65666
66395
|
|
|
65667
|
-
1. Edit ${
|
|
65668
|
-
2. Edit your workflows in ${
|
|
65669
|
-
3. Validate: ${
|
|
65670
|
-
4. Push: ${
|
|
66396
|
+
1. Edit ${pc70.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
66397
|
+
2. Edit your workflows in ${pc70.cyan("wraps/workflows/")}
|
|
66398
|
+
3. Validate: ${pc70.cyan("wraps email workflows validate")}
|
|
66399
|
+
4. Push: ${pc70.cyan("wraps email workflows push")}
|
|
65671
66400
|
|
|
65672
|
-
${
|
|
66401
|
+
${pc70.dim("Docs:")} ${pc70.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
65673
66402
|
);
|
|
65674
66403
|
}
|
|
65675
66404
|
|
|
@@ -65713,7 +66442,10 @@ var STRING_FLAGS = [
|
|
|
65713
66442
|
"limit",
|
|
65714
66443
|
"cursor",
|
|
65715
66444
|
"set",
|
|
65716
|
-
"volume"
|
|
66445
|
+
"volume",
|
|
66446
|
+
"since",
|
|
66447
|
+
"filter",
|
|
66448
|
+
"source"
|
|
65717
66449
|
];
|
|
65718
66450
|
var BOOLEAN_FLAGS = [
|
|
65719
66451
|
"yes",
|
|
@@ -65744,7 +66476,11 @@ var BOOLEAN_FLAGS = [
|
|
|
65744
66476
|
"vdm-engagement",
|
|
65745
66477
|
"vdm-inbox",
|
|
65746
66478
|
"help",
|
|
65747
|
-
"version"
|
|
66479
|
+
"version",
|
|
66480
|
+
"follow",
|
|
66481
|
+
"errors",
|
|
66482
|
+
"live",
|
|
66483
|
+
"platform"
|
|
65748
66484
|
];
|
|
65749
66485
|
var NEGATED_BOOLEANS = [
|
|
65750
66486
|
{ positive: "open", camelKey: "noOpen" },
|
|
@@ -65869,235 +66605,244 @@ function showVersion() {
|
|
|
65869
66605
|
process.exit(0);
|
|
65870
66606
|
}
|
|
65871
66607
|
function showHelp() {
|
|
65872
|
-
|
|
66608
|
+
clack68.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
65873
66609
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
65874
66610
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
65875
66611
|
console.log("Services:");
|
|
65876
|
-
console.log(` ${
|
|
66612
|
+
console.log(` ${pc72.cyan("email")} Email infrastructure (AWS SES)`);
|
|
65877
66613
|
console.log(
|
|
65878
|
-
` ${
|
|
66614
|
+
` ${pc72.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
65879
66615
|
);
|
|
65880
66616
|
console.log(
|
|
65881
|
-
` ${
|
|
66617
|
+
` ${pc72.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)`
|
|
65882
66618
|
);
|
|
65883
66619
|
console.log(
|
|
65884
|
-
` ${
|
|
66620
|
+
` ${pc72.cyan("selfhost")} Self-hosted Wraps control plane (enterprise)`
|
|
65885
66621
|
);
|
|
65886
66622
|
console.log(
|
|
65887
|
-
` ${
|
|
66623
|
+
` ${pc72.cyan("license")} License key management (Wraps team only)
|
|
65888
66624
|
`
|
|
65889
66625
|
);
|
|
65890
66626
|
console.log("Email Commands:");
|
|
65891
66627
|
console.log(
|
|
65892
|
-
` ${
|
|
66628
|
+
` ${pc72.cyan("email init")} Deploy new email infrastructure`
|
|
65893
66629
|
);
|
|
65894
66630
|
console.log(
|
|
65895
|
-
` ${
|
|
66631
|
+
` ${pc72.cyan("email check")} Check email deliverability for a domain`
|
|
65896
66632
|
);
|
|
65897
66633
|
console.log(
|
|
65898
|
-
` ${
|
|
66634
|
+
` ${pc72.cyan("email connect")} Connect to existing AWS SES`
|
|
65899
66635
|
);
|
|
65900
66636
|
console.log(
|
|
65901
|
-
` ${
|
|
66637
|
+
` ${pc72.cyan("email status")} Show email infrastructure details`
|
|
65902
66638
|
);
|
|
65903
66639
|
console.log(
|
|
65904
|
-
` ${
|
|
66640
|
+
` ${pc72.cyan("email plan")} Show SES pricing plan and cheaper options`
|
|
65905
66641
|
);
|
|
65906
|
-
console.log(` ${
|
|
65907
|
-
console.log(` ${
|
|
66642
|
+
console.log(` ${pc72.cyan("email test")} Send a test email`);
|
|
66643
|
+
console.log(` ${pc72.cyan("email verify")} Verify domain DNS records`);
|
|
65908
66644
|
console.log(
|
|
65909
|
-
` ${
|
|
66645
|
+
` ${pc72.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
65910
66646
|
);
|
|
65911
|
-
console.log(` ${
|
|
66647
|
+
console.log(` ${pc72.cyan("email upgrade")} Add features`);
|
|
65912
66648
|
console.log(
|
|
65913
|
-
` ${
|
|
66649
|
+
` ${pc72.cyan("email restore")} Restore original configuration`
|
|
65914
66650
|
);
|
|
65915
66651
|
console.log(
|
|
65916
|
-
` ${
|
|
66652
|
+
` ${pc72.cyan("email destroy")} Remove email infrastructure`
|
|
65917
66653
|
);
|
|
65918
66654
|
console.log(
|
|
65919
|
-
` ${
|
|
66655
|
+
` ${pc72.cyan("email doctor")} Diagnose and clean up email infrastructure`
|
|
65920
66656
|
);
|
|
65921
|
-
console.log(` ${
|
|
65922
|
-
console.log(` ${
|
|
65923
|
-
console.log(` ${
|
|
66657
|
+
console.log(` ${pc72.cyan("email domains add")} Add a domain to SES`);
|
|
66658
|
+
console.log(` ${pc72.cyan("email domains list")} List all domains`);
|
|
66659
|
+
console.log(` ${pc72.cyan("email domains remove")} Remove a domain`);
|
|
65924
66660
|
console.log(
|
|
65925
|
-
` ${
|
|
66661
|
+
` ${pc72.cyan("email inbound init")} Enable inbound email receiving`
|
|
65926
66662
|
);
|
|
65927
|
-
console.log(` ${
|
|
66663
|
+
console.log(` ${pc72.cyan("email inbound status")} Show inbound email status`);
|
|
65928
66664
|
console.log(
|
|
65929
|
-
` ${
|
|
66665
|
+
` ${pc72.cyan("email inbound verify")} Verify inbound DNS records`
|
|
65930
66666
|
);
|
|
65931
66667
|
console.log(
|
|
65932
|
-
` ${
|
|
66668
|
+
` ${pc72.cyan("email inbound test")} Send test email and verify receipt`
|
|
65933
66669
|
);
|
|
65934
66670
|
console.log(
|
|
65935
|
-
` ${
|
|
66671
|
+
` ${pc72.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
65936
66672
|
`
|
|
65937
66673
|
);
|
|
65938
66674
|
console.log("Agent Commands:");
|
|
65939
66675
|
console.log(
|
|
65940
|
-
` ${
|
|
66676
|
+
` ${pc72.cyan("email agent create")} Create a leashed agent mailbox`
|
|
65941
66677
|
);
|
|
65942
|
-
console.log(` ${
|
|
66678
|
+
console.log(` ${pc72.cyan("email agent list")} List agents`);
|
|
65943
66679
|
console.log(
|
|
65944
|
-
` ${
|
|
66680
|
+
` ${pc72.cyan("email agent kill")} Kill an agent (revoke sending)
|
|
65945
66681
|
`
|
|
65946
66682
|
);
|
|
65947
66683
|
console.log("Template Commands:");
|
|
65948
66684
|
console.log(
|
|
65949
|
-
` ${
|
|
66685
|
+
` ${pc72.cyan("email templates init")} Initialize templates-as-code`
|
|
65950
66686
|
);
|
|
65951
66687
|
console.log(
|
|
65952
|
-
` ${
|
|
66688
|
+
` ${pc72.cyan("email templates push")} Push templates to SES + dashboard`
|
|
65953
66689
|
);
|
|
65954
66690
|
console.log(
|
|
65955
|
-
` ${
|
|
66691
|
+
` ${pc72.cyan("email templates preview")} Preview templates in browser`
|
|
65956
66692
|
);
|
|
65957
66693
|
console.log(
|
|
65958
|
-
` ${
|
|
66694
|
+
` ${pc72.cyan("push")} ${pc72.dim("(alias for email templates push)")}
|
|
65959
66695
|
`
|
|
65960
66696
|
);
|
|
65961
66697
|
console.log("Workflow Commands:");
|
|
65962
66698
|
console.log(
|
|
65963
|
-
` ${
|
|
66699
|
+
` ${pc72.cyan("email workflows init")} Initialize workflows-as-code`
|
|
65964
66700
|
);
|
|
65965
66701
|
console.log(
|
|
65966
|
-
` ${
|
|
66702
|
+
` ${pc72.cyan("email workflows validate")} Validate workflow files`
|
|
65967
66703
|
);
|
|
65968
66704
|
console.log(
|
|
65969
|
-
` ${
|
|
66705
|
+
` ${pc72.cyan("email workflows push")} Push workflows to dashboard
|
|
65970
66706
|
`
|
|
65971
66707
|
);
|
|
65972
66708
|
console.log("SMS Commands:");
|
|
65973
|
-
console.log(` ${
|
|
66709
|
+
console.log(` ${pc72.cyan("sms init")} Deploy SMS infrastructure`);
|
|
65974
66710
|
console.log(
|
|
65975
|
-
` ${
|
|
66711
|
+
` ${pc72.cyan("sms status")} Show SMS infrastructure details`
|
|
65976
66712
|
);
|
|
65977
|
-
console.log(` ${
|
|
66713
|
+
console.log(` ${pc72.cyan("sms test")} Send a test SMS message`);
|
|
65978
66714
|
console.log(
|
|
65979
|
-
` ${
|
|
66715
|
+
` ${pc72.cyan("sms verify-number")} Verify a destination phone number`
|
|
65980
66716
|
);
|
|
65981
66717
|
console.log(
|
|
65982
|
-
` ${
|
|
66718
|
+
` ${pc72.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
65983
66719
|
);
|
|
65984
|
-
console.log(` ${
|
|
65985
|
-
console.log(` ${
|
|
66720
|
+
console.log(` ${pc72.cyan("sms upgrade")} Upgrade SMS features`);
|
|
66721
|
+
console.log(` ${pc72.cyan("sms register")} Register toll-free number`);
|
|
65986
66722
|
console.log(
|
|
65987
|
-
` ${
|
|
66723
|
+
` ${pc72.cyan("sms destroy")} Remove SMS infrastructure
|
|
65988
66724
|
`
|
|
65989
66725
|
);
|
|
65990
66726
|
console.log("CDN Commands:");
|
|
65991
66727
|
console.log(
|
|
65992
|
-
` ${
|
|
66728
|
+
` ${pc72.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
65993
66729
|
);
|
|
65994
66730
|
console.log(
|
|
65995
|
-
` ${
|
|
66731
|
+
` ${pc72.cyan("cdn status")} Show CDN infrastructure details`
|
|
65996
66732
|
);
|
|
65997
66733
|
console.log(
|
|
65998
|
-
` ${
|
|
66734
|
+
` ${pc72.cyan("cdn verify")} Check DNS and certificate status`
|
|
65999
66735
|
);
|
|
66000
66736
|
console.log(
|
|
66001
|
-
` ${
|
|
66737
|
+
` ${pc72.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
66002
66738
|
);
|
|
66003
66739
|
console.log(
|
|
66004
|
-
` ${
|
|
66740
|
+
` ${pc72.cyan("cdn sync")} Sync infrastructure with current config`
|
|
66005
66741
|
);
|
|
66006
66742
|
console.log(
|
|
66007
|
-
` ${
|
|
66743
|
+
` ${pc72.cyan("cdn destroy")} Remove CDN infrastructure
|
|
66008
66744
|
`
|
|
66009
66745
|
);
|
|
66010
66746
|
console.log("Self-Hosted Commands:");
|
|
66011
66747
|
console.log(
|
|
66012
|
-
` ${
|
|
66748
|
+
` ${pc72.cyan("selfhost deploy")} Deploy Wraps API to your AWS account`
|
|
66013
66749
|
);
|
|
66014
66750
|
console.log(
|
|
66015
|
-
` ${
|
|
66751
|
+
` ${pc72.cyan("selfhost login")} Sign in to your self-hosted Wraps instance`
|
|
66016
66752
|
);
|
|
66017
66753
|
console.log(
|
|
66018
|
-
` ${
|
|
66754
|
+
` ${pc72.cyan("selfhost logout")} Sign out of your self-hosted Wraps instance`
|
|
66019
66755
|
);
|
|
66020
66756
|
console.log(
|
|
66021
|
-
` ${
|
|
66757
|
+
` ${pc72.cyan("selfhost upgrade")} Rebuild and redeploy the self-hosted API`
|
|
66022
66758
|
);
|
|
66023
66759
|
console.log(
|
|
66024
|
-
` ${
|
|
66760
|
+
` ${pc72.cyan("selfhost status")} Show self-hosted deployment details`
|
|
66025
66761
|
);
|
|
66026
66762
|
console.log(
|
|
66027
|
-
` ${
|
|
66763
|
+
` ${pc72.cyan("selfhost logs")} Stream logs from your self-hosted API, dashboard, and workers`
|
|
66028
66764
|
);
|
|
66029
66765
|
console.log(
|
|
66030
|
-
` ${
|
|
66766
|
+
` ${pc72.cyan("selfhost env")} Print env vars for hosting the dashboard yourself`
|
|
66767
|
+
);
|
|
66768
|
+
console.log(
|
|
66769
|
+
` ${pc72.cyan("selfhost connect")} Connect your AWS account to your self-hosted instance`
|
|
66770
|
+
);
|
|
66771
|
+
console.log(
|
|
66772
|
+
` ${pc72.cyan("selfhost update-role")} Refresh your self-hosted console role's permissions`
|
|
66773
|
+
);
|
|
66774
|
+
console.log(
|
|
66775
|
+
` ${pc72.cyan("selfhost destroy")} Tear down the self-hosted deployment
|
|
66031
66776
|
`
|
|
66032
66777
|
);
|
|
66033
66778
|
console.log("Local Development:");
|
|
66034
66779
|
console.log(
|
|
66035
|
-
` ${
|
|
66780
|
+
` ${pc72.cyan("console")} Start local web console
|
|
66036
66781
|
`
|
|
66037
66782
|
);
|
|
66038
66783
|
console.log("Platform:");
|
|
66039
66784
|
console.log(
|
|
66040
|
-
` ${
|
|
66785
|
+
` ${pc72.cyan("platform")} Show platform info and pricing`
|
|
66041
66786
|
);
|
|
66042
66787
|
console.log(
|
|
66043
|
-
` ${
|
|
66788
|
+
` ${pc72.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
66044
66789
|
);
|
|
66045
66790
|
console.log(
|
|
66046
|
-
` ${
|
|
66791
|
+
` ${pc72.cyan("platform update-role")} Update platform IAM permissions
|
|
66047
66792
|
`
|
|
66048
66793
|
);
|
|
66049
66794
|
console.log("Auth:");
|
|
66050
66795
|
console.log(
|
|
66051
|
-
` ${
|
|
66796
|
+
` ${pc72.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
66052
66797
|
);
|
|
66053
|
-
console.log(` ${
|
|
66798
|
+
console.log(` ${pc72.cyan("auth status")} Show current auth state`);
|
|
66054
66799
|
console.log(
|
|
66055
|
-
` ${
|
|
66800
|
+
` ${pc72.cyan("auth logout")} Sign out and remove stored token
|
|
66056
66801
|
`
|
|
66057
66802
|
);
|
|
66058
66803
|
console.log("AWS Setup:");
|
|
66059
66804
|
console.log(
|
|
66060
|
-
` ${
|
|
66805
|
+
` ${pc72.cyan("aws setup")} Interactive AWS setup wizard`
|
|
66061
66806
|
);
|
|
66062
66807
|
console.log(
|
|
66063
|
-
` ${
|
|
66808
|
+
` ${pc72.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
66064
66809
|
`
|
|
66065
66810
|
);
|
|
66066
66811
|
console.log("Global Commands:");
|
|
66067
|
-
console.log(` ${
|
|
66068
|
-
console.log(` ${
|
|
66069
|
-
console.log(` ${
|
|
66070
|
-
console.log(` ${
|
|
66812
|
+
console.log(` ${pc72.cyan("status")} Show overview of all services`);
|
|
66813
|
+
console.log(` ${pc72.cyan("destroy")} Remove deployed infrastructure`);
|
|
66814
|
+
console.log(` ${pc72.cyan("permissions")} Show required AWS IAM permissions`);
|
|
66815
|
+
console.log(` ${pc72.cyan("completion")} Generate shell completion script`);
|
|
66071
66816
|
console.log(
|
|
66072
|
-
` ${
|
|
66817
|
+
` ${pc72.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
66073
66818
|
);
|
|
66074
|
-
console.log(` ${
|
|
66075
|
-
console.log(` ${
|
|
66819
|
+
console.log(` ${pc72.cyan("update")} Update CLI to latest version`);
|
|
66820
|
+
console.log(` ${pc72.cyan("news")} Show recent Wraps updates`);
|
|
66076
66821
|
console.log(
|
|
66077
|
-
` ${
|
|
66822
|
+
` ${pc72.cyan("support")} Get help and support contact info
|
|
66078
66823
|
`
|
|
66079
66824
|
);
|
|
66080
66825
|
console.log("Options:");
|
|
66081
66826
|
console.log(
|
|
66082
|
-
` ${
|
|
66827
|
+
` ${pc72.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
66083
66828
|
);
|
|
66084
|
-
console.log(` ${
|
|
66085
|
-
console.log(` ${
|
|
66086
|
-
console.log(` ${
|
|
66087
|
-
console.log(` ${
|
|
66088
|
-
console.log(` ${
|
|
66089
|
-
console.log(` ${
|
|
66090
|
-
console.log(` ${
|
|
66829
|
+
console.log(` ${pc72.dim("-r, --region")} AWS region`);
|
|
66830
|
+
console.log(` ${pc72.dim("-d, --domain")} Domain name`);
|
|
66831
|
+
console.log(` ${pc72.dim("--account")} AWS account ID or alias`);
|
|
66832
|
+
console.log(` ${pc72.dim("--preset")} Configuration preset`);
|
|
66833
|
+
console.log(` ${pc72.dim("--token")} API key or token for auth`);
|
|
66834
|
+
console.log(` ${pc72.dim("-y, --yes")} Skip confirmation prompts`);
|
|
66835
|
+
console.log(` ${pc72.dim("-f, --force")} Force destructive operations`);
|
|
66091
66836
|
console.log(
|
|
66092
|
-
` ${
|
|
66837
|
+
` ${pc72.dim("--preview")} Preview changes without deploying`
|
|
66093
66838
|
);
|
|
66094
|
-
console.log(` ${
|
|
66839
|
+
console.log(` ${pc72.dim("-v, --version")} Show version number
|
|
66095
66840
|
`);
|
|
66096
66841
|
console.log(
|
|
66097
|
-
`Run ${
|
|
66842
|
+
`Run ${pc72.cyan("wraps <service> <command> --help")} for more information.`
|
|
66098
66843
|
);
|
|
66099
66844
|
console.log(
|
|
66100
|
-
`AI agents: complete docs at ${
|
|
66845
|
+
`AI agents: complete docs at ${pc72.cyan("https://wraps.dev/llms-full.txt")}
|
|
66101
66846
|
`
|
|
66102
66847
|
);
|
|
66103
66848
|
}
|
|
@@ -66119,27 +66864,27 @@ if (!primaryCommand) {
|
|
|
66119
66864
|
const telemetry = getTelemetryClient();
|
|
66120
66865
|
if (telemetry.shouldShowNotification()) {
|
|
66121
66866
|
console.log();
|
|
66122
|
-
|
|
66867
|
+
clack68.log.info(pc72.bold("Anonymous Telemetry"));
|
|
66123
66868
|
console.log(
|
|
66124
|
-
` Wraps collects ${
|
|
66869
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
66125
66870
|
);
|
|
66126
66871
|
console.log(
|
|
66127
|
-
` We ${
|
|
66872
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
66128
66873
|
);
|
|
66129
66874
|
console.log(
|
|
66130
|
-
` We ${
|
|
66875
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
66131
66876
|
);
|
|
66132
66877
|
console.log();
|
|
66133
|
-
console.log(` Opt-out anytime: ${
|
|
66134
|
-
console.log(` Or set: ${
|
|
66135
|
-
console.log(` Learn more: ${
|
|
66878
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
66879
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
66880
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
66136
66881
|
console.log();
|
|
66137
66882
|
telemetry.markNotificationShown();
|
|
66138
66883
|
}
|
|
66139
66884
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
66140
|
-
|
|
66885
|
+
clack68.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
66141
66886
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
66142
|
-
const action = await
|
|
66887
|
+
const action = await clack68.select({
|
|
66143
66888
|
message: "What would you like to do?",
|
|
66144
66889
|
options: [
|
|
66145
66890
|
{
|
|
@@ -66189,13 +66934,13 @@ if (!primaryCommand) {
|
|
|
66189
66934
|
}
|
|
66190
66935
|
]
|
|
66191
66936
|
});
|
|
66192
|
-
if (
|
|
66937
|
+
if (clack68.isCancel(action)) {
|
|
66193
66938
|
trackCommand("interactive:cancel", {
|
|
66194
66939
|
success: true,
|
|
66195
66940
|
duration_ms: Date.now() - startTime
|
|
66196
66941
|
});
|
|
66197
66942
|
await telemetry.shutdown();
|
|
66198
|
-
|
|
66943
|
+
clack68.cancel("Operation cancelled.");
|
|
66199
66944
|
process.exit(0);
|
|
66200
66945
|
}
|
|
66201
66946
|
trackCommand(`interactive:${action}`, {
|
|
@@ -66275,20 +67020,20 @@ async function run() {
|
|
|
66275
67020
|
const telemetry = getTelemetryClient();
|
|
66276
67021
|
if (telemetry.shouldShowNotification()) {
|
|
66277
67022
|
console.log();
|
|
66278
|
-
|
|
67023
|
+
clack68.log.info(pc72.bold("Anonymous Telemetry"));
|
|
66279
67024
|
console.log(
|
|
66280
|
-
` Wraps collects ${
|
|
67025
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
66281
67026
|
);
|
|
66282
67027
|
console.log(
|
|
66283
|
-
` We ${
|
|
67028
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
66284
67029
|
);
|
|
66285
67030
|
console.log(
|
|
66286
|
-
` We ${
|
|
67031
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
66287
67032
|
);
|
|
66288
67033
|
console.log();
|
|
66289
|
-
console.log(` Opt-out anytime: ${
|
|
66290
|
-
console.log(` Or set: ${
|
|
66291
|
-
console.log(` Learn more: ${
|
|
67034
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
67035
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
67036
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
66292
67037
|
console.log();
|
|
66293
67038
|
telemetry.markNotificationShown();
|
|
66294
67039
|
}
|
|
@@ -66382,10 +67127,10 @@ async function run() {
|
|
|
66382
67127
|
break;
|
|
66383
67128
|
case "verify": {
|
|
66384
67129
|
if (!flags.domain) {
|
|
66385
|
-
|
|
67130
|
+
clack68.log.error("--domain flag is required");
|
|
66386
67131
|
console.log(
|
|
66387
67132
|
`
|
|
66388
|
-
Usage: ${
|
|
67133
|
+
Usage: ${pc72.cyan("wraps email verify --domain yourapp.com")}
|
|
66389
67134
|
`
|
|
66390
67135
|
);
|
|
66391
67136
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66457,12 +67202,12 @@ Usage: ${pc71.cyan("wraps email verify --domain yourapp.com")}
|
|
|
66457
67202
|
});
|
|
66458
67203
|
break;
|
|
66459
67204
|
default:
|
|
66460
|
-
|
|
67205
|
+
clack68.log.error(
|
|
66461
67206
|
`Unknown inbound command: ${inboundSubCommand || "(none)"}`
|
|
66462
67207
|
);
|
|
66463
67208
|
console.log(
|
|
66464
67209
|
`
|
|
66465
|
-
Available commands: ${
|
|
67210
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("destroy")}, ${pc72.cyan("status")}, ${pc72.cyan("verify")}, ${pc72.cyan("test")}, ${pc72.cyan("add")}, ${pc72.cyan("remove")}
|
|
66466
67211
|
`
|
|
66467
67212
|
);
|
|
66468
67213
|
throw new Error(
|
|
@@ -66499,12 +67244,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("destroy")}, ${pc71.cyan("
|
|
|
66499
67244
|
});
|
|
66500
67245
|
break;
|
|
66501
67246
|
default:
|
|
66502
|
-
|
|
67247
|
+
clack68.log.error(
|
|
66503
67248
|
`Unknown agent command: ${agentSubCommand || "(none)"}`
|
|
66504
67249
|
);
|
|
66505
67250
|
console.log(
|
|
66506
67251
|
`
|
|
66507
|
-
Available commands: ${
|
|
67252
|
+
Available commands: ${pc72.cyan("create")}, ${pc72.cyan("list")}, ${pc72.cyan("kill")}
|
|
66508
67253
|
`
|
|
66509
67254
|
);
|
|
66510
67255
|
throw new Error(
|
|
@@ -66556,12 +67301,12 @@ Available commands: ${pc71.cyan("create")}, ${pc71.cyan("list")}, ${pc71.cyan("k
|
|
|
66556
67301
|
break;
|
|
66557
67302
|
}
|
|
66558
67303
|
default:
|
|
66559
|
-
|
|
67304
|
+
clack68.log.error(
|
|
66560
67305
|
`Unknown reply command: ${replySubCommand || "(none)"}`
|
|
66561
67306
|
);
|
|
66562
67307
|
console.log(
|
|
66563
67308
|
`
|
|
66564
|
-
Available commands: ${
|
|
67309
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("rotate")}, ${pc72.cyan("status")}, ${pc72.cyan("destroy")}, ${pc72.cyan("decode")}
|
|
66565
67310
|
`
|
|
66566
67311
|
);
|
|
66567
67312
|
throw new Error(
|
|
@@ -66586,10 +67331,10 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("rotate")}, ${pc71.cyan("s
|
|
|
66586
67331
|
break;
|
|
66587
67332
|
case "verify": {
|
|
66588
67333
|
if (!flags.domain) {
|
|
66589
|
-
|
|
67334
|
+
clack68.log.error("--domain flag is required");
|
|
66590
67335
|
console.log(
|
|
66591
67336
|
`
|
|
66592
|
-
Usage: ${
|
|
67337
|
+
Usage: ${pc72.cyan("wraps email domains verify --domain yourapp.com")}
|
|
66593
67338
|
`
|
|
66594
67339
|
);
|
|
66595
67340
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66599,10 +67344,10 @@ Usage: ${pc71.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
66599
67344
|
}
|
|
66600
67345
|
case "get-dkim": {
|
|
66601
67346
|
if (!flags.domain) {
|
|
66602
|
-
|
|
67347
|
+
clack68.log.error("--domain flag is required");
|
|
66603
67348
|
console.log(
|
|
66604
67349
|
`
|
|
66605
|
-
Usage: ${
|
|
67350
|
+
Usage: ${pc72.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
66606
67351
|
`
|
|
66607
67352
|
);
|
|
66608
67353
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66612,10 +67357,10 @@ Usage: ${pc71.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
66612
67357
|
}
|
|
66613
67358
|
case "remove": {
|
|
66614
67359
|
if (!flags.domain) {
|
|
66615
|
-
|
|
67360
|
+
clack68.log.error("--domain flag is required");
|
|
66616
67361
|
console.log(
|
|
66617
67362
|
`
|
|
66618
|
-
Usage: ${
|
|
67363
|
+
Usage: ${pc72.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
66619
67364
|
`
|
|
66620
67365
|
);
|
|
66621
67366
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66645,12 +67390,12 @@ Usage: ${pc71.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
66645
67390
|
break;
|
|
66646
67391
|
}
|
|
66647
67392
|
default:
|
|
66648
|
-
|
|
67393
|
+
clack68.log.error(
|
|
66649
67394
|
`Unknown domains command: ${domainsSubCommand || "(none)"}`
|
|
66650
67395
|
);
|
|
66651
67396
|
console.log(
|
|
66652
67397
|
`
|
|
66653
|
-
Available commands: ${
|
|
67398
|
+
Available commands: ${pc72.cyan("add")}, ${pc72.cyan("list")}, ${pc72.cyan("verify")}, ${pc72.cyan("get-dkim")}, ${pc72.cyan("remove")}, ${pc72.cyan("config")}
|
|
66654
67399
|
`
|
|
66655
67400
|
);
|
|
66656
67401
|
throw new Error(
|
|
@@ -66692,12 +67437,12 @@ Available commands: ${pc71.cyan("add")}, ${pc71.cyan("list")}, ${pc71.cyan("veri
|
|
|
66692
67437
|
});
|
|
66693
67438
|
break;
|
|
66694
67439
|
default:
|
|
66695
|
-
|
|
67440
|
+
clack68.log.error(
|
|
66696
67441
|
`Unknown templates command: ${templatesSubCommand || "(none)"}`
|
|
66697
67442
|
);
|
|
66698
67443
|
console.log(
|
|
66699
67444
|
`
|
|
66700
|
-
Available commands: ${
|
|
67445
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("push")}, ${pc72.cyan("preview")}
|
|
66701
67446
|
`
|
|
66702
67447
|
);
|
|
66703
67448
|
throw new Error(
|
|
@@ -66736,12 +67481,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("push")}, ${pc71.cyan("pre
|
|
|
66736
67481
|
});
|
|
66737
67482
|
break;
|
|
66738
67483
|
default:
|
|
66739
|
-
|
|
67484
|
+
clack68.log.error(
|
|
66740
67485
|
`Unknown workflows command: ${workflowsSubCommand || "(none)"}`
|
|
66741
67486
|
);
|
|
66742
67487
|
console.log(
|
|
66743
67488
|
`
|
|
66744
|
-
Available commands: ${
|
|
67489
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("validate")}, ${pc72.cyan("push")}
|
|
66745
67490
|
`
|
|
66746
67491
|
);
|
|
66747
67492
|
throw new Error(
|
|
@@ -66766,7 +67511,7 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("validate")}, ${pc71.cyan(
|
|
|
66766
67511
|
case "get": {
|
|
66767
67512
|
const messageId = sub[3];
|
|
66768
67513
|
if (!messageId) {
|
|
66769
|
-
|
|
67514
|
+
clack68.log.error("Usage: wraps email logs get <message-id>");
|
|
66770
67515
|
throw new Error("Missing required argument: <message-id>");
|
|
66771
67516
|
}
|
|
66772
67517
|
await emailLogsGet({
|
|
@@ -66778,12 +67523,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("validate")}, ${pc71.cyan(
|
|
|
66778
67523
|
break;
|
|
66779
67524
|
}
|
|
66780
67525
|
default:
|
|
66781
|
-
|
|
67526
|
+
clack68.log.error(
|
|
66782
67527
|
`Unknown logs command: ${logsSubCommand || "(none)"}`
|
|
66783
67528
|
);
|
|
66784
67529
|
console.log(
|
|
66785
67530
|
`
|
|
66786
|
-
Available commands: ${
|
|
67531
|
+
Available commands: ${pc72.cyan("list")}, ${pc72.cyan("get <message-id>")}
|
|
66787
67532
|
`
|
|
66788
67533
|
);
|
|
66789
67534
|
throw new Error(
|
|
@@ -66808,10 +67553,10 @@ Available commands: ${pc71.cyan("list")}, ${pc71.cyan("get <message-id>")}
|
|
|
66808
67553
|
});
|
|
66809
67554
|
break;
|
|
66810
67555
|
default:
|
|
66811
|
-
|
|
67556
|
+
clack68.log.error(`Unknown email command: ${subCommand}`);
|
|
66812
67557
|
console.log(
|
|
66813
67558
|
`
|
|
66814
|
-
Run ${
|
|
67559
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66815
67560
|
`
|
|
66816
67561
|
);
|
|
66817
67562
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -66836,10 +67581,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66836
67581
|
});
|
|
66837
67582
|
break;
|
|
66838
67583
|
default:
|
|
66839
|
-
|
|
67584
|
+
clack68.log.error(`Unknown license command: ${subCommand}`);
|
|
66840
67585
|
console.log(
|
|
66841
67586
|
`
|
|
66842
|
-
Run ${
|
|
67587
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66843
67588
|
`
|
|
66844
67589
|
);
|
|
66845
67590
|
throw new Error(`Unknown license command: ${subCommand}`);
|
|
@@ -66886,6 +67631,21 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66886
67631
|
json: flags.json
|
|
66887
67632
|
});
|
|
66888
67633
|
break;
|
|
67634
|
+
case "logs":
|
|
67635
|
+
await selfhostLogs({
|
|
67636
|
+
region: flags.region,
|
|
67637
|
+
follow: flags.follow,
|
|
67638
|
+
errors: flags.errors,
|
|
67639
|
+
source: flags.source,
|
|
67640
|
+
since: flags.since,
|
|
67641
|
+
filter: flags.filter,
|
|
67642
|
+
interval: flags.interval,
|
|
67643
|
+
live: flags.live,
|
|
67644
|
+
platform: flags.platform,
|
|
67645
|
+
verbose: flags.verbose,
|
|
67646
|
+
json: flags.json
|
|
67647
|
+
});
|
|
67648
|
+
break;
|
|
66889
67649
|
case "login":
|
|
66890
67650
|
await selfhostLogin({
|
|
66891
67651
|
region: flags.region,
|
|
@@ -66923,10 +67683,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66923
67683
|
});
|
|
66924
67684
|
break;
|
|
66925
67685
|
default:
|
|
66926
|
-
|
|
67686
|
+
clack68.log.error(`Unknown selfhost command: ${subCommand}`);
|
|
66927
67687
|
console.log(
|
|
66928
67688
|
`
|
|
66929
|
-
Run ${
|
|
67689
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66930
67690
|
`
|
|
66931
67691
|
);
|
|
66932
67692
|
throw new Error(`Unknown selfhost command: ${subCommand}`);
|
|
@@ -67006,10 +67766,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67006
67766
|
});
|
|
67007
67767
|
break;
|
|
67008
67768
|
default:
|
|
67009
|
-
|
|
67769
|
+
clack68.log.error(`Unknown sms command: ${subCommand}`);
|
|
67010
67770
|
console.log(
|
|
67011
67771
|
`
|
|
67012
|
-
Run ${
|
|
67772
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67013
67773
|
`
|
|
67014
67774
|
);
|
|
67015
67775
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -67070,10 +67830,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67070
67830
|
});
|
|
67071
67831
|
break;
|
|
67072
67832
|
default:
|
|
67073
|
-
|
|
67833
|
+
clack68.log.error(`Unknown cdn command: ${subCommand}`);
|
|
67074
67834
|
console.log(
|
|
67075
67835
|
`
|
|
67076
|
-
Run ${
|
|
67836
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67077
67837
|
`
|
|
67078
67838
|
);
|
|
67079
67839
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -67095,13 +67855,13 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67095
67855
|
});
|
|
67096
67856
|
break;
|
|
67097
67857
|
default:
|
|
67098
|
-
|
|
67858
|
+
clack68.log.error(
|
|
67099
67859
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
67100
67860
|
);
|
|
67101
67861
|
console.log(`
|
|
67102
|
-
Available commands: ${
|
|
67862
|
+
Available commands: ${pc72.cyan("init")}
|
|
67103
67863
|
`);
|
|
67104
|
-
console.log(`Run ${
|
|
67864
|
+
console.log(`Run ${pc72.cyan("wraps --help")} for more information.
|
|
67105
67865
|
`);
|
|
67106
67866
|
throw new Error(
|
|
67107
67867
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -67143,14 +67903,14 @@ Available commands: ${pc71.cyan("init")}
|
|
|
67143
67903
|
});
|
|
67144
67904
|
break;
|
|
67145
67905
|
default:
|
|
67146
|
-
|
|
67906
|
+
clack68.log.error(`Unknown platform command: ${subCommand}`);
|
|
67147
67907
|
console.log(
|
|
67148
67908
|
`
|
|
67149
|
-
Available commands: ${
|
|
67909
|
+
Available commands: ${pc72.cyan("connect")}, ${pc72.cyan("update-role")}
|
|
67150
67910
|
`
|
|
67151
67911
|
);
|
|
67152
67912
|
console.log(
|
|
67153
|
-
`Run ${
|
|
67913
|
+
`Run ${pc72.cyan("wraps platform")} for more information.
|
|
67154
67914
|
`
|
|
67155
67915
|
);
|
|
67156
67916
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -67175,10 +67935,10 @@ Available commands: ${pc71.cyan("connect")}, ${pc71.cyan("update-role")}
|
|
|
67175
67935
|
await logout();
|
|
67176
67936
|
break;
|
|
67177
67937
|
default:
|
|
67178
|
-
|
|
67938
|
+
clack68.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
67179
67939
|
console.log(
|
|
67180
67940
|
`
|
|
67181
|
-
Available commands: ${
|
|
67941
|
+
Available commands: ${pc72.cyan("login")}, ${pc72.cyan("status")}, ${pc72.cyan("logout")}
|
|
67182
67942
|
`
|
|
67183
67943
|
);
|
|
67184
67944
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -67196,13 +67956,13 @@ Available commands: ${pc71.cyan("login")}, ${pc71.cyan("status")}, ${pc71.cyan("
|
|
|
67196
67956
|
await doctor();
|
|
67197
67957
|
break;
|
|
67198
67958
|
default:
|
|
67199
|
-
|
|
67959
|
+
clack68.log.error(`Unknown aws command: ${subCommand}`);
|
|
67200
67960
|
console.log(
|
|
67201
67961
|
`
|
|
67202
|
-
Available commands: ${
|
|
67962
|
+
Available commands: ${pc72.cyan("setup")}, ${pc72.cyan("doctor")}
|
|
67203
67963
|
`
|
|
67204
67964
|
);
|
|
67205
|
-
console.log(`Run ${
|
|
67965
|
+
console.log(`Run ${pc72.cyan("wraps --help")} for more information.
|
|
67206
67966
|
`);
|
|
67207
67967
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
67208
67968
|
}
|
|
@@ -67283,10 +68043,10 @@ Available commands: ${pc71.cyan("setup")}, ${pc71.cyan("doctor")}
|
|
|
67283
68043
|
await telemetryStatus();
|
|
67284
68044
|
break;
|
|
67285
68045
|
default:
|
|
67286
|
-
|
|
68046
|
+
clack68.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
67287
68047
|
console.log(
|
|
67288
68048
|
`
|
|
67289
|
-
Available commands: ${
|
|
68049
|
+
Available commands: ${pc72.cyan("enable")}, ${pc72.cyan("disable")}, ${pc72.cyan("status")}
|
|
67290
68050
|
`
|
|
67291
68051
|
);
|
|
67292
68052
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -67310,10 +68070,10 @@ Please specify a command for ${primaryCommand} service.
|
|
|
67310
68070
|
showHelp();
|
|
67311
68071
|
break;
|
|
67312
68072
|
default:
|
|
67313
|
-
|
|
68073
|
+
clack68.log.error(`Unknown command: ${primaryCommand}`);
|
|
67314
68074
|
console.log(
|
|
67315
68075
|
`
|
|
67316
|
-
Run ${
|
|
68076
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67317
68077
|
`
|
|
67318
68078
|
);
|
|
67319
68079
|
throw new Error(`Unknown command: ${primaryCommand}`);
|