@vercel/cli-support 68.3.0 → 68.4.0-snapshot-12a52bb14e02
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-LVSBBBNT.js → add-D2RVJIWA.js} +1 -1
- package/dist/chunks/{add-QNZUJVW3.js → add-NNRQGYMJ.js} +1 -1
- package/dist/chunks/{add-6QNDJVXV.js → add-X5BG5K7E.js} +1 -1
- package/dist/chunks/{alerts-TCS56TZU.js → alerts-VIZYTXZW.js} +1 -1
- package/dist/chunks/{build-KKE7LLGT.js → build-6QBDH5NU.js} +1 -1
- package/dist/chunks/{chunk-DPQLHYC5.js → chunk-2KJYAJ5R.js} +1 -1
- package/dist/chunks/{chunk-W6KIUTKO.js → chunk-4CZGKJNW.js} +1 -1
- package/dist/chunks/{chunk-KNQPKVDP.js → chunk-4ESCOWWX.js} +1 -1
- package/dist/chunks/{chunk-MHIH4NVP.js → chunk-5426Z2JE.js} +1 -1
- package/dist/chunks/{chunk-MSKKM36B.js → chunk-5HZOQZZA.js} +1 -1
- package/dist/chunks/{chunk-JZXT53LT.js → chunk-5RP35CP7.js} +1 -1
- package/dist/chunks/{chunk-GJQ3G7OG.js → chunk-5WEPILUN.js} +1 -1
- package/dist/chunks/{chunk-EYH6WGF2.js → chunk-5ZEFNVK4.js} +1 -1
- package/dist/chunks/{chunk-MUJDAD73.js → chunk-6DLSV6MR.js} +4 -4
- package/dist/chunks/{chunk-KTWVMMXL.js → chunk-6DYIE4YH.js} +1 -1
- package/dist/chunks/{chunk-XJVTGNAB.js → chunk-6IHHEJSP.js} +1 -1
- package/dist/chunks/{chunk-GIRRO4QV.js → chunk-7WTYSBYS.js} +1 -1
- package/dist/chunks/{chunk-OHK7TSWE.js → chunk-AAM6ROBN.js} +1 -1
- package/dist/chunks/{chunk-NZU43SVD.js → chunk-ABXP6CZC.js} +1 -1
- package/dist/chunks/{chunk-TTGD6NBN.js → chunk-AD2TGHUA.js} +1 -1
- package/dist/chunks/{chunk-TXQFB44P.js → chunk-BJKRV7BZ.js} +1 -1
- package/dist/chunks/{chunk-DFZRZPCJ.js → chunk-BQ6CQAJV.js} +1 -1
- package/dist/chunks/{chunk-MDSJKFYU.js → chunk-CPLBFAJG.js} +1 -1
- package/dist/chunks/{chunk-ZZTCTVBJ.js → chunk-CZT4KM5Q.js} +1 -1
- package/dist/chunks/{chunk-OCIRBXJK.js → chunk-EKMHS6C7.js} +1 -1
- package/dist/chunks/{chunk-GVQEICZZ.js → chunk-EL4BU63M.js} +1 -1
- package/dist/chunks/{chunk-XTDL6VDZ.js → chunk-FE43D3RY.js} +1 -1
- package/dist/chunks/{chunk-YSOO56PM.js → chunk-G7YTJ7R3.js} +1 -1
- package/dist/chunks/{chunk-I3EXVLOR.js → chunk-GHXTY666.js} +1 -1
- package/dist/chunks/{chunk-GXTN6ATK.js → chunk-GJPJ2PPR.js} +1 -1
- package/dist/chunks/{chunk-YDWOGOYQ.js → chunk-GOVKH2SU.js} +1 -1
- package/dist/chunks/{chunk-4ZZEDEMN.js → chunk-GRVIM22S.js} +1 -1
- package/dist/chunks/{chunk-BSPLBWAX.js → chunk-GS4JE5IQ.js} +1 -1
- package/dist/chunks/{chunk-HOYNGN6Y.js → chunk-HHSDWBZT.js} +1 -1
- package/dist/chunks/{chunk-24L6BDAY.js → chunk-I5REFXOD.js} +1 -1
- package/dist/chunks/{chunk-UL6BYW6P.js → chunk-IVUJSORE.js} +1 -1
- package/dist/chunks/{chunk-6562FIUX.js → chunk-J3V72KJT.js} +1 -1
- package/dist/chunks/{chunk-3TOEU3F6.js → chunk-JX562QLD.js} +1 -1
- package/dist/chunks/{chunk-X2LS3YDZ.js → chunk-JYQASNBC.js} +1 -1
- package/dist/chunks/{chunk-67H6BT7B.js → chunk-KBHH5ZD5.js} +1 -1
- package/dist/chunks/{chunk-FRBBC5I7.js → chunk-KLZMXCMT.js} +1 -1
- package/dist/chunks/{chunk-5VVIXI7N.js → chunk-LEMFN5R3.js} +1 -1
- package/dist/chunks/{chunk-5KLSANRW.js → chunk-LYOMLFWU.js} +1 -1
- package/dist/chunks/{chunk-GROKZBM5.js → chunk-MEKWGM7P.js} +1 -1
- package/dist/chunks/{chunk-FEO3KPCN.js → chunk-NJK6BMRX.js} +2 -2
- package/dist/chunks/{chunk-PYXGCPOE.js → chunk-NU3MHAAM.js} +1 -1
- package/dist/chunks/{chunk-HCFEUT2S.js → chunk-NUQXJEM3.js} +1 -1
- package/dist/chunks/{chunk-2CDYSI2W.js → chunk-NVR7CZXV.js} +1 -1
- package/dist/chunks/{chunk-HH7YFAAX.js → chunk-QIAXQ5E7.js} +1 -1
- package/dist/chunks/{chunk-DSFXR6UL.js → chunk-QJZ32EQI.js} +1 -1
- package/dist/chunks/{chunk-NBMLJM3J.js → chunk-QUCSJ4GA.js} +1 -1
- package/dist/chunks/{chunk-IXRTZRJN.js → chunk-QUDPFC2I.js} +1 -1
- package/dist/chunks/{chunk-LCM7GAHQ.js → chunk-RD752RFM.js} +1 -1
- package/dist/chunks/{chunk-3CK5SHI4.js → chunk-S7CL46EL.js} +1 -1
- package/dist/chunks/{chunk-H3NVQYY6.js → chunk-SAPXVTTO.js} +1 -1
- package/dist/chunks/{chunk-SUZXGVMN.js → chunk-SO5KJGBC.js} +1 -1
- package/dist/chunks/{chunk-HHV7F6W4.js → chunk-U7H33V47.js} +1 -1
- package/dist/chunks/{chunk-SP73R4DW.js → chunk-UVQLLOIX.js} +1 -1
- package/dist/chunks/{chunk-NNYSREF6.js → chunk-UZS7ZVR7.js} +1 -1
- package/dist/chunks/{chunk-V2BCAK3I.js → chunk-V6IXFL2N.js} +1 -1
- package/dist/chunks/{chunk-TTSA4CGZ.js → chunk-WBGU7T5P.js} +1 -1
- package/dist/chunks/{chunk-5NRYTFUS.js → chunk-WKLFESIP.js} +1 -1
- package/dist/chunks/{chunk-N4J3R7KS.js → chunk-XLBELNZD.js} +1 -1
- package/dist/chunks/{chunk-H3K7IR5S.js → chunk-Z5BC4PSX.js} +1 -1
- package/dist/chunks/{chunk-T2DXWRDM.js → chunk-ZDQDXOZR.js} +1 -1
- package/dist/chunks/{chunk-Z7B7PFAR.js → chunk-ZHPUHC7H.js} +2 -2
- package/dist/chunks/{clear-CHK647GV.js → clear-E2QY2YIU.js} +1 -1
- package/dist/chunks/{compile-vercel-config-HAQYXHPB.js → compile-vercel-config-Q3UIMEYG.js} +1 -1
- package/dist/chunks/{config-X6N2ECGU.js → config-4RQZE3FO.js} +1 -1
- package/dist/chunks/{config-ROLBZC3E.js → config-T7YMSL26.js} +1 -1
- package/dist/chunks/{delete-MC7BC7NX.js → delete-HH6FFUHB.js} +1 -1
- package/dist/chunks/{delete-A3ZN3JL2.js → delete-RR44WMDV.js} +1 -1
- package/dist/chunks/{describe-MF3QA4XP.js → describe-Y7OHZYFR.js} +1 -1
- package/dist/chunks/{detect-services-V6P6RNRY.js → detect-services-HE7JZAIS.js} +1 -1
- package/dist/chunks/{disable-GKANXOTL.js → disable-EYYJLVBO.js} +1 -1
- package/dist/chunks/{discard-2WY2RBN3.js → discard-WTZ7YRJK.js} +1 -1
- package/dist/chunks/{edit-DXAJX6I2.js → edit-DHBSFSKX.js} +1 -1
- package/dist/chunks/{edit-U4VYAWI2.js → edit-VE27DQG2.js} +1 -1
- package/dist/chunks/{enable-LLHUA7RH.js → enable-BEYYBDLQ.js} +1 -1
- package/dist/chunks/{export-4DW4AQ46.js → export-GMMD2WFZ.js} +1 -1
- package/dist/chunks/{future-WJEMZHER.js → future-O5RVBPBM.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-EHPJUMRI.js → generate-cert-for-deploy-SPK4RZB7.js} +1 -1
- package/dist/chunks/{group-actions-MVWNYISJ.js → group-actions-KRESFEUS.js} +1 -1
- package/dist/chunks/{image-XXG2UE6K.js → image-KQTEYWEC.js} +1 -1
- package/dist/chunks/{import-builders-JZ2W4AKZ.js → import-builders-MZCCQIVY.js} +1 -1
- package/dist/chunks/{inspect-23F7OG7O.js → inspect-3AD2PDIN.js} +1 -1
- package/dist/chunks/{inspect-CMX764GE.js → inspect-FJAUC2CH.js} +1 -1
- package/dist/chunks/{inspect-2YUBT5J7.js → inspect-LRAQ3R2D.js} +1 -1
- package/dist/chunks/{inspect-NIW6SLTJ.js → inspect-T4S2RNCA.js} +1 -1
- package/dist/chunks/{inspect-FBFB4673.js → inspect-UYUST4YR.js} +1 -1
- package/dist/chunks/{list-4HCIH7ZT.js → list-DHKWGQVS.js} +1 -1
- package/dist/chunks/{list-LBLSWS4G.js → list-T3KR5JK5.js} +1 -1
- package/dist/chunks/{list-5EN5BQGX.js → list-U7ALJAHR.js} +1 -1
- package/dist/chunks/{login-FCE6ZNVP.js → login-E2E7A3JG.js} +1 -1
- package/dist/chunks/{login-7B6WUTZA.js → login-VHOSHZ4C.js} +1 -1
- package/dist/chunks/{logs-UCFAA573.js → logs-65QXVNTD.js} +1 -1
- package/dist/chunks/{ls-AFD7VVPV.js → ls-AUW2OT4A.js} +1 -1
- package/dist/chunks/{ls-JF5IEJRG.js → ls-C5TSPC7C.js} +1 -1
- package/dist/chunks/{ls-VX6NJEQ5.js → ls-G3UDAUFP.js} +1 -1
- package/dist/chunks/{ls-M3AULXSF.js → ls-LOEQMD63.js} +1 -1
- package/dist/chunks/{ls-22KCD6XH.js → ls-QBD45VI4.js} +1 -1
- package/dist/chunks/{ls-74UF3GAZ.js → ls-U5IZPT7S.js} +1 -1
- package/dist/chunks/{ls-TZVW6K64.js → ls-ZNBYGUOO.js} +1 -1
- package/dist/chunks/{migrate-experimental-services-DPLTGN7G.js → migrate-experimental-services-FBEYFPS5.js} +1 -1
- package/dist/chunks/{mutate-ANP4MINN.js → mutate-ESBM5LRQ.js} +1 -1
- package/dist/chunks/{notifications-ZLM75IM7.js → notifications-7D3TVPGL.js} +1 -1
- package/dist/chunks/{open-BTVG7PAR.js → open-4KWLVSCN.js} +1 -1
- package/dist/chunks/{permissions-R2VXNC7P.js → permissions-AGJCRYBT.js} +1 -1
- package/dist/chunks/{plugin-offer-TOGG57CN.js → plugin-offer-B2M2K6ND.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-M3MJ23CT.js → prompt-missing-credentials-NK2LVTLD.js} +1 -1
- package/dist/chunks/{publish-ZE5QH5IK.js → publish-U64BOK7P.js} +1 -1
- package/dist/chunks/{pull-THZVVRD5.js → pull-E76DBNKF.js} +1 -1
- package/dist/chunks/{purchase-domain-if-available-JCYJIHA3.js → purchase-domain-if-available-UCAVWKBZ.js} +1 -1
- package/dist/chunks/{push-3IMAJJIA.js → push-H3SF3QIY.js} +1 -1
- package/dist/chunks/{query-JS46X4HV.js → query-GYIMXS6L.js} +1 -1
- package/dist/chunks/{raw-query-4K6JHAQG.js → raw-query-BNKDA4IK.js} +1 -1
- package/dist/chunks/{reauthenticate-5WD77AFG.js → reauthenticate-2DCO4INA.js} +1 -1
- package/dist/chunks/{remove-KOF4XIZ7.js → remove-HF2GZCIK.js} +1 -1
- package/dist/chunks/{reorder-3NXXZRZO.js → reorder-UBEPKIWG.js} +1 -1
- package/dist/chunks/{reply-JNYYMJN5.js → reply-HI3WFA2M.js} +1 -1
- package/dist/chunks/{resolve-RGGB7NDY.js → resolve-W2DL5JG2.js} +1 -1
- package/dist/chunks/{resolve-agent-team-ZB6AGD4A.js → resolve-agent-team-SO3F25DJ.js} +1 -1
- package/dist/chunks/{restore-7TLQ4OQL.js → restore-36KMCOTN.js} +1 -1
- package/dist/chunks/{rm-NUEUIXWD.js → rm-CVYH6MYF.js} +1 -1
- package/dist/chunks/{rm-GKRLNTNG.js → rm-DDHPGAMJ.js} +1 -1
- package/dist/chunks/{rm-TR7263R7.js → rm-Q2K5LZL6.js} +1 -1
- package/dist/chunks/{rm-GG4YAYEG.js → rm-R2ZHIF3V.js} +1 -1
- package/dist/chunks/{rm-LVENOOH4.js → rm-UACAV5IJ.js} +1 -1
- package/dist/chunks/{rule-inspect-7VXXJWNZ.js → rule-inspect-YU5L7PRZ.js} +1 -1
- package/dist/chunks/{schema-LZGI5ZTU.js → schema-CCADGZ24.js} +1 -1
- package/dist/chunks/{schema-HCNHCZ3R.js → schema-PNIIEG36.js} +1 -1
- package/dist/chunks/{select-org-HKSE2YDF.js → select-org-BC733EUT.js} +1 -1
- package/dist/chunks/{set-7UNVXHZM.js → set-AURC7UX5.js} +1 -1
- package/dist/chunks/{setup-and-link-L47YL6MP.js → setup-and-link-6BLHO3WH.js} +1 -1
- package/dist/chunks/{tags-NXBLJZJF.js → tags-NNXRQPVV.js} +1 -1
- package/dist/chunks/{update-BCBWJ565.js → update-7CW2XQSW.js} +1 -1
- package/dist/chunks/{usage-G4CJ3ZOH.js → usage-A7K3CN7K.js} +1 -1
- package/dist/chunks/{views-QU3K2TSP.js → views-OC2PB7RL.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 +4 -4
- 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/project/index.js +1 -1
- package/dist/commands/tunnel/index.js +1 -1
- package/dist/commands-account.js +2 -2
- package/dist/commands-ai.js +1 -1
- package/dist/commands-blob.js +1 -1
- package/dist/commands-core.js +16 -24
- package/dist/commands-deployments.js +1 -1
- package/dist/commands-flags.js +1 -1
- package/dist/commands-integrations.js +1 -1
- package/dist/commands-observability.js +2 -2
- package/dist/commands-routing.js +2 -2
- package/dist/index.js +3 -3
- package/dist/internal-build.js +1 -1
- package/dist/package.json +40 -40
- package/dist/version.mjs +1 -1
- package/package.json +42 -42
|
@@ -4,5 +4,5 @@ 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{printRuleMutationReceipt}from"./chunk-NKACWBO3.js";import"./chunk-QOIG2FJP.js";import{resolveRulesProject,resolveRulesTeam}from"./chunk-
|
|
7
|
+
import{printRuleMutationReceipt}from"./chunk-NKACWBO3.js";import"./chunk-QOIG2FJP.js";import{resolveRulesProject,resolveRulesTeam}from"./chunk-5426Z2JE.js";import"./chunk-QUDPFC2I.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,resolveRuleBodyInput,rulesCollectionPath}from"./chunk-AD2TGHUA.js";import"./chunk-DRDY2UZX.js";import"./chunk-GHAY4PSD.js";import"./chunk-EL65DTVZ.js";import"./chunk-6JY43KSR.js";import"./chunk-FIICEEXO.js";import"./chunk-46R47IE5.js";import"./chunk-GZNDA6SV.js";import"./chunk-OM6NML7C.js";import{trackCreatedId}from"./chunk-ILNTOWHG.js";import{withWarnings}from"./chunk-237WN2MK.js";import"./chunk-QCYCLWNG.js";import{monitorsAddSubcommand}from"./chunk-X2UJGCIC.js";import"./chunk-JX562QLD.js";import"./chunk-QROPMCL2.js";import"./chunk-6DLSV6MR.js";import"./chunk-SUD5V67L.js";import"./chunk-7TRHPXCG.js";import"./chunk-VO5M6G7M.js";import"./chunk-QRPBDCDH.js";import"./chunk-2GXP676X.js";import"./chunk-K5GE24PG.js";import"./chunk-IFMPBA4K.js";import"./chunk-KHJWQ4WP.js";import"./chunk-MY4MONOH.js";import"./chunk-YATYCZQJ.js";import"./chunk-2ILZM77F.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments}from"./chunk-E7ICSU45.js";import"./chunk-3QTP26QS.js";import{validateJsonOutput}from"./chunk-BDLZ6WL2.js";import"./chunk-PH2MLBQO.js";import"./chunk-DCFCPAFQ.js";import"./chunk-GOXGA37R.js";import{isAPIError}from"./chunk-UNAQQ5DF.js";import"./chunk-EFGZK6OY.js";import"./chunk-JCDPMWKO.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import"./chunk-7Y572CPZ.js";import"./chunk-BVFFSUG3.js";import"./chunk-RRX2AMWY.js";import"./chunk-GUFRGEM5.js";import"./chunk-SUT2PTL3.js";import"./chunk-AX6UCTOC.js";import"./chunk-4SIQE2W4.js";import"./chunk-MF43WTDT.js";import"./chunk-7QHUMMBA.js";import"./chunk-AUCQKYL2.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import"./chunk-2BKALEOP.js";import"./chunk-UJ7YUIEJ.js";import"./chunk-L6MWUMWZ.js";import"./chunk-L4CSJDG7.js";import"./chunk-YHZXIBS7.js";import"./chunk-LPYHYTYI.js";import"./chunk-NBPLUP7C.js";function applyScopeFlag(client,body,type,scope,flags,jsonOutput,warnings){if(Object.hasOwn(body,"ruleScope"))return flags["--project"]||flags["--all"]?outputRulesError(client,jsonOutput,"SCOPE_CONFLICT","Specify monitor scope either in the body or with --project/--all, not both.",{warnings}):void 0;if(flags["--project"]){body.ruleScope=type==="custom"?{type:"project",projectId:scope.projectId}:{type:"include",projectIds:[scope.projectId]};return}if(flags["--all"]){if(type==="custom")return outputRulesError(client,jsonOutput,"INVALID_SCOPE","Custom monitors must target one project. Use --project <name-or-id>.",{warnings});body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing monitor scope. Add ruleScope to the body, or pass --project or --all.",{warnings})}async function resolveCreateScope(client,flags,jsonOutput,warnings){return flags["--project"]&&flags["--all"]?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --all and --project. Use one or the other.",{warnings}):flags["--project"]?resolveRulesProject(client,flags["--project"],jsonOutput,"monitors add"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv,api,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(monitorsAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"monitors add --project <name-or-id> --file <path>"),printError(error),2}let flags=parsedArgs.flags;telemetry?.trackCliFlagAll(flags["--all"]),telemetry?.trackCliFlagJson(flags["--json"]),telemetry?.trackCliOptionFile(flags["--file"]),telemetry?.trackCliOptionData(flags["--data"]),telemetry?.trackCliOptionBody(flags["--body"]);let format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);let resolvedInput=await resolveRuleBodyInput(client,parsedArgs.flags,format.jsonOutput,{required:!0,missingMessage:"Missing required option: --file <PATH> or --data <JSON>."});if(typeof resolvedInput=="number")return resolvedInput;let{body,warnings}=resolvedInput,type=getBodyType(body);if(!type)return outputRulesError(client,format.jsonOutput,"INVALID_RULE_TYPE","Create body must set a supported monitor type.",{warnings});if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify monitor scope either in the body or with --project/--all, not both.",{warnings});if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom monitors must target one project. Use --project <name-or-id>.",{warnings});let scope=await resolveCreateScope(client,flags,format.jsonOutput,warnings);if(typeof scope=="number")return scope;let scopeError=applyScopeFlag(client,body,type,scope,flags,format.jsonOutput,warnings);if(scopeError!==void 0)return scopeError;output_manager_default.spinner("Creating monitor\u2026");try{let response=await client.fetch(rulesCollectionPath(api,scope.teamId),{method:"POST",body});return trackCreatedId(client,"monitor",response[api.itemKey]?.id),format.jsonOutput?client.stdout.write(`${JSON.stringify(withWarnings(response,warnings),null,2)}
|
|
8
8
|
`):printRuleMutationReceipt("Created",response[api.itemKey],client.argv),0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput,warnings);throw error}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -4,5 +4,5 @@ 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{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-7WTYSBYS.js";import{outputError}from"./chunk-6JY43KSR.js";import"./chunk-3WXQHKSS.js";import"./chunk-FIICEEXO.js";import"./chunk-RFD7CEL6.js";import{trackCreatedId}from"./chunk-ILNTOWHG.js";import{addSubcommand}from"./chunk-CHTFRAXA.js";import"./chunk-T2IZUTGY.js";import"./chunk-3F3WNT5K.js";import"./chunk-P7GA2C6N.js";import"./chunk-JX562QLD.js";import"./chunk-QROPMCL2.js";import"./chunk-6DLSV6MR.js";import"./chunk-SUD5V67L.js";import"./chunk-7TRHPXCG.js";import"./chunk-VO5M6G7M.js";import"./chunk-QRPBDCDH.js";import"./chunk-2GXP676X.js";import"./chunk-K5GE24PG.js";import"./chunk-IFMPBA4K.js";import"./chunk-KHJWQ4WP.js";import"./chunk-MY4MONOH.js";import"./chunk-YATYCZQJ.js";import"./chunk-2ILZM77F.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments}from"./chunk-E7ICSU45.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-3QTP26QS.js";import"./chunk-BDLZ6WL2.js";import"./chunk-PH2MLBQO.js";import"./chunk-DCFCPAFQ.js";import"./chunk-GOXGA37R.js";import{isAPIError}from"./chunk-UNAQQ5DF.js";import{packageName}from"./chunk-EFGZK6OY.js";import"./chunk-JCDPMWKO.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import"./chunk-7Y572CPZ.js";import"./chunk-BVFFSUG3.js";import"./chunk-RRX2AMWY.js";import"./chunk-GUFRGEM5.js";import"./chunk-SUT2PTL3.js";import"./chunk-AX6UCTOC.js";import"./chunk-4SIQE2W4.js";import"./chunk-MF43WTDT.js";import"./chunk-7QHUMMBA.js";import"./chunk-AUCQKYL2.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import"./chunk-2BKALEOP.js";import"./chunk-UJ7YUIEJ.js";import"./chunk-L6MWUMWZ.js";import"./chunk-L4CSJDG7.js";import"./chunk-YHZXIBS7.js";import"./chunk-LPYHYTYI.js";import"./chunk-NBPLUP7C.js";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(addSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr create <name> --project <name-or-id>"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let name=parsedArgs.args[0],project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),!name)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository name. Example: ${packageName} vcr create <name>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr create <name>"),when:"Replace <name> with the repository name to create"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel vcr create <name>`");let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=`/v1/vcr/repository?teamId=${encodeURIComponent(scope.teamId)}`;output_manager_default.spinner("Creating repository...");try{let created=await client.fetch(path,{method:"POST",body:{projectId:scope.projectId,name}});return trackCreatedId(client,"vcr-repository",created.repository?.id),fr.jsonOutput?client.stdout.write(`${JSON.stringify(created,null,2)}
|
|
8
8
|
`):output_manager_default.success(`Created repository ${created.repository?.name??name}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List existing repositories (a name conflict means it already exists)"}});throw err}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -4,5 +4,5 @@ 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{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-7WTYSBYS.js";import{require_async_sema}from"./chunk-ZOJI7HYA.js";import{outputError}from"./chunk-6JY43KSR.js";import"./chunk-3WXQHKSS.js";import"./chunk-FIICEEXO.js";import"./chunk-RFD7CEL6.js";import{permissionsAddSubcommand}from"./chunk-T2IZUTGY.js";import{getCachedTeamSlug,hasExplicitScopeValue}from"./chunk-JX562QLD.js";import"./chunk-6DLSV6MR.js";import"./chunk-SUD5V67L.js";import"./chunk-7TRHPXCG.js";import"./chunk-VO5M6G7M.js";import"./chunk-QRPBDCDH.js";import"./chunk-2GXP676X.js";import"./chunk-K5GE24PG.js";import"./chunk-IFMPBA4K.js";import"./chunk-KHJWQ4WP.js";import"./chunk-MY4MONOH.js";import"./chunk-YATYCZQJ.js";import"./chunk-2ILZM77F.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments}from"./chunk-E7ICSU45.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError,quoteSuggestionToken}from"./chunk-3QTP26QS.js";import"./chunk-BDLZ6WL2.js";import"./chunk-PH2MLBQO.js";import"./chunk-DCFCPAFQ.js";import"./chunk-GOXGA37R.js";import{isAPIError}from"./chunk-UNAQQ5DF.js";import{packageName}from"./chunk-EFGZK6OY.js";import"./chunk-JCDPMWKO.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import"./chunk-7Y572CPZ.js";import"./chunk-BVFFSUG3.js";import"./chunk-RRX2AMWY.js";import"./chunk-GUFRGEM5.js";import"./chunk-SUT2PTL3.js";import"./chunk-AX6UCTOC.js";import"./chunk-4SIQE2W4.js";import"./chunk-MF43WTDT.js";import{remoteText}from"./chunk-AUCQKYL2.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import"./chunk-2BKALEOP.js";import"./chunk-UJ7YUIEJ.js";import"./chunk-L6MWUMWZ.js";import"./chunk-L4CSJDG7.js";import"./chunk-YHZXIBS7.js";import"./chunk-LPYHYTYI.js";import{__toESM}from"./chunk-NBPLUP7C.js";var import_async_sema=__toESM(require_async_sema(),1);var USAGE="vcr permissions <repository> add <team>[,<team>...]";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsAddSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],teamRefs=parseTeamRefs(parsedArgs.args.slice(2)),project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),teamRefs.length===0)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing team. Example: ${packageName} vcr permissions ${repository} add team_1a2b3c4d`,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Replace <team> with a team id or slug (comma-separate multiple teams)"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${USAGE}\``);let scopeIsExplicit=hasExplicitScopeValue(client),selectedTeamId=client.config.currentTeam,scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let projectTeamId=scope.teamId.startsWith("team_")?scope.teamId:void 0;if(scopeIsExplicit&&projectTeamId!==selectedTeamId){let selected=selectedTeamId?`the team --scope selects (${remoteText(getCachedTeamSlug(client.config,selectedTeamId)??selectedTeamId)})`:"the personal account --scope selects",recovery=selectedTeamId?"pass --project for a project in the selected team":"select the linked project's team with --scope",message=`This directory's linked project is in "${remoteText(scope.teamSlug)}", which is not ${selected}. No permission was added. Run \`vercel link\` to relink the directory, or ${recovery}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.CONFLICT,message,...selectedTeamId&&{next:[{command:buildCommandWithGlobalFlags(client.argv,`vcr permissions ${quoteSuggestionToken(repository)} add ${quoteSuggestionToken(teamRefs.join(","))} --project <name_or_id>`),when:"share the repository from a project in the selected team"}]}},1),outputError(client,fr.jsonOutput,"SCOPE_MISMATCH",message)}let path=repositoryPermissionsPath(scope,repository),added=[],failed=[];output_manager_default.spinner(`Sharing ${repository} with ${teamRefs.length===1?teamRefs[0]:`${teamRefs.length} teams`}...`);let sema=new import_async_sema.default(10),results;try{results=await Promise.all(teamRefs.map(async team=>{await sema.acquire();try{let result=await client.fetch(path,{method:"POST",body:teamRefBody(team)});return{ok:!0,team,permission:result.permission}}catch(err){if(!isAPIError(err))throw err;let message=err.serverMessage||`API error (${err.status}).`;return{ok:!1,team,failure:{team,code:err.code||"API_ERROR",message}}}finally{sema.release()}}))}finally{output_manager_default.stopSpinner()}for(let result of results)result.ok?(added.push(result.permission),fr.jsonOutput||output_manager_default.success(`Shared ${repository} with ${result.permission?.teamSlug??result.team}`)):(failed.push(result.failure),fr.jsonOutput||output_manager_default.error(`Failed to share ${repository} with ${result.team}: ${result.failure.message}`));return failed.length>0&&outputAgentError(client,{status:"error",reason:AGENT_REASON.API_ERROR,message:`Failed to share ${repository} with ${failed.map(f=>`${f.team} (${f.message})`).join(", ")}`},1),fr.jsonOutput&&client.stdout.write(`${JSON.stringify({permissions:added,failed},null,2)}
|
|
8
8
|
`),failed.length>0?1:0}export{add as default};
|
|
@@ -4,5 +4,5 @@ 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{loadScopeNames,printBudgetAlertsTable,scopeNameOf}from"./chunk-EHA24PIE.js";import{organizationTarget,parseBudgetFilterOptions,rejectUnexpectedArgs,resolveBudgetFilter,resolveBudgetOwner,trackScopeOptions,typeFilter}from"./chunk-ZUCLG4ML.js";import"./chunk-46DSHEHL.js";import"./chunk-PL2KOT4Q.js";import"./chunk-LKFQMY5V.js";import{handleValidationError,outputError,validateOptionalIntegerRange,validateTimeBound,validateTimeOrder}from"./chunk-6JY43KSR.js";import{INVALID_NEXT_MESSAGE}from"./chunk-C6GY2G73.js";import"./chunk-64GNDWWX.js";import"./chunk-FIICEEXO.js";import{budgetAlertJson,listBudgetAlerts,ownerJson}from"./chunk-ZUWIJMH2.js";import{getSubcommand}from"./chunk-ETV3C2CV.js";import"./chunk-QCYCLWNG.js";import{MAX_LIST_LIMIT,getNextPageCommand,printNextPageCommand}from"./chunk-WS6UOPMS.js";import{getCommandAliases}from"./chunk-
|
|
7
|
+
import{loadScopeNames,printBudgetAlertsTable,scopeNameOf}from"./chunk-EHA24PIE.js";import{organizationTarget,parseBudgetFilterOptions,rejectUnexpectedArgs,resolveBudgetFilter,resolveBudgetOwner,trackScopeOptions,typeFilter}from"./chunk-ZUCLG4ML.js";import"./chunk-46DSHEHL.js";import"./chunk-PL2KOT4Q.js";import"./chunk-LKFQMY5V.js";import{handleValidationError,outputError,validateOptionalIntegerRange,validateTimeBound,validateTimeOrder}from"./chunk-6JY43KSR.js";import{INVALID_NEXT_MESSAGE}from"./chunk-C6GY2G73.js";import"./chunk-64GNDWWX.js";import"./chunk-FIICEEXO.js";import{budgetAlertJson,listBudgetAlerts,ownerJson}from"./chunk-ZUWIJMH2.js";import{getSubcommand}from"./chunk-ETV3C2CV.js";import"./chunk-QCYCLWNG.js";import{MAX_LIST_LIMIT,getNextPageCommand,printNextPageCommand}from"./chunk-WS6UOPMS.js";import{getCommandAliases}from"./chunk-BQ6CQAJV.js";import"./chunk-XHWA436J.js";import"./chunk-4MAA4BQD.js";import"./chunk-OXQKWOLS.js";import"./chunk-GO64LSUW.js";import{alertsListSubcommand,alertsSubcommand}from"./chunk-M3LYYAQ6.js";import"./chunk-TUPVVZ4I.js";import"./chunk-HXIOR7P6.js";import"./chunk-CHTFRAXA.js";import"./chunk-T2IZUTGY.js";import"./chunk-3F3WNT5K.js";import"./chunk-P7GA2C6N.js";import"./chunk-RPYIWRSN.js";import"./chunk-CDO5IECP.js";import"./chunk-6XXXPJBV.js";import{isBudgetScope}from"./chunk-L74PQVPL.js";import"./chunk-HT5EXCYX.js";import"./chunk-TTJWZ3ZW.js";import"./chunk-R3ZPLQDI.js";import"./chunk-QPPFQREO.js";import"./chunk-X2UJGCIC.js";import"./chunk-XZYVBYUY.js";import"./chunk-EZ3HXFLB.js";import"./chunk-WMIZ6Y4E.js";import"./chunk-QPNYOR6O.js";import"./chunk-JGEJY7AC.js";import"./chunk-LBJ7EOZM.js";import{TelemetryClient}from"./chunk-QROPMCL2.js";import{require_pluralize}from"./chunk-7TRHPXCG.js";import"./chunk-VO5M6G7M.js";import"./chunk-2ILZM77F.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments,takeCommand}from"./chunk-E7ICSU45.js";import{AGENT_REASON}from"./chunk-3QTP26QS.js";import{validateJsonOutput}from"./chunk-BDLZ6WL2.js";import"./chunk-GOXGA37R.js";import{isAPIError}from"./chunk-UNAQQ5DF.js";import"./chunk-EFGZK6OY.js";import"./chunk-JCDPMWKO.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import"./chunk-7Y572CPZ.js";import"./chunk-BVFFSUG3.js";import"./chunk-4SIQE2W4.js";import"./chunk-MF43WTDT.js";import"./chunk-FUH5PBGR.js";import"./chunk-7TREJIPV.js";import"./chunk-7QHUMMBA.js";import"./chunk-AUCQKYL2.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import"./chunk-2BKALEOP.js";import"./chunk-UJ7YUIEJ.js";import"./chunk-L6MWUMWZ.js";import"./chunk-L4CSJDG7.js";import"./chunk-YHZXIBS7.js";import"./chunk-LPYHYTYI.js";import{__toESM}from"./chunk-NBPLUP7C.js";var import_pluralize=__toESM(require_pluralize(),1);function encodeBudgetAlertsCursor(value){return Buffer.from(JSON.stringify({c:value.cursor,t:value.teamId,o:value.owner==="organization"?value.owner:void 0,s:value.since,u:value.until,sc:value.selector?.scope,si:value.selector&&"scopeId"in value.selector?value.selector.scopeId:void 0})).toString("base64url")}function decodeBudgetAlertsCursor(value){if(value===void 0)return{valid:!0,value:void 0};let invalid={valid:!1,code:"INVALID_NEXT",message:INVALID_NEXT_MESSAGE},raw;try{raw=JSON.parse(Buffer.from(value,"base64url").toString("utf8"))}catch{return invalid}if(typeof raw!="object"||raw===null)return invalid;let{c,t,o,s,u,sc,si}=raw;if(typeof c!="string"||typeof t!="string"||!(o===void 0||o==="organization"&&sc==="organization"&&si===void 0)||!isOptionalMs(s)||!isOptionalMs(u)||!(sc===void 0||isBudgetScope(sc)||isScopeList(sc))||!(si===void 0||typeof si=="string"&&isBudgetScope(sc)))return invalid;let selector;return isScopeList(sc)?selector={scope:sc}:isBudgetScope(sc)&&(selector=si===void 0?{scope:sc}:{scope:sc,scopeId:si}),o==="organization"?{valid:!0,value:{cursor:c,teamId:t,owner:o,since:s,until:u,selector:{scope:"organization",orgId:t}}}:{valid:!0,value:{cursor:c,teamId:t,since:s,until:u,selector}}}function isScopeList(value){return Array.isArray(value)&&value.length>0&&value.every(isBudgetScope)}function isOptionalMs(value){return value===void 0||Number.isFinite(value)}var BudgetAlertsTelemetryClient=class extends TelemetryClient{trackCliOptionOrganization(organization){organization&&this.trackCliOption({option:"organization",value:this.redactedValue})}trackCliOptionProject(project){project&&this.trackCliOption({option:"project",value:this.redactedValue})}trackCliOptionType(types){types?.length&&this.trackCliOption({option:"type",value:types.join(",")})}trackCliOptionProduct(product){product&&this.trackCliOption({option:"product",value:this.redactedValue})}trackCliSubcommandList(actual){this.trackCliSubcommand({subcommand:"list",value:actual})}trackCliOptionSince(since){since&&this.trackCliOption({option:"since",value:this.redactedValue})}trackCliOptionUntil(until){until&&this.trackCliOption({option:"until",value:this.redactedValue})}trackCliOptionLimit(limit){limit!==void 0&&this.trackCliOption({option:"limit",value:String(limit)})}trackCliOptionNext(next){next&&this.trackCliOption({option:"next",value:this.redactedValue})}trackCliOptionFormat(format){format&&this.trackCliOption({option:"format",value:format})}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};async function alerts(client,argv){let telemetry=new BudgetAlertsTelemetryClient({opts:{store:client.telemetryEventStore}}),action,parsedArgs,flagsSpecification=getFlagsSpecification(alertsSubcommand.options);try{let selected=takeCommand(argv,flagsSpecification);action=getSubcommand(selected.command?[selected.command]:[],{list:getCommandAliases(alertsListSubcommand)}),parsedArgs=parseArguments(action.subcommand?selected.args:argv,flagsSpecification)}catch(error){return printError(error),2}let{flags:opts,args}=parsedArgs;action.subcommand==="list"&&telemetry.trackCliSubcommandList(action.subcommandOriginal);let formatResult=validateJsonOutput(opts);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let asJson=formatResult.jsonOutput;if(rejectUnexpectedArgs(args,"billing budgets alerts"))return 2;let scopeArgs=parseBudgetFilterOptions(opts);if("error"in scopeArgs)return outputError(client,asJson,"INVALID_ARGUMENTS",scopeArgs.error);trackScopeOptions(telemetry,opts),telemetry.trackCliOptionType(opts["--type"]),telemetry.trackCliOptionSince(opts["--since"]),telemetry.trackCliOptionUntil(opts["--until"]),telemetry.trackCliOptionLimit(opts["--limit"]),telemetry.trackCliOptionNext(opts["--next"]),telemetry.trackCliOptionFormat(opts["--format"]?"json":void 0),telemetry.trackCliFlagJson(opts["--json"]);let nextResult=decodeBudgetAlertsCursor(opts["--next"]);if(!nextResult.valid)return handleValidationError(nextResult,asJson,client);let cursor=nextResult.value,{types}=scopeArgs.value;if(cursor&&types&&!sameSelector(cursor.selector,{scope:types}))return outputError(client,asJson,"INVALID_NEXT",OTHER_FILTER_CURSOR);let warnings=[],limit=opts["--limit"];if(typeof limit=="number"&&Number.isInteger(limit)&&limit>MAX_LIST_LIMIT){let message=`--limit ${limit} is above the maximum of ${MAX_LIST_LIMIT}. Using ${MAX_LIST_LIMIT}.`;warnings.push({reason:AGENT_REASON.LIMIT_CLAMPED,message}),asJson||output_manager_default.warning(message),limit=MAX_LIST_LIMIT}let limitResult=validateOptionalIntegerRange(limit,{flag:"--limit",min:1,max:MAX_LIST_LIMIT});if(!limitResult.valid)return handleValidationError(limitResult,asJson,client);let sinceResult=validateTimeBound(opts["--since"]);if(!sinceResult.valid)return handleValidationError(sinceResult,asJson,client);let untilResult=validateTimeBound(opts["--until"]);if(!untilResult.valid)return handleValidationError(untilResult,asJson,client);let order=validateTimeOrder(sinceResult.value,untilResult.value);if(!order.valid)return handleValidationError(order,asJson,client);let resolvedOwner=await resolveBudgetOwner(client,scopeArgs.value.input??(cursor?.owner==="organization"?{scope:"organization",value:cursor.teamId}:null));if(!resolvedOwner)return 2;if("error"in resolvedOwner)return outputError(client,asJson,resolvedOwner.usage?"INVALID_ARGUMENTS":"API_ERROR",resolvedOwner.error);let owner=resolvedOwner.value;if(cursor&&cursor.teamId!==owner.id)return outputError(client,asJson,"INVALID_NEXT",`This --next cursor is from another team or organization, not ${owner.slug}. Use the --scope or --organization it was printed with.`);let since=cursor?cursor.since:sinceResult.value?.getTime(),until=cursor?cursor.until:untilResult.value?.getTime();output_manager_default.spinner("Fetching budget alerts\u2026");let resolved=cursor&&!scopeArgs.value.input&&!scopeArgs.value.types?{value:cursorFilter(owner,cursor.selector)}:await resolveBudgetFilter(client,owner,scopeArgs.value);if("error"in resolved)return output_manager_default.stopSpinner(),outputError(client,asJson,resolved.usage?"INVALID_ARGUMENTS":"API_ERROR",resolved.error);let filter=resolved.value;if(cursor&&!sameSelector(cursor.selector,filter.selector))return output_manager_default.stopSpinner(),outputError(client,asJson,"INVALID_NEXT",OTHER_FILTER_CURSOR);let page;try{page=await listBudgetAlerts(client,filter.selector,{since,until,limit:limitResult.value,next:cursor?.cursor})}catch(err){if(output_manager_default.stopSpinner(),isAPIError(err))return err.code==="invalid_cursor"?outputError(client,asJson,"INVALID_NEXT",INVALID_NEXT_MESSAGE):outputError(client,asJson,err.code||"API_ERROR",err.message);throw err}let names=await loadScopeNames(client,owner,page.data);output_manager_default.stopSpinner();let next=page.next?encodeBudgetAlertsCursor({cursor:page.next,teamId:owner.id,owner:owner.type,since,until,selector:filter.selector}):null;if(asJson)return client.stdout.write(`${JSON.stringify({...ownerJson(owner),...filter.selector?{filter:filter.json}:{},alerts:page.data.map(alert=>budgetAlertJson(alert,scopeNameOf(names,alert))),pagination:{next},...warnings.length>0?{warnings}:{}},null,2)}
|
|
8
8
|
`),0;let{where}=filter;return page.data.length===0?(output_manager_default.log(cursor?`No more budget alerts ${where}.`:`No budget alerts found ${where}.`),0):(output_manager_default.log(`${(0,import_pluralize.default)("budget alert",page.data.length,!0)} ${where}`),client.stdout.write(printBudgetAlertsTable(page.data,names)),next&&printNextPageCommand(getNextPageCommand(client.argv,next,WINDOW_FLAGS)),0)}function cursorFilter(owner,selector){if(owner.type==="organization")return organizationTarget(owner);if(!selector)return typeFilter(owner,null);if(Array.isArray(selector.scope))return typeFilter(owner,selector.scope);let{scope}=selector,scopeId="scopeId"in selector?selector.scopeId:void 0;return{selector,args:"",where:scopeId?`on ${scope} ${scopeId}`:`on ${scope}`,json:{scope,scopeId:scopeId??null,name:null}}}var OTHER_FILTER_CURSOR="This --next cursor is from a list with a different --type, --organization, --project, or --product. Use the options it was printed with.";function sameSelector(a,b){return queryKey(a)===queryKey(b)}function queryKey(query){return query?Array.isArray(query.scope)?query.scope.join(","):"scopeId"in query&&query.scopeId?`${query.scope}:${query.scopeId}`:query.scope:""}var WINDOW_FLAGS=["--since","-s","--until","-u"];export{alerts as default};
|
|
@@ -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{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-
|
|
7
|
+
import{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-7WTYSBYS.js";import{outputError}from"./chunk-6JY43KSR.js";import"./chunk-3WXQHKSS.js";import"./chunk-FIICEEXO.js";import"./chunk-RFD7CEL6.js";import{buildSubcommand}from"./chunk-CHTFRAXA.js";import"./chunk-T2IZUTGY.js";import"./chunk-3F3WNT5K.js";import"./chunk-P7GA2C6N.js";import"./chunk-JX562QLD.js";import"./chunk-6DLSV6MR.js";import"./chunk-SUD5V67L.js";import"./chunk-7TRHPXCG.js";import"./chunk-VO5M6G7M.js";import"./chunk-QRPBDCDH.js";import"./chunk-2GXP676X.js";import"./chunk-K5GE24PG.js";import"./chunk-IFMPBA4K.js";import"./chunk-KHJWQ4WP.js";import"./chunk-MY4MONOH.js";import"./chunk-YATYCZQJ.js";import"./chunk-2ILZM77F.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments}from"./chunk-E7ICSU45.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-3QTP26QS.js";import"./chunk-BDLZ6WL2.js";import"./chunk-PH2MLBQO.js";import"./chunk-DCFCPAFQ.js";import"./chunk-GOXGA37R.js";import"./chunk-UNAQQ5DF.js";import"./chunk-EFGZK6OY.js";import"./chunk-JCDPMWKO.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import"./chunk-7Y572CPZ.js";import"./chunk-BVFFSUG3.js";import"./chunk-RRX2AMWY.js";import"./chunk-GUFRGEM5.js";import"./chunk-SUT2PTL3.js";import"./chunk-AX6UCTOC.js";import"./chunk-4SIQE2W4.js";import"./chunk-MF43WTDT.js";import"./chunk-AUCQKYL2.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import"./chunk-2BKALEOP.js";import"./chunk-UJ7YUIEJ.js";import"./chunk-L6MWUMWZ.js";import"./chunk-L4CSJDG7.js";import"./chunk-YHZXIBS7.js";import"./chunk-LPYHYTYI.js";import"./chunk-NBPLUP7C.js";var DEFAULT_PLATFORM="linux/amd64";async function build(client,telemetry){let{own,passthrough}=splitPassthrough(client.argv),parsedArgs;try{parsedArgs=parseArguments(own,getFlagsSpecification(buildSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr build <engine> [path] [name[:tag]]"),printError(err),2}let[engineArg,pathArg,nameArg]=parsedArgs.args.slice(2),project=parsedArgs.flags["--project"],platform=parsedArgs.flags["--platform"],push=!!parsedArgs.flags["--push"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliArgumentPath(pathArg),telemetry.trackCliArgumentName(nameArg),telemetry.trackCliOptionProject(project),telemetry.trackCliOptionPlatform(platform),telemetry.trackCliFlagPush(push),!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 build 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}`,contextPath=pathArg??".",buildPlatform=platform??DEFAULT_PLATFORM;if(push&&engine==="docker"&&await isBuildxAvailable()){let outputSpec=`type=image,name=${ref},push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true`,engineArgs2=["buildx","build","--platform",buildPlatform,"--output",outputSpec,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} buildx build ${ref}`);let result2=await runEngine(engine,engineArgs2,{cwd:client.cwd,captureStderr:!0});return result2.exitCode!==0?reportEnginePushFailure(client,engine,"buildx build",result2):(output_manager_default.success(`Built and pushed ${ref} (zstd compression)`),0)}push&&engine==="docker"&&output_manager_default.warn("Docker Buildx is not available; building and pushing without zstd compression. Install Buildx for smaller, faster image pushes.");let engineArgs=["build","--platform",buildPlatform,"--tag",ref,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} build ${ref}`);let result=await runEngine(engine,engineArgs,{cwd:client.cwd});if(result.exitCode!==0)return reportEngineCommandFailure(client,engine,"build",result);if(!push)return output_manager_default.success(`Built ${ref}`),output_manager_default.log(`Push it with \`${buildCommandWithGlobalFlags(client.argv,`vcr push ${engine}${nameArg?` ${nameArg}`:""}`)}\`.`),0;let pushArgs=["push",...pushCompressionArgs(engine),ref];output_manager_default.log(`Running: ${engine} ${pushArgs.join(" ")}`);let pushResult=await runEngine(engine,pushArgs,{cwd:client.cwd,captureStderr:!0});if(pushResult.exitCode!==0)return reportEnginePushFailure(client,engine,"push",pushResult);let compressed=engine!=="docker";return output_manager_default.success(`Built and pushed ${ref}${compressed?" (zstd compression)":""}`),0}export{build as default};
|
|
@@ -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{resolveProjectContext}from"./chunk-
|
|
7
|
+
import{resolveProjectContext}from"./chunk-5HZOQZZA.js";function getProjectNameFromFlags(flags){return flags["--project"]}function getLinkedFlagsProject(client,projectName,options){return resolveProjectContext({client,projectNameOrId:projectName,projectNotFoundHandling:options?.projectNotFoundHandling,projectOptionName:options?.projectOptionName,commandName:options?.commandName})}export{getProjectNameFromFlags,getLinkedFlagsProject};
|
|
@@ -4,5 +4,5 @@ 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{external_exports}from"./chunk-64GNDWWX.js";import{recordLine}from"./chunk-
|
|
7
|
+
import{external_exports}from"./chunk-64GNDWWX.js";import{recordLine}from"./chunk-6DLSV6MR.js";import{isAPIError}from"./chunk-UNAQQ5DF.js";import{require_strip_ansi}from"./chunk-LPYHYTYI.js";import{__toESM}from"./chunk-NBPLUP7C.js";var CONTINUATION_VERSION=1,continuationSchema=external_exports.object({v:external_exports.literal(CONTINUATION_VERSION),event:external_exports.string().min(1),ownerId:external_exports.string().min(1),projectIds:external_exports.array(external_exports.string().min(1)).optional(),timeRange:external_exports.object({start:external_exports.string().min(1),end:external_exports.string().min(1)}),filter:external_exports.string().optional(),order:external_exports.enum(["asc","desc"]),cursor:external_exports.string().min(1)});function encodeContinuation(continuation){let payload={v:CONTINUATION_VERSION,event:continuation.event,ownerId:continuation.ownerId,...continuation.projectIds?{projectIds:[...continuation.projectIds]}:{},timeRange:{start:continuation.timeRange.start,end:continuation.timeRange.end},...continuation.filter!==void 0?{filter:continuation.filter}:{},order:continuation.order,cursor:continuation.cursor};return Buffer.from(JSON.stringify(payload),"utf8").toString("base64url")}function decodeContinuation(token){if(!/^[A-Za-z0-9_-]+$/.test(token))return;let raw;try{raw=JSON.parse(Buffer.from(token,"base64url").toString("utf8"))}catch{return}let parsed=continuationSchema.safeParse(raw);if(!parsed.success)return;let{v:_version,...continuation}=parsed.data;return continuation}var MAX_PAGE_SIZE=1e3,QUERY_REASON_HEADER="x-vercel-observability-query-reason",responseSchema=external_exports.object({events:external_exports.array(external_exports.record(external_exports.string(),external_exports.unknown())),pagination:external_exports.object({hasMore:external_exports.boolean(),nextCursor:external_exports.string().nullable()}),meta:external_exports.object({excludedIntervals:external_exports.array(external_exports.object({start:external_exports.string(),end:external_exports.string()})).optional()}).passthrough().optional()}),InvalidEventsResponseError=class extends Error{constructor(){super("The Observability API returned an invalid events response."),this.name="InvalidEventsResponseError"}},RecordTooLargeError=class extends Error{constructor(){super("A single record exceeds the API response size limit and cannot be returned."),this.name="RecordTooLargeError"}};function isResultTooLarge(err){return isAPIError(err)&&err.status===413&&err.code==="result_too_large"}async function fetchEventsPage(client,request,limit,cursor){let body={event:request.event,scope:{ownerId:request.ownerId,...request.projectIds?{projectIds:[...request.projectIds]}:{}},timeRange:{start:request.timeRange.start,end:request.timeRange.end},select:[...request.select],order:"desc",limit};request.filter&&(body.filter=request.filter),cursor&&(body.cursor=cursor);let params=new URLSearchParams({teamId:request.ownerId}),response=await client.fetch(`/v1/observability/events?${params}`,{method:"POST",headers:{[QUERY_REASON_HEADER]:request.queryReason},body,useCurrentTeam:!1,...request.bailOn429?{bailOn429:!0}:{},...request.gatewayTimeoutRetries!==void 0?{gatewayTimeoutRetries:request.gatewayTimeoutRetries}:{}}),parsed=responseSchema.safeParse(response);if(!parsed.success)throw new InvalidEventsResponseError;return parsed.data}async function*fetchEventPages(client,request,limit,startCursor){let remaining=limit,maxPageSize=MAX_PAGE_SIZE,cursor=startCursor,lastNextCursor=null;for(;remaining>0;){let pageSize=Math.min(remaining,maxPageSize),response;for(;;)try{response=await fetchEventsPage(client,request,pageSize,cursor);break}catch(err){if(!isResultTooLarge(err))throw err;if(pageSize===1)throw new RecordTooLargeError;pageSize=Math.max(1,Math.floor(pageSize/2)),maxPageSize=pageSize}let events=response.events.slice(0,remaining);remaining-=events.length;let{hasMore,nextCursor}=response.pagination,continues=hasMore&&!!nextCursor&&nextCursor!==cursor;if(lastNextCursor=continues?nextCursor:null,yield{events,excludedIntervals:response.meta?.excludedIntervals??[],nextCursor:lastNextCursor},!continues)return{hasMore,nextCursor:null};cursor=nextCursor??void 0}return{hasMore:!0,nextCursor:lastNextCursor}}function sortIntervals(intervals){return[...intervals].sort((a,b)=>Date.parse(a.start)-Date.parse(b.start)||Date.parse(a.end)-Date.parse(b.end))}var import_strip_ansi=__toESM(require_strip_ansi(),1);function recordLine2(type,event){return recordLine(type,event)}function warningLine(warning){let line={type:"warning",reason:warning.reason,message:(0,import_strip_ansi.default)(warning.message),...warning.data?{data:warning.data}:{}};return`${JSON.stringify(line)}
|
|
8
8
|
`}function serializeTimeRange(range){return{start:range.start.toISOString(),end:range.end.toISOString()}}export{encodeContinuation,decodeContinuation,InvalidEventsResponseError,RecordTooLargeError,fetchEventPages,sortIntervals,recordLine2 as recordLine,warningLine,serializeTimeRange};
|
|
@@ -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{getContextName}from"./chunk-
|
|
7
|
+
import{getContextName}from"./chunk-JX562QLD.js";import{DeploymentNotFound,DeploymentPermissionDenied,InvalidDeploymentId,isAPIError}from"./chunk-UNAQQ5DF.js";async function getAliases(client,deploymentId,next,limit=20){let aliasUrl=`/v3/now/aliases?limit=${limit}`;next&&(aliasUrl+=`&until=${next}`);let to=deploymentId?`/now/deployments/${deploymentId}/aliases`:aliasUrl;try{return await client.fetch(to)}catch(err){if(isAPIError(err)){let contextName=await getContextName(client,{allowOwnerLookupFallback:!0});if(err.status===404)throw new DeploymentNotFound({id:deploymentId,context:contextName});if(err.status===403&&deploymentId)throw new DeploymentPermissionDenied(deploymentId,contextName);if(err.status===400&&err.message.includes("`id`")&&deploymentId)throw new InvalidDeploymentId(deploymentId)}throw err}}export{getAliases};
|
|
@@ -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{emitAlertsScopeError,resolveAlertsScope}from"./chunk-
|
|
7
|
+
import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-QUDPFC2I.js";import{handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-6JY43KSR.js";import{getScope}from"./chunk-JX562QLD.js";import{getProjectByNameOrId}from"./chunk-VO5M6G7M.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-3QTP26QS.js";import{ProjectNotFound,isAPIError}from"./chunk-UNAQQ5DF.js";async function resolveRulesTeam(client,jsonOutput){let scope;try{scope=await getScope(client,{resolveLocalScope:!0})}catch(err){if(isAPIError(err)&&(err.status===403||err.status===404))return emitAlertsScopeError(client,jsonOutput,err.code||"API_ERROR",err.serverMessage||`API error (${err.status}).`,{reason:AGENT_REASON.MISSING_SCOPE,hint:"The selected team could not be loaded. Select a team you can access, or pass --scope <team-slug>.",next:[{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Select a team"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Inspect the current scope"}]});throw err}let{team}=scope;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:"Monitors 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="monitors 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,"monitors --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}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope};
|
|
@@ -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{printProjectNotFoundError}from"./chunk-
|
|
7
|
+
import{printProjectNotFoundError}from"./chunk-RD752RFM.js";import{detectExplicitScope}from"./chunk-JX562QLD.js";import{getLinkedProject}from"./chunk-6DLSV6MR.js";import{omitGlobalFlagsFromArgs}from"./chunk-3QTP26QS.js";function getInvokingCommandArgsFromArgv(argv){let args=omitGlobalFlagsFromArgs(argv.slice(2)),positionals=[];for(let arg of args){if(arg.startsWith("-"))break;positionals.push(arg)}return positionals}async function resolveProjectContext({client,cwd=client.cwd,projectNameOrId,projectAccountId,commandName="",projectOptionName,projectNotFoundHandling="report",skipOwnerLookup,allowOwnerLookupFallback,allowProjectLookupFallback,quiet,allowConfigExecution}){let context=await getLinkedProject(client,{cwd,projectName:projectNameOrId,projectAccountId,projectNameIsExplicit:!!projectNameOrId,scopeIsExplicit:detectExplicitScope(client),skipOwnerLookup,allowOwnerLookupFallback,allowProjectLookupFallback,quiet,allowConfigExecution});return context.status==="not_linked"&&projectNameOrId&&projectNotFoundHandling==="report"?(await printProjectNotFoundError(client,projectNameOrId,commandName||getInvokingCommandArgsFromArgv(client.argv),context.orgId,{projectOptionName}),{status:"error",exitCode:1,orgId:context.orgId}):context}export{resolveProjectContext};
|
|
@@ -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{sleep}from"./chunk-
|
|
7
|
+
import{sleep}from"./chunk-6DLSV6MR.js";import{fetch}from"./chunk-MY4MONOH.js";import{getCommandNamePlain}from"./chunk-EFGZK6OY.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import{require_source}from"./chunk-UJ7YUIEJ.js";import{__toESM}from"./chunk-NBPLUP7C.js";var import_chalk=__toESM(require_source(),1);var BYPASS_READY_DELAYS_MS=[250,500,1e3,2e3,2e3,2e3,2e3,2e3],BYPASS_READY_TIMEOUT_MS=12e3,BYPASS_READY_REQUEST_TIMEOUT_MS=3e3,PROTECTION_BODY_MAX_BYTES=16*1024;async function createDeploymentProtectionToken(client,projectId,orgId){if(!client.authConfig.token)throw output_manager_default.debug("No auth token available, skipping deployment protection token"),new Error("Authentication required to create protection bypass token");try{let response=await client.fetch(`/v1/projects/${projectId}/protection-bypass`,{method:"PATCH",body:"{}",headers:{"Content-Type":"application/json"},accountId:orgId}),{protectionBypass}=response,token=getAutomationBypassToken(protectionBypass);return output_manager_default.log(`Added a Protection Bypass for Automation secret to project ${import_chalk.default.bold(projectId)}. It stays on the project until you revoke it.`),output_manager_default.print(` To revoke it, open Deployment Protection in the project settings, or run:
|
|
8
8
|
${getCommandNamePlain(`project protection disable ${projectId} --protection-bypass --protection-bypass-secret <secret>`)}
|
|
9
9
|
|
|
10
10
|
`),token}catch(error){throw output_manager_default.debug(`Failed to generate deployment protection bypass token: ${error}`),output_manager_default.note('To bypass deployment protection, create a "Protection Bypass for Automation" secret in your project settings:'),output_manager_default.log(` 1. Visit ${import_chalk.default.cyan("https://vercel.com/dashboard")}`),output_manager_default.log(" 2. Go to your project settings \u2192 Deployment Protection"),output_manager_default.log(' 3. Generate a "Protection Bypass for Automation" secret'),output_manager_default.log(` 4. Use it with ${import_chalk.default.cyan("--protection-bypass")} option or set ${import_chalk.default.cyan("VERCEL_AUTOMATION_BYPASS_SECRET")} env var`),output_manager_default.log(""),new Error("Failed to create deployment protection bypass token")}}function getAutomationBypassToken(protectionBypass){if(!protectionBypass)throw new Error("No protection bypass tokens found");let token=Object.keys(protectionBypass).find(key=>protectionBypass[key].scope==="automation-bypass");if(!token)throw new Error("No automation bypass token found in protection bypass settings");return token}async function getOrCreateDeploymentProtectionToken(client,{project,org},{createIfMissing=!0,readinessUrl}={}){if(process.env.VERCEL_AUTOMATION_BYPASS_SECRET)return output_manager_default.debug("Using protection bypass secret from environment variable"),process.env.VERCEL_AUTOMATION_BYPASS_SECRET;if(project.protectionBypass&&Object.values(project.protectionBypass).length){let protectionBypass;try{protectionBypass=getAutomationBypassToken(project.protectionBypass)}catch(error){if(!createIfMissing)return output_manager_default.debug(`No existing automation bypass token found for project ${project.id}`),null;throw error}if(protectionBypass)return output_manager_default.debug("Using existing protection bypass token from project settings"),protectionBypass}if(!createIfMissing)return output_manager_default.debug(`Not creating an automation bypass token for project ${project.id}`),null;let token=await createDeploymentProtectionToken(client,project.id,org.id);return readinessUrl?(await waitForProtectionBypass(readinessUrl,token)||output_manager_default.warning("The new bypass secret is not active yet, so this request can return the Deployment Protection page. If it does, run the command again in a few seconds."),token):(await sleep(1e3),token)}async function waitForProtectionBypass(url,token){let origin=new URL(url).origin,deadline=Date.now()+BYPASS_READY_TIMEOUT_MS;output_manager_default.spinner("Waiting for the new bypass secret to become active\u2026");try{for(let attempt=0;;attempt++){let remaining=deadline-Date.now(),protectedResponse;try{protectedResponse=await isProtected(origin,token,Math.max(1,Math.min(BYPASS_READY_REQUEST_TIMEOUT_MS,remaining)))}catch(err){return output_manager_default.debug(`Could not check the new bypass secret: ${err}`),!0}if(!protectedResponse)return output_manager_default.debug(`The new bypass secret works after ${attempt+1} checks`),!0;let delay=BYPASS_READY_DELAYS_MS[attempt];if(delay===void 0||Date.now()+delay>=deadline)return output_manager_default.debug(`The new bypass secret did not work after ${attempt+1} checks`),!1;await sleep(delay)}}finally{output_manager_default.stopSpinner()}}async function isProtected(origin,token,timeoutMs){let res=await fetch(`${origin}/`,{headers:{accept:"application/json",...token?{"x-vercel-protection-bypass":token}:{}},redirect:"manual",signal:AbortSignal.timeout(timeoutMs)});try{return await isProtectionResponse(res,origin)}finally{await res.body?.cancel().catch(()=>{})}}async function isProtectionResponse(res,origin){let location=res.headers.get("location");if(res.status>=300&&res.status<400&&location){let target=new URL(location,origin);return target.host==="vercel.com"&&target.pathname==="/sso-api"}let contentType=res.headers.get("content-type")??"";if(res.status!==401||!contentType.includes("application/json"))return!1;try{let text=await readBodyUpTo(res,PROTECTION_BODY_MAX_BYTES);return text===null?!1:JSON.parse(text)?.error?.message==="Protected deployment"}catch{return!1}}async function readBodyUpTo(res,maxBytes){let reader=res.body?.getReader();if(!reader)return"";let chunks=[],size=0;try{for(;;){let{done,value}=await reader.read();if(done)break;if(size+=value.byteLength,size>maxBytes)return await reader.cancel(),null;chunks.push(value)}}finally{reader.releaseLock()}return Buffer.concat(chunks).toString("utf8")}export{getOrCreateDeploymentProtectionToken,isProtected};
|
|
@@ -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{formatCondition,formatTransform,isTargetTransform}from"./chunk-
|
|
7
|
+
import{formatCondition,formatTransform,isTargetTransform}from"./chunk-I5REFXOD.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";import{require_source}from"./chunk-UJ7YUIEJ.js";import{__toESM}from"./chunk-NBPLUP7C.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
|
|
8
8
|
Current conditions:`);for(let c of currentHas)output_manager_default.print(` has: ${c}
|
|
9
9
|
`);for(let c of currentMissing)output_manager_default.print(` does not have: ${c}
|
|
10
10
|
`);output_manager_default.print(`
|
|
@@ -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{writeProjectSettings}from"./chunk-
|
|
7
|
+
import{writeProjectSettings}from"./chunk-KBHH5ZD5.js";import{repoRootContains,repoRootOutsideMessage,resolvesToDirectoryInside}from"./chunk-EKMHS6C7.js";import{stamp_default}from"./chunk-LY3EY2VG.js";import{envPullCommandLogic}from"./chunk-S7CL46EL.js";import{parseTarget,warnDeprecatedProdFlag}from"./chunk-7IHVCKUV.js";import{ensureLink}from"./chunk-ZHPUHC7H.js";import{pullCommand}from"./chunk-XZYVBYUY.js";import{TelemetryClient}from"./chunk-QROPMCL2.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,describePullPathFix,getWriteCheckRoot,inspectWritableFile,jsonNextStep,printEnvFileSymlinkError,printUnsafeWritePathError,runWithJsonOutput,toEnvFileSymlinkError,writeJsonFailure,writeJsonResult,writeJsonUsageError}from"./chunk-6DLSV6MR.js";import{printAlignedLabel}from"./chunk-SUD5V67L.js";import{printError}from"./chunk-QI7BWXRV.js";import{parseArguments}from"./chunk-E7ICSU45.js";import{AGENT_REASON,AGENT_STATUS}from"./chunk-3QTP26QS.js";import{EnvFileSymlinkError,UnsafeWritePathError,humanizePath}from"./chunk-UNAQQ5DF.js";import{emoji,output_manager_default,prependEmoji}from"./chunk-RIXTYUYN.js";import{help}from"./chunk-7TREJIPV.js";import{getFlagsSpecification}from"./chunk-CUO3CYU3.js";import{require_source}from"./chunk-UJ7YUIEJ.js";import{__toESM}from"./chunk-NBPLUP7C.js";var import_chalk=__toESM(require_source(),1);import{join}from"node:path";var PullTelemetryClient=class extends TelemetryClient{trackCliArgumentProjectPath(value){value&&this.trackCliArgument({arg:"projectPath",value:this.redactedValue})}trackCliOptionEnvironment(environment){environment&&this.trackCliOption({option:"environment",value:this.redactedTargetName(environment)})}trackCliOptionGitBranch(gitBranch){gitBranch&&this.trackCliOption({option:"git-branch",value:this.redactedValue})}trackCliFlagProd(isProduction){isProduction&&this.trackCliFlag("prod")}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};function getEnvFilename(environment){return join(VERCEL_DIR,`.env.${environment}.local`)}async function pullAllEnvFiles(environment,client,link,flags,cwd){return await envPullCommandLogic(client,getEnvFilename(environment),!!flags["--yes"],environment,link,flags["--git-branch"],cwd,"vercel-cli:pull")}async function main(client){let parsedArgs=null,flagsSpecification=getFlagsSpecification(pullCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error){return client.argv.includes("--json")?writeJsonUsageError(client,error):(printError(error),2)}let telemetryClient=new PullTelemetryClient({opts:{store:client.telemetryEventStore}});if(parsedArgs.flags["--help"])return telemetryClient.trackCliFlagHelp("pull"),output_manager_default.print(help(pullCommand,{stream:client.stderr,columns:client.stderr.columns})),0;let cwd=parsedArgs.args[1]||client.cwd,autoConfirm=!!parsedArgs.flags["--yes"],isProduction=!!parsedArgs.flags["--prod"];warnDeprecatedProdFlag(client,parsedArgs.flags);let environment=parseTarget({flagName:"environment",flags:parsedArgs.flags})||"development";telemetryClient.trackCliArgumentProjectPath(parsedArgs.args[1]),telemetryClient.trackCliFlagYes(autoConfirm),telemetryClient.trackCliFlagProd(isProduction),telemetryClient.trackCliOptionGitBranch(parsedArgs.flags["--git-branch"]),telemetryClient.trackCliOptionEnvironment(parsedArgs.flags["--environment"]),telemetryClient.trackCliOptionProject(parsedArgs.flags["--project"]),telemetryClient.trackCliFlagJson(parsedArgs.flags["--json"]);let json=!!parsedArgs.flags["--json"],flags=parsedArgs.flags,run=()=>pullCommandLogic(client,cwd,autoConfirm,environment,flags,flags["--project"],{json});return json?runWithJsonOutput(client,run):run()}async function pullCommandLogic(client,cwd,autoConfirm,environment,flags,projectNameOrId,{json=!1}={}){let link=await ensureLink("pull",client,cwd,{autoConfirm,pullEnv:!1,projectName:projectNameOrId,failIfNotFound:!!projectNameOrId,skipOwnerLookup:!0,allowConfigExecution:!1});if(typeof link=="number")return link;let{project,org,repoRoot}=link,currentDirectory;if(repoRoot){if(!await repoRootContains(repoRoot,cwd))return output_manager_default.error(repoRootOutsideMessage("pull into",cwd,repoRoot)),1;if(currentDirectory=join(repoRoot,project.rootDirectory||""),project.rootDirectory&&!await resolvesToDirectoryInside(repoRoot,currentDirectory)){output_manager_default.fatal("Can't pull the project. Its Root Directory does not resolve to a directory in the repository."),printAlignedLabel("Repository",humanizePath(repoRoot));let{isPlainPath}=await import("./repo-root-STNOAHCH.js");return isPlainPath(project.rootDirectory)&&printAlignedLabel("Root Directory",project.rootDirectory),output_manager_default.print(`
|
|
8
8
|
Check the Root Directory in the Project Settings and the symbolic links in that path.
|
|
9
9
|
`),1}}else currentDirectory=cwd;client.config.currentTeam=org.type==="team"?org.id:void 0;let root=getWriteCheckRoot(client.cwd,currentDirectory,repoRoot),envFilename=getEnvFilename(environment),settingsPath=join(currentDirectory,VERCEL_DIR,VERCEL_DIR_PROJECT),envFile;try{await inspectWritableFile(join(currentDirectory,envFilename),root).catch(err=>{throw toEnvFileSymlinkError(err,envFilename)}),await inspectWritableFile(settingsPath,root),envFile=await pullAllEnvFiles(environment,client,link,flags,currentDirectory)}catch(err){if(!(err instanceof EnvFileSymlinkError||err instanceof UnsafeWritePathError))throw err;let fix=describePullPathFix(err),rerun=jsonNextStep(client,["pull",...cwd!==client.cwd?[cwd]:[],"--environment",environment,...flags["--git-branch"]?["--git-branch",flags["--git-branch"]]:[],...projectNameOrId?["--project",projectNameOrId]:[],...autoConfirm?["--yes"]:[]],fix.when);if(json)return writeJsonFailure(client,{status:AGENT_STATUS.ACTION_REQUIRED,message:err.message,next:[rerun],...err instanceof EnvFileSymlinkError?{reason:AGENT_REASON.ENV_FILE_SYMLINK,data:{path:err.meta.path,kind:err.meta.kind}}:{reason:AGENT_REASON.UNSAFE_WRITE_PATH,data:{path:err.meta.path,problem:err.meta.problem}}},1);let recoveries=[{instruction:`${fix.instruction}, then run`,command:rerun.command}];return err instanceof EnvFileSymlinkError?printEnvFileSymlinkError(err,recoveries):printUnsafeWritePathError(err,recoveries),1}if(output_manager_default.print(`
|
|
10
10
|
`),output_manager_default.log("Downloading project settings"),await writeProjectSettings(currentDirectory,project,org,typeof repoRoot=="string",root),json)return writeJsonResult(client,{envFile:envFile?{path:envFile.path,variables:envFile.variables}:null,projectSettings:{path:settingsPath},outcome:"pulled",...envFile?.secretNotReturnedWarning?{warnings:[{reason:"secret_not_returned",message:envFile.secretNotReturnedWarning}]}:{},next:[jsonNextStep(client,["env","list","--environment",environment,...projectNameOrId?["--project",projectNameOrId]:[]],"List the Environment Variables")]});let settingsStamp=stamp_default();return output_manager_default.print(`${prependEmoji(`Downloaded project settings to ${import_chalk.default.bold(humanizePath(settingsPath))} ${import_chalk.default.gray(settingsStamp())}`,emoji("success"))}
|