vercel 59.0.0 → 59.1.3
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.
- package/dist/chunks/{add-SQ6ERCFZ.js → add-CUGPQYFW.js} +8 -8
- package/dist/chunks/{add-QZUQNL2C.js → add-PP3PJPJV.js} +5 -5
- package/dist/chunks/{add-3LO3UMYC.js → add-PRG4KKYH.js} +9 -11
- package/dist/chunks/{build-WMUKZEFH.js → build-T22GMLY6.js} +8 -8
- package/dist/chunks/{chunk-ELA5VN3A.js → chunk-2MF3ZAVW.js} +13 -4
- package/dist/chunks/{chunk-ZFTRB6AB.js → chunk-43DD2KNM.js} +1 -1
- package/dist/chunks/{chunk-N5DK7EMY.js → chunk-4HI7G6KG.js} +1 -1
- package/dist/chunks/{chunk-DQDJVHA5.js → chunk-4JKZ7SRX.js} +4 -4
- package/dist/chunks/{chunk-ZRWSSPW5.js → chunk-57G6HBJ4.js} +2 -2
- package/dist/chunks/{chunk-RWRSUGXY.js → chunk-5DVMXOFT.js} +2 -2
- package/dist/chunks/{chunk-SHR6DYA5.js → chunk-7NQLRE5V.js} +1 -1
- package/dist/chunks/{chunk-JLWQWYKO.js → chunk-BBSS3XIW.js} +2 -4
- package/dist/chunks/{chunk-V42UVZDX.js → chunk-BCZFZETZ.js} +5 -5
- package/dist/chunks/{chunk-MZ3L3SGZ.js → chunk-DAWJOQF6.js} +4 -6
- package/dist/chunks/{chunk-W34XLJ44.js → chunk-DEB45ND4.js} +3 -3
- package/dist/chunks/{chunk-QGQX7BYN.js → chunk-DOMLWKKZ.js} +38 -15
- package/dist/chunks/{chunk-TEQKKTJQ.js → chunk-F7OXZLY2.js} +2 -2
- package/dist/chunks/{chunk-J6LK45HT.js → chunk-GFCTRJI5.js} +16 -2
- package/dist/chunks/{chunk-O26N2UPI.js → chunk-GGPE5377.js} +1 -1
- package/dist/chunks/{chunk-4LDQIDRM.js → chunk-GMWRTZVZ.js} +9 -1
- package/dist/chunks/{chunk-LT5UQNTC.js → chunk-IKKUCZE7.js} +3 -3
- package/dist/chunks/{chunk-XIG4GH62.js → chunk-JYEO6OJS.js} +188 -102
- package/dist/chunks/{chunk-DMLU5KQE.js → chunk-KTLFN5FV.js} +1 -1
- package/dist/chunks/{chunk-L6NIIAB7.js → chunk-LNVZ3T7X.js} +6 -8
- package/dist/chunks/{chunk-UQVOFOP2.js → chunk-M34ZRNDQ.js} +1 -1
- package/dist/chunks/{chunk-2SFMOCWR.js → chunk-PD7ZUXE7.js} +1 -1
- package/dist/chunks/chunk-QCVKGY2A.js +151 -0
- package/dist/chunks/{chunk-S3H7ITUR.js → chunk-QD5NX7RG.js} +1 -1
- package/dist/chunks/{chunk-4N7XLXM2.js → chunk-QQ6PH4RY.js} +1 -0
- package/dist/chunks/{chunk-A5KP5HAI.js → chunk-RIB4S2IB.js} +10 -1
- package/dist/chunks/{chunk-ZX2FSPWV.js → chunk-SJQEGGH7.js} +4 -4
- package/dist/chunks/{chunk-5KI3SUJI.js → chunk-SOKQBFF7.js} +609 -73
- package/dist/chunks/{chunk-PSZQNYEV.js → chunk-SQGMTRZD.js} +91 -43
- package/dist/chunks/{chunk-TJJ562C5.js → chunk-TJLBCLEX.js} +15 -0
- package/dist/chunks/{chunk-WE3TFESA.js → chunk-TM3F7PLR.js} +2 -2
- package/dist/chunks/{chunk-SD2QZHZA.js → chunk-TNKRSTMB.js} +1 -1
- package/dist/chunks/{chunk-KT4XXKJK.js → chunk-VAFU7DXZ.js} +195 -3
- package/dist/chunks/{chunk-RQ7H43CJ.js → chunk-VDJN4WKH.js} +1 -1
- package/dist/chunks/{chunk-3R5JGMHV.js → chunk-VE545BR3.js} +4473 -2796
- package/dist/chunks/{chunk-B3JTF4CF.js → chunk-WC7IINFV.js} +10 -1
- package/dist/chunks/{chunk-SQAQED4U.js → chunk-XZLI27ES.js} +2 -2
- package/dist/chunks/{chunk-CMR5KQVR.js → chunk-ZUVJISHS.js} +3 -3
- package/dist/chunks/{clear-W2B4CHTP.js → clear-Z4IKUIN7.js} +5 -5
- package/dist/chunks/{compile-vercel-config-HTWOS7DZ.js → compile-vercel-config-PSVXFAZW.js} +3 -3
- package/dist/chunks/{config-EGJY4UUE.js → config-M5GMZ2X5.js} +8 -8
- package/dist/chunks/{constants-WEQVJSYS.js → constants-YMCRE6IG.js} +1 -1
- package/dist/chunks/{delete-BVMID4W2.js → delete-5GRRDJSF.js} +4 -4
- package/dist/chunks/{delete-6I7V5AGV.js → delete-P4XIBY7T.js} +5 -5
- package/dist/chunks/{disable-I54JNXJE.js → disable-NT5NYVO7.js} +4 -4
- package/dist/chunks/{discard-6TSJJCUQ.js → discard-TBNIEAJZ.js} +4 -4
- package/dist/chunks/{edit-YS2SWHFJ.js → edit-DJ6MT6HA.js} +5 -5
- package/dist/chunks/{edit-KCWYQ2YT.js → edit-UF3D2CCH.js} +5 -5
- package/dist/chunks/{enable-RYXRIGQN.js → enable-JTQBQMBO.js} +4 -4
- package/dist/chunks/{export-G3NYOADE.js → export-OKMRGRVM.js} +4 -4
- package/dist/chunks/{image-RJBLSUES.js → image-ARUJH4H5.js} +4 -4
- package/dist/chunks/{import-builders-M6F3F4DH.js → import-builders-3NTMZM64.js} +6 -4
- package/dist/chunks/{inspect-YTCVTZHY.js → inspect-5NETOGAI.js} +6 -7
- package/dist/chunks/{inspect-AE4YIJYS.js → inspect-CHFKZKKP.js} +5 -5
- package/dist/chunks/{inspect-Z74NZZ2A.js → inspect-FXZTQY62.js} +6 -6
- package/dist/chunks/{inspect-E7TBGK7D.js → inspect-PTXIBSYW.js} +8 -8
- package/dist/chunks/{inspect-7XUEVBDM.js → inspect-UXP2HDES.js} +5 -5
- package/dist/chunks/{list-SGPLL4KJ.js → list-2WMIVJ2R.js} +15 -10
- package/dist/chunks/{list-KJNC3NOE.js → list-ADI55WKW.js} +6 -7
- package/dist/chunks/{list-WXS2AFQD.js → list-DYCZA2VX.js} +3 -3
- package/dist/chunks/{login-XD3CFPBF.js → login-YCSIQG6B.js} +8 -8
- package/dist/chunks/{ls-5DSOTTYX.js → ls-2TKUIUK4.js} +11 -12
- package/dist/chunks/{ls-KE5I7BZO.js → ls-EOMIQLRH.js} +11 -12
- package/dist/chunks/{ls-SVSO3677.js → ls-PQFDGOJL.js} +7 -8
- package/dist/chunks/{ls-5A4327XJ.js → ls-RZVTIP5U.js} +11 -12
- package/dist/chunks/{ls-NBKSDTWX.js → ls-VIOMDUGW.js} +14 -15
- package/dist/chunks/{open-M2MOAE2K.js → open-JYPWOXQD.js} +5 -5
- package/dist/chunks/{permissions-ADPY554K.js → permissions-SGJWGEVD.js} +6 -6
- package/dist/chunks/{publish-OBIOOL7T.js → publish-ZUQHJAXL.js} +4 -4
- package/dist/chunks/{push-5237XBTO.js → push-XMVKG5A5.js} +8 -8
- package/dist/chunks/{query-ILL74HIA.js → query-ZLJZEGZB.js} +237 -49
- package/dist/chunks/{reorder-GAUAO4LW.js → reorder-NVHDWMRU.js} +4 -4
- package/dist/chunks/{reply-IZJHEULD.js → reply-PUUPUQ3V.js} +5 -5
- package/dist/chunks/{resolve-HTIT7CGL.js → resolve-5U2LJVE6.js} +5 -5
- package/dist/chunks/{restore-IKL74HSE.js → restore-OXIUY2UI.js} +4 -4
- package/dist/chunks/{rm-QAVNP5KX.js → rm-3IOCBNPE.js} +5 -5
- package/dist/chunks/{rm-5Y6BL47T.js → rm-BZNKJRXU.js} +5 -5
- package/dist/chunks/{rm-C37ZORQV.js → rm-OUI4ZB5R.js} +5 -5
- package/dist/chunks/{rm-XJU5SBGH.js → rm-Z2KYJ7XT.js} +8 -8
- package/dist/chunks/{rule-inspect-DYHWWROS.js → rule-inspect-ZBJJCDQV.js} +7 -8
- package/dist/chunks/{rules-M6EJ2Y6S.js → rules-HEGAXXUN.js} +8 -8
- package/dist/chunks/{schema-LLBDZNIC.js → schema-7GVL3BNP.js} +63 -31
- package/dist/chunks/{schema-ZNPIMQL5.js → schema-ZYIJYA2E.js} +2 -3
- package/dist/chunks/{tags-HR5RVQFA.js → tags-3SCWCMNQ.js} +3 -3
- package/dist/chunks/{types-UWI4HETD.js → types-AJHILHO5.js} +2 -4
- package/dist/chunks/{update-6A5V6HBH.js → update-YR2GCCJN.js} +7 -8
- package/dist/commands/build/index.js +10 -15
- package/dist/commands/deploy/index.js +310 -302
- package/dist/commands/dev/index.js +254 -181
- package/dist/commands/env/index.js +15 -16
- package/dist/commands/link/index.js +14 -20
- package/dist/commands/list/index.js +7 -9
- package/dist/commands-bulk.js +4408 -1246
- package/dist/help.js +1 -1
- package/dist/index.js +30 -22
- package/dist/version.mjs +1 -1
- package/package.json +41 -40
- package/dist/chunks/chunk-BGILSKZ5.js +0 -85
- package/dist/chunks/chunk-GFG6QDIE.js +0 -101
- package/dist/chunks/chunk-KBEX5MYS.js +0 -208
- package/dist/chunks/chunk-PBECT5BN.js +0 -107
- package/dist/chunks/chunk-PVCJIMVY.js +0 -1552
- /package/dist/{commands/dev/next-dev-websocket-shim-preload.cjs → runtime-assets/node-preloads/next-dev-websocket.cjs} +0 -0
|
@@ -16,16 +16,16 @@ import {
|
|
|
16
16
|
} from "./chunk-A3NYPUKZ.js";
|
|
17
17
|
import {
|
|
18
18
|
ellipsizeMiddle
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VDJN4WKH.js";
|
|
20
20
|
import {
|
|
21
21
|
elapsed
|
|
22
22
|
} from "./chunk-VXYGCOKL.js";
|
|
23
|
-
import {
|
|
24
|
-
table
|
|
25
|
-
} from "./chunk-KT4XXKJK.js";
|
|
26
23
|
import {
|
|
27
24
|
require_ms
|
|
28
25
|
} from "./chunk-GGP5R3FU.js";
|
|
26
|
+
import {
|
|
27
|
+
table
|
|
28
|
+
} from "./chunk-VAFU7DXZ.js";
|
|
29
29
|
import {
|
|
30
30
|
require_source
|
|
31
31
|
} from "./chunk-S7KYDPEM.js";
|
|
@@ -125,26 +125,101 @@ function toGranularityMsFromDuration(duration) {
|
|
|
125
125
|
return duration.days * DAY_MS;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// src/commands/metrics/types.ts
|
|
129
|
+
var CANONICAL_AGGREGATIONS = [
|
|
130
|
+
"count",
|
|
131
|
+
"sum",
|
|
132
|
+
"avg",
|
|
133
|
+
"min",
|
|
134
|
+
"max",
|
|
135
|
+
"p50",
|
|
136
|
+
"p75",
|
|
137
|
+
"p90",
|
|
138
|
+
"p95",
|
|
139
|
+
"p99"
|
|
140
|
+
];
|
|
141
|
+
function isCanonicalAggregation(aggregation) {
|
|
142
|
+
return CANONICAL_AGGREGATIONS.includes(aggregation);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/commands/metrics/metric-units.ts
|
|
146
|
+
var DURATION_UNITS = /* @__PURE__ */ new Set([
|
|
147
|
+
"nanoseconds",
|
|
148
|
+
"microseconds",
|
|
149
|
+
"milliseconds",
|
|
150
|
+
"seconds",
|
|
151
|
+
"minutes",
|
|
152
|
+
"hours",
|
|
153
|
+
"days"
|
|
154
|
+
]);
|
|
155
|
+
function normalizeMetricUnit(unit) {
|
|
156
|
+
return unit.trim().toLowerCase().replace(/[_\s]+/g, " ");
|
|
157
|
+
}
|
|
158
|
+
function getPreferredCustomMetricAggregation(unit) {
|
|
159
|
+
const normalizedUnit = normalizeMetricUnit(unit);
|
|
160
|
+
if (DURATION_UNITS.has(normalizedUnit)) {
|
|
161
|
+
return "p75";
|
|
162
|
+
}
|
|
163
|
+
if (normalizedUnit === "percent") {
|
|
164
|
+
return "avg";
|
|
165
|
+
}
|
|
166
|
+
return "sum";
|
|
167
|
+
}
|
|
168
|
+
function getDefaultCustomMetricAggregation(unit, aggregations) {
|
|
169
|
+
const preferredAggregation = getPreferredCustomMetricAggregation(unit);
|
|
170
|
+
if (aggregations?.includes(preferredAggregation)) {
|
|
171
|
+
return preferredAggregation;
|
|
172
|
+
}
|
|
173
|
+
if (aggregations?.includes("sum")) {
|
|
174
|
+
return "sum";
|
|
175
|
+
}
|
|
176
|
+
return aggregations?.find(isCanonicalAggregation) ?? "sum";
|
|
177
|
+
}
|
|
178
|
+
|
|
128
179
|
// src/commands/metrics/text-output.ts
|
|
129
180
|
var import_chalk = __toESM(require_source(), 1);
|
|
130
181
|
var GROUP_KEY_DELIMITER = "";
|
|
131
182
|
var MAX_SPARKLINE_LENGTH = 120;
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
183
|
+
var DURATION_SCALE_MS = {
|
|
184
|
+
seconds: 1e3,
|
|
185
|
+
minutes: 6e4,
|
|
186
|
+
hours: 36e5,
|
|
187
|
+
days: 864e5
|
|
188
|
+
};
|
|
189
|
+
var BYTE_SCALE = {
|
|
190
|
+
bytes: 1,
|
|
191
|
+
kilobytes: 1e3,
|
|
192
|
+
megabytes: 1e6,
|
|
193
|
+
gigabytes: 1e9,
|
|
194
|
+
terabytes: 1e12,
|
|
195
|
+
petabytes: 1e15
|
|
196
|
+
};
|
|
197
|
+
var COMPACT_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
198
|
+
notation: "compact",
|
|
199
|
+
compactDisplay: "short"
|
|
200
|
+
});
|
|
201
|
+
var TWO_FRACTION_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
202
|
+
maximumFractionDigits: 2
|
|
203
|
+
});
|
|
204
|
+
var TWO_SIGNIFICANT_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
205
|
+
minimumSignificantDigits: 2,
|
|
206
|
+
maximumSignificantDigits: 2,
|
|
207
|
+
maximumFractionDigits: 2
|
|
208
|
+
});
|
|
209
|
+
var PERCENTAGE_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
210
|
+
style: "unit",
|
|
211
|
+
unit: "percent",
|
|
212
|
+
unitDisplay: "narrow",
|
|
213
|
+
maximumFractionDigits: 1
|
|
214
|
+
});
|
|
215
|
+
var USD_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
216
|
+
style: "currency",
|
|
217
|
+
currency: "USD",
|
|
218
|
+
minimumFractionDigits: 2,
|
|
219
|
+
maximumFractionDigits: 2
|
|
220
|
+
});
|
|
143
221
|
var BLOCKS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
144
222
|
var MISSING_CHAR = "\xB7";
|
|
145
|
-
function normalizeUnit(unit) {
|
|
146
|
-
return unit.trim().toLowerCase().replace(/[_\s]+/g, " ");
|
|
147
|
-
}
|
|
148
223
|
function isAggregationWithDimension(aggregation) {
|
|
149
224
|
const [, dimension] = aggregation.split("/");
|
|
150
225
|
return Boolean(dimension);
|
|
@@ -180,36 +255,8 @@ function formatPeriodSpan(startInput, endInput) {
|
|
|
180
255
|
}
|
|
181
256
|
return elapsed(durationMs);
|
|
182
257
|
}
|
|
183
|
-
function formatUnitLabel(unit) {
|
|
184
|
-
switch (normalizeUnit(unit)) {
|
|
185
|
-
case "milliseconds":
|
|
186
|
-
return "ms";
|
|
187
|
-
case "seconds":
|
|
188
|
-
return "s";
|
|
189
|
-
case "usd":
|
|
190
|
-
case "us dollars":
|
|
191
|
-
return "USD";
|
|
192
|
-
case "gigabyte hour":
|
|
193
|
-
case "gigabyte hours":
|
|
194
|
-
return "GB-h";
|
|
195
|
-
default:
|
|
196
|
-
return unit;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function isCountIntegerDisplay(measureType, aggregation) {
|
|
200
|
-
return measureType === "count" && aggregation === "sum";
|
|
201
|
-
}
|
|
202
|
-
function formatNumber(value, measureType, aggregation, opts) {
|
|
203
|
-
if (isCountIntegerDisplay(measureType, aggregation)) {
|
|
204
|
-
if (opts?.preserveFractionalCountSum && !Number.isInteger(value)) {
|
|
205
|
-
return formatDecimal(value);
|
|
206
|
-
}
|
|
207
|
-
return formatCount(value);
|
|
208
|
-
}
|
|
209
|
-
return formatDecimal(value);
|
|
210
|
-
}
|
|
211
258
|
function getStatColumns(aggregation) {
|
|
212
|
-
if (aggregation === "sum") {
|
|
259
|
+
if (aggregation === "sum" || aggregation === "count") {
|
|
213
260
|
return ["total", "avg", "min", "max"];
|
|
214
261
|
}
|
|
215
262
|
return ["avg", "min", "max"];
|
|
@@ -250,13 +297,13 @@ function normalizeTimestampToIso(timestamp) {
|
|
|
250
297
|
}
|
|
251
298
|
return new Date(parsed).toISOString();
|
|
252
299
|
}
|
|
253
|
-
function formatStatCell(column, stats,
|
|
300
|
+
function formatStatCell(column, stats, periodStart, periodEnd, formatValue) {
|
|
254
301
|
switch (column) {
|
|
255
302
|
case "total":
|
|
256
|
-
return
|
|
303
|
+
return formatValue(stats.total);
|
|
257
304
|
case "avg":
|
|
258
|
-
return
|
|
259
|
-
|
|
305
|
+
return formatValue(stats.avg, {
|
|
306
|
+
preserveFractionalCount: true
|
|
260
307
|
});
|
|
261
308
|
case "min": {
|
|
262
309
|
const ts = formatMinMaxTimestamp(
|
|
@@ -264,7 +311,7 @@ function formatStatCell(column, stats, measureType, aggregation, periodStart, pe
|
|
|
264
311
|
periodStart,
|
|
265
312
|
periodEnd
|
|
266
313
|
);
|
|
267
|
-
return `${
|
|
314
|
+
return `${formatValue(stats.min.value)} at ${ts}`;
|
|
268
315
|
}
|
|
269
316
|
case "max": {
|
|
270
317
|
const ts = formatMinMaxTimestamp(
|
|
@@ -272,7 +319,7 @@ function formatStatCell(column, stats, measureType, aggregation, periodStart, pe
|
|
|
272
319
|
periodStart,
|
|
273
320
|
periodEnd
|
|
274
321
|
);
|
|
275
|
-
return `${
|
|
322
|
+
return `${formatValue(stats.max.value)} at ${ts}`;
|
|
276
323
|
}
|
|
277
324
|
}
|
|
278
325
|
}
|
|
@@ -312,22 +359,6 @@ function buildSeriesTimestamps(periodStart, periodEnd, granularityMs, observedTi
|
|
|
312
359
|
}
|
|
313
360
|
return buildObservedTimestamps(observedTimestamps, granularityMs);
|
|
314
361
|
}
|
|
315
|
-
function getMeasureType(unit) {
|
|
316
|
-
const normalized = normalizeUnit(unit);
|
|
317
|
-
if (COUNT_UNITS.has(normalized)) {
|
|
318
|
-
return "count";
|
|
319
|
-
}
|
|
320
|
-
if (DURATION_UNITS.has(normalized)) {
|
|
321
|
-
return "duration";
|
|
322
|
-
}
|
|
323
|
-
if (BYTES_UNITS.has(normalized)) {
|
|
324
|
-
return "bytes";
|
|
325
|
-
}
|
|
326
|
-
if (RATIO_UNITS.has(normalized)) {
|
|
327
|
-
return "ratio";
|
|
328
|
-
}
|
|
329
|
-
return "ratio";
|
|
330
|
-
}
|
|
331
362
|
function formatCount(n) {
|
|
332
363
|
return Math.round(n).toLocaleString("en-US");
|
|
333
364
|
}
|
|
@@ -349,6 +380,88 @@ function formatDecimal(n) {
|
|
|
349
380
|
const trimmed = fixed.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, "").replace(/\.$/, "");
|
|
350
381
|
return `${sign}${trimmed}`;
|
|
351
382
|
}
|
|
383
|
+
function formatDuration(durationMs) {
|
|
384
|
+
const durationSeconds = durationMs / 1e3;
|
|
385
|
+
if (durationMs < 1e3) {
|
|
386
|
+
return `${durationMs.toFixed(0)}ms`;
|
|
387
|
+
}
|
|
388
|
+
if (durationMs < 5e3) {
|
|
389
|
+
return `${Math.round(durationSeconds * 100) / 100}s`;
|
|
390
|
+
}
|
|
391
|
+
if (durationSeconds < 60) {
|
|
392
|
+
return `${durationSeconds.toFixed(0)}s`;
|
|
393
|
+
}
|
|
394
|
+
if (durationSeconds < 3600) {
|
|
395
|
+
return `${(durationSeconds / 60).toFixed(0)}m`;
|
|
396
|
+
}
|
|
397
|
+
return `${(durationSeconds / 3600).toFixed(0)}h`;
|
|
398
|
+
}
|
|
399
|
+
function formatBytes(bytes) {
|
|
400
|
+
if (bytes === 0) {
|
|
401
|
+
return "0 Bytes";
|
|
402
|
+
}
|
|
403
|
+
const units = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
404
|
+
const absoluteBytes = Math.abs(bytes);
|
|
405
|
+
let unitIndex = Math.min(
|
|
406
|
+
units.length - 1,
|
|
407
|
+
Math.max(0, Math.floor(Math.log(absoluteBytes) / Math.log(1e3)))
|
|
408
|
+
);
|
|
409
|
+
let value = bytes / 1e3 ** unitIndex;
|
|
410
|
+
if (unitIndex === 1 || unitIndex === 2) {
|
|
411
|
+
value = Math.round(value);
|
|
412
|
+
if (Math.abs(value) === 1e3 && unitIndex < units.length - 1) {
|
|
413
|
+
value /= 1e3;
|
|
414
|
+
unitIndex += 1;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return `${TWO_FRACTION_NUMBER_FORMATTER.format(value)} ${units[unitIndex]}`;
|
|
418
|
+
}
|
|
419
|
+
function formatMetricValue(value, baseUnit, aggregation, opts) {
|
|
420
|
+
const formatCountValue = () => opts?.preserveFractionalCount && !Number.isInteger(value) ? formatDecimal(value) : formatCount(value);
|
|
421
|
+
if (isAggregationWithDimension(aggregation) || aggregation === "count") {
|
|
422
|
+
return formatCountValue();
|
|
423
|
+
}
|
|
424
|
+
const unit = normalizeMetricUnit(baseUnit ?? "units");
|
|
425
|
+
if (aggregation === "percent" || unit === "percent") {
|
|
426
|
+
return PERCENTAGE_FORMATTER.format(value);
|
|
427
|
+
}
|
|
428
|
+
if (aggregation === "unique") {
|
|
429
|
+
return COMPACT_NUMBER_FORMATTER.format(value);
|
|
430
|
+
}
|
|
431
|
+
const withRateSuffix = (formatted2) => aggregation === "persecond" ? `${formatted2}/s` : formatted2;
|
|
432
|
+
if (unit === "milliseconds") {
|
|
433
|
+
return withRateSuffix(formatDuration(value));
|
|
434
|
+
}
|
|
435
|
+
const durationScale = DURATION_SCALE_MS[unit];
|
|
436
|
+
if (durationScale) {
|
|
437
|
+
return withRateSuffix(formatDuration(value * durationScale));
|
|
438
|
+
}
|
|
439
|
+
if (unit === "nanoseconds" || unit === "microseconds") {
|
|
440
|
+
const suffix = unit === "nanoseconds" ? " ns" : " \xB5s";
|
|
441
|
+
const formatted2 = TWO_FRACTION_NUMBER_FORMATTER.format(value);
|
|
442
|
+
return withRateSuffix(`${formatted2}${suffix}`);
|
|
443
|
+
}
|
|
444
|
+
const byteScale = BYTE_SCALE[unit];
|
|
445
|
+
if (byteScale) {
|
|
446
|
+
return withRateSuffix(formatBytes(value * byteScale));
|
|
447
|
+
}
|
|
448
|
+
if (unit === "gigabyte hour" || unit === "gigabyte hours") {
|
|
449
|
+
const formatted2 = TWO_SIGNIFICANT_NUMBER_FORMATTER.format(value);
|
|
450
|
+
return withRateSuffix(`${formatted2} GB-hrs`);
|
|
451
|
+
}
|
|
452
|
+
if (unit === "usd" || unit === "us dollars" || unit === "dollars") {
|
|
453
|
+
return withRateSuffix(USD_FORMATTER.format(value));
|
|
454
|
+
}
|
|
455
|
+
if (unit === "count" && aggregation === "sum") {
|
|
456
|
+
return formatCountValue();
|
|
457
|
+
}
|
|
458
|
+
const formatted = COMPACT_NUMBER_FORMATTER.format(value);
|
|
459
|
+
const unitLabel = baseUnit?.trim();
|
|
460
|
+
if (!unitLabel || unit === "units" || unit === "count" || unit === "ratio") {
|
|
461
|
+
return withRateSuffix(formatted);
|
|
462
|
+
}
|
|
463
|
+
return withRateSuffix(`${formatted} ${unitLabel}`);
|
|
464
|
+
}
|
|
352
465
|
function formatMinMaxTimestamp(date, periodStart, periodEnd) {
|
|
353
466
|
const sameDay = periodStart.getUTCFullYear() === periodEnd.getUTCFullYear() && periodStart.getUTCMonth() === periodEnd.getUTCMonth() && periodStart.getUTCDate() === periodEnd.getUTCDate();
|
|
354
467
|
if (sameDay) {
|
|
@@ -542,9 +655,6 @@ function formatMetadataHeader(opts) {
|
|
|
542
655
|
value: `${opts.teamName ?? opts.scope.ownerId} (all projects)`
|
|
543
656
|
});
|
|
544
657
|
}
|
|
545
|
-
if (opts.unit && normalizeUnit(opts.unit) !== "count") {
|
|
546
|
-
rows.push({ key: "Units", value: formatUnitLabel(opts.unit) });
|
|
547
|
-
}
|
|
548
658
|
if (!opts.compact && typeof opts.groupCount === "number") {
|
|
549
659
|
rows.push({ key: "Groups", value: String(opts.groupCount) });
|
|
550
660
|
}
|
|
@@ -568,10 +678,9 @@ function formatSummaryTable(opts) {
|
|
|
568
678
|
(column) => formatStatCell(
|
|
569
679
|
column,
|
|
570
680
|
row.stats,
|
|
571
|
-
opts.measureType,
|
|
572
|
-
opts.aggregation,
|
|
573
681
|
opts.periodStart,
|
|
574
|
-
opts.periodEnd
|
|
682
|
+
opts.periodEnd,
|
|
683
|
+
opts.formatValue
|
|
575
684
|
)
|
|
576
685
|
)
|
|
577
686
|
);
|
|
@@ -617,33 +726,9 @@ function formatSparklineSection(groupRows, sparklines, groupByFields, compact =
|
|
|
617
726
|
return compact ? chart : `sparklines:
|
|
618
727
|
${chart}`;
|
|
619
728
|
}
|
|
620
|
-
function getEffectiveDisplay(baseUnit, aggregation) {
|
|
621
|
-
if (isAggregationWithDimension(aggregation)) {
|
|
622
|
-
return { displayUnit: void 0, measureType: "count" };
|
|
623
|
-
}
|
|
624
|
-
switch (aggregation) {
|
|
625
|
-
case "percent":
|
|
626
|
-
return { displayUnit: "%", measureType: "ratio" };
|
|
627
|
-
case "persecond": {
|
|
628
|
-
const label = baseUnit ? formatUnitLabel(baseUnit) : void 0;
|
|
629
|
-
return {
|
|
630
|
-
displayUnit: label ? `${label}/s` : void 0,
|
|
631
|
-
measureType: getMeasureType(baseUnit ?? "ratio")
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
default:
|
|
635
|
-
return {
|
|
636
|
-
displayUnit: baseUnit,
|
|
637
|
-
measureType: getMeasureType(baseUnit ?? "ratio")
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
729
|
function formatText(response, opts) {
|
|
642
730
|
const rollupColumn = getRollupColumnName(opts.metric, opts.aggregation);
|
|
643
|
-
const
|
|
644
|
-
opts.metricUnit,
|
|
645
|
-
opts.aggregation
|
|
646
|
-
);
|
|
731
|
+
const formatValue = (value, formatOptions) => formatMetricValue(value, opts.metricUnit, opts.aggregation, formatOptions);
|
|
647
732
|
const granularityMs = toGranularityMsFromDuration(opts.granularity);
|
|
648
733
|
const orderMetadata = getResolvedOrderMetadata(opts, response);
|
|
649
734
|
const { groups, series, groupValues } = extractGroupedSeries(
|
|
@@ -674,7 +759,6 @@ function formatText(response, opts) {
|
|
|
674
759
|
scope: opts.scope,
|
|
675
760
|
projectName: opts.projectName,
|
|
676
761
|
teamName: opts.teamName,
|
|
677
|
-
unit: displayUnit,
|
|
678
762
|
groupCount: opts.groupBy.length > 0 ? groups.length : void 0,
|
|
679
763
|
compact: opts.presentation?.compact
|
|
680
764
|
});
|
|
@@ -705,10 +789,10 @@ No data found for this period.
|
|
|
705
789
|
const summaryTable = formatSummaryTable({
|
|
706
790
|
rows: summaryRows,
|
|
707
791
|
groupByFields: opts.groupBy,
|
|
708
|
-
measureType,
|
|
709
792
|
aggregation: opts.aggregation,
|
|
710
793
|
periodStart: new Date(opts.periodStart),
|
|
711
794
|
periodEnd: new Date(opts.periodEnd),
|
|
795
|
+
formatValue,
|
|
712
796
|
ansiAwareGroupValues: opts.presentation?.compact
|
|
713
797
|
});
|
|
714
798
|
const groupedOutput = opts.groupBy.length > 0;
|
|
@@ -726,5 +810,7 @@ No data found for this period.
|
|
|
726
810
|
export {
|
|
727
811
|
computeGranularity,
|
|
728
812
|
toGranularityMsFromDuration,
|
|
813
|
+
isCanonicalAggregation,
|
|
814
|
+
getDefaultCustomMetricAggregation,
|
|
729
815
|
formatText
|
|
730
816
|
};
|
|
@@ -6,35 +6,33 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
writeProjectSettings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4HI7G6KG.js";
|
|
10
10
|
import {
|
|
11
11
|
autoInstallVercelPlugin
|
|
12
12
|
} from "./chunk-HT2XWSAJ.js";
|
|
13
13
|
import {
|
|
14
14
|
stamp_default
|
|
15
15
|
} from "./chunk-64IF634X.js";
|
|
16
|
-
import {
|
|
17
|
-
ensureLink
|
|
18
|
-
} from "./chunk-PBECT5BN.js";
|
|
19
16
|
import {
|
|
20
17
|
pullCommand
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-7NQLRE5V.js";
|
|
22
19
|
import {
|
|
23
20
|
help
|
|
24
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SJQEGGH7.js";
|
|
25
22
|
import {
|
|
26
23
|
VERCEL_DIR,
|
|
27
24
|
VERCEL_DIR_PROJECT,
|
|
25
|
+
ensureLink,
|
|
28
26
|
envPullCommandLogic,
|
|
29
27
|
humanizePath,
|
|
30
28
|
parseTarget
|
|
31
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-VE545BR3.js";
|
|
32
30
|
import {
|
|
33
31
|
TelemetryClient
|
|
34
32
|
} from "./chunk-ECCWJHC6.js";
|
|
35
33
|
import {
|
|
36
34
|
printError
|
|
37
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-VAFU7DXZ.js";
|
|
38
36
|
import {
|
|
39
37
|
parseArguments
|
|
40
38
|
} from "./chunk-XLKFJPMT.js";
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
formatErrorJson,
|
|
9
|
+
handleApiError
|
|
10
|
+
} from "./chunk-NM43FFV6.js";
|
|
11
|
+
import {
|
|
12
|
+
isAPIError
|
|
13
|
+
} from "./chunk-SOFC4MLS.js";
|
|
14
|
+
import {
|
|
15
|
+
output_manager_default
|
|
16
|
+
} from "./chunk-OX7KI3LF.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/metrics/schema-api.ts
|
|
19
|
+
var OBSERVABILITY_METRICS_PATH = "/metrics/v1";
|
|
20
|
+
var METRIC_CATALOG_PAGE_SIZE = 250;
|
|
21
|
+
function toMetricDetail(metric) {
|
|
22
|
+
return {
|
|
23
|
+
id: metric.id,
|
|
24
|
+
description: metric.description,
|
|
25
|
+
dimensions: metric.dimensions,
|
|
26
|
+
unit: metric.unit,
|
|
27
|
+
aggregations: metric.aggregations,
|
|
28
|
+
defaultAggregation: metric.defaultAggregation
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getDefaultAggregation(detail, metricId) {
|
|
32
|
+
return detail.find((metric) => metric.id === metricId)?.defaultAggregation;
|
|
33
|
+
}
|
|
34
|
+
async function fetchMetricList(client, accountId) {
|
|
35
|
+
const { metrics } = await client.fetch(
|
|
36
|
+
"/v2/observability/schema",
|
|
37
|
+
{ accountId }
|
|
38
|
+
);
|
|
39
|
+
return metrics;
|
|
40
|
+
}
|
|
41
|
+
async function fetchCustomMetricCatalog(client, accountId, search, activeSince) {
|
|
42
|
+
const metrics = [];
|
|
43
|
+
let cursor = null;
|
|
44
|
+
do {
|
|
45
|
+
const searchParams = new URLSearchParams({
|
|
46
|
+
limit: String(METRIC_CATALOG_PAGE_SIZE),
|
|
47
|
+
kind: "custom"
|
|
48
|
+
});
|
|
49
|
+
if (search) {
|
|
50
|
+
searchParams.set("search", search);
|
|
51
|
+
}
|
|
52
|
+
if (activeSince) {
|
|
53
|
+
searchParams.set("activeSince", activeSince);
|
|
54
|
+
}
|
|
55
|
+
if (cursor) {
|
|
56
|
+
searchParams.set("cursor", cursor);
|
|
57
|
+
}
|
|
58
|
+
const response = await client.fetch(
|
|
59
|
+
`${OBSERVABILITY_METRICS_PATH}?${searchParams}`,
|
|
60
|
+
{ accountId }
|
|
61
|
+
);
|
|
62
|
+
metrics.push(
|
|
63
|
+
...response.metrics.map((metric) => ({
|
|
64
|
+
id: metric.id,
|
|
65
|
+
description: metric.description,
|
|
66
|
+
dimensions: metric.dimensions,
|
|
67
|
+
unit: metric.unit,
|
|
68
|
+
aggregations: metric.aggregations
|
|
69
|
+
}))
|
|
70
|
+
);
|
|
71
|
+
cursor = response.pagination.hasMore ? response.pagination.nextCursor : null;
|
|
72
|
+
} while (cursor);
|
|
73
|
+
return metrics.filter(
|
|
74
|
+
(metric) => !metric.id.startsWith("vercel.") && (!search || metric.id.startsWith(search))
|
|
75
|
+
).sort((left, right) => left.id.localeCompare(right.id));
|
|
76
|
+
}
|
|
77
|
+
async function fetchCustomMetricDetail(client, accountId, metricId) {
|
|
78
|
+
const metrics = await fetchCustomMetricCatalog(client, accountId, metricId);
|
|
79
|
+
const exactMetric = metrics.find((metric) => metric.id === metricId);
|
|
80
|
+
if (!exactMetric) {
|
|
81
|
+
return metrics;
|
|
82
|
+
}
|
|
83
|
+
return [exactMetric];
|
|
84
|
+
}
|
|
85
|
+
async function fetchMetricDetail(client, accountId, metricId) {
|
|
86
|
+
const detail = await client.fetch(
|
|
87
|
+
`/v2/observability/schema/${encodeURIComponent(metricId)}`,
|
|
88
|
+
{ accountId }
|
|
89
|
+
);
|
|
90
|
+
return detail.map(toMetricDetail);
|
|
91
|
+
}
|
|
92
|
+
async function fetchSchemaOrExit(client, jsonOutput, operation) {
|
|
93
|
+
try {
|
|
94
|
+
return await operation();
|
|
95
|
+
} catch (err) {
|
|
96
|
+
if (isAPIError(err)) {
|
|
97
|
+
return handleApiError(err, jsonOutput, client, {
|
|
98
|
+
401: {
|
|
99
|
+
code: "SCHEMA_UNAUTHORIZED",
|
|
100
|
+
message: "The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."
|
|
101
|
+
},
|
|
102
|
+
403: {
|
|
103
|
+
code: "SCHEMA_UNAUTHORIZED",
|
|
104
|
+
message: "The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const message = err instanceof Error ? `Failed to fetch metrics schema: ${err.message}` : `Failed to fetch metrics schema: ${String(err)}`;
|
|
109
|
+
if (jsonOutput) {
|
|
110
|
+
client.stdout.write(formatErrorJson("SCHEMA_FETCH_FAILED", message));
|
|
111
|
+
} else {
|
|
112
|
+
output_manager_default.error(message);
|
|
113
|
+
}
|
|
114
|
+
return 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function fetchCustomMetricDetailOrExit(client, accountId, jsonOutput, metricId) {
|
|
118
|
+
return fetchSchemaOrExit(
|
|
119
|
+
client,
|
|
120
|
+
jsonOutput,
|
|
121
|
+
() => fetchCustomMetricDetail(client, accountId, metricId)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function fetchCombinedMetricListOrExit(client, accountId, jsonOutput) {
|
|
125
|
+
return fetchSchemaOrExit(client, jsonOutput, async () => {
|
|
126
|
+
const [platformMetrics, customMetrics] = await Promise.all([
|
|
127
|
+
fetchMetricList(client, accountId),
|
|
128
|
+
fetchCustomMetricCatalog(client, accountId).catch(() => [])
|
|
129
|
+
]);
|
|
130
|
+
return [
|
|
131
|
+
...platformMetrics.filter((metric) => metric.id.startsWith("vercel.")),
|
|
132
|
+
...customMetrics.map(({ id, description }) => ({ id, description }))
|
|
133
|
+
].sort((left, right) => left.id.localeCompare(right.id));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async function fetchMetricDetailOrExit(client, accountId, metricId, jsonOutput) {
|
|
137
|
+
return fetchSchemaOrExit(
|
|
138
|
+
client,
|
|
139
|
+
jsonOutput,
|
|
140
|
+
() => fetchMetricDetail(client, accountId, metricId)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export {
|
|
145
|
+
OBSERVABILITY_METRICS_PATH,
|
|
146
|
+
getDefaultAggregation,
|
|
147
|
+
fetchCustomMetricCatalog,
|
|
148
|
+
fetchCustomMetricDetailOrExit,
|
|
149
|
+
fetchCombinedMetricListOrExit,
|
|
150
|
+
fetchMetricDetailOrExit
|
|
151
|
+
};
|
|
@@ -73,6 +73,7 @@ var help = () => `
|
|
|
73
73
|
flags [cmd] Manage feature flags for a Vercel project
|
|
74
74
|
global-config [cmd] Manage Global Config stores
|
|
75
75
|
httpstat path Visualize HTTP timing statistics for deployments
|
|
76
|
+
kms [cmd] Manage KMS issuers, signing keys, and project grants [beta]
|
|
76
77
|
logs [url] Displays the logs for a deployment
|
|
77
78
|
metrics <metric> Queries observability metrics for your project or team
|
|
78
79
|
mcp Set up MCP agents and configuration
|
|
@@ -19,11 +19,19 @@ var projectScopeOption = {
|
|
|
19
19
|
shorthand: "p",
|
|
20
20
|
description: "Project name or ID (defaults to the linked project)."
|
|
21
21
|
};
|
|
22
|
+
var nextOption = {
|
|
23
|
+
name: "next",
|
|
24
|
+
shorthand: null,
|
|
25
|
+
type: String,
|
|
26
|
+
deprecated: false,
|
|
27
|
+
description: "Continue from a previous response",
|
|
28
|
+
argument: "CURSOR"
|
|
29
|
+
};
|
|
22
30
|
var cursorOption = {
|
|
23
31
|
name: "cursor",
|
|
24
32
|
shorthand: "c",
|
|
25
33
|
type: String,
|
|
26
|
-
deprecated:
|
|
34
|
+
deprecated: true,
|
|
27
35
|
description: "Cursor from a previous page to continue listing from",
|
|
28
36
|
argument: "STRING"
|
|
29
37
|
};
|
|
@@ -47,6 +55,7 @@ var imageLsSubcommand = {
|
|
|
47
55
|
description: "Only list images that have no tags"
|
|
48
56
|
},
|
|
49
57
|
limitOption,
|
|
58
|
+
nextOption,
|
|
50
59
|
cursorOption,
|
|
51
60
|
formatOption,
|
|
52
61
|
jsonOption
|
|
@@ -4,13 +4,13 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import {
|
|
8
|
-
noBorderChars,
|
|
9
|
-
require_cli_table3
|
|
10
|
-
} from "./chunk-KT4XXKJK.js";
|
|
11
7
|
import {
|
|
12
8
|
require_dist
|
|
13
9
|
} from "./chunk-ECCWJHC6.js";
|
|
10
|
+
import {
|
|
11
|
+
noBorderChars,
|
|
12
|
+
require_cli_table3
|
|
13
|
+
} from "./chunk-VAFU7DXZ.js";
|
|
14
14
|
import {
|
|
15
15
|
globalCommandOptions
|
|
16
16
|
} from "./chunk-SOFC4MLS.js";
|