vercel 59.11.7 → 59.13.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.
- package/dist/chunks/{add-WU2QYHYL.js → add-7OX6PBFD.js} +3 -3
- package/dist/chunks/add-7RYUFBZ3.js +221 -0
- package/dist/chunks/{add-KSJQYR5C.js → add-FX5WWUXU.js} +3 -3
- package/dist/chunks/{build-F3J6FLPD.js → build-Q3TR46K4.js} +3 -3
- package/dist/chunks/{chunk-N4QHMXOO.js → chunk-2GXA4NGG.js} +3 -2
- package/dist/chunks/{chunk-CNDPIHY5.js → chunk-2QFYCMKN.js} +24 -19
- package/dist/chunks/{chunk-7KROIXQM.js → chunk-3FIEWWMM.js} +3 -3
- package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
- package/dist/chunks/{chunk-FVT74RZ5.js → chunk-5JDX6XOS.js} +11 -11
- package/dist/chunks/{chunk-WL6QYSGD.js → chunk-5ORMFNXL.js} +586 -41
- package/dist/chunks/{chunk-C762AAVU.js → chunk-66LPM47Z.js} +4 -4
- package/dist/chunks/{chunk-4IVSM24H.js → chunk-76CB3CF2.js} +1 -1
- package/dist/chunks/{chunk-2TSBB22D.js → chunk-7F5RNOTP.js} +2 -2
- package/dist/chunks/{chunk-UARGTFCT.js → chunk-7NRNFV77.js} +1 -1
- package/dist/chunks/chunk-DQ23J2KG.js +305 -0
- package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
- package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-EEV2LKFC.js} +1 -1
- package/dist/chunks/{chunk-DSTNNQVV.js → chunk-EIBH6FCR.js} +3 -3
- package/dist/chunks/chunk-F4S6Q4OY.js +79 -0
- package/dist/chunks/chunk-GDOUDU6O.js +74 -0
- package/dist/chunks/{chunk-DBYHS3CK.js → chunk-GQRG7VFK.js} +2 -2
- package/dist/chunks/{chunk-GCVXKRR5.js → chunk-HD4DR3DA.js} +1 -0
- package/dist/chunks/{chunk-DWIC7MRV.js → chunk-HKHXKSXQ.js} +1 -1
- package/dist/chunks/{chunk-ZBEECGFD.js → chunk-HM24ZWQL.js} +1 -1
- package/dist/chunks/{chunk-GHKJAK5V.js → chunk-IK6PC2JA.js} +4 -4
- package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-IUC3TR3S.js} +1 -1
- package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-JIK2FUMT.js} +1 -1
- package/dist/chunks/{chunk-TGNEG57M.js → chunk-KU2WCB6G.js} +110 -14
- package/dist/chunks/{chunk-FVNJTRCE.js → chunk-KXTXGYG7.js} +2 -2
- package/dist/chunks/{chunk-QOPTXV4G.js → chunk-L4H3DP65.js} +1 -1
- package/dist/chunks/{chunk-FL4JLNT2.js → chunk-LE5V7G2U.js} +2 -2
- package/dist/chunks/chunk-LVCCV2YJ.js +324 -0
- package/dist/chunks/{chunk-SHFNEZVI.js → chunk-MUGF3SGQ.js} +1 -1
- package/dist/chunks/{chunk-G3PXSXIB.js → chunk-N6HP5BLI.js} +5 -3
- package/dist/chunks/{chunk-EZQDYIVB.js → chunk-NSGRICJ2.js} +1 -1
- package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
- package/dist/chunks/{chunk-X7DBBZQD.js → chunk-QRFRS2JH.js} +1 -1
- package/dist/chunks/{chunk-PFM75KY3.js → chunk-QSJ6Q5QP.js} +3 -3
- package/dist/chunks/{chunk-XD4DCYMX.js → chunk-S3HYE6ZE.js} +2 -2
- package/dist/chunks/{chunk-QHS645AZ.js → chunk-SPRQ4IBQ.js} +3 -3
- package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-T3NB7VQG.js} +6 -6
- package/dist/chunks/{chunk-PJXMXMCO.js → chunk-TLPHZ7M4.js} +2 -2
- package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TOXZAP5I.js} +1 -1
- package/dist/chunks/{chunk-XIFATBH5.js → chunk-U4ZLWJQD.js} +4 -4
- package/dist/chunks/{chunk-CEDN47PH.js → chunk-UXKNSAP2.js} +1 -1
- package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-XEVKGAVI.js} +6 -6
- package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-Z6YZMXVN.js} +4 -4
- package/dist/chunks/{clear-XUQO4ZTK.js → clear-GIAFWC5X.js} +3 -3
- package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-QJGEQKK4.js} +2 -2
- package/dist/chunks/{config-MEDLXUVM.js → config-AOA2HS4R.js} +3 -3
- package/dist/chunks/{config-37OAE7QJ.js → config-HYBSW733.js} +7 -7
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-VSWDZ2SW.js → delete-BBFI75A2.js} +5 -5
- package/dist/chunks/{delete-3N3YZZOF.js → delete-DJ7RI2NX.js} +5 -5
- package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-Q2DVXVMH.js} +6 -6
- package/dist/chunks/{disable-A4FLFMC7.js → disable-P7X2V5LS.js} +5 -5
- package/dist/chunks/{discard-CHGFULBZ.js → discard-JNQBH4XU.js} +5 -5
- package/dist/chunks/{edit-JZ63AJYQ.js → edit-AXQEMBQC.js} +5 -5
- package/dist/chunks/{edit-MHSYAPDR.js → edit-BO3GXEKA.js} +6 -6
- package/dist/chunks/{enable-KD46SEC5.js → enable-NC4BN7EQ.js} +5 -5
- package/dist/chunks/{export-42QZLBSN.js → export-HQ42UNYD.js} +5 -5
- package/dist/chunks/{image-GP4H73A2.js → image-UM4FQYOA.js} +3 -3
- package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-F6SWNCHK.js} +4 -4
- package/dist/chunks/{inspect-MUVK6MMT.js → inspect-EXEA57MP.js} +3 -3
- package/dist/chunks/{inspect-5FMWMY3C.js → inspect-H3M3XJNB.js} +10 -10
- package/dist/chunks/{inspect-QFXAOUL4.js → inspect-MTNQOLNM.js} +3 -3
- package/dist/chunks/{inspect-RNTSYM6O.js → inspect-PYFF2K4X.js} +3 -3
- package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-XF324IQ2.js} +9 -9
- package/dist/chunks/{list-JRNWLSO5.js → list-4JHZJUBS.js} +2 -2
- package/dist/chunks/{list-IHHIPXEC.js → list-YEN54SGY.js} +6 -6
- package/dist/chunks/{list-XHD5DLEX.js → list-ZKD2O4D2.js} +7 -7
- package/dist/chunks/{login-PCT6KFWY.js → login-56KGZQI2.js} +3 -3
- package/dist/chunks/{ls-SVOHC3XW.js → ls-ELYVF6EU.js} +4 -4
- package/dist/chunks/{ls-PQZ2RIDX.js → ls-HZEMZY2R.js} +4 -4
- package/dist/chunks/{ls-TGHCCARZ.js → ls-IJW74NG3.js} +4 -4
- package/dist/chunks/{ls-GPEHEFCF.js → ls-OAGYLILX.js} +4 -4
- package/dist/chunks/{ls-VRIH5WA3.js → ls-QNTHMTIH.js} +7 -7
- package/dist/chunks/ls-WW5UFH5B.js +204 -0
- package/dist/chunks/{open-E7DEKYDU.js → open-D2E5TEKN.js} +5 -5
- package/dist/chunks/{permissions-JKOONWVL.js → permissions-CFUXWXSK.js} +4 -4
- package/dist/chunks/{publish-EDDELDE5.js → publish-BP4IUYNM.js} +5 -5
- package/dist/chunks/{pull-646WEVDE.js → pull-DL72B6RW.js} +7 -7
- package/dist/chunks/{push-LTNW5OVD.js → push-6YCS4YQW.js} +3 -3
- package/dist/chunks/{query-LU4N6KPO.js → query-7N3YB4LE.js} +7 -7
- package/dist/chunks/{reorder-22PKJMZP.js → reorder-YJN36TPT.js} +5 -5
- package/dist/chunks/{reply-SF2EZMVZ.js → reply-3U3O7LNG.js} +5 -5
- package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-TT75WCWT.js} +5 -5
- package/dist/chunks/{restore-VJAWZXB4.js → restore-6UF6W23A.js} +5 -5
- package/dist/chunks/rm-3QIDFPVA.js +162 -0
- package/dist/chunks/{rm-WNPGTUBH.js → rm-6MJ7ZPXQ.js} +3 -3
- package/dist/chunks/{rm-KVEAJPRE.js → rm-JZRS2NBH.js} +3 -3
- package/dist/chunks/{rm-OSZ5FZUM.js → rm-KI4W2HYP.js} +7 -7
- package/dist/chunks/{rm-KN2QFCKO.js → rm-QCQXVB54.js} +3 -3
- package/dist/chunks/rule-inspect-PX73J52Q.js +123 -0
- package/dist/chunks/{rules-65LKAQ35.js → rules-Q334NBUC.js} +7 -7
- package/dist/chunks/schema-GRTOHAZO.js +381 -0
- package/dist/chunks/{schema-NXCW4M75.js → schema-YV3XYL3A.js} +6 -6
- package/dist/chunks/{set-FYJVKMPV.js → set-J3AQKL6V.js} +7 -7
- package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-R5N7WJ46.js} +16 -16
- package/dist/chunks/{tags-ANIRP5E3.js → tags-2VLJ4VIH.js} +2 -2
- package/dist/chunks/update-VMS45VF2.js +224 -0
- package/dist/chunks/vlt-builder-importer-USCFHWPL.js +322 -0
- package/dist/commands/build/index.js +19 -19
- package/dist/commands/deploy/index.js +19 -19
- package/dist/commands/dev/index.js +25 -25
- package/dist/commands/env/index.js +12 -12
- package/dist/commands/link/index.js +12 -12
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +11343 -4386
- package/dist/help.js +1 -1
- package/dist/index.js +28 -18
- package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +6 -0
- package/dist/version.mjs +1 -1
- package/package.json +52 -48
- package/dist/chunks/add-PERLOALD.js +0 -233
- package/dist/chunks/chunk-5GGUB4EO.js +0 -31
- package/dist/chunks/chunk-ARU7VBKR.js +0 -144
- package/dist/chunks/chunk-KEKR7OCB.js +0 -140
- package/dist/chunks/chunk-MXLA3VQS.js +0 -20
- package/dist/chunks/chunk-QKX7WKIN.js +0 -98
- package/dist/chunks/ls-PF7F4PP4.js +0 -197
- package/dist/chunks/rm-W722Q2AO.js +0 -173
- package/dist/chunks/rule-inspect-25Z6SNX3.js +0 -285
- package/dist/chunks/schema-7D6IGJEJ.js +0 -429
- package/dist/chunks/update-UT6CTKVG.js +0 -246
|
@@ -6,15 +6,15 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
printProjectNotFoundError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TLPHZ7M4.js";
|
|
10
10
|
import {
|
|
11
11
|
detectExplicitScope
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-76CB3CF2.js";
|
|
13
13
|
import {
|
|
14
14
|
getLinkedProject,
|
|
15
15
|
param,
|
|
16
16
|
resolveProjectCwd
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7F5RNOTP.js";
|
|
18
18
|
import {
|
|
19
19
|
buildCommandWithYes,
|
|
20
20
|
outputActionRequired
|
|
@@ -91,7 +91,7 @@ async function ensureLink(commandName, client, cwd, opts = {}) {
|
|
|
91
91
|
);
|
|
92
92
|
return 1;
|
|
93
93
|
}
|
|
94
|
-
const { default: setupAndLink } = await import("./setup-and-link-
|
|
94
|
+
const { default: setupAndLink } = await import("./setup-and-link-R5N7WJ46.js");
|
|
95
95
|
link = await setupAndLink(client, cwd, opts);
|
|
96
96
|
if (link.status === "not_linked") {
|
|
97
97
|
return 0;
|
|
@@ -13476,7 +13476,7 @@ async function resolveProjectCwd(cwd) {
|
|
|
13476
13476
|
const projectRoot = await findProjectRoot(cwd);
|
|
13477
13477
|
if (!projectRoot || projectRoot === cwd)
|
|
13478
13478
|
return cwd;
|
|
13479
|
-
const { isExperimentalServicesEnabled, tryDetectServices } = await import("./detect-services-
|
|
13479
|
+
const { isExperimentalServicesEnabled, tryDetectServices } = await import("./detect-services-Q2DVXVMH.js");
|
|
13480
13480
|
const isServicesEnabled = await isExperimentalServicesEnabled(projectRoot);
|
|
13481
13481
|
if (!isServicesEnabled) {
|
|
13482
13482
|
return cwd;
|
|
@@ -13946,7 +13946,7 @@ async function linkFolderToProject(client, path, projectLink, projectName, orgSl
|
|
|
13946
13946
|
try {
|
|
13947
13947
|
client.cwd = path;
|
|
13948
13948
|
const args = autoConfirm ? ["--yes"] : [];
|
|
13949
|
-
const { default: pull } = await import("./pull-
|
|
13949
|
+
const { default: pull } = await import("./pull-DL72B6RW.js");
|
|
13950
13950
|
const exitCode = await pull(client, args, "vercel-cli:link");
|
|
13951
13951
|
if (exitCode !== 0) {
|
|
13952
13952
|
output_manager_default.error(
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
humanizeReference,
|
|
9
|
+
renderAlertTable
|
|
10
|
+
} from "./chunk-GDOUDU6O.js";
|
|
11
|
+
import {
|
|
12
|
+
formatDate
|
|
13
|
+
} from "./chunk-GZLPFESR.js";
|
|
14
|
+
import {
|
|
15
|
+
truncateEnd,
|
|
16
|
+
truncateMiddle
|
|
17
|
+
} from "./chunk-ND5CF2H3.js";
|
|
18
|
+
import {
|
|
19
|
+
printAlignedLabel
|
|
20
|
+
} from "./chunk-7F5RNOTP.js";
|
|
21
|
+
import {
|
|
22
|
+
buildCommandWithGlobalFlags,
|
|
23
|
+
quoteArg
|
|
24
|
+
} from "./chunk-26CU4Q3C.js";
|
|
25
|
+
import {
|
|
26
|
+
output_manager_default
|
|
27
|
+
} from "./chunk-2JIX6UMI.js";
|
|
28
|
+
import {
|
|
29
|
+
require_source
|
|
30
|
+
} from "./chunk-S7KYDPEM.js";
|
|
31
|
+
import {
|
|
32
|
+
__toESM
|
|
33
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
34
|
+
|
|
35
|
+
// src/commands/alerts/rules/format.ts
|
|
36
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
37
|
+
function formatBoolean(value) {
|
|
38
|
+
return value ? "yes" : "no";
|
|
39
|
+
}
|
|
40
|
+
function formatOperator(operator) {
|
|
41
|
+
return {
|
|
42
|
+
gt: ">",
|
|
43
|
+
gte: ">=",
|
|
44
|
+
lt: "<",
|
|
45
|
+
lte: "<="
|
|
46
|
+
}[operator] ?? operator;
|
|
47
|
+
}
|
|
48
|
+
function formatPublicRuleScope(rule) {
|
|
49
|
+
const scope = rule.ruleScope;
|
|
50
|
+
if (scope.type === "all")
|
|
51
|
+
return "all projects";
|
|
52
|
+
if (scope.type === "project")
|
|
53
|
+
return `project: ${scope.projectId}`;
|
|
54
|
+
return `${scope.type}: ${scope.projectIds.join(", ")}`;
|
|
55
|
+
}
|
|
56
|
+
function formatMetricSelection(metric) {
|
|
57
|
+
const modifiers = [
|
|
58
|
+
metric.per ? `per ${metric.per}` : void 0,
|
|
59
|
+
metric.normalize ? `normalize ${metric.normalize}` : void 0,
|
|
60
|
+
metric.dimensions?.length ? `dimensions ${metric.dimensions.join(", ")}` : void 0
|
|
61
|
+
].filter(Boolean);
|
|
62
|
+
return `${metric.aggregation} ${metric.metric}${modifiers.length ? ` (${modifiers.join("; ")})` : ""}`;
|
|
63
|
+
}
|
|
64
|
+
function formatCustomTrigger(trigger) {
|
|
65
|
+
const minimum = trigger.minimum ? `; minimum ${trigger.minimum.output} >= ${trigger.minimum.threshold}` : "";
|
|
66
|
+
if (trigger.type === "anomaly") {
|
|
67
|
+
return `${trigger.output} anomaly at ${trigger.standardDeviations} standard deviations${minimum}`;
|
|
68
|
+
}
|
|
69
|
+
return `${trigger.output} ${formatOperator(trigger.operator)} ${trigger.threshold}${minimum}`;
|
|
70
|
+
}
|
|
71
|
+
function formatCustomCondition(rule) {
|
|
72
|
+
if (!rule.querySupported)
|
|
73
|
+
return "Query unavailable via API";
|
|
74
|
+
const query = rule.evaluation.query;
|
|
75
|
+
const output = query.outputs[0];
|
|
76
|
+
const selection = query.formulas?.[output] ? `${output} = ${query.formulas[output]}` : query.metrics[output] ? formatMetricSelection(query.metrics[output]) : output;
|
|
77
|
+
return `${selection}; ${formatCustomTrigger(rule.trigger)}; ${rule.evaluation.window}`;
|
|
78
|
+
}
|
|
79
|
+
function formatBuiltInCondition(rule) {
|
|
80
|
+
const triggers = rule.triggers.mode === "all" ? "all triggers" : rule.triggers.items.map((trigger) => humanizeReference(trigger.type)).join(", ");
|
|
81
|
+
return `${triggers}; minimum ${rule.matchMinimumSeverityLevel}`;
|
|
82
|
+
}
|
|
83
|
+
function formatRuleCondition(rule) {
|
|
84
|
+
return rule.type === "built-in" ? formatBuiltInCondition(rule) : formatCustomCondition(rule);
|
|
85
|
+
}
|
|
86
|
+
function printRules(rules) {
|
|
87
|
+
const rows = [
|
|
88
|
+
["Name", "Rule ID", "Type", "Scope", "Condition"].map(
|
|
89
|
+
(header) => import_chalk.default.cyan(header)
|
|
90
|
+
),
|
|
91
|
+
...rules.map((rule) => [
|
|
92
|
+
import_chalk.default.bold(truncateEnd(rule.name, 36)),
|
|
93
|
+
import_chalk.default.dim(rule.id),
|
|
94
|
+
rule.isDefault ? `${rule.type} (default)` : rule.type,
|
|
95
|
+
truncateMiddle(formatPublicRuleScope(rule), 38),
|
|
96
|
+
truncateEnd(formatRuleCondition(rule), 72)
|
|
97
|
+
])
|
|
98
|
+
];
|
|
99
|
+
output_manager_default.print(`
|
|
100
|
+
${renderAlertTable(rows, 2)}
|
|
101
|
+
`);
|
|
102
|
+
}
|
|
103
|
+
function commonRows(rule) {
|
|
104
|
+
return [
|
|
105
|
+
["Name", rule.name],
|
|
106
|
+
["Rule ID", rule.id],
|
|
107
|
+
["Type", rule.type],
|
|
108
|
+
["Scope", formatPublicRuleScope(rule)],
|
|
109
|
+
["Default", formatBoolean(rule.isDefault)],
|
|
110
|
+
...rule.createdAt ? [["Created", formatDate(rule.createdAt)]] : [],
|
|
111
|
+
...rule.updatedAt ? [["Updated", formatDate(rule.updatedAt)]] : []
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
function notificationRows(rule) {
|
|
115
|
+
return [
|
|
116
|
+
[
|
|
117
|
+
"Team owner notifications",
|
|
118
|
+
formatBoolean(rule.notificationSettings.enableTeamOwnerNotifications)
|
|
119
|
+
],
|
|
120
|
+
...rule.notificationSettings.incidentIoRoutingKey ? [
|
|
121
|
+
[
|
|
122
|
+
"Incident.io routing key",
|
|
123
|
+
rule.notificationSettings.incidentIoRoutingKey
|
|
124
|
+
]
|
|
125
|
+
] : []
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
function printBuiltInRule(rule) {
|
|
129
|
+
output_manager_default.print(`${import_chalk.default.cyan("Built-in conditions")}
|
|
130
|
+
|
|
131
|
+
`);
|
|
132
|
+
if (rule.triggers.mode === "all") {
|
|
133
|
+
output_manager_default.print(
|
|
134
|
+
`${renderAlertTable(
|
|
135
|
+
[
|
|
136
|
+
["Minimum severity", rule.matchMinimumSeverityLevel],
|
|
137
|
+
["Triggers", "all built-in triggers"]
|
|
138
|
+
],
|
|
139
|
+
3
|
|
140
|
+
)}
|
|
141
|
+
`
|
|
142
|
+
);
|
|
143
|
+
} else {
|
|
144
|
+
output_manager_default.print(
|
|
145
|
+
`${renderAlertTable(
|
|
146
|
+
[["Minimum severity", rule.matchMinimumSeverityLevel]],
|
|
147
|
+
3
|
|
148
|
+
)}
|
|
149
|
+
|
|
150
|
+
${renderAlertTable(
|
|
151
|
+
[
|
|
152
|
+
["Trigger", "Filter"].map((header) => import_chalk.default.cyan(header)),
|
|
153
|
+
...rule.triggers.items.map((trigger) => [
|
|
154
|
+
trigger.type,
|
|
155
|
+
trigger.filter || "-"
|
|
156
|
+
])
|
|
157
|
+
],
|
|
158
|
+
3
|
|
159
|
+
)}
|
|
160
|
+
`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function metricRows(rule) {
|
|
165
|
+
return Object.entries(rule.evaluation.query.metrics).map(
|
|
166
|
+
([alias, metric]) => [
|
|
167
|
+
alias,
|
|
168
|
+
metric.metric,
|
|
169
|
+
metric.aggregation,
|
|
170
|
+
[
|
|
171
|
+
metric.per ? `per ${metric.per}` : void 0,
|
|
172
|
+
metric.normalize ? `normalize ${metric.normalize}` : void 0,
|
|
173
|
+
metric.dimensions?.join(", ")
|
|
174
|
+
].filter(Boolean).join("; ") || "-",
|
|
175
|
+
metric.filter || "-"
|
|
176
|
+
]
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function printCustomRule(rule) {
|
|
180
|
+
output_manager_default.print(`${import_chalk.default.cyan("Custom alert")}
|
|
181
|
+
|
|
182
|
+
`);
|
|
183
|
+
if (!rule.querySupported) {
|
|
184
|
+
output_manager_default.print(
|
|
185
|
+
" Query unavailable via API. You can update metadata, delete the rule, or recreate it with a supported query.\n"
|
|
186
|
+
);
|
|
187
|
+
output_manager_default.print(`
|
|
188
|
+
${renderAlertTable([["Severity", rule.severity]], 3)}
|
|
189
|
+
`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const query = rule.evaluation.query;
|
|
193
|
+
output_manager_default.print(
|
|
194
|
+
`${renderAlertTable(
|
|
195
|
+
[
|
|
196
|
+
["Severity", rule.severity],
|
|
197
|
+
["Window", rule.evaluation.window],
|
|
198
|
+
["Output", query.outputs[0]],
|
|
199
|
+
...query.formulas ? Object.entries(query.formulas).map(([alias, formula]) => [
|
|
200
|
+
`Formula ${alias}`,
|
|
201
|
+
formula
|
|
202
|
+
]) : [],
|
|
203
|
+
...query.groupBy?.length ? [["Group By", query.groupBy.join(", ")]] : [],
|
|
204
|
+
...query.filter ? [["Query Filter", query.filter]] : []
|
|
205
|
+
],
|
|
206
|
+
3
|
|
207
|
+
)}
|
|
208
|
+
`
|
|
209
|
+
);
|
|
210
|
+
output_manager_default.print(`
|
|
211
|
+
${import_chalk.default.cyan("Metrics")}
|
|
212
|
+
|
|
213
|
+
`);
|
|
214
|
+
output_manager_default.print(
|
|
215
|
+
`${renderAlertTable(
|
|
216
|
+
[
|
|
217
|
+
["Alias", "Metric", "Aggregation", "Modifiers", "Filter"].map(
|
|
218
|
+
(header) => import_chalk.default.cyan(header)
|
|
219
|
+
),
|
|
220
|
+
...metricRows(rule)
|
|
221
|
+
],
|
|
222
|
+
3
|
|
223
|
+
)}
|
|
224
|
+
`
|
|
225
|
+
);
|
|
226
|
+
output_manager_default.print(`
|
|
227
|
+
${import_chalk.default.cyan("Trigger")}
|
|
228
|
+
|
|
229
|
+
`);
|
|
230
|
+
output_manager_default.print(
|
|
231
|
+
`${renderAlertTable(
|
|
232
|
+
[
|
|
233
|
+
["Type", rule.trigger.type],
|
|
234
|
+
["Output", rule.trigger.output],
|
|
235
|
+
...rule.trigger.type === "threshold" ? [
|
|
236
|
+
["Operator", rule.trigger.operator],
|
|
237
|
+
["Threshold", String(rule.trigger.threshold)]
|
|
238
|
+
] : [["Standard Deviations", String(rule.trigger.standardDeviations)]],
|
|
239
|
+
...rule.trigger.minimum ? [
|
|
240
|
+
["Minimum Output", rule.trigger.minimum.output],
|
|
241
|
+
["Minimum Threshold", String(rule.trigger.minimum.threshold)]
|
|
242
|
+
] : []
|
|
243
|
+
],
|
|
244
|
+
3
|
|
245
|
+
)}
|
|
246
|
+
`
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
function printRule(rule) {
|
|
250
|
+
output_manager_default.print(
|
|
251
|
+
`
|
|
252
|
+
${import_chalk.default.bold("Alert rule")} ${import_chalk.default.cyan(rule.id)}
|
|
253
|
+
${renderAlertTable(
|
|
254
|
+
commonRows(rule),
|
|
255
|
+
3
|
|
256
|
+
)}
|
|
257
|
+
|
|
258
|
+
${import_chalk.default.cyan("Notifications")}
|
|
259
|
+
|
|
260
|
+
${renderAlertTable(
|
|
261
|
+
notificationRows(rule),
|
|
262
|
+
3
|
|
263
|
+
)}
|
|
264
|
+
|
|
265
|
+
`
|
|
266
|
+
);
|
|
267
|
+
if (rule.type === "built-in")
|
|
268
|
+
printBuiltInRule(rule);
|
|
269
|
+
else
|
|
270
|
+
printCustomRule(rule);
|
|
271
|
+
}
|
|
272
|
+
function printRulePreview(rule) {
|
|
273
|
+
printAlignedLabel("Name", rule.name);
|
|
274
|
+
printAlignedLabel("Rule ID", rule.id);
|
|
275
|
+
printAlignedLabel("Type", rule.type);
|
|
276
|
+
printAlignedLabel("Scope", formatPublicRuleScope(rule));
|
|
277
|
+
}
|
|
278
|
+
function printRuleDeletionReceipt(ruleId) {
|
|
279
|
+
output_manager_default.print("\n");
|
|
280
|
+
printAlignedLabel("Deleted", ruleId, { gutter: "\u2713" });
|
|
281
|
+
}
|
|
282
|
+
function printRuleMutationReceipt(action, rule, argv) {
|
|
283
|
+
output_manager_default.print("\n");
|
|
284
|
+
printAlignedLabel(action, rule.name, { gutter: "\u2713" });
|
|
285
|
+
printAlignedLabel("Rule ID", rule.id);
|
|
286
|
+
printAlignedLabel("Type", rule.type);
|
|
287
|
+
printAlignedLabel("Scope", formatPublicRuleScope(rule));
|
|
288
|
+
if (action !== "Deleted") {
|
|
289
|
+
printAlignedLabel(
|
|
290
|
+
"Inspect",
|
|
291
|
+
buildCommandWithGlobalFlags(
|
|
292
|
+
argv,
|
|
293
|
+
`alerts rules inspect ${quoteArg(rule.id)}`
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export {
|
|
300
|
+
printRules,
|
|
301
|
+
printRule,
|
|
302
|
+
printRulePreview,
|
|
303
|
+
printRuleDeletionReceipt,
|
|
304
|
+
printRuleMutationReceipt
|
|
305
|
+
};
|
|
@@ -13,68 +13,76 @@ import {
|
|
|
13
13
|
} from "./chunk-Q2DGFCO7.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/alerts/rules/command.ts
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
scopeOptions[1]
|
|
16
|
+
var projectScopeOption = {
|
|
17
|
+
...projectOption,
|
|
18
|
+
shorthand: "p",
|
|
19
|
+
description: "Use a project by name or ID"
|
|
20
|
+
};
|
|
21
|
+
var listAllOption = {
|
|
22
|
+
name: "all",
|
|
23
|
+
shorthand: "a",
|
|
24
|
+
type: Boolean,
|
|
25
|
+
deprecated: false,
|
|
26
|
+
description: "List all accessible rules in the selected team"
|
|
27
|
+
};
|
|
28
|
+
var mutationAllOption = {
|
|
29
|
+
...listAllOption,
|
|
30
|
+
description: "Apply the rule to all projects in the selected team"
|
|
31
|
+
};
|
|
32
|
+
var deprecatedItemScopeOptions = [
|
|
33
|
+
{ ...projectScopeOption, deprecated: true },
|
|
34
|
+
{ ...listAllOption, deprecated: true }
|
|
36
35
|
];
|
|
36
|
+
var bodyOption = {
|
|
37
|
+
name: "body",
|
|
38
|
+
shorthand: null,
|
|
39
|
+
type: String,
|
|
40
|
+
argument: "PATH",
|
|
41
|
+
deprecated: false,
|
|
42
|
+
description: "Read the alert rule body from a JSON file"
|
|
43
|
+
};
|
|
37
44
|
var rulesLsSubcommand = {
|
|
38
45
|
name: "ls",
|
|
39
46
|
aliases: ["list"],
|
|
40
|
-
description: "List alert rules for
|
|
47
|
+
description: "List alert rules for a project or team",
|
|
41
48
|
arguments: [],
|
|
42
49
|
options: [
|
|
43
|
-
|
|
50
|
+
projectScopeOption,
|
|
51
|
+
listAllOption,
|
|
44
52
|
{
|
|
45
53
|
name: "type",
|
|
46
54
|
shorthand: null,
|
|
47
55
|
type: [String],
|
|
48
56
|
argument: "TYPE",
|
|
49
57
|
deprecated: false,
|
|
50
|
-
description: "Filter by
|
|
58
|
+
description: "Filter by rule type: built-in or custom"
|
|
51
59
|
},
|
|
52
60
|
formatOption,
|
|
53
61
|
jsonOption
|
|
54
62
|
],
|
|
55
63
|
examples: [
|
|
56
64
|
{
|
|
57
|
-
name: "List rules
|
|
65
|
+
name: "List rules affecting the linked project",
|
|
58
66
|
value: `${packageName} alerts rules ls`
|
|
59
67
|
},
|
|
60
68
|
{
|
|
61
|
-
name: "List
|
|
69
|
+
name: "List all rules in the selected team",
|
|
62
70
|
value: `${packageName} alerts rules ls --all`
|
|
63
71
|
},
|
|
64
72
|
{
|
|
65
|
-
name: "List custom
|
|
66
|
-
value: `${packageName} alerts rules ls --type
|
|
73
|
+
name: "List custom rules for a project",
|
|
74
|
+
value: `${packageName} alerts rules ls --project my-app --type custom`
|
|
67
75
|
},
|
|
68
76
|
{
|
|
69
|
-
name: "JSON output",
|
|
70
|
-
value: `${packageName} alerts rules ls --json`
|
|
77
|
+
name: "Write JSON output",
|
|
78
|
+
value: `${packageName} alerts rules ls --all --json`
|
|
71
79
|
}
|
|
72
80
|
]
|
|
73
81
|
};
|
|
74
82
|
var rulesSchemaSubcommand = {
|
|
75
83
|
name: "schema",
|
|
76
84
|
aliases: [],
|
|
77
|
-
description: "Show alert rule
|
|
85
|
+
description: "Show alert rule request fields and examples",
|
|
78
86
|
arguments: [],
|
|
79
87
|
options: [
|
|
80
88
|
{
|
|
@@ -83,7 +91,7 @@ var rulesSchemaSubcommand = {
|
|
|
83
91
|
type: String,
|
|
84
92
|
argument: "TYPE",
|
|
85
93
|
deprecated: false,
|
|
86
|
-
description: "
|
|
94
|
+
description: "Rule type to describe: built-in or custom"
|
|
87
95
|
},
|
|
88
96
|
formatOption
|
|
89
97
|
],
|
|
@@ -93,62 +101,51 @@ var rulesSchemaSubcommand = {
|
|
|
93
101
|
value: `${packageName} alerts rules schema`
|
|
94
102
|
},
|
|
95
103
|
{
|
|
96
|
-
name: "Show
|
|
97
|
-
value: `${packageName} alerts rules schema --type
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "Show custom alert rule schema",
|
|
101
|
-
value: `${packageName} alerts rules schema --type custom_alert`
|
|
104
|
+
name: "Show the built-in rule schema",
|
|
105
|
+
value: `${packageName} alerts rules schema --type built-in`
|
|
102
106
|
},
|
|
103
107
|
{
|
|
104
|
-
name: "
|
|
105
|
-
value: `${packageName} alerts rules schema --type
|
|
108
|
+
name: "Show the custom rule schema as JSON",
|
|
109
|
+
value: `${packageName} alerts rules schema --type custom --format json`
|
|
106
110
|
}
|
|
107
111
|
]
|
|
108
112
|
};
|
|
109
113
|
var rulesAddSubcommand = {
|
|
110
114
|
name: "add",
|
|
111
115
|
aliases: ["create"],
|
|
112
|
-
description: "Create an alert rule from a JSON body
|
|
116
|
+
description: "Create an alert rule from a JSON body",
|
|
113
117
|
arguments: [],
|
|
114
118
|
options: [
|
|
115
|
-
|
|
119
|
+
projectScopeOption,
|
|
120
|
+
mutationAllOption,
|
|
116
121
|
formatOption,
|
|
117
122
|
jsonOption,
|
|
118
|
-
|
|
119
|
-
name: "body",
|
|
120
|
-
shorthand: null,
|
|
121
|
-
type: String,
|
|
122
|
-
argument: "PATH",
|
|
123
|
-
deprecated: false,
|
|
124
|
-
description: "Path to JSON for the new rule. Do not include id or teamId; the API assigns them."
|
|
125
|
-
}
|
|
123
|
+
bodyOption
|
|
126
124
|
],
|
|
127
125
|
examples: [
|
|
128
126
|
{
|
|
129
|
-
name: "Create
|
|
130
|
-
value: `${packageName} alerts rules add --body ./rule.json`
|
|
127
|
+
name: "Create a project-scoped rule",
|
|
128
|
+
value: `${packageName} alerts rules add --project my-app --body ./rule.json`
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "Create a team-wide built-in rule",
|
|
132
|
+
value: `${packageName} alerts rules add --all --body ./rule.json`
|
|
131
133
|
}
|
|
132
134
|
]
|
|
133
135
|
};
|
|
134
136
|
var rulesInspectSubcommand = {
|
|
135
137
|
name: "inspect",
|
|
136
138
|
aliases: ["get"],
|
|
137
|
-
description: "Show one alert rule by
|
|
138
|
-
arguments: [
|
|
139
|
-
|
|
140
|
-
name: "ruleId",
|
|
141
|
-
required: true
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
options: [...scopeOptions, formatOption, jsonOption],
|
|
139
|
+
description: "Show one alert rule by ID",
|
|
140
|
+
arguments: [{ name: "ruleId", required: true }],
|
|
141
|
+
options: [...deprecatedItemScopeOptions, formatOption, jsonOption],
|
|
145
142
|
examples: [
|
|
146
143
|
{
|
|
147
144
|
name: "Inspect a rule",
|
|
148
145
|
value: `${packageName} alerts rules inspect ar_abc123`
|
|
149
146
|
},
|
|
150
147
|
{
|
|
151
|
-
name: "JSON output",
|
|
148
|
+
name: "Write JSON output",
|
|
152
149
|
value: `${packageName} alerts rules inspect ar_abc123 --json`
|
|
153
150
|
}
|
|
154
151
|
]
|
|
@@ -157,20 +154,15 @@ var rulesRmSubcommand = {
|
|
|
157
154
|
name: "rm",
|
|
158
155
|
aliases: ["remove", "delete"],
|
|
159
156
|
description: "Delete an alert rule",
|
|
160
|
-
arguments: [
|
|
161
|
-
|
|
162
|
-
name: "ruleId",
|
|
163
|
-
required: true
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
options: [...scopeOptions, formatOption, jsonOption, yesOption],
|
|
157
|
+
arguments: [{ name: "ruleId", required: true }],
|
|
158
|
+
options: [...deprecatedItemScopeOptions, formatOption, jsonOption, yesOption],
|
|
167
159
|
examples: [
|
|
168
160
|
{
|
|
169
161
|
name: "Delete with confirmation",
|
|
170
162
|
value: `${packageName} alerts rules rm ar_abc123`
|
|
171
163
|
},
|
|
172
164
|
{
|
|
173
|
-
name: "Delete without prompt",
|
|
165
|
+
name: "Delete without a prompt",
|
|
174
166
|
value: `${packageName} alerts rules rm ar_abc123 --yes`
|
|
175
167
|
}
|
|
176
168
|
]
|
|
@@ -178,37 +170,33 @@ var rulesRmSubcommand = {
|
|
|
178
170
|
var rulesUpdateSubcommand = {
|
|
179
171
|
name: "update",
|
|
180
172
|
aliases: ["patch"],
|
|
181
|
-
description: "Patch an alert rule
|
|
182
|
-
arguments: [
|
|
183
|
-
{
|
|
184
|
-
name: "ruleId",
|
|
185
|
-
required: true
|
|
186
|
-
}
|
|
187
|
-
],
|
|
173
|
+
description: "Patch an alert rule or change its scope",
|
|
174
|
+
arguments: [{ name: "ruleId", required: true }],
|
|
188
175
|
options: [
|
|
189
|
-
|
|
176
|
+
projectScopeOption,
|
|
177
|
+
mutationAllOption,
|
|
190
178
|
formatOption,
|
|
191
179
|
jsonOption,
|
|
192
180
|
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
type: String,
|
|
196
|
-
argument: "PATH",
|
|
197
|
-
deprecated: false,
|
|
198
|
-
description: "Path to partial JSON. Omitted fields remain unchanged; null clears supported optional fields."
|
|
181
|
+
...bodyOption,
|
|
182
|
+
description: "Read the partial update body from a JSON file"
|
|
199
183
|
}
|
|
200
184
|
],
|
|
201
185
|
examples: [
|
|
202
186
|
{
|
|
203
|
-
name: "Update from file",
|
|
187
|
+
name: "Update fields from a file",
|
|
204
188
|
value: `${packageName} alerts rules update ar_abc123 --body ./patch.json`
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "Move a rule to a project",
|
|
192
|
+
value: `${packageName} alerts rules update ar_abc123 --project my-app`
|
|
205
193
|
}
|
|
206
194
|
]
|
|
207
195
|
};
|
|
208
196
|
var rulesAggregateCommand = {
|
|
209
197
|
name: "rules",
|
|
210
198
|
aliases: [],
|
|
211
|
-
description: "Create, list, update,
|
|
199
|
+
description: "Create, inspect, list, update, and delete alert rules",
|
|
212
200
|
arguments: [],
|
|
213
201
|
subcommands: [
|
|
214
202
|
rulesLsSubcommand,
|
|
@@ -221,20 +209,16 @@ var rulesAggregateCommand = {
|
|
|
221
209
|
options: [],
|
|
222
210
|
examples: [
|
|
223
211
|
{
|
|
224
|
-
name: "List rules",
|
|
212
|
+
name: "List rules for the linked project",
|
|
225
213
|
value: `${packageName} alerts rules ls`
|
|
226
214
|
},
|
|
227
215
|
{
|
|
228
|
-
name: "
|
|
229
|
-
value: `${packageName} alerts rules
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "Show schema for a rule type",
|
|
233
|
-
value: `${packageName} alerts rules schema --type custom_alert`
|
|
216
|
+
name: "Show the custom rule schema",
|
|
217
|
+
value: `${packageName} alerts rules schema --type custom`
|
|
234
218
|
},
|
|
235
219
|
{
|
|
236
220
|
name: "Add a rule",
|
|
237
|
-
value: `${packageName} alerts rules add --body ./rule.json`
|
|
221
|
+
value: `${packageName} alerts rules add --project my-app --body ./rule.json`
|
|
238
222
|
},
|
|
239
223
|
{
|
|
240
224
|
name: "Inspect a rule",
|