vercel 54.17.2 → 54.18.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 (62) hide show
  1. package/dist/chunks/{add-ADMRKNTV.js → add-6IFGG2TY.js} +9 -9
  2. package/dist/chunks/chunk-2RVK3DDN.js +224 -0
  3. package/dist/chunks/{chunk-FR2CJ7AV.js → chunk-5ACKBNHW.js} +8 -8
  4. package/dist/chunks/{chunk-CQRLZB3Y.js → chunk-AQIWBG3Y.js} +8 -8
  5. package/dist/chunks/{chunk-U7HYX4V6.js → chunk-AWAUGLOM.js} +4 -4
  6. package/dist/chunks/{chunk-AZP6TNVD.js → chunk-B3VMTJM2.js} +1 -1
  7. package/dist/chunks/{chunk-UZZBWCU2.js → chunk-C6H4BP2L.js} +58 -6
  8. package/dist/chunks/{chunk-YI3JV6GM.js → chunk-CT3OCODK.js} +1 -1
  9. package/dist/chunks/{chunk-3ESVKDUA.js → chunk-DZ65TDY4.js} +1 -1
  10. package/dist/chunks/{chunk-PEJCJXGI.js → chunk-F57GYOKZ.js} +1 -1
  11. package/dist/chunks/{chunk-A6I3RGAN.js → chunk-FOPFOSQM.js} +3 -3
  12. package/dist/chunks/{chunk-RL7DANWP.js → chunk-GZ5KF7HK.js} +5 -5
  13. package/dist/chunks/{chunk-NG53DNDG.js → chunk-HMWVVA4B.js} +1 -1
  14. package/dist/chunks/{chunk-KAICYGS4.js → chunk-IBJBNVZV.js} +1 -1
  15. package/dist/chunks/{chunk-52DDM5F6.js → chunk-JJKW6J63.js} +2 -2
  16. package/dist/chunks/{chunk-WR6JALPR.js → chunk-JWQ37WLT.js} +4 -3
  17. package/dist/chunks/{chunk-64KT5RVX.js → chunk-KQDEJE65.js} +3 -3
  18. package/dist/chunks/{chunk-7CTNFMKH.js → chunk-MUDZFSZC.js} +1 -1
  19. package/dist/chunks/{chunk-ZKAWVYGP.js → chunk-UNIIXDM2.js} +56 -56
  20. package/dist/chunks/{chunk-LUORN5H7.js → chunk-VUVQO3LF.js} +3607 -514
  21. package/dist/chunks/{chunk-NHGCQRK5.js → chunk-X5UROEGN.js} +12 -0
  22. package/dist/chunks/{chunk-2YIEJRSL.js → chunk-X7KGEDKQ.js} +10 -9
  23. package/dist/chunks/{chunk-P4KQ3FJ4.js → chunk-XQQXV6ZZ.js} +1 -0
  24. package/dist/chunks/{chunk-JYTOXUQJ.js → chunk-YHFZKOKK.js} +1 -1
  25. package/dist/chunks/{compile-vercel-config-7IAWGVM7.js → compile-vercel-config-CZH5GU3R.js} +4 -4
  26. package/dist/chunks/{delete-DHYJ7ZYD.js → delete-KZJPJUTT.js} +6 -6
  27. package/dist/chunks/{disable-A4D7SZ6G.js → disable-XXKGGPR5.js} +6 -6
  28. package/dist/chunks/{discard-PRE343AI.js → discard-VFWCCRDF.js} +6 -6
  29. package/dist/chunks/{edit-MWFKADR7.js → edit-RY2KAHX2.js} +7 -7
  30. package/dist/chunks/{enable-6P6TDM6D.js → enable-M2PSCPZH.js} +6 -6
  31. package/dist/chunks/{exec-HI4HF4GY.js → exec-CGBHRYWG.js} +14 -9
  32. package/dist/chunks/{export-WISO5LBX.js → export-U3ZPYBWC.js} +6 -6
  33. package/dist/chunks/fetch-proxy-R3JZNXBZ.js +99 -0
  34. package/dist/chunks/{inspect-EBIQ5XF3.js → inspect-HI7DLEJ2.js} +8 -8
  35. package/dist/chunks/{list-755IMC6Y.js → list-KLZIIRGS.js} +13 -13
  36. package/dist/chunks/{list-OD7KO5BB.js → list-TUYF4LRT.js} +6 -6
  37. package/dist/chunks/{ls-ZSVMQVZX.js → ls-6PFY2I7Q.js} +9 -9
  38. package/dist/chunks/{publish-LMGSRL3X.js → publish-GXWEL4UA.js} +6 -6
  39. package/dist/chunks/{query-WZTKABE4.js → query-SLLJ6OJT.js} +11 -11
  40. package/dist/chunks/{reorder-QK5QJ6TW.js → reorder-VRC6BLJM.js} +6 -6
  41. package/dist/chunks/{restore-VF3HDGON.js → restore-SMXHUGVC.js} +6 -6
  42. package/dist/chunks/{rm-QP57BPQO.js → rm-V7DGLIHX.js} +9 -9
  43. package/dist/chunks/{rule-inspect-ZZJ7SQJF.js → rule-inspect-7AZGYZDI.js} +9 -9
  44. package/dist/chunks/{rules-SUBKFNPR.js → rules-MQBE2RMP.js} +7 -7
  45. package/dist/chunks/{schema-FSQEAUMR.js → schema-EMHEFUMV.js} +6 -6
  46. package/dist/chunks/{update-DDCJ2EDT.js → update-GSQ26HZG.js} +9 -9
  47. package/dist/commands/build/index.js +28 -18
  48. package/dist/commands/deploy/index.js +22 -22
  49. package/dist/commands/dev/index.js +47 -39
  50. package/dist/commands/env/index.js +16 -16
  51. package/dist/commands/link/index.js +13 -13
  52. package/dist/commands/list/index.js +12 -12
  53. package/dist/commands-bulk.js +576 -292
  54. package/dist/fetch-dist-tags.cjs +60 -0
  55. package/dist/get-latest-worker.cjs +6 -56
  56. package/dist/help.js +1 -1
  57. package/dist/index.js +200 -61
  58. package/dist/version.mjs +1 -1
  59. package/package.json +15 -17
  60. package/dist/chunks/chunk-N2T234LO.js +0 -3144
  61. package/dist/chunks/{chunk-3NR6OYDV.js → chunk-LWJWW6ZY.js} +3 -3
  62. package/dist/chunks/{chunk-D7MGZH35.js → chunk-U5FVI3MF.js} +3 -3
@@ -31,7 +31,7 @@ import {
31
31
  runInteractiveEditLoop,
32
32
  stripQuotes,
33
33
  validateActionFlags
34
- } from "./chunks/chunk-PEJCJXGI.js";
34
+ } from "./chunks/chunk-F57GYOKZ.js";
35
35
  import {
36
36
  getRouteVersions
37
37
  } from "./chunks/chunk-AHU7WNL2.js";
@@ -49,10 +49,10 @@ import {
49
49
  parsePosition,
50
50
  parseSubcommandArgs,
51
51
  withGlobalFlags
52
- } from "./chunks/chunk-52DDM5F6.js";
52
+ } from "./chunks/chunk-JJKW6J63.js";
53
53
  import {
54
54
  normalizeRepeatableStringFilters
55
- } from "./chunks/chunk-D7MGZH35.js";
55
+ } from "./chunks/chunk-U5FVI3MF.js";
56
56
  import {
57
57
  OpenApiCache,
58
58
  api,
@@ -65,19 +65,19 @@ import {
65
65
  resolveOpenApiTagForTeamsCli,
66
66
  setAutoUpdate,
67
67
  tryOpenApiFallback
68
- } from "./chunks/chunk-FR2CJ7AV.js";
68
+ } from "./chunks/chunk-5ACKBNHW.js";
69
69
  import {
70
70
  getUpdateCommand,
71
71
  isGlobal
72
- } from "./chunks/chunk-JYTOXUQJ.js";
72
+ } from "./chunks/chunk-YHFZKOKK.js";
73
73
  import {
74
74
  Now,
75
+ addDomain,
75
76
  collectContactInformation,
76
77
  createCertForCns,
77
78
  displayBuildLogs,
78
79
  displayRuntimeLogs,
79
80
  extractDomain,
80
- getDomain,
81
81
  getDomainByName,
82
82
  getDomainPrice,
83
83
  getDomainStatus,
@@ -90,14 +90,14 @@ import {
90
90
  require_format,
91
91
  require_jsonlines,
92
92
  setupDomain
93
- } from "./chunks/chunk-ZKAWVYGP.js";
93
+ } from "./chunks/chunk-UNIIXDM2.js";
94
94
  import {
95
95
  getGlobalPathConfig,
96
96
  persistAuthConfig,
97
97
  readLocalConfig,
98
98
  sleep,
99
99
  writeToConfigFile
100
- } from "./chunks/chunk-CQRLZB3Y.js";
100
+ } from "./chunks/chunk-AQIWBG3Y.js";
101
101
  import "./chunks/chunk-V5P25P7F.js";
102
102
  import {
103
103
  ellipsis,
@@ -125,7 +125,7 @@ import {
125
125
  import {
126
126
  formatEnvironment,
127
127
  validateLsArgs
128
- } from "./chunks/chunk-3ESVKDUA.js";
128
+ } from "./chunks/chunk-DZ65TDY4.js";
129
129
  import {
130
130
  validateJsonOutput
131
131
  } from "./chunks/chunk-XPKWKPWA.js";
@@ -398,7 +398,7 @@ import {
398
398
  webAnalyticsSubcommand,
399
399
  webhooksCommand,
400
400
  whoamiCommand
401
- } from "./chunks/chunk-UZZBWCU2.js";
401
+ } from "./chunks/chunk-C6H4BP2L.js";
402
402
  import {
403
403
  metricsCommand,
404
404
  schemaSubcommand
@@ -419,6 +419,10 @@ import {
419
419
  restoreSubcommand as restoreSubcommand2,
420
420
  routesCommand
421
421
  } from "./chunks/chunk-IB56QKCM.js";
422
+ import {
423
+ activityCommand,
424
+ typesSubcommand
425
+ } from "./chunks/chunk-56AJHIQC.js";
422
426
  import {
423
427
  alertsCommand,
424
428
  inspectSubcommand,
@@ -433,19 +437,15 @@ import {
433
437
  rulesUpdateSubcommand
434
438
  } from "./chunks/chunk-SGPBULVT.js";
435
439
  import "./chunks/chunk-VKRW77HH.js";
436
- import {
437
- activityCommand,
438
- typesSubcommand
439
- } from "./chunks/chunk-56AJHIQC.js";
440
440
  import "./chunks/chunk-IJJOI63T.js";
441
441
  import {
442
442
  main
443
- } from "./chunks/chunk-RL7DANWP.js";
443
+ } from "./chunks/chunk-GZ5KF7HK.js";
444
444
  import "./chunks/chunk-IB5L4LKZ.js";
445
- import "./chunks/chunk-KAICYGS4.js";
445
+ import "./chunks/chunk-IBJBNVZV.js";
446
446
  import {
447
447
  require_execa
448
- } from "./chunks/chunk-YI3JV6GM.js";
448
+ } from "./chunks/chunk-CT3OCODK.js";
449
449
  import {
450
450
  autoInstallVercelPlugin
451
451
  } from "./chunks/chunk-BRQ6PX3U.js";
@@ -457,22 +457,25 @@ import {
457
457
  } from "./chunks/chunk-VXYGCOKL.js";
458
458
  import {
459
459
  ensureLink
460
- } from "./chunks/chunk-64KT5RVX.js";
461
- import "./chunks/chunk-2YIEJRSL.js";
460
+ } from "./chunks/chunk-KQDEJE65.js";
461
+ import "./chunks/chunk-X7KGEDKQ.js";
462
462
  import {
463
463
  AGENT_ACTION,
464
464
  AGENT_REASON,
465
465
  AGENT_STATUS
466
466
  } from "./chunks/chunk-QH7WYDEP.js";
467
- import "./chunks/chunk-AZP6TNVD.js";
468
- import "./chunks/chunk-NG53DNDG.js";
467
+ import "./chunks/chunk-B3VMTJM2.js";
468
+ import "./chunks/chunk-HMWVVA4B.js";
469
469
  import {
470
470
  detectExplicitScope,
471
471
  getScope
472
- } from "./chunks/chunk-7CTNFMKH.js";
472
+ } from "./chunks/chunk-MUDZFSZC.js";
473
473
  import {
474
474
  help
475
- } from "./chunks/chunk-3NR6OYDV.js";
475
+ } from "./chunks/chunk-LWJWW6ZY.js";
476
+ import {
477
+ table
478
+ } from "./chunks/chunk-LYCSVJIX.js";
476
479
  import {
477
480
  STANDARD_ENVIRONMENTS,
478
481
  VERCEL_CONFIG_EXTENSIONS,
@@ -518,10 +521,7 @@ import {
518
521
  selectAndParseRemoteUrl,
519
522
  selectOrg,
520
523
  ua_default
521
- } from "./chunks/chunk-LUORN5H7.js";
522
- import {
523
- TelemetryClient
524
- } from "./chunks/chunk-Q77ALSXR.js";
524
+ } from "./chunks/chunk-VUVQO3LF.js";
525
525
  import {
526
526
  argvHasNonInteractive,
527
527
  buildCommandWithGlobalFlags,
@@ -532,17 +532,12 @@ import {
532
532
  openUrlInBrowserCommand,
533
533
  outputActionRequired,
534
534
  outputAgentError,
535
+ outputAgentSuccess,
535
536
  shouldEmitNonInteractiveCommandError
536
- } from "./chunks/chunk-NHGCQRK5.js";
537
+ } from "./chunks/chunk-X5UROEGN.js";
537
538
  import {
538
- require_lib as require_lib3
539
- } from "./chunks/chunk-N2T234LO.js";
540
- import {
541
- require_ms
542
- } from "./chunks/chunk-GGP5R3FU.js";
543
- import {
544
- table
545
- } from "./chunks/chunk-LYCSVJIX.js";
539
+ TelemetryClient
540
+ } from "./chunks/chunk-Q77ALSXR.js";
546
541
  import {
547
542
  GLOBAL_CLI_FLAG_NAMES,
548
543
  getCommandNameWithGlobalFlags,
@@ -610,6 +605,10 @@ import {
610
605
  import {
611
606
  pkg_default
612
607
  } from "./chunks/chunk-P4QNYOFB.js";
608
+ import {
609
+ fetch as fetch2,
610
+ toNodeReadable
611
+ } from "./chunks/chunk-2RVK3DDN.js";
613
612
  import {
614
613
  emoji,
615
614
  eraseLines,
@@ -618,6 +617,9 @@ import {
618
617
  prependEmoji,
619
618
  require_dist
620
619
  } from "./chunks/chunk-Z5SBJH6L.js";
620
+ import {
621
+ require_ms
622
+ } from "./chunks/chunk-GGP5R3FU.js";
621
623
  import {
622
624
  require_source
623
625
  } from "./chunks/chunk-S7KYDPEM.js";
@@ -899,7 +901,7 @@ async function activity(client) {
899
901
  return 0;
900
902
  }
901
903
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
902
- const listFn = (await import("./chunks/list-OD7KO5BB.js")).default;
904
+ const listFn = (await import("./chunks/list-TUYF4LRT.js")).default;
903
905
  return listFn(client, telemetry2);
904
906
  }
905
907
  }
@@ -2002,17 +2004,17 @@ async function alerts(client) {
2002
2004
  switch (subcommand) {
2003
2005
  case "inspect": {
2004
2006
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
2005
- const inspectFn = (await import("./chunks/inspect-EBIQ5XF3.js")).default;
2007
+ const inspectFn = (await import("./chunks/inspect-HI7DLEJ2.js")).default;
2006
2008
  return inspectFn(client, args);
2007
2009
  }
2008
2010
  case "rules": {
2009
2011
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
2010
- const rulesFn = (await import("./chunks/rules-SUBKFNPR.js")).default;
2012
+ const rulesFn = (await import("./chunks/rules-MQBE2RMP.js")).default;
2011
2013
  return rulesFn(client, args);
2012
2014
  }
2013
2015
  default: {
2014
2016
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
2015
- const listFn = (await import("./chunks/list-755IMC6Y.js")).default;
2017
+ const listFn = (await import("./chunks/list-KLZIIRGS.js")).default;
2016
2018
  return listFn(client, telemetry2);
2017
2019
  }
2018
2020
  }
@@ -14002,52 +14004,21 @@ async function dns(client) {
14002
14004
  }
14003
14005
 
14004
14006
  // src/commands/domains/add.ts
14005
- var import_chalk59 = __toESM(require_source(), 1);
14006
-
14007
- // src/util/format-ns-table.ts
14008
- var import_chalk56 = __toESM(require_source(), 1);
14009
-
14010
- // src/util/output/chars.ts
14011
- var chars = {
14012
- tick: process.platform === "win32" ? "\u221A" : "\u2714",
14013
- cross: process.platform === "win32" ? "\u2613" : "\u2718"
14014
- };
14015
- var chars_default = chars;
14016
-
14017
- // src/util/format-ns-table.ts
14018
- function formatNSTable(intendedNameservers, currentNameservers, { extraSpace = "" } = {}) {
14019
- const sortedIntended = intendedNameservers.sort();
14020
- const sortedCurrent = currentNameservers.sort();
14021
- const maxLength = Math.max(
14022
- intendedNameservers.length,
14023
- currentNameservers.length
14024
- );
14025
- const rows = [];
14026
- for (let i = 0; i < maxLength; i++) {
14027
- rows.push([
14028
- sortedIntended[i] || import_chalk56.default.gray("-"),
14029
- sortedCurrent[i] || import_chalk56.default.gray("-"),
14030
- sortedIntended[i] === sortedCurrent[i] ? import_chalk56.default.green(chars_default.tick) : import_chalk56.default.red(chars_default.cross)
14031
- ]);
14032
- }
14033
- return table(
14034
- [
14035
- [
14036
- import_chalk56.default.gray("Intended Nameservers"),
14037
- import_chalk56.default.gray("Current Nameservers"),
14038
- ""
14039
- ],
14040
- ...rows
14041
- ],
14042
- { hsep: 4 }
14043
- ).replace(/^(.*)/gm, `${extraSpace}$1`);
14044
- }
14007
+ var import_chalk58 = __toESM(require_source(), 1);
14045
14008
 
14046
14009
  // src/util/domains/is-public-suffix.ts
14047
14010
  function isPublicSuffix(domainName) {
14048
14011
  return domainName.endsWith(".vercel.app") || domainName.endsWith(".now.sh");
14049
14012
  }
14050
14013
 
14014
+ // src/util/is-root-domain.ts
14015
+ var import_tldts5 = __toESM(require_cjs(), 1);
14016
+ function isRootDomain(domainName) {
14017
+ const parsedDomain = (0, import_tldts5.parse)(domainName);
14018
+ const { domain: rootDomain, subdomain } = parsedDomain;
14019
+ return Boolean(!subdomain && rootDomain);
14020
+ }
14021
+
14051
14022
  // src/util/domains/get-domain-config.ts
14052
14023
  async function getDomainConfig(client, domainName) {
14053
14024
  try {
@@ -14064,10 +14035,10 @@ async function getDomainConfig(client, domainName) {
14064
14035
  }
14065
14036
 
14066
14037
  // src/util/projects/add-domain-to-project.ts
14067
- var import_chalk57 = __toESM(require_source(), 1);
14038
+ var import_chalk56 = __toESM(require_source(), 1);
14068
14039
  async function addDomainToProject(client, projectNameOrId, domain2) {
14069
14040
  output_manager_default.spinner(
14070
- `Adding domain ${domain2} to project ${import_chalk57.default.bold(projectNameOrId)}`
14041
+ `Adding domain ${domain2} to project ${import_chalk56.default.bold(projectNameOrId)}`
14071
14042
  );
14072
14043
  try {
14073
14044
  const response = await client.fetch(
@@ -14097,11 +14068,44 @@ async function addDomainToProject(client, projectNameOrId, domain2) {
14097
14068
  }
14098
14069
  }
14099
14070
 
14071
+ // src/util/projects/get-project-domain.ts
14072
+ function getProjectDomain(client, projectIdOrName, domainName, options = {}) {
14073
+ return fetchProjectDomain(
14074
+ client,
14075
+ `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}`,
14076
+ options
14077
+ );
14078
+ }
14079
+ function getProjectDomainByName(client, domainName, options = {}) {
14080
+ return fetchProjectDomain(
14081
+ client,
14082
+ `/project-domains/${encodeURIComponent(domainName)}`,
14083
+ options
14084
+ );
14085
+ }
14086
+ function verifyProjectDomain(client, projectIdOrName, domainName, options = {}) {
14087
+ return fetchProjectDomain(
14088
+ client,
14089
+ `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}/verify`,
14090
+ { ...options, method: "POST" }
14091
+ );
14092
+ }
14093
+ async function fetchProjectDomain(client, url, init2) {
14094
+ try {
14095
+ return await client.fetch(url, init2);
14096
+ } catch (err) {
14097
+ if (isAPIError(err) && err.status < 500) {
14098
+ return err;
14099
+ }
14100
+ throw err;
14101
+ }
14102
+ }
14103
+
14100
14104
  // src/util/projects/remove-domain-from-project.ts
14101
- var import_chalk58 = __toESM(require_source(), 1);
14105
+ var import_chalk57 = __toESM(require_source(), 1);
14102
14106
  async function removeDomainFromProject(client, projectNameOrId, domain2) {
14103
14107
  output_manager_default.spinner(
14104
- `Removing domain ${domain2} from project ${import_chalk58.default.bold(projectNameOrId)}`
14108
+ `Removing domain ${domain2} from project ${import_chalk57.default.bold(projectNameOrId)}`
14105
14109
  );
14106
14110
  try {
14107
14111
  const response = await client.fetch(
@@ -14153,7 +14157,7 @@ function withGlobalFlags5(client, commandTemplate) {
14153
14157
  return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
14154
14158
  }
14155
14159
  var VERCEL_DOMAINS_DASHBOARD = "https://vercel.com/dashboard/domains";
14156
- function nextCommandsForDomainsAddFailure(client, domainName, projectName, err, linkedProject) {
14160
+ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err) {
14157
14161
  const next = [
14158
14162
  {
14159
14163
  command: withGlobalFlags5(client, `domains inspect ${domainName}`),
@@ -14180,15 +14184,62 @@ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err,
14180
14184
  when: "to open the Domains dashboard in your browser"
14181
14185
  });
14182
14186
  }
14183
- if (aliasConflict && !looksLikeOwnershipOrPurchaseIssue) {
14184
- const forceCmd = linkedProject ? `domains add ${domainName} --force` : `domains add ${domainName} ${projectName} --force`;
14187
+ if (aliasConflict && !looksLikeOwnershipOrPurchaseIssue && projectName) {
14185
14188
  next.push({
14186
- command: withGlobalFlags5(client, forceCmd),
14189
+ command: withGlobalFlags5(
14190
+ client,
14191
+ `domains add ${domainName} ${projectName} --force`
14192
+ ),
14187
14193
  when: "to force move from another project (only if API returns project id\u2014otherwise remove domain from the other project first)"
14188
14194
  });
14189
14195
  }
14190
14196
  return next;
14191
14197
  }
14198
+ function nextCommandsForDomainsAddSuccess(client, domainName, projectName) {
14199
+ if (!projectName) {
14200
+ return [
14201
+ {
14202
+ command: withGlobalFlags5(client, `domains add ${domainName} <project>`),
14203
+ when: "to attach this domain to a project"
14204
+ },
14205
+ {
14206
+ command: withGlobalFlags5(client, `domains inspect ${domainName}`),
14207
+ when: "to inspect domain configuration and ownership"
14208
+ }
14209
+ ];
14210
+ }
14211
+ return [
14212
+ {
14213
+ command: withGlobalFlags5(client, `domains verify ${domainName}`),
14214
+ when: "to check DNS configuration and see the records you need to set"
14215
+ },
14216
+ {
14217
+ command: withGlobalFlags5(client, `domains inspect ${domainName}`),
14218
+ when: "to inspect domain configuration and ownership"
14219
+ }
14220
+ ];
14221
+ }
14222
+ async function printDomainConfiguration(client, domainName) {
14223
+ if (isPublicSuffix(domainName)) {
14224
+ output_manager_default.log(
14225
+ "The domain will automatically get assigned to your latest production deployment."
14226
+ );
14227
+ return 0;
14228
+ }
14229
+ const domainConfig = await getDomainConfig(client, domainName);
14230
+ if (!(domainConfig instanceof Error) && domainConfig.misconfigured) {
14231
+ output_manager_default.warn(
14232
+ `This domain is not configured properly. Run ${getCommandName(
14233
+ `domains verify ${domainName}`
14234
+ )} to see how to configure it.`
14235
+ );
14236
+ } else {
14237
+ output_manager_default.log(
14238
+ "The domain will automatically get assigned to your latest production deployment."
14239
+ );
14240
+ }
14241
+ return 0;
14242
+ }
14192
14243
  async function add5(client, argv) {
14193
14244
  const telemetry2 = new DomainsAddTelemetryClient({
14194
14245
  opts: {
@@ -14218,25 +14269,20 @@ async function add5(client, argv) {
14218
14269
  const force = opts["--force"];
14219
14270
  telemetry2.trackCliFlagForce(force);
14220
14271
  const { contextName } = await getScope(client);
14221
- const project = await getLinkedProject(client).then((result) => {
14222
- if (result.status === "linked") {
14223
- return result.project;
14224
- }
14225
- return null;
14226
- });
14227
- if (project && args.length !== 1) {
14272
+ if (args.length < 1 || args.length > 2) {
14228
14273
  if (client.nonInteractive) {
14274
+ const cmd2 = withGlobalFlags5(client, "domains add <domain> [project]");
14229
14275
  outputActionRequired(
14230
14276
  client,
14231
14277
  {
14232
14278
  status: "action_required",
14233
14279
  reason: "missing_arguments",
14234
14280
  action: "missing_arguments",
14235
- message: `Linked project is "${project.name}". Run: ${withGlobalFlags5(client, `domains add <domain>`)}`,
14281
+ message: `Run: ${cmd2}`,
14236
14282
  next: [
14237
14283
  {
14238
- command: withGlobalFlags5(client, `domains add <domain>`),
14239
- when: "to add a domain to the linked project (single argument)"
14284
+ command: cmd2,
14285
+ when: "to add a domain to your team, or pass a project name to assign it to a project"
14240
14286
  }
14241
14287
  ]
14242
14288
  },
@@ -14244,67 +14290,209 @@ async function add5(client, argv) {
14244
14290
  );
14245
14291
  }
14246
14292
  output_manager_default.error(
14247
- `${getCommandName("domains add <domain>")} expects one argument.`
14293
+ `${getCommandName(
14294
+ "domains add <domain> [project]"
14295
+ )} expects one or two arguments.`
14248
14296
  );
14249
14297
  return 1;
14250
14298
  }
14251
- if (!project && args.length !== 2) {
14299
+ const domainName = String(args[0]);
14300
+ const projectName = args.length === 2 ? String(args[1]) : void 0;
14301
+ telemetry2.trackCliArgumentDomain(domainName);
14302
+ telemetry2.trackCliArgumentProject(args[1]);
14303
+ if (!projectName) {
14304
+ if (!isPublicSuffix(domainName) && !isRootDomain(domainName)) {
14305
+ const cmd2 = withGlobalFlags5(
14306
+ client,
14307
+ `domains add ${domainName} <project>`
14308
+ );
14309
+ const message = `Only apex domains can be added without a project. To add the subdomain ${domainName}, pass a project: ${cmd2}`;
14310
+ if (client.nonInteractive) {
14311
+ outputActionRequired(
14312
+ client,
14313
+ {
14314
+ status: "action_required",
14315
+ reason: "project_required_for_subdomain",
14316
+ action: "add_with_project",
14317
+ message,
14318
+ next: [
14319
+ {
14320
+ command: cmd2,
14321
+ when: "to add this subdomain to a specific project"
14322
+ }
14323
+ ]
14324
+ },
14325
+ 1
14326
+ );
14327
+ }
14328
+ output_manager_default.error(message);
14329
+ return 1;
14330
+ }
14331
+ const addStamp2 = stamp_default();
14332
+ let addResult;
14333
+ try {
14334
+ addResult = await addDomain(client, domainName, contextName);
14335
+ } catch (err) {
14336
+ const error = err instanceof Error ? err : new Error(String(err));
14337
+ if (client.nonInteractive) {
14338
+ const status3 = isAPIError(error) ? error.status : void 0;
14339
+ const apiErr = error;
14340
+ const code2 = typeof apiErr.code === "string" ? apiErr.code : "";
14341
+ const msg = error.message.toLowerCase();
14342
+ let reason = status3 === 403 ? "forbidden" : status3 === 404 ? "not_found" : status3 === 409 || msg.includes("already") ? "alias_conflict" : "domain_add_failed";
14343
+ if (code2 === "not_domain_owner" || status3 === 403 && msg.includes("not authorized")) {
14344
+ reason = "domain_not_owned";
14345
+ }
14346
+ let message = (0, import_error_utils8.errorToString)(error);
14347
+ if (reason === "domain_not_owned" || code2 === "invalid_domain" || msg.includes("not authorized to use")) {
14348
+ message += " domains add is for domains you already own or control via DNS. If you have not purchased the domain yet, the user must run 'domains buy' interactively (agents must not purchase) or buy in the dashboard; use 'domains transfer-in' to move an existing registration to Vercel.";
14349
+ }
14350
+ outputAgentError(
14351
+ client,
14352
+ {
14353
+ status: "error",
14354
+ reason,
14355
+ message,
14356
+ next: nextCommandsForDomainsAddFailure(
14357
+ client,
14358
+ domainName,
14359
+ "",
14360
+ error
14361
+ )
14362
+ },
14363
+ 1
14364
+ );
14365
+ }
14366
+ output_manager_default.prettyError(error);
14367
+ return 1;
14368
+ }
14369
+ if (addResult instanceof InvalidDomain) {
14370
+ if (client.nonInteractive) {
14371
+ outputAgentError(
14372
+ client,
14373
+ {
14374
+ status: "error",
14375
+ reason: "invalid_domain",
14376
+ message: (0, import_error_utils8.errorToString)(addResult)
14377
+ },
14378
+ 1
14379
+ );
14380
+ }
14381
+ output_manager_default.prettyError(addResult);
14382
+ return 1;
14383
+ }
14384
+ if (addResult instanceof DomainAlreadyExists) {
14385
+ if (client.nonInteractive) {
14386
+ outputAgentError(
14387
+ client,
14388
+ {
14389
+ status: "error",
14390
+ reason: "domain_already_exists",
14391
+ message: (0, import_error_utils8.errorToString)(addResult)
14392
+ },
14393
+ 1
14394
+ );
14395
+ }
14396
+ output_manager_default.prettyError(addResult);
14397
+ return 1;
14398
+ }
14252
14399
  if (client.nonInteractive) {
14253
- const cmd2 = withGlobalFlags5(client, "domains add <domain> <project>");
14254
- outputActionRequired(
14400
+ outputAgentSuccess(
14255
14401
  client,
14256
14402
  {
14257
- status: "action_required",
14258
- reason: "missing_arguments",
14259
- action: "missing_arguments",
14260
- message: `No linked project and domain needs a project. Run: ${cmd2}`,
14261
- next: [
14262
- {
14263
- command: cmd2,
14264
- when: "to add a domain to a project (or link a project first)"
14265
- }
14266
- ]
14403
+ status: "success",
14404
+ reason: "domain_added",
14405
+ message: `Domain ${domainName} added to ${contextName}.`,
14406
+ next: nextCommandsForDomainsAddSuccess(client, domainName)
14267
14407
  },
14268
- 1
14408
+ 0
14269
14409
  );
14270
14410
  }
14271
- output_manager_default.error(
14272
- `${getCommandName(
14273
- "domains add <domain> <project>"
14274
- )} expects two arguments.`
14411
+ output_manager_default.success(
14412
+ `Domain ${import_chalk58.default.bold(domainName)} added to ${import_chalk58.default.bold(
14413
+ contextName
14414
+ )}. ${addStamp2()}`
14275
14415
  );
14276
- return 1;
14416
+ return 0;
14277
14417
  }
14278
- const domainName = String(args[0]);
14279
- const projectName = project ? project.name : String(args[1]);
14280
- telemetry2.trackCliArgumentDomain(domainName);
14281
- telemetry2.trackCliArgumentProject(args[1]);
14282
14418
  const addStamp = stamp_default();
14283
14419
  let aliasTarget = await addDomainToProject(client, projectName, domainName);
14284
14420
  if (aliasTarget instanceof Error) {
14285
- if (aliasTarget instanceof APIError && aliasTarget.code === "ALIAS_DOMAIN_EXIST" && aliasTarget.project && aliasTarget.project.id) {
14286
- if (force) {
14287
- const removeResponse = await removeDomainFromProject(
14421
+ if (aliasTarget instanceof APIError && aliasTarget.code === "ALIAS_DOMAIN_EXIST") {
14422
+ const conflictProject = aliasTarget.project;
14423
+ let alreadyOnRequestedProject = Boolean(
14424
+ conflictProject && (conflictProject.id === projectName || conflictProject.name === projectName)
14425
+ );
14426
+ if (!alreadyOnRequestedProject) {
14427
+ const existing = await getProjectDomain(
14288
14428
  client,
14289
- aliasTarget.project.id,
14429
+ projectName,
14290
14430
  domainName
14291
14431
  );
14292
- if (removeResponse instanceof Error) {
14293
- if (client.nonInteractive) {
14294
- outputAgentError(
14295
- client,
14296
- {
14297
- status: "error",
14298
- reason: "domain_remove_failed",
14299
- message: (0, import_error_utils8.errorToString)(removeResponse)
14300
- },
14301
- 1
14302
- );
14432
+ alreadyOnRequestedProject = !(existing instanceof Error);
14433
+ }
14434
+ if (alreadyOnRequestedProject) {
14435
+ if (client.nonInteractive) {
14436
+ outputAgentSuccess(
14437
+ client,
14438
+ {
14439
+ status: "success",
14440
+ reason: "domain_already_assigned",
14441
+ message: `Domain ${domainName} is already assigned to project ${projectName}.`,
14442
+ next: nextCommandsForDomainsAddSuccess(
14443
+ client,
14444
+ domainName,
14445
+ projectName
14446
+ )
14447
+ },
14448
+ 0
14449
+ );
14450
+ }
14451
+ output_manager_default.log(
14452
+ `Domain ${import_chalk58.default.bold(domainName)} is already assigned to project ${import_chalk58.default.bold(
14453
+ projectName
14454
+ )}. ${addStamp()}`
14455
+ );
14456
+ return printDomainConfiguration(client, domainName);
14457
+ }
14458
+ if (force) {
14459
+ let currentProjectId = conflictProject?.id;
14460
+ if (!currentProjectId) {
14461
+ const currentProjectDomain = await getProjectDomainByName(
14462
+ client,
14463
+ domainName
14464
+ );
14465
+ if (!(currentProjectDomain instanceof Error)) {
14466
+ currentProjectId = currentProjectDomain.projectId;
14303
14467
  }
14304
- output_manager_default.prettyError(removeResponse);
14305
- return 1;
14306
14468
  }
14307
- aliasTarget = await addDomainToProject(client, projectName, domainName);
14469
+ if (currentProjectId) {
14470
+ const removeResponse = await removeDomainFromProject(
14471
+ client,
14472
+ currentProjectId,
14473
+ domainName
14474
+ );
14475
+ if (removeResponse instanceof Error) {
14476
+ if (client.nonInteractive) {
14477
+ outputAgentError(
14478
+ client,
14479
+ {
14480
+ status: "error",
14481
+ reason: "domain_remove_failed",
14482
+ message: (0, import_error_utils8.errorToString)(removeResponse)
14483
+ },
14484
+ 1
14485
+ );
14486
+ }
14487
+ output_manager_default.prettyError(removeResponse);
14488
+ return 1;
14489
+ }
14490
+ aliasTarget = await addDomainToProject(
14491
+ client,
14492
+ projectName,
14493
+ domainName
14494
+ );
14495
+ }
14308
14496
  }
14309
14497
  }
14310
14498
  if (aliasTarget instanceof Error) {
@@ -14331,8 +14519,7 @@ async function add5(client, argv) {
14331
14519
  client,
14332
14520
  domainName,
14333
14521
  projectName,
14334
- aliasTarget,
14335
- !!project
14522
+ aliasTarget
14336
14523
  )
14337
14524
  },
14338
14525
  1
@@ -14342,79 +14529,28 @@ async function add5(client, argv) {
14342
14529
  return 1;
14343
14530
  }
14344
14531
  }
14532
+ if (client.nonInteractive) {
14533
+ outputAgentSuccess(
14534
+ client,
14535
+ {
14536
+ status: "success",
14537
+ reason: "domain_added",
14538
+ message: `Domain ${domainName} added to project ${projectName}.`,
14539
+ next: nextCommandsForDomainsAddSuccess(client, domainName, projectName)
14540
+ },
14541
+ 0
14542
+ );
14543
+ }
14345
14544
  output_manager_default.success(
14346
- `Domain ${import_chalk59.default.bold(domainName)} added to project ${import_chalk59.default.bold(
14545
+ `Domain ${import_chalk58.default.bold(domainName)} added to project ${import_chalk58.default.bold(
14347
14546
  projectName
14348
14547
  )}. ${addStamp()}`
14349
14548
  );
14350
- if (isPublicSuffix(domainName)) {
14351
- output_manager_default.log(
14352
- "The domain will automatically get assigned to your latest production deployment."
14353
- );
14354
- return 0;
14355
- }
14356
- const domainResponse = await getDomain(client, contextName, domainName);
14357
- if (domainResponse instanceof Error) {
14358
- if (client.nonInteractive) {
14359
- outputAgentError(
14360
- client,
14361
- {
14362
- status: "error",
14363
- reason: "domain_fetch_failed",
14364
- message: (0, import_error_utils8.errorToString)(domainResponse)
14365
- },
14366
- 1
14367
- );
14368
- }
14369
- output_manager_default.prettyError(domainResponse);
14370
- return 1;
14371
- }
14372
- const domainConfig = await getDomainConfig(client, domainName);
14373
- if (domainConfig.misconfigured) {
14374
- output_manager_default.warn(
14375
- "This domain is not configured properly. To configure it you should either:"
14376
- );
14377
- output_manager_default.print(
14378
- ` ${import_chalk59.default.grey("a)")} Set the following record on your DNS provider to continue: ${code(`A ${domainName} 76.76.21.21`)} ${import_chalk59.default.grey("[recommended]")}
14379
- `
14380
- );
14381
- output_manager_default.print(
14382
- ` ${import_chalk59.default.grey("b)")} Change your Domains's nameservers to the intended set`
14383
- );
14384
- output_manager_default.print(
14385
- `
14386
- ${formatNSTable(
14387
- domainResponse.intendedNameservers,
14388
- domainResponse.nameservers,
14389
- { extraSpace: " " }
14390
- )}
14391
-
14392
- `
14393
- );
14394
- output_manager_default.print(
14395
- " We will run a verification for you and you will receive an email upon completion.\n"
14396
- );
14397
- output_manager_default.print(" Read more: https://vercel.link/domain-configuration\n\n");
14398
- } else {
14399
- output_manager_default.log(
14400
- "The domain will automatically get assigned to your latest production deployment."
14401
- );
14402
- }
14403
- return 0;
14404
- }
14405
-
14406
- // src/commands/domains/check.ts
14407
- var import_chalk60 = __toESM(require_source(), 1);
14408
-
14409
- // src/util/is-root-domain.ts
14410
- var import_tldts5 = __toESM(require_cjs(), 1);
14411
- function isRootDomain(domainName) {
14412
- const parsedDomain = (0, import_tldts5.parse)(domainName);
14413
- const { domain: rootDomain, subdomain } = parsedDomain;
14414
- return Boolean(!subdomain && rootDomain);
14549
+ return printDomainConfiguration(client, domainName);
14415
14550
  }
14416
14551
 
14417
14552
  // src/commands/domains/check.ts
14553
+ var import_chalk59 = __toESM(require_source(), 1);
14418
14554
  async function check(client, argv) {
14419
14555
  let parsedArgs;
14420
14556
  const flagsSpecification = getFlagsSpecification(checkSubcommand.options);
@@ -14496,7 +14632,7 @@ async function check(client, argv) {
14496
14632
  }
14497
14633
  for (const result of results) {
14498
14634
  output_manager_default.log(
14499
- `The domain ${param(result.domain)} is ${import_chalk60.default.underline(
14635
+ `The domain ${param(result.domain)} is ${import_chalk59.default.underline(
14500
14636
  result.available ? "available" : "unavailable"
14501
14637
  )}.`
14502
14638
  );
@@ -14525,7 +14661,7 @@ async function check(client, argv) {
14525
14661
  }
14526
14662
 
14527
14663
  // src/commands/domains/transfer-in.ts
14528
- var import_chalk61 = __toESM(require_source(), 1);
14664
+ var import_chalk60 = __toESM(require_source(), 1);
14529
14665
 
14530
14666
  // src/util/domains/transfer-in-domain.ts
14531
14667
  async function transferInDomain(client, name, authCode, expectedPrice, years) {
@@ -14668,13 +14804,13 @@ async function transferIn(client, argv) {
14668
14804
  }
14669
14805
  const { contextName } = await getScope(client);
14670
14806
  output_manager_default.log(
14671
- `The domain ${param(domainName)} is ${import_chalk61.default.underline(
14807
+ `The domain ${param(domainName)} is ${import_chalk60.default.underline(
14672
14808
  "available"
14673
- )} to transfer under ${import_chalk61.default.bold(contextName)}! ${availableStamp()}`
14809
+ )} to transfer under ${import_chalk60.default.bold(contextName)}! ${availableStamp()}`
14674
14810
  );
14675
14811
  const authCode = await getAuthCode(client, opts["--code"]);
14676
14812
  const shouldTransfer = await client.input.confirm(
14677
- `Transfer now with 1yr renewal for ${import_chalk61.default.bold(`$${transferPrice}`)}?`,
14813
+ `Transfer now with 1yr renewal for ${import_chalk60.default.bold(`$${transferPrice}`)}?`,
14678
14814
  false
14679
14815
  );
14680
14816
  if (!shouldTransfer) {
@@ -14745,6 +14881,45 @@ async function transferIn(client, argv) {
14745
14881
  // src/commands/domains/inspect.ts
14746
14882
  var import_chalk62 = __toESM(require_source(), 1);
14747
14883
 
14884
+ // src/util/format-ns-table.ts
14885
+ var import_chalk61 = __toESM(require_source(), 1);
14886
+
14887
+ // src/util/output/chars.ts
14888
+ var chars = {
14889
+ tick: process.platform === "win32" ? "\u221A" : "\u2714",
14890
+ cross: process.platform === "win32" ? "\u2613" : "\u2718"
14891
+ };
14892
+ var chars_default = chars;
14893
+
14894
+ // src/util/format-ns-table.ts
14895
+ function formatNSTable(intendedNameservers, currentNameservers, { extraSpace = "" } = {}) {
14896
+ const sortedIntended = intendedNameservers.sort();
14897
+ const sortedCurrent = currentNameservers.sort();
14898
+ const maxLength = Math.max(
14899
+ intendedNameservers.length,
14900
+ currentNameservers.length
14901
+ );
14902
+ const rows = [];
14903
+ for (let i = 0; i < maxLength; i++) {
14904
+ rows.push([
14905
+ sortedIntended[i] || import_chalk61.default.gray("-"),
14906
+ sortedCurrent[i] || import_chalk61.default.gray("-"),
14907
+ sortedIntended[i] === sortedCurrent[i] ? import_chalk61.default.green(chars_default.tick) : import_chalk61.default.red(chars_default.cross)
14908
+ ]);
14909
+ }
14910
+ return table(
14911
+ [
14912
+ [
14913
+ import_chalk61.default.gray("Intended Nameservers"),
14914
+ import_chalk61.default.gray("Current Nameservers"),
14915
+ ""
14916
+ ],
14917
+ ...rows
14918
+ ],
14919
+ { hsep: 4 }
14920
+ ).replace(/^(.*)/gm, `${extraSpace}$1`);
14921
+ }
14922
+
14748
14923
  // src/util/projects/find-projects-for-domain.ts
14749
14924
  async function findProjectsForDomain(client, domainName) {
14750
14925
  try {
@@ -16229,39 +16404,6 @@ async function getDomainConfigV6(client, domainName, options = {}) {
16229
16404
  }
16230
16405
  }
16231
16406
 
16232
- // src/util/projects/get-project-domain.ts
16233
- function getProjectDomain(client, projectIdOrName, domainName, options = {}) {
16234
- return fetchProjectDomain(
16235
- client,
16236
- `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}`,
16237
- options
16238
- );
16239
- }
16240
- function getProjectDomainByName(client, domainName, options = {}) {
16241
- return fetchProjectDomain(
16242
- client,
16243
- `/project-domains/${encodeURIComponent(domainName)}`,
16244
- options
16245
- );
16246
- }
16247
- function verifyProjectDomain(client, projectIdOrName, domainName, options = {}) {
16248
- return fetchProjectDomain(
16249
- client,
16250
- `/v9/projects/${encodeURIComponent(projectIdOrName)}/domains/${encodeURIComponent(domainName)}/verify`,
16251
- { ...options, method: "POST" }
16252
- );
16253
- }
16254
- async function fetchProjectDomain(client, url, init2) {
16255
- try {
16256
- return await client.fetch(url, init2);
16257
- } catch (err) {
16258
- if (isAPIError(err) && err.status < 500) {
16259
- return err;
16260
- }
16261
- throw err;
16262
- }
16263
- }
16264
-
16265
16407
  // src/commands/domains/verify-acquisition.ts
16266
16408
  async function acquireVerificationFacts(client, options) {
16267
16409
  const { domainName } = options;
@@ -26023,11 +26165,56 @@ var import_ms13 = __toESM(require_ms(), 1);
26023
26165
  var import_pluralize8 = __toESM(require_pluralize(), 1);
26024
26166
 
26025
26167
  // src/util/flags/get-flags.ts
26026
- async function getFlags(client, projectId, state = "active") {
26168
+ var MAX_FLAGS_PAGE_LIMIT = 100;
26169
+ async function getFlags(client, projectId, options = {}) {
26170
+ const {
26171
+ state = "active",
26172
+ tags,
26173
+ createdBy,
26174
+ maintainerIds,
26175
+ limit,
26176
+ cursor
26177
+ } = options;
26027
26178
  output_manager_default.debug(`Fetching feature flags for project ${projectId}`);
26028
- const url = `/v1/projects/${encodeURIComponent(projectId)}/feature-flags/flags?state=${state}`;
26029
- const response = await client.fetch(url);
26030
- return response.data;
26179
+ const basePath = `/v2/projects/${encodeURIComponent(projectId)}/feature-flags/flags`;
26180
+ const buildQuery = (pageLimit, pageCursor2) => {
26181
+ const query = new URLSearchParams();
26182
+ query.set("state", state);
26183
+ query.set("limit", String(pageLimit));
26184
+ if (pageCursor2) {
26185
+ query.set("cursor", pageCursor2);
26186
+ }
26187
+ if (createdBy) {
26188
+ query.set("createdBy", createdBy);
26189
+ }
26190
+ for (const tag of tags ?? []) {
26191
+ query.append("tags", tag);
26192
+ }
26193
+ for (const maintainerId of maintainerIds ?? []) {
26194
+ query.append("maintainerIds", maintainerId);
26195
+ }
26196
+ return query.toString();
26197
+ };
26198
+ if (limit !== void 0 || cursor !== void 0) {
26199
+ const pageLimit = Math.min(
26200
+ limit ?? MAX_FLAGS_PAGE_LIMIT,
26201
+ MAX_FLAGS_PAGE_LIMIT
26202
+ );
26203
+ const response = await client.fetch(
26204
+ `${basePath}?${buildQuery(pageLimit, cursor)}`
26205
+ );
26206
+ return { flags: response.data, next: response.pagination?.next ?? null };
26207
+ }
26208
+ const flags = [];
26209
+ let pageCursor;
26210
+ do {
26211
+ const response = await client.fetch(
26212
+ `${basePath}?${buildQuery(MAX_FLAGS_PAGE_LIMIT, pageCursor)}`
26213
+ );
26214
+ flags.push(...response.data);
26215
+ pageCursor = response.pagination?.next ?? void 0;
26216
+ } while (pageCursor);
26217
+ return { flags, next: null };
26031
26218
  }
26032
26219
  async function getFlag(client, projectId, flagIdOrSlug) {
26033
26220
  output_manager_default.debug(
@@ -26059,6 +26246,46 @@ var FlagsLsTelemetryClient = class extends TelemetryClient {
26059
26246
  this.trackCliFlag("json");
26060
26247
  }
26061
26248
  }
26249
+ trackCliOptionTag(tags) {
26250
+ if (tags && tags.length > 0) {
26251
+ this.trackCliOption({
26252
+ option: "tag",
26253
+ value: this.redactedValue
26254
+ });
26255
+ }
26256
+ }
26257
+ trackCliOptionCreatedBy(createdBy) {
26258
+ if (createdBy) {
26259
+ this.trackCliOption({
26260
+ option: "created-by",
26261
+ value: this.redactedValue
26262
+ });
26263
+ }
26264
+ }
26265
+ trackCliOptionMaintainerId(maintainerIds) {
26266
+ if (maintainerIds && maintainerIds.length > 0) {
26267
+ this.trackCliOption({
26268
+ option: "maintainer-id",
26269
+ value: this.redactedValue
26270
+ });
26271
+ }
26272
+ }
26273
+ trackCliOptionLimit(limit) {
26274
+ if (limit !== void 0) {
26275
+ this.trackCliOption({
26276
+ option: "limit",
26277
+ value: String(limit)
26278
+ });
26279
+ }
26280
+ }
26281
+ trackCliOptionNext(next) {
26282
+ if (next) {
26283
+ this.trackCliOption({
26284
+ option: "next",
26285
+ value: this.redactedValue
26286
+ });
26287
+ }
26288
+ }
26062
26289
  };
26063
26290
 
26064
26291
  // src/commands/flags/ls.ts
@@ -26078,9 +26305,25 @@ async function ls7(client, argv) {
26078
26305
  }
26079
26306
  const { flags } = parsedArgs;
26080
26307
  const state = flags["--state"] || "active";
26308
+ const tags = flags["--tag"];
26309
+ const createdBy = flags["--created-by"];
26310
+ const maintainerIds = flags["--maintainer-id"];
26311
+ const limit = flags["--limit"];
26312
+ const next = flags["--next"];
26081
26313
  const json = flags["--json"];
26082
26314
  telemetryClient.trackCliOptionState(state);
26315
+ telemetryClient.trackCliOptionTag(tags);
26316
+ telemetryClient.trackCliOptionCreatedBy(createdBy);
26317
+ telemetryClient.trackCliOptionMaintainerId(maintainerIds);
26318
+ telemetryClient.trackCliOptionLimit(limit);
26319
+ telemetryClient.trackCliOptionNext(next);
26083
26320
  telemetryClient.trackCliFlagJson(json);
26321
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > MAX_FLAGS_PAGE_LIMIT)) {
26322
+ output_manager_default.error(
26323
+ `The --limit option must be an integer between 1 and ${MAX_FLAGS_PAGE_LIMIT}.`
26324
+ );
26325
+ return 1;
26326
+ }
26084
26327
  const link = await getLinkedProject(client);
26085
26328
  if (link.status === "error") {
26086
26329
  return link.exitCode;
@@ -26096,11 +26339,21 @@ async function ls7(client, argv) {
26096
26339
  const lsStamp = stamp_default();
26097
26340
  output_manager_default.spinner(`Fetching ${state} feature flags for ${projectSlugLink}`);
26098
26341
  try {
26099
- const flagsList = await getFlags(client, project.id, state);
26342
+ const { flags: flagsList, next: nextCursor } = await getFlags(
26343
+ client,
26344
+ project.id,
26345
+ {
26346
+ state,
26347
+ tags,
26348
+ createdBy,
26349
+ maintainerIds,
26350
+ limit,
26351
+ cursor: next
26352
+ }
26353
+ );
26100
26354
  output_manager_default.stopSpinner();
26101
- const sortedFlags = flagsList.sort((a, b) => b.updatedAt - a.updatedAt);
26102
26355
  if (json) {
26103
- outputJson3(client, sortedFlags);
26356
+ outputJson3(client, flagsList, nextCursor);
26104
26357
  } else if (flagsList.length === 0) {
26105
26358
  output_manager_default.log(
26106
26359
  `No ${state} feature flags found for ${projectSlugLink} ${import_chalk103.default.gray(lsStamp())}`
@@ -26109,7 +26362,16 @@ async function ls7(client, argv) {
26109
26362
  output_manager_default.log(
26110
26363
  `${(0, import_pluralize8.default)("feature flag", flagsList.length, true)} found for ${projectSlugLink} ${import_chalk103.default.gray(lsStamp())}`
26111
26364
  );
26112
- printFlagsTable(sortedFlags);
26365
+ printFlagsTable(flagsList);
26366
+ if (nextCursor) {
26367
+ const nextCmd = buildNextPageCommand(
26368
+ flags,
26369
+ tags,
26370
+ maintainerIds,
26371
+ nextCursor
26372
+ );
26373
+ output_manager_default.log(`To display the next page, run ${getCommandName(nextCmd)}`);
26374
+ }
26113
26375
  }
26114
26376
  } catch (err) {
26115
26377
  output_manager_default.stopSpinner();
@@ -26118,7 +26380,28 @@ async function ls7(client, argv) {
26118
26380
  }
26119
26381
  return 0;
26120
26382
  }
26121
- function outputJson3(client, flags) {
26383
+ function buildNextPageCommand(flags, tags, maintainerIds, nextCursor) {
26384
+ const baseFlags = getCommandFlags(flags, [
26385
+ "_",
26386
+ "--tag",
26387
+ "--maintainer-id",
26388
+ "--next",
26389
+ "--json"
26390
+ ]);
26391
+ const repeatable = [
26392
+ ...(tags ?? []).map((tag) => `--tag ${quoteArg(tag)}`),
26393
+ ...(maintainerIds ?? []).map((id) => `--maintainer-id ${quoteArg(id)}`)
26394
+ ];
26395
+ const suffix = repeatable.length > 0 ? ` ${repeatable.join(" ")}` : "";
26396
+ return `flags ls${baseFlags}${suffix} --next ${nextCursor}`;
26397
+ }
26398
+ function quoteArg(value) {
26399
+ if (/^[A-Za-z0-9_./@:-]+$/.test(value)) {
26400
+ return value;
26401
+ }
26402
+ return `'${value.replace(/'/g, `'\\''`)}'`;
26403
+ }
26404
+ function outputJson3(client, flags, next) {
26122
26405
  const jsonOutput = {
26123
26406
  flags: flags.map((flag) => ({
26124
26407
  id: flag.id,
@@ -26129,7 +26412,8 @@ function outputJson3(client, flags) {
26129
26412
  variants: flag.variants,
26130
26413
  createdAt: flag.createdAt,
26131
26414
  updatedAt: flag.updatedAt
26132
- }))
26415
+ })),
26416
+ pagination: { next }
26133
26417
  };
26134
26418
  client.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
26135
26419
  `);
@@ -32826,10 +33110,11 @@ async function extractExample(client, name, dir, force, ver = "v2") {
32826
33110
  }
32827
33111
  await new Promise((resolve9, reject) => {
32828
33112
  const extractor = import_tar_fs.default.extract(folder);
32829
- res.body.on("error", reject);
33113
+ const body = toNodeReadable(res.body);
33114
+ body.on("error", reject);
32830
33115
  extractor.on("error", reject);
32831
33116
  extractor.on("finish", resolve9);
32832
- res.body.pipe(extractor);
33117
+ body.pipe(extractor);
32833
33118
  });
32834
33119
  const successLog = `Initialized "${import_chalk131.default.bold(
32835
33120
  name
@@ -34163,7 +34448,7 @@ async function claim(client, argv) {
34163
34448
  telemetry2.trackCliFlagNoWait(noWait);
34164
34449
  if (parsedArguments.args.length > 1) {
34165
34450
  output_manager_default.error(
34166
- "Too many arguments. Usage: `vercel integration-resource claim [name]`."
34451
+ "Too many arguments. Usage: `vercel integration resource claim [name]`."
34167
34452
  );
34168
34453
  return 1;
34169
34454
  }
@@ -35368,24 +35653,24 @@ Re-run with --installation-id to select one, e.g.:
35368
35653
  });
35369
35654
  } else {
35370
35655
  output_manager_default.warn(
35371
- `Could not locate the newly provisioned resource. Run \`${packageName} integration-resource claim ${resourceName}\` to claim it.`
35656
+ `Could not locate the newly provisioned resource. Run \`${packageName} integration resource claim ${resourceName}\` to claim it.`
35372
35657
  );
35373
35658
  }
35374
35659
  } catch (error) {
35375
35660
  output_manager_default.warn(
35376
- `Failed to start claim flow: ${error.message}. Run \`${packageName} integration-resource claim ${resourceName}\` to retry.`
35661
+ `Failed to start claim flow: ${error.message}. Run \`${packageName} integration resource claim ${resourceName}\` to retry.`
35377
35662
  );
35378
35663
  }
35379
35664
  }
35380
35665
  } else {
35381
35666
  output_manager_default.log(
35382
- `Sandbox resource \u2014 claim it with: ${import_chalk138.default.cyan(`vercel integration-resource claim ${resourceName}`)}`
35667
+ `Sandbox resource \u2014 claim it with: ${import_chalk138.default.cyan(`vercel integration resource claim ${resourceName}`)}`
35383
35668
  );
35384
35669
  }
35385
35670
  } else if (isSandbox && options.noClaim) {
35386
35671
  telemetry2.trackCliFlagNoClaim(options.noClaim);
35387
35672
  output_manager_default.log(
35388
- `Sandbox resource \u2014 claim it later with: ${import_chalk138.default.cyan(`vercel integration-resource claim ${resourceName}`)}`
35673
+ `Sandbox resource \u2014 claim it later with: ${import_chalk138.default.cyan(`vercel integration resource claim ${resourceName}`)}`
35389
35674
  );
35390
35675
  }
35391
35676
  const guideSlug = integration.products.length > 1 ? `${integration.slug}/${product.slug}` : integration.slug;
@@ -37230,12 +37515,12 @@ async function remove5(client, argv) {
37230
37515
  status: "error",
37231
37516
  reason: AGENT_REASON.MISSING_ARGUMENTS,
37232
37517
  message,
37233
- hint: `Put global flags first, then \`integration-resource remove <resource> --yes\`. Use \`--disconnect-all\` to detach projects before delete.`,
37518
+ hint: `Put global flags first, then \`integration resource remove <resource> --yes\`. Use \`--disconnect-all\` to detach projects before delete.`,
37234
37519
  next: [
37235
37520
  {
37236
37521
  command: buildCommandWithGlobalFlags(
37237
37522
  client.argv,
37238
- "integration-resource remove <resource> --yes",
37523
+ "integration resource remove <resource> --yes",
37239
37524
  packageName,
37240
37525
  suggestRemoveOpts
37241
37526
  ),
@@ -37257,12 +37542,12 @@ async function remove5(client, argv) {
37257
37542
  status: "error",
37258
37543
  reason: AGENT_REASON.INVALID_ARGUMENTS,
37259
37544
  message,
37260
- hint: `One resource per invocation: \`${packageName} [global flags] integration-resource remove <resource> [--disconnect-all] --yes\`.`,
37545
+ hint: `One resource per invocation: \`${packageName} [global flags] integration resource remove <resource> [--disconnect-all] --yes\`.`,
37261
37546
  next: [
37262
37547
  {
37263
37548
  command: buildCommandWithGlobalFlags(
37264
37549
  client.argv,
37265
- "integration-resource remove <resource> --disconnect-all --yes",
37550
+ "integration resource remove <resource> --disconnect-all --yes",
37266
37551
  packageName,
37267
37552
  suggestRemoveOpts
37268
37553
  ),
@@ -37644,7 +37929,7 @@ ${table(
37644
37929
  const noun = sandboxCount === 1 ? "resource" : "resources";
37645
37930
  output_manager_default.log(`${sandboxCount} sandbox ${noun} can be claimed.`);
37646
37931
  output_manager_default.print(
37647
- ` Run \`${packageName} integration-resource claim <name>\` to claim one.
37932
+ ` Run \`${packageName} integration resource claim <name>\` to claim one.
37648
37933
  `
37649
37934
  );
37650
37935
  }
@@ -38020,12 +38305,12 @@ async function remove6(client, argv) {
38020
38305
  error: "has_resources",
38021
38306
  message: `Cannot uninstall ${integrationName} because it still has resources.`,
38022
38307
  resources: resourceNames,
38023
- hint: client.isAgent ? `${approvalHint} Agents must obtain explicit user approval before running integration-resource remove.` : approvalHint,
38308
+ hint: client.isAgent ? `${approvalHint} Agents must obtain explicit user approval before running integration resource remove.` : approvalHint,
38024
38309
  userActionRequired: client.isAgent ? true : void 0,
38025
38310
  next: resourceNames.map((name) => ({
38026
38311
  command: buildCommandWithGlobalFlags(
38027
38312
  client.argv,
38028
- `integration-resource remove ${name} ${resourceTail}`,
38313
+ `integration resource remove ${name} ${resourceTail}`,
38029
38314
  packageName,
38030
38315
  suggestNextOpts
38031
38316
  ),
@@ -38059,7 +38344,7 @@ async function remove6(client, argv) {
38059
38344
  );
38060
38345
  }
38061
38346
  output_manager_default.log(
38062
- `Remove and disconnect all resources first with: ${import_chalk149.default.cyan(`${packageName} integration-resource remove <resource-name> --disconnect-all`)}`
38347
+ `Remove and disconnect all resources first with: ${import_chalk149.default.cyan(`${packageName} integration resource remove <resource-name> --disconnect-all`)}`
38063
38348
  );
38064
38349
  output_manager_default.log(
38065
38350
  `Then retry: ${import_chalk149.default.cyan(`${packageName} integration remove ${integrationName}`)}`
@@ -41266,7 +41551,7 @@ async function metrics(client) {
41266
41551
  return 0;
41267
41552
  }
41268
41553
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
41269
- const schemaFn = (await import("./chunks/schema-FSQEAUMR.js")).default;
41554
+ const schemaFn = (await import("./chunks/schema-EMHEFUMV.js")).default;
41270
41555
  return schemaFn(client, telemetry2);
41271
41556
  }
41272
41557
  default: {
@@ -41279,7 +41564,7 @@ async function metrics(client) {
41279
41564
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
41280
41565
  return 2;
41281
41566
  }
41282
- const queryFn = (await import("./chunks/query-WZTKABE4.js")).default;
41567
+ const queryFn = (await import("./chunks/query-SLLJ6OJT.js")).default;
41283
41568
  return queryFn(client, telemetry2);
41284
41569
  }
41285
41570
  }
@@ -47411,7 +47696,6 @@ async function add10(client, argv) {
47411
47696
  var import_chalk183 = __toESM(require_source(), 1);
47412
47697
  import { readFileSync as readFileSync4 } from "fs";
47413
47698
  import { basename as basename2 } from "path";
47414
- import FormData from "form-data";
47415
47699
 
47416
47700
  // src/commands/redirects/validate-redirects.ts
47417
47701
  import { statSync as statSync2 } from "fs";
@@ -47657,13 +47941,13 @@ async function upload(client, argv) {
47657
47941
  if (versionName) {
47658
47942
  form.append("name", versionName);
47659
47943
  }
47660
- form.append("bulkRedirectsFile", csvContent, {
47661
- filename: fileName,
47662
- contentType: "text/csv"
47663
- });
47944
+ form.append(
47945
+ "bulkRedirectsFile",
47946
+ new Blob([new Uint8Array(csvContent)], { type: "text/csv" }),
47947
+ fileName
47948
+ );
47664
47949
  result = await client.fetch(url, {
47665
47950
  method: "PUT",
47666
- headers: form.getHeaders(),
47667
47951
  body: form
47668
47952
  });
47669
47953
  } else {
@@ -52190,7 +52474,7 @@ async function main27(client) {
52190
52474
  return 2;
52191
52475
  }
52192
52476
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
52193
- return (await import("./chunks/edit-MWFKADR7.js")).default(client, args);
52477
+ return (await import("./chunks/edit-RY2KAHX2.js")).default(client, args);
52194
52478
  case "delete":
52195
52479
  if (needHelp) {
52196
52480
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52198,7 +52482,7 @@ async function main27(client) {
52198
52482
  return 2;
52199
52483
  }
52200
52484
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
52201
- return (await import("./chunks/delete-DHYJ7ZYD.js")).default(client, args);
52485
+ return (await import("./chunks/delete-KZJPJUTT.js")).default(client, args);
52202
52486
  case "enable":
52203
52487
  if (needHelp) {
52204
52488
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52206,7 +52490,7 @@ async function main27(client) {
52206
52490
  return 2;
52207
52491
  }
52208
52492
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
52209
- return (await import("./chunks/enable-6P6TDM6D.js")).default(client, args);
52493
+ return (await import("./chunks/enable-M2PSCPZH.js")).default(client, args);
52210
52494
  case "disable":
52211
52495
  if (needHelp) {
52212
52496
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52214,7 +52498,7 @@ async function main27(client) {
52214
52498
  return 2;
52215
52499
  }
52216
52500
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
52217
- return (await import("./chunks/disable-A4D7SZ6G.js")).default(client, args);
52501
+ return (await import("./chunks/disable-XXKGGPR5.js")).default(client, args);
52218
52502
  case "reorder":
52219
52503
  if (needHelp) {
52220
52504
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52222,7 +52506,7 @@ async function main27(client) {
52222
52506
  return 2;
52223
52507
  }
52224
52508
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
52225
- return (await import("./chunks/reorder-QK5QJ6TW.js")).default(client, args);
52509
+ return (await import("./chunks/reorder-VRC6BLJM.js")).default(client, args);
52226
52510
  case "export":
52227
52511
  if (needHelp) {
52228
52512
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52230,7 +52514,7 @@ async function main27(client) {
52230
52514
  return 2;
52231
52515
  }
52232
52516
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
52233
- return (await import("./chunks/export-WISO5LBX.js")).default(client, args);
52517
+ return (await import("./chunks/export-U3ZPYBWC.js")).default(client, args);
52234
52518
  case "publish":
52235
52519
  if (needHelp) {
52236
52520
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52238,7 +52522,7 @@ async function main27(client) {
52238
52522
  return 2;
52239
52523
  }
52240
52524
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
52241
- return (await import("./chunks/publish-LMGSRL3X.js")).default(client, args);
52525
+ return (await import("./chunks/publish-GXWEL4UA.js")).default(client, args);
52242
52526
  case "restore":
52243
52527
  if (needHelp) {
52244
52528
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52246,7 +52530,7 @@ async function main27(client) {
52246
52530
  return 2;
52247
52531
  }
52248
52532
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
52249
- return (await import("./chunks/restore-VF3HDGON.js")).default(client, args);
52533
+ return (await import("./chunks/restore-SMXHUGVC.js")).default(client, args);
52250
52534
  case "discard-staging":
52251
52535
  if (needHelp) {
52252
52536
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -52254,7 +52538,7 @@ async function main27(client) {
52254
52538
  return 2;
52255
52539
  }
52256
52540
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
52257
- return (await import("./chunks/discard-PRE343AI.js")).default(client, args);
52541
+ return (await import("./chunks/discard-VFWCCRDF.js")).default(client, args);
52258
52542
  default:
52259
52543
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG37));
52260
52544
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
@@ -54995,12 +55279,11 @@ async function disable5(client) {
54995
55279
  }
54996
55280
 
54997
55281
  // src/commands/telemetry/flush.ts
54998
- var import_node_fetch = __toESM(require_lib3(), 1);
54999
55282
  async function flush(_client, args) {
55000
55283
  const url = process.env.VERCEL_TELEMETRY_BRIDGE_URL || "https://telemetry.vercel.com/api/vercel-cli/v1/events";
55001
55284
  const { headers, body } = JSON.parse(args[0]);
55002
55285
  try {
55003
- const res = await (0, import_node_fetch.default)(url, {
55286
+ const res = await fetch2(url, {
55004
55287
  method: "POST",
55005
55288
  headers,
55006
55289
  body: JSON.stringify(body)
@@ -56552,7 +56835,8 @@ async function processCharges(response, breakdownPeriod, groupByDimension, conte
56552
56835
  let chargeCount = 0;
56553
56836
  let pricingUnit = "MIUs";
56554
56837
  await new Promise((resolve9, reject) => {
56555
- const stream = response.body.pipe(import_jsonlines.default.parse());
56838
+ const readable = toNodeReadable(response.body);
56839
+ const stream = readable.pipe(import_jsonlines.default.parse());
56556
56840
  stream.on("data", (charge) => {
56557
56841
  chargeCount++;
56558
56842
  if (chargeCount === 1 && charge.PricingUnit) {
@@ -56637,7 +56921,7 @@ async function processCharges(response, breakdownPeriod, groupByDimension, conte
56637
56921
  });
56638
56922
  stream.on("end", resolve9);
56639
56923
  stream.on("error", reject);
56640
- response.body.on("error", reject);
56924
+ readable.on("error", reject);
56641
56925
  });
56642
56926
  return {
56643
56927
  contextName,