@wraps.dev/cli 2.21.6 → 2.21.10

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.
Files changed (65) hide show
  1. package/dist/api-lambda.zip +0 -0
  2. package/dist/cli.js +40 -59
  3. package/dist/cli.js.map +1 -1
  4. package/dist/lambda/event-processor/.bundled +1 -1
  5. package/dist/lambda/inbound-processor/.bundled +1 -1
  6. package/dist/lambda/sms-event-processor/.bundled +1 -1
  7. package/dist/selfhost-migrations/0000_absent_rogue.sql +203 -0
  8. package/dist/selfhost-migrations/0001_polite_maverick.sql +17 -0
  9. package/dist/selfhost-migrations/0002_perpetual_scorpion.sql +1 -0
  10. package/dist/selfhost-migrations/0003_wealthy_absorbing_man.sql +1 -0
  11. package/dist/selfhost-migrations/0004_opposite_blur.sql +1 -0
  12. package/dist/selfhost-migrations/0005_clear_terror.sql +4 -0
  13. package/dist/selfhost-migrations/0006_soft_black_widow.sql +20 -0
  14. package/dist/selfhost-migrations/0007_dazzling_saracen.sql +124 -0
  15. package/dist/selfhost-migrations/0008_broad_hannibal_king.sql +33 -0
  16. package/dist/selfhost-migrations/0009_bouncy_mystique.sql +73 -0
  17. package/dist/selfhost-migrations/0010_cheerful_valeria_richards.sql +18 -0
  18. package/dist/selfhost-migrations/0011_absent_thunderbolts.sql +2 -0
  19. package/dist/selfhost-migrations/0012_demonic_donald_blake.sql +1 -0
  20. package/dist/selfhost-migrations/0013_nifty_preak.sql +143 -0
  21. package/dist/selfhost-migrations/0014_hesitant_beast.sql +2 -0
  22. package/dist/selfhost-migrations/0015_blue_giant_girl.sql +1 -0
  23. package/dist/selfhost-migrations/0016_cooing_overlord.sql +1 -0
  24. package/dist/selfhost-migrations/0017_tranquil_ender_wiggin.sql +11 -0
  25. package/dist/selfhost-migrations/0018_talented_groot.sql +8 -0
  26. package/dist/selfhost-migrations/0019_ambitious_devos.sql +3 -0
  27. package/dist/selfhost-migrations/0020_misty_master_mold.sql +95 -0
  28. package/dist/selfhost-migrations/0021_regular_harrier.sql +14 -0
  29. package/dist/selfhost-migrations/0022_sour_blizzard.sql +10 -0
  30. package/dist/selfhost-migrations/0023_flawless_psynapse.sql +1 -0
  31. package/dist/selfhost-migrations/0024_premium_blindfold.sql +1 -0
  32. package/dist/selfhost-migrations/0025_unusual_santa_claus.sql +1 -0
  33. package/dist/selfhost-migrations/0026_volatile_pandemic.sql +2 -0
  34. package/dist/selfhost-migrations/0027_workable_logan.sql +4 -0
  35. package/dist/selfhost-migrations/0028_familiar_prodigy.sql +1 -0
  36. package/dist/selfhost-migrations/0029_cute_maddog.sql +13 -0
  37. package/dist/selfhost-migrations/0030_adorable_scarecrow.sql +1 -0
  38. package/dist/selfhost-migrations/0031_material_slapstick.sql +10 -0
  39. package/dist/selfhost-migrations/0032_hot_dust.sql +11 -0
  40. package/dist/selfhost-migrations/0033_slow_deathbird.sql +1 -0
  41. package/dist/selfhost-migrations/0034_lush_rafael_vega.sql +12 -0
  42. package/dist/selfhost-migrations/0035_normal_red_hulk.sql +8 -0
  43. package/dist/selfhost-migrations/0036_marvelous_ezekiel.sql +1 -0
  44. package/dist/selfhost-migrations/0037_swift_talisman.sql +8 -0
  45. package/dist/selfhost-migrations/0038_first_mandroid.sql +1 -0
  46. package/dist/selfhost-migrations/0039_fixed_stryfe.sql +1 -0
  47. package/dist/selfhost-migrations/0040_add_channel_check_constraints.sql +2 -0
  48. package/dist/selfhost-migrations/0041_black_spencer_smythe.sql +1 -0
  49. package/dist/selfhost-migrations/0042_plain_marvel_zombies.sql +2 -0
  50. package/dist/selfhost-migrations/0043_curved_champions.sql +1 -0
  51. package/dist/selfhost-migrations/0044_clean_iceman.sql +1 -0
  52. package/dist/selfhost-migrations/0045_condemned_steel_serpent.sql +1 -0
  53. package/dist/selfhost-migrations/0046_steep_ultimo.sql +2 -0
  54. package/dist/selfhost-migrations/0047_empty_sleepwalker.sql +2 -0
  55. package/dist/selfhost-migrations/0048_cheerful_multiple_man.sql +1 -0
  56. package/dist/selfhost-migrations/0049_nostalgic_loki.sql +3 -0
  57. package/dist/selfhost-migrations/0050_add_engagement_metadata.sql +4 -0
  58. package/dist/selfhost-migrations/0051_odd_marrow.sql +2 -0
  59. package/dist/selfhost-migrations/0052_redundant_siren.sql +5 -0
  60. package/dist/selfhost-migrations/0053_soft_carnage.sql +31 -0
  61. package/dist/selfhost-migrations/0054_blushing_vin_gonzales.sql +1 -0
  62. package/dist/selfhost-migrations/0055_broadcast_resume_columns.sql +12 -0
  63. package/dist/selfhost-migrations/0056_broadcast_resume_dedup_cleanup.sql +31 -0
  64. package/dist/selfhost-migrations/0057_audit_log_actoremail_jsonb.sql +5 -0
  65. package/package.json +5 -2
Binary file
package/dist/cli.js CHANGED
@@ -10356,7 +10356,7 @@ var init_update = __esm({
10356
10356
  // src/cli.ts
10357
10357
  init_esm_shims();
10358
10358
  import { readFileSync as readFileSync3 } from "fs";
10359
- import { dirname as dirname5, join as join24 } from "path";
10359
+ import { dirname as dirname7, join as join24 } from "path";
10360
10360
  import { fileURLToPath as fileURLToPath8 } from "url";
10361
10361
  import * as clack61 from "@clack/prompts";
10362
10362
  import pc65 from "picocolors";
@@ -26214,7 +26214,7 @@ async function findCliNodeModules() {
26214
26214
  const paths = [];
26215
26215
  try {
26216
26216
  const { createRequire } = await import("module");
26217
- const { dirname: dirname6 } = await import("path");
26217
+ const { dirname: dirname8 } = await import("path");
26218
26218
  for (const base of [
26219
26219
  // The current file's location (works when running from source)
26220
26220
  import.meta.url,
@@ -26224,7 +26224,7 @@ async function findCliNodeModules() {
26224
26224
  try {
26225
26225
  const req = createRequire(base);
26226
26226
  const reactPkg = req.resolve("react/package.json");
26227
- const reactNodeModules = join12(dirname6(reactPkg), "..");
26227
+ const reactNodeModules = join12(dirname8(reactPkg), "..");
26228
26228
  if (existsSync10(join12(reactNodeModules, "react"))) {
26229
26229
  paths.push(reactNodeModules);
26230
26230
  break;
@@ -33221,10 +33221,9 @@ function buildConsolePolicyDocument2(emailConfig, smsConfig) {
33221
33221
 
33222
33222
  // src/commands/selfhost/deploy.ts
33223
33223
  init_esm_shims();
33224
- import { execSync as execSync2 } from "child_process";
33225
33224
  import { randomBytes as randomBytes6 } from "crypto";
33226
- import { writeFileSync } from "fs";
33227
- import { join as join20 } from "path";
33225
+ import { existsSync as existsSync18 } from "fs";
33226
+ import { dirname as dirname5, join as join20 } from "path";
33228
33227
  import { fileURLToPath as fileURLToPath5 } from "url";
33229
33228
  import * as clack43 from "@clack/prompts";
33230
33229
  import * as pulumi26 from "@pulumi/pulumi";
@@ -33493,7 +33492,9 @@ init_metadata();
33493
33492
  init_output();
33494
33493
  init_pulumi();
33495
33494
  var __filename2 = fileURLToPath5(import.meta.url);
33496
- var repoRoot = join20(__filename2, "../../../..");
33495
+ var cliDir = dirname5(__filename2);
33496
+ var bundledLambdaZip = join20(cliDir, "api-lambda.zip");
33497
+ var bundledMigrationsDir = join20(cliDir, "selfhost-migrations");
33497
33498
  async function selfhostDeploy(options) {
33498
33499
  const startTime = Date.now();
33499
33500
  if (!isJsonMode()) {
@@ -33604,22 +33605,12 @@ async function selfhostDeploy(options) {
33604
33605
  process.exit(0);
33605
33606
  }
33606
33607
  }
33607
- const childStdio = isJsonMode() ? "pipe" : "inherit";
33608
- await progress.execute("Building Wraps API", async () => {
33609
- execSync2("pnpm --filter @wraps/api build", {
33610
- stdio: childStdio,
33611
- cwd: repoRoot
33612
- });
33613
- });
33614
- const lambdaZipPath = join20(repoRoot, "apps/api/lambda.zip");
33615
- const distDir = join20(repoRoot, "apps/api/dist");
33616
- await progress.execute("Packaging Lambda", async () => {
33617
- writeFileSync(join20(distDir, "package.json"), '{"type":"module"}\n');
33618
- execSync2("/bin/sh -c 'zip -r ../lambda.zip .'", {
33619
- cwd: distDir,
33620
- stdio: childStdio
33621
- });
33622
- });
33608
+ if (!existsSync18(bundledLambdaZip)) {
33609
+ throw new Error(
33610
+ `Bundled API lambda not found at ${bundledLambdaZip}. Run 'pnpm build' in the CLI package to generate it.`
33611
+ );
33612
+ }
33613
+ const lambdaZipPath = bundledLambdaZip;
33623
33614
  if (!resolvedDatabaseUrl) {
33624
33615
  const neonProject = await progress.execute(
33625
33616
  "Provisioning Neon PostgreSQL database",
@@ -33669,14 +33660,14 @@ async function selfhostDeploy(options) {
33669
33660
  savedMetadata.timestamp = deployedAt;
33670
33661
  await saveConnectionMetadata(savedMetadata);
33671
33662
  await progress.execute("Running database migrations", async () => {
33672
- execSync2("pnpm --filter @wraps/db db:migrate", {
33673
- stdio: childStdio,
33674
- cwd: repoRoot,
33675
- env: {
33676
- ...process.env,
33677
- DATABASE_URL: databaseUrl
33678
- }
33679
- });
33663
+ const { neonConfig, Pool } = await import("@neondatabase/serverless");
33664
+ const { drizzle } = await import("drizzle-orm/neon-serverless");
33665
+ const { migrate } = await import("drizzle-orm/neon-serverless/migrator");
33666
+ neonConfig.poolQueryViaFetch = true;
33667
+ const pool = new Pool({ connectionString: databaseUrl });
33668
+ const db = drizzle(pool);
33669
+ await migrate(db, { migrationsFolder: bundledMigrationsDir });
33670
+ await pool.end();
33680
33671
  });
33681
33672
  const createStack = async () => {
33682
33673
  await ensurePulumiWorkDir({
@@ -33985,9 +33976,8 @@ Run ${pc48.cyan("wraps selfhost deploy")} to deploy the self-hosted control plan
33985
33976
 
33986
33977
  // src/commands/selfhost/upgrade.ts
33987
33978
  init_esm_shims();
33988
- import { execSync as execSync3 } from "child_process";
33989
- import { writeFileSync as writeFileSync2 } from "fs";
33990
- import { join as join21 } from "path";
33979
+ import { existsSync as existsSync19 } from "fs";
33980
+ import { dirname as dirname6, join as join21 } from "path";
33991
33981
  import { fileURLToPath as fileURLToPath6 } from "url";
33992
33982
  import * as clack46 from "@clack/prompts";
33993
33983
  import * as pulumi27 from "@pulumi/pulumi";
@@ -34002,7 +33992,8 @@ init_output();
34002
33992
  init_pulumi();
34003
33993
  init_region_resolver();
34004
33994
  var __filename3 = fileURLToPath6(import.meta.url);
34005
- var repoRoot2 = join21(__filename3, "../../../..");
33995
+ var cliDir2 = dirname6(__filename3);
33996
+ var bundledLambdaZip2 = join21(cliDir2, "api-lambda.zip");
34006
33997
  async function selfhostUpgrade(options) {
34007
33998
  const startTime = Date.now();
34008
33999
  if (!isJsonMode()) {
@@ -34049,22 +34040,12 @@ async function selfhostUpgrade(options) {
34049
34040
  }
34050
34041
  const config2 = selfhostService.config;
34051
34042
  const stackName = selfhostService.pulumiStackName || `wraps-selfhost-${identity.accountId}-${region}`;
34052
- const childStdio = isJsonMode() ? "pipe" : "inherit";
34053
- await progress.execute("Building Wraps API", async () => {
34054
- execSync3("pnpm --filter @wraps/api build", {
34055
- stdio: childStdio,
34056
- cwd: repoRoot2
34057
- });
34058
- });
34059
- const lambdaZipPath = join21(repoRoot2, "apps/api/lambda.zip");
34060
- const distDir = join21(repoRoot2, "apps/api/dist");
34061
- await progress.execute("Packaging Lambda", async () => {
34062
- writeFileSync2(join21(distDir, "package.json"), '{"type":"module"}\n');
34063
- execSync3("/bin/sh -c 'zip -r ../lambda.zip .'", {
34064
- cwd: distDir,
34065
- stdio: childStdio
34066
- });
34067
- });
34043
+ if (!existsSync19(bundledLambdaZip2)) {
34044
+ throw new Error(
34045
+ `Bundled API lambda not found at ${bundledLambdaZip2}. Run 'pnpm build' in the CLI package to generate it.`
34046
+ );
34047
+ }
34048
+ const lambdaZipPath = bundledLambdaZip2;
34068
34049
  const createStack = async () => {
34069
34050
  await ensurePulumiWorkDir({ accountId: identity.accountId, region });
34070
34051
  const stack = await pulumi27.automation.LocalWorkspace.createOrSelectStack(
@@ -41432,7 +41413,7 @@ async function telemetryStatus() {
41432
41413
 
41433
41414
  // src/commands/workflow/init.ts
41434
41415
  init_esm_shims();
41435
- import { existsSync as existsSync18, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
41416
+ import { existsSync as existsSync20, mkdirSync as mkdirSync2, writeFileSync } from "fs";
41436
41417
  import { join as join22 } from "path";
41437
41418
  import * as clack60 from "@clack/prompts";
41438
41419
  import pc63 from "picocolors";
@@ -41534,11 +41515,11 @@ async function workflowInit(options = {}) {
41534
41515
  const wrapsDir = join22(process.cwd(), "wraps");
41535
41516
  const workflowsDir = join22(wrapsDir, "workflows");
41536
41517
  const configPath = join22(wrapsDir, "wraps.config.ts");
41537
- if (existsSync18(workflowsDir)) {
41518
+ if (existsSync20(workflowsDir)) {
41538
41519
  clack60.log.info(
41539
41520
  `Workflows directory already exists at ${pc63.cyan("wraps/workflows/")}`
41540
41521
  );
41541
- const files = existsSync18(join22(workflowsDir, "cart-recovery.ts")) || existsSync18(join22(workflowsDir, "welcome-sequence.ts"));
41522
+ const files = existsSync20(join22(workflowsDir, "cart-recovery.ts")) || existsSync20(join22(workflowsDir, "welcome-sequence.ts"));
41542
41523
  if (files && !options.yes) {
41543
41524
  const shouldContinue = await clack60.confirm({
41544
41525
  message: "Example files may already exist. Overwrite them?",
@@ -41558,19 +41539,19 @@ async function workflowInit(options = {}) {
41558
41539
  mkdirSync2(workflowsDir, { recursive: true });
41559
41540
  s.stop("Created wraps/workflows/");
41560
41541
  s.start("Scaffolding example workflows...");
41561
- writeFileSync3(
41542
+ writeFileSync(
41562
41543
  join22(workflowsDir, "cart-recovery.ts"),
41563
41544
  EXAMPLE_CASCADE_WORKFLOW,
41564
41545
  "utf-8"
41565
41546
  );
41566
- writeFileSync3(
41547
+ writeFileSync(
41567
41548
  join22(workflowsDir, "welcome-sequence.ts"),
41568
41549
  EXAMPLE_WELCOME_WORKFLOW,
41569
41550
  "utf-8"
41570
41551
  );
41571
41552
  s.stop("Created 2 example workflows");
41572
- if (!existsSync18(configPath)) {
41573
- writeFileSync3(configPath, EXAMPLE_CONFIG, "utf-8");
41553
+ if (!existsSync20(configPath)) {
41554
+ writeFileSync(configPath, EXAMPLE_CONFIG, "utf-8");
41574
41555
  clack60.log.info(`Created ${pc63.cyan("wraps/wraps.config.ts")}`);
41575
41556
  }
41576
41557
  clack60.log.success(
@@ -41782,7 +41763,7 @@ if (nodeMajorVersion < 20) {
41782
41763
  process.exit(1);
41783
41764
  }
41784
41765
  var __filename4 = fileURLToPath8(import.meta.url);
41785
- var __dirname3 = dirname5(__filename4);
41766
+ var __dirname3 = dirname7(__filename4);
41786
41767
  var packageJson = JSON.parse(
41787
41768
  readFileSync3(join24(__dirname3, "../package.json"), "utf-8")
41788
41769
  );