vercel 51.4.0 → 51.5.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.
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-XPKWKPWA.js";
28
28
  import {
29
29
  metricsCommand
30
- } from "./chunk-4RBF6ZDU.js";
30
+ } from "./chunk-BHDZCUTT.js";
31
31
  import {
32
32
  table
33
33
  } from "./chunk-GE6G37P4.js";
@@ -70,7 +70,7 @@ function validateRequiredMetric(metric) {
70
70
  return {
71
71
  valid: false,
72
72
  code: "MISSING_METRIC",
73
- message: "Missing required flag --metric. Specify the metric to query.\n\nRun 'vercel metrics schema' to see available metrics."
73
+ message: "Missing required metric. Specify the metric to query.\n\nRun 'vercel metrics schema' to see available metrics."
74
74
  };
75
75
  }
76
76
 
@@ -799,13 +799,15 @@ async function query(client, telemetry) {
799
799
  return 1;
800
800
  }
801
801
  const flags = parsedArgs.flags;
802
+ const positionalArgs = parsedArgs.args.slice(1);
803
+ const positionalMetric = positionalArgs[0] === "query" ? positionalArgs[1] : positionalArgs[0];
802
804
  const formatResult = validateJsonOutput(flags);
803
805
  if (!formatResult.valid) {
804
806
  output_manager_default.error(formatResult.error);
805
807
  return 1;
806
808
  }
807
809
  const jsonOutput = formatResult.jsonOutput;
808
- const metricFlag = flags["--metric"];
810
+ const metricFlag = positionalMetric;
809
811
  const aggregationFlag = flags["--aggregation"];
810
812
  const groupBy = flags["--group-by"] ?? [];
811
813
  const limit = flags["--limit"];
@@ -815,7 +817,7 @@ async function query(client, telemetry) {
815
817
  const granularity = flags["--granularity"];
816
818
  const project = flags["--project"];
817
819
  const all = flags["--all"];
818
- telemetry.trackCliOptionMetric(metricFlag);
820
+ telemetry.trackCliArgumentMetricId(metricFlag);
819
821
  telemetry.trackCliOptionAggregation(aggregationFlag);
820
822
  telemetry.trackCliOptionGroupBy(groupBy.length > 0 ? groupBy : void 0);
821
823
  telemetry.trackCliOptionLimit(limit);
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-XPKWKPWA.js";
24
24
  import {
25
25
  schemaSubcommand
26
- } from "./chunk-4RBF6ZDU.js";
26
+ } from "./chunk-BHDZCUTT.js";
27
27
  import "./chunk-GE6G37P4.js";
28
28
  import {
29
29
  require_pluralize
@@ -57,14 +57,16 @@ async function schema(client, telemetry) {
57
57
  return 1;
58
58
  }
59
59
  const flags = parsedArgs.flags;
60
+ const positionalArgs = parsedArgs.args.slice(1);
61
+ const positionalMetric = positionalArgs[0] === "schema" ? positionalArgs[1] : positionalArgs[0];
60
62
  const formatResult = validateJsonOutput(flags);
61
63
  if (!formatResult.valid) {
62
64
  output_manager_default.error(formatResult.error);
63
65
  return 1;
64
66
  }
65
67
  const jsonOutput = formatResult.jsonOutput;
66
- const metric = flags["--metric"];
67
- telemetry.trackCliOptionMetric(metric);
68
+ const metric = positionalMetric;
69
+ telemetry.trackCliArgumentMetricId(metric);
68
70
  telemetry.trackCliOptionFormat(flags["--format"]);
69
71
  const { team } = await getScope(client);
70
72
  if (!team) {
@@ -129,26 +131,54 @@ function formatMetricsTable(metrics) {
129
131
  if (metrics.length === 0) {
130
132
  return null;
131
133
  }
132
- return indent_default(
134
+ const dimensionsByMetric = metrics.map(
135
+ (metric) => metric.dimensions.map((dimension) => dimension.name)
136
+ );
137
+ const sharedDimensions = dimensionsByMetric[0].filter(
138
+ (dimension) => dimensionsByMetric.every(
139
+ (metricDimensions) => metricDimensions.includes(dimension)
140
+ )
141
+ );
142
+ const rows = metrics.map((metric) => {
143
+ const extraDimensions = metric.dimensions.map((dimension) => dimension.name).filter((dimension) => !sharedDimensions.includes(dimension)).map((dimension) => `+${dimension}`);
144
+ const aggregations = metric.aggregations.map(
145
+ (aggregation) => aggregation === metric.defaultAggregation ? `${aggregation} (default)` : aggregation
146
+ ).join(", ");
147
+ return {
148
+ metric: metric.id,
149
+ description: metric.description,
150
+ unit: metric.unit,
151
+ aggregations,
152
+ extraDimensions
153
+ };
154
+ });
155
+ const hasExtraDimensions = rows.some((row) => row.extraDimensions.length > 0);
156
+ const tableHeaders = hasExtraDimensions ? ["Metric", "Description", "Unit", "Aggregations", "Dimensions"] : ["Metric", "Description", "Unit", "Aggregations"];
157
+ const tableRows = rows.map(
158
+ (row) => hasExtraDimensions ? [
159
+ row.metric,
160
+ row.description,
161
+ row.unit,
162
+ row.aggregations,
163
+ row.extraDimensions.join(", ") || "\u2014"
164
+ ] : [row.metric, row.description, row.unit, row.aggregations]
165
+ );
166
+ const sharedDimensionsLine = sharedDimensions.length > 0 ? metrics.length === 1 ? `Dimensions:
167
+ ${sharedDimensions.join(", ")}` : `Shared dimensions:
168
+ ${sharedDimensions.join(", ")}` : null;
169
+ const table = indent_default(
133
170
  formatTable(
134
- ["Metric", "Description", "Dimensions", "Unit", "Aggregations"],
135
- ["l", "l", "l", "l", "l"],
136
- [
137
- {
138
- rows: metrics.map((metric) => [
139
- metric.id,
140
- metric.description,
141
- metric.dimensions.map((dimension) => dimension.name).join(", ") || "\u2014",
142
- metric.unit,
143
- metric.aggregations.map(
144
- (aggregation) => aggregation === metric.defaultAggregation ? `${aggregation} (default)` : aggregation
145
- ).join(", ")
146
- ])
147
- }
148
- ]
171
+ tableHeaders,
172
+ hasExtraDimensions ? ["l", "l", "l", "l", "l"] : ["l", "l", "l", "l"],
173
+ [{ rows: tableRows }]
149
174
  ),
150
175
  1
151
176
  );
177
+ return sharedDimensionsLine ? `
178
+ ${table}
179
+
180
+ ${sharedDimensionsLine}` : `
181
+ ${table}`;
152
182
  }
153
183
  export {
154
184
  schema as default
@@ -14,7 +14,7 @@ import {
14
14
  purchaseDomainIfAvailable,
15
15
  require_cjs,
16
16
  setupDomain
17
- } from "../../chunks/chunk-3GDNTBCE.js";
17
+ } from "../../chunks/chunk-FBY3IEDZ.js";
18
18
  import {
19
19
  readLocalConfig
20
20
  } from "../../chunks/chunk-6C33Y3DC.js";
@@ -43,9 +43,9 @@ import {
43
43
  deprecatedArchiveSplitTgz,
44
44
  getCommandAliases,
45
45
  initSubcommand
46
- } from "../../chunks/chunk-UJ4JXXED.js";
46
+ } from "../../chunks/chunk-SG4QOQTF.js";
47
47
  import "../../chunks/chunk-CRZM5WM2.js";
48
- import "../../chunks/chunk-4RBF6ZDU.js";
48
+ import "../../chunks/chunk-BHDZCUTT.js";
49
49
  import "../../chunks/chunk-BJQTGP42.js";
50
50
  import "../../chunks/chunk-UWKTUK3W.js";
51
51
  import "../../chunks/chunk-TAOVG4PS.js";
@@ -698,6 +698,8 @@ async function handleInitDeployment(client, telemetryClient) {
698
698
  if (link.repoRoot) {
699
699
  cwd = link.repoRoot;
700
700
  }
701
+ const contextName = org.slug;
702
+ client.config.currentTeam = org.type === "team" ? org.id : void 0;
701
703
  if (functionsBeta || noFunctionsBeta) {
702
704
  const toggleResult = await applyFunctionsBetaToggle(
703
705
  client,
@@ -709,8 +711,6 @@ async function handleInitDeployment(client, telemetryClient) {
709
711
  return toggleResult.exitCode;
710
712
  }
711
713
  }
712
- const contextName = org.slug;
713
- client.config.currentTeam = org.type === "team" ? org.id : void 0;
714
714
  if (rootDirectory && await validateRootDirectory(
715
715
  cwd,
716
716
  join2(cwd, rootDirectory),
@@ -1394,17 +1394,6 @@ async function handleDefaultDeploy(client, telemetryClient) {
1394
1394
  if (link.repoRoot) {
1395
1395
  cwd = link.repoRoot;
1396
1396
  }
1397
- if (functionsBeta || noFunctionsBeta) {
1398
- const toggleResult = await applyFunctionsBetaToggle(
1399
- client,
1400
- project,
1401
- functionsBeta,
1402
- noFunctionsBeta
1403
- );
1404
- if (toggleResult.error) {
1405
- return toggleResult.exitCode;
1406
- }
1407
- }
1408
1397
  let vercelOutputDir;
1409
1398
  if (parsedArguments.flags["--prebuilt"]) {
1410
1399
  vercelOutputDir = join2(cwd, ".vercel/output");
@@ -1451,6 +1440,17 @@ async function handleDefaultDeploy(client, telemetryClient) {
1451
1440
  }
1452
1441
  const contextName = org.slug;
1453
1442
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
1443
+ if (functionsBeta || noFunctionsBeta) {
1444
+ const toggleResult = await applyFunctionsBetaToggle(
1445
+ client,
1446
+ project,
1447
+ functionsBeta,
1448
+ noFunctionsBeta
1449
+ );
1450
+ if (toggleResult.error) {
1451
+ return toggleResult.exitCode;
1452
+ }
1453
+ }
1454
1454
  if (rootDirectory && await validateRootDirectory(
1455
1455
  cwd,
1456
1456
  join2(cwd, rootDirectory),
@@ -28,9 +28,9 @@ import {
28
28
  } from "../../chunks/chunk-YPQSDAEW.js";
29
29
  import {
30
30
  getCommandAliases
31
- } from "../../chunks/chunk-UJ4JXXED.js";
31
+ } from "../../chunks/chunk-SG4QOQTF.js";
32
32
  import "../../chunks/chunk-CRZM5WM2.js";
33
- import "../../chunks/chunk-4RBF6ZDU.js";
33
+ import "../../chunks/chunk-BHDZCUTT.js";
34
34
  import "../../chunks/chunk-BJQTGP42.js";
35
35
  import "../../chunks/chunk-UWKTUK3W.js";
36
36
  import "../../chunks/chunk-TAOVG4PS.js";
@@ -14,9 +14,9 @@ import {
14
14
  addSubcommand7 as addSubcommand,
15
15
  getCommandAliases,
16
16
  linkCommand
17
- } from "../../chunks/chunk-UJ4JXXED.js";
17
+ } from "../../chunks/chunk-SG4QOQTF.js";
18
18
  import "../../chunks/chunk-CRZM5WM2.js";
19
- import "../../chunks/chunk-4RBF6ZDU.js";
19
+ import "../../chunks/chunk-BHDZCUTT.js";
20
20
  import "../../chunks/chunk-BJQTGP42.js";
21
21
  import "../../chunks/chunk-UWKTUK3W.js";
22
22
  import "../../chunks/chunk-TAOVG4PS.js";