vercel 54.17.0 → 54.17.2

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-QQY6QOTO.js → add-ADMRKNTV.js} +4 -4
  2. package/dist/chunks/{chunk-V7JDSYIZ.js → chunk-2YIEJRSL.js} +3 -3
  3. package/dist/chunks/{chunk-DDTKG4J3.js → chunk-3ESVKDUA.js} +1 -1
  4. package/dist/chunks/{chunk-WJPWCLMH.js → chunk-52DDM5F6.js} +1 -1
  5. package/dist/chunks/{chunk-P5AZW6W6.js → chunk-64KT5RVX.js} +2 -2
  6. package/dist/chunks/{chunk-2F6JT2OC.js → chunk-7CTNFMKH.js} +1 -1
  7. package/dist/chunks/{chunk-HJ2TEW5Y.js → chunk-A6I3RGAN.js} +1 -1
  8. package/dist/chunks/{chunk-MS3WAXLU.js → chunk-AZP6TNVD.js} +1 -1
  9. package/dist/chunks/{chunk-A4B4JQVP.js → chunk-CQRLZB3Y.js} +2 -2
  10. package/dist/chunks/{chunk-5X7FBWLF.js → chunk-FR2CJ7AV.js} +4 -4
  11. package/dist/chunks/{chunk-E6FCE2XJ.js → chunk-JYTOXUQJ.js} +1 -1
  12. package/dist/chunks/{chunk-NRIXI6V5.js → chunk-KAICYGS4.js} +1 -1
  13. package/dist/chunks/{chunk-YE3C5CUX.js → chunk-LCNEKTLC.js} +31 -4
  14. package/dist/chunks/{chunk-KTX4RQFM.js → chunk-LUORN5H7.js} +65 -28
  15. package/dist/chunks/{chunk-YW7AYO7N.js → chunk-NG53DNDG.js} +1 -1
  16. package/dist/chunks/{chunk-Z2MBXYZZ.js → chunk-NKU6QGO6.js} +17 -2
  17. package/dist/chunks/{chunk-4D42VZRX.js → chunk-PEJCJXGI.js} +1 -1
  18. package/dist/chunks/{chunk-LGR4JRFA.js → chunk-RL7DANWP.js} +4 -4
  19. package/dist/chunks/{chunk-7B44AIGE.js → chunk-U7HYX4V6.js} +2 -2
  20. package/dist/chunks/{chunk-BRLY3Q4U.js → chunk-UZZBWCU2.js} +70 -4
  21. package/dist/chunks/{chunk-7AQDR2RX.js → chunk-WR6JALPR.js} +1 -1
  22. package/dist/chunks/{chunk-KWCZRH7N.js → chunk-ZKAWVYGP.js} +15 -8
  23. package/dist/chunks/{compile-vercel-config-D2OQCK4B.js → compile-vercel-config-7IAWGVM7.js} +1 -1
  24. package/dist/chunks/{delete-VMW7FORM.js → delete-DHYJ7ZYD.js} +2 -2
  25. package/dist/chunks/{disable-BDFZELDL.js → disable-A4D7SZ6G.js} +2 -2
  26. package/dist/chunks/{discard-WIN3BOXR.js → discard-PRE343AI.js} +2 -2
  27. package/dist/chunks/{edit-IZQX4XAG.js → edit-MWFKADR7.js} +3 -3
  28. package/dist/chunks/{enable-RFODZ2L7.js → enable-6P6TDM6D.js} +2 -2
  29. package/dist/chunks/{export-5CCLXZYT.js → export-WISO5LBX.js} +2 -2
  30. package/dist/chunks/{inspect-GEUUTDBY.js → inspect-EBIQ5XF3.js} +3 -3
  31. package/dist/chunks/{list-JIYDXQDJ.js → list-755IMC6Y.js} +3 -3
  32. package/dist/chunks/{list-H35AGNO2.js → list-OD7KO5BB.js} +2 -2
  33. package/dist/chunks/{ls-WPNFJAS6.js → ls-ZSVMQVZX.js} +4 -4
  34. package/dist/chunks/{publish-K7OPKXYC.js → publish-LMGSRL3X.js} +2 -2
  35. package/dist/chunks/{query-MAN4NKU4.js → query-WZTKABE4.js} +82 -10
  36. package/dist/chunks/{reorder-GQ7BOQA7.js → reorder-QK5QJ6TW.js} +2 -2
  37. package/dist/chunks/{restore-MODYFJSP.js → restore-VF3HDGON.js} +2 -2
  38. package/dist/chunks/{rm-A45OKS6U.js → rm-QP57BPQO.js} +4 -4
  39. package/dist/chunks/{rule-inspect-HJCERQHK.js → rule-inspect-ZZJ7SQJF.js} +4 -4
  40. package/dist/chunks/{rules-UNL3IB4P.js → rules-SUBKFNPR.js} +6 -6
  41. package/dist/chunks/{schema-WOW2BATT.js → schema-FSQEAUMR.js} +4 -4
  42. package/dist/chunks/{update-MOM4T2RN.js → update-DDCJ2EDT.js} +4 -4
  43. package/dist/commands/build/index.js +20 -12
  44. package/dist/commands/deploy/index.js +11 -11
  45. package/dist/commands/dev/index.js +9 -9
  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 +1209 -909
  50. package/dist/index.js +9 -9
  51. package/dist/version.mjs +1 -1
  52. package/package.json +15 -15
@@ -10,7 +10,7 @@ import {
10
10
  progress,
11
11
  require_dist as require_dist2,
12
12
  sleep
13
- } from "./chunk-A4B4JQVP.js";
13
+ } from "./chunk-CQRLZB3Y.js";
14
14
  import {
15
15
  suggestNextCommands
16
16
  } from "./chunk-LKBI43XK.js";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-TCF6MGBY.js";
21
21
  import {
22
22
  CommandTimeout
23
- } from "./chunk-BRLY3Q4U.js";
23
+ } from "./chunk-UZZBWCU2.js";
24
24
  import {
25
25
  showPluginTipIfNeeded
26
26
  } from "./chunk-BRQ6PX3U.js";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-64IF634X.js";
30
30
  import {
31
31
  getScope
32
- } from "./chunk-2F6JT2OC.js";
32
+ } from "./chunk-7CTNFMKH.js";
33
33
  import {
34
34
  getProjectByNameOrId,
35
35
  param,
@@ -37,7 +37,7 @@ import {
37
37
  require_dist as require_dist3,
38
38
  require_pluralize,
39
39
  ua_default
40
- } from "./chunk-KTX4RQFM.js";
40
+ } from "./chunk-LUORN5H7.js";
41
41
  import {
42
42
  require_lib
43
43
  } from "./chunk-N2T234LO.js";
@@ -2018,7 +2018,10 @@ async function processDeployment({
2018
2018
  if (event.type === "file-count") {
2019
2019
  const { total, missing, uploads } = event.payload;
2020
2020
  output_manager_default.debug(`Total files ${total.size}, ${missing.length} changed`);
2021
- const missingSize = missing.map((sha) => total.get(sha).data.length).reduce((a, b) => a + b, 0);
2021
+ const missingSize = missing.map((sha) => {
2022
+ const file = total.get(sha);
2023
+ return file?.data?.length ?? file?.size ?? 0;
2024
+ }).reduce((a, b) => a + b, 0);
2022
2025
  const totalSizeHuman = import_bytes.default.format(missingSize, { decimalPlaces: 1 });
2023
2026
  let nextStep = 0;
2024
2027
  const stepSize = now._client.stderr.isTTY ? 0 : 0.25;
@@ -2050,9 +2053,10 @@ async function processDeployment({
2050
2053
  updateProgress();
2051
2054
  }
2052
2055
  if (event.type === "file-uploaded") {
2056
+ const { file } = event.payload;
2053
2057
  output_manager_default.debug(
2054
- `Uploaded: ${event.payload.file.names.join(" ")} (${(0, import_bytes.default)(
2055
- event.payload.file.data.length
2058
+ `Uploaded: ${file.names.join(" ")} (${(0, import_bytes.default)(
2059
+ file.data?.length ?? file.size ?? 0
2056
2060
  )})`
2057
2061
  );
2058
2062
  }
@@ -2204,7 +2208,10 @@ function handleErrorSolvableWithArchive(error) {
2204
2208
  if ((0, import_error_utils.isErrorLike)(error)) {
2205
2209
  const isUploadRateLimit = "errorName" in error && typeof error.errorName === "string" && error.errorName.startsWith("api-upload-");
2206
2210
  const isTooManyFilesLimit = "code" in error && error.code === "too_many_files";
2207
- if (isUploadRateLimit || isTooManyFilesLimit) {
2211
+ const isEntityTooLarge = /entity too large|payload too large/i.test(
2212
+ error.message
2213
+ );
2214
+ if (isUploadRateLimit || isTooManyFilesLimit || isEntityTooLarge) {
2208
2215
  return new UploadErrorMissingArchive(
2209
2216
  `${error.message}
2210
2217
  ${archiveSuggestionText}`
@@ -11,7 +11,7 @@ import {
11
11
  findSourceVercelConfigFile,
12
12
  getVercelConfigPath,
13
13
  normalizeConfig
14
- } from "./chunk-KTX4RQFM.js";
14
+ } from "./chunk-LUORN5H7.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-WJPWCLMH.js";
18
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
30
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
20
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
29
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
20
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
29
+ import "./chunk-LUORN5H7.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-4D42VZRX.js";
22
+ } from "./chunk-PEJCJXGI.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-WJPWCLMH.js";
34
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
43
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
20
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
29
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
12
+ } from "./chunk-52DDM5F6.js";
13
13
  import {
14
14
  exportSubcommand
15
15
  } from "./chunk-IB56QKCM.js";
16
16
  import "./chunk-QH7WYDEP.js";
17
- import "./chunk-KTX4RQFM.js";
17
+ import "./chunk-LUORN5H7.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-7B44AIGE.js";
9
+ } from "./chunk-U7HYX4V6.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-2F6JT2OC.js";
27
+ } from "./chunk-7CTNFMKH.js";
28
28
  import {
29
29
  getLinkedProject,
30
30
  getProjectByNameOrId
31
- } from "./chunk-KTX4RQFM.js";
31
+ } from "./chunk-LUORN5H7.js";
32
32
  import "./chunk-Q77ALSXR.js";
33
33
  import {
34
34
  buildCommandWithGlobalFlags,
@@ -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-7B44AIGE.js";
9
+ } from "./chunk-U7HYX4V6.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-2F6JT2OC.js";
30
- import "./chunk-KTX4RQFM.js";
29
+ import "./chunk-7CTNFMKH.js";
30
+ import "./chunk-LUORN5H7.js";
31
31
  import "./chunk-Q77ALSXR.js";
32
32
  import {
33
33
  buildCommandWithGlobalFlags,
@@ -24,11 +24,11 @@ import {
24
24
  } from "./chunk-56AJHIQC.js";
25
25
  import {
26
26
  getScope
27
- } from "./chunk-2F6JT2OC.js";
27
+ } from "./chunk-7CTNFMKH.js";
28
28
  import {
29
29
  getLinkedProject,
30
30
  getProjectByNameOrId
31
- } from "./chunk-KTX4RQFM.js";
31
+ } from "./chunk-LUORN5H7.js";
32
32
  import "./chunk-Q77ALSXR.js";
33
33
  import "./chunk-NHGCQRK5.js";
34
34
  import "./chunk-N2T234LO.js";
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesCollectionPath
12
- } from "./chunk-HJ2TEW5Y.js";
13
- import "./chunk-7B44AIGE.js";
12
+ } from "./chunk-A6I3RGAN.js";
13
+ import "./chunk-U7HYX4V6.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-2F6JT2OC.js";
25
- import "./chunk-KTX4RQFM.js";
24
+ import "./chunk-7CTNFMKH.js";
25
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
20
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
29
+ import "./chunk-LUORN5H7.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-2F6JT2OC.js";
31
+ } from "./chunk-7CTNFMKH.js";
31
32
  import {
32
33
  getLinkedProject,
33
34
  getProjectByNameOrId
34
- } from "./chunk-KTX4RQFM.js";
35
+ } from "./chunk-LUORN5H7.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-WJPWCLMH.js";
19
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
28
+ import "./chunk-LUORN5H7.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-WJPWCLMH.js";
22
+ } from "./chunk-52DDM5F6.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-KTX4RQFM.js";
31
+ import "./chunk-LUORN5H7.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-HJ2TEW5Y.js";
13
- import "./chunk-7B44AIGE.js";
12
+ } from "./chunk-A6I3RGAN.js";
13
+ import "./chunk-U7HYX4V6.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-2F6JT2OC.js";
25
- import "./chunk-KTX4RQFM.js";
24
+ import "./chunk-7CTNFMKH.js";
25
+ import "./chunk-LUORN5H7.js";
26
26
  import "./chunk-Q77ALSXR.js";
27
27
  import {
28
28
  buildCommandWithGlobalFlags,
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-HJ2TEW5Y.js";
13
- import "./chunk-7B44AIGE.js";
12
+ } from "./chunk-A6I3RGAN.js";
13
+ import "./chunk-U7HYX4V6.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-2F6JT2OC.js";
25
- import "./chunk-KTX4RQFM.js";
24
+ import "./chunk-7CTNFMKH.js";
25
+ import "./chunk-LUORN5H7.js";
26
26
  import "./chunk-Q77ALSXR.js";
27
27
  import {
28
28
  buildCommandWithGlobalFlags,
@@ -32,7 +32,7 @@ var RULES_CONFIG = {
32
32
  };
33
33
  async function rules(client, argv) {
34
34
  if (argv.length === 0) {
35
- const lsFn = (await import("./ls-WPNFJAS6.js")).default;
35
+ const lsFn = (await import("./ls-ZSVMQVZX.js")).default;
36
36
  return lsFn(client, []);
37
37
  }
38
38
  const { subcommand, args, subcommandOriginal } = getSubcommand(
@@ -65,15 +65,15 @@ async function rules(client, argv) {
65
65
  }
66
66
  switch (subcommand) {
67
67
  case "ls":
68
- return (await import("./ls-WPNFJAS6.js")).default(client, args);
68
+ return (await import("./ls-ZSVMQVZX.js")).default(client, args);
69
69
  case "add":
70
- return (await import("./add-QQY6QOTO.js")).default(client, args);
70
+ return (await import("./add-ADMRKNTV.js")).default(client, args);
71
71
  case "inspect":
72
- return (await import("./rule-inspect-HJCERQHK.js")).default(client, args);
72
+ return (await import("./rule-inspect-ZZJ7SQJF.js")).default(client, args);
73
73
  case "rm":
74
- return (await import("./rm-A45OKS6U.js")).default(client, args);
74
+ return (await import("./rm-QP57BPQO.js")).default(client, args);
75
75
  case "update":
76
- return (await import("./update-MOM4T2RN.js")).default(client, args);
76
+ return (await import("./update-DDCJ2EDT.js")).default(client, args);
77
77
  default:
78
78
  output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`);
79
79
  return 1;
@@ -8,7 +8,7 @@ import {
8
8
  fetchMetricDetailOrExit,
9
9
  fetchMetricListOrExit,
10
10
  formatErrorJson
11
- } from "./chunk-Z2MBXYZZ.js";
11
+ } from "./chunk-NKU6QGO6.js";
12
12
  import {
13
13
  indent_default
14
14
  } from "./chunk-A3NYPUKZ.js";
@@ -20,13 +20,13 @@ import {
20
20
  } from "./chunk-XPKWKPWA.js";
21
21
  import {
22
22
  schemaSubcommand
23
- } from "./chunk-YE3C5CUX.js";
23
+ } from "./chunk-LCNEKTLC.js";
24
24
  import {
25
25
  getScope
26
- } from "./chunk-2F6JT2OC.js";
26
+ } from "./chunk-7CTNFMKH.js";
27
27
  import {
28
28
  require_pluralize
29
- } from "./chunk-KTX4RQFM.js";
29
+ } from "./chunk-LUORN5H7.js";
30
30
  import "./chunk-Q77ALSXR.js";
31
31
  import "./chunk-NHGCQRK5.js";
32
32
  import "./chunk-N2T234LO.js";
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-HJ2TEW5Y.js";
13
- import "./chunk-7B44AIGE.js";
12
+ } from "./chunk-A6I3RGAN.js";
13
+ import "./chunk-U7HYX4V6.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-2F6JT2OC.js";
25
- import "./chunk-KTX4RQFM.js";
24
+ import "./chunk-7CTNFMKH.js";
25
+ import "./chunk-LUORN5H7.js";
26
26
  import "./chunk-Q77ALSXR.js";
27
27
  import {
28
28
  buildCommandWithGlobalFlags,