vercel 63.0.1 → 63.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-QKGWNVQS.js → add-CCFBYKZH.js} +1 -1
- package/dist/chunks/{add-BODUK747.js → add-FNCCXJZO.js} +1 -1
- package/dist/chunks/{add-ZLY3DE35.js → add-LU5TSLJU.js} +1 -1
- package/dist/chunks/{build-SD6SLRK7.js → build-PUIFBQKZ.js} +1 -1
- package/dist/chunks/{chunk-MEJTHWZB.js → chunk-36EFWYTN.js} +1 -1
- package/dist/chunks/{chunk-JUSQYKFF.js → chunk-3TJDVDDJ.js} +1 -1
- package/dist/chunks/{chunk-QW2UP4W4.js → chunk-3YQVBYQD.js} +1 -1
- package/dist/chunks/{chunk-7D2HVBVP.js → chunk-5O2CW3SX.js} +1 -1
- package/dist/chunks/chunk-5YQP44VL.js +10 -0
- package/dist/chunks/{chunk-KNBEUC4P.js → chunk-6BE4D57F.js} +1 -1
- package/dist/chunks/{chunk-HJ3NY4UA.js → chunk-6LXX5P3A.js} +1 -1
- package/dist/chunks/{chunk-64U5W6GU.js → chunk-6OUBLFZ2.js} +1 -1
- package/dist/chunks/{chunk-YLTCVZOL.js → chunk-6TEFVB2U.js} +1 -1
- package/dist/chunks/{chunk-3AF3TTCR.js → chunk-7SGM233C.js} +1 -1
- package/dist/chunks/{chunk-PSBBSY46.js → chunk-A6RRKSD3.js} +1 -1
- package/dist/chunks/{chunk-ESMQCFCX.js → chunk-AHSMFZWH.js} +1 -1
- package/dist/chunks/{chunk-TKA7PPGY.js → chunk-BIFAR2CO.js} +1 -1
- package/dist/chunks/{chunk-X3JK3SQ2.js → chunk-D7KEDMBF.js} +1 -1
- package/dist/chunks/{chunk-6LRVRPYO.js → chunk-E6UKNYFF.js} +1 -1
- package/dist/chunks/{chunk-NZBUIMZG.js → chunk-EDVP7QUI.js} +1 -1
- package/dist/chunks/{chunk-WF5YVWWY.js → chunk-FU7KGU6V.js} +1 -1
- package/dist/chunks/{chunk-IYL5CKZ4.js → chunk-GAG42XNF.js} +1 -1
- package/dist/chunks/{chunk-DZ6GORJ7.js → chunk-HWYHRPWP.js} +1 -1
- package/dist/chunks/{chunk-UTW2FDSC.js → chunk-I3D36ZLJ.js} +1 -1
- package/dist/chunks/{chunk-KTNRWBHM.js → chunk-I7FGFRN3.js} +1 -1
- package/dist/chunks/{chunk-MA4K5IWW.js → chunk-IFNTXDX2.js} +1 -1
- package/dist/chunks/{chunk-JTAAWOJS.js → chunk-IMC63GXI.js} +1 -1
- package/dist/chunks/{chunk-VIBUYIZ3.js → chunk-J2LAZELI.js} +1 -1
- package/dist/chunks/{chunk-SY4EANZH.js → chunk-JORUFFOD.js} +3 -3
- package/dist/chunks/{chunk-4A5SGLIH.js → chunk-JYFYL3ON.js} +1 -1
- package/dist/chunks/{chunk-IAUAFUO2.js → chunk-K5GYV5CW.js} +1 -1
- package/dist/chunks/{chunk-B3PZ3I4Z.js → chunk-KCQERNQX.js} +1 -1
- package/dist/chunks/{chunk-QZRZ6ECD.js → chunk-KG3OGJ3U.js} +1 -1
- package/dist/chunks/{chunk-2H243SJV.js → chunk-MSH7V3FL.js} +1 -1
- package/dist/chunks/{chunk-VNSQCAVT.js → chunk-MT4MO7DT.js} +1 -1
- package/dist/chunks/{chunk-XJOOPPSQ.js → chunk-NUITF4GR.js} +1 -1
- package/dist/chunks/chunk-OB5XGIDM.js +9 -0
- package/dist/chunks/{chunk-25S4PQNK.js → chunk-OPVNMCAF.js} +1 -1
- package/dist/chunks/{chunk-AZ76R3LW.js → chunk-PLG4UIV4.js} +1 -1
- package/dist/chunks/{chunk-CRO7VQWK.js → chunk-PR7SYJVT.js} +1 -1
- package/dist/chunks/{chunk-2WYDLP7X.js → chunk-R6OWQQMZ.js} +1 -1
- package/dist/chunks/{chunk-SSEVYTJ7.js → chunk-RIPCUZO6.js} +1 -1
- package/dist/chunks/{chunk-VJEQAITW.js → chunk-RV77ZW7T.js} +1 -1
- package/dist/chunks/{chunk-V2BKSCXI.js → chunk-SKTP7MSL.js} +1 -1
- package/dist/chunks/{chunk-MYMM34ZH.js → chunk-SWJYZETA.js} +4 -4
- package/dist/chunks/{chunk-BZYQ6RFV.js → chunk-SYEKOJHT.js} +1 -1
- package/dist/chunks/{chunk-VOB4W7DO.js → chunk-SZRSBECO.js} +1 -1
- package/dist/chunks/{chunk-2LGNEOKV.js → chunk-T3PAZMDW.js} +1 -1
- package/dist/chunks/{chunk-V336CYEI.js → chunk-T6GXMIXO.js} +1 -1
- package/dist/chunks/{chunk-HUJPGK7W.js → chunk-TNZMCRAP.js} +1 -1
- package/dist/chunks/chunk-TUJ3WXOZ.js +7 -0
- package/dist/chunks/{chunk-BRUTDRAQ.js → chunk-VLSSMFTF.js} +1 -1
- package/dist/chunks/{chunk-VSE5BAPP.js → chunk-WPQN5UKR.js} +1 -1
- package/dist/chunks/{chunk-3DMY3OJR.js → chunk-X5GP2FBT.js} +1 -1
- package/dist/chunks/{chunk-AUZEOUZU.js → chunk-XKDY4OFQ.js} +1 -1
- package/dist/chunks/{chunk-H7LHZZKU.js → chunk-Y35RMGOU.js} +1 -1
- package/dist/chunks/{chunk-AZULOP7M.js → chunk-YIIPBH2D.js} +2 -2
- package/dist/chunks/{chunk-T6SFC3IH.js → chunk-Z6HYEIYV.js} +1 -1
- package/dist/chunks/{chunk-BWY67LI6.js → chunk-ZH4DW3T3.js} +1 -1
- package/dist/chunks/{chunk-T76ITV65.js → chunk-ZQBMRI57.js} +2 -2
- package/dist/chunks/{clear-PYDGQBSS.js → clear-E6TSPA67.js} +1 -1
- package/dist/chunks/{compile-vercel-config-KWSIFONF.js → compile-vercel-config-2HBWORW5.js} +1 -1
- package/dist/chunks/{config-Y3JEZPVK.js → config-MTH57FUD.js} +1 -1
- package/dist/chunks/{config-6TQFY5DN.js → config-NWNQSZNZ.js} +1 -1
- package/dist/chunks/{connect-git-provider-HW23GK35.js → connect-git-provider-VJYXBRYG.js} +1 -1
- package/dist/chunks/{delete-ZISJ7HIW.js → delete-MZ4LAS3L.js} +1 -1
- package/dist/chunks/{delete-HAOLSE35.js → delete-NIPKCWUT.js} +1 -1
- package/dist/chunks/{detect-services-22KZAGH2.js → detect-services-5CVG24CL.js} +1 -1
- package/dist/chunks/{disable-ZCEEK2BD.js → disable-YZATFLNR.js} +1 -1
- package/dist/chunks/{discard-VHO5BXYN.js → discard-B5IFVCDR.js} +1 -1
- package/dist/chunks/{edit-ZPNWEZWU.js → edit-3PKYF5FY.js} +1 -1
- package/dist/chunks/{edit-JRYFZ5N5.js → edit-EDTBD7PX.js} +1 -1
- package/dist/chunks/{enable-USQVAN4K.js → enable-AKGADEKU.js} +1 -1
- package/dist/chunks/{export-H7YV6NVF.js → export-NKCN63SF.js} +1 -1
- package/dist/chunks/{future-PHRPWAVY.js → future-AQR2QP74.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-WLYVWTBG.js → generate-cert-for-deploy-UNRGDROB.js} +1 -1
- package/dist/chunks/{image-6KIQRC65.js → image-IQJVHHAW.js} +1 -1
- package/dist/chunks/{import-builders-YAC6UE33.js → import-builders-4K4WE66I.js} +1 -1
- package/dist/chunks/{inspect-MRJ6JO7M.js → inspect-2UUTLI4H.js} +1 -1
- package/dist/chunks/{inspect-BQELJ5EI.js → inspect-4DASZGPR.js} +1 -1
- package/dist/chunks/{inspect-HJQWRFHR.js → inspect-FVB5P54P.js} +1 -1
- package/dist/chunks/{inspect-SEGNEPGI.js → inspect-GKZFZINR.js} +1 -1
- package/dist/chunks/{inspect-DWOQ6566.js → inspect-IU2VMHWZ.js} +1 -1
- package/dist/chunks/{list-S2XKQMNX.js → list-5LMFTD7U.js} +1 -1
- package/dist/chunks/{list-HS54LLJ5.js → list-OYT6T3TA.js} +1 -1
- package/dist/chunks/{list-OCU47YHP.js → list-TL7VBVR5.js} +1 -1
- package/dist/chunks/{login-SKAMFH7S.js → login-PFAKA6JO.js} +1 -1
- package/dist/chunks/{login-K6VYVJPS.js → login-UWL7N6ZS.js} +1 -1
- package/dist/chunks/{logs-KZSKOQUN.js → logs-4FOJKWAW.js} +1 -1
- package/dist/chunks/{ls-ZYM3DQXI.js → ls-6TRT3UFZ.js} +1 -1
- package/dist/chunks/{ls-LBBI45ZT.js → ls-B3D7XA2S.js} +1 -1
- package/dist/chunks/{ls-G5NTVYUB.js → ls-H7YO6MS5.js} +1 -1
- package/dist/chunks/{ls-NUM6IQL6.js → ls-SJDE4U7I.js} +1 -1
- package/dist/chunks/{ls-TE7BAMHR.js → ls-SXE2THDP.js} +1 -1
- package/dist/chunks/{ls-DTEGGHQA.js → ls-VFV23YCF.js} +1 -1
- package/dist/chunks/{ls-LCY7BHOP.js → ls-VNOGQ64O.js} +1 -1
- package/dist/chunks/{mutate-BAFVNNRU.js → mutate-IGC37SCR.js} +1 -1
- package/dist/chunks/{notifications-3EB3ZEU3.js → notifications-47EDEA5C.js} +1 -1
- package/dist/chunks/{open-J4X5KJ6A.js → open-NP444BUR.js} +1 -1
- package/dist/chunks/{openapi-C5BHMHWS.js → openapi-LW24FRTC.js} +1 -1
- package/dist/chunks/{permissions-JMFKPIO4.js → permissions-CP57O3II.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-VS3ZJSCQ.js → prompt-missing-credentials-C3OIQONK.js} +1 -1
- package/dist/chunks/{publish-WWI5HOAL.js → publish-5TK3IVYM.js} +1 -1
- package/dist/chunks/{pull-MTQAMT4L.js → pull-FCQKXYBD.js} +1 -1
- package/dist/chunks/{purchase-domain-if-available-ZIIAF7CC.js → purchase-domain-if-available-QBDRKJZ5.js} +1 -1
- package/dist/chunks/{push-PBKUSKXQ.js → push-SIR5XTJN.js} +1 -1
- package/dist/chunks/{query-5VGUVE2A.js → query-IEBWCCMJ.js} +1 -1
- package/dist/chunks/{reauthenticate-UGBXSWZE.js → reauthenticate-XSNRCXPC.js} +1 -1
- package/dist/chunks/{reorder-S2ZJML5K.js → reorder-TPLZXSRB.js} +1 -1
- package/dist/chunks/{reply-3GFULOMZ.js → reply-BCDQQ6I2.js} +1 -1
- package/dist/chunks/{resolve-USEBSFUT.js → resolve-VKJAE7KO.js} +1 -1
- package/dist/chunks/{restore-JD7IGDTY.js → restore-TZAXCNLL.js} +1 -1
- package/dist/chunks/{rm-ARMNSPGQ.js → rm-53HZ5XOQ.js} +1 -1
- package/dist/chunks/{rm-RHRKS7XG.js → rm-A2NTZ4EJ.js} +1 -1
- package/dist/chunks/{rm-BYOBKSWY.js → rm-DPVWWH4Q.js} +1 -1
- package/dist/chunks/{rm-EQYVIFNX.js → rm-TTZBAVUG.js} +1 -1
- package/dist/chunks/{rm-3V47KPK6.js → rm-V4M46PRZ.js} +1 -1
- package/dist/chunks/{routes-NID5V7EJ.js → routes-PKCKZ5T6.js} +1 -1
- package/dist/chunks/{rule-inspect-5DZ7OXGE.js → rule-inspect-5QXLEJZA.js} +1 -1
- package/dist/chunks/{rules-CM2ARIWZ.js → rules-2SBYOL6R.js} +1 -1
- package/dist/chunks/{schema-V75RRXXF.js → schema-OGGOD3HX.js} +1 -1
- package/dist/chunks/{schema-SZUKDSY2.js → schema-PGGJZ2AT.js} +1 -1
- package/dist/chunks/{select-org-SH4JT6RI.js → select-org-VBP5DCYP.js} +1 -1
- package/dist/chunks/{set-LY4YI5FZ.js → set-6BCSH3I3.js} +1 -1
- package/dist/chunks/{setup-and-link-MWLALWAS.js → setup-and-link-FPGTZUH6.js} +1 -1
- package/dist/chunks/{tags-P5GB7HTF.js → tags-77REB4BF.js} +1 -1
- package/dist/chunks/{types-OC7OTQNK.js → types-4C5N66YA.js} +1 -1
- package/dist/chunks/{update-SOD622HT.js → update-7BNVIJWB.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +5 -5
- package/dist/commands/dev/index.js +2 -2
- 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 +48 -36
- package/dist/index.js +2 -2
- package/dist/internal-build.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +14 -14
- package/dist/chunks/chunk-5RR3435W.js +0 -10
- package/dist/chunks/chunk-U5C6XOLA.js +0 -9
- package/dist/chunks/chunk-W6LNIG5O.js +0 -7
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_format}from"./chunk-PFD7LETF.js";import{events_default,require_jsonlines}from"./chunk-
|
|
7
|
+
import{require_format}from"./chunk-PFD7LETF.js";import{events_default,require_jsonlines}from"./chunk-X5GP2FBT.js";import{CommandTimeout}from"./chunk-AMDHTZDV.js";import{require_strip_ansi}from"./chunk-BS32OUOC.js";import{require_ms}from"./chunk-MXTC4ZAQ.js";import{toNodeReadable}from"./chunk-MY4MONOH.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_split2=__commonJS({"../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports,module){"use strict";var{Transform}=__require("stream"),{StringDecoder}=__require("string_decoder"),kLast=Symbol("last"),kDecoder=Symbol("decoder");function transform(chunk,enc,cb){let list;if(this.overflow){if(list=this[kDecoder].write(chunk).split(this.matcher),list.length===1)return cb();list.shift(),this.overflow=!1}else this[kLast]+=this[kDecoder].write(chunk),list=this[kLast].split(this.matcher);this[kLast]=list.pop();for(let i=0;i<list.length;i++)try{push(this,this.mapper(list[i]))}catch(error){return cb(error)}if(this.overflow=this[kLast].length>this.maxLength,this.overflow&&!this.skipOverflow){cb(new Error("maximum buffer reached"));return}cb()}function flush(cb){if(this[kLast]+=this[kDecoder].end(),this[kLast])try{push(this,this.mapper(this[kLast]))}catch(error){return cb(error)}cb()}function push(self,val){val!==void 0&&self.push(val)}function noop(incoming){return incoming}function split2(matcher,mapper,options){switch(matcher=matcher||/\r?\n/,mapper=mapper||noop,options=options||{},arguments.length){case 1:typeof matcher=="function"?(mapper=matcher,matcher=/\r?\n/):typeof matcher=="object"&&!(matcher instanceof RegExp)&&!matcher[Symbol.split]&&(options=matcher,matcher=/\r?\n/);break;case 2:typeof matcher=="function"?(options=mapper,mapper=matcher,matcher=/\r?\n/):typeof mapper=="object"&&(options=mapper,mapper=noop)}options=Object.assign({},options),options.autoDestroy=!0,options.transform=transform,options.flush=flush,options.readableObjectMode=!0;let stream=new Transform(options);return stream[kLast]="",stream[kDecoder]=new StringDecoder("utf8"),stream.matcher=matcher,stream.mapper=mapper,stream.maxLength=options.maxLength,stream.skipOverflow=options.skipOverflow||!1,stream.overflow=!1,stream._destroy=function(err,cb){this._writableState.errorEmitted=!1,cb(err)},stream}module.exports=split2}});var import_chalk=__toESM(require_source(),1),import_format=__toESM(require_format(),1),import_ms=__toESM(require_ms(),1),import_jsonlines=__toESM(require_jsonlines(),1),import_split2=__toESM(require_split2(),1);import{URLSearchParams}from"url";var import_strip_ansi=__toESM(require_strip_ansi(),1);function displayBuildLogs(client,deployment,follow=!0,onAliasAssigned){let abortController=new AbortController;return{promise:events_default(client,deployment.id,{mode:"logs",onEvent:event=>printBuildLog(event,output_manager_default.print),onAliasAssigned,quiet:!1,findOpts:{direction:"forward",follow}},abortController),abortController}}function collectBuildLogs(client,deployment,follow=!0){let logs=[],abortController=new AbortController;return{promise:events_default(client,deployment.id,{mode:"logs",onEvent:event=>{event.created&&logs.push(event)},quiet:!0,findOpts:{direction:"forward",follow}},abortController).then(()=>logs),abortController}}async function displayBuildLogsUntilFinalError(client,deployment,error){let abortController=new AbortController;return events_default(client,deployment.id,{mode:"logs",onEvent:event=>{printBuildLog(event,output_manager_default.print),event.level==="error"&&event.text?.includes(error)&&abortController.abort()},quiet:!1,findOpts:{direction:"forward",follow:!0}},abortController)}var runtimeLogSpinnerMessage="waiting for new logs...";async function displayRuntimeLogs(client,options,abortController){let{log,debug,print,spinner,stopSpinner,warn}=output_manager_default,{projectId,deploymentId,parse}=options,query=new URLSearchParams({format:"lines"}),url=`/v1/projects/${projectId}/deployments/${deploymentId}/runtime-logs?${query}`;spinner(runtimeLogSpinnerMessage);let timeout=setTimeout(()=>{abortController.abort(),warn(`${import_chalk.default.bold(`Command automatically interrupted after ${CommandTimeout}.`)}
|
|
8
8
|
`)},(0,import_ms.default)(CommandTimeout)),response=await client.fetch(url,{json:!1,signal:abortController.signal,retry:{retries:3,onRetry:err=>{if(log(`Runtime logs error: ${err.message}`),!(err instanceof Error&&err.name==="AbortError"))throw err}}});return new Promise((resolve,reject)=>{let readable=toNodeReadable(response.body),stream=readable.pipe(parse?import_jsonlines.default.parse():(0,import_split2.default)()),finished=!1,errored=!1;function finish(err){finished||(clearTimeout(timeout),stopSpinner(),finished=!0,err?reject(err):resolve(abortController.signal.aborted?1:0))}let handleData=data=>{let log2=parse?data:JSON.parse(data);if(stopSpinner(),isRuntimeLimitDelimiter(log2)){abortController.abort(),warn(`${import_chalk.default.bold(log2.message)}
|
|
9
9
|
`);return}parse?prettyPrintLogline(log2,print):printRawLogLine(data,client),spinner(runtimeLogSpinnerMessage)},handleError=err=>{if(!(finished||errored)){if(err.name==="AbortError"){finish();return}stream.destroy(),errored=!0,debug(`Runtime logs stream error: ${err.message??err}`),setTimeout(()=>{abortController.signal.aborted||displayRuntimeLogs(client,options,abortController).then(resolve,reject)},2e3)}};stream.on("end",finish),stream.on("data",handleData),stream.on("error",handleError),readable.on("error",handleError)})}function printBuildLog(log,print){if(!log.created)return;let date=new Date(log.created).toISOString(),cleanText=parseLogLines(log).join(`
|
|
10
10
|
`);for(let line of colorize(cleanText,log).split(`
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{buildCommandWithGlobalFlags}from"./chunk-
|
|
7
|
+
import{buildCommandWithGlobalFlags}from"./chunk-5YQP44VL.js";import{quoteArg}from"./chunk-BKV35LVB.js";import{printAlignedLabel}from"./chunk-N7Q2IESO.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var CRITICAL_DELIVERY_DESCRIPTION="Critical only (escalated by Vercel Agent)";function formatMinimumSeverity(notification){let level=notification.minimumSeverityLevel;return level==="critical"?CRITICAL_DELIVERY_DESCRIPTION:level?`${level[0].toUpperCase()}${level.slice(1)} and above`:notification.type==="webhook"&&!("url"in notification.webhook)?"Details unavailable":"Rule setting"}function formatProjectScope(scope){return scope.type==="all"?"all projects":`${scope.projectName} (${scope.projectId})`}function formatNotificationExpanded(notification,index){if(notification.type==="slack")return[` ${index+1}. ${import_chalk.default.bold("Slack")} ${import_chalk.default.cyan(`#${notification.channelName}`)}`,` ${import_chalk.default.dim("Project scope:")} ${formatProjectScope(notification.projectScope)}`,` ${import_chalk.default.dim("Channel ID:")} ${notification.channelId}`,` ${import_chalk.default.dim("Slack installation ID:")} ${notification.configId}`,` ${import_chalk.default.dim("Minimum severity:")} ${formatMinimumSeverity(notification)}`].join(`
|
|
8
8
|
`);let{webhook}=notification;return[` ${index+1}. ${import_chalk.default.bold("Webhook")}`,` ${import_chalk.default.dim("Webhook ID:")} ${webhook.id}`,` ${import_chalk.default.dim("URL:")} ${"url"in webhook?webhook.url:"Details unavailable"}`,` ${import_chalk.default.dim("Minimum severity:")} ${formatMinimumSeverity(notification)}`].join(`
|
|
9
9
|
`)}function formatRuleExpanded(ruleId,notifications){let lines=[` ${import_chalk.default.bold(ruleId)}`];return notifications.length===0?lines.push(` ${import_chalk.default.dim("No notification destinations")}`):lines.push(notifications.map((notification,index)=>formatNotificationExpanded(notification,index)).join(`
|
|
10
10
|
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{RULE_ENVIRONMENTS}from"./chunk-UFXKCETS.js";import{AGENT_STATUS}from"./chunk-
|
|
7
|
+
import{RULE_ENVIRONMENTS}from"./chunk-UFXKCETS.js";import{AGENT_STATUS}from"./chunk-5YQP44VL.js";function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
|
|
8
8
|
`);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
|
|
9
9
|
`)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{type:"head_sampling",rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readTracingConfig({client,teamId,projectId,projectName}){let config=await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId}),sampling=config.enabled&&config.sampling.length===0?[{type:"head_sampling",rate:1}]:config.sampling;return{project:{id:projectId,name:projectName},enabled:config.enabled,entries:sampling.map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,rules}){await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId,method:"PUT",body:{enabled:rules.length>0,...rules.length>0?{sampling:rules}:{}}})}export{writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,hasSameKey,readTracingConfig,writeSamplingRules};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{outputError}from"./chunk-WH3SHWVK.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-
|
|
7
|
+
import{outputError}from"./chunk-WH3SHWVK.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-5YQP44VL.js";import{getScope}from"./chunk-HWYHRPWP.js";import{getLinkedProject,getProjectByNameOrId}from"./chunk-SWJYZETA.js";import{ProjectNotFound,isAPIError}from"./chunk-YIIPBH2D.js";function emitAlertsScopeError(client,jsonOutput,code,message,agent){return outputAgentError(client,{status:"error",reason:agent.reason,message,hint:agent.hint,next:agent.next},1),outputError(client,jsonOutput,code,message)}async function resolveAlertsScope(client,opts){let command=opts.command??"alerts",projectCommand=`${command} --project <name_or_id>`,allCommand=`${command} --all`;if(opts.all||opts.project){let{team}=await getScope(client);if(!team){let msg="No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory.";return emitAlertsScopeError(client,opts.jsonOutput,"NO_TEAM",msg,{reason:AGENT_REASON.MISSING_SCOPE,hint:"Select a team scope before using --project or --all with alerts.",next:[{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"},{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Switch to a team that owns the project"}]})}if(opts.all)return{teamId:team.id};let projectResult;try{projectResult=await getProjectByNameOrId(client,opts.project,team.id)}catch(err){if(isAPIError(err)){let msg=err.serverMessage||(err.status===403?`You do not have permission to access project "${opts.project}" in team "${team.slug}".`:`API error (${err.status}).`),reason=err.status===401?"not_authorized":err.status===403?"forbidden":AGENT_REASON.API_ERROR;return emitAlertsScopeError(client,opts.jsonOutput,err.code||"API_ERROR",msg,{reason,next:[{command:buildCommandWithGlobalFlags(client.argv,projectCommand),when:"Retry with a project you can access (replace <name_or_id>)"}]})}throw err}if(projectResult instanceof ProjectNotFound){let msg=`Project "${opts.project}" was not found in team "${team.slug}".`;return emitAlertsScopeError(client,opts.jsonOutput,"PROJECT_NOT_FOUND",msg,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,projectCommand),when:"Retry with a valid project (replace <name_or_id>)"}]})}return{teamId:team.id,projectId:projectResult.id,projectName:projectResult.name}}let linkedProject=await getLinkedProject(client);if(linkedProject.status==="error")return linkedProject.exitCode;if(linkedProject.status==="not_linked"){let msg="No linked project found. Run `vercel link` to link a project, or use --project <name> or --all.";return emitAlertsScopeError(client,opts.jsonOutput,"NOT_LINKED",msg,{reason:AGENT_REASON.NOT_LINKED,hint:"Agents should pass --project or --all when no .vercel link exists in --cwd.",next:[{command:buildCommandWithGlobalFlags(client.argv,"link"),when:"Link this directory to a Vercel project"},{command:buildCommandWithGlobalFlags(client.argv,projectCommand),when:"Retry with an explicit project (replace <name_or_id>)"},{command:buildCommandWithGlobalFlags(client.argv,allCommand),when:"Use team-wide scope without a linked project"}]})}return{teamId:linkedProject.org.id,projectId:linkedProject.project.id,projectName:linkedProject.project.name}}export{emitAlertsScopeError,resolveAlertsScope};
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-
|
|
7
|
+
import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-R6OWQQMZ.js";import{getExitCodeForErrorCode,handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-WH3SHWVK.js";import{isJSONObject}from"./chunk-JORUFFOD.js";import{AGENT_REASON,buildCommandWithGlobalFlags,getExitCodeForReason,outputAgentError}from"./chunk-5YQP44VL.js";import{getScope}from"./chunk-HWYHRPWP.js";import{getProjectByNameOrId}from"./chunk-SWJYZETA.js";import{ProjectNotFound,isAPIError}from"./chunk-YIIPBH2D.js";import{output_manager_default}from"./chunk-75IAMKGV.js";async function resolveRulesTeam(client,jsonOutput){let{team}=await getScope(client,{resolveLocalScope:!0});return team?{teamId:team.id}:emitAlertsScopeError(client,jsonOutput,"NO_TEAM","No team context found. Run `vercel switch` to select a team, use `--scope <team>`, or link a team project.",{reason:AGENT_REASON.MISSING_SCOPE,hint:"Alert rules belong to a team. Select the team before retrying.",next:[{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Select a team"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Inspect the current scope"}]})}async function resolveRulesProject(client,projectNameOrId,jsonOutput,command){let teamScope=await resolveRulesTeam(client,jsonOutput);if(typeof teamScope=="number")return teamScope;try{let project=await getProjectByNameOrId(client,projectNameOrId,teamScope.teamId);return project instanceof ProjectNotFound?emitAlertsScopeError(client,jsonOutput,"PROJECT_NOT_FOUND",`Project "${projectNameOrId}" was not found in the selected team.`,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,`${command} --project <name_or_id>`),when:"Retry with a valid project"}]}):{...teamScope,projectId:project.id,projectName:project.name}}catch(error){if(!isAPIError(error))throw error;return emitAlertsScopeError(client,jsonOutput,error.code||"API_ERROR",error.serverMessage||`API error (${error.status}).`,{reason:error.status===401?"not_authorized":error.status===403?"forbidden":AGENT_REASON.API_ERROR})}}async function parseRulesFlagsAndScope(client,flags,jsonOutput,command="alerts rules ls"){let mutual=validateAllProjectMutualExclusivity(flags["--all"],flags["--project"]);if(!mutual.valid)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:mutual.message,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts rules --help"),when:"Use either `--project` or `--all`, not both"}]},2),handleValidationError(mutual,jsonOutput,client);if(flags["--all"])return resolveRulesTeam(client,jsonOutput);if(flags["--project"])return resolveRulesProject(client,flags["--project"],jsonOutput,command);let linkedScope=await resolveAlertsScope(client,{jsonOutput,command});if(typeof linkedScope=="number")return linkedScope;let teamScope=await resolveRulesTeam(client,jsonOutput);return typeof teamScope=="number"?teamScope:linkedScope.teamId===teamScope.teamId?linkedScope:teamScope}import{readFileSync}from"fs";import{resolve}from"path";function rulesCollectionPath(teamId,options={}){let query=new URLSearchParams({teamId});return options.limit!==void 0&&query.set("limit",String(options.limit)),options.cursor&&query.set("cursor",options.cursor),options.projectId&&query.set("projectId",options.projectId),options.type&&query.set("type",options.type),`/alerts/v3/alert-rules?${query.toString()}`}function rulesItemPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`}function ruleNotificationsPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}/notifications?${query.toString()}`}function rulesNotificationsPath(teamId,options={}){let query=new URLSearchParams({teamId});return options.limit!==void 0&&query.set("limit",String(options.limit)),options.cursor&&query.set("cursor",options.cursor),`/alerts/v3/alert-rules/notifications?${query.toString()}`}function rulesNotificationLinksPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}/notifications/links?${query.toString()}`}function rulesSchemaPath(teamId,type){let query=new URLSearchParams({teamId});return type&&query.set("type",type),`/alerts/v3/alert-rules/schema?${query.toString()}`}async function fetchRule(client,scope,ruleId){return(await client.fetch(rulesItemPath(scope.teamId,ruleId))).rule}function getIssues(error){return Array.isArray(error.issues)?error.issues.filter(issue=>isJSONObject(issue)&&typeof issue.path=="string"&&typeof issue.message=="string"):[]}function outputRulesError(client,jsonOutput,code,message,options={}){let issues=options.issues??[],issueSummary=issues.slice(0,5).map(issue=>`${issue.path||"body"}: ${issue.message}`).join("; "),exitCode=options.reason!==void 0?getExitCodeForReason(options.reason):getExitCodeForErrorCode(code);return outputAgentError(client,{status:"error",reason:options.reason??AGENT_REASON.INVALID_ARGUMENTS,message,hint:options.hint??(issueSummary||void 0)},exitCode),jsonOutput?client.stdout.write(`${JSON.stringify({error:{code,message,...issues.length?{issues}:{}}},null,2)}
|
|
8
8
|
`):output_manager_default.fatal([message,...issues.map(issue=>` ${issue.path}: ${issue.message}`)].join(`
|
|
9
9
|
`)),exitCode}function handleRulesApiError(client,err,jsonOutput){let message=err.status===401?"You do not have access to alert rules in this team. Ensure your role can manage Alert Rules, or pass --token and --scope.":err.status===403?err.serverMessage||"You do not have permission to manage alert rules in this team.":err.status>=500?`The alert rules endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`:err.serverMessage||`API error (${err.status}).`;return outputRulesError(client,jsonOutput,err.code||"API_ERROR",message,{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,issues:getIssues(err),hint:err.status===401||err.status===403?"Confirm the team with `vercel whoami`; use --scope <team-slug> if the rule belongs to another team.":void 0})}var LEGACY_BODY_FIELDS=["alertTypes","customAlert","queryJsonString"];function readRuleBody(client,bodyPath,jsonOutput){let raw;try{raw=readFileSync(resolve(client.cwd,bodyPath),"utf8")}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS",`Could not read --body file: ${bodyPath}`)}let parsed;try{parsed=JSON.parse(raw)}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","Invalid JSON in --body file.")}return isJSONObject(parsed)?LEGACY_BODY_FIELDS.some(field=>Object.hasOwn(parsed,field))?outputRulesError(client,jsonOutput,"LEGACY_ALERT_RULE_BODY","This body uses the previous alert-rules shape. Rewrite it using the current schema.",{hint:"Run `vercel alerts rules schema --type built-in` for examples."}):parsed:outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","The --body file must contain a JSON object.")}function getBodyType(body){return body.type==="built-in"||body.type==="custom"?body.type:void 0}function emitRulesArgParseError(client,err,recoverWithProjectFlag){let message=err instanceof Error?err.message:String(err),projectFlagMissingArg=message.includes("--project")&&message.includes("requires argument");outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":message,next:[{command:buildCommandWithGlobalFlags(client.argv,projectFlagMissingArg?recoverWithProjectFlag:"alerts rules --help"),when:projectFlagMissingArg?"Retry with a project name or id":"See valid `alerts rules` subcommands"}]},2)}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope,rulesCollectionPath,rulesItemPath,ruleNotificationsPath,rulesNotificationsPath,rulesNotificationLinksPath,rulesSchemaPath,fetchRule,outputRulesError,handleRulesApiError,readRuleBody,getBodyType,emitRulesArgParseError};
|