@wraps.dev/cli 2.29.1 → 2.30.1
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 +1494 -733
- 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 +2 -1
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,46 +61884,46 @@ 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
|
|
|
61170
61899
|
// src/commands/shared/status.ts
|
|
61171
61900
|
init_esm_shims();
|
|
61172
61901
|
init_events();
|
|
61902
|
+
import * as clack56 from "@clack/prompts";
|
|
61903
|
+
import * as pulumi32 from "@pulumi/pulumi";
|
|
61904
|
+
import pc59 from "picocolors";
|
|
61173
61905
|
init_aws();
|
|
61174
61906
|
init_fs();
|
|
61175
61907
|
init_json_output();
|
|
61176
61908
|
init_output();
|
|
61177
61909
|
init_pulumi();
|
|
61178
|
-
import * as clack55 from "@clack/prompts";
|
|
61179
|
-
import * as pulumi32 from "@pulumi/pulumi";
|
|
61180
|
-
import pc58 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,36 @@ 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
|
}
|
|
62004
|
+
const dashboardUrl = await resolveDashboardUrl(identity.accountId, region);
|
|
61275
62005
|
console.log(`
|
|
61276
|
-
${
|
|
61277
|
-
console.log(`${
|
|
62006
|
+
${pc59.bold("Dashboard:")} ${pc59.blue(dashboardUrl)}`);
|
|
62007
|
+
console.log(`${pc59.bold("Docs:")} ${pc59.blue("https://wraps.dev/docs")}
|
|
61278
62008
|
`);
|
|
61279
62009
|
trackCommand("status", {
|
|
61280
62010
|
success: true,
|
|
@@ -61285,9 +62015,9 @@ ${pc58.bold("Dashboard:")} ${pc58.blue("https://app.wraps.dev")}`);
|
|
|
61285
62015
|
|
|
61286
62016
|
// src/commands/sms/destroy.ts
|
|
61287
62017
|
init_esm_shims();
|
|
61288
|
-
import * as
|
|
62018
|
+
import * as clack57 from "@clack/prompts";
|
|
61289
62019
|
import * as pulumi34 from "@pulumi/pulumi";
|
|
61290
|
-
import
|
|
62020
|
+
import pc60 from "picocolors";
|
|
61291
62021
|
|
|
61292
62022
|
// src/infrastructure/sms-stack.ts
|
|
61293
62023
|
init_esm_shims();
|
|
@@ -61978,18 +62708,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
61978
62708
|
const existing = await client2.send(
|
|
61979
62709
|
new DescribeProtectConfigurationsCommand({})
|
|
61980
62710
|
);
|
|
61981
|
-
for (const
|
|
61982
|
-
if (!(
|
|
62711
|
+
for (const pc73 of existing.ProtectConfigurations || []) {
|
|
62712
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
61983
62713
|
continue;
|
|
61984
62714
|
}
|
|
61985
62715
|
const tagsResponse = await client2.send(
|
|
61986
62716
|
new ListTagsForResourceCommand({
|
|
61987
|
-
ResourceArn:
|
|
62717
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
61988
62718
|
})
|
|
61989
62719
|
);
|
|
61990
62720
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
61991
62721
|
if (nameTag?.Value === protectConfigName) {
|
|
61992
|
-
existingProtectConfigId =
|
|
62722
|
+
existingProtectConfigId = pc73.ProtectConfigurationId;
|
|
61993
62723
|
break;
|
|
61994
62724
|
}
|
|
61995
62725
|
}
|
|
@@ -62085,13 +62815,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62085
62815
|
new DescribeProtectConfigurationsCommand({})
|
|
62086
62816
|
);
|
|
62087
62817
|
if (existing.ProtectConfigurations) {
|
|
62088
|
-
for (const
|
|
62089
|
-
if (!(
|
|
62818
|
+
for (const pc73 of existing.ProtectConfigurations) {
|
|
62819
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
62090
62820
|
continue;
|
|
62091
62821
|
}
|
|
62092
62822
|
const tagsResponse = await client2.send(
|
|
62093
62823
|
new ListTagsForResourceCommand({
|
|
62094
|
-
ResourceArn:
|
|
62824
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
62095
62825
|
})
|
|
62096
62826
|
);
|
|
62097
62827
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -62100,7 +62830,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62100
62830
|
if (isWrapsManaged) {
|
|
62101
62831
|
await client2.send(
|
|
62102
62832
|
new DeleteProtectConfigurationCommand({
|
|
62103
|
-
ProtectConfigurationId:
|
|
62833
|
+
ProtectConfigurationId: pc73.ProtectConfigurationId
|
|
62104
62834
|
})
|
|
62105
62835
|
);
|
|
62106
62836
|
}
|
|
@@ -62135,8 +62865,8 @@ async function smsDestroy(options) {
|
|
|
62135
62865
|
);
|
|
62136
62866
|
}
|
|
62137
62867
|
if (!isJsonMode()) {
|
|
62138
|
-
|
|
62139
|
-
|
|
62868
|
+
clack57.intro(
|
|
62869
|
+
pc60.bold(
|
|
62140
62870
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
62141
62871
|
)
|
|
62142
62872
|
);
|
|
@@ -62162,15 +62892,15 @@ async function smsDestroy(options) {
|
|
|
62162
62892
|
`Available regions: ${smsConnections.map((c6) => c6.region).join(", ")}`
|
|
62163
62893
|
);
|
|
62164
62894
|
}
|
|
62165
|
-
const selectedRegion = await
|
|
62895
|
+
const selectedRegion = await clack57.select({
|
|
62166
62896
|
message: "Multiple SMS deployments found. Which region to destroy?",
|
|
62167
62897
|
options: smsConnections.map((conn) => ({
|
|
62168
62898
|
value: conn.region,
|
|
62169
62899
|
label: conn.region
|
|
62170
62900
|
}))
|
|
62171
62901
|
});
|
|
62172
|
-
if (
|
|
62173
|
-
|
|
62902
|
+
if (clack57.isCancel(selectedRegion)) {
|
|
62903
|
+
clack57.cancel("Operation cancelled");
|
|
62174
62904
|
process.exit(0);
|
|
62175
62905
|
}
|
|
62176
62906
|
region = selectedRegion;
|
|
@@ -62181,18 +62911,18 @@ async function smsDestroy(options) {
|
|
|
62181
62911
|
const storedStackName = smsService?.pulumiStackName;
|
|
62182
62912
|
if (!smsService) {
|
|
62183
62913
|
progress.stop();
|
|
62184
|
-
|
|
62914
|
+
clack57.log.warn("No SMS infrastructure found");
|
|
62185
62915
|
process.exit(0);
|
|
62186
62916
|
}
|
|
62187
62917
|
if (!(options.force || options.preview)) {
|
|
62188
|
-
const confirmed = await
|
|
62189
|
-
message:
|
|
62918
|
+
const confirmed = await clack57.confirm({
|
|
62919
|
+
message: pc60.red(
|
|
62190
62920
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
62191
62921
|
),
|
|
62192
62922
|
initialValue: false
|
|
62193
62923
|
});
|
|
62194
|
-
if (
|
|
62195
|
-
|
|
62924
|
+
if (clack57.isCancel(confirmed) || !confirmed) {
|
|
62925
|
+
clack57.cancel("Destruction cancelled.");
|
|
62196
62926
|
process.exit(0);
|
|
62197
62927
|
}
|
|
62198
62928
|
}
|
|
@@ -62224,8 +62954,8 @@ async function smsDestroy(options) {
|
|
|
62224
62954
|
costEstimate: "Monthly cost after destruction: $0.00",
|
|
62225
62955
|
commandName: "wraps sms destroy"
|
|
62226
62956
|
});
|
|
62227
|
-
|
|
62228
|
-
|
|
62957
|
+
clack57.outro(
|
|
62958
|
+
pc60.green("Preview complete. Run without --preview to destroy.")
|
|
62229
62959
|
);
|
|
62230
62960
|
trackServiceRemoved("sms", {
|
|
62231
62961
|
preview: true,
|
|
@@ -62236,7 +62966,7 @@ async function smsDestroy(options) {
|
|
|
62236
62966
|
progress.stop();
|
|
62237
62967
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62238
62968
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
62239
|
-
|
|
62969
|
+
clack57.log.warn("No SMS infrastructure found to preview");
|
|
62240
62970
|
process.exit(0);
|
|
62241
62971
|
}
|
|
62242
62972
|
trackError("PREVIEW_FAILED", "sms destroy", { step: "preview" });
|
|
@@ -62285,7 +63015,7 @@ async function smsDestroy(options) {
|
|
|
62285
63015
|
progress.stop();
|
|
62286
63016
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62287
63017
|
if (errorMessage.includes("No SMS infrastructure found")) {
|
|
62288
|
-
|
|
63018
|
+
clack57.log.warn("No SMS infrastructure found");
|
|
62289
63019
|
if (metadata) {
|
|
62290
63020
|
removeServiceFromConnection(metadata, "sms");
|
|
62291
63021
|
await saveConnectionMetadata(metadata);
|
|
@@ -62298,7 +63028,7 @@ async function smsDestroy(options) {
|
|
|
62298
63028
|
}
|
|
62299
63029
|
trackError("DESTROY_FAILED", "sms destroy", { step: "destroy" });
|
|
62300
63030
|
destroyFailed = true;
|
|
62301
|
-
|
|
63031
|
+
clack57.log.warn(
|
|
62302
63032
|
"Some resources may not have been fully removed. You can re-run this command or clean up manually in the AWS console."
|
|
62303
63033
|
);
|
|
62304
63034
|
}
|
|
@@ -62321,21 +63051,21 @@ async function smsDestroy(options) {
|
|
|
62321
63051
|
return;
|
|
62322
63052
|
}
|
|
62323
63053
|
if (destroyFailed) {
|
|
62324
|
-
|
|
62325
|
-
|
|
63054
|
+
clack57.outro(
|
|
63055
|
+
pc60.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
62326
63056
|
);
|
|
62327
63057
|
} else {
|
|
62328
|
-
|
|
63058
|
+
clack57.outro(pc60.green("SMS infrastructure has been removed"));
|
|
62329
63059
|
console.log(`
|
|
62330
|
-
${
|
|
62331
|
-
console.log(` ${
|
|
62332
|
-
console.log(` ${
|
|
62333
|
-
console.log(` ${
|
|
62334
|
-
console.log(` ${
|
|
63060
|
+
${pc60.bold("Cleaned up:")}`);
|
|
63061
|
+
console.log(` ${pc60.green("\u2713")} Phone number released`);
|
|
63062
|
+
console.log(` ${pc60.green("\u2713")} Configuration set deleted`);
|
|
63063
|
+
console.log(` ${pc60.green("\u2713")} Event processing infrastructure removed`);
|
|
63064
|
+
console.log(` ${pc60.green("\u2713")} IAM role deleted`);
|
|
62335
63065
|
}
|
|
62336
63066
|
console.log(
|
|
62337
63067
|
`
|
|
62338
|
-
Run ${
|
|
63068
|
+
Run ${pc60.cyan("wraps sms init")} to deploy infrastructure again.
|
|
62339
63069
|
`
|
|
62340
63070
|
);
|
|
62341
63071
|
trackServiceRemoved("sms", {
|
|
@@ -62347,9 +63077,9 @@ Run ${pc59.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
62347
63077
|
|
|
62348
63078
|
// src/commands/sms/init.ts
|
|
62349
63079
|
init_esm_shims();
|
|
62350
|
-
import * as
|
|
63080
|
+
import * as clack58 from "@clack/prompts";
|
|
62351
63081
|
import * as pulumi35 from "@pulumi/pulumi";
|
|
62352
|
-
import
|
|
63082
|
+
import pc61 from "picocolors";
|
|
62353
63083
|
init_events();
|
|
62354
63084
|
init_aws();
|
|
62355
63085
|
init_fs();
|
|
@@ -62768,7 +63498,7 @@ function validateSMSConfig(config2) {
|
|
|
62768
63498
|
|
|
62769
63499
|
// src/commands/sms/init.ts
|
|
62770
63500
|
async function promptPhoneNumberType() {
|
|
62771
|
-
const result = await
|
|
63501
|
+
const result = await clack58.select({
|
|
62772
63502
|
message: "Select phone number type:",
|
|
62773
63503
|
options: [
|
|
62774
63504
|
{
|
|
@@ -62788,14 +63518,14 @@ async function promptPhoneNumberType() {
|
|
|
62788
63518
|
}
|
|
62789
63519
|
]
|
|
62790
63520
|
});
|
|
62791
|
-
if (
|
|
62792
|
-
|
|
63521
|
+
if (clack58.isCancel(result)) {
|
|
63522
|
+
clack58.cancel("Operation cancelled.");
|
|
62793
63523
|
process.exit(0);
|
|
62794
63524
|
}
|
|
62795
63525
|
return result;
|
|
62796
63526
|
}
|
|
62797
63527
|
async function promptSMSPreset() {
|
|
62798
|
-
const result = await
|
|
63528
|
+
const result = await clack58.select({
|
|
62799
63529
|
message: "Choose configuration preset:",
|
|
62800
63530
|
options: [
|
|
62801
63531
|
{
|
|
@@ -62820,8 +63550,8 @@ async function promptSMSPreset() {
|
|
|
62820
63550
|
}
|
|
62821
63551
|
]
|
|
62822
63552
|
});
|
|
62823
|
-
if (
|
|
62824
|
-
|
|
63553
|
+
if (clack58.isCancel(result)) {
|
|
63554
|
+
clack58.cancel("Operation cancelled.");
|
|
62825
63555
|
process.exit(0);
|
|
62826
63556
|
}
|
|
62827
63557
|
return result;
|
|
@@ -62841,7 +63571,7 @@ var COMMON_COUNTRIES = [
|
|
|
62841
63571
|
{ code: "IN", name: "India" }
|
|
62842
63572
|
];
|
|
62843
63573
|
async function promptAllowedCountries() {
|
|
62844
|
-
const result = await
|
|
63574
|
+
const result = await clack58.multiselect({
|
|
62845
63575
|
message: "Select countries to allow SMS delivery (blocks all others):",
|
|
62846
63576
|
options: COMMON_COUNTRIES.map((c6) => ({
|
|
62847
63577
|
value: c6.code,
|
|
@@ -62850,14 +63580,14 @@ async function promptAllowedCountries() {
|
|
|
62850
63580
|
initialValues: ["US"],
|
|
62851
63581
|
required: true
|
|
62852
63582
|
});
|
|
62853
|
-
if (
|
|
62854
|
-
|
|
63583
|
+
if (clack58.isCancel(result)) {
|
|
63584
|
+
clack58.cancel("Operation cancelled.");
|
|
62855
63585
|
process.exit(0);
|
|
62856
63586
|
}
|
|
62857
63587
|
return result;
|
|
62858
63588
|
}
|
|
62859
63589
|
async function promptEstimatedSMSVolume() {
|
|
62860
|
-
const result = await
|
|
63590
|
+
const result = await clack58.select({
|
|
62861
63591
|
message: "Estimated messages per month:",
|
|
62862
63592
|
options: [
|
|
62863
63593
|
{ value: 100, label: "< 100 (Testing)" },
|
|
@@ -62867,8 +63597,8 @@ async function promptEstimatedSMSVolume() {
|
|
|
62867
63597
|
{ value: 1e5, label: "50,000+" }
|
|
62868
63598
|
]
|
|
62869
63599
|
});
|
|
62870
|
-
if (
|
|
62871
|
-
|
|
63600
|
+
if (clack58.isCancel(result)) {
|
|
63601
|
+
clack58.cancel("Operation cancelled.");
|
|
62872
63602
|
process.exit(0);
|
|
62873
63603
|
}
|
|
62874
63604
|
return result;
|
|
@@ -62876,14 +63606,14 @@ async function promptEstimatedSMSVolume() {
|
|
|
62876
63606
|
async function init3(options) {
|
|
62877
63607
|
const startTime = Date.now();
|
|
62878
63608
|
if (!isJsonMode()) {
|
|
62879
|
-
|
|
63609
|
+
clack58.intro(pc61.bold("Wraps SMS Infrastructure Setup"));
|
|
62880
63610
|
}
|
|
62881
63611
|
const progress = new DeploymentProgress();
|
|
62882
63612
|
const identity = await progress.execute(
|
|
62883
63613
|
"Validating AWS credentials",
|
|
62884
63614
|
async () => validateAWSCredentials()
|
|
62885
63615
|
);
|
|
62886
|
-
progress.info(`Connected to AWS account: ${
|
|
63616
|
+
progress.info(`Connected to AWS account: ${pc61.cyan(identity.accountId)}`);
|
|
62887
63617
|
const wasAutoInstalled = await progress.execute(
|
|
62888
63618
|
"Checking Pulumi CLI installation",
|
|
62889
63619
|
async () => await ensurePulumiInstalled()
|
|
@@ -62902,10 +63632,10 @@ async function init3(options) {
|
|
|
62902
63632
|
region
|
|
62903
63633
|
);
|
|
62904
63634
|
if (existingConnection?.services?.sms) {
|
|
62905
|
-
|
|
62906
|
-
`SMS already configured for account ${
|
|
63635
|
+
clack58.log.warn(
|
|
63636
|
+
`SMS already configured for account ${pc61.cyan(identity.accountId)} in region ${pc61.cyan(region)}`
|
|
62907
63637
|
);
|
|
62908
|
-
|
|
63638
|
+
clack58.log.info(`Use ${pc61.cyan("wraps sms status")} to view current setup`);
|
|
62909
63639
|
process.exit(0);
|
|
62910
63640
|
}
|
|
62911
63641
|
let preset = options.preset;
|
|
@@ -62922,12 +63652,12 @@ async function init3(options) {
|
|
|
62922
63652
|
optOutManagement: true,
|
|
62923
63653
|
sendingEnabled: true
|
|
62924
63654
|
};
|
|
62925
|
-
const enableEventTracking = await
|
|
63655
|
+
const enableEventTracking = await clack58.confirm({
|
|
62926
63656
|
message: "Enable event tracking (EventBridge + DynamoDB)?",
|
|
62927
63657
|
initialValue: false
|
|
62928
63658
|
});
|
|
62929
|
-
if (
|
|
62930
|
-
|
|
63659
|
+
if (clack58.isCancel(enableEventTracking)) {
|
|
63660
|
+
clack58.cancel("Operation cancelled.");
|
|
62931
63661
|
process.exit(0);
|
|
62932
63662
|
}
|
|
62933
63663
|
if (enableEventTracking) {
|
|
@@ -62947,17 +63677,17 @@ async function init3(options) {
|
|
|
62947
63677
|
}
|
|
62948
63678
|
progress.info(
|
|
62949
63679
|
`
|
|
62950
|
-
${
|
|
63680
|
+
${pc61.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
62951
63681
|
);
|
|
62952
63682
|
const allowedCountries = await promptAllowedCountries();
|
|
62953
63683
|
let aitFiltering = false;
|
|
62954
63684
|
if (smsConfig.phoneNumberType !== "simulator") {
|
|
62955
|
-
const enableAIT = await
|
|
63685
|
+
const enableAIT = await clack58.confirm({
|
|
62956
63686
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
62957
63687
|
initialValue: false
|
|
62958
63688
|
});
|
|
62959
|
-
if (
|
|
62960
|
-
|
|
63689
|
+
if (clack58.isCancel(enableAIT)) {
|
|
63690
|
+
clack58.cancel("Operation cancelled.");
|
|
62961
63691
|
process.exit(0);
|
|
62962
63692
|
}
|
|
62963
63693
|
aitFiltering = enableAIT;
|
|
@@ -62969,21 +63699,21 @@ ${pc60.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
62969
63699
|
};
|
|
62970
63700
|
const estimatedVolume = await promptEstimatedSMSVolume();
|
|
62971
63701
|
progress.info(`
|
|
62972
|
-
${
|
|
63702
|
+
${pc61.bold("Cost Estimate:")}`);
|
|
62973
63703
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
62974
|
-
|
|
63704
|
+
clack58.log.info(costSummary);
|
|
62975
63705
|
const warnings = validateSMSConfig(smsConfig);
|
|
62976
63706
|
if (warnings.length > 0) {
|
|
62977
63707
|
progress.info(`
|
|
62978
|
-
${
|
|
63708
|
+
${pc61.yellow(pc61.bold("Important Notes:"))}`);
|
|
62979
63709
|
for (const warning2 of warnings) {
|
|
62980
|
-
|
|
63710
|
+
clack58.log.warn(warning2);
|
|
62981
63711
|
}
|
|
62982
63712
|
}
|
|
62983
63713
|
if (!(options.yes || options.preview)) {
|
|
62984
63714
|
const confirmed = await confirmDeploy();
|
|
62985
63715
|
if (!confirmed) {
|
|
62986
|
-
|
|
63716
|
+
clack58.cancel("Deployment cancelled.");
|
|
62987
63717
|
process.exit(0);
|
|
62988
63718
|
}
|
|
62989
63719
|
}
|
|
@@ -63043,8 +63773,8 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63043
63773
|
costEstimate: getSMSCostSummary(smsConfig, 0),
|
|
63044
63774
|
commandName: "wraps sms init"
|
|
63045
63775
|
});
|
|
63046
|
-
|
|
63047
|
-
|
|
63776
|
+
clack58.outro(
|
|
63777
|
+
pc61.green("Preview complete. Run without --preview to deploy.")
|
|
63048
63778
|
);
|
|
63049
63779
|
trackServiceInit("sms", true, {
|
|
63050
63780
|
provider,
|
|
@@ -63093,9 +63823,9 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63093
63823
|
} catch (sdkError) {
|
|
63094
63824
|
sdkResourceWarning = true;
|
|
63095
63825
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63096
|
-
|
|
63097
|
-
|
|
63098
|
-
`Run ${
|
|
63826
|
+
clack58.log.warn(`Phone pool creation failed: ${msg}`);
|
|
63827
|
+
clack58.log.info(
|
|
63828
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63099
63829
|
);
|
|
63100
63830
|
}
|
|
63101
63831
|
}
|
|
@@ -63111,9 +63841,9 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63111
63841
|
} catch (sdkError) {
|
|
63112
63842
|
sdkResourceWarning = true;
|
|
63113
63843
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63114
|
-
|
|
63115
|
-
|
|
63116
|
-
`Run ${
|
|
63844
|
+
clack58.log.warn(`Event destination creation failed: ${msg}`);
|
|
63845
|
+
clack58.log.info(
|
|
63846
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63117
63847
|
);
|
|
63118
63848
|
}
|
|
63119
63849
|
}
|
|
@@ -63132,14 +63862,14 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63132
63862
|
} catch (sdkError) {
|
|
63133
63863
|
sdkResourceWarning = true;
|
|
63134
63864
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63135
|
-
|
|
63136
|
-
|
|
63137
|
-
`Run ${
|
|
63865
|
+
clack58.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
63866
|
+
clack58.log.info(
|
|
63867
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63138
63868
|
);
|
|
63139
63869
|
}
|
|
63140
63870
|
}
|
|
63141
63871
|
if (sdkResourceWarning) {
|
|
63142
|
-
|
|
63872
|
+
clack58.log.warn(
|
|
63143
63873
|
"Some SDK resources failed to create. Core infrastructure is deployed."
|
|
63144
63874
|
);
|
|
63145
63875
|
}
|
|
@@ -63184,47 +63914,47 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63184
63914
|
return;
|
|
63185
63915
|
}
|
|
63186
63916
|
console.log("\n");
|
|
63187
|
-
|
|
63917
|
+
clack58.log.success(pc61.green(pc61.bold("SMS infrastructure deployed!")));
|
|
63188
63918
|
console.log("\n");
|
|
63189
|
-
|
|
63919
|
+
clack58.note(
|
|
63190
63920
|
[
|
|
63191
|
-
`${
|
|
63192
|
-
`${
|
|
63193
|
-
`${
|
|
63194
|
-
`${
|
|
63195
|
-
outputs.tableName ? `${
|
|
63921
|
+
`${pc61.bold("Phone Number:")} ${pc61.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
63922
|
+
`${pc61.bold("Phone Type:")} ${pc61.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
63923
|
+
`${pc61.bold("Config Set:")} ${pc61.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
63924
|
+
`${pc61.bold("Region:")} ${pc61.cyan(outputs.region)}`,
|
|
63925
|
+
outputs.tableName ? `${pc61.bold("History Table:")} ${pc61.cyan(outputs.tableName)}` : "",
|
|
63196
63926
|
"",
|
|
63197
|
-
|
|
63198
|
-
|
|
63927
|
+
pc61.dim("IAM Role:"),
|
|
63928
|
+
pc61.dim(` ${outputs.roleArn}`)
|
|
63199
63929
|
].filter(Boolean).join("\n"),
|
|
63200
63930
|
"SMS Infrastructure"
|
|
63201
63931
|
);
|
|
63202
63932
|
const nextSteps = [];
|
|
63203
63933
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
63204
63934
|
nextSteps.push(
|
|
63205
|
-
`${
|
|
63935
|
+
`${pc61.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
63206
63936
|
);
|
|
63207
63937
|
}
|
|
63208
63938
|
nextSteps.push(
|
|
63209
|
-
`${
|
|
63939
|
+
`${pc61.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
63210
63940
|
);
|
|
63211
|
-
nextSteps.push(`${
|
|
63941
|
+
nextSteps.push(`${pc61.cyan("wraps sms status")} - View SMS configuration`);
|
|
63212
63942
|
console.log("\n");
|
|
63213
|
-
|
|
63943
|
+
clack58.log.info(pc61.bold("Next steps:"));
|
|
63214
63944
|
for (const step of nextSteps) {
|
|
63215
63945
|
console.log(` ${step}`);
|
|
63216
63946
|
}
|
|
63217
63947
|
console.log("\n");
|
|
63218
|
-
|
|
63219
|
-
console.log(
|
|
63948
|
+
clack58.log.info(pc61.bold("SDK Usage:"));
|
|
63949
|
+
console.log(pc61.dim(" npm install @wraps.dev/sms"));
|
|
63220
63950
|
console.log("");
|
|
63221
|
-
console.log(
|
|
63222
|
-
console.log(
|
|
63223
|
-
console.log(
|
|
63224
|
-
console.log(
|
|
63225
|
-
console.log(
|
|
63226
|
-
console.log(
|
|
63227
|
-
|
|
63951
|
+
console.log(pc61.dim(" import { Wraps } from '@wraps.dev/sms';"));
|
|
63952
|
+
console.log(pc61.dim(" const wraps = new Wraps();"));
|
|
63953
|
+
console.log(pc61.dim(" await wraps.sms.send({"));
|
|
63954
|
+
console.log(pc61.dim(" to: '+14155551234',"));
|
|
63955
|
+
console.log(pc61.dim(" message: 'Your code is 123456',"));
|
|
63956
|
+
console.log(pc61.dim(" });"));
|
|
63957
|
+
clack58.outro(pc61.green("Setup complete!"));
|
|
63228
63958
|
const duration = Date.now() - startTime;
|
|
63229
63959
|
const enabledFeatures = [];
|
|
63230
63960
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -63260,8 +63990,8 @@ init_aws();
|
|
|
63260
63990
|
init_json_output();
|
|
63261
63991
|
init_metadata();
|
|
63262
63992
|
init_output();
|
|
63263
|
-
import * as
|
|
63264
|
-
import
|
|
63993
|
+
import * as clack59 from "@clack/prompts";
|
|
63994
|
+
import pc62 from "picocolors";
|
|
63265
63995
|
async function getPhoneNumberDetails(region) {
|
|
63266
63996
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
63267
63997
|
const client2 = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -63281,7 +64011,7 @@ async function getPhoneNumberDetails(region) {
|
|
|
63281
64011
|
return null;
|
|
63282
64012
|
} catch (error) {
|
|
63283
64013
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
63284
|
-
|
|
64014
|
+
clack59.log.error(`Error fetching phone number: ${errorMessage}`);
|
|
63285
64015
|
return null;
|
|
63286
64016
|
}
|
|
63287
64017
|
}
|
|
@@ -63302,7 +64032,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
63302
64032
|
async function smsRegister(options) {
|
|
63303
64033
|
const startTime = Date.now();
|
|
63304
64034
|
if (!isJsonMode()) {
|
|
63305
|
-
|
|
64035
|
+
clack59.intro(pc62.bold("Wraps SMS - Toll-Free Registration"));
|
|
63306
64036
|
}
|
|
63307
64037
|
const progress = new DeploymentProgress();
|
|
63308
64038
|
const identity = await progress.execute(
|
|
@@ -63315,8 +64045,8 @@ async function smsRegister(options) {
|
|
|
63315
64045
|
}
|
|
63316
64046
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63317
64047
|
if (!metadata?.services?.sms) {
|
|
63318
|
-
|
|
63319
|
-
|
|
64048
|
+
clack59.log.error("No SMS infrastructure found.");
|
|
64049
|
+
clack59.log.info(`Run ${pc62.cyan("wraps sms init")} first.`);
|
|
63320
64050
|
process.exit(1);
|
|
63321
64051
|
}
|
|
63322
64052
|
const phoneDetails = await progress.execute(
|
|
@@ -63324,7 +64054,7 @@ async function smsRegister(options) {
|
|
|
63324
64054
|
async () => getPhoneNumberDetails(region)
|
|
63325
64055
|
);
|
|
63326
64056
|
if (!phoneDetails) {
|
|
63327
|
-
|
|
64057
|
+
clack59.log.error("No phone number found.");
|
|
63328
64058
|
process.exit(1);
|
|
63329
64059
|
}
|
|
63330
64060
|
let registrationStatus = null;
|
|
@@ -63350,53 +64080,53 @@ async function smsRegister(options) {
|
|
|
63350
64080
|
}
|
|
63351
64081
|
console.log("");
|
|
63352
64082
|
console.log(
|
|
63353
|
-
`${
|
|
64083
|
+
`${pc62.bold("Phone Number:")} ${pc62.cyan(phoneDetails.phoneNumber)}`
|
|
63354
64084
|
);
|
|
63355
|
-
console.log(`${
|
|
64085
|
+
console.log(`${pc62.bold("Type:")} ${pc62.cyan(phoneDetails.type)}`);
|
|
63356
64086
|
console.log(
|
|
63357
|
-
`${
|
|
64087
|
+
`${pc62.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc62.green(phoneDetails.status) : pc62.yellow(phoneDetails.status)}`
|
|
63358
64088
|
);
|
|
63359
64089
|
if (registrationStatus) {
|
|
63360
|
-
console.log(`${
|
|
64090
|
+
console.log(`${pc62.bold("Registration:")} ${pc62.cyan(registrationStatus)}`);
|
|
63361
64091
|
}
|
|
63362
64092
|
console.log("");
|
|
63363
64093
|
if (phoneDetails.status === "ACTIVE") {
|
|
63364
|
-
|
|
64094
|
+
clack59.log.success("Your phone number is already ACTIVE and ready to use!");
|
|
63365
64095
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePoolsCommand } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
63366
64096
|
const client2 = new PinpointSMSVoiceV2Client5({ region });
|
|
63367
64097
|
const pools = await client2.send(new DescribePoolsCommand({}));
|
|
63368
64098
|
if (!pools.Pools?.length) {
|
|
63369
|
-
|
|
64099
|
+
clack59.log.info("Run `wraps sms sync` to create the phone pool.");
|
|
63370
64100
|
}
|
|
63371
64101
|
process.exit(0);
|
|
63372
64102
|
}
|
|
63373
64103
|
if (phoneDetails.type !== "TOLL_FREE") {
|
|
63374
|
-
|
|
63375
|
-
|
|
64104
|
+
clack59.log.info("Only toll-free numbers require registration.");
|
|
64105
|
+
clack59.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
63376
64106
|
process.exit(0);
|
|
63377
64107
|
}
|
|
63378
|
-
console.log(
|
|
64108
|
+
console.log(pc62.bold("Toll-Free Registration Required"));
|
|
63379
64109
|
console.log("");
|
|
63380
64110
|
console.log(
|
|
63381
|
-
|
|
64111
|
+
pc62.dim("To send SMS at scale, you must register your toll-free number.")
|
|
63382
64112
|
);
|
|
63383
|
-
console.log(
|
|
64113
|
+
console.log(pc62.dim("This process typically takes 1-15 business days."));
|
|
63384
64114
|
console.log("");
|
|
63385
|
-
console.log(
|
|
63386
|
-
console.log(` ${
|
|
64115
|
+
console.log(pc62.bold("You'll need to provide:"));
|
|
64116
|
+
console.log(` ${pc62.dim("\u2022")} Business name and address`);
|
|
63387
64117
|
console.log(
|
|
63388
|
-
` ${
|
|
64118
|
+
` ${pc62.dim("\u2022")} Use case description (what messages you're sending)`
|
|
63389
64119
|
);
|
|
63390
|
-
console.log(` ${
|
|
63391
|
-
console.log(` ${
|
|
63392
|
-
console.log(` ${
|
|
64120
|
+
console.log(` ${pc62.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
64121
|
+
console.log(` ${pc62.dim("\u2022")} How users opt-in to receive messages`);
|
|
64122
|
+
console.log(` ${pc62.dim("\u2022")} Expected monthly message volume`);
|
|
63393
64123
|
console.log("");
|
|
63394
|
-
const openConsole = await
|
|
64124
|
+
const openConsole = await clack59.confirm({
|
|
63395
64125
|
message: "Open AWS Console to start registration?",
|
|
63396
64126
|
initialValue: true
|
|
63397
64127
|
});
|
|
63398
|
-
if (
|
|
63399
|
-
|
|
64128
|
+
if (clack59.isCancel(openConsole)) {
|
|
64129
|
+
clack59.cancel("Registration cancelled.");
|
|
63400
64130
|
process.exit(0);
|
|
63401
64131
|
}
|
|
63402
64132
|
if (openConsole) {
|
|
@@ -63406,41 +64136,41 @@ async function smsRegister(options) {
|
|
|
63406
64136
|
const execAsync2 = promisify3(exec3);
|
|
63407
64137
|
try {
|
|
63408
64138
|
await execAsync2(`open "${consoleUrl}"`);
|
|
63409
|
-
|
|
64139
|
+
clack59.log.success("Opened AWS Console in your browser.");
|
|
63410
64140
|
} catch {
|
|
63411
64141
|
try {
|
|
63412
64142
|
await execAsync2(`xdg-open "${consoleUrl}"`);
|
|
63413
|
-
|
|
64143
|
+
clack59.log.success("Opened AWS Console in your browser.");
|
|
63414
64144
|
} catch {
|
|
63415
|
-
|
|
64145
|
+
clack59.log.info("Open this URL in your browser:");
|
|
63416
64146
|
console.log(`
|
|
63417
|
-
${
|
|
64147
|
+
${pc62.cyan(consoleUrl)}
|
|
63418
64148
|
`);
|
|
63419
64149
|
}
|
|
63420
64150
|
}
|
|
63421
64151
|
console.log("");
|
|
63422
|
-
console.log(
|
|
64152
|
+
console.log(pc62.bold("Next Steps:"));
|
|
63423
64153
|
console.log(
|
|
63424
|
-
` 1. Click ${
|
|
64154
|
+
` 1. Click ${pc62.cyan("Create registration")} in the AWS Console`
|
|
63425
64155
|
);
|
|
63426
|
-
console.log(` 2. Select ${
|
|
64156
|
+
console.log(` 2. Select ${pc62.cyan("Toll-free number registration")}`);
|
|
63427
64157
|
console.log(" 3. Fill out the business information form");
|
|
63428
64158
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
63429
64159
|
console.log("");
|
|
63430
64160
|
console.log(
|
|
63431
|
-
|
|
64161
|
+
pc62.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
63432
64162
|
);
|
|
63433
64163
|
} else {
|
|
63434
64164
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
63435
64165
|
console.log("");
|
|
63436
64166
|
console.log("When you're ready, go to:");
|
|
63437
|
-
console.log(` ${
|
|
64167
|
+
console.log(` ${pc62.cyan(consoleUrl)}`);
|
|
63438
64168
|
}
|
|
63439
64169
|
trackCommand("sms:register", {
|
|
63440
64170
|
success: true,
|
|
63441
64171
|
duration_ms: Date.now() - startTime
|
|
63442
64172
|
});
|
|
63443
|
-
|
|
64173
|
+
clack59.outro(pc62.dim("Good luck with your registration!"));
|
|
63444
64174
|
}
|
|
63445
64175
|
|
|
63446
64176
|
// src/commands/sms/status.ts
|
|
@@ -63453,54 +64183,54 @@ init_metadata();
|
|
|
63453
64183
|
init_output();
|
|
63454
64184
|
init_pulumi();
|
|
63455
64185
|
init_region_resolver();
|
|
63456
|
-
import * as
|
|
64186
|
+
import * as clack60 from "@clack/prompts";
|
|
63457
64187
|
import * as pulumi36 from "@pulumi/pulumi";
|
|
63458
|
-
import
|
|
64188
|
+
import pc63 from "picocolors";
|
|
63459
64189
|
function displaySMSStatus(options) {
|
|
63460
64190
|
const lines = [];
|
|
63461
|
-
lines.push(
|
|
64191
|
+
lines.push(pc63.bold(pc63.green("SMS Infrastructure Active")));
|
|
63462
64192
|
lines.push("");
|
|
63463
|
-
lines.push(
|
|
64193
|
+
lines.push(pc63.bold("Phone Number"));
|
|
63464
64194
|
if (options.phoneNumber) {
|
|
63465
|
-
lines.push(` Number: ${
|
|
64195
|
+
lines.push(` Number: ${pc63.cyan(options.phoneNumber)}`);
|
|
63466
64196
|
} else {
|
|
63467
|
-
lines.push(` Number: ${
|
|
64197
|
+
lines.push(` Number: ${pc63.yellow("Provisioning...")}`);
|
|
63468
64198
|
}
|
|
63469
|
-
lines.push(` Type: ${
|
|
64199
|
+
lines.push(` Type: ${pc63.cyan(options.phoneNumberType || "simulator")}`);
|
|
63470
64200
|
lines.push("");
|
|
63471
|
-
lines.push(
|
|
63472
|
-
lines.push(` Region: ${
|
|
64201
|
+
lines.push(pc63.bold("Configuration"));
|
|
64202
|
+
lines.push(` Region: ${pc63.cyan(options.region)}`);
|
|
63473
64203
|
if (options.preset) {
|
|
63474
|
-
lines.push(` Preset: ${
|
|
64204
|
+
lines.push(` Preset: ${pc63.cyan(options.preset)}`);
|
|
63475
64205
|
}
|
|
63476
64206
|
if (options.configSetName) {
|
|
63477
|
-
lines.push(` Config Set: ${
|
|
64207
|
+
lines.push(` Config Set: ${pc63.cyan(options.configSetName)}`);
|
|
63478
64208
|
}
|
|
63479
64209
|
lines.push("");
|
|
63480
|
-
lines.push(
|
|
64210
|
+
lines.push(pc63.bold("Features"));
|
|
63481
64211
|
lines.push(
|
|
63482
|
-
` Event Tracking: ${options.eventTracking ?
|
|
64212
|
+
` Event Tracking: ${options.eventTracking ? pc63.green("Enabled") : pc63.dim("Disabled")}`
|
|
63483
64213
|
);
|
|
63484
64214
|
if (options.tableName) {
|
|
63485
|
-
lines.push(` Message History: ${
|
|
63486
|
-
lines.push(` Table: ${
|
|
64215
|
+
lines.push(` Message History: ${pc63.green("Enabled")}`);
|
|
64216
|
+
lines.push(` Table: ${pc63.dim(options.tableName)}`);
|
|
63487
64217
|
}
|
|
63488
64218
|
if (options.queueUrl) {
|
|
63489
|
-
lines.push(` Event Queue: ${
|
|
64219
|
+
lines.push(` Event Queue: ${pc63.green("Enabled")}`);
|
|
63490
64220
|
}
|
|
63491
64221
|
lines.push("");
|
|
63492
64222
|
if (options.roleArn) {
|
|
63493
|
-
lines.push(
|
|
63494
|
-
lines.push(` ${
|
|
64223
|
+
lines.push(pc63.bold("IAM Role"));
|
|
64224
|
+
lines.push(` ${pc63.dim(options.roleArn)}`);
|
|
63495
64225
|
}
|
|
63496
|
-
|
|
64226
|
+
clack60.note(lines.join("\n"), "SMS Status");
|
|
63497
64227
|
}
|
|
63498
64228
|
async function smsStatus(options) {
|
|
63499
64229
|
await ensurePulumiInstalled();
|
|
63500
64230
|
const startTime = Date.now();
|
|
63501
64231
|
const progress = new DeploymentProgress();
|
|
63502
64232
|
if (!isJsonMode()) {
|
|
63503
|
-
|
|
64233
|
+
clack60.intro(pc63.bold("Wraps SMS Status"));
|
|
63504
64234
|
}
|
|
63505
64235
|
const identity = await progress.execute(
|
|
63506
64236
|
"Loading SMS infrastructure status",
|
|
@@ -63515,10 +64245,10 @@ async function smsStatus(options) {
|
|
|
63515
64245
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63516
64246
|
if (!metadata?.services?.sms) {
|
|
63517
64247
|
progress.stop();
|
|
63518
|
-
|
|
64248
|
+
clack60.log.error("No SMS infrastructure found");
|
|
63519
64249
|
console.log(
|
|
63520
64250
|
`
|
|
63521
|
-
Run ${
|
|
64251
|
+
Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
63522
64252
|
`
|
|
63523
64253
|
);
|
|
63524
64254
|
process.exit(1);
|
|
@@ -63554,25 +64284,25 @@ Run ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63554
64284
|
}
|
|
63555
64285
|
displaySMSStatus(smsStatusData);
|
|
63556
64286
|
console.log("");
|
|
63557
|
-
|
|
64287
|
+
clack60.log.info(pc63.bold("Commands:"));
|
|
63558
64288
|
console.log(
|
|
63559
|
-
` ${
|
|
64289
|
+
` ${pc63.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
63560
64290
|
);
|
|
63561
|
-
console.log(` ${
|
|
64291
|
+
console.log(` ${pc63.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
63562
64292
|
trackCommand("sms:status", {
|
|
63563
64293
|
success: true,
|
|
63564
64294
|
phone_type: smsConfig?.phoneNumberType,
|
|
63565
64295
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
63566
64296
|
duration_ms: Date.now() - startTime
|
|
63567
64297
|
});
|
|
63568
|
-
|
|
64298
|
+
clack60.outro(pc63.dim("SMS infrastructure is ready"));
|
|
63569
64299
|
}
|
|
63570
64300
|
|
|
63571
64301
|
// src/commands/sms/sync.ts
|
|
63572
64302
|
init_esm_shims();
|
|
63573
|
-
import * as
|
|
64303
|
+
import * as clack61 from "@clack/prompts";
|
|
63574
64304
|
import * as pulumi37 from "@pulumi/pulumi";
|
|
63575
|
-
import
|
|
64305
|
+
import pc64 from "picocolors";
|
|
63576
64306
|
init_events();
|
|
63577
64307
|
init_aws();
|
|
63578
64308
|
init_errors();
|
|
@@ -63585,7 +64315,7 @@ async function smsSync(options) {
|
|
|
63585
64315
|
await ensurePulumiInstalled();
|
|
63586
64316
|
const startTime = Date.now();
|
|
63587
64317
|
if (!isJsonMode()) {
|
|
63588
|
-
|
|
64318
|
+
clack61.intro(pc64.bold("Wraps SMS Infrastructure Sync"));
|
|
63589
64319
|
}
|
|
63590
64320
|
const progress = new DeploymentProgress();
|
|
63591
64321
|
const identity = await progress.execute(
|
|
@@ -63597,10 +64327,10 @@ async function smsSync(options) {
|
|
|
63597
64327
|
const smsService = metadata?.services?.sms;
|
|
63598
64328
|
if (!smsService?.config) {
|
|
63599
64329
|
progress.stop();
|
|
63600
|
-
|
|
64330
|
+
clack61.log.error("No SMS infrastructure found to sync");
|
|
63601
64331
|
console.log(
|
|
63602
64332
|
`
|
|
63603
|
-
Run ${
|
|
64333
|
+
Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
63604
64334
|
`
|
|
63605
64335
|
);
|
|
63606
64336
|
process.exit(1);
|
|
@@ -63609,18 +64339,18 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63609
64339
|
const storedStackName = smsService.pulumiStackName;
|
|
63610
64340
|
progress.info("Found existing SMS configuration");
|
|
63611
64341
|
progress.info(
|
|
63612
|
-
`Phone type: ${
|
|
64342
|
+
`Phone type: ${pc64.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
63613
64343
|
);
|
|
63614
64344
|
progress.info(
|
|
63615
|
-
`Event tracking: ${
|
|
64345
|
+
`Event tracking: ${pc64.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
63616
64346
|
);
|
|
63617
64347
|
if (!options.yes) {
|
|
63618
|
-
const confirmed = await
|
|
64348
|
+
const confirmed = await clack61.confirm({
|
|
63619
64349
|
message: "Sync SMS infrastructure? This will update Lambda code and recreate any missing resources.",
|
|
63620
64350
|
initialValue: true
|
|
63621
64351
|
});
|
|
63622
|
-
if (
|
|
63623
|
-
|
|
64352
|
+
if (clack61.isCancel(confirmed) || !confirmed) {
|
|
64353
|
+
clack61.cancel("Sync cancelled.");
|
|
63624
64354
|
process.exit(0);
|
|
63625
64355
|
}
|
|
63626
64356
|
}
|
|
@@ -63725,7 +64455,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63725
64455
|
throw errors.stackLocked();
|
|
63726
64456
|
}
|
|
63727
64457
|
trackError("SYNC_FAILED", "sms:sync", { step: "sync" });
|
|
63728
|
-
|
|
64458
|
+
clack61.log.error(`SMS sync failed: ${errorMessage}`);
|
|
63729
64459
|
process.exit(1);
|
|
63730
64460
|
}
|
|
63731
64461
|
if (metadata && smsService) {
|
|
@@ -63745,7 +64475,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63745
64475
|
return;
|
|
63746
64476
|
}
|
|
63747
64477
|
console.log("\n");
|
|
63748
|
-
|
|
64478
|
+
clack61.log.success(pc64.green("SMS infrastructure synced successfully!"));
|
|
63749
64479
|
const changes = [];
|
|
63750
64480
|
if (outputs.lambdaFunctions?.length) {
|
|
63751
64481
|
changes.push("Lambda functions updated");
|
|
@@ -63753,13 +64483,13 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
63753
64483
|
changes.push("SDK resources verified");
|
|
63754
64484
|
console.log("");
|
|
63755
64485
|
for (const change of changes) {
|
|
63756
|
-
console.log(` ${
|
|
64486
|
+
console.log(` ${pc64.green("\u2713")} ${change}`);
|
|
63757
64487
|
}
|
|
63758
64488
|
trackCommand("sms:sync", {
|
|
63759
64489
|
success: true,
|
|
63760
64490
|
duration_ms: Date.now() - startTime
|
|
63761
64491
|
});
|
|
63762
|
-
|
|
64492
|
+
clack61.outro(pc64.green("Sync complete!"));
|
|
63763
64493
|
}
|
|
63764
64494
|
|
|
63765
64495
|
// src/commands/sms/test.ts
|
|
@@ -63774,8 +64504,8 @@ import {
|
|
|
63774
64504
|
PinpointSMSVoiceV2Client as PinpointSMSVoiceV2Client3,
|
|
63775
64505
|
SendTextMessageCommand
|
|
63776
64506
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
63777
|
-
import * as
|
|
63778
|
-
import
|
|
64507
|
+
import * as clack62 from "@clack/prompts";
|
|
64508
|
+
import pc65 from "picocolors";
|
|
63779
64509
|
|
|
63780
64510
|
// src/utils/sms/validation.ts
|
|
63781
64511
|
init_esm_shims();
|
|
@@ -63798,7 +64528,7 @@ async function smsTest(options) {
|
|
|
63798
64528
|
const startTime = Date.now();
|
|
63799
64529
|
const progress = new DeploymentProgress();
|
|
63800
64530
|
if (!isJsonMode()) {
|
|
63801
|
-
|
|
64531
|
+
clack62.intro(pc65.bold("Wraps SMS Test"));
|
|
63802
64532
|
}
|
|
63803
64533
|
const identity = await progress.execute(
|
|
63804
64534
|
"Validating AWS credentials",
|
|
@@ -63808,10 +64538,10 @@ async function smsTest(options) {
|
|
|
63808
64538
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
63809
64539
|
if (!metadata?.services?.sms) {
|
|
63810
64540
|
progress.stop();
|
|
63811
|
-
|
|
64541
|
+
clack62.log.error("No SMS infrastructure found");
|
|
63812
64542
|
console.log(
|
|
63813
64543
|
`
|
|
63814
|
-
Run ${
|
|
64544
|
+
Run ${pc65.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
63815
64545
|
`
|
|
63816
64546
|
);
|
|
63817
64547
|
process.exit(1);
|
|
@@ -63825,7 +64555,7 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63825
64555
|
);
|
|
63826
64556
|
}
|
|
63827
64557
|
if (!toNumber) {
|
|
63828
|
-
const destinationType = await
|
|
64558
|
+
const destinationType = await clack62.select({
|
|
63829
64559
|
message: "Choose destination number:",
|
|
63830
64560
|
options: [
|
|
63831
64561
|
{
|
|
@@ -63840,25 +64570,25 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63840
64570
|
}
|
|
63841
64571
|
]
|
|
63842
64572
|
});
|
|
63843
|
-
if (
|
|
63844
|
-
|
|
64573
|
+
if (clack62.isCancel(destinationType)) {
|
|
64574
|
+
clack62.cancel("Operation cancelled.");
|
|
63845
64575
|
process.exit(0);
|
|
63846
64576
|
}
|
|
63847
64577
|
if (destinationType === "simulator") {
|
|
63848
|
-
const simResult = await
|
|
64578
|
+
const simResult = await clack62.select({
|
|
63849
64579
|
message: "Select simulator destination:",
|
|
63850
64580
|
options: SIMULATOR_DESTINATIONS.map((sim) => ({
|
|
63851
64581
|
value: sim.number,
|
|
63852
64582
|
label: `${sim.number} | ${sim.country}`
|
|
63853
64583
|
}))
|
|
63854
64584
|
});
|
|
63855
|
-
if (
|
|
63856
|
-
|
|
64585
|
+
if (clack62.isCancel(simResult)) {
|
|
64586
|
+
clack62.cancel("Operation cancelled.");
|
|
63857
64587
|
process.exit(0);
|
|
63858
64588
|
}
|
|
63859
64589
|
toNumber = simResult;
|
|
63860
64590
|
} else {
|
|
63861
|
-
const result = await
|
|
64591
|
+
const result = await clack62.text({
|
|
63862
64592
|
message: "Enter destination phone number (E.164 format):",
|
|
63863
64593
|
placeholder: "+14155551234",
|
|
63864
64594
|
validate: (value) => {
|
|
@@ -63871,22 +64601,22 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63871
64601
|
return;
|
|
63872
64602
|
}
|
|
63873
64603
|
});
|
|
63874
|
-
if (
|
|
63875
|
-
|
|
64604
|
+
if (clack62.isCancel(result)) {
|
|
64605
|
+
clack62.cancel("Operation cancelled.");
|
|
63876
64606
|
process.exit(0);
|
|
63877
64607
|
}
|
|
63878
64608
|
toNumber = result;
|
|
63879
64609
|
}
|
|
63880
64610
|
} else if (!isValidPhoneNumber(toNumber)) {
|
|
63881
64611
|
progress.stop();
|
|
63882
|
-
|
|
64612
|
+
clack62.log.error(
|
|
63883
64613
|
`Invalid phone number format: ${toNumber}. Use E.164 format (e.g., +14155551234)`
|
|
63884
64614
|
);
|
|
63885
64615
|
process.exit(1);
|
|
63886
64616
|
}
|
|
63887
64617
|
let message = options.message;
|
|
63888
64618
|
if (!message) {
|
|
63889
|
-
const result = await
|
|
64619
|
+
const result = await clack62.text({
|
|
63890
64620
|
message: "Enter test message:",
|
|
63891
64621
|
placeholder: "Hello from Wraps SMS!",
|
|
63892
64622
|
defaultValue: "Hello from Wraps SMS! This is a test message.",
|
|
@@ -63900,8 +64630,8 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63900
64630
|
return;
|
|
63901
64631
|
}
|
|
63902
64632
|
});
|
|
63903
|
-
if (
|
|
63904
|
-
|
|
64633
|
+
if (clack62.isCancel(result)) {
|
|
64634
|
+
clack62.cancel("Operation cancelled.");
|
|
63905
64635
|
process.exit(0);
|
|
63906
64636
|
}
|
|
63907
64637
|
message = result;
|
|
@@ -63940,16 +64670,16 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63940
64670
|
return;
|
|
63941
64671
|
}
|
|
63942
64672
|
console.log("\n");
|
|
63943
|
-
|
|
64673
|
+
clack62.log.success(pc65.green("Test SMS sent successfully!"));
|
|
63944
64674
|
console.log("");
|
|
63945
|
-
|
|
64675
|
+
clack62.note(
|
|
63946
64676
|
[
|
|
63947
|
-
`${
|
|
63948
|
-
`${
|
|
63949
|
-
`${
|
|
63950
|
-
`${
|
|
64677
|
+
`${pc65.bold("Message ID:")} ${pc65.cyan(messageId || "unknown")}`,
|
|
64678
|
+
`${pc65.bold("To:")} ${pc65.cyan(toNumber)}`,
|
|
64679
|
+
`${pc65.bold("Message:")} ${message}`,
|
|
64680
|
+
`${pc65.bold("Type:")} ${pc65.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
63951
64681
|
"",
|
|
63952
|
-
|
|
64682
|
+
pc65.dim(
|
|
63953
64683
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
63954
64684
|
)
|
|
63955
64685
|
].join("\n"),
|
|
@@ -63957,11 +64687,11 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63957
64687
|
);
|
|
63958
64688
|
if (smsConfig?.eventTracking?.enabled) {
|
|
63959
64689
|
console.log("");
|
|
63960
|
-
|
|
63961
|
-
|
|
64690
|
+
clack62.log.info(
|
|
64691
|
+
pc65.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
63962
64692
|
);
|
|
63963
64693
|
}
|
|
63964
|
-
|
|
64694
|
+
clack62.outro(pc65.green("Test complete!"));
|
|
63965
64695
|
} catch (error) {
|
|
63966
64696
|
progress.stop();
|
|
63967
64697
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -63973,33 +64703,33 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
63973
64703
|
});
|
|
63974
64704
|
const errorName = error instanceof Error ? error.name : "";
|
|
63975
64705
|
if (errorName === "ConflictException" || errorMessage.includes("opt-out")) {
|
|
63976
|
-
|
|
64706
|
+
clack62.log.error("Destination number has opted out of messages");
|
|
63977
64707
|
console.log("\nThe recipient has opted out of receiving SMS messages.\n");
|
|
63978
64708
|
} else if (errorName === "ThrottlingException" || errorMessage.includes("spending limit")) {
|
|
63979
|
-
|
|
64709
|
+
clack62.log.error("SMS rate or spending limit reached");
|
|
63980
64710
|
console.log(
|
|
63981
64711
|
"\nCheck your AWS account SMS spending limits in the console.\n"
|
|
63982
64712
|
);
|
|
63983
64713
|
} else if (errorName === "ValidationException") {
|
|
63984
|
-
|
|
64714
|
+
clack62.log.error(`Invalid request: ${errorMessage}`);
|
|
63985
64715
|
} else if (errorMessage.includes("not verified") || errorMessage.includes("not registered")) {
|
|
63986
|
-
|
|
64716
|
+
clack62.log.error("Toll-free number registration is not complete");
|
|
63987
64717
|
console.log(
|
|
63988
64718
|
`
|
|
63989
|
-
Run ${
|
|
64719
|
+
Run ${pc65.cyan("wraps sms register")} to check registration status.
|
|
63990
64720
|
`
|
|
63991
64721
|
);
|
|
63992
64722
|
} else if (errorName === "AccessDeniedException") {
|
|
63993
|
-
|
|
64723
|
+
clack62.log.error(
|
|
63994
64724
|
"Permission denied \u2014 IAM role may be missing SMS send permissions"
|
|
63995
64725
|
);
|
|
63996
64726
|
console.log(
|
|
63997
64727
|
`
|
|
63998
|
-
Run ${
|
|
64728
|
+
Run ${pc65.cyan("wraps sms upgrade")} to update IAM policies.
|
|
63999
64729
|
`
|
|
64000
64730
|
);
|
|
64001
64731
|
} else {
|
|
64002
|
-
|
|
64732
|
+
clack62.log.error(`Failed to send SMS: ${errorMessage}`);
|
|
64003
64733
|
}
|
|
64004
64734
|
process.exit(1);
|
|
64005
64735
|
}
|
|
@@ -64007,9 +64737,9 @@ Run ${pc64.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
64007
64737
|
|
|
64008
64738
|
// src/commands/sms/upgrade.ts
|
|
64009
64739
|
init_esm_shims();
|
|
64010
|
-
import * as
|
|
64740
|
+
import * as clack63 from "@clack/prompts";
|
|
64011
64741
|
import * as pulumi38 from "@pulumi/pulumi";
|
|
64012
|
-
import
|
|
64742
|
+
import pc66 from "picocolors";
|
|
64013
64743
|
init_events();
|
|
64014
64744
|
init_aws();
|
|
64015
64745
|
init_errors();
|
|
@@ -64024,7 +64754,7 @@ async function smsUpgrade(options) {
|
|
|
64024
64754
|
const startTime = Date.now();
|
|
64025
64755
|
let upgradeAction = "";
|
|
64026
64756
|
if (!isJsonMode()) {
|
|
64027
|
-
|
|
64757
|
+
clack63.intro(pc66.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
64028
64758
|
}
|
|
64029
64759
|
const progress = new DeploymentProgress();
|
|
64030
64760
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -64038,7 +64768,7 @@ async function smsUpgrade(options) {
|
|
|
64038
64768
|
"Validating AWS credentials",
|
|
64039
64769
|
async () => validateAWSCredentials()
|
|
64040
64770
|
);
|
|
64041
|
-
progress.info(`Connected to AWS account: ${
|
|
64771
|
+
progress.info(`Connected to AWS account: ${pc66.cyan(identity.accountId)}`);
|
|
64042
64772
|
const region = await resolveRegionForCommand({
|
|
64043
64773
|
accountId: identity.accountId,
|
|
64044
64774
|
optionRegion: options.region,
|
|
@@ -64047,35 +64777,35 @@ async function smsUpgrade(options) {
|
|
|
64047
64777
|
});
|
|
64048
64778
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
64049
64779
|
if (!metadata) {
|
|
64050
|
-
|
|
64051
|
-
`No Wraps connection found for account ${
|
|
64780
|
+
clack63.log.error(
|
|
64781
|
+
`No Wraps connection found for account ${pc66.cyan(identity.accountId)} in region ${pc66.cyan(region)}`
|
|
64052
64782
|
);
|
|
64053
|
-
|
|
64054
|
-
`Use ${
|
|
64783
|
+
clack63.log.info(
|
|
64784
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64055
64785
|
);
|
|
64056
64786
|
process.exit(1);
|
|
64057
64787
|
}
|
|
64058
64788
|
if (!metadata.services.sms) {
|
|
64059
|
-
|
|
64060
|
-
|
|
64061
|
-
`Use ${
|
|
64789
|
+
clack63.log.error("No SMS infrastructure found");
|
|
64790
|
+
clack63.log.info(
|
|
64791
|
+
`Use ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
64062
64792
|
);
|
|
64063
64793
|
process.exit(1);
|
|
64064
64794
|
}
|
|
64065
64795
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
64066
64796
|
console.log(`
|
|
64067
|
-
${
|
|
64797
|
+
${pc66.bold("Current Configuration:")}
|
|
64068
64798
|
`);
|
|
64069
64799
|
if (metadata.services.sms.preset) {
|
|
64070
|
-
console.log(` Preset: ${
|
|
64800
|
+
console.log(` Preset: ${pc66.cyan(metadata.services.sms.preset)}`);
|
|
64071
64801
|
} else {
|
|
64072
|
-
console.log(` Preset: ${
|
|
64802
|
+
console.log(` Preset: ${pc66.cyan("custom")}`);
|
|
64073
64803
|
}
|
|
64074
64804
|
const config2 = metadata.services.sms.config;
|
|
64075
64805
|
if (!config2) {
|
|
64076
|
-
|
|
64077
|
-
|
|
64078
|
-
`Use ${
|
|
64806
|
+
clack63.log.error("No SMS configuration found in metadata");
|
|
64807
|
+
clack63.log.info(
|
|
64808
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64079
64809
|
);
|
|
64080
64810
|
process.exit(1);
|
|
64081
64811
|
}
|
|
@@ -64087,45 +64817,45 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64087
64817
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
64088
64818
|
};
|
|
64089
64819
|
console.log(
|
|
64090
|
-
` Phone Type: ${
|
|
64820
|
+
` Phone Type: ${pc66.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
64091
64821
|
);
|
|
64092
64822
|
}
|
|
64093
64823
|
if (config2.tracking?.enabled) {
|
|
64094
|
-
console.log(` ${
|
|
64824
|
+
console.log(` ${pc66.green("\u2713")} Delivery Tracking`);
|
|
64095
64825
|
if (config2.tracking.linkTracking) {
|
|
64096
|
-
console.log(` ${
|
|
64826
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
64097
64827
|
}
|
|
64098
64828
|
}
|
|
64099
64829
|
if (config2.eventTracking?.enabled) {
|
|
64100
|
-
console.log(` ${
|
|
64830
|
+
console.log(` ${pc66.green("\u2713")} Event Tracking (SNS)`);
|
|
64101
64831
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
64102
64832
|
console.log(
|
|
64103
|
-
` ${
|
|
64833
|
+
` ${pc66.dim("\u2514\u2500")} Message History: ${pc66.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
64104
64834
|
);
|
|
64105
64835
|
}
|
|
64106
64836
|
}
|
|
64107
64837
|
if (config2.messageArchiving?.enabled) {
|
|
64108
64838
|
console.log(
|
|
64109
|
-
` ${
|
|
64839
|
+
` ${pc66.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
64110
64840
|
);
|
|
64111
64841
|
}
|
|
64112
64842
|
if (config2.optOutManagement) {
|
|
64113
|
-
console.log(` ${
|
|
64843
|
+
console.log(` ${pc66.green("\u2713")} Opt-out Management`);
|
|
64114
64844
|
}
|
|
64115
64845
|
if (config2.protectConfiguration?.enabled) {
|
|
64116
64846
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
64117
|
-
console.log(` ${
|
|
64118
|
-
console.log(` ${
|
|
64847
|
+
console.log(` ${pc66.green("\u2713")} Fraud Protection`);
|
|
64848
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Allowed countries: ${pc66.cyan(countries)}`);
|
|
64119
64849
|
if (config2.protectConfiguration.aitFiltering) {
|
|
64120
|
-
console.log(` ${
|
|
64850
|
+
console.log(` ${pc66.dim("\u2514\u2500")} AIT filtering: ${pc66.cyan("enabled")}`);
|
|
64121
64851
|
}
|
|
64122
64852
|
} else {
|
|
64123
|
-
console.log(` ${
|
|
64853
|
+
console.log(` ${pc66.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
64124
64854
|
}
|
|
64125
64855
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
64126
64856
|
console.log(
|
|
64127
64857
|
`
|
|
64128
|
-
Estimated Cost: ${
|
|
64858
|
+
Estimated Cost: ${pc66.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
64129
64859
|
);
|
|
64130
64860
|
console.log("");
|
|
64131
64861
|
const phoneTypeLabels = {
|
|
@@ -64134,7 +64864,7 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64134
64864
|
"10dlc": "10DLC",
|
|
64135
64865
|
"short-code": "Short code"
|
|
64136
64866
|
};
|
|
64137
|
-
upgradeAction = await
|
|
64867
|
+
upgradeAction = await clack63.select({
|
|
64138
64868
|
message: "What would you like to do?",
|
|
64139
64869
|
options: [
|
|
64140
64870
|
{
|
|
@@ -64174,8 +64904,8 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64174
64904
|
}
|
|
64175
64905
|
]
|
|
64176
64906
|
});
|
|
64177
|
-
if (
|
|
64178
|
-
|
|
64907
|
+
if (clack63.isCancel(upgradeAction)) {
|
|
64908
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64179
64909
|
process.exit(0);
|
|
64180
64910
|
}
|
|
64181
64911
|
let updatedConfig = { ...config2 };
|
|
@@ -64216,65 +64946,65 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64216
64946
|
hint: p3.hint
|
|
64217
64947
|
}));
|
|
64218
64948
|
if (availableTypes.length === 0) {
|
|
64219
|
-
|
|
64949
|
+
clack63.log.warn(
|
|
64220
64950
|
"Already on highest phone number tier. Contact AWS for dedicated short codes."
|
|
64221
64951
|
);
|
|
64222
64952
|
process.exit(0);
|
|
64223
64953
|
}
|
|
64224
|
-
const selectedType = await
|
|
64954
|
+
const selectedType = await clack63.select({
|
|
64225
64955
|
message: "Select new phone number type:",
|
|
64226
64956
|
options: availableTypes
|
|
64227
64957
|
});
|
|
64228
|
-
if (
|
|
64229
|
-
|
|
64958
|
+
if (clack63.isCancel(selectedType)) {
|
|
64959
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64230
64960
|
process.exit(0);
|
|
64231
64961
|
}
|
|
64232
64962
|
if (selectedType === "toll-free") {
|
|
64233
64963
|
console.log(
|
|
64234
64964
|
`
|
|
64235
|
-
${
|
|
64965
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("Toll-free Registration Required")}
|
|
64236
64966
|
`
|
|
64237
64967
|
);
|
|
64238
64968
|
console.log(
|
|
64239
|
-
|
|
64969
|
+
pc66.dim("Toll-free numbers require carrier registration before")
|
|
64240
64970
|
);
|
|
64241
64971
|
console.log(
|
|
64242
|
-
|
|
64972
|
+
pc66.dim("they can send messages at scale. After deployment:\n")
|
|
64243
64973
|
);
|
|
64244
64974
|
console.log(
|
|
64245
|
-
` 1. Run ${
|
|
64975
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start registration`
|
|
64246
64976
|
);
|
|
64247
64977
|
console.log(" 2. Submit your business use case information");
|
|
64248
64978
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
64249
64979
|
console.log(
|
|
64250
|
-
|
|
64980
|
+
pc66.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
64251
64981
|
);
|
|
64252
|
-
const confirmTollFree = await
|
|
64982
|
+
const confirmTollFree = await clack63.confirm({
|
|
64253
64983
|
message: "Continue with toll-free number request?",
|
|
64254
64984
|
initialValue: true
|
|
64255
64985
|
});
|
|
64256
|
-
if (
|
|
64257
|
-
|
|
64986
|
+
if (clack63.isCancel(confirmTollFree) || !confirmTollFree) {
|
|
64987
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64258
64988
|
process.exit(0);
|
|
64259
64989
|
}
|
|
64260
64990
|
}
|
|
64261
64991
|
if (selectedType === "10dlc") {
|
|
64262
64992
|
console.log(
|
|
64263
64993
|
`
|
|
64264
|
-
${
|
|
64994
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("10DLC Campaign Registration Required")}
|
|
64265
64995
|
`
|
|
64266
64996
|
);
|
|
64267
|
-
console.log(
|
|
64997
|
+
console.log(pc66.dim("10DLC requires brand and campaign registration:"));
|
|
64268
64998
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
64269
64999
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
64270
65000
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
64271
65001
|
console.log("");
|
|
64272
|
-
const confirm10DLC = await
|
|
65002
|
+
const confirm10DLC = await clack63.confirm({
|
|
64273
65003
|
message: "Continue with 10DLC number request?",
|
|
64274
65004
|
initialValue: true
|
|
64275
65005
|
});
|
|
64276
|
-
if (
|
|
64277
|
-
|
|
65006
|
+
if (clack63.isCancel(confirm10DLC) || !confirm10DLC) {
|
|
65007
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64278
65008
|
process.exit(0);
|
|
64279
65009
|
}
|
|
64280
65010
|
}
|
|
@@ -64299,15 +65029,15 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64299
65029
|
disabled: currentPresetIdx >= 0 && idx <= currentPresetIdx ? "Current or lower tier" : void 0
|
|
64300
65030
|
})).filter((p3) => !p3.disabled && p3.value !== "custom");
|
|
64301
65031
|
if (availablePresets.length === 0) {
|
|
64302
|
-
|
|
65032
|
+
clack63.log.warn("Already on highest preset (Enterprise)");
|
|
64303
65033
|
process.exit(0);
|
|
64304
65034
|
}
|
|
64305
|
-
const selectedPreset = await
|
|
65035
|
+
const selectedPreset = await clack63.select({
|
|
64306
65036
|
message: "Select new preset:",
|
|
64307
65037
|
options: availablePresets
|
|
64308
65038
|
});
|
|
64309
|
-
if (
|
|
64310
|
-
|
|
65039
|
+
if (clack63.isCancel(selectedPreset)) {
|
|
65040
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64311
65041
|
process.exit(0);
|
|
64312
65042
|
}
|
|
64313
65043
|
const presetConfig = getSMSPreset(selectedPreset);
|
|
@@ -64323,7 +65053,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64323
65053
|
}
|
|
64324
65054
|
case "event-tracking": {
|
|
64325
65055
|
if (config2.eventTracking?.enabled) {
|
|
64326
|
-
const eventAction = await
|
|
65056
|
+
const eventAction = await clack63.select({
|
|
64327
65057
|
message: "What would you like to do with event tracking?",
|
|
64328
65058
|
options: [
|
|
64329
65059
|
{
|
|
@@ -64338,17 +65068,17 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64338
65068
|
}
|
|
64339
65069
|
]
|
|
64340
65070
|
});
|
|
64341
|
-
if (
|
|
64342
|
-
|
|
65071
|
+
if (clack63.isCancel(eventAction)) {
|
|
65072
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64343
65073
|
process.exit(0);
|
|
64344
65074
|
}
|
|
64345
65075
|
if (eventAction === "disable") {
|
|
64346
|
-
const confirmDisable = await
|
|
65076
|
+
const confirmDisable = await clack63.confirm({
|
|
64347
65077
|
message: "Are you sure? Existing history will remain, but new events won't be tracked.",
|
|
64348
65078
|
initialValue: false
|
|
64349
65079
|
});
|
|
64350
|
-
if (
|
|
64351
|
-
|
|
65080
|
+
if (clack63.isCancel(confirmDisable) || !confirmDisable) {
|
|
65081
|
+
clack63.cancel("Event tracking not disabled.");
|
|
64352
65082
|
process.exit(0);
|
|
64353
65083
|
}
|
|
64354
65084
|
updatedConfig = {
|
|
@@ -64358,7 +65088,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64358
65088
|
}
|
|
64359
65089
|
};
|
|
64360
65090
|
} else {
|
|
64361
|
-
const retention = await
|
|
65091
|
+
const retention = await clack63.select({
|
|
64362
65092
|
message: "Message history retention period:",
|
|
64363
65093
|
options: [
|
|
64364
65094
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64385,8 +65115,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64385
65115
|
],
|
|
64386
65116
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
64387
65117
|
});
|
|
64388
|
-
if (
|
|
64389
|
-
|
|
65118
|
+
if (clack63.isCancel(retention)) {
|
|
65119
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64390
65120
|
process.exit(0);
|
|
64391
65121
|
}
|
|
64392
65122
|
updatedConfig = {
|
|
@@ -64398,19 +65128,19 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64398
65128
|
};
|
|
64399
65129
|
}
|
|
64400
65130
|
} else {
|
|
64401
|
-
const enableTracking = await
|
|
65131
|
+
const enableTracking = await clack63.confirm({
|
|
64402
65132
|
message: "Enable event tracking? (Track SMS events with history)",
|
|
64403
65133
|
initialValue: true
|
|
64404
65134
|
});
|
|
64405
|
-
if (
|
|
64406
|
-
|
|
65135
|
+
if (clack63.isCancel(enableTracking)) {
|
|
65136
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64407
65137
|
process.exit(0);
|
|
64408
65138
|
}
|
|
64409
65139
|
if (!enableTracking) {
|
|
64410
|
-
|
|
65140
|
+
clack63.log.info("Event tracking not enabled.");
|
|
64411
65141
|
process.exit(0);
|
|
64412
65142
|
}
|
|
64413
|
-
const retention = await
|
|
65143
|
+
const retention = await clack63.select({
|
|
64414
65144
|
message: "Message history retention period:",
|
|
64415
65145
|
options: [
|
|
64416
65146
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64433,8 +65163,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64433
65163
|
],
|
|
64434
65164
|
initialValue: "90days"
|
|
64435
65165
|
});
|
|
64436
|
-
if (
|
|
64437
|
-
|
|
65166
|
+
if (clack63.isCancel(retention)) {
|
|
65167
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64438
65168
|
process.exit(0);
|
|
64439
65169
|
}
|
|
64440
65170
|
updatedConfig = {
|
|
@@ -64453,12 +65183,12 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64453
65183
|
}
|
|
64454
65184
|
case "retention": {
|
|
64455
65185
|
if (!config2.eventTracking?.enabled) {
|
|
64456
|
-
|
|
65186
|
+
clack63.log.error(
|
|
64457
65187
|
"Event tracking is not enabled. Enable it first to change retention."
|
|
64458
65188
|
);
|
|
64459
65189
|
process.exit(1);
|
|
64460
65190
|
}
|
|
64461
|
-
const retention = await
|
|
65191
|
+
const retention = await clack63.select({
|
|
64462
65192
|
message: "Message history retention period (event data in DynamoDB):",
|
|
64463
65193
|
options: [
|
|
64464
65194
|
{ value: "7days", label: "7 days", hint: "Minimal storage cost" },
|
|
@@ -64477,8 +65207,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64477
65207
|
],
|
|
64478
65208
|
initialValue: config2.eventTracking.archiveRetention || "90days"
|
|
64479
65209
|
});
|
|
64480
|
-
if (
|
|
64481
|
-
|
|
65210
|
+
if (clack63.isCancel(retention)) {
|
|
65211
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64482
65212
|
process.exit(0);
|
|
64483
65213
|
}
|
|
64484
65214
|
updatedConfig = {
|
|
@@ -64496,21 +65226,21 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64496
65226
|
case "link-tracking": {
|
|
64497
65227
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
64498
65228
|
if (enableLinkTracking) {
|
|
64499
|
-
|
|
64500
|
-
|
|
65229
|
+
clack63.log.info(
|
|
65230
|
+
pc66.dim(
|
|
64501
65231
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
64502
65232
|
)
|
|
64503
65233
|
);
|
|
64504
|
-
|
|
64505
|
-
|
|
65234
|
+
clack63.log.info(
|
|
65235
|
+
pc66.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
64506
65236
|
);
|
|
64507
65237
|
}
|
|
64508
|
-
const confirmed = await
|
|
65238
|
+
const confirmed = await clack63.confirm({
|
|
64509
65239
|
message: enableLinkTracking ? "Enable link click tracking?" : "Disable link click tracking?",
|
|
64510
65240
|
initialValue: enableLinkTracking
|
|
64511
65241
|
});
|
|
64512
|
-
if (
|
|
64513
|
-
|
|
65242
|
+
if (clack63.isCancel(confirmed) || !confirmed) {
|
|
65243
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64514
65244
|
process.exit(0);
|
|
64515
65245
|
}
|
|
64516
65246
|
updatedConfig = {
|
|
@@ -64527,7 +65257,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64527
65257
|
}
|
|
64528
65258
|
case "archiving": {
|
|
64529
65259
|
if (config2.messageArchiving?.enabled) {
|
|
64530
|
-
const archivingAction = await
|
|
65260
|
+
const archivingAction = await clack63.select({
|
|
64531
65261
|
message: "What would you like to do with message archiving?",
|
|
64532
65262
|
options: [
|
|
64533
65263
|
{
|
|
@@ -64542,17 +65272,17 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64542
65272
|
}
|
|
64543
65273
|
]
|
|
64544
65274
|
});
|
|
64545
|
-
if (
|
|
64546
|
-
|
|
65275
|
+
if (clack63.isCancel(archivingAction)) {
|
|
65276
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64547
65277
|
process.exit(0);
|
|
64548
65278
|
}
|
|
64549
65279
|
if (archivingAction === "disable") {
|
|
64550
|
-
const confirmDisable = await
|
|
65280
|
+
const confirmDisable = await clack63.confirm({
|
|
64551
65281
|
message: "Are you sure? Existing archived messages will remain, but new messages won't be archived.",
|
|
64552
65282
|
initialValue: false
|
|
64553
65283
|
});
|
|
64554
|
-
if (
|
|
64555
|
-
|
|
65284
|
+
if (clack63.isCancel(confirmDisable) || !confirmDisable) {
|
|
65285
|
+
clack63.cancel("Archiving not disabled.");
|
|
64556
65286
|
process.exit(0);
|
|
64557
65287
|
}
|
|
64558
65288
|
updatedConfig = {
|
|
@@ -64563,7 +65293,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64563
65293
|
}
|
|
64564
65294
|
};
|
|
64565
65295
|
} else {
|
|
64566
|
-
const retention = await
|
|
65296
|
+
const retention = await clack63.select({
|
|
64567
65297
|
message: "Message archive retention period:",
|
|
64568
65298
|
options: [
|
|
64569
65299
|
{
|
|
@@ -64594,8 +65324,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64594
65324
|
],
|
|
64595
65325
|
initialValue: config2.messageArchiving.retention
|
|
64596
65326
|
});
|
|
64597
|
-
if (
|
|
64598
|
-
|
|
65327
|
+
if (clack63.isCancel(retention)) {
|
|
65328
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64599
65329
|
process.exit(0);
|
|
64600
65330
|
}
|
|
64601
65331
|
updatedConfig = {
|
|
@@ -64607,19 +65337,19 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64607
65337
|
};
|
|
64608
65338
|
}
|
|
64609
65339
|
} else {
|
|
64610
|
-
const enableArchiving = await
|
|
65340
|
+
const enableArchiving = await clack63.confirm({
|
|
64611
65341
|
message: "Enable message archiving? (Store full message content for viewing)",
|
|
64612
65342
|
initialValue: true
|
|
64613
65343
|
});
|
|
64614
|
-
if (
|
|
64615
|
-
|
|
65344
|
+
if (clack63.isCancel(enableArchiving)) {
|
|
65345
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64616
65346
|
process.exit(0);
|
|
64617
65347
|
}
|
|
64618
65348
|
if (!enableArchiving) {
|
|
64619
|
-
|
|
65349
|
+
clack63.log.info("Message archiving not enabled.");
|
|
64620
65350
|
process.exit(0);
|
|
64621
65351
|
}
|
|
64622
|
-
const retention = await
|
|
65352
|
+
const retention = await clack63.select({
|
|
64623
65353
|
message: "Message archive retention period:",
|
|
64624
65354
|
options: [
|
|
64625
65355
|
{ value: "7days", label: "7 days", hint: "~$1-2/mo for 10k msgs" },
|
|
@@ -64646,8 +65376,8 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64646
65376
|
],
|
|
64647
65377
|
initialValue: "90days"
|
|
64648
65378
|
});
|
|
64649
|
-
if (
|
|
64650
|
-
|
|
65379
|
+
if (clack63.isCancel(retention)) {
|
|
65380
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64651
65381
|
process.exit(0);
|
|
64652
65382
|
}
|
|
64653
65383
|
updatedConfig = {
|
|
@@ -64679,7 +65409,7 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64679
65409
|
const currentAllowed = config2.protectConfiguration?.allowedCountries || [
|
|
64680
65410
|
"US"
|
|
64681
65411
|
];
|
|
64682
|
-
const selectedCountries = await
|
|
65412
|
+
const selectedCountries = await clack63.multiselect({
|
|
64683
65413
|
message: "Select countries to allow SMS delivery (all others blocked):",
|
|
64684
65414
|
options: commonCountries.map((c6) => ({
|
|
64685
65415
|
value: c6.code,
|
|
@@ -64688,16 +65418,16 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64688
65418
|
initialValues: currentAllowed,
|
|
64689
65419
|
required: true
|
|
64690
65420
|
});
|
|
64691
|
-
if (
|
|
64692
|
-
|
|
65421
|
+
if (clack63.isCancel(selectedCountries)) {
|
|
65422
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64693
65423
|
process.exit(0);
|
|
64694
65424
|
}
|
|
64695
|
-
const enableAIT = await
|
|
65425
|
+
const enableAIT = await clack63.confirm({
|
|
64696
65426
|
message: "Enable AIT (Artificially Inflated Traffic) filtering? (adds per-message cost)",
|
|
64697
65427
|
initialValue: config2.protectConfiguration?.aitFiltering ?? false
|
|
64698
65428
|
});
|
|
64699
|
-
if (
|
|
64700
|
-
|
|
65429
|
+
if (clack63.isCancel(enableAIT)) {
|
|
65430
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64701
65431
|
process.exit(0);
|
|
64702
65432
|
}
|
|
64703
65433
|
updatedConfig = {
|
|
@@ -64715,28 +65445,28 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
64715
65445
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
64716
65446
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
64717
65447
|
console.log(`
|
|
64718
|
-
${
|
|
65448
|
+
${pc66.bold("Cost Impact:")}`);
|
|
64719
65449
|
console.log(
|
|
64720
|
-
` Current: ${
|
|
65450
|
+
` Current: ${pc66.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
64721
65451
|
);
|
|
64722
65452
|
console.log(
|
|
64723
|
-
` New: ${
|
|
65453
|
+
` New: ${pc66.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
64724
65454
|
);
|
|
64725
65455
|
if (costDiff > 0) {
|
|
64726
|
-
console.log(` Change: ${
|
|
65456
|
+
console.log(` Change: ${pc66.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
64727
65457
|
} else if (costDiff < 0) {
|
|
64728
65458
|
console.log(
|
|
64729
|
-
` Change: ${
|
|
65459
|
+
` Change: ${pc66.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
64730
65460
|
);
|
|
64731
65461
|
}
|
|
64732
65462
|
console.log("");
|
|
64733
65463
|
if (!(options.yes || options.preview)) {
|
|
64734
|
-
const confirmed = await
|
|
65464
|
+
const confirmed = await clack63.confirm({
|
|
64735
65465
|
message: "Proceed with upgrade?",
|
|
64736
65466
|
initialValue: true
|
|
64737
65467
|
});
|
|
64738
|
-
if (
|
|
64739
|
-
|
|
65468
|
+
if (clack63.isCancel(confirmed) || !confirmed) {
|
|
65469
|
+
clack63.cancel("Upgrade cancelled.");
|
|
64740
65470
|
process.exit(0);
|
|
64741
65471
|
}
|
|
64742
65472
|
}
|
|
@@ -64805,8 +65535,8 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
64805
65535
|
resourceChanges: previewResult.resourceChanges,
|
|
64806
65536
|
commandName: "wraps sms upgrade"
|
|
64807
65537
|
});
|
|
64808
|
-
|
|
64809
|
-
|
|
65538
|
+
clack63.outro(
|
|
65539
|
+
pc66.green("Preview complete. Run without --preview to upgrade.")
|
|
64810
65540
|
);
|
|
64811
65541
|
trackServiceUpgrade("sms", {
|
|
64812
65542
|
region,
|
|
@@ -64911,43 +65641,43 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
64911
65641
|
}
|
|
64912
65642
|
progress.info("Connection metadata updated");
|
|
64913
65643
|
console.log("\n");
|
|
64914
|
-
|
|
65644
|
+
clack63.log.success(pc66.green(pc66.bold("SMS infrastructure upgraded!")));
|
|
64915
65645
|
console.log("\n");
|
|
64916
|
-
|
|
65646
|
+
clack63.note(
|
|
64917
65647
|
[
|
|
64918
|
-
`${
|
|
64919
|
-
`${
|
|
64920
|
-
`${
|
|
64921
|
-
`${
|
|
64922
|
-
outputs.tableName ? `${
|
|
65648
|
+
`${pc66.bold("Phone Number:")} ${pc66.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
65649
|
+
`${pc66.bold("Phone Type:")} ${pc66.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
65650
|
+
`${pc66.bold("Config Set:")} ${pc66.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
65651
|
+
`${pc66.bold("Region:")} ${pc66.cyan(outputs.region)}`,
|
|
65652
|
+
outputs.tableName ? `${pc66.bold("History Table:")} ${pc66.cyan(outputs.tableName)}` : "",
|
|
64923
65653
|
"",
|
|
64924
|
-
|
|
64925
|
-
|
|
65654
|
+
pc66.dim("IAM Role:"),
|
|
65655
|
+
pc66.dim(` ${outputs.roleArn}`)
|
|
64926
65656
|
].filter(Boolean).join("\n"),
|
|
64927
65657
|
"SMS Infrastructure"
|
|
64928
65658
|
);
|
|
64929
65659
|
console.log(`
|
|
64930
|
-
${
|
|
65660
|
+
${pc66.green("\u2713")} ${pc66.bold("Upgrade complete!")}
|
|
64931
65661
|
`);
|
|
64932
65662
|
if (upgradeAction === "phone-number") {
|
|
64933
65663
|
console.log(
|
|
64934
|
-
`Upgraded to ${
|
|
65664
|
+
`Upgraded to ${pc66.cyan(updatedConfig.phoneNumberType)} number (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64935
65665
|
`
|
|
64936
65666
|
);
|
|
64937
65667
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
64938
|
-
console.log(`${
|
|
65668
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
64939
65669
|
console.log(
|
|
64940
|
-
` 1. Run ${
|
|
65670
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start toll-free registration`
|
|
64941
65671
|
);
|
|
64942
65672
|
console.log(" 2. Submit your business information and use case");
|
|
64943
65673
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
64944
65674
|
console.log("");
|
|
64945
65675
|
console.log(
|
|
64946
|
-
|
|
65676
|
+
pc66.dim("Until verified, your number can only send limited messages.")
|
|
64947
65677
|
);
|
|
64948
65678
|
console.log("");
|
|
64949
65679
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
64950
|
-
console.log(`${
|
|
65680
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
64951
65681
|
console.log(" 1. Register your brand in the AWS Console");
|
|
64952
65682
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
64953
65683
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -64955,16 +65685,16 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
64955
65685
|
}
|
|
64956
65686
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
64957
65687
|
console.log(
|
|
64958
|
-
`Upgraded to ${
|
|
65688
|
+
`Upgraded to ${pc66.cyan(newPreset)} preset (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64959
65689
|
`
|
|
64960
65690
|
);
|
|
64961
65691
|
} else {
|
|
64962
65692
|
console.log(
|
|
64963
|
-
`Updated configuration (${
|
|
65693
|
+
`Updated configuration (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
64964
65694
|
`
|
|
64965
65695
|
);
|
|
64966
65696
|
}
|
|
64967
|
-
console.log(
|
|
65697
|
+
console.log(pc66.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
64968
65698
|
const enabledFeatures = [];
|
|
64969
65699
|
if (updatedConfig.tracking?.enabled) {
|
|
64970
65700
|
enabledFeatures.push("tracking");
|
|
@@ -64988,7 +65718,7 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
64988
65718
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
64989
65719
|
duration_ms: Date.now() - startTime
|
|
64990
65720
|
});
|
|
64991
|
-
|
|
65721
|
+
clack63.outro(pc66.green("Upgrade complete!"));
|
|
64992
65722
|
}
|
|
64993
65723
|
|
|
64994
65724
|
// src/commands/sms/verify-number.ts
|
|
@@ -65007,13 +65737,13 @@ import {
|
|
|
65007
65737
|
SendDestinationNumberVerificationCodeCommand,
|
|
65008
65738
|
VerifyDestinationNumberCommand
|
|
65009
65739
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
65010
|
-
import * as
|
|
65011
|
-
import
|
|
65740
|
+
import * as clack64 from "@clack/prompts";
|
|
65741
|
+
import pc67 from "picocolors";
|
|
65012
65742
|
async function smsVerifyNumber(options) {
|
|
65013
65743
|
const startTime = Date.now();
|
|
65014
65744
|
const progress = new DeploymentProgress();
|
|
65015
65745
|
if (!isJsonMode()) {
|
|
65016
|
-
|
|
65746
|
+
clack64.intro(pc67.bold("Wraps SMS - Verify Destination Number"));
|
|
65017
65747
|
}
|
|
65018
65748
|
const identity = await progress.execute(
|
|
65019
65749
|
"Validating AWS credentials",
|
|
@@ -65023,10 +65753,10 @@ async function smsVerifyNumber(options) {
|
|
|
65023
65753
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
65024
65754
|
if (!metadata?.services?.sms) {
|
|
65025
65755
|
progress.stop();
|
|
65026
|
-
|
|
65756
|
+
clack64.log.error("No SMS infrastructure found");
|
|
65027
65757
|
console.log(
|
|
65028
65758
|
`
|
|
65029
|
-
Run ${
|
|
65759
|
+
Run ${pc67.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
65030
65760
|
`
|
|
65031
65761
|
);
|
|
65032
65762
|
process.exit(1);
|
|
@@ -65040,19 +65770,19 @@ Run ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
65040
65770
|
);
|
|
65041
65771
|
progress.stop();
|
|
65042
65772
|
if (!response.VerifiedDestinationNumbers || response.VerifiedDestinationNumbers.length === 0) {
|
|
65043
|
-
|
|
65773
|
+
clack64.log.info("No verified destination numbers found");
|
|
65044
65774
|
console.log(
|
|
65045
65775
|
`
|
|
65046
|
-
Run ${
|
|
65776
|
+
Run ${pc67.cyan("wraps sms verify-number")} to verify a number.
|
|
65047
65777
|
`
|
|
65048
65778
|
);
|
|
65049
65779
|
} else {
|
|
65050
65780
|
console.log("\n");
|
|
65051
|
-
|
|
65781
|
+
clack64.log.info(pc67.bold("Verified Destination Numbers:"));
|
|
65052
65782
|
console.log("");
|
|
65053
65783
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
65054
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
65055
|
-
console.log(` ${
|
|
65784
|
+
const status2 = num.Status === "VERIFIED" ? pc67.green("\u2713 Verified") : pc67.yellow("\u29D6 Pending");
|
|
65785
|
+
console.log(` ${pc67.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
65056
65786
|
}
|
|
65057
65787
|
console.log("");
|
|
65058
65788
|
}
|
|
@@ -65070,7 +65800,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65070
65800
|
});
|
|
65071
65801
|
return;
|
|
65072
65802
|
}
|
|
65073
|
-
|
|
65803
|
+
clack64.outro(pc67.green("Done!"));
|
|
65074
65804
|
return;
|
|
65075
65805
|
} catch (error) {
|
|
65076
65806
|
progress.stop();
|
|
@@ -65078,7 +65808,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65078
65808
|
trackError("SMS_LIST_VERIFIED_FAILED", "sms:verify-number:list", {
|
|
65079
65809
|
error: errorMessage
|
|
65080
65810
|
});
|
|
65081
|
-
|
|
65811
|
+
clack64.log.error(`Failed to list verified numbers: ${errorMessage}`);
|
|
65082
65812
|
process.exit(1);
|
|
65083
65813
|
}
|
|
65084
65814
|
}
|
|
@@ -65086,10 +65816,10 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65086
65816
|
const phoneNumber2 = options.phoneNumber;
|
|
65087
65817
|
if (!phoneNumber2) {
|
|
65088
65818
|
progress.stop();
|
|
65089
|
-
|
|
65819
|
+
clack64.log.error("Phone number is required for deletion");
|
|
65090
65820
|
console.log(
|
|
65091
65821
|
`
|
|
65092
|
-
Usage: ${
|
|
65822
|
+
Usage: ${pc67.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
65093
65823
|
`
|
|
65094
65824
|
);
|
|
65095
65825
|
process.exit(1);
|
|
@@ -65103,7 +65833,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65103
65833
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65104
65834
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65105
65835
|
progress.stop();
|
|
65106
|
-
|
|
65836
|
+
clack64.log.error(`Number ${phoneNumber2} is not in verified list`);
|
|
65107
65837
|
process.exit(1);
|
|
65108
65838
|
}
|
|
65109
65839
|
await progress.execute(`Removing ${phoneNumber2}`, async () => {
|
|
@@ -65114,7 +65844,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65114
65844
|
);
|
|
65115
65845
|
});
|
|
65116
65846
|
progress.stop();
|
|
65117
|
-
|
|
65847
|
+
clack64.log.success(`Removed ${pc67.cyan(phoneNumber2)} from verified list`);
|
|
65118
65848
|
trackCommand("sms:verify-number:delete", {
|
|
65119
65849
|
success: true,
|
|
65120
65850
|
duration_ms: Date.now() - startTime
|
|
@@ -65126,7 +65856,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65126
65856
|
});
|
|
65127
65857
|
return;
|
|
65128
65858
|
}
|
|
65129
|
-
|
|
65859
|
+
clack64.outro(pc67.green("Done!"));
|
|
65130
65860
|
return;
|
|
65131
65861
|
} catch (error) {
|
|
65132
65862
|
progress.stop();
|
|
@@ -65134,7 +65864,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65134
65864
|
trackError("SMS_DELETE_VERIFIED_FAILED", "sms:verify-number:delete", {
|
|
65135
65865
|
error: errorMessage
|
|
65136
65866
|
});
|
|
65137
|
-
|
|
65867
|
+
clack64.log.error(`Failed to delete verified number: ${errorMessage}`);
|
|
65138
65868
|
process.exit(1);
|
|
65139
65869
|
}
|
|
65140
65870
|
}
|
|
@@ -65147,7 +65877,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65147
65877
|
);
|
|
65148
65878
|
}
|
|
65149
65879
|
if (!phoneNumber) {
|
|
65150
|
-
const result = await
|
|
65880
|
+
const result = await clack64.text({
|
|
65151
65881
|
message: "Enter phone number to verify (E.164 format):",
|
|
65152
65882
|
placeholder: "+14155551234",
|
|
65153
65883
|
validate: (value) => {
|
|
@@ -65160,14 +65890,14 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65160
65890
|
return;
|
|
65161
65891
|
}
|
|
65162
65892
|
});
|
|
65163
|
-
if (
|
|
65164
|
-
|
|
65893
|
+
if (clack64.isCancel(result)) {
|
|
65894
|
+
clack64.cancel("Operation cancelled.");
|
|
65165
65895
|
process.exit(0);
|
|
65166
65896
|
}
|
|
65167
65897
|
phoneNumber = result;
|
|
65168
65898
|
} else if (!isValidPhoneNumber(phoneNumber)) {
|
|
65169
65899
|
progress.stop();
|
|
65170
|
-
|
|
65900
|
+
clack64.log.error(
|
|
65171
65901
|
`Invalid phone number format: ${phoneNumber}. Use E.164 format (e.g., +14155551234)`
|
|
65172
65902
|
);
|
|
65173
65903
|
process.exit(1);
|
|
@@ -65182,7 +65912,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65182
65912
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65183
65913
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65184
65914
|
progress.stop();
|
|
65185
|
-
|
|
65915
|
+
clack64.log.error(
|
|
65186
65916
|
`Number ${phoneNumber} not found. Run without --code first.`
|
|
65187
65917
|
);
|
|
65188
65918
|
process.exit(1);
|
|
@@ -65197,12 +65927,12 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65197
65927
|
});
|
|
65198
65928
|
progress.stop();
|
|
65199
65929
|
console.log("\n");
|
|
65200
|
-
|
|
65201
|
-
|
|
65930
|
+
clack64.log.success(
|
|
65931
|
+
pc67.green(`Phone number ${pc67.cyan(phoneNumber)} verified!`)
|
|
65202
65932
|
);
|
|
65203
65933
|
console.log("");
|
|
65204
65934
|
console.log(
|
|
65205
|
-
`You can now send test messages to this number with ${
|
|
65935
|
+
`You can now send test messages to this number with ${pc67.cyan("wraps sms test")}`
|
|
65206
65936
|
);
|
|
65207
65937
|
trackCommand("sms:verify-number:confirm", {
|
|
65208
65938
|
success: true,
|
|
@@ -65215,23 +65945,23 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65215
65945
|
});
|
|
65216
65946
|
return;
|
|
65217
65947
|
}
|
|
65218
|
-
|
|
65948
|
+
clack64.outro(pc67.green("Verification complete!"));
|
|
65219
65949
|
return;
|
|
65220
65950
|
} catch (error) {
|
|
65221
65951
|
progress.stop();
|
|
65222
65952
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65223
65953
|
if (errorMessage.includes("Invalid verification code")) {
|
|
65224
|
-
|
|
65954
|
+
clack64.log.error("Invalid verification code. Please try again.");
|
|
65225
65955
|
console.log(
|
|
65226
65956
|
`
|
|
65227
|
-
Run ${
|
|
65957
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
65228
65958
|
`
|
|
65229
65959
|
);
|
|
65230
65960
|
} else {
|
|
65231
65961
|
trackError("SMS_VERIFY_CODE_FAILED", "sms:verify-number:confirm", {
|
|
65232
65962
|
error: errorMessage
|
|
65233
65963
|
});
|
|
65234
|
-
|
|
65964
|
+
clack64.log.error(`Verification failed: ${errorMessage}`);
|
|
65235
65965
|
}
|
|
65236
65966
|
process.exit(1);
|
|
65237
65967
|
}
|
|
@@ -65246,7 +65976,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65246
65976
|
const verifiedNumber = listResponse.VerifiedDestinationNumbers?.[0];
|
|
65247
65977
|
if (!verifiedNumber?.VerifiedDestinationNumberId) {
|
|
65248
65978
|
progress.stop();
|
|
65249
|
-
|
|
65979
|
+
clack64.log.error(
|
|
65250
65980
|
`Number ${phoneNumber} not found. Run without --resend first.`
|
|
65251
65981
|
);
|
|
65252
65982
|
process.exit(1);
|
|
@@ -65260,11 +65990,11 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65260
65990
|
);
|
|
65261
65991
|
});
|
|
65262
65992
|
progress.stop();
|
|
65263
|
-
|
|
65993
|
+
clack64.log.success(`Verification code resent to ${pc67.cyan(phoneNumber)}`);
|
|
65264
65994
|
console.log("");
|
|
65265
65995
|
console.log(
|
|
65266
65996
|
`Once you receive the code, run:
|
|
65267
|
-
${
|
|
65997
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
65268
65998
|
);
|
|
65269
65999
|
trackCommand("sms:verify-number:resend", {
|
|
65270
66000
|
success: true,
|
|
@@ -65277,7 +66007,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65277
66007
|
});
|
|
65278
66008
|
return;
|
|
65279
66009
|
}
|
|
65280
|
-
|
|
66010
|
+
clack64.outro(pc67.green("Code sent!"));
|
|
65281
66011
|
return;
|
|
65282
66012
|
} catch (error) {
|
|
65283
66013
|
progress.stop();
|
|
@@ -65285,7 +66015,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65285
66015
|
trackError("SMS_RESEND_CODE_FAILED", "sms:verify-number:resend", {
|
|
65286
66016
|
error: errorMessage
|
|
65287
66017
|
});
|
|
65288
|
-
|
|
66018
|
+
clack64.log.error(`Failed to resend code: ${errorMessage}`);
|
|
65289
66019
|
process.exit(1);
|
|
65290
66020
|
}
|
|
65291
66021
|
}
|
|
@@ -65305,10 +66035,10 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65305
66035
|
});
|
|
65306
66036
|
return;
|
|
65307
66037
|
}
|
|
65308
|
-
|
|
65309
|
-
`Number ${
|
|
66038
|
+
clack64.log.info(
|
|
66039
|
+
`Number ${pc67.cyan(phoneNumber)} is already verified and ready to use!`
|
|
65310
66040
|
);
|
|
65311
|
-
|
|
66041
|
+
clack64.outro(pc67.green("Done!"));
|
|
65312
66042
|
return;
|
|
65313
66043
|
}
|
|
65314
66044
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -65332,15 +66062,15 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65332
66062
|
});
|
|
65333
66063
|
return;
|
|
65334
66064
|
}
|
|
65335
|
-
|
|
65336
|
-
`Verification already in progress. New code sent to ${
|
|
66065
|
+
clack64.log.info(
|
|
66066
|
+
`Verification already in progress. New code sent to ${pc67.cyan(phoneNumber)}`
|
|
65337
66067
|
);
|
|
65338
66068
|
console.log("");
|
|
65339
66069
|
console.log(
|
|
65340
66070
|
`Once you receive the code, run:
|
|
65341
|
-
${
|
|
66071
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
65342
66072
|
);
|
|
65343
|
-
|
|
66073
|
+
clack64.outro(pc67.green("Code sent!"));
|
|
65344
66074
|
return;
|
|
65345
66075
|
}
|
|
65346
66076
|
const createResponse = await progress.execute(
|
|
@@ -65361,18 +66091,18 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65361
66091
|
});
|
|
65362
66092
|
progress.stop();
|
|
65363
66093
|
console.log("\n");
|
|
65364
|
-
|
|
65365
|
-
`Verification code sent to ${
|
|
66094
|
+
clack64.log.success(
|
|
66095
|
+
`Verification code sent to ${pc67.cyan(phoneNumber)} via SMS`
|
|
65366
66096
|
);
|
|
65367
66097
|
console.log("");
|
|
65368
|
-
|
|
66098
|
+
clack64.note(
|
|
65369
66099
|
[
|
|
65370
66100
|
"1. Check your phone for the verification code",
|
|
65371
66101
|
"",
|
|
65372
66102
|
"2. Complete verification with:",
|
|
65373
|
-
` ${
|
|
66103
|
+
` ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
65374
66104
|
"",
|
|
65375
|
-
|
|
66105
|
+
pc67.dim("The code expires in 24 hours")
|
|
65376
66106
|
].join("\n"),
|
|
65377
66107
|
"Next Steps"
|
|
65378
66108
|
);
|
|
@@ -65388,22 +66118,22 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65388
66118
|
});
|
|
65389
66119
|
return;
|
|
65390
66120
|
}
|
|
65391
|
-
|
|
66121
|
+
clack64.outro(pc67.green("Verification started!"));
|
|
65392
66122
|
} catch (error) {
|
|
65393
66123
|
progress.stop();
|
|
65394
66124
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65395
66125
|
if (errorMessage.includes("already exists")) {
|
|
65396
|
-
|
|
66126
|
+
clack64.log.error("This number is already being verified");
|
|
65397
66127
|
console.log(
|
|
65398
66128
|
`
|
|
65399
|
-
Run ${
|
|
66129
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
65400
66130
|
`
|
|
65401
66131
|
);
|
|
65402
66132
|
} else {
|
|
65403
66133
|
trackError("SMS_CREATE_VERIFIED_FAILED", "sms:verify-number:start", {
|
|
65404
66134
|
error: errorMessage
|
|
65405
66135
|
});
|
|
65406
|
-
|
|
66136
|
+
clack64.log.error(`Failed to start verification: ${errorMessage}`);
|
|
65407
66137
|
}
|
|
65408
66138
|
process.exit(1);
|
|
65409
66139
|
}
|
|
@@ -65412,91 +66142,91 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
65412
66142
|
// src/commands/support.ts
|
|
65413
66143
|
init_esm_shims();
|
|
65414
66144
|
init_events();
|
|
65415
|
-
import * as
|
|
65416
|
-
import
|
|
66145
|
+
import * as clack65 from "@clack/prompts";
|
|
66146
|
+
import pc68 from "picocolors";
|
|
65417
66147
|
async function support() {
|
|
65418
66148
|
trackCommand("support", { success: true });
|
|
65419
|
-
|
|
66149
|
+
clack65.intro(pc68.bold("Get Help with Wraps"));
|
|
65420
66150
|
console.log();
|
|
65421
|
-
console.log(` ${
|
|
66151
|
+
console.log(` ${pc68.bold("Email:")} ${pc68.cyan("hey@wraps.dev")}`);
|
|
65422
66152
|
console.log(
|
|
65423
|
-
` ${
|
|
66153
|
+
` ${pc68.bold("GitHub:")} ${pc68.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
65424
66154
|
);
|
|
65425
|
-
console.log(` ${
|
|
66155
|
+
console.log(` ${pc68.bold("Docs:")} ${pc68.cyan("https://wraps.dev/docs")}`);
|
|
65426
66156
|
console.log(
|
|
65427
|
-
` ${
|
|
66157
|
+
` ${pc68.bold("AI docs:")} ${pc68.cyan("https://wraps.dev/llms-full.txt")} ${pc68.dim("(complete docs, one file)")}`
|
|
65428
66158
|
);
|
|
65429
66159
|
console.log();
|
|
65430
|
-
console.log(
|
|
66160
|
+
console.log(pc68.dim(" Response time: Usually within 24 hours"));
|
|
65431
66161
|
console.log();
|
|
65432
66162
|
}
|
|
65433
66163
|
|
|
65434
66164
|
// src/commands/telemetry.ts
|
|
65435
66165
|
init_esm_shims();
|
|
65436
66166
|
init_client();
|
|
65437
|
-
import * as
|
|
65438
|
-
import
|
|
66167
|
+
import * as clack66 from "@clack/prompts";
|
|
66168
|
+
import pc69 from "picocolors";
|
|
65439
66169
|
async function telemetryEnable() {
|
|
65440
66170
|
const client2 = getTelemetryClient();
|
|
65441
66171
|
const override = client2.enable();
|
|
65442
66172
|
if (override) {
|
|
65443
|
-
|
|
66173
|
+
clack66.log.warn(
|
|
65444
66174
|
"Telemetry enabled in config, but overridden by environment"
|
|
65445
66175
|
);
|
|
65446
|
-
console.log(` Reason: ${
|
|
65447
|
-
console.log(` Config: ${
|
|
66176
|
+
console.log(` Reason: ${pc69.yellow(override)}`);
|
|
66177
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65448
66178
|
console.log();
|
|
65449
66179
|
} else {
|
|
65450
|
-
|
|
65451
|
-
console.log(` Config: ${
|
|
66180
|
+
clack66.log.success(pc69.green("Telemetry enabled"));
|
|
66181
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65452
66182
|
console.log(`
|
|
65453
|
-
${
|
|
66183
|
+
${pc69.dim("Thank you for helping improve Wraps!")}
|
|
65454
66184
|
`);
|
|
65455
66185
|
}
|
|
65456
66186
|
}
|
|
65457
66187
|
async function telemetryDisable() {
|
|
65458
66188
|
const client2 = getTelemetryClient();
|
|
65459
66189
|
client2.disable();
|
|
65460
|
-
|
|
65461
|
-
console.log(` Config: ${
|
|
66190
|
+
clack66.log.success(pc69.green("Telemetry disabled"));
|
|
66191
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
65462
66192
|
console.log(
|
|
65463
66193
|
`
|
|
65464
|
-
${
|
|
66194
|
+
${pc69.dim("You can re-enable with:")} wraps telemetry enable
|
|
65465
66195
|
`
|
|
65466
66196
|
);
|
|
65467
66197
|
}
|
|
65468
66198
|
async function telemetryStatus() {
|
|
65469
66199
|
const client2 = getTelemetryClient();
|
|
65470
|
-
|
|
66200
|
+
clack66.intro(pc69.bold("Telemetry Status"));
|
|
65471
66201
|
const override = client2.getEnvOverride();
|
|
65472
|
-
const status2 = client2.isEnabled() ?
|
|
66202
|
+
const status2 = client2.isEnabled() ? pc69.green("Enabled") : pc69.red("Disabled");
|
|
65473
66203
|
console.log();
|
|
65474
|
-
console.log(` ${
|
|
66204
|
+
console.log(` ${pc69.bold("Status:")} ${status2}`);
|
|
65475
66205
|
if (!client2.isEnabled() && override) {
|
|
65476
|
-
console.log(` ${
|
|
66206
|
+
console.log(` ${pc69.bold("Reason:")} ${pc69.yellow(override)}`);
|
|
65477
66207
|
}
|
|
65478
|
-
console.log(` ${
|
|
66208
|
+
console.log(` ${pc69.bold("Config file:")} ${pc69.dim(client2.getConfigPath())}`);
|
|
65479
66209
|
if (client2.isEnabled()) {
|
|
65480
66210
|
console.log();
|
|
65481
|
-
console.log(
|
|
65482
|
-
console.log(` ${
|
|
66211
|
+
console.log(pc69.bold(" How to opt-out:"));
|
|
66212
|
+
console.log(` ${pc69.cyan("wraps telemetry disable")}`);
|
|
65483
66213
|
console.log(
|
|
65484
|
-
` ${
|
|
66214
|
+
` ${pc69.dim("Or set:")} ${pc69.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
65485
66215
|
);
|
|
65486
|
-
console.log(` ${
|
|
66216
|
+
console.log(` ${pc69.dim("Or set:")} ${pc69.cyan("DO_NOT_TRACK=1")}`);
|
|
65487
66217
|
} else {
|
|
65488
66218
|
console.log();
|
|
65489
|
-
console.log(
|
|
65490
|
-
console.log(` ${
|
|
66219
|
+
console.log(pc69.bold(" How to opt-in:"));
|
|
66220
|
+
console.log(` ${pc69.cyan("wraps telemetry enable")}`);
|
|
65491
66221
|
}
|
|
65492
66222
|
console.log();
|
|
65493
|
-
console.log(
|
|
66223
|
+
console.log(pc69.bold(" Debug mode:"));
|
|
65494
66224
|
console.log(
|
|
65495
|
-
` ${
|
|
66225
|
+
` ${pc69.dim("See what would be sent:")} ${pc69.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
65496
66226
|
);
|
|
65497
66227
|
console.log();
|
|
65498
66228
|
console.log(
|
|
65499
|
-
` ${
|
|
66229
|
+
` ${pc69.dim("Learn more:")} ${pc69.cyan("https://wraps.dev/docs/telemetry")}`
|
|
65500
66230
|
);
|
|
65501
66231
|
console.log();
|
|
65502
66232
|
}
|
|
@@ -65505,8 +66235,8 @@ async function telemetryStatus() {
|
|
|
65505
66235
|
init_esm_shims();
|
|
65506
66236
|
import { existsSync as existsSync20, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
65507
66237
|
import { join as join25 } from "path";
|
|
65508
|
-
import * as
|
|
65509
|
-
import
|
|
66238
|
+
import * as clack67 from "@clack/prompts";
|
|
66239
|
+
import pc70 from "picocolors";
|
|
65510
66240
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
65511
66241
|
defineWorkflow,
|
|
65512
66242
|
sendEmail,
|
|
@@ -65601,30 +66331,30 @@ export default defineConfig({
|
|
|
65601
66331
|
});
|
|
65602
66332
|
`;
|
|
65603
66333
|
async function workflowInit(options = {}) {
|
|
65604
|
-
|
|
66334
|
+
clack67.intro(pc70.bgCyan(pc70.black(" wraps workflow init ")));
|
|
65605
66335
|
const wrapsDir = join25(process.cwd(), "wraps");
|
|
65606
66336
|
const workflowsDir = join25(wrapsDir, "workflows");
|
|
65607
66337
|
const configPath = join25(wrapsDir, "wraps.config.ts");
|
|
65608
66338
|
if (existsSync20(workflowsDir)) {
|
|
65609
|
-
|
|
65610
|
-
`Workflows directory already exists at ${
|
|
66339
|
+
clack67.log.info(
|
|
66340
|
+
`Workflows directory already exists at ${pc70.cyan("wraps/workflows/")}`
|
|
65611
66341
|
);
|
|
65612
66342
|
const files = existsSync20(join25(workflowsDir, "cart-recovery.ts")) || existsSync20(join25(workflowsDir, "welcome-sequence.ts"));
|
|
65613
66343
|
if (files && !options.yes) {
|
|
65614
|
-
const shouldContinue = await
|
|
66344
|
+
const shouldContinue = await clack67.confirm({
|
|
65615
66345
|
message: "Example files may already exist. Overwrite them?",
|
|
65616
66346
|
initialValue: false
|
|
65617
66347
|
});
|
|
65618
|
-
if (
|
|
65619
|
-
|
|
66348
|
+
if (clack67.isCancel(shouldContinue) || !shouldContinue) {
|
|
66349
|
+
clack67.log.info("Skipping file creation.");
|
|
65620
66350
|
showNextSteps2();
|
|
65621
|
-
|
|
66351
|
+
clack67.outro("Done!");
|
|
65622
66352
|
return;
|
|
65623
66353
|
}
|
|
65624
66354
|
}
|
|
65625
66355
|
}
|
|
65626
66356
|
try {
|
|
65627
|
-
const s2 =
|
|
66357
|
+
const s2 = clack67.spinner();
|
|
65628
66358
|
s2.start("Creating workflows directory...");
|
|
65629
66359
|
mkdirSync2(workflowsDir, { recursive: true });
|
|
65630
66360
|
s2.stop("Created wraps/workflows/");
|
|
@@ -65642,34 +66372,34 @@ async function workflowInit(options = {}) {
|
|
|
65642
66372
|
s2.stop("Created 2 example workflows");
|
|
65643
66373
|
if (!existsSync20(configPath)) {
|
|
65644
66374
|
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
65645
|
-
|
|
66375
|
+
clack67.log.info(`Created ${pc70.cyan("wraps/wraps.config.ts")}`);
|
|
65646
66376
|
}
|
|
65647
|
-
|
|
65648
|
-
`${
|
|
65649
|
-
${
|
|
65650
|
-
${
|
|
65651
|
-
${
|
|
66377
|
+
clack67.log.success(
|
|
66378
|
+
`${pc70.bold("Workflows scaffolded!")} Created:
|
|
66379
|
+
${pc70.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
66380
|
+
${pc70.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
66381
|
+
${pc70.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
65652
66382
|
);
|
|
65653
66383
|
showNextSteps2();
|
|
65654
|
-
|
|
66384
|
+
clack67.outro(pc70.green("Happy orchestrating!"));
|
|
65655
66385
|
} catch (error) {
|
|
65656
|
-
|
|
66386
|
+
clack67.log.error(
|
|
65657
66387
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
65658
66388
|
);
|
|
65659
|
-
|
|
66389
|
+
clack67.outro(pc70.red("Scaffolding failed."));
|
|
65660
66390
|
process.exitCode = 1;
|
|
65661
66391
|
}
|
|
65662
66392
|
}
|
|
65663
66393
|
function showNextSteps2() {
|
|
65664
|
-
|
|
65665
|
-
`${
|
|
66394
|
+
clack67.log.info(
|
|
66395
|
+
`${pc70.bold("Next steps:")}
|
|
65666
66396
|
|
|
65667
|
-
1. Edit ${
|
|
65668
|
-
2. Edit your workflows in ${
|
|
65669
|
-
3. Validate: ${
|
|
65670
|
-
4. Push: ${
|
|
66397
|
+
1. Edit ${pc70.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
66398
|
+
2. Edit your workflows in ${pc70.cyan("wraps/workflows/")}
|
|
66399
|
+
3. Validate: ${pc70.cyan("wraps email workflows validate")}
|
|
66400
|
+
4. Push: ${pc70.cyan("wraps email workflows push")}
|
|
65671
66401
|
|
|
65672
|
-
${
|
|
66402
|
+
${pc70.dim("Docs:")} ${pc70.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
65673
66403
|
);
|
|
65674
66404
|
}
|
|
65675
66405
|
|
|
@@ -65713,7 +66443,10 @@ var STRING_FLAGS = [
|
|
|
65713
66443
|
"limit",
|
|
65714
66444
|
"cursor",
|
|
65715
66445
|
"set",
|
|
65716
|
-
"volume"
|
|
66446
|
+
"volume",
|
|
66447
|
+
"since",
|
|
66448
|
+
"filter",
|
|
66449
|
+
"source"
|
|
65717
66450
|
];
|
|
65718
66451
|
var BOOLEAN_FLAGS = [
|
|
65719
66452
|
"yes",
|
|
@@ -65744,7 +66477,11 @@ var BOOLEAN_FLAGS = [
|
|
|
65744
66477
|
"vdm-engagement",
|
|
65745
66478
|
"vdm-inbox",
|
|
65746
66479
|
"help",
|
|
65747
|
-
"version"
|
|
66480
|
+
"version",
|
|
66481
|
+
"follow",
|
|
66482
|
+
"errors",
|
|
66483
|
+
"live",
|
|
66484
|
+
"platform"
|
|
65748
66485
|
];
|
|
65749
66486
|
var NEGATED_BOOLEANS = [
|
|
65750
66487
|
{ positive: "open", camelKey: "noOpen" },
|
|
@@ -65869,235 +66606,244 @@ function showVersion() {
|
|
|
65869
66606
|
process.exit(0);
|
|
65870
66607
|
}
|
|
65871
66608
|
function showHelp() {
|
|
65872
|
-
|
|
66609
|
+
clack68.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
65873
66610
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
65874
66611
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
65875
66612
|
console.log("Services:");
|
|
65876
|
-
console.log(` ${
|
|
66613
|
+
console.log(` ${pc72.cyan("email")} Email infrastructure (AWS SES)`);
|
|
65877
66614
|
console.log(
|
|
65878
|
-
` ${
|
|
66615
|
+
` ${pc72.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
65879
66616
|
);
|
|
65880
66617
|
console.log(
|
|
65881
|
-
` ${
|
|
66618
|
+
` ${pc72.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)`
|
|
65882
66619
|
);
|
|
65883
66620
|
console.log(
|
|
65884
|
-
` ${
|
|
66621
|
+
` ${pc72.cyan("selfhost")} Self-hosted Wraps control plane (enterprise)`
|
|
65885
66622
|
);
|
|
65886
66623
|
console.log(
|
|
65887
|
-
` ${
|
|
66624
|
+
` ${pc72.cyan("license")} License key management (Wraps team only)
|
|
65888
66625
|
`
|
|
65889
66626
|
);
|
|
65890
66627
|
console.log("Email Commands:");
|
|
65891
66628
|
console.log(
|
|
65892
|
-
` ${
|
|
66629
|
+
` ${pc72.cyan("email init")} Deploy new email infrastructure`
|
|
65893
66630
|
);
|
|
65894
66631
|
console.log(
|
|
65895
|
-
` ${
|
|
66632
|
+
` ${pc72.cyan("email check")} Check email deliverability for a domain`
|
|
65896
66633
|
);
|
|
65897
66634
|
console.log(
|
|
65898
|
-
` ${
|
|
66635
|
+
` ${pc72.cyan("email connect")} Connect to existing AWS SES`
|
|
65899
66636
|
);
|
|
65900
66637
|
console.log(
|
|
65901
|
-
` ${
|
|
66638
|
+
` ${pc72.cyan("email status")} Show email infrastructure details`
|
|
65902
66639
|
);
|
|
65903
66640
|
console.log(
|
|
65904
|
-
` ${
|
|
66641
|
+
` ${pc72.cyan("email plan")} Show SES pricing plan and cheaper options`
|
|
65905
66642
|
);
|
|
65906
|
-
console.log(` ${
|
|
65907
|
-
console.log(` ${
|
|
66643
|
+
console.log(` ${pc72.cyan("email test")} Send a test email`);
|
|
66644
|
+
console.log(` ${pc72.cyan("email verify")} Verify domain DNS records`);
|
|
65908
66645
|
console.log(
|
|
65909
|
-
` ${
|
|
66646
|
+
` ${pc72.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
65910
66647
|
);
|
|
65911
|
-
console.log(` ${
|
|
66648
|
+
console.log(` ${pc72.cyan("email upgrade")} Add features`);
|
|
65912
66649
|
console.log(
|
|
65913
|
-
` ${
|
|
66650
|
+
` ${pc72.cyan("email restore")} Restore original configuration`
|
|
65914
66651
|
);
|
|
65915
66652
|
console.log(
|
|
65916
|
-
` ${
|
|
66653
|
+
` ${pc72.cyan("email destroy")} Remove email infrastructure`
|
|
65917
66654
|
);
|
|
65918
66655
|
console.log(
|
|
65919
|
-
` ${
|
|
66656
|
+
` ${pc72.cyan("email doctor")} Diagnose and clean up email infrastructure`
|
|
65920
66657
|
);
|
|
65921
|
-
console.log(` ${
|
|
65922
|
-
console.log(` ${
|
|
65923
|
-
console.log(` ${
|
|
66658
|
+
console.log(` ${pc72.cyan("email domains add")} Add a domain to SES`);
|
|
66659
|
+
console.log(` ${pc72.cyan("email domains list")} List all domains`);
|
|
66660
|
+
console.log(` ${pc72.cyan("email domains remove")} Remove a domain`);
|
|
65924
66661
|
console.log(
|
|
65925
|
-
` ${
|
|
66662
|
+
` ${pc72.cyan("email inbound init")} Enable inbound email receiving`
|
|
65926
66663
|
);
|
|
65927
|
-
console.log(` ${
|
|
66664
|
+
console.log(` ${pc72.cyan("email inbound status")} Show inbound email status`);
|
|
65928
66665
|
console.log(
|
|
65929
|
-
` ${
|
|
66666
|
+
` ${pc72.cyan("email inbound verify")} Verify inbound DNS records`
|
|
65930
66667
|
);
|
|
65931
66668
|
console.log(
|
|
65932
|
-
` ${
|
|
66669
|
+
` ${pc72.cyan("email inbound test")} Send test email and verify receipt`
|
|
65933
66670
|
);
|
|
65934
66671
|
console.log(
|
|
65935
|
-
` ${
|
|
66672
|
+
` ${pc72.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
65936
66673
|
`
|
|
65937
66674
|
);
|
|
65938
66675
|
console.log("Agent Commands:");
|
|
65939
66676
|
console.log(
|
|
65940
|
-
` ${
|
|
66677
|
+
` ${pc72.cyan("email agent create")} Create a leashed agent mailbox`
|
|
65941
66678
|
);
|
|
65942
|
-
console.log(` ${
|
|
66679
|
+
console.log(` ${pc72.cyan("email agent list")} List agents`);
|
|
65943
66680
|
console.log(
|
|
65944
|
-
` ${
|
|
66681
|
+
` ${pc72.cyan("email agent kill")} Kill an agent (revoke sending)
|
|
65945
66682
|
`
|
|
65946
66683
|
);
|
|
65947
66684
|
console.log("Template Commands:");
|
|
65948
66685
|
console.log(
|
|
65949
|
-
` ${
|
|
66686
|
+
` ${pc72.cyan("email templates init")} Initialize templates-as-code`
|
|
65950
66687
|
);
|
|
65951
66688
|
console.log(
|
|
65952
|
-
` ${
|
|
66689
|
+
` ${pc72.cyan("email templates push")} Push templates to SES + dashboard`
|
|
65953
66690
|
);
|
|
65954
66691
|
console.log(
|
|
65955
|
-
` ${
|
|
66692
|
+
` ${pc72.cyan("email templates preview")} Preview templates in browser`
|
|
65956
66693
|
);
|
|
65957
66694
|
console.log(
|
|
65958
|
-
` ${
|
|
66695
|
+
` ${pc72.cyan("push")} ${pc72.dim("(alias for email templates push)")}
|
|
65959
66696
|
`
|
|
65960
66697
|
);
|
|
65961
66698
|
console.log("Workflow Commands:");
|
|
65962
66699
|
console.log(
|
|
65963
|
-
` ${
|
|
66700
|
+
` ${pc72.cyan("email workflows init")} Initialize workflows-as-code`
|
|
65964
66701
|
);
|
|
65965
66702
|
console.log(
|
|
65966
|
-
` ${
|
|
66703
|
+
` ${pc72.cyan("email workflows validate")} Validate workflow files`
|
|
65967
66704
|
);
|
|
65968
66705
|
console.log(
|
|
65969
|
-
` ${
|
|
66706
|
+
` ${pc72.cyan("email workflows push")} Push workflows to dashboard
|
|
65970
66707
|
`
|
|
65971
66708
|
);
|
|
65972
66709
|
console.log("SMS Commands:");
|
|
65973
|
-
console.log(` ${
|
|
66710
|
+
console.log(` ${pc72.cyan("sms init")} Deploy SMS infrastructure`);
|
|
65974
66711
|
console.log(
|
|
65975
|
-
` ${
|
|
66712
|
+
` ${pc72.cyan("sms status")} Show SMS infrastructure details`
|
|
65976
66713
|
);
|
|
65977
|
-
console.log(` ${
|
|
66714
|
+
console.log(` ${pc72.cyan("sms test")} Send a test SMS message`);
|
|
65978
66715
|
console.log(
|
|
65979
|
-
` ${
|
|
66716
|
+
` ${pc72.cyan("sms verify-number")} Verify a destination phone number`
|
|
65980
66717
|
);
|
|
65981
66718
|
console.log(
|
|
65982
|
-
` ${
|
|
66719
|
+
` ${pc72.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
65983
66720
|
);
|
|
65984
|
-
console.log(` ${
|
|
65985
|
-
console.log(` ${
|
|
66721
|
+
console.log(` ${pc72.cyan("sms upgrade")} Upgrade SMS features`);
|
|
66722
|
+
console.log(` ${pc72.cyan("sms register")} Register toll-free number`);
|
|
65986
66723
|
console.log(
|
|
65987
|
-
` ${
|
|
66724
|
+
` ${pc72.cyan("sms destroy")} Remove SMS infrastructure
|
|
65988
66725
|
`
|
|
65989
66726
|
);
|
|
65990
66727
|
console.log("CDN Commands:");
|
|
65991
66728
|
console.log(
|
|
65992
|
-
` ${
|
|
66729
|
+
` ${pc72.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
65993
66730
|
);
|
|
65994
66731
|
console.log(
|
|
65995
|
-
` ${
|
|
66732
|
+
` ${pc72.cyan("cdn status")} Show CDN infrastructure details`
|
|
65996
66733
|
);
|
|
65997
66734
|
console.log(
|
|
65998
|
-
` ${
|
|
66735
|
+
` ${pc72.cyan("cdn verify")} Check DNS and certificate status`
|
|
65999
66736
|
);
|
|
66000
66737
|
console.log(
|
|
66001
|
-
` ${
|
|
66738
|
+
` ${pc72.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
66002
66739
|
);
|
|
66003
66740
|
console.log(
|
|
66004
|
-
` ${
|
|
66741
|
+
` ${pc72.cyan("cdn sync")} Sync infrastructure with current config`
|
|
66005
66742
|
);
|
|
66006
66743
|
console.log(
|
|
66007
|
-
` ${
|
|
66744
|
+
` ${pc72.cyan("cdn destroy")} Remove CDN infrastructure
|
|
66008
66745
|
`
|
|
66009
66746
|
);
|
|
66010
66747
|
console.log("Self-Hosted Commands:");
|
|
66011
66748
|
console.log(
|
|
66012
|
-
` ${
|
|
66749
|
+
` ${pc72.cyan("selfhost deploy")} Deploy Wraps API to your AWS account`
|
|
66013
66750
|
);
|
|
66014
66751
|
console.log(
|
|
66015
|
-
` ${
|
|
66752
|
+
` ${pc72.cyan("selfhost login")} Sign in to your self-hosted Wraps instance`
|
|
66016
66753
|
);
|
|
66017
66754
|
console.log(
|
|
66018
|
-
` ${
|
|
66755
|
+
` ${pc72.cyan("selfhost logout")} Sign out of your self-hosted Wraps instance`
|
|
66019
66756
|
);
|
|
66020
66757
|
console.log(
|
|
66021
|
-
` ${
|
|
66758
|
+
` ${pc72.cyan("selfhost upgrade")} Rebuild and redeploy the self-hosted API`
|
|
66022
66759
|
);
|
|
66023
66760
|
console.log(
|
|
66024
|
-
` ${
|
|
66761
|
+
` ${pc72.cyan("selfhost status")} Show self-hosted deployment details`
|
|
66025
66762
|
);
|
|
66026
66763
|
console.log(
|
|
66027
|
-
` ${
|
|
66764
|
+
` ${pc72.cyan("selfhost logs")} Stream logs from your self-hosted API, dashboard, and workers`
|
|
66028
66765
|
);
|
|
66029
66766
|
console.log(
|
|
66030
|
-
` ${
|
|
66767
|
+
` ${pc72.cyan("selfhost env")} Print env vars for hosting the dashboard yourself`
|
|
66768
|
+
);
|
|
66769
|
+
console.log(
|
|
66770
|
+
` ${pc72.cyan("selfhost connect")} Connect your AWS account to your self-hosted instance`
|
|
66771
|
+
);
|
|
66772
|
+
console.log(
|
|
66773
|
+
` ${pc72.cyan("selfhost update-role")} Refresh your self-hosted console role's permissions`
|
|
66774
|
+
);
|
|
66775
|
+
console.log(
|
|
66776
|
+
` ${pc72.cyan("selfhost destroy")} Tear down the self-hosted deployment
|
|
66031
66777
|
`
|
|
66032
66778
|
);
|
|
66033
66779
|
console.log("Local Development:");
|
|
66034
66780
|
console.log(
|
|
66035
|
-
` ${
|
|
66781
|
+
` ${pc72.cyan("console")} Start local web console
|
|
66036
66782
|
`
|
|
66037
66783
|
);
|
|
66038
66784
|
console.log("Platform:");
|
|
66039
66785
|
console.log(
|
|
66040
|
-
` ${
|
|
66786
|
+
` ${pc72.cyan("platform")} Show platform info and pricing`
|
|
66041
66787
|
);
|
|
66042
66788
|
console.log(
|
|
66043
|
-
` ${
|
|
66789
|
+
` ${pc72.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
66044
66790
|
);
|
|
66045
66791
|
console.log(
|
|
66046
|
-
` ${
|
|
66792
|
+
` ${pc72.cyan("platform update-role")} Update platform IAM permissions
|
|
66047
66793
|
`
|
|
66048
66794
|
);
|
|
66049
66795
|
console.log("Auth:");
|
|
66050
66796
|
console.log(
|
|
66051
|
-
` ${
|
|
66797
|
+
` ${pc72.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
66052
66798
|
);
|
|
66053
|
-
console.log(` ${
|
|
66799
|
+
console.log(` ${pc72.cyan("auth status")} Show current auth state`);
|
|
66054
66800
|
console.log(
|
|
66055
|
-
` ${
|
|
66801
|
+
` ${pc72.cyan("auth logout")} Sign out and remove stored token
|
|
66056
66802
|
`
|
|
66057
66803
|
);
|
|
66058
66804
|
console.log("AWS Setup:");
|
|
66059
66805
|
console.log(
|
|
66060
|
-
` ${
|
|
66806
|
+
` ${pc72.cyan("aws setup")} Interactive AWS setup wizard`
|
|
66061
66807
|
);
|
|
66062
66808
|
console.log(
|
|
66063
|
-
` ${
|
|
66809
|
+
` ${pc72.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
66064
66810
|
`
|
|
66065
66811
|
);
|
|
66066
66812
|
console.log("Global Commands:");
|
|
66067
|
-
console.log(` ${
|
|
66068
|
-
console.log(` ${
|
|
66069
|
-
console.log(` ${
|
|
66070
|
-
console.log(` ${
|
|
66813
|
+
console.log(` ${pc72.cyan("status")} Show overview of all services`);
|
|
66814
|
+
console.log(` ${pc72.cyan("destroy")} Remove deployed infrastructure`);
|
|
66815
|
+
console.log(` ${pc72.cyan("permissions")} Show required AWS IAM permissions`);
|
|
66816
|
+
console.log(` ${pc72.cyan("completion")} Generate shell completion script`);
|
|
66071
66817
|
console.log(
|
|
66072
|
-
` ${
|
|
66818
|
+
` ${pc72.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
66073
66819
|
);
|
|
66074
|
-
console.log(` ${
|
|
66075
|
-
console.log(` ${
|
|
66820
|
+
console.log(` ${pc72.cyan("update")} Update CLI to latest version`);
|
|
66821
|
+
console.log(` ${pc72.cyan("news")} Show recent Wraps updates`);
|
|
66076
66822
|
console.log(
|
|
66077
|
-
` ${
|
|
66823
|
+
` ${pc72.cyan("support")} Get help and support contact info
|
|
66078
66824
|
`
|
|
66079
66825
|
);
|
|
66080
66826
|
console.log("Options:");
|
|
66081
66827
|
console.log(
|
|
66082
|
-
` ${
|
|
66828
|
+
` ${pc72.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
66083
66829
|
);
|
|
66084
|
-
console.log(` ${
|
|
66085
|
-
console.log(` ${
|
|
66086
|
-
console.log(` ${
|
|
66087
|
-
console.log(` ${
|
|
66088
|
-
console.log(` ${
|
|
66089
|
-
console.log(` ${
|
|
66090
|
-
console.log(` ${
|
|
66830
|
+
console.log(` ${pc72.dim("-r, --region")} AWS region`);
|
|
66831
|
+
console.log(` ${pc72.dim("-d, --domain")} Domain name`);
|
|
66832
|
+
console.log(` ${pc72.dim("--account")} AWS account ID or alias`);
|
|
66833
|
+
console.log(` ${pc72.dim("--preset")} Configuration preset`);
|
|
66834
|
+
console.log(` ${pc72.dim("--token")} API key or token for auth`);
|
|
66835
|
+
console.log(` ${pc72.dim("-y, --yes")} Skip confirmation prompts`);
|
|
66836
|
+
console.log(` ${pc72.dim("-f, --force")} Force destructive operations`);
|
|
66091
66837
|
console.log(
|
|
66092
|
-
` ${
|
|
66838
|
+
` ${pc72.dim("--preview")} Preview changes without deploying`
|
|
66093
66839
|
);
|
|
66094
|
-
console.log(` ${
|
|
66840
|
+
console.log(` ${pc72.dim("-v, --version")} Show version number
|
|
66095
66841
|
`);
|
|
66096
66842
|
console.log(
|
|
66097
|
-
`Run ${
|
|
66843
|
+
`Run ${pc72.cyan("wraps <service> <command> --help")} for more information.`
|
|
66098
66844
|
);
|
|
66099
66845
|
console.log(
|
|
66100
|
-
`AI agents: complete docs at ${
|
|
66846
|
+
`AI agents: complete docs at ${pc72.cyan("https://wraps.dev/llms-full.txt")}
|
|
66101
66847
|
`
|
|
66102
66848
|
);
|
|
66103
66849
|
}
|
|
@@ -66119,27 +66865,27 @@ if (!primaryCommand) {
|
|
|
66119
66865
|
const telemetry = getTelemetryClient();
|
|
66120
66866
|
if (telemetry.shouldShowNotification()) {
|
|
66121
66867
|
console.log();
|
|
66122
|
-
|
|
66868
|
+
clack68.log.info(pc72.bold("Anonymous Telemetry"));
|
|
66123
66869
|
console.log(
|
|
66124
|
-
` Wraps collects ${
|
|
66870
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
66125
66871
|
);
|
|
66126
66872
|
console.log(
|
|
66127
|
-
` We ${
|
|
66873
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
66128
66874
|
);
|
|
66129
66875
|
console.log(
|
|
66130
|
-
` We ${
|
|
66876
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
66131
66877
|
);
|
|
66132
66878
|
console.log();
|
|
66133
|
-
console.log(` Opt-out anytime: ${
|
|
66134
|
-
console.log(` Or set: ${
|
|
66135
|
-
console.log(` Learn more: ${
|
|
66879
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
66880
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
66881
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
66136
66882
|
console.log();
|
|
66137
66883
|
telemetry.markNotificationShown();
|
|
66138
66884
|
}
|
|
66139
66885
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
66140
|
-
|
|
66886
|
+
clack68.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
66141
66887
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
66142
|
-
const action = await
|
|
66888
|
+
const action = await clack68.select({
|
|
66143
66889
|
message: "What would you like to do?",
|
|
66144
66890
|
options: [
|
|
66145
66891
|
{
|
|
@@ -66189,13 +66935,13 @@ if (!primaryCommand) {
|
|
|
66189
66935
|
}
|
|
66190
66936
|
]
|
|
66191
66937
|
});
|
|
66192
|
-
if (
|
|
66938
|
+
if (clack68.isCancel(action)) {
|
|
66193
66939
|
trackCommand("interactive:cancel", {
|
|
66194
66940
|
success: true,
|
|
66195
66941
|
duration_ms: Date.now() - startTime
|
|
66196
66942
|
});
|
|
66197
66943
|
await telemetry.shutdown();
|
|
66198
|
-
|
|
66944
|
+
clack68.cancel("Operation cancelled.");
|
|
66199
66945
|
process.exit(0);
|
|
66200
66946
|
}
|
|
66201
66947
|
trackCommand(`interactive:${action}`, {
|
|
@@ -66275,20 +67021,20 @@ async function run() {
|
|
|
66275
67021
|
const telemetry = getTelemetryClient();
|
|
66276
67022
|
if (telemetry.shouldShowNotification()) {
|
|
66277
67023
|
console.log();
|
|
66278
|
-
|
|
67024
|
+
clack68.log.info(pc72.bold("Anonymous Telemetry"));
|
|
66279
67025
|
console.log(
|
|
66280
|
-
` Wraps collects ${
|
|
67026
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
66281
67027
|
);
|
|
66282
67028
|
console.log(
|
|
66283
|
-
` We ${
|
|
67029
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
66284
67030
|
);
|
|
66285
67031
|
console.log(
|
|
66286
|
-
` We ${
|
|
67032
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
66287
67033
|
);
|
|
66288
67034
|
console.log();
|
|
66289
|
-
console.log(` Opt-out anytime: ${
|
|
66290
|
-
console.log(` Or set: ${
|
|
66291
|
-
console.log(` Learn more: ${
|
|
67035
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
67036
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
67037
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
66292
67038
|
console.log();
|
|
66293
67039
|
telemetry.markNotificationShown();
|
|
66294
67040
|
}
|
|
@@ -66382,10 +67128,10 @@ async function run() {
|
|
|
66382
67128
|
break;
|
|
66383
67129
|
case "verify": {
|
|
66384
67130
|
if (!flags.domain) {
|
|
66385
|
-
|
|
67131
|
+
clack68.log.error("--domain flag is required");
|
|
66386
67132
|
console.log(
|
|
66387
67133
|
`
|
|
66388
|
-
Usage: ${
|
|
67134
|
+
Usage: ${pc72.cyan("wraps email verify --domain yourapp.com")}
|
|
66389
67135
|
`
|
|
66390
67136
|
);
|
|
66391
67137
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66457,12 +67203,12 @@ Usage: ${pc71.cyan("wraps email verify --domain yourapp.com")}
|
|
|
66457
67203
|
});
|
|
66458
67204
|
break;
|
|
66459
67205
|
default:
|
|
66460
|
-
|
|
67206
|
+
clack68.log.error(
|
|
66461
67207
|
`Unknown inbound command: ${inboundSubCommand || "(none)"}`
|
|
66462
67208
|
);
|
|
66463
67209
|
console.log(
|
|
66464
67210
|
`
|
|
66465
|
-
Available commands: ${
|
|
67211
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("destroy")}, ${pc72.cyan("status")}, ${pc72.cyan("verify")}, ${pc72.cyan("test")}, ${pc72.cyan("add")}, ${pc72.cyan("remove")}
|
|
66466
67212
|
`
|
|
66467
67213
|
);
|
|
66468
67214
|
throw new Error(
|
|
@@ -66499,12 +67245,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("destroy")}, ${pc71.cyan("
|
|
|
66499
67245
|
});
|
|
66500
67246
|
break;
|
|
66501
67247
|
default:
|
|
66502
|
-
|
|
67248
|
+
clack68.log.error(
|
|
66503
67249
|
`Unknown agent command: ${agentSubCommand || "(none)"}`
|
|
66504
67250
|
);
|
|
66505
67251
|
console.log(
|
|
66506
67252
|
`
|
|
66507
|
-
Available commands: ${
|
|
67253
|
+
Available commands: ${pc72.cyan("create")}, ${pc72.cyan("list")}, ${pc72.cyan("kill")}
|
|
66508
67254
|
`
|
|
66509
67255
|
);
|
|
66510
67256
|
throw new Error(
|
|
@@ -66556,12 +67302,12 @@ Available commands: ${pc71.cyan("create")}, ${pc71.cyan("list")}, ${pc71.cyan("k
|
|
|
66556
67302
|
break;
|
|
66557
67303
|
}
|
|
66558
67304
|
default:
|
|
66559
|
-
|
|
67305
|
+
clack68.log.error(
|
|
66560
67306
|
`Unknown reply command: ${replySubCommand || "(none)"}`
|
|
66561
67307
|
);
|
|
66562
67308
|
console.log(
|
|
66563
67309
|
`
|
|
66564
|
-
Available commands: ${
|
|
67310
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("rotate")}, ${pc72.cyan("status")}, ${pc72.cyan("destroy")}, ${pc72.cyan("decode")}
|
|
66565
67311
|
`
|
|
66566
67312
|
);
|
|
66567
67313
|
throw new Error(
|
|
@@ -66586,10 +67332,10 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("rotate")}, ${pc71.cyan("s
|
|
|
66586
67332
|
break;
|
|
66587
67333
|
case "verify": {
|
|
66588
67334
|
if (!flags.domain) {
|
|
66589
|
-
|
|
67335
|
+
clack68.log.error("--domain flag is required");
|
|
66590
67336
|
console.log(
|
|
66591
67337
|
`
|
|
66592
|
-
Usage: ${
|
|
67338
|
+
Usage: ${pc72.cyan("wraps email domains verify --domain yourapp.com")}
|
|
66593
67339
|
`
|
|
66594
67340
|
);
|
|
66595
67341
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66599,10 +67345,10 @@ Usage: ${pc71.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
66599
67345
|
}
|
|
66600
67346
|
case "get-dkim": {
|
|
66601
67347
|
if (!flags.domain) {
|
|
66602
|
-
|
|
67348
|
+
clack68.log.error("--domain flag is required");
|
|
66603
67349
|
console.log(
|
|
66604
67350
|
`
|
|
66605
|
-
Usage: ${
|
|
67351
|
+
Usage: ${pc72.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
66606
67352
|
`
|
|
66607
67353
|
);
|
|
66608
67354
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66612,10 +67358,10 @@ Usage: ${pc71.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
66612
67358
|
}
|
|
66613
67359
|
case "remove": {
|
|
66614
67360
|
if (!flags.domain) {
|
|
66615
|
-
|
|
67361
|
+
clack68.log.error("--domain flag is required");
|
|
66616
67362
|
console.log(
|
|
66617
67363
|
`
|
|
66618
|
-
Usage: ${
|
|
67364
|
+
Usage: ${pc72.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
66619
67365
|
`
|
|
66620
67366
|
);
|
|
66621
67367
|
throw new Error("Missing required flag: --domain");
|
|
@@ -66645,12 +67391,12 @@ Usage: ${pc71.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
66645
67391
|
break;
|
|
66646
67392
|
}
|
|
66647
67393
|
default:
|
|
66648
|
-
|
|
67394
|
+
clack68.log.error(
|
|
66649
67395
|
`Unknown domains command: ${domainsSubCommand || "(none)"}`
|
|
66650
67396
|
);
|
|
66651
67397
|
console.log(
|
|
66652
67398
|
`
|
|
66653
|
-
Available commands: ${
|
|
67399
|
+
Available commands: ${pc72.cyan("add")}, ${pc72.cyan("list")}, ${pc72.cyan("verify")}, ${pc72.cyan("get-dkim")}, ${pc72.cyan("remove")}, ${pc72.cyan("config")}
|
|
66654
67400
|
`
|
|
66655
67401
|
);
|
|
66656
67402
|
throw new Error(
|
|
@@ -66692,12 +67438,12 @@ Available commands: ${pc71.cyan("add")}, ${pc71.cyan("list")}, ${pc71.cyan("veri
|
|
|
66692
67438
|
});
|
|
66693
67439
|
break;
|
|
66694
67440
|
default:
|
|
66695
|
-
|
|
67441
|
+
clack68.log.error(
|
|
66696
67442
|
`Unknown templates command: ${templatesSubCommand || "(none)"}`
|
|
66697
67443
|
);
|
|
66698
67444
|
console.log(
|
|
66699
67445
|
`
|
|
66700
|
-
Available commands: ${
|
|
67446
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("push")}, ${pc72.cyan("preview")}
|
|
66701
67447
|
`
|
|
66702
67448
|
);
|
|
66703
67449
|
throw new Error(
|
|
@@ -66736,12 +67482,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("push")}, ${pc71.cyan("pre
|
|
|
66736
67482
|
});
|
|
66737
67483
|
break;
|
|
66738
67484
|
default:
|
|
66739
|
-
|
|
67485
|
+
clack68.log.error(
|
|
66740
67486
|
`Unknown workflows command: ${workflowsSubCommand || "(none)"}`
|
|
66741
67487
|
);
|
|
66742
67488
|
console.log(
|
|
66743
67489
|
`
|
|
66744
|
-
Available commands: ${
|
|
67490
|
+
Available commands: ${pc72.cyan("init")}, ${pc72.cyan("validate")}, ${pc72.cyan("push")}
|
|
66745
67491
|
`
|
|
66746
67492
|
);
|
|
66747
67493
|
throw new Error(
|
|
@@ -66766,7 +67512,7 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("validate")}, ${pc71.cyan(
|
|
|
66766
67512
|
case "get": {
|
|
66767
67513
|
const messageId = sub[3];
|
|
66768
67514
|
if (!messageId) {
|
|
66769
|
-
|
|
67515
|
+
clack68.log.error("Usage: wraps email logs get <message-id>");
|
|
66770
67516
|
throw new Error("Missing required argument: <message-id>");
|
|
66771
67517
|
}
|
|
66772
67518
|
await emailLogsGet({
|
|
@@ -66778,12 +67524,12 @@ Available commands: ${pc71.cyan("init")}, ${pc71.cyan("validate")}, ${pc71.cyan(
|
|
|
66778
67524
|
break;
|
|
66779
67525
|
}
|
|
66780
67526
|
default:
|
|
66781
|
-
|
|
67527
|
+
clack68.log.error(
|
|
66782
67528
|
`Unknown logs command: ${logsSubCommand || "(none)"}`
|
|
66783
67529
|
);
|
|
66784
67530
|
console.log(
|
|
66785
67531
|
`
|
|
66786
|
-
Available commands: ${
|
|
67532
|
+
Available commands: ${pc72.cyan("list")}, ${pc72.cyan("get <message-id>")}
|
|
66787
67533
|
`
|
|
66788
67534
|
);
|
|
66789
67535
|
throw new Error(
|
|
@@ -66808,10 +67554,10 @@ Available commands: ${pc71.cyan("list")}, ${pc71.cyan("get <message-id>")}
|
|
|
66808
67554
|
});
|
|
66809
67555
|
break;
|
|
66810
67556
|
default:
|
|
66811
|
-
|
|
67557
|
+
clack68.log.error(`Unknown email command: ${subCommand}`);
|
|
66812
67558
|
console.log(
|
|
66813
67559
|
`
|
|
66814
|
-
Run ${
|
|
67560
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66815
67561
|
`
|
|
66816
67562
|
);
|
|
66817
67563
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -66836,10 +67582,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66836
67582
|
});
|
|
66837
67583
|
break;
|
|
66838
67584
|
default:
|
|
66839
|
-
|
|
67585
|
+
clack68.log.error(`Unknown license command: ${subCommand}`);
|
|
66840
67586
|
console.log(
|
|
66841
67587
|
`
|
|
66842
|
-
Run ${
|
|
67588
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66843
67589
|
`
|
|
66844
67590
|
);
|
|
66845
67591
|
throw new Error(`Unknown license command: ${subCommand}`);
|
|
@@ -66886,6 +67632,21 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66886
67632
|
json: flags.json
|
|
66887
67633
|
});
|
|
66888
67634
|
break;
|
|
67635
|
+
case "logs":
|
|
67636
|
+
await selfhostLogs({
|
|
67637
|
+
region: flags.region,
|
|
67638
|
+
follow: flags.follow,
|
|
67639
|
+
errors: flags.errors,
|
|
67640
|
+
source: flags.source,
|
|
67641
|
+
since: flags.since,
|
|
67642
|
+
filter: flags.filter,
|
|
67643
|
+
interval: flags.interval,
|
|
67644
|
+
live: flags.live,
|
|
67645
|
+
platform: flags.platform,
|
|
67646
|
+
verbose: flags.verbose,
|
|
67647
|
+
json: flags.json
|
|
67648
|
+
});
|
|
67649
|
+
break;
|
|
66889
67650
|
case "login":
|
|
66890
67651
|
await selfhostLogin({
|
|
66891
67652
|
region: flags.region,
|
|
@@ -66923,10 +67684,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
66923
67684
|
});
|
|
66924
67685
|
break;
|
|
66925
67686
|
default:
|
|
66926
|
-
|
|
67687
|
+
clack68.log.error(`Unknown selfhost command: ${subCommand}`);
|
|
66927
67688
|
console.log(
|
|
66928
67689
|
`
|
|
66929
|
-
Run ${
|
|
67690
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
66930
67691
|
`
|
|
66931
67692
|
);
|
|
66932
67693
|
throw new Error(`Unknown selfhost command: ${subCommand}`);
|
|
@@ -67006,10 +67767,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67006
67767
|
});
|
|
67007
67768
|
break;
|
|
67008
67769
|
default:
|
|
67009
|
-
|
|
67770
|
+
clack68.log.error(`Unknown sms command: ${subCommand}`);
|
|
67010
67771
|
console.log(
|
|
67011
67772
|
`
|
|
67012
|
-
Run ${
|
|
67773
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67013
67774
|
`
|
|
67014
67775
|
);
|
|
67015
67776
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -67070,10 +67831,10 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67070
67831
|
});
|
|
67071
67832
|
break;
|
|
67072
67833
|
default:
|
|
67073
|
-
|
|
67834
|
+
clack68.log.error(`Unknown cdn command: ${subCommand}`);
|
|
67074
67835
|
console.log(
|
|
67075
67836
|
`
|
|
67076
|
-
Run ${
|
|
67837
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67077
67838
|
`
|
|
67078
67839
|
);
|
|
67079
67840
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -67095,13 +67856,13 @@ Run ${pc71.cyan("wraps --help")} for available commands.
|
|
|
67095
67856
|
});
|
|
67096
67857
|
break;
|
|
67097
67858
|
default:
|
|
67098
|
-
|
|
67859
|
+
clack68.log.error(
|
|
67099
67860
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
67100
67861
|
);
|
|
67101
67862
|
console.log(`
|
|
67102
|
-
Available commands: ${
|
|
67863
|
+
Available commands: ${pc72.cyan("init")}
|
|
67103
67864
|
`);
|
|
67104
|
-
console.log(`Run ${
|
|
67865
|
+
console.log(`Run ${pc72.cyan("wraps --help")} for more information.
|
|
67105
67866
|
`);
|
|
67106
67867
|
throw new Error(
|
|
67107
67868
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -67143,14 +67904,14 @@ Available commands: ${pc71.cyan("init")}
|
|
|
67143
67904
|
});
|
|
67144
67905
|
break;
|
|
67145
67906
|
default:
|
|
67146
|
-
|
|
67907
|
+
clack68.log.error(`Unknown platform command: ${subCommand}`);
|
|
67147
67908
|
console.log(
|
|
67148
67909
|
`
|
|
67149
|
-
Available commands: ${
|
|
67910
|
+
Available commands: ${pc72.cyan("connect")}, ${pc72.cyan("update-role")}
|
|
67150
67911
|
`
|
|
67151
67912
|
);
|
|
67152
67913
|
console.log(
|
|
67153
|
-
`Run ${
|
|
67914
|
+
`Run ${pc72.cyan("wraps platform")} for more information.
|
|
67154
67915
|
`
|
|
67155
67916
|
);
|
|
67156
67917
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -67175,10 +67936,10 @@ Available commands: ${pc71.cyan("connect")}, ${pc71.cyan("update-role")}
|
|
|
67175
67936
|
await logout();
|
|
67176
67937
|
break;
|
|
67177
67938
|
default:
|
|
67178
|
-
|
|
67939
|
+
clack68.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
67179
67940
|
console.log(
|
|
67180
67941
|
`
|
|
67181
|
-
Available commands: ${
|
|
67942
|
+
Available commands: ${pc72.cyan("login")}, ${pc72.cyan("status")}, ${pc72.cyan("logout")}
|
|
67182
67943
|
`
|
|
67183
67944
|
);
|
|
67184
67945
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -67196,13 +67957,13 @@ Available commands: ${pc71.cyan("login")}, ${pc71.cyan("status")}, ${pc71.cyan("
|
|
|
67196
67957
|
await doctor();
|
|
67197
67958
|
break;
|
|
67198
67959
|
default:
|
|
67199
|
-
|
|
67960
|
+
clack68.log.error(`Unknown aws command: ${subCommand}`);
|
|
67200
67961
|
console.log(
|
|
67201
67962
|
`
|
|
67202
|
-
Available commands: ${
|
|
67963
|
+
Available commands: ${pc72.cyan("setup")}, ${pc72.cyan("doctor")}
|
|
67203
67964
|
`
|
|
67204
67965
|
);
|
|
67205
|
-
console.log(`Run ${
|
|
67966
|
+
console.log(`Run ${pc72.cyan("wraps --help")} for more information.
|
|
67206
67967
|
`);
|
|
67207
67968
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
67208
67969
|
}
|
|
@@ -67283,10 +68044,10 @@ Available commands: ${pc71.cyan("setup")}, ${pc71.cyan("doctor")}
|
|
|
67283
68044
|
await telemetryStatus();
|
|
67284
68045
|
break;
|
|
67285
68046
|
default:
|
|
67286
|
-
|
|
68047
|
+
clack68.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
67287
68048
|
console.log(
|
|
67288
68049
|
`
|
|
67289
|
-
Available commands: ${
|
|
68050
|
+
Available commands: ${pc72.cyan("enable")}, ${pc72.cyan("disable")}, ${pc72.cyan("status")}
|
|
67290
68051
|
`
|
|
67291
68052
|
);
|
|
67292
68053
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -67310,10 +68071,10 @@ Please specify a command for ${primaryCommand} service.
|
|
|
67310
68071
|
showHelp();
|
|
67311
68072
|
break;
|
|
67312
68073
|
default:
|
|
67313
|
-
|
|
68074
|
+
clack68.log.error(`Unknown command: ${primaryCommand}`);
|
|
67314
68075
|
console.log(
|
|
67315
68076
|
`
|
|
67316
|
-
Run ${
|
|
68077
|
+
Run ${pc72.cyan("wraps --help")} for available commands.
|
|
67317
68078
|
`
|
|
67318
68079
|
);
|
|
67319
68080
|
throw new Error(`Unknown command: ${primaryCommand}`);
|