vercel 59.11.7 → 59.12.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-KSJQYR5C.js → add-OO3JGLZW.js} +3 -3
- package/dist/chunks/{add-WU2QYHYL.js → add-RTXDASSS.js} +3 -3
- package/dist/chunks/add-XGO6LHMD.js +221 -0
- package/dist/chunks/{build-F3J6FLPD.js → build-JINV2UD4.js} +3 -3
- package/dist/chunks/chunk-2NIDTSQJ.js +305 -0
- package/dist/chunks/{chunk-SHFNEZVI.js → chunk-32XSMM3W.js} +1 -1
- package/dist/chunks/{chunk-N4QHMXOO.js → chunk-3BB2HOO2.js} +3 -2
- package/dist/chunks/{chunk-DSTNNQVV.js → chunk-3F25W3GA.js} +3 -3
- package/dist/chunks/{chunk-OIH6FP5Y.js → chunk-4TUMNBEE.js} +2 -2
- package/dist/chunks/{chunk-4IVSM24H.js → chunk-ABSZNJQO.js} +1 -1
- package/dist/chunks/{chunk-CNDPIHY5.js → chunk-AV747POV.js} +24 -19
- package/dist/chunks/{chunk-QHS645AZ.js → chunk-CZ5QQRXD.js} +3 -3
- package/dist/chunks/{chunk-FL4JLNT2.js → chunk-E47NARDE.js} +2 -2
- package/dist/chunks/{chunk-XM3LOQIX.js → chunk-EDMW7SBH.js} +76 -92
- package/dist/chunks/{chunk-PJXMXMCO.js → chunk-ELZ6WQQA.js} +2 -2
- package/dist/chunks/{chunk-FVNJTRCE.js → chunk-EOLGLGXJ.js} +2 -2
- package/dist/chunks/chunk-GDOUDU6O.js +74 -0
- 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-HR2MP4XF.js +324 -0
- package/dist/chunks/{chunk-EZQDYIVB.js → chunk-JOXNBQ7W.js} +1 -1
- package/dist/chunks/{chunk-DBYHS3CK.js → chunk-KAF4WFF3.js} +2 -2
- package/dist/chunks/{chunk-VYC45Q4Z.js → chunk-KNO327AW.js} +1 -1
- package/dist/chunks/{chunk-XD4DCYMX.js → chunk-L6B6BRHH.js} +2 -2
- package/dist/chunks/{chunk-X7DBBZQD.js → chunk-LDV2R4P4.js} +1 -1
- package/dist/chunks/{chunk-2TSBB22D.js → chunk-MADFAH3O.js} +2 -2
- package/dist/chunks/{chunk-TGNEG57M.js → chunk-MDGPZHSM.js} +110 -14
- package/dist/chunks/{chunk-XIFATBH5.js → chunk-NDY3JDOU.js} +4 -4
- package/dist/chunks/{chunk-NSOYO6JQ.js → chunk-OJHDGHOB.js} +6 -6
- package/dist/chunks/{chunk-KJBZ5ZST.js → chunk-PIMIVJYK.js} +1 -0
- package/dist/chunks/{chunk-C762AAVU.js → chunk-PP5GKSIX.js} +4 -4
- package/dist/chunks/{chunk-Z7JWYFOY.js → chunk-QB2UHSUB.js} +1 -1
- package/dist/chunks/chunk-QIUK4Z7Q.js +79 -0
- package/dist/chunks/{chunk-GHKJAK5V.js → chunk-RNK3LXLR.js} +4 -4
- package/dist/chunks/{chunk-CEDN47PH.js → chunk-SWO66HE2.js} +1 -1
- package/dist/chunks/{chunk-EPOLDWRA.js → chunk-TDGK45FB.js} +1 -1
- package/dist/chunks/{chunk-PFM75KY3.js → chunk-UA55I7M6.js} +3 -3
- package/dist/chunks/{chunk-VT3Z7HF6.js → chunk-UJPVHLL5.js} +4 -4
- package/dist/chunks/{chunk-UARGTFCT.js → chunk-VJSREJVM.js} +1 -1
- package/dist/chunks/{chunk-WL6QYSGD.js → chunk-WPBCUXMZ.js} +506 -22
- package/dist/chunks/{chunk-A5JZS6ZN.js → chunk-WSZ5E4WH.js} +1 -1
- package/dist/chunks/{chunk-GUU4Z2AQ.js → chunk-WT2Y7FRD.js} +6 -6
- package/dist/chunks/{chunk-G3PXSXIB.js → chunk-WT6C2ALC.js} +3 -3
- package/dist/chunks/{chunk-7KROIXQM.js → chunk-X6TGUHFD.js} +3 -3
- package/dist/chunks/{chunk-QOPTXV4G.js → chunk-YPMFZRTN.js} +1 -1
- package/dist/chunks/{chunk-FVT74RZ5.js → chunk-YRESLJCW.js} +11 -11
- package/dist/chunks/{clear-XUQO4ZTK.js → clear-GQTDYSKJ.js} +3 -3
- package/dist/chunks/{compile-vercel-config-D3ARNHTN.js → compile-vercel-config-URVMKDVW.js} +2 -2
- package/dist/chunks/{config-37OAE7QJ.js → config-MSVQR5T6.js} +7 -7
- package/dist/chunks/{config-MEDLXUVM.js → config-OAXY4J6P.js} +3 -3
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{delete-VSWDZ2SW.js → delete-57QO64HD.js} +5 -5
- package/dist/chunks/{delete-3N3YZZOF.js → delete-XN6ESD7C.js} +5 -5
- package/dist/chunks/{detect-services-TESZCQWG.js → detect-services-UPY4LTBZ.js} +6 -6
- package/dist/chunks/{disable-A4FLFMC7.js → disable-BYI46V7B.js} +5 -5
- package/dist/chunks/{discard-CHGFULBZ.js → discard-IIQL44ZZ.js} +5 -5
- package/dist/chunks/{edit-MHSYAPDR.js → edit-BRNS3OR4.js} +6 -6
- package/dist/chunks/{edit-JZ63AJYQ.js → edit-JTW7XZH7.js} +5 -5
- package/dist/chunks/{enable-KD46SEC5.js → enable-CH5FSQMR.js} +5 -5
- package/dist/chunks/{export-42QZLBSN.js → export-6WHQOWKM.js} +5 -5
- package/dist/chunks/{image-GP4H73A2.js → image-ZSLYATWG.js} +3 -3
- package/dist/chunks/{import-builders-6TBLMPL2.js → import-builders-FNMYJZGG.js} +4 -4
- package/dist/chunks/{inspect-5FMWMY3C.js → inspect-4RDZSYWU.js} +10 -10
- package/dist/chunks/{inspect-MUVK6MMT.js → inspect-7WQXZWET.js} +3 -3
- package/dist/chunks/{inspect-Q3DWW7MC.js → inspect-CGXTNMMO.js} +9 -9
- package/dist/chunks/{inspect-RNTSYM6O.js → inspect-XJ7BYLZ5.js} +3 -3
- package/dist/chunks/{inspect-QFXAOUL4.js → inspect-Z2MBTTB7.js} +3 -3
- package/dist/chunks/{list-IHHIPXEC.js → list-65LW6OTM.js} +6 -6
- package/dist/chunks/{list-XHD5DLEX.js → list-7W3PHRB6.js} +7 -7
- package/dist/chunks/{list-JRNWLSO5.js → list-KS22Y57L.js} +2 -2
- package/dist/chunks/{login-PCT6KFWY.js → login-NXULVQZ2.js} +3 -3
- package/dist/chunks/{ls-TGHCCARZ.js → ls-35EOVEIQ.js} +4 -4
- package/dist/chunks/{ls-PQZ2RIDX.js → ls-5GKS5QRW.js} +4 -4
- package/dist/chunks/ls-ADYFYYIW.js +204 -0
- package/dist/chunks/{ls-SVOHC3XW.js → ls-DZYN3SNS.js} +4 -4
- package/dist/chunks/{ls-VRIH5WA3.js → ls-HVQOGBGV.js} +7 -7
- package/dist/chunks/{ls-GPEHEFCF.js → ls-I2PWG7YN.js} +4 -4
- package/dist/chunks/{open-E7DEKYDU.js → open-H34HXJHP.js} +5 -5
- package/dist/chunks/{permissions-JKOONWVL.js → permissions-ZPPEPKVE.js} +4 -4
- package/dist/chunks/{publish-EDDELDE5.js → publish-NRMKXHAU.js} +5 -5
- package/dist/chunks/{pull-646WEVDE.js → pull-WUT3XTZX.js} +7 -7
- package/dist/chunks/{push-LTNW5OVD.js → push-WFNCEA5J.js} +3 -3
- package/dist/chunks/{query-LU4N6KPO.js → query-2FQM3F7N.js} +7 -7
- package/dist/chunks/{reorder-22PKJMZP.js → reorder-GYCT7L3C.js} +5 -5
- package/dist/chunks/{reply-SF2EZMVZ.js → reply-RFEXNYZ7.js} +5 -5
- package/dist/chunks/{resolve-ZCZGXTOT.js → resolve-ZFGT7W6Z.js} +5 -5
- package/dist/chunks/{restore-VJAWZXB4.js → restore-JAXPMYL5.js} +5 -5
- package/dist/chunks/rm-CLKQN5E4.js +162 -0
- package/dist/chunks/{rm-WNPGTUBH.js → rm-JPV5V2SH.js} +3 -3
- package/dist/chunks/{rm-KN2QFCKO.js → rm-N7SGFQOA.js} +3 -3
- package/dist/chunks/{rm-KVEAJPRE.js → rm-UQJ4CZJH.js} +3 -3
- package/dist/chunks/{rm-OSZ5FZUM.js → rm-ZUQ4U454.js} +7 -7
- package/dist/chunks/rule-inspect-HI3YY7OY.js +123 -0
- package/dist/chunks/{rules-65LKAQ35.js → rules-DA3Q64M4.js} +7 -7
- package/dist/chunks/{schema-NXCW4M75.js → schema-R3C4CXJ6.js} +6 -6
- package/dist/chunks/schema-UYYFV3JB.js +381 -0
- package/dist/chunks/{set-FYJVKMPV.js → set-TOJPGW4J.js} +7 -7
- package/dist/chunks/{setup-and-link-KXPZE32P.js → setup-and-link-DRYXQOH4.js} +16 -16
- package/dist/chunks/{tags-ANIRP5E3.js → tags-TNLVFNVI.js} +2 -2
- package/dist/chunks/update-X6JB3NPI.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 +8273 -3511
- 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
|
@@ -0,0 +1,381 @@
|
|
|
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
|
+
handleRulesApiError,
|
|
9
|
+
outputRulesError,
|
|
10
|
+
resolveRulesTeam,
|
|
11
|
+
rulesSchemaPath
|
|
12
|
+
} from "./chunk-HR2MP4XF.js";
|
|
13
|
+
import "./chunk-3BB2HOO2.js";
|
|
14
|
+
import {
|
|
15
|
+
indent_default
|
|
16
|
+
} from "./chunk-A3NYPUKZ.js";
|
|
17
|
+
import "./chunk-KFWQ3EFH.js";
|
|
18
|
+
import "./chunk-WT2Y7FRD.js";
|
|
19
|
+
import "./chunk-AINIBIP4.js";
|
|
20
|
+
import "./chunk-QB2UHSUB.js";
|
|
21
|
+
import {
|
|
22
|
+
formatTable
|
|
23
|
+
} from "./chunk-GVNCVKCI.js";
|
|
24
|
+
import {
|
|
25
|
+
validateJsonOutput
|
|
26
|
+
} from "./chunk-KXDWXXJH.js";
|
|
27
|
+
import "./chunk-V4RMJKQP.js";
|
|
28
|
+
import {
|
|
29
|
+
rulesSchemaSubcommand
|
|
30
|
+
} from "./chunk-EDMW7SBH.js";
|
|
31
|
+
import "./chunk-WT6C2ALC.js";
|
|
32
|
+
import "./chunk-P7VSBDR4.js";
|
|
33
|
+
import "./chunk-YPMFZRTN.js";
|
|
34
|
+
import "./chunk-ZDU2NODC.js";
|
|
35
|
+
import "./chunk-PEC3CQSK.js";
|
|
36
|
+
import "./chunk-GGP5R3FU.js";
|
|
37
|
+
import "./chunk-VUS2JQB2.js";
|
|
38
|
+
import "./chunk-KAF4WFF3.js";
|
|
39
|
+
import "./chunk-HRXRELD3.js";
|
|
40
|
+
import "./chunk-B5XLQKHI.js";
|
|
41
|
+
import "./chunk-ABSZNJQO.js";
|
|
42
|
+
import "./chunk-XNIZGCN5.js";
|
|
43
|
+
import "./chunk-NW34PW6V.js";
|
|
44
|
+
import {
|
|
45
|
+
printError
|
|
46
|
+
} from "./chunk-3VM7HWF6.js";
|
|
47
|
+
import {
|
|
48
|
+
parseArguments
|
|
49
|
+
} from "./chunk-57RHXXXG.js";
|
|
50
|
+
import "./chunk-MADFAH3O.js";
|
|
51
|
+
import "./chunk-G5FBSUL4.js";
|
|
52
|
+
import "./chunk-26CU4Q3C.js";
|
|
53
|
+
import "./chunk-XPJLPUKO.js";
|
|
54
|
+
import {
|
|
55
|
+
isAPIError
|
|
56
|
+
} from "./chunk-CV5YC2EN.js";
|
|
57
|
+
import {
|
|
58
|
+
getFlagsSpecification,
|
|
59
|
+
packageName
|
|
60
|
+
} from "./chunk-Q2DGFCO7.js";
|
|
61
|
+
import {
|
|
62
|
+
output_manager_default
|
|
63
|
+
} from "./chunk-2JIX6UMI.js";
|
|
64
|
+
import "./chunk-P4QNYOFB.js";
|
|
65
|
+
import "./chunk-ZW6HETRE.js";
|
|
66
|
+
import "./chunk-S7KYDPEM.js";
|
|
67
|
+
import "./chunk-TZ2YI2VH.js";
|
|
68
|
+
|
|
69
|
+
// src/commands/alerts/rules/schema.ts
|
|
70
|
+
async function schema(client, argv) {
|
|
71
|
+
let parsedArgs;
|
|
72
|
+
try {
|
|
73
|
+
parsedArgs = parseArguments(
|
|
74
|
+
argv,
|
|
75
|
+
getFlagsSpecification(rulesSchemaSubcommand.options)
|
|
76
|
+
);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
printError(error);
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
const format = validateJsonOutput(parsedArgs.flags);
|
|
82
|
+
if (!format.valid) {
|
|
83
|
+
return outputRulesError(client, false, "INVALID_ARGUMENTS", format.error);
|
|
84
|
+
}
|
|
85
|
+
const value = parsedArgs.flags["--type"];
|
|
86
|
+
if (value !== void 0 && value !== "built-in" && value !== "custom") {
|
|
87
|
+
const suggestion = value === "custom_alert" ? " Use custom; alert rule types are built-in and custom." : "";
|
|
88
|
+
return outputRulesError(
|
|
89
|
+
client,
|
|
90
|
+
format.jsonOutput,
|
|
91
|
+
"INVALID_RULE_TYPE",
|
|
92
|
+
`Invalid rule type "${String(value)}".${suggestion} Expected built-in or custom.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const type = value;
|
|
96
|
+
const scope = await resolveRulesTeam(client, format.jsonOutput);
|
|
97
|
+
if (typeof scope === "number")
|
|
98
|
+
return scope;
|
|
99
|
+
output_manager_default.spinner("Fetching alert rule schema\u2026");
|
|
100
|
+
try {
|
|
101
|
+
const document = await client.fetch(
|
|
102
|
+
rulesSchemaPath(scope.teamId, type)
|
|
103
|
+
);
|
|
104
|
+
if (format.jsonOutput) {
|
|
105
|
+
client.stdout.write(`${JSON.stringify(document, null, 2)}
|
|
106
|
+
`);
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
if (!type) {
|
|
110
|
+
printSchemaIndex(document.ruleTypes);
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
const ruleSchema = document.ruleTypes.find((item) => item.type === type);
|
|
114
|
+
if (!ruleSchema) {
|
|
115
|
+
return outputRulesError(
|
|
116
|
+
client,
|
|
117
|
+
false,
|
|
118
|
+
"INVALID_SCHEMA_RESPONSE",
|
|
119
|
+
`The API did not return the ${type} alert rule schema.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
printSchema(ruleSchema);
|
|
123
|
+
return 0;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (isAPIError(error)) {
|
|
126
|
+
return handleRulesApiError(client, error, format.jsonOutput);
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
} finally {
|
|
130
|
+
output_manager_default.stopSpinner();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function printSchemaIndex(ruleTypes) {
|
|
134
|
+
output_manager_default.log("Alert rule schemas");
|
|
135
|
+
output_manager_default.print(
|
|
136
|
+
`${formatRows(
|
|
137
|
+
["Type", "Description"],
|
|
138
|
+
ruleTypes.map((item) => [item.type, item.description])
|
|
139
|
+
)}
|
|
140
|
+
Run \`${packageName} alerts rules schema --type <type>\` for fields and examples.
|
|
141
|
+
`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function printSchema(schema2) {
|
|
145
|
+
output_manager_default.log(`Alert rule schema: ${schema2.type}`);
|
|
146
|
+
output_manager_default.print(`${schema2.description}
|
|
147
|
+
|
|
148
|
+
`);
|
|
149
|
+
printCliScope(schema2.type);
|
|
150
|
+
printFields(schema2);
|
|
151
|
+
if (schema2.metricDiscovery) {
|
|
152
|
+
output_manager_default.print("Metric discovery\n\n");
|
|
153
|
+
output_manager_default.print(`${indent_default(schema2.metricDiscovery.command, 2)}
|
|
154
|
+
`);
|
|
155
|
+
output_manager_default.print(`${indent_default(schema2.metricDiscovery.description, 4)}
|
|
156
|
+
|
|
157
|
+
`);
|
|
158
|
+
}
|
|
159
|
+
printConstraints(schema2.constraints);
|
|
160
|
+
printExamples("Create examples", "create", schema2.create.examples);
|
|
161
|
+
printExamples("Update examples", "update", schema2.update.examples);
|
|
162
|
+
}
|
|
163
|
+
function printCliScope(type) {
|
|
164
|
+
output_manager_default.print("CLI scope flags\n\n");
|
|
165
|
+
output_manager_default.print(`${indent_default("--project <name-or-id>", 2)}
|
|
166
|
+
`);
|
|
167
|
+
output_manager_default.print(
|
|
168
|
+
`${indent_default(
|
|
169
|
+
type === "built-in" ? "Apply the rule only to the resolved project" : "Set the project evaluated by the rule",
|
|
170
|
+
4
|
|
171
|
+
)}
|
|
172
|
+
`
|
|
173
|
+
);
|
|
174
|
+
if (type === "built-in") {
|
|
175
|
+
output_manager_default.print(`${indent_default("--all", 2)}
|
|
176
|
+
`);
|
|
177
|
+
output_manager_default.print(`${indent_default("Apply the rule to every team project", 4)}
|
|
178
|
+
`);
|
|
179
|
+
}
|
|
180
|
+
output_manager_default.print(
|
|
181
|
+
`${indent_default("Use a scope flag or ruleScope in the body, not both.", 2)}
|
|
182
|
+
|
|
183
|
+
`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function printFields(schema2) {
|
|
187
|
+
const createFields = collectFields(schema2.create.jsonSchema);
|
|
188
|
+
const updateFields = collectFields(schema2.update.jsonSchema);
|
|
189
|
+
const paths = [
|
|
190
|
+
...createFields.keys(),
|
|
191
|
+
...[...updateFields.keys()].filter((path) => !createFields.has(path))
|
|
192
|
+
];
|
|
193
|
+
output_manager_default.print("Fields\n\n");
|
|
194
|
+
for (const path of paths) {
|
|
195
|
+
const create = createFields.get(path);
|
|
196
|
+
const update = updateFields.get(path);
|
|
197
|
+
const types = unique([...create?.types ?? [], ...update?.types ?? []]);
|
|
198
|
+
const descriptions = unique([
|
|
199
|
+
...create?.descriptions ?? [],
|
|
200
|
+
...update?.descriptions ?? []
|
|
201
|
+
]);
|
|
202
|
+
output_manager_default.print(`${indent_default(path, 2)}
|
|
203
|
+
`);
|
|
204
|
+
output_manager_default.print(
|
|
205
|
+
`${indent_default(
|
|
206
|
+
`${types.join(" | ") || "value"} \xB7 create ${create?.requirement ?? "not accepted"} \xB7 update ${update?.requirement ?? "not accepted"}`,
|
|
207
|
+
4
|
|
208
|
+
)}
|
|
209
|
+
`
|
|
210
|
+
);
|
|
211
|
+
if (descriptions[0]) {
|
|
212
|
+
output_manager_default.print(`${indent_default(descriptions[0], 4)}
|
|
213
|
+
`);
|
|
214
|
+
}
|
|
215
|
+
output_manager_default.print("\n");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function collectFields(schema2) {
|
|
219
|
+
const fields = /* @__PURE__ */ new Map();
|
|
220
|
+
visitObjectSchema(schema2, "", false, fields);
|
|
221
|
+
return fields;
|
|
222
|
+
}
|
|
223
|
+
function visitObjectSchema(schema2, prefix, conditional, fields) {
|
|
224
|
+
const properties = asSchemaRecord(schema2.properties);
|
|
225
|
+
const required = new Set(
|
|
226
|
+
Array.isArray(schema2.required) ? schema2.required.filter(
|
|
227
|
+
(item) => typeof item === "string"
|
|
228
|
+
) : []
|
|
229
|
+
);
|
|
230
|
+
for (const [name, propertySchema] of Object.entries(properties)) {
|
|
231
|
+
const path = prefix ? `${prefix}.${name}` : name;
|
|
232
|
+
const requirement = conditional ? "conditional" : required.has(name) ? "required" : "optional";
|
|
233
|
+
addField(fields, path, propertySchema, requirement);
|
|
234
|
+
visitNestedSchema(propertySchema, path, requirement !== "required", fields);
|
|
235
|
+
}
|
|
236
|
+
for (const variant of schemaVariants(schema2)) {
|
|
237
|
+
visitObjectSchema(variant, prefix, true, fields);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function visitNestedSchema(schema2, path, conditional, fields) {
|
|
241
|
+
if (schema2.properties || schema2.oneOf || schema2.anyOf || schema2.allOf) {
|
|
242
|
+
visitObjectSchema(schema2, path, conditional, fields);
|
|
243
|
+
}
|
|
244
|
+
const additionalProperties = asSchema(schema2.additionalProperties);
|
|
245
|
+
if (additionalProperties) {
|
|
246
|
+
const entryPath = `${path}.<key>`;
|
|
247
|
+
addField(fields, entryPath, additionalProperties, "conditional");
|
|
248
|
+
visitNestedSchema(additionalProperties, entryPath, true, fields);
|
|
249
|
+
}
|
|
250
|
+
const items = asSchema(schema2.items);
|
|
251
|
+
if (items) {
|
|
252
|
+
visitNestedSchema(items, `${path}[]`, true, fields);
|
|
253
|
+
}
|
|
254
|
+
if (Array.isArray(schema2.prefixItems)) {
|
|
255
|
+
for (const item of schema2.prefixItems) {
|
|
256
|
+
const itemSchema = asSchema(item);
|
|
257
|
+
if (itemSchema)
|
|
258
|
+
visitNestedSchema(itemSchema, `${path}[]`, true, fields);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function addField(fields, path, schema2, requirement) {
|
|
263
|
+
const current = fields.get(path);
|
|
264
|
+
const type = describeSchemaType(schema2);
|
|
265
|
+
const description = typeof schema2.description === "string" ? schema2.description : void 0;
|
|
266
|
+
if (!current) {
|
|
267
|
+
fields.set(path, {
|
|
268
|
+
requirement,
|
|
269
|
+
types: type ? [type] : [],
|
|
270
|
+
descriptions: description ? [description] : []
|
|
271
|
+
});
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
current.types = unique([...current.types, ...type ? [type] : []]);
|
|
275
|
+
current.descriptions = unique([
|
|
276
|
+
...current.descriptions,
|
|
277
|
+
...description ? [description] : []
|
|
278
|
+
]);
|
|
279
|
+
if (current.requirement !== requirement)
|
|
280
|
+
current.requirement = "conditional";
|
|
281
|
+
}
|
|
282
|
+
function describeSchemaType(schema2) {
|
|
283
|
+
if ("const" in schema2)
|
|
284
|
+
return formatLiteral(schema2.const);
|
|
285
|
+
if (Array.isArray(schema2.enum)) {
|
|
286
|
+
return schema2.enum.map(formatLiteral).join(" | ");
|
|
287
|
+
}
|
|
288
|
+
const variants = schemaVariants(schema2).map(describeSchemaType).filter(Boolean);
|
|
289
|
+
if (variants.length > 0)
|
|
290
|
+
return unique(variants).join(" | ");
|
|
291
|
+
if (schema2.type === "array" || schema2.prefixItems || schema2.items) {
|
|
292
|
+
if (Array.isArray(schema2.prefixItems)) {
|
|
293
|
+
const tuple = schema2.prefixItems.map(asSchema).filter((item2) => item2 !== void 0).map(describeSchemaType).join(", ");
|
|
294
|
+
return `[${tuple || "value"}]`;
|
|
295
|
+
}
|
|
296
|
+
const item = asSchema(schema2.items);
|
|
297
|
+
return `${item ? describeSchemaType(item) : "value"}[]`;
|
|
298
|
+
}
|
|
299
|
+
if (schema2.type === "object" || schema2.properties) {
|
|
300
|
+
const value = asSchema(schema2.additionalProperties);
|
|
301
|
+
return value ? `record<string, ${describeSchemaType(value)}>` : "object";
|
|
302
|
+
}
|
|
303
|
+
return typeof schema2.type === "string" ? schema2.type : "value";
|
|
304
|
+
}
|
|
305
|
+
function schemaVariants(schema2) {
|
|
306
|
+
return ["oneOf", "anyOf", "allOf"].flatMap((key) => {
|
|
307
|
+
const value = schema2[key];
|
|
308
|
+
if (!Array.isArray(value))
|
|
309
|
+
return [];
|
|
310
|
+
return value.map(asSchema).filter((item) => item !== void 0);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function asSchema(value) {
|
|
314
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
315
|
+
}
|
|
316
|
+
function asSchemaRecord(value) {
|
|
317
|
+
const schema2 = asSchema(value);
|
|
318
|
+
if (!schema2)
|
|
319
|
+
return {};
|
|
320
|
+
return Object.fromEntries(
|
|
321
|
+
Object.entries(schema2).filter(
|
|
322
|
+
(entry) => asSchema(entry[1]) !== void 0
|
|
323
|
+
)
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
function formatLiteral(value) {
|
|
327
|
+
return typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
|
|
328
|
+
}
|
|
329
|
+
function unique(values) {
|
|
330
|
+
return [...new Set(values)];
|
|
331
|
+
}
|
|
332
|
+
function printConstraints(constraints) {
|
|
333
|
+
if (constraints.length === 0)
|
|
334
|
+
return;
|
|
335
|
+
output_manager_default.print("Constraints\n\n");
|
|
336
|
+
for (const constraint of constraints) {
|
|
337
|
+
const operations = constraint.appliesTo.join("/");
|
|
338
|
+
const kind = constraint.kind === "request" ? "" : ` \xB7 ${humanize(constraint.kind)}`;
|
|
339
|
+
output_manager_default.print(
|
|
340
|
+
`${indent_default(`${humanize(constraint.code)} \xB7 ${operations}${kind}`, 2)}
|
|
341
|
+
`
|
|
342
|
+
);
|
|
343
|
+
output_manager_default.print(`${indent_default(`Paths: ${constraint.paths.join(", ")}`, 4)}
|
|
344
|
+
`);
|
|
345
|
+
output_manager_default.print(`${indent_default(constraint.description, 4)}
|
|
346
|
+
|
|
347
|
+
`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function humanize(value) {
|
|
351
|
+
const words = value.replace(/[-_]/g, " ");
|
|
352
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
353
|
+
}
|
|
354
|
+
function printExamples(title, operation, examples) {
|
|
355
|
+
output_manager_default.print(`${title}
|
|
356
|
+
|
|
357
|
+
`);
|
|
358
|
+
for (const example of examples) {
|
|
359
|
+
const fileName = operation === "create" ? "rule.json" : "patch.json";
|
|
360
|
+
const command = operation === "create" ? `${packageName} alerts rules add --body ./${fileName}` : `${packageName} alerts rules update <rule-id> --body ./${fileName}`;
|
|
361
|
+
output_manager_default.print(`${indent_default(example.name, 2)}
|
|
362
|
+
`);
|
|
363
|
+
output_manager_default.print(`${indent_default(`Body (${fileName}):`, 4)}
|
|
364
|
+
`);
|
|
365
|
+
output_manager_default.print(`${indent_default(JSON.stringify(example.body, null, 2), 6)}
|
|
366
|
+
`);
|
|
367
|
+
output_manager_default.print(`${indent_default(command, 4)}
|
|
368
|
+
|
|
369
|
+
`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function formatRows(headers, rows) {
|
|
373
|
+
return formatTable(
|
|
374
|
+
headers,
|
|
375
|
+
headers.map(() => "l"),
|
|
376
|
+
[{ rows }]
|
|
377
|
+
).trim();
|
|
378
|
+
}
|
|
379
|
+
export {
|
|
380
|
+
schema as default
|
|
381
|
+
};
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
toRule,
|
|
24
24
|
writeConfigJson,
|
|
25
25
|
writeSamplingRules
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-3F25W3GA.js";
|
|
27
|
+
import "./chunk-QIUK4Z7Q.js";
|
|
28
28
|
import {
|
|
29
29
|
validateJsonOutput
|
|
30
30
|
} from "./chunk-KXDWXXJH.js";
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
setSubcommand
|
|
36
36
|
} from "./chunk-GY5I4AYD.js";
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-X6TGUHFD.js";
|
|
38
|
+
import "./chunk-ELZ6WQQA.js";
|
|
39
39
|
import "./chunk-VUS2JQB2.js";
|
|
40
40
|
import {
|
|
41
41
|
help
|
|
@@ -44,9 +44,9 @@ import {
|
|
|
44
44
|
TelemetryClient
|
|
45
45
|
} from "./chunk-HB4UKFDO.js";
|
|
46
46
|
import "./chunk-B5XLQKHI.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-4IVSM24H.js";
|
|
47
|
+
import "./chunk-ABSZNJQO.js";
|
|
49
48
|
import "./chunk-XNIZGCN5.js";
|
|
49
|
+
import "./chunk-NW34PW6V.js";
|
|
50
50
|
import {
|
|
51
51
|
printError
|
|
52
52
|
} from "./chunk-3VM7HWF6.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
parseArguments
|
|
55
55
|
} from "./chunk-57RHXXXG.js";
|
|
56
56
|
import "./chunk-4IALDGB7.js";
|
|
57
|
-
import "./chunk-
|
|
57
|
+
import "./chunk-MADFAH3O.js";
|
|
58
58
|
import "./chunk-G5FBSUL4.js";
|
|
59
59
|
import "./chunk-26CU4Q3C.js";
|
|
60
60
|
import "./chunk-XPJLPUKO.js";
|
|
@@ -10,42 +10,42 @@ import {
|
|
|
10
10
|
resolveGitConnectIntent,
|
|
11
11
|
setupAndLink,
|
|
12
12
|
shouldPromptForRootDirectory
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YRESLJCW.js";
|
|
14
|
+
import "./chunk-UJPVHLL5.js";
|
|
14
15
|
import "./chunk-RVBZ64EQ.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-Z7JWYFOY.js";
|
|
16
|
+
import "./chunk-WSZ5E4WH.js";
|
|
17
|
+
import "./chunk-QB2UHSUB.js";
|
|
18
18
|
import "./chunk-V4RMJKQP.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-VJSREJVM.js";
|
|
20
20
|
import "./chunk-332LMJLZ.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-32XSMM3W.js";
|
|
22
|
+
import "./chunk-WT6C2ALC.js";
|
|
23
23
|
import "./chunk-P7VSBDR4.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-YPMFZRTN.js";
|
|
25
25
|
import "./chunk-ZDU2NODC.js";
|
|
26
26
|
import "./chunk-PEC3CQSK.js";
|
|
27
27
|
import "./chunk-GGP5R3FU.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-RNK3LXLR.js";
|
|
29
|
+
import "./chunk-X6TGUHFD.js";
|
|
30
30
|
import "./chunk-FRVG4OW3.js";
|
|
31
31
|
import "./chunk-6E6KPBXY.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-PP5GKSIX.js";
|
|
33
|
+
import "./chunk-ELZ6WQQA.js";
|
|
34
34
|
import "./chunk-VUS2JQB2.js";
|
|
35
35
|
import "./chunk-XUAWTW4W.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-KAF4WFF3.js";
|
|
37
37
|
import "./chunk-HRXRELD3.js";
|
|
38
38
|
import "./chunk-PNGVSHR3.js";
|
|
39
39
|
import "./chunk-RN6V5ODW.js";
|
|
40
40
|
import "./chunk-HB4UKFDO.js";
|
|
41
41
|
import "./chunk-B5XLQKHI.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-4IVSM24H.js";
|
|
42
|
+
import "./chunk-ABSZNJQO.js";
|
|
44
43
|
import "./chunk-XNIZGCN5.js";
|
|
44
|
+
import "./chunk-NW34PW6V.js";
|
|
45
45
|
import "./chunk-3VM7HWF6.js";
|
|
46
46
|
import "./chunk-57RHXXXG.js";
|
|
47
47
|
import "./chunk-4IALDGB7.js";
|
|
48
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-MADFAH3O.js";
|
|
49
49
|
import "./chunk-G5FBSUL4.js";
|
|
50
50
|
import "./chunk-26CU4Q3C.js";
|
|
51
51
|
import "./chunk-XPJLPUKO.js";
|
|
@@ -56,9 +56,9 @@ async function tags(client, argv, telemetry) {
|
|
|
56
56
|
}
|
|
57
57
|
switch (subcommand) {
|
|
58
58
|
case "ls":
|
|
59
|
-
return (await import("./ls-
|
|
59
|
+
return (await import("./ls-DZYN3SNS.js")).default(client, args, telemetry);
|
|
60
60
|
case "inspect":
|
|
61
|
-
return (await import("./inspect-
|
|
61
|
+
return (await import("./inspect-XJ7BYLZ5.js")).default(client, args, telemetry);
|
|
62
62
|
default:
|
|
63
63
|
output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
|
|
64
64
|
return 1;
|