@wraps.dev/cli 2.14.5 → 2.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -8703,11 +8703,11 @@ var init_dynamodb_metrics = __esm({
|
|
|
8703
8703
|
// src/cli.ts
|
|
8704
8704
|
init_esm_shims();
|
|
8705
8705
|
import { readFileSync as readFileSync3 } from "fs";
|
|
8706
|
-
import { dirname as dirname3, join as
|
|
8706
|
+
import { dirname as dirname3, join as join19 } from "path";
|
|
8707
8707
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
8708
8708
|
import * as clack50 from "@clack/prompts";
|
|
8709
8709
|
import args from "args";
|
|
8710
|
-
import
|
|
8710
|
+
import pc53 from "picocolors";
|
|
8711
8711
|
|
|
8712
8712
|
// src/commands/auth/login.ts
|
|
8713
8713
|
init_esm_shims();
|
|
@@ -24720,349 +24720,16 @@ ${pc30.green("\u2713")} ${pc30.bold("Upgrade complete!")}
|
|
|
24720
24720
|
});
|
|
24721
24721
|
}
|
|
24722
24722
|
|
|
24723
|
-
// src/commands/email/workflows/generate.ts
|
|
24724
|
-
init_esm_shims();
|
|
24725
|
-
init_events();
|
|
24726
|
-
init_json_output();
|
|
24727
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
24728
|
-
import { join as join14 } from "path";
|
|
24729
|
-
import { intro as intro27, log as log29 } from "@clack/prompts";
|
|
24730
|
-
import pc31 from "picocolors";
|
|
24731
|
-
var TEMPLATES = {
|
|
24732
|
-
welcome: `import {
|
|
24733
|
-
defineWorkflow,
|
|
24734
|
-
sendEmail,
|
|
24735
|
-
delay,
|
|
24736
|
-
condition,
|
|
24737
|
-
exit,
|
|
24738
|
-
} from '@wraps.dev/client';
|
|
24739
|
-
|
|
24740
|
-
/**
|
|
24741
|
-
* Welcome Sequence
|
|
24742
|
-
*
|
|
24743
|
-
* Send a welcome email when a contact is created,
|
|
24744
|
-
* wait 1 day, then check if they activated.
|
|
24745
|
-
* If not, send a follow-up with tips.
|
|
24746
|
-
*/
|
|
24747
|
-
export default defineWorkflow({
|
|
24748
|
-
name: 'Welcome Sequence',
|
|
24749
|
-
trigger: {
|
|
24750
|
-
type: 'contact_created',
|
|
24751
|
-
},
|
|
24752
|
-
|
|
24753
|
-
steps: [
|
|
24754
|
-
sendEmail('send-welcome', { template: 'welcome-email' }),
|
|
24755
|
-
delay('wait-1-day', { days: 1 }),
|
|
24756
|
-
condition('check-activated', {
|
|
24757
|
-
field: 'contact.hasActivated',
|
|
24758
|
-
operator: 'equals',
|
|
24759
|
-
value: true,
|
|
24760
|
-
branches: {
|
|
24761
|
-
yes: [exit('already-active')],
|
|
24762
|
-
no: [
|
|
24763
|
-
sendEmail('send-tips', { template: 'getting-started-tips' }),
|
|
24764
|
-
],
|
|
24765
|
-
},
|
|
24766
|
-
}),
|
|
24767
|
-
],
|
|
24768
|
-
});
|
|
24769
|
-
`,
|
|
24770
|
-
"cart-recovery": `import {
|
|
24771
|
-
defineWorkflow,
|
|
24772
|
-
sendEmail,
|
|
24773
|
-
sendSms,
|
|
24774
|
-
delay,
|
|
24775
|
-
cascade,
|
|
24776
|
-
exit,
|
|
24777
|
-
} from '@wraps.dev/client';
|
|
24778
|
-
|
|
24779
|
-
/**
|
|
24780
|
-
* Cart Recovery Cascade
|
|
24781
|
-
*
|
|
24782
|
-
* When a cart is abandoned, wait 30 minutes, then try
|
|
24783
|
-
* email first. If not opened after 2 hours, fall back to SMS.
|
|
24784
|
-
*/
|
|
24785
|
-
export default defineWorkflow({
|
|
24786
|
-
name: 'Cart Recovery Cascade',
|
|
24787
|
-
trigger: {
|
|
24788
|
-
type: 'event',
|
|
24789
|
-
eventName: 'cart.abandoned',
|
|
24790
|
-
},
|
|
24791
|
-
|
|
24792
|
-
steps: [
|
|
24793
|
-
delay('initial-wait', { minutes: 30 }),
|
|
24794
|
-
|
|
24795
|
-
...cascade('recover-cart', {
|
|
24796
|
-
channels: [
|
|
24797
|
-
{
|
|
24798
|
-
type: 'email',
|
|
24799
|
-
template: 'cart-recovery',
|
|
24800
|
-
waitFor: { hours: 2 },
|
|
24801
|
-
engagement: 'opened',
|
|
24802
|
-
},
|
|
24803
|
-
{
|
|
24804
|
-
type: 'sms',
|
|
24805
|
-
template: 'cart-sms-reminder',
|
|
24806
|
-
},
|
|
24807
|
-
],
|
|
24808
|
-
}),
|
|
24809
|
-
|
|
24810
|
-
exit('cascade-complete'),
|
|
24811
|
-
],
|
|
24812
|
-
});
|
|
24813
|
-
`,
|
|
24814
|
-
"trial-conversion": `import {
|
|
24815
|
-
defineWorkflow,
|
|
24816
|
-
sendEmail,
|
|
24817
|
-
delay,
|
|
24818
|
-
condition,
|
|
24819
|
-
exit,
|
|
24820
|
-
} from '@wraps.dev/client';
|
|
24821
|
-
|
|
24822
|
-
/**
|
|
24823
|
-
* Trial Conversion
|
|
24824
|
-
*
|
|
24825
|
-
* Remind users 3 days before their trial ends.
|
|
24826
|
-
* If they haven't upgraded after 1 day, send a final nudge.
|
|
24827
|
-
*/
|
|
24828
|
-
export default defineWorkflow({
|
|
24829
|
-
name: 'Trial Conversion',
|
|
24830
|
-
trigger: {
|
|
24831
|
-
type: 'event',
|
|
24832
|
-
eventName: 'trial.ending',
|
|
24833
|
-
},
|
|
24834
|
-
|
|
24835
|
-
steps: [
|
|
24836
|
-
sendEmail('send-reminder', { template: 'trial-ending-reminder' }),
|
|
24837
|
-
delay('wait-1-day', { days: 1 }),
|
|
24838
|
-
condition('check-upgraded', {
|
|
24839
|
-
field: 'contact.plan',
|
|
24840
|
-
operator: 'not_equals',
|
|
24841
|
-
value: 'free',
|
|
24842
|
-
branches: {
|
|
24843
|
-
yes: [exit('already-upgraded')],
|
|
24844
|
-
no: [
|
|
24845
|
-
sendEmail('send-upgrade-nudge', { template: 'upgrade-offer' }),
|
|
24846
|
-
],
|
|
24847
|
-
},
|
|
24848
|
-
}),
|
|
24849
|
-
],
|
|
24850
|
-
});
|
|
24851
|
-
`,
|
|
24852
|
-
"re-engagement": `import {
|
|
24853
|
-
defineWorkflow,
|
|
24854
|
-
sendEmail,
|
|
24855
|
-
delay,
|
|
24856
|
-
condition,
|
|
24857
|
-
exit,
|
|
24858
|
-
} from '@wraps.dev/client';
|
|
24859
|
-
|
|
24860
|
-
/**
|
|
24861
|
-
* Re-engagement Campaign
|
|
24862
|
-
*
|
|
24863
|
-
* Win back inactive users with a personalized email.
|
|
24864
|
-
* Wait 3 days for engagement, then send a final offer.
|
|
24865
|
-
*/
|
|
24866
|
-
export default defineWorkflow({
|
|
24867
|
-
name: 'Re-engagement Campaign',
|
|
24868
|
-
trigger: {
|
|
24869
|
-
type: 'event',
|
|
24870
|
-
eventName: 'contact.inactive',
|
|
24871
|
-
},
|
|
24872
|
-
|
|
24873
|
-
steps: [
|
|
24874
|
-
sendEmail('send-win-back', { template: 'we-miss-you' }),
|
|
24875
|
-
delay('wait-3-days', { days: 3 }),
|
|
24876
|
-
condition('check-engaged', {
|
|
24877
|
-
field: 'contact.lastActiveAt',
|
|
24878
|
-
operator: 'is_set',
|
|
24879
|
-
value: true,
|
|
24880
|
-
branches: {
|
|
24881
|
-
yes: [exit('re-engaged')],
|
|
24882
|
-
no: [
|
|
24883
|
-
sendEmail('send-final-offer', { template: 'final-offer' }),
|
|
24884
|
-
],
|
|
24885
|
-
},
|
|
24886
|
-
}),
|
|
24887
|
-
],
|
|
24888
|
-
});
|
|
24889
|
-
`,
|
|
24890
|
-
onboarding: `import {
|
|
24891
|
-
defineWorkflow,
|
|
24892
|
-
sendEmail,
|
|
24893
|
-
delay,
|
|
24894
|
-
condition,
|
|
24895
|
-
exit,
|
|
24896
|
-
} from '@wraps.dev/client';
|
|
24897
|
-
|
|
24898
|
-
/**
|
|
24899
|
-
* Multi-step Onboarding
|
|
24900
|
-
*
|
|
24901
|
-
* Guide new users through setup with a series of emails.
|
|
24902
|
-
* Check progress at each step and skip ahead if they're done.
|
|
24903
|
-
*/
|
|
24904
|
-
export default defineWorkflow({
|
|
24905
|
-
name: 'Onboarding Sequence',
|
|
24906
|
-
trigger: {
|
|
24907
|
-
type: 'contact_created',
|
|
24908
|
-
},
|
|
24909
|
-
|
|
24910
|
-
steps: [
|
|
24911
|
-
sendEmail('send-welcome', { template: 'onboarding-welcome' }),
|
|
24912
|
-
delay('wait-1-day', { days: 1 }),
|
|
24913
|
-
|
|
24914
|
-
condition('check-profile-complete', {
|
|
24915
|
-
field: 'contact.profileComplete',
|
|
24916
|
-
operator: 'equals',
|
|
24917
|
-
value: true,
|
|
24918
|
-
branches: {
|
|
24919
|
-
yes: [
|
|
24920
|
-
sendEmail('send-next-steps', { template: 'onboarding-next-steps' }),
|
|
24921
|
-
],
|
|
24922
|
-
no: [
|
|
24923
|
-
sendEmail('send-profile-reminder', { template: 'complete-your-profile' }),
|
|
24924
|
-
delay('wait-2-days', { days: 2 }),
|
|
24925
|
-
sendEmail('send-next-steps-delayed', { template: 'onboarding-next-steps' }),
|
|
24926
|
-
],
|
|
24927
|
-
},
|
|
24928
|
-
}),
|
|
24929
|
-
|
|
24930
|
-
delay('wait-3-days', { days: 3 }),
|
|
24931
|
-
|
|
24932
|
-
condition('check-first-action', {
|
|
24933
|
-
field: 'contact.hasCompletedFirstAction',
|
|
24934
|
-
operator: 'equals',
|
|
24935
|
-
value: true,
|
|
24936
|
-
branches: {
|
|
24937
|
-
yes: [exit('onboarding-complete')],
|
|
24938
|
-
no: [
|
|
24939
|
-
sendEmail('send-help', { template: 'need-help' }),
|
|
24940
|
-
],
|
|
24941
|
-
},
|
|
24942
|
-
}),
|
|
24943
|
-
],
|
|
24944
|
-
});
|
|
24945
|
-
`
|
|
24946
|
-
};
|
|
24947
|
-
var TEMPLATE_NAMES = Object.keys(TEMPLATES);
|
|
24948
|
-
async function workflowsGenerate(options) {
|
|
24949
|
-
const startTime = Date.now();
|
|
24950
|
-
if (options.template) {
|
|
24951
|
-
generateFromTemplate(options);
|
|
24952
|
-
} else {
|
|
24953
|
-
showUsage();
|
|
24954
|
-
return;
|
|
24955
|
-
}
|
|
24956
|
-
trackCommand("email:workflows:generate", {
|
|
24957
|
-
success: true,
|
|
24958
|
-
duration_ms: Date.now() - startTime,
|
|
24959
|
-
mode: "template"
|
|
24960
|
-
});
|
|
24961
|
-
}
|
|
24962
|
-
function showUsage() {
|
|
24963
|
-
if (isJsonMode()) {
|
|
24964
|
-
jsonError("email.workflows.generate", {
|
|
24965
|
-
code: "MISSING_INPUT",
|
|
24966
|
-
message: "Provide a --template name to generate a workflow"
|
|
24967
|
-
});
|
|
24968
|
-
return;
|
|
24969
|
-
}
|
|
24970
|
-
log29.error("Provide a --template to generate a workflow.");
|
|
24971
|
-
console.log();
|
|
24972
|
-
console.log(` ${pc31.bold("Usage:")}`);
|
|
24973
|
-
console.log(
|
|
24974
|
-
` ${pc31.cyan("wraps email workflows generate --template welcome")}`
|
|
24975
|
-
);
|
|
24976
|
-
console.log();
|
|
24977
|
-
console.log(
|
|
24978
|
-
` ${pc31.bold("Available templates:")} ${TEMPLATE_NAMES.join(", ")}`
|
|
24979
|
-
);
|
|
24980
|
-
console.log();
|
|
24981
|
-
console.log(` ${pc31.bold("Want a custom workflow?")}`);
|
|
24982
|
-
console.log(
|
|
24983
|
-
" Describe what you need to your AI coding assistant (Claude Code, Cursor, etc.)"
|
|
24984
|
-
);
|
|
24985
|
-
console.log(
|
|
24986
|
-
` and it will generate a workflow file using the ${pc31.cyan("@wraps.dev/client")} DSL.`
|
|
24987
|
-
);
|
|
24988
|
-
console.log();
|
|
24989
|
-
}
|
|
24990
|
-
function generateFromTemplate(options) {
|
|
24991
|
-
const templateName = options.template ?? "";
|
|
24992
|
-
const templateCode = TEMPLATES[templateName];
|
|
24993
|
-
if (!templateCode) {
|
|
24994
|
-
if (isJsonMode()) {
|
|
24995
|
-
jsonError("email.workflows.generate", {
|
|
24996
|
-
code: "UNKNOWN_TEMPLATE",
|
|
24997
|
-
message: `Unknown template: ${templateName}. Available: ${TEMPLATE_NAMES.join(", ")}`
|
|
24998
|
-
});
|
|
24999
|
-
} else {
|
|
25000
|
-
log29.error(`Unknown template: ${pc31.red(templateName)}`);
|
|
25001
|
-
console.log(
|
|
25002
|
-
`
|
|
25003
|
-
Available templates: ${TEMPLATE_NAMES.map((t) => pc31.cyan(t)).join(", ")}
|
|
25004
|
-
`
|
|
25005
|
-
);
|
|
25006
|
-
}
|
|
25007
|
-
return;
|
|
25008
|
-
}
|
|
25009
|
-
const slug = options.name || templateName;
|
|
25010
|
-
const cwd = process.cwd();
|
|
25011
|
-
const workflowsDir = join14(cwd, "wraps", "workflows");
|
|
25012
|
-
const filePath = join14(workflowsDir, `${slug}.ts`);
|
|
25013
|
-
if (existsSync13(filePath) && !options.force) {
|
|
25014
|
-
if (isJsonMode()) {
|
|
25015
|
-
jsonError("email.workflows.generate", {
|
|
25016
|
-
code: "FILE_EXISTS",
|
|
25017
|
-
message: `wraps/workflows/${slug}.ts already exists. Use --force to overwrite.`
|
|
25018
|
-
});
|
|
25019
|
-
} else {
|
|
25020
|
-
log29.error(
|
|
25021
|
-
`${pc31.cyan(`wraps/workflows/${slug}.ts`)} already exists. Use ${pc31.bold("--force")} to overwrite.`
|
|
25022
|
-
);
|
|
25023
|
-
}
|
|
25024
|
-
return;
|
|
25025
|
-
}
|
|
25026
|
-
mkdirSync2(workflowsDir, { recursive: true });
|
|
25027
|
-
writeFileSync(filePath, templateCode, "utf-8");
|
|
25028
|
-
if (isJsonMode()) {
|
|
25029
|
-
jsonSuccess("email.workflows.generate", {
|
|
25030
|
-
mode: "template",
|
|
25031
|
-
template: templateName,
|
|
25032
|
-
slug,
|
|
25033
|
-
path: `wraps/workflows/${slug}.ts`
|
|
25034
|
-
});
|
|
25035
|
-
} else {
|
|
25036
|
-
intro27(pc31.bold("Generate Workflow"));
|
|
25037
|
-
log29.success(
|
|
25038
|
-
`Created ${pc31.cyan(`wraps/workflows/${slug}.ts`)} from ${pc31.bold(templateName)} template`
|
|
25039
|
-
);
|
|
25040
|
-
showNextSteps2(slug);
|
|
25041
|
-
}
|
|
25042
|
-
}
|
|
25043
|
-
function showNextSteps2(slug) {
|
|
25044
|
-
console.log();
|
|
25045
|
-
console.log(` ${pc31.bold("Next steps:")}`);
|
|
25046
|
-
console.log(
|
|
25047
|
-
` 1. Edit template references in ${pc31.cyan(`wraps/workflows/${slug}.ts`)}`
|
|
25048
|
-
);
|
|
25049
|
-
console.log(
|
|
25050
|
-
` 2. Validate: ${pc31.cyan(`wraps email workflows validate --workflow ${slug}`)}`
|
|
25051
|
-
);
|
|
25052
|
-
console.log(` 3. Push: ${pc31.cyan("wraps email workflows push")}`);
|
|
25053
|
-
console.log();
|
|
25054
|
-
}
|
|
25055
|
-
|
|
25056
24723
|
// src/commands/email/workflows/init.ts
|
|
25057
24724
|
init_esm_shims();
|
|
25058
24725
|
init_events();
|
|
25059
24726
|
init_json_output();
|
|
25060
24727
|
init_output();
|
|
25061
|
-
import { existsSync as
|
|
24728
|
+
import { existsSync as existsSync13 } from "fs";
|
|
25062
24729
|
import { mkdir as mkdir7, readFile as readFile7, writeFile as writeFile9 } from "fs/promises";
|
|
25063
|
-
import { join as
|
|
24730
|
+
import { join as join14 } from "path";
|
|
25064
24731
|
import * as clack30 from "@clack/prompts";
|
|
25065
|
-
import
|
|
24732
|
+
import pc31 from "picocolors";
|
|
25066
24733
|
|
|
25067
24734
|
// src/commands/email/workflows/claude-content.ts
|
|
25068
24735
|
init_esm_shims();
|
|
@@ -25075,8 +24742,6 @@ Workflow automation files live at \`wraps/workflows/*.ts\` and are written using
|
|
|
25075
24742
|
|
|
25076
24743
|
- \`wraps email workflows validate\` \u2014 Validate workflow files locally
|
|
25077
24744
|
- \`wraps email workflows push\` \u2014 Push workflows to the Wraps dashboard
|
|
25078
|
-
- \`wraps email workflows generate --template <name>\` \u2014 Generate from a built-in template
|
|
25079
|
-
- \`wraps email workflows generate "description"\` \u2014 Generate from a natural language description
|
|
25080
24745
|
|
|
25081
24746
|
### Quick Reference
|
|
25082
24747
|
|
|
@@ -25408,8 +25073,6 @@ export default defineWorkflow({
|
|
|
25408
25073
|
wraps email workflows validate # Validate all workflow files
|
|
25409
25074
|
wraps email workflows validate --workflow welcome # Validate a specific workflow
|
|
25410
25075
|
wraps email workflows push # Push workflows to dashboard
|
|
25411
|
-
wraps email workflows generate --template welcome # Generate from built-in template
|
|
25412
|
-
wraps email workflows generate "description..." # Generate from AI description
|
|
25413
25076
|
\`\`\`
|
|
25414
25077
|
`;
|
|
25415
25078
|
|
|
@@ -25455,12 +25118,12 @@ export default defineWorkflow({
|
|
|
25455
25118
|
async function workflowsInit(options) {
|
|
25456
25119
|
const startTime = Date.now();
|
|
25457
25120
|
const cwd = process.cwd();
|
|
25458
|
-
const workflowsDir =
|
|
25121
|
+
const workflowsDir = join14(cwd, "wraps", "workflows");
|
|
25459
25122
|
if (!isJsonMode()) {
|
|
25460
|
-
clack30.intro(
|
|
25123
|
+
clack30.intro(pc31.bold("Workflows as Code"));
|
|
25461
25124
|
}
|
|
25462
25125
|
const progress = new DeploymentProgress();
|
|
25463
|
-
if (
|
|
25126
|
+
if (existsSync13(workflowsDir) && !options.force) {
|
|
25464
25127
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
25465
25128
|
const files = await readdir4(workflowsDir);
|
|
25466
25129
|
const tsFiles = files.filter(
|
|
@@ -25468,14 +25131,14 @@ async function workflowsInit(options) {
|
|
|
25468
25131
|
);
|
|
25469
25132
|
if (tsFiles.length > 0 && !options.force && !isJsonMode()) {
|
|
25470
25133
|
clack30.log.warn(
|
|
25471
|
-
`${
|
|
25134
|
+
`${pc31.cyan("wraps/workflows/")} already contains ${tsFiles.length} workflow file(s). Use ${pc31.bold("--force")} to overwrite.`
|
|
25472
25135
|
);
|
|
25473
25136
|
}
|
|
25474
25137
|
}
|
|
25475
25138
|
progress.start("Creating wraps/workflows/ directory");
|
|
25476
25139
|
await mkdir7(workflowsDir, { recursive: true });
|
|
25477
|
-
const configPath =
|
|
25478
|
-
if (
|
|
25140
|
+
const configPath = join14(cwd, "wraps", "wraps.config.ts");
|
|
25141
|
+
if (existsSync13(configPath)) {
|
|
25479
25142
|
const configContent = await readFile7(configPath, "utf-8");
|
|
25480
25143
|
if (!configContent.includes("workflowsDir")) {
|
|
25481
25144
|
const updated = configContent.replace(
|
|
@@ -25492,8 +25155,8 @@ async function workflowsInit(options) {
|
|
|
25492
25155
|
}
|
|
25493
25156
|
const filesCreated = [];
|
|
25494
25157
|
if (!options.noExample) {
|
|
25495
|
-
const examplePath =
|
|
25496
|
-
if (!
|
|
25158
|
+
const examplePath = join14(workflowsDir, "welcome.ts");
|
|
25159
|
+
if (!existsSync13(examplePath) || options.force) {
|
|
25497
25160
|
await writeFile9(examplePath, EXAMPLE_WORKFLOW, "utf-8");
|
|
25498
25161
|
filesCreated.push("wraps/workflows/welcome.ts");
|
|
25499
25162
|
}
|
|
@@ -25534,26 +25197,26 @@ async function workflowsInit(options) {
|
|
|
25534
25197
|
return;
|
|
25535
25198
|
}
|
|
25536
25199
|
console.log();
|
|
25537
|
-
clack30.log.success(
|
|
25200
|
+
clack30.log.success(pc31.green("Workflows as Code initialized!"));
|
|
25538
25201
|
console.log();
|
|
25539
|
-
console.log(` ${
|
|
25202
|
+
console.log(` ${pc31.dim("Directory:")} ${pc31.cyan("wraps/workflows/")}`);
|
|
25540
25203
|
if (!options.noExample) {
|
|
25541
25204
|
console.log(
|
|
25542
|
-
` ${
|
|
25205
|
+
` ${pc31.dim("Example:")} ${pc31.cyan("wraps/workflows/welcome.ts")}`
|
|
25543
25206
|
);
|
|
25544
25207
|
}
|
|
25545
25208
|
if (!options.noClaude) {
|
|
25546
25209
|
console.log(
|
|
25547
|
-
` ${
|
|
25210
|
+
` ${pc31.dim("AI Context:")} ${pc31.cyan(".claude/skills/wraps-workflows/")}`
|
|
25548
25211
|
);
|
|
25549
25212
|
}
|
|
25550
25213
|
console.log();
|
|
25551
|
-
console.log(`${
|
|
25214
|
+
console.log(`${pc31.bold("Next steps:")}`);
|
|
25552
25215
|
console.log(
|
|
25553
|
-
` 1. Edit or create workflows in ${
|
|
25216
|
+
` 1. Edit or create workflows in ${pc31.cyan("wraps/workflows/")}`
|
|
25554
25217
|
);
|
|
25555
|
-
console.log(` 2. Validate: ${
|
|
25556
|
-
console.log(` 3. Push: ${
|
|
25218
|
+
console.log(` 2. Validate: ${pc31.cyan("wraps email workflows validate")}`);
|
|
25219
|
+
console.log(` 3. Push: ${pc31.cyan("wraps email workflows push")}`);
|
|
25557
25220
|
if (!options.noClaude) {
|
|
25558
25221
|
console.log(" 4. Use Claude Code to generate workflows from descriptions");
|
|
25559
25222
|
}
|
|
@@ -25575,10 +25238,10 @@ export default defineConfig({
|
|
|
25575
25238
|
// src/commands/email/workflows/push.ts
|
|
25576
25239
|
init_esm_shims();
|
|
25577
25240
|
init_events();
|
|
25578
|
-
import { existsSync as
|
|
25579
|
-
import { join as
|
|
25241
|
+
import { existsSync as existsSync15 } from "fs";
|
|
25242
|
+
import { join as join16 } from "path";
|
|
25580
25243
|
import * as clack31 from "@clack/prompts";
|
|
25581
|
-
import
|
|
25244
|
+
import pc32 from "picocolors";
|
|
25582
25245
|
|
|
25583
25246
|
// src/utils/email/workflow-transform.ts
|
|
25584
25247
|
init_esm_shims();
|
|
@@ -25795,11 +25458,11 @@ function assignPositions(steps, transitions) {
|
|
|
25795
25458
|
// src/utils/email/workflow-ts.ts
|
|
25796
25459
|
init_esm_shims();
|
|
25797
25460
|
import { createHash as createHash2 } from "crypto";
|
|
25798
|
-
import { existsSync as
|
|
25461
|
+
import { existsSync as existsSync14 } from "fs";
|
|
25799
25462
|
import { mkdir as mkdir8, readdir as readdir3, readFile as readFile8, writeFile as writeFile10 } from "fs/promises";
|
|
25800
|
-
import { basename, join as
|
|
25463
|
+
import { basename, join as join15 } from "path";
|
|
25801
25464
|
async function discoverWorkflows(dir, filter) {
|
|
25802
|
-
if (!
|
|
25465
|
+
if (!existsSync14(dir)) {
|
|
25803
25466
|
return [];
|
|
25804
25467
|
}
|
|
25805
25468
|
const entries = await readdir3(dir);
|
|
@@ -25822,7 +25485,7 @@ async function parseWorkflowTs(filePath, wrapsDir) {
|
|
|
25822
25485
|
const source = await readFile8(filePath, "utf-8");
|
|
25823
25486
|
const sourceHash = createHash2("sha256").update(source).digest("hex");
|
|
25824
25487
|
const slug = basename(filePath, ".ts");
|
|
25825
|
-
const shimDir =
|
|
25488
|
+
const shimDir = join15(wrapsDir, ".wraps", "_shims");
|
|
25826
25489
|
await mkdir8(shimDir, { recursive: true });
|
|
25827
25490
|
const clientShimContent = `
|
|
25828
25491
|
// Identity functions for workflow definitions
|
|
@@ -26051,7 +25714,7 @@ function durationToSeconds(duration) {
|
|
|
26051
25714
|
}
|
|
26052
25715
|
`;
|
|
26053
25716
|
await writeFile10(
|
|
26054
|
-
|
|
25717
|
+
join15(shimDir, "wraps-client-shim.mjs"),
|
|
26055
25718
|
clientShimContent,
|
|
26056
25719
|
"utf-8"
|
|
26057
25720
|
);
|
|
@@ -26063,13 +25726,13 @@ function durationToSeconds(duration) {
|
|
|
26063
25726
|
platform: "node",
|
|
26064
25727
|
target: "node20",
|
|
26065
25728
|
alias: {
|
|
26066
|
-
"@wraps.dev/client":
|
|
25729
|
+
"@wraps.dev/client": join15(shimDir, "wraps-client-shim.mjs")
|
|
26067
25730
|
}
|
|
26068
25731
|
});
|
|
26069
25732
|
const bundledCode = result.outputFiles[0].text;
|
|
26070
|
-
const tmpDir =
|
|
25733
|
+
const tmpDir = join15(wrapsDir, ".wraps", "_workflows");
|
|
26071
25734
|
await mkdir8(tmpDir, { recursive: true });
|
|
26072
|
-
const tmpPath =
|
|
25735
|
+
const tmpPath = join15(tmpDir, `${slug}.mjs`);
|
|
26073
25736
|
await writeFile10(tmpPath, bundledCode, "utf-8");
|
|
26074
25737
|
const mod = await import(`${tmpPath}?t=${Date.now()}`);
|
|
26075
25738
|
const definition = mod.default;
|
|
@@ -26422,20 +26085,20 @@ init_output();
|
|
|
26422
26085
|
async function workflowsPush(options) {
|
|
26423
26086
|
const startTime = Date.now();
|
|
26424
26087
|
const cwd = process.cwd();
|
|
26425
|
-
const wrapsDir =
|
|
26426
|
-
const configPath =
|
|
26427
|
-
if (!
|
|
26088
|
+
const wrapsDir = join16(cwd, "wraps");
|
|
26089
|
+
const configPath = join16(wrapsDir, "wraps.config.ts");
|
|
26090
|
+
if (!existsSync15(configPath)) {
|
|
26428
26091
|
throw errors.wrapsConfigNotFound();
|
|
26429
26092
|
}
|
|
26430
26093
|
if (!isJsonMode()) {
|
|
26431
|
-
clack31.intro(
|
|
26094
|
+
clack31.intro(pc32.bold("Push Workflows"));
|
|
26432
26095
|
}
|
|
26433
26096
|
const progress = new DeploymentProgress();
|
|
26434
26097
|
progress.start("Loading configuration");
|
|
26435
26098
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
26436
26099
|
progress.succeed("Configuration loaded");
|
|
26437
|
-
const workflowsDir =
|
|
26438
|
-
if (!
|
|
26100
|
+
const workflowsDir = join16(wrapsDir, config2.workflowsDir || "./workflows");
|
|
26101
|
+
if (!existsSync15(workflowsDir)) {
|
|
26439
26102
|
if (isJsonMode()) {
|
|
26440
26103
|
jsonSuccess("email.workflows.push", {
|
|
26441
26104
|
pushed: [],
|
|
@@ -26461,9 +26124,9 @@ async function workflowsPush(options) {
|
|
|
26461
26124
|
return;
|
|
26462
26125
|
}
|
|
26463
26126
|
const lockfile = await loadLockfile(wrapsDir);
|
|
26464
|
-
const templatesDir =
|
|
26127
|
+
const templatesDir = join16(wrapsDir, config2.templatesDir || "./templates");
|
|
26465
26128
|
let localTemplateSlugs;
|
|
26466
|
-
if (
|
|
26129
|
+
if (existsSync15(templatesDir)) {
|
|
26467
26130
|
const templateFiles = await discoverTemplates(templatesDir);
|
|
26468
26131
|
localTemplateSlugs = new Set(
|
|
26469
26132
|
templateFiles.map((f) => f.replace(/\.tsx?$/, ""))
|
|
@@ -26475,14 +26138,14 @@ async function workflowsPush(options) {
|
|
|
26475
26138
|
const validationErrors = [];
|
|
26476
26139
|
for (const file of workflowFiles) {
|
|
26477
26140
|
const slug = file.replace(/\.ts$/, "");
|
|
26478
|
-
const filePath =
|
|
26479
|
-
progress.start(`Processing ${
|
|
26141
|
+
const filePath = join16(workflowsDir, file);
|
|
26142
|
+
progress.start(`Processing ${pc32.cyan(slug)}`);
|
|
26480
26143
|
try {
|
|
26481
26144
|
const parsed = await parseWorkflowTs(filePath, wrapsDir);
|
|
26482
26145
|
const localHashMatches = lockfile.workflows?.[slug]?.localHash === parsed.sourceHash;
|
|
26483
26146
|
if (!options.force && localHashMatches) {
|
|
26484
26147
|
unchanged.push(slug);
|
|
26485
|
-
progress.succeed(`${
|
|
26148
|
+
progress.succeed(`${pc32.cyan(slug)} unchanged`);
|
|
26486
26149
|
continue;
|
|
26487
26150
|
}
|
|
26488
26151
|
const transformed = transformWorkflow(parsed.definition);
|
|
@@ -26499,15 +26162,15 @@ async function workflowsPush(options) {
|
|
|
26499
26162
|
message: e.message
|
|
26500
26163
|
}))
|
|
26501
26164
|
});
|
|
26502
|
-
progress.fail(`${
|
|
26165
|
+
progress.fail(`${pc32.cyan(slug)} has validation errors`);
|
|
26503
26166
|
continue;
|
|
26504
26167
|
}
|
|
26505
26168
|
toProcess.push({ slug, parsed, transformed });
|
|
26506
|
-
progress.succeed(`${
|
|
26169
|
+
progress.succeed(`${pc32.cyan(slug)} validated`);
|
|
26507
26170
|
} catch (err) {
|
|
26508
26171
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
26509
26172
|
parseErrors.push({ slug, error: errMsg });
|
|
26510
|
-
progress.fail(`Failed to parse ${
|
|
26173
|
+
progress.fail(`Failed to parse ${pc32.cyan(slug)}: ${errMsg}`);
|
|
26511
26174
|
}
|
|
26512
26175
|
}
|
|
26513
26176
|
if (validationErrors.length > 0 || parseErrors.length > 0) {
|
|
@@ -26526,7 +26189,7 @@ async function workflowsPush(options) {
|
|
|
26526
26189
|
} else {
|
|
26527
26190
|
console.log();
|
|
26528
26191
|
clack31.log.error(
|
|
26529
|
-
|
|
26192
|
+
pc32.red("Cannot push due to validation errors. Fix errors and retry.")
|
|
26530
26193
|
);
|
|
26531
26194
|
console.log();
|
|
26532
26195
|
}
|
|
@@ -26561,15 +26224,15 @@ async function workflowsPush(options) {
|
|
|
26561
26224
|
});
|
|
26562
26225
|
} else {
|
|
26563
26226
|
console.log();
|
|
26564
|
-
clack31.log.info(
|
|
26227
|
+
clack31.log.info(pc32.bold("Dry run \u2014 no changes made"));
|
|
26565
26228
|
console.log();
|
|
26566
26229
|
for (const w of toProcess) {
|
|
26567
26230
|
console.log(
|
|
26568
|
-
` ${
|
|
26231
|
+
` ${pc32.green("\u25CF")} ${pc32.cyan(w.slug)} \u2014 ${w.parsed.definition.name} (${w.transformed.steps.length} steps)`
|
|
26569
26232
|
);
|
|
26570
26233
|
}
|
|
26571
26234
|
for (const slug of unchanged) {
|
|
26572
|
-
console.log(` ${
|
|
26235
|
+
console.log(` ${pc32.dim("\u25CB")} ${pc32.dim(slug)} \u2014 unchanged`);
|
|
26573
26236
|
}
|
|
26574
26237
|
console.log();
|
|
26575
26238
|
}
|
|
@@ -26619,12 +26282,12 @@ async function workflowsPush(options) {
|
|
|
26619
26282
|
console.log();
|
|
26620
26283
|
if (enabled.length > 0) {
|
|
26621
26284
|
clack31.log.success(
|
|
26622
|
-
|
|
26285
|
+
pc32.green(`${enabled.length} workflow(s) pushed and enabled`)
|
|
26623
26286
|
);
|
|
26624
26287
|
}
|
|
26625
26288
|
if (drafts.length > 0) {
|
|
26626
26289
|
clack31.log.success(
|
|
26627
|
-
|
|
26290
|
+
pc32.green(`${drafts.length} workflow(s) pushed as draft`)
|
|
26628
26291
|
);
|
|
26629
26292
|
}
|
|
26630
26293
|
if (unchanged.length > 0) {
|
|
@@ -26635,7 +26298,7 @@ async function workflowsPush(options) {
|
|
|
26635
26298
|
`${conflicts.length} workflow(s) skipped due to dashboard edits. Use --force to overwrite.`
|
|
26636
26299
|
);
|
|
26637
26300
|
for (const c of conflicts) {
|
|
26638
|
-
console.log(` ${
|
|
26301
|
+
console.log(` ${pc32.yellow("!")} ${pc32.cyan(c.slug)}`);
|
|
26639
26302
|
}
|
|
26640
26303
|
}
|
|
26641
26304
|
console.log();
|
|
@@ -26704,13 +26367,13 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
26704
26367
|
progress.succeed(`Synced ${successCount} workflows to dashboard`);
|
|
26705
26368
|
for (const c of data.conflicts ?? []) {
|
|
26706
26369
|
progress.fail(
|
|
26707
|
-
`${
|
|
26370
|
+
`${pc32.cyan(c.slug)} was edited on the dashboard. Use ${pc32.bold("--force")} to overwrite.`
|
|
26708
26371
|
);
|
|
26709
26372
|
}
|
|
26710
26373
|
} else if (conflictCount > 0) {
|
|
26711
26374
|
for (const c of data.conflicts ?? []) {
|
|
26712
26375
|
progress.fail(
|
|
26713
|
-
`${
|
|
26376
|
+
`${pc32.cyan(c.slug)} was edited on the dashboard. Use ${pc32.bold("--force")} to overwrite.`
|
|
26714
26377
|
);
|
|
26715
26378
|
}
|
|
26716
26379
|
}
|
|
@@ -26738,7 +26401,7 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
26738
26401
|
}
|
|
26739
26402
|
} else if (workflows.length === 1) {
|
|
26740
26403
|
const w = workflows[0];
|
|
26741
|
-
progress.start(`Syncing ${
|
|
26404
|
+
progress.start(`Syncing ${pc32.cyan(w.slug)} to dashboard`);
|
|
26742
26405
|
try {
|
|
26743
26406
|
const resp = await fetch(`${apiBase}/v1/workflows/push`, {
|
|
26744
26407
|
method: "POST",
|
|
@@ -26766,7 +26429,7 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
26766
26429
|
if (Number(resp.status) === 409) {
|
|
26767
26430
|
results.push({ slug: w.slug, success: false, conflict: true });
|
|
26768
26431
|
progress.fail(
|
|
26769
|
-
`${
|
|
26432
|
+
`${pc32.cyan(w.slug)} was edited on the dashboard since last push. Use ${pc32.bold("--force")} to overwrite.`
|
|
26770
26433
|
);
|
|
26771
26434
|
} else if (resp.ok) {
|
|
26772
26435
|
const data = await resp.json();
|
|
@@ -26776,7 +26439,7 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
26776
26439
|
status: data.status,
|
|
26777
26440
|
success: true
|
|
26778
26441
|
});
|
|
26779
|
-
progress.succeed(`Synced ${
|
|
26442
|
+
progress.succeed(`Synced ${pc32.cyan(w.slug)} to dashboard`);
|
|
26780
26443
|
} else {
|
|
26781
26444
|
const body = await resp.text();
|
|
26782
26445
|
throw new Error(`API returned ${resp.status}: ${body}`);
|
|
@@ -26793,30 +26456,30 @@ async function pushToAPI2(workflows, token, progress, options) {
|
|
|
26793
26456
|
// src/commands/email/workflows/validate.ts
|
|
26794
26457
|
init_esm_shims();
|
|
26795
26458
|
init_events();
|
|
26796
|
-
import { existsSync as
|
|
26797
|
-
import { join as
|
|
26459
|
+
import { existsSync as existsSync16 } from "fs";
|
|
26460
|
+
import { join as join17 } from "path";
|
|
26798
26461
|
import * as clack32 from "@clack/prompts";
|
|
26799
|
-
import
|
|
26462
|
+
import pc33 from "picocolors";
|
|
26800
26463
|
init_errors();
|
|
26801
26464
|
init_json_output();
|
|
26802
26465
|
init_output();
|
|
26803
26466
|
async function workflowsValidate(options) {
|
|
26804
26467
|
const startTime = Date.now();
|
|
26805
26468
|
const cwd = process.cwd();
|
|
26806
|
-
const wrapsDir =
|
|
26807
|
-
const configPath =
|
|
26808
|
-
if (!
|
|
26469
|
+
const wrapsDir = join17(cwd, "wraps");
|
|
26470
|
+
const configPath = join17(wrapsDir, "wraps.config.ts");
|
|
26471
|
+
if (!existsSync16(configPath)) {
|
|
26809
26472
|
throw errors.wrapsConfigNotFound();
|
|
26810
26473
|
}
|
|
26811
26474
|
if (!isJsonMode()) {
|
|
26812
|
-
clack32.intro(
|
|
26475
|
+
clack32.intro(pc33.bold("Validate Workflows"));
|
|
26813
26476
|
}
|
|
26814
26477
|
const progress = new DeploymentProgress();
|
|
26815
26478
|
progress.start("Loading configuration");
|
|
26816
26479
|
const config2 = await loadWrapsConfig(wrapsDir);
|
|
26817
26480
|
progress.succeed("Configuration loaded");
|
|
26818
|
-
const workflowsDir =
|
|
26819
|
-
if (!
|
|
26481
|
+
const workflowsDir = join17(wrapsDir, config2.workflowsDir || "./workflows");
|
|
26482
|
+
if (!existsSync16(workflowsDir)) {
|
|
26820
26483
|
if (isJsonMode()) {
|
|
26821
26484
|
jsonSuccess("email.workflows.validate", { workflows: [], errors: [] });
|
|
26822
26485
|
} else {
|
|
@@ -26833,9 +26496,9 @@ async function workflowsValidate(options) {
|
|
|
26833
26496
|
}
|
|
26834
26497
|
return;
|
|
26835
26498
|
}
|
|
26836
|
-
const templatesDir =
|
|
26499
|
+
const templatesDir = join17(wrapsDir, config2.templatesDir || "./templates");
|
|
26837
26500
|
let localTemplateSlugs;
|
|
26838
|
-
if (
|
|
26501
|
+
if (existsSync16(templatesDir)) {
|
|
26839
26502
|
const templateFiles = await discoverTemplates(templatesDir);
|
|
26840
26503
|
localTemplateSlugs = new Set(
|
|
26841
26504
|
templateFiles.map((f) => f.replace(/\.tsx?$/, ""))
|
|
@@ -26845,8 +26508,8 @@ async function workflowsValidate(options) {
|
|
|
26845
26508
|
const parseErrors = [];
|
|
26846
26509
|
for (const file of workflowFiles) {
|
|
26847
26510
|
const slug = file.replace(/\.ts$/, "");
|
|
26848
|
-
const filePath =
|
|
26849
|
-
progress.start(`Validating ${
|
|
26511
|
+
const filePath = join17(workflowsDir, file);
|
|
26512
|
+
progress.start(`Validating ${pc33.cyan(slug)}`);
|
|
26850
26513
|
try {
|
|
26851
26514
|
const parsed = await parseWorkflowTs(filePath, wrapsDir);
|
|
26852
26515
|
const transformed = transformWorkflow(parsed.definition);
|
|
@@ -26871,20 +26534,20 @@ async function workflowsValidate(options) {
|
|
|
26871
26534
|
}))
|
|
26872
26535
|
});
|
|
26873
26536
|
if (errs.length === 0 && warnings.length === 0) {
|
|
26874
|
-
progress.succeed(`${
|
|
26537
|
+
progress.succeed(`${pc33.cyan(slug)} is valid`);
|
|
26875
26538
|
} else if (errs.length === 0) {
|
|
26876
26539
|
progress.succeed(
|
|
26877
|
-
`${
|
|
26540
|
+
`${pc33.cyan(slug)} is valid with ${warnings.length} warning(s)`
|
|
26878
26541
|
);
|
|
26879
26542
|
} else {
|
|
26880
26543
|
progress.fail(
|
|
26881
|
-
`${
|
|
26544
|
+
`${pc33.cyan(slug)} has ${errs.length} error(s), ${warnings.length} warning(s)`
|
|
26882
26545
|
);
|
|
26883
26546
|
}
|
|
26884
26547
|
} catch (err) {
|
|
26885
26548
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
26886
26549
|
parseErrors.push({ slug, error: errMsg });
|
|
26887
|
-
progress.fail(`Failed to parse ${
|
|
26550
|
+
progress.fail(`Failed to parse ${pc33.cyan(slug)}: ${errMsg}`);
|
|
26888
26551
|
}
|
|
26889
26552
|
}
|
|
26890
26553
|
if (isJsonMode()) {
|
|
@@ -26907,34 +26570,34 @@ async function workflowsValidate(options) {
|
|
|
26907
26570
|
const parseErrorCount = parseErrors.length;
|
|
26908
26571
|
if (parseErrorCount === 0 && invalidCount === 0) {
|
|
26909
26572
|
clack32.log.success(
|
|
26910
|
-
|
|
26573
|
+
pc33.green(`${validCount} workflow(s) validated successfully`)
|
|
26911
26574
|
);
|
|
26912
26575
|
} else {
|
|
26913
26576
|
if (validCount > 0) {
|
|
26914
|
-
clack32.log.success(
|
|
26577
|
+
clack32.log.success(pc33.green(`${validCount} workflow(s) valid`));
|
|
26915
26578
|
}
|
|
26916
26579
|
if (invalidCount > 0) {
|
|
26917
|
-
clack32.log.error(
|
|
26580
|
+
clack32.log.error(pc33.red(`${invalidCount} workflow(s) have errors`));
|
|
26918
26581
|
}
|
|
26919
26582
|
if (parseErrorCount > 0) {
|
|
26920
26583
|
clack32.log.error(
|
|
26921
|
-
|
|
26584
|
+
pc33.red(`${parseErrorCount} workflow(s) failed to parse`)
|
|
26922
26585
|
);
|
|
26923
26586
|
}
|
|
26924
26587
|
console.log();
|
|
26925
26588
|
for (const result of validationResults) {
|
|
26926
26589
|
if (!result.valid) {
|
|
26927
|
-
console.log(` ${
|
|
26590
|
+
console.log(` ${pc33.cyan(result.slug)}:`);
|
|
26928
26591
|
for (const err of result.errors) {
|
|
26929
26592
|
console.log(
|
|
26930
|
-
` ${
|
|
26593
|
+
` ${pc33.red("\u2715")} ${err.nodeId ? `[${err.nodeId}] ` : ""}${err.message}`
|
|
26931
26594
|
);
|
|
26932
26595
|
}
|
|
26933
26596
|
}
|
|
26934
26597
|
}
|
|
26935
26598
|
for (const parseErr of parseErrors) {
|
|
26936
|
-
console.log(` ${
|
|
26937
|
-
console.log(` ${
|
|
26599
|
+
console.log(` ${pc33.cyan(parseErr.slug)}:`);
|
|
26600
|
+
console.log(` ${pc33.red("\u2715")} Parse error: ${parseErr.error}`);
|
|
26938
26601
|
}
|
|
26939
26602
|
}
|
|
26940
26603
|
console.log();
|
|
@@ -26952,18 +26615,18 @@ async function workflowsValidate(options) {
|
|
|
26952
26615
|
init_esm_shims();
|
|
26953
26616
|
init_events();
|
|
26954
26617
|
import * as clack33 from "@clack/prompts";
|
|
26955
|
-
import
|
|
26618
|
+
import pc34 from "picocolors";
|
|
26956
26619
|
async function news() {
|
|
26957
26620
|
trackCommand("news", { success: true });
|
|
26958
|
-
clack33.intro(
|
|
26621
|
+
clack33.intro(pc34.bold("What's New in Wraps"));
|
|
26959
26622
|
console.log();
|
|
26960
26623
|
console.log(" See the latest updates, features, and improvements:");
|
|
26961
26624
|
console.log();
|
|
26962
26625
|
console.log(
|
|
26963
|
-
` ${
|
|
26626
|
+
` ${pc34.cyan("\u2192")} ${pc34.bold("Changelog:")} ${pc34.cyan("https://wraps.dev/changelog")}`
|
|
26964
26627
|
);
|
|
26965
26628
|
console.log();
|
|
26966
|
-
console.log(
|
|
26629
|
+
console.log(pc34.dim(" Subscribe to get notified about new releases."));
|
|
26967
26630
|
console.log();
|
|
26968
26631
|
}
|
|
26969
26632
|
|
|
@@ -26972,7 +26635,7 @@ init_esm_shims();
|
|
|
26972
26635
|
init_events();
|
|
26973
26636
|
init_json_output();
|
|
26974
26637
|
import * as clack34 from "@clack/prompts";
|
|
26975
|
-
import
|
|
26638
|
+
import pc35 from "picocolors";
|
|
26976
26639
|
function getBaseStatements() {
|
|
26977
26640
|
return [
|
|
26978
26641
|
{
|
|
@@ -27363,74 +27026,74 @@ function buildPolicy(service, preset) {
|
|
|
27363
27026
|
};
|
|
27364
27027
|
}
|
|
27365
27028
|
function displaySummary(service, preset) {
|
|
27366
|
-
clack34.intro(
|
|
27029
|
+
clack34.intro(pc35.bold("Wraps Required AWS Permissions"));
|
|
27367
27030
|
const serviceLabel = service ? service.toUpperCase() : "All Services";
|
|
27368
27031
|
const presetLabel = preset ? preset.charAt(0).toUpperCase() + preset.slice(1) : "All Features";
|
|
27369
27032
|
console.log(`
|
|
27370
|
-
${
|
|
27371
|
-
console.log(`${
|
|
27033
|
+
${pc35.dim("Service:")} ${pc35.cyan(serviceLabel)}`);
|
|
27034
|
+
console.log(`${pc35.dim("Preset:")} ${pc35.cyan(presetLabel)}
|
|
27372
27035
|
`);
|
|
27373
|
-
console.log(
|
|
27374
|
-
console.log(` ${
|
|
27375
|
-
console.log(` ${
|
|
27376
|
-
console.log(` ${
|
|
27036
|
+
console.log(pc35.bold("Required AWS Services:\n"));
|
|
27037
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("IAM")} - Role management`);
|
|
27038
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("STS")} - Credential validation`);
|
|
27039
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("CloudWatch")} - Metrics access`);
|
|
27377
27040
|
console.log(
|
|
27378
|
-
` ${
|
|
27041
|
+
` ${pc35.green("+")} ${pc35.bold("S3")} - State management ${pc35.dim("(wraps-state-* buckets)")}`
|
|
27379
27042
|
);
|
|
27380
27043
|
if (!service || service === "email") {
|
|
27381
27044
|
console.log(
|
|
27382
|
-
` ${
|
|
27045
|
+
` ${pc35.green("+")} ${pc35.bold("SES")} - Email sending & configuration`
|
|
27383
27046
|
);
|
|
27384
27047
|
if (!preset || preset === "production" || preset === "enterprise") {
|
|
27385
27048
|
console.log(
|
|
27386
|
-
` ${
|
|
27049
|
+
` ${pc35.green("+")} ${pc35.bold("EventBridge")} - Event routing (Production+)`
|
|
27387
27050
|
);
|
|
27388
27051
|
console.log(
|
|
27389
|
-
` ${
|
|
27052
|
+
` ${pc35.green("+")} ${pc35.bold("SQS")} - Event queuing (Production+)`
|
|
27390
27053
|
);
|
|
27391
27054
|
console.log(
|
|
27392
|
-
` ${
|
|
27055
|
+
` ${pc35.green("+")} ${pc35.bold("Lambda")} - Event processing (Production+)`
|
|
27393
27056
|
);
|
|
27394
27057
|
console.log(
|
|
27395
|
-
` ${
|
|
27058
|
+
` ${pc35.green("+")} ${pc35.bold("DynamoDB")} - Email history (Production+)`
|
|
27396
27059
|
);
|
|
27397
27060
|
}
|
|
27398
27061
|
console.log(
|
|
27399
|
-
` ${
|
|
27062
|
+
` ${pc35.yellow("?")} ${pc35.bold("Route53")} - Auto DNS ${pc35.dim("(optional)")}`
|
|
27400
27063
|
);
|
|
27401
27064
|
console.log(
|
|
27402
|
-
` ${
|
|
27065
|
+
` ${pc35.yellow("?")} ${pc35.bold("IAM OIDC")} - Vercel integration ${pc35.dim("(if using Vercel)")}`
|
|
27403
27066
|
);
|
|
27404
27067
|
}
|
|
27405
27068
|
if (!service || service === "sms") {
|
|
27406
27069
|
console.log(
|
|
27407
|
-
` ${
|
|
27070
|
+
` ${pc35.green("+")} ${pc35.bold("SMS Voice")} - SMS sending & management`
|
|
27408
27071
|
);
|
|
27409
|
-
console.log(` ${
|
|
27410
|
-
console.log(` ${
|
|
27072
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("DynamoDB")} - Message history`);
|
|
27073
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("Lambda")} - Event processing`);
|
|
27411
27074
|
}
|
|
27412
27075
|
if (!service || service === "cdn") {
|
|
27413
|
-
console.log(` ${
|
|
27076
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("S3")} - Asset storage`);
|
|
27414
27077
|
console.log(
|
|
27415
|
-
` ${
|
|
27078
|
+
` ${pc35.green("+")} ${pc35.bold("CloudFront")} - CDN distribution`
|
|
27416
27079
|
);
|
|
27417
|
-
console.log(` ${
|
|
27080
|
+
console.log(` ${pc35.green("+")} ${pc35.bold("ACM")} - SSL certificates`);
|
|
27418
27081
|
console.log(
|
|
27419
|
-
` ${
|
|
27082
|
+
` ${pc35.yellow("?")} ${pc35.bold("Route53")} - DNS management ${pc35.dim("(optional)")}`
|
|
27420
27083
|
);
|
|
27421
27084
|
}
|
|
27422
27085
|
console.log(`
|
|
27423
|
-
${
|
|
27424
|
-
console.log(` ${
|
|
27086
|
+
${pc35.dim("Get full IAM policy JSON:")}`);
|
|
27087
|
+
console.log(` ${pc35.cyan("wraps permissions --json")}`);
|
|
27425
27088
|
if (service) {
|
|
27426
27089
|
console.log(`
|
|
27427
|
-
${
|
|
27428
|
-
console.log(` ${
|
|
27090
|
+
${pc35.dim("Get permissions for all services:")}`);
|
|
27091
|
+
console.log(` ${pc35.cyan("wraps permissions")}`);
|
|
27429
27092
|
}
|
|
27430
27093
|
console.log(`
|
|
27431
|
-
${
|
|
27094
|
+
${pc35.dim("Documentation:")}`);
|
|
27432
27095
|
console.log(
|
|
27433
|
-
` ${
|
|
27096
|
+
` ${pc35.blue("https://wraps.dev/docs/guides/aws-setup/permissions")}
|
|
27434
27097
|
`
|
|
27435
27098
|
);
|
|
27436
27099
|
}
|
|
@@ -27448,17 +27111,17 @@ async function permissions(options) {
|
|
|
27448
27111
|
});
|
|
27449
27112
|
} else {
|
|
27450
27113
|
displaySummary(options.service, options.preset);
|
|
27451
|
-
console.log(
|
|
27114
|
+
console.log(pc35.bold("Quick Setup:\n"));
|
|
27452
27115
|
console.log("1. Copy the IAM policy:");
|
|
27453
27116
|
console.log(
|
|
27454
|
-
` ${
|
|
27117
|
+
` ${pc35.cyan("wraps permissions --json > wraps-policy.json")}
|
|
27455
27118
|
`
|
|
27456
27119
|
);
|
|
27457
27120
|
console.log("2. Create the policy in AWS Console:");
|
|
27458
27121
|
console.log(" IAM > Policies > Create Policy > JSON\n");
|
|
27459
27122
|
console.log("3. Attach to your IAM user/role\n");
|
|
27460
27123
|
clack34.outro(
|
|
27461
|
-
|
|
27124
|
+
pc35.green("Run with --json to get the full IAM policy document")
|
|
27462
27125
|
);
|
|
27463
27126
|
}
|
|
27464
27127
|
trackCommand("permissions", {
|
|
@@ -27475,9 +27138,9 @@ import {
|
|
|
27475
27138
|
IAMClient as IAMClient2,
|
|
27476
27139
|
PutRolePolicyCommand
|
|
27477
27140
|
} from "@aws-sdk/client-iam";
|
|
27478
|
-
import { confirm as confirm14, intro as
|
|
27141
|
+
import { confirm as confirm14, intro as intro32, isCancel as isCancel20, log as log32, outro as outro19, select as select14 } from "@clack/prompts";
|
|
27479
27142
|
import * as pulumi21 from "@pulumi/pulumi";
|
|
27480
|
-
import
|
|
27143
|
+
import pc36 from "picocolors";
|
|
27481
27144
|
init_events();
|
|
27482
27145
|
init_aws();
|
|
27483
27146
|
init_config();
|
|
@@ -27655,7 +27318,7 @@ async function validateAndLoadMetadata(options, progress) {
|
|
|
27655
27318
|
"Validating AWS credentials",
|
|
27656
27319
|
async () => validateAWSCredentials()
|
|
27657
27320
|
);
|
|
27658
|
-
progress.info(`Connected to AWS account: ${
|
|
27321
|
+
progress.info(`Connected to AWS account: ${pc36.cyan(identity.accountId)}`);
|
|
27659
27322
|
let region = options.region;
|
|
27660
27323
|
if (!region) {
|
|
27661
27324
|
region = await getAWSRegion();
|
|
@@ -27663,12 +27326,12 @@ async function validateAndLoadMetadata(options, progress) {
|
|
|
27663
27326
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
27664
27327
|
if (!metadata) {
|
|
27665
27328
|
progress.stop();
|
|
27666
|
-
|
|
27667
|
-
`No Wraps deployment found for account ${
|
|
27329
|
+
log32.error(
|
|
27330
|
+
`No Wraps deployment found for account ${pc36.cyan(identity.accountId)} in region ${pc36.cyan(region)}`
|
|
27668
27331
|
);
|
|
27669
27332
|
console.log(
|
|
27670
27333
|
`
|
|
27671
|
-
Run ${
|
|
27334
|
+
Run ${pc36.cyan("wraps email init")} to deploy infrastructure first.
|
|
27672
27335
|
`
|
|
27673
27336
|
);
|
|
27674
27337
|
process.exit(1);
|
|
@@ -27677,10 +27340,10 @@ Run ${pc37.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
27677
27340
|
const hasSms = !!metadata.services.sms?.config;
|
|
27678
27341
|
if (!(hasEmail || hasSms)) {
|
|
27679
27342
|
progress.stop();
|
|
27680
|
-
|
|
27343
|
+
log32.error("No services deployed in this region.");
|
|
27681
27344
|
console.log(
|
|
27682
27345
|
`
|
|
27683
|
-
Run ${
|
|
27346
|
+
Run ${pc36.cyan("wraps email init")} or ${pc36.cyan("wraps sms init")} first.
|
|
27684
27347
|
`
|
|
27685
27348
|
);
|
|
27686
27349
|
process.exit(1);
|
|
@@ -27805,7 +27468,7 @@ async function updatePlatformRole(metadata, progress, externalId) {
|
|
|
27805
27468
|
progress.succeed("Platform access role created");
|
|
27806
27469
|
} else {
|
|
27807
27470
|
progress.info(
|
|
27808
|
-
`IAM role ${
|
|
27471
|
+
`IAM role ${pc36.cyan(roleName)} will be created when you add your AWS account in the dashboard`
|
|
27809
27472
|
);
|
|
27810
27473
|
}
|
|
27811
27474
|
}
|
|
@@ -27859,7 +27522,7 @@ async function registerConnection(params) {
|
|
|
27859
27522
|
async function authenticatedConnect(token, options) {
|
|
27860
27523
|
const startTime = Date.now();
|
|
27861
27524
|
if (!isJsonMode()) {
|
|
27862
|
-
|
|
27525
|
+
intro32(pc36.bold("Connect to Wraps Platform"));
|
|
27863
27526
|
}
|
|
27864
27527
|
const progress = new DeploymentProgress();
|
|
27865
27528
|
try {
|
|
@@ -27871,20 +27534,20 @@ async function authenticatedConnect(token, options) {
|
|
|
27871
27534
|
const org = await resolveOrganization();
|
|
27872
27535
|
if (!org) {
|
|
27873
27536
|
progress.stop();
|
|
27874
|
-
|
|
27537
|
+
log32.error(
|
|
27875
27538
|
"No organizations found. Sign in at https://app.wraps.dev to create one."
|
|
27876
27539
|
);
|
|
27877
27540
|
process.exit(1);
|
|
27878
27541
|
}
|
|
27879
27542
|
if (!isJsonMode()) {
|
|
27880
|
-
progress.info(`Organization: ${
|
|
27543
|
+
progress.info(`Organization: ${pc36.cyan(org.name)}`);
|
|
27881
27544
|
}
|
|
27882
27545
|
if (hasEmail) {
|
|
27883
27546
|
const emailConfig = metadata.services.email?.config;
|
|
27884
27547
|
if (!emailConfig?.eventTracking?.enabled) {
|
|
27885
27548
|
if (!isJsonMode()) {
|
|
27886
27549
|
progress.stop();
|
|
27887
|
-
|
|
27550
|
+
log32.warn(
|
|
27888
27551
|
"Event tracking must be enabled to connect to the Wraps Platform."
|
|
27889
27552
|
);
|
|
27890
27553
|
}
|
|
@@ -27934,12 +27597,12 @@ async function authenticatedConnect(token, options) {
|
|
|
27934
27597
|
);
|
|
27935
27598
|
if (!(result.success && result.webhookSecret)) {
|
|
27936
27599
|
progress.stop();
|
|
27937
|
-
|
|
27600
|
+
log32.error(
|
|
27938
27601
|
`Failed to register connection: ${result.error || "Unknown error"}`
|
|
27939
27602
|
);
|
|
27940
27603
|
console.log(
|
|
27941
27604
|
`
|
|
27942
|
-
You can try the manual flow: ${
|
|
27605
|
+
You can try the manual flow: ${pc36.cyan("wraps auth logout")} then ${pc36.cyan("wraps platform connect")}
|
|
27943
27606
|
`
|
|
27944
27607
|
);
|
|
27945
27608
|
process.exit(1);
|
|
@@ -27967,10 +27630,10 @@ You can try the manual flow: ${pc37.cyan("wraps auth logout")} then ${pc37.cyan(
|
|
|
27967
27630
|
} catch (error) {
|
|
27968
27631
|
const errName = error && typeof error === "object" && "name" in error ? error.name : "Unknown";
|
|
27969
27632
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
27970
|
-
|
|
27633
|
+
log32.warn(
|
|
27971
27634
|
`Could not create/update IAM role (${errName}): ${errMsg}
|
|
27972
|
-
You may need ${
|
|
27973
|
-
Run ${
|
|
27635
|
+
You may need ${pc36.cyan("iam:GetRole")}, ${pc36.cyan("iam:CreateRole")}, and ${pc36.cyan("iam:PutRolePolicy")} permissions.
|
|
27636
|
+
Run ${pc36.cyan("wraps platform update-role")} to retry.`
|
|
27974
27637
|
);
|
|
27975
27638
|
}
|
|
27976
27639
|
await saveConnectionMetadata(metadata);
|
|
@@ -27984,14 +27647,14 @@ You can try the manual flow: ${pc37.cyan("wraps auth logout")} then ${pc37.cyan(
|
|
|
27984
27647
|
webhookConnected: true
|
|
27985
27648
|
});
|
|
27986
27649
|
} else {
|
|
27987
|
-
outro19(
|
|
27650
|
+
outro19(pc36.green("Platform connection complete!"));
|
|
27988
27651
|
console.log();
|
|
27989
27652
|
console.log(
|
|
27990
|
-
|
|
27653
|
+
pc36.dim(
|
|
27991
27654
|
"Events from your AWS infrastructure will stream to the dashboard."
|
|
27992
27655
|
)
|
|
27993
27656
|
);
|
|
27994
|
-
console.log(` Dashboard: ${
|
|
27657
|
+
console.log(` Dashboard: ${pc36.cyan("https://app.wraps.dev")}`);
|
|
27995
27658
|
console.log();
|
|
27996
27659
|
}
|
|
27997
27660
|
const duration = Date.now() - startTime;
|
|
@@ -28022,7 +27685,7 @@ async function connect3(options) {
|
|
|
28022
27685
|
return;
|
|
28023
27686
|
}
|
|
28024
27687
|
const startTime = Date.now();
|
|
28025
|
-
|
|
27688
|
+
intro32(pc36.bold("Connect to Wraps Platform"));
|
|
28026
27689
|
const progress = new DeploymentProgress();
|
|
28027
27690
|
try {
|
|
28028
27691
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -28036,7 +27699,7 @@ async function connect3(options) {
|
|
|
28036
27699
|
"Validating AWS credentials",
|
|
28037
27700
|
async () => validateAWSCredentials()
|
|
28038
27701
|
);
|
|
28039
|
-
progress.info(`Connected to AWS account: ${
|
|
27702
|
+
progress.info(`Connected to AWS account: ${pc36.cyan(identity.accountId)}`);
|
|
28040
27703
|
let region = options.region;
|
|
28041
27704
|
if (!region) {
|
|
28042
27705
|
region = await getAWSRegion();
|
|
@@ -28044,12 +27707,12 @@ async function connect3(options) {
|
|
|
28044
27707
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
28045
27708
|
if (!metadata) {
|
|
28046
27709
|
progress.stop();
|
|
28047
|
-
|
|
28048
|
-
`No Wraps deployment found for account ${
|
|
27710
|
+
log32.error(
|
|
27711
|
+
`No Wraps deployment found for account ${pc36.cyan(identity.accountId)} in region ${pc36.cyan(region)}`
|
|
28049
27712
|
);
|
|
28050
27713
|
console.log(
|
|
28051
27714
|
`
|
|
28052
|
-
Run ${
|
|
27715
|
+
Run ${pc36.cyan("wraps email init")} to deploy infrastructure first.
|
|
28053
27716
|
`
|
|
28054
27717
|
);
|
|
28055
27718
|
process.exit(1);
|
|
@@ -28058,10 +27721,10 @@ Run ${pc37.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
28058
27721
|
const hasSms = !!metadata.services.sms?.config;
|
|
28059
27722
|
if (!(hasEmail || hasSms)) {
|
|
28060
27723
|
progress.stop();
|
|
28061
|
-
|
|
27724
|
+
log32.error("No services deployed in this region.");
|
|
28062
27725
|
console.log(
|
|
28063
27726
|
`
|
|
28064
|
-
Run ${
|
|
27727
|
+
Run ${pc36.cyan("wraps email init")} or ${pc36.cyan("wraps sms init")} first.
|
|
28065
27728
|
`
|
|
28066
27729
|
);
|
|
28067
27730
|
process.exit(1);
|
|
@@ -28076,10 +27739,10 @@ Run ${pc37.cyan("wraps email init")} or ${pc37.cyan("wraps sms init")} first.
|
|
|
28076
27739
|
const existingSecret = metadata.services.email?.webhookSecret;
|
|
28077
27740
|
if (!emailConfig?.eventTracking?.enabled) {
|
|
28078
27741
|
progress.stop();
|
|
28079
|
-
|
|
27742
|
+
log32.warn(
|
|
28080
27743
|
"Event tracking must be enabled to connect to the Wraps Platform."
|
|
28081
27744
|
);
|
|
28082
|
-
|
|
27745
|
+
log32.info(
|
|
28083
27746
|
"Enabling event tracking will allow SES events to be streamed to the dashboard."
|
|
28084
27747
|
);
|
|
28085
27748
|
const enableEventTracking = await confirm14({
|
|
@@ -28111,8 +27774,8 @@ Run ${pc37.cyan("wraps email init")} or ${pc37.cyan("wraps sms init")} first.
|
|
|
28111
27774
|
}
|
|
28112
27775
|
if (existingSecret) {
|
|
28113
27776
|
progress.stop();
|
|
28114
|
-
|
|
28115
|
-
`Already connected to Wraps Platform (AWS Account: ${
|
|
27777
|
+
log32.info(
|
|
27778
|
+
`Already connected to Wraps Platform (AWS Account: ${pc36.cyan(metadata.accountId)})`
|
|
28116
27779
|
);
|
|
28117
27780
|
const action = await select14({
|
|
28118
27781
|
message: "What would you like to do?",
|
|
@@ -28239,36 +27902,36 @@ Run ${pc37.cyan("wraps email init")} or ${pc37.cyan("wraps sms init")} first.
|
|
|
28239
27902
|
progress.succeed("Platform access role updated");
|
|
28240
27903
|
} else {
|
|
28241
27904
|
progress.info(
|
|
28242
|
-
`IAM role ${
|
|
27905
|
+
`IAM role ${pc36.cyan(roleName)} will be created when you add your AWS account in the dashboard`
|
|
28243
27906
|
);
|
|
28244
27907
|
}
|
|
28245
27908
|
await saveConnectionMetadata(metadata);
|
|
28246
27909
|
progress.stop();
|
|
28247
|
-
outro19(
|
|
27910
|
+
outro19(pc36.green("Platform connection complete!"));
|
|
28248
27911
|
if (webhookSecret && needsDeployment) {
|
|
28249
27912
|
console.log(`
|
|
28250
|
-
${
|
|
28251
|
-
console.log(
|
|
28252
|
-
console.log(` ${
|
|
28253
|
-
console.log(
|
|
27913
|
+
${pc36.bold("Webhook Secret")} ${pc36.dim("(save this!)")}`);
|
|
27914
|
+
console.log(pc36.dim("\u2500".repeat(60)));
|
|
27915
|
+
console.log(` ${pc36.cyan(webhookSecret)}`);
|
|
27916
|
+
console.log(pc36.dim("\u2500".repeat(60)));
|
|
28254
27917
|
} else if (metadata.services.email?.webhookSecret && !needsDeployment) {
|
|
28255
27918
|
console.log(`
|
|
28256
|
-
${
|
|
28257
|
-
console.log(
|
|
28258
|
-
console.log(` ${
|
|
28259
|
-
console.log(
|
|
27919
|
+
${pc36.bold("Existing Webhook Secret:")}`);
|
|
27920
|
+
console.log(pc36.dim("\u2500".repeat(60)));
|
|
27921
|
+
console.log(` ${pc36.cyan(metadata.services.email.webhookSecret)}`);
|
|
27922
|
+
console.log(pc36.dim("\u2500".repeat(60)));
|
|
28260
27923
|
}
|
|
28261
27924
|
console.log(`
|
|
28262
|
-
${
|
|
28263
|
-
console.log(` 1. Go to ${
|
|
28264
|
-
console.log(` 2. Navigate to ${
|
|
28265
|
-
console.log(` 3. Add your AWS account: ${
|
|
27925
|
+
${pc36.bold("Next Steps:")}`);
|
|
27926
|
+
console.log(` 1. Go to ${pc36.cyan("https://app.wraps.dev")}`);
|
|
27927
|
+
console.log(` 2. Navigate to ${pc36.dim("Settings \u2192 AWS Accounts")}`);
|
|
27928
|
+
console.log(` 3. Add your AWS account: ${pc36.cyan(identity.accountId)}`);
|
|
28266
27929
|
if (webhookSecret) {
|
|
28267
27930
|
console.log(" 4. Paste the webhook secret shown above");
|
|
28268
27931
|
}
|
|
28269
27932
|
console.log();
|
|
28270
27933
|
console.log(
|
|
28271
|
-
|
|
27934
|
+
pc36.dim(
|
|
28272
27935
|
"Events from your AWS infrastructure will stream to the dashboard."
|
|
28273
27936
|
)
|
|
28274
27937
|
);
|
|
@@ -28296,51 +27959,51 @@ ${pc37.bold("Next Steps:")}`);
|
|
|
28296
27959
|
// src/commands/platform/index.ts
|
|
28297
27960
|
init_esm_shims();
|
|
28298
27961
|
import * as clack35 from "@clack/prompts";
|
|
28299
|
-
import
|
|
27962
|
+
import pc37 from "picocolors";
|
|
28300
27963
|
async function platform() {
|
|
28301
|
-
clack35.intro(
|
|
27964
|
+
clack35.intro(pc37.bold("Wraps Platform"));
|
|
28302
27965
|
console.log();
|
|
28303
27966
|
console.log(
|
|
28304
27967
|
" The Wraps Platform extends the free CLI with hosted features:"
|
|
28305
27968
|
);
|
|
28306
27969
|
console.log();
|
|
28307
|
-
console.log(` ${
|
|
28308
|
-
console.log(` ${
|
|
28309
|
-
console.log(` ${
|
|
28310
|
-
console.log(` ${
|
|
28311
|
-
console.log(` ${
|
|
28312
|
-
console.log(` ${
|
|
28313
|
-
console.log(` ${
|
|
27970
|
+
console.log(` ${pc37.bold("Features:")}`);
|
|
27971
|
+
console.log(` ${pc37.green("\u2713")} Visual email template editor`);
|
|
27972
|
+
console.log(` ${pc37.green("\u2713")} Broadcast campaigns & scheduling`);
|
|
27973
|
+
console.log(` ${pc37.green("\u2713")} Contact management & segments`);
|
|
27974
|
+
console.log(` ${pc37.green("\u2713")} Workflow automations`);
|
|
27975
|
+
console.log(` ${pc37.green("\u2713")} Analytics dashboard`);
|
|
27976
|
+
console.log(` ${pc37.green("\u2713")} Team collaboration`);
|
|
28314
27977
|
console.log();
|
|
28315
|
-
console.log(` ${
|
|
28316
|
-
console.log(` ${
|
|
28317
|
-
console.log(` ${
|
|
28318
|
-
console.log(` ${
|
|
28319
|
-
console.log(` ${
|
|
27978
|
+
console.log(` ${pc37.bold("Pricing:")}`);
|
|
27979
|
+
console.log(` ${pc37.cyan("Starter")} $10/mo 5,000 contacts`);
|
|
27980
|
+
console.log(` ${pc37.cyan("Growth")} $25/mo 25,000 contacts`);
|
|
27981
|
+
console.log(` ${pc37.cyan("Scale")} $50/mo 100,000 contacts`);
|
|
27982
|
+
console.log(` ${pc37.cyan("Enterprise")} Custom Unlimited contacts`);
|
|
28320
27983
|
console.log();
|
|
28321
27984
|
console.log(
|
|
28322
|
-
|
|
27985
|
+
pc37.dim(" + AWS costs at $0.10 per 1,000 emails (paid directly to AWS)")
|
|
28323
27986
|
);
|
|
28324
27987
|
console.log();
|
|
28325
27988
|
console.log(
|
|
28326
|
-
` ${
|
|
27989
|
+
` ${pc37.bold("Learn more:")} ${pc37.cyan("https://wraps.dev/platform")}`
|
|
28327
27990
|
);
|
|
28328
27991
|
console.log();
|
|
28329
|
-
console.log(
|
|
27992
|
+
console.log(pc37.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"));
|
|
28330
27993
|
console.log();
|
|
28331
|
-
console.log(` ${
|
|
27994
|
+
console.log(` ${pc37.bold("Platform Commands:")}`);
|
|
28332
27995
|
console.log();
|
|
28333
27996
|
console.log(
|
|
28334
|
-
` ${
|
|
27997
|
+
` ${pc37.cyan("wraps platform connect")} Connect infrastructure to Wraps Platform`
|
|
28335
27998
|
);
|
|
28336
27999
|
console.log(
|
|
28337
|
-
` ${
|
|
28000
|
+
` ${pc37.cyan("wraps platform update-role")} Update IAM permissions for dashboard`
|
|
28338
28001
|
);
|
|
28339
28002
|
console.log();
|
|
28340
28003
|
console.log(
|
|
28341
|
-
|
|
28004
|
+
pc37.dim(" The connect command sets up event streaming and IAM permissions")
|
|
28342
28005
|
);
|
|
28343
|
-
console.log(
|
|
28006
|
+
console.log(pc37.dim(" in one step. Run it after deploying infrastructure."));
|
|
28344
28007
|
console.log();
|
|
28345
28008
|
}
|
|
28346
28009
|
|
|
@@ -28356,12 +28019,12 @@ import {
|
|
|
28356
28019
|
GetRoleCommand as GetRoleCommand2,
|
|
28357
28020
|
IAMClient as IAMClient3
|
|
28358
28021
|
} from "@aws-sdk/client-iam";
|
|
28359
|
-
import { confirm as confirm15, intro as
|
|
28360
|
-
import
|
|
28022
|
+
import { confirm as confirm15, intro as intro34, isCancel as isCancel21, log as log33, outro as outro20 } from "@clack/prompts";
|
|
28023
|
+
import pc38 from "picocolors";
|
|
28361
28024
|
async function updateRole(options) {
|
|
28362
28025
|
const startTime = Date.now();
|
|
28363
28026
|
if (!isJsonMode()) {
|
|
28364
|
-
|
|
28027
|
+
intro34(pc38.bold("Update Platform Access Role"));
|
|
28365
28028
|
}
|
|
28366
28029
|
const progress = new DeploymentProgress();
|
|
28367
28030
|
const identity = await progress.execute(
|
|
@@ -28372,12 +28035,12 @@ async function updateRole(options) {
|
|
|
28372
28035
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
28373
28036
|
if (!metadata) {
|
|
28374
28037
|
progress.stop();
|
|
28375
|
-
|
|
28376
|
-
`No Wraps deployment found for account ${
|
|
28038
|
+
log33.error(
|
|
28039
|
+
`No Wraps deployment found for account ${pc38.cyan(identity.accountId)} in region ${pc38.cyan(region)}`
|
|
28377
28040
|
);
|
|
28378
28041
|
console.log(
|
|
28379
28042
|
`
|
|
28380
|
-
Run ${
|
|
28043
|
+
Run ${pc38.cyan("wraps email init")} to deploy infrastructure first.
|
|
28381
28044
|
`
|
|
28382
28045
|
);
|
|
28383
28046
|
process.exit(1);
|
|
@@ -28397,28 +28060,28 @@ Run ${pc39.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
28397
28060
|
const externalId = metadata.platform?.externalId;
|
|
28398
28061
|
if (!(roleExists2 || externalId)) {
|
|
28399
28062
|
progress.stop();
|
|
28400
|
-
|
|
28063
|
+
log33.warn(`IAM role ${pc38.cyan(roleName)} does not exist`);
|
|
28401
28064
|
console.log(
|
|
28402
28065
|
"\nThis role is created when you connect AWS accounts through the Wraps Platform."
|
|
28403
28066
|
);
|
|
28404
28067
|
console.log(
|
|
28405
|
-
`Run ${
|
|
28068
|
+
`Run ${pc38.cyan("wraps platform connect")} while logged in to create the role automatically.
|
|
28406
28069
|
`
|
|
28407
28070
|
);
|
|
28408
28071
|
process.exit(0);
|
|
28409
28072
|
}
|
|
28410
28073
|
if (roleExists2) {
|
|
28411
|
-
progress.info(`Found IAM role: ${
|
|
28074
|
+
progress.info(`Found IAM role: ${pc38.cyan(roleName)}`);
|
|
28412
28075
|
} else {
|
|
28413
28076
|
progress.info(
|
|
28414
|
-
`IAM role ${
|
|
28077
|
+
`IAM role ${pc38.cyan(roleName)} not found \u2014 will create it using stored externalId`
|
|
28415
28078
|
);
|
|
28416
28079
|
}
|
|
28417
28080
|
if (!options.force) {
|
|
28418
28081
|
progress.stop();
|
|
28419
28082
|
const actionLabel = roleExists2 ? "Update" : "Create";
|
|
28420
28083
|
const shouldContinue = await confirm15({
|
|
28421
|
-
message: `${actionLabel} IAM role ${
|
|
28084
|
+
message: `${actionLabel} IAM role ${pc38.cyan(roleName)} with latest permissions?`,
|
|
28422
28085
|
initialValue: true
|
|
28423
28086
|
});
|
|
28424
28087
|
if (isCancel21(shouldContinue) || !shouldContinue) {
|
|
@@ -28502,53 +28165,53 @@ Run ${pc39.cyan("wraps email init")} to deploy infrastructure first.
|
|
|
28502
28165
|
});
|
|
28503
28166
|
return;
|
|
28504
28167
|
}
|
|
28505
|
-
outro20(
|
|
28168
|
+
outro20(pc38.green(`\u2713 Platform access role ${actionVerb} successfully`));
|
|
28506
28169
|
console.log(`
|
|
28507
|
-
${
|
|
28170
|
+
${pc38.bold("Permissions:")}`);
|
|
28508
28171
|
console.log(`
|
|
28509
|
-
${
|
|
28172
|
+
${pc38.bold(pc38.cyan("Email:"))}`);
|
|
28510
28173
|
console.log(
|
|
28511
|
-
` ${
|
|
28174
|
+
` ${pc38.green("\u2713")} SES metrics and identity verification (always enabled)`
|
|
28512
28175
|
);
|
|
28513
|
-
console.log(` ${
|
|
28514
|
-
console.log(` ${
|
|
28176
|
+
console.log(` ${pc38.green("\u2713")} SES template management (always enabled)`);
|
|
28177
|
+
console.log(` ${pc38.green("\u2713")} Inbound bucket detection (always enabled)`);
|
|
28515
28178
|
if (sendingEnabled) {
|
|
28516
|
-
console.log(` ${
|
|
28179
|
+
console.log(` ${pc38.green("\u2713")} Email sending via SES`);
|
|
28517
28180
|
}
|
|
28518
28181
|
if (eventTracking?.dynamoDBHistory) {
|
|
28519
28182
|
console.log(
|
|
28520
|
-
` ${
|
|
28183
|
+
` ${pc38.green("\u2713")} DynamoDB read access (including DescribeTable)`
|
|
28521
28184
|
);
|
|
28522
28185
|
}
|
|
28523
28186
|
if (eventTracking?.enabled) {
|
|
28524
|
-
console.log(` ${
|
|
28187
|
+
console.log(` ${pc38.green("\u2713")} EventBridge and SQS access`);
|
|
28525
28188
|
}
|
|
28526
28189
|
if (emailArchiving?.enabled) {
|
|
28527
|
-
console.log(` ${
|
|
28190
|
+
console.log(` ${pc38.green("\u2713")} Mail Manager Archive access`);
|
|
28528
28191
|
}
|
|
28529
28192
|
const inbound = emailConfig?.inbound;
|
|
28530
28193
|
if (inbound?.enabled) {
|
|
28531
|
-
console.log(` ${
|
|
28194
|
+
console.log(` ${pc38.green("\u2713")} S3 access for inbound email`);
|
|
28532
28195
|
}
|
|
28533
28196
|
if (smsEnabled) {
|
|
28534
28197
|
console.log(`
|
|
28535
|
-
${
|
|
28198
|
+
${pc38.bold(pc38.cyan("SMS:"))}`);
|
|
28536
28199
|
console.log(
|
|
28537
|
-
` ${
|
|
28200
|
+
` ${pc38.green("\u2713")} SMS Voice V2 read access (phone numbers, config, registrations)`
|
|
28538
28201
|
);
|
|
28539
28202
|
if (smsSendingEnabled) {
|
|
28540
|
-
console.log(` ${
|
|
28203
|
+
console.log(` ${pc38.green("\u2713")} SMS sending via SMS Voice V2`);
|
|
28541
28204
|
}
|
|
28542
28205
|
if (smsEventTracking?.dynamoDBHistory) {
|
|
28543
|
-
console.log(` ${
|
|
28206
|
+
console.log(` ${pc38.green("\u2713")} DynamoDB read access for SMS history`);
|
|
28544
28207
|
}
|
|
28545
28208
|
if (smsEventTracking?.enabled) {
|
|
28546
|
-
console.log(` ${
|
|
28209
|
+
console.log(` ${pc38.green("\u2713")} SNS topic access for SMS events`);
|
|
28547
28210
|
}
|
|
28548
28211
|
}
|
|
28549
28212
|
console.log(
|
|
28550
28213
|
`
|
|
28551
|
-
${
|
|
28214
|
+
${pc38.dim(`The Wraps Platform will now have ${actionVerb} permissions for feature detection.`)}
|
|
28552
28215
|
`
|
|
28553
28216
|
);
|
|
28554
28217
|
}
|
|
@@ -28743,7 +28406,7 @@ import * as clack36 from "@clack/prompts";
|
|
|
28743
28406
|
import * as pulumi22 from "@pulumi/pulumi";
|
|
28744
28407
|
import getPort from "get-port";
|
|
28745
28408
|
import open2 from "open";
|
|
28746
|
-
import
|
|
28409
|
+
import pc39 from "picocolors";
|
|
28747
28410
|
|
|
28748
28411
|
// src/console/server.ts
|
|
28749
28412
|
init_esm_shims();
|
|
@@ -29933,13 +29596,13 @@ function createMetricsRouter(config2) {
|
|
|
29933
29596
|
const router = createRouter5();
|
|
29934
29597
|
router.get("/stream", async (req, res) => {
|
|
29935
29598
|
const connectionId = randomUUID().slice(0, 8);
|
|
29936
|
-
const
|
|
29599
|
+
const log47 = (msg, data) => {
|
|
29937
29600
|
console.log(JSON.stringify({ connectionId, msg, ...data }));
|
|
29938
29601
|
};
|
|
29939
29602
|
res.setHeader("Content-Type", "text/event-stream");
|
|
29940
29603
|
res.setHeader("Cache-Control", "no-cache");
|
|
29941
29604
|
res.setHeader("Connection", "keep-alive");
|
|
29942
|
-
|
|
29605
|
+
log47("SSE connected");
|
|
29943
29606
|
res.write('data: {"type":"connected"}\n\n');
|
|
29944
29607
|
const { startTime, endTime } = req.query;
|
|
29945
29608
|
const getTimeRange = () => ({
|
|
@@ -29949,7 +29612,7 @@ function createMetricsRouter(config2) {
|
|
|
29949
29612
|
const sendMetrics = async () => {
|
|
29950
29613
|
try {
|
|
29951
29614
|
const timeRange = getTimeRange();
|
|
29952
|
-
|
|
29615
|
+
log47("Fetching metrics", {
|
|
29953
29616
|
start: timeRange.start.toISOString(),
|
|
29954
29617
|
end: timeRange.end.toISOString()
|
|
29955
29618
|
});
|
|
@@ -29962,7 +29625,7 @@ function createMetricsRouter(config2) {
|
|
|
29962
29625
|
),
|
|
29963
29626
|
fetchSendQuota(config2.roleArn, config2.region)
|
|
29964
29627
|
]);
|
|
29965
|
-
|
|
29628
|
+
log47("Metrics fetched successfully");
|
|
29966
29629
|
const data = {
|
|
29967
29630
|
type: "metrics",
|
|
29968
29631
|
timestamp: Date.now(),
|
|
@@ -29992,7 +29655,7 @@ function createMetricsRouter(config2) {
|
|
|
29992
29655
|
const interval = setInterval(sendMetrics, 6e4);
|
|
29993
29656
|
req.on("close", () => {
|
|
29994
29657
|
clearInterval(interval);
|
|
29995
|
-
|
|
29658
|
+
log47("SSE disconnected");
|
|
29996
29659
|
});
|
|
29997
29660
|
});
|
|
29998
29661
|
router.get("/snapshot", async (_req, res) => {
|
|
@@ -31370,7 +31033,7 @@ init_fs();
|
|
|
31370
31033
|
init_metadata();
|
|
31371
31034
|
init_output();
|
|
31372
31035
|
async function dashboard(options) {
|
|
31373
|
-
clack36.intro(
|
|
31036
|
+
clack36.intro(pc39.bold("Wraps Dashboard"));
|
|
31374
31037
|
const progress = new DeploymentProgress();
|
|
31375
31038
|
const identity = await progress.execute(
|
|
31376
31039
|
"Validating AWS credentials",
|
|
@@ -31413,7 +31076,7 @@ async function dashboard(options) {
|
|
|
31413
31076
|
progress.stop();
|
|
31414
31077
|
clack36.log.error("No Wraps infrastructure found");
|
|
31415
31078
|
console.log(
|
|
31416
|
-
`\\nRun ${
|
|
31079
|
+
`\\nRun ${pc39.cyan("wraps email init")}, ${pc39.cyan("wraps sms init")}, or ${pc39.cyan("wraps storage init")} to deploy infrastructure first.\\n`
|
|
31417
31080
|
);
|
|
31418
31081
|
process.exit(1);
|
|
31419
31082
|
}
|
|
@@ -31457,7 +31120,7 @@ async function dashboard(options) {
|
|
|
31457
31120
|
progress.stop();
|
|
31458
31121
|
clack36.log.success("Starting dashboard server...");
|
|
31459
31122
|
console.log(
|
|
31460
|
-
`${
|
|
31123
|
+
`${pc39.dim("Using current AWS credentials (no role assumption)")}\\n`
|
|
31461
31124
|
);
|
|
31462
31125
|
const { url } = await startConsoleServer({
|
|
31463
31126
|
port,
|
|
@@ -31490,8 +31153,8 @@ async function dashboard(options) {
|
|
|
31490
31153
|
cdnCustomDomain,
|
|
31491
31154
|
cdnCertificateArn
|
|
31492
31155
|
});
|
|
31493
|
-
console.log(`\\n${
|
|
31494
|
-
console.log(`${
|
|
31156
|
+
console.log(`\\n${pc39.bold("Dashboard:")} ${pc39.cyan(url)}`);
|
|
31157
|
+
console.log(`${pc39.dim("Press Ctrl+C to stop")}\\n`);
|
|
31495
31158
|
getTelemetryClient().showFooterOnce();
|
|
31496
31159
|
if (!options.noOpen) {
|
|
31497
31160
|
await open2(url);
|
|
@@ -31513,7 +31176,7 @@ init_errors();
|
|
|
31513
31176
|
init_json_output();
|
|
31514
31177
|
init_metadata();
|
|
31515
31178
|
import * as clack37 from "@clack/prompts";
|
|
31516
|
-
import
|
|
31179
|
+
import pc40 from "picocolors";
|
|
31517
31180
|
async function destroy(options) {
|
|
31518
31181
|
trackCommand("destroy", { success: true });
|
|
31519
31182
|
if (isJsonMode() && !options.force) {
|
|
@@ -31524,7 +31187,7 @@ async function destroy(options) {
|
|
|
31524
31187
|
);
|
|
31525
31188
|
}
|
|
31526
31189
|
if (!isJsonMode()) {
|
|
31527
|
-
clack37.intro(
|
|
31190
|
+
clack37.intro(pc40.bold("Wraps Infrastructure Teardown"));
|
|
31528
31191
|
}
|
|
31529
31192
|
const spinner10 = clack37.spinner();
|
|
31530
31193
|
spinner10.start("Validating AWS credentials");
|
|
@@ -31546,14 +31209,14 @@ async function destroy(options) {
|
|
|
31546
31209
|
clack37.log.warn("No Wraps services found in this region");
|
|
31547
31210
|
console.log(
|
|
31548
31211
|
`
|
|
31549
|
-
Run ${
|
|
31212
|
+
Run ${pc40.cyan("wraps email init")} to deploy infrastructure.
|
|
31550
31213
|
`
|
|
31551
31214
|
);
|
|
31552
31215
|
process.exit(0);
|
|
31553
31216
|
}
|
|
31554
31217
|
if (deployedServices.length === 1) {
|
|
31555
31218
|
const service = deployedServices[0];
|
|
31556
|
-
clack37.log.info(`Found ${
|
|
31219
|
+
clack37.log.info(`Found ${pc40.cyan(service)} service deployed`);
|
|
31557
31220
|
if (service === "email") {
|
|
31558
31221
|
await emailDestroy(options);
|
|
31559
31222
|
return;
|
|
@@ -31591,7 +31254,7 @@ Run ${pc41.cyan("wraps email init")} to deploy infrastructure.
|
|
|
31591
31254
|
await emailDestroy(options);
|
|
31592
31255
|
}
|
|
31593
31256
|
if (serviceToDestroy === "all") {
|
|
31594
|
-
clack37.outro(
|
|
31257
|
+
clack37.outro(pc40.green("All Wraps infrastructure has been removed"));
|
|
31595
31258
|
}
|
|
31596
31259
|
}
|
|
31597
31260
|
|
|
@@ -31604,23 +31267,23 @@ init_json_output();
|
|
|
31604
31267
|
init_output();
|
|
31605
31268
|
import * as clack38 from "@clack/prompts";
|
|
31606
31269
|
import * as pulumi23 from "@pulumi/pulumi";
|
|
31607
|
-
import
|
|
31270
|
+
import pc41 from "picocolors";
|
|
31608
31271
|
async function status(_options) {
|
|
31609
31272
|
const startTime = Date.now();
|
|
31610
31273
|
const progress = new DeploymentProgress();
|
|
31611
31274
|
if (!isJsonMode()) {
|
|
31612
|
-
clack38.intro(
|
|
31275
|
+
clack38.intro(pc41.bold("Wraps Infrastructure Status"));
|
|
31613
31276
|
}
|
|
31614
31277
|
const identity = await progress.execute(
|
|
31615
31278
|
"Loading infrastructure status",
|
|
31616
31279
|
async () => validateAWSCredentials()
|
|
31617
31280
|
);
|
|
31618
31281
|
if (!isJsonMode()) {
|
|
31619
|
-
progress.info(`AWS Account: ${
|
|
31282
|
+
progress.info(`AWS Account: ${pc41.cyan(identity.accountId)}`);
|
|
31620
31283
|
}
|
|
31621
31284
|
const region = await getAWSRegion();
|
|
31622
31285
|
if (!isJsonMode()) {
|
|
31623
|
-
progress.info(`Region: ${
|
|
31286
|
+
progress.info(`Region: ${pc41.cyan(region)}`);
|
|
31624
31287
|
}
|
|
31625
31288
|
const services = [];
|
|
31626
31289
|
try {
|
|
@@ -31675,32 +31338,32 @@ async function status(_options) {
|
|
|
31675
31338
|
clack38.note(
|
|
31676
31339
|
services.map((s) => {
|
|
31677
31340
|
if (s.status === "deployed") {
|
|
31678
|
-
const details = s.details ?
|
|
31679
|
-
return ` ${
|
|
31341
|
+
const details = s.details ? pc41.dim(` (${s.details})`) : "";
|
|
31342
|
+
return ` ${pc41.green("\u2713")} ${s.name}${details}`;
|
|
31680
31343
|
}
|
|
31681
|
-
return ` ${
|
|
31344
|
+
return ` ${pc41.dim("\u25CB")} ${s.name} ${pc41.dim("(not deployed)")}`;
|
|
31682
31345
|
}).join("\n"),
|
|
31683
31346
|
"Services"
|
|
31684
31347
|
);
|
|
31685
31348
|
const hasDeployedServices = services.some((s) => s.status === "deployed");
|
|
31686
31349
|
if (hasDeployedServices) {
|
|
31687
31350
|
console.log(`
|
|
31688
|
-
${
|
|
31351
|
+
${pc41.bold("Details:")}`);
|
|
31689
31352
|
if (services.find((s) => s.name === "Email")?.status === "deployed") {
|
|
31690
|
-
console.log(` ${
|
|
31353
|
+
console.log(` ${pc41.dim("Email:")} ${pc41.cyan("wraps email status")}`);
|
|
31691
31354
|
}
|
|
31692
31355
|
if (services.find((s) => s.name === "SMS")?.status === "deployed") {
|
|
31693
|
-
console.log(` ${
|
|
31356
|
+
console.log(` ${pc41.dim("SMS:")} ${pc41.cyan("wraps sms status")}`);
|
|
31694
31357
|
}
|
|
31695
31358
|
} else {
|
|
31696
31359
|
console.log(`
|
|
31697
|
-
${
|
|
31698
|
-
console.log(` ${
|
|
31699
|
-
console.log(` ${
|
|
31360
|
+
${pc41.bold("Get started:")}`);
|
|
31361
|
+
console.log(` ${pc41.dim("Deploy email:")} ${pc41.cyan("wraps email init")}`);
|
|
31362
|
+
console.log(` ${pc41.dim("Deploy SMS:")} ${pc41.cyan("wraps sms init")}`);
|
|
31700
31363
|
}
|
|
31701
31364
|
console.log(`
|
|
31702
|
-
${
|
|
31703
|
-
console.log(`${
|
|
31365
|
+
${pc41.bold("Dashboard:")} ${pc41.blue("https://app.wraps.dev")}`);
|
|
31366
|
+
console.log(`${pc41.bold("Docs:")} ${pc41.blue("https://wraps.dev/docs")}
|
|
31704
31367
|
`);
|
|
31705
31368
|
trackCommand("status", {
|
|
31706
31369
|
success: true,
|
|
@@ -31713,7 +31376,7 @@ ${pc42.bold("Dashboard:")} ${pc42.blue("https://app.wraps.dev")}`);
|
|
|
31713
31376
|
init_esm_shims();
|
|
31714
31377
|
import * as clack39 from "@clack/prompts";
|
|
31715
31378
|
import * as pulumi25 from "@pulumi/pulumi";
|
|
31716
|
-
import
|
|
31379
|
+
import pc42 from "picocolors";
|
|
31717
31380
|
|
|
31718
31381
|
// src/infrastructure/sms-stack.ts
|
|
31719
31382
|
init_esm_shims();
|
|
@@ -32405,18 +32068,18 @@ async function createSMSProtectConfigurationWithSDK(configurationSetName, region
|
|
|
32405
32068
|
const existing = await client.send(
|
|
32406
32069
|
new DescribeProtectConfigurationsCommand({})
|
|
32407
32070
|
);
|
|
32408
|
-
for (const
|
|
32409
|
-
if (!(
|
|
32071
|
+
for (const pc54 of existing.ProtectConfigurations || []) {
|
|
32072
|
+
if (!(pc54.ProtectConfigurationArn && pc54.ProtectConfigurationId)) {
|
|
32410
32073
|
continue;
|
|
32411
32074
|
}
|
|
32412
32075
|
const tagsResponse = await client.send(
|
|
32413
32076
|
new ListTagsForResourceCommand({
|
|
32414
|
-
ResourceArn:
|
|
32077
|
+
ResourceArn: pc54.ProtectConfigurationArn
|
|
32415
32078
|
})
|
|
32416
32079
|
);
|
|
32417
32080
|
const nameTag = tagsResponse.Tags?.find((t) => t.Key === "Name");
|
|
32418
32081
|
if (nameTag?.Value === protectConfigName) {
|
|
32419
|
-
existingProtectConfigId =
|
|
32082
|
+
existingProtectConfigId = pc54.ProtectConfigurationId;
|
|
32420
32083
|
break;
|
|
32421
32084
|
}
|
|
32422
32085
|
}
|
|
@@ -32512,13 +32175,13 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
32512
32175
|
new DescribeProtectConfigurationsCommand({})
|
|
32513
32176
|
);
|
|
32514
32177
|
if (existing.ProtectConfigurations) {
|
|
32515
|
-
for (const
|
|
32516
|
-
if (!(
|
|
32178
|
+
for (const pc54 of existing.ProtectConfigurations) {
|
|
32179
|
+
if (!(pc54.ProtectConfigurationArn && pc54.ProtectConfigurationId)) {
|
|
32517
32180
|
continue;
|
|
32518
32181
|
}
|
|
32519
32182
|
const tagsResponse = await client.send(
|
|
32520
32183
|
new ListTagsForResourceCommand({
|
|
32521
|
-
ResourceArn:
|
|
32184
|
+
ResourceArn: pc54.ProtectConfigurationArn
|
|
32522
32185
|
})
|
|
32523
32186
|
);
|
|
32524
32187
|
const isWrapsManaged = tagsResponse.Tags?.some(
|
|
@@ -32527,7 +32190,7 @@ async function deleteSMSProtectConfigurationWithSDK(region) {
|
|
|
32527
32190
|
if (isWrapsManaged) {
|
|
32528
32191
|
await client.send(
|
|
32529
32192
|
new DeleteProtectConfigurationCommand({
|
|
32530
|
-
ProtectConfigurationId:
|
|
32193
|
+
ProtectConfigurationId: pc54.ProtectConfigurationId
|
|
32531
32194
|
})
|
|
32532
32195
|
);
|
|
32533
32196
|
}
|
|
@@ -32561,7 +32224,7 @@ async function smsDestroy(options) {
|
|
|
32561
32224
|
}
|
|
32562
32225
|
if (!isJsonMode()) {
|
|
32563
32226
|
clack39.intro(
|
|
32564
|
-
|
|
32227
|
+
pc42.bold(
|
|
32565
32228
|
options.preview ? "SMS Infrastructure Destruction Preview" : "SMS Infrastructure Teardown"
|
|
32566
32229
|
)
|
|
32567
32230
|
);
|
|
@@ -32611,7 +32274,7 @@ async function smsDestroy(options) {
|
|
|
32611
32274
|
}
|
|
32612
32275
|
if (!(options.force || options.preview)) {
|
|
32613
32276
|
const confirmed = await clack39.confirm({
|
|
32614
|
-
message:
|
|
32277
|
+
message: pc42.red(
|
|
32615
32278
|
"Are you sure you want to destroy all SMS infrastructure?"
|
|
32616
32279
|
),
|
|
32617
32280
|
initialValue: false
|
|
@@ -32650,7 +32313,7 @@ async function smsDestroy(options) {
|
|
|
32650
32313
|
commandName: "wraps sms destroy"
|
|
32651
32314
|
});
|
|
32652
32315
|
clack39.outro(
|
|
32653
|
-
|
|
32316
|
+
pc42.green("Preview complete. Run without --preview to destroy.")
|
|
32654
32317
|
);
|
|
32655
32318
|
trackServiceRemoved("sms", {
|
|
32656
32319
|
preview: true,
|
|
@@ -32747,20 +32410,20 @@ async function smsDestroy(options) {
|
|
|
32747
32410
|
}
|
|
32748
32411
|
if (destroyFailed) {
|
|
32749
32412
|
clack39.outro(
|
|
32750
|
-
|
|
32413
|
+
pc42.yellow("SMS infrastructure partially removed. Metadata cleaned up.")
|
|
32751
32414
|
);
|
|
32752
32415
|
} else {
|
|
32753
|
-
clack39.outro(
|
|
32416
|
+
clack39.outro(pc42.green("SMS infrastructure has been removed"));
|
|
32754
32417
|
console.log(`
|
|
32755
|
-
${
|
|
32756
|
-
console.log(` ${
|
|
32757
|
-
console.log(` ${
|
|
32758
|
-
console.log(` ${
|
|
32759
|
-
console.log(` ${
|
|
32418
|
+
${pc42.bold("Cleaned up:")}`);
|
|
32419
|
+
console.log(` ${pc42.green("\u2713")} Phone number released`);
|
|
32420
|
+
console.log(` ${pc42.green("\u2713")} Configuration set deleted`);
|
|
32421
|
+
console.log(` ${pc42.green("\u2713")} Event processing infrastructure removed`);
|
|
32422
|
+
console.log(` ${pc42.green("\u2713")} IAM role deleted`);
|
|
32760
32423
|
}
|
|
32761
32424
|
console.log(
|
|
32762
32425
|
`
|
|
32763
|
-
Run ${
|
|
32426
|
+
Run ${pc42.cyan("wraps sms init")} to deploy infrastructure again.
|
|
32764
32427
|
`
|
|
32765
32428
|
);
|
|
32766
32429
|
trackServiceRemoved("sms", {
|
|
@@ -32774,7 +32437,7 @@ Run ${pc43.cyan("wraps sms init")} to deploy infrastructure again.
|
|
|
32774
32437
|
init_esm_shims();
|
|
32775
32438
|
import * as clack40 from "@clack/prompts";
|
|
32776
32439
|
import * as pulumi26 from "@pulumi/pulumi";
|
|
32777
|
-
import
|
|
32440
|
+
import pc43 from "picocolors";
|
|
32778
32441
|
init_events();
|
|
32779
32442
|
init_aws();
|
|
32780
32443
|
init_errors();
|
|
@@ -33301,7 +32964,7 @@ async function promptEstimatedSMSVolume() {
|
|
|
33301
32964
|
async function init3(options) {
|
|
33302
32965
|
const startTime = Date.now();
|
|
33303
32966
|
if (!isJsonMode()) {
|
|
33304
|
-
clack40.intro(
|
|
32967
|
+
clack40.intro(pc43.bold("Wraps SMS Infrastructure Setup"));
|
|
33305
32968
|
}
|
|
33306
32969
|
const progress = new DeploymentProgress();
|
|
33307
32970
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -33315,7 +32978,7 @@ async function init3(options) {
|
|
|
33315
32978
|
"Validating AWS credentials",
|
|
33316
32979
|
async () => validateAWSCredentials()
|
|
33317
32980
|
);
|
|
33318
|
-
progress.info(`Connected to AWS account: ${
|
|
32981
|
+
progress.info(`Connected to AWS account: ${pc43.cyan(identity.accountId)}`);
|
|
33319
32982
|
const provider = options.provider || await promptProvider();
|
|
33320
32983
|
const region = options.region || await promptRegion(await getAWSRegion());
|
|
33321
32984
|
let vercelConfig;
|
|
@@ -33328,9 +32991,9 @@ async function init3(options) {
|
|
|
33328
32991
|
);
|
|
33329
32992
|
if (existingConnection?.services?.sms) {
|
|
33330
32993
|
clack40.log.warn(
|
|
33331
|
-
`SMS already configured for account ${
|
|
32994
|
+
`SMS already configured for account ${pc43.cyan(identity.accountId)} in region ${pc43.cyan(region)}`
|
|
33332
32995
|
);
|
|
33333
|
-
clack40.log.info(`Use ${
|
|
32996
|
+
clack40.log.info(`Use ${pc43.cyan("wraps sms status")} to view current setup`);
|
|
33334
32997
|
process.exit(0);
|
|
33335
32998
|
}
|
|
33336
32999
|
let preset = options.preset;
|
|
@@ -33372,7 +33035,7 @@ async function init3(options) {
|
|
|
33372
33035
|
}
|
|
33373
33036
|
progress.info(
|
|
33374
33037
|
`
|
|
33375
|
-
${
|
|
33038
|
+
${pc43.bold("Fraud Protection")} - Block SMS to countries where you don't do business`
|
|
33376
33039
|
);
|
|
33377
33040
|
const allowedCountries = await promptAllowedCountries();
|
|
33378
33041
|
let aitFiltering = false;
|
|
@@ -33394,13 +33057,13 @@ ${pc44.bold("Fraud Protection")} - Block SMS to countries where you don't do bus
|
|
|
33394
33057
|
};
|
|
33395
33058
|
const estimatedVolume = await promptEstimatedSMSVolume();
|
|
33396
33059
|
progress.info(`
|
|
33397
|
-
${
|
|
33060
|
+
${pc43.bold("Cost Estimate:")}`);
|
|
33398
33061
|
const costSummary = getSMSCostSummary(smsConfig, estimatedVolume);
|
|
33399
33062
|
clack40.log.info(costSummary);
|
|
33400
33063
|
const warnings = validateSMSConfig(smsConfig);
|
|
33401
33064
|
if (warnings.length > 0) {
|
|
33402
33065
|
progress.info(`
|
|
33403
|
-
${
|
|
33066
|
+
${pc43.yellow(pc43.bold("Important Notes:"))}`);
|
|
33404
33067
|
for (const warning of warnings) {
|
|
33405
33068
|
clack40.log.warn(warning);
|
|
33406
33069
|
}
|
|
@@ -33483,7 +33146,7 @@ ${pc44.yellow(pc44.bold("Important Notes:"))}`);
|
|
|
33483
33146
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
33484
33147
|
clack40.log.warn(`Phone pool creation failed: ${msg}`);
|
|
33485
33148
|
clack40.log.info(
|
|
33486
|
-
`Run ${
|
|
33149
|
+
`Run ${pc43.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
33487
33150
|
);
|
|
33488
33151
|
}
|
|
33489
33152
|
}
|
|
@@ -33501,7 +33164,7 @@ ${pc44.yellow(pc44.bold("Important Notes:"))}`);
|
|
|
33501
33164
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
33502
33165
|
clack40.log.warn(`Event destination creation failed: ${msg}`);
|
|
33503
33166
|
clack40.log.info(
|
|
33504
|
-
`Run ${
|
|
33167
|
+
`Run ${pc43.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
33505
33168
|
);
|
|
33506
33169
|
}
|
|
33507
33170
|
}
|
|
@@ -33522,7 +33185,7 @@ ${pc44.yellow(pc44.bold("Important Notes:"))}`);
|
|
|
33522
33185
|
const msg = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
33523
33186
|
clack40.log.warn(`Protect configuration creation failed: ${msg}`);
|
|
33524
33187
|
clack40.log.info(
|
|
33525
|
-
`Run ${
|
|
33188
|
+
`Run ${pc43.cyan("wraps sms sync")} to retry SDK resource creation.`
|
|
33526
33189
|
);
|
|
33527
33190
|
}
|
|
33528
33191
|
}
|
|
@@ -33576,47 +33239,47 @@ ${pc44.yellow(pc44.bold("Important Notes:"))}`);
|
|
|
33576
33239
|
return;
|
|
33577
33240
|
}
|
|
33578
33241
|
console.log("\n");
|
|
33579
|
-
clack40.log.success(
|
|
33242
|
+
clack40.log.success(pc43.green(pc43.bold("SMS infrastructure deployed!")));
|
|
33580
33243
|
console.log("\n");
|
|
33581
33244
|
clack40.note(
|
|
33582
33245
|
[
|
|
33583
|
-
`${
|
|
33584
|
-
`${
|
|
33585
|
-
`${
|
|
33586
|
-
`${
|
|
33587
|
-
outputs.tableName ? `${
|
|
33246
|
+
`${pc43.bold("Phone Number:")} ${pc43.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
33247
|
+
`${pc43.bold("Phone Type:")} ${pc43.cyan(smsConfig.phoneNumberType || "simulator")}`,
|
|
33248
|
+
`${pc43.bold("Config Set:")} ${pc43.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
33249
|
+
`${pc43.bold("Region:")} ${pc43.cyan(outputs.region)}`,
|
|
33250
|
+
outputs.tableName ? `${pc43.bold("History Table:")} ${pc43.cyan(outputs.tableName)}` : "",
|
|
33588
33251
|
"",
|
|
33589
|
-
|
|
33590
|
-
|
|
33252
|
+
pc43.dim("IAM Role:"),
|
|
33253
|
+
pc43.dim(` ${outputs.roleArn}`)
|
|
33591
33254
|
].filter(Boolean).join("\n"),
|
|
33592
33255
|
"SMS Infrastructure"
|
|
33593
33256
|
);
|
|
33594
33257
|
const nextSteps = [];
|
|
33595
33258
|
if (smsConfig.phoneNumberType === "toll-free") {
|
|
33596
33259
|
nextSteps.push(
|
|
33597
|
-
`${
|
|
33260
|
+
`${pc43.cyan("wraps sms register")} - Submit toll-free registration (required before sending)`
|
|
33598
33261
|
);
|
|
33599
33262
|
}
|
|
33600
33263
|
nextSteps.push(
|
|
33601
|
-
`${
|
|
33264
|
+
`${pc43.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
33602
33265
|
);
|
|
33603
|
-
nextSteps.push(`${
|
|
33266
|
+
nextSteps.push(`${pc43.cyan("wraps sms status")} - View SMS configuration`);
|
|
33604
33267
|
console.log("\n");
|
|
33605
|
-
clack40.log.info(
|
|
33268
|
+
clack40.log.info(pc43.bold("Next steps:"));
|
|
33606
33269
|
for (const step of nextSteps) {
|
|
33607
33270
|
console.log(` ${step}`);
|
|
33608
33271
|
}
|
|
33609
33272
|
console.log("\n");
|
|
33610
|
-
clack40.log.info(
|
|
33611
|
-
console.log(
|
|
33273
|
+
clack40.log.info(pc43.bold("SDK Usage:"));
|
|
33274
|
+
console.log(pc43.dim(" npm install @wraps.dev/sms"));
|
|
33612
33275
|
console.log("");
|
|
33613
|
-
console.log(
|
|
33614
|
-
console.log(
|
|
33615
|
-
console.log(
|
|
33616
|
-
console.log(
|
|
33617
|
-
console.log(
|
|
33618
|
-
console.log(
|
|
33619
|
-
clack40.outro(
|
|
33276
|
+
console.log(pc43.dim(" import { Wraps } from '@wraps.dev/sms';"));
|
|
33277
|
+
console.log(pc43.dim(" const wraps = new Wraps();"));
|
|
33278
|
+
console.log(pc43.dim(" await wraps.sms.send({"));
|
|
33279
|
+
console.log(pc43.dim(" to: '+14155551234',"));
|
|
33280
|
+
console.log(pc43.dim(" message: 'Your code is 123456',"));
|
|
33281
|
+
console.log(pc43.dim(" });"));
|
|
33282
|
+
clack40.outro(pc43.green("Setup complete!"));
|
|
33620
33283
|
const duration = Date.now() - startTime;
|
|
33621
33284
|
const enabledFeatures = [];
|
|
33622
33285
|
if (smsConfig.tracking?.enabled) {
|
|
@@ -33653,7 +33316,7 @@ init_json_output();
|
|
|
33653
33316
|
init_metadata();
|
|
33654
33317
|
init_output();
|
|
33655
33318
|
import * as clack41 from "@clack/prompts";
|
|
33656
|
-
import
|
|
33319
|
+
import pc44 from "picocolors";
|
|
33657
33320
|
async function getPhoneNumberDetails(region) {
|
|
33658
33321
|
const { PinpointSMSVoiceV2Client: PinpointSMSVoiceV2Client5, DescribePhoneNumbersCommand: DescribePhoneNumbersCommand2 } = await import("@aws-sdk/client-pinpoint-sms-voice-v2");
|
|
33659
33322
|
const client = new PinpointSMSVoiceV2Client5({ region });
|
|
@@ -33694,7 +33357,7 @@ async function getRegistrationStatus(region, registrationId) {
|
|
|
33694
33357
|
async function smsRegister(options) {
|
|
33695
33358
|
const startTime = Date.now();
|
|
33696
33359
|
if (!isJsonMode()) {
|
|
33697
|
-
clack41.intro(
|
|
33360
|
+
clack41.intro(pc44.bold("Wraps SMS - Toll-Free Registration"));
|
|
33698
33361
|
}
|
|
33699
33362
|
const progress = new DeploymentProgress();
|
|
33700
33363
|
const identity = await progress.execute(
|
|
@@ -33708,7 +33371,7 @@ async function smsRegister(options) {
|
|
|
33708
33371
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
33709
33372
|
if (!metadata?.services?.sms) {
|
|
33710
33373
|
clack41.log.error("No SMS infrastructure found.");
|
|
33711
|
-
clack41.log.info(`Run ${
|
|
33374
|
+
clack41.log.info(`Run ${pc44.cyan("wraps sms init")} first.`);
|
|
33712
33375
|
process.exit(1);
|
|
33713
33376
|
}
|
|
33714
33377
|
const phoneDetails = await progress.execute(
|
|
@@ -33742,14 +33405,14 @@ async function smsRegister(options) {
|
|
|
33742
33405
|
}
|
|
33743
33406
|
console.log("");
|
|
33744
33407
|
console.log(
|
|
33745
|
-
`${
|
|
33408
|
+
`${pc44.bold("Phone Number:")} ${pc44.cyan(phoneDetails.phoneNumber)}`
|
|
33746
33409
|
);
|
|
33747
|
-
console.log(`${
|
|
33410
|
+
console.log(`${pc44.bold("Type:")} ${pc44.cyan(phoneDetails.type)}`);
|
|
33748
33411
|
console.log(
|
|
33749
|
-
`${
|
|
33412
|
+
`${pc44.bold("Status:")} ${phoneDetails.status === "ACTIVE" ? pc44.green(phoneDetails.status) : pc44.yellow(phoneDetails.status)}`
|
|
33750
33413
|
);
|
|
33751
33414
|
if (registrationStatus) {
|
|
33752
|
-
console.log(`${
|
|
33415
|
+
console.log(`${pc44.bold("Registration:")} ${pc44.cyan(registrationStatus)}`);
|
|
33753
33416
|
}
|
|
33754
33417
|
console.log("");
|
|
33755
33418
|
if (phoneDetails.status === "ACTIVE") {
|
|
@@ -33767,21 +33430,21 @@ async function smsRegister(options) {
|
|
|
33767
33430
|
clack41.log.info(`Your ${phoneDetails.type} number should be ready to use.`);
|
|
33768
33431
|
process.exit(0);
|
|
33769
33432
|
}
|
|
33770
|
-
console.log(
|
|
33433
|
+
console.log(pc44.bold("Toll-Free Registration Required"));
|
|
33771
33434
|
console.log("");
|
|
33772
33435
|
console.log(
|
|
33773
|
-
|
|
33436
|
+
pc44.dim("To send SMS at scale, you must register your toll-free number.")
|
|
33774
33437
|
);
|
|
33775
|
-
console.log(
|
|
33438
|
+
console.log(pc44.dim("This process typically takes 1-15 business days."));
|
|
33776
33439
|
console.log("");
|
|
33777
|
-
console.log(
|
|
33778
|
-
console.log(` ${
|
|
33440
|
+
console.log(pc44.bold("You'll need to provide:"));
|
|
33441
|
+
console.log(` ${pc44.dim("\u2022")} Business name and address`);
|
|
33779
33442
|
console.log(
|
|
33780
|
-
` ${
|
|
33443
|
+
` ${pc44.dim("\u2022")} Use case description (what messages you're sending)`
|
|
33781
33444
|
);
|
|
33782
|
-
console.log(` ${
|
|
33783
|
-
console.log(` ${
|
|
33784
|
-
console.log(` ${
|
|
33445
|
+
console.log(` ${pc44.dim("\u2022")} Sample messages (2-3 examples)`);
|
|
33446
|
+
console.log(` ${pc44.dim("\u2022")} How users opt-in to receive messages`);
|
|
33447
|
+
console.log(` ${pc44.dim("\u2022")} Expected monthly message volume`);
|
|
33785
33448
|
console.log("");
|
|
33786
33449
|
const openConsole = await clack41.confirm({
|
|
33787
33450
|
message: "Open AWS Console to start registration?",
|
|
@@ -33806,33 +33469,33 @@ async function smsRegister(options) {
|
|
|
33806
33469
|
} catch {
|
|
33807
33470
|
clack41.log.info("Open this URL in your browser:");
|
|
33808
33471
|
console.log(`
|
|
33809
|
-
${
|
|
33472
|
+
${pc44.cyan(consoleUrl)}
|
|
33810
33473
|
`);
|
|
33811
33474
|
}
|
|
33812
33475
|
}
|
|
33813
33476
|
console.log("");
|
|
33814
|
-
console.log(
|
|
33477
|
+
console.log(pc44.bold("Next Steps:"));
|
|
33815
33478
|
console.log(
|
|
33816
|
-
` 1. Click ${
|
|
33479
|
+
` 1. Click ${pc44.cyan("Create registration")} in the AWS Console`
|
|
33817
33480
|
);
|
|
33818
|
-
console.log(` 2. Select ${
|
|
33481
|
+
console.log(` 2. Select ${pc44.cyan("Toll-free number registration")}`);
|
|
33819
33482
|
console.log(" 3. Fill out the business information form");
|
|
33820
33483
|
console.log(" 4. Submit and wait for approval (1-15 business days)");
|
|
33821
33484
|
console.log("");
|
|
33822
33485
|
console.log(
|
|
33823
|
-
|
|
33486
|
+
pc44.dim("Once approved, run `wraps sms sync` to complete setup.")
|
|
33824
33487
|
);
|
|
33825
33488
|
} else {
|
|
33826
33489
|
const consoleUrl = `https://${region}.console.aws.amazon.com/sms-voice/home?region=${region}#/registrations`;
|
|
33827
33490
|
console.log("");
|
|
33828
33491
|
console.log("When you're ready, go to:");
|
|
33829
|
-
console.log(` ${
|
|
33492
|
+
console.log(` ${pc44.cyan(consoleUrl)}`);
|
|
33830
33493
|
}
|
|
33831
33494
|
trackCommand("sms:register", {
|
|
33832
33495
|
success: true,
|
|
33833
33496
|
duration_ms: Date.now() - startTime
|
|
33834
33497
|
});
|
|
33835
|
-
clack41.outro(
|
|
33498
|
+
clack41.outro(pc44.dim("Good luck with your registration!"));
|
|
33836
33499
|
}
|
|
33837
33500
|
|
|
33838
33501
|
// src/commands/sms/status.ts
|
|
@@ -33845,43 +33508,43 @@ init_metadata();
|
|
|
33845
33508
|
init_output();
|
|
33846
33509
|
import * as clack42 from "@clack/prompts";
|
|
33847
33510
|
import * as pulumi27 from "@pulumi/pulumi";
|
|
33848
|
-
import
|
|
33511
|
+
import pc45 from "picocolors";
|
|
33849
33512
|
function displaySMSStatus(options) {
|
|
33850
33513
|
const lines = [];
|
|
33851
|
-
lines.push(
|
|
33514
|
+
lines.push(pc45.bold(pc45.green("SMS Infrastructure Active")));
|
|
33852
33515
|
lines.push("");
|
|
33853
|
-
lines.push(
|
|
33516
|
+
lines.push(pc45.bold("Phone Number"));
|
|
33854
33517
|
if (options.phoneNumber) {
|
|
33855
|
-
lines.push(` Number: ${
|
|
33518
|
+
lines.push(` Number: ${pc45.cyan(options.phoneNumber)}`);
|
|
33856
33519
|
} else {
|
|
33857
|
-
lines.push(` Number: ${
|
|
33520
|
+
lines.push(` Number: ${pc45.yellow("Provisioning...")}`);
|
|
33858
33521
|
}
|
|
33859
|
-
lines.push(` Type: ${
|
|
33522
|
+
lines.push(` Type: ${pc45.cyan(options.phoneNumberType || "simulator")}`);
|
|
33860
33523
|
lines.push("");
|
|
33861
|
-
lines.push(
|
|
33862
|
-
lines.push(` Region: ${
|
|
33524
|
+
lines.push(pc45.bold("Configuration"));
|
|
33525
|
+
lines.push(` Region: ${pc45.cyan(options.region)}`);
|
|
33863
33526
|
if (options.preset) {
|
|
33864
|
-
lines.push(` Preset: ${
|
|
33527
|
+
lines.push(` Preset: ${pc45.cyan(options.preset)}`);
|
|
33865
33528
|
}
|
|
33866
33529
|
if (options.configSetName) {
|
|
33867
|
-
lines.push(` Config Set: ${
|
|
33530
|
+
lines.push(` Config Set: ${pc45.cyan(options.configSetName)}`);
|
|
33868
33531
|
}
|
|
33869
33532
|
lines.push("");
|
|
33870
|
-
lines.push(
|
|
33533
|
+
lines.push(pc45.bold("Features"));
|
|
33871
33534
|
lines.push(
|
|
33872
|
-
` Event Tracking: ${options.eventTracking ?
|
|
33535
|
+
` Event Tracking: ${options.eventTracking ? pc45.green("Enabled") : pc45.dim("Disabled")}`
|
|
33873
33536
|
);
|
|
33874
33537
|
if (options.tableName) {
|
|
33875
|
-
lines.push(` Message History: ${
|
|
33876
|
-
lines.push(` Table: ${
|
|
33538
|
+
lines.push(` Message History: ${pc45.green("Enabled")}`);
|
|
33539
|
+
lines.push(` Table: ${pc45.dim(options.tableName)}`);
|
|
33877
33540
|
}
|
|
33878
33541
|
if (options.queueUrl) {
|
|
33879
|
-
lines.push(` Event Queue: ${
|
|
33542
|
+
lines.push(` Event Queue: ${pc45.green("Enabled")}`);
|
|
33880
33543
|
}
|
|
33881
33544
|
lines.push("");
|
|
33882
33545
|
if (options.roleArn) {
|
|
33883
|
-
lines.push(
|
|
33884
|
-
lines.push(` ${
|
|
33546
|
+
lines.push(pc45.bold("IAM Role"));
|
|
33547
|
+
lines.push(` ${pc45.dim(options.roleArn)}`);
|
|
33885
33548
|
}
|
|
33886
33549
|
clack42.note(lines.join("\n"), "SMS Status");
|
|
33887
33550
|
}
|
|
@@ -33889,7 +33552,7 @@ async function smsStatus(_options) {
|
|
|
33889
33552
|
const startTime = Date.now();
|
|
33890
33553
|
const progress = new DeploymentProgress();
|
|
33891
33554
|
if (!isJsonMode()) {
|
|
33892
|
-
clack42.intro(
|
|
33555
|
+
clack42.intro(pc45.bold("Wraps SMS Status"));
|
|
33893
33556
|
}
|
|
33894
33557
|
const identity = await progress.execute(
|
|
33895
33558
|
"Loading SMS infrastructure status",
|
|
@@ -33902,7 +33565,7 @@ async function smsStatus(_options) {
|
|
|
33902
33565
|
clack42.log.error("No SMS infrastructure found");
|
|
33903
33566
|
console.log(
|
|
33904
33567
|
`
|
|
33905
|
-
Run ${
|
|
33568
|
+
Run ${pc45.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
33906
33569
|
`
|
|
33907
33570
|
);
|
|
33908
33571
|
process.exit(1);
|
|
@@ -33938,25 +33601,25 @@ Run ${pc46.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
33938
33601
|
}
|
|
33939
33602
|
displaySMSStatus(smsStatusData);
|
|
33940
33603
|
console.log("");
|
|
33941
|
-
clack42.log.info(
|
|
33604
|
+
clack42.log.info(pc45.bold("Commands:"));
|
|
33942
33605
|
console.log(
|
|
33943
|
-
` ${
|
|
33606
|
+
` ${pc45.cyan("wraps sms test --to +1234567890")} - Send a test message`
|
|
33944
33607
|
);
|
|
33945
|
-
console.log(` ${
|
|
33608
|
+
console.log(` ${pc45.cyan("wraps sms destroy")} - Remove SMS infrastructure`);
|
|
33946
33609
|
trackCommand("sms:status", {
|
|
33947
33610
|
success: true,
|
|
33948
33611
|
phone_type: smsConfig?.phoneNumberType,
|
|
33949
33612
|
event_tracking: smsConfig?.eventTracking?.enabled,
|
|
33950
33613
|
duration_ms: Date.now() - startTime
|
|
33951
33614
|
});
|
|
33952
|
-
clack42.outro(
|
|
33615
|
+
clack42.outro(pc45.dim("SMS infrastructure is ready"));
|
|
33953
33616
|
}
|
|
33954
33617
|
|
|
33955
33618
|
// src/commands/sms/sync.ts
|
|
33956
33619
|
init_esm_shims();
|
|
33957
33620
|
import * as clack43 from "@clack/prompts";
|
|
33958
33621
|
import * as pulumi28 from "@pulumi/pulumi";
|
|
33959
|
-
import
|
|
33622
|
+
import pc46 from "picocolors";
|
|
33960
33623
|
init_events();
|
|
33961
33624
|
init_aws();
|
|
33962
33625
|
init_errors();
|
|
@@ -33967,7 +33630,7 @@ init_output();
|
|
|
33967
33630
|
async function smsSync(options) {
|
|
33968
33631
|
const startTime = Date.now();
|
|
33969
33632
|
if (!isJsonMode()) {
|
|
33970
|
-
clack43.intro(
|
|
33633
|
+
clack43.intro(pc46.bold("Wraps SMS Infrastructure Sync"));
|
|
33971
33634
|
}
|
|
33972
33635
|
const progress = new DeploymentProgress();
|
|
33973
33636
|
const identity = await progress.execute(
|
|
@@ -33982,7 +33645,7 @@ async function smsSync(options) {
|
|
|
33982
33645
|
clack43.log.error("No SMS infrastructure found to sync");
|
|
33983
33646
|
console.log(
|
|
33984
33647
|
`
|
|
33985
|
-
Run ${
|
|
33648
|
+
Run ${pc46.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
33986
33649
|
`
|
|
33987
33650
|
);
|
|
33988
33651
|
process.exit(1);
|
|
@@ -33991,10 +33654,10 @@ Run ${pc47.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
33991
33654
|
const storedStackName = smsService.pulumiStackName;
|
|
33992
33655
|
progress.info("Found existing SMS configuration");
|
|
33993
33656
|
progress.info(
|
|
33994
|
-
`Phone type: ${
|
|
33657
|
+
`Phone type: ${pc46.cyan(smsConfig.phoneNumberType || "simulator")}`
|
|
33995
33658
|
);
|
|
33996
33659
|
progress.info(
|
|
33997
|
-
`Event tracking: ${
|
|
33660
|
+
`Event tracking: ${pc46.cyan(smsConfig.eventTracking?.enabled ? "enabled" : "disabled")}`
|
|
33998
33661
|
);
|
|
33999
33662
|
if (!options.yes) {
|
|
34000
33663
|
const confirmed = await clack43.confirm({
|
|
@@ -34127,7 +33790,7 @@ Run ${pc47.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
34127
33790
|
return;
|
|
34128
33791
|
}
|
|
34129
33792
|
console.log("\n");
|
|
34130
|
-
clack43.log.success(
|
|
33793
|
+
clack43.log.success(pc46.green("SMS infrastructure synced successfully!"));
|
|
34131
33794
|
const changes = [];
|
|
34132
33795
|
if (outputs.lambdaFunctions?.length) {
|
|
34133
33796
|
changes.push("Lambda functions updated");
|
|
@@ -34135,13 +33798,13 @@ Run ${pc47.cyan("wraps sms init")} to deploy SMS infrastructure first.
|
|
|
34135
33798
|
changes.push("SDK resources verified");
|
|
34136
33799
|
console.log("");
|
|
34137
33800
|
for (const change of changes) {
|
|
34138
|
-
console.log(` ${
|
|
33801
|
+
console.log(` ${pc46.green("\u2713")} ${change}`);
|
|
34139
33802
|
}
|
|
34140
33803
|
trackCommand("sms:sync", {
|
|
34141
33804
|
success: true,
|
|
34142
33805
|
duration_ms: Date.now() - startTime
|
|
34143
33806
|
});
|
|
34144
|
-
clack43.outro(
|
|
33807
|
+
clack43.outro(pc46.green("Sync complete!"));
|
|
34145
33808
|
}
|
|
34146
33809
|
|
|
34147
33810
|
// src/commands/sms/test.ts
|
|
@@ -34157,7 +33820,7 @@ import {
|
|
|
34157
33820
|
SendTextMessageCommand
|
|
34158
33821
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
34159
33822
|
import * as clack44 from "@clack/prompts";
|
|
34160
|
-
import
|
|
33823
|
+
import pc47 from "picocolors";
|
|
34161
33824
|
|
|
34162
33825
|
// src/utils/sms/validation.ts
|
|
34163
33826
|
init_esm_shims();
|
|
@@ -34180,7 +33843,7 @@ async function smsTest(options) {
|
|
|
34180
33843
|
const startTime = Date.now();
|
|
34181
33844
|
const progress = new DeploymentProgress();
|
|
34182
33845
|
if (!isJsonMode()) {
|
|
34183
|
-
clack44.intro(
|
|
33846
|
+
clack44.intro(pc47.bold("Wraps SMS Test"));
|
|
34184
33847
|
}
|
|
34185
33848
|
const identity = await progress.execute(
|
|
34186
33849
|
"Validating AWS credentials",
|
|
@@ -34193,7 +33856,7 @@ async function smsTest(options) {
|
|
|
34193
33856
|
clack44.log.error("No SMS infrastructure found");
|
|
34194
33857
|
console.log(
|
|
34195
33858
|
`
|
|
34196
|
-
Run ${
|
|
33859
|
+
Run ${pc47.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
34197
33860
|
`
|
|
34198
33861
|
);
|
|
34199
33862
|
process.exit(1);
|
|
@@ -34322,16 +33985,16 @@ Run ${pc48.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
34322
33985
|
return;
|
|
34323
33986
|
}
|
|
34324
33987
|
console.log("\n");
|
|
34325
|
-
clack44.log.success(
|
|
33988
|
+
clack44.log.success(pc47.green("Test SMS sent successfully!"));
|
|
34326
33989
|
console.log("");
|
|
34327
33990
|
clack44.note(
|
|
34328
33991
|
[
|
|
34329
|
-
`${
|
|
34330
|
-
`${
|
|
34331
|
-
`${
|
|
34332
|
-
`${
|
|
33992
|
+
`${pc47.bold("Message ID:")} ${pc47.cyan(messageId || "unknown")}`,
|
|
33993
|
+
`${pc47.bold("To:")} ${pc47.cyan(toNumber)}`,
|
|
33994
|
+
`${pc47.bold("Message:")} ${message}`,
|
|
33995
|
+
`${pc47.bold("Type:")} ${pc47.cyan(smsConfig?.phoneNumberType || "simulator")}`,
|
|
34333
33996
|
"",
|
|
34334
|
-
|
|
33997
|
+
pc47.dim(
|
|
34335
33998
|
smsConfig?.phoneNumberType === "simulator" ? "Note: Simulator messages are not actually delivered" : "Check your phone for the message!"
|
|
34336
33999
|
)
|
|
34337
34000
|
].join("\n"),
|
|
@@ -34340,10 +34003,10 @@ Run ${pc48.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
34340
34003
|
if (smsConfig?.eventTracking?.enabled) {
|
|
34341
34004
|
console.log("");
|
|
34342
34005
|
clack44.log.info(
|
|
34343
|
-
|
|
34006
|
+
pc47.dim("Event tracking is enabled. Check DynamoDB for delivery status.")
|
|
34344
34007
|
);
|
|
34345
34008
|
}
|
|
34346
|
-
clack44.outro(
|
|
34009
|
+
clack44.outro(pc47.green("Test complete!"));
|
|
34347
34010
|
} catch (error) {
|
|
34348
34011
|
progress.stop();
|
|
34349
34012
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -34368,7 +34031,7 @@ Run ${pc48.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
34368
34031
|
clack44.log.error("Toll-free number registration is not complete");
|
|
34369
34032
|
console.log(
|
|
34370
34033
|
`
|
|
34371
|
-
Run ${
|
|
34034
|
+
Run ${pc47.cyan("wraps sms register")} to check registration status.
|
|
34372
34035
|
`
|
|
34373
34036
|
);
|
|
34374
34037
|
} else if (errorName === "AccessDeniedException") {
|
|
@@ -34377,7 +34040,7 @@ Run ${pc48.cyan("wraps sms register")} to check registration status.
|
|
|
34377
34040
|
);
|
|
34378
34041
|
console.log(
|
|
34379
34042
|
`
|
|
34380
|
-
Run ${
|
|
34043
|
+
Run ${pc47.cyan("wraps sms upgrade")} to update IAM policies.
|
|
34381
34044
|
`
|
|
34382
34045
|
);
|
|
34383
34046
|
} else {
|
|
@@ -34391,7 +34054,7 @@ Run ${pc48.cyan("wraps sms upgrade")} to update IAM policies.
|
|
|
34391
34054
|
init_esm_shims();
|
|
34392
34055
|
import * as clack45 from "@clack/prompts";
|
|
34393
34056
|
import * as pulumi29 from "@pulumi/pulumi";
|
|
34394
|
-
import
|
|
34057
|
+
import pc48 from "picocolors";
|
|
34395
34058
|
init_events();
|
|
34396
34059
|
init_aws();
|
|
34397
34060
|
init_errors();
|
|
@@ -34404,7 +34067,7 @@ async function smsUpgrade(options) {
|
|
|
34404
34067
|
const startTime = Date.now();
|
|
34405
34068
|
let upgradeAction = "";
|
|
34406
34069
|
if (!isJsonMode()) {
|
|
34407
|
-
clack45.intro(
|
|
34070
|
+
clack45.intro(pc48.bold("Wraps SMS Upgrade - Enhance Your SMS Infrastructure"));
|
|
34408
34071
|
}
|
|
34409
34072
|
const progress = new DeploymentProgress();
|
|
34410
34073
|
const wasAutoInstalled = await progress.execute(
|
|
@@ -34418,7 +34081,7 @@ async function smsUpgrade(options) {
|
|
|
34418
34081
|
"Validating AWS credentials",
|
|
34419
34082
|
async () => validateAWSCredentials()
|
|
34420
34083
|
);
|
|
34421
|
-
progress.info(`Connected to AWS account: ${
|
|
34084
|
+
progress.info(`Connected to AWS account: ${pc48.cyan(identity.accountId)}`);
|
|
34422
34085
|
let region = options.region;
|
|
34423
34086
|
if (!region) {
|
|
34424
34087
|
const defaultRegion = await getAWSRegion();
|
|
@@ -34427,34 +34090,34 @@ async function smsUpgrade(options) {
|
|
|
34427
34090
|
const metadata = await loadConnectionMetadata(identity.accountId, region);
|
|
34428
34091
|
if (!metadata) {
|
|
34429
34092
|
clack45.log.error(
|
|
34430
|
-
`No Wraps connection found for account ${
|
|
34093
|
+
`No Wraps connection found for account ${pc48.cyan(identity.accountId)} in region ${pc48.cyan(region)}`
|
|
34431
34094
|
);
|
|
34432
34095
|
clack45.log.info(
|
|
34433
|
-
`Use ${
|
|
34096
|
+
`Use ${pc48.cyan("wraps sms init")} to create new infrastructure.`
|
|
34434
34097
|
);
|
|
34435
34098
|
process.exit(1);
|
|
34436
34099
|
}
|
|
34437
34100
|
if (!metadata.services.sms) {
|
|
34438
34101
|
clack45.log.error("No SMS infrastructure found");
|
|
34439
34102
|
clack45.log.info(
|
|
34440
|
-
`Use ${
|
|
34103
|
+
`Use ${pc48.cyan("wraps sms init")} to deploy SMS infrastructure.`
|
|
34441
34104
|
);
|
|
34442
34105
|
process.exit(1);
|
|
34443
34106
|
}
|
|
34444
34107
|
progress.info(`Found existing connection created: ${metadata.timestamp}`);
|
|
34445
34108
|
console.log(`
|
|
34446
|
-
${
|
|
34109
|
+
${pc48.bold("Current Configuration:")}
|
|
34447
34110
|
`);
|
|
34448
34111
|
if (metadata.services.sms.preset) {
|
|
34449
|
-
console.log(` Preset: ${
|
|
34112
|
+
console.log(` Preset: ${pc48.cyan(metadata.services.sms.preset)}`);
|
|
34450
34113
|
} else {
|
|
34451
|
-
console.log(` Preset: ${
|
|
34114
|
+
console.log(` Preset: ${pc48.cyan("custom")}`);
|
|
34452
34115
|
}
|
|
34453
34116
|
const config2 = metadata.services.sms.config;
|
|
34454
34117
|
if (!config2) {
|
|
34455
34118
|
clack45.log.error("No SMS configuration found in metadata");
|
|
34456
34119
|
clack45.log.info(
|
|
34457
|
-
`Use ${
|
|
34120
|
+
`Use ${pc48.cyan("wraps sms init")} to create new infrastructure.`
|
|
34458
34121
|
);
|
|
34459
34122
|
process.exit(1);
|
|
34460
34123
|
}
|
|
@@ -34466,45 +34129,45 @@ ${pc49.bold("Current Configuration:")}
|
|
|
34466
34129
|
"short-code": "Short code ($995+/mo, 100+ MPS)"
|
|
34467
34130
|
};
|
|
34468
34131
|
console.log(
|
|
34469
|
-
` Phone Type: ${
|
|
34132
|
+
` Phone Type: ${pc48.cyan(phoneTypeLabels2[config2.phoneNumberType] || config2.phoneNumberType)}`
|
|
34470
34133
|
);
|
|
34471
34134
|
}
|
|
34472
34135
|
if (config2.tracking?.enabled) {
|
|
34473
|
-
console.log(` ${
|
|
34136
|
+
console.log(` ${pc48.green("\u2713")} Delivery Tracking`);
|
|
34474
34137
|
if (config2.tracking.linkTracking) {
|
|
34475
|
-
console.log(` ${
|
|
34138
|
+
console.log(` ${pc48.dim("\u2514\u2500")} Link click tracking enabled`);
|
|
34476
34139
|
}
|
|
34477
34140
|
}
|
|
34478
34141
|
if (config2.eventTracking?.enabled) {
|
|
34479
|
-
console.log(` ${
|
|
34142
|
+
console.log(` ${pc48.green("\u2713")} Event Tracking (SNS)`);
|
|
34480
34143
|
if (config2.eventTracking.dynamoDBHistory) {
|
|
34481
34144
|
console.log(
|
|
34482
|
-
` ${
|
|
34145
|
+
` ${pc48.dim("\u2514\u2500")} Message History: ${pc48.cyan(config2.eventTracking.archiveRetention || "90days")}`
|
|
34483
34146
|
);
|
|
34484
34147
|
}
|
|
34485
34148
|
}
|
|
34486
34149
|
if (config2.messageArchiving?.enabled) {
|
|
34487
34150
|
console.log(
|
|
34488
|
-
` ${
|
|
34151
|
+
` ${pc48.green("\u2713")} Message Archiving (${config2.messageArchiving.retention})`
|
|
34489
34152
|
);
|
|
34490
34153
|
}
|
|
34491
34154
|
if (config2.optOutManagement) {
|
|
34492
|
-
console.log(` ${
|
|
34155
|
+
console.log(` ${pc48.green("\u2713")} Opt-out Management`);
|
|
34493
34156
|
}
|
|
34494
34157
|
if (config2.protectConfiguration?.enabled) {
|
|
34495
34158
|
const countries = config2.protectConfiguration.allowedCountries?.join(", ") || "US";
|
|
34496
|
-
console.log(` ${
|
|
34497
|
-
console.log(` ${
|
|
34159
|
+
console.log(` ${pc48.green("\u2713")} Fraud Protection`);
|
|
34160
|
+
console.log(` ${pc48.dim("\u2514\u2500")} Allowed countries: ${pc48.cyan(countries)}`);
|
|
34498
34161
|
if (config2.protectConfiguration.aitFiltering) {
|
|
34499
|
-
console.log(` ${
|
|
34162
|
+
console.log(` ${pc48.dim("\u2514\u2500")} AIT filtering: ${pc48.cyan("enabled")}`);
|
|
34500
34163
|
}
|
|
34501
34164
|
} else {
|
|
34502
|
-
console.log(` ${
|
|
34165
|
+
console.log(` ${pc48.dim("\u25CB")} Fraud Protection (not configured)`);
|
|
34503
34166
|
}
|
|
34504
34167
|
const currentCostData = calculateSMSCosts(config2, 1e4);
|
|
34505
34168
|
console.log(
|
|
34506
34169
|
`
|
|
34507
|
-
Estimated Cost: ${
|
|
34170
|
+
Estimated Cost: ${pc48.cyan(`~${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
34508
34171
|
);
|
|
34509
34172
|
console.log("");
|
|
34510
34173
|
const phoneTypeLabels = {
|
|
@@ -34611,22 +34274,22 @@ ${pc49.bold("Current Configuration:")}
|
|
|
34611
34274
|
if (selectedType === "toll-free") {
|
|
34612
34275
|
console.log(
|
|
34613
34276
|
`
|
|
34614
|
-
${
|
|
34277
|
+
${pc48.yellow("\u26A0")} ${pc48.bold("Toll-free Registration Required")}
|
|
34615
34278
|
`
|
|
34616
34279
|
);
|
|
34617
34280
|
console.log(
|
|
34618
|
-
|
|
34281
|
+
pc48.dim("Toll-free numbers require carrier registration before")
|
|
34619
34282
|
);
|
|
34620
34283
|
console.log(
|
|
34621
|
-
|
|
34284
|
+
pc48.dim("they can send messages at scale. After deployment:\n")
|
|
34622
34285
|
);
|
|
34623
34286
|
console.log(
|
|
34624
|
-
` 1. Run ${
|
|
34287
|
+
` 1. Run ${pc48.cyan("wraps sms register")} to start registration`
|
|
34625
34288
|
);
|
|
34626
34289
|
console.log(" 2. Submit your business use case information");
|
|
34627
34290
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
34628
34291
|
console.log(
|
|
34629
|
-
|
|
34292
|
+
pc48.dim("\nUntil verified, sending is limited to low volume.\n")
|
|
34630
34293
|
);
|
|
34631
34294
|
const confirmTollFree = await clack45.confirm({
|
|
34632
34295
|
message: "Continue with toll-free number request?",
|
|
@@ -34640,10 +34303,10 @@ ${pc49.yellow("\u26A0")} ${pc49.bold("Toll-free Registration Required")}
|
|
|
34640
34303
|
if (selectedType === "10dlc") {
|
|
34641
34304
|
console.log(
|
|
34642
34305
|
`
|
|
34643
|
-
${
|
|
34306
|
+
${pc48.yellow("\u26A0")} ${pc48.bold("10DLC Campaign Registration Required")}
|
|
34644
34307
|
`
|
|
34645
34308
|
);
|
|
34646
|
-
console.log(
|
|
34309
|
+
console.log(pc48.dim("10DLC requires brand and campaign registration:"));
|
|
34647
34310
|
console.log(" \u2022 Brand registration: one-time $4 fee");
|
|
34648
34311
|
console.log(" \u2022 Campaign registration: $15/mo per campaign");
|
|
34649
34312
|
console.log(" \u2022 Verification takes 1-7 business days");
|
|
@@ -34876,12 +34539,12 @@ ${pc49.yellow("\u26A0")} ${pc49.bold("10DLC Campaign Registration Required")}
|
|
|
34876
34539
|
const enableLinkTracking = !config2.tracking?.linkTracking;
|
|
34877
34540
|
if (enableLinkTracking) {
|
|
34878
34541
|
clack45.log.info(
|
|
34879
|
-
|
|
34542
|
+
pc48.dim(
|
|
34880
34543
|
"Link tracking will track clicks on URLs in your SMS messages."
|
|
34881
34544
|
)
|
|
34882
34545
|
);
|
|
34883
34546
|
clack45.log.info(
|
|
34884
|
-
|
|
34547
|
+
pc48.dim("URLs will be rewritten to go through a tracking endpoint.")
|
|
34885
34548
|
);
|
|
34886
34549
|
}
|
|
34887
34550
|
const confirmed = await clack45.confirm({
|
|
@@ -35094,18 +34757,18 @@ ${pc49.yellow("\u26A0")} ${pc49.bold("10DLC Campaign Registration Required")}
|
|
|
35094
34757
|
const newCostData = calculateSMSCosts(updatedConfig, 1e4);
|
|
35095
34758
|
const costDiff = newCostData.total.monthly - currentCostData.total.monthly;
|
|
35096
34759
|
console.log(`
|
|
35097
|
-
${
|
|
34760
|
+
${pc48.bold("Cost Impact:")}`);
|
|
35098
34761
|
console.log(
|
|
35099
|
-
` Current: ${
|
|
34762
|
+
` Current: ${pc48.cyan(`${formatCost3(currentCostData.total.monthly)}/mo`)}`
|
|
35100
34763
|
);
|
|
35101
34764
|
console.log(
|
|
35102
|
-
` New: ${
|
|
34765
|
+
` New: ${pc48.cyan(`${formatCost3(newCostData.total.monthly)}/mo`)}`
|
|
35103
34766
|
);
|
|
35104
34767
|
if (costDiff > 0) {
|
|
35105
|
-
console.log(` Change: ${
|
|
34768
|
+
console.log(` Change: ${pc48.yellow(`+${formatCost3(costDiff)}/mo`)}`);
|
|
35106
34769
|
} else if (costDiff < 0) {
|
|
35107
34770
|
console.log(
|
|
35108
|
-
` Change: ${
|
|
34771
|
+
` Change: ${pc48.green(`-${formatCost3(Math.abs(costDiff))}/mo`)}`
|
|
35109
34772
|
);
|
|
35110
34773
|
}
|
|
35111
34774
|
console.log("");
|
|
@@ -35257,43 +34920,43 @@ ${pc49.bold("Cost Impact:")}`);
|
|
|
35257
34920
|
}
|
|
35258
34921
|
progress.info("Connection metadata updated");
|
|
35259
34922
|
console.log("\n");
|
|
35260
|
-
clack45.log.success(
|
|
34923
|
+
clack45.log.success(pc48.green(pc48.bold("SMS infrastructure upgraded!")));
|
|
35261
34924
|
console.log("\n");
|
|
35262
34925
|
clack45.note(
|
|
35263
34926
|
[
|
|
35264
|
-
`${
|
|
35265
|
-
`${
|
|
35266
|
-
`${
|
|
35267
|
-
`${
|
|
35268
|
-
outputs.tableName ? `${
|
|
34927
|
+
`${pc48.bold("Phone Number:")} ${pc48.cyan(outputs.phoneNumber || "Provisioning...")}`,
|
|
34928
|
+
`${pc48.bold("Phone Type:")} ${pc48.cyan(updatedConfig.phoneNumberType || "simulator")}`,
|
|
34929
|
+
`${pc48.bold("Config Set:")} ${pc48.cyan(outputs.configSetName || "wraps-sms-config")}`,
|
|
34930
|
+
`${pc48.bold("Region:")} ${pc48.cyan(outputs.region)}`,
|
|
34931
|
+
outputs.tableName ? `${pc48.bold("History Table:")} ${pc48.cyan(outputs.tableName)}` : "",
|
|
35269
34932
|
"",
|
|
35270
|
-
|
|
35271
|
-
|
|
34933
|
+
pc48.dim("IAM Role:"),
|
|
34934
|
+
pc48.dim(` ${outputs.roleArn}`)
|
|
35272
34935
|
].filter(Boolean).join("\n"),
|
|
35273
34936
|
"SMS Infrastructure"
|
|
35274
34937
|
);
|
|
35275
34938
|
console.log(`
|
|
35276
|
-
${
|
|
34939
|
+
${pc48.green("\u2713")} ${pc48.bold("Upgrade complete!")}
|
|
35277
34940
|
`);
|
|
35278
34941
|
if (upgradeAction === "phone-number") {
|
|
35279
34942
|
console.log(
|
|
35280
|
-
`Upgraded to ${
|
|
34943
|
+
`Upgraded to ${pc48.cyan(updatedConfig.phoneNumberType)} number (${pc48.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
35281
34944
|
`
|
|
35282
34945
|
);
|
|
35283
34946
|
if (updatedConfig.phoneNumberType === "toll-free") {
|
|
35284
|
-
console.log(`${
|
|
34947
|
+
console.log(`${pc48.bold("Next Steps:")}`);
|
|
35285
34948
|
console.log(
|
|
35286
|
-
` 1. Run ${
|
|
34949
|
+
` 1. Run ${pc48.cyan("wraps sms register")} to start toll-free registration`
|
|
35287
34950
|
);
|
|
35288
34951
|
console.log(" 2. Submit your business information and use case");
|
|
35289
34952
|
console.log(" 3. Wait for carrier verification (1-5 business days)");
|
|
35290
34953
|
console.log("");
|
|
35291
34954
|
console.log(
|
|
35292
|
-
|
|
34955
|
+
pc48.dim("Until verified, your number can only send limited messages.")
|
|
35293
34956
|
);
|
|
35294
34957
|
console.log("");
|
|
35295
34958
|
} else if (updatedConfig.phoneNumberType === "10dlc") {
|
|
35296
|
-
console.log(`${
|
|
34959
|
+
console.log(`${pc48.bold("Next Steps:")}`);
|
|
35297
34960
|
console.log(" 1. Register your brand in the AWS Console");
|
|
35298
34961
|
console.log(" 2. Create a 10DLC campaign for your use case");
|
|
35299
34962
|
console.log(" 3. Wait for campaign approval (1-7 business days)");
|
|
@@ -35301,16 +34964,16 @@ ${pc49.green("\u2713")} ${pc49.bold("Upgrade complete!")}
|
|
|
35301
34964
|
}
|
|
35302
34965
|
} else if (upgradeAction === "preset" && newPreset) {
|
|
35303
34966
|
console.log(
|
|
35304
|
-
`Upgraded to ${
|
|
34967
|
+
`Upgraded to ${pc48.cyan(newPreset)} preset (${pc48.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
35305
34968
|
`
|
|
35306
34969
|
);
|
|
35307
34970
|
} else {
|
|
35308
34971
|
console.log(
|
|
35309
|
-
`Updated configuration (${
|
|
34972
|
+
`Updated configuration (${pc48.green(`${formatCost3(newCostData.total.monthly)}/mo`)})
|
|
35310
34973
|
`
|
|
35311
34974
|
);
|
|
35312
34975
|
}
|
|
35313
|
-
console.log(
|
|
34976
|
+
console.log(pc48.dim(getSMSCostSummary(updatedConfig, 1e4)));
|
|
35314
34977
|
const enabledFeatures = [];
|
|
35315
34978
|
if (updatedConfig.tracking?.enabled) {
|
|
35316
34979
|
enabledFeatures.push("tracking");
|
|
@@ -35334,7 +34997,7 @@ ${pc49.green("\u2713")} ${pc49.bold("Upgrade complete!")}
|
|
|
35334
34997
|
action: typeof upgradeAction === "string" ? upgradeAction : void 0,
|
|
35335
34998
|
duration_ms: Date.now() - startTime
|
|
35336
34999
|
});
|
|
35337
|
-
clack45.outro(
|
|
35000
|
+
clack45.outro(pc48.green("Upgrade complete!"));
|
|
35338
35001
|
}
|
|
35339
35002
|
|
|
35340
35003
|
// src/commands/sms/verify-number.ts
|
|
@@ -35354,12 +35017,12 @@ import {
|
|
|
35354
35017
|
VerifyDestinationNumberCommand
|
|
35355
35018
|
} from "@aws-sdk/client-pinpoint-sms-voice-v2";
|
|
35356
35019
|
import * as clack46 from "@clack/prompts";
|
|
35357
|
-
import
|
|
35020
|
+
import pc49 from "picocolors";
|
|
35358
35021
|
async function smsVerifyNumber(options) {
|
|
35359
35022
|
const startTime = Date.now();
|
|
35360
35023
|
const progress = new DeploymentProgress();
|
|
35361
35024
|
if (!isJsonMode()) {
|
|
35362
|
-
clack46.intro(
|
|
35025
|
+
clack46.intro(pc49.bold("Wraps SMS - Verify Destination Number"));
|
|
35363
35026
|
}
|
|
35364
35027
|
const identity = await progress.execute(
|
|
35365
35028
|
"Validating AWS credentials",
|
|
@@ -35372,7 +35035,7 @@ async function smsVerifyNumber(options) {
|
|
|
35372
35035
|
clack46.log.error("No SMS infrastructure found");
|
|
35373
35036
|
console.log(
|
|
35374
35037
|
`
|
|
35375
|
-
Run ${
|
|
35038
|
+
Run ${pc49.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
35376
35039
|
`
|
|
35377
35040
|
);
|
|
35378
35041
|
process.exit(1);
|
|
@@ -35389,16 +35052,16 @@ Run ${pc50.cyan("wraps sms init")} to deploy SMS infrastructure.
|
|
|
35389
35052
|
clack46.log.info("No verified destination numbers found");
|
|
35390
35053
|
console.log(
|
|
35391
35054
|
`
|
|
35392
|
-
Run ${
|
|
35055
|
+
Run ${pc49.cyan("wraps sms verify-number")} to verify a number.
|
|
35393
35056
|
`
|
|
35394
35057
|
);
|
|
35395
35058
|
} else {
|
|
35396
35059
|
console.log("\n");
|
|
35397
|
-
clack46.log.info(
|
|
35060
|
+
clack46.log.info(pc49.bold("Verified Destination Numbers:"));
|
|
35398
35061
|
console.log("");
|
|
35399
35062
|
for (const num of response.VerifiedDestinationNumbers) {
|
|
35400
|
-
const status2 = num.Status === "VERIFIED" ?
|
|
35401
|
-
console.log(` ${
|
|
35063
|
+
const status2 = num.Status === "VERIFIED" ? pc49.green("\u2713 Verified") : pc49.yellow("\u29D6 Pending");
|
|
35064
|
+
console.log(` ${pc49.cyan(num.DestinationPhoneNumber)} - ${status2}`);
|
|
35402
35065
|
}
|
|
35403
35066
|
console.log("");
|
|
35404
35067
|
}
|
|
@@ -35416,7 +35079,7 @@ Run ${pc50.cyan("wraps sms verify-number")} to verify a number.
|
|
|
35416
35079
|
});
|
|
35417
35080
|
return;
|
|
35418
35081
|
}
|
|
35419
|
-
clack46.outro(
|
|
35082
|
+
clack46.outro(pc49.green("Done!"));
|
|
35420
35083
|
return;
|
|
35421
35084
|
} catch (error) {
|
|
35422
35085
|
progress.stop();
|
|
@@ -35435,7 +35098,7 @@ Run ${pc50.cyan("wraps sms verify-number")} to verify a number.
|
|
|
35435
35098
|
clack46.log.error("Phone number is required for deletion");
|
|
35436
35099
|
console.log(
|
|
35437
35100
|
`
|
|
35438
|
-
Usage: ${
|
|
35101
|
+
Usage: ${pc49.cyan("wraps sms verify-number --delete --phone-number +14155551234")}
|
|
35439
35102
|
`
|
|
35440
35103
|
);
|
|
35441
35104
|
process.exit(1);
|
|
@@ -35460,7 +35123,7 @@ Usage: ${pc50.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
35460
35123
|
);
|
|
35461
35124
|
});
|
|
35462
35125
|
progress.stop();
|
|
35463
|
-
clack46.log.success(`Removed ${
|
|
35126
|
+
clack46.log.success(`Removed ${pc49.cyan(phoneNumber2)} from verified list`);
|
|
35464
35127
|
trackCommand("sms:verify-number:delete", {
|
|
35465
35128
|
success: true,
|
|
35466
35129
|
duration_ms: Date.now() - startTime
|
|
@@ -35472,7 +35135,7 @@ Usage: ${pc50.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
35472
35135
|
});
|
|
35473
35136
|
return;
|
|
35474
35137
|
}
|
|
35475
|
-
clack46.outro(
|
|
35138
|
+
clack46.outro(pc49.green("Done!"));
|
|
35476
35139
|
return;
|
|
35477
35140
|
} catch (error) {
|
|
35478
35141
|
progress.stop();
|
|
@@ -35544,11 +35207,11 @@ Usage: ${pc50.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
35544
35207
|
progress.stop();
|
|
35545
35208
|
console.log("\n");
|
|
35546
35209
|
clack46.log.success(
|
|
35547
|
-
|
|
35210
|
+
pc49.green(`Phone number ${pc49.cyan(phoneNumber)} verified!`)
|
|
35548
35211
|
);
|
|
35549
35212
|
console.log("");
|
|
35550
35213
|
console.log(
|
|
35551
|
-
`You can now send test messages to this number with ${
|
|
35214
|
+
`You can now send test messages to this number with ${pc49.cyan("wraps sms test")}`
|
|
35552
35215
|
);
|
|
35553
35216
|
trackCommand("sms:verify-number:confirm", {
|
|
35554
35217
|
success: true,
|
|
@@ -35561,7 +35224,7 @@ Usage: ${pc50.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
35561
35224
|
});
|
|
35562
35225
|
return;
|
|
35563
35226
|
}
|
|
35564
|
-
clack46.outro(
|
|
35227
|
+
clack46.outro(pc49.green("Verification complete!"));
|
|
35565
35228
|
return;
|
|
35566
35229
|
} catch (error) {
|
|
35567
35230
|
progress.stop();
|
|
@@ -35570,7 +35233,7 @@ Usage: ${pc50.cyan("wraps sms verify-number --delete --phone-number +14155551234
|
|
|
35570
35233
|
clack46.log.error("Invalid verification code. Please try again.");
|
|
35571
35234
|
console.log(
|
|
35572
35235
|
`
|
|
35573
|
-
Run ${
|
|
35236
|
+
Run ${pc49.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
35574
35237
|
`
|
|
35575
35238
|
);
|
|
35576
35239
|
} else {
|
|
@@ -35606,11 +35269,11 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35606
35269
|
);
|
|
35607
35270
|
});
|
|
35608
35271
|
progress.stop();
|
|
35609
|
-
clack46.log.success(`Verification code resent to ${
|
|
35272
|
+
clack46.log.success(`Verification code resent to ${pc49.cyan(phoneNumber)}`);
|
|
35610
35273
|
console.log("");
|
|
35611
35274
|
console.log(
|
|
35612
35275
|
`Once you receive the code, run:
|
|
35613
|
-
${
|
|
35276
|
+
${pc49.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
35614
35277
|
);
|
|
35615
35278
|
trackCommand("sms:verify-number:resend", {
|
|
35616
35279
|
success: true,
|
|
@@ -35623,7 +35286,7 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35623
35286
|
});
|
|
35624
35287
|
return;
|
|
35625
35288
|
}
|
|
35626
|
-
clack46.outro(
|
|
35289
|
+
clack46.outro(pc49.green("Code sent!"));
|
|
35627
35290
|
return;
|
|
35628
35291
|
} catch (error) {
|
|
35629
35292
|
progress.stop();
|
|
@@ -35652,9 +35315,9 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35652
35315
|
return;
|
|
35653
35316
|
}
|
|
35654
35317
|
clack46.log.info(
|
|
35655
|
-
`Number ${
|
|
35318
|
+
`Number ${pc49.cyan(phoneNumber)} is already verified and ready to use!`
|
|
35656
35319
|
);
|
|
35657
|
-
clack46.outro(
|
|
35320
|
+
clack46.outro(pc49.green("Done!"));
|
|
35658
35321
|
return;
|
|
35659
35322
|
}
|
|
35660
35323
|
if (existingNumber?.Status === "PENDING") {
|
|
@@ -35679,14 +35342,14 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35679
35342
|
return;
|
|
35680
35343
|
}
|
|
35681
35344
|
clack46.log.info(
|
|
35682
|
-
`Verification already in progress. New code sent to ${
|
|
35345
|
+
`Verification already in progress. New code sent to ${pc49.cyan(phoneNumber)}`
|
|
35683
35346
|
);
|
|
35684
35347
|
console.log("");
|
|
35685
35348
|
console.log(
|
|
35686
35349
|
`Once you receive the code, run:
|
|
35687
|
-
${
|
|
35350
|
+
${pc49.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`
|
|
35688
35351
|
);
|
|
35689
|
-
clack46.outro(
|
|
35352
|
+
clack46.outro(pc49.green("Code sent!"));
|
|
35690
35353
|
return;
|
|
35691
35354
|
}
|
|
35692
35355
|
const createResponse = await progress.execute(
|
|
@@ -35708,7 +35371,7 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35708
35371
|
progress.stop();
|
|
35709
35372
|
console.log("\n");
|
|
35710
35373
|
clack46.log.success(
|
|
35711
|
-
`Verification code sent to ${
|
|
35374
|
+
`Verification code sent to ${pc49.cyan(phoneNumber)} via SMS`
|
|
35712
35375
|
);
|
|
35713
35376
|
console.log("");
|
|
35714
35377
|
clack46.note(
|
|
@@ -35716,9 +35379,9 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35716
35379
|
"1. Check your phone for the verification code",
|
|
35717
35380
|
"",
|
|
35718
35381
|
"2. Complete verification with:",
|
|
35719
|
-
` ${
|
|
35382
|
+
` ${pc49.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --code YOUR_CODE`)}`,
|
|
35720
35383
|
"",
|
|
35721
|
-
|
|
35384
|
+
pc49.dim("The code expires in 24 hours")
|
|
35722
35385
|
].join("\n"),
|
|
35723
35386
|
"Next Steps"
|
|
35724
35387
|
);
|
|
@@ -35734,7 +35397,7 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35734
35397
|
});
|
|
35735
35398
|
return;
|
|
35736
35399
|
}
|
|
35737
|
-
clack46.outro(
|
|
35400
|
+
clack46.outro(pc49.green("Verification started!"));
|
|
35738
35401
|
} catch (error) {
|
|
35739
35402
|
progress.stop();
|
|
35740
35403
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -35742,7 +35405,7 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35742
35405
|
clack46.log.error("This number is already being verified");
|
|
35743
35406
|
console.log(
|
|
35744
35407
|
`
|
|
35745
|
-
Run ${
|
|
35408
|
+
Run ${pc49.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`)} to get a new code.
|
|
35746
35409
|
`
|
|
35747
35410
|
);
|
|
35748
35411
|
} else {
|
|
@@ -35759,18 +35422,18 @@ Run ${pc50.cyan(`wraps sms verify-number --phone-number ${phoneNumber} --resend`
|
|
|
35759
35422
|
init_esm_shims();
|
|
35760
35423
|
init_events();
|
|
35761
35424
|
import * as clack47 from "@clack/prompts";
|
|
35762
|
-
import
|
|
35425
|
+
import pc50 from "picocolors";
|
|
35763
35426
|
async function support() {
|
|
35764
35427
|
trackCommand("support", { success: true });
|
|
35765
|
-
clack47.intro(
|
|
35428
|
+
clack47.intro(pc50.bold("Get Help with Wraps"));
|
|
35766
35429
|
console.log();
|
|
35767
|
-
console.log(` ${
|
|
35430
|
+
console.log(` ${pc50.bold("Email:")} ${pc50.cyan("hey@wraps.sh")}`);
|
|
35768
35431
|
console.log(
|
|
35769
|
-
` ${
|
|
35432
|
+
` ${pc50.bold("GitHub:")} ${pc50.cyan("https://github.com/wraps-dev/wraps/issues")}`
|
|
35770
35433
|
);
|
|
35771
|
-
console.log(` ${
|
|
35434
|
+
console.log(` ${pc50.bold("Docs:")} ${pc50.cyan("https://wraps.dev/docs")}`);
|
|
35772
35435
|
console.log();
|
|
35773
|
-
console.log(
|
|
35436
|
+
console.log(pc50.dim(" Response time: Usually within 24 hours"));
|
|
35774
35437
|
console.log();
|
|
35775
35438
|
}
|
|
35776
35439
|
|
|
@@ -35778,7 +35441,7 @@ async function support() {
|
|
|
35778
35441
|
init_esm_shims();
|
|
35779
35442
|
init_client();
|
|
35780
35443
|
import * as clack48 from "@clack/prompts";
|
|
35781
|
-
import
|
|
35444
|
+
import pc51 from "picocolors";
|
|
35782
35445
|
async function telemetryEnable() {
|
|
35783
35446
|
const client = getTelemetryClient();
|
|
35784
35447
|
const override = client.enable();
|
|
@@ -35786,70 +35449,70 @@ async function telemetryEnable() {
|
|
|
35786
35449
|
clack48.log.warn(
|
|
35787
35450
|
"Telemetry enabled in config, but overridden by environment"
|
|
35788
35451
|
);
|
|
35789
|
-
console.log(` Reason: ${
|
|
35790
|
-
console.log(` Config: ${
|
|
35452
|
+
console.log(` Reason: ${pc51.yellow(override)}`);
|
|
35453
|
+
console.log(` Config: ${pc51.dim(client.getConfigPath())}`);
|
|
35791
35454
|
console.log();
|
|
35792
35455
|
} else {
|
|
35793
|
-
clack48.log.success(
|
|
35794
|
-
console.log(` Config: ${
|
|
35456
|
+
clack48.log.success(pc51.green("Telemetry enabled"));
|
|
35457
|
+
console.log(` Config: ${pc51.dim(client.getConfigPath())}`);
|
|
35795
35458
|
console.log(`
|
|
35796
|
-
${
|
|
35459
|
+
${pc51.dim("Thank you for helping improve Wraps!")}
|
|
35797
35460
|
`);
|
|
35798
35461
|
}
|
|
35799
35462
|
}
|
|
35800
35463
|
async function telemetryDisable() {
|
|
35801
35464
|
const client = getTelemetryClient();
|
|
35802
35465
|
client.disable();
|
|
35803
|
-
clack48.log.success(
|
|
35804
|
-
console.log(` Config: ${
|
|
35466
|
+
clack48.log.success(pc51.green("Telemetry disabled"));
|
|
35467
|
+
console.log(` Config: ${pc51.dim(client.getConfigPath())}`);
|
|
35805
35468
|
console.log(
|
|
35806
35469
|
`
|
|
35807
|
-
${
|
|
35470
|
+
${pc51.dim("You can re-enable with:")} wraps telemetry enable
|
|
35808
35471
|
`
|
|
35809
35472
|
);
|
|
35810
35473
|
}
|
|
35811
35474
|
async function telemetryStatus() {
|
|
35812
35475
|
const client = getTelemetryClient();
|
|
35813
|
-
clack48.intro(
|
|
35476
|
+
clack48.intro(pc51.bold("Telemetry Status"));
|
|
35814
35477
|
const override = client.getEnvOverride();
|
|
35815
|
-
const status2 = client.isEnabled() ?
|
|
35478
|
+
const status2 = client.isEnabled() ? pc51.green("Enabled") : pc51.red("Disabled");
|
|
35816
35479
|
console.log();
|
|
35817
|
-
console.log(` ${
|
|
35480
|
+
console.log(` ${pc51.bold("Status:")} ${status2}`);
|
|
35818
35481
|
if (!client.isEnabled() && override) {
|
|
35819
|
-
console.log(` ${
|
|
35482
|
+
console.log(` ${pc51.bold("Reason:")} ${pc51.yellow(override)}`);
|
|
35820
35483
|
}
|
|
35821
|
-
console.log(` ${
|
|
35484
|
+
console.log(` ${pc51.bold("Config file:")} ${pc51.dim(client.getConfigPath())}`);
|
|
35822
35485
|
if (client.isEnabled()) {
|
|
35823
35486
|
console.log();
|
|
35824
|
-
console.log(
|
|
35825
|
-
console.log(` ${
|
|
35487
|
+
console.log(pc51.bold(" How to opt-out:"));
|
|
35488
|
+
console.log(` ${pc51.cyan("wraps telemetry disable")}`);
|
|
35826
35489
|
console.log(
|
|
35827
|
-
` ${
|
|
35490
|
+
` ${pc51.dim("Or set:")} ${pc51.cyan("WRAPS_TELEMETRY_DISABLED=1")}`
|
|
35828
35491
|
);
|
|
35829
|
-
console.log(` ${
|
|
35492
|
+
console.log(` ${pc51.dim("Or set:")} ${pc51.cyan("DO_NOT_TRACK=1")}`);
|
|
35830
35493
|
} else {
|
|
35831
35494
|
console.log();
|
|
35832
|
-
console.log(
|
|
35833
|
-
console.log(` ${
|
|
35495
|
+
console.log(pc51.bold(" How to opt-in:"));
|
|
35496
|
+
console.log(` ${pc51.cyan("wraps telemetry enable")}`);
|
|
35834
35497
|
}
|
|
35835
35498
|
console.log();
|
|
35836
|
-
console.log(
|
|
35499
|
+
console.log(pc51.bold(" Debug mode:"));
|
|
35837
35500
|
console.log(
|
|
35838
|
-
` ${
|
|
35501
|
+
` ${pc51.dim("See what would be sent:")} ${pc51.cyan("WRAPS_TELEMETRY_DEBUG=1 wraps <command>")}`
|
|
35839
35502
|
);
|
|
35840
35503
|
console.log();
|
|
35841
35504
|
console.log(
|
|
35842
|
-
` ${
|
|
35505
|
+
` ${pc51.dim("Learn more:")} ${pc51.cyan("https://wraps.dev/docs/telemetry")}`
|
|
35843
35506
|
);
|
|
35844
35507
|
console.log();
|
|
35845
35508
|
}
|
|
35846
35509
|
|
|
35847
35510
|
// src/commands/workflow/init.ts
|
|
35848
35511
|
init_esm_shims();
|
|
35849
|
-
import { existsSync as
|
|
35850
|
-
import { join as
|
|
35512
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
35513
|
+
import { join as join18 } from "path";
|
|
35851
35514
|
import * as clack49 from "@clack/prompts";
|
|
35852
|
-
import
|
|
35515
|
+
import pc52 from "picocolors";
|
|
35853
35516
|
var EXAMPLE_CASCADE_WORKFLOW = `import {
|
|
35854
35517
|
defineWorkflow,
|
|
35855
35518
|
sendEmail,
|
|
@@ -35944,15 +35607,15 @@ export default defineConfig({
|
|
|
35944
35607
|
});
|
|
35945
35608
|
`;
|
|
35946
35609
|
async function workflowInit(options = {}) {
|
|
35947
|
-
clack49.intro(
|
|
35948
|
-
const wrapsDir =
|
|
35949
|
-
const workflowsDir =
|
|
35950
|
-
const configPath =
|
|
35951
|
-
if (
|
|
35610
|
+
clack49.intro(pc52.bgCyan(pc52.black(" wraps workflow init ")));
|
|
35611
|
+
const wrapsDir = join18(process.cwd(), "wraps");
|
|
35612
|
+
const workflowsDir = join18(wrapsDir, "workflows");
|
|
35613
|
+
const configPath = join18(wrapsDir, "wraps.config.ts");
|
|
35614
|
+
if (existsSync17(workflowsDir)) {
|
|
35952
35615
|
clack49.log.info(
|
|
35953
|
-
`Workflows directory already exists at ${
|
|
35616
|
+
`Workflows directory already exists at ${pc52.cyan("wraps/workflows/")}`
|
|
35954
35617
|
);
|
|
35955
|
-
const files =
|
|
35618
|
+
const files = existsSync17(join18(workflowsDir, "cart-recovery.ts")) || existsSync17(join18(workflowsDir, "welcome-sequence.ts"));
|
|
35956
35619
|
if (files && !options.yes) {
|
|
35957
35620
|
const shouldContinue = await clack49.confirm({
|
|
35958
35621
|
message: "Example files may already exist. Overwrite them?",
|
|
@@ -35960,7 +35623,7 @@ async function workflowInit(options = {}) {
|
|
|
35960
35623
|
});
|
|
35961
35624
|
if (clack49.isCancel(shouldContinue) || !shouldContinue) {
|
|
35962
35625
|
clack49.log.info("Skipping file creation.");
|
|
35963
|
-
|
|
35626
|
+
showNextSteps2();
|
|
35964
35627
|
clack49.outro("Done!");
|
|
35965
35628
|
return;
|
|
35966
35629
|
}
|
|
@@ -35969,50 +35632,50 @@ async function workflowInit(options = {}) {
|
|
|
35969
35632
|
try {
|
|
35970
35633
|
const s = clack49.spinner();
|
|
35971
35634
|
s.start("Creating workflows directory...");
|
|
35972
|
-
|
|
35635
|
+
mkdirSync2(workflowsDir, { recursive: true });
|
|
35973
35636
|
s.stop("Created wraps/workflows/");
|
|
35974
35637
|
s.start("Scaffolding example workflows...");
|
|
35975
|
-
|
|
35976
|
-
|
|
35638
|
+
writeFileSync(
|
|
35639
|
+
join18(workflowsDir, "cart-recovery.ts"),
|
|
35977
35640
|
EXAMPLE_CASCADE_WORKFLOW,
|
|
35978
35641
|
"utf-8"
|
|
35979
35642
|
);
|
|
35980
|
-
|
|
35981
|
-
|
|
35643
|
+
writeFileSync(
|
|
35644
|
+
join18(workflowsDir, "welcome-sequence.ts"),
|
|
35982
35645
|
EXAMPLE_WELCOME_WORKFLOW,
|
|
35983
35646
|
"utf-8"
|
|
35984
35647
|
);
|
|
35985
35648
|
s.stop("Created 2 example workflows");
|
|
35986
|
-
if (!
|
|
35987
|
-
|
|
35988
|
-
clack49.log.info(`Created ${
|
|
35649
|
+
if (!existsSync17(configPath)) {
|
|
35650
|
+
writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
|
|
35651
|
+
clack49.log.info(`Created ${pc52.cyan("wraps/wraps.config.ts")}`);
|
|
35989
35652
|
}
|
|
35990
35653
|
clack49.log.success(
|
|
35991
|
-
`${
|
|
35992
|
-
${
|
|
35993
|
-
${
|
|
35994
|
-
${
|
|
35654
|
+
`${pc52.bold("Workflows scaffolded!")} Created:
|
|
35655
|
+
${pc52.cyan("wraps/wraps.config.ts")} \u2014 Project config
|
|
35656
|
+
${pc52.cyan("wraps/workflows/cart-recovery.ts")} \u2014 Cross-channel cascade example
|
|
35657
|
+
${pc52.cyan("wraps/workflows/welcome-sequence.ts")} \u2014 Welcome series example`
|
|
35995
35658
|
);
|
|
35996
|
-
|
|
35997
|
-
clack49.outro(
|
|
35659
|
+
showNextSteps2();
|
|
35660
|
+
clack49.outro(pc52.green("Happy orchestrating!"));
|
|
35998
35661
|
} catch (error) {
|
|
35999
35662
|
clack49.log.error(
|
|
36000
35663
|
`Failed to scaffold workflows: ${error instanceof Error ? error.message : String(error)}`
|
|
36001
35664
|
);
|
|
36002
|
-
clack49.outro(
|
|
35665
|
+
clack49.outro(pc52.red("Scaffolding failed."));
|
|
36003
35666
|
process.exitCode = 1;
|
|
36004
35667
|
}
|
|
36005
35668
|
}
|
|
36006
|
-
function
|
|
35669
|
+
function showNextSteps2() {
|
|
36007
35670
|
clack49.log.info(
|
|
36008
|
-
`${
|
|
35671
|
+
`${pc52.bold("Next steps:")}
|
|
36009
35672
|
|
|
36010
|
-
1. Edit ${
|
|
36011
|
-
2. Edit your workflows in ${
|
|
36012
|
-
3. Validate: ${
|
|
36013
|
-
4. Push: ${
|
|
35673
|
+
1. Edit ${pc52.cyan("wraps/wraps.config.ts")} with your org slug and domain
|
|
35674
|
+
2. Edit your workflows in ${pc52.cyan("wraps/workflows/")}
|
|
35675
|
+
3. Validate: ${pc52.cyan("wraps email workflows validate")}
|
|
35676
|
+
4. Push: ${pc52.cyan("wraps email workflows push")}
|
|
36014
35677
|
|
|
36015
|
-
${
|
|
35678
|
+
${pc52.dim("Docs:")} ${pc52.underline("https://wraps.dev/docs/guides/orchestration")}`
|
|
36016
35679
|
);
|
|
36017
35680
|
}
|
|
36018
35681
|
|
|
@@ -36086,7 +35749,7 @@ if (nodeMajorVersion < 20) {
|
|
|
36086
35749
|
var __filename2 = fileURLToPath5(import.meta.url);
|
|
36087
35750
|
var __dirname3 = dirname3(__filename2);
|
|
36088
35751
|
var packageJson = JSON.parse(
|
|
36089
|
-
readFileSync3(
|
|
35752
|
+
readFileSync3(join19(__dirname3, "../package.json"), "utf-8")
|
|
36090
35753
|
);
|
|
36091
35754
|
var VERSION = packageJson.version;
|
|
36092
35755
|
setupTabCompletion();
|
|
@@ -36095,190 +35758,187 @@ function showVersion() {
|
|
|
36095
35758
|
process.exit(0);
|
|
36096
35759
|
}
|
|
36097
35760
|
function showHelp() {
|
|
36098
|
-
clack50.intro(
|
|
35761
|
+
clack50.intro(pc53.bold(`WRAPS CLI v${VERSION}`));
|
|
36099
35762
|
console.log("Deploy AWS infrastructure to your account\n");
|
|
36100
35763
|
console.log("Usage: wraps [service] <command> [options]\n");
|
|
36101
35764
|
console.log("Services:");
|
|
36102
|
-
console.log(` ${
|
|
35765
|
+
console.log(` ${pc53.cyan("email")} Email infrastructure (AWS SES)`);
|
|
36103
35766
|
console.log(
|
|
36104
|
-
` ${
|
|
35767
|
+
` ${pc53.cyan("sms")} SMS infrastructure (AWS End User Messaging)`
|
|
36105
35768
|
);
|
|
36106
35769
|
console.log(
|
|
36107
|
-
` ${
|
|
35770
|
+
` ${pc53.cyan("cdn")} CDN infrastructure (AWS S3 + CloudFront)
|
|
36108
35771
|
`
|
|
36109
35772
|
);
|
|
36110
35773
|
console.log("Email Commands:");
|
|
36111
35774
|
console.log(
|
|
36112
|
-
` ${
|
|
35775
|
+
` ${pc53.cyan("email init")} Deploy new email infrastructure`
|
|
36113
35776
|
);
|
|
36114
35777
|
console.log(
|
|
36115
|
-
` ${
|
|
35778
|
+
` ${pc53.cyan("email check")} Check email deliverability for a domain`
|
|
36116
35779
|
);
|
|
36117
35780
|
console.log(
|
|
36118
|
-
` ${
|
|
35781
|
+
` ${pc53.cyan("email connect")} Connect to existing AWS SES`
|
|
36119
35782
|
);
|
|
36120
35783
|
console.log(
|
|
36121
|
-
` ${
|
|
35784
|
+
` ${pc53.cyan("email status")} Show email infrastructure details`
|
|
36122
35785
|
);
|
|
36123
|
-
console.log(` ${
|
|
36124
|
-
console.log(` ${
|
|
35786
|
+
console.log(` ${pc53.cyan("email test")} Send a test email`);
|
|
35787
|
+
console.log(` ${pc53.cyan("email verify")} Verify domain DNS records`);
|
|
36125
35788
|
console.log(
|
|
36126
|
-
` ${
|
|
35789
|
+
` ${pc53.cyan("email sync")} Apply CLI updates to infrastructure`
|
|
36127
35790
|
);
|
|
36128
|
-
console.log(` ${
|
|
35791
|
+
console.log(` ${pc53.cyan("email upgrade")} Add features`);
|
|
36129
35792
|
console.log(
|
|
36130
|
-
` ${
|
|
35793
|
+
` ${pc53.cyan("email restore")} Restore original configuration`
|
|
36131
35794
|
);
|
|
36132
35795
|
console.log(
|
|
36133
|
-
` ${
|
|
35796
|
+
` ${pc53.cyan("email destroy")} Remove email infrastructure`
|
|
36134
35797
|
);
|
|
36135
|
-
console.log(` ${
|
|
36136
|
-
console.log(` ${
|
|
36137
|
-
console.log(` ${
|
|
35798
|
+
console.log(` ${pc53.cyan("email domains add")} Add a domain to SES`);
|
|
35799
|
+
console.log(` ${pc53.cyan("email domains list")} List all domains`);
|
|
35800
|
+
console.log(` ${pc53.cyan("email domains remove")} Remove a domain`);
|
|
36138
35801
|
console.log(
|
|
36139
|
-
` ${
|
|
35802
|
+
` ${pc53.cyan("email inbound init")} Enable inbound email receiving`
|
|
36140
35803
|
);
|
|
36141
|
-
console.log(` ${
|
|
35804
|
+
console.log(` ${pc53.cyan("email inbound status")} Show inbound email status`);
|
|
36142
35805
|
console.log(
|
|
36143
|
-
` ${
|
|
35806
|
+
` ${pc53.cyan("email inbound verify")} Verify inbound DNS records`
|
|
36144
35807
|
);
|
|
36145
35808
|
console.log(
|
|
36146
|
-
` ${
|
|
35809
|
+
` ${pc53.cyan("email inbound test")} Send test email and verify receipt`
|
|
36147
35810
|
);
|
|
36148
35811
|
console.log(
|
|
36149
|
-
` ${
|
|
35812
|
+
` ${pc53.cyan("email inbound destroy")} Remove inbound email infrastructure
|
|
36150
35813
|
`
|
|
36151
35814
|
);
|
|
36152
35815
|
console.log("Template Commands:");
|
|
36153
35816
|
console.log(
|
|
36154
|
-
` ${
|
|
35817
|
+
` ${pc53.cyan("email templates init")} Initialize templates-as-code`
|
|
36155
35818
|
);
|
|
36156
35819
|
console.log(
|
|
36157
|
-
` ${
|
|
35820
|
+
` ${pc53.cyan("email templates push")} Push templates to SES + dashboard`
|
|
36158
35821
|
);
|
|
36159
35822
|
console.log(
|
|
36160
|
-
` ${
|
|
35823
|
+
` ${pc53.cyan("email templates preview")} Preview templates in browser`
|
|
36161
35824
|
);
|
|
36162
35825
|
console.log(
|
|
36163
|
-
` ${
|
|
35826
|
+
` ${pc53.cyan("push")} ${pc53.dim("(alias for email templates push)")}
|
|
36164
35827
|
`
|
|
36165
35828
|
);
|
|
36166
35829
|
console.log("Workflow Commands:");
|
|
36167
35830
|
console.log(
|
|
36168
|
-
` ${
|
|
35831
|
+
` ${pc53.cyan("email workflows init")} Initialize workflows-as-code`
|
|
36169
35832
|
);
|
|
36170
35833
|
console.log(
|
|
36171
|
-
` ${
|
|
35834
|
+
` ${pc53.cyan("email workflows validate")} Validate workflow files`
|
|
36172
35835
|
);
|
|
36173
35836
|
console.log(
|
|
36174
|
-
` ${
|
|
36175
|
-
);
|
|
36176
|
-
console.log(
|
|
36177
|
-
` ${pc54.cyan("email workflows generate")} Generate workflow from template
|
|
35837
|
+
` ${pc53.cyan("email workflows push")} Push workflows to dashboard
|
|
36178
35838
|
`
|
|
36179
35839
|
);
|
|
36180
35840
|
console.log("SMS Commands:");
|
|
36181
|
-
console.log(` ${
|
|
35841
|
+
console.log(` ${pc53.cyan("sms init")} Deploy SMS infrastructure`);
|
|
36182
35842
|
console.log(
|
|
36183
|
-
` ${
|
|
35843
|
+
` ${pc53.cyan("sms status")} Show SMS infrastructure details`
|
|
36184
35844
|
);
|
|
36185
|
-
console.log(` ${
|
|
35845
|
+
console.log(` ${pc53.cyan("sms test")} Send a test SMS message`);
|
|
36186
35846
|
console.log(
|
|
36187
|
-
` ${
|
|
35847
|
+
` ${pc53.cyan("sms verify-number")} Verify a destination phone number`
|
|
36188
35848
|
);
|
|
36189
35849
|
console.log(
|
|
36190
|
-
` ${
|
|
35850
|
+
` ${pc53.cyan("sms sync")} Sync infrastructure (update Lambda, etc.)`
|
|
36191
35851
|
);
|
|
36192
|
-
console.log(` ${
|
|
36193
|
-
console.log(` ${
|
|
35852
|
+
console.log(` ${pc53.cyan("sms upgrade")} Upgrade SMS features`);
|
|
35853
|
+
console.log(` ${pc53.cyan("sms register")} Register toll-free number`);
|
|
36194
35854
|
console.log(
|
|
36195
|
-
` ${
|
|
35855
|
+
` ${pc53.cyan("sms destroy")} Remove SMS infrastructure
|
|
36196
35856
|
`
|
|
36197
35857
|
);
|
|
36198
35858
|
console.log("CDN Commands:");
|
|
36199
35859
|
console.log(
|
|
36200
|
-
` ${
|
|
35860
|
+
` ${pc53.cyan("cdn init")} Deploy CDN infrastructure (S3 + CloudFront)`
|
|
36201
35861
|
);
|
|
36202
35862
|
console.log(
|
|
36203
|
-
` ${
|
|
35863
|
+
` ${pc53.cyan("cdn status")} Show CDN infrastructure details`
|
|
36204
35864
|
);
|
|
36205
35865
|
console.log(
|
|
36206
|
-
` ${
|
|
35866
|
+
` ${pc53.cyan("cdn verify")} Check DNS and certificate status`
|
|
36207
35867
|
);
|
|
36208
35868
|
console.log(
|
|
36209
|
-
` ${
|
|
35869
|
+
` ${pc53.cyan("cdn upgrade")} Add custom domain after cert validation`
|
|
36210
35870
|
);
|
|
36211
35871
|
console.log(
|
|
36212
|
-
` ${
|
|
35872
|
+
` ${pc53.cyan("cdn sync")} Sync infrastructure with current config`
|
|
36213
35873
|
);
|
|
36214
35874
|
console.log(
|
|
36215
|
-
` ${
|
|
35875
|
+
` ${pc53.cyan("cdn destroy")} Remove CDN infrastructure
|
|
36216
35876
|
`
|
|
36217
35877
|
);
|
|
36218
35878
|
console.log("Local Development:");
|
|
36219
35879
|
console.log(
|
|
36220
|
-
` ${
|
|
35880
|
+
` ${pc53.cyan("console")} Start local web console
|
|
36221
35881
|
`
|
|
36222
35882
|
);
|
|
36223
35883
|
console.log("Platform:");
|
|
36224
35884
|
console.log(
|
|
36225
|
-
` ${
|
|
35885
|
+
` ${pc53.cyan("platform")} Show platform info and pricing`
|
|
36226
35886
|
);
|
|
36227
35887
|
console.log(
|
|
36228
|
-
` ${
|
|
35888
|
+
` ${pc53.cyan("platform connect")} Connect to Wraps Platform (events + IAM)`
|
|
36229
35889
|
);
|
|
36230
35890
|
console.log(
|
|
36231
|
-
` ${
|
|
35891
|
+
` ${pc53.cyan("platform update-role")} Update platform IAM permissions
|
|
36232
35892
|
`
|
|
36233
35893
|
);
|
|
36234
35894
|
console.log("Auth:");
|
|
36235
35895
|
console.log(
|
|
36236
|
-
` ${
|
|
35896
|
+
` ${pc53.cyan("auth login")} Sign in to wraps.dev (device flow)`
|
|
36237
35897
|
);
|
|
36238
|
-
console.log(` ${
|
|
35898
|
+
console.log(` ${pc53.cyan("auth status")} Show current auth state`);
|
|
36239
35899
|
console.log(
|
|
36240
|
-
` ${
|
|
35900
|
+
` ${pc53.cyan("auth logout")} Sign out and remove stored token
|
|
36241
35901
|
`
|
|
36242
35902
|
);
|
|
36243
35903
|
console.log("AWS Setup:");
|
|
36244
35904
|
console.log(
|
|
36245
|
-
` ${
|
|
35905
|
+
` ${pc53.cyan("aws setup")} Interactive AWS setup wizard`
|
|
36246
35906
|
);
|
|
36247
35907
|
console.log(
|
|
36248
|
-
` ${
|
|
35908
|
+
` ${pc53.cyan("aws doctor")} Diagnose AWS configuration issues
|
|
36249
35909
|
`
|
|
36250
35910
|
);
|
|
36251
35911
|
console.log("Global Commands:");
|
|
36252
|
-
console.log(` ${
|
|
36253
|
-
console.log(` ${
|
|
36254
|
-
console.log(` ${
|
|
36255
|
-
console.log(` ${
|
|
35912
|
+
console.log(` ${pc53.cyan("status")} Show overview of all services`);
|
|
35913
|
+
console.log(` ${pc53.cyan("destroy")} Remove deployed infrastructure`);
|
|
35914
|
+
console.log(` ${pc53.cyan("permissions")} Show required AWS IAM permissions`);
|
|
35915
|
+
console.log(` ${pc53.cyan("completion")} Generate shell completion script`);
|
|
36256
35916
|
console.log(
|
|
36257
|
-
` ${
|
|
35917
|
+
` ${pc53.cyan("telemetry")} Manage anonymous telemetry settings`
|
|
36258
35918
|
);
|
|
36259
|
-
console.log(` ${
|
|
35919
|
+
console.log(` ${pc53.cyan("news")} Show recent Wraps updates`);
|
|
36260
35920
|
console.log(
|
|
36261
|
-
` ${
|
|
35921
|
+
` ${pc53.cyan("support")} Get help and support contact info
|
|
36262
35922
|
`
|
|
36263
35923
|
);
|
|
36264
35924
|
console.log("Options:");
|
|
36265
35925
|
console.log(
|
|
36266
|
-
` ${
|
|
36267
|
-
);
|
|
36268
|
-
console.log(` ${
|
|
36269
|
-
console.log(` ${
|
|
36270
|
-
console.log(` ${
|
|
36271
|
-
console.log(` ${
|
|
36272
|
-
console.log(` ${
|
|
36273
|
-
console.log(` ${
|
|
36274
|
-
console.log(` ${
|
|
35926
|
+
` ${pc53.dim("-p, --provider")} Hosting provider (vercel, aws, railway, other)`
|
|
35927
|
+
);
|
|
35928
|
+
console.log(` ${pc53.dim("-r, --region")} AWS region`);
|
|
35929
|
+
console.log(` ${pc53.dim("-d, --domain")} Domain name`);
|
|
35930
|
+
console.log(` ${pc53.dim("--account")} AWS account ID or alias`);
|
|
35931
|
+
console.log(` ${pc53.dim("--preset")} Configuration preset`);
|
|
35932
|
+
console.log(` ${pc53.dim("--token")} API key or token for auth`);
|
|
35933
|
+
console.log(` ${pc53.dim("-y, --yes")} Skip confirmation prompts`);
|
|
35934
|
+
console.log(` ${pc53.dim("-f, --force")} Force destructive operations`);
|
|
36275
35935
|
console.log(
|
|
36276
|
-
` ${
|
|
35936
|
+
` ${pc53.dim("--preview")} Preview changes without deploying`
|
|
36277
35937
|
);
|
|
36278
|
-
console.log(` ${
|
|
35938
|
+
console.log(` ${pc53.dim("-v, --version")} Show version number
|
|
36279
35939
|
`);
|
|
36280
35940
|
console.log(
|
|
36281
|
-
`Run ${
|
|
35941
|
+
`Run ${pc53.cyan("wraps <service> <command> --help")} for more information.
|
|
36282
35942
|
`
|
|
36283
35943
|
);
|
|
36284
35944
|
}
|
|
@@ -36463,11 +36123,6 @@ args.options([
|
|
|
36463
36123
|
description: "Push workflow as draft without enabling it",
|
|
36464
36124
|
defaultValue: false
|
|
36465
36125
|
},
|
|
36466
|
-
{
|
|
36467
|
-
name: "name",
|
|
36468
|
-
description: "Output file slug for generated workflow",
|
|
36469
|
-
defaultValue: void 0
|
|
36470
|
-
},
|
|
36471
36126
|
{
|
|
36472
36127
|
name: "noExample",
|
|
36473
36128
|
description: "Skip creating example template",
|
|
@@ -36493,25 +36148,25 @@ if (!primaryCommand) {
|
|
|
36493
36148
|
const telemetry = getTelemetryClient();
|
|
36494
36149
|
if (telemetry.shouldShowNotification()) {
|
|
36495
36150
|
console.log();
|
|
36496
|
-
clack50.log.info(
|
|
36151
|
+
clack50.log.info(pc53.bold("Anonymous Telemetry"));
|
|
36497
36152
|
console.log(
|
|
36498
|
-
` Wraps collects ${
|
|
36153
|
+
` Wraps collects ${pc53.cyan("anonymous usage data")} to improve the CLI.`
|
|
36499
36154
|
);
|
|
36500
36155
|
console.log(
|
|
36501
|
-
` We ${
|
|
36156
|
+
` We ${pc53.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
36502
36157
|
);
|
|
36503
36158
|
console.log(
|
|
36504
|
-
` We ${
|
|
36159
|
+
` We ${pc53.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
36505
36160
|
);
|
|
36506
36161
|
console.log();
|
|
36507
|
-
console.log(` Opt-out anytime: ${
|
|
36508
|
-
console.log(` Or set: ${
|
|
36509
|
-
console.log(` Learn more: ${
|
|
36162
|
+
console.log(` Opt-out anytime: ${pc53.cyan("wraps telemetry disable")}`);
|
|
36163
|
+
console.log(` Or set: ${pc53.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
36164
|
+
console.log(` Learn more: ${pc53.cyan("https://wraps.dev/docs")}`);
|
|
36510
36165
|
console.log();
|
|
36511
36166
|
telemetry.markNotificationShown();
|
|
36512
36167
|
}
|
|
36513
36168
|
trackCommand("interactive:menu", { success: true, duration_ms: 0 });
|
|
36514
|
-
clack50.intro(
|
|
36169
|
+
clack50.intro(pc53.bold(`WRAPS CLI v${VERSION}`));
|
|
36515
36170
|
console.log(" Deploy AWS infrastructure to your account.\n");
|
|
36516
36171
|
const action = await clack50.select({
|
|
36517
36172
|
message: "What would you like to do?",
|
|
@@ -36648,20 +36303,20 @@ async function run() {
|
|
|
36648
36303
|
const telemetry = getTelemetryClient();
|
|
36649
36304
|
if (telemetry.shouldShowNotification()) {
|
|
36650
36305
|
console.log();
|
|
36651
|
-
clack50.log.info(
|
|
36306
|
+
clack50.log.info(pc53.bold("Anonymous Telemetry"));
|
|
36652
36307
|
console.log(
|
|
36653
|
-
` Wraps collects ${
|
|
36308
|
+
` Wraps collects ${pc53.cyan("anonymous usage data")} to improve the CLI.`
|
|
36654
36309
|
);
|
|
36655
36310
|
console.log(
|
|
36656
|
-
` We ${
|
|
36311
|
+
` We ${pc53.bold("never")} collect: domains, AWS credentials, email content, or PII.`
|
|
36657
36312
|
);
|
|
36658
36313
|
console.log(
|
|
36659
|
-
` We ${
|
|
36314
|
+
` We ${pc53.bold("only")} collect: command names, success/failure, CLI version, OS.`
|
|
36660
36315
|
);
|
|
36661
36316
|
console.log();
|
|
36662
|
-
console.log(` Opt-out anytime: ${
|
|
36663
|
-
console.log(` Or set: ${
|
|
36664
|
-
console.log(` Learn more: ${
|
|
36317
|
+
console.log(` Opt-out anytime: ${pc53.cyan("wraps telemetry disable")}`);
|
|
36318
|
+
console.log(` Or set: ${pc53.cyan("WRAPS_TELEMETRY_DISABLED=1")}`);
|
|
36319
|
+
console.log(` Learn more: ${pc53.cyan("https://wraps.dev/docs")}`);
|
|
36665
36320
|
console.log();
|
|
36666
36321
|
telemetry.markNotificationShown();
|
|
36667
36322
|
}
|
|
@@ -36746,7 +36401,7 @@ async function run() {
|
|
|
36746
36401
|
clack50.log.error("--domain flag is required");
|
|
36747
36402
|
console.log(
|
|
36748
36403
|
`
|
|
36749
|
-
Usage: ${
|
|
36404
|
+
Usage: ${pc53.cyan("wraps email verify --domain yourapp.com")}
|
|
36750
36405
|
`
|
|
36751
36406
|
);
|
|
36752
36407
|
throw new Error("Missing required flag: --domain");
|
|
@@ -36802,7 +36457,7 @@ Usage: ${pc54.cyan("wraps email verify --domain yourapp.com")}
|
|
|
36802
36457
|
);
|
|
36803
36458
|
console.log(
|
|
36804
36459
|
`
|
|
36805
|
-
Available commands: ${
|
|
36460
|
+
Available commands: ${pc53.cyan("init")}, ${pc53.cyan("destroy")}, ${pc53.cyan("status")}, ${pc53.cyan("verify")}, ${pc53.cyan("test")}
|
|
36806
36461
|
`
|
|
36807
36462
|
);
|
|
36808
36463
|
throw new Error(
|
|
@@ -36830,7 +36485,7 @@ Available commands: ${pc54.cyan("init")}, ${pc54.cyan("destroy")}, ${pc54.cyan("
|
|
|
36830
36485
|
clack50.log.error("--domain flag is required");
|
|
36831
36486
|
console.log(
|
|
36832
36487
|
`
|
|
36833
|
-
Usage: ${
|
|
36488
|
+
Usage: ${pc53.cyan("wraps email domains verify --domain yourapp.com")}
|
|
36834
36489
|
`
|
|
36835
36490
|
);
|
|
36836
36491
|
throw new Error("Missing required flag: --domain");
|
|
@@ -36843,7 +36498,7 @@ Usage: ${pc54.cyan("wraps email domains verify --domain yourapp.com")}
|
|
|
36843
36498
|
clack50.log.error("--domain flag is required");
|
|
36844
36499
|
console.log(
|
|
36845
36500
|
`
|
|
36846
|
-
Usage: ${
|
|
36501
|
+
Usage: ${pc53.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
36847
36502
|
`
|
|
36848
36503
|
);
|
|
36849
36504
|
throw new Error("Missing required flag: --domain");
|
|
@@ -36856,7 +36511,7 @@ Usage: ${pc54.cyan("wraps email domains get-dkim --domain yourapp.com")}
|
|
|
36856
36511
|
clack50.log.error("--domain flag is required");
|
|
36857
36512
|
console.log(
|
|
36858
36513
|
`
|
|
36859
|
-
Usage: ${
|
|
36514
|
+
Usage: ${pc53.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
36860
36515
|
`
|
|
36861
36516
|
);
|
|
36862
36517
|
throw new Error("Missing required flag: --domain");
|
|
@@ -36873,7 +36528,7 @@ Usage: ${pc54.cyan("wraps email domains remove --domain yourapp.com --force")}
|
|
|
36873
36528
|
);
|
|
36874
36529
|
console.log(
|
|
36875
36530
|
`
|
|
36876
|
-
Available commands: ${
|
|
36531
|
+
Available commands: ${pc53.cyan("add")}, ${pc53.cyan("list")}, ${pc53.cyan("verify")}, ${pc53.cyan("get-dkim")}, ${pc53.cyan("remove")}
|
|
36877
36532
|
`
|
|
36878
36533
|
);
|
|
36879
36534
|
throw new Error(
|
|
@@ -36918,7 +36573,7 @@ Available commands: ${pc54.cyan("add")}, ${pc54.cyan("list")}, ${pc54.cyan("veri
|
|
|
36918
36573
|
);
|
|
36919
36574
|
console.log(
|
|
36920
36575
|
`
|
|
36921
|
-
Available commands: ${
|
|
36576
|
+
Available commands: ${pc53.cyan("init")}, ${pc53.cyan("push")}, ${pc53.cyan("preview")}
|
|
36922
36577
|
`
|
|
36923
36578
|
);
|
|
36924
36579
|
throw new Error(
|
|
@@ -36956,21 +36611,13 @@ Available commands: ${pc54.cyan("init")}, ${pc54.cyan("push")}, ${pc54.cyan("pre
|
|
|
36956
36611
|
token: flags.token
|
|
36957
36612
|
});
|
|
36958
36613
|
break;
|
|
36959
|
-
case "generate":
|
|
36960
|
-
await workflowsGenerate({
|
|
36961
|
-
template: flags.template,
|
|
36962
|
-
name: flags.name,
|
|
36963
|
-
force: flags.force,
|
|
36964
|
-
json: flags.json
|
|
36965
|
-
});
|
|
36966
|
-
break;
|
|
36967
36614
|
default:
|
|
36968
36615
|
clack50.log.error(
|
|
36969
36616
|
`Unknown workflows command: ${workflowsSubCommand || "(none)"}`
|
|
36970
36617
|
);
|
|
36971
36618
|
console.log(
|
|
36972
36619
|
`
|
|
36973
|
-
Available commands: ${
|
|
36620
|
+
Available commands: ${pc53.cyan("init")}, ${pc53.cyan("validate")}, ${pc53.cyan("push")}
|
|
36974
36621
|
`
|
|
36975
36622
|
);
|
|
36976
36623
|
throw new Error(
|
|
@@ -36991,7 +36638,7 @@ Available commands: ${pc54.cyan("init")}, ${pc54.cyan("validate")}, ${pc54.cyan(
|
|
|
36991
36638
|
clack50.log.error(`Unknown email command: ${subCommand}`);
|
|
36992
36639
|
console.log(
|
|
36993
36640
|
`
|
|
36994
|
-
Run ${
|
|
36641
|
+
Run ${pc53.cyan("wraps --help")} for available commands.
|
|
36995
36642
|
`
|
|
36996
36643
|
);
|
|
36997
36644
|
throw new Error(`Unknown email command: ${subCommand}`);
|
|
@@ -37069,7 +36716,7 @@ Run ${pc54.cyan("wraps --help")} for available commands.
|
|
|
37069
36716
|
clack50.log.error(`Unknown sms command: ${subCommand}`);
|
|
37070
36717
|
console.log(
|
|
37071
36718
|
`
|
|
37072
|
-
Run ${
|
|
36719
|
+
Run ${pc53.cyan("wraps --help")} for available commands.
|
|
37073
36720
|
`
|
|
37074
36721
|
);
|
|
37075
36722
|
throw new Error(`Unknown sms command: ${subCommand}`);
|
|
@@ -37133,7 +36780,7 @@ Run ${pc54.cyan("wraps --help")} for available commands.
|
|
|
37133
36780
|
clack50.log.error(`Unknown cdn command: ${subCommand}`);
|
|
37134
36781
|
console.log(
|
|
37135
36782
|
`
|
|
37136
|
-
Run ${
|
|
36783
|
+
Run ${pc53.cyan("wraps --help")} for available commands.
|
|
37137
36784
|
`
|
|
37138
36785
|
);
|
|
37139
36786
|
throw new Error(`Unknown cdn command: ${subCommand}`);
|
|
@@ -37159,9 +36806,9 @@ Run ${pc54.cyan("wraps --help")} for available commands.
|
|
|
37159
36806
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
37160
36807
|
);
|
|
37161
36808
|
console.log(`
|
|
37162
|
-
Available commands: ${
|
|
36809
|
+
Available commands: ${pc53.cyan("init")}
|
|
37163
36810
|
`);
|
|
37164
|
-
console.log(`Run ${
|
|
36811
|
+
console.log(`Run ${pc53.cyan("wraps --help")} for more information.
|
|
37165
36812
|
`);
|
|
37166
36813
|
throw new Error(
|
|
37167
36814
|
`Unknown workflow command: ${subCommand || "(none)"}`
|
|
@@ -37206,11 +36853,11 @@ Available commands: ${pc54.cyan("init")}
|
|
|
37206
36853
|
clack50.log.error(`Unknown platform command: ${subCommand}`);
|
|
37207
36854
|
console.log(
|
|
37208
36855
|
`
|
|
37209
|
-
Available commands: ${
|
|
36856
|
+
Available commands: ${pc53.cyan("connect")}, ${pc53.cyan("update-role")}
|
|
37210
36857
|
`
|
|
37211
36858
|
);
|
|
37212
36859
|
console.log(
|
|
37213
|
-
`Run ${
|
|
36860
|
+
`Run ${pc53.cyan("wraps platform")} for more information.
|
|
37214
36861
|
`
|
|
37215
36862
|
);
|
|
37216
36863
|
throw new Error(`Unknown platform command: ${subCommand}`);
|
|
@@ -37238,7 +36885,7 @@ Available commands: ${pc54.cyan("connect")}, ${pc54.cyan("update-role")}
|
|
|
37238
36885
|
clack50.log.error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
37239
36886
|
console.log(
|
|
37240
36887
|
`
|
|
37241
|
-
Available commands: ${
|
|
36888
|
+
Available commands: ${pc53.cyan("login")}, ${pc53.cyan("status")}, ${pc53.cyan("logout")}
|
|
37242
36889
|
`
|
|
37243
36890
|
);
|
|
37244
36891
|
throw new Error(`Unknown auth command: ${subCommand || "(none)"}`);
|
|
@@ -37259,10 +36906,10 @@ Available commands: ${pc54.cyan("login")}, ${pc54.cyan("status")}, ${pc54.cyan("
|
|
|
37259
36906
|
clack50.log.error(`Unknown aws command: ${subCommand}`);
|
|
37260
36907
|
console.log(
|
|
37261
36908
|
`
|
|
37262
|
-
Available commands: ${
|
|
36909
|
+
Available commands: ${pc53.cyan("setup")}, ${pc53.cyan("doctor")}
|
|
37263
36910
|
`
|
|
37264
36911
|
);
|
|
37265
|
-
console.log(`Run ${
|
|
36912
|
+
console.log(`Run ${pc53.cyan("wraps --help")} for more information.
|
|
37266
36913
|
`);
|
|
37267
36914
|
throw new Error(`Unknown aws command: ${subCommand}`);
|
|
37268
36915
|
}
|
|
@@ -37338,7 +36985,7 @@ Available commands: ${pc54.cyan("setup")}, ${pc54.cyan("doctor")}
|
|
|
37338
36985
|
clack50.log.error(`Unknown telemetry command: ${subCommand}`);
|
|
37339
36986
|
console.log(
|
|
37340
36987
|
`
|
|
37341
|
-
Available commands: ${
|
|
36988
|
+
Available commands: ${pc53.cyan("enable")}, ${pc53.cyan("disable")}, ${pc53.cyan("status")}
|
|
37342
36989
|
`
|
|
37343
36990
|
);
|
|
37344
36991
|
throw new Error(`Unknown telemetry command: ${subCommand}`);
|
|
@@ -37365,7 +37012,7 @@ Please specify a command for ${primaryCommand} service.
|
|
|
37365
37012
|
clack50.log.error(`Unknown command: ${primaryCommand}`);
|
|
37366
37013
|
console.log(
|
|
37367
37014
|
`
|
|
37368
|
-
Run ${
|
|
37015
|
+
Run ${pc53.cyan("wraps --help")} for available commands.
|
|
37369
37016
|
`
|
|
37370
37017
|
);
|
|
37371
37018
|
throw new Error(`Unknown command: ${primaryCommand}`);
|