vercel 54.16.0 → 54.17.1

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 (52) hide show
  1. package/dist/chunks/{add-ODBKI7EV.js → add-QQY6QOTO.js} +4 -4
  2. package/dist/chunks/{chunk-FBYYZKN3.js → chunk-2F6JT2OC.js} +1 -1
  3. package/dist/chunks/{chunk-O6YJBWWC.js → chunk-4D42VZRX.js} +1 -1
  4. package/dist/chunks/{chunk-7CTLNKAS.js → chunk-7AQDR2RX.js} +1 -1
  5. package/dist/chunks/{chunk-UI2T3GI4.js → chunk-7B44AIGE.js} +2 -2
  6. package/dist/chunks/{chunk-LJXYGWOY.js → chunk-A4B4JQVP.js} +2 -2
  7. package/dist/chunks/{chunk-NVITPK2U.js → chunk-DDTKG4J3.js} +1 -1
  8. package/dist/chunks/{chunk-RCUMYP4L.js → chunk-DWA63R5L.js} +5 -8
  9. package/dist/chunks/{chunk-HXAMK45D.js → chunk-E6FCE2XJ.js} +1 -1
  10. package/dist/chunks/{chunk-Q4ZRBN2A.js → chunk-HJ2TEW5Y.js} +1 -1
  11. package/dist/chunks/{chunk-INFYZRHS.js → chunk-KTX4RQFM.js} +235 -58
  12. package/dist/chunks/{chunk-YE3C5CUX.js → chunk-LCNEKTLC.js} +31 -4
  13. package/dist/chunks/{chunk-BGQPLZFA.js → chunk-LGR4JRFA.js} +4 -4
  14. package/dist/chunks/{chunk-HL5ZRVF2.js → chunk-MLVCDMCS.js} +4 -4
  15. package/dist/chunks/{chunk-ULNWA6GY.js → chunk-MS3WAXLU.js} +1 -1
  16. package/dist/chunks/{chunk-Z2MBXYZZ.js → chunk-NKU6QGO6.js} +17 -2
  17. package/dist/chunks/{chunk-MSWXRAHA.js → chunk-NRIXI6V5.js} +1 -1
  18. package/dist/chunks/{chunk-BIHRICRM.js → chunk-P5AZW6W6.js} +8 -2
  19. package/dist/chunks/{chunk-76QQSALN.js → chunk-V7JDSYIZ.js} +3 -3
  20. package/dist/chunks/{chunk-VLQBXXOQ.js → chunk-VO7PRFFG.js} +19 -4
  21. package/dist/chunks/{chunk-U2NYO6GP.js → chunk-WJPWCLMH.js} +1 -1
  22. package/dist/chunks/{chunk-KJMSI2CT.js → chunk-YW7AYO7N.js} +1 -1
  23. package/dist/chunks/{compile-vercel-config-7THB6MTJ.js → compile-vercel-config-D2OQCK4B.js} +1 -1
  24. package/dist/chunks/{delete-USWDARFF.js → delete-VMW7FORM.js} +2 -2
  25. package/dist/chunks/{disable-K6B26MC2.js → disable-BDFZELDL.js} +2 -2
  26. package/dist/chunks/{discard-2T7HZCGR.js → discard-WIN3BOXR.js} +2 -2
  27. package/dist/chunks/{edit-2CC2WAO4.js → edit-IZQX4XAG.js} +3 -3
  28. package/dist/chunks/{enable-KEZA6F4T.js → enable-RFODZ2L7.js} +2 -2
  29. package/dist/chunks/{export-PE2T4HYP.js → export-5CCLXZYT.js} +2 -2
  30. package/dist/chunks/{inspect-TQSHD4MH.js → inspect-GEUUTDBY.js} +3 -3
  31. package/dist/chunks/{list-IDTF5TWY.js → list-H35AGNO2.js} +2 -2
  32. package/dist/chunks/{list-AU6URG3E.js → list-JIYDXQDJ.js} +3 -3
  33. package/dist/chunks/{ls-XOAWRTNQ.js → ls-WPNFJAS6.js} +4 -4
  34. package/dist/chunks/{publish-G42C77TP.js → publish-K7OPKXYC.js} +2 -2
  35. package/dist/chunks/{query-YTBD7YLX.js → query-IIUJIRHR.js} +82 -10
  36. package/dist/chunks/{reorder-BDOOUURL.js → reorder-GQ7BOQA7.js} +2 -2
  37. package/dist/chunks/{restore-ENUHC25O.js → restore-MODYFJSP.js} +2 -2
  38. package/dist/chunks/{rm-ALWF3NBL.js → rm-A45OKS6U.js} +4 -4
  39. package/dist/chunks/{rule-inspect-BV6MC7PG.js → rule-inspect-HJCERQHK.js} +4 -4
  40. package/dist/chunks/{rules-IGG7M2AC.js → rules-UNL3IB4P.js} +6 -6
  41. package/dist/chunks/{schema-ZYJOJIGL.js → schema-EUH7PJEX.js} +4 -4
  42. package/dist/chunks/{update-I3WE3IQJ.js → update-MOM4T2RN.js} +4 -4
  43. package/dist/commands/build/index.js +20 -12
  44. package/dist/commands/deploy/index.js +159 -12
  45. package/dist/commands/dev/index.js +50 -17
  46. package/dist/commands/env/index.js +5 -5
  47. package/dist/commands/link/index.js +8 -8
  48. package/dist/commands/list/index.js +3 -3
  49. package/dist/commands-bulk.js +53 -32
  50. package/dist/index.js +9 -9
  51. package/dist/version.mjs +1 -1
  52. package/package.json +21 -21
@@ -15,13 +15,27 @@ import {
15
15
  function getRollupColumnName(metric, aggregation) {
16
16
  return `${metric}_${aggregation}`.replace(/[./]/g, "_");
17
17
  }
18
+ function getResolvedOrderMetadata(query, response) {
19
+ const orderBy = query.orderBy ?? (response.orderBy ? "count" : void 0);
20
+ const orderDirection = response.orderDirection ?? query.orderDirection;
21
+ return {
22
+ ...orderBy ? { orderBy } : {},
23
+ ...orderDirection ? { orderDirection } : {}
24
+ };
25
+ }
18
26
  function formatQueryJson(query, response) {
27
+ const orderMetadata = getResolvedOrderMetadata(query, response);
28
+ const queryWithResponseMetadata = {
29
+ ...query,
30
+ ...orderMetadata
31
+ };
19
32
  return JSON.stringify(
20
33
  {
21
- query,
34
+ query: queryWithResponseMetadata,
22
35
  summary: response.summary ?? [],
23
36
  data: response.data ?? [],
24
- statistics: response.statistics ?? {}
37
+ statistics: response.statistics ?? {},
38
+ ...orderMetadata
25
39
  },
26
40
  null,
27
41
  2
@@ -169,6 +183,7 @@ async function fetchMetricDetailOrExit(client, accountId, metricId, jsonOutput)
169
183
 
170
184
  export {
171
185
  getRollupColumnName,
186
+ getResolvedOrderMetadata,
172
187
  formatQueryJson,
173
188
  formatErrorJson,
174
189
  handleApiError,
@@ -8,7 +8,7 @@ import {
8
8
  VERCEL_DIR,
9
9
  VERCEL_DIR_PROJECT,
10
10
  require_lib
11
- } from "./chunk-INFYZRHS.js";
11
+ } from "./chunk-KTX4RQFM.js";
12
12
  import {
13
13
  require_dist
14
14
  } from "./chunk-Z5SBJH6L.js";
@@ -7,12 +7,12 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  printProjectNotFoundError,
9
9
  setupAndLink
10
- } from "./chunk-76QQSALN.js";
10
+ } from "./chunk-V7JDSYIZ.js";
11
11
  import {
12
12
  getLinkedProject,
13
13
  param,
14
14
  resolveProjectCwd
15
- } from "./chunk-INFYZRHS.js";
15
+ } from "./chunk-KTX4RQFM.js";
16
16
  import {
17
17
  buildCommandWithYes,
18
18
  outputActionRequired
@@ -49,6 +49,12 @@ async function ensureLink(commandName, client, cwd, opts = {}) {
49
49
  await printProjectNotFoundError(client, opts.projectName, commandName);
50
50
  return 1;
51
51
  }
52
+ if (link.status === "not_linked" && opts.requireExistingLink) {
53
+ output_manager_default.error(
54
+ `Project is not linked. Run ${getCommandName("link")} first.`
55
+ );
56
+ return 1;
57
+ }
52
58
  link = await setupAndLink(client, cwd, opts);
53
59
  if (link.status === "not_linked") {
54
60
  return 0;
@@ -10,10 +10,10 @@ import {
10
10
  } from "./chunk-QH7WYDEP.js";
11
11
  import {
12
12
  getLocalPathConfig
13
- } from "./chunk-ULNWA6GY.js";
13
+ } from "./chunk-MS3WAXLU.js";
14
14
  import {
15
15
  getScope
16
- } from "./chunk-FBYYZKN3.js";
16
+ } from "./chunk-2F6JT2OC.js";
17
17
  import {
18
18
  VERCEL_DIR_PROJECT,
19
19
  VERCEL_DIR_README,
@@ -48,7 +48,7 @@ import {
48
48
  selectAndParseRemoteUrl,
49
49
  selectOrg,
50
50
  writeServicesConfig
51
- } from "./chunk-INFYZRHS.js";
51
+ } from "./chunk-KTX4RQFM.js";
52
52
  import {
53
53
  buildCommandWithGlobalFlags,
54
54
  outputAgentError,
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  metricsCommand
9
- } from "./chunk-YE3C5CUX.js";
9
+ } from "./chunk-LCNEKTLC.js";
10
10
  import {
11
11
  routesCommand
12
12
  } from "./chunk-IB56QKCM.js";
@@ -25,10 +25,10 @@ import {
25
25
  import {
26
26
  buildCommand,
27
27
  pullCommand
28
- } from "./chunk-KJMSI2CT.js";
28
+ } from "./chunk-YW7AYO7N.js";
29
29
  import {
30
30
  envCommand
31
- } from "./chunk-INFYZRHS.js";
31
+ } from "./chunk-KTX4RQFM.js";
32
32
  import {
33
33
  confirmOption,
34
34
  deploymentOption,
@@ -192,7 +192,7 @@ var continueSubcommand = {
192
192
  var deployCommand = {
193
193
  name: "deploy",
194
194
  aliases: [],
195
- description: "Deploy your project to Vercel. The `deploy` command is the default command for the Vercel CLI, and can be omitted (`vc deploy my-app` equals `vc my-app`).",
195
+ description: "Deploy your project to Vercel. The `deploy` command is the default command for the Vercel CLI, and can be omitted (`vc deploy my-app` equals `vc my-app`). Use `--dry` to inspect the detected framework preset and source files without deploying.",
196
196
  arguments: [
197
197
  {
198
198
  name: "project-path",
@@ -273,6 +273,13 @@ var deployCommand = {
273
273
  deprecated: false,
274
274
  description: "Don't wait for the deployment to finish"
275
275
  },
276
+ {
277
+ name: "dry",
278
+ shorthand: null,
279
+ type: Boolean,
280
+ deprecated: false,
281
+ description: "Inspect the detected framework preset and source files without uploading or creating a deployment. Non-TTY output includes every file as JSON"
282
+ },
276
283
  {
277
284
  name: "skip-domain",
278
285
  shorthand: null,
@@ -347,6 +354,14 @@ var deployCommand = {
347
354
  name: "Deploy with prebuilt outputs",
348
355
  value: ["vercel build", "vercel deploy --prebuilt"]
349
356
  },
357
+ {
358
+ name: "Inspect deployment inputs without deploying",
359
+ value: "vercel deploy --dry"
360
+ },
361
+ {
362
+ name: "Get every deployment file as JSON",
363
+ value: "vercel deploy --dry --format=json"
364
+ },
350
365
  {
351
366
  name: "Write Deployment URL to a file",
352
367
  value: "vercel > deployment-url.txt"
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-QH7WYDEP.js";
11
11
  import {
12
12
  getLinkedProject
13
- } from "./chunk-INFYZRHS.js";
13
+ } from "./chunk-KTX4RQFM.js";
14
14
  import {
15
15
  buildCommandWithYes,
16
16
  outputAgentError
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  getEnvTargetPlaceholder
9
- } from "./chunk-INFYZRHS.js";
9
+ } from "./chunk-KTX4RQFM.js";
10
10
  import {
11
11
  projectOption,
12
12
  yesOption
@@ -11,7 +11,7 @@ import {
11
11
  findSourceVercelConfigFile,
12
12
  getVercelConfigPath,
13
13
  normalizeConfig
14
- } from "./chunk-INFYZRHS.js";
14
+ } from "./chunk-KTX4RQFM.js";
15
15
  import "./chunk-Q77ALSXR.js";
16
16
  import "./chunk-NHGCQRK5.js";
17
17
  import "./chunk-N2T234LO.js";
@@ -15,7 +15,7 @@ import {
15
15
  parseSubcommandArgs,
16
16
  resolveRoutes,
17
17
  withGlobalFlags
18
- } from "./chunk-U2NYO6GP.js";
18
+ } from "./chunk-WJPWCLMH.js";
19
19
  import {
20
20
  deleteSubcommand
21
21
  } from "./chunk-IB56QKCM.js";
@@ -27,7 +27,7 @@ import {
27
27
  AGENT_REASON,
28
28
  AGENT_STATUS
29
29
  } from "./chunk-QH7WYDEP.js";
30
- import "./chunk-INFYZRHS.js";
30
+ import "./chunk-KTX4RQFM.js";
31
31
  import "./chunk-Q77ALSXR.js";
32
32
  import {
33
33
  outputAgentError
@@ -17,7 +17,7 @@ import {
17
17
  parseSubcommandArgs,
18
18
  resolveRoute,
19
19
  withGlobalFlags
20
- } from "./chunk-U2NYO6GP.js";
20
+ } from "./chunk-WJPWCLMH.js";
21
21
  import {
22
22
  disableSubcommand
23
23
  } from "./chunk-IB56QKCM.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-64IF634X.js";
27
27
  import "./chunk-VXYGCOKL.js";
28
28
  import "./chunk-QH7WYDEP.js";
29
- import "./chunk-INFYZRHS.js";
29
+ import "./chunk-KTX4RQFM.js";
30
30
  import "./chunk-Q77ALSXR.js";
31
31
  import {
32
32
  outputAgentError
@@ -17,7 +17,7 @@ import {
17
17
  parseSubcommandArgs,
18
18
  printDiffSummary,
19
19
  withGlobalFlags
20
- } from "./chunk-U2NYO6GP.js";
20
+ } from "./chunk-WJPWCLMH.js";
21
21
  import {
22
22
  discardSubcommand
23
23
  } from "./chunk-IB56QKCM.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-64IF634X.js";
27
27
  import "./chunk-VXYGCOKL.js";
28
28
  import "./chunk-QH7WYDEP.js";
29
- import "./chunk-INFYZRHS.js";
29
+ import "./chunk-KTX4RQFM.js";
30
30
  import "./chunk-Q77ALSXR.js";
31
31
  import {
32
32
  outputAgentError
@@ -19,7 +19,7 @@ import {
19
19
  printRouteConfig,
20
20
  routingRuleToCurrentRoute,
21
21
  runInteractiveEditLoop
22
- } from "./chunk-O6YJBWWC.js";
22
+ } from "./chunk-4D42VZRX.js";
23
23
  import {
24
24
  getRouteVersions
25
25
  } from "./chunk-AHU7WNL2.js";
@@ -31,7 +31,7 @@ import {
31
31
  resolveRoute,
32
32
  shellQuoteRouteIdentifierForSuggestion,
33
33
  withGlobalFlags
34
- } from "./chunk-U2NYO6GP.js";
34
+ } from "./chunk-WJPWCLMH.js";
35
35
  import {
36
36
  editSubcommand
37
37
  } from "./chunk-IB56QKCM.js";
@@ -40,7 +40,7 @@ import {
40
40
  } from "./chunk-64IF634X.js";
41
41
  import "./chunk-VXYGCOKL.js";
42
42
  import "./chunk-QH7WYDEP.js";
43
- import "./chunk-INFYZRHS.js";
43
+ import "./chunk-KTX4RQFM.js";
44
44
  import "./chunk-Q77ALSXR.js";
45
45
  import {
46
46
  outputAgentError
@@ -17,7 +17,7 @@ import {
17
17
  parseSubcommandArgs,
18
18
  resolveRoute,
19
19
  withGlobalFlags
20
- } from "./chunk-U2NYO6GP.js";
20
+ } from "./chunk-WJPWCLMH.js";
21
21
  import {
22
22
  enableSubcommand
23
23
  } from "./chunk-IB56QKCM.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-64IF634X.js";
27
27
  import "./chunk-VXYGCOKL.js";
28
28
  import "./chunk-QH7WYDEP.js";
29
- import "./chunk-INFYZRHS.js";
29
+ import "./chunk-KTX4RQFM.js";
30
30
  import "./chunk-Q77ALSXR.js";
31
31
  import {
32
32
  outputAgentError
@@ -9,12 +9,12 @@ import {
9
9
  getRoutes,
10
10
  parseSubcommandArgs,
11
11
  withGlobalFlags
12
- } from "./chunk-U2NYO6GP.js";
12
+ } from "./chunk-WJPWCLMH.js";
13
13
  import {
14
14
  exportSubcommand
15
15
  } from "./chunk-IB56QKCM.js";
16
16
  import "./chunk-QH7WYDEP.js";
17
- import "./chunk-INFYZRHS.js";
17
+ import "./chunk-KTX4RQFM.js";
18
18
  import "./chunk-Q77ALSXR.js";
19
19
  import {
20
20
  outputAgentError
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  emitAlertsScopeError
9
- } from "./chunk-UI2T3GI4.js";
9
+ } from "./chunk-7B44AIGE.js";
10
10
  import {
11
11
  handleValidationError,
12
12
  outputError,
@@ -24,11 +24,11 @@ import {
24
24
  } from "./chunk-QH7WYDEP.js";
25
25
  import {
26
26
  getScope
27
- } from "./chunk-FBYYZKN3.js";
27
+ } from "./chunk-2F6JT2OC.js";
28
28
  import {
29
29
  getLinkedProject,
30
30
  getProjectByNameOrId
31
- } from "./chunk-INFYZRHS.js";
31
+ } from "./chunk-KTX4RQFM.js";
32
32
  import "./chunk-Q77ALSXR.js";
33
33
  import {
34
34
  buildCommandWithGlobalFlags,
@@ -24,11 +24,11 @@ import {
24
24
  } from "./chunk-56AJHIQC.js";
25
25
  import {
26
26
  getScope
27
- } from "./chunk-FBYYZKN3.js";
27
+ } from "./chunk-2F6JT2OC.js";
28
28
  import {
29
29
  getLinkedProject,
30
30
  getProjectByNameOrId
31
- } from "./chunk-INFYZRHS.js";
31
+ } from "./chunk-KTX4RQFM.js";
32
32
  import "./chunk-Q77ALSXR.js";
33
33
  import "./chunk-NHGCQRK5.js";
34
34
  import "./chunk-N2T234LO.js";
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  resolveAlertsScope
9
- } from "./chunk-UI2T3GI4.js";
9
+ } from "./chunk-7B44AIGE.js";
10
10
  import {
11
11
  handleValidationError,
12
12
  normalizeRepeatableStringFilters,
@@ -26,8 +26,8 @@ import "./chunk-SGPBULVT.js";
26
26
  import {
27
27
  AGENT_REASON
28
28
  } from "./chunk-QH7WYDEP.js";
29
- import "./chunk-FBYYZKN3.js";
30
- import "./chunk-INFYZRHS.js";
29
+ import "./chunk-2F6JT2OC.js";
30
+ import "./chunk-KTX4RQFM.js";
31
31
  import "./chunk-Q77ALSXR.js";
32
32
  import {
33
33
  buildCommandWithGlobalFlags,
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesCollectionPath
12
- } from "./chunk-Q4ZRBN2A.js";
13
- import "./chunk-UI2T3GI4.js";
12
+ } from "./chunk-HJ2TEW5Y.js";
13
+ import "./chunk-7B44AIGE.js";
14
14
  import "./chunk-D7MGZH35.js";
15
15
  import {
16
16
  validateJsonOutput
@@ -21,8 +21,8 @@ import {
21
21
  import {
22
22
  AGENT_REASON
23
23
  } from "./chunk-QH7WYDEP.js";
24
- import "./chunk-FBYYZKN3.js";
25
- import "./chunk-INFYZRHS.js";
24
+ import "./chunk-2F6JT2OC.js";
25
+ import "./chunk-KTX4RQFM.js";
26
26
  import "./chunk-Q77ALSXR.js";
27
27
  import {
28
28
  outputAgentError
@@ -17,7 +17,7 @@ import {
17
17
  parseSubcommandArgs,
18
18
  printDiffSummary,
19
19
  withGlobalFlags
20
- } from "./chunk-U2NYO6GP.js";
20
+ } from "./chunk-WJPWCLMH.js";
21
21
  import {
22
22
  publishSubcommand
23
23
  } from "./chunk-IB56QKCM.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-64IF634X.js";
27
27
  import "./chunk-VXYGCOKL.js";
28
28
  import "./chunk-QH7WYDEP.js";
29
- import "./chunk-INFYZRHS.js";
29
+ import "./chunk-KTX4RQFM.js";
30
30
  import "./chunk-Q77ALSXR.js";
31
31
  import {
32
32
  outputAgentError
@@ -9,9 +9,10 @@ import {
9
9
  formatErrorJson,
10
10
  formatQueryJson,
11
11
  getDefaultAggregation,
12
+ getResolvedOrderMetadata,
12
13
  getRollupColumnName,
13
14
  handleApiError
14
- } from "./chunk-Z2MBXYZZ.js";
15
+ } from "./chunk-NKU6QGO6.js";
15
16
  import {
16
17
  indent_default
17
18
  } from "./chunk-A3NYPUKZ.js";
@@ -24,14 +25,14 @@ import {
24
25
  } from "./chunk-XPKWKPWA.js";
25
26
  import {
26
27
  metricsCommand
27
- } from "./chunk-YE3C5CUX.js";
28
+ } from "./chunk-LCNEKTLC.js";
28
29
  import {
29
30
  getScope
30
- } from "./chunk-FBYYZKN3.js";
31
+ } from "./chunk-2F6JT2OC.js";
31
32
  import {
32
33
  getLinkedProject,
33
34
  getProjectByNameOrId
34
- } from "./chunk-INFYZRHS.js";
35
+ } from "./chunk-KTX4RQFM.js";
35
36
  import "./chunk-Q77ALSXR.js";
36
37
  import "./chunk-NHGCQRK5.js";
37
38
  import "./chunk-N2T234LO.js";
@@ -75,6 +76,34 @@ function validateRequiredMetric(metric) {
75
76
  message: "Missing required metric. Specify the metric to query.\n\nRun 'vercel metrics schema' to see available metrics."
76
77
  };
77
78
  }
79
+ function validateOrderDirection(orderDirection) {
80
+ if (orderDirection === void 0) {
81
+ return { valid: true, value: void 0 };
82
+ }
83
+ if (orderDirection === "asc" || orderDirection === "desc") {
84
+ return { valid: true, value: orderDirection };
85
+ }
86
+ return {
87
+ valid: false,
88
+ code: "INVALID_ORDER",
89
+ message: `Invalid order "${orderDirection}". Use "asc" or "desc".`,
90
+ allowedValues: ["asc", "desc"]
91
+ };
92
+ }
93
+ function validateOrderBy(orderBy) {
94
+ if (orderBy === void 0) {
95
+ return { valid: true, value: void 0 };
96
+ }
97
+ if (orderBy === "value" || orderBy === "count") {
98
+ return { valid: true, value: orderBy };
99
+ }
100
+ return {
101
+ valid: false,
102
+ code: "INVALID_ORDER_BY",
103
+ message: `Invalid order-by "${orderBy}". Use "value" or "count".`,
104
+ allowedValues: ["value", "count"]
105
+ };
106
+ }
78
107
 
79
108
  // src/commands/metrics/text-output.ts
80
109
  var import_chalk = __toESM(require_source(), 1);
@@ -573,6 +602,12 @@ function formatMetadataHeader(opts) {
573
602
  if (opts.filter) {
574
603
  rows.push({ key: "Filter", value: opts.filter });
575
604
  }
605
+ if (opts.orderBy && opts.orderDirection) {
606
+ rows.push({
607
+ key: "Order By",
608
+ value: `${opts.orderBy} ${opts.orderDirection}${opts.orderBy === "count" ? " (default)" : ""}`
609
+ });
610
+ }
576
611
  if (opts.scope.type === "project") {
577
612
  rows.push({
578
613
  key: "Project",
@@ -692,6 +727,7 @@ function formatText(response, opts) {
692
727
  opts.aggregation
693
728
  );
694
729
  const granularityMs = toGranularityMsFromDuration(opts.granularity);
730
+ const orderMetadata = getResolvedOrderMetadata(opts, response);
695
731
  const { groups, series, groupValues } = extractGroupedSeries(
696
732
  response.data ?? [],
697
733
  opts.groupBy,
@@ -716,6 +752,7 @@ function formatText(response, opts) {
716
752
  periodUnique,
717
753
  bucketTimezone: opts.bucketTimezone,
718
754
  filter: opts.filter,
755
+ ...opts.groupBy.length > 0 ? orderMetadata : {},
719
756
  scope: opts.scope,
720
757
  projectName: opts.projectName,
721
758
  teamName: opts.teamName,
@@ -769,11 +806,20 @@ function handleValidationError(result, jsonOutput, client) {
769
806
  );
770
807
  } else {
771
808
  output_manager_default.error(result.message);
809
+ if (result.allowedValues && result.allowedValues.length > 0) {
810
+ output_manager_default.print(`
811
+ Available values: ${result.allowedValues.join(", ")}
812
+ `);
813
+ }
772
814
  }
773
815
  return 1;
774
816
  }
775
- function combineFilters(filters) {
776
- const nonEmptyFilters = filters?.filter((filter) => filter.length > 0) ?? [];
817
+ var PRODUCTION_ENVIRONMENT_FILTER = "environment eq 'production'";
818
+ function combineFilters(filters, prod) {
819
+ const nonEmptyFilters = [
820
+ ...filters?.filter((filter) => filter.length > 0) ?? [],
821
+ ...prod ? [PRODUCTION_ENVIRONMENT_FILTER] : []
822
+ ];
777
823
  if (nonEmptyFilters.length === 0) {
778
824
  return void 0;
779
825
  }
@@ -782,6 +828,9 @@ function combineFilters(filters) {
782
828
  }
783
829
  return nonEmptyFilters.map((filter) => `(${filter})`).join(" and ");
784
830
  }
831
+ function getRequestOrderBy(metric, aggregation, orderBy) {
832
+ return orderBy === "value" ? getRollupColumnName(metric, aggregation) : void 0;
833
+ }
785
834
  async function resolveQueryScope(client, opts) {
786
835
  if (opts.project || opts.all) {
787
836
  const { team } = await getScope(client);
@@ -868,8 +917,11 @@ async function query(client, telemetry) {
868
917
  const aggregationFlag = flags["--aggregation"];
869
918
  const groupBy = flags["--group-by"] ?? [];
870
919
  const limit = flags["--limit"];
920
+ const orderByInput = typeof flags["--order-by"] === "string" ? flags["--order-by"].trim().toLowerCase() : void 0;
921
+ const orderInput = typeof flags["--order"] === "string" ? flags["--order"].trim().toLowerCase() : void 0;
871
922
  const filters = flags["--filter"];
872
- const filter = combineFilters(filters);
923
+ const prod = flags["--prod"];
924
+ const filter = combineFilters(filters, prod);
873
925
  const since = flags["--since"];
874
926
  const until = flags["--until"];
875
927
  const granularity = flags["--granularity"];
@@ -880,7 +932,10 @@ async function query(client, telemetry) {
880
932
  telemetry.trackCliOptionAggregation(aggregationFlag);
881
933
  telemetry.trackCliOptionGroupBy(groupBy.length > 0 ? groupBy : void 0);
882
934
  telemetry.trackCliOptionLimit(limit);
935
+ telemetry.trackCliOptionOrderBy(orderByInput);
936
+ telemetry.trackCliOptionOrder(orderInput);
883
937
  telemetry.trackCliOptionFilter(filters);
938
+ telemetry.trackCliFlagProd(prod);
884
939
  telemetry.trackCliOptionSince(since);
885
940
  telemetry.trackCliOptionUntil(until);
886
941
  telemetry.trackCliOptionGranularity(granularity);
@@ -888,6 +943,11 @@ async function query(client, telemetry) {
888
943
  telemetry.trackCliOptionProject(project);
889
944
  telemetry.trackCliFlagAll(all);
890
945
  telemetry.trackCliOptionFormat(flags["--format"]);
946
+ const orderByResult = validateOrderBy(orderByInput);
947
+ if (!orderByResult.valid) {
948
+ return handleValidationError(orderByResult, jsonOutput, client);
949
+ }
950
+ const orderByMode = orderByResult.value;
891
951
  const requiredMetric = validateRequiredMetric(metricFlag);
892
952
  if (!requiredMetric.valid) {
893
953
  return handleValidationError(requiredMetric, jsonOutput, client);
@@ -897,6 +957,11 @@ async function query(client, telemetry) {
897
957
  if (!mutualResult.valid) {
898
958
  return handleValidationError(mutualResult, jsonOutput, client);
899
959
  }
960
+ const orderDirectionResult = validateOrderDirection(orderInput);
961
+ if (!orderDirectionResult.valid) {
962
+ return handleValidationError(orderDirectionResult, jsonOutput, client);
963
+ }
964
+ const orderDirection = orderDirectionResult.value;
900
965
  const scopeResult = await resolveQueryScope(client, {
901
966
  project,
902
967
  all,
@@ -917,6 +982,7 @@ async function query(client, telemetry) {
917
982
  }
918
983
  const aggregationInput = aggregationFlag ?? getDefaultAggregation(detailOrExitCode, metric) ?? "sum";
919
984
  const aggregation = aggregationInput;
985
+ const orderBy = getRequestOrderBy(metric, aggregation, orderByMode);
920
986
  let startTime;
921
987
  let endTime;
922
988
  try {
@@ -945,7 +1011,9 @@ async function query(client, telemetry) {
945
1011
  ...bucketTimezone ? { bucketTimezone } : {},
946
1012
  ...groupBy.length > 0 ? { groupBy } : {},
947
1013
  ...filter ? { filter } : {},
948
- limit: limit ?? 10
1014
+ limit: limit ?? 10,
1015
+ ...orderBy ? { orderBy } : {},
1016
+ ...orderDirection ? { orderDirection } : {}
949
1017
  };
950
1018
  if (!jsonOutput) {
951
1019
  output_manager_default.spinner("Querying metrics...");
@@ -989,7 +1057,9 @@ async function query(client, telemetry) {
989
1057
  startTime: startTime.toISOString(),
990
1058
  endTime: endTime.toISOString(),
991
1059
  granularity: granResult.duration,
992
- ...bucketTimezone ? { bucketTimezone } : {}
1060
+ ...bucketTimezone ? { bucketTimezone } : {},
1061
+ ...orderByMode ? { orderBy: orderByMode } : {},
1062
+ ...orderDirection ? { orderDirection } : {}
993
1063
  },
994
1064
  response
995
1065
  )
@@ -1008,7 +1078,9 @@ async function query(client, telemetry) {
1008
1078
  periodStart: startTime.toISOString(),
1009
1079
  periodEnd: endTime.toISOString(),
1010
1080
  granularity: granResult.duration,
1011
- bucketTimezone
1081
+ bucketTimezone,
1082
+ orderBy: orderByMode,
1083
+ orderDirection
1012
1084
  })
1013
1085
  );
1014
1086
  }
@@ -16,7 +16,7 @@ import {
16
16
  resolveRoute,
17
17
  shellQuoteRouteIdentifierForSuggestion,
18
18
  withGlobalFlags
19
- } from "./chunk-U2NYO6GP.js";
19
+ } from "./chunk-WJPWCLMH.js";
20
20
  import {
21
21
  reorderSubcommand
22
22
  } from "./chunk-IB56QKCM.js";
@@ -25,7 +25,7 @@ import {
25
25
  } from "./chunk-64IF634X.js";
26
26
  import "./chunk-VXYGCOKL.js";
27
27
  import "./chunk-QH7WYDEP.js";
28
- import "./chunk-INFYZRHS.js";
28
+ import "./chunk-KTX4RQFM.js";
29
29
  import "./chunk-Q77ALSXR.js";
30
30
  import {
31
31
  outputAgentError
@@ -19,7 +19,7 @@ import {
19
19
  printDiffSummary,
20
20
  validateRequiredArgs,
21
21
  withGlobalFlags
22
- } from "./chunk-U2NYO6GP.js";
22
+ } from "./chunk-WJPWCLMH.js";
23
23
  import {
24
24
  restoreSubcommand
25
25
  } from "./chunk-IB56QKCM.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-64IF634X.js";
29
29
  import "./chunk-VXYGCOKL.js";
30
30
  import "./chunk-QH7WYDEP.js";
31
- import "./chunk-INFYZRHS.js";
31
+ import "./chunk-KTX4RQFM.js";
32
32
  import "./chunk-Q77ALSXR.js";
33
33
  import {
34
34
  outputAgentError
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-Q4ZRBN2A.js";
13
- import "./chunk-UI2T3GI4.js";
12
+ } from "./chunk-HJ2TEW5Y.js";
13
+ import "./chunk-7B44AIGE.js";
14
14
  import "./chunk-D7MGZH35.js";
15
15
  import {
16
16
  validateJsonOutput
@@ -21,8 +21,8 @@ import {
21
21
  import {
22
22
  AGENT_REASON
23
23
  } from "./chunk-QH7WYDEP.js";
24
- import "./chunk-FBYYZKN3.js";
25
- import "./chunk-INFYZRHS.js";
24
+ import "./chunk-2F6JT2OC.js";
25
+ import "./chunk-KTX4RQFM.js";
26
26
  import "./chunk-Q77ALSXR.js";
27
27
  import {
28
28
  buildCommandWithGlobalFlags,