@wraps.dev/cli 3.4.0 → 3.5.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/cli.js +864 -598
- package/dist/cli.js.map +1 -1
- package/dist/console/assets/index-CGthEkGy.js +127 -0
- package/dist/console/index.html +1 -1
- package/dist/lambda/agent-enforcer/.bundled +1 -1
- package/dist/lambda/agent-enforcer/index.js +13 -13
- package/dist/lambda/agent-enforcer/index.test.ts +99 -0
- package/dist/lambda/agent-enforcer/index.ts +54 -0
- package/dist/lambda/event-processor/.bundled +1 -1
- package/dist/lambda/inbound-processor/.bundled +1 -1
- package/dist/lambda/inbound-processor/index.js +56 -56
- package/dist/lambda/sms-event-processor/.bundled +1 -1
- package/package.json +3 -3
- package/dist/console/assets/index-YRZcw9N8.js +0 -127
package/dist/cli.js
CHANGED
|
@@ -1946,7 +1946,7 @@ async function needsMigration(localPulumiDir, accountId, region) {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
}
|
|
1948
1948
|
async function migrateLocalPulumiState(localPulumiDir, bucketName, accountId, region) {
|
|
1949
|
-
const
|
|
1949
|
+
const pulumi36 = await import("@pulumi/pulumi/automation/index.js");
|
|
1950
1950
|
const stacksDir = join2(localPulumiDir, ".pulumi", "stacks");
|
|
1951
1951
|
const entries = await readdir(stacksDir);
|
|
1952
1952
|
for (const entry of entries) {
|
|
@@ -1962,12 +1962,12 @@ async function migrateLocalPulumiState(localPulumiDir, bucketName, accountId, re
|
|
|
1962
1962
|
for (const stackFile of stackFiles) {
|
|
1963
1963
|
const stackName = stackFile.replace(".json", "");
|
|
1964
1964
|
try {
|
|
1965
|
-
const localStack = await
|
|
1965
|
+
const localStack = await pulumi36.LocalWorkspace.selectStack({
|
|
1966
1966
|
stackName,
|
|
1967
1967
|
workDir: localPulumiDir
|
|
1968
1968
|
});
|
|
1969
1969
|
const state2 = await localStack.exportStack();
|
|
1970
|
-
const s3Stack = await
|
|
1970
|
+
const s3Stack = await pulumi36.LocalWorkspace.createOrSelectStack(
|
|
1971
1971
|
{
|
|
1972
1972
|
stackName,
|
|
1973
1973
|
projectName,
|
|
@@ -2575,8 +2575,16 @@ var init_client = __esm({
|
|
|
2575
2575
|
});
|
|
2576
2576
|
|
|
2577
2577
|
// src/telemetry/events.ts
|
|
2578
|
+
function trackCommandFallback(command6, metadata) {
|
|
2579
|
+
const failing = metadata?.success === false;
|
|
2580
|
+
if (failing ? reportedOutcome === "failure" : reportedOutcome !== "none") {
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
trackCommand(command6, metadata);
|
|
2584
|
+
}
|
|
2578
2585
|
function trackCommand(command6, metadata) {
|
|
2579
2586
|
const client2 = getTelemetryClient();
|
|
2587
|
+
reportedOutcome = metadata?.success === false || reportedOutcome === "failure" ? "failure" : "success";
|
|
2580
2588
|
const sanitized = metadata ? { ...metadata } : {};
|
|
2581
2589
|
sanitized.domain = void 0;
|
|
2582
2590
|
sanitized.accountId = void 0;
|
|
@@ -2624,11 +2632,13 @@ function trackServiceRemoved(service, metadata) {
|
|
|
2624
2632
|
...metadata
|
|
2625
2633
|
});
|
|
2626
2634
|
}
|
|
2635
|
+
var reportedOutcome;
|
|
2627
2636
|
var init_events = __esm({
|
|
2628
2637
|
"src/telemetry/events.ts"() {
|
|
2629
2638
|
"use strict";
|
|
2630
2639
|
init_esm_shims();
|
|
2631
2640
|
init_client();
|
|
2641
|
+
reportedOutcome = "none";
|
|
2632
2642
|
}
|
|
2633
2643
|
});
|
|
2634
2644
|
|
|
@@ -28379,14 +28389,14 @@ async function withLockRetry(fn, options) {
|
|
|
28379
28389
|
throw error;
|
|
28380
28390
|
}
|
|
28381
28391
|
const clack67 = await import("@clack/prompts");
|
|
28382
|
-
const
|
|
28392
|
+
const pc73 = (await import("picocolors")).default;
|
|
28383
28393
|
if (options.autoConfirm) {
|
|
28384
28394
|
clack67.log.warn(
|
|
28385
28395
|
"Stack is locked from a previous interrupted run. Auto-clearing..."
|
|
28386
28396
|
);
|
|
28387
28397
|
} else {
|
|
28388
28398
|
const shouldClear = await clack67.confirm({
|
|
28389
|
-
message: `Stack is locked from a previous interrupted run. ${
|
|
28399
|
+
message: `Stack is locked from a previous interrupted run. ${pc73.yellow("Clear the stale lock and retry?")}`,
|
|
28390
28400
|
initialValue: true
|
|
28391
28401
|
});
|
|
28392
28402
|
if (clack67.isCancel(shouldClear) || !shouldClear) {
|
|
@@ -28413,8 +28423,8 @@ var init_pulumi = __esm({
|
|
|
28413
28423
|
// src/infrastructure/shared/resource-checks.ts
|
|
28414
28424
|
async function roleExists(roleName) {
|
|
28415
28425
|
try {
|
|
28416
|
-
const { IAMClient:
|
|
28417
|
-
const iam13 = new
|
|
28426
|
+
const { IAMClient: IAMClient7, GetRoleCommand: GetRoleCommand4 } = await import("@aws-sdk/client-iam");
|
|
28427
|
+
const iam13 = new IAMClient7({ region: "us-east-1" });
|
|
28418
28428
|
await iam13.send(new GetRoleCommand4({ RoleName: roleName }));
|
|
28419
28429
|
return true;
|
|
28420
28430
|
} catch (error) {
|
|
@@ -30171,8 +30181,8 @@ __export(iam_agent_user_exports, {
|
|
|
30171
30181
|
import * as aws22 from "@pulumi/aws";
|
|
30172
30182
|
async function userExists2(userName) {
|
|
30173
30183
|
try {
|
|
30174
|
-
const { IAMClient:
|
|
30175
|
-
const iam13 = new
|
|
30184
|
+
const { IAMClient: IAMClient7, GetUserCommand } = await import("@aws-sdk/client-iam");
|
|
30185
|
+
const iam13 = new IAMClient7({
|
|
30176
30186
|
region: getDefaultRegion()
|
|
30177
30187
|
});
|
|
30178
30188
|
await iam13.send(new GetUserCommand({ UserName: userName }));
|
|
@@ -31725,8 +31735,8 @@ import { homedir as homedir6, tmpdir as tmpdir2 } from "os";
|
|
|
31725
31735
|
import { join as join24 } from "path";
|
|
31726
31736
|
import { Readable as Readable5 } from "stream";
|
|
31727
31737
|
import { pipeline } from "stream/promises";
|
|
31728
|
-
import { cancel as cancel35, confirm as
|
|
31729
|
-
import
|
|
31738
|
+
import { cancel as cancel35, confirm as confirm30, intro as intro62, isCancel as isCancel41, log as log61 } from "@clack/prompts";
|
|
31739
|
+
import pc71 from "picocolors";
|
|
31730
31740
|
function isStandaloneInstall() {
|
|
31731
31741
|
return process.execPath.includes(".wraps/runtime");
|
|
31732
31742
|
}
|
|
@@ -31755,7 +31765,7 @@ function detectPlatformArch() {
|
|
|
31755
31765
|
return { platform: platform3, arch };
|
|
31756
31766
|
}
|
|
31757
31767
|
async function update(currentVersion) {
|
|
31758
|
-
|
|
31768
|
+
intro62(pc71.bold("Wraps CLI Update"));
|
|
31759
31769
|
const progress = new DeploymentProgress();
|
|
31760
31770
|
const result = await progress.execute(
|
|
31761
31771
|
"Checking for updates...",
|
|
@@ -31767,27 +31777,27 @@ async function update(currentVersion) {
|
|
|
31767
31777
|
}
|
|
31768
31778
|
const { version: latestVersion, release: release2 } = result;
|
|
31769
31779
|
if (currentVersion === latestVersion) {
|
|
31770
|
-
progress.succeed(`Already up to date ${
|
|
31780
|
+
progress.succeed(`Already up to date ${pc71.dim(`(v${currentVersion})`)}`);
|
|
31771
31781
|
return;
|
|
31772
31782
|
}
|
|
31773
31783
|
console.log();
|
|
31774
|
-
|
|
31775
|
-
`Current version: ${
|
|
31776
|
-
Latest version: ${
|
|
31784
|
+
log61.info(
|
|
31785
|
+
`Current version: ${pc71.dim(`v${currentVersion}`)}
|
|
31786
|
+
Latest version: ${pc71.cyan(`v${latestVersion}`)}`
|
|
31777
31787
|
);
|
|
31778
31788
|
console.log();
|
|
31779
31789
|
if (!isStandaloneInstall()) {
|
|
31780
|
-
|
|
31790
|
+
log61.info(
|
|
31781
31791
|
`You installed Wraps via npm. Update with:
|
|
31782
31792
|
|
|
31783
|
-
${
|
|
31793
|
+
${pc71.cyan("npm update -g @wraps.dev/cli")}`
|
|
31784
31794
|
);
|
|
31785
31795
|
return;
|
|
31786
31796
|
}
|
|
31787
|
-
const shouldUpdate = await
|
|
31797
|
+
const shouldUpdate = await confirm30({
|
|
31788
31798
|
message: `Update to v${latestVersion}?`
|
|
31789
31799
|
});
|
|
31790
|
-
if (
|
|
31800
|
+
if (isCancel41(shouldUpdate) || !shouldUpdate) {
|
|
31791
31801
|
cancel35("Update cancelled.");
|
|
31792
31802
|
return;
|
|
31793
31803
|
}
|
|
@@ -31855,7 +31865,7 @@ async function update(currentVersion) {
|
|
|
31855
31865
|
});
|
|
31856
31866
|
console.log();
|
|
31857
31867
|
progress.succeed(
|
|
31858
|
-
`Updated to ${
|
|
31868
|
+
`Updated to ${pc71.cyan(`v${latestVersion}`)} successfully!`
|
|
31859
31869
|
);
|
|
31860
31870
|
} finally {
|
|
31861
31871
|
rmSync(tmp, { recursive: true, force: true });
|
|
@@ -31879,7 +31889,7 @@ import { readFileSync as readFileSync4 } from "fs";
|
|
|
31879
31889
|
import { dirname as dirname6, join as join25 } from "path";
|
|
31880
31890
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
31881
31891
|
import * as clack66 from "@clack/prompts";
|
|
31882
|
-
import
|
|
31892
|
+
import pc72 from "picocolors";
|
|
31883
31893
|
|
|
31884
31894
|
// src/commands/auth/login.ts
|
|
31885
31895
|
init_esm_shims();
|
|
@@ -34242,8 +34252,8 @@ init_constants();
|
|
|
34242
34252
|
import * as aws3 from "@pulumi/aws";
|
|
34243
34253
|
async function getExistingOIDCProviderArn(url) {
|
|
34244
34254
|
try {
|
|
34245
|
-
const { IAMClient:
|
|
34246
|
-
const iam13 = new
|
|
34255
|
+
const { IAMClient: IAMClient7, ListOpenIDConnectProvidersCommand } = await import("@aws-sdk/client-iam");
|
|
34256
|
+
const iam13 = new IAMClient7({
|
|
34247
34257
|
region: getDefaultRegion()
|
|
34248
34258
|
});
|
|
34249
34259
|
const response = await iam13.send(new ListOpenIDConnectProvidersCommand({}));
|
|
@@ -38332,8 +38342,8 @@ function convertToSMTPPassword2(secretAccessKey, region) {
|
|
|
38332
38342
|
}
|
|
38333
38343
|
async function userExists(userName) {
|
|
38334
38344
|
try {
|
|
38335
|
-
const { IAMClient:
|
|
38336
|
-
const iam13 = new
|
|
38345
|
+
const { IAMClient: IAMClient7, GetUserCommand } = await import("@aws-sdk/client-iam");
|
|
38346
|
+
const iam13 = new IAMClient7({
|
|
38337
38347
|
region: getDefaultRegion()
|
|
38338
38348
|
});
|
|
38339
38349
|
await iam13.send(new GetUserCommand({ UserName: userName }));
|
|
@@ -47246,8 +47256,8 @@ function getRequiredActions(config2) {
|
|
|
47246
47256
|
}
|
|
47247
47257
|
async function checkIAMPermissions(userArn, actions, region) {
|
|
47248
47258
|
try {
|
|
47249
|
-
const { IAMClient:
|
|
47250
|
-
const client2 = new
|
|
47259
|
+
const { IAMClient: IAMClient7, SimulatePrincipalPolicyCommand } = await import("@aws-sdk/client-iam");
|
|
47260
|
+
const client2 = new IAMClient7({ region });
|
|
47251
47261
|
const batchSize = 100;
|
|
47252
47262
|
const batches = [];
|
|
47253
47263
|
for (let i6 = 0; i6 < actions.length; i6 += batchSize) {
|
|
@@ -48100,12 +48110,12 @@ async function emailLogsList(options) {
|
|
|
48100
48110
|
}
|
|
48101
48111
|
const COL = { time: 8, status: 11, to: 28, subject: 40, msgId: 18 };
|
|
48102
48112
|
const header = pc32.bold("Time".padEnd(COL.time)) + " " + pc32.bold("Status".padEnd(COL.status)) + " " + pc32.bold("To".padEnd(COL.to)) + " " + pc32.bold("Subject".padEnd(COL.subject)) + " " + pc32.bold("Message ID");
|
|
48103
|
-
const rows = data.logs.map((
|
|
48104
|
-
const time2 = relativeTime(
|
|
48105
|
-
const status2 = padVisible(colorStatus(
|
|
48106
|
-
const to = padVisible(truncate(
|
|
48107
|
-
const subject = padVisible(truncate(
|
|
48108
|
-
const msgId = truncate(
|
|
48113
|
+
const rows = data.logs.map((log63) => {
|
|
48114
|
+
const time2 = relativeTime(log63.createdAt).padEnd(COL.time);
|
|
48115
|
+
const status2 = padVisible(colorStatus(log63.status), COL.status);
|
|
48116
|
+
const to = padVisible(truncate(log63.recipient, COL.to), COL.to);
|
|
48117
|
+
const subject = padVisible(truncate(log63.subject, COL.subject), COL.subject);
|
|
48118
|
+
const msgId = truncate(log63.messageId, COL.msgId);
|
|
48109
48119
|
return `${time2} ${status2} ${to} ${subject} ${msgId}`;
|
|
48110
48120
|
});
|
|
48111
48121
|
clack30.note(
|
|
@@ -48163,32 +48173,32 @@ async function emailLogsGet(options) {
|
|
|
48163
48173
|
}
|
|
48164
48174
|
return;
|
|
48165
48175
|
}
|
|
48166
|
-
const
|
|
48176
|
+
const log63 = await resp.json();
|
|
48167
48177
|
if (isJsonMode()) {
|
|
48168
|
-
jsonSuccess("email.logs.get",
|
|
48178
|
+
jsonSuccess("email.logs.get", log63);
|
|
48169
48179
|
return;
|
|
48170
48180
|
}
|
|
48171
48181
|
const kv = (label, value) => `${pc32.dim(label.padEnd(16))} ${value ?? pc32.dim("\u2014")}`;
|
|
48172
|
-
const sentAt =
|
|
48173
|
-
const deliveredAt =
|
|
48174
|
-
const bouncedAt =
|
|
48175
|
-
const createdAt = new Date(
|
|
48182
|
+
const sentAt = log63.sentAt ? new Date(log63.sentAt).toLocaleString() : null;
|
|
48183
|
+
const deliveredAt = log63.deliveredAt ? new Date(log63.deliveredAt).toLocaleString() : null;
|
|
48184
|
+
const bouncedAt = log63.bouncedAt ? new Date(log63.bouncedAt).toLocaleString() : null;
|
|
48185
|
+
const createdAt = new Date(log63.createdAt).toLocaleString();
|
|
48176
48186
|
const lines = [
|
|
48177
|
-
kv("Message ID:",
|
|
48178
|
-
kv("Status:",
|
|
48179
|
-
kv("To:",
|
|
48180
|
-
kv("From:",
|
|
48181
|
-
kv("Subject:",
|
|
48182
|
-
kv("Source:",
|
|
48187
|
+
kv("Message ID:", log63.messageId),
|
|
48188
|
+
kv("Status:", log63.status ? colorStatus(log63.status) : null),
|
|
48189
|
+
kv("To:", log63.recipient),
|
|
48190
|
+
kv("From:", log63.from),
|
|
48191
|
+
kv("Subject:", log63.subject),
|
|
48192
|
+
kv("Source:", log63.sourceType),
|
|
48183
48193
|
kv("Sent:", sentAt),
|
|
48184
48194
|
kv("Delivered:", deliveredAt),
|
|
48185
48195
|
kv("Bounced:", bouncedAt),
|
|
48186
|
-
...
|
|
48196
|
+
...log63.bouncedSubType ? [kv("Bounce type:", log63.bouncedSubType)] : [],
|
|
48187
48197
|
kv("Created:", createdAt)
|
|
48188
48198
|
];
|
|
48189
48199
|
clack30.note(
|
|
48190
48200
|
lines.join("\n"),
|
|
48191
|
-
`Log Detail \u2014 ${
|
|
48201
|
+
`Log Detail \u2014 ${log63.messageId ?? "(no message id)"}`
|
|
48192
48202
|
);
|
|
48193
48203
|
}
|
|
48194
48204
|
|
|
@@ -55719,7 +55729,7 @@ import pc44 from "picocolors";
|
|
|
55719
55729
|
// src/utils/license.ts
|
|
55720
55730
|
init_esm_shims();
|
|
55721
55731
|
import { sign as sign2 } from "crypto";
|
|
55722
|
-
var VALID_TIERS = ["starter", "growth", "scale"];
|
|
55732
|
+
var VALID_TIERS = ["pro", "business", "starter", "growth", "scale"];
|
|
55723
55733
|
function generateLicenseKey(tier, expires) {
|
|
55724
55734
|
if (!VALID_TIERS.includes(tier)) {
|
|
55725
55735
|
throw new Error(
|
|
@@ -55743,7 +55753,7 @@ function generateLicenseKey(tier, expires) {
|
|
|
55743
55753
|
|
|
55744
55754
|
// src/commands/license/generate.ts
|
|
55745
55755
|
init_json_output();
|
|
55746
|
-
var VALID_TIERS2 = ["starter", "growth", "scale"];
|
|
55756
|
+
var VALID_TIERS2 = ["pro", "business", "starter", "growth", "scale"];
|
|
55747
55757
|
async function licenseGenerate(options) {
|
|
55748
55758
|
if (!isJsonMode()) {
|
|
55749
55759
|
clack43.intro(pc44.bold("Wraps License Key Generator"));
|
|
@@ -56305,11 +56315,6 @@ ${pc46.dim("Documentation:")}`);
|
|
|
56305
56315
|
}
|
|
56306
56316
|
async function permissions(options) {
|
|
56307
56317
|
const startTime = Date.now();
|
|
56308
|
-
trackCommand("permissions", {
|
|
56309
|
-
json: options.json,
|
|
56310
|
-
preset: options.preset,
|
|
56311
|
-
service: options.service
|
|
56312
|
-
});
|
|
56313
56318
|
const policy = buildPolicy(options.service, options.preset);
|
|
56314
56319
|
if (isJsonMode()) {
|
|
56315
56320
|
jsonSuccess("permissions", {
|
|
@@ -56332,7 +56337,10 @@ async function permissions(options) {
|
|
|
56332
56337
|
}
|
|
56333
56338
|
trackCommand("permissions", {
|
|
56334
56339
|
success: true,
|
|
56335
|
-
duration_ms: Date.now() - startTime
|
|
56340
|
+
duration_ms: Date.now() - startTime,
|
|
56341
|
+
json: options.json,
|
|
56342
|
+
preset: options.preset,
|
|
56343
|
+
service: options.service
|
|
56336
56344
|
});
|
|
56337
56345
|
}
|
|
56338
56346
|
|
|
@@ -57305,54 +57313,285 @@ ${pc47.bold("Next Steps:")}`);
|
|
|
57305
57313
|
}
|
|
57306
57314
|
}
|
|
57307
57315
|
|
|
57316
|
+
// src/commands/platform/disconnect.ts
|
|
57317
|
+
init_esm_shims();
|
|
57318
|
+
init_dist();
|
|
57319
|
+
import {
|
|
57320
|
+
DeleteRoleCommand as DeleteRoleCommand2,
|
|
57321
|
+
DeleteRolePolicyCommand as DeleteRolePolicyCommand2,
|
|
57322
|
+
IAMClient as IAMClient4
|
|
57323
|
+
} from "@aws-sdk/client-iam";
|
|
57324
|
+
import { confirm as confirm22, intro as intro40, isCancel as isCancel30, log as log42, outro as outro27 } from "@clack/prompts";
|
|
57325
|
+
import * as pulumi27 from "@pulumi/pulumi";
|
|
57326
|
+
import pc48 from "picocolors";
|
|
57327
|
+
init_aws();
|
|
57328
|
+
init_errors();
|
|
57329
|
+
init_fs();
|
|
57330
|
+
init_json_output();
|
|
57331
|
+
init_metadata();
|
|
57332
|
+
init_output();
|
|
57333
|
+
init_prompts();
|
|
57334
|
+
init_pulumi();
|
|
57335
|
+
init_region_resolver();
|
|
57336
|
+
async function removeConsoleAccessRole(region) {
|
|
57337
|
+
const iam13 = new IAMClient4({ region });
|
|
57338
|
+
try {
|
|
57339
|
+
await iam13.send(
|
|
57340
|
+
new DeleteRolePolicyCommand2({
|
|
57341
|
+
RoleName: CONSOLE_ACCESS_ROLE_NAME,
|
|
57342
|
+
PolicyName: "wraps-console-access-policy"
|
|
57343
|
+
})
|
|
57344
|
+
);
|
|
57345
|
+
} catch (error) {
|
|
57346
|
+
if (!isAWSNotFoundError(error)) {
|
|
57347
|
+
throw error;
|
|
57348
|
+
}
|
|
57349
|
+
}
|
|
57350
|
+
try {
|
|
57351
|
+
await iam13.send(
|
|
57352
|
+
new DeleteRoleCommand2({ RoleName: CONSOLE_ACCESS_ROLE_NAME })
|
|
57353
|
+
);
|
|
57354
|
+
return true;
|
|
57355
|
+
} catch (error) {
|
|
57356
|
+
if (isAWSNotFoundError(error)) {
|
|
57357
|
+
return false;
|
|
57358
|
+
}
|
|
57359
|
+
throw error;
|
|
57360
|
+
}
|
|
57361
|
+
}
|
|
57362
|
+
async function disconnect(options) {
|
|
57363
|
+
const json = isJsonMode();
|
|
57364
|
+
if (!json) {
|
|
57365
|
+
intro40(pc48.bold("Disconnect from Wraps Platform"));
|
|
57366
|
+
}
|
|
57367
|
+
const progress = new DeploymentProgress();
|
|
57368
|
+
try {
|
|
57369
|
+
await progress.execute(
|
|
57370
|
+
"Checking Pulumi CLI installation",
|
|
57371
|
+
async () => await ensurePulumiInstalled()
|
|
57372
|
+
);
|
|
57373
|
+
const identity = await progress.execute(
|
|
57374
|
+
"Validating AWS credentials",
|
|
57375
|
+
async () => validateAWSCredentials()
|
|
57376
|
+
);
|
|
57377
|
+
const region = await resolveRegionForCommand({
|
|
57378
|
+
accountId: identity.accountId,
|
|
57379
|
+
optionRegion: options.region,
|
|
57380
|
+
label: "connection"
|
|
57381
|
+
});
|
|
57382
|
+
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
57383
|
+
if (!metadata) {
|
|
57384
|
+
progress.stop();
|
|
57385
|
+
if (json) {
|
|
57386
|
+
jsonError("platform.disconnect", {
|
|
57387
|
+
code: "NO_DEPLOYMENT",
|
|
57388
|
+
message: `No Wraps deployment found for account ${identity.accountId} in ${region}.`,
|
|
57389
|
+
suggestion: "Run `wraps email init` to deploy infrastructure first."
|
|
57390
|
+
});
|
|
57391
|
+
return;
|
|
57392
|
+
}
|
|
57393
|
+
log42.error(
|
|
57394
|
+
`No Wraps deployment found for account ${pc48.cyan(identity.accountId)} in region ${pc48.cyan(region)}`
|
|
57395
|
+
);
|
|
57396
|
+
process.exit(1);
|
|
57397
|
+
}
|
|
57398
|
+
const emailService = metadata.services.email;
|
|
57399
|
+
if (!emailService?.config) {
|
|
57400
|
+
progress.stop();
|
|
57401
|
+
if (json) {
|
|
57402
|
+
jsonError("platform.disconnect", {
|
|
57403
|
+
code: "NO_EMAIL_SERVICE",
|
|
57404
|
+
message: "No email service deployed in this region.",
|
|
57405
|
+
suggestion: "Run `wraps email init` first."
|
|
57406
|
+
});
|
|
57407
|
+
return;
|
|
57408
|
+
}
|
|
57409
|
+
log42.error("No email service deployed in this region.");
|
|
57410
|
+
process.exit(1);
|
|
57411
|
+
}
|
|
57412
|
+
if (!emailService.webhookSecret) {
|
|
57413
|
+
progress.stop();
|
|
57414
|
+
if (json) {
|
|
57415
|
+
jsonSuccess("platform.disconnect", {
|
|
57416
|
+
accountId: identity.accountId,
|
|
57417
|
+
region,
|
|
57418
|
+
disconnected: false,
|
|
57419
|
+
reason: "not connected"
|
|
57420
|
+
});
|
|
57421
|
+
return;
|
|
57422
|
+
}
|
|
57423
|
+
log42.info("This account is not connected to the Wraps Platform.");
|
|
57424
|
+
outro27("Nothing to do");
|
|
57425
|
+
return;
|
|
57426
|
+
}
|
|
57427
|
+
const stillSelfhosted = !!emailService.selfhostWebhook;
|
|
57428
|
+
if (!(options.force || options.yes || json)) {
|
|
57429
|
+
progress.stop();
|
|
57430
|
+
log42.warn(
|
|
57431
|
+
`SES events from AWS account ${pc48.cyan(identity.accountId)} will stop reaching ${pc48.cyan("app.wraps.dev")}.`
|
|
57432
|
+
);
|
|
57433
|
+
log42.info(
|
|
57434
|
+
[
|
|
57435
|
+
"This does NOT affect sending \u2014 your mail flows through your own SES.",
|
|
57436
|
+
`Wraps' cross-account IAM role (${pc48.cyan(CONSOLE_ACCESS_ROLE_NAME)}) will be deleted, revoking dashboard access to this account.`,
|
|
57437
|
+
stillSelfhosted ? `Your self-hosted control plane (${pc48.cyan(emailService.selfhostWebhook?.url ?? "self-hosted")}) keeps receiving events.` : "Dashboard email logs and analytics will stop updating for this account."
|
|
57438
|
+
].join("\n ")
|
|
57439
|
+
);
|
|
57440
|
+
const confirmed = await confirm22({
|
|
57441
|
+
message: "Disconnect from the Wraps Platform?",
|
|
57442
|
+
initialValue: false
|
|
57443
|
+
});
|
|
57444
|
+
if (isCancel30(confirmed) || !confirmed) {
|
|
57445
|
+
outro27("Disconnect cancelled");
|
|
57446
|
+
return;
|
|
57447
|
+
}
|
|
57448
|
+
}
|
|
57449
|
+
emailService.webhookSecret = void 0;
|
|
57450
|
+
emailService.webhookUrl = void 0;
|
|
57451
|
+
await saveConnectionMetadata(metadata);
|
|
57452
|
+
if (metadata.provider === "vercel" && !metadata.vercel) {
|
|
57453
|
+
progress.stop();
|
|
57454
|
+
metadata.vercel = await promptVercelConfig();
|
|
57455
|
+
}
|
|
57456
|
+
const stackConfig = buildEmailStackConfig(metadata, region, {
|
|
57457
|
+
webhook: void 0
|
|
57458
|
+
});
|
|
57459
|
+
await progress.execute("Removing platform event target", async () => {
|
|
57460
|
+
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
57461
|
+
const stack = await pulumi27.automation.LocalWorkspace.createOrSelectStack(
|
|
57462
|
+
{
|
|
57463
|
+
stackName: emailService.pulumiStackName || `wraps-${identity.accountId}-${region}`,
|
|
57464
|
+
projectName: "wraps-email",
|
|
57465
|
+
program: async () => {
|
|
57466
|
+
const result = await deployEmailStack(stackConfig);
|
|
57467
|
+
return {
|
|
57468
|
+
roleArn: result.roleArn,
|
|
57469
|
+
configSetName: result.configSetName,
|
|
57470
|
+
tableName: result.tableName,
|
|
57471
|
+
region: result.region
|
|
57472
|
+
};
|
|
57473
|
+
}
|
|
57474
|
+
},
|
|
57475
|
+
{
|
|
57476
|
+
workDir: getPulumiWorkDir(),
|
|
57477
|
+
envVars: {
|
|
57478
|
+
PULUMI_CONFIG_PASSPHRASE: "",
|
|
57479
|
+
AWS_REGION: region
|
|
57480
|
+
},
|
|
57481
|
+
secretsProvider: "passphrase"
|
|
57482
|
+
}
|
|
57483
|
+
);
|
|
57484
|
+
await stack.setConfig("aws:region", { value: region });
|
|
57485
|
+
await stack.refresh({ onOutput: () => {
|
|
57486
|
+
} });
|
|
57487
|
+
const stackState = await stack.exportStack();
|
|
57488
|
+
const resourceCount = stackState.deployment?.resources?.length ?? 0;
|
|
57489
|
+
if (resourceCount > 1) {
|
|
57490
|
+
stackConfig.skipResourceImports = true;
|
|
57491
|
+
}
|
|
57492
|
+
await stack.up({ onOutput: () => {
|
|
57493
|
+
} });
|
|
57494
|
+
});
|
|
57495
|
+
progress.succeed("Platform event target removed");
|
|
57496
|
+
const roleRemoved = await progress.execute(
|
|
57497
|
+
"Revoking dashboard access",
|
|
57498
|
+
async () => removeConsoleAccessRole(region)
|
|
57499
|
+
);
|
|
57500
|
+
metadata.platform = void 0;
|
|
57501
|
+
await saveConnectionMetadata(metadata);
|
|
57502
|
+
if (json) {
|
|
57503
|
+
jsonSuccess("platform.disconnect", {
|
|
57504
|
+
accountId: identity.accountId,
|
|
57505
|
+
region,
|
|
57506
|
+
disconnected: true,
|
|
57507
|
+
selfhostWebhookRetained: stillSelfhosted,
|
|
57508
|
+
consoleAccessRoleRemoved: roleRemoved
|
|
57509
|
+
});
|
|
57510
|
+
return;
|
|
57511
|
+
}
|
|
57512
|
+
console.log();
|
|
57513
|
+
log42.success("Disconnected from the Wraps Platform.");
|
|
57514
|
+
console.log();
|
|
57515
|
+
console.log(
|
|
57516
|
+
` SES events from ${pc48.cyan(identity.accountId)} no longer reach app.wraps.dev.`
|
|
57517
|
+
);
|
|
57518
|
+
console.log(
|
|
57519
|
+
roleRemoved ? ` Wraps' cross-account access role was deleted \u2014 the dashboard can no longer read this account.` : " No cross-account access role was present to remove."
|
|
57520
|
+
);
|
|
57521
|
+
if (stillSelfhosted) {
|
|
57522
|
+
console.log(
|
|
57523
|
+
` Your self-hosted plane at ${pc48.cyan(emailService.selfhostWebhook?.url ?? "")} is unchanged.`
|
|
57524
|
+
);
|
|
57525
|
+
}
|
|
57526
|
+
console.log(
|
|
57527
|
+
pc48.dim(` Reconnect any time with ${pc48.cyan("wraps platform connect")}.`)
|
|
57528
|
+
);
|
|
57529
|
+
console.log();
|
|
57530
|
+
outro27("Done");
|
|
57531
|
+
} catch (error) {
|
|
57532
|
+
progress.stop();
|
|
57533
|
+
if (json) {
|
|
57534
|
+
jsonError("platform.disconnect", {
|
|
57535
|
+
code: "DISCONNECT_FAILED",
|
|
57536
|
+
message: error instanceof Error ? error.message : String(error)
|
|
57537
|
+
});
|
|
57538
|
+
return;
|
|
57539
|
+
}
|
|
57540
|
+
throw error;
|
|
57541
|
+
}
|
|
57542
|
+
}
|
|
57543
|
+
|
|
57308
57544
|
// src/commands/platform/index.ts
|
|
57309
57545
|
init_esm_shims();
|
|
57310
57546
|
import * as clack46 from "@clack/prompts";
|
|
57311
|
-
import
|
|
57547
|
+
import pc49 from "picocolors";
|
|
57312
57548
|
async function platform2() {
|
|
57313
|
-
clack46.intro(
|
|
57549
|
+
clack46.intro(pc49.bold("Wraps Platform"));
|
|
57314
57550
|
console.log();
|
|
57315
57551
|
console.log(
|
|
57316
57552
|
" The Wraps Platform extends the free CLI with hosted features:"
|
|
57317
57553
|
);
|
|
57318
57554
|
console.log();
|
|
57319
|
-
console.log(` ${
|
|
57320
|
-
console.log(` ${
|
|
57321
|
-
console.log(` ${
|
|
57322
|
-
console.log(` ${
|
|
57323
|
-
console.log(` ${
|
|
57324
|
-
console.log(` ${
|
|
57325
|
-
console.log(` ${
|
|
57555
|
+
console.log(` ${pc49.bold("Features:")}`);
|
|
57556
|
+
console.log(` ${pc49.green("\u2713")} Visual email template editor`);
|
|
57557
|
+
console.log(` ${pc49.green("\u2713")} Broadcast campaigns & scheduling`);
|
|
57558
|
+
console.log(` ${pc49.green("\u2713")} Contact management & segments`);
|
|
57559
|
+
console.log(` ${pc49.green("\u2713")} Workflow automations`);
|
|
57560
|
+
console.log(` ${pc49.green("\u2713")} Analytics dashboard`);
|
|
57561
|
+
console.log(` ${pc49.green("\u2713")} Team collaboration`);
|
|
57326
57562
|
console.log();
|
|
57327
|
-
console.log(` ${
|
|
57328
|
-
console.log(` ${
|
|
57329
|
-
console.log(` ${
|
|
57330
|
-
console.log(` ${
|
|
57331
|
-
console.log(` ${
|
|
57563
|
+
console.log(` ${pc49.bold("Pricing:")}`);
|
|
57564
|
+
console.log(` ${pc49.cyan("Starter")} $10/mo 5,000 contacts`);
|
|
57565
|
+
console.log(` ${pc49.cyan("Growth")} $25/mo 25,000 contacts`);
|
|
57566
|
+
console.log(` ${pc49.cyan("Scale")} $50/mo 100,000 contacts`);
|
|
57567
|
+
console.log(` ${pc49.cyan("Enterprise")} Custom Unlimited contacts`);
|
|
57332
57568
|
console.log();
|
|
57333
57569
|
console.log(
|
|
57334
|
-
|
|
57570
|
+
pc49.dim(" + AWS costs at $0.10 per 1,000 emails (paid directly to AWS)")
|
|
57335
57571
|
);
|
|
57336
57572
|
console.log();
|
|
57337
57573
|
console.log(
|
|
57338
|
-
` ${
|
|
57574
|
+
` ${pc49.bold("Learn more:")} ${pc49.cyan("https://wraps.dev/platform")}`
|
|
57339
57575
|
);
|
|
57340
57576
|
console.log();
|
|
57341
|
-
console.log(
|
|
57577
|
+
console.log(pc49.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
57342
57578
|
console.log();
|
|
57343
|
-
console.log(` ${
|
|
57579
|
+
console.log(` ${pc49.bold("Platform Commands:")}`);
|
|
57344
57580
|
console.log();
|
|
57345
57581
|
console.log(
|
|
57346
|
-
` ${
|
|
57582
|
+
` ${pc49.cyan("wraps platform connect")} Connect infrastructure to Wraps Platform`
|
|
57347
57583
|
);
|
|
57348
57584
|
console.log(
|
|
57349
|
-
` ${
|
|
57585
|
+
` ${pc49.cyan("wraps platform disconnect")} Stop streaming events to Wraps Platform`
|
|
57586
|
+
);
|
|
57587
|
+
console.log(
|
|
57588
|
+
` ${pc49.cyan("wraps platform update-role")} Update IAM permissions for dashboard`
|
|
57350
57589
|
);
|
|
57351
57590
|
console.log();
|
|
57352
57591
|
console.log(
|
|
57353
|
-
|
|
57592
|
+
pc49.dim(" The connect command sets up event streaming and IAM permissions")
|
|
57354
57593
|
);
|
|
57355
|
-
console.log(
|
|
57594
|
+
console.log(pc49.dim(" in one step. Run it after deploying infrastructure."));
|
|
57356
57595
|
console.log();
|
|
57357
57596
|
}
|
|
57358
57597
|
|
|
@@ -57368,15 +57607,15 @@ init_region_resolver();
|
|
|
57368
57607
|
import {
|
|
57369
57608
|
CreateRoleCommand as CreateRoleCommand2,
|
|
57370
57609
|
GetRoleCommand as GetRoleCommand2,
|
|
57371
|
-
IAMClient as
|
|
57610
|
+
IAMClient as IAMClient5,
|
|
57372
57611
|
UpdateAssumeRolePolicyCommand as UpdateAssumeRolePolicyCommand2
|
|
57373
57612
|
} from "@aws-sdk/client-iam";
|
|
57374
|
-
import { confirm as
|
|
57375
|
-
import
|
|
57613
|
+
import { confirm as confirm23, intro as intro42, isCancel as isCancel31, log as log43, outro as outro28 } from "@clack/prompts";
|
|
57614
|
+
import pc50 from "picocolors";
|
|
57376
57615
|
async function updateRole(options) {
|
|
57377
57616
|
const startTime = Date.now();
|
|
57378
57617
|
if (!isJsonMode()) {
|
|
57379
|
-
|
|
57618
|
+
intro42(pc50.bold("Update Platform Access Role"));
|
|
57380
57619
|
}
|
|
57381
57620
|
const progress = new DeploymentProgress();
|
|
57382
57621
|
const identity = await progress.execute(
|
|
@@ -57391,19 +57630,19 @@ async function updateRole(options) {
|
|
|
57391
57630
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
57392
57631
|
if (!metadata) {
|
|
57393
57632
|
progress.stop();
|
|
57394
|
-
|
|
57395
|
-
`No Wraps deployment found for account ${
|
|
57633
|
+
log43.error(
|
|
57634
|
+
`No Wraps deployment found for account ${pc50.cyan(identity.accountId)} in region ${pc50.cyan(region)}`
|
|
57396
57635
|
);
|
|
57397
57636
|
console.log(
|
|
57398
57637
|
`
|
|
57399
|
-
Run ${
|
|
57638
|
+
Run ${pc50.cyan("wraps email init")} to deploy infrastructure first.
|
|
57400
57639
|
`
|
|
57401
57640
|
);
|
|
57402
57641
|
process.exit(1);
|
|
57403
57642
|
}
|
|
57404
57643
|
const selfhosted = options.selfhosted === true;
|
|
57405
57644
|
const roleName = selfhosted ? SELFHOST_CONSOLE_ACCESS_ROLE_NAME : CONSOLE_ACCESS_ROLE_NAME;
|
|
57406
|
-
const iam13 = new
|
|
57645
|
+
const iam13 = new IAMClient5({ region: "us-east-1" });
|
|
57407
57646
|
const WRAPS_PLATFORM_ACCOUNT_ID2 = "905130073023";
|
|
57408
57647
|
const trustedAccountId = selfhosted ? metadata.accountId : WRAPS_PLATFORM_ACCOUNT_ID2;
|
|
57409
57648
|
let roleExists2 = false;
|
|
@@ -57419,13 +57658,13 @@ Run ${pc49.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
57419
57658
|
const externalId = selfhosted ? metadata.selfhostPlatform?.externalId : metadata.platform?.externalId;
|
|
57420
57659
|
if (!(roleExists2 || externalId)) {
|
|
57421
57660
|
progress.stop();
|
|
57422
|
-
|
|
57661
|
+
log43.warn(`IAM role ${pc50.cyan(roleName)} does not exist`);
|
|
57423
57662
|
if (selfhosted) {
|
|
57424
57663
|
console.log(
|
|
57425
57664
|
"\nThis role is created when your self-hosted control plane connects this AWS account."
|
|
57426
57665
|
);
|
|
57427
57666
|
console.log(
|
|
57428
|
-
`Run ${
|
|
57667
|
+
`Run ${pc50.cyan("wraps selfhost connect")} to create the role automatically.
|
|
57429
57668
|
`
|
|
57430
57669
|
);
|
|
57431
57670
|
} else {
|
|
@@ -57433,28 +57672,28 @@ Run ${pc49.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
57433
57672
|
"\nThis role is created when you connect AWS accounts through the Wraps Platform."
|
|
57434
57673
|
);
|
|
57435
57674
|
console.log(
|
|
57436
|
-
`Run ${
|
|
57675
|
+
`Run ${pc50.cyan("wraps platform connect")} while logged in to create the role automatically.
|
|
57437
57676
|
`
|
|
57438
57677
|
);
|
|
57439
57678
|
}
|
|
57440
57679
|
process.exit(0);
|
|
57441
57680
|
}
|
|
57442
57681
|
if (roleExists2) {
|
|
57443
|
-
progress.info(`Found IAM role: ${
|
|
57682
|
+
progress.info(`Found IAM role: ${pc50.cyan(roleName)}`);
|
|
57444
57683
|
} else {
|
|
57445
57684
|
progress.info(
|
|
57446
|
-
`IAM role ${
|
|
57685
|
+
`IAM role ${pc50.cyan(roleName)} not found \u2014 will create it using stored externalId`
|
|
57447
57686
|
);
|
|
57448
57687
|
}
|
|
57449
57688
|
if (!options.force) {
|
|
57450
57689
|
progress.stop();
|
|
57451
57690
|
const actionLabel = roleExists2 ? "Update" : "Create";
|
|
57452
|
-
const shouldContinue = await
|
|
57453
|
-
message: `${actionLabel} IAM role ${
|
|
57691
|
+
const shouldContinue = await confirm23({
|
|
57692
|
+
message: `${actionLabel} IAM role ${pc50.cyan(roleName)} with latest permissions?`,
|
|
57454
57693
|
initialValue: true
|
|
57455
57694
|
});
|
|
57456
|
-
if (
|
|
57457
|
-
|
|
57695
|
+
if (isCancel31(shouldContinue) || !shouldContinue) {
|
|
57696
|
+
outro28(`${actionLabel} cancelled`);
|
|
57458
57697
|
process.exit(0);
|
|
57459
57698
|
}
|
|
57460
57699
|
}
|
|
@@ -57560,51 +57799,51 @@ Run ${pc49.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
57560
57799
|
});
|
|
57561
57800
|
return;
|
|
57562
57801
|
}
|
|
57563
|
-
|
|
57802
|
+
outro28(pc50.green(`\u2713 Platform access role ${actionVerb} successfully`));
|
|
57564
57803
|
console.log(`
|
|
57565
|
-
${
|
|
57804
|
+
${pc50.bold("Permissions:")}`);
|
|
57566
57805
|
console.log(`
|
|
57567
|
-
${
|
|
57806
|
+
${pc50.bold(pc50.cyan("Email:"))}`);
|
|
57568
57807
|
console.log(
|
|
57569
|
-
` ${
|
|
57808
|
+
` ${pc50.green("\u2713")} SES metrics and identity verification (always enabled)`
|
|
57570
57809
|
);
|
|
57571
|
-
console.log(` ${
|
|
57572
|
-
console.log(` ${
|
|
57810
|
+
console.log(` ${pc50.green("\u2713")} SES template management (always enabled)`);
|
|
57811
|
+
console.log(` ${pc50.green("\u2713")} Inbound bucket detection (always enabled)`);
|
|
57573
57812
|
if (sendingEnabled) {
|
|
57574
|
-
console.log(` ${
|
|
57813
|
+
console.log(` ${pc50.green("\u2713")} Email sending via SES`);
|
|
57575
57814
|
}
|
|
57576
57815
|
console.log(
|
|
57577
|
-
` ${
|
|
57816
|
+
` ${pc50.green("\u2713")} DynamoDB read access (including DescribeTable)`
|
|
57578
57817
|
);
|
|
57579
57818
|
if (eventTracking?.enabled) {
|
|
57580
|
-
console.log(` ${
|
|
57819
|
+
console.log(` ${pc50.green("\u2713")} EventBridge and SQS access`);
|
|
57581
57820
|
}
|
|
57582
57821
|
if (emailArchiving?.enabled) {
|
|
57583
|
-
console.log(` ${
|
|
57822
|
+
console.log(` ${pc50.green("\u2713")} Mail Manager Archive access`);
|
|
57584
57823
|
}
|
|
57585
57824
|
const inbound = emailConfig?.inbound;
|
|
57586
57825
|
if (inbound?.enabled) {
|
|
57587
|
-
console.log(` ${
|
|
57826
|
+
console.log(` ${pc50.green("\u2713")} S3 access for inbound email`);
|
|
57588
57827
|
}
|
|
57589
57828
|
if (smsEnabled) {
|
|
57590
57829
|
console.log(`
|
|
57591
|
-
${
|
|
57830
|
+
${pc50.bold(pc50.cyan("SMS:"))}`);
|
|
57592
57831
|
console.log(
|
|
57593
|
-
` ${
|
|
57832
|
+
` ${pc50.green("\u2713")} SMS Voice V2 read access (phone numbers, config, registrations)`
|
|
57594
57833
|
);
|
|
57595
57834
|
if (smsSendingEnabled) {
|
|
57596
|
-
console.log(` ${
|
|
57835
|
+
console.log(` ${pc50.green("\u2713")} SMS sending via SMS Voice V2`);
|
|
57597
57836
|
}
|
|
57598
57837
|
if (smsEventTracking?.dynamoDBHistory) {
|
|
57599
|
-
console.log(` ${
|
|
57838
|
+
console.log(` ${pc50.green("\u2713")} DynamoDB read access for SMS history`);
|
|
57600
57839
|
}
|
|
57601
57840
|
if (smsEventTracking?.enabled) {
|
|
57602
|
-
console.log(` ${
|
|
57841
|
+
console.log(` ${pc50.green("\u2713")} SNS topic access for SMS events`);
|
|
57603
57842
|
}
|
|
57604
57843
|
}
|
|
57605
57844
|
console.log(
|
|
57606
57845
|
`
|
|
57607
|
-
${
|
|
57846
|
+
${pc50.dim(`The Wraps Platform will now have ${actionVerb} permissions for feature detection.`)}
|
|
57608
57847
|
`
|
|
57609
57848
|
);
|
|
57610
57849
|
}
|
|
@@ -57802,12 +58041,12 @@ function buildConsolePolicyDocument2(emailConfig, smsConfig) {
|
|
|
57802
58041
|
init_esm_shims();
|
|
57803
58042
|
init_events();
|
|
57804
58043
|
import * as clack47 from "@clack/prompts";
|
|
57805
|
-
import
|
|
58044
|
+
import pc51 from "picocolors";
|
|
57806
58045
|
|
|
57807
58046
|
// src/utils/selfhost/email-stack.ts
|
|
57808
58047
|
init_esm_shims();
|
|
57809
58048
|
init_dist();
|
|
57810
|
-
import { GetRoleCommand as GetRoleCommand3, IAMClient as
|
|
58049
|
+
import { GetRoleCommand as GetRoleCommand3, IAMClient as IAMClient6 } from "@aws-sdk/client-iam";
|
|
57811
58050
|
import {
|
|
57812
58051
|
ListConfigurationSetsCommand as ListConfigurationSetsCommand2,
|
|
57813
58052
|
ListEmailIdentitiesCommand,
|
|
@@ -57815,7 +58054,7 @@ import {
|
|
|
57815
58054
|
} from "@aws-sdk/client-sesv2";
|
|
57816
58055
|
async function detectEmailStack(region) {
|
|
57817
58056
|
try {
|
|
57818
|
-
const iam13 = new
|
|
58057
|
+
const iam13 = new IAMClient6({ region });
|
|
57819
58058
|
const ses = new SESv2Client9({ region });
|
|
57820
58059
|
const [roleResult, setsResult, identitiesResult] = await Promise.allSettled(
|
|
57821
58060
|
[
|
|
@@ -57866,7 +58105,7 @@ init_region_resolver();
|
|
|
57866
58105
|
async function selfhostEnv(options) {
|
|
57867
58106
|
const startTime = Date.now();
|
|
57868
58107
|
if (!isJsonMode()) {
|
|
57869
|
-
clack47.intro(
|
|
58108
|
+
clack47.intro(pc51.bold("Wraps Self-Hosted \u2014 Vercel Environment Variables"));
|
|
57870
58109
|
}
|
|
57871
58110
|
const identity = await validateAWSCredentials();
|
|
57872
58111
|
const region = await resolveRegionForCommand({
|
|
@@ -57880,7 +58119,7 @@ async function selfhostEnv(options) {
|
|
|
57880
58119
|
clack47.log.error("No self-hosted deployment found");
|
|
57881
58120
|
console.log(
|
|
57882
58121
|
`
|
|
57883
|
-
Run ${
|
|
58122
|
+
Run ${pc51.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hosted control plane.
|
|
57884
58123
|
`
|
|
57885
58124
|
);
|
|
57886
58125
|
process.exit(1);
|
|
@@ -57894,7 +58133,7 @@ Run ${pc50.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
57894
58133
|
);
|
|
57895
58134
|
console.log(
|
|
57896
58135
|
`
|
|
57897
|
-
The deployment may have failed partway through. Run ${
|
|
58136
|
+
The deployment may have failed partway through. Run ${pc51.cyan("pnpm selfhost:upgrade")} from your fork to complete it.
|
|
57898
58137
|
`
|
|
57899
58138
|
);
|
|
57900
58139
|
process.exit(1);
|
|
@@ -58000,7 +58239,7 @@ The deployment may have failed partway through. Run ${pc50.cyan("pnpm selfhost:u
|
|
|
58000
58239
|
`# AWS_ROLE_ARN=arn:aws:iam::${identity.accountId}:role/<your-vercel-backend-role>`
|
|
58001
58240
|
);
|
|
58002
58241
|
clack47.outro(
|
|
58003
|
-
|
|
58242
|
+
pc51.dim(
|
|
58004
58243
|
"Paste into Vercel \u2192 Settings \u2192 Environment Variables \u2192 Add from .env"
|
|
58005
58244
|
)
|
|
58006
58245
|
);
|
|
@@ -58015,7 +58254,7 @@ init_esm_shims();
|
|
|
58015
58254
|
init_events();
|
|
58016
58255
|
import * as clack48 from "@clack/prompts";
|
|
58017
58256
|
import open2 from "open";
|
|
58018
|
-
import
|
|
58257
|
+
import pc52 from "picocolors";
|
|
58019
58258
|
init_aws();
|
|
58020
58259
|
init_config();
|
|
58021
58260
|
init_json_output();
|
|
@@ -58024,7 +58263,7 @@ init_region_resolver();
|
|
|
58024
58263
|
async function selfhostLogin(options) {
|
|
58025
58264
|
const startTime = Date.now();
|
|
58026
58265
|
if (!isJsonMode()) {
|
|
58027
|
-
clack48.intro(
|
|
58266
|
+
clack48.intro(pc52.bold("Wraps Self-Hosted \u203A Sign In"));
|
|
58028
58267
|
}
|
|
58029
58268
|
const identity = await validateAWSCredentials();
|
|
58030
58269
|
const region = await resolveRegionForCommand({
|
|
@@ -58038,7 +58277,7 @@ async function selfhostLogin(options) {
|
|
|
58038
58277
|
clack48.log.error("No self-hosted deployment found.");
|
|
58039
58278
|
console.log(
|
|
58040
58279
|
`
|
|
58041
|
-
Run ${
|
|
58280
|
+
Run ${pc52.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hosted control plane first.
|
|
58042
58281
|
`
|
|
58043
58282
|
);
|
|
58044
58283
|
process.exit(1);
|
|
@@ -58046,7 +58285,7 @@ Run ${pc51.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58046
58285
|
}
|
|
58047
58286
|
const { appUrl: baseURL } = metadata.services.selfhost.config;
|
|
58048
58287
|
const apiUrl = await reconcileSelfhostApiUrl(metadata, region);
|
|
58049
|
-
clack48.log.info(`Connecting to: ${
|
|
58288
|
+
clack48.log.info(`Connecting to: ${pc52.cyan(baseURL)}`);
|
|
58050
58289
|
const authClient = createCliAuthClient(baseURL);
|
|
58051
58290
|
const spinner11 = clack48.spinner();
|
|
58052
58291
|
const { data: codeData, error: codeError } = await authClient.device.code({
|
|
@@ -58062,14 +58301,14 @@ Run ${pc51.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58062
58301
|
step: "request_code"
|
|
58063
58302
|
});
|
|
58064
58303
|
clack48.log.error(
|
|
58065
|
-
`Failed to reach ${
|
|
58304
|
+
`Failed to reach ${pc52.cyan(baseURL)}. Make sure the dashboard is deployed and reachable.`
|
|
58066
58305
|
);
|
|
58067
58306
|
throw new Error("Failed to start device authorization.");
|
|
58068
58307
|
}
|
|
58069
58308
|
const { device_code, user_code, interval, expires_in } = codeData;
|
|
58070
58309
|
const formatted = `${user_code.slice(0, 4)}-${user_code.slice(4)}`;
|
|
58071
|
-
clack48.log.info(`Your code: ${
|
|
58072
|
-
clack48.log.info(`Visit: ${
|
|
58310
|
+
clack48.log.info(`Your code: ${pc52.bold(pc52.cyan(formatted))}`);
|
|
58311
|
+
clack48.log.info(`Visit: ${pc52.underline(`${baseURL}/device`)}`);
|
|
58073
58312
|
try {
|
|
58074
58313
|
await open2(`${baseURL}/device?user_code=${user_code}`);
|
|
58075
58314
|
clack48.log.info("Opening browser...");
|
|
@@ -58106,18 +58345,18 @@ Run ${pc51.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58106
58345
|
});
|
|
58107
58346
|
clack48.log.success("Signed in to your self-hosted Wraps instance.");
|
|
58108
58347
|
if (organizations.length === 1) {
|
|
58109
|
-
clack48.log.info(`Organization: ${
|
|
58348
|
+
clack48.log.info(`Organization: ${pc52.cyan(organizations[0].name)}`);
|
|
58110
58349
|
} else if (organizations.length > 1) {
|
|
58111
58350
|
clack48.log.info(`${organizations.length} organizations available`);
|
|
58112
58351
|
} else {
|
|
58113
58352
|
clack48.log.info(
|
|
58114
|
-
`No organizations found. Create one at ${
|
|
58353
|
+
`No organizations found. Create one at ${pc52.underline(`${baseURL}/onboarding`)} and run ${pc52.cyan("wraps selfhost login")} again.`
|
|
58115
58354
|
);
|
|
58116
58355
|
}
|
|
58117
58356
|
if (isJsonMode()) {
|
|
58118
58357
|
jsonSuccess("selfhost.login", { tokenType: "session", organizations });
|
|
58119
58358
|
} else {
|
|
58120
|
-
clack48.outro(
|
|
58359
|
+
clack48.outro(pc52.green("Done!"));
|
|
58121
58360
|
}
|
|
58122
58361
|
return;
|
|
58123
58362
|
}
|
|
@@ -58165,10 +58404,10 @@ init_json_output();
|
|
|
58165
58404
|
init_metadata();
|
|
58166
58405
|
init_region_resolver();
|
|
58167
58406
|
import * as clack49 from "@clack/prompts";
|
|
58168
|
-
import
|
|
58407
|
+
import pc53 from "picocolors";
|
|
58169
58408
|
async function selfhostLogout(options) {
|
|
58170
58409
|
if (!isJsonMode()) {
|
|
58171
|
-
clack49.intro(
|
|
58410
|
+
clack49.intro(pc53.bold("Wraps Self-Hosted \u203A Sign Out"));
|
|
58172
58411
|
}
|
|
58173
58412
|
const identity = await validateAWSCredentials();
|
|
58174
58413
|
const region = await resolveRegionForCommand({
|
|
@@ -58182,7 +58421,7 @@ async function selfhostLogout(options) {
|
|
|
58182
58421
|
clack49.log.error("No self-hosted deployment found.");
|
|
58183
58422
|
console.log(
|
|
58184
58423
|
`
|
|
58185
|
-
Run ${
|
|
58424
|
+
Run ${pc53.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hosted control plane first.
|
|
58186
58425
|
`
|
|
58187
58426
|
);
|
|
58188
58427
|
process.exit(1);
|
|
@@ -58201,7 +58440,7 @@ Run ${pc52.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58201
58440
|
});
|
|
58202
58441
|
return;
|
|
58203
58442
|
}
|
|
58204
|
-
clack49.log.info(`Not signed in to ${
|
|
58443
|
+
clack49.log.info(`Not signed in to ${pc53.cyan(baseURL)}.`);
|
|
58205
58444
|
return;
|
|
58206
58445
|
}
|
|
58207
58446
|
await clearSelfhostAuth(baseURL);
|
|
@@ -58210,13 +58449,13 @@ Run ${pc52.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58210
58449
|
jsonSuccess("selfhost.logout", { loggedOut: true });
|
|
58211
58450
|
return;
|
|
58212
58451
|
}
|
|
58213
|
-
clack49.log.success(`Signed out of ${
|
|
58452
|
+
clack49.log.success(`Signed out of ${pc53.cyan(baseURL)}.`);
|
|
58214
58453
|
}
|
|
58215
58454
|
|
|
58216
58455
|
// src/commands/selfhost/logs.ts
|
|
58217
58456
|
init_esm_shims();
|
|
58218
58457
|
import * as clack50 from "@clack/prompts";
|
|
58219
|
-
import
|
|
58458
|
+
import pc54 from "picocolors";
|
|
58220
58459
|
|
|
58221
58460
|
// src/utils/selfhost/logs.ts
|
|
58222
58461
|
init_esm_shims();
|
|
@@ -58555,10 +58794,10 @@ var MAX_INTERVAL_SECONDS = 60;
|
|
|
58555
58794
|
var FOLLOW_BACKFILL_MS = 5 * 60 * 1e3;
|
|
58556
58795
|
var MAX_ENTRIES = 1e3;
|
|
58557
58796
|
var SOURCE_COLORS = {
|
|
58558
|
-
api:
|
|
58559
|
-
web:
|
|
58560
|
-
workers:
|
|
58561
|
-
other:
|
|
58797
|
+
api: pc54.cyan,
|
|
58798
|
+
web: pc54.magenta,
|
|
58799
|
+
workers: pc54.blue,
|
|
58800
|
+
other: pc54.gray
|
|
58562
58801
|
};
|
|
58563
58802
|
function formatTime(timestamp) {
|
|
58564
58803
|
const date2 = new Date(timestamp);
|
|
@@ -58567,25 +58806,25 @@ function formatTime(timestamp) {
|
|
|
58567
58806
|
}
|
|
58568
58807
|
function colorLevel(level) {
|
|
58569
58808
|
if (!level) {
|
|
58570
|
-
return
|
|
58809
|
+
return pc54.dim(" ");
|
|
58571
58810
|
}
|
|
58572
58811
|
const padded = level.padEnd(5).slice(0, 5);
|
|
58573
58812
|
if (level === "ERROR" || level === "FATAL" || level === "CRITICAL") {
|
|
58574
|
-
return
|
|
58813
|
+
return pc54.red(padded);
|
|
58575
58814
|
}
|
|
58576
58815
|
if (level === "WARN") {
|
|
58577
|
-
return
|
|
58816
|
+
return pc54.yellow(padded);
|
|
58578
58817
|
}
|
|
58579
58818
|
if (level === "INFO") {
|
|
58580
|
-
return
|
|
58819
|
+
return pc54.green(padded);
|
|
58581
58820
|
}
|
|
58582
|
-
return
|
|
58821
|
+
return pc54.dim(padded);
|
|
58583
58822
|
}
|
|
58584
58823
|
function renderEntry(entry, options) {
|
|
58585
58824
|
const level = detectLevel(entry.message);
|
|
58586
58825
|
const label = logSourceLabel(entry.source).padEnd(options.sourceWidth);
|
|
58587
58826
|
const body = options.verbose ? entry.message : formatMessageBody(entry.message);
|
|
58588
|
-
return `${
|
|
58827
|
+
return `${pc54.dim(formatTime(entry.timestamp))} ${SOURCE_COLORS[entry.source](label)} ${colorLevel(level)} ${body}`;
|
|
58589
58828
|
}
|
|
58590
58829
|
function toJsonEntry(entry) {
|
|
58591
58830
|
return {
|
|
@@ -58656,17 +58895,17 @@ function printGroupSummary(groups) {
|
|
|
58656
58895
|
bySource.set(group4.source, existing);
|
|
58657
58896
|
}
|
|
58658
58897
|
const parts = [...bySource.entries()].map(
|
|
58659
|
-
([source, names]) => `${SOURCE_COLORS[source](logSourceLabel(source))} ${
|
|
58898
|
+
([source, names]) => `${SOURCE_COLORS[source](logSourceLabel(source))} ${pc54.dim(`(${names.length})`)}`
|
|
58660
58899
|
);
|
|
58661
58900
|
console.log(
|
|
58662
|
-
`${
|
|
58901
|
+
`${pc54.dim("Sources:")} ${parts.join(pc54.dim(" \xB7 "))} ${pc54.dim(`${groups.length} log group${groups.length === 1 ? "" : "s"}`)}`
|
|
58663
58902
|
);
|
|
58664
58903
|
}
|
|
58665
58904
|
async function selfhostLogs(options) {
|
|
58666
58905
|
const progress = new DeploymentProgress();
|
|
58667
58906
|
const json = isJsonMode();
|
|
58668
58907
|
if (!json) {
|
|
58669
|
-
clack50.intro(
|
|
58908
|
+
clack50.intro(pc54.bold("Wraps Self-Hosted Logs"));
|
|
58670
58909
|
}
|
|
58671
58910
|
const sinceMs = parseSince(options.since ?? DEFAULT_SINCE);
|
|
58672
58911
|
const intervalSeconds = parseInterval(options.interval);
|
|
@@ -58768,18 +59007,18 @@ async function printWindow(context, window) {
|
|
|
58768
59007
|
clack50.log.info(
|
|
58769
59008
|
window.errorsOnly ? `No errors in the last ${window.sinceLabel}.` : `No log events in the last ${window.sinceLabel}.`
|
|
58770
59009
|
);
|
|
58771
|
-
clack50.outro(
|
|
59010
|
+
clack50.outro(pc54.dim("Nothing to report"));
|
|
58772
59011
|
return;
|
|
58773
59012
|
}
|
|
58774
59013
|
context.emit(entries);
|
|
58775
59014
|
console.log("");
|
|
58776
59015
|
if (entries.length >= MAX_ENTRIES) {
|
|
58777
59016
|
clack50.log.warn(
|
|
58778
|
-
`Showing the most recent ${MAX_ENTRIES} events \u2014 narrow the window with ${
|
|
59017
|
+
`Showing the most recent ${MAX_ENTRIES} events \u2014 narrow the window with ${pc54.cyan("--since")} to see more.`
|
|
58779
59018
|
);
|
|
58780
59019
|
}
|
|
58781
59020
|
clack50.outro(
|
|
58782
|
-
|
|
59021
|
+
pc54.dim(
|
|
58783
59022
|
`${entries.length} event${entries.length === 1 ? "" : "s"} from the last ${window.sinceLabel}`
|
|
58784
59023
|
)
|
|
58785
59024
|
);
|
|
@@ -58788,17 +59027,17 @@ function printFollowHeader(context) {
|
|
|
58788
59027
|
printGroupSummary(context.groups);
|
|
58789
59028
|
if (context.live) {
|
|
58790
59029
|
console.log(
|
|
58791
|
-
|
|
59030
|
+
pc54.yellow(
|
|
58792
59031
|
"\u26A0 CloudWatch Live Tail bills ~$0.01/min for as long as this session is open."
|
|
58793
59032
|
)
|
|
58794
59033
|
);
|
|
58795
59034
|
console.log(
|
|
58796
|
-
|
|
59035
|
+
pc54.dim(`Live tailing \xB7 ${pc54.reset(pc54.bold("Ctrl+C"))} to stop`)
|
|
58797
59036
|
);
|
|
58798
59037
|
} else {
|
|
58799
59038
|
console.log(
|
|
58800
|
-
|
|
58801
|
-
`Polling every ${context.intervalSeconds}s \xB7 ${
|
|
59039
|
+
pc54.dim(
|
|
59040
|
+
`Polling every ${context.intervalSeconds}s \xB7 ${pc54.reset(pc54.bold("Ctrl+C"))} to stop`
|
|
58802
59041
|
)
|
|
58803
59042
|
);
|
|
58804
59043
|
}
|
|
@@ -58848,13 +59087,13 @@ async function follow(context) {
|
|
|
58848
59087
|
}
|
|
58849
59088
|
if (!context.json) {
|
|
58850
59089
|
console.log("");
|
|
58851
|
-
clack50.outro(
|
|
59090
|
+
clack50.outro(pc54.dim("Stopped"));
|
|
58852
59091
|
}
|
|
58853
59092
|
}
|
|
58854
59093
|
async function runLiveTail(context, control) {
|
|
58855
59094
|
if (context.groups.length > liveTailGroupLimit() && !context.json) {
|
|
58856
59095
|
clack50.log.warn(
|
|
58857
|
-
`Live Tail supports ${liveTailGroupLimit()} log groups per session \u2014 tailing the first ${liveTailGroupLimit()}. Use ${
|
|
59096
|
+
`Live Tail supports ${liveTailGroupLimit()} log groups per session \u2014 tailing the first ${liveTailGroupLimit()}. Use ${pc54.cyan("--source")} to choose which.`
|
|
58858
59097
|
);
|
|
58859
59098
|
}
|
|
58860
59099
|
const session = startSelfhostLiveTail({
|
|
@@ -58875,7 +59114,7 @@ async function runLiveTail(context, control) {
|
|
|
58875
59114
|
}
|
|
58876
59115
|
if (!(control.isStopped() || context.json)) {
|
|
58877
59116
|
clack50.log.warn(
|
|
58878
|
-
`Live Tail session ended (AWS caps sessions at ~3 hours). Run ${
|
|
59117
|
+
`Live Tail session ended (AWS caps sessions at ~3 hours). Run ${pc54.cyan("wraps selfhost logs --follow --live")} again to resume.`
|
|
58879
59118
|
);
|
|
58880
59119
|
}
|
|
58881
59120
|
}
|
|
@@ -58902,7 +59141,7 @@ function isAbortError(error) {
|
|
|
58902
59141
|
init_esm_shims();
|
|
58903
59142
|
init_events();
|
|
58904
59143
|
import * as clack51 from "@clack/prompts";
|
|
58905
|
-
import
|
|
59144
|
+
import pc55 from "picocolors";
|
|
58906
59145
|
init_aws();
|
|
58907
59146
|
init_json_output();
|
|
58908
59147
|
init_metadata();
|
|
@@ -58912,26 +59151,26 @@ function displaySelfhostStatus(options) {
|
|
|
58912
59151
|
const lines = [];
|
|
58913
59152
|
const incomplete = !(options.apiUrl && options.appUrl);
|
|
58914
59153
|
lines.push(
|
|
58915
|
-
incomplete ?
|
|
59154
|
+
incomplete ? pc55.bold(pc55.yellow("Self-Hosted Control Plane Incomplete")) : pc55.bold(pc55.green("Self-Hosted Control Plane Active"))
|
|
58916
59155
|
);
|
|
58917
59156
|
if (incomplete) {
|
|
58918
59157
|
lines.push(
|
|
58919
|
-
|
|
58920
|
-
`A previous deploy did not finish. Run ${
|
|
59158
|
+
pc55.yellow(
|
|
59159
|
+
`A previous deploy did not finish. Run ${pc55.cyan("pnpm selfhost:upgrade")} from your fork to complete it.`
|
|
58921
59160
|
)
|
|
58922
59161
|
);
|
|
58923
59162
|
}
|
|
58924
59163
|
lines.push("");
|
|
58925
|
-
lines.push(
|
|
58926
|
-
lines.push(` URL: ${
|
|
58927
|
-
lines.push(` Region: ${
|
|
58928
|
-
lines.push(` Deployed: ${
|
|
59164
|
+
lines.push(pc55.bold("API"));
|
|
59165
|
+
lines.push(` URL: ${pc55.cyan(options.apiUrl || "(not deployed)")}`);
|
|
59166
|
+
lines.push(` Region: ${pc55.cyan(options.region)}`);
|
|
59167
|
+
lines.push(` Deployed: ${pc55.dim(options.deployedAt)}`);
|
|
58929
59168
|
lines.push("");
|
|
58930
|
-
lines.push(
|
|
58931
|
-
lines.push(` App URL: ${
|
|
58932
|
-
lines.push(` License Key: ${
|
|
59169
|
+
lines.push(pc55.bold("Configuration"));
|
|
59170
|
+
lines.push(` App URL: ${pc55.cyan(options.appUrl || "(not deployed)")}`);
|
|
59171
|
+
lines.push(` License Key: ${pc55.dim(`${options.licenseKeyPrefix}...`)}`);
|
|
58933
59172
|
if (options.neonProjectId) {
|
|
58934
|
-
lines.push(` Neon Project: ${
|
|
59173
|
+
lines.push(` Neon Project: ${pc55.dim(options.neonProjectId)}`);
|
|
58935
59174
|
}
|
|
58936
59175
|
clack51.note(lines.join("\n"), "Self-Hosted Status");
|
|
58937
59176
|
}
|
|
@@ -58939,7 +59178,7 @@ async function selfhostStatus(options) {
|
|
|
58939
59178
|
const startTime = Date.now();
|
|
58940
59179
|
const progress = new DeploymentProgress();
|
|
58941
59180
|
if (!isJsonMode()) {
|
|
58942
|
-
clack51.intro(
|
|
59181
|
+
clack51.intro(pc55.bold("Wraps Self-Hosted Status"));
|
|
58943
59182
|
}
|
|
58944
59183
|
const identity = await progress.execute(
|
|
58945
59184
|
"Loading self-hosted status",
|
|
@@ -58957,7 +59196,7 @@ async function selfhostStatus(options) {
|
|
|
58957
59196
|
clack51.log.error("No self-hosted deployment found");
|
|
58958
59197
|
console.log(
|
|
58959
59198
|
`
|
|
58960
|
-
Run ${
|
|
59199
|
+
Run ${pc55.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hosted platform.
|
|
58961
59200
|
`
|
|
58962
59201
|
);
|
|
58963
59202
|
process.exit(1);
|
|
@@ -58980,24 +59219,24 @@ Run ${pc54.cyan("pnpm selfhost:deploy")} from your fork to deploy the self-hoste
|
|
|
58980
59219
|
}
|
|
58981
59220
|
displaySelfhostStatus(statusData);
|
|
58982
59221
|
console.log("");
|
|
58983
|
-
clack51.log.info(
|
|
59222
|
+
clack51.log.info(pc55.bold("Commands:"));
|
|
58984
59223
|
console.log(
|
|
58985
|
-
` ${
|
|
59224
|
+
` ${pc55.cyan("pnpm selfhost:upgrade")} (from your fork) - Redeploy the platform and run migrations`
|
|
58986
59225
|
);
|
|
58987
59226
|
trackCommand("selfhost:status", {
|
|
58988
59227
|
success: true,
|
|
58989
59228
|
duration_ms: Date.now() - startTime
|
|
58990
59229
|
});
|
|
58991
|
-
clack51.outro(
|
|
59230
|
+
clack51.outro(pc55.dim("Self-hosted deployment is active"));
|
|
58992
59231
|
}
|
|
58993
59232
|
|
|
58994
59233
|
// src/commands/shared/dashboard.ts
|
|
58995
59234
|
init_esm_shims();
|
|
58996
59235
|
import * as clack52 from "@clack/prompts";
|
|
58997
|
-
import * as
|
|
59236
|
+
import * as pulumi28 from "@pulumi/pulumi";
|
|
58998
59237
|
import getPort from "get-port";
|
|
58999
59238
|
import open3 from "open";
|
|
59000
|
-
import
|
|
59239
|
+
import pc56 from "picocolors";
|
|
59001
59240
|
|
|
59002
59241
|
// src/console/server.ts
|
|
59003
59242
|
init_esm_shims();
|
|
@@ -60197,13 +60436,13 @@ function createMetricsRouter(config2) {
|
|
|
60197
60436
|
const router = createRouter5();
|
|
60198
60437
|
router.get("/stream", async (req, res) => {
|
|
60199
60438
|
const connectionId = randomUUID().slice(0, 8);
|
|
60200
|
-
const
|
|
60439
|
+
const log63 = (msg, data) => {
|
|
60201
60440
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
60202
60441
|
};
|
|
60203
60442
|
res.setHeader("Content-Type", "text/event-stream");
|
|
60204
60443
|
res.setHeader("Cache-Control", "no-cache");
|
|
60205
60444
|
res.setHeader("Connection", "keep-alive");
|
|
60206
|
-
|
|
60445
|
+
log63("SSE connected");
|
|
60207
60446
|
res.write('data: {"type":"connected"}\n\n');
|
|
60208
60447
|
const { startTime, endTime } = req.query;
|
|
60209
60448
|
const getTimeRange = () => ({
|
|
@@ -60213,7 +60452,7 @@ function createMetricsRouter(config2) {
|
|
|
60213
60452
|
const sendMetrics = async () => {
|
|
60214
60453
|
try {
|
|
60215
60454
|
const timeRange = getTimeRange();
|
|
60216
|
-
|
|
60455
|
+
log63("Fetching metrics", {
|
|
60217
60456
|
start: timeRange.start.toISOString(),
|
|
60218
60457
|
end: timeRange.end.toISOString()
|
|
60219
60458
|
});
|
|
@@ -60226,7 +60465,7 @@ function createMetricsRouter(config2) {
|
|
|
60226
60465
|
),
|
|
60227
60466
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
60228
60467
|
]);
|
|
60229
|
-
|
|
60468
|
+
log63("Metrics fetched successfully");
|
|
60230
60469
|
const data = {
|
|
60231
60470
|
type: "metrics",
|
|
60232
60471
|
timestamp: Date.now(),
|
|
@@ -60256,7 +60495,7 @@ function createMetricsRouter(config2) {
|
|
|
60256
60495
|
const interval = setInterval(sendMetrics, 6e4);
|
|
60257
60496
|
req.on("close", () => {
|
|
60258
60497
|
clearInterval(interval);
|
|
60259
|
-
|
|
60498
|
+
log63("SSE disconnected");
|
|
60260
60499
|
});
|
|
60261
60500
|
});
|
|
60262
60501
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -61512,9 +61751,9 @@ function createUserRouter(config2) {
|
|
|
61512
61751
|
if (config2.roleArn) {
|
|
61513
61752
|
console.log("[User API] Attempting to fetch account alias via IAM");
|
|
61514
61753
|
const { assumeRole: assumeRole2 } = await Promise.resolve().then(() => (init_assume_role(), assume_role_exports));
|
|
61515
|
-
const { IAMClient:
|
|
61754
|
+
const { IAMClient: IAMClient7, ListAccountAliasesCommand } = await import("@aws-sdk/client-iam");
|
|
61516
61755
|
const credentials = await assumeRole2(config2.roleArn, region);
|
|
61517
|
-
const iamClient = new
|
|
61756
|
+
const iamClient = new IAMClient7({ region, credentials });
|
|
61518
61757
|
const response = await iamClient.send(
|
|
61519
61758
|
new ListAccountAliasesCommand({})
|
|
61520
61759
|
);
|
|
@@ -61651,7 +61890,7 @@ init_output();
|
|
|
61651
61890
|
init_pulumi();
|
|
61652
61891
|
async function dashboard(options) {
|
|
61653
61892
|
await ensurePulumiInstalled();
|
|
61654
|
-
clack52.intro(
|
|
61893
|
+
clack52.intro(pc56.bold("Wraps Dashboard"));
|
|
61655
61894
|
const progress = new DeploymentProgress();
|
|
61656
61895
|
const identity = await progress.execute(
|
|
61657
61896
|
"Validating AWS credentials",
|
|
@@ -61664,7 +61903,7 @@ async function dashboard(options) {
|
|
|
61664
61903
|
try {
|
|
61665
61904
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
61666
61905
|
try {
|
|
61667
|
-
const emailStack = await
|
|
61906
|
+
const emailStack = await pulumi28.automation.LocalWorkspace.selectStack({
|
|
61668
61907
|
stackName: `wraps-${identity.accountId}-${region}`,
|
|
61669
61908
|
workDir: getPulumiWorkDir()
|
|
61670
61909
|
});
|
|
@@ -61672,7 +61911,7 @@ async function dashboard(options) {
|
|
|
61672
61911
|
} catch (_emailError) {
|
|
61673
61912
|
}
|
|
61674
61913
|
try {
|
|
61675
|
-
const smsStack = await
|
|
61914
|
+
const smsStack = await pulumi28.automation.LocalWorkspace.selectStack({
|
|
61676
61915
|
stackName: `wraps-sms-${identity.accountId}-${region}`,
|
|
61677
61916
|
workDir: getPulumiWorkDir()
|
|
61678
61917
|
});
|
|
@@ -61680,7 +61919,7 @@ async function dashboard(options) {
|
|
|
61680
61919
|
} catch (_smsError) {
|
|
61681
61920
|
}
|
|
61682
61921
|
try {
|
|
61683
|
-
const cdnStack = await
|
|
61922
|
+
const cdnStack = await pulumi28.automation.LocalWorkspace.selectStack({
|
|
61684
61923
|
stackName: `wraps-cdn-${identity.accountId}-${region}`,
|
|
61685
61924
|
workDir: getPulumiWorkDir()
|
|
61686
61925
|
});
|
|
@@ -61694,7 +61933,7 @@ async function dashboard(options) {
|
|
|
61694
61933
|
progress.stop();
|
|
61695
61934
|
clack52.log.error("No Wraps infrastructure found");
|
|
61696
61935
|
console.log(
|
|
61697
|
-
`\\nRun ${
|
|
61936
|
+
`\\nRun ${pc56.cyan("wraps email init")}, ${pc56.cyan("wraps sms init")}, or ${pc56.cyan("wraps storage init")} to deploy infrastructure first.\\n`
|
|
61698
61937
|
);
|
|
61699
61938
|
process.exit(1);
|
|
61700
61939
|
}
|
|
@@ -61738,7 +61977,7 @@ async function dashboard(options) {
|
|
|
61738
61977
|
progress.stop();
|
|
61739
61978
|
clack52.log.success("Starting dashboard server...");
|
|
61740
61979
|
console.log(
|
|
61741
|
-
`${
|
|
61980
|
+
`${pc56.dim("Using current AWS credentials (no role assumption)")}\\n`
|
|
61742
61981
|
);
|
|
61743
61982
|
const { url } = await startConsoleServer({
|
|
61744
61983
|
port,
|
|
@@ -61771,8 +62010,8 @@ async function dashboard(options) {
|
|
|
61771
62010
|
cdnCustomDomain,
|
|
61772
62011
|
cdnCertificateArn
|
|
61773
62012
|
});
|
|
61774
|
-
console.log(`\\n${
|
|
61775
|
-
console.log(`${
|
|
62013
|
+
console.log(`\\n${pc56.bold("Dashboard:")} ${pc56.cyan(url)}`);
|
|
62014
|
+
console.log(`${pc56.dim("Press Ctrl+C to stop")}\\n`);
|
|
61776
62015
|
getTelemetryClient().showFooterOnce();
|
|
61777
62016
|
if (!options.noOpen) {
|
|
61778
62017
|
await open3(url);
|
|
@@ -61794,7 +62033,7 @@ init_errors();
|
|
|
61794
62033
|
init_json_output();
|
|
61795
62034
|
init_metadata();
|
|
61796
62035
|
import * as clack53 from "@clack/prompts";
|
|
61797
|
-
import
|
|
62036
|
+
import pc57 from "picocolors";
|
|
61798
62037
|
async function destroy(options) {
|
|
61799
62038
|
trackCommand("destroy", { success: true });
|
|
61800
62039
|
if (isJsonMode() && !options.force) {
|
|
@@ -61805,7 +62044,7 @@ async function destroy(options) {
|
|
|
61805
62044
|
);
|
|
61806
62045
|
}
|
|
61807
62046
|
if (!isJsonMode()) {
|
|
61808
|
-
clack53.intro(
|
|
62047
|
+
clack53.intro(pc57.bold("Wraps Infrastructure Teardown"));
|
|
61809
62048
|
}
|
|
61810
62049
|
const spinner11 = clack53.spinner();
|
|
61811
62050
|
spinner11.start("Validating AWS credentials");
|
|
@@ -61827,14 +62066,14 @@ async function destroy(options) {
|
|
|
61827
62066
|
clack53.log.warn("No Wraps services found in this region");
|
|
61828
62067
|
console.log(
|
|
61829
62068
|
`
|
|
61830
|
-
Run ${
|
|
62069
|
+
Run ${pc57.cyan("wraps email init")} to deploy infrastructure.
|
|
61831
62070
|
`
|
|
61832
62071
|
);
|
|
61833
62072
|
process.exit(0);
|
|
61834
62073
|
}
|
|
61835
62074
|
if (deployedServices.length === 1) {
|
|
61836
62075
|
const service = deployedServices[0];
|
|
61837
|
-
clack53.log.info(`Found ${
|
|
62076
|
+
clack53.log.info(`Found ${pc57.cyan(service)} service deployed`);
|
|
61838
62077
|
if (service === "email") {
|
|
61839
62078
|
await emailDestroy(options);
|
|
61840
62079
|
return;
|
|
@@ -61872,7 +62111,7 @@ Run ${pc56.cyan("wraps email init")} to deploy infrastructure.
|
|
|
61872
62111
|
await emailDestroy(options);
|
|
61873
62112
|
}
|
|
61874
62113
|
if (serviceToDestroy === "all") {
|
|
61875
|
-
clack53.outro(
|
|
62114
|
+
clack53.outro(pc57.green("All Wraps infrastructure has been removed"));
|
|
61876
62115
|
}
|
|
61877
62116
|
}
|
|
61878
62117
|
|
|
@@ -61880,8 +62119,8 @@ Run ${pc56.cyan("wraps email init")} to deploy infrastructure.
|
|
|
61880
62119
|
init_esm_shims();
|
|
61881
62120
|
init_events();
|
|
61882
62121
|
import * as clack54 from "@clack/prompts";
|
|
61883
|
-
import * as
|
|
61884
|
-
import
|
|
62122
|
+
import * as pulumi29 from "@pulumi/pulumi";
|
|
62123
|
+
import pc58 from "picocolors";
|
|
61885
62124
|
init_aws();
|
|
61886
62125
|
init_fs();
|
|
61887
62126
|
init_json_output();
|
|
@@ -61892,23 +62131,23 @@ async function status(options) {
|
|
|
61892
62131
|
const startTime = Date.now();
|
|
61893
62132
|
const progress = new DeploymentProgress();
|
|
61894
62133
|
if (!isJsonMode()) {
|
|
61895
|
-
clack54.intro(
|
|
62134
|
+
clack54.intro(pc58.bold("Wraps Infrastructure Status"));
|
|
61896
62135
|
}
|
|
61897
62136
|
const identity = await progress.execute(
|
|
61898
62137
|
"Loading infrastructure status",
|
|
61899
62138
|
async () => validateAWSCredentials()
|
|
61900
62139
|
);
|
|
61901
62140
|
if (!isJsonMode()) {
|
|
61902
|
-
progress.info(`AWS Account: ${
|
|
62141
|
+
progress.info(`AWS Account: ${pc58.cyan(identity.accountId)}`);
|
|
61903
62142
|
}
|
|
61904
62143
|
const region = options.region || await getAWSRegion();
|
|
61905
62144
|
if (!isJsonMode()) {
|
|
61906
|
-
progress.info(`Region: ${
|
|
62145
|
+
progress.info(`Region: ${pc58.cyan(region)}`);
|
|
61907
62146
|
}
|
|
61908
62147
|
const services = [];
|
|
61909
62148
|
try {
|
|
61910
62149
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
61911
|
-
const emailStack = await
|
|
62150
|
+
const emailStack = await pulumi29.automation.LocalWorkspace.selectStack({
|
|
61912
62151
|
stackName: `wraps-${identity.accountId}-${region}`,
|
|
61913
62152
|
workDir: getPulumiWorkDir()
|
|
61914
62153
|
});
|
|
@@ -61927,7 +62166,7 @@ async function status(options) {
|
|
|
61927
62166
|
services.push({ name: "Email", status: "not_deployed" });
|
|
61928
62167
|
}
|
|
61929
62168
|
try {
|
|
61930
|
-
const smsStack = await
|
|
62169
|
+
const smsStack = await pulumi29.automation.LocalWorkspace.selectStack({
|
|
61931
62170
|
stackName: `wraps-sms-${identity.accountId}-${region}`,
|
|
61932
62171
|
workDir: getPulumiWorkDir()
|
|
61933
62172
|
});
|
|
@@ -61958,33 +62197,33 @@ async function status(options) {
|
|
|
61958
62197
|
clack54.note(
|
|
61959
62198
|
services.map((s2) => {
|
|
61960
62199
|
if (s2.status === "deployed") {
|
|
61961
|
-
const details = s2.details ?
|
|
61962
|
-
return ` ${
|
|
62200
|
+
const details = s2.details ? pc58.dim(` (${s2.details})`) : "";
|
|
62201
|
+
return ` ${pc58.green("\u2713")} ${s2.name}${details}`;
|
|
61963
62202
|
}
|
|
61964
|
-
return ` ${
|
|
62203
|
+
return ` ${pc58.dim("\u25CB")} ${s2.name} ${pc58.dim("(not deployed)")}`;
|
|
61965
62204
|
}).join("\n"),
|
|
61966
62205
|
"Services"
|
|
61967
62206
|
);
|
|
61968
62207
|
const hasDeployedServices = services.some((s2) => s2.status === "deployed");
|
|
61969
62208
|
if (hasDeployedServices) {
|
|
61970
62209
|
console.log(`
|
|
61971
|
-
${
|
|
62210
|
+
${pc58.bold("Details:")}`);
|
|
61972
62211
|
if (services.find((s2) => s2.name === "Email")?.status === "deployed") {
|
|
61973
|
-
console.log(` ${
|
|
62212
|
+
console.log(` ${pc58.dim("Email:")} ${pc58.cyan("wraps email status")}`);
|
|
61974
62213
|
}
|
|
61975
62214
|
if (services.find((s2) => s2.name === "SMS")?.status === "deployed") {
|
|
61976
|
-
console.log(` ${
|
|
62215
|
+
console.log(` ${pc58.dim("SMS:")} ${pc58.cyan("wraps sms status")}`);
|
|
61977
62216
|
}
|
|
61978
62217
|
} else {
|
|
61979
62218
|
console.log(`
|
|
61980
|
-
${
|
|
61981
|
-
console.log(` ${
|
|
61982
|
-
console.log(` ${
|
|
62219
|
+
${pc58.bold("Get started:")}`);
|
|
62220
|
+
console.log(` ${pc58.dim("Deploy email:")} ${pc58.cyan("wraps email init")}`);
|
|
62221
|
+
console.log(` ${pc58.dim("Deploy SMS:")} ${pc58.cyan("wraps sms init")}`);
|
|
61983
62222
|
}
|
|
61984
62223
|
const dashboardUrl = await resolveDashboardUrl(identity.accountId, region);
|
|
61985
62224
|
console.log(`
|
|
61986
|
-
${
|
|
61987
|
-
console.log(`${
|
|
62225
|
+
${pc58.bold("Dashboard:")} ${pc58.blue(dashboardUrl)}`);
|
|
62226
|
+
console.log(`${pc58.bold("Docs:")} ${pc58.blue("https://wraps.dev/docs")}
|
|
61988
62227
|
`);
|
|
61989
62228
|
trackCommand("status", {
|
|
61990
62229
|
success: true,
|
|
@@ -61996,13 +62235,13 @@ ${pc57.bold("Dashboard:")} ${pc57.blue(dashboardUrl)}`);
|
|
|
61996
62235
|
// src/commands/sms/destroy.ts
|
|
61997
62236
|
init_esm_shims();
|
|
61998
62237
|
import * as clack55 from "@clack/prompts";
|
|
61999
|
-
import * as
|
|
62000
|
-
import
|
|
62238
|
+
import * as pulumi31 from "@pulumi/pulumi";
|
|
62239
|
+
import pc59 from "picocolors";
|
|
62001
62240
|
|
|
62002
62241
|
// src/infrastructure/sms-stack.ts
|
|
62003
62242
|
init_esm_shims();
|
|
62004
62243
|
import * as aws24 from "@pulumi/aws";
|
|
62005
|
-
import * as
|
|
62244
|
+
import * as pulumi30 from "@pulumi/pulumi";
|
|
62006
62245
|
init_resource_checks();
|
|
62007
62246
|
async function createSMSIAMRole(config2) {
|
|
62008
62247
|
const statements = [];
|
|
@@ -62282,7 +62521,7 @@ async function createSMSSNSResources(config2) {
|
|
|
62282
62521
|
});
|
|
62283
62522
|
new aws24.sqs.QueuePolicy("wraps-sms-events-queue-policy", {
|
|
62284
62523
|
queueUrl: config2.queueUrl,
|
|
62285
|
-
policy:
|
|
62524
|
+
policy: pulumi30.all([config2.queueArn, topic.arn]).apply(
|
|
62286
62525
|
([queueArn, topicArn2]) => JSON.stringify({
|
|
62287
62526
|
Version: "2012-10-17",
|
|
62288
62527
|
Statement: [
|
|
@@ -62381,7 +62620,7 @@ async function deploySMSLambdaFunction(config2) {
|
|
|
62381
62620
|
});
|
|
62382
62621
|
new aws24.iam.RolePolicy("wraps-sms-lambda-policy", {
|
|
62383
62622
|
role: lambdaRole.name,
|
|
62384
|
-
policy:
|
|
62623
|
+
policy: pulumi30.all([config2.tableName, config2.queueArn]).apply(
|
|
62385
62624
|
([tableName, queueArn]) => JSON.stringify({
|
|
62386
62625
|
Version: "2012-10-17",
|
|
62387
62626
|
Statement: [
|
|
@@ -62418,7 +62657,7 @@ async function deploySMSLambdaFunction(config2) {
|
|
|
62418
62657
|
runtime: "nodejs24.x",
|
|
62419
62658
|
handler: "index.handler",
|
|
62420
62659
|
role: lambdaRole.arn,
|
|
62421
|
-
code: new
|
|
62660
|
+
code: new pulumi30.asset.FileArchive(codeDir),
|
|
62422
62661
|
timeout: 300,
|
|
62423
62662
|
// 5 minutes
|
|
62424
62663
|
memorySize: 512,
|
|
@@ -62688,18 +62927,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
62688
62927
|
const existing = await client2.send(
|
|
62689
62928
|
new DescribeProtectConfigurationsCommand({})
|
|
62690
62929
|
);
|
|
62691
|
-
for (const
|
|
62692
|
-
if (!(
|
|
62930
|
+
for (const pc73 of existing.ProtectConfigurations || []) {
|
|
62931
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
62693
62932
|
continue;
|
|
62694
62933
|
}
|
|
62695
62934
|
const tagsResponse = await client2.send(
|
|
62696
62935
|
new ListTagsForResourceCommand({
|
|
62697
|
-
ResourceArn:
|
|
62936
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
62698
62937
|
})
|
|
62699
62938
|
);
|
|
62700
62939
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
62701
62940
|
if (nameTag?.Value === protectConfigName) {
|
|
62702
|
-
existingProtectConfigId =
|
|
62941
|
+
existingProtectConfigId = pc73.ProtectConfigurationId;
|
|
62703
62942
|
break;
|
|
62704
62943
|
}
|
|
62705
62944
|
}
|
|
@@ -62795,13 +63034,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62795
63034
|
new DescribeProtectConfigurationsCommand({})
|
|
62796
63035
|
);
|
|
62797
63036
|
if (existing.ProtectConfigurations) {
|
|
62798
|
-
for (const
|
|
62799
|
-
if (!(
|
|
63037
|
+
for (const pc73 of existing.ProtectConfigurations) {
|
|
63038
|
+
if (!(pc73.ProtectConfigurationArn && pc73.ProtectConfigurationId)) {
|
|
62800
63039
|
continue;
|
|
62801
63040
|
}
|
|
62802
63041
|
const tagsResponse = await client2.send(
|
|
62803
63042
|
new ListTagsForResourceCommand({
|
|
62804
|
-
ResourceArn:
|
|
63043
|
+
ResourceArn: pc73.ProtectConfigurationArn
|
|
62805
63044
|
})
|
|
62806
63045
|
);
|
|
62807
63046
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -62810,7 +63049,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
62810
63049
|
if (isWrapsManaged) {
|
|
62811
63050
|
await client2.send(
|
|
62812
63051
|
new DeleteProtectConfigurationCommand({
|
|
62813
|
-
ProtectConfigurationId:
|
|
63052
|
+
ProtectConfigurationId: pc73.ProtectConfigurationId
|
|
62814
63053
|
})
|
|
62815
63054
|
);
|
|
62816
63055
|
}
|
|
@@ -62846,7 +63085,7 @@ async function smsDestroy(options) {
|
|
|
62846
63085
|
}
|
|
62847
63086
|
if (!isJsonMode()) {
|
|
62848
63087
|
clack55.intro(
|
|
62849
|
-
|
|
63088
|
+
pc59.bold(
|
|
62850
63089
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
62851
63090
|
)
|
|
62852
63091
|
);
|
|
@@ -62896,7 +63135,7 @@ async function smsDestroy(options) {
|
|
|
62896
63135
|
}
|
|
62897
63136
|
if (!(options.force || options.preview)) {
|
|
62898
63137
|
const confirmed = await clack55.confirm({
|
|
62899
|
-
message:
|
|
63138
|
+
message: pc59.red(
|
|
62900
63139
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
62901
63140
|
),
|
|
62902
63141
|
initialValue: false
|
|
@@ -62915,7 +63154,7 @@ async function smsDestroy(options) {
|
|
|
62915
63154
|
const stackName = storedStackName || `wraps-sms-${identity.accountId}-${region}`;
|
|
62916
63155
|
let stack;
|
|
62917
63156
|
try {
|
|
62918
|
-
stack = await
|
|
63157
|
+
stack = await pulumi31.automation.LocalWorkspace.selectStack({
|
|
62919
63158
|
stackName,
|
|
62920
63159
|
workDir: getPulumiWorkDir()
|
|
62921
63160
|
});
|
|
@@ -62935,7 +63174,7 @@ async function smsDestroy(options) {
|
|
|
62935
63174
|
commandName: "wraps sms destroy"
|
|
62936
63175
|
});
|
|
62937
63176
|
clack55.outro(
|
|
62938
|
-
|
|
63177
|
+
pc59.green("Preview complete. Run without --preview to destroy.")
|
|
62939
63178
|
);
|
|
62940
63179
|
trackServiceRemoved("sms", {
|
|
62941
63180
|
preview: true,
|
|
@@ -62973,7 +63212,7 @@ async function smsDestroy(options) {
|
|
|
62973
63212
|
const stackName = storedStackName || `wraps-sms-${identity.accountId}-${region}`;
|
|
62974
63213
|
let stack;
|
|
62975
63214
|
try {
|
|
62976
|
-
stack = await
|
|
63215
|
+
stack = await pulumi31.automation.LocalWorkspace.selectStack({
|
|
62977
63216
|
stackName,
|
|
62978
63217
|
workDir: getPulumiWorkDir()
|
|
62979
63218
|
});
|
|
@@ -63032,20 +63271,20 @@ async function smsDestroy(options) {
|
|
|
63032
63271
|
}
|
|
63033
63272
|
if (destroyFailed) {
|
|
63034
63273
|
clack55.outro(
|
|
63035
|
-
|
|
63274
|
+
pc59.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
63036
63275
|
);
|
|
63037
63276
|
} else {
|
|
63038
|
-
clack55.outro(
|
|
63277
|
+
clack55.outro(pc59.green("SMS infrastructure has been removed"));
|
|
63039
63278
|
console.log(`
|
|
63040
|
-
${
|
|
63041
|
-
console.log(` ${
|
|
63042
|
-
console.log(` ${
|
|
63043
|
-
console.log(` ${
|
|
63044
|
-
console.log(` ${
|
|
63279
|
+
${pc59.bold("Cleaned up:")}`);
|
|
63280
|
+
console.log(` ${pc59.green("\u2713")} Phone number released`);
|
|
63281
|
+
console.log(` ${pc59.green("\u2713")} Configuration set deleted`);
|
|
63282
|
+
console.log(` ${pc59.green("\u2713")} Event processing infrastructure removed`);
|
|
63283
|
+
console.log(` ${pc59.green("\u2713")} IAM role deleted`);
|
|
63045
63284
|
}
|
|
63046
63285
|
console.log(
|
|
63047
63286
|
`
|
|
63048
|
-
Run ${
|
|
63287
|
+
Run ${pc59.cyan("wraps sms init")} to deploy infrastructure again.
|
|
63049
63288
|
`
|
|
63050
63289
|
);
|
|
63051
63290
|
trackServiceRemoved("sms", {
|
|
@@ -63058,8 +63297,8 @@ Run ${pc58.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
63058
63297
|
// src/commands/sms/init.ts
|
|
63059
63298
|
init_esm_shims();
|
|
63060
63299
|
import * as clack56 from "@clack/prompts";
|
|
63061
|
-
import * as
|
|
63062
|
-
import
|
|
63300
|
+
import * as pulumi32 from "@pulumi/pulumi";
|
|
63301
|
+
import pc61 from "picocolors";
|
|
63063
63302
|
init_events();
|
|
63064
63303
|
init_aws();
|
|
63065
63304
|
init_errors();
|
|
@@ -63297,16 +63536,16 @@ function getSMSCostSummary(config2, messagesPerMonth = 1e3) {
|
|
|
63297
63536
|
|
|
63298
63537
|
// src/utils/sms/output.ts
|
|
63299
63538
|
init_esm_shims();
|
|
63300
|
-
import
|
|
63539
|
+
import pc60 from "picocolors";
|
|
63301
63540
|
function displaySMSSDKUsage(region) {
|
|
63302
|
-
console.log(
|
|
63541
|
+
console.log(pc60.dim(" npm install @wraps.dev/sms"));
|
|
63303
63542
|
console.log("");
|
|
63304
|
-
console.log(
|
|
63305
|
-
console.log(
|
|
63306
|
-
console.log(
|
|
63307
|
-
console.log(
|
|
63308
|
-
console.log(
|
|
63309
|
-
console.log(
|
|
63543
|
+
console.log(pc60.dim(" import { WrapsSMS } from '@wraps.dev/sms';"));
|
|
63544
|
+
console.log(pc60.dim(` const sms = new WrapsSMS({ region: '${region}' });`));
|
|
63545
|
+
console.log(pc60.dim(" await sms.send({"));
|
|
63546
|
+
console.log(pc60.dim(" to: '+14155551234',"));
|
|
63547
|
+
console.log(pc60.dim(" message: 'Your code is 123456',"));
|
|
63548
|
+
console.log(pc60.dim(" });"));
|
|
63310
63549
|
}
|
|
63311
63550
|
|
|
63312
63551
|
// src/utils/sms/presets.ts
|
|
@@ -63628,14 +63867,14 @@ function parseVolume(raw) {
|
|
|
63628
63867
|
async function init3(options) {
|
|
63629
63868
|
const startTime = Date.now();
|
|
63630
63869
|
if (!isJsonMode()) {
|
|
63631
|
-
clack56.intro(
|
|
63870
|
+
clack56.intro(pc61.bold("Wraps SMS Infrastructure Setup"));
|
|
63632
63871
|
}
|
|
63633
63872
|
const progress = new DeploymentProgress();
|
|
63634
63873
|
const identity = await progress.execute(
|
|
63635
63874
|
"Validating AWS credentials",
|
|
63636
63875
|
async () => validateAWSCredentials()
|
|
63637
63876
|
);
|
|
63638
|
-
progress.info(`Connected to AWS account: ${
|
|
63877
|
+
progress.info(`Connected to AWS account: ${pc61.cyan(identity.accountId)}`);
|
|
63639
63878
|
const wasAutoInstalled = await progress.execute(
|
|
63640
63879
|
"Checking Pulumi CLI installation",
|
|
63641
63880
|
async () => await ensurePulumiInstalled()
|
|
@@ -63655,9 +63894,9 @@ async function init3(options) {
|
|
|
63655
63894
|
);
|
|
63656
63895
|
if (existingConnection?.services?.sms) {
|
|
63657
63896
|
clack56.log.warn(
|
|
63658
|
-
`SMS already configured for account ${
|
|
63897
|
+
`SMS already configured for account ${pc61.cyan(identity.accountId)} in region ${pc61.cyan(region)}`
|
|
63659
63898
|
);
|
|
63660
|
-
clack56.log.info(`Use ${
|
|
63899
|
+
clack56.log.info(`Use ${pc61.cyan("wraps sms status")} to view current setup`);
|
|
63661
63900
|
process.exit(0);
|
|
63662
63901
|
}
|
|
63663
63902
|
let preset = options.preset;
|
|
@@ -63703,7 +63942,7 @@ async function init3(options) {
|
|
|
63703
63942
|
}
|
|
63704
63943
|
progress.info(
|
|
63705
63944
|
`
|
|
63706
|
-
${
|
|
63945
|
+
${pc61.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
63707
63946
|
);
|
|
63708
63947
|
let allowedCountries;
|
|
63709
63948
|
if (options.countries) {
|
|
@@ -63741,13 +63980,13 @@ ${pc60.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
63741
63980
|
estimatedVolume = await promptEstimatedSMSVolume();
|
|
63742
63981
|
}
|
|
63743
63982
|
progress.info(`
|
|
63744
|
-
${
|
|
63983
|
+
${pc61.bold("Cost Estimate:")}`);
|
|
63745
63984
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
63746
63985
|
clack56.log.info(costSummary);
|
|
63747
63986
|
const warnings = validateSMSConfig(smsConfig);
|
|
63748
63987
|
if (warnings.length > 0) {
|
|
63749
63988
|
progress.info(`
|
|
63750
|
-
${
|
|
63989
|
+
${pc61.yellow(pc61.bold("Important Notes:"))}`);
|
|
63751
63990
|
for (const warning2 of warnings) {
|
|
63752
63991
|
clack56.log.warn(warning2);
|
|
63753
63992
|
}
|
|
@@ -63767,7 +64006,7 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63767
64006
|
};
|
|
63768
64007
|
const createStack = async () => {
|
|
63769
64008
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
63770
|
-
const stack = await
|
|
64009
|
+
const stack = await pulumi32.automation.LocalWorkspace.createOrSelectStack(
|
|
63771
64010
|
{
|
|
63772
64011
|
stackName: `wraps-sms-${identity.accountId}-${region}`,
|
|
63773
64012
|
projectName: "wraps-sms",
|
|
@@ -63816,7 +64055,7 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63816
64055
|
commandName: "wraps sms init"
|
|
63817
64056
|
});
|
|
63818
64057
|
clack56.outro(
|
|
63819
|
-
|
|
64058
|
+
pc61.green("Preview complete. Run without --preview to deploy.")
|
|
63820
64059
|
);
|
|
63821
64060
|
trackServiceInit("sms", true, {
|
|
63822
64061
|
provider,
|
|
@@ -63867,7 +64106,7 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63867
64106
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63868
64107
|
clack56.log.warn(`Phone pool creation failed: ${msg}`);
|
|
63869
64108
|
clack56.log.info(
|
|
63870
|
-
`Run ${
|
|
64109
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63871
64110
|
);
|
|
63872
64111
|
}
|
|
63873
64112
|
}
|
|
@@ -63885,7 +64124,7 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63885
64124
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63886
64125
|
clack56.log.warn(`Event destination creation failed: ${msg}`);
|
|
63887
64126
|
clack56.log.info(
|
|
63888
|
-
`Run ${
|
|
64127
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63889
64128
|
);
|
|
63890
64129
|
}
|
|
63891
64130
|
}
|
|
@@ -63906,7 +64145,7 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63906
64145
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
63907
64146
|
clack56.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
63908
64147
|
clack56.log.info(
|
|
63909
|
-
`Run ${
|
|
64148
|
+
`Run ${pc61.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
63910
64149
|
);
|
|
63911
64150
|
}
|
|
63912
64151
|
}
|
|
@@ -63956,40 +64195,40 @@ ${pc60.yellow(pc60.bold("Important Notes:"))}`);
|
|
|
63956
64195
|
return;
|
|
63957
64196
|
}
|
|
63958
64197
|
console.log("\n");
|
|
63959
|
-
clack56.log.success(
|
|
64198
|
+
clack56.log.success(pc61.green(pc61.bold("SMS infrastructure deployed!")));
|
|
63960
64199
|
console.log("\n");
|
|
63961
64200
|
clack56.note(
|
|
63962
64201
|
[
|
|
63963
|
-
`${
|
|
63964
|
-
`${
|
|
63965
|
-
`${
|
|
63966
|
-
`${
|
|
63967
|
-
outputs.tableName ? `${
|
|
64202
|
+
`${pc61.bold("Phone Number:")} ${pc61.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
64203
|
+
`${pc61.bold("Phone Type:")} ${pc61.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
64204
|
+
`${pc61.bold("Config Set:")} ${pc61.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
64205
|
+
`${pc61.bold("Region:")} ${pc61.cyan(outputs.region)}`,
|
|
64206
|
+
outputs.tableName ? `${pc61.bold("History Table:")} ${pc61.cyan(outputs.tableName)}` : "",
|
|
63968
64207
|
"",
|
|
63969
|
-
|
|
63970
|
-
|
|
64208
|
+
pc61.dim("IAM Role:"),
|
|
64209
|
+
pc61.dim(` ${outputs.roleArn}`)
|
|
63971
64210
|
].filter(Boolean).join("\n"),
|
|
63972
64211
|
"SMS Infrastructure"
|
|
63973
64212
|
);
|
|
63974
64213
|
const nextSteps = [];
|
|
63975
64214
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
63976
64215
|
nextSteps.push(
|
|
63977
|
-
`${
|
|
64216
|
+
`${pc61.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
63978
64217
|
);
|
|
63979
64218
|
}
|
|
63980
64219
|
nextSteps.push(
|
|
63981
|
-
`${
|
|
64220
|
+
`${pc61.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
63982
64221
|
);
|
|
63983
|
-
nextSteps.push(`${
|
|
64222
|
+
nextSteps.push(`${pc61.cyan("wraps sms status")} - View SMS configuration`);
|
|
63984
64223
|
console.log("\n");
|
|
63985
|
-
clack56.log.info(
|
|
64224
|
+
clack56.log.info(pc61.bold("Next steps:"));
|
|
63986
64225
|
for (const step of nextSteps) {
|
|
63987
64226
|
console.log(` ${step}`);
|
|
63988
64227
|
}
|
|
63989
64228
|
console.log("\n");
|
|
63990
|
-
clack56.log.info(
|
|
64229
|
+
clack56.log.info(pc61.bold("SDK Usage:"));
|
|
63991
64230
|
displaySMSSDKUsage(region);
|
|
63992
|
-
clack56.outro(
|
|
64231
|
+
clack56.outro(pc61.green("Setup complete!"));
|
|
63993
64232
|
const duration = Date.now() - startTime;
|
|
63994
64233
|
const enabledFeatures = [];
|
|
63995
64234
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -64026,7 +64265,7 @@ init_json_output();
|
|
|
64026
64265
|
init_metadata();
|
|
64027
64266
|
init_output();
|
|
64028
64267
|
import * as clack57 from "@clack/prompts";
|
|
64029
|
-
import
|
|
64268
|
+
import pc62 from "picocolors";
|
|
64030
64269
|
async function getPhoneNumberDetails(region) {
|
|
64031
64270
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
64032
64271
|
const client2 = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -64067,7 +64306,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
64067
64306
|
async function smsRegister(options) {
|
|
64068
64307
|
const startTime = Date.now();
|
|
64069
64308
|
if (!isJsonMode()) {
|
|
64070
|
-
clack57.intro(
|
|
64309
|
+
clack57.intro(pc62.bold("Wraps SMS - Toll-Free Registration"));
|
|
64071
64310
|
}
|
|
64072
64311
|
const progress = new DeploymentProgress();
|
|
64073
64312
|
const identity = await progress.execute(
|
|
@@ -64081,7 +64320,7 @@ async function smsRegister(options) {
|
|
|
64081
64320
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
64082
64321
|
if (!metadata?.services?.sms) {
|
|
64083
64322
|
clack57.log.error("No SMS infrastructure found.");
|
|
64084
|
-
clack57.log.info(`Run ${
|
|
64323
|
+
clack57.log.info(`Run ${pc62.cyan("wraps sms init")} first.`);
|
|
64085
64324
|
process.exit(1);
|
|
64086
64325
|
}
|
|
64087
64326
|
const phoneDetails = await progress.execute(
|
|
@@ -64115,14 +64354,14 @@ async function smsRegister(options) {
|
|
|
64115
64354
|
}
|
|
64116
64355
|
console.log("");
|
|
64117
64356
|
console.log(
|
|
64118
|
-
`${
|
|
64357
|
+
`${pc62.bold("Phone Number:")} ${pc62.cyan(phoneDetails.phoneNumber)}`
|
|
64119
64358
|
);
|
|
64120
|
-
console.log(`${
|
|
64359
|
+
console.log(`${pc62.bold("Type:")} ${pc62.cyan(phoneDetails.type)}`);
|
|
64121
64360
|
console.log(
|
|
64122
|
-
`${
|
|
64361
|
+
`${pc62.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc62.green(phoneDetails.status) : pc62.yellow(phoneDetails.status)}`
|
|
64123
64362
|
);
|
|
64124
64363
|
if (registrationStatus) {
|
|
64125
|
-
console.log(`${
|
|
64364
|
+
console.log(`${pc62.bold("Registration:")} ${pc62.cyan(registrationStatus)}`);
|
|
64126
64365
|
}
|
|
64127
64366
|
console.log("");
|
|
64128
64367
|
if (phoneDetails.status === "ACTIVE") {
|
|
@@ -64140,21 +64379,21 @@ async function smsRegister(options) {
|
|
|
64140
64379
|
clack57.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
64141
64380
|
process.exit(0);
|
|
64142
64381
|
}
|
|
64143
|
-
console.log(
|
|
64382
|
+
console.log(pc62.bold("Toll-Free Registration Required"));
|
|
64144
64383
|
console.log("");
|
|
64145
64384
|
console.log(
|
|
64146
|
-
|
|
64385
|
+
pc62.dim("To send SMS at scale, you must register your toll-free number.")
|
|
64147
64386
|
);
|
|
64148
|
-
console.log(
|
|
64387
|
+
console.log(pc62.dim("This process typically takes 1-15 business days."));
|
|
64149
64388
|
console.log("");
|
|
64150
|
-
console.log(
|
|
64151
|
-
console.log(` ${
|
|
64389
|
+
console.log(pc62.bold("You'll need to provide:"));
|
|
64390
|
+
console.log(` ${pc62.dim("\u2022")} Business name and address`);
|
|
64152
64391
|
console.log(
|
|
64153
|
-
` ${
|
|
64392
|
+
` ${pc62.dim("\u2022")} Use case description (what messages you're sending)`
|
|
64154
64393
|
);
|
|
64155
|
-
console.log(` ${
|
|
64156
|
-
console.log(` ${
|
|
64157
|
-
console.log(` ${
|
|
64394
|
+
console.log(` ${pc62.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
64395
|
+
console.log(` ${pc62.dim("\u2022")} How users opt-in to receive messages`);
|
|
64396
|
+
console.log(` ${pc62.dim("\u2022")} Expected monthly message volume`);
|
|
64158
64397
|
console.log("");
|
|
64159
64398
|
const openConsole = await clack57.confirm({
|
|
64160
64399
|
message: "Open AWS Console to start registration?",
|
|
@@ -64179,33 +64418,33 @@ async function smsRegister(options) {
|
|
|
64179
64418
|
} catch {
|
|
64180
64419
|
clack57.log.info("Open this URL in your browser:");
|
|
64181
64420
|
console.log(`
|
|
64182
|
-
${
|
|
64421
|
+
${pc62.cyan(consoleUrl)}
|
|
64183
64422
|
`);
|
|
64184
64423
|
}
|
|
64185
64424
|
}
|
|
64186
64425
|
console.log("");
|
|
64187
|
-
console.log(
|
|
64426
|
+
console.log(pc62.bold("Next Steps:"));
|
|
64188
64427
|
console.log(
|
|
64189
|
-
` 1. Click ${
|
|
64428
|
+
` 1. Click ${pc62.cyan("Create registration")} in the AWS Console`
|
|
64190
64429
|
);
|
|
64191
|
-
console.log(` 2. Select ${
|
|
64430
|
+
console.log(` 2. Select ${pc62.cyan("Toll-free number registration")}`);
|
|
64192
64431
|
console.log(" 3. Fill out the business information form");
|
|
64193
64432
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
64194
64433
|
console.log("");
|
|
64195
64434
|
console.log(
|
|
64196
|
-
|
|
64435
|
+
pc62.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
64197
64436
|
);
|
|
64198
64437
|
} else {
|
|
64199
64438
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
64200
64439
|
console.log("");
|
|
64201
64440
|
console.log("When you're ready, go to:");
|
|
64202
|
-
console.log(` ${
|
|
64441
|
+
console.log(` ${pc62.cyan(consoleUrl)}`);
|
|
64203
64442
|
}
|
|
64204
64443
|
trackCommand("sms:register", {
|
|
64205
64444
|
success: true,
|
|
64206
64445
|
duration_ms: Date.now() - startTime
|
|
64207
64446
|
});
|
|
64208
|
-
clack57.outro(
|
|
64447
|
+
clack57.outro(pc62.dim("Good luck with your registration!"));
|
|
64209
64448
|
}
|
|
64210
64449
|
|
|
64211
64450
|
// src/commands/sms/status.ts
|
|
@@ -64219,44 +64458,44 @@ init_output();
|
|
|
64219
64458
|
init_pulumi();
|
|
64220
64459
|
init_region_resolver();
|
|
64221
64460
|
import * as clack58 from "@clack/prompts";
|
|
64222
|
-
import * as
|
|
64223
|
-
import
|
|
64461
|
+
import * as pulumi33 from "@pulumi/pulumi";
|
|
64462
|
+
import pc63 from "picocolors";
|
|
64224
64463
|
function displaySMSStatus(options) {
|
|
64225
64464
|
const lines = [];
|
|
64226
|
-
lines.push(
|
|
64465
|
+
lines.push(pc63.bold(pc63.green("SMS Infrastructure Active")));
|
|
64227
64466
|
lines.push("");
|
|
64228
|
-
lines.push(
|
|
64467
|
+
lines.push(pc63.bold("Phone Number"));
|
|
64229
64468
|
if (options.phoneNumber) {
|
|
64230
|
-
lines.push(` Number: ${
|
|
64469
|
+
lines.push(` Number: ${pc63.cyan(options.phoneNumber)}`);
|
|
64231
64470
|
} else {
|
|
64232
|
-
lines.push(` Number: ${
|
|
64471
|
+
lines.push(` Number: ${pc63.yellow("Provisioning...")}`);
|
|
64233
64472
|
}
|
|
64234
|
-
lines.push(` Type: ${
|
|
64473
|
+
lines.push(` Type: ${pc63.cyan(options.phoneNumberType || "simulator")}`);
|
|
64235
64474
|
lines.push("");
|
|
64236
|
-
lines.push(
|
|
64237
|
-
lines.push(` Region: ${
|
|
64475
|
+
lines.push(pc63.bold("Configuration"));
|
|
64476
|
+
lines.push(` Region: ${pc63.cyan(options.region)}`);
|
|
64238
64477
|
if (options.preset) {
|
|
64239
|
-
lines.push(` Preset: ${
|
|
64478
|
+
lines.push(` Preset: ${pc63.cyan(options.preset)}`);
|
|
64240
64479
|
}
|
|
64241
64480
|
if (options.configSetName) {
|
|
64242
|
-
lines.push(` Config Set: ${
|
|
64481
|
+
lines.push(` Config Set: ${pc63.cyan(options.configSetName)}`);
|
|
64243
64482
|
}
|
|
64244
64483
|
lines.push("");
|
|
64245
|
-
lines.push(
|
|
64484
|
+
lines.push(pc63.bold("Features"));
|
|
64246
64485
|
lines.push(
|
|
64247
|
-
` Event Tracking: ${options.eventTracking ?
|
|
64486
|
+
` Event Tracking: ${options.eventTracking ? pc63.green("Enabled") : pc63.dim("Disabled")}`
|
|
64248
64487
|
);
|
|
64249
64488
|
if (options.tableName) {
|
|
64250
|
-
lines.push(` Message History: ${
|
|
64251
|
-
lines.push(` Table: ${
|
|
64489
|
+
lines.push(` Message History: ${pc63.green("Enabled")}`);
|
|
64490
|
+
lines.push(` Table: ${pc63.dim(options.tableName)}`);
|
|
64252
64491
|
}
|
|
64253
64492
|
if (options.queueUrl) {
|
|
64254
|
-
lines.push(` Event Queue: ${
|
|
64493
|
+
lines.push(` Event Queue: ${pc63.green("Enabled")}`);
|
|
64255
64494
|
}
|
|
64256
64495
|
lines.push("");
|
|
64257
64496
|
if (options.roleArn) {
|
|
64258
|
-
lines.push(
|
|
64259
|
-
lines.push(` ${
|
|
64497
|
+
lines.push(pc63.bold("IAM Role"));
|
|
64498
|
+
lines.push(` ${pc63.dim(options.roleArn)}`);
|
|
64260
64499
|
}
|
|
64261
64500
|
clack58.note(lines.join("\n"), "SMS Status");
|
|
64262
64501
|
}
|
|
@@ -64265,7 +64504,7 @@ async function smsStatus(options) {
|
|
|
64265
64504
|
const startTime = Date.now();
|
|
64266
64505
|
const progress = new DeploymentProgress();
|
|
64267
64506
|
if (!isJsonMode()) {
|
|
64268
|
-
clack58.intro(
|
|
64507
|
+
clack58.intro(pc63.bold("Wraps SMS Status"));
|
|
64269
64508
|
}
|
|
64270
64509
|
const identity = await progress.execute(
|
|
64271
64510
|
"Loading SMS infrastructure status",
|
|
@@ -64283,7 +64522,7 @@ async function smsStatus(options) {
|
|
|
64283
64522
|
clack58.log.error("No SMS infrastructure found");
|
|
64284
64523
|
console.log(
|
|
64285
64524
|
`
|
|
64286
|
-
Run ${
|
|
64525
|
+
Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
64287
64526
|
`
|
|
64288
64527
|
);
|
|
64289
64528
|
process.exit(1);
|
|
@@ -64292,7 +64531,7 @@ Run ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
64292
64531
|
try {
|
|
64293
64532
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
64294
64533
|
const stackName = metadata.services.sms.pulumiStackName || `wraps-sms-${identity.accountId}-${region}`;
|
|
64295
|
-
const stack = await
|
|
64534
|
+
const stack = await pulumi33.automation.LocalWorkspace.selectStack({
|
|
64296
64535
|
stackName,
|
|
64297
64536
|
workDir: getPulumiWorkDir()
|
|
64298
64537
|
});
|
|
@@ -64319,25 +64558,25 @@ Run ${pc62.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
64319
64558
|
}
|
|
64320
64559
|
displaySMSStatus(smsStatusData);
|
|
64321
64560
|
console.log("");
|
|
64322
|
-
clack58.log.info(
|
|
64561
|
+
clack58.log.info(pc63.bold("Commands:"));
|
|
64323
64562
|
console.log(
|
|
64324
|
-
` ${
|
|
64563
|
+
` ${pc63.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
64325
64564
|
);
|
|
64326
|
-
console.log(` ${
|
|
64565
|
+
console.log(` ${pc63.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
64327
64566
|
trackCommand("sms:status", {
|
|
64328
64567
|
success: true,
|
|
64329
64568
|
phone_type: smsConfig?.phoneNumberType,
|
|
64330
64569
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
64331
64570
|
duration_ms: Date.now() - startTime
|
|
64332
64571
|
});
|
|
64333
|
-
clack58.outro(
|
|
64572
|
+
clack58.outro(pc63.dim("SMS infrastructure is ready"));
|
|
64334
64573
|
}
|
|
64335
64574
|
|
|
64336
64575
|
// src/commands/sms/sync.ts
|
|
64337
64576
|
init_esm_shims();
|
|
64338
64577
|
import * as clack59 from "@clack/prompts";
|
|
64339
|
-
import * as
|
|
64340
|
-
import
|
|
64578
|
+
import * as pulumi34 from "@pulumi/pulumi";
|
|
64579
|
+
import pc64 from "picocolors";
|
|
64341
64580
|
init_events();
|
|
64342
64581
|
init_aws();
|
|
64343
64582
|
init_errors();
|
|
@@ -64350,7 +64589,7 @@ async function smsSync(options) {
|
|
|
64350
64589
|
await ensurePulumiInstalled();
|
|
64351
64590
|
const startTime = Date.now();
|
|
64352
64591
|
if (!isJsonMode()) {
|
|
64353
|
-
clack59.intro(
|
|
64592
|
+
clack59.intro(pc64.bold("Wraps SMS Infrastructure Sync"));
|
|
64354
64593
|
}
|
|
64355
64594
|
const progress = new DeploymentProgress();
|
|
64356
64595
|
const identity = await progress.execute(
|
|
@@ -64365,7 +64604,7 @@ async function smsSync(options) {
|
|
|
64365
64604
|
clack59.log.error("No SMS infrastructure found to sync");
|
|
64366
64605
|
console.log(
|
|
64367
64606
|
`
|
|
64368
|
-
Run ${
|
|
64607
|
+
Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
64369
64608
|
`
|
|
64370
64609
|
);
|
|
64371
64610
|
process.exit(1);
|
|
@@ -64374,10 +64613,10 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
64374
64613
|
const storedStackName = smsService.pulumiStackName;
|
|
64375
64614
|
progress.info("Found existing SMS configuration");
|
|
64376
64615
|
progress.info(
|
|
64377
|
-
`Phone type: ${
|
|
64616
|
+
`Phone type: ${pc64.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
64378
64617
|
);
|
|
64379
64618
|
progress.info(
|
|
64380
|
-
`Event tracking: ${
|
|
64619
|
+
`Event tracking: ${pc64.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
64381
64620
|
);
|
|
64382
64621
|
if (!options.yes) {
|
|
64383
64622
|
const confirmed = await clack59.confirm({
|
|
@@ -64400,7 +64639,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
64400
64639
|
outputs = await progress.execute("Syncing SMS infrastructure", async () => {
|
|
64401
64640
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
64402
64641
|
const stackName = storedStackName || `wraps-sms-${identity.accountId}-${region}`;
|
|
64403
|
-
const stack = await
|
|
64642
|
+
const stack = await pulumi34.automation.LocalWorkspace.createOrSelectStack(
|
|
64404
64643
|
{
|
|
64405
64644
|
stackName,
|
|
64406
64645
|
projectName: "wraps-sms",
|
|
@@ -64510,7 +64749,7 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
64510
64749
|
return;
|
|
64511
64750
|
}
|
|
64512
64751
|
console.log("\n");
|
|
64513
|
-
clack59.log.success(
|
|
64752
|
+
clack59.log.success(pc64.green("SMS infrastructure synced successfully!"));
|
|
64514
64753
|
const changes = [];
|
|
64515
64754
|
if (outputs.lambdaFunctions?.length) {
|
|
64516
64755
|
changes.push("Lambda functions updated");
|
|
@@ -64518,13 +64757,13 @@ Run ${pc63.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
64518
64757
|
changes.push("SDK resources verified");
|
|
64519
64758
|
console.log("");
|
|
64520
64759
|
for (const change of changes) {
|
|
64521
|
-
console.log(` ${
|
|
64760
|
+
console.log(` ${pc64.green("\u2713")} ${change}`);
|
|
64522
64761
|
}
|
|
64523
64762
|
trackCommand("sms:sync", {
|
|
64524
64763
|
success: true,
|
|
64525
64764
|
duration_ms: Date.now() - startTime
|
|
64526
64765
|
});
|
|
64527
|
-
clack59.outro(
|
|
64766
|
+
clack59.outro(pc64.green("Sync complete!"));
|
|
64528
64767
|
}
|
|
64529
64768
|
|
|
64530
64769
|
// src/commands/sms/test.ts
|
|
@@ -64540,7 +64779,7 @@ import {
|
|
|
64540
64779
|
SendTextMessageCommand
|
|
64541
64780
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
64542
64781
|
import * as clack60 from "@clack/prompts";
|
|
64543
|
-
import
|
|
64782
|
+
import pc65 from "picocolors";
|
|
64544
64783
|
|
|
64545
64784
|
// src/utils/sms/validation.ts
|
|
64546
64785
|
init_esm_shims();
|
|
@@ -64563,7 +64802,7 @@ async function smsTest(options) {
|
|
|
64563
64802
|
const startTime = Date.now();
|
|
64564
64803
|
const progress = new DeploymentProgress();
|
|
64565
64804
|
if (!isJsonMode()) {
|
|
64566
|
-
clack60.intro(
|
|
64805
|
+
clack60.intro(pc65.bold("Wraps SMS Test"));
|
|
64567
64806
|
}
|
|
64568
64807
|
const identity = await progress.execute(
|
|
64569
64808
|
"Validating AWS credentials",
|
|
@@ -64576,7 +64815,7 @@ async function smsTest(options) {
|
|
|
64576
64815
|
clack60.log.error("No SMS infrastructure found");
|
|
64577
64816
|
console.log(
|
|
64578
64817
|
`
|
|
64579
|
-
Run ${
|
|
64818
|
+
Run ${pc65.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
64580
64819
|
`
|
|
64581
64820
|
);
|
|
64582
64821
|
process.exit(1);
|
|
@@ -64705,16 +64944,16 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
64705
64944
|
return;
|
|
64706
64945
|
}
|
|
64707
64946
|
console.log("\n");
|
|
64708
|
-
clack60.log.success(
|
|
64947
|
+
clack60.log.success(pc65.green("Test SMS sent successfully!"));
|
|
64709
64948
|
console.log("");
|
|
64710
64949
|
clack60.note(
|
|
64711
64950
|
[
|
|
64712
|
-
`${
|
|
64713
|
-
`${
|
|
64714
|
-
`${
|
|
64715
|
-
`${
|
|
64951
|
+
`${pc65.bold("Message ID:")} ${pc65.cyan(messageId || "unknown")}`,
|
|
64952
|
+
`${pc65.bold("To:")} ${pc65.cyan(toNumber)}`,
|
|
64953
|
+
`${pc65.bold("Message:")} ${message}`,
|
|
64954
|
+
`${pc65.bold("Type:")} ${pc65.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
64716
64955
|
"",
|
|
64717
|
-
|
|
64956
|
+
pc65.dim(
|
|
64718
64957
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
64719
64958
|
)
|
|
64720
64959
|
].join("\n"),
|
|
@@ -64723,10 +64962,10 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
64723
64962
|
if (smsConfig?.eventTracking?.enabled) {
|
|
64724
64963
|
console.log("");
|
|
64725
64964
|
clack60.log.info(
|
|
64726
|
-
|
|
64965
|
+
pc65.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
64727
64966
|
);
|
|
64728
64967
|
}
|
|
64729
|
-
clack60.outro(
|
|
64968
|
+
clack60.outro(pc65.green("Test complete!"));
|
|
64730
64969
|
} catch (error) {
|
|
64731
64970
|
progress.stop();
|
|
64732
64971
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -64751,7 +64990,7 @@ Run ${pc64.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
64751
64990
|
clack60.log.error("Toll-free number registration is not complete");
|
|
64752
64991
|
console.log(
|
|
64753
64992
|
`
|
|
64754
|
-
Run ${
|
|
64993
|
+
Run ${pc65.cyan("wraps sms register")} to check registration status.
|
|
64755
64994
|
`
|
|
64756
64995
|
);
|
|
64757
64996
|
} else if (errorName === "AccessDeniedException") {
|
|
@@ -64760,7 +64999,7 @@ Run ${pc64.cyan("wraps sms register")} to check registration status.
|
|
|
64760
64999
|
);
|
|
64761
65000
|
console.log(
|
|
64762
65001
|
`
|
|
64763
|
-
Run ${
|
|
65002
|
+
Run ${pc65.cyan("wraps sms upgrade")} to update IAM policies.
|
|
64764
65003
|
`
|
|
64765
65004
|
);
|
|
64766
65005
|
} else {
|
|
@@ -64773,8 +65012,8 @@ Run ${pc64.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
64773
65012
|
// src/commands/sms/upgrade.ts
|
|
64774
65013
|
init_esm_shims();
|
|
64775
65014
|
import * as clack61 from "@clack/prompts";
|
|
64776
|
-
import * as
|
|
64777
|
-
import
|
|
65015
|
+
import * as pulumi35 from "@pulumi/pulumi";
|
|
65016
|
+
import pc66 from "picocolors";
|
|
64778
65017
|
init_events();
|
|
64779
65018
|
init_aws();
|
|
64780
65019
|
init_errors();
|
|
@@ -64789,7 +65028,7 @@ async function smsUpgrade(options) {
|
|
|
64789
65028
|
const startTime = Date.now();
|
|
64790
65029
|
let upgradeAction = "";
|
|
64791
65030
|
if (!isJsonMode()) {
|
|
64792
|
-
clack61.intro(
|
|
65031
|
+
clack61.intro(pc66.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
64793
65032
|
}
|
|
64794
65033
|
const progress = new DeploymentProgress();
|
|
64795
65034
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -64803,7 +65042,7 @@ async function smsUpgrade(options) {
|
|
|
64803
65042
|
"Validating AWS credentials",
|
|
64804
65043
|
async () => validateAWSCredentials()
|
|
64805
65044
|
);
|
|
64806
|
-
progress.info(`Connected to AWS account: ${
|
|
65045
|
+
progress.info(`Connected to AWS account: ${pc66.cyan(identity.accountId)}`);
|
|
64807
65046
|
const region = await resolveRegionForCommand({
|
|
64808
65047
|
accountId: identity.accountId,
|
|
64809
65048
|
optionRegion: options.region,
|
|
@@ -64813,34 +65052,34 @@ async function smsUpgrade(options) {
|
|
|
64813
65052
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
64814
65053
|
if (!metadata) {
|
|
64815
65054
|
clack61.log.error(
|
|
64816
|
-
`No Wraps connection found for account ${
|
|
65055
|
+
`No Wraps connection found for account ${pc66.cyan(identity.accountId)} in region ${pc66.cyan(region)}`
|
|
64817
65056
|
);
|
|
64818
65057
|
clack61.log.info(
|
|
64819
|
-
`Use ${
|
|
65058
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64820
65059
|
);
|
|
64821
65060
|
process.exit(1);
|
|
64822
65061
|
}
|
|
64823
65062
|
if (!metadata.services.sms) {
|
|
64824
65063
|
clack61.log.error("No SMS infrastructure found");
|
|
64825
65064
|
clack61.log.info(
|
|
64826
|
-
`Use ${
|
|
65065
|
+
`Use ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
64827
65066
|
);
|
|
64828
65067
|
process.exit(1);
|
|
64829
65068
|
}
|
|
64830
65069
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
64831
65070
|
console.log(`
|
|
64832
|
-
${
|
|
65071
|
+
${pc66.bold("Current Configuration:")}
|
|
64833
65072
|
`);
|
|
64834
65073
|
if (metadata.services.sms.preset) {
|
|
64835
|
-
console.log(` Preset: ${
|
|
65074
|
+
console.log(` Preset: ${pc66.cyan(metadata.services.sms.preset)}`);
|
|
64836
65075
|
} else {
|
|
64837
|
-
console.log(` Preset: ${
|
|
65076
|
+
console.log(` Preset: ${pc66.cyan("custom")}`);
|
|
64838
65077
|
}
|
|
64839
65078
|
const config2 = metadata.services.sms.config;
|
|
64840
65079
|
if (!config2) {
|
|
64841
65080
|
clack61.log.error("No SMS configuration found in metadata");
|
|
64842
65081
|
clack61.log.info(
|
|
64843
|
-
`Use ${
|
|
65082
|
+
`Use ${pc66.cyan("wraps sms init")} to create new infrastructure.`
|
|
64844
65083
|
);
|
|
64845
65084
|
process.exit(1);
|
|
64846
65085
|
}
|
|
@@ -64852,45 +65091,45 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64852
65091
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
64853
65092
|
};
|
|
64854
65093
|
console.log(
|
|
64855
|
-
` Phone Type: ${
|
|
65094
|
+
` Phone Type: ${pc66.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
64856
65095
|
);
|
|
64857
65096
|
}
|
|
64858
65097
|
if (config2.tracking?.enabled) {
|
|
64859
|
-
console.log(` ${
|
|
65098
|
+
console.log(` ${pc66.green("\u2713")} Delivery Tracking`);
|
|
64860
65099
|
if (config2.tracking.linkTracking) {
|
|
64861
|
-
console.log(` ${
|
|
65100
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
64862
65101
|
}
|
|
64863
65102
|
}
|
|
64864
65103
|
if (config2.eventTracking?.enabled) {
|
|
64865
|
-
console.log(` ${
|
|
65104
|
+
console.log(` ${pc66.green("\u2713")} Event Tracking (SNS)`);
|
|
64866
65105
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
64867
65106
|
console.log(
|
|
64868
|
-
` ${
|
|
65107
|
+
` ${pc66.dim("\u2514\u2500")} Message History: ${pc66.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
64869
65108
|
);
|
|
64870
65109
|
}
|
|
64871
65110
|
}
|
|
64872
65111
|
if (config2.messageArchiving?.enabled) {
|
|
64873
65112
|
console.log(
|
|
64874
|
-
` ${
|
|
65113
|
+
` ${pc66.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
64875
65114
|
);
|
|
64876
65115
|
}
|
|
64877
65116
|
if (config2.optOutManagement) {
|
|
64878
|
-
console.log(` ${
|
|
65117
|
+
console.log(` ${pc66.green("\u2713")} Opt-out Management`);
|
|
64879
65118
|
}
|
|
64880
65119
|
if (config2.protectConfiguration?.enabled) {
|
|
64881
65120
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
64882
|
-
console.log(` ${
|
|
64883
|
-
console.log(` ${
|
|
65121
|
+
console.log(` ${pc66.green("\u2713")} Fraud Protection`);
|
|
65122
|
+
console.log(` ${pc66.dim("\u2514\u2500")} Allowed countries: ${pc66.cyan(countries)}`);
|
|
64884
65123
|
if (config2.protectConfiguration.aitFiltering) {
|
|
64885
|
-
console.log(` ${
|
|
65124
|
+
console.log(` ${pc66.dim("\u2514\u2500")} AIT filtering: ${pc66.cyan("enabled")}`);
|
|
64886
65125
|
}
|
|
64887
65126
|
} else {
|
|
64888
|
-
console.log(` ${
|
|
65127
|
+
console.log(` ${pc66.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
64889
65128
|
}
|
|
64890
65129
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
64891
65130
|
console.log(
|
|
64892
65131
|
`
|
|
64893
|
-
Estimated Cost: ${
|
|
65132
|
+
Estimated Cost: ${pc66.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
64894
65133
|
);
|
|
64895
65134
|
console.log("");
|
|
64896
65135
|
const phoneTypeLabels = {
|
|
@@ -64997,22 +65236,22 @@ ${pc65.bold("Current Configuration:")}
|
|
|
64997
65236
|
if (selectedType === "toll-free") {
|
|
64998
65237
|
console.log(
|
|
64999
65238
|
`
|
|
65000
|
-
${
|
|
65239
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("Toll-free Registration Required")}
|
|
65001
65240
|
`
|
|
65002
65241
|
);
|
|
65003
65242
|
console.log(
|
|
65004
|
-
|
|
65243
|
+
pc66.dim("Toll-free numbers require carrier registration before")
|
|
65005
65244
|
);
|
|
65006
65245
|
console.log(
|
|
65007
|
-
|
|
65246
|
+
pc66.dim("they can send messages at scale. After deployment:\n")
|
|
65008
65247
|
);
|
|
65009
65248
|
console.log(
|
|
65010
|
-
` 1. Run ${
|
|
65249
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start registration`
|
|
65011
65250
|
);
|
|
65012
65251
|
console.log(" 2. Submit your business use case information");
|
|
65013
65252
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
65014
65253
|
console.log(
|
|
65015
|
-
|
|
65254
|
+
pc66.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
65016
65255
|
);
|
|
65017
65256
|
const confirmTollFree = await clack61.confirm({
|
|
65018
65257
|
message: "Continue with toll-free number request?",
|
|
@@ -65026,10 +65265,10 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("Toll-free Registration Required")}
|
|
|
65026
65265
|
if (selectedType === "10dlc") {
|
|
65027
65266
|
console.log(
|
|
65028
65267
|
`
|
|
65029
|
-
${
|
|
65268
|
+
${pc66.yellow("\u26A0")} ${pc66.bold("10DLC Campaign Registration Required")}
|
|
65030
65269
|
`
|
|
65031
65270
|
);
|
|
65032
|
-
console.log(
|
|
65271
|
+
console.log(pc66.dim("10DLC requires brand and campaign registration:"));
|
|
65033
65272
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
65034
65273
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
65035
65274
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
@@ -65262,12 +65501,12 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
65262
65501
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
65263
65502
|
if (enableLinkTracking) {
|
|
65264
65503
|
clack61.log.info(
|
|
65265
|
-
|
|
65504
|
+
pc66.dim(
|
|
65266
65505
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
65267
65506
|
)
|
|
65268
65507
|
);
|
|
65269
65508
|
clack61.log.info(
|
|
65270
|
-
|
|
65509
|
+
pc66.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
65271
65510
|
);
|
|
65272
65511
|
}
|
|
65273
65512
|
const confirmed = await clack61.confirm({
|
|
@@ -65480,18 +65719,18 @@ ${pc65.yellow("\u26A0")} ${pc65.bold("10DLC Campaign Registration Required")}
|
|
|
65480
65719
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
65481
65720
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
65482
65721
|
console.log(`
|
|
65483
|
-
${
|
|
65722
|
+
${pc66.bold("Cost Impact:")}`);
|
|
65484
65723
|
console.log(
|
|
65485
|
-
` Current: ${
|
|
65724
|
+
` Current: ${pc66.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
65486
65725
|
);
|
|
65487
65726
|
console.log(
|
|
65488
|
-
` New: ${
|
|
65727
|
+
` New: ${pc66.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
65489
65728
|
);
|
|
65490
65729
|
if (costDiff > 0) {
|
|
65491
|
-
console.log(` Change: ${
|
|
65730
|
+
console.log(` Change: ${pc66.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
65492
65731
|
} else if (costDiff < 0) {
|
|
65493
65732
|
console.log(
|
|
65494
|
-
` Change: ${
|
|
65733
|
+
` Change: ${pc66.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
65495
65734
|
);
|
|
65496
65735
|
}
|
|
65497
65736
|
console.log("");
|
|
@@ -65520,7 +65759,7 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
65520
65759
|
const stackName = metadata.services.sms?.pulumiStackName || `wraps-sms-${identity.accountId}-${region}`;
|
|
65521
65760
|
const createStack = async () => {
|
|
65522
65761
|
await ensurePulumiWorkDir({ accountId: identity.accountId, region });
|
|
65523
|
-
const stack = await
|
|
65762
|
+
const stack = await pulumi35.automation.LocalWorkspace.createOrSelectStack(
|
|
65524
65763
|
{
|
|
65525
65764
|
stackName,
|
|
65526
65765
|
projectName: "wraps-sms",
|
|
@@ -65571,7 +65810,7 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
65571
65810
|
commandName: "wraps sms upgrade"
|
|
65572
65811
|
});
|
|
65573
65812
|
clack61.outro(
|
|
65574
|
-
|
|
65813
|
+
pc66.green("Preview complete. Run without --preview to upgrade.")
|
|
65575
65814
|
);
|
|
65576
65815
|
trackServiceUpgrade("sms", {
|
|
65577
65816
|
region,
|
|
@@ -65676,43 +65915,43 @@ ${pc65.bold("Cost Impact:")}`);
|
|
|
65676
65915
|
}
|
|
65677
65916
|
progress.info("Connection metadata updated");
|
|
65678
65917
|
console.log("\n");
|
|
65679
|
-
clack61.log.success(
|
|
65918
|
+
clack61.log.success(pc66.green(pc66.bold("SMS infrastructure upgraded!")));
|
|
65680
65919
|
console.log("\n");
|
|
65681
65920
|
clack61.note(
|
|
65682
65921
|
[
|
|
65683
|
-
`${
|
|
65684
|
-
`${
|
|
65685
|
-
`${
|
|
65686
|
-
`${
|
|
65687
|
-
outputs.tableName ? `${
|
|
65922
|
+
`${pc66.bold("Phone Number:")} ${pc66.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
65923
|
+
`${pc66.bold("Phone Type:")} ${pc66.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
65924
|
+
`${pc66.bold("Config Set:")} ${pc66.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
65925
|
+
`${pc66.bold("Region:")} ${pc66.cyan(outputs.region)}`,
|
|
65926
|
+
outputs.tableName ? `${pc66.bold("History Table:")} ${pc66.cyan(outputs.tableName)}` : "",
|
|
65688
65927
|
"",
|
|
65689
|
-
|
|
65690
|
-
|
|
65928
|
+
pc66.dim("IAM Role:"),
|
|
65929
|
+
pc66.dim(` ${outputs.roleArn}`)
|
|
65691
65930
|
].filter(Boolean).join("\n"),
|
|
65692
65931
|
"SMS Infrastructure"
|
|
65693
65932
|
);
|
|
65694
65933
|
console.log(`
|
|
65695
|
-
${
|
|
65934
|
+
${pc66.green("\u2713")} ${pc66.bold("Upgrade complete!")}
|
|
65696
65935
|
`);
|
|
65697
65936
|
if (upgradeAction === "phone-number") {
|
|
65698
65937
|
console.log(
|
|
65699
|
-
`Upgraded to ${
|
|
65938
|
+
`Upgraded to ${pc66.cyan(updatedConfig.phoneNumberType)} number (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
65700
65939
|
`
|
|
65701
65940
|
);
|
|
65702
65941
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
65703
|
-
console.log(`${
|
|
65942
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
65704
65943
|
console.log(
|
|
65705
|
-
` 1. Run ${
|
|
65944
|
+
` 1. Run ${pc66.cyan("wraps sms register")} to start toll-free registration`
|
|
65706
65945
|
);
|
|
65707
65946
|
console.log(" 2. Submit your business information and use case");
|
|
65708
65947
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
65709
65948
|
console.log("");
|
|
65710
65949
|
console.log(
|
|
65711
|
-
|
|
65950
|
+
pc66.dim("Until verified, your number can only send limited messages.")
|
|
65712
65951
|
);
|
|
65713
65952
|
console.log("");
|
|
65714
65953
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
65715
|
-
console.log(`${
|
|
65954
|
+
console.log(`${pc66.bold("Next Steps:")}`);
|
|
65716
65955
|
console.log(" 1. Register your brand in the AWS Console");
|
|
65717
65956
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
65718
65957
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -65720,16 +65959,16 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
65720
65959
|
}
|
|
65721
65960
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
65722
65961
|
console.log(
|
|
65723
|
-
`Upgraded to ${
|
|
65962
|
+
`Upgraded to ${pc66.cyan(newPreset)} preset (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
65724
65963
|
`
|
|
65725
65964
|
);
|
|
65726
65965
|
} else {
|
|
65727
65966
|
console.log(
|
|
65728
|
-
`Updated configuration (${
|
|
65967
|
+
`Updated configuration (${pc66.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
65729
65968
|
`
|
|
65730
65969
|
);
|
|
65731
65970
|
}
|
|
65732
|
-
console.log(
|
|
65971
|
+
console.log(pc66.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
65733
65972
|
const enabledFeatures = [];
|
|
65734
65973
|
if (updatedConfig.tracking?.enabled) {
|
|
65735
65974
|
enabledFeatures.push("tracking");
|
|
@@ -65753,7 +65992,7 @@ ${pc65.green("\u2713")} ${pc65.bold("Upgrade complete!")}
|
|
|
65753
65992
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
65754
65993
|
duration_ms: Date.now() - startTime
|
|
65755
65994
|
});
|
|
65756
|
-
clack61.outro(
|
|
65995
|
+
clack61.outro(pc66.green("Upgrade complete!"));
|
|
65757
65996
|
}
|
|
65758
65997
|
|
|
65759
65998
|
// src/commands/sms/verify-number.ts
|
|
@@ -65773,12 +66012,12 @@ import {
|
|
|
65773
66012
|
VerifyDestinationNumberCommand
|
|
65774
66013
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
65775
66014
|
import * as clack62 from "@clack/prompts";
|
|
65776
|
-
import
|
|
66015
|
+
import pc67 from "picocolors";
|
|
65777
66016
|
async function smsVerifyNumber(options) {
|
|
65778
66017
|
const startTime = Date.now();
|
|
65779
66018
|
const progress = new DeploymentProgress();
|
|
65780
66019
|
if (!isJsonMode()) {
|
|
65781
|
-
clack62.intro(
|
|
66020
|
+
clack62.intro(pc67.bold("Wraps SMS - Verify Destination Number"));
|
|
65782
66021
|
}
|
|
65783
66022
|
const identity = await progress.execute(
|
|
65784
66023
|
"Validating AWS credentials",
|
|
@@ -65791,7 +66030,7 @@ async function smsVerifyNumber(options) {
|
|
|
65791
66030
|
clack62.log.error("No SMS infrastructure found");
|
|
65792
66031
|
console.log(
|
|
65793
66032
|
`
|
|
65794
|
-
Run ${
|
|
66033
|
+
Run ${pc67.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
65795
66034
|
`
|
|
65796
66035
|
);
|
|
65797
66036
|
process.exit(1);
|
|
@@ -65808,16 +66047,16 @@ Run ${pc66.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
65808
66047
|
clack62.log.info("No verified destination numbers found");
|
|
65809
66048
|
console.log(
|
|
65810
66049
|
`
|
|
65811
|
-
Run ${
|
|
66050
|
+
Run ${pc67.cyan("wraps sms verify-number")} to verify a number.
|
|
65812
66051
|
`
|
|
65813
66052
|
);
|
|
65814
66053
|
} else {
|
|
65815
66054
|
console.log("\n");
|
|
65816
|
-
clack62.log.info(
|
|
66055
|
+
clack62.log.info(pc67.bold("Verified Destination Numbers:"));
|
|
65817
66056
|
console.log("");
|
|
65818
66057
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
65819
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
65820
|
-
console.log(` ${
|
|
66058
|
+
const status2 = num.Status === "VERIFIED" ? pc67.green("\u2713 Verified") : pc67.yellow("\u29D6 Pending");
|
|
66059
|
+
console.log(` ${pc67.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
65821
66060
|
}
|
|
65822
66061
|
console.log("");
|
|
65823
66062
|
}
|
|
@@ -65835,7 +66074,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65835
66074
|
});
|
|
65836
66075
|
return;
|
|
65837
66076
|
}
|
|
65838
|
-
clack62.outro(
|
|
66077
|
+
clack62.outro(pc67.green("Done!"));
|
|
65839
66078
|
return;
|
|
65840
66079
|
} catch (error) {
|
|
65841
66080
|
progress.stop();
|
|
@@ -65854,7 +66093,7 @@ Run ${pc66.cyan("wraps sms verify-number")} to verify a number.
|
|
|
65854
66093
|
clack62.log.error("Phone number is required for deletion");
|
|
65855
66094
|
console.log(
|
|
65856
66095
|
`
|
|
65857
|
-
Usage: ${
|
|
66096
|
+
Usage: ${pc67.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
65858
66097
|
`
|
|
65859
66098
|
);
|
|
65860
66099
|
process.exit(1);
|
|
@@ -65879,7 +66118,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65879
66118
|
);
|
|
65880
66119
|
});
|
|
65881
66120
|
progress.stop();
|
|
65882
|
-
clack62.log.success(`Removed ${
|
|
66121
|
+
clack62.log.success(`Removed ${pc67.cyan(phoneNumber2)} from verified list`);
|
|
65883
66122
|
trackCommand("sms:verify-number:delete", {
|
|
65884
66123
|
success: true,
|
|
65885
66124
|
duration_ms: Date.now() - startTime
|
|
@@ -65891,7 +66130,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65891
66130
|
});
|
|
65892
66131
|
return;
|
|
65893
66132
|
}
|
|
65894
|
-
clack62.outro(
|
|
66133
|
+
clack62.outro(pc67.green("Done!"));
|
|
65895
66134
|
return;
|
|
65896
66135
|
} catch (error) {
|
|
65897
66136
|
progress.stop();
|
|
@@ -65963,11 +66202,11 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65963
66202
|
progress.stop();
|
|
65964
66203
|
console.log("\n");
|
|
65965
66204
|
clack62.log.success(
|
|
65966
|
-
|
|
66205
|
+
pc67.green(`Phone number ${pc67.cyan(phoneNumber)} verified!`)
|
|
65967
66206
|
);
|
|
65968
66207
|
console.log("");
|
|
65969
66208
|
console.log(
|
|
65970
|
-
`You can now send test messages to this number with ${
|
|
66209
|
+
`You can now send test messages to this number with ${pc67.cyan("wraps sms test")}`
|
|
65971
66210
|
);
|
|
65972
66211
|
trackCommand("sms:verify-number:confirm", {
|
|
65973
66212
|
success: true,
|
|
@@ -65980,7 +66219,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65980
66219
|
});
|
|
65981
66220
|
return;
|
|
65982
66221
|
}
|
|
65983
|
-
clack62.outro(
|
|
66222
|
+
clack62.outro(pc67.green("Verification complete!"));
|
|
65984
66223
|
return;
|
|
65985
66224
|
} catch (error) {
|
|
65986
66225
|
progress.stop();
|
|
@@ -65989,7 +66228,7 @@ Usage: ${pc66.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
65989
66228
|
clack62.log.error("Invalid verification code. Please try again.");
|
|
65990
66229
|
console.log(
|
|
65991
66230
|
`
|
|
65992
|
-
Run ${
|
|
66231
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
65993
66232
|
`
|
|
65994
66233
|
);
|
|
65995
66234
|
} else {
|
|
@@ -66025,11 +66264,11 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66025
66264
|
);
|
|
66026
66265
|
});
|
|
66027
66266
|
progress.stop();
|
|
66028
|
-
clack62.log.success(`Verification code resent to ${
|
|
66267
|
+
clack62.log.success(`Verification code resent to ${pc67.cyan(phoneNumber)}`);
|
|
66029
66268
|
console.log("");
|
|
66030
66269
|
console.log(
|
|
66031
66270
|
`Once you receive the code, run:
|
|
66032
|
-
${
|
|
66271
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
66033
66272
|
);
|
|
66034
66273
|
trackCommand("sms:verify-number:resend", {
|
|
66035
66274
|
success: true,
|
|
@@ -66042,7 +66281,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66042
66281
|
});
|
|
66043
66282
|
return;
|
|
66044
66283
|
}
|
|
66045
|
-
clack62.outro(
|
|
66284
|
+
clack62.outro(pc67.green("Code sent!"));
|
|
66046
66285
|
return;
|
|
66047
66286
|
} catch (error) {
|
|
66048
66287
|
progress.stop();
|
|
@@ -66071,9 +66310,9 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66071
66310
|
return;
|
|
66072
66311
|
}
|
|
66073
66312
|
clack62.log.info(
|
|
66074
|
-
`Number ${
|
|
66313
|
+
`Number ${pc67.cyan(phoneNumber)} is already verified and ready to use!`
|
|
66075
66314
|
);
|
|
66076
|
-
clack62.outro(
|
|
66315
|
+
clack62.outro(pc67.green("Done!"));
|
|
66077
66316
|
return;
|
|
66078
66317
|
}
|
|
66079
66318
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -66098,14 +66337,14 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66098
66337
|
return;
|
|
66099
66338
|
}
|
|
66100
66339
|
clack62.log.info(
|
|
66101
|
-
`Verification already in progress. New code sent to ${
|
|
66340
|
+
`Verification already in progress. New code sent to ${pc67.cyan(phoneNumber)}`
|
|
66102
66341
|
);
|
|
66103
66342
|
console.log("");
|
|
66104
66343
|
console.log(
|
|
66105
66344
|
`Once you receive the code, run:
|
|
66106
|
-
${
|
|
66345
|
+
${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
66107
66346
|
);
|
|
66108
|
-
clack62.outro(
|
|
66347
|
+
clack62.outro(pc67.green("Code sent!"));
|
|
66109
66348
|
return;
|
|
66110
66349
|
}
|
|
66111
66350
|
const createResponse = await progress.execute(
|
|
@@ -66127,7 +66366,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66127
66366
|
progress.stop();
|
|
66128
66367
|
console.log("\n");
|
|
66129
66368
|
clack62.log.success(
|
|
66130
|
-
`Verification code sent to ${
|
|
66369
|
+
`Verification code sent to ${pc67.cyan(phoneNumber)} via SMS`
|
|
66131
66370
|
);
|
|
66132
66371
|
console.log("");
|
|
66133
66372
|
clack62.note(
|
|
@@ -66135,9 +66374,9 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66135
66374
|
"1. Check your phone for the verification code",
|
|
66136
66375
|
"",
|
|
66137
66376
|
"2. Complete verification with:",
|
|
66138
|
-
` ${
|
|
66377
|
+
` ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
66139
66378
|
"",
|
|
66140
|
-
|
|
66379
|
+
pc67.dim("The code expires in 24 hours")
|
|
66141
66380
|
].join("\n"),
|
|
66142
66381
|
"Next Steps"
|
|
66143
66382
|
);
|
|
@@ -66153,7 +66392,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66153
66392
|
});
|
|
66154
66393
|
return;
|
|
66155
66394
|
}
|
|
66156
|
-
clack62.outro(
|
|
66395
|
+
clack62.outro(pc67.green("Verification started!"));
|
|
66157
66396
|
} catch (error) {
|
|
66158
66397
|
progress.stop();
|
|
66159
66398
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -66161,7 +66400,7 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66161
66400
|
clack62.log.error("This number is already being verified");
|
|
66162
66401
|
console.log(
|
|
66163
66402
|
`
|
|
66164
|
-
Run ${
|
|
66403
|
+
Run ${pc67.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
66165
66404
|
`
|
|
66166
66405
|
);
|
|
66167
66406
|
} else {
|
|
@@ -66178,21 +66417,21 @@ Run ${pc66.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
66178
66417
|
init_esm_shims();
|
|
66179
66418
|
init_events();
|
|
66180
66419
|
import * as clack63 from "@clack/prompts";
|
|
66181
|
-
import
|
|
66420
|
+
import pc68 from "picocolors";
|
|
66182
66421
|
async function support() {
|
|
66183
66422
|
trackCommand("support", { success: true });
|
|
66184
|
-
clack63.intro(
|
|
66423
|
+
clack63.intro(pc68.bold("Get Help with Wraps"));
|
|
66185
66424
|
console.log();
|
|
66186
|
-
console.log(` ${
|
|
66425
|
+
console.log(` ${pc68.bold("Email:")} ${pc68.cyan("hey@wraps.dev")}`);
|
|
66187
66426
|
console.log(
|
|
66188
|
-
` ${
|
|
66427
|
+
` ${pc68.bold("GitHub:")} ${pc68.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
66189
66428
|
);
|
|
66190
|
-
console.log(` ${
|
|
66429
|
+
console.log(` ${pc68.bold("Docs:")} ${pc68.cyan("https://wraps.dev/docs")}`);
|
|
66191
66430
|
console.log(
|
|
66192
|
-
` ${
|
|
66431
|
+
` ${pc68.bold("AI docs:")} ${pc68.cyan("https://wraps.dev/llms-full.txt")} ${pc68.dim("(complete docs, one file)")}`
|
|
66193
66432
|
);
|
|
66194
66433
|
console.log();
|
|
66195
|
-
console.log(
|
|
66434
|
+
console.log(pc68.dim(" Response time: Usually within 24 hours"));
|
|
66196
66435
|
console.log();
|
|
66197
66436
|
}
|
|
66198
66437
|
|
|
@@ -66200,7 +66439,7 @@ async function support() {
|
|
|
66200
66439
|
init_esm_shims();
|
|
66201
66440
|
init_client();
|
|
66202
66441
|
import * as clack64 from "@clack/prompts";
|
|
66203
|
-
import
|
|
66442
|
+
import pc69 from "picocolors";
|
|
66204
66443
|
async function telemetryEnable() {
|
|
66205
66444
|
const client2 = getTelemetryClient();
|
|
66206
66445
|
const override = client2.enable();
|
|
@@ -66208,60 +66447,60 @@ async function telemetryEnable() {
|
|
|
66208
66447
|
clack64.log.warn(
|
|
66209
66448
|
"Telemetry enabled in config, but overridden by environment"
|
|
66210
66449
|
);
|
|
66211
|
-
console.log(` Reason: ${
|
|
66212
|
-
console.log(` Config: ${
|
|
66450
|
+
console.log(` Reason: ${pc69.yellow(override)}`);
|
|
66451
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
66213
66452
|
console.log();
|
|
66214
66453
|
} else {
|
|
66215
|
-
clack64.log.success(
|
|
66216
|
-
console.log(` Config: ${
|
|
66454
|
+
clack64.log.success(pc69.green("Telemetry enabled"));
|
|
66455
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
66217
66456
|
console.log(`
|
|
66218
|
-
${
|
|
66457
|
+
${pc69.dim("Thank you for helping improve Wraps!")}
|
|
66219
66458
|
`);
|
|
66220
66459
|
}
|
|
66221
66460
|
}
|
|
66222
66461
|
async function telemetryDisable() {
|
|
66223
66462
|
const client2 = getTelemetryClient();
|
|
66224
66463
|
client2.disable();
|
|
66225
|
-
clack64.log.success(
|
|
66226
|
-
console.log(` Config: ${
|
|
66464
|
+
clack64.log.success(pc69.green("Telemetry disabled"));
|
|
66465
|
+
console.log(` Config: ${pc69.dim(client2.getConfigPath())}`);
|
|
66227
66466
|
console.log(
|
|
66228
66467
|
`
|
|
66229
|
-
${
|
|
66468
|
+
${pc69.dim("You can re-enable with:")} wraps telemetry enable
|
|
66230
66469
|
`
|
|
66231
66470
|
);
|
|
66232
66471
|
}
|
|
66233
66472
|
async function telemetryStatus() {
|
|
66234
66473
|
const client2 = getTelemetryClient();
|
|
66235
|
-
clack64.intro(
|
|
66474
|
+
clack64.intro(pc69.bold("Telemetry Status"));
|
|
66236
66475
|
const override = client2.getEnvOverride();
|
|
66237
|
-
const status2 = client2.isEnabled() ?
|
|
66476
|
+
const status2 = client2.isEnabled() ? pc69.green("Enabled") : pc69.red("Disabled");
|
|
66238
66477
|
console.log();
|
|
66239
|
-
console.log(` ${
|
|
66478
|
+
console.log(` ${pc69.bold("Status:")} ${status2}`);
|
|
66240
66479
|
if (!client2.isEnabled() && override) {
|
|
66241
|
-
console.log(` ${
|
|
66480
|
+
console.log(` ${pc69.bold("Reason:")} ${pc69.yellow(override)}`);
|
|
66242
66481
|
}
|
|
66243
|
-
console.log(` ${
|
|
66482
|
+
console.log(` ${pc69.bold("Config file:")} ${pc69.dim(client2.getConfigPath())}`);
|
|
66244
66483
|
if (client2.isEnabled()) {
|
|
66245
66484
|
console.log();
|
|
66246
|
-
console.log(
|
|
66247
|
-
console.log(` ${
|
|
66485
|
+
console.log(pc69.bold(" How to opt-out:"));
|
|
66486
|
+
console.log(` ${pc69.cyan("wraps telemetry disable")}`);
|
|
66248
66487
|
console.log(
|
|
66249
|
-
` ${
|
|
66488
|
+
` ${pc69.dim("Or set:")} ${pc69.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
66250
66489
|
);
|
|
66251
|
-
console.log(` ${
|
|
66490
|
+
console.log(` ${pc69.dim("Or set:")} ${pc69.cyan("DO_NOT_TRACK=1")}`);
|
|
66252
66491
|
} else {
|
|
66253
66492
|
console.log();
|
|
66254
|
-
console.log(
|
|
66255
|
-
console.log(` ${
|
|
66493
|
+
console.log(pc69.bold(" How to opt-in:"));
|
|
66494
|
+
console.log(` ${pc69.cyan("wraps telemetry enable")}`);
|
|
66256
66495
|
}
|
|
66257
66496
|
console.log();
|
|
66258
|
-
console.log(
|
|
66497
|
+
console.log(pc69.bold(" Debug mode:"));
|
|
66259
66498
|
console.log(
|
|
66260
|
-
` ${
|
|
66499
|
+
` ${pc69.dim("See what would be sent:")} ${pc69.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
66261
66500
|
);
|
|
66262
66501
|
console.log();
|
|
66263
66502
|
console.log(
|
|
66264
|
-
` ${
|
|
66503
|
+
` ${pc69.dim("Learn more:")} ${pc69.cyan("https://wraps.dev/docs/telemetry")}`
|
|
66265
66504
|
);
|
|
66266
66505
|
console.log();
|
|
66267
66506
|
}
|
|
@@ -66271,7 +66510,7 @@ init_esm_shims();
|
|
|
66271
66510
|
import { existsSync as existsSync18, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
66272
66511
|
import { join as join23 } from "path";
|
|
66273
66512
|
import * as clack65 from "@clack/prompts";
|
|
66274
|
-
import
|
|
66513
|
+
import pc70 from "picocolors";
|
|
66275
66514
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
66276
66515
|
defineWorkflow,
|
|
66277
66516
|
sendEmail,
|
|
@@ -66366,13 +66605,13 @@ export default defineConfig({
|
|
|
66366
66605
|
});
|
|
66367
66606
|
`;
|
|
66368
66607
|
async function workflowInit(options = {}) {
|
|
66369
|
-
clack65.intro(
|
|
66608
|
+
clack65.intro(pc70.bgCyan(pc70.black(" wraps workflow init ")));
|
|
66370
66609
|
const wrapsDir = join23(process.cwd(), "wraps");
|
|
66371
66610
|
const workflowsDir = join23(wrapsDir, "workflows");
|
|
66372
66611
|
const configPath = join23(wrapsDir, "wraps.config.ts");
|
|
66373
66612
|
if (existsSync18(workflowsDir)) {
|
|
66374
66613
|
clack65.log.info(
|
|
66375
|
-
`Workflows directory already exists at ${
|
|
66614
|
+
`Workflows directory already exists at ${pc70.cyan("wraps/workflows/")}`
|
|
66376
66615
|
);
|
|
66377
66616
|
const files = existsSync18(join23(workflowsDir, "cart-recovery.ts")) || existsSync18(join23(workflowsDir, "welcome-sequence.ts"));
|
|
66378
66617
|
if (files && !options.yes) {
|
|
@@ -66407,34 +66646,34 @@ async function workflowInit(options = {}) {
|
|
|
66407
66646
|
s2.stop("Created 2 example workflows");
|
|
66408
66647
|
if (!existsSync18(configPath)) {
|
|
66409
66648
|
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
66410
|
-
clack65.log.info(`Created ${
|
|
66649
|
+
clack65.log.info(`Created ${pc70.cyan("wraps/wraps.config.ts")}`);
|
|
66411
66650
|
}
|
|
66412
66651
|
clack65.log.success(
|
|
66413
|
-
`${
|
|
66414
|
-
${
|
|
66415
|
-
${
|
|
66416
|
-
${
|
|
66652
|
+
`${pc70.bold("Workflows scaffolded!")} Created:
|
|
66653
|
+
${pc70.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
66654
|
+
${pc70.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
66655
|
+
${pc70.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
66417
66656
|
);
|
|
66418
66657
|
showNextSteps2();
|
|
66419
|
-
clack65.outro(
|
|
66658
|
+
clack65.outro(pc70.green("Happy orchestrating!"));
|
|
66420
66659
|
} catch (error) {
|
|
66421
66660
|
clack65.log.error(
|
|
66422
66661
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
66423
66662
|
);
|
|
66424
|
-
clack65.outro(
|
|
66663
|
+
clack65.outro(pc70.red("Scaffolding failed."));
|
|
66425
66664
|
process.exitCode = 1;
|
|
66426
66665
|
}
|
|
66427
66666
|
}
|
|
66428
66667
|
function showNextSteps2() {
|
|
66429
66668
|
clack65.log.info(
|
|
66430
|
-
`${
|
|
66669
|
+
`${pc70.bold("Next steps:")}
|
|
66431
66670
|
|
|
66432
|
-
1. Edit ${
|
|
66433
|
-
2. Edit your workflows in ${
|
|
66434
|
-
3. Validate: ${
|
|
66435
|
-
4. Push: ${
|
|
66671
|
+
1. Edit ${pc70.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
66672
|
+
2. Edit your workflows in ${pc70.cyan("wraps/workflows/")}
|
|
66673
|
+
3. Validate: ${pc70.cyan("wraps email workflows validate")}
|
|
66674
|
+
4. Push: ${pc70.cyan("wraps email workflows push")}
|
|
66436
66675
|
|
|
66437
|
-
${
|
|
66676
|
+
${pc70.dim("Docs:")} ${pc70.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
66438
66677
|
);
|
|
66439
66678
|
}
|
|
66440
66679
|
|
|
@@ -66513,14 +66752,22 @@ function suggestCommand(input, known = TOP_LEVEL_COMMANDS) {
|
|
|
66513
66752
|
var UNKNOWN = "unknown";
|
|
66514
66753
|
var COMMAND_WORD = /^[a-z][a-z0-9-]{0,31}$/;
|
|
66515
66754
|
var COMMANDS_WITH_DATA_SECOND_POSITIONAL = ["push"];
|
|
66516
|
-
|
|
66755
|
+
var PAIRS_WITH_DATA_THIRD_POSITIONAL = ["email:check"];
|
|
66756
|
+
function telemetryCommandName(primaryCommand2, subCommand2, thirdPositional) {
|
|
66517
66757
|
if (!(primaryCommand2 && TOP_LEVEL_COMMANDS.includes(primaryCommand2))) {
|
|
66518
66758
|
return UNKNOWN;
|
|
66519
66759
|
}
|
|
66520
66760
|
if (!subCommand2 || COMMANDS_WITH_DATA_SECOND_POSITIONAL.includes(primaryCommand2)) {
|
|
66521
66761
|
return primaryCommand2;
|
|
66522
66762
|
}
|
|
66523
|
-
|
|
66763
|
+
if (!COMMAND_WORD.test(subCommand2)) {
|
|
66764
|
+
return `${primaryCommand2}:${UNKNOWN}`;
|
|
66765
|
+
}
|
|
66766
|
+
const pair = `${primaryCommand2}:${subCommand2}`;
|
|
66767
|
+
if (!(thirdPositional && COMMAND_WORD.test(thirdPositional)) || PAIRS_WITH_DATA_THIRD_POSITIONAL.includes(pair)) {
|
|
66768
|
+
return pair;
|
|
66769
|
+
}
|
|
66770
|
+
return `${pair}:${thirdPositional}`;
|
|
66524
66771
|
}
|
|
66525
66772
|
|
|
66526
66773
|
// src/cli.ts
|
|
@@ -66726,238 +66973,241 @@ function showVersion() {
|
|
|
66726
66973
|
process.exit(0);
|
|
66727
66974
|
}
|
|
66728
66975
|
function showHelp() {
|
|
66729
|
-
clack66.intro(
|
|
66976
|
+
clack66.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
66730
66977
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
66731
66978
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
66732
66979
|
console.log("Services:");
|
|
66733
|
-
console.log(` ${
|
|
66980
|
+
console.log(` ${pc72.cyan("email")} Email infrastructure (AWS SES)`);
|
|
66734
66981
|
console.log(
|
|
66735
|
-
` ${
|
|
66982
|
+
` ${pc72.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
66736
66983
|
);
|
|
66737
66984
|
console.log(
|
|
66738
|
-
` ${
|
|
66985
|
+
` ${pc72.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)`
|
|
66739
66986
|
);
|
|
66740
66987
|
console.log(
|
|
66741
|
-
` ${
|
|
66988
|
+
` ${pc72.cyan("selfhost")} Self-hosted Wraps control plane (enterprise)`
|
|
66742
66989
|
);
|
|
66743
66990
|
console.log(
|
|
66744
|
-
` ${
|
|
66991
|
+
` ${pc72.cyan("license")} License key management (Wraps team only)
|
|
66745
66992
|
`
|
|
66746
66993
|
);
|
|
66747
66994
|
console.log("Email Commands:");
|
|
66748
66995
|
console.log(
|
|
66749
|
-
` ${
|
|
66996
|
+
` ${pc72.cyan("email init")} Deploy new email infrastructure`
|
|
66750
66997
|
);
|
|
66751
66998
|
console.log(
|
|
66752
|
-
` ${
|
|
66999
|
+
` ${pc72.cyan("email check")} Check email deliverability for a domain`
|
|
66753
67000
|
);
|
|
66754
67001
|
console.log(
|
|
66755
|
-
` ${
|
|
67002
|
+
` ${pc72.cyan("email connect")} Connect to existing AWS SES`
|
|
66756
67003
|
);
|
|
66757
67004
|
console.log(
|
|
66758
|
-
` ${
|
|
67005
|
+
` ${pc72.cyan("email status")} Show email infrastructure details`
|
|
66759
67006
|
);
|
|
66760
67007
|
console.log(
|
|
66761
|
-
` ${
|
|
67008
|
+
` ${pc72.cyan("email plan")} Show SES pricing plan and cheaper options`
|
|
66762
67009
|
);
|
|
66763
|
-
console.log(` ${
|
|
66764
|
-
console.log(` ${
|
|
67010
|
+
console.log(` ${pc72.cyan("email test")} Send a test email`);
|
|
67011
|
+
console.log(` ${pc72.cyan("email verify")} Verify domain DNS records`);
|
|
66765
67012
|
console.log(
|
|
66766
|
-
` ${
|
|
67013
|
+
` ${pc72.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
66767
67014
|
);
|
|
66768
|
-
console.log(` ${
|
|
67015
|
+
console.log(` ${pc72.cyan("email upgrade")} Add features`);
|
|
66769
67016
|
console.log(
|
|
66770
|
-
` ${
|
|
67017
|
+
` ${pc72.cyan("email restore")} Restore original configuration`
|
|
66771
67018
|
);
|
|
66772
67019
|
console.log(
|
|
66773
|
-
` ${
|
|
67020
|
+
` ${pc72.cyan("email destroy")} Remove email infrastructure`
|
|
66774
67021
|
);
|
|
66775
67022
|
console.log(
|
|
66776
|
-
` ${
|
|
67023
|
+
` ${pc72.cyan("email doctor")} Diagnose and clean up email infrastructure`
|
|
66777
67024
|
);
|
|
66778
|
-
console.log(` ${
|
|
66779
|
-
console.log(` ${
|
|
66780
|
-
console.log(` ${
|
|
67025
|
+
console.log(` ${pc72.cyan("email domains add")} Add a domain to SES`);
|
|
67026
|
+
console.log(` ${pc72.cyan("email domains list")} List all domains`);
|
|
67027
|
+
console.log(` ${pc72.cyan("email domains remove")} Remove a domain`);
|
|
66781
67028
|
console.log(
|
|
66782
|
-
` ${
|
|
67029
|
+
` ${pc72.cyan("email inbound init")} Enable inbound email receiving`
|
|
66783
67030
|
);
|
|
66784
|
-
console.log(` ${
|
|
67031
|
+
console.log(` ${pc72.cyan("email inbound status")} Show inbound email status`);
|
|
66785
67032
|
console.log(
|
|
66786
|
-
` ${
|
|
67033
|
+
` ${pc72.cyan("email inbound verify")} Verify inbound DNS records`
|
|
66787
67034
|
);
|
|
66788
67035
|
console.log(
|
|
66789
|
-
` ${
|
|
67036
|
+
` ${pc72.cyan("email inbound test")} Send test email and verify receipt`
|
|
66790
67037
|
);
|
|
66791
67038
|
console.log(
|
|
66792
|
-
` ${
|
|
67039
|
+
` ${pc72.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
66793
67040
|
`
|
|
66794
67041
|
);
|
|
66795
67042
|
console.log("Agent Commands:");
|
|
66796
67043
|
console.log(
|
|
66797
|
-
` ${
|
|
67044
|
+
` ${pc72.cyan("email agent create")} Create a leashed agent mailbox`
|
|
66798
67045
|
);
|
|
66799
|
-
console.log(` ${
|
|
67046
|
+
console.log(` ${pc72.cyan("email agent list")} List agents`);
|
|
66800
67047
|
console.log(
|
|
66801
|
-
` ${
|
|
67048
|
+
` ${pc72.cyan("email agent kill")} Kill an agent (revoke sending)
|
|
66802
67049
|
`
|
|
66803
67050
|
);
|
|
66804
67051
|
console.log("Template Commands:");
|
|
66805
67052
|
console.log(
|
|
66806
|
-
` ${
|
|
67053
|
+
` ${pc72.cyan("email templates init")} Initialize templates-as-code`
|
|
66807
67054
|
);
|
|
66808
67055
|
console.log(
|
|
66809
|
-
` ${
|
|
67056
|
+
` ${pc72.cyan("email templates push")} Push templates to SES + dashboard`
|
|
66810
67057
|
);
|
|
66811
67058
|
console.log(
|
|
66812
|
-
` ${
|
|
67059
|
+
` ${pc72.cyan("email templates preview")} Preview templates in browser`
|
|
66813
67060
|
);
|
|
66814
67061
|
console.log(
|
|
66815
|
-
` ${
|
|
67062
|
+
` ${pc72.cyan("push")} ${pc72.dim("(alias for email templates push)")}
|
|
66816
67063
|
`
|
|
66817
67064
|
);
|
|
66818
67065
|
console.log("Workflow Commands:");
|
|
66819
67066
|
console.log(
|
|
66820
|
-
` ${
|
|
67067
|
+
` ${pc72.cyan("email workflows init")} Initialize workflows-as-code`
|
|
66821
67068
|
);
|
|
66822
67069
|
console.log(
|
|
66823
|
-
` ${
|
|
67070
|
+
` ${pc72.cyan("email workflows validate")} Validate workflow files`
|
|
66824
67071
|
);
|
|
66825
67072
|
console.log(
|
|
66826
|
-
` ${
|
|
67073
|
+
` ${pc72.cyan("email workflows push")} Push workflows to dashboard
|
|
66827
67074
|
`
|
|
66828
67075
|
);
|
|
66829
67076
|
console.log("SMS Commands:");
|
|
66830
|
-
console.log(` ${
|
|
67077
|
+
console.log(` ${pc72.cyan("sms init")} Deploy SMS infrastructure`);
|
|
66831
67078
|
console.log(
|
|
66832
|
-
` ${
|
|
67079
|
+
` ${pc72.cyan("sms status")} Show SMS infrastructure details`
|
|
66833
67080
|
);
|
|
66834
|
-
console.log(` ${
|
|
67081
|
+
console.log(` ${pc72.cyan("sms test")} Send a test SMS message`);
|
|
66835
67082
|
console.log(
|
|
66836
|
-
` ${
|
|
67083
|
+
` ${pc72.cyan("sms verify-number")} Verify a destination phone number`
|
|
66837
67084
|
);
|
|
66838
67085
|
console.log(
|
|
66839
|
-
` ${
|
|
67086
|
+
` ${pc72.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
66840
67087
|
);
|
|
66841
|
-
console.log(` ${
|
|
66842
|
-
console.log(` ${
|
|
67088
|
+
console.log(` ${pc72.cyan("sms upgrade")} Upgrade SMS features`);
|
|
67089
|
+
console.log(` ${pc72.cyan("sms register")} Register toll-free number`);
|
|
66843
67090
|
console.log(
|
|
66844
|
-
` ${
|
|
67091
|
+
` ${pc72.cyan("sms destroy")} Remove SMS infrastructure
|
|
66845
67092
|
`
|
|
66846
67093
|
);
|
|
66847
67094
|
console.log("CDN Commands:");
|
|
66848
67095
|
console.log(
|
|
66849
|
-
` ${
|
|
67096
|
+
` ${pc72.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
66850
67097
|
);
|
|
66851
67098
|
console.log(
|
|
66852
|
-
` ${
|
|
67099
|
+
` ${pc72.cyan("cdn status")} Show CDN infrastructure details`
|
|
66853
67100
|
);
|
|
66854
67101
|
console.log(
|
|
66855
|
-
` ${
|
|
67102
|
+
` ${pc72.cyan("cdn verify")} Check DNS and certificate status`
|
|
66856
67103
|
);
|
|
66857
67104
|
console.log(
|
|
66858
|
-
` ${
|
|
67105
|
+
` ${pc72.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
66859
67106
|
);
|
|
66860
67107
|
console.log(
|
|
66861
|
-
` ${
|
|
67108
|
+
` ${pc72.cyan("cdn sync")} Sync infrastructure with current config`
|
|
66862
67109
|
);
|
|
66863
67110
|
console.log(
|
|
66864
|
-
` ${
|
|
67111
|
+
` ${pc72.cyan("cdn destroy")} Remove CDN infrastructure
|
|
66865
67112
|
`
|
|
66866
67113
|
);
|
|
66867
67114
|
console.log("Self-Hosted Commands:");
|
|
66868
67115
|
console.log(
|
|
66869
|
-
` ${
|
|
67116
|
+
` ${pc72.cyan("selfhost login")} Sign in to your self-hosted Wraps instance`
|
|
66870
67117
|
);
|
|
66871
67118
|
console.log(
|
|
66872
|
-
` ${
|
|
67119
|
+
` ${pc72.cyan("selfhost logout")} Sign out of your self-hosted Wraps instance`
|
|
66873
67120
|
);
|
|
66874
67121
|
console.log(
|
|
66875
|
-
` ${
|
|
67122
|
+
` ${pc72.cyan("selfhost status")} Show self-hosted deployment details`
|
|
66876
67123
|
);
|
|
66877
67124
|
console.log(
|
|
66878
|
-
` ${
|
|
67125
|
+
` ${pc72.cyan("selfhost logs")} Stream logs from your self-hosted API, dashboard, and workers`
|
|
66879
67126
|
);
|
|
66880
67127
|
console.log(
|
|
66881
|
-
` ${
|
|
67128
|
+
` ${pc72.cyan("selfhost env")} Print env vars for hosting the dashboard yourself`
|
|
66882
67129
|
);
|
|
66883
67130
|
console.log(
|
|
66884
|
-
` ${
|
|
67131
|
+
` ${pc72.cyan("selfhost connect")} Connect your AWS account to your self-hosted instance`
|
|
66885
67132
|
);
|
|
66886
67133
|
console.log(
|
|
66887
|
-
` ${
|
|
67134
|
+
` ${pc72.cyan("selfhost update-role")} Refresh your self-hosted console role's permissions
|
|
66888
67135
|
`
|
|
66889
67136
|
);
|
|
66890
67137
|
console.log("Local Development:");
|
|
66891
67138
|
console.log(
|
|
66892
|
-
` ${
|
|
67139
|
+
` ${pc72.cyan("console")} Start local web console
|
|
66893
67140
|
`
|
|
66894
67141
|
);
|
|
66895
67142
|
console.log("Platform:");
|
|
66896
67143
|
console.log(
|
|
66897
|
-
` ${
|
|
67144
|
+
` ${pc72.cyan("platform")} Show platform info and pricing`
|
|
66898
67145
|
);
|
|
66899
67146
|
console.log(
|
|
66900
|
-
` ${
|
|
67147
|
+
` ${pc72.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
66901
67148
|
);
|
|
66902
67149
|
console.log(
|
|
66903
|
-
` ${
|
|
67150
|
+
` ${pc72.cyan("platform disconnect")} Stop streaming events to Wraps Platform`
|
|
67151
|
+
);
|
|
67152
|
+
console.log(
|
|
67153
|
+
` ${pc72.cyan("platform update-role")} Update platform IAM permissions
|
|
66904
67154
|
`
|
|
66905
67155
|
);
|
|
66906
67156
|
console.log("Auth:");
|
|
66907
67157
|
console.log(
|
|
66908
|
-
` ${
|
|
67158
|
+
` ${pc72.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
66909
67159
|
);
|
|
66910
|
-
console.log(` ${
|
|
67160
|
+
console.log(` ${pc72.cyan("auth status")} Show current auth state`);
|
|
66911
67161
|
console.log(
|
|
66912
|
-
` ${
|
|
67162
|
+
` ${pc72.cyan("auth logout")} Sign out and remove stored token
|
|
66913
67163
|
`
|
|
66914
67164
|
);
|
|
66915
67165
|
console.log("AWS Setup:");
|
|
66916
67166
|
console.log(
|
|
66917
|
-
` ${
|
|
67167
|
+
` ${pc72.cyan("aws setup")} Interactive AWS setup wizard`
|
|
66918
67168
|
);
|
|
66919
67169
|
console.log(
|
|
66920
|
-
` ${
|
|
67170
|
+
` ${pc72.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
66921
67171
|
`
|
|
66922
67172
|
);
|
|
66923
67173
|
console.log("Global Commands:");
|
|
66924
|
-
console.log(` ${
|
|
67174
|
+
console.log(` ${pc72.cyan("status")} Show overview of all services`);
|
|
66925
67175
|
console.log(
|
|
66926
|
-
` ${
|
|
67176
|
+
` ${pc72.cyan("doctor")} Diagnose AWS + email infrastructure`
|
|
66927
67177
|
);
|
|
66928
|
-
console.log(` ${
|
|
66929
|
-
console.log(` ${
|
|
66930
|
-
console.log(` ${
|
|
67178
|
+
console.log(` ${pc72.cyan("destroy")} Remove deployed infrastructure`);
|
|
67179
|
+
console.log(` ${pc72.cyan("permissions")} Show required AWS IAM permissions`);
|
|
67180
|
+
console.log(` ${pc72.cyan("completion")} Generate shell completion script`);
|
|
66931
67181
|
console.log(
|
|
66932
|
-
` ${
|
|
67182
|
+
` ${pc72.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
66933
67183
|
);
|
|
66934
|
-
console.log(` ${
|
|
66935
|
-
console.log(` ${
|
|
67184
|
+
console.log(` ${pc72.cyan("update")} Update CLI to latest version`);
|
|
67185
|
+
console.log(` ${pc72.cyan("news")} Show recent Wraps updates`);
|
|
66936
67186
|
console.log(
|
|
66937
|
-
` ${
|
|
67187
|
+
` ${pc72.cyan("support")} Get help and support contact info
|
|
66938
67188
|
`
|
|
66939
67189
|
);
|
|
66940
67190
|
console.log("Options:");
|
|
66941
67191
|
console.log(
|
|
66942
|
-
` ${
|
|
67192
|
+
` ${pc72.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
66943
67193
|
);
|
|
66944
|
-
console.log(` ${
|
|
66945
|
-
console.log(` ${
|
|
66946
|
-
console.log(` ${
|
|
66947
|
-
console.log(` ${
|
|
66948
|
-
console.log(` ${
|
|
66949
|
-
console.log(` ${
|
|
66950
|
-
console.log(` ${
|
|
67194
|
+
console.log(` ${pc72.dim("-r, --region")} AWS region`);
|
|
67195
|
+
console.log(` ${pc72.dim("-d, --domain")} Domain name`);
|
|
67196
|
+
console.log(` ${pc72.dim("--account")} AWS account ID or alias`);
|
|
67197
|
+
console.log(` ${pc72.dim("--preset")} Configuration preset`);
|
|
67198
|
+
console.log(` ${pc72.dim("--token")} API key or token for auth`);
|
|
67199
|
+
console.log(` ${pc72.dim("-y, --yes")} Skip confirmation prompts`);
|
|
67200
|
+
console.log(` ${pc72.dim("-f, --force")} Force destructive operations`);
|
|
66951
67201
|
console.log(
|
|
66952
|
-
` ${
|
|
67202
|
+
` ${pc72.dim("--preview")} Preview changes without deploying`
|
|
66953
67203
|
);
|
|
66954
|
-
console.log(` ${
|
|
67204
|
+
console.log(` ${pc72.dim("-v, --version")} Show version number
|
|
66955
67205
|
`);
|
|
66956
67206
|
console.log(
|
|
66957
|
-
`Run ${
|
|
67207
|
+
`Run ${pc72.cyan("wraps <service> <command> --help")} for more information.`
|
|
66958
67208
|
);
|
|
66959
67209
|
console.log(
|
|
66960
|
-
`AI agents: complete docs at ${
|
|
67210
|
+
`AI agents: complete docs at ${pc72.cyan("https://wraps.dev/llms-full.txt")}
|
|
66961
67211
|
`
|
|
66962
67212
|
);
|
|
66963
67213
|
}
|
|
@@ -66979,25 +67229,25 @@ if (!primaryCommand) {
|
|
|
66979
67229
|
const telemetry = getTelemetryClient();
|
|
66980
67230
|
if (!isJsonMode() && telemetry.shouldShowNotification()) {
|
|
66981
67231
|
console.log();
|
|
66982
|
-
clack66.log.info(
|
|
67232
|
+
clack66.log.info(pc72.bold("Anonymous Telemetry"));
|
|
66983
67233
|
console.log(
|
|
66984
|
-
` Wraps collects ${
|
|
67234
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
66985
67235
|
);
|
|
66986
67236
|
console.log(
|
|
66987
|
-
` We ${
|
|
67237
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
66988
67238
|
);
|
|
66989
67239
|
console.log(
|
|
66990
|
-
` We ${
|
|
67240
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
66991
67241
|
);
|
|
66992
67242
|
console.log();
|
|
66993
|
-
console.log(` Opt-out anytime: ${
|
|
66994
|
-
console.log(` Or set: ${
|
|
66995
|
-
console.log(` Learn more: ${
|
|
67243
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
67244
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
67245
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
66996
67246
|
console.log();
|
|
66997
67247
|
telemetry.markNotificationShown();
|
|
66998
67248
|
}
|
|
66999
67249
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
67000
|
-
clack66.intro(
|
|
67250
|
+
clack66.intro(pc72.bold(`WRAPS CLI v${VERSION}`));
|
|
67001
67251
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
67002
67252
|
const action = await clack66.select({
|
|
67003
67253
|
message: "What would you like to do?",
|
|
@@ -67136,20 +67386,20 @@ async function run() {
|
|
|
67136
67386
|
const telemetry = getTelemetryClient();
|
|
67137
67387
|
if (!isJsonMode() && telemetry.shouldShowNotification()) {
|
|
67138
67388
|
console.log();
|
|
67139
|
-
clack66.log.info(
|
|
67389
|
+
clack66.log.info(pc72.bold("Anonymous Telemetry"));
|
|
67140
67390
|
console.log(
|
|
67141
|
-
` Wraps collects ${
|
|
67391
|
+
` Wraps collects ${pc72.cyan("anonymous usage data")} to improve the CLI.`
|
|
67142
67392
|
);
|
|
67143
67393
|
console.log(
|
|
67144
|
-
` We ${
|
|
67394
|
+
` We ${pc72.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
67145
67395
|
);
|
|
67146
67396
|
console.log(
|
|
67147
|
-
` We ${
|
|
67397
|
+
` We ${pc72.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
67148
67398
|
);
|
|
67149
67399
|
console.log();
|
|
67150
|
-
console.log(` Opt-out anytime: ${
|
|
67151
|
-
console.log(` Or set: ${
|
|
67152
|
-
console.log(` Learn more: ${
|
|
67400
|
+
console.log(` Opt-out anytime: ${pc72.cyan("wraps telemetry disable")}`);
|
|
67401
|
+
console.log(` Or set: ${pc72.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
67402
|
+
console.log(` Learn more: ${pc72.cyan("https://wraps.dev/docs")}`);
|
|
67153
67403
|
console.log();
|
|
67154
67404
|
telemetry.markNotificationShown();
|
|
67155
67405
|
}
|
|
@@ -67626,7 +67876,7 @@ async function run() {
|
|
|
67626
67876
|
}
|
|
67627
67877
|
const emailDuration = Date.now() - startTime;
|
|
67628
67878
|
const emailCommandName = `email:${subCommand}`;
|
|
67629
|
-
|
|
67879
|
+
trackCommandFallback(emailCommandName, {
|
|
67630
67880
|
success: true,
|
|
67631
67881
|
duration_ms: emailDuration,
|
|
67632
67882
|
service: "email"
|
|
@@ -67650,7 +67900,7 @@ async function run() {
|
|
|
67650
67900
|
"Run wraps --help for available commands."
|
|
67651
67901
|
);
|
|
67652
67902
|
}
|
|
67653
|
-
|
|
67903
|
+
trackCommandFallback(`license:${subCommand}`, {
|
|
67654
67904
|
success: true,
|
|
67655
67905
|
duration_ms: Date.now() - startTime,
|
|
67656
67906
|
service: "license"
|
|
@@ -67724,7 +67974,7 @@ async function run() {
|
|
|
67724
67974
|
}
|
|
67725
67975
|
const selfhostDuration = Date.now() - startTime;
|
|
67726
67976
|
const selfhostCommandName = `selfhost:${subCommand}`;
|
|
67727
|
-
|
|
67977
|
+
trackCommandFallback(selfhostCommandName, {
|
|
67728
67978
|
success: true,
|
|
67729
67979
|
duration_ms: selfhostDuration,
|
|
67730
67980
|
service: "selfhost"
|
|
@@ -67808,7 +68058,7 @@ async function run() {
|
|
|
67808
68058
|
}
|
|
67809
68059
|
const smsDuration = Date.now() - startTime;
|
|
67810
68060
|
const smsCommandName = `sms:${subCommand}`;
|
|
67811
|
-
|
|
68061
|
+
trackCommandFallback(smsCommandName, {
|
|
67812
68062
|
success: true,
|
|
67813
68063
|
duration_ms: smsDuration,
|
|
67814
68064
|
service: "sms"
|
|
@@ -67870,7 +68120,7 @@ async function run() {
|
|
|
67870
68120
|
}
|
|
67871
68121
|
const cdnDuration = Date.now() - startTime;
|
|
67872
68122
|
const cdnCommandName = `cdn:${subCommand}`;
|
|
67873
|
-
|
|
68123
|
+
trackCommandFallback(cdnCommandName, {
|
|
67874
68124
|
success: true,
|
|
67875
68125
|
duration_ms: cdnDuration,
|
|
67876
68126
|
service: "cdn"
|
|
@@ -67893,7 +68143,7 @@ async function run() {
|
|
|
67893
68143
|
}
|
|
67894
68144
|
const workflowDuration = Date.now() - startTime;
|
|
67895
68145
|
const workflowCommandName = `workflow:${subCommand}`;
|
|
67896
|
-
|
|
68146
|
+
trackCommandFallback(workflowCommandName, {
|
|
67897
68147
|
success: true,
|
|
67898
68148
|
duration_ms: workflowDuration,
|
|
67899
68149
|
service: "workflow"
|
|
@@ -67904,7 +68154,7 @@ async function run() {
|
|
|
67904
68154
|
if (!subCommand) {
|
|
67905
68155
|
await platform2();
|
|
67906
68156
|
const platformDuration2 = Date.now() - startTime;
|
|
67907
|
-
|
|
68157
|
+
trackCommandFallback("platform", {
|
|
67908
68158
|
success: true,
|
|
67909
68159
|
duration_ms: platformDuration2
|
|
67910
68160
|
});
|
|
@@ -67919,6 +68169,14 @@ async function run() {
|
|
|
67919
68169
|
json: flags.json
|
|
67920
68170
|
});
|
|
67921
68171
|
break;
|
|
68172
|
+
case "disconnect":
|
|
68173
|
+
await disconnect({
|
|
68174
|
+
region: flags.region,
|
|
68175
|
+
force: flags.force,
|
|
68176
|
+
yes: flags.yes,
|
|
68177
|
+
json: flags.json
|
|
68178
|
+
});
|
|
68179
|
+
break;
|
|
67922
68180
|
case "update-role":
|
|
67923
68181
|
await updateRole({
|
|
67924
68182
|
region: flags.region,
|
|
@@ -67930,12 +68188,12 @@ async function run() {
|
|
|
67930
68188
|
throw errors.unknownCommand(
|
|
67931
68189
|
"platform command",
|
|
67932
68190
|
subCommand,
|
|
67933
|
-
"Available commands: connect, update-role\n\nRun wraps platform for more information."
|
|
68191
|
+
"Available commands: connect, disconnect, update-role\n\nRun wraps platform for more information."
|
|
67934
68192
|
);
|
|
67935
68193
|
}
|
|
67936
68194
|
const platformDuration = Date.now() - startTime;
|
|
67937
68195
|
const platformCommandName = `platform:${subCommand}`;
|
|
67938
|
-
|
|
68196
|
+
trackCommandFallback(platformCommandName, {
|
|
67939
68197
|
success: true,
|
|
67940
68198
|
duration_ms: platformDuration
|
|
67941
68199
|
});
|
|
@@ -67978,7 +68236,7 @@ async function run() {
|
|
|
67978
68236
|
}
|
|
67979
68237
|
const awsDuration = Date.now() - startTime;
|
|
67980
68238
|
const awsCommandName = `aws:${subCommand}`;
|
|
67981
|
-
|
|
68239
|
+
trackCommandFallback(awsCommandName, {
|
|
67982
68240
|
success: true,
|
|
67983
68241
|
duration_ms: awsDuration
|
|
67984
68242
|
});
|
|
@@ -68092,15 +68350,23 @@ Run wraps --help for available commands.` : "Run wraps --help for available comm
|
|
|
68092
68350
|
}
|
|
68093
68351
|
}
|
|
68094
68352
|
const duration = Date.now() - startTime;
|
|
68095
|
-
const commandName = telemetryCommandName(
|
|
68096
|
-
|
|
68353
|
+
const commandName = telemetryCommandName(
|
|
68354
|
+
primaryCommand,
|
|
68355
|
+
subCommand,
|
|
68356
|
+
sub[2]
|
|
68357
|
+
);
|
|
68358
|
+
trackCommandFallback(commandName, {
|
|
68097
68359
|
success: true,
|
|
68098
68360
|
duration_ms: duration
|
|
68099
68361
|
});
|
|
68100
68362
|
} catch (error) {
|
|
68101
68363
|
const duration = Date.now() - startTime;
|
|
68102
|
-
const commandName = telemetryCommandName(
|
|
68103
|
-
|
|
68364
|
+
const commandName = telemetryCommandName(
|
|
68365
|
+
primaryCommand,
|
|
68366
|
+
subCommand,
|
|
68367
|
+
sub[2]
|
|
68368
|
+
);
|
|
68369
|
+
trackCommandFallback(commandName, {
|
|
68104
68370
|
success: false,
|
|
68105
68371
|
duration_ms: duration
|
|
68106
68372
|
});
|