vercel 56.3.1 → 56.4.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.
- package/dist/chunks/{add-ANWCBEDB.js → add-2HLAH42D.js} +2 -2
- package/dist/chunks/{add-FWXAFWCU.js → add-XY2LNFK3.js} +3 -3
- package/dist/chunks/{chunk-7ZECC3BE.js → chunk-2KNVJ7ET.js} +88 -2
- package/dist/chunks/{chunk-74TJ5D35.js → chunk-4QRRJEYO.js} +2 -2
- package/dist/chunks/{chunk-4Z5LC2CI.js → chunk-6RTK6BWX.js} +4 -96
- package/dist/chunks/{chunk-JEWA7HG3.js → chunk-BRTMH4PL.js} +1 -1
- package/dist/chunks/{chunk-F3B65VPT.js → chunk-C4TEOOGB.js} +1 -1
- package/dist/chunks/{chunk-M5LOXLMK.js → chunk-EJNFC5AV.js} +1 -1
- package/dist/chunks/{chunk-UOB64NBX.js → chunk-ENIJVO7C.js} +2 -2
- package/dist/chunks/{query-XC3Y3EBD.js → chunk-F5OMERHI.js} +65 -411
- package/dist/chunks/{chunk-26VWIAO5.js → chunk-IN3RG4AU.js} +1 -1
- package/dist/chunks/{chunk-2E3ZC3JA.js → chunk-JGXABANG.js} +1 -1
- package/dist/chunks/{chunk-AHSE4X6V.js → chunk-JIK3GTU3.js} +1 -1
- package/dist/chunks/{chunk-NMAHBCNK.js → chunk-K6YMSJMZ.js} +4 -4
- package/dist/chunks/{chunk-ETWY3HX7.js → chunk-ORMDX3GR.js} +1 -1
- package/dist/chunks/{chunk-JAY74MG2.js → chunk-OSXJ6G4O.js} +3 -3
- package/dist/chunks/{chunk-IAEXF3FY.js → chunk-PEC4ROHM.js} +4 -4
- package/dist/chunks/{chunk-RGOP4OYL.js → chunk-QX4337BT.js} +10 -7
- package/dist/chunks/{chunk-SAEAR237.js → chunk-S7HMSWGQ.js} +2 -2
- package/dist/chunks/{chunk-VO6PK3ZA.js → chunk-SLCLT4P5.js} +1 -1
- package/dist/chunks/{chunk-XOED7Y6Z.js → chunk-UA3D44SL.js} +1 -1
- package/dist/chunks/{chunk-5R5FS7WB.js → chunk-VZGX4CKB.js} +1 -1
- package/dist/chunks/{chunk-D7SLHLED.js → chunk-WM3UMX65.js} +1 -1
- package/dist/chunks/chunk-Z7NPYIZ6.js +116 -0
- package/dist/chunks/{compile-vercel-config-ELXMKFUY.js → compile-vercel-config-4Q4YZ44O.js} +1 -1
- package/dist/chunks/{delete-BO3RQ3F6.js → delete-AUDPLCMU.js} +2 -2
- package/dist/chunks/{disable-WRXXRGYR.js → disable-WFPXR7GZ.js} +2 -2
- package/dist/chunks/{discard-5XOTKSVP.js → discard-RVFKIZZG.js} +2 -2
- package/dist/chunks/{edit-ML2P3MKK.js → edit-KO5KX4WU.js} +3 -3
- package/dist/chunks/{enable-E5YCEICZ.js → enable-I5HE32DI.js} +2 -2
- package/dist/chunks/{export-EUFPKG5T.js → export-4Y5L2TOT.js} +2 -2
- package/dist/chunks/{image-5WOBJQFO.js → image-QC5MVWKN.js} +3 -3
- package/dist/chunks/{inspect-7PJE37AJ.js → inspect-BULBAPNR.js} +2 -2
- package/dist/chunks/{inspect-I3ZNL35B.js → inspect-JUGFKEGR.js} +2 -2
- package/dist/chunks/{inspect-W4SOI7QI.js → inspect-PJDCPARM.js} +2 -2
- package/dist/chunks/{inspect-BX26XAK2.js → inspect-Q5BKZNVI.js} +2 -2
- package/dist/chunks/{list-44G7AUFR.js → list-FJT44SB6.js} +1 -1
- package/dist/chunks/{list-VLFAOPR5.js → list-N7OA4FBI.js} +2 -2
- package/dist/chunks/{login-CL57KXDR.js → login-BPE774JW.js} +2 -2
- package/dist/chunks/{ls-VD2DNABR.js → ls-26VFGQ6P.js} +3 -3
- package/dist/chunks/{ls-KIAXSLDB.js → ls-E47M6P5O.js} +2 -2
- package/dist/chunks/{ls-42JFBIDV.js → ls-H52WO65Y.js} +2 -2
- package/dist/chunks/{ls-EZRL6SGP.js → ls-YV554CRJ.js} +2 -2
- package/dist/chunks/{publish-C3QAGQJ7.js → publish-DUTEBRX3.js} +2 -2
- package/dist/chunks/query-QDOKUCHX.js +391 -0
- package/dist/chunks/{reorder-L56M5KP3.js → reorder-L2M3YGJ4.js} +2 -2
- package/dist/chunks/{restore-E5LGXKS3.js → restore-BVDNAJVC.js} +2 -2
- package/dist/chunks/{rm-KGRSF2OY.js → rm-4OQ7G6UX.js} +2 -2
- package/dist/chunks/{rm-EF4HUVO2.js → rm-7KSHXSTB.js} +3 -3
- package/dist/chunks/{rm-AG3FDPTQ.js → rm-VHWBHG3A.js} +2 -2
- package/dist/chunks/{rule-inspect-FRDI2PJF.js → rule-inspect-AT6IEOUF.js} +3 -3
- package/dist/chunks/{rules-OEOYTZ6U.js → rules-SQFCUKWS.js} +6 -6
- package/dist/chunks/{schema-OEWP27BI.js → schema-PWSCMD24.js} +5 -5
- package/dist/chunks/{tags-RUHWH6XO.js → tags-BT7ZGJP2.js} +2 -2
- package/dist/chunks/{update-BEXGZY7H.js → update-PTDGBKEH.js} +3 -3
- package/dist/commands/build/index.js +9 -9
- package/dist/commands/deploy/index.js +9 -9
- package/dist/commands/dev/index.js +7 -7
- package/dist/commands/env/index.js +4 -4
- package/dist/commands/link/index.js +6 -6
- package/dist/commands/list/index.js +2 -2
- package/dist/commands-bulk.js +595 -71
- package/dist/index.js +7 -7
- package/dist/version.mjs +1 -1
- package/package.json +10 -10
- package/dist/chunks/chunk-A3NYPUKZ.js +0 -17
|
@@ -0,0 +1,391 @@
|
|
|
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
|
+
fetchMetricDetailOrExit,
|
|
9
|
+
getDefaultAggregation
|
|
10
|
+
} from "./chunk-6RTK6BWX.js";
|
|
11
|
+
import {
|
|
12
|
+
computeGranularity,
|
|
13
|
+
formatText
|
|
14
|
+
} from "./chunk-F5OMERHI.js";
|
|
15
|
+
import {
|
|
16
|
+
formatErrorJson,
|
|
17
|
+
formatQueryJson,
|
|
18
|
+
getRollupColumnName,
|
|
19
|
+
handleApiError
|
|
20
|
+
} from "./chunk-Z7NPYIZ6.js";
|
|
21
|
+
import {
|
|
22
|
+
resolveTimeRange,
|
|
23
|
+
validateAllProjectMutualExclusivity
|
|
24
|
+
} from "./chunk-BUZRVER7.js";
|
|
25
|
+
import {
|
|
26
|
+
validateJsonOutput
|
|
27
|
+
} from "./chunk-XPKWKPWA.js";
|
|
28
|
+
import {
|
|
29
|
+
metricsCommand
|
|
30
|
+
} from "./chunk-4G6QZSBL.js";
|
|
31
|
+
import "./chunk-VXYGCOKL.js";
|
|
32
|
+
import "./chunk-NZRWTCRM.js";
|
|
33
|
+
import {
|
|
34
|
+
getLinkedProject,
|
|
35
|
+
getProjectByNameOrId,
|
|
36
|
+
getScope
|
|
37
|
+
} from "./chunk-QX4337BT.js";
|
|
38
|
+
import "./chunk-UDWRZXIT.js";
|
|
39
|
+
import "./chunk-ECCWJHC6.js";
|
|
40
|
+
import {
|
|
41
|
+
parseArguments,
|
|
42
|
+
printError
|
|
43
|
+
} from "./chunk-SZXT3PDQ.js";
|
|
44
|
+
import {
|
|
45
|
+
ProjectNotFound,
|
|
46
|
+
getFlagsSpecification,
|
|
47
|
+
isAPIError
|
|
48
|
+
} from "./chunk-KSSNLCL4.js";
|
|
49
|
+
import "./chunk-P4QNYOFB.js";
|
|
50
|
+
import "./chunk-52QYYTM5.js";
|
|
51
|
+
import {
|
|
52
|
+
output_manager_default
|
|
53
|
+
} from "./chunk-OX7KI3LF.js";
|
|
54
|
+
import "./chunk-GGP5R3FU.js";
|
|
55
|
+
import "./chunk-S7KYDPEM.js";
|
|
56
|
+
import "./chunk-TZ2YI2VH.js";
|
|
57
|
+
|
|
58
|
+
// src/commands/metrics/validation.ts
|
|
59
|
+
function validateMutualExclusivity(all, project) {
|
|
60
|
+
return validateAllProjectMutualExclusivity(all, project);
|
|
61
|
+
}
|
|
62
|
+
function validateRequiredMetric(metric) {
|
|
63
|
+
if (metric) {
|
|
64
|
+
return { valid: true, value: metric };
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
valid: false,
|
|
68
|
+
code: "MISSING_METRIC",
|
|
69
|
+
message: "Missing required metric. Specify the metric to query.\n\nRun 'vercel metrics schema' to see available metrics."
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function validateOrderDirection(orderDirection) {
|
|
73
|
+
if (orderDirection === void 0) {
|
|
74
|
+
return { valid: true, value: void 0 };
|
|
75
|
+
}
|
|
76
|
+
if (orderDirection === "asc" || orderDirection === "desc") {
|
|
77
|
+
return { valid: true, value: orderDirection };
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
valid: false,
|
|
81
|
+
code: "INVALID_ORDER",
|
|
82
|
+
message: `Invalid order "${orderDirection}". Use "asc" or "desc".`,
|
|
83
|
+
allowedValues: ["asc", "desc"]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function validateOrderBy(orderBy) {
|
|
87
|
+
if (orderBy === void 0) {
|
|
88
|
+
return { valid: true, value: void 0 };
|
|
89
|
+
}
|
|
90
|
+
if (orderBy === "value" || orderBy === "count") {
|
|
91
|
+
return { valid: true, value: orderBy };
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
valid: false,
|
|
95
|
+
code: "INVALID_ORDER_BY",
|
|
96
|
+
message: `Invalid order-by "${orderBy}". Use "value" or "count".`,
|
|
97
|
+
allowedValues: ["value", "count"]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/commands/metrics/query.ts
|
|
102
|
+
function handleValidationError(result, jsonOutput, client) {
|
|
103
|
+
if (jsonOutput) {
|
|
104
|
+
client.stdout.write(
|
|
105
|
+
formatErrorJson(result.code, result.message, result.allowedValues)
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
output_manager_default.error(result.message);
|
|
109
|
+
if (result.allowedValues && result.allowedValues.length > 0) {
|
|
110
|
+
output_manager_default.print(`
|
|
111
|
+
Available values: ${result.allowedValues.join(", ")}
|
|
112
|
+
`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
var PRODUCTION_ENVIRONMENT_FILTER = "environment eq 'production'";
|
|
118
|
+
function combineFilters(filters, prod) {
|
|
119
|
+
const nonEmptyFilters = [
|
|
120
|
+
...filters?.filter((filter) => filter.length > 0) ?? [],
|
|
121
|
+
...prod ? [PRODUCTION_ENVIRONMENT_FILTER] : []
|
|
122
|
+
];
|
|
123
|
+
if (nonEmptyFilters.length === 0) {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
if (nonEmptyFilters.length === 1) {
|
|
127
|
+
return nonEmptyFilters[0];
|
|
128
|
+
}
|
|
129
|
+
return nonEmptyFilters.map((filter) => `(${filter})`).join(" and ");
|
|
130
|
+
}
|
|
131
|
+
function getRequestOrderBy(metric, aggregation, orderBy) {
|
|
132
|
+
return orderBy === "value" ? getRollupColumnName(metric, aggregation) : void 0;
|
|
133
|
+
}
|
|
134
|
+
async function resolveQueryScope(client, opts) {
|
|
135
|
+
if (opts.project || opts.all) {
|
|
136
|
+
const { team } = await getScope(client);
|
|
137
|
+
if (!team) {
|
|
138
|
+
const errMsg = "No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory.";
|
|
139
|
+
if (opts.jsonOutput) {
|
|
140
|
+
client.stdout.write(formatErrorJson("NO_TEAM", errMsg));
|
|
141
|
+
} else {
|
|
142
|
+
output_manager_default.error(errMsg);
|
|
143
|
+
}
|
|
144
|
+
return 1;
|
|
145
|
+
}
|
|
146
|
+
if (opts.all) {
|
|
147
|
+
return {
|
|
148
|
+
scope: { type: "owner", ownerId: team.id },
|
|
149
|
+
accountId: team.id,
|
|
150
|
+
teamName: team.slug
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const project = await getProjectByNameOrId(client, opts.project, team.id);
|
|
154
|
+
if (project instanceof ProjectNotFound) {
|
|
155
|
+
const errMsg = `Project "${opts.project}" was not found in team "${team.slug}".`;
|
|
156
|
+
if (opts.jsonOutput) {
|
|
157
|
+
client.stdout.write(formatErrorJson("PROJECT_NOT_FOUND", errMsg));
|
|
158
|
+
} else {
|
|
159
|
+
output_manager_default.error(errMsg);
|
|
160
|
+
}
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
scope: {
|
|
165
|
+
type: "project",
|
|
166
|
+
ownerId: team.id,
|
|
167
|
+
projectIds: [project.id]
|
|
168
|
+
},
|
|
169
|
+
accountId: team.id,
|
|
170
|
+
teamName: team.slug,
|
|
171
|
+
projectName: project.name
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const linkedProject = await getLinkedProject(client);
|
|
175
|
+
if (linkedProject.status === "error") {
|
|
176
|
+
return linkedProject.exitCode;
|
|
177
|
+
}
|
|
178
|
+
if (linkedProject.status === "not_linked") {
|
|
179
|
+
const errMsg = "No linked project found. Run `vercel link` to link a project, or use --project <name-or-id> or --all.";
|
|
180
|
+
if (opts.jsonOutput) {
|
|
181
|
+
client.stdout.write(formatErrorJson("NOT_LINKED", errMsg));
|
|
182
|
+
} else {
|
|
183
|
+
output_manager_default.error(errMsg);
|
|
184
|
+
}
|
|
185
|
+
return 1;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
scope: {
|
|
189
|
+
type: "project",
|
|
190
|
+
ownerId: linkedProject.org.id,
|
|
191
|
+
projectIds: [linkedProject.project.id]
|
|
192
|
+
},
|
|
193
|
+
accountId: linkedProject.org.id,
|
|
194
|
+
teamName: linkedProject.org.slug,
|
|
195
|
+
projectName: linkedProject.project.name
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async function query(client, telemetry) {
|
|
199
|
+
let parsedArgs;
|
|
200
|
+
const flagsSpecification = getFlagsSpecification(metricsCommand.options);
|
|
201
|
+
try {
|
|
202
|
+
parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
203
|
+
} catch (err) {
|
|
204
|
+
printError(err);
|
|
205
|
+
return 1;
|
|
206
|
+
}
|
|
207
|
+
const flags = parsedArgs.flags;
|
|
208
|
+
const positionalArgs = parsedArgs.args.slice(1);
|
|
209
|
+
const positionalMetric = positionalArgs[0] === "query" ? positionalArgs[1] : positionalArgs[0];
|
|
210
|
+
const formatResult = validateJsonOutput(flags);
|
|
211
|
+
if (!formatResult.valid) {
|
|
212
|
+
output_manager_default.error(formatResult.error);
|
|
213
|
+
return 1;
|
|
214
|
+
}
|
|
215
|
+
const jsonOutput = formatResult.jsonOutput;
|
|
216
|
+
const metricFlag = positionalMetric;
|
|
217
|
+
const aggregationFlag = flags["--aggregation"];
|
|
218
|
+
const groupBy = flags["--group-by"] ?? [];
|
|
219
|
+
const limit = flags["--limit"];
|
|
220
|
+
const orderByInput = typeof flags["--order-by"] === "string" ? flags["--order-by"].trim().toLowerCase() : void 0;
|
|
221
|
+
const orderInput = typeof flags["--order"] === "string" ? flags["--order"].trim().toLowerCase() : void 0;
|
|
222
|
+
const filters = flags["--filter"];
|
|
223
|
+
const prod = flags["--prod"];
|
|
224
|
+
const filter = combineFilters(filters, prod);
|
|
225
|
+
const since = flags["--since"];
|
|
226
|
+
const until = flags["--until"];
|
|
227
|
+
const granularity = flags["--granularity"];
|
|
228
|
+
const bucketTimezone = flags["--bucket-timezone"]?.trim();
|
|
229
|
+
const project = flags["--project"];
|
|
230
|
+
const all = flags["--all"];
|
|
231
|
+
telemetry.trackCliArgumentMetricId(metricFlag);
|
|
232
|
+
telemetry.trackCliOptionAggregation(aggregationFlag);
|
|
233
|
+
telemetry.trackCliOptionGroupBy(groupBy.length > 0 ? groupBy : void 0);
|
|
234
|
+
telemetry.trackCliOptionLimit(limit);
|
|
235
|
+
telemetry.trackCliOptionOrderBy(orderByInput);
|
|
236
|
+
telemetry.trackCliOptionOrder(orderInput);
|
|
237
|
+
telemetry.trackCliOptionFilter(filters);
|
|
238
|
+
telemetry.trackCliFlagProd(prod);
|
|
239
|
+
telemetry.trackCliOptionSince(since);
|
|
240
|
+
telemetry.trackCliOptionUntil(until);
|
|
241
|
+
telemetry.trackCliOptionGranularity(granularity);
|
|
242
|
+
telemetry.trackCliOptionBucketTimezone(bucketTimezone);
|
|
243
|
+
telemetry.trackCliOptionProject(project);
|
|
244
|
+
telemetry.trackCliFlagAll(all);
|
|
245
|
+
telemetry.trackCliOptionFormat(flags["--format"]);
|
|
246
|
+
const orderByResult = validateOrderBy(orderByInput);
|
|
247
|
+
if (!orderByResult.valid) {
|
|
248
|
+
return handleValidationError(orderByResult, jsonOutput, client);
|
|
249
|
+
}
|
|
250
|
+
const orderByMode = orderByResult.value;
|
|
251
|
+
const requiredMetric = validateRequiredMetric(metricFlag);
|
|
252
|
+
if (!requiredMetric.valid) {
|
|
253
|
+
return handleValidationError(requiredMetric, jsonOutput, client);
|
|
254
|
+
}
|
|
255
|
+
const metric = requiredMetric.value;
|
|
256
|
+
const mutualResult = validateMutualExclusivity(all, project);
|
|
257
|
+
if (!mutualResult.valid) {
|
|
258
|
+
return handleValidationError(mutualResult, jsonOutput, client);
|
|
259
|
+
}
|
|
260
|
+
const orderDirectionResult = validateOrderDirection(orderInput);
|
|
261
|
+
if (!orderDirectionResult.valid) {
|
|
262
|
+
return handleValidationError(orderDirectionResult, jsonOutput, client);
|
|
263
|
+
}
|
|
264
|
+
const orderDirection = orderDirectionResult.value;
|
|
265
|
+
const scopeResult = await resolveQueryScope(client, {
|
|
266
|
+
project,
|
|
267
|
+
all,
|
|
268
|
+
jsonOutput
|
|
269
|
+
});
|
|
270
|
+
if (typeof scopeResult === "number") {
|
|
271
|
+
return scopeResult;
|
|
272
|
+
}
|
|
273
|
+
const { scope, accountId, teamName, projectName } = scopeResult;
|
|
274
|
+
const detailOrExitCode = await fetchMetricDetailOrExit(
|
|
275
|
+
client,
|
|
276
|
+
accountId,
|
|
277
|
+
metric,
|
|
278
|
+
jsonOutput
|
|
279
|
+
);
|
|
280
|
+
if (typeof detailOrExitCode === "number") {
|
|
281
|
+
return detailOrExitCode;
|
|
282
|
+
}
|
|
283
|
+
const aggregationInput = aggregationFlag ?? getDefaultAggregation(detailOrExitCode, metric) ?? "sum";
|
|
284
|
+
const aggregation = aggregationInput;
|
|
285
|
+
const orderBy = getRequestOrderBy(metric, aggregation, orderByMode);
|
|
286
|
+
let startTime;
|
|
287
|
+
let endTime;
|
|
288
|
+
try {
|
|
289
|
+
({ startTime, endTime } = resolveTimeRange(since, until));
|
|
290
|
+
} catch (err) {
|
|
291
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
292
|
+
if (jsonOutput) {
|
|
293
|
+
client.stdout.write(formatErrorJson("INVALID_TIME", errMsg));
|
|
294
|
+
} else {
|
|
295
|
+
output_manager_default.error(errMsg);
|
|
296
|
+
}
|
|
297
|
+
return 1;
|
|
298
|
+
}
|
|
299
|
+
const rangeMs = endTime.getTime() - startTime.getTime();
|
|
300
|
+
const granResult = computeGranularity(rangeMs, granularity);
|
|
301
|
+
if (!jsonOutput && granResult.adjusted && granResult.notice) {
|
|
302
|
+
output_manager_default.log(`Notice: ${granResult.notice}`);
|
|
303
|
+
}
|
|
304
|
+
const body = {
|
|
305
|
+
scope,
|
|
306
|
+
metric,
|
|
307
|
+
aggregation,
|
|
308
|
+
startTime: startTime.toISOString(),
|
|
309
|
+
endTime: endTime.toISOString(),
|
|
310
|
+
granularity: granResult.duration,
|
|
311
|
+
...bucketTimezone ? { bucketTimezone } : {},
|
|
312
|
+
...groupBy.length > 0 ? { groupBy } : {},
|
|
313
|
+
...filter ? { filter } : {},
|
|
314
|
+
limit: limit ?? 10,
|
|
315
|
+
...orderBy ? { orderBy } : {},
|
|
316
|
+
...orderDirection ? { orderDirection } : {}
|
|
317
|
+
};
|
|
318
|
+
if (!jsonOutput) {
|
|
319
|
+
output_manager_default.spinner("Querying metrics...");
|
|
320
|
+
}
|
|
321
|
+
let response;
|
|
322
|
+
try {
|
|
323
|
+
response = await client.fetch(
|
|
324
|
+
"/v2/observability/query",
|
|
325
|
+
{
|
|
326
|
+
method: "POST",
|
|
327
|
+
body: JSON.stringify(body),
|
|
328
|
+
headers: { "Content-Type": "application/json" },
|
|
329
|
+
accountId,
|
|
330
|
+
bailOn429: true
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
} catch (err) {
|
|
334
|
+
if (isAPIError(err)) {
|
|
335
|
+
return handleApiError(err, jsonOutput, client);
|
|
336
|
+
}
|
|
337
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
338
|
+
if (jsonOutput) {
|
|
339
|
+
client.stdout.write(formatErrorJson("NETWORK_ERROR", errMsg));
|
|
340
|
+
} else {
|
|
341
|
+
output_manager_default.error(errMsg);
|
|
342
|
+
}
|
|
343
|
+
return 1;
|
|
344
|
+
} finally {
|
|
345
|
+
if (!jsonOutput) {
|
|
346
|
+
output_manager_default.stopSpinner();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (jsonOutput) {
|
|
350
|
+
client.stdout.write(
|
|
351
|
+
formatQueryJson(
|
|
352
|
+
{
|
|
353
|
+
metric,
|
|
354
|
+
aggregation,
|
|
355
|
+
groupBy,
|
|
356
|
+
filter,
|
|
357
|
+
startTime: startTime.toISOString(),
|
|
358
|
+
endTime: endTime.toISOString(),
|
|
359
|
+
granularity: granResult.duration,
|
|
360
|
+
...bucketTimezone ? { bucketTimezone } : {},
|
|
361
|
+
...orderByMode ? { orderBy: orderByMode } : {},
|
|
362
|
+
...orderDirection ? { orderDirection } : {}
|
|
363
|
+
},
|
|
364
|
+
response
|
|
365
|
+
)
|
|
366
|
+
);
|
|
367
|
+
} else {
|
|
368
|
+
client.stdout.write(
|
|
369
|
+
formatText(response, {
|
|
370
|
+
metric,
|
|
371
|
+
metricUnit: detailOrExitCode.find((item) => item.id === metric)?.unit ?? "count",
|
|
372
|
+
aggregation,
|
|
373
|
+
groupBy,
|
|
374
|
+
filter,
|
|
375
|
+
scope,
|
|
376
|
+
projectName,
|
|
377
|
+
teamName,
|
|
378
|
+
periodStart: startTime.toISOString(),
|
|
379
|
+
periodEnd: endTime.toISOString(),
|
|
380
|
+
granularity: granResult.duration,
|
|
381
|
+
bucketTimezone,
|
|
382
|
+
orderBy: orderByMode,
|
|
383
|
+
orderDirection
|
|
384
|
+
})
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
return 0;
|
|
388
|
+
}
|
|
389
|
+
export {
|
|
390
|
+
query as default
|
|
391
|
+
};
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
resolveRoute,
|
|
17
17
|
shellQuoteRouteIdentifierForSuggestion,
|
|
18
18
|
withGlobalFlags
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ORMDX3GR.js";
|
|
20
20
|
import {
|
|
21
21
|
reorderSubcommand
|
|
22
22
|
} from "./chunk-VZSZBD4V.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
stamp_default
|
|
25
25
|
} from "./chunk-64IF634X.js";
|
|
26
26
|
import "./chunk-VXYGCOKL.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-QX4337BT.js";
|
|
28
28
|
import {
|
|
29
29
|
outputAgentError
|
|
30
30
|
} from "./chunk-UDWRZXIT.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
requireProjectContext,
|
|
20
20
|
validateRequiredArguments,
|
|
21
21
|
withGlobalFlags
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ORMDX3GR.js";
|
|
23
23
|
import {
|
|
24
24
|
restoreSubcommand
|
|
25
25
|
} from "./chunk-VZSZBD4V.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
stamp_default
|
|
28
28
|
} from "./chunk-64IF634X.js";
|
|
29
29
|
import "./chunk-VXYGCOKL.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-QX4337BT.js";
|
|
31
31
|
import {
|
|
32
32
|
outputAgentError
|
|
33
33
|
} from "./chunk-UDWRZXIT.js";
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
requireVcrRepositoryAndImageId,
|
|
14
14
|
resolveVcrScope,
|
|
15
15
|
validateVcrJsonOutput
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SLCLT4P5.js";
|
|
17
17
|
import "./chunk-BUZRVER7.js";
|
|
18
18
|
import "./chunk-XPKWKPWA.js";
|
|
19
19
|
import {
|
|
20
20
|
imageRmSubcommand
|
|
21
21
|
} from "./chunk-FYQPTH5C.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-QX4337BT.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENT_REASON,
|
|
25
25
|
buildCommandWithYes,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
handleRulesApiError,
|
|
10
10
|
parseRulesFlagsAndScope,
|
|
11
11
|
rulesItemPath
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-BRTMH4PL.js";
|
|
13
|
+
import "./chunk-WM3UMX65.js";
|
|
14
14
|
import "./chunk-BUZRVER7.js";
|
|
15
15
|
import {
|
|
16
16
|
validateJsonOutput
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
rulesRmSubcommand
|
|
20
20
|
} from "./chunk-STJJ3DFO.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-QX4337BT.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT_REASON,
|
|
24
24
|
buildCommandWithGlobalFlags,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
requireVcrRepository,
|
|
14
14
|
resolveVcrScope,
|
|
15
15
|
validateVcrJsonOutput
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SLCLT4P5.js";
|
|
17
17
|
import "./chunk-BUZRVER7.js";
|
|
18
18
|
import "./chunk-XPKWKPWA.js";
|
|
19
19
|
import {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-3VS4DTAU.js";
|
|
22
22
|
import "./chunk-GIL3VAUR.js";
|
|
23
23
|
import "./chunk-FYQPTH5C.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-QX4337BT.js";
|
|
25
25
|
import {
|
|
26
26
|
AGENT_REASON,
|
|
27
27
|
buildCommandWithYes,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
handleRulesApiError,
|
|
10
10
|
parseRulesFlagsAndScope,
|
|
11
11
|
rulesItemPath
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-BRTMH4PL.js";
|
|
13
|
+
import "./chunk-WM3UMX65.js";
|
|
14
14
|
import "./chunk-BUZRVER7.js";
|
|
15
15
|
import {
|
|
16
16
|
validateJsonOutput
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
rulesInspectSubcommand
|
|
20
20
|
} from "./chunk-STJJ3DFO.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-QX4337BT.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT_REASON,
|
|
24
24
|
buildCommandWithGlobalFlags,
|
|
@@ -30,7 +30,7 @@ var RULES_CONFIG = {
|
|
|
30
30
|
};
|
|
31
31
|
async function rules(client, argv) {
|
|
32
32
|
if (argv.length === 0 || argv[0].startsWith("-")) {
|
|
33
|
-
const lsFn = (await import("./ls-
|
|
33
|
+
const lsFn = (await import("./ls-26VFGQ6P.js")).default;
|
|
34
34
|
return lsFn(client, argv);
|
|
35
35
|
}
|
|
36
36
|
const { subcommand, args, subcommandOriginal } = getSubcommand(
|
|
@@ -63,15 +63,15 @@ async function rules(client, argv) {
|
|
|
63
63
|
}
|
|
64
64
|
switch (subcommand) {
|
|
65
65
|
case "ls":
|
|
66
|
-
return (await import("./ls-
|
|
66
|
+
return (await import("./ls-26VFGQ6P.js")).default(client, args);
|
|
67
67
|
case "add":
|
|
68
|
-
return (await import("./add-
|
|
68
|
+
return (await import("./add-XY2LNFK3.js")).default(client, args);
|
|
69
69
|
case "inspect":
|
|
70
|
-
return (await import("./rule-inspect-
|
|
70
|
+
return (await import("./rule-inspect-AT6IEOUF.js")).default(client, args);
|
|
71
71
|
case "rm":
|
|
72
|
-
return (await import("./rm-
|
|
72
|
+
return (await import("./rm-7KSHXSTB.js")).default(client, args);
|
|
73
73
|
case "update":
|
|
74
|
-
return (await import("./update-
|
|
74
|
+
return (await import("./update-PTDGBKEH.js")).default(client, args);
|
|
75
75
|
default:
|
|
76
76
|
output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`);
|
|
77
77
|
return 1;
|
|
@@ -6,12 +6,12 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
fetchMetricDetailOrExit,
|
|
9
|
-
fetchMetricListOrExit
|
|
10
|
-
|
|
11
|
-
} from "./chunk-4Z5LC2CI.js";
|
|
9
|
+
fetchMetricListOrExit
|
|
10
|
+
} from "./chunk-6RTK6BWX.js";
|
|
12
11
|
import {
|
|
12
|
+
formatErrorJson,
|
|
13
13
|
indent_default
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Z7NPYIZ6.js";
|
|
15
15
|
import {
|
|
16
16
|
formatTable
|
|
17
17
|
} from "./chunk-ZVLPUREX.js";
|
|
@@ -25,7 +25,7 @@ import "./chunk-NZRWTCRM.js";
|
|
|
25
25
|
import {
|
|
26
26
|
getScope,
|
|
27
27
|
require_pluralize
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QX4337BT.js";
|
|
29
29
|
import "./chunk-UDWRZXIT.js";
|
|
30
30
|
import "./chunk-ECCWJHC6.js";
|
|
31
31
|
import {
|
|
@@ -52,9 +52,9 @@ async function tags(client, argv, telemetry) {
|
|
|
52
52
|
}
|
|
53
53
|
switch (subcommand) {
|
|
54
54
|
case "ls":
|
|
55
|
-
return (await import("./ls-
|
|
55
|
+
return (await import("./ls-YV554CRJ.js")).default(client, args, telemetry);
|
|
56
56
|
case "inspect":
|
|
57
|
-
return (await import("./inspect-
|
|
57
|
+
return (await import("./inspect-JUGFKEGR.js")).default(client, args, telemetry);
|
|
58
58
|
default:
|
|
59
59
|
output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
|
|
60
60
|
return 1;
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
handleRulesApiError,
|
|
10
10
|
parseRulesFlagsAndScope,
|
|
11
11
|
rulesItemPath
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-BRTMH4PL.js";
|
|
13
|
+
import "./chunk-WM3UMX65.js";
|
|
14
14
|
import "./chunk-BUZRVER7.js";
|
|
15
15
|
import {
|
|
16
16
|
validateJsonOutput
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
rulesUpdateSubcommand
|
|
20
20
|
} from "./chunk-STJJ3DFO.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-QX4337BT.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT_REASON,
|
|
24
24
|
buildCommandWithGlobalFlags,
|
|
@@ -11,17 +11,17 @@ import {
|
|
|
11
11
|
isLambda,
|
|
12
12
|
staticFiles,
|
|
13
13
|
writeBuildResult
|
|
14
|
-
} from "../../chunks/chunk-
|
|
14
|
+
} from "../../chunks/chunk-C4TEOOGB.js";
|
|
15
15
|
import {
|
|
16
16
|
pullCommandLogic
|
|
17
|
-
} from "../../chunks/chunk-
|
|
17
|
+
} from "../../chunks/chunk-K6YMSJMZ.js";
|
|
18
18
|
import {
|
|
19
19
|
require_semver
|
|
20
20
|
} from "../../chunks/chunk-IB5L4LKZ.js";
|
|
21
21
|
import {
|
|
22
22
|
pickOverrides,
|
|
23
23
|
readProjectSettings
|
|
24
|
-
} from "../../chunks/chunk-
|
|
24
|
+
} from "../../chunks/chunk-JIK3GTU3.js";
|
|
25
25
|
import "../../chunks/chunk-R6IGDGX3.js";
|
|
26
26
|
import "../../chunks/chunk-NJUPUGOE.js";
|
|
27
27
|
import {
|
|
@@ -30,12 +30,12 @@ import {
|
|
|
30
30
|
import "../../chunks/chunk-VXYGCOKL.js";
|
|
31
31
|
import {
|
|
32
32
|
ensureLink
|
|
33
|
-
} from "../../chunks/chunk-
|
|
34
|
-
import "../../chunks/chunk-
|
|
35
|
-
import "../../chunks/chunk-
|
|
33
|
+
} from "../../chunks/chunk-4QRRJEYO.js";
|
|
34
|
+
import "../../chunks/chunk-ENIJVO7C.js";
|
|
35
|
+
import "../../chunks/chunk-UA3D44SL.js";
|
|
36
36
|
import {
|
|
37
37
|
buildCommand
|
|
38
|
-
} from "../../chunks/chunk-
|
|
38
|
+
} from "../../chunks/chunk-EJNFC5AV.js";
|
|
39
39
|
import {
|
|
40
40
|
help
|
|
41
41
|
} from "../../chunks/chunk-DMSLNAVH.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
resolveProjectCwd,
|
|
64
64
|
ua_default,
|
|
65
65
|
validateConfig
|
|
66
|
-
} from "../../chunks/chunk-
|
|
66
|
+
} from "../../chunks/chunk-QX4337BT.js";
|
|
67
67
|
import {
|
|
68
68
|
AGENT_REASON,
|
|
69
69
|
AGENT_STATUS,
|
|
@@ -5005,7 +5005,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
|
|
|
5005
5005
|
);
|
|
5006
5006
|
const mergedCrons = mergeCrons(
|
|
5007
5007
|
[...localConfig.crons || [], ...synthesizedServiceCrons],
|
|
5008
|
-
|
|
5008
|
+
buildResults.values()
|
|
5009
5009
|
);
|
|
5010
5010
|
const mergedWildcard = mergeWildcard(topLevelBuildResults.values());
|
|
5011
5011
|
const mergedDeploymentId = await mergeDeploymentId(
|