vercel 57.0.0 → 58.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/chunks/{add-YRZTDNXX.js → add-7PPD4ZUJ.js} +2 -2
  2. package/dist/chunks/{add-7M577U56.js → add-E4KH6P4A.js} +3 -3
  3. package/dist/chunks/{chunk-3242RXCN.js → chunk-AZTV7WPZ.js} +1 -1
  4. package/dist/chunks/{chunk-4PGF367U.js → chunk-B2MTCHPO.js} +19 -1
  5. package/dist/chunks/{chunk-RYO6FJFB.js → chunk-BYQQLGCT.js} +1 -1
  6. package/dist/chunks/{chunk-555WJSO5.js → chunk-DGFASMSE.js} +1 -1
  7. package/dist/chunks/{chunk-NH43BFJ3.js → chunk-EA22NMFU.js} +1 -1
  8. package/dist/chunks/{chunk-RAFH25WW.js → chunk-FB4UFWEC.js} +1 -1
  9. package/dist/chunks/{chunk-T4NODP6Y.js → chunk-FYR7WEUJ.js} +1 -1
  10. package/dist/chunks/{chunk-NRNMT43R.js → chunk-KGVT2RSG.js} +1 -1
  11. package/dist/chunks/{chunk-2EDWKVNP.js → chunk-L4WYMJB3.js} +4 -4
  12. package/dist/chunks/{chunk-F5PQWDOC.js → chunk-MDQJLTGN.js} +1 -1
  13. package/dist/chunks/{chunk-LMHT3QR3.js → chunk-OQGN4TEC.js} +1 -1
  14. package/dist/chunks/{chunk-MAHINYBW.js → chunk-R54DAHCL.js} +1 -1
  15. package/dist/chunks/{chunk-F7X55TOY.js → chunk-RSCSALZH.js} +3 -3
  16. package/dist/chunks/{chunk-MIFDRYTN.js → chunk-TEWJ7TIW.js} +1 -1
  17. package/dist/chunks/{chunk-TBR2Q37Y.js → chunk-TPX7RZBM.js} +243 -44
  18. package/dist/chunks/{chunk-GP5VCTEU.js → chunk-VUESC3YO.js} +1 -1
  19. package/dist/chunks/{chunk-A2TYQBX2.js → chunk-WANVKOVB.js} +24 -4
  20. package/dist/chunks/{chunk-HD7B425F.js → chunk-WDE2EDYX.js} +2 -2
  21. package/dist/chunks/{chunk-YOZCJHLZ.js → chunk-YZMZCQP3.js} +4 -4
  22. package/dist/chunks/{chunk-IOAZNR6Z.js → chunk-ZMVFTCQF.js} +1 -1
  23. package/dist/chunks/{compile-vercel-config-3OHO3TJA.js → compile-vercel-config-G2IVBXEI.js} +1 -1
  24. package/dist/chunks/config-validator.mjs +1 -1
  25. package/dist/chunks/{delete-VOSJLNEA.js → delete-2EIVGM6P.js} +2 -2
  26. package/dist/chunks/{delete-3DZOCWCC.js → delete-E6ZQNE5X.js} +2 -2
  27. package/dist/chunks/{disable-LQDEVRQF.js → disable-M3Q6BBB7.js} +2 -2
  28. package/dist/chunks/{discard-RGV4JKXQ.js → discard-3R6ETBPS.js} +2 -2
  29. package/dist/chunks/{edit-SFIEOQ24.js → edit-7JUDPVXD.js} +3 -3
  30. package/dist/chunks/{edit-UPZPI54L.js → edit-ICVMGRRU.js} +2 -2
  31. package/dist/chunks/{enable-6UVH35WC.js → enable-HLTA35QL.js} +2 -2
  32. package/dist/chunks/{export-6CEG3CK7.js → export-E6XZUFW3.js} +2 -2
  33. package/dist/chunks/{image-CQRCD2OE.js → image-SIRPPQZT.js} +3 -3
  34. package/dist/chunks/{inspect-UM3LDRPV.js → inspect-4FYBOOM5.js} +2 -2
  35. package/dist/chunks/{inspect-K5ZMQG7X.js → inspect-65YX7L3O.js} +2 -2
  36. package/dist/chunks/{inspect-EXQBIAFF.js → inspect-6TQWDIBG.js} +2 -2
  37. package/dist/chunks/{inspect-ZFRY3X3H.js → inspect-NFOURIGN.js} +2 -2
  38. package/dist/chunks/{inspect-4ZAH3RFT.js → inspect-OEWWGAHZ.js} +3 -3
  39. package/dist/chunks/{list-FJCBOCCA.js → list-27DCGMBI.js} +1 -1
  40. package/dist/chunks/{list-4DRVM7Q4.js → list-APFMKZJO.js} +2 -2
  41. package/dist/chunks/{list-KCUHD4OA.js → list-XQCZVLES.js} +3 -3
  42. package/dist/chunks/{login-DFGYNU3K.js → login-FMU4CQOV.js} +2 -2
  43. package/dist/chunks/{ls-CG6A7UXF.js → ls-24BRCAZR.js} +2 -2
  44. package/dist/chunks/{ls-RHEQ6YQB.js → ls-3L6EN4YU.js} +3 -3
  45. package/dist/chunks/{ls-4QHHVXXD.js → ls-BFACWH6C.js} +2 -2
  46. package/dist/chunks/{ls-34NCZKBE.js → ls-T5RGDBCV.js} +2 -2
  47. package/dist/chunks/{open-E3XADEMX.js → open-AG3VYJZM.js} +2 -2
  48. package/dist/chunks/{publish-Z3AQRUCS.js → publish-5OVCPS4J.js} +2 -2
  49. package/dist/chunks/{query-3EV66DO3.js → query-QS4VKBXJ.js} +1 -1
  50. package/dist/chunks/{reorder-VA5E5ZJT.js → reorder-B5V2P7YM.js} +2 -2
  51. package/dist/chunks/{reply-SNSCNKAW.js → reply-JBLWE6RS.js} +2 -2
  52. package/dist/chunks/{resolve-6ZX4RTXX.js → resolve-2I6XH2G3.js} +2 -2
  53. package/dist/chunks/{restore-NEHI5B5P.js → restore-O63FZXCL.js} +2 -2
  54. package/dist/chunks/{rm-FR6KE744.js → rm-HUED5R3Q.js} +3 -3
  55. package/dist/chunks/{rm-E5ZVLAKO.js → rm-N7W3QYWZ.js} +2 -2
  56. package/dist/chunks/{rm-22B22E47.js → rm-P3NJSCMY.js} +2 -2
  57. package/dist/chunks/{rule-inspect-DMP2CKJQ.js → rule-inspect-M3QUSPU2.js} +3 -3
  58. package/dist/chunks/{rules-EYGXEI2Z.js → rules-NSSWPJ2B.js} +6 -6
  59. package/dist/chunks/{schema-2IIWOBSQ.js → schema-G2PAXPVA.js} +1 -1
  60. package/dist/chunks/{tags-ZDVYRHAY.js → tags-JFMO63D4.js} +2 -2
  61. package/dist/chunks/{update-QH4DQMZV.js → update-VJCKD6YG.js} +3 -3
  62. package/dist/commands/build/index.js +7 -7
  63. package/dist/commands/deploy/index.js +8 -8
  64. package/dist/commands/dev/index.js +19 -6
  65. package/dist/commands/env/index.js +4 -4
  66. package/dist/commands/link/index.js +5 -5
  67. package/dist/commands/list/index.js +2 -2
  68. package/dist/commands-bulk.js +170 -67
  69. package/dist/index.js +6 -6
  70. package/dist/version.mjs +1 -1
  71. package/package.json +35 -35
@@ -37,7 +37,7 @@ import {
37
37
  runInteractiveEditLoop,
38
38
  stripQuotes,
39
39
  validateActionFlags
40
- } from "./chunks/chunk-IOAZNR6Z.js";
40
+ } from "./chunks/chunk-ZMVFTCQF.js";
41
41
  import {
42
42
  getRouteVersions
43
43
  } from "./chunks/chunk-AHU7WNL2.js";
@@ -57,7 +57,7 @@ import {
57
57
  requireProjectContext,
58
58
  validateRequiredArguments,
59
59
  withGlobalFlags as withGlobalFlags2
60
- } from "./chunks/chunk-555WJSO5.js";
60
+ } from "./chunks/chunk-DGFASMSE.js";
61
61
  import {
62
62
  canPrompt
63
63
  } from "./chunks/chunk-2473DUBR.js";
@@ -87,12 +87,12 @@ import {
87
87
  resolveOpenApiTagForTeamsCli,
88
88
  setAutoUpdate,
89
89
  tryOpenApiFallback
90
- } from "./chunks/chunk-2EDWKVNP.js";
90
+ } from "./chunks/chunk-L4WYMJB3.js";
91
91
  import "./chunks/chunk-FGDKMNEN.js";
92
92
  import {
93
93
  getUpdateCommand,
94
94
  isGlobal
95
- } from "./chunks/chunk-RYO6FJFB.js";
95
+ } from "./chunks/chunk-BYQQLGCT.js";
96
96
  import {
97
97
  Now,
98
98
  addDomain,
@@ -113,13 +113,13 @@ import {
113
113
  require_cjs,
114
114
  require_jsonlines,
115
115
  setupDomain
116
- } from "./chunks/chunk-F7X55TOY.js";
116
+ } from "./chunks/chunk-RSCSALZH.js";
117
117
  import {
118
118
  require_format
119
119
  } from "./chunks/chunk-PRWJUY5U.js";
120
120
  import {
121
121
  sleep
122
- } from "./chunks/chunk-4PGF367U.js";
122
+ } from "./chunks/chunk-B2MTCHPO.js";
123
123
  import {
124
124
  CHECKBOX_INSTRUCTIONS,
125
125
  ellipsis,
@@ -146,7 +146,7 @@ import {
146
146
  import {
147
147
  formatEnvironment,
148
148
  validateLsArgs
149
- } from "./chunks/chunk-MIFDRYTN.js";
149
+ } from "./chunks/chunk-TEWJ7TIW.js";
150
150
  import {
151
151
  validateJsonOutput
152
152
  } from "./chunks/chunk-XPKWKPWA.js";
@@ -440,7 +440,7 @@ import {
440
440
  webAnalyticsSubcommand,
441
441
  webhooksCommand,
442
442
  whoamiCommand
443
- } from "./chunks/chunk-A2TYQBX2.js";
443
+ } from "./chunks/chunk-WANVKOVB.js";
444
444
  import {
445
445
  addSubcommand as addSubcommand12,
446
446
  inspectSubcommand as inspectSubcommand9,
@@ -512,9 +512,9 @@ import "./chunks/chunk-OGG6UBXK.js";
512
512
  import "./chunks/chunk-LHFNIZ2P.js";
513
513
  import {
514
514
  main
515
- } from "./chunks/chunk-YOZCJHLZ.js";
515
+ } from "./chunks/chunk-YZMZCQP3.js";
516
516
  import "./chunks/chunk-IB5L4LKZ.js";
517
- import "./chunks/chunk-3242RXCN.js";
517
+ import "./chunks/chunk-AZTV7WPZ.js";
518
518
  import {
519
519
  require_execa
520
520
  } from "./chunks/chunk-R6IGDGX3.js";
@@ -529,10 +529,10 @@ import {
529
529
  } from "./chunks/chunk-VXYGCOKL.js";
530
530
  import {
531
531
  ensureLink
532
- } from "./chunks/chunk-HD7B425F.js";
533
- import "./chunks/chunk-NRNMT43R.js";
532
+ } from "./chunks/chunk-WDE2EDYX.js";
533
+ import "./chunks/chunk-KGVT2RSG.js";
534
534
  import "./chunks/chunk-V4RMJKQP.js";
535
- import "./chunks/chunk-NH43BFJ3.js";
535
+ import "./chunks/chunk-EA22NMFU.js";
536
536
  import {
537
537
  help
538
538
  } from "./chunks/chunk-DMSLNAVH.js";
@@ -567,7 +567,6 @@ import {
567
567
  humanizePath,
568
568
  init_main,
569
569
  isValidEnvTarget,
570
- isVercelTomlEnabled,
571
570
  list,
572
571
  mapCertError,
573
572
  modify,
@@ -602,7 +601,7 @@ import {
602
601
  toHost,
603
602
  ua_default,
604
603
  writeToConfigFile
605
- } from "./chunks/chunk-TBR2Q37Y.js";
604
+ } from "./chunks/chunk-TPX7RZBM.js";
606
605
  import {
607
606
  TelemetryClient
608
607
  } from "./chunks/chunk-ECCWJHC6.js";
@@ -2438,7 +2437,7 @@ async function activity(client) {
2438
2437
  return 0;
2439
2438
  }
2440
2439
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
2441
- const listFn = (await import("./chunks/list-FJCBOCCA.js")).default;
2440
+ const listFn = (await import("./chunks/list-27DCGMBI.js")).default;
2442
2441
  return listFn(client, telemetry2);
2443
2442
  }
2444
2443
  }
@@ -6654,17 +6653,17 @@ async function alerts(client) {
6654
6653
  switch (subcommand) {
6655
6654
  case "inspect": {
6656
6655
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
6657
- const inspectFn = (await import("./chunks/inspect-EXQBIAFF.js")).default;
6656
+ const inspectFn = (await import("./chunks/inspect-6TQWDIBG.js")).default;
6658
6657
  return inspectFn(client, rawSubcommandArgs);
6659
6658
  }
6660
6659
  case "rules": {
6661
6660
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
6662
- const rulesFn = (await import("./chunks/rules-EYGXEI2Z.js")).default;
6661
+ const rulesFn = (await import("./chunks/rules-NSSWPJ2B.js")).default;
6663
6662
  return rulesFn(client, rawSubcommandArgs);
6664
6663
  }
6665
6664
  default: {
6666
6665
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
6667
- const listFn = (await import("./chunks/list-4DRVM7Q4.js")).default;
6666
+ const listFn = (await import("./chunks/list-APFMKZJO.js")).default;
6668
6667
  return listFn(client, telemetry2);
6669
6668
  }
6670
6669
  }
@@ -11852,43 +11851,43 @@ async function comments(client) {
11852
11851
  if (handleHelp(inspectSubcommand3))
11853
11852
  return 0;
11854
11853
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
11855
- return (await import("./chunks/inspect-4ZAH3RFT.js")).default(client, telemetry2);
11854
+ return (await import("./chunks/inspect-OEWWGAHZ.js")).default(client, telemetry2);
11856
11855
  }
11857
11856
  case "open": {
11858
11857
  if (handleHelp(openSubcommand))
11859
11858
  return 0;
11860
11859
  telemetry2.trackCliSubcommandOpen(subcommandOriginal);
11861
- return (await import("./chunks/open-E3XADEMX.js")).default(client, telemetry2);
11860
+ return (await import("./chunks/open-AG3VYJZM.js")).default(client, telemetry2);
11862
11861
  }
11863
11862
  case "reply": {
11864
11863
  if (handleHelp(replySubcommand))
11865
11864
  return 0;
11866
11865
  telemetry2.trackCliSubcommandReply(subcommandOriginal);
11867
- return (await import("./chunks/reply-SNSCNKAW.js")).default(client, telemetry2);
11866
+ return (await import("./chunks/reply-JBLWE6RS.js")).default(client, telemetry2);
11868
11867
  }
11869
11868
  case "resolve": {
11870
11869
  if (handleHelp(resolveSubcommand))
11871
11870
  return 0;
11872
11871
  telemetry2.trackCliSubcommandResolve(subcommandOriginal);
11873
- return (await import("./chunks/resolve-6ZX4RTXX.js")).default(client, telemetry2, true);
11872
+ return (await import("./chunks/resolve-2I6XH2G3.js")).default(client, telemetry2, true);
11874
11873
  }
11875
11874
  case "reopen": {
11876
11875
  if (handleHelp(reopenSubcommand))
11877
11876
  return 0;
11878
11877
  telemetry2.trackCliSubcommandReopen(subcommandOriginal);
11879
- return (await import("./chunks/resolve-6ZX4RTXX.js")).default(client, telemetry2, false);
11878
+ return (await import("./chunks/resolve-2I6XH2G3.js")).default(client, telemetry2, false);
11880
11879
  }
11881
11880
  case "edit": {
11882
11881
  if (handleHelp(editSubcommand))
11883
11882
  return 0;
11884
11883
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
11885
- return (await import("./chunks/edit-UPZPI54L.js")).default(client, telemetry2);
11884
+ return (await import("./chunks/edit-ICVMGRRU.js")).default(client, telemetry2);
11886
11885
  }
11887
11886
  case "delete": {
11888
11887
  if (handleHelp(deleteSubcommand))
11889
11888
  return 0;
11890
11889
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
11891
- return (await import("./chunks/delete-3DZOCWCC.js")).default(client, telemetry2);
11890
+ return (await import("./chunks/delete-E6ZQNE5X.js")).default(client, telemetry2);
11892
11891
  }
11893
11892
  default: {
11894
11893
  if (needHelp) {
@@ -11904,7 +11903,7 @@ async function comments(client) {
11904
11903
  }
11905
11904
  telemetry2.trackCliSubcommandList(subcommandOriginal);
11906
11905
  const defaultInvocation = subcommandOriginal === "default";
11907
- return (await import("./chunks/list-KCUHD4OA.js")).default(
11906
+ return (await import("./chunks/list-XQCZVLES.js")).default(
11908
11907
  client,
11909
11908
  telemetry2,
11910
11909
  defaultInvocation
@@ -12068,6 +12067,14 @@ var ConnexTelemetryClient = class extends TelemetryClient {
12068
12067
  });
12069
12068
  }
12070
12069
  }
12070
+ trackCliOptionTriggerEnvironment(v) {
12071
+ if (v) {
12072
+ this.trackCliOption({
12073
+ option: "trigger-environment",
12074
+ value: this.redactedValue
12075
+ });
12076
+ }
12077
+ }
12071
12078
  trackCliOptionTriggerPath(v) {
12072
12079
  if (v) {
12073
12080
  this.trackCliOption({
@@ -13207,13 +13214,21 @@ var import_chalk42 = __toESM(require_source(), 1);
13207
13214
  var import_chalk41 = __toESM(require_source(), 1);
13208
13215
  var MAX_TRIGGER_DESTINATIONS = 3;
13209
13216
  function destinationsMatch(a, b) {
13210
- return a.projectId === b.projectId && (a.branch ?? null) === (b.branch ?? null) && (a.path ?? null) === (b.path ?? null);
13217
+ return a.projectId === b.projectId && (a.customEnvironmentId ?? null) === (b.customEnvironmentId ?? null) && (a.branch ?? null) === (b.branch ?? null) && (a.path ?? null) === (b.path ?? null);
13211
13218
  }
13212
13219
  function findMatchingDestination(destinations, desired) {
13213
13220
  return destinations.find((d) => destinationsMatch(d, desired));
13214
13221
  }
13215
13222
  function buildTriggerDestination(input) {
13223
+ if (input.branch !== void 0 && input.customEnvironmentId !== void 0) {
13224
+ throw new Error(
13225
+ "Trigger destinations cannot target both a branch and a custom environment."
13226
+ );
13227
+ }
13216
13228
  const dest = { projectId: input.projectId };
13229
+ if (input.customEnvironmentId !== void 0) {
13230
+ dest.customEnvironmentId = input.customEnvironmentId;
13231
+ }
13217
13232
  if (input.branch !== void 0) {
13218
13233
  dest.branch = input.branch;
13219
13234
  }
@@ -13223,14 +13238,18 @@ function buildTriggerDestination(input) {
13223
13238
  return dest;
13224
13239
  }
13225
13240
  function formatDestination(d) {
13241
+ const target = d.customEnvironmentId ? `custom environment ${import_chalk41.default.bold(d.customEnvironmentId)}` : `branch ${import_chalk41.default.bold(d.branch ?? "production")}`;
13226
13242
  return [
13227
13243
  `project ${import_chalk41.default.bold(d.projectId)}`,
13228
- `branch ${import_chalk41.default.bold(d.branch ?? "production")}`,
13244
+ target,
13229
13245
  `path ${import_chalk41.default.bold(d.path ?? "<default>")}`
13230
13246
  ].join(", ");
13231
13247
  }
13232
13248
  function toJsonDestination(d) {
13233
13249
  const entry = { projectId: d.projectId };
13250
+ if (d.customEnvironmentId !== void 0) {
13251
+ entry.customEnvironmentId = d.customEnvironmentId;
13252
+ }
13234
13253
  if (d.branch !== void 0) {
13235
13254
  entry.branch = d.branch;
13236
13255
  }
@@ -13252,6 +13271,34 @@ async function patchTriggerDestinations(client, connectorId, destinations) {
13252
13271
 
13253
13272
  // src/commands/connex/attach.ts
13254
13273
  var ALL_ENVS = ["production", "preview", "development"];
13274
+ async function resolveRequestedEnvironments(client, projectId, projectName, requestedEnvironments) {
13275
+ if (requestedEnvironments.length === 0) {
13276
+ return [...ALL_ENVS];
13277
+ }
13278
+ const customEnvironmentInputs = requestedEnvironments.filter(
13279
+ (environment) => !isValidEnvTarget(environment)
13280
+ );
13281
+ const customEnvironments = customEnvironmentInputs.length > 0 ? await getCustomEnvironments(client, projectId) : [];
13282
+ const resolvedEnvironments = /* @__PURE__ */ new Set();
13283
+ for (const environment of requestedEnvironments) {
13284
+ if (isValidEnvTarget(environment)) {
13285
+ resolvedEnvironments.add(environment);
13286
+ continue;
13287
+ }
13288
+ const customEnvironment = pickCustomEnvironment(
13289
+ customEnvironments,
13290
+ environment
13291
+ );
13292
+ if (!customEnvironment) {
13293
+ output_manager_default.error(
13294
+ `Invalid environment ${import_chalk42.default.bold(environment)} for project ${import_chalk42.default.bold(projectName)}. Use ${envTargetChoices.map((choice) => choice.value).join(", ")}, or a custom environment slug or ID from that project.`
13295
+ );
13296
+ return void 0;
13297
+ }
13298
+ resolvedEnvironments.add(customEnvironment.id);
13299
+ }
13300
+ return [...resolvedEnvironments];
13301
+ }
13255
13302
  function envSetsEqual(a, b) {
13256
13303
  if (a.length !== b.length) {
13257
13304
  return false;
@@ -13259,6 +13306,15 @@ function envSetsEqual(a, b) {
13259
13306
  const aSet = new Set(a);
13260
13307
  return b.every((env) => aSet.has(env));
13261
13308
  }
13309
+ function getAttachmentEnvironments(requestedEnvironments, projectId, destinations) {
13310
+ const environments = new Set(requestedEnvironments);
13311
+ for (const destination of destinations) {
13312
+ if (destination.projectId === projectId && destination.customEnvironmentId !== void 0) {
13313
+ environments.add(destination.customEnvironmentId);
13314
+ }
13315
+ }
13316
+ return [...environments];
13317
+ }
13262
13318
  async function attach(client, args, flags) {
13263
13319
  const formatResult = validateJsonOutput(flags);
13264
13320
  if (!formatResult.valid) {
@@ -13269,17 +13325,28 @@ async function attach(client, args, flags) {
13269
13325
  const skipConfirmation = !!flags["--yes"];
13270
13326
  const withTriggers = !!flags["--triggers"];
13271
13327
  const triggerBranch = flags["--trigger-branch"];
13328
+ const triggerEnvironment = flags["--trigger-environment"];
13272
13329
  const triggerPath = flags["--trigger-path"];
13273
13330
  if (asJson && !skipConfirmation) {
13274
13331
  output_manager_default.error("--format=json requires --yes to skip confirmation prompts");
13275
13332
  return 1;
13276
13333
  }
13277
- if (!withTriggers && (triggerBranch || triggerPath)) {
13334
+ if (!withTriggers && (triggerBranch !== void 0 || triggerEnvironment !== void 0 || triggerPath !== void 0)) {
13278
13335
  output_manager_default.error(
13279
- "--trigger-branch and --trigger-path require --triggers to also be set."
13336
+ "--trigger-branch, --trigger-environment, and --trigger-path require --triggers to also be set."
13280
13337
  );
13281
13338
  return 1;
13282
13339
  }
13340
+ if (triggerBranch !== void 0 && triggerEnvironment !== void 0) {
13341
+ output_manager_default.error(
13342
+ "--trigger-branch and --trigger-environment are mutually exclusive."
13343
+ );
13344
+ return 1;
13345
+ }
13346
+ if (triggerEnvironment !== void 0 && triggerEnvironment.trim() === "") {
13347
+ output_manager_default.error("--trigger-environment must not be empty.");
13348
+ return 1;
13349
+ }
13283
13350
  const clientIdOrUid = args[0];
13284
13351
  if (!clientIdOrUid) {
13285
13352
  output_manager_default.error(
@@ -13290,15 +13357,6 @@ async function attach(client, args, flags) {
13290
13357
  const requestedEnvsRaw = normalizeRepeatableStringFilters(
13291
13358
  flags["--environment"]
13292
13359
  );
13293
- for (const env of requestedEnvsRaw) {
13294
- if (!isValidEnvTarget(env)) {
13295
- output_manager_default.error(
13296
- `Invalid environment ${import_chalk42.default.bold(env)}. Allowed values: ${envTargetChoices.map((c) => c.value).join(", ")}.`
13297
- );
13298
- return 1;
13299
- }
13300
- }
13301
- const environments = requestedEnvsRaw.length > 0 ? requestedEnvsRaw : [...ALL_ENVS];
13302
13360
  let projectId;
13303
13361
  let projectName;
13304
13362
  const projectFlag = flags["--project"];
@@ -13342,6 +13400,21 @@ async function attach(client, args, flags) {
13342
13400
  projectId = linked.project.id;
13343
13401
  projectName = sanitizeForTerminal(linked.project.name);
13344
13402
  }
13403
+ let environments;
13404
+ try {
13405
+ environments = await resolveRequestedEnvironments(
13406
+ client,
13407
+ projectId,
13408
+ projectName,
13409
+ requestedEnvsRaw
13410
+ );
13411
+ } catch (err) {
13412
+ printError(err);
13413
+ return 1;
13414
+ }
13415
+ if (!environments) {
13416
+ return 1;
13417
+ }
13345
13418
  output_manager_default.spinner("Retrieving connector\u2026");
13346
13419
  let target;
13347
13420
  try {
@@ -13373,8 +13446,30 @@ async function attach(client, args, flags) {
13373
13446
  return 1;
13374
13447
  }
13375
13448
  triggersEnabledOnConnector = target.triggers?.enabled === true;
13449
+ let customEnvironmentId;
13450
+ if (triggerEnvironment !== void 0) {
13451
+ let customEnvironments;
13452
+ try {
13453
+ customEnvironments = await getCustomEnvironments(client, projectId);
13454
+ } catch (err) {
13455
+ printError(err);
13456
+ return 1;
13457
+ }
13458
+ const customEnvironment = pickCustomEnvironment(
13459
+ customEnvironments,
13460
+ triggerEnvironment
13461
+ );
13462
+ if (!customEnvironment) {
13463
+ output_manager_default.error(
13464
+ `Unknown trigger environment ${import_chalk42.default.bold(triggerEnvironment)} for project ${import_chalk42.default.bold(projectName)}. Use a custom environment slug or stable ID from that project.`
13465
+ );
13466
+ return 1;
13467
+ }
13468
+ customEnvironmentId = customEnvironment.id;
13469
+ }
13376
13470
  desiredDestination = buildTriggerDestination({
13377
13471
  projectId,
13472
+ customEnvironmentId,
13378
13473
  branch: triggerBranch,
13379
13474
  path: triggerPath
13380
13475
  });
@@ -13399,7 +13494,12 @@ async function attach(client, args, flags) {
13399
13494
  return 1;
13400
13495
  }
13401
13496
  }
13402
- const attachmentMatches = existingAttachment !== void 0 && envSetsEqual(existingAttachment.environments ?? [], environments);
13497
+ const attachmentEnvironments = getAttachmentEnvironments(
13498
+ environments,
13499
+ projectId,
13500
+ target.triggerDestinations ?? []
13501
+ );
13502
+ const attachmentMatches = existingAttachment !== void 0 && envSetsEqual(existingAttachment.environments ?? [], attachmentEnvironments);
13403
13503
  const shouldAttach = !attachmentMatches;
13404
13504
  const shouldRegisterTrigger = withTriggers && !triggerAlreadyRegistered;
13405
13505
  if (!shouldAttach && !shouldRegisterTrigger) {
@@ -13410,7 +13510,7 @@ async function attach(client, args, flags) {
13410
13510
  clientId: target.id,
13411
13511
  uid: target.uid,
13412
13512
  projectId,
13413
- environments,
13513
+ environments: attachmentEnvironments,
13414
13514
  triggerDestination: withTriggers ? desiredDestination : void 0,
13415
13515
  unchanged: true
13416
13516
  },
@@ -13425,7 +13525,7 @@ async function attach(client, args, flags) {
13425
13525
  output_manager_default.log(
13426
13526
  `Connector ${import_chalk42.default.bold(displayName)} is already attached to ${import_chalk42.default.bold(
13427
13527
  projectName
13428
- )} for environments: ${environments.join(", ")}${triggerPart}. Nothing to do.`
13528
+ )} for environments: ${attachmentEnvironments.join(", ")}${triggerPart}. Nothing to do.`
13429
13529
  );
13430
13530
  return 0;
13431
13531
  }
@@ -13439,7 +13539,7 @@ async function attach(client, args, flags) {
13439
13539
  if (shouldAttach) {
13440
13540
  if (existingAttachment) {
13441
13541
  const current = (existingAttachment.environments ?? []).join(", ") || "\u2014";
13442
- const next = environments.join(", ");
13542
+ const next = attachmentEnvironments.join(", ");
13443
13543
  output_manager_default.log(
13444
13544
  `Connector ${import_chalk42.default.bold(displayName)} is already attached to ${import_chalk42.default.bold(
13445
13545
  projectName
@@ -13451,7 +13551,7 @@ async function attach(client, args, flags) {
13451
13551
  output_manager_default.log(
13452
13552
  `Connector ${import_chalk42.default.bold(displayName)} will be attached to ${import_chalk42.default.bold(
13453
13553
  projectName
13454
- )} for environments: ${environments.join(", ")}.`
13554
+ )} for environments: ${attachmentEnvironments.join(", ")}.`
13455
13555
  );
13456
13556
  }
13457
13557
  }
@@ -13478,7 +13578,7 @@ async function attach(client, args, flags) {
13478
13578
  `/v1/connect/connectors/${encodeURIComponent(target.id)}/projects/${encodeURIComponent(projectId)}`,
13479
13579
  {
13480
13580
  method: "POST",
13481
- body: { environments }
13581
+ body: { environments: attachmentEnvironments }
13482
13582
  }
13483
13583
  );
13484
13584
  } catch (err) {
@@ -13536,7 +13636,7 @@ async function attach(client, args, flags) {
13536
13636
  clientId: target.id,
13537
13637
  uid: target.uid,
13538
13638
  projectId,
13539
- environments,
13639
+ environments: attachmentEnvironments,
13540
13640
  triggerDestination: withTriggers ? desiredDestination : void 0
13541
13641
  },
13542
13642
  null,
@@ -13548,7 +13648,7 @@ async function attach(client, args, flags) {
13548
13648
  }
13549
13649
  if (shouldAttach) {
13550
13650
  output_manager_default.success(
13551
- `Attached connector ${import_chalk42.default.bold(displayName)} to ${import_chalk42.default.bold(projectName)} for environments: ${environments.join(", ")}.`
13651
+ `Attached connector ${import_chalk42.default.bold(displayName)} to ${import_chalk42.default.bold(projectName)} for environments: ${attachmentEnvironments.join(", ")}.`
13552
13652
  );
13553
13653
  }
13554
13654
  if (shouldRegisterTrigger && desiredDestination) {
@@ -14269,6 +14369,9 @@ async function connex(client) {
14269
14369
  telemetry2.trackCliOptionTriggerBranch(
14270
14370
  attachParsedArgs.flags["--trigger-branch"]
14271
14371
  );
14372
+ telemetry2.trackCliOptionTriggerEnvironment(
14373
+ attachParsedArgs.flags["--trigger-environment"]
14374
+ );
14272
14375
  telemetry2.trackCliOptionTriggerPath(
14273
14376
  attachParsedArgs.flags["--trigger-path"]
14274
14377
  );
@@ -15558,7 +15661,7 @@ async function add3(client, argv) {
15558
15661
  }
15559
15662
  const nonJsonConfigs = [
15560
15663
  ...VERCEL_CONFIG_EXTENSIONS.map((ext) => `vercel.${ext}`),
15561
- ...isVercelTomlEnabled() ? ["vercel.toml"] : []
15664
+ "vercel.toml"
15562
15665
  ];
15563
15666
  for (const configName of nonJsonConfigs) {
15564
15667
  const altPath = resolve7(client.cwd, configName);
@@ -49597,7 +49700,7 @@ async function metrics(client) {
49597
49700
  return 0;
49598
49701
  }
49599
49702
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
49600
- const schemaFn = (await import("./chunks/schema-2IIWOBSQ.js")).default;
49703
+ const schemaFn = (await import("./chunks/schema-G2PAXPVA.js")).default;
49601
49704
  return schemaFn(client, telemetry2);
49602
49705
  }
49603
49706
  default: {
@@ -49610,7 +49713,7 @@ async function metrics(client) {
49610
49713
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
49611
49714
  return 2;
49612
49715
  }
49613
- const queryFn = (await import("./chunks/query-3EV66DO3.js")).default;
49716
+ const queryFn = (await import("./chunks/query-QS4VKBXJ.js")).default;
49614
49717
  return queryFn(client, telemetry2);
49615
49718
  }
49616
49719
  }
@@ -60190,7 +60293,7 @@ async function main26(client) {
60190
60293
  return 2;
60191
60294
  }
60192
60295
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
60193
- return (await import("./chunks/edit-SFIEOQ24.js")).default(client, args);
60296
+ return (await import("./chunks/edit-7JUDPVXD.js")).default(client, args);
60194
60297
  case "delete":
60195
60298
  if (needHelp) {
60196
60299
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60198,7 +60301,7 @@ async function main26(client) {
60198
60301
  return 2;
60199
60302
  }
60200
60303
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
60201
- return (await import("./chunks/delete-VOSJLNEA.js")).default(client, args);
60304
+ return (await import("./chunks/delete-2EIVGM6P.js")).default(client, args);
60202
60305
  case "enable":
60203
60306
  if (needHelp) {
60204
60307
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60206,7 +60309,7 @@ async function main26(client) {
60206
60309
  return 2;
60207
60310
  }
60208
60311
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
60209
- return (await import("./chunks/enable-6UVH35WC.js")).default(client, args);
60312
+ return (await import("./chunks/enable-HLTA35QL.js")).default(client, args);
60210
60313
  case "disable":
60211
60314
  if (needHelp) {
60212
60315
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60214,7 +60317,7 @@ async function main26(client) {
60214
60317
  return 2;
60215
60318
  }
60216
60319
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
60217
- return (await import("./chunks/disable-LQDEVRQF.js")).default(client, args);
60320
+ return (await import("./chunks/disable-M3Q6BBB7.js")).default(client, args);
60218
60321
  case "reorder":
60219
60322
  if (needHelp) {
60220
60323
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60222,7 +60325,7 @@ async function main26(client) {
60222
60325
  return 2;
60223
60326
  }
60224
60327
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
60225
- return (await import("./chunks/reorder-VA5E5ZJT.js")).default(client, args);
60328
+ return (await import("./chunks/reorder-B5V2P7YM.js")).default(client, args);
60226
60329
  case "export":
60227
60330
  if (needHelp) {
60228
60331
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60230,7 +60333,7 @@ async function main26(client) {
60230
60333
  return 2;
60231
60334
  }
60232
60335
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
60233
- return (await import("./chunks/export-6CEG3CK7.js")).default(client, args);
60336
+ return (await import("./chunks/export-E6XZUFW3.js")).default(client, args);
60234
60337
  case "publish":
60235
60338
  if (needHelp) {
60236
60339
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60238,7 +60341,7 @@ async function main26(client) {
60238
60341
  return 2;
60239
60342
  }
60240
60343
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
60241
- return (await import("./chunks/publish-Z3AQRUCS.js")).default(client, args);
60344
+ return (await import("./chunks/publish-5OVCPS4J.js")).default(client, args);
60242
60345
  case "restore":
60243
60346
  if (needHelp) {
60244
60347
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60246,7 +60349,7 @@ async function main26(client) {
60246
60349
  return 2;
60247
60350
  }
60248
60351
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
60249
- return (await import("./chunks/restore-NEHI5B5P.js")).default(client, args);
60352
+ return (await import("./chunks/restore-O63FZXCL.js")).default(client, args);
60250
60353
  case "discard-staging":
60251
60354
  if (needHelp) {
60252
60355
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -60254,7 +60357,7 @@ async function main26(client) {
60254
60357
  return 2;
60255
60358
  }
60256
60359
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
60257
- return (await import("./chunks/discard-RGV4JKXQ.js")).default(client, args);
60360
+ return (await import("./chunks/discard-3R6ETBPS.js")).default(client, args);
60258
60361
  default:
60259
60362
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG43));
60260
60363
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
@@ -64871,25 +64974,25 @@ async function vcr(client) {
64871
64974
  switch (subcommand) {
64872
64975
  case "ls":
64873
64976
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
64874
- return (await import("./chunks/ls-4QHHVXXD.js")).default(client, args, telemetry2);
64977
+ return (await import("./chunks/ls-BFACWH6C.js")).default(client, args, telemetry2);
64875
64978
  case "inspect":
64876
64979
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
64877
- return (await import("./chunks/inspect-ZFRY3X3H.js")).default(client, args, telemetry2);
64980
+ return (await import("./chunks/inspect-NFOURIGN.js")).default(client, args, telemetry2);
64878
64981
  case "add":
64879
64982
  telemetry2.trackCliSubcommandAdd(subcommandOriginal);
64880
- return (await import("./chunks/add-YRZTDNXX.js")).default(client, args, telemetry2);
64983
+ return (await import("./chunks/add-7PPD4ZUJ.js")).default(client, args, telemetry2);
64881
64984
  case "rm":
64882
64985
  telemetry2.trackCliSubcommandRm(subcommandOriginal);
64883
- return (await import("./chunks/rm-E5ZVLAKO.js")).default(client, args, telemetry2);
64986
+ return (await import("./chunks/rm-N7W3QYWZ.js")).default(client, args, telemetry2);
64884
64987
  case "login":
64885
64988
  telemetry2.trackCliSubcommandLogin(subcommandOriginal);
64886
- return (await import("./chunks/login-DFGYNU3K.js")).default(client, args, telemetry2);
64989
+ return (await import("./chunks/login-FMU4CQOV.js")).default(client, args, telemetry2);
64887
64990
  case "tag":
64888
64991
  telemetry2.trackCliSubcommandTag(subcommandOriginal);
64889
- return (await import("./chunks/tags-ZDVYRHAY.js")).default(client, args, telemetry2);
64992
+ return (await import("./chunks/tags-JFMO63D4.js")).default(client, args, telemetry2);
64890
64993
  case "image":
64891
64994
  telemetry2.trackCliSubcommandImage(subcommandOriginal);
64892
- return (await import("./chunks/image-CQRCD2OE.js")).default(client, args, telemetry2);
64995
+ return (await import("./chunks/image-SIRPPQZT.js")).default(client, args, telemetry2);
64893
64996
  default:
64894
64997
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG49));
64895
64998
  output_manager_default.print(help(vcrCommand, { columns: client.stderr.columns }));
package/dist/index.js CHANGED
@@ -18,18 +18,18 @@ import {
18
18
  require_ci_info,
19
19
  setAutoUpdate,
20
20
  tryOpenApiFallback
21
- } from "./chunks/chunk-2EDWKVNP.js";
21
+ } from "./chunks/chunk-L4WYMJB3.js";
22
22
  import "./chunks/chunk-FGDKMNEN.js";
23
23
  import {
24
24
  getUpdateCommand
25
- } from "./chunks/chunk-RYO6FJFB.js";
25
+ } from "./chunks/chunk-BYQQLGCT.js";
26
26
  import {
27
27
  Client
28
- } from "./chunks/chunk-4PGF367U.js";
28
+ } from "./chunks/chunk-B2MTCHPO.js";
29
29
  import {
30
30
  commandNames,
31
31
  commands
32
- } from "./chunks/chunk-A2TYQBX2.js";
32
+ } from "./chunks/chunk-WANVKOVB.js";
33
33
  import "./chunks/chunk-3VS4DTAU.js";
34
34
  import "./chunks/chunk-GIL3VAUR.js";
35
35
  import "./chunks/chunk-FYQPTH5C.js";
@@ -45,7 +45,7 @@ import {
45
45
  require_semver
46
46
  } from "./chunks/chunk-IB5L4LKZ.js";
47
47
  import "./chunks/chunk-V4RMJKQP.js";
48
- import "./chunks/chunk-NH43BFJ3.js";
48
+ import "./chunks/chunk-EA22NMFU.js";
49
49
  import "./chunks/chunk-DMSLNAVH.js";
50
50
  import "./chunks/chunk-NZRWTCRM.js";
51
51
  import {
@@ -66,7 +66,7 @@ import {
66
66
  require_dist as require_dist2,
67
67
  require_lib,
68
68
  writeToConfigFile
69
- } from "./chunks/chunk-TBR2Q37Y.js";
69
+ } from "./chunks/chunk-TPX7RZBM.js";
70
70
  import {
71
71
  TelemetryClient,
72
72
  TelemetryEventStore,
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- export const version = "57.0.0";
1
+ export const version = "58.0.0";