vercel 63.1.2 → 64.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/add-BXOEELS6.js +8 -0
- package/dist/chunks/add-FZLHLH56.js +8 -0
- package/dist/chunks/add-XUNOIBOU.js +8 -0
- package/dist/chunks/build-PCEPD6N5.js +7 -0
- package/dist/chunks/{chunk-VOZEB6PD.js → chunk-2VBFQZ72.js} +1 -1
- package/dist/chunks/{chunk-DO4GPDKO.js → chunk-34ZJMN36.js} +1 -1
- package/dist/chunks/{chunk-YCV465P5.js → chunk-37QGCN6P.js} +2 -2
- package/dist/chunks/chunk-3AVG55SO.js +7 -0
- package/dist/chunks/{chunk-2GTCIOCB.js → chunk-3CTSLNNG.js} +1 -1
- package/dist/chunks/{chunk-QCG6Q33G.js → chunk-4CDUQXUK.js} +1 -1
- package/dist/chunks/{chunk-HVNIW32A.js → chunk-4R32LMIV.js} +2 -2
- package/dist/chunks/chunk-5UEBA6N6.js +8 -0
- package/dist/chunks/{chunk-OKS442LQ.js → chunk-7C2QFD5D.js} +1 -1
- package/dist/chunks/{chunk-ME75ZZW7.js → chunk-ASU72O2R.js} +1 -1
- package/dist/chunks/chunk-BDFUWXIX.js +8 -0
- package/dist/chunks/{chunk-AVRYIQRF.js → chunk-BLAIBYEU.js} +3 -3
- package/dist/chunks/{chunk-L3S26YTM.js → chunk-BZ3YIITB.js} +1 -1
- package/dist/chunks/{chunk-MSH7V3FL.js → chunk-DYQXJCHO.js} +1 -1
- package/dist/chunks/{chunk-YDRNDY2V.js → chunk-FECLYNNO.js} +2 -2
- package/dist/chunks/{chunk-HMS3UIQ2.js → chunk-FIIHB66A.js} +1 -1
- package/dist/chunks/chunk-FO7MV3VE.js +8 -0
- package/dist/chunks/chunk-FZIRYAXC.js +10 -0
- package/dist/chunks/{chunk-EGZIRI5B.js → chunk-G6B6TVAE.js} +1 -1
- package/dist/chunks/{chunk-JV4URBEA.js → chunk-GHVWBHMT.js} +1 -1
- package/dist/chunks/{chunk-WJEAGH4K.js → chunk-GNKUINRV.js} +1 -1
- package/dist/chunks/{chunk-DJDT2SUM.js → chunk-HKHQBR4Y.js} +1 -1
- package/dist/chunks/{chunk-IVUYULMP.js → chunk-IUF3I4BN.js} +1 -1
- package/dist/chunks/chunk-IVSKWN3O.js +7 -0
- package/dist/chunks/{chunk-OA446564.js → chunk-JGPRCZC2.js} +1 -1
- package/dist/chunks/{chunk-B3K6GM2W.js → chunk-JNPG7MVL.js} +1 -1
- package/dist/chunks/{chunk-IOJYYPUF.js → chunk-K6BJ5GVA.js} +5 -5
- package/dist/chunks/chunk-KLH6NMWT.js +20 -0
- package/dist/chunks/{chunk-7I57HOA6.js → chunk-KLZZRZPR.js} +1 -1
- package/dist/chunks/{chunk-TAAV7L3T.js → chunk-MJD6WHG4.js} +1 -1
- package/dist/chunks/chunk-MYX5A5KF.js +11 -0
- package/dist/chunks/{chunk-7Z4JCYS6.js → chunk-NFJPCOTV.js} +2 -2
- package/dist/chunks/{chunk-R4TMZGV5.js → chunk-OAOSM4JQ.js} +10 -7
- package/dist/chunks/{chunk-46XQIXL7.js → chunk-OIB6INSE.js} +1 -1
- package/dist/chunks/chunk-OKFDH3WB.js +12 -0
- package/dist/chunks/{chunk-WDJFZM7U.js → chunk-OZ47SVXA.js} +1 -1
- package/dist/chunks/{chunk-RZTGPQFR.js → chunk-P2DETVWN.js} +1 -1
- package/dist/chunks/{chunk-VUILLFZ6.js → chunk-P4YB5FAK.js} +1 -1
- package/dist/chunks/{chunk-MS576PZ7.js → chunk-Q7CITIB3.js} +1 -1
- package/dist/chunks/{chunk-WXWBB7LP.js → chunk-QADFMDEL.js} +1 -1
- package/dist/chunks/{chunk-Q7ZF7MBI.js → chunk-QYDG63GL.js} +1 -1
- package/dist/chunks/{chunk-UPXIQO57.js → chunk-RELWXDML.js} +1 -1
- package/dist/chunks/{chunk-I4NK2P2D.js → chunk-RG4ARRCN.js} +1 -1
- package/dist/chunks/{chunk-ME6DBVQG.js → chunk-RNF5CSW6.js} +1 -1
- package/dist/chunks/{chunk-GNY6U33Z.js → chunk-S2JJZDW6.js} +2 -2
- package/dist/chunks/{chunk-26KRNEYD.js → chunk-TMMEVR3B.js} +1 -1
- package/dist/chunks/{chunk-LZAGJ3QI.js → chunk-TYTNF34C.js} +1 -1
- package/dist/chunks/{chunk-BW64GZ3E.js → chunk-VYC3AMWW.js} +1 -1
- package/dist/chunks/{chunk-G64N3I5W.js → chunk-WHVT7UXE.js} +1 -1
- package/dist/chunks/{chunk-G2JKENQU.js → chunk-WJ5GXTPJ.js} +1 -1
- package/dist/chunks/{chunk-WKTIAVGU.js → chunk-X33ZHJ45.js} +1 -1
- package/dist/chunks/chunk-YBOS65VB.js +7 -0
- package/dist/chunks/{chunk-NUPLQVP3.js → chunk-YCQFJOHY.js} +3 -3
- package/dist/chunks/chunk-YTDK6AHS.js +7 -0
- package/dist/chunks/{chunk-Q3SWLXLO.js → chunk-YTEZO2SZ.js} +1 -1
- package/dist/chunks/{chunk-R4VVQRLX.js → chunk-Z4OH72VZ.js} +1 -1
- package/dist/chunks/{chunk-MJR564B4.js → chunk-ZEQLYYUJ.js} +1 -1
- package/dist/chunks/chunk-ZV2YYRGF.js +7 -0
- package/dist/chunks/{chunk-TEHMKMPG.js → chunk-ZYTRVEE3.js} +1 -1
- package/dist/chunks/clear-MO5T5MPM.js +8 -0
- package/dist/chunks/{compile-vercel-config-66TMMPL5.js → compile-vercel-config-PB3PBGGE.js} +1 -1
- package/dist/chunks/config-63EI73DZ.js +7 -0
- package/dist/chunks/config-KZTDW2QM.js +8 -0
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/delete-2UDSDSP4.js +9 -0
- package/dist/chunks/delete-UB32CPKH.js +10 -0
- package/dist/chunks/{detect-projects-FTGWHOTA.js → detect-projects-LFEZ7BQU.js} +1 -1
- package/dist/chunks/{detect-services-QPBLJZGR.js → detect-services-WGEJOZNA.js} +1 -1
- package/dist/chunks/disable-JIJU4GNV.js +7 -0
- package/dist/chunks/discard-O65PEVZT.js +14 -0
- package/dist/chunks/edit-KWWBA2X3.js +9 -0
- package/dist/chunks/edit-L4FF6DXN.js +8 -0
- package/dist/chunks/enable-S62D7E5S.js +7 -0
- package/dist/chunks/{export-OFXKWFKJ.js → export-OZ4RCU45.js} +1 -1
- package/dist/chunks/future-MDYFVS3M.js +7 -0
- package/dist/chunks/{generate-cert-for-deploy-H5CIDNMW.js → generate-cert-for-deploy-S5NMGXYT.js} +1 -1
- package/dist/chunks/image-OFC55KW4.js +7 -0
- package/dist/chunks/{import-builders-K3AX56WJ.js → import-builders-QHBL27W6.js} +1 -1
- package/dist/chunks/inspect-35NUO5W2.js +13 -0
- package/dist/chunks/{inspect-ZNSHEHOX.js → inspect-BNXHORO6.js} +1 -1
- package/dist/chunks/{inspect-7YQ3GVZK.js → inspect-IXITCFX4.js} +1 -1
- package/dist/chunks/inspect-WCNQQI76.js +9 -0
- package/dist/chunks/{inspect-3YVNC464.js → inspect-XP5PASNY.js} +1 -1
- package/dist/chunks/{list-AKLXWJVE.js → list-5FOC7RBS.js} +1 -1
- package/dist/chunks/{list-QWTJ5GEV.js → list-NJ42HMZJ.js} +1 -1
- package/dist/chunks/list-OQOQNY3M.js +11 -0
- package/dist/chunks/login-LGUJR7CK.js +9 -0
- package/dist/chunks/login-X7K2C7IO.js +7 -0
- package/dist/chunks/logs-EH3XT4WK.js +7 -0
- package/dist/chunks/{ls-PDGT4IYT.js → ls-3M5GSH6T.js} +1 -1
- package/dist/chunks/{ls-RT2GW7GQ.js → ls-5SSERJCY.js} +1 -1
- package/dist/chunks/{ls-62IGNDVX.js → ls-72Y3CWNF.js} +1 -1
- package/dist/chunks/{ls-KPDMEX3M.js → ls-D66KXCEQ.js} +1 -1
- package/dist/chunks/ls-EYG5GFIX.js +8 -0
- package/dist/chunks/ls-GG4RSGA4.js +11 -0
- package/dist/chunks/{ls-SWSNZDIB.js → ls-MCI6TODA.js} +1 -1
- package/dist/chunks/mutate-VM3WSWZD.js +9 -0
- package/dist/chunks/notifications-T4QZSK34.js +7 -0
- package/dist/chunks/open-2TSWF7N6.js +7 -0
- package/dist/chunks/openapi-UYT3A457.js +7 -0
- package/dist/chunks/permissions-IAM4KOAB.js +7 -0
- package/dist/chunks/prompt-missing-credentials-C2JLCS3F.js +7 -0
- package/dist/chunks/publish-E5CQKZV2.js +15 -0
- package/dist/chunks/pull-FCIBUMPR.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-YK7ZK4OQ.js → purchase-domain-if-available-LDWR2G45.js} +1 -1
- package/dist/chunks/push-ZWGOHNYH.js +7 -0
- package/dist/chunks/query-LYHMXYRT.js +12 -0
- package/dist/chunks/reauthenticate-Z62FFYZH.js +7 -0
- package/dist/chunks/reorder-2ZHAHZTI.js +10 -0
- package/dist/chunks/reply-6WH2VCFF.js +9 -0
- package/dist/chunks/resolve-RRLE67FD.js +12 -0
- package/dist/chunks/resolve-agent-team-ESQPBTIE.js +7 -0
- package/dist/chunks/restore-3WU5FYUK.js +16 -0
- package/dist/chunks/rm-27VKBKTH.js +8 -0
- package/dist/chunks/rm-3T2RJ37B.js +8 -0
- package/dist/chunks/rm-C6VVMUCP.js +8 -0
- package/dist/chunks/rm-CAPJK4ND.js +8 -0
- package/dist/chunks/rm-ZN3VHILG.js +8 -0
- package/dist/chunks/rule-inspect-3XXNK2ON.js +8 -0
- package/dist/chunks/rules-ZJW64O5H.js +7 -0
- package/dist/chunks/{schema-LM6XGKQS.js → schema-GAUOV4YT.js} +1 -1
- package/dist/chunks/schema-XKLWHSSQ.js +14 -0
- package/dist/chunks/select-org-GGUGYGDL.js +7 -0
- package/dist/chunks/set-6UUR4ZX2.js +7 -0
- package/dist/chunks/setup-and-link-MCBSB4BW.js +7 -0
- package/dist/chunks/tags-Z45CQGA6.js +7 -0
- package/dist/chunks/{types-K73TDN7C.js → types-FK3W7A2Y.js} +1 -1
- package/dist/chunks/{update-QSNT3MDG.js → update-BPLPDZSK.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +9 -9
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +347 -331
- package/dist/index.js +2 -2
- package/dist/internal-build.js +1 -1
- package/dist/root-help-commands.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +56 -56
- package/dist/chunks/add-LFJBSEHE.js +0 -8
- package/dist/chunks/add-WX7XBOMM.js +0 -8
- package/dist/chunks/add-YAWFEGID.js +0 -8
- package/dist/chunks/build-FIPVJJWA.js +0 -7
- package/dist/chunks/chunk-5DXCVG5U.js +0 -10
- package/dist/chunks/chunk-5O2CW3SX.js +0 -8
- package/dist/chunks/chunk-67N2NJCF.js +0 -7
- package/dist/chunks/chunk-6LZ72MNE.js +0 -9
- package/dist/chunks/chunk-ACGKBCXE.js +0 -8
- package/dist/chunks/chunk-AMDHTZDV.js +0 -11
- package/dist/chunks/chunk-BKV35LVB.js +0 -7
- package/dist/chunks/chunk-HRR57QNP.js +0 -7
- package/dist/chunks/chunk-IADIPNJO.js +0 -7
- package/dist/chunks/chunk-MHQ2MW2B.js +0 -20
- package/dist/chunks/chunk-MYY36NBW.js +0 -7
- package/dist/chunks/chunk-OBRNACWW.js +0 -18
- package/dist/chunks/chunk-OH2RT2GN.js +0 -7
- package/dist/chunks/chunk-PFD7LETF.js +0 -7
- package/dist/chunks/chunk-WH3SHWVK.js +0 -8
- package/dist/chunks/clear-ZEWRQLJR.js +0 -8
- package/dist/chunks/config-LDTDOVVC.js +0 -8
- package/dist/chunks/config-V7SAJGMS.js +0 -7
- package/dist/chunks/delete-5WC3BAXY.js +0 -9
- package/dist/chunks/delete-QVG74P23.js +0 -10
- package/dist/chunks/disable-MJP72BUH.js +0 -7
- package/dist/chunks/discard-GHJO6HJ7.js +0 -14
- package/dist/chunks/edit-ELV6KOAC.js +0 -9
- package/dist/chunks/edit-MCMKL3PG.js +0 -8
- package/dist/chunks/enable-NJV7TP3E.js +0 -7
- package/dist/chunks/future-TTQX6P2J.js +0 -7
- package/dist/chunks/image-2V2VJOSJ.js +0 -7
- package/dist/chunks/inspect-SEHUG246.js +0 -13
- package/dist/chunks/inspect-SLCLHRCE.js +0 -9
- package/dist/chunks/list-TFJSUTGX.js +0 -11
- package/dist/chunks/login-2RXKHHR7.js +0 -7
- package/dist/chunks/login-DTYYE77N.js +0 -9
- package/dist/chunks/logs-RI5TPLZS.js +0 -7
- package/dist/chunks/ls-O6RYA4QE.js +0 -8
- package/dist/chunks/ls-XBWZZIZW.js +0 -11
- package/dist/chunks/mutate-4QF5LX5H.js +0 -9
- package/dist/chunks/notifications-EZWNVZIY.js +0 -7
- package/dist/chunks/open-ZOCLC6EL.js +0 -7
- package/dist/chunks/openapi-WDPDBK6G.js +0 -7
- package/dist/chunks/permissions-WZ74DZVX.js +0 -7
- package/dist/chunks/prompt-missing-credentials-EU3KK3J4.js +0 -7
- package/dist/chunks/publish-M6VGADUV.js +0 -15
- package/dist/chunks/pull-HE4HZUJO.js +0 -7
- package/dist/chunks/push-AXG4E43Q.js +0 -7
- package/dist/chunks/query-LSTTTOQM.js +0 -12
- package/dist/chunks/reauthenticate-S6DCF7RS.js +0 -7
- package/dist/chunks/reorder-4G2JILHR.js +0 -10
- package/dist/chunks/reply-MDSF5FRG.js +0 -9
- package/dist/chunks/resolve-JFM5IA7H.js +0 -12
- package/dist/chunks/restore-DGXZYLLN.js +0 -16
- package/dist/chunks/rm-3CXFYPYT.js +0 -8
- package/dist/chunks/rm-56YVF7VJ.js +0 -8
- package/dist/chunks/rm-72VFNBSP.js +0 -8
- package/dist/chunks/rm-OAN2XZOH.js +0 -8
- package/dist/chunks/rm-WFK724PU.js +0 -8
- package/dist/chunks/rule-inspect-C6FZRTXY.js +0 -8
- package/dist/chunks/rules-5EKUX5OX.js +0 -7
- package/dist/chunks/schema-6LPADSVE.js +0 -14
- package/dist/chunks/select-org-MARKOFHY.js +0 -7
- package/dist/chunks/set-MTKMZ2YS.js +0 -7
- package/dist/chunks/setup-and-link-KMD3ZLHN.js +0 -7
- package/dist/chunks/tags-SXRDMEPO.js +0 -7
|
@@ -1,13 +0,0 @@
|
|
|
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{formatTriggerOperator,getGroupStartedAt,getGroupTitle,getGroupType,humanizeReference,normalizeTimestamp,renderAlertTable}from"./chunk-RRWEIG6B.js";import{resolveAlertsScope}from"./chunk-UPXIQO57.js";import{formatGranularity}from"./chunk-IVSSTHB6.js";import{formatDate}from"./chunk-HRR57QNP.js";import"./chunk-GZNDA6SV.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-PFD7LETF.js";import"./chunk-GHAY4PSD.js";import{truncateEnd,truncateMiddle}from"./chunk-ID663OJ7.js";import{inspectSubcommand}from"./chunk-CNU4T7FO.js";import"./chunk-LU5O3NH7.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var aggregationLabels={sum:"Sum",avg:"Average",min:"Min",max:"Max",p50:"P50",p75:"P75",p90:"P90",p95:"P95",p99:"P99",stddev:"Std Dev",unique:"Unique",persecond:"Per Second",percent:"Percent"},formatCustomAlertRatioBelowFivePercent=new Intl.NumberFormat("en-US",{maximumFractionDigits:2,minimumFractionDigits:2,style:"percent"}),formatCustomAlertRatioThresholdValue=new Intl.NumberFormat("en-US",{maximumFractionDigits:4,minimumFractionDigits:0,style:"percent"});function getGroupStatus(group){if(group.status)return group.status;let alerts=group.alerts??[];return alerts.some(alert=>alert.status==="active")?"active":alerts.length>0?"resolved":"-"}function humanizeLabel(value){return humanizeReference(value,{case:"title"})}function formatAlertFieldValue(value,maxLength=64){if(value==null)return;let displayValue=typeof value=="number"?formatNumber(value):String(value);if(displayValue)return truncateMiddle(displayValue,maxLength)}function formatNumber(value){let absValue=Math.abs(value),sign=value<0?"-":"";for(let[threshold,suffix]of[[1e9,"B"],[1e6,"M"],[1e3,"k"]])if(absValue>=threshold)return`${sign}${(absValue/threshold).toFixed(1).replace(/\.0$/,"")}${suffix}`;return Number.isInteger(value)?String(value):value.toFixed(2).replace(/\.?0+$/,"")}function parseFormattedNumber(value){let trimmed=value.trim();if(!trimmed)return;let number=Number(trimmed.replace(/,/g,""));return Number.isFinite(number)?number:void 0}function formatRatio(value){if(value.trim().endsWith("%"))return value;let number=parseFormattedNumber(value);if(number===void 0)return value;let percent=number*100;return percent>=5?`${Math.floor(percent)}%`:formatCustomAlertRatioBelowFivePercent.format(number)}function formatRatioThreshold(value){if(value.trim().endsWith("%"))return value;let number=parseFormattedNumber(value);return number===void 0?value:formatCustomAlertRatioThresholdValue.format(number)}function getAlertSonarQuery(alert){return alert.sonarQuery??alert.data?.sonarQuery}function getCustomAlertBaselineTitle(alert){let granularity=getAlertSonarQuery(alert)?.granularity;return(granularity&&("hours"in granularity||"days"in granularity)?"7-day baseline":"24-hour baseline").replace(/\b[a-z]/g,character=>character.toUpperCase())}function appendUnit(value,unit){return!unit||unit==="score"?value:unit==="ratio"?formatRatio(value):unit==="%"?value.endsWith("%")?value:`${value}%`:value.toLowerCase().includes(unit.toLowerCase())?value:`${value} ${unit}`}function formatThreshold(alert){let data=alert.data,formatted=alert.formattedValues?.formattedThreshold??(data?.triggerThreshold===void 0?void 0:formatNumber(data.triggerThreshold));if(!formatted)return;let operator=formatTriggerOperator(data?.triggerOperator),threshold=data?.triggerType==="anomaly"?`${formatted} z-score`:alert.unit==="ratio"?formatRatioThreshold(formatted):appendUnit(formatted,alert.unit);return[operator,threshold].filter(Boolean).join(" ")}function getRuleIds(alert){let ids=new Set,dataRuleId=alert.data?.ruleId;dataRuleId&&ids.add(dataRuleId);for(let ruleId of alert.rules??[])ruleId&&ids.add(ruleId);return[...ids]}function getAlertResolvedAt(alert){return normalizeTimestamp(alert.recordedResolvedAt??alert.resolvedAt)}function getSignalRows(alert){let rows=[],formattedValues=alert.formattedValues??{},observed=formattedValues.formattedCount,baseline=formattedValues.formattedAvg,change=[formattedValues.changeDirection,formattedValues.changeAmount].filter(Boolean).join(" "),zscore=alert.data?.zscore,threshold=formatThreshold(alert),minThreshold=alert.data?.minThreshold,isRatioFormulaAlert=!!getCustomAlertFormula(alert);return alert.eventLabel&&rows.push(["Event",alert.eventLabel]),alert.measureLabel&&rows.push(["Measure",alert.measureLabel]),observed&&rows.push(["Observed Value",appendUnit(observed,alert.unit)]),baseline&&rows.push([alert.type==="custom_alert"&&alert.data?.triggerType==="anomaly"?getCustomAlertBaselineTitle(alert):"Baseline",appendUnit(baseline,alert.unit)]),change&&rows.push(["Change",change]),zscore!==void 0&&rows.push(["Observed Deviation",`${formatNumber(zscore)} z-score`]),threshold&&rows.push(["Threshold",threshold]),minThreshold!==void 0&&!isRatioFormulaAlert&&rows.push(["Minimum",alert.unit==="ratio"?formatNumber(minThreshold):appendUnit(formatNumber(minThreshold),alert.unit)]),formattedValues.errorRate&&rows.push(["Error Rate",formattedValues.errorRate]),formattedValues.avgErrorRate&&rows.push(["Baseline Error Rate",formattedValues.avgErrorRate]),rows.push(...getFieldRows(alert)),rows}function getFieldRows(alert){let fields=alert.data?.fields;if(!fields)return[];let groupBy=getAlertSonarQuery(alert)?.groupBy??[];return[...groupBy,...Object.keys(fields).filter(key=>!groupBy.includes(key))].flatMap(key=>{let value=fields[key],displayValue=formatAlertFieldValue(value);return displayValue?[[humanizeLabel(key),displayValue]]:[]})}function formatAggregation(value){return value?aggregationLabels[value]??humanizeLabel(value):void 0}function formatQueryReference(value){return value?humanizeLabel(value):void 0}function formatRollupDetail(rollup,fallbackMeasure){if(!rollup)return;let aggregation=formatAggregation(rollup.aggregation),measure=fallbackMeasure??formatQueryReference(rollup.measure);return[aggregation,measure].filter(Boolean).join(" ")||void 0}function getPrimaryRollup(rollups){return Object.values(rollups??{})[0]}function getCustomAlertFormula(alert){let formula=alert.data?.formula;if(formula?.operator==="divide"&&formula.left&&formula.right)return{operator:formula.operator,left:formula.left,right:formula.right}}function getQueryRows(alert){if(alert.type!=="custom_alert")return[];let query=getAlertSonarQuery(alert);if(!query)return[];let formula=getCustomAlertFormula(alert),rows=[],addRow=(label,value)=>{value&&rows.push([label,truncateMiddle(value,120)])};if(addRow("Event",alert.eventLabel??formatQueryReference(query.event)),formula)addRow("Numerator",formatRollupDetail(query.rollups?.[formula.left])),addRow("Denominator",formatRollupDetail(query.rollups?.[formula.right]));else{let primaryRollup=getPrimaryRollup(query.rollups);addRow("Measure",alert.measureLabel??formatQueryReference(primaryRollup?.measure)),addRow("Aggregation",formatAggregation(primaryRollup?.aggregation))}addRow("Granularity",formatGranularity(query.granularity));let groupBy=query.groupBy?.filter(Boolean)??[];if(groupBy.length>0&&addRow("Group by",groupBy.map(humanizeLabel).join(", ")),formula&&typeof alert.data?.minThreshold=="number"&&addRow("Minimum Numerator",formatNumber(alert.data.minThreshold)),addRow("Filter by",query.filter?.trim()),formula)for(let[label,rollupName]of[["Numerator filter",formula.left],["Denominator filter",formula.right]])addRow(label,query.rollups?.[rollupName]?.filter?.trim());return rows}function getDetailRows(alert){let data=alert.data;if(!data)return[];let rows=[],addRow=(label,value)=>{let displayValue=formatAlertFieldValue(value);displayValue&&rows.push([label,displayValue])};return addRow("Route",data.route),addRow("Status Group",data.statusGroup),addRow("Deployment ID",data.deploymentId),rows}function renderAlertSections(alert){let lines=[],signalRows=getSignalRows(alert);signalRows.length>0&&(lines.push(import_chalk.default.cyan("Signals")),lines.push(renderAlertTable(signalRows,3)));let queryRows=getQueryRows(alert);return queryRows.length>0&&(lines.push(import_chalk.default.cyan("Query")),lines.push(renderAlertTable(queryRows,3))),lines.join(`
|
|
8
|
-
`)}function renderAlert(alert,index,totalAlerts){let title=alert.title||`Alert ${index+1}`,ruleIds=getRuleIds(alert),resolvedAt=getAlertResolvedAt(alert),sections=renderAlertSections(alert),summaryRows=[["Alert id",alert.id||"-"],["Type",alert.type||"-"],["Status",alert.status||"-"],["Started At",formatDate(normalizeTimestamp(alert.recordedStartedAt??alert.startedAt))],...resolvedAt!==void 0?[["Resolved At",formatDate(resolvedAt)]]:[],...ruleIds.length>0?[["Rule id",ruleIds.map(id=>truncateMiddle(id,48)).join(", ")]]:[],...getDetailRows(alert)];return[import_chalk.default.bold(totalAlerts>1?`Alert ${index+1}: ${title}`:title),renderAlertTable(summaryRows,3),...sections?[sections]:[]].join(`
|
|
9
|
-
`)}function printAlertGroup(group,groupId){let alerts=group.alerts??[],singleAlert=alerts.length===1?alerts[0]:void 0,singleAlertRuleIds=singleAlert?getRuleIds(singleAlert):[],singleAlertResolvedAt=singleAlert?getAlertResolvedAt(singleAlert):void 0,summaryRows=[["Title",truncateEnd(getGroupTitle(group),80)],["Group id",group.id||groupId],["Type",getGroupType(group)],["Status",getGroupStatus(group)],["Started At",formatDate(getGroupStartedAt(group))],...singleAlertResolvedAt!==void 0?[["Resolved At",formatDate(singleAlertResolvedAt)]]:[],["Alerts",String(alerts.length)],...singleAlert?.id?[["Alert id",singleAlert.id]]:[],...singleAlertRuleIds.length>0?[["Rule id",singleAlertRuleIds.map(id=>truncateMiddle(id,48)).join(", ")]]:[],...singleAlert?getDetailRows(singleAlert):[]],renderedAlerts=alerts.length>0?alerts.length===1?renderAlertSections(alerts[0]):alerts.map((alert,index)=>renderAlert(alert,index,alerts.length)).join(`
|
|
10
|
-
|
|
11
|
-
`):"No alerts in this group.";output_manager_default.print(["",`${import_chalk.default.bold("Alert group")} ${import_chalk.default.cyan(group.id||groupId)}`,renderAlertTable(summaryRows,3),"",renderedAlerts,""].join(`
|
|
12
|
-
`))}async function inspect(client,argv){let parsedArgs,spec=getFlagsSpecification(inspectSubcommand.options);try{parsedArgs=parseArguments(argv,spec)}catch(e){let msg=e instanceof Error?e.message:String(e),projectFlagMissingArg=msg.includes("--project")&&msg.includes("requires argument");return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":msg,next:projectFlagMissingArg?[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect <groupId> --project <name-or-id>"),when:"Re-run with placeholders replaced"}]:[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect --help"),when:"See valid `alerts inspect` usage"}]},2),printError(e),2}let groupId=parsedArgs.args[0],fr=validateJsonOutput(parsedArgs.flags);if(!fr.valid)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:fr.error},2),output_manager_default.error(fr.error),2;if(!groupId)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing group id. Example: ${packageName} alerts inspect <groupId>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect <groupId>"),when:"Replace <groupId> with a group id from `vercel alerts`"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel alerts inspect <groupId>`");let scope=await resolveAlertsScope(client,{project:parsedArgs.flags["--project"],all:parsedArgs.flags["--all"],jsonOutput:fr.jsonOutput,command:`alerts inspect ${groupId}`});if(typeof scope=="number")return scope;let query=new URLSearchParams({teamId:scope.teamId});scope.projectId&&query.set("projectId",scope.projectId);let path=`/alerts/v3/groups/${encodeURIComponent(groupId)}?${query.toString()}`;output_manager_default.spinner("Fetching alert group...");try{let group=await client.fetch(path);return fr.jsonOutput?client.stdout.write(`${JSON.stringify({group},null,2)}
|
|
13
|
-
`):printAlertGroup(group,groupId),0}catch(err){if(isAPIError(err)){let msg=err.serverMessage||`API error (${err.status}).`,reason=err.status===401?"not_authorized":err.status===403?"forbidden":err.status===404?AGENT_REASON.NOT_FOUND:err.status===429?"rate_limited":AGENT_REASON.API_ERROR;return outputAgentError(client,{status:"error",reason,message:msg,...err.status===401||err.status===403?{hint:"Confirm team scope; use --scope <team-slug> if the group belongs to another team.",next:[{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"},{command:buildCommandWithGlobalFlags(client.argv,`alerts inspect ${groupId}`),when:"Retry after fixing scope or permissions"}]}:{}},1),outputError(client,fr.jsonOutput,err.code||"API_ERROR",msg)}throw err}finally{output_manager_default.stopSpinner()}}export{inspect as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
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{actorLabel,displayPath,renderThreadDetail,threadAge,truncate}from"./chunk-TBLIJ2PS.js";import{parseThreadArg}from"./chunk-2S6PE6GB.js";import{getThread,handleCommentsParseError,inferBranch,listMessages,listThreads,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts}from"./chunk-VUILLFZ6.js";import{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-F4KY2TOK.js";import"./chunk-ID663OJ7.js";import"./chunk-WJEAGH4K.js";import"./chunk-WKTIAVGU.js";import{inspectSubcommand}from"./chunk-MYCQIZU6.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";async function pickThread(client,jsonOutput){if(!canPrompt(client)||jsonOutput)return outputError(client,jsonOutput,"MISSING_THREAD","Pass a thread ID or URL: `vercel comments inspect <thread>`.");let scope=await resolveCommentsScope(client,{requireProject:!0,jsonOutput});if(typeof scope=="number")return scope;let focus=scope.linked?inferBranch(client.cwd):void 0;output_manager_default.spinner("Fetching comments\u2026");let response;try{response=await listThreads(client,scope.teamId,{projectId:scope.projectId,status:"unresolved",branch:focus?[focus.value]:void 0,limit:20})}finally{output_manager_default.stopSpinner()}return response.threads.length===0?outputError(client,jsonOutput,"NO_COMMENTS",`No unresolved comments${focus?` on ${focus.value}`:""} to pick from.`):client.input.select({message:"Select a comment",choices:response.threads.map(thread=>({name:`${threadAge(thread)} ${actorLabel(thread.messages[0]?.author)} ${displayPath(thread)} \u201C${truncate(thread.messages[0]?.text??"",48)}\u201D`,value:thread.id}))})}async function fetchAllMessages(client,teamId,thread){if(thread.messageCount<=thread.messages.length)return thread.messages;let all=[],cursor;do{let page=await listMessages(client,teamId,thread.id,{limit:100,cursor});all.push(...page.messages),cursor=page.pagination?.nextCursor}while(cursor&&all.length<thread.messageCount);return all}async function inspect(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(inspectSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"inspect")}let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput,showContext=!!parsedArgs.flags["--context"];telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliFlagContext(parsedArgs.flags["--context"]),telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);let threadInput=parsedArgs.args[2];telemetry.trackCliArgumentThread(threadInput);let threadId,urlTeamSlug;if(threadInput){let parsed=parseThreadArg(threadInput);if(!parsed)return outputError(client,jsonOutput,"INVALID_THREAD",`Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`);threadId=parsed.id,urlTeamSlug=parsed.teamSlug}else{let picked=await pickThread(client,jsonOutput);if(typeof picked=="number")return picked;threadId=picked}let scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput,urlTeamSlug});if(typeof scope=="number")return scope;jsonOutput||output_manager_default.spinner("Fetching comment\u2026");let thread,messages;try{thread=await getThread(client,scope.teamId,threadId),messages=await fetchAllMessages(client,scope.teamId,thread)}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err);return outputError(client,jsonOutput,code,err.status===404?threadNotFoundMessage(threadId,scope):message)}throw err}finally{output_manager_default.stopSpinner()}return jsonOutput?(client.stdout.write(`${JSON.stringify({...thread,messages},null,2)}
|
|
8
|
-
`),0):(output_manager_default.print(`${renderThreadDetail(thread,messages,{showContext})}
|
|
9
|
-
`),0)}export{inspect as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
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{renderThreadRow}from"./chunk-TBLIJ2PS.js";import{handleCommentsParseError,inferBranch,listThreads,resolveCommentsScope}from"./chunk-VUILLFZ6.js";import{handleValidationError,outputError,validateIntegerRangeWithDefault}from"./chunk-WH3SHWVK.js";import"./chunk-F4KY2TOK.js";import"./chunk-ID663OJ7.js";import"./chunk-WJEAGH4K.js";import"./chunk-WKTIAVGU.js";import{listSubcommand}from"./chunk-MYCQIZU6.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{getScope}from"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification,stripSensitiveAuthArgs}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{getCommandName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateStatus(value){let status=value??"unresolved";if(["unresolved","resolved","all"].includes(status))return status}async function resolveAuthors(client,authors,jsonOutput){if(!authors||authors.length===0)return;if(!authors.includes("me"))return authors;let{user}=await getScope(client);return user?authors.map(author=>author==="me"?user.id:author):outputError(client,jsonOutput,"USER_REQUIRED","Can't resolve `--author me` when authenticated as an app. Use an author ID with `--author`, or authenticate with a user token.")}function statusWord(status){return status==="all"?"":` ${status}`}function printActiveFilters(flags){let parts=[];flags["--author"]?.length&&parts.push(`--author ${flags["--author"].join(", ")} (takes a user ID or \`me\` \u2014 usernames match nothing)`);let pagePaths=flags["--page-path"]??flags["--page"];pagePaths?.length&&parts.push(`--page-path ${pagePaths.join(", ")}`),flags["--search"]&&parts.push(`--search ${flags["--search"]}`),flags["--content-id"]?.length&&parts.push(`--content-id ${flags["--content-id"].join(", ")}`),parts.length>0&&output_manager_default.log(`Filters: ${parts.join(" \xB7 ")}`)}function countLine(count,status){return`${count}${statusWord(status)} comment${count===1?"":"s"}`}var SCOPE_FLAG_NAMES=new Set(["--scope","-S","--project","-p","--team","-T"]);function argvFlagTokens(client){return stripSensitiveAuthArgs(client.argv.slice(3))}function scopeFlagsSuffix(client){let tokens=argvFlagTokens(client),out=[];for(let i=0;i<tokens.length;i++){let token=tokens[i],name=token.split("=")[0];SCOPE_FLAG_NAMES.has(name)&&(out.push(token),!token.includes("=")&&i+1<tokens.length&&out.push(tokens[++i]))}return out.length>0?` ${out.join(" ")}`:""}function nextPageFlagsSuffix(client){let tokens=argvFlagTokens(client),out=[];for(let i=0;i<tokens.length;i++){let token=tokens[i];if(!token.startsWith("-"))continue;let name=token.split("=")[0];if(name==="--next"||name==="-N"){!token.includes("=")&&i+1<tokens.length&&i++;continue}out.push(name==="--page"?token.replace(/^--page(?==|$)/,"--page-path"):token),!token.includes("=")&&i+1<tokens.length&&!tokens[i+1].startsWith("-")&&out.push(tokens[++i])}return out.length>0?` ${out.join(" ")}`:""}function shellSafe(value){return/^[A-Za-z0-9._/-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}async function printEmptyState(client,scope,focus,params,status,flags){let probe;try{probe=await listThreads(client,scope.teamId,{...params,branch:void 0,cursor:void 0,limit:20})}catch{output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);return}let branches=new Map;for(let thread of probe.threads){let branch=thread.branch??"(no branch)";branches.set(branch,(branches.get(branch)??0)+1)}if(branches.size===0){output_manager_default.log(`No${statusWord(status)} comments in ${scope.projectName??"this project"} on any branch.`),printActiveFilters(flags);return}output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);let suffix=probe.pagination.nextCursor?"+":"",scopeSuffix=scopeFlagsSuffix(client);if(branches.size===1){let[branch,count]=[...branches.entries()][0];output_manager_default.log(`${count}${suffix}${statusWord(status)} on ${import_chalk.default.bold(branch)} \u2014 run ${getCommandName(`comments --branch ${shellSafe(branch)}${scopeSuffix}`)}`);return}let total=[...branches.values()].reduce((a,b)=>a+b,0);output_manager_default.log(`${total}${suffix}${statusWord(status)} on other branches \u2014 run ${getCommandName(`comments --all-branches${scopeSuffix}`)}`)}async function list(client,telemetry,defaultInvocation){let parsedArgs,flagsSpecification=getFlagsSpecification(listSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"list")}let flags=parsedArgs.flags,pagePaths=flags["--page-path"]??flags["--page"],expectedPositionals=defaultInvocation?1:2;if(parsedArgs.args.length>expectedPositionals)return output_manager_default.error(`Unknown ${defaultInvocation?"subcommand":"argument"} "${parsedArgs.args[expectedPositionals]}". Run \`vercel comments --help\` for usage.`),1;let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput;telemetry.trackCliOptionProject(flags["--project"]),telemetry.trackCliOptionBranch(flags["--branch"]),telemetry.trackCliFlagAllBranches(flags["--all-branches"]),telemetry.trackCliOptionStatus(flags["--status"]),telemetry.trackCliOptionPagePath(flags["--page-path"]),telemetry.trackCliOptionPage(flags["--page"]),telemetry.trackCliOptionAuthor(flags["--author"]),telemetry.trackCliOptionContentId(flags["--content-id"]),telemetry.trackCliOptionSearch(flags["--search"]),telemetry.trackCliOptionLimit(flags["--limit"]),telemetry.trackCliOptionNext(flags["--next"]),telemetry.trackCliOptionFormat(flags["--format"]);let status=validateStatus(flags["--status"]);if(!status)return outputError(client,jsonOutput,"INVALID_STATUS",`Invalid --status "${flags["--status"]}". Valid values: unresolved, resolved, all.`);let limitResult=validateIntegerRangeWithDefault(flags["--limit"],{flag:"--limit",min:1,max:100,defaultValue:20});if(!limitResult.valid)return handleValidationError(limitResult,jsonOutput,client);if(flags["--branch"]&&flags["--all-branches"])return outputError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --branch and --all-branches.");let scope=await resolveCommentsScope(client,{project:flags["--project"],requireProject:!0,jsonOutput});if(typeof scope=="number")return scope;let focus,branchFilter;if(flags["--branch"]&&flags["--branch"].length>0)branchFilter=flags["--branch"],focus={value:branchFilter.join(", "),source:"flag"};else if(!flags["--all-branches"]&&scope.linked){let inferred=inferBranch(client.cwd);inferred&&(focus=inferred,branchFilter=[inferred.value])}let authors=await resolveAuthors(client,flags["--author"],jsonOutput);if(typeof authors=="number")return authors;let params={projectId:scope.projectId,branch:branchFilter,status:status==="all"?void 0:status,page:pagePaths,author:authors,contentId:flags["--content-id"],search:flags["--search"],limit:limitResult.value,cursor:flags["--next"]};jsonOutput||output_manager_default.spinner("Fetching comments\u2026");let response;try{response=await listThreads(client,scope.teamId,params)}catch(err){if(isAPIError(err))return outputError(client,jsonOutput,err.code||"API_ERROR",err.serverMessage||`API error (${err.status}).`);throw err}finally{output_manager_default.stopSpinner()}let threads=response.threads??[],nextCursor=response.pagination?.nextCursor??null;if(jsonOutput){let envelope={scope:{teamId:scope.teamId,...scope.teamSlug&&{teamSlug:scope.teamSlug},...scope.projectId&&{projectId:scope.projectId},...scope.projectName&&{projectName:scope.projectName},...focus&&focus.source!=="flag"&&{inferredBranch:focus.value}},filters:{...status!=="all"&&{status},...focus&&{branch:{value:focus.value,source:focus.source}}},pagination:{nextCursor},threads};return client.stdout.write(`${JSON.stringify(envelope,null,2)}
|
|
8
|
-
`),0}let branchLabel=focus?focus.value:"all branches";if(output_manager_default.log(`Comments in ${import_chalk.default.bold(scope.projectName??scope.projectId??"")} \xB7 ${branchLabel}`),threads.length===0)return focus?await printEmptyState(client,scope,focus,params,status,flags):(output_manager_default.log(`No${statusWord(status)} comments in ${scope.projectName??"this project"}.`),printActiveFilters(flags)),0;output_manager_default.print(`
|
|
9
|
-
`);for(let thread of threads)output_manager_default.print(`${renderThreadRow(thread,{showBranch:!focus})}
|
|
10
|
-
|
|
11
|
-
`);return output_manager_default.log(countLine(threads.length,status)),output_manager_default.log(`To read a thread, run ${getCommandName(`comments inspect <id>${scopeFlagsSuffix(client)}`)}`),nextCursor&&output_manager_default.log(`To display the next page, run ${getCommandName(`comments${nextPageFlagsSuffix(client)} --next ${nextCursor}`)}`),0}export{list as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{login}from"./chunk-DO4GPDKO.js";import"./chunk-YCV465P5.js";import"./chunk-PVASGBEF.js";import"./chunk-B4YYOSPY.js";import"./chunk-MSH7V3FL.js";import"./chunk-5O2CW3SX.js";import"./chunk-773GOZIR.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import"./chunk-TNZMCRAP.js";import"./chunk-VKXEOL4K.js";import"./chunk-YYPNUQDI.js";import"./chunk-4SAVH3H7.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{login as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
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{AUTH_FAILURE,CREDENTIAL_STORE_CONFLICT,VCR_ENGINES,VCR_LOGIN_USERNAME,emitVcrArgParseError,engineLogin,engineLogout,handleVcrApiError,isEngineInstalled,resolveRegistry,resolveVcrScope,stderrTail,validateVcrChoice,validateVcrJsonOutput}from"./chunk-QCG6Q33G.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-GSOPJJO5.js";import{loginSubcommand}from"./chunk-RZGWCQP7.js";import"./chunk-AG5QQNJ3.js";import"./chunk-AU42HSQ3.js";import"./chunk-L5FUUGYX.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var LOGIN_VALID_HOURS=12;async function login(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(loginSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr login <engine> --project <name-or-id>"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let engineArg=parsedArgs.args[0],project=parsedArgs.flags["--project"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),!engineArg){let message=`Missing engine. Choose one of: ${VCR_ENGINES.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr login docker"),when:"Replace docker with the container tool you use"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",message)}let choiceError=validateVcrChoice(client,"engine",engineArg,VCR_ENGINES,fr.jsonOutput);if(typeof choiceError=="number")return choiceError;let engine=engineArg;if(!isEngineInstalled(engine)){let message=`\`${engine}\` is not installed or not on your PATH. Install it and try again.`;return outputAgentError(client,{status:"error",reason:"engine_not_found",message},1),outputError(client,fr.jsonOutput,"ENGINE_NOT_FOUND",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let registry=resolveRegistry();output_manager_default.spinner(`Authenticating ${engine} with ${registry}...`);try{let{token}=await client.fetch(`/projects/${scope.projectId}/token`,{method:"POST",accountId:scope.teamId,body:JSON.stringify({source:"vercel-cli"}),headers:{"Content-Type":"application/json"}}),result=await engineLogin(engine,registry,token);if(result.exitCode!==0&&CREDENTIAL_STORE_CONFLICT.test(result.stderr)&&(output_manager_default.debug(`Stale ${registry} credential in the ${engine} credential store; running \`${engine} logout\` and retrying`),await engineLogout(engine,registry),result=await engineLogin(engine,registry,token)),result.exitCode!==0){let message=AUTH_FAILURE.test(result.stderr)?`Authentication to ${registry} as "${VCR_LOGIN_USERNAME}" was rejected. The OIDC token may be expired or lack access to this project.`:`\`${engine} login\` failed (exit code ${result.exitCode}).${stderrTail(result.stderr)?`
|
|
8
|
-
${stderrTail(result.stderr)}`:""}`;return outputAgentError(client,{status:"error",reason:AUTH_FAILURE.test(result.stderr)?"not_authorized":"command_failed",message,next:[{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"}]},1),outputError(client,fr.jsonOutput,AUTH_FAILURE.test(result.stderr)?"NOT_AUTHORIZED":"COMMAND_FAILED",message)}return fr.jsonOutput?client.stdout.write(`${JSON.stringify({status:"success",engine,registry,username:VCR_LOGIN_USERNAME,validForHours:LOGIN_VALID_HOURS},null,2)}
|
|
9
|
-
`):(output_manager_default.success(`Logged in to ${registry} as ${VCR_LOGIN_USERNAME} (${engine}).`),output_manager_default.log(`Credentials are valid for ~${LOGIN_VALID_HOURS} hours. Re-run \`${buildCommandWithGlobalFlags(client.argv,`vcr login ${engine}`)}\` to refresh.`)),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput);throw err}finally{output_manager_default.stopSpinner()}}export{login as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{collectBuildLogs,displayBuildLogs,displayBuildLogsUntilFinalError,displayRuntimeLogs,parseLogLines}from"./chunk-OBRNACWW.js";import"./chunk-PFD7LETF.js";import"./chunk-HVNIW32A.js";import"./chunk-O4FDRZ22.js";import"./chunk-AMDHTZDV.js";import"./chunk-J2LAZELI.js";import"./chunk-E6UKNYFF.js";import"./chunk-BS32OUOC.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{collectBuildLogs,displayBuildLogs,displayBuildLogsUntilFinalError,displayRuntimeLogs,parseLogLines};
|
|
@@ -1,8 +0,0 @@
|
|
|
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{printRules}from"./chunk-TAAV7L3T.js";import"./chunk-RRWEIG6B.js";import{emitRulesArgParseError,handleRulesApiError,outputRulesError,parseRulesFlagsAndScope,rulesCollectionPath}from"./chunk-MS576PZ7.js";import"./chunk-UPXIQO57.js";import"./chunk-HRR57QNP.js";import"./chunk-GZNDA6SV.js";import{normalizeRepeatableStringFilters}from"./chunk-WH3SHWVK.js";import"./chunk-PFD7LETF.js";import"./chunk-GHAY4PSD.js";import"./chunk-MHQ2MW2B.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import"./chunk-ID663OJ7.js";import{rulesLsSubcommand}from"./chunk-LU5O3NH7.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var BUILT_IN_ALERT_TYPES=["usage_anomaly","error_anomaly","botId_anomaly","firewallSystemRule_anomaly","firewallCustomRule_anomaly","testAlert_anomaly","buildTime_anomaly"];var BUILT_IN_ALERT_TYPE_SET=new Set(BUILT_IN_ALERT_TYPES);function parseRuleTypeFilter(client,values,jsonOutput){let types=normalizeRepeatableStringFilters(values);if(types.length===0)return;let invalidType=types.find(type=>type!=="built-in"&&type!=="custom"&&type!=="custom_alert"&&!BUILT_IN_ALERT_TYPE_SET.has(type));if(invalidType)return outputRulesError(client,jsonOutput,"INVALID_RULE_TYPE",`Invalid rule type "${invalidType}". Expected a supported rule type or built-in trigger type.`);let includeCustom=types.includes("custom")||types.includes("custom_alert"),includeAllBuiltIn=types.includes("built-in"),builtInAlertTypes=new Set(types.filter(type=>BUILT_IN_ALERT_TYPE_SET.has(type))),includeBuiltIn=includeAllBuiltIn||builtInAlertTypes.size>0;return{apiType:includeCustom===includeBuiltIn?void 0:includeCustom?"custom":"built-in",matches(rule){return rule.type==="custom"?includeCustom:includeAllBuiltIn?!0:includeBuiltIn?rule.triggers.mode==="all"?!0:rule.triggers.items.some(trigger=>builtInAlertTypes.has(trigger.type)):!1}}}async function ls(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesLsSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules ls --project <name-or-id>"),printError(error),2}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);let typeFilter=parseRuleTypeFilter(client,flags["--type"],format.jsonOutput);if(typeof typeFilter=="number")return typeFilter;let scope=await parseRulesFlagsAndScope(client,{"--project":flags["--project"],"--all":flags["--all"]},format.jsonOutput,"alerts rules ls");if(typeof scope=="number")return scope;output_manager_default.spinner("Fetching alert rules\u2026");try{let rules=[],cursor;do{let page=await client.fetch(rulesCollectionPath(scope.teamId,{limit:100,cursor,projectId:scope.projectId,type:typeFilter?.apiType}));rules.push(...page.rules),cursor=page.pagination.next??void 0}while(cursor);let filteredRules=typeFilter?rules.filter(typeFilter.matches):rules;return format.jsonOutput?client.stdout.write(`${JSON.stringify({rules:filteredRules},null,2)}
|
|
8
|
-
`):filteredRules.length===0?output_manager_default.log("No alert rules found for this scope"):printRules(filteredRules),0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{output_manager_default.stopSpinner()}}export{ls as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
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{printRuleNotifications,printRulesNotifications}from"./chunk-ME75ZZW7.js";import{emitRulesArgParseError,handleRulesApiError,outputRulesError,resolveRulesTeam,ruleNotificationsPath,rulesNotificationsPath}from"./chunk-MS576PZ7.js";import"./chunk-UPXIQO57.js";import"./chunk-WH3SHWVK.js";import"./chunk-MHQ2MW2B.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import{rulesNotificationsLsSubcommand}from"./chunk-LU5O3NH7.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_STATUS,buildCommandWithGlobalFlags}from"./chunk-5DXCVG5U.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import{quoteArg}from"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var PAGE_LIMIT=100;async function fetchRulesNotifications(client,teamId){let notifications={},cursor;do{let page=await client.fetch(rulesNotificationsPath(teamId,{limit:PAGE_LIMIT,cursor}));Object.assign(notifications,page.notifications),cursor=page.pagination.next??void 0}while(cursor);return{notifications}}async function ls(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesNotificationsLsSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules notifications [rule-id]"),printError(error),2}let format=validateJsonOutput(parsedArgs.flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);let[ruleId,extraArg]=parsedArgs.args;if(extraArg)return outputRulesError(client,format.jsonOutput,"INVALID_ARGUMENTS","Expected exactly one rule ID.");let scope=await resolveRulesTeam(client,format.jsonOutput);if(typeof scope=="number")return scope;client.nonInteractive||output_manager_default.spinner(ruleId?"Fetching notification destinations\u2026":"Fetching alert rule notification destinations\u2026");try{if(!ruleId){let result=await fetchRulesNotifications(client,scope.teamId);if(client.nonInteractive){let ruleCount=Object.keys(result.notifications).length,notificationCount=Object.values(result.notifications).reduce((count,notifications)=>count+notifications.length,0);client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,...result,message:`Listed ${notificationCount} notification destination${notificationCount===1?"":"s"} across ${ruleCount} readable alert rule${ruleCount===1?"":"s"}.`,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts rules notifications link <rule-id> --slack-channel <channel-id> --slack-installation-id <installation-id>"),when:"Link a Slack channel to a rule"},{command:buildCommandWithGlobalFlags(client.argv,"alerts rules notifications link <rule-id> --webhook <webhook-id>"),when:"Link an account webhook to a rule"}]},null,2)}
|
|
8
|
-
`)}else format.jsonOutput?client.stdout.write(`${JSON.stringify(result,null,2)}
|
|
9
|
-
`):printRulesNotifications(result);return 0}let response=await client.fetch(ruleNotificationsPath(scope.teamId,ruleId));if(client.nonInteractive){let count=response.notifications.length;client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,ruleId,notifications:response.notifications,message:`${count} notification destination${count===1?"":"s"} linked to alert rule ${ruleId}.`,next:[{command:buildCommandWithGlobalFlags(client.argv,`alerts rules notifications link ${quoteArg(ruleId)} --webhook <webhook-id>`),when:"Link an account webhook"},{command:buildCommandWithGlobalFlags(client.argv,`alerts rules notifications link ${quoteArg(ruleId)} --slack-channel <channel-id>`),when:"Link a Slack channel"}]},null,2)}
|
|
10
|
-
`)}else format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
|
|
11
|
-
`):printRuleNotifications(ruleId,response.notifications);return 0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{client.nonInteractive||output_manager_default.stopSpinner()}}export{ls as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
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{buildRuleNotificationsInspectCommand,printRuleNotificationMutationReceipt}from"./chunk-ME75ZZW7.js";import{emitRulesArgParseError,handleRulesApiError,outputRulesError,resolveRulesTeam,rulesNotificationLinksPath}from"./chunk-MS576PZ7.js";import"./chunk-UPXIQO57.js";import"./chunk-WH3SHWVK.js";import"./chunk-MHQ2MW2B.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import{rulesNotificationsLinkSubcommand,rulesNotificationsUnlinkSubcommand,rulesNotificationsUpdateSubcommand}from"./chunk-LU5O3NH7.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_STATUS}from"./chunk-5DXCVG5U.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var API_SLACK_INSTALLATION_REQUIRED_MESSAGE="configId is required unless the team has exactly one Slack configuration.",CLI_SLACK_INSTALLATION_REQUIRED_MESSAGE="A Slack installation ID is required unless the team has exactly one completed Slack installation. Pass --slack-installation-id <installation-id>.";function getTarget(client,flags,jsonOutput){let webhookId=flags["--webhook"],channelId=flags["--slack-channel"],configId=flags["--slack-installation-id"];return webhookId&&(channelId||configId)?outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","Specify either --webhook or --slack-channel, not both."):configId&&!channelId?outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","--slack-installation-id requires --slack-channel."):webhookId?{type:"webhook",webhookId}:channelId?configId?{type:"slack",channelId,configId}:{type:"slack",channelId}:outputRulesError(client,jsonOutput,"MISSING_ARGUMENTS","Specify a notification destination with --webhook or --slack-channel.")}function applyDeliverySetting(client,target,flags,action,jsonOutput){let criticalOnly=flags["--critical-only"],noCriticalOnly=flags["--no-critical-only"];return criticalOnly&&noCriticalOnly?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Specify either --critical-only or --no-critical-only, not both."):action==="update"&&!criticalOnly&&!noCriticalOnly?outputRulesError(client,jsonOutput,"MISSING_ARGUMENTS","Specify --critical-only or --no-critical-only."):criticalOnly?{...target,minimumSeverityLevel:"critical"}:action==="update"&&noCriticalOnly?{...target,minimumSeverityLevel:null}:target}async function mutate(client,argv,action){let command={link:rulesNotificationsLinkSubcommand,update:rulesNotificationsUpdateSubcommand,unlink:rulesNotificationsUnlinkSubcommand}[action],parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(command.options))}catch(error){return emitRulesArgParseError(client,error,`alerts rules notifications ${action} <rule-id> --webhook <webhook-id>`),printError(error),2}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);let[ruleId,extraArg]=parsedArgs.args;if(!ruleId)return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS",`Missing rule ID. Example: ${packageName} alerts rules notifications ${action} <rule-id> --webhook <webhook-id>`);if(extraArg)return outputRulesError(client,format.jsonOutput,"INVALID_ARGUMENTS","Expected exactly one rule ID.");let target=getTarget(client,flags,format.jsonOutput);if(typeof target=="number")return target;let notification=applyDeliverySetting(client,target,flags,action,format.jsonOutput);if(typeof notification=="number")return notification;let scope=await resolveRulesTeam(client,format.jsonOutput);if(typeof scope=="number")return scope;client.nonInteractive||output_manager_default.spinner(`${action==="link"?"Linking":action==="update"?"Updating":"Unlinking"} notification destination\u2026`);try{let response=await client.fetch(rulesNotificationLinksPath(scope.teamId,ruleId),{method:action==="link"?"POST":action==="update"?"PATCH":"DELETE",body:notification});if(client.nonInteractive){let actionPastTense=action==="link"?"Linked":action==="update"?"Updated":"Unlinked",preposition=action==="link"?"to":action==="update"?"for":"from";client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,success:response.success,action,ruleId,notification:response.notification,message:`${actionPastTense} notification destination ${preposition} alert rule ${ruleId}.`,next:[{command:buildRuleNotificationsInspectCommand(client.argv,ruleId),when:"Inspect linked notification destinations"}]},null,2)}
|
|
8
|
-
`)}else format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
|
|
9
|
-
`):printRuleNotificationMutationReceipt(action==="link"?"Linked":action==="update"?"Updated":"Unlinked",ruleId,notification,client.argv);return 0}catch(error){if(isAPIError(error))return error.serverMessage===API_SLACK_INSTALLATION_REQUIRED_MESSAGE?outputRulesError(client,format.jsonOutput,error.code||"bad_request",CLI_SLACK_INSTALLATION_REQUIRED_MESSAGE):handleRulesApiError(client,error,format.jsonOutput);throw error}finally{client.nonInteractive||output_manager_default.stopSpinner()}}export{mutate as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{getSubcommand}from"./chunk-ETV3C2CV.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var NOTIFICATIONS_CONFIG={ls:["ls","list"],link:["link"],update:["update","patch"],unlink:["unlink"]};async function notifications(client,argv){if(argv.length===0||argv[0]?.startsWith("-")||argv[0]?.startsWith("ar_"))return(await import("./ls-XBWZZIZW.js")).default(client,argv);let{subcommand,args}=getSubcommand(argv,NOTIFICATIONS_CONFIG);if(subcommand==null)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:`Unknown "alerts rules notifications" subcommand "${argv[0]}".`,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts rules notifications --help"),when:"Show valid notification subcommands"}]},2),output_manager_default.error(`Unknown "alerts rules notifications" subcommand "${argv[0]}". Run \`vercel alerts rules notifications --help\`.`),2;switch(subcommand){case"ls":return(await import("./ls-XBWZZIZW.js")).default(client,args);case"link":case"update":case"unlink":return(await import("./mutate-4QF5LX5H.js")).default(client,args,subcommand);default:return output_manager_default.error(`Unhandled notifications subcommand: ${String(subcommand)}`),1}}export{notifications as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{parseThreadArg}from"./chunk-2S6PE6GB.js";import{getThread,handleCommentsParseError,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts}from"./chunk-VUILLFZ6.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-WJEAGH4K.js";import"./chunk-WKTIAVGU.js";import{require_open}from"./chunk-PVASGBEF.js";import{openSubcommand}from"./chunk-MYCQIZU6.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_open=__toESM(require_open(),1);async function openThread(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(openSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"open")}let threadInput=parsedArgs.args[2];if(telemetry.trackCliArgumentThread(threadInput),!threadInput)return output_manager_default.error("Pass a thread ID or URL: `vercel comments open <thread>`."),2;let threadRef=parseThreadArg(threadInput);if(!threadRef)return output_manager_default.error(`Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`),2;let threadId=threadRef.id;telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);let scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput:!1,urlTeamSlug:threadRef.teamSlug});if(typeof scope=="number")return scope;let webUrl;try{webUrl=(await getThread(client,scope.teamId,threadId)).webUrl}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err);return outputError(client,!1,code,err.status===404?threadNotFoundMessage(threadId,scope):message)}throw err}return webUrl?(output_manager_default.log(`Opening ${webUrl}`),await(0,import_open.default)(webUrl),0):(output_manager_default.error(`The API returned no web URL for ${threadId}.`),1)}export{openThread as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{createOpenApiCache,fetchSpecUrl,foldNamingStyle,formatAsCard,formatAsDataTable,inferCliSubcommandAliases,operationIdToKebabCase,resolveEndpointByTagAndOperationId,tryOpenApiFallback}from"./chunk-7I57HOA6.js";import{humanReadableColumnLabel,humanizeIdentifier}from"./chunk-GHAY4PSD.js";import{CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,OPENAPI_URL,OpenApiCache,SSO_API_URL,VERCEL_CLI_ROOT_DISPLAY_KEY,assertAllowedSpecUrl,matchesCliApiTag,readSpecResponse,resolveOpenApiTagForProjectsCli}from"./chunk-B3K6GM2W.js";import"./chunk-JLXG2XWW.js";import"./chunk-5O2CW3SX.js";import"./chunk-773GOZIR.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import"./chunk-D4MW3RDW.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-TNZMCRAP.js";import"./chunk-VKXEOL4K.js";import"./chunk-YYPNUQDI.js";import"./chunk-4SAVH3H7.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-VKPZP4LC.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,OPENAPI_URL,OpenApiCache,SSO_API_URL,VERCEL_CLI_ROOT_DISPLAY_KEY,assertAllowedSpecUrl,createOpenApiCache,fetchSpecUrl,foldNamingStyle,formatAsCard,formatAsDataTable,humanReadableColumnLabel,humanizeIdentifier,inferCliSubcommandAliases,matchesCliApiTag,operationIdToKebabCase,readSpecResponse,resolveEndpointByTagAndOperationId,resolveOpenApiTagForProjectsCli,tryOpenApiFallback};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{getSubcommand}from"./chunk-ETV3C2CV.js";import{PERMISSIONS_ACTIONS,permissionsClearSubcommand,permissionsLsSubcommand}from"./chunk-AU42HSQ3.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5DXCVG5U.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var USAGE="vcr permissions <repository> <ls|add|rm|clear>",ROUTING_OPTIONS=[...permissionsLsSubcommand.options,...permissionsClearSubcommand.options];async function permissions(client,argv,telemetry){let positionals;try{positionals=parseArguments(argv,getFlagsSpecification(ROUTING_OPTIONS),{permissive:!0}).args}catch{positionals=argv.filter(arg=>!arg.startsWith("-"))}let repository=positionals[0],{subcommand}=getSubcommand(positionals.slice(1),PERMISSIONS_ACTIONS);if(!repository||subcommand==null){let message=repository?positionals.length<2?`Please specify an action. Usage: \`vercel ${USAGE}\`.`:`Unknown "vcr permissions" action "${positionals[1]}". Usage: \`vercel ${USAGE}\`.`:`Missing repository. Usage: \`vercel ${USAGE}\`.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr permissions --help"),when:"Show valid permissions actions"}]},2),output_manager_default.error(`${message} Run \`vercel vcr permissions --help\`.`),2}switch(subcommand){case"ls":return(await import("./ls-KPDMEX3M.js")).default(client,argv,telemetry);case"add":return(await import("./add-YAWFEGID.js")).default(client,argv,telemetry);case"rm":return(await import("./rm-WFK724PU.js")).default(client,argv,telemetry);case"clear":return(await import("./clear-ZEWRQLJR.js")).default(client,argv,telemetry);default:return output_manager_default.error(`Unhandled permissions action: ${subcommand}`),1}}export{permissions as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{login}from"./chunk-DO4GPDKO.js";import{require_ci_info}from"./chunk-2EYYB6YN.js";import"./chunk-YCV465P5.js";import"./chunk-PVASGBEF.js";import"./chunk-B4YYOSPY.js";import"./chunk-MSH7V3FL.js";import{param}from"./chunk-3G3FQYMW.js";import"./chunk-5O2CW3SX.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{getGlobalPathConfig}from"./chunk-HMS3UIQ2.js";import"./chunk-TNZMCRAP.js";import"./chunk-VKXEOL4K.js";import"./chunk-YYPNUQDI.js";import"./chunk-4SAVH3H7.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-VKPZP4LC.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import{getCommandName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_ci_info=__toESM(require_ci_info(),1);async function promptMissingCredentials(client,onLoginError){let isTTY=process.stdout.isTTY;if(!import_ci_info.default.isCI&&(isTTY||client.isAgent)){output_manager_default.log(isTTY?"No existing credentials found. Please log in:":"No existing credentials found. Starting login flow...");try{let result=await login(client,{shouldParseArgs:!1});if(result!==0)return result}catch(error){return printError(error),onLoginError?.(error),1}return output_manager_default.debug(`Saved credentials in "${humanizePath(getGlobalPathConfig())}"`),0}return output_manager_default.prettyError({message:`No existing credentials found. Please run ${getCommandName("login")} or pass ${param("--token")}`,link:"https://err.sh/vercel/no-credentials-found"}),1}export{promptMissingCredentials as default};
|
|
@@ -1,15 +0,0 @@
|
|
|
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{updateRouteVersion}from"./chunk-6QKS6QK7.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{confirmAction,getRoutes,parseSubcommandArgs,printDiffSummary,requireProjectContext,withGlobalFlags}from"./chunk-G2JKENQU.js";import"./chunk-WJEAGH4K.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-WKTIAVGU.js";import{publishSubcommand}from"./chunk-QC47UKDR.js";import"./chunk-Q7D7RGXM.js";import"./chunk-WDJFZM7U.js";import{outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function publish(client,argv){let parsed=await parseSubcommandArgs(argv,publishSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0;output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);let{versions}=await getRouteVersions(client,project.id,{teamId}),version=versions.find(v=>v.isStaging);if(!version)return output_manager_default.warn(`No staged changes to publish. Make changes first with ${import_chalk.default.cyan(withGlobalFlags(client,"routes add"))}.`),0;output_manager_default.spinner("Fetching changes");let{routes:diffRoutes}=await getRoutes(client,project.id,{teamId,versionId:version.id,diff:!0}),changedRoutes=diffRoutes.filter(r=>r.action!==void 0);if(changedRoutes.length>0?(output_manager_default.print(`
|
|
8
|
-
${import_chalk.default.bold("Changes to be published:")}
|
|
9
|
-
|
|
10
|
-
`),printDiffSummary(changedRoutes),output_manager_default.print(`
|
|
11
|
-
`)):output_manager_default.print(`
|
|
12
|
-
${import_chalk.default.gray("No changes detected from current production version.")}
|
|
13
|
-
|
|
14
|
-
`),!await confirmAction(client,parsed.flags["--yes"],"Publish these changes to production?",`This will make them live for ${import_chalk.default.bold(project.name)}.`))return output_manager_default.log("Canceled"),0;let updateStamp=stamp_default();output_manager_default.spinner("Publishing to production");try{let{version:newVersion}=await updateRouteVersion(client,project.id,version.id,"promote",{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Success!")} Routes published to production ${import_chalk.default.gray(updateStamp())}`),newVersion.ruleCount!==void 0&&output_manager_default.print(` ${import_chalk.default.bold("Active routes:")} ${newVersion.ruleCount}
|
|
15
|
-
`),0}catch(e){let msg=e.message||"Failed to publish routes";return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"api_error",message:msg,next:[{command:withGlobalFlags(client,"routes publish --yes")}]}),process.exit(1),1):(output_manager_default.error(msg),1)}}export{publish as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{SENSITIVE_PLACEHOLDER,envPullCommandLogic,pull}from"./chunk-LZAGJ3QI.js";import"./chunk-WJEAGH4K.js";import"./chunk-25565AGS.js";import"./chunk-BW64GZ3E.js";import"./chunk-WKTIAVGU.js";import"./chunk-YCV465P5.js";import"./chunk-PVASGBEF.js";import"./chunk-MVCAUS4F.js";import"./chunk-6LXX5P3A.js";import"./chunk-MSH7V3FL.js";import"./chunk-3G3FQYMW.js";import"./chunk-3EYOQC4R.js";import"./chunk-XEQT373M.js";import"./chunk-J2LAZELI.js";import"./chunk-E6UKNYFF.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-TNZMCRAP.js";import"./chunk-VKXEOL4K.js";import"./chunk-YYPNUQDI.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{SENSITIVE_PLACEHOLDER,pull as default,envPullCommandLogic};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isEngineInstalled,pushCompressionArgs,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-QCG6Q33G.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-GSOPJJO5.js";import{pushSubcommand}from"./chunk-RZGWCQP7.js";import"./chunk-AG5QQNJ3.js";import"./chunk-AU42HSQ3.js";import"./chunk-L5FUUGYX.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";async function push(client,telemetry){let{own,passthrough}=splitPassthrough(client.argv),parsedArgs;try{parsedArgs=parseArguments(own,getFlagsSpecification(pushSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr push <engine> [name[:tag]]"),printError(err),2}let[engineArg,nameArg]=parsedArgs.args.slice(2),project=parsedArgs.flags["--project"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliArgumentName(nameArg),telemetry.trackCliOptionProject(project),!engineArg){let message=`Missing engine. Choose one of: ${VCR_ENGINES.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr push docker"),when:"Replace docker with the container tool you use"}]},2),outputError(client,!1,"MISSING_ARGUMENTS",message)}let choiceError=validateVcrChoice(client,"engine",engineArg,VCR_ENGINES,!1);if(typeof choiceError=="number")return choiceError;let engine=engineArg;if(!isEngineInstalled(engine)){let message=`\`${engine}\` is not installed or not on your PATH. Install it and try again.`;return outputAgentError(client,{status:"error",reason:"engine_not_found",message},1),outputError(client,!1,"ENGINE_NOT_FOUND",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:!1});if(typeof scope=="number")return scope;let parsed=parseNameArg(nameArg,scope.projectName);if("error"in parsed)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:parsed.error},2),outputError(client,!1,"INVALID_ARGUMENTS",parsed.error);let validationError=validateImageParts(parsed);if(validationError)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:validationError},2),outputError(client,!1,"INVALID_ARGUMENTS",validationError);let ref=`${buildRepositoryReference({registry:resolveRegistry(),teamSlug:scope.teamSlug,projectName:scope.projectName,repository:parsed.repository})}:${parsed.tag??DEFAULT_TAG}`,engineArgs=["push",...pushCompressionArgs(engine),...passthrough,ref];output_manager_default.log(`Running: ${engine} ${engineArgs.join(" ")}`);let result=await runEngine(engine,engineArgs,{cwd:client.cwd,captureStderr:!0});return result.exitCode!==0?reportEnginePushFailure(client,engine,"push",result):(output_manager_default.success(`Pushed ${ref}`),0)}export{push as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
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{warnIfFidMetric}from"./chunk-ZUCSA4IW.js";import{FILTER_DEPRECATION_WARNING,computeGranularity,formatText,getDefaultCustomMetricAggregation,isCanonicalAggregation,usesODataSyntax}from"./chunk-7Z4JCYS6.js";import{OBSERVABILITY_METRICS_PATH,fetchCatalogMetricDetailOrExit,fetchMetricDetailOrExit,formatErrorJson,formatQueryJson,getDefaultAggregation,getRollupColumnName,handleApiError}from"./chunk-G64N3I5W.js";import"./chunk-IVSSTHB6.js";import"./chunk-GZNDA6SV.js";import{resolveTimeRange,validateAllProjectMutualExclusivity}from"./chunk-WH3SHWVK.js";import"./chunk-ID663OJ7.js";import{metricsCommand}from"./chunk-QJKJBD2M.js";import"./chunk-Q7D7RGXM.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{getScope}from"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import{getLinkedProject,getProjectByNameOrId}from"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{ProjectNotFound,isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateRequiredMetric(metric){return metric?{valid:!0,value:metric}:{valid:!1,code:"MISSING_METRIC",message:`Missing required metric. Specify the metric to query.
|
|
8
|
-
|
|
9
|
-
Run 'vercel metrics schema' to see available metrics.`}}function validateOrderDirection(orderDirection){return orderDirection===void 0?{valid:!0,value:void 0}:orderDirection==="asc"||orderDirection==="desc"?{valid:!0,value:orderDirection}:{valid:!1,code:"INVALID_ORDER",message:`Invalid order "${orderDirection}". Use "asc" or "desc".`,allowedValues:["asc","desc"]}}function validateOrderBy(orderBy){return orderBy===void 0?{valid:!0,value:void 0}:orderBy==="value"||orderBy==="count"?{valid:!0,value:orderBy}:{valid:!1,code:"INVALID_ORDER_BY",message:`Invalid order-by "${orderBy}". Use "value" or "count".`,allowedValues:["value","count"]}}function handleValidationError(result,jsonOutput,client,telemetry){return telemetry.trackCliError(result.code),jsonOutput?client.stdout.write(formatErrorJson(result.code,result.message,result.allowedValues)):(output_manager_default.error(result.message),result.allowedValues&&result.allowedValues.length>0&&output_manager_default.print(`
|
|
10
|
-
Available values: ${result.allowedValues.join(", ")}
|
|
11
|
-
`)),1}var PRODUCTION_ENVIRONMENT_FILTER="environment eq 'production'",PRODUCTION_ENVIRONMENT_KQL_FILTER="environment:production",CUSTOM_METRIC_VALUE_ALIAS="value",CUSTOM_METRIC_COUNT_ALIAS="__seriesCount",SUM_DEFAULT_METRIC_UNITS=new Set(["bytes","count","usd","units"]);function combineFilters(filters,prod,syntax="odata"){let nonEmptyFilters=[...filters?.filter(filter=>filter.length>0)??[],...prod?[syntax==="kql"?PRODUCTION_ENVIRONMENT_KQL_FILTER:PRODUCTION_ENVIRONMENT_FILTER]:[]];if(nonEmptyFilters.length===0)return;if(nonEmptyFilters.length===1)return nonEmptyFilters[0];let conjunction=syntax==="kql"?" AND ":" and ";return nonEmptyFilters.map(filter=>`(${filter})`).join(conjunction)}function getRequestOrderBy(metric,aggregation,orderBy){return orderBy==="value"?getRollupColumnName(metric,aggregation):void 0}function toBucketSeconds(granularity){return"minutes"in granularity?granularity.minutes*60:"hours"in granularity?granularity.hours*60*60:granularity.days*24*60*60}function alignTimeRangeToGranularity(startTime,endTime,granularity){let bucketMs=toBucketSeconds(granularity)*1e3;return{startTime:new Date(Math.floor(startTime.getTime()/bucketMs)*bucketMs),endTime:new Date(Math.ceil(endTime.getTime()/bucketMs)*bucketMs)}}function getCatalogDefaultAggregation(metric,isPlatformMetric){if(!isPlatformMetric)return getDefaultCustomMetricAggregation(metric.unit,metric.aggregations);let defaultAggregation=SUM_DEFAULT_METRIC_UNITS.has(metric.unit)?"sum":"avg";return metric.aggregations.includes(defaultAggregation)?defaultAggregation:defaultAggregation==="sum"&&metric.aggregations.includes("count")?"count":metric.aggregations.includes("sum")?"sum":metric.aggregations[0]}function toCanonicalMetricSelection(metric,aggregation,supportedAggregations){let[aggregationName,...dimensionParts]=aggregation.split("/"),dimension=dimensionParts.join("/")||void 0,countOnlyMetric=supportedAggregations?.includes("count")===!0&&!supportedAggregations.includes("sum"),additiveAggregation=supportedAggregations?.includes("sum")?"sum":countOnlyMetric||supportedAggregations===void 0&&metric.endsWith(".count")?"count":"sum";return aggregation==="persecond"?{metric,aggregation:additiveAggregation,per:"second"}:aggregation==="percent"?{metric,aggregation:additiveAggregation,normalize:"percent"}:aggregationName==="unique"?dimension?{metric,aggregation:"unique",dimensions:[dimension]}:{valid:!1,code:"UNSUPPORTED_AGGREGATION",message:'The unique aggregation requires a dimension, for example "unique/visitorId".'}:isCanonicalAggregation(aggregation)?{metric,aggregation}:{valid:!1,code:"INVALID_AGGREGATION",message:`Aggregation "${aggregation}" is not supported by the Observability query API.`}}function getCanonicalOrderBy(orderBy,selection,supportedAggregations){if(orderBy==="value")return"value";let supportsCount=supportedAggregations===void 0||supportedAggregations.includes("count");return selection.aggregation==="count"||supportsCount?"count":orderBy==="count"?{valid:!1,code:"INVALID_ORDER_BY",message:"--order-by count is not available because this metric does not support the count aggregation. Use --order-by value.",allowedValues:["value"]}:"value"}function createCanonicalMetricsRequest(options){let metrics={[CUSTOM_METRIC_VALUE_ALIAS]:options.selection},rankMetric=CUSTOM_METRIC_VALUE_ALIAS;return options.groupBy.length>0&&options.orderBy==="count"&&options.selection.aggregation!=="count"&&(metrics[CUSTOM_METRIC_COUNT_ALIAS]={metric:options.metric,aggregation:"count"},rankMetric=CUSTOM_METRIC_COUNT_ALIAS),{scope:{ownerId:options.scope.ownerId,...options.scope.type==="project"?{projectIds:options.scope.projectIds}:{}},timeRange:{start:options.startTime.toISOString(),end:options.endTime.toISOString()},bucketSeconds:toBucketSeconds(options.granularity),...options.groupBy.length>0?{groupBy:options.groupBy}:{},...options.filter?{filter:options.filter}:{},metrics,outputs:[CUSTOM_METRIC_VALUE_ALIAS],...options.groupBy.length>0?{seriesSelection:{limit:options.limit,mode:"exact",rankBy:[{metric:rankMetric,direction:options.orderDirection??"desc"}]}}:{}}}function canonicalResponseToMetricsResponse(response,rollupColumn,orderBy,orderDirection){let toRow=point=>({...point.dimensions,[rollupColumn]:point.values[CUSTOM_METRIC_VALUE_ALIAS]??null});return{...response.series?{data:response.series.map(point=>({timestamp:point.timestamp,...toRow(point)}))}:{},summary:response.summary.map(toRow),statistics:{rowsRead:response.meta.statistics.rowsRead,bytesRead:response.meta.statistics.bytesRead,dbTimeSeconds:response.meta.statistics.databaseElapsedMs/1e3,engineTimeSeconds:response.meta.statistics.elapsedMs/1e3,queryTable:[...new Set(response.meta.sources.map(source=>source.id))].sort().join(",")},...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}}}async function resolveQueryScope(client,telemetry,opts){if(opts.project||opts.all){let{team}=await getScope(client);if(!team)return handleValidationError({valid:!1,code:"NO_TEAM",message:"No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory."},opts.jsonOutput,client,telemetry);if(opts.all)return{scope:{type:"owner",ownerId:team.id},accountId:team.id,teamName:team.slug};let project=await getProjectByNameOrId(client,opts.project,team.id);if(project instanceof ProjectNotFound){let errMsg=`Project "${opts.project}" was not found in team "${team.slug}".`;return handleValidationError({valid:!1,code:"PROJECT_NOT_FOUND",message:errMsg},opts.jsonOutput,client,telemetry)}return{scope:{type:"project",ownerId:team.id,projectIds:[project.id]},accountId:team.id,teamName:team.slug,projectName:project.name}}let linkedProject=await getLinkedProject(client);return linkedProject.status==="error"?(telemetry.trackCliError("LINK_ERROR"),linkedProject.exitCode):linkedProject.status==="not_linked"?handleValidationError({valid:!1,code:"NOT_LINKED",message:"No linked project found. Run `vercel link` to link a project, or use --project <name-or-id> or --all."},opts.jsonOutput,client,telemetry):{scope:{type:"project",ownerId:linkedProject.org.id,projectIds:[linkedProject.project.id]},accountId:linkedProject.org.id,teamName:linkedProject.org.slug,projectName:linkedProject.project.name}}async function query(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(metricsCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return telemetry.trackCliError("INVALID_ARGUMENTS"),printError(err,client),2}let flags=parsedArgs.flags,positionalArgs=parsedArgs.args.slice(1),positionalMetric=positionalArgs[0]==="query"?positionalArgs[1]:positionalArgs[0],formatResult=validateJsonOutput(flags);if(!formatResult.valid)return telemetry.trackCliError("INVALID_OUTPUT_FORMAT"),output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput,metricFlag=positionalMetric,aggregationFlag=flags["--aggregation"],groupBy=flags["--group-by"]??[],limit=flags["--limit"],orderByInput=typeof flags["--order-by"]=="string"?flags["--order-by"].trim().toLowerCase():void 0,orderInput=typeof flags["--order"]=="string"?flags["--order"].trim().toLowerCase():void 0,filters=flags["--filter"],prod=flags["--prod"],since=flags["--since"],until=flags["--until"],granularity=flags["--granularity"],bucketTimezone=flags["--bucket-timezone"]?.trim(),project=flags["--project"],all=flags["--all"];telemetry.trackCliArgumentMetricId(metricFlag),telemetry.trackCliOptionAggregation(aggregationFlag),telemetry.trackCliOptionGroupBy(groupBy.length>0?groupBy:void 0),telemetry.trackCliOptionLimit(limit),telemetry.trackCliOptionOrderBy(orderByInput),telemetry.trackCliOptionOrder(orderInput),telemetry.trackCliOptionFilter(filters),telemetry.trackCliFlagProd(prod),telemetry.trackCliOptionSince(since),telemetry.trackCliOptionUntil(until),telemetry.trackCliOptionGranularity(granularity),telemetry.trackCliOptionBucketTimezone(bucketTimezone),telemetry.trackCliOptionProject(project),telemetry.trackCliFlagAll(all),telemetry.trackCliOptionFormat(flags["--format"]);let orderByResult=validateOrderBy(orderByInput);if(!orderByResult.valid)return handleValidationError(orderByResult,jsonOutput,client,telemetry);let orderByMode=orderByResult.value,requiredMetric=validateRequiredMetric(metricFlag);if(!requiredMetric.valid)return handleValidationError(requiredMetric,jsonOutput,client,telemetry);let metric=requiredMetric.value;warnIfFidMetric(metric);let mutualResult=validateAllProjectMutualExclusivity(all,project);if(!mutualResult.valid)return handleValidationError(mutualResult,jsonOutput,client,telemetry);let orderDirectionResult=validateOrderDirection(orderInput);if(!orderDirectionResult.valid)return handleValidationError(orderDirectionResult,jsonOutput,client,telemetry);let orderDirection=orderDirectionResult.value,scopeResult=await resolveQueryScope(client,telemetry,{project,all,jsonOutput});if(typeof scopeResult=="number")return scopeResult;let{scope,accountId,teamName,projectName}=scopeResult,isPlatformMetric=metric.startsWith("vercel."),useCanonicalQuery=!isPlatformMetric||!process.env.FF_LEGACY_METRICS,filterUsesOData=usesODataSyntax(filters);useCanonicalQuery&&filterUsesOData&&output_manager_default.print(`${import_chalk.default.yellow("!")} ${FILTER_DEPRECATION_WARNING}
|
|
12
|
-
`);let filter=combineFilters(filters,prod,useCanonicalQuery&&!filterUsesOData?"kql":"odata"),startTime,endTime;try{({startTime,endTime}=resolveTimeRange(since,until))}catch(err){let errMsg=err instanceof Error?err.message:String(err);return handleValidationError({valid:!1,code:"INVALID_TIME",message:errMsg},jsonOutput,client,telemetry)}let metricUnit,aggregationInput,canonicalAggregations;if(useCanonicalQuery){let catalogOrExitCode=await fetchCatalogMetricDetailOrExit(client,accountId,jsonOutput,metric,isPlatformMetric?"system":"custom",startTime.toISOString());if(typeof catalogOrExitCode=="number")return telemetry.trackCliError("SCHEMA_FETCH_FAILED"),catalogOrExitCode;let catalogMetric=catalogOrExitCode.find(item=>item.id===metric);if(!catalogMetric)return handleValidationError({valid:!1,code:"UNKNOWN_METRIC",message:`Unknown metric "${metric}".`,allowedValues:catalogOrExitCode.map(item=>item.id)},jsonOutput,client,telemetry);if(metricUnit=catalogMetric.unit,canonicalAggregations=catalogMetric.aggregations,aggregationFlag)aggregationInput=aggregationFlag;else{let defaultAggregation=getCatalogDefaultAggregation(catalogMetric,isPlatformMetric);if(!defaultAggregation)return handleValidationError({valid:!1,code:"INVALID_AGGREGATION",message:`Metric "${metric}" does not support any query aggregations.`},jsonOutput,client,telemetry);aggregationInput=defaultAggregation}}else{let detailOrExitCode=await fetchMetricDetailOrExit(client,accountId,metric,jsonOutput);if(typeof detailOrExitCode=="number")return telemetry.trackCliError("SCHEMA_FETCH_FAILED"),detailOrExitCode;aggregationInput=aggregationFlag??getDefaultAggregation(detailOrExitCode,metric)??"sum",metricUnit=detailOrExitCode.find(item=>item.id===metric)?.unit??"count"}let aggregation=aggregationInput,orderBy=getRequestOrderBy(metric,aggregation,orderByMode),rangeMs=endTime.getTime()-startTime.getTime(),granResult=computeGranularity(rangeMs,granularity),queryTimeRange=useCanonicalQuery?alignTimeRangeToGranularity(startTime,endTime,granResult.duration):{startTime,endTime};!jsonOutput&&granResult.adjusted&&granResult.notice&&output_manager_default.log(`Notice: ${granResult.notice}`);let body,canonicalOrderBy;if(!useCanonicalQuery)body={scope,metric,aggregation,startTime:startTime.toISOString(),endTime:endTime.toISOString(),granularity:granResult.duration,...bucketTimezone?{bucketTimezone}:{},...groupBy.length>0?{groupBy}:{},...filter?{filter}:{},limit:limit??10,...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}};else{if(bucketTimezone)return handleValidationError({valid:!1,code:"UNSUPPORTED_BUCKET_TIMEZONE",message:"--bucket-timezone is not supported by the new Observability query API yet."},jsonOutput,client,telemetry);let selection=toCanonicalMetricSelection(metric,aggregation,canonicalAggregations);if("valid"in selection)return handleValidationError(selection,jsonOutput,client,telemetry);let supportedAggregation=selection.aggregation;if(canonicalAggregations&&!canonicalAggregations.includes(supportedAggregation))return handleValidationError({valid:!1,code:"INVALID_AGGREGATION",message:`Aggregation "${aggregation}" is not valid for metric "${metric}".`,allowedValues:[...canonicalAggregations]},jsonOutput,client,telemetry);let canonicalOrderByResult=groupBy.length>0?getCanonicalOrderBy(orderByMode,selection,canonicalAggregations):void 0;if(canonicalOrderByResult&&typeof canonicalOrderByResult!="string")return handleValidationError(canonicalOrderByResult,jsonOutput,client,telemetry);canonicalOrderBy=canonicalOrderByResult,body=createCanonicalMetricsRequest({scope,metric,selection,startTime:queryTimeRange.startTime,endTime:queryTimeRange.endTime,granularity:granResult.duration,groupBy,filter,limit:limit??10,orderBy:canonicalOrderBy,orderDirection})}let resolvedOrderBy=canonicalOrderBy??orderByMode;jsonOutput||output_manager_default.spinner("Querying metrics...");let response;try{if(!useCanonicalQuery)response=await client.fetch("/v2/observability/query",{method:"POST",body:JSON.stringify(body),headers:{"Content-Type":"application/json"},accountId,bailOn429:!0});else{let canonicalResponse=await client.fetch(OBSERVABILITY_METRICS_PATH,{method:"POST",body:JSON.stringify(body),headers:{"Content-Type":"application/json"},accountId,bailOn429:!0});response=canonicalResponseToMetricsResponse(canonicalResponse,getRollupColumnName(metric,aggregation),canonicalOrderBy,groupBy.length>0?orderDirection??"desc":void 0)}}catch(err){if(isAPIError(err))return telemetry.trackCliError(err.code??"API_ERROR",err.status),handleApiError(err,jsonOutput,client,{},{scope:accountId.startsWith("team_")?teamName||accountId:void 0,projectName});let errMsg=err instanceof Error?err.message:String(err);return telemetry.trackCliError("NETWORK_ERROR"),jsonOutput?client.stdout.write(formatErrorJson("NETWORK_ERROR",errMsg)):output_manager_default.error(errMsg),1}finally{jsonOutput||output_manager_default.stopSpinner()}return jsonOutput?client.stdout.write(formatQueryJson({metric,aggregation,groupBy,filter,startTime:queryTimeRange.startTime.toISOString(),endTime:queryTimeRange.endTime.toISOString(),granularity:granResult.duration,...bucketTimezone?{bucketTimezone}:{},...resolvedOrderBy?{orderBy:resolvedOrderBy}:{},...orderDirection?{orderDirection}:{}},response)):client.stdout.write(formatText(response,{metric,metricUnit,aggregation,groupBy,filter,scope,projectName,teamName,periodStart:queryTimeRange.startTime.toISOString(),periodEnd:queryTimeRange.endTime.toISOString(),granularity:granResult.duration,bucketTimezone,orderBy:resolvedOrderBy,orderDirection})),0}export{query as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
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{performDeviceCodeFlow}from"./chunk-YCV465P5.js";import"./chunk-PVASGBEF.js";import"./chunk-MSH7V3FL.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-PPCFQQSU.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function reauthenticate(client,error){let{tokenSource}=client.authConfig,reauthAction=error.enforced?"SAML re-authentication is required":"Re-authentication is required";if(tokenSource==="flag")throw new Error(`${reauthAction} for ${(0,import_chalk.bold)(error.scope)} scope, but the token provided via \`--token\` does not have access. Provide a token that is authorized for that scope.`);if(tokenSource==="env")throw new Error(`${reauthAction} for ${(0,import_chalk.bold)(error.scope)} scope, but the token provided via the VERCEL_TOKEN environment variable does not have access. Set VERCEL_TOKEN to a token that is authorized for that scope.`);if(!client.stdin.isTTY&&process.env.CI)throw new Error(`${reauthAction} for ${(0,import_chalk.bold)(error.scope)} scope, but the current environment is non-interactive so the device-code flow cannot be completed. Run \`vercel login\` in an interactive shell, or set VERCEL_TOKEN / pass \`--token\` with a token that is authorized for that scope.`);error.teamId&&error.enforced?output_manager_default.log(`You must re-authenticate with SAML to use ${(0,import_chalk.bold)(error.scope)} scope.`):output_manager_default.log(`You must re-authenticate to use ${(0,import_chalk.bold)(error.scope)} scope.`);let tokens=await performDeviceCodeFlow(client,{teamId:error.teamId||void 0});return tokens?(client.updateAuthConfig({token:tokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in,refreshToken:tokens.refresh_token}),client.persistAuthConfig(),output_manager_default.success(`Authentication complete for ${(0,import_chalk.bold)(error.scope)} scope.`),{token:tokens.access_token,email:""}):1}export{reauthenticate as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
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{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRoutes,offerAutoPromote,parsePosition,parseSubcommandArgs,requireProjectContext,resolveRoute,shellQuoteRouteIdentifierForSuggestion,withGlobalFlags}from"./chunk-G2JKENQU.js";import"./chunk-WJEAGH4K.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-WKTIAVGU.js";import{reorderSubcommand}from"./chunk-QC47UKDR.js";import"./chunk-Q7D7RGXM.js";import"./chunk-WDJFZM7U.js";import{outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function stageRoutes(client,projectId,routes,overwrite,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({routes,overwrite})})}async function reorder(client,argv){let parsed=await parseSubcommandArgs(argv,reorderSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args,flags}=parsed,skipConfirmation=flags["--yes"],identifier=args[0];if(!identifier)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Route name or ID and position are required.",next:[{command:withGlobalFlags(client,"routes reorder <name-or-id> --position <pos> --yes"),when:"replace placeholders; --first/--last or numeric position"}]},2),output_manager_default.error(`Route name or ID is required. Usage: ${withGlobalFlags(client,"routes reorder <name-or-id> --position <pos>")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:"No routes found in this project."},1),output_manager_default.error("No routes found in this project."),1;if(routes.length===1)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:"Cannot reorder when there is only one route."},2),output_manager_default.error("Cannot reorder when there is only one route."),2;let route=await resolveRoute(client,routes,identifier);if(!route)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:`No route found matching "${identifier}".`,next:[{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},1),output_manager_default.error(`No route found matching "${identifier}". Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see all routes.`),1;let currentIndex=routes.findIndex(r=>r.id===route.id),currentPosition=currentIndex+1,targetIndex,positionFlag=flags["--position"],firstFlag=flags["--first"],lastFlag=flags["--last"];if(firstFlag)targetIndex=0;else if(lastFlag)targetIndex=routes.length;else if(positionFlag)if(positionFlag==="first")targetIndex=0;else if(positionFlag==="last")targetIndex=routes.length;else{let num=parseInt(positionFlag,10);if(!isNaN(num)&&String(num)===positionFlag){if(num<1){let msg="Position must be 1 or greater. Positions are 1-based (e.g. --position 1 for first). Use --first or --last instead of 0.";return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"invalid_arguments",message:msg,next:[{command:withGlobalFlags(client,`routes reorder ${shellQuoteRouteIdentifierForSuggestion(identifier)} --first --yes`),when:"move to first position"},{command:withGlobalFlags(client,`routes reorder ${shellQuoteRouteIdentifierForSuggestion(identifier)} --position 1 --yes`),when:"same as first (1-based index)"},{command:withGlobalFlags(client,`routes reorder ${shellQuoteRouteIdentifierForSuggestion(identifier)} --last --yes`),when:"move to last position"}],hint:"Numeric --position uses 1-based indices; there is no position 0."},2),2):(output_manager_default.error(msg),2)}targetIndex=Math.min(num-1,routes.length)}else try{let pos=parsePosition(positionFlag);if(pos.placement==="start")targetIndex=0;else if(pos.placement==="end")targetIndex=routes.length;else if(pos.placement==="after"&&pos.referenceId){let refIndex=routes.findIndex(r=>r.id===pos.referenceId);if(refIndex===-1)return output_manager_default.error(`Reference route "${pos.referenceId}" not found. Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see route IDs.`),1;targetIndex=refIndex+1}else if(pos.placement==="before"&&pos.referenceId){let refIndex=routes.findIndex(r=>r.id===pos.referenceId);if(refIndex===-1)return output_manager_default.error(`Reference route "${pos.referenceId}" not found. Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see route IDs.`),1;targetIndex=refIndex}else return output_manager_default.error("Invalid position specification."),1}catch(e){return output_manager_default.error(`${e instanceof Error?e.message:"Invalid position"}. Usage: ${withGlobalFlags(client,"routes reorder <name-or-id> --position <pos>")}`),2}}else{client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Target position is required. Use --position <n|first|last|after:id|before:id> or --first / --last.",next:[{command:withGlobalFlags(client,`routes reorder ${shellQuoteRouteIdentifierForSuggestion(identifier)} --position <pos> --yes`),when:"replace <pos> with numeric position or first/last"}]},2),output_manager_default.print(`
|
|
8
|
-
`),output_manager_default.log("Current route order:");for(let i=0;i<routes.length;i++){let r=routes[i],isCurrent=r.id===route.id,prefix=isCurrent?import_chalk.default.cyan("\u2192"):" ",num=import_chalk.default.gray(`${i+1}.`),name=isCurrent?import_chalk.default.bold(r.name):r.name,src=import_chalk.default.gray(`(${r.route.src})`),marker=isCurrent?import_chalk.default.cyan(" \u2190 current"):"";output_manager_default.print(` ${prefix} ${num} ${name} ${src}${marker}
|
|
9
|
-
`)}output_manager_default.print(`
|
|
10
|
-
`);let input=await client.input.text({message:`Move "${route.name}" to position (1-${routes.length}, "first", or "last"):`,validate:val=>{if(!val)return"Position is required";if(val==="first"||val==="last")return!0;let num=parseInt(val,10);return isNaN(num)||num<1||num>routes.length?`Enter a number between 1 and ${routes.length}, "first", or "last"`:!0}});input==="first"?targetIndex=0:input==="last"?targetIndex=routes.length:targetIndex=parseInt(input,10)-1}let adjustedTarget=currentIndex<targetIndex?targetIndex-1:targetIndex,clampedTarget=Math.max(0,Math.min(adjustedTarget,routes.length-1));if(currentIndex===clampedTarget)return output_manager_default.log(`Route "${route.name}" is already at position ${currentPosition}.`),0;let finalPosition=clampedTarget+1;if(!skipConfirmation&&(client.nonInteractive&&outputAgentError(client,{status:"error",reason:"confirmation_required",message:"Reorder requires confirmation. Pass --yes in non-interactive mode.",next:[{command:withGlobalFlags(client,`routes reorder ${shellQuoteRouteIdentifierForSuggestion(identifier)} --position ${finalPosition} --yes`),when:"re-run with --yes"}]},1),!await client.input.confirm(`Move "${route.name}" from position ${currentPosition} to position ${finalPosition}?`,!0)))return output_manager_default.log("Aborted."),0;let reordered=[...routes];reordered.splice(currentIndex,1),reordered.splice(clampedTarget,0,route);let reorderStamp=stamp_default();output_manager_default.spinner(`Moving route "${route.name}"`);try{let{version}=await stageRoutes(client,project.id,reordered,!0,{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Moved")} "${route.name}" from position ${currentPosition} to ${finalPosition} ${import_chalk.default.gray(reorderStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return output_manager_default.error(error.message||"Failed to reorder route"),1}}export{reorder as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
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{resolveMessageContent}from"./chunk-OA446564.js";import{parseThreadArg}from"./chunk-2S6PE6GB.js";import{addMessage,handleCommentsParseError,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts}from"./chunk-VUILLFZ6.js";import"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-WJEAGH4K.js";import"./chunk-WKTIAVGU.js";import{replySubcommand}from"./chunk-MYCQIZU6.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateAttachments(attach){if(!(!attach||attach.length===0)){if(attach.length>10)return"A message can have at most 10 attachments.";for(let url of attach)if(!/^https:\/\//i.test(url))return`Attachments must be https URLs (the API fetches them); got "${url}". Local file upload is not supported by the API.`}}async function reply(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(replySubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"reply")}let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput;telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliOptionMessage(parsedArgs.flags["--message"]),telemetry.trackCliOptionFile(parsedArgs.flags["--file"]),telemetry.trackCliOptionAttach(parsedArgs.flags["--attach"]);let threadInput=parsedArgs.args[2];if(telemetry.trackCliArgumentThread(threadInput),!threadInput)return outputError(client,jsonOutput,"MISSING_THREAD","Pass a thread ID or URL: `vercel comments reply <thread> -m <text>`.");let threadRef=parseThreadArg(threadInput);if(!threadRef)return outputError(client,jsonOutput,"INVALID_THREAD",`Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`);let threadId=threadRef.id,attach=parsedArgs.flags["--attach"],attachError=validateAttachments(attach);if(attachError)return outputError(client,jsonOutput,"INVALID_ATTACHMENT",attachError);let content=await resolveMessageContent(client,{message:parsedArgs.flags["--message"],file:parsedArgs.flags["--file"],hasAttachments:!!(attach&&attach.length>0)},jsonOutput);if(typeof content=="number")return content;telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);let scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput,urlTeamSlug:threadRef.teamSlug});if(typeof scope=="number")return scope;jsonOutput||output_manager_default.spinner("Posting reply\u2026");try{let message=await addMessage(client,scope.teamId,threadId,{...content!==void 0&&{markdown:content},...attach&&attach.length>0&&{attachments:attach.map(url=>({url}))}});return jsonOutput?(client.stdout.write(`${JSON.stringify(message,null,2)}
|
|
8
|
-
`),0):(output_manager_default.print(`${import_chalk.default.green("\u2713")} Replied to ${threadId}
|
|
9
|
-
`),0)}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err);return outputError(client,jsonOutput,code,err.status===404?threadNotFoundMessage(threadId,scope):message)}throw err}finally{output_manager_default.stopSpinner()}}export{reply as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
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{parseThreadArg}from"./chunk-2S6PE6GB.js";import{addMessage,handleCommentsParseError,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts,updateThread}from"./chunk-VUILLFZ6.js";import{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-WH3SHWVK.js";import"./chunk-WJEAGH4K.js";import"./chunk-WKTIAVGU.js";import{reopenSubcommand,resolveSubcommand}from"./chunk-MYCQIZU6.js";import"./chunk-WDJFZM7U.js";import"./chunk-5DXCVG5U.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function resolveThreads(client,telemetry,resolved){let subcommand=resolved?resolveSubcommand:reopenSubcommand,verb=resolved?"resolve":"reopen",pastVerb=resolved?"resolved":"reopened",parsedArgs,flagsSpecification=getFlagsSpecification(subcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,subcommand.name)}let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput,closingMessage=resolved?parsedArgs.flags["--message"]:void 0,yes=!!parsedArgs.flags["--yes"];telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]),resolved&&telemetry.trackCliOptionMessage(closingMessage);let threadInputs=parsedArgs.args.slice(2);if(telemetry.trackCliArgumentThread(threadInputs[0]),threadInputs.length===0)return outputError(client,jsonOutput,"MISSING_THREAD",`Pass at least one thread ID or URL: \`vercel comments ${verb} <thread>\`.`);let threadIds=[],urlTeamSlug;for(let input of threadInputs){let ref=parseThreadArg(input);if(!ref)return outputError(client,jsonOutput,"INVALID_THREAD",`Could not extract a thread ID from "${input}".`);if(ref.teamSlug){if(urlTeamSlug&&urlTeamSlug!==ref.teamSlug)return outputError(client,jsonOutput,"MIXED_TEAMS",`The URLs belong to different teams (${urlTeamSlug}, ${ref.teamSlug}). Run once per team.`);urlTeamSlug=ref.teamSlug}threadIds.push(ref.id)}if(closingMessage!==void 0&&threadIds.length>1)return outputError(client,jsonOutput,"MESSAGE_WITH_MULTIPLE_THREADS","Cannot use -m with multiple threads. Resolve one thread with a closing message, or resolve multiple threads without -m.");let scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput,urlTeamSlug});if(typeof scope=="number")return scope;if(threadIds.length>1&&!yes){if(!canPrompt(client)||jsonOutput)return outputError(client,jsonOutput,"CONFIRMATION_REQUIRED",`Pass --yes to ${verb} ${threadIds.length} comments non-interactively.`);if(!await client.input.confirm(`${import_chalk.default.bold(String(threadIds.length))} comments will be ${pastVerb} in team ${scope.teamSlug??scope.teamId}. Continue?`,!1))return output_manager_default.log("Canceled."),0}if(telemetry.trackCliOptionProject(parsedArgs.flags["--project"]),threadIds.length===1){let threadId=threadIds[0],replied=!1;try{closingMessage!==void 0&&(await addMessage(client,scope.teamId,threadId,{markdown:closingMessage}),replied=!0);let thread=await updateThread(client,scope.teamId,threadId,resolved);return jsonOutput?(client.stdout.write(`${JSON.stringify({thread,replied},null,2)}
|
|
8
|
-
`),0):(output_manager_default.print(`${import_chalk.default.green("\u2713")} ${threadId} ${pastVerb}${replied?" (with closing reply)":""}
|
|
9
|
-
`),0)}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err),friendly=err.status===404?threadNotFoundMessage(threadId,scope):message;return outputError(client,jsonOutput,code,replied?`Replied, but ${verb} failed: ${friendly} Run \`vercel comments resolve ${threadId}\` (without -m) to finish without duplicating the reply.`:friendly)}throw err}}let results=[];for(let threadId of threadIds)try{await updateThread(client,scope.teamId,threadId,resolved),results.push({id:threadId,ok:!0})}catch(err){if(isAPIError(err)){let{message}=toApiErrorParts(err);results.push({id:threadId,ok:!1,error:message})}else throw err}let failed=results.filter(result=>!result.ok);if(jsonOutput)return client.stdout.write(`${JSON.stringify({results},null,2)}
|
|
10
|
-
`),failed.length>0?1:0;for(let result of results)result.ok?output_manager_default.print(`${import_chalk.default.green("\u2713")} ${result.id} ${pastVerb}
|
|
11
|
-
`):output_manager_default.print(`${import_chalk.default.yellow("!")} ${result.id} ${result.error}
|
|
12
|
-
`);return failed.length>0?1:0}export{resolveThreads as default};
|
|
@@ -1,16 +0,0 @@
|
|
|
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{updateRouteVersion}from"./chunk-6QKS6QK7.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{confirmAction,findVersionById,getRoutes,parseSubcommandArgs,printDiffSummary,requireProjectContext,validateRequiredArguments,withGlobalFlags}from"./chunk-G2JKENQU.js";import"./chunk-WJEAGH4K.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-WKTIAVGU.js";import{restoreSubcommand}from"./chunk-QC47UKDR.js";import"./chunk-Q7D7RGXM.js";import"./chunk-WDJFZM7U.js";import{outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function restore(client,argv){let parsed=await parseSubcommandArgs(argv,restoreSubcommand,client);if(typeof parsed=="number")return parsed;let error=validateRequiredArguments(parsed.args,["version-id"]);if(error)return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"missing_arguments",message:error,next:[{command:withGlobalFlags(client,"routes restore <version-id> --yes")},{command:withGlobalFlags(client,"routes list-versions")}]}),process.exit(1),2):(output_manager_default.error(error),2);let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,[versionIdentifier]=parsed.args;output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);let{versions}=await getRouteVersions(client,project.id,{teamId}),result=findVersionById(client,versions,versionIdentifier);if(result.error)return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"invalid_arguments",message:result.error,next:[{command:withGlobalFlags(client,"routes list-versions")}]}),process.exit(1),2):(output_manager_default.error(result.error),2);let version=result.version;if(!version)return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"not_found",message:"Version not found.",next:[{command:withGlobalFlags(client,"routes list-versions")}]}),process.exit(1),1):(output_manager_default.error("Version not found."),1);if(version.isLive){let liveMsg=`Version ${version.id.slice(0,12)} is currently live. You cannot restore the live version. Run ${withGlobalFlags(client,"routes list-versions")} to see previous versions you can restore.`;return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"invalid_arguments",message:liveMsg,next:[{command:withGlobalFlags(client,"routes list-versions")}]}),process.exit(1),2):(output_manager_default.error(`Version ${import_chalk.default.bold(version.id.slice(0,12))} is currently live. You cannot restore the live version.
|
|
8
|
-
Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list-versions"))} to see previous versions you can restore.`),2)}if(version.isStaging){let stagingMsg=`Version ${version.id.slice(0,12)} is staged. Use ${withGlobalFlags(client,"routes publish")} to publish it instead.`;return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"invalid_arguments",message:stagingMsg,next:[{command:withGlobalFlags(client,"routes publish --yes")}]}),process.exit(1),2):(output_manager_default.error(`Version ${import_chalk.default.bold(version.id.slice(0,12))} is staged. Use ${import_chalk.default.cyan(withGlobalFlags(client,"routes publish"))} to publish it instead.`),2)}output_manager_default.spinner("Fetching changes");let{routes:diffRoutes}=await getRoutes(client,project.id,{teamId,versionId:version.id,diff:!0}),changedRoutes=diffRoutes.filter(r=>r.action!==void 0);if(changedRoutes.length>0?(output_manager_default.print(`
|
|
9
|
-
${import_chalk.default.bold("Changes to be restored:")}
|
|
10
|
-
|
|
11
|
-
`),printDiffSummary(changedRoutes),output_manager_default.print(`
|
|
12
|
-
`)):output_manager_default.print(`
|
|
13
|
-
${import_chalk.default.gray("No changes detected from current production version.")}
|
|
14
|
-
|
|
15
|
-
`),!await confirmAction(client,parsed.flags["--yes"],`Restore version ${import_chalk.default.bold(version.id.slice(0,12))} to production?`,`This will replace the current live routes for ${import_chalk.default.bold(project.name)}.`))return output_manager_default.log("Canceled"),0;let updateStamp=stamp_default();output_manager_default.spinner(`Restoring version ${import_chalk.default.bold(version.id.slice(0,12))}`);try{let{version:newVersion}=await updateRouteVersion(client,project.id,version.id,"restore",{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Success!")} Version ${import_chalk.default.bold(newVersion.id.slice(0,12))} restored to production ${import_chalk.default.gray(updateStamp())}`),newVersion.ruleCount!==void 0&&output_manager_default.print(` ${import_chalk.default.bold("Active routes:")} ${newVersion.ruleCount}
|
|
16
|
-
`),0}catch(e){let msg=e.message||"Failed to restore version";return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"api_error",message:msg,next:[{command:withGlobalFlags(client,`routes restore ${versionIdentifier} --yes`)}]}),process.exit(1),1):(output_manager_default.error(msg),1)}}export{restore as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
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{printRuleDeletionReceipt,printRuleMutationReceipt,printRulePreview}from"./chunk-TAAV7L3T.js";import"./chunk-RRWEIG6B.js";import{emitRulesArgParseError,fetchRule,handleRulesApiError,outputRulesError,resolveRulesTeam,rulesItemPath}from"./chunk-MS576PZ7.js";import"./chunk-UPXIQO57.js";import"./chunk-HRR57QNP.js";import"./chunk-GZNDA6SV.js";import"./chunk-WH3SHWVK.js";import"./chunk-PFD7LETF.js";import"./chunk-GHAY4PSD.js";import"./chunk-MHQ2MW2B.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import"./chunk-ID663OJ7.js";import{rulesRmSubcommand}from"./chunk-LU5O3NH7.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_REASON,buildCommandWithYes,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";async function rm(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesRmSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules rm <rule-id> --yes"),printError(error),2}let format=validateJsonOutput(parsedArgs.flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);let ruleId=parsedArgs.args[0];if(!ruleId)return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS",`Missing rule ID. Example: ${packageName} alerts rules rm <rule-id> --yes`);let scope=await resolveRulesTeam(client,format.jsonOutput);if(typeof scope=="number")return scope;let skipConfirmation=!!parsedArgs.flags["--yes"],prefetchedRule;try{return!skipConfirmation&&(output_manager_default.spinner("Fetching alert rule\u2026"),prefetchedRule=await fetchRule(client,scope,ruleId),output_manager_default.stopSpinner(),printRulePreview(prefetchedRule),outputAgentError(client,{status:"error",reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Removing an alert rule requires confirmation. Re-run with --yes.",next:[{command:buildCommandWithYes(client.argv)}]},1),!await client.input.confirm(`Delete alert rule ${prefetchedRule.name} (${ruleId})? This cannot be undone.`,!1))?(output_manager_default.log("Canceled"),0):(output_manager_default.spinner("Deleting alert rule\u2026"),await client.fetch(rulesItemPath(scope.teamId,ruleId),{method:"DELETE"}),format.jsonOutput?client.stdout.write(`${JSON.stringify({ok:!0,ruleId,deleted:!0},null,2)}
|
|
8
|
-
`):prefetchedRule?printRuleMutationReceipt("Deleted",prefetchedRule,client.argv):printRuleDeletionReceipt(ruleId),0)}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{output_manager_default.stopSpinner()}}export{rm as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
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{imagePath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,handleVcrApiError,requireVcrRepositoryAndImageId,resolveVcrScope,validateVcrJsonOutput}from"./chunk-QCG6Q33G.js";import"./chunk-WH3SHWVK.js";import"./chunk-GSOPJJO5.js";import{imageRmSubcommand}from"./chunk-AG5QQNJ3.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-WDJFZM7U.js";import{AGENT_REASON,buildCommandWithYes,outputAgentError}from"./chunk-5DXCVG5U.js";import"./chunk-D4MW3RDW.js";import"./chunk-67N2NJCF.js";import"./chunk-HMS3UIQ2.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-VKXEOL4K.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-R4VVQRLX.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-IOJYYPUF.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";async function rm(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(imageRmSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr image rm <repository> <imageId> --project <name-or-id>"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],imageId=parsedArgs.args[1],project=parsedArgs.flags["--project"],skipConfirmation=!!parsedArgs.flags["--yes"];telemetry.trackCliOptionProject(project),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);let missingArgs=requireVcrRepositoryAndImageId(client,repository,imageId,fr.jsonOutput,"vcr image rm <repository> <imageId>");if(typeof missingArgs=="number")return missingArgs;let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;if(!skipConfirmation&&(outputAgentError(client,{status:"error",reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Deleting an image is permanent. Re-run with --yes.",next:[{command:buildCommandWithYes(client.argv)}]},1),!await client.input.confirm(`Delete image ${imageId} from ${repository}? This cannot be undone.`,!1)))return output_manager_default.log("Canceled"),0;let path=imagePath(scope,repository,imageId);output_manager_default.spinner("Deleting image...");try{return await client.fetch(path,{method:"DELETE"}),fr.jsonOutput?client.stdout.write(`${JSON.stringify({imageId,repository,deleted:!0},null,2)}
|
|
8
|
-
`):output_manager_default.success(`Image ${imageId} deleted`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput);throw err}finally{output_manager_default.stopSpinner()}}export{rm as default};
|