vercel 59.23.2 → 59.25.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/README.md +2 -0
- package/dist/chunks/add-M4CAL43A.js +8 -0
- package/dist/chunks/add-UQUROKDW.js +8 -0
- package/dist/chunks/add-VI6GCTOM.js +8 -0
- package/dist/chunks/build-KQJVVWRT.js +7 -0
- package/dist/chunks/{chunk-GTJ2OLYI.js → chunk-2R6NQXTQ.js} +1 -1
- package/dist/chunks/{chunk-4YVA7TSY.js → chunk-2VEEUAB2.js} +1 -1
- package/dist/chunks/{chunk-6LE44WCK.js → chunk-3B4P7YHO.js} +1 -1
- package/dist/chunks/{chunk-YGJO25LP.js → chunk-3JHCLQOM.js} +1 -1
- package/dist/chunks/{chunk-2SLHYWMC.js → chunk-3QHHQAHD.js} +1 -1
- package/dist/chunks/{chunk-J5X5YRBH.js → chunk-3RV2B7D3.js} +1 -1
- package/dist/chunks/{chunk-7B5NNJ2P.js → chunk-3V7QO2DE.js} +1 -1
- package/dist/chunks/{chunk-M6A7UH4U.js → chunk-4N526L5G.js} +2 -2
- package/dist/chunks/{chunk-6C7LA5RA.js → chunk-4VC32DHS.js} +1 -1
- package/dist/chunks/{chunk-73G2MHUX.js → chunk-6ISN6ZNQ.js} +1 -1
- package/dist/chunks/{chunk-UXCTETFN.js → chunk-6NPXWN5F.js} +1 -1
- package/dist/chunks/{chunk-NZKBBY2A.js → chunk-77Z66QDE.js} +1 -1
- package/dist/chunks/{chunk-JGPECEYY.js → chunk-7CQGVZ6Z.js} +1 -1
- package/dist/chunks/{chunk-PS645CWM.js → chunk-7QPE2TB5.js} +1 -1
- package/dist/chunks/{chunk-GRDPI246.js → chunk-AKZOYEBP.js} +1 -1
- package/dist/chunks/{chunk-ZKWM4JBE.js → chunk-AP36GAOG.js} +1 -1
- package/dist/chunks/{chunk-ZDORSGCG.js → chunk-AX3CQSVT.js} +1 -1
- package/dist/chunks/{chunk-WDVSYGZS.js → chunk-B6RDQTJF.js} +1 -1
- package/dist/chunks/{chunk-QR7QPUFN.js → chunk-BKV35LVB.js} +1 -1
- package/dist/chunks/{chunk-GHULCYAR.js → chunk-C5KVTG2O.js} +1 -1
- package/dist/chunks/chunk-DAWC332R.js +8 -0
- package/dist/chunks/{chunk-Z6LKARXP.js → chunk-DXYF2ULP.js} +1 -1
- package/dist/chunks/{chunk-64NJHVA3.js → chunk-EO4G5E7C.js} +5 -5
- package/dist/chunks/{chunk-QI3JSWD6.js → chunk-EWGDLEGG.js} +1 -1
- package/dist/chunks/{chunk-66RYR2GI.js → chunk-GKWT55SU.js} +1 -1
- package/dist/chunks/chunk-GQGVOJ4V.js +7 -0
- package/dist/chunks/{chunk-6SA6SOHU.js → chunk-GWSFFKFF.js} +1 -1
- package/dist/chunks/chunk-H4FTGLWV.js +22 -0
- package/dist/chunks/{chunk-X4X5RB2V.js → chunk-HZ5ZZCUZ.js} +1 -1
- package/dist/chunks/{chunk-VIR3KDCQ.js → chunk-I46LFJJG.js} +1 -1
- package/dist/chunks/{chunk-E4X2DH4K.js → chunk-IPTMDVQX.js} +1 -1
- package/dist/chunks/{chunk-KBKN7EI7.js → chunk-JSKGZLE4.js} +1 -1
- package/dist/chunks/chunk-K72XWICT.js +7 -0
- package/dist/chunks/chunk-KCARCOP5.js +10 -0
- package/dist/chunks/{chunk-TJKM3345.js → chunk-KYYVQW52.js} +1 -1
- package/dist/chunks/{chunk-ABSRS5KC.js → chunk-LN7DRS3D.js} +1 -1
- package/dist/chunks/{chunk-RRQTVE2P.js → chunk-MKY5IBKK.js} +1 -1
- package/dist/chunks/chunk-N5AIKGEO.js +9 -0
- package/dist/chunks/{chunk-FZH7RIRX.js → chunk-OXDGBPM6.js} +2 -2
- package/dist/chunks/{chunk-NYOQMU3P.js → chunk-Q2KQTYPU.js} +4 -4
- package/dist/chunks/{chunk-Z7PBDQNR.js → chunk-QRBAWXHP.js} +5 -5
- package/dist/chunks/{chunk-SFTXBTMI.js → chunk-REDC5VPI.js} +1 -1
- package/dist/chunks/chunk-RINZXCDJ.js +19 -0
- package/dist/chunks/{chunk-GGNZLN4R.js → chunk-RKH42432.js} +1 -1
- package/dist/chunks/{chunk-HOYHUMBD.js → chunk-RQTVTHE7.js} +1 -1
- package/dist/chunks/{chunk-UUM2N6IG.js → chunk-RRTWGLJT.js} +1 -1
- package/dist/chunks/{chunk-EHTHHCNG.js → chunk-RYZ5FAUA.js} +1 -0
- package/dist/chunks/{chunk-V5DCSHYJ.js → chunk-SM5JI6QM.js} +1 -1
- package/dist/chunks/{chunk-EQP3SW72.js → chunk-T4LZS75P.js} +1 -1
- package/dist/chunks/{chunk-KXYR43H5.js → chunk-VGECSVOP.js} +1 -1
- package/dist/chunks/{chunk-T4AZ3U7O.js → chunk-WWB66KP5.js} +1 -1
- package/dist/chunks/{chunk-GR3DLKYP.js → chunk-XDFTDPGS.js} +1 -1
- package/dist/chunks/{chunk-GL2AUBAI.js → chunk-XEWSGP2D.js} +1 -1
- package/dist/chunks/{chunk-4WSAOLBH.js → chunk-XQQGQ55A.js} +1 -1
- package/dist/chunks/{chunk-FB5TMOLQ.js → chunk-XU5QGRSL.js} +1 -1
- package/dist/chunks/{chunk-SOQ5DE44.js → chunk-YG6LPJFT.js} +1 -1
- package/dist/chunks/{chunk-2HEC5TDU.js → chunk-YUL3DN2H.js} +1 -1
- package/dist/chunks/{chunk-UWZ5VIIQ.js → chunk-YUQ2GQBY.js} +1 -1
- package/dist/chunks/{chunk-UGXNE4YE.js → chunk-ZDB3FWQF.js} +1 -1
- package/dist/chunks/clear-OCDDL3S6.js +8 -0
- package/dist/chunks/compile-vercel-config-UXTDRI6O.js +7 -0
- package/dist/chunks/config-46HFJIVB.js +8 -0
- package/dist/chunks/{config-HLVJQKP7.js → config-BTACRRGK.js} +1 -1
- package/dist/chunks/{connect-git-provider-P3SGOW6X.js → connect-git-provider-VYU65KTS.js} +1 -1
- package/dist/chunks/delete-CWCGCHDO.js +10 -0
- package/dist/chunks/delete-Q3YKRT7J.js +9 -0
- package/dist/chunks/{detect-projects-WLAFT5HC.js → detect-projects-BTDKBOU4.js} +1 -1
- package/dist/chunks/detect-services-EEFYZN3O.js +7 -0
- package/dist/chunks/disable-FD757X27.js +7 -0
- package/dist/chunks/discard-MCCFXCZX.js +14 -0
- package/dist/chunks/edit-4G7SOJA4.js +9 -0
- package/dist/chunks/edit-6OV2FEJN.js +8 -0
- package/dist/chunks/enable-Q633KLQ3.js +7 -0
- package/dist/chunks/{export-QCBAQNTT.js → export-CRBBRS6Y.js} +1 -1
- package/dist/chunks/future-IGDV62BF.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-V3LNOFRV.js +7 -0
- package/dist/chunks/{image-DU7GJZR2.js → image-ABRB2PUJ.js} +1 -1
- package/dist/chunks/import-builders-EJEQ4WXC.js +7 -0
- package/dist/chunks/{inspect-CPOFKE4X.js → inspect-A77NDMCO.js} +1 -1
- package/dist/chunks/inspect-DS7LIUWG.js +9 -0
- package/dist/chunks/{inspect-EMWJLBAW.js → inspect-IED7TPJ3.js} +1 -1
- package/dist/chunks/{inspect-IVJOEZC4.js → inspect-J3CBCMIX.js} +1 -1
- package/dist/chunks/inspect-JFCMOHNJ.js +13 -0
- package/dist/chunks/list-FEHTM5WL.js +11 -0
- package/dist/chunks/{list-KYZNCXBM.js → list-KLXDBNFC.js} +1 -1
- package/dist/chunks/{list-ZE2VPPXI.js → list-KSC5IJSH.js} +1 -1
- package/dist/chunks/login-C4PUINCQ.js +7 -0
- package/dist/chunks/login-S63HHO6R.js +9 -0
- package/dist/chunks/logs-6BYIWJPY.js +7 -0
- package/dist/chunks/ls-C47FWYJ6.js +8 -0
- package/dist/chunks/{ls-AKGRKWHM.js → ls-DHEY2FBJ.js} +1 -1
- package/dist/chunks/{ls-4M2OBNG6.js → ls-H4BCSNTG.js} +1 -1
- package/dist/chunks/{ls-DU5QTKKA.js → ls-IKHNJQFH.js} +1 -1
- package/dist/chunks/{ls-P6LKMT33.js → ls-IZWWHIEK.js} +1 -1
- package/dist/chunks/ls-UAWOECKQ.js +11 -0
- package/dist/chunks/{ls-7O63WIES.js → ls-YCPRYUT7.js} +1 -1
- package/dist/chunks/mutate-X22CUEKM.js +9 -0
- package/dist/chunks/{notifications-3RDFNJSD.js → notifications-HDMUEMWS.js} +1 -1
- package/dist/chunks/open-DU3MYPC3.js +7 -0
- package/dist/chunks/openapi-ULBM7RWG.js +7 -0
- package/dist/chunks/{permissions-AE5JO26V.js → permissions-PBNI3ZE3.js} +1 -1
- package/dist/chunks/prompt-missing-credentials-K6IWGP2N.js +7 -0
- package/dist/chunks/publish-BDBMRK5M.js +15 -0
- package/dist/chunks/pull-KMLPNSY3.js +7 -0
- package/dist/chunks/purchase-domain-if-available-ZNTAIIJN.js +7 -0
- package/dist/chunks/push-XPKPIGFN.js +7 -0
- package/dist/chunks/{query-PHAGR43V.js → query-ITYSKSNF.js} +1 -1
- package/dist/chunks/{reauthenticate-O6C2AW3J.js → reauthenticate-DIFJZWC5.js} +1 -1
- package/dist/chunks/reorder-CZ6OAJ5D.js +10 -0
- package/dist/chunks/reply-QENWO3AS.js +9 -0
- package/dist/chunks/resolve-IJUP7C3T.js +12 -0
- package/dist/chunks/restore-GUJCGF3E.js +16 -0
- package/dist/chunks/rm-2YGKGNKJ.js +8 -0
- package/dist/chunks/rm-3POYUGWI.js +8 -0
- package/dist/chunks/rm-5MVVB7NO.js +8 -0
- package/dist/chunks/rm-OTDHLXGL.js +8 -0
- package/dist/chunks/rm-T5F5THS2.js +8 -0
- package/dist/chunks/routes-IPGKJ2E4.js +1 -1
- package/dist/chunks/rule-inspect-G3G5ISY4.js +8 -0
- package/dist/chunks/{rules-6TZ6GSKT.js → rules-7YI6LVNU.js} +1 -1
- package/dist/chunks/schema-GOG6OEUZ.js +14 -0
- package/dist/chunks/{schema-5CZLK6NI.js → schema-N3USOS7S.js} +1 -1
- package/dist/chunks/{select-org-F2A5JJFH.js → select-org-6AA7XX6E.js} +1 -1
- package/dist/chunks/set-DGS6G7GQ.js +7 -0
- package/dist/chunks/setup-and-link-ZKMVK42H.js +7 -0
- package/dist/chunks/{tags-C3HWJLJ4.js → tags-XZDKLBYD.js} +1 -1
- package/dist/chunks/{types-H3B56MH6.js → types-UYIFBCCL.js} +1 -1
- package/dist/chunks/{update-5HE4X45O.js → update-TTQC7U3R.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +5 -5
- 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 +97 -89
- package/dist/help.js +1 -1
- package/dist/index.js +2 -2
- package/dist/vc.js +14 -4
- package/dist/version.mjs +1 -1
- package/package.json +23 -23
- package/dist/chunks/add-JVSHQKWC.js +0 -8
- package/dist/chunks/add-UKFIETLE.js +0 -8
- package/dist/chunks/add-Z3CJT63N.js +0 -8
- package/dist/chunks/build-SMQYQX23.js +0 -7
- package/dist/chunks/chunk-32QBGZ2Z.js +0 -7
- package/dist/chunks/chunk-5YA32S6K.js +0 -7
- package/dist/chunks/chunk-BX5KDMLT.js +0 -10
- package/dist/chunks/chunk-DL665Q3Z.js +0 -7
- package/dist/chunks/chunk-J3U3L45Y.js +0 -7
- package/dist/chunks/chunk-LKI6FRNM.js +0 -19
- package/dist/chunks/chunk-TBBU37TD.js +0 -9
- package/dist/chunks/chunk-TOGR3HUB.js +0 -8
- package/dist/chunks/chunk-WHYH7DVI.js +0 -20
- package/dist/chunks/clear-6IXTTZO6.js +0 -8
- package/dist/chunks/compile-vercel-config-ZFMPTU47.js +0 -7
- package/dist/chunks/config-XXHMPW46.js +0 -8
- package/dist/chunks/delete-52QKO73X.js +0 -10
- package/dist/chunks/delete-6VOUZDIR.js +0 -9
- package/dist/chunks/detect-services-YYT3LUUX.js +0 -7
- package/dist/chunks/disable-7FGR2S56.js +0 -7
- package/dist/chunks/discard-XKPTY3DC.js +0 -14
- package/dist/chunks/edit-A3HJCNPW.js +0 -8
- package/dist/chunks/edit-A7WGTO6K.js +0 -9
- package/dist/chunks/enable-NGKLGHJ2.js +0 -7
- package/dist/chunks/future-BB7OE645.js +0 -7
- package/dist/chunks/generate-cert-for-deploy-U7JF3HF3.js +0 -7
- package/dist/chunks/import-builders-IFZM44NL.js +0 -7
- package/dist/chunks/inspect-PHUMEO4A.js +0 -9
- package/dist/chunks/inspect-Q7OVSWFO.js +0 -13
- package/dist/chunks/list-G4JM2TYX.js +0 -11
- package/dist/chunks/login-AVVJFLSC.js +0 -9
- package/dist/chunks/login-RMAISH4F.js +0 -7
- package/dist/chunks/logs-3LTU2N25.js +0 -7
- package/dist/chunks/ls-HWUYP3XY.js +0 -8
- package/dist/chunks/ls-Y4QR3I6O.js +0 -11
- package/dist/chunks/mutate-KOAALPIL.js +0 -9
- package/dist/chunks/open-VD4F6MAO.js +0 -7
- package/dist/chunks/openapi-DKMCRF2V.js +0 -7
- package/dist/chunks/prompt-missing-credentials-QY4MZDT6.js +0 -7
- package/dist/chunks/publish-YXVJXBQT.js +0 -15
- package/dist/chunks/pull-QLC2CV4J.js +0 -7
- package/dist/chunks/purchase-domain-if-available-74ZYVVBE.js +0 -7
- package/dist/chunks/push-TMPPU5NU.js +0 -7
- package/dist/chunks/reorder-OAJ3NXQQ.js +0 -10
- package/dist/chunks/reply-Q3JFRFA3.js +0 -9
- package/dist/chunks/resolve-XXJVOXNE.js +0 -12
- package/dist/chunks/restore-MO4B2EQV.js +0 -16
- package/dist/chunks/rm-63LFH6NA.js +0 -8
- package/dist/chunks/rm-F2XD2XKB.js +0 -8
- package/dist/chunks/rm-GMG2DZOV.js +0 -8
- package/dist/chunks/rm-P6KA5RSP.js +0 -8
- package/dist/chunks/rm-SZ4HWA4R.js +0 -8
- package/dist/chunks/rule-inspect-JKAXOBII.js +0 -8
- package/dist/chunks/schema-S2ZAREKF.js +0 -14
- package/dist/chunks/set-PIKLGKT6.js +0 -7
- package/dist/chunks/setup-and-link-O5QSQ5K2.js +0 -7
|
@@ -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-XDFTDPGS.js";import{param}from"./chunk-SXUEGVWB.js";import{detectExplicitScope}from"./chunk-GQGVOJ4V.js";import{getLinkedProject,resolveProjectCwd}from"./chunk-EO4G5E7C.js";import{buildCommandWithYes,outputActionRequired}from"./chunk-KCARCOP5.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";var parseEnv=env=>{if(!env)return{};if(typeof env=="string"&&(env=[env]),Array.isArray(env)){let startingDict={};return env.reduce((o,e)=>{let key,value,equalsSign=e.indexOf("=");return equalsSign===-1?key=e:(key=e.slice(0,equalsSign),value=e.slice(equalsSign+1)),o[key]=value,o},startingDict)}return env};async function ensureLink(commandName,client,cwd,opts={}){cwd=await resolveProjectCwd(cwd);let link=opts.link,nonInteractive=opts.nonInteractive??client.nonInteractive??!1;if(opts.nonInteractive=nonInteractive,link||(opts.forceDelete?link={status:"not_linked",org:null,project:null}:link=await getLinkedProject(client,{cwd,projectName:opts.projectName,projectNameIsExplicit:!!(opts.projectName&&opts.failIfNotFound),scopeIsExplicit:detectExplicitScope(client),allowOwnerLookupFallback:opts.allowOwnerLookupFallback,skipRemoteLookup:opts.skipRemoteLookup}),opts.link=link),link.status==="linked"&&opts.forceDelete||link.status==="not_linked"){if(link.status==="not_linked"&&opts.failIfNotFound&&opts.projectName)return await printProjectNotFoundError(client,opts.projectName,commandName,link.orgId),1;if(link.status==="not_linked"&&opts.requireExistingLink)return output_manager_default.error(`Project is not linked. Run ${getCommandName("link")} first.`),1;let{default:setupAndLink}=await import("./setup-and-link-ZKMVK42H.js");if(link=await setupAndLink(client,cwd,opts),link.status==="not_linked")return 0}return link.status==="error"?(link.reason==="HEADLESS"&&(nonInteractive?outputActionRequired(client,{status:"action_required",reason:"confirmation_required",message:`Command ${getCommandNamePlain(commandName)} requires confirmation. Use option --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"Confirm and run"}]},link.exitCode):output_manager_default.error(`Command ${getCommandName(commandName)} requires confirmation. Use option ${param("--yes")} to confirm.`)),nonInteractive&&process.exit(link.exitCode),link.exitCode):link}export{parseEnv,ensureLink};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{getCommandName}from"./chunk-FI772UVH.js";import{require_build_utils}from"./chunk-EWWFNMPZ.js";import{require_dist}from"./chunk-QGIQK47P.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_bytes=__commonJS({"../../node_modules/.pnpm/bytes@3.0.0/node_modules/bytes/index.js"(exports,module){"use strict";module.exports=bytes2;module.exports.format=format;module.exports.parse=parse;var formatThousandsRegExp=/\B(?=(\d{3})+(?!\d))/g,formatDecimalsRegExp=/(?:\.0*|(\.[^0]+)0+)$/,map={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:(1<<30)*1024},parseRegExp=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i;function bytes2(value,options){return typeof value=="string"?parse(value):typeof value=="number"?format(value,options):null}function format(value,options){if(!Number.isFinite(value))return null;var mag=Math.abs(value),thousandsSeparator=options&&options.thousandsSeparator||"",unitSeparator=options&&options.unitSeparator||"",decimalPlaces=options&&options.decimalPlaces!==void 0?options.decimalPlaces:2,fixedDecimals=!!(options&&options.fixedDecimals),unit=options&&options.unit||"";(!unit||!map[unit.toLowerCase()])&&(mag>=map.tb?unit="TB":mag>=map.gb?unit="GB":mag>=map.mb?unit="MB":mag>=map.kb?unit="KB":unit="B");var val=value/map[unit.toLowerCase()],str=val.toFixed(decimalPlaces);return fixedDecimals||(str=str.replace(formatDecimalsRegExp,"$1")),thousandsSeparator&&(str=str.replace(formatThousandsRegExp,thousandsSeparator)),str+unitSeparator+unit}function parse(val){if(typeof val=="number"&&!isNaN(val))return val;if(typeof val!="string")return null;var results=parseRegExp.exec(val),floatValue,unit="b";return results?(floatValue=parseFloat(results[1]),unit=results[4].toLowerCase()):(floatValue=parseInt(val,10),unit="b"),Math.floor(map[unit]*floatValue)}}});var NowError=class extends Error{constructor({code:code2,message,meta}){super(message);this.code=code2,this.meta=meta}};var import_chalk=__toESM(require_source(),1);function code(cmd,{backticks=!0}={}){let tick=backticks?import_chalk.default.gray("`"):"";return`${tick}${import_chalk.default.bold(cmd)}${tick}`}var import_bytes=__toESM(require_bytes(),1),import_build_utils=__toESM(require_build_utils(),1);var import_chalk2=__toESM(require_source(),1),import_error_utils=__toESM(require_dist(),1),APIError=class extends Error{constructor(message,response,body){super();if(this.message=`${message} (${response.status})`,this.status=response.status,this.serverMessage=message,this.wwwAuthenticate=response.headers.get("WWW-Authenticate")??void 0,body)for(let field of Object.keys(body))field!=="message"&&(this[field]=body[field]);if(response.status===429||response.status===503){let parsed=parseRetryAfterHeaderAsMillis(response.headers.get("Retry-After"));this.retryAfterMs=parsed??(response.status===429?0:void 0)}}};function parseRetryAfterHeaderAsMillis(header){if(!header)return;let retryAfterMs=Number(header)*1e3;if(Number.isNaN(retryAfterMs)){if(retryAfterMs=Date.parse(header),Number.isNaN(retryAfterMs))return;retryAfterMs=retryAfterMs-Date.now()}return Math.max(retryAfterMs,0)}function isAPIError(v){return(0,import_error_utils.isError)(v)&&"status"in v}var TeamDeleted=class extends NowError{constructor(){super({code:"TEAM_DELETED",message:`Your team was deleted or you were removed from the team. You can switch to a different one using ${getCommandName("switch")}.`,meta:{}})}},InvalidToken=class extends NowError{constructor(tokenSource){let message;tokenSource==="flag"?message="The token provided via `--token` argument is not valid. Please provide a valid token.":tokenSource==="env"?message="The token provided via VERCEL_TOKEN environment variable is not valid. Please provide a valid token.":message=`The specified token is not valid. Use ${getCommandName("login")} to generate a new token.`,super({code:"NOT_AUTHORIZED",message,meta:{}})}},MissingUser=class extends NowError{constructor(){super({code:"MISSING_USER",message:"Not able to load user, missing from response",meta:{}})}},DomainAlreadyExists=class extends NowError{constructor(domain){super({code:"DOMAIN_ALREADY_EXISTS",meta:{domain},message:`The domain ${domain} already exists under a different context.`})}},DomainPermissionDenied=class extends NowError{constructor(domain,context){super({code:"DOMAIN_PERMISSION_DENIED",meta:{domain,context},message:`You don't have access to the domain ${domain} under ${context}.`})}},DomainExternal=class extends NowError{constructor(domain){super({code:"DOMAIN_EXTERNAL",meta:{domain},message:`The domain ${domain} must point to zeit.world.`})}},SourceNotFound=class extends NowError{constructor(){super({code:"SOURCE_NOT_FOUND",meta:{},message:"Not able to purchase. Please add a payment method using the dashboard."})}};var DomainNotFound=class extends NowError{constructor(domain,contextName){super({code:"DOMAIN_NOT_FOUND",meta:{domain},message:`Domain not found by "${domain}"${contextName?` under ${import_chalk2.default.bold(contextName)}`:""}.`})}},DomainNotVerified=class extends NowError{constructor(domain){super({code:"DOMAIN_NOT_VERIFIED",meta:{domain},message:`The domain ${domain} is not verified.`})}},DomainVerificationFailed=class extends NowError{constructor({domain,nsVerification,txtVerification,purchased=!1}){super({code:"DOMAIN_VERIFICATION_FAILED",meta:{domain,nsVerification,txtVerification,purchased},message:`We can't verify the domain ${domain}. Both Name Servers and DNS TXT verifications failed.`})}},InvalidDomain=class extends NowError{constructor(domain,message){super({code:"INVALID_DOMAIN",meta:{domain},message:message||`The domain ${domain} is not valid.`})}},NotDomainOwner=class extends NowError{constructor(message){super({code:"NOT_DOMAIN_OWNER",meta:{},message})}},InvalidDeploymentId=class extends NowError{constructor(id,message){super({code:"INVALID_DEPLOYMENT_ID",meta:{id},message:message||`The deployment id "${id}" is not valid.`})}},UnsupportedTLD=class extends NowError{constructor(domain){super({code:"UNSUPPORTED_TLD",meta:{domain},message:`The TLD for domain name ${domain} is not supported.`})}},TLDNotSupportedViaCLI=class extends NowError{constructor(domain){super({code:"UNSUPPORTED_TLD_VIA_CLI",meta:{domain},message:`Purchased for the TLD for domain name ${domain} are not supported via the CLI. Use the REST API or the dashboard to purchase.`})}},DomainNotAvailable=class extends NowError{constructor(domain){super({code:"DOMAIN_NOT_AVAILABLE",meta:{domain},message:`The domain ${domain} is not available to be purchased.`})}};var UnexpectedDomainPurchaseError=class extends NowError{constructor(domain){super({code:"UNEXPECTED_DOMAIN_PURCHASE_ERROR",meta:{domain},message:"An unexpected error happened while purchasing."})}},UnexpectedDomainTransferError=class extends NowError{constructor(domain){super({code:"UNEXPECTED_DOMAIN_TRANSFER_ERROR",meta:{domain},message:"An unexpected error happened while transferring."})}},DomainPaymentError=class extends NowError{constructor(){super({code:"DOMAIN_PAYMENT_ERROR",meta:{},message:"Your card was declined."})}},DomainPurchasePending=class extends NowError{constructor(domain){super({code:"DOMAIN_PURCHASE_PENDING",meta:{domain},message:`The domain purchase for ${domain} is pending.`})}},UserAborted=class extends NowError{constructor(){super({code:"USER_ABORTED",meta:{},message:"The user canceled the operation."})}},CertNotFound=class extends NowError{constructor(id){super({code:"CERT_NOT_FOUND",meta:{id},message:`The cert ${id} can't be found.`})}},CertsPermissionDenied=class extends NowError{constructor(context,domain){super({code:"CERTS_PERMISSION_DENIED",meta:{domain},message:`You don't have access to ${domain}'s certs under ${context}.`})}},CertOrderNotFound=class extends NowError{constructor(cns){super({code:"CERT_ORDER_NOT_FOUND",meta:{cns},message:`No cert order could be found for cns ${cns.join(" ,")}`})}},TooManyRequests=class extends NowError{constructor(api,retryAfterMs){super({code:"TOO_MANY_REQUESTS",meta:{api,retryAfterMs},message:"Rate limited. Too many requests to the same endpoint."})}},CertError=class extends NowError{constructor({cns,code:code2,message,helpUrl}){super({code:"CERT_ERROR",meta:{cns,code:code2,helpUrl},message})}},CertConfigurationError=class extends NowError{constructor({cns,message,external,type,helpUrl}){super({code:"CERT_CONFIGURATION_ERROR",meta:{cns,helpUrl,external,type},message})}},DeploymentNotFound=class extends NowError{constructor({context,id=""}){super({code:"DEPLOYMENT_NOT_FOUND",meta:{id,context},message:`Can't find the deployment "${id}" under the context "${context}"`})}},DeploymentNotReady=class extends NowError{constructor({url=""}){super({code:"DEPLOYMENT_NOT_READY",meta:{url},message:`The deployment https://${url} is not ready.`})}},DeploymentFailedAliasImpossible=class extends NowError{constructor(){super({code:"DEPLOYMENT_FAILED_ALIAS_IMPOSSIBLE",meta:{},message:"The deployment build has failed and cannot be aliased"})}},DeploymentPermissionDenied=class extends NowError{constructor(id,context){super({code:"DEPLOYMENT_PERMISSION_DENIED",meta:{id,context},message:`You don't have access to the deployment ${id} under ${context}.`})}},InvalidAlias=class extends NowError{constructor(alias){super({code:"INVALID_ALIAS",meta:{alias},message:`The given alias ${alias} is not valid`})}},AliasInUse=class extends NowError{constructor(alias){super({code:"ALIAS_IN_USE",meta:{alias},message:"The alias is already in use"})}},CertMissing=class extends NowError{constructor(domain){super({code:"CERT_MISSING",meta:{domain},message:`The certificate for domain ${domain} is missing`})}},CantParseJSONFile=class extends NowError{constructor(file,parseErrorLocation){let message=`Can't parse json file ${file}: ${parseErrorLocation}`;super({code:"CANT_PARSE_JSON_FILE",meta:{file,parseErrorLocation},message})}},ConflictingConfigFiles=class extends import_build_utils.NowBuildError{constructor(files,message,link){super({code:"CONFLICTING_CONFIG_FILES",message:message||"Multiple config files found. Please use only one configuration file.",link:link||"https://vercel.link/combining-old-and-new-config"});this.files=files}},DeprecatedNowJson=class extends import_build_utils.NowBuildError{constructor(_file){super({code:"DEPRECATED_NOW_JSON",message:"The `now.json` file is deprecated and no longer supported. Please rename it to `vercel.json`.",link:"https://vercel.com/docs/projects/project-configuration"})}},CantFindConfig=class extends NowError{constructor(paths){super({code:"CANT_FIND_CONFIG",meta:{paths},message:"Can't find a configuration file in the given locations."})}},WorkingDirectoryDoesNotExist=class extends NowError{constructor(){super({code:"CWD_DOES_NOT_EXIST",meta:{},message:"The current working directory does not exist."})}};var NoAliasInConfig=class extends NowError{constructor(){super({code:"NO_ALIAS_IN_CONFIG",meta:{},message:"There is no alias set up in config file."})}},InvalidAliasInConfig=class extends NowError{constructor(value){super({code:"INVALID_ALIAS_IN_CONFIG",meta:{value},message:"Invalid alias option in configuration."})}};var DNSPermissionDenied=class extends NowError{constructor(domain){super({code:"DNS_PERMISSION_DENIED",meta:{domain},message:`You don't have access to the DNS records of ${domain}.`})}},DNSInvalidPort=class extends NowError{constructor(){super({code:"DNS_INVALID_PORT",meta:{},message:"Invalid <port> parameter. A number was expected"})}},DNSInvalidType=class extends NowError{constructor(type){super({code:"DNS_INVALID_TYPE",meta:{type},message:`Invalid <type> parameter "${type}". Expected one of A, AAAA, ALIAS, CAA, CNAME, MX, SRV, TXT`})}},DNSConflictingRecord=class extends NowError{constructor(record){super({code:"DNS_CONFLICTING_RECORD",meta:{record},message:` A conflicting record exists "${record}".`})}},DomainRemovalConflict=class extends NowError{constructor({aliases,certs,message,pendingAsyncPurchase,resolvable,suffix,transferring}){super({code:"domain_removal_conflict",meta:{aliases,certs,pendingAsyncPurchase,suffix,transferring,resolvable},message})}},DomainMoveConflict=class extends NowError{constructor({message,pendingAsyncPurchase,resolvable,suffix}){super({code:"domain_move_conflict",meta:{pendingAsyncPurchase,resolvable,suffix},message})}};var InvalidMoveDestination=class extends NowError{constructor(destination){super({code:"INVALID_MOVE_DESTINATION",message:`Invalid move destination "${destination}"`,meta:{destination}})}};var LambdaSizeExceededError=class extends NowError{constructor(size,maxLambdaSize){super({code:"MAX_LAMBDA_SIZE_EXCEEDED",message:`The lambda function size (${(0,import_bytes.default)(size).toLowerCase()}) exceeds the maximum size limit (${(0,import_bytes.default)(maxLambdaSize).toLowerCase()}).`,meta:{size,maxLambdaSize}})}},MissingDotenvVarsError=class extends NowError{constructor(type,missing){let message;missing.length===1?message=`Env var ${JSON.stringify(missing[0])} is not defined in ${code(type)} file`:message=[`The following env vars are not defined in ${code(type)} file:`,...missing.map(name=>` - ${JSON.stringify(name)}`)].join(`
|
|
8
|
+
`),message+=`
|
|
9
|
+
Read more: https://err.sh/vercel/missing-env-file`,super({code:"MISSING_DOTENV_VARS",message,meta:{type,missing}})}},DeploymentsRateLimited=class extends NowError{constructor(message){super({code:"DEPLOYMENTS_RATE_LIMITED",meta:{},message})}},BuildsRateLimited=class extends NowError{constructor(message,meta={}){super({code:"BUILDS_RATE_LIMITED",meta,message})}},ProjectNotFound=class extends NowError{constructor(nameOrId){super({code:"PROJECT_NOT_FOUND",meta:{},message:`There is no project for "${nameOrId}"`})}},LinkRequiredError=class extends NowError{constructor(message="No project is linked in this directory. Run `vercel link` or pass a project name."){super({code:"LINK_REQUIRED",meta:{},message})}},AliasDomainConfigured=class extends NowError{constructor({message}){super({code:"DOMAIN_CONFIGURED",meta:{},message})}},MissingBuildScript=class extends NowError{constructor({message}){super({code:"MISSING_BUILD_SCRIPT",meta:{},message})}},ConflictingFilePath=class extends NowError{constructor({message}){super({code:"CONFLICTING_FILE_PATH",meta:{},message})}},ConflictingPathSegment=class extends NowError{constructor({message}){super({code:"CONFLICTING_PATH_SEGMENT",meta:{},message})}},BuildError=class extends NowError{constructor({message,meta}){super({code:"BUILD_ERROR",meta,message})}},SchemaValidationFailed=class extends NowError{constructor(message,keyword,dataPath,params){super({code:"SCHEMA_VALIDATION_FAILED",meta:{message,keyword,dataPath,params},message:"Schema verification failed"})}},InvalidLocalConfig=class extends NowError{constructor(value){super({code:"INVALID_LOCAL_CONFIG",meta:{value},message:`Invalid local config parameter [${value.map(localConfig=>`"${localConfig}"`).join(", ")}]. A string was expected.`})}};export{require_bytes,NowError,code,APIError,parseRetryAfterHeaderAsMillis,isAPIError,TeamDeleted,InvalidToken,MissingUser,DomainAlreadyExists,DomainPermissionDenied,DomainExternal,SourceNotFound,DomainNotFound,DomainNotVerified,DomainVerificationFailed,InvalidDomain,NotDomainOwner,InvalidDeploymentId,UnsupportedTLD,TLDNotSupportedViaCLI,DomainNotAvailable,UnexpectedDomainPurchaseError,UnexpectedDomainTransferError,DomainPaymentError,DomainPurchasePending,UserAborted,CertNotFound,CertsPermissionDenied,CertOrderNotFound,TooManyRequests,CertError,CertConfigurationError,DeploymentNotFound,DeploymentNotReady,DeploymentFailedAliasImpossible,DeploymentPermissionDenied,InvalidAlias,AliasInUse,CertMissing,CantParseJSONFile,ConflictingConfigFiles,DeprecatedNowJson,CantFindConfig,WorkingDirectoryDoesNotExist,NoAliasInConfig,InvalidAliasInConfig,DNSPermissionDenied,DNSInvalidPort,DNSInvalidType,DNSConflictingRecord,DomainRemovalConflict,DomainMoveConflict,InvalidMoveDestination,LambdaSizeExceededError,MissingDotenvVarsError,DeploymentsRateLimited,BuildsRateLimited,ProjectNotFound,LinkRequiredError,AliasDomainConfigured,MissingBuildScript,ConflictingFilePath,ConflictingPathSegment,BuildError,SchemaValidationFailed,InvalidLocalConfig};
|
|
10
|
+
/*! Bundled license information:
|
|
11
|
+
|
|
12
|
+
bytes/index.js:
|
|
13
|
+
(*!
|
|
14
|
+
* bytes
|
|
15
|
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
16
|
+
* Copyright(c) 2015 Jed Watson
|
|
17
|
+
* MIT Licensed
|
|
18
|
+
*)
|
|
19
|
+
*/
|
|
@@ -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-3QHHQAHD.js";import{handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-FA6O7FPC.js";import{isJSONObject}from"./chunk-Q2KQTYPU.js";import{AGENT_REASON}from"./chunk-T4LZS75P.js";import{getScope}from"./chunk-GQGVOJ4V.js";import{getProjectByNameOrId}from"./chunk-EO4G5E7C.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-KCARCOP5.js";import{ProjectNotFound,isAPIError}from"./chunk-RINZXCDJ.js";import{output_manager_default}from"./chunk-EWWFNMPZ.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"}]},1),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("; ");return outputAgentError(client,{status:"error",reason:options.reason??AGENT_REASON.INVALID_ARGUMENTS,message,hint:options.hint??(issueSummary||void 0)},1),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
|
`)),1}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"}]},1)}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope,rulesCollectionPath,rulesItemPath,ruleNotificationsPath,rulesNotificationsPath,rulesNotificationLinksPath,rulesSchemaPath,fetchRule,outputRulesError,handleRulesApiError,readRuleBody,getBodyType,emitRulesArgParseError};
|
|
@@ -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{resolveProjectContext}from"./chunk-
|
|
7
|
+
import{resolveProjectContext}from"./chunk-GKWT55SU.js";import{AGENT_REASON,AGENT_STATUS}from"./chunk-T4LZS75P.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import{buildCommandWithYes,outputAgentError,withGlobalFlags}from"./chunk-KCARCOP5.js";import{getFlagsSpecification,getGlobalFlagsFromArgs}from"./chunk-JAJW3P42.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";async function requireProjectContext(client,command,projectName){let link=await resolveProjectContext({client,projectNameOrId:projectName});if(link.status==="error")return link.exitCode;if(link.status==="not_linked"){if(client.nonInteractive)if(command==="redirects"){let linkCmd=getCommandNamePlain("link");outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.NOT_LINKED,message:`Your codebase isn't linked to a project on Vercel. Run ${linkCmd} to begin.`,next:[{command:linkCmd}]},1)}else{let flags=getGlobalFlagsFromArgs(client.argv.slice(2)),cmd=getCommandNamePlain(`link ${flags.join(" ")}`.trim());return outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.NOT_LINKED,userActionRequired:!0,message:`Your codebase is not linked to a Vercel project. Run link first, then retry ${command} commands.`,next:[{command:cmd,when:"to link this directory to a project"}]},1),1}return output_manager_default.error(`Your codebase isn't linked to a project on Vercel. Run ${getCommandName("link")} to begin.`),1}return client.config.currentTeam=link.org.type==="team"?link.org.id:void 0,link}function parseSubcommandArguments(argv,command){let flagsSpecification=getFlagsSpecification(command.options);return parseArguments(argv,flagsSpecification)}function validateRequiredArguments(args,required){for(let i=0;i<required.length;i++)if(!args[i])return`Missing required argument: ${required[i]}`;return null}var ROUTE_TYPE_LABELS={rewrite:"Rewrite",redirect:"Redirect",set_status:"Set Status",transform:"Transform"};function getRouteTypeLabel(rule){return rule.routeType?ROUTE_TYPE_LABELS[rule.routeType]??"-":"-"}var SRC_SYNTAX_LABELS={equals:"Exact Match","path-to-regexp":"Pattern",regex:"Regex"};function getSrcSyntaxLabel(rule){let syntax=rule.srcSyntax??"regex";return SRC_SYNTAX_LABELS[syntax]}function isTargetTransform(transform){return"target"in transform}var import_chalk=__toESM(require_source(),1);function withGlobalFlags2(client,commandTemplate){return withGlobalFlags(client,commandTemplate,{preserveProject:!0})}function shellQuoteRouteIdentifierForSuggestion(identifier){return identifier.includes(" ")?identifier.includes("'")?identifier.includes('"')?`"${identifier.replace(/"/g,'\\"')}"`:`"${identifier}"`:`'${identifier}'`:identifier}async function parseSubcommandArgs(argv,command,client){let parsedArgs;try{parsedArgs=parseSubcommandArguments(argv,command)}catch(err){if(client?.nonInteractive){let rawMessage=err instanceof Error?err.message:String(err),flags=getGlobalFlagsFromArgs(client.argv.slice(2),{preserveProject:!0}),message=rawMessage,next=[{command:getCommandNamePlain(`routes ${command.name} ${flags.join(" ")}`.trim()),when:"fix flags and retry"}],aiIdx=argv.indexOf("--ai");return(aiIdx!==-1&&(aiIdx===argv.length-1||argv[aiIdx+1]!==void 0&&argv[aiIdx+1].startsWith("-"))||/option requires argument.*--ai|--ai.*requires argument/i.test(rawMessage))&&(command.name==="add"||command.name==="edit")&&(message=command.name==="add"?'--ai requires a description. Example: routes add --ai <description> --yes --non-interactive. Replace <description> with your text; use shell quotes if it contains spaces (e.g. --ai "Redirect /old to /new").':"--ai requires a description. Example: routes edit <name-or-id> --ai <description> --yes --non-interactive. Replace placeholders; use shell quotes for <description> if it contains spaces.",next=[{command:withGlobalFlags2(client,command.name==="add"?"routes add --ai <description> --yes":"routes edit <name-or-id> --ai <description> --yes"),when:"replace <description> with your text (quote it in the shell if it contains spaces), then run"},{command:getCommandNamePlain(`routes ${command.name} --help ${flags.join(" ")}`.trim()),when:"see all flags"}]),outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.INVALID_ARGUMENTS,message,next},1),1}return printError(err),1}return parsedArgs}async function confirmAction(client,skipConfirmation,message,details){return skipConfirmation?!0:client.nonInteractive?(outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:`${message} Re-run with --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"re-run with --yes to confirm"}]}),process.exit(1),!1):(details&&output_manager_default.print(` ${details}
|
|
8
8
|
`),await client.input.confirm(message,!1))}function formatCondition(condition){let parts=[import_chalk.default.gray(`[${condition.type}]`)];if(condition.key&&parts.push(import_chalk.default.cyan(condition.key)),condition.value!==void 0){let formatted=typeof condition.value=="string"?condition.value:JSON.stringify(condition.value);parts.push(condition.key?`= ${formatted}`:formatted)}return parts.join(" ")}var TRANSFORM_TYPE_LABELS={"request.headers":"Request Header","request.query":"Request Query","response.headers":"Response Header","request.path":"Request Path"},TRANSFORM_OP_LABELS={set:"set",append:"append",delete:"delete"};function formatTransform(transform,includeType=!0){let opLabel=TRANSFORM_OP_LABELS[transform.op]??transform.op,key=isTargetTransform(transform)?typeof transform.target.key=="string"?transform.target.key:JSON.stringify(transform.target.key):"path",parts=[];if(includeType){let typeLabel=TRANSFORM_TYPE_LABELS[transform.type]??transform.type;parts.push(import_chalk.default.gray(`[${typeLabel}]`))}if(parts.push(import_chalk.default.yellow(opLabel),import_chalk.default.cyan(key)),transform.args!==void 0&&transform.op!=="delete"){let argsStr=Array.isArray(transform.args)?transform.args.join(", "):transform.args;parts.push(`= ${argsStr}`)}return parts.join(" ")}function parsePosition(position){if(position==="start")return{placement:"start"};if(position==="end")return{placement:"end"};if(position.startsWith("after:")){let referenceId=position.slice(6);if(!referenceId)throw new Error('Position "after:" requires a route ID');return{placement:"after",referenceId}}if(position.startsWith("before:")){let referenceId=position.slice(7);if(!referenceId)throw new Error('Position "before:" requires a route ID');return{placement:"before",referenceId}}throw new Error(`Invalid position: "${position}". Use: start, end, after:<id>, or before:<id>`)}async function offerAutoPromote(client,projectId,version,hadExistingStagingVersion,opts){let{default:updateRouteVersion}=await import("./update-route-version-XZAFPQJC.js"),{default:stamp}=await import("./stamp-OX4YO3KY.js");if(output_manager_default.print(`
|
|
9
9
|
${import_chalk.default.gray(`This change is staged. Run ${import_chalk.default.cyan(withGlobalFlags2(client,"routes publish"))} to make it live, or ${import_chalk.default.cyan(withGlobalFlags2(client,"routes discard-staging"))} to undo.`)}
|
|
10
10
|
`),!hadExistingStagingVersion&&!opts.skipPrompts){if(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{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-V6MR45PD.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{require_minimatch2 as require_minimatch}from"./chunk-Z7PBDQNR.js";import{require_types}from"./chunk-GHM7V3GG.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,require_lib}from"./chunk-64NJHVA3.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_universalify=__commonJS({"../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js"(exports){"use strict";exports.fromCallback=function(fn){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")fn.apply(this,arguments);else return new Promise((resolve,reject)=>{arguments[arguments.length]=(err,res)=>{if(err)return reject(err);resolve(res)},arguments.length++,fn.apply(this,arguments)})},"name",{value:fn.name})};exports.fromPromise=function(fn){return Object.defineProperty(function(){let cb=arguments[arguments.length-1];if(typeof cb!="function")return fn.apply(this,arguments);fn.apply(this,arguments).then(r=>cb(null,r),cb)},"name",{value:fn.name})}}});var require_fs=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/fs/index.js"(exports){"use strict";var u=require_universalify().fromCallback,fs=require_graceful_fs(),api=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(key=>typeof fs[key]=="function");Object.keys(fs).forEach(key=>{key!=="promises"&&(exports[key]=fs[key])});api.forEach(method=>{exports[method]=u(fs[method])});exports.exists=function(filename,callback){return typeof callback=="function"?fs.exists(filename,callback):new Promise(resolve=>fs.exists(filename,resolve))};exports.read=function(fd,buffer,offset,length,position,callback){return typeof callback=="function"?fs.read(fd,buffer,offset,length,position,callback):new Promise((resolve,reject)=>{fs.read(fd,buffer,offset,length,position,(err,bytesRead,buffer2)=>{if(err)return reject(err);resolve({bytesRead,buffer:buffer2})})})};exports.write=function(fd,buffer,...args){return typeof args[args.length-1]=="function"?fs.write(fd,buffer,...args):new Promise((resolve,reject)=>{fs.write(fd,buffer,...args,(err,bytesWritten,buffer2)=>{if(err)return reject(err);resolve({bytesWritten,buffer:buffer2})})})}}});var require_win32=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/win32.js"(exports,module){"use strict";var path=__require("path");function getRootPath(p){return p=path.normalize(path.resolve(p)).split(path.sep),p.length>0?p[0]:null}var INVALID_PATH_CHARS=/[<>:"|?*]/;function invalidWin32Path(p){let rp=getRootPath(p);return p=p.replace(rp,""),INVALID_PATH_CHARS.test(p)}module.exports={getRootPath,invalidWin32Path}}});var require_mkdirs=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),invalidWin32Path=require_win32().invalidWin32Path,o777=parseInt("0777",8);function mkdirs(p,opts,callback,made){if(typeof opts=="function"?(callback=opts,opts={}):(!opts||typeof opts!="object")&&(opts={mode:opts}),process.platform==="win32"&&invalidWin32Path(p)){let errInval=new Error(p+" contains invalid WIN32 path characters.");return errInval.code="EINVAL",callback(errInval)}let mode=opts.mode,xfs=opts.fs||fs;mode===void 0&&(mode=o777&~process.umask()),made||(made=null),callback=callback||function(){},p=path.resolve(p),xfs.mkdir(p,mode,er=>{if(!er)return made=made||p,callback(null,made);switch(er.code){case"ENOENT":if(path.dirname(p)===p)return callback(er);mkdirs(path.dirname(p),opts,(er2,made2)=>{er2?callback(er2,made2):mkdirs(p,opts,callback,made2)});break;default:xfs.stat(p,(er2,stat)=>{er2||!stat.isDirectory()?callback(er,made):callback(null,made)});break}})}module.exports=mkdirs}});var require_mkdirs_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),invalidWin32Path=require_win32().invalidWin32Path,o777=parseInt("0777",8);function mkdirsSync(p,opts,made){(!opts||typeof opts!="object")&&(opts={mode:opts});let mode=opts.mode,xfs=opts.fs||fs;if(process.platform==="win32"&&invalidWin32Path(p)){let errInval=new Error(p+" contains invalid WIN32 path characters.");throw errInval.code="EINVAL",errInval}mode===void 0&&(mode=o777&~process.umask()),made||(made=null),p=path.resolve(p);try{xfs.mkdirSync(p,mode),made=made||p}catch(err0){if(err0.code==="ENOENT"){if(path.dirname(p)===p)throw err0;made=mkdirsSync(path.dirname(p),opts,made),mkdirsSync(p,opts,made)}else{let stat;try{stat=xfs.statSync(p)}catch{throw err0}if(!stat.isDirectory())throw err0}}return made}module.exports=mkdirsSync}});var require_mkdirs2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,mkdirs=u(require_mkdirs()),mkdirsSync=require_mkdirs_sync();module.exports={mkdirs,mkdirsSync,mkdirp:mkdirs,mkdirpSync:mkdirsSync,ensureDir:mkdirs,ensureDirSync:mkdirsSync}}});var require_utimes=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/utimes.js"(exports,module){"use strict";var fs=require_graceful_fs(),os=__require("os"),path=__require("path");function hasMillisResSync(){let tmpfile=path.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));tmpfile=path.join(os.tmpdir(),tmpfile);let d=new Date(1435410243862);fs.writeFileSync(tmpfile,"https://github.com/jprichardson/node-fs-extra/pull/141");let fd=fs.openSync(tmpfile,"r+");return fs.futimesSync(fd,d,d),fs.closeSync(fd),fs.statSync(tmpfile).mtime>1435410243e3}function hasMillisRes(callback){let tmpfile=path.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));tmpfile=path.join(os.tmpdir(),tmpfile);let d=new Date(1435410243862);fs.writeFile(tmpfile,"https://github.com/jprichardson/node-fs-extra/pull/141",err=>{if(err)return callback(err);fs.open(tmpfile,"r+",(err2,fd)=>{if(err2)return callback(err2);fs.futimes(fd,d,d,err3=>{if(err3)return callback(err3);fs.close(fd,err4=>{if(err4)return callback(err4);fs.stat(tmpfile,(err5,stats)=>{if(err5)return callback(err5);callback(null,stats.mtime>1435410243e3)})})})})})}function timeRemoveMillis(timestamp){if(typeof timestamp=="number")return Math.floor(timestamp/1e3)*1e3;if(timestamp instanceof Date)return new Date(Math.floor(timestamp.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function utimesMillis(path2,atime,mtime,callback){fs.open(path2,"r+",(err,fd)=>{if(err)return callback(err);fs.futimes(fd,atime,mtime,futimesErr=>{fs.close(fd,closeErr=>{callback&&callback(futimesErr||closeErr)})})})}function utimesMillisSync(path2,atime,mtime){let fd=fs.openSync(path2,"r+");return fs.futimesSync(fd,atime,mtime),fs.closeSync(fd)}module.exports={hasMillisRes,hasMillisResSync,timeRemoveMillis,utimesMillis,utimesMillisSync}}});var require_stat=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/stat.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),NODE_VERSION_MAJOR_WITH_BIGINT=10,NODE_VERSION_MINOR_WITH_BIGINT=5,NODE_VERSION_PATCH_WITH_BIGINT=0,nodeVersion=process.versions.node.split("."),nodeVersionMajor=Number.parseInt(nodeVersion[0],10),nodeVersionMinor=Number.parseInt(nodeVersion[1],10),nodeVersionPatch=Number.parseInt(nodeVersion[2],10);function nodeSupportsBigInt(){if(nodeVersionMajor>NODE_VERSION_MAJOR_WITH_BIGINT)return!0;if(nodeVersionMajor===NODE_VERSION_MAJOR_WITH_BIGINT){if(nodeVersionMinor>NODE_VERSION_MINOR_WITH_BIGINT)return!0;if(nodeVersionMinor===NODE_VERSION_MINOR_WITH_BIGINT&&nodeVersionPatch>=NODE_VERSION_PATCH_WITH_BIGINT)return!0}return!1}function getStats(src,dest,cb){nodeSupportsBigInt()?fs.stat(src,{bigint:!0},(err,srcStat)=>{if(err)return cb(err);fs.stat(dest,{bigint:!0},(err2,destStat)=>err2?err2.code==="ENOENT"?cb(null,{srcStat,destStat:null}):cb(err2):cb(null,{srcStat,destStat}))}):fs.stat(src,(err,srcStat)=>{if(err)return cb(err);fs.stat(dest,(err2,destStat)=>err2?err2.code==="ENOENT"?cb(null,{srcStat,destStat:null}):cb(err2):cb(null,{srcStat,destStat}))})}function getStatsSync(src,dest){let srcStat,destStat;nodeSupportsBigInt()?srcStat=fs.statSync(src,{bigint:!0}):srcStat=fs.statSync(src);try{nodeSupportsBigInt()?destStat=fs.statSync(dest,{bigint:!0}):destStat=fs.statSync(dest)}catch(err){if(err.code==="ENOENT")return{srcStat,destStat:null};throw err}return{srcStat,destStat}}function checkPaths(src,dest,funcName,cb){getStats(src,dest,(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;return destStat&&destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error("Source and destination must not be the same.")):srcStat.isDirectory()&&isSrcSubdir(src,dest)?cb(new Error(errMsg(src,dest,funcName))):cb(null,{srcStat,destStat})})}function checkPathsSync(src,dest,funcName){let{srcStat,destStat}=getStatsSync(src,dest);if(destStat&&destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev)throw new Error("Source and destination must not be the same.");if(srcStat.isDirectory()&&isSrcSubdir(src,dest))throw new Error(errMsg(src,dest,funcName));return{srcStat,destStat}}function checkParentPaths(src,srcStat,dest,funcName,cb){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return cb();nodeSupportsBigInt()?fs.stat(destParent,{bigint:!0},(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb)):fs.stat(destParent,(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb))}function checkParentPathsSync(src,srcStat,dest,funcName){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return;let destStat;try{nodeSupportsBigInt()?destStat=fs.statSync(destParent,{bigint:!0}):destStat=fs.statSync(destParent)}catch(err){if(err.code==="ENOENT")return;throw err}if(destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev)throw new Error(errMsg(src,dest,funcName));return checkParentPathsSync(src,srcStat,destParent,funcName)}function isSrcSubdir(src,dest){let srcArr=path.resolve(src).split(path.sep).filter(i=>i),destArr=path.resolve(dest).split(path.sep).filter(i=>i);return srcArr.reduce((acc,cur,i)=>acc&&destArr[i]===cur,!0)}function errMsg(src,dest,funcName){return`Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`}module.exports={checkPaths,checkPathsSync,checkParentPaths,checkParentPathsSync,isSrcSubdir}}});var require_buffer=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/buffer.js"(exports,module){"use strict";module.exports=function(size){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(size)}catch{return new Buffer(size)}return new Buffer(size)}}});var require_copy_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),mkdirpSync=require_mkdirs2().mkdirsSync,utimesSync=require_utimes().utimesMillisSync,stat=require_stat();function copySync(src,dest,opts){typeof opts=="function"&&(opts={filter:opts}),opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
7
|
+
import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-V6MR45PD.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{require_minimatch2 as require_minimatch}from"./chunk-QRBAWXHP.js";import{require_types}from"./chunk-GHM7V3GG.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,require_lib}from"./chunk-EO4G5E7C.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_universalify=__commonJS({"../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js"(exports){"use strict";exports.fromCallback=function(fn){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")fn.apply(this,arguments);else return new Promise((resolve,reject)=>{arguments[arguments.length]=(err,res)=>{if(err)return reject(err);resolve(res)},arguments.length++,fn.apply(this,arguments)})},"name",{value:fn.name})};exports.fromPromise=function(fn){return Object.defineProperty(function(){let cb=arguments[arguments.length-1];if(typeof cb!="function")return fn.apply(this,arguments);fn.apply(this,arguments).then(r=>cb(null,r),cb)},"name",{value:fn.name})}}});var require_fs=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/fs/index.js"(exports){"use strict";var u=require_universalify().fromCallback,fs=require_graceful_fs(),api=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(key=>typeof fs[key]=="function");Object.keys(fs).forEach(key=>{key!=="promises"&&(exports[key]=fs[key])});api.forEach(method=>{exports[method]=u(fs[method])});exports.exists=function(filename,callback){return typeof callback=="function"?fs.exists(filename,callback):new Promise(resolve=>fs.exists(filename,resolve))};exports.read=function(fd,buffer,offset,length,position,callback){return typeof callback=="function"?fs.read(fd,buffer,offset,length,position,callback):new Promise((resolve,reject)=>{fs.read(fd,buffer,offset,length,position,(err,bytesRead,buffer2)=>{if(err)return reject(err);resolve({bytesRead,buffer:buffer2})})})};exports.write=function(fd,buffer,...args){return typeof args[args.length-1]=="function"?fs.write(fd,buffer,...args):new Promise((resolve,reject)=>{fs.write(fd,buffer,...args,(err,bytesWritten,buffer2)=>{if(err)return reject(err);resolve({bytesWritten,buffer:buffer2})})})}}});var require_win32=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/win32.js"(exports,module){"use strict";var path=__require("path");function getRootPath(p){return p=path.normalize(path.resolve(p)).split(path.sep),p.length>0?p[0]:null}var INVALID_PATH_CHARS=/[<>:"|?*]/;function invalidWin32Path(p){let rp=getRootPath(p);return p=p.replace(rp,""),INVALID_PATH_CHARS.test(p)}module.exports={getRootPath,invalidWin32Path}}});var require_mkdirs=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),invalidWin32Path=require_win32().invalidWin32Path,o777=parseInt("0777",8);function mkdirs(p,opts,callback,made){if(typeof opts=="function"?(callback=opts,opts={}):(!opts||typeof opts!="object")&&(opts={mode:opts}),process.platform==="win32"&&invalidWin32Path(p)){let errInval=new Error(p+" contains invalid WIN32 path characters.");return errInval.code="EINVAL",callback(errInval)}let mode=opts.mode,xfs=opts.fs||fs;mode===void 0&&(mode=o777&~process.umask()),made||(made=null),callback=callback||function(){},p=path.resolve(p),xfs.mkdir(p,mode,er=>{if(!er)return made=made||p,callback(null,made);switch(er.code){case"ENOENT":if(path.dirname(p)===p)return callback(er);mkdirs(path.dirname(p),opts,(er2,made2)=>{er2?callback(er2,made2):mkdirs(p,opts,callback,made2)});break;default:xfs.stat(p,(er2,stat)=>{er2||!stat.isDirectory()?callback(er,made):callback(null,made)});break}})}module.exports=mkdirs}});var require_mkdirs_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),invalidWin32Path=require_win32().invalidWin32Path,o777=parseInt("0777",8);function mkdirsSync(p,opts,made){(!opts||typeof opts!="object")&&(opts={mode:opts});let mode=opts.mode,xfs=opts.fs||fs;if(process.platform==="win32"&&invalidWin32Path(p)){let errInval=new Error(p+" contains invalid WIN32 path characters.");throw errInval.code="EINVAL",errInval}mode===void 0&&(mode=o777&~process.umask()),made||(made=null),p=path.resolve(p);try{xfs.mkdirSync(p,mode),made=made||p}catch(err0){if(err0.code==="ENOENT"){if(path.dirname(p)===p)throw err0;made=mkdirsSync(path.dirname(p),opts,made),mkdirsSync(p,opts,made)}else{let stat;try{stat=xfs.statSync(p)}catch{throw err0}if(!stat.isDirectory())throw err0}}return made}module.exports=mkdirsSync}});var require_mkdirs2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/mkdirs/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,mkdirs=u(require_mkdirs()),mkdirsSync=require_mkdirs_sync();module.exports={mkdirs,mkdirsSync,mkdirp:mkdirs,mkdirpSync:mkdirsSync,ensureDir:mkdirs,ensureDirSync:mkdirsSync}}});var require_utimes=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/utimes.js"(exports,module){"use strict";var fs=require_graceful_fs(),os=__require("os"),path=__require("path");function hasMillisResSync(){let tmpfile=path.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));tmpfile=path.join(os.tmpdir(),tmpfile);let d=new Date(1435410243862);fs.writeFileSync(tmpfile,"https://github.com/jprichardson/node-fs-extra/pull/141");let fd=fs.openSync(tmpfile,"r+");return fs.futimesSync(fd,d,d),fs.closeSync(fd),fs.statSync(tmpfile).mtime>1435410243e3}function hasMillisRes(callback){let tmpfile=path.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));tmpfile=path.join(os.tmpdir(),tmpfile);let d=new Date(1435410243862);fs.writeFile(tmpfile,"https://github.com/jprichardson/node-fs-extra/pull/141",err=>{if(err)return callback(err);fs.open(tmpfile,"r+",(err2,fd)=>{if(err2)return callback(err2);fs.futimes(fd,d,d,err3=>{if(err3)return callback(err3);fs.close(fd,err4=>{if(err4)return callback(err4);fs.stat(tmpfile,(err5,stats)=>{if(err5)return callback(err5);callback(null,stats.mtime>1435410243e3)})})})})})}function timeRemoveMillis(timestamp){if(typeof timestamp=="number")return Math.floor(timestamp/1e3)*1e3;if(timestamp instanceof Date)return new Date(Math.floor(timestamp.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function utimesMillis(path2,atime,mtime,callback){fs.open(path2,"r+",(err,fd)=>{if(err)return callback(err);fs.futimes(fd,atime,mtime,futimesErr=>{fs.close(fd,closeErr=>{callback&&callback(futimesErr||closeErr)})})})}function utimesMillisSync(path2,atime,mtime){let fd=fs.openSync(path2,"r+");return fs.futimesSync(fd,atime,mtime),fs.closeSync(fd)}module.exports={hasMillisRes,hasMillisResSync,timeRemoveMillis,utimesMillis,utimesMillisSync}}});var require_stat=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/stat.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),NODE_VERSION_MAJOR_WITH_BIGINT=10,NODE_VERSION_MINOR_WITH_BIGINT=5,NODE_VERSION_PATCH_WITH_BIGINT=0,nodeVersion=process.versions.node.split("."),nodeVersionMajor=Number.parseInt(nodeVersion[0],10),nodeVersionMinor=Number.parseInt(nodeVersion[1],10),nodeVersionPatch=Number.parseInt(nodeVersion[2],10);function nodeSupportsBigInt(){if(nodeVersionMajor>NODE_VERSION_MAJOR_WITH_BIGINT)return!0;if(nodeVersionMajor===NODE_VERSION_MAJOR_WITH_BIGINT){if(nodeVersionMinor>NODE_VERSION_MINOR_WITH_BIGINT)return!0;if(nodeVersionMinor===NODE_VERSION_MINOR_WITH_BIGINT&&nodeVersionPatch>=NODE_VERSION_PATCH_WITH_BIGINT)return!0}return!1}function getStats(src,dest,cb){nodeSupportsBigInt()?fs.stat(src,{bigint:!0},(err,srcStat)=>{if(err)return cb(err);fs.stat(dest,{bigint:!0},(err2,destStat)=>err2?err2.code==="ENOENT"?cb(null,{srcStat,destStat:null}):cb(err2):cb(null,{srcStat,destStat}))}):fs.stat(src,(err,srcStat)=>{if(err)return cb(err);fs.stat(dest,(err2,destStat)=>err2?err2.code==="ENOENT"?cb(null,{srcStat,destStat:null}):cb(err2):cb(null,{srcStat,destStat}))})}function getStatsSync(src,dest){let srcStat,destStat;nodeSupportsBigInt()?srcStat=fs.statSync(src,{bigint:!0}):srcStat=fs.statSync(src);try{nodeSupportsBigInt()?destStat=fs.statSync(dest,{bigint:!0}):destStat=fs.statSync(dest)}catch(err){if(err.code==="ENOENT")return{srcStat,destStat:null};throw err}return{srcStat,destStat}}function checkPaths(src,dest,funcName,cb){getStats(src,dest,(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;return destStat&&destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error("Source and destination must not be the same.")):srcStat.isDirectory()&&isSrcSubdir(src,dest)?cb(new Error(errMsg(src,dest,funcName))):cb(null,{srcStat,destStat})})}function checkPathsSync(src,dest,funcName){let{srcStat,destStat}=getStatsSync(src,dest);if(destStat&&destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev)throw new Error("Source and destination must not be the same.");if(srcStat.isDirectory()&&isSrcSubdir(src,dest))throw new Error(errMsg(src,dest,funcName));return{srcStat,destStat}}function checkParentPaths(src,srcStat,dest,funcName,cb){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return cb();nodeSupportsBigInt()?fs.stat(destParent,{bigint:!0},(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb)):fs.stat(destParent,(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb))}function checkParentPathsSync(src,srcStat,dest,funcName){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return;let destStat;try{nodeSupportsBigInt()?destStat=fs.statSync(destParent,{bigint:!0}):destStat=fs.statSync(destParent)}catch(err){if(err.code==="ENOENT")return;throw err}if(destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev)throw new Error(errMsg(src,dest,funcName));return checkParentPathsSync(src,srcStat,destParent,funcName)}function isSrcSubdir(src,dest){let srcArr=path.resolve(src).split(path.sep).filter(i=>i),destArr=path.resolve(dest).split(path.sep).filter(i=>i);return srcArr.reduce((acc,cur,i)=>acc&&destArr[i]===cur,!0)}function errMsg(src,dest,funcName){return`Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`}module.exports={checkPaths,checkPathsSync,checkParentPaths,checkParentPathsSync,isSrcSubdir}}});var require_buffer=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/util/buffer.js"(exports,module){"use strict";module.exports=function(size){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(size)}catch{return new Buffer(size)}return new Buffer(size)}}});var require_copy_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),mkdirpSync=require_mkdirs2().mkdirsSync,utimesSync=require_utimes().utimesMillisSync,stat=require_stat();function copySync(src,dest,opts){typeof opts=="function"&&(opts={filter:opts}),opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
8
8
|
|
|
9
9
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat,destStat}=stat.checkPathsSync(src,dest,"copy");return stat.checkParentPathsSync(src,srcStat,dest,"copy"),handleFilterAndCopy(destStat,src,dest,opts)}function handleFilterAndCopy(destStat,src,dest,opts){if(opts.filter&&!opts.filter(src,dest))return;let destParent=path.dirname(dest);return fs.existsSync(destParent)||mkdirpSync(destParent),startCopy(destStat,src,dest,opts)}function startCopy(destStat,src,dest,opts){if(!(opts.filter&&!opts.filter(src,dest)))return getStats(destStat,src,dest,opts)}function getStats(destStat,src,dest,opts){let srcStat=(opts.dereference?fs.statSync:fs.lstatSync)(src);if(srcStat.isDirectory())return onDir(srcStat,destStat,src,dest,opts);if(srcStat.isFile()||srcStat.isCharacterDevice()||srcStat.isBlockDevice())return onFile(srcStat,destStat,src,dest,opts);if(srcStat.isSymbolicLink())return onLink(destStat,src,dest,opts)}function onFile(srcStat,destStat,src,dest,opts){return destStat?mayCopyFile(srcStat,src,dest,opts):copyFile(srcStat,src,dest,opts)}function mayCopyFile(srcStat,src,dest,opts){if(opts.overwrite)return fs.unlinkSync(dest),copyFile(srcStat,src,dest,opts);if(opts.errorOnExist)throw new Error(`'${dest}' already exists`)}function copyFile(srcStat,src,dest,opts){return typeof fs.copyFileSync=="function"?(fs.copyFileSync(src,dest),fs.chmodSync(dest,srcStat.mode),opts.preserveTimestamps?utimesSync(dest,srcStat.atime,srcStat.mtime):void 0):copyFileFallback(srcStat,src,dest,opts)}function copyFileFallback(srcStat,src,dest,opts){let _buff=require_buffer()(65536),fdr=fs.openSync(src,"r"),fdw=fs.openSync(dest,"w",srcStat.mode),pos=0;for(;pos<srcStat.size;){let bytesRead=fs.readSync(fdr,_buff,0,65536,pos);fs.writeSync(fdw,_buff,0,bytesRead),pos+=bytesRead}opts.preserveTimestamps&&fs.futimesSync(fdw,srcStat.atime,srcStat.mtime),fs.closeSync(fdr),fs.closeSync(fdw)}function onDir(srcStat,destStat,src,dest,opts){if(!destStat)return mkDirAndCopy(srcStat,src,dest,opts);if(destStat&&!destStat.isDirectory())throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);return copyDir(src,dest,opts)}function mkDirAndCopy(srcStat,src,dest,opts){return fs.mkdirSync(dest),copyDir(src,dest,opts),fs.chmodSync(dest,srcStat.mode)}function copyDir(src,dest,opts){fs.readdirSync(src).forEach(item=>copyDirItem(item,src,dest,opts))}function copyDirItem(item,src,dest,opts){let srcItem=path.join(src,item),destItem=path.join(dest,item),{destStat}=stat.checkPathsSync(srcItem,destItem,"copy");return startCopy(destStat,srcItem,destItem,opts)}function onLink(destStat,src,dest,opts){let resolvedSrc=fs.readlinkSync(src);if(opts.dereference&&(resolvedSrc=path.resolve(process.cwd(),resolvedSrc)),destStat){let resolvedDest;try{resolvedDest=fs.readlinkSync(dest)}catch(err){if(err.code==="EINVAL"||err.code==="UNKNOWN")return fs.symlinkSync(resolvedSrc,dest);throw err}if(opts.dereference&&(resolvedDest=path.resolve(process.cwd(),resolvedDest)),stat.isSrcSubdir(resolvedSrc,resolvedDest))throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);if(fs.statSync(dest).isDirectory()&&stat.isSrcSubdir(resolvedDest,resolvedSrc))throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);return copyLink(resolvedSrc,dest)}else return fs.symlinkSync(resolvedSrc,dest)}function copyLink(resolvedSrc,dest){return fs.unlinkSync(dest),fs.symlinkSync(resolvedSrc,dest)}module.exports=copySync}});var require_copy_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy-sync/index.js"(exports,module){"use strict";module.exports={copySync:require_copy_sync()}}});var require_path_exists=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/path-exists/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,fs=require_fs();function pathExists(path){return fs.access(path).then(()=>!0).catch(()=>!1)}module.exports={pathExists:u(pathExists),pathExistsSync:fs.existsSync}}});var require_copy=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy/copy.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),mkdirp=require_mkdirs2().mkdirs,pathExists=require_path_exists().pathExists,utimes=require_utimes().utimesMillis,stat=require_stat();function copy(src,dest,opts,cb){typeof opts=="function"&&!cb?(cb=opts,opts={}):typeof opts=="function"&&(opts={filter:opts}),cb=cb||function(){},opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
10
10
|
|
|
@@ -34,6 +34,7 @@ import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L23
|
|
|
34
34
|
pull [path] Pull your Project Settings from the cloud
|
|
35
35
|
redeploy [url|id] Rebuild and deploy a previous deployment.
|
|
36
36
|
rollback [url|id] Quickly revert back to a previous deployment
|
|
37
|
+
signup Creates a new account and logs in
|
|
37
38
|
switch [scope] Switches between different scopes
|
|
38
39
|
|
|
39
40
|
${import_chalk.default.dim("Advanced")}
|
|
@@ -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{APIError,InvalidToken,MissingUser}from"./chunk-
|
|
7
|
+
import{APIError,InvalidToken,MissingUser}from"./chunk-RINZXCDJ.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";async function getUser(client){return client.user?client.user:(client.userPromise||(client.userPromise=fetchUser(client).finally(()=>{client.userPromise=void 0})),client.userPromise)}async function fetchUser(client){try{let res=await client.fetch("/v2/user",{useCurrentTeam:!1});if(!res.user)throw new MissingUser;if(client.authConfig.userId!==res.user.id){client.updateAuthConfig({userId:res.user.id});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}return client.telemetryEventStore.updateUserId(res.user.id),client.user=res.user,res.user}catch(error){if(error instanceof APIError&&error.status===403){if(client.user=void 0,client.userPromise=void 0,client.authConfig.userId){client.updateAuthConfig({userId:void 0});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}throw new InvalidToken(client.authConfig.tokenSource)}throw error}}export{getUser};
|
|
@@ -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
|
-
var AGENT_STATUS={ERROR:"error",ACTION_REQUIRED:"action_required",OK:"ok"},AGENT_REASON={MISSING_ARGUMENTS:"missing_arguments",INVALID_ARGUMENTS:"invalid_arguments",CONFIRMATION_REQUIRED:"confirmation_required",INTERACTIVE_CONFIRMATION_REQUIRED:"interactive_confirmation_required",LOGIN_REQUIRED:"login_required",PROJECT_SETTINGS_REQUIRED:"project_settings_required",NOT_LINKED:"not_linked",NOT_FOUND:"not_found",PROJECT_NOT_FOUND:"project_not_found",MISSING_SCOPE:"missing_scope",SCOPE_NOT_ACCESSIBLE:"scope_not_accessible",API_ERROR:"api_error",RATE_LIMITED:"rate_limited",SEGMENT_IN_USE:"segment_in_use",ENTITY_IN_USE:"entity_in_use",MISSING_REQUIREMENTS:"missing_requirements",MISSING_NAME:"missing_name",MISSING_VALUE:"missing_value",MISSING_ENVIRONMENT:"missing_environment",ENV_NOT_FOUND:"env_not_found",MULTIPLE_ENVS:"multiple_envs",ENV_FILE_EXISTS:"env_file_exists",GIT_BRANCH_REQUIRED:"git_branch_required",ENV_KEY_SENSITIVE:"env_key_sensitive",AMBIGUOUS_ROUTE:"ambiguous_route",ROUTE_CREATE_FAILED:"route_create_failed",ROUTE_GENERATION_FAILED:"route_generation_failed",DOMAIN_NOT_FOUND:"domain_not_found",DNS_RECORD_NOT_FOUND:"dns_record_not_found",INCOMPLETE_RECORD:"incomplete_record",PERMISSION_DENIED:"permission_denied",INVALID_PORT:"invalid_port",INVALID_DNS_TYPE:"invalid_dns_type",DNS_ADD_FAILED:"dns_add_failed",INVALID_DOMAIN:"invalid_domain",CONFIGURED_CORRECTLY:"configured_correctly",VERIFICATION_NEEDED:"verification_needed",INVALID_CONFIGURATION:"invalid_configuration",DNS_CHANGE_REQUIRED:"dns_change_required",DNS_CHANGE_RECOMMENDED:"dns_change_recommended",DNSSEC_NEEDS_TO_BE_DISABLED:"dnssec_needs_to_be_disabled",PROJECT_ATTACHMENT_RECOMMENDED:"project_attachment_recommended",PROJECT_DOMAIN_MISSING:"project_domain_missing",INTEGRATION_TERMS_ACCEPTANCE_REQUIRED:"integration_terms_acceptance_required",HAS_RESOURCES:"has_resources",INTEGRATION_SANDBOX_CLAIM_REQUIRED:"integration_sandbox_claim_required",CLASSIC_TOKEN_REQUIRED:"classic_token_required",TOKEN_USER_SCOPE_REQUIRED:"token_user_scope_required",MISSING_URL:"missing_url",MISSING_EVENTS:"missing_events",INVALID_URL:"invalid_url",INVALID_EVENT:"invalid_event",INVALID_BUDGET:"invalid_budget",INVALID_REFRESH_PERIOD:"invalid_refresh_period",INVALID_EXPIRATION:"invalid_expiration",INVALID_ALERT_THRESHOLDS:"invalid_alert_thresholds",REQUIRES_CONSENT:"requires_consent",MISSING_ISSUER_ID:"missing_issuer_id",MISSING_KEY:"missing_key",MISSING_KEY_ID:"missing_key_id",MISSING_PROJECT:"missing_project",ISSUER_NOT_FOUND:"issuer_not_found",ISSUER_MANAGED:"issuer_managed",ISSUER_REQUIRES_IMPORTED_KEY:"issuer_requires_imported_key",ISSUER_REQUIRES_GENERATED_KEY:"issuer_requires_generated_key",KEY_NOT_REVOKING:"key_not_revoking",NO_CHANGES_REQUESTED:"no_changes_requested",SCHEDULES_NOT_ENABLED:"schedules_not_enabled",REDIRECT_NOT_FOUND:"redirect_not_found",VERSION_NOT_FOUND:"version_not_found",VERSION_ALREADY_LIVE:"version_already_live",VERSION_IS_STAGING:"version_is_staging",PLAN_UPGRADE_REQUIRED:"plan_upgrade_required",NOT_TEAM_MEMBER:"not_team_member",INVALID_ROLE_COMBINATION:"invalid_role_combination"},AGENT_ACTION={MISSING_ARGUMENTS:"missing_arguments",CONFIRMATION_REQUIRED:"confirmation_required",LOGIN_REQUIRED:"login_required"};export{AGENT_STATUS,AGENT_REASON,AGENT_ACTION};
|
|
7
|
+
var AGENT_STATUS={ERROR:"error",ACTION_REQUIRED:"action_required",OK:"ok"},AGENT_REASON={MISSING_ARGUMENTS:"missing_arguments",INVALID_ARGUMENTS:"invalid_arguments",CONFIRMATION_REQUIRED:"confirmation_required",INTERACTIVE_CONFIRMATION_REQUIRED:"interactive_confirmation_required",LOGIN_REQUIRED:"login_required",PROJECT_SETTINGS_REQUIRED:"project_settings_required",NOT_LINKED:"not_linked",NOT_FOUND:"not_found",PROJECT_NOT_FOUND:"project_not_found",MISSING_SCOPE:"missing_scope",SCOPE_NOT_ACCESSIBLE:"scope_not_accessible",API_ERROR:"api_error",RATE_LIMITED:"rate_limited",SEGMENT_IN_USE:"segment_in_use",ENTITY_IN_USE:"entity_in_use",MISSING_REQUIREMENTS:"missing_requirements",MISSING_NAME:"missing_name",MISSING_VALUE:"missing_value",MISSING_ENVIRONMENT:"missing_environment",ENV_NOT_FOUND:"env_not_found",MULTIPLE_ENVS:"multiple_envs",ENV_FILE_EXISTS:"env_file_exists",GIT_BRANCH_REQUIRED:"git_branch_required",ENV_KEY_SENSITIVE:"env_key_sensitive",AMBIGUOUS_ROUTE:"ambiguous_route",ROUTE_CREATE_FAILED:"route_create_failed",ROUTE_GENERATION_FAILED:"route_generation_failed",DOMAIN_NOT_FOUND:"domain_not_found",DNS_RECORD_NOT_FOUND:"dns_record_not_found",INCOMPLETE_RECORD:"incomplete_record",PERMISSION_DENIED:"permission_denied",INVALID_PORT:"invalid_port",INVALID_DNS_TYPE:"invalid_dns_type",DNS_ADD_FAILED:"dns_add_failed",INVALID_DOMAIN:"invalid_domain",CONFIGURED_CORRECTLY:"configured_correctly",VERIFICATION_NEEDED:"verification_needed",INVALID_CONFIGURATION:"invalid_configuration",DNS_CHANGE_REQUIRED:"dns_change_required",DNS_CHANGE_RECOMMENDED:"dns_change_recommended",DNSSEC_NEEDS_TO_BE_DISABLED:"dnssec_needs_to_be_disabled",PROJECT_ATTACHMENT_RECOMMENDED:"project_attachment_recommended",PROJECT_DOMAIN_MISSING:"project_domain_missing",INTEGRATION_TERMS_ACCEPTANCE_REQUIRED:"integration_terms_acceptance_required",HAS_RESOURCES:"has_resources",INTEGRATION_SANDBOX_CLAIM_REQUIRED:"integration_sandbox_claim_required",CLASSIC_TOKEN_REQUIRED:"classic_token_required",TOKEN_USER_SCOPE_REQUIRED:"token_user_scope_required",MISSING_URL:"missing_url",MISSING_EVENTS:"missing_events",INVALID_URL:"invalid_url",INVALID_EVENT:"invalid_event",INVALID_BUDGET:"invalid_budget",INVALID_REFRESH_PERIOD:"invalid_refresh_period",INVALID_EXPIRATION:"invalid_expiration",INVALID_ALERT_THRESHOLDS:"invalid_alert_thresholds",REQUIRES_CONSENT:"requires_consent",MISSING_ISSUER_ID:"missing_issuer_id",MISSING_KEY:"missing_key",MISSING_KEY_ID:"missing_key_id",MISSING_PROJECT:"missing_project",ISSUER_NOT_FOUND:"issuer_not_found",ISSUER_MANAGED:"issuer_managed",ISSUER_REQUIRES_IMPORTED_KEY:"issuer_requires_imported_key",ISSUER_REQUIRES_GENERATED_KEY:"issuer_requires_generated_key",KEY_NOT_REVOKING:"key_not_revoking",NO_CHANGES_REQUESTED:"no_changes_requested",SCHEDULES_NOT_ENABLED:"schedules_not_enabled",SCHEDULE_ALREADY_EXISTS:"schedule_already_exists",INVALID_CRON_EXPRESSION:"invalid_cron_expression",INVALID_JITTER:"invalid_jitter",JITTER_EXCEEDS_CADENCE:"jitter_exceeds_cadence",SCHEDULE_PAYLOAD_TOO_LARGE:"payload_too_large",SCHEDULE_PAYLOAD_STORE_FAILED:"payload_store_failed",REDIRECT_NOT_FOUND:"redirect_not_found",VERSION_NOT_FOUND:"version_not_found",VERSION_ALREADY_LIVE:"version_already_live",VERSION_IS_STAGING:"version_is_staging",PLAN_UPGRADE_REQUIRED:"plan_upgrade_required",NOT_TEAM_MEMBER:"not_team_member",INVALID_ROLE_COMBINATION:"invalid_role_combination"},AGENT_ACTION={MISSING_ARGUMENTS:"missing_arguments",CONFIRMATION_REQUIRED:"confirmation_required",LOGIN_REQUIRED:"login_required"};export{AGENT_STATUS,AGENT_REASON,AGENT_ACTION};
|
|
@@ -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-RQTVTHE7.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.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,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{quoteArg}from"./chunk-
|
|
7
|
+
import{quoteArg}from"./chunk-BKV35LVB.js";import{arg_common_default,stripSensitiveAuthArgs}from"./chunk-JAJW3P42.js";import{packageName}from"./chunk-FI772UVH.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_arg=__commonJS({"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports,module){var flagSymbol=Symbol("arg flag"),ArgError=class _ArgError extends Error{constructor(msg,code){super(msg),this.name="ArgError",this.code=code,Object.setPrototypeOf(this,_ArgError.prototype)}};function arg2(opts,{argv=process.argv.slice(2),permissive=!1,stopAtPositional=!1}={}){if(!opts)throw new ArgError("argument specification object is required","ARG_CONFIG_NO_SPEC");let result={_:[]},aliases={},handlers={};for(let key of Object.keys(opts)){if(!key)throw new ArgError("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(key[0]!=="-")throw new ArgError(`argument key must start with '-' but found: '${key}'`,"ARG_CONFIG_NONOPT_KEY");if(key.length===1)throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`,"ARG_CONFIG_NONAME_KEY");if(typeof opts[key]=="string"){aliases[key]=opts[key];continue}let type=opts[key],isFlag=!1;if(Array.isArray(type)&&type.length===1&&typeof type[0]=="function"){let[fn]=type;type=(value,name,prev=[])=>(prev.push(fn(value,name,prev[prev.length-1])),prev),isFlag=fn===Boolean||fn[flagSymbol]===!0}else if(typeof type=="function")isFlag=type===Boolean||type[flagSymbol]===!0;else throw new ArgError(`type missing or not a function or valid array type: ${key}`,"ARG_CONFIG_VAD_TYPE");if(key[1]!=="-"&&key.length>2)throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`,"ARG_CONFIG_SHORTOPT_TOOLONG");handlers[key]=[type,isFlag]}for(let i=0,len=argv.length;i<len;i++){let wholeArg=argv[i];if(stopAtPositional&&result._.length>0){result._=result._.concat(argv.slice(i));break}if(wholeArg==="--"){result._=result._.concat(argv.slice(i+1));break}if(wholeArg.length>1&&wholeArg[0]==="-"){let separatedArguments=wholeArg[1]==="-"||wholeArg.length===2?[wholeArg]:wholeArg.slice(1).split("").map(a=>`-${a}`);for(let j=0;j<separatedArguments.length;j++){let arg3=separatedArguments[j],[originalArgName,argStr]=arg3[1]==="-"?arg3.split(/=(.*)/,2):[arg3,void 0],argName=originalArgName;for(;argName in aliases;)argName=aliases[argName];if(!(argName in handlers))if(permissive){result._.push(arg3);continue}else throw new ArgError(`unknown or unexpected option: ${originalArgName}`,"ARG_UNKNOWN_OPTION");let[type,isFlag]=handlers[argName];if(!isFlag&&j+1<separatedArguments.length)throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`,"ARG_MISSING_REQUIRED_SHORTARG");if(isFlag)result[argName]=type(!0,argName,result[argName]);else if(argStr===void 0){if(argv.length<i+2||argv[i+1].length>1&&argv[i+1][0]==="-"&&!(argv[i+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(type===Number||typeof BigInt<"u"&&type===BigInt))){let extended=originalArgName===argName?"":` (alias for ${argName})`;throw new ArgError(`option requires argument: ${originalArgName}${extended}`,"ARG_MISSING_REQUIRED_LONGARG")}result[argName]=type(argv[i+1],argName,result[argName]),++i}else result[argName]=type(argStr,argName,result[argName])}}else result._.push(wholeArg)}return result}arg2.flag=fn=>(fn[flagSymbol]=!0,fn);arg2.COUNT=arg2.flag((v,name,existingCount)=>(existingCount||0)+1);arg2.ArgError=ArgError;module.exports=arg2}});var import_arg=__toESM(require_arg(),1);function suggestCorrection(input,choices){if(input.replace(/^-+/,"").length<3||choices.includes(input))return;let matches=[...new Set(choices)].filter(choice=>{if(Math.abs(input.length-choice.length)>1)return!1;let i=0;for(;i<input.length&&input[i]===choice[i];)i++;return input.length===choice.length?input.slice(i+1)===choice.slice(i+1)||input[i]===choice[i+1]&&input[i+1]===choice[i]&&input.slice(i+2)===choice.slice(i+2):input.length>choice.length?input.slice(i+1)===choice.slice(i):input.slice(i)===choice.slice(i+1)});return matches.length===1?matches[0]:void 0}var SAFE_VALUE_FLAGS=new Set(["--cwd","--scope","--team","-S","-T","--project","-p","--format","--environment","--since","--until","--limit"]),READ_COMMANDS=new Set(["inspect","list","ls","schema","whoami"]);function buildCorrectedCommand(argv,from,to,flagsSpecification={}){let corrected=argv.slice(2),spec={...arg_common_default(),...flagsSpecification},valuelessFlags=new Set,takesValue=new Set;for(let[name,value]of Object.entries(spec))((typeof value=="string"?spec[value]:value)===Boolean?valuelessFlags:takesValue).add(name);for(let i=0;i<corrected.length;i++){let value=corrected[i];if(value==="--")break;if(value===from||value.startsWith(`${from}=`)){corrected[i]=to+value.slice(from.length);break}takesValue.has(value)&&i++}let args=stripSensitiveAuthArgs(corrected).filter(arg2=>!/^-t[^-=]/.test(arg2)),out=[],positionals=0,readCommand=!1;for(let i=0;i<args.length;i++){let value=args[i];if(value==="--"){out.push("--","<argument>");break}if(value.startsWith("-")){if(/^-[A-Za-z][^=].+/.test(value)&&!value.startsWith("--")){let name2=value.slice(0,2);out.push(name2,SAFE_VALUE_FLAGS.has(name2)?value.slice(2):"<value>");continue}let equals=value.indexOf("="),name=equals<0?value:value.slice(0,equals);equals>=0?out.push(`${name}=${SAFE_VALUE_FLAGS.has(name)||valuelessFlags.has(name)&&/^(true|false)$/.test(value.slice(equals+1))?value.slice(equals+1):"<value>"}`):(out.push(name),!valuelessFlags.has(name)&&i+1<args.length&&(takesValue.has(name)||!args[i+1].startsWith("-"))&&(i++,out.push(SAFE_VALUE_FLAGS.has(name)?args[i]:"<value>")))}else positionals++,positionals<=2&&(readCommand||=READ_COMMANDS.has(value)),out.push(positionals<=2||readCommand?value:"<argument>")}return[packageName,...out].map(quoteArg).join(" ")}var argumentErrors=new WeakSet;function isArgumentError(error){return error instanceof Error&&argumentErrors.has(error)}function parseWithSuggestions(args,spec,options){try{return(0,import_arg.default)(spec,{...options,argv:args})}catch(error){if(error instanceof Error&&"code"in error&&error.code==="ARG_UNKNOWN_OPTION"){let err=error,option=/unknown or unexpected option: (--?[A-Za-z0-9-]+)$/.exec(err.message)?.[1];option&&(argumentErrors.add(err),err.invalidOption=option,err.allowedOptions=Object.keys(spec).filter(name=>name.startsWith("--")).sort(),err.suggestedOption=suggestCorrection(option,err.allowedOptions),err.flagsSpecification=spec)}throw error}}function getArgs(argv,argsOptions,argOptions={}){return parseWithSuggestions(argv,Object.assign({},arg_common_default(),argsOptions),argOptions)}function parseArguments(args,flagsSpecification,parserOptions={}){let{_:positional,...rest}=parseWithSuggestions(args,Object.assign({},arg_common_default(),flagsSpecification),parserOptions);return{args:positional,flags:rest}}export{suggestCorrection,buildCorrectedCommand,isArgumentError,getArgs,parseArguments};
|
|
@@ -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{AGENT_REASON,AGENT_STATUS}from"./chunk-
|
|
7
|
+
import{AGENT_REASON,AGENT_STATUS}from"./chunk-T4LZS75P.js";import{getScope}from"./chunk-GQGVOJ4V.js";import{getOrgById}from"./chunk-EO4G5E7C.js";import{buildCommandWithGlobalFlags,outputAgentError,shouldEmitNonInteractiveCommandError}from"./chunk-KCARCOP5.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";async function printProjectNotFoundError(client,projectNameOrId,commandName,orgId){let contextName;try{orgId?contextName=(await getOrgById(client,orgId))?.slug??orgId:contextName=(await getScope(client)).contextName}catch(err){contextName=orgId,output_manager_default.debug(`Scope lookup failed during error reporting: ${err}`)}let scopeClause=contextName?` (${contextName})`:"",headline=`Project "${projectNameOrId}" was not found in the current scope${scopeClause}.`;if(output_manager_default.error(`${headline}
|
|
8
8
|
|
|
9
9
|
If it lives in a different team or account:
|
|
10
10
|
\u2022 Retry with \`--scope <team-slug|your-username>\`, or
|
|
@@ -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{outputError}from"./chunk-FA6O7FPC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{require_execa}from"./chunk-HWWHR7H3.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{AGENT_REASON}from"./chunk-
|
|
7
|
+
import{outputError}from"./chunk-FA6O7FPC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{require_execa}from"./chunk-HWWHR7H3.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{AGENT_REASON}from"./chunk-T4LZS75P.js";import{getScope}from"./chunk-GQGVOJ4V.js";import{getLinkedProject,getProjectByNameOrId}from"./chunk-EO4G5E7C.js";import{require_lib}from"./chunk-B4ATVYZW.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-KCARCOP5.js";import{ProjectNotFound,isAPIError,require_bytes}from"./chunk-RINZXCDJ.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{__toESM}from"./chunk-6L236MNA.js";function emitVcrScopeError(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 resolveVcrScope(client,opts){if(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 emitVcrScopeError(client,opts.jsonOutput,"NO_TEAM",msg,{reason:AGENT_REASON.MISSING_SCOPE,hint:"Select a team scope before using --project with vcr.",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"}]})}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 emitVcrScopeError(client,opts.jsonOutput,err.code||"API_ERROR",msg,{reason,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr ls --project <name_or_id>"),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 emitVcrScopeError(client,opts.jsonOutput,"PROJECT_NOT_FOUND",msg,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,"project ls"),when:"List projects in the current team to pick a name"}]})}return{teamId:team.id,teamSlug:team.slug,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 pass --project <name>.";return emitVcrScopeError(client,opts.jsonOutput,"NOT_LINKED",msg,{reason:AGENT_REASON.NOT_LINKED,hint:"Agents should pass --project 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,"vcr ls --project <name_or_id>"),when:"List repositories for a project without linking (replace <name_or_id>)"}]})}return{teamId:linkedProject.org.id,teamSlug:linkedProject.org.slug,projectId:linkedProject.project.id,projectName:linkedProject.project.name}}var import_ms=__toESM(require_ms(),1),import_bytes=__toESM(require_bytes(),1);function formatBytes(size){return typeof size!="number"||Number.isNaN(size)?"-":import_bytes.default.format(size,{decimalPlaces:1})??"-"}function formatRelativeTime(iso){let time=new Date(iso).getTime();return Number.isNaN(time)?"-":`${(0,import_ms.default)(Date.now()-time)} ago`}function formatDigest(digest){return digest?digest.replace(/^sha256:/,"").slice(0,12):"-"}function formatImageStatus(status){switch(status){case"ready":return"Ready";case"preparing":return"Preparing";case"unoptimized":return"Ready (unoptimized)";default:return"-"}}var VCR_REGISTRY="vcr.vercel.com";function formatImageReference(teamSlug,projectName,repositoryName,digest){return digest?`${VCR_REGISTRY}/${teamSlug}/${projectName}/${repositoryName}@${digest}`:"-"}function formatTagReference(teamSlug,projectName,repositoryName,tag){return tag?`${VCR_REGISTRY}/${teamSlug}/${projectName}/${repositoryName}:${tag}`:"-"}function validateVcrJsonOutput(client,flags){let fr=validateJsonOutput(flags);return fr.valid?{jsonOutput:fr.jsonOutput}:(outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:fr.error},1),output_manager_default.error(fr.error),1)}function validateVcrChoice(client,flag,value,choices,jsonOutput){if(value===void 0||choices.includes(value))return;let message=`Invalid value for ${flag}: "${value}". Must be one of: ${choices.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message},1),outputError(client,jsonOutput,"INVALID_ARGUMENTS",message)}function requireVcrRepository(client,repository,jsonOutput,usage){if(!repository)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List repositories to pick a name or id"}]},1),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}function requireVcrRepositoryAndTag(client,repository,tag,jsonOutput,usage){if(!(repository&&tag))return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing arguments. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr tag ls <repository>"),when:"List tags to pick a tag (replace <repository>)"}]},1),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}function requireVcrRepositoryAndImageId(client,repository,imageId,jsonOutput,usage){if(!(repository&&imageId))return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing arguments. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr image ls <repository>"),when:"List images to pick an image id (replace <repository>)"}]},1),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}var import_which=__toESM(require_lib(),1),import_execa=__toESM(require_execa(),1);var VCR_ENGINES=["docker","podman","buildah"],VCR_LOGIN_USERNAME="oidc";function resolveRegistry(){return process.env.VERCEL_VCR_REGISTRY||VCR_REGISTRY}function isEngineInstalled(engine){return import_which.default.sync(engine,{nothrow:!0})!==null}function splitPassthrough(argv){let idx=argv.indexOf("--");return idx===-1?{own:argv.slice(2),passthrough:[]}:{own:argv.slice(2,idx),passthrough:argv.slice(idx+1)}}async function isBuildxAvailable(){let result=await(0,import_execa.default)("docker",["buildx","version"],{reject:!1,stdio:"ignore"});return result instanceof Error?!1:result.exitCode===0}function pushCompressionArgs(engine){return engine==="docker"?[]:["--compression-format","zstd","--compression-level","3"]}var AUTH_FAILURE=/\b(?:unauthorized|denied|forbidden)\b\s*:|authentication required|access to the resource is denied|\b(?:401 unauthorized|403 forbidden)\b/i,CREDENTIAL_STORE_CONFLICT=/already exists in the keychain|errSecDuplicateItem/i;function stderrTail(stderr){return stderr.trim().split(`
|
|
8
8
|
`).slice(-5).join(`
|
|
9
9
|
`)}async function engineLogin(engine,registry,token){let result=await(0,import_execa.default)(engine,["login",registry,"--username",VCR_LOGIN_USERNAME,"--password-stdin"],{input:token,reject:!1});return result instanceof Error&&typeof result.exitCode!="number"?{exitCode:1,stderr:result.message}:{exitCode:typeof result.exitCode=="number"?result.exitCode:1,stderr:result.stderr??""}}async function engineLogout(engine,registry){await(0,import_execa.default)(engine,["logout",registry],{reject:!1,stdio:"ignore"})}async function runEngine(engine,args,opts){if(opts.captureStderr){let subprocess=(0,import_execa.default)(engine,args,{cwd:opts.cwd,stdio:["inherit","inherit","pipe"],reject:!1});subprocess.stderr?.pipe(process.stderr);let result2=await subprocess;return result2 instanceof Error&&typeof result2.exitCode!="number"?{exitCode:1,stderr:result2.message}:{exitCode:typeof result2.exitCode=="number"?result2.exitCode:1,stderr:result2.stderr??""}}let result=await(0,import_execa.default)(engine,args,{cwd:opts.cwd,stdio:"inherit",reject:!1});return result instanceof Error&&typeof result.exitCode!="number"?{exitCode:1,stderr:result.message}:{exitCode:typeof result.exitCode=="number"?result.exitCode:1,stderr:""}}var NOT_AUTHORIZED_MESSAGE="You do not have access to the container registry in this scope. Ensure your role can manage the project, or pass --token and --scope.",NOT_AUTHORIZED_HINT="Confirm team scope with whoami; use --scope <team-slug> if the repository lives under another team.",genericMessage=err=>err.serverMessage||`API error (${err.status}).`,STATUS_INFO={401:{reason:"not_authorized",message:()=>NOT_AUTHORIZED_MESSAGE,hint:NOT_AUTHORIZED_HINT,suggestWhoami:!0},403:{reason:"forbidden",message:()=>NOT_AUTHORIZED_MESSAGE,hint:NOT_AUTHORIZED_HINT,suggestWhoami:!0},404:{reason:AGENT_REASON.NOT_FOUND,message:genericMessage},409:{reason:"conflict",message:genericMessage},429:{reason:"rate_limited",message:genericMessage}};function resolveStatusInfo(err){return STATUS_INFO[err.status]?STATUS_INFO[err.status]:err.status>=500?{reason:AGENT_REASON.API_ERROR,message:()=>`The container registry endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`}:{reason:AGENT_REASON.API_ERROR,message:genericMessage}}function handleVcrApiError(client,err,jsonOutput,opts={}){let info=resolveStatusInfo(err),message=info.message(err),next=[];return info.suggestWhoami&&next.push({command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"}),opts.retry&&next.push(opts.retry),outputAgentError(client,{status:"error",reason:info.reason,message,...info.hint?{hint:info.hint}:{},...next.length>0?{next}:{}},1),outputError(client,jsonOutput,err.code||"API_ERROR",message)}function reportEngineCommandFailure(client,engine,verb,result){let tail=stderrTail(result.stderr),message=`\`${engine} ${verb}\` failed (exit code ${result.exitCode}).${tail?`
|
|
10
10
|
${tail}`:""}`;return outputAgentError(client,{status:"error",reason:"command_failed",message},1),outputError(client,!1,"COMMAND_FAILED",message)}function reportEnginePushFailure(client,engine,verb,result){if(AUTH_FAILURE.test(result.stderr)){let message=`Push to ${resolveRegistry()} was rejected. Your registry credentials may be missing or expired.`;return outputAgentError(client,{status:"error",reason:"not_authorized",message,next:[{command:buildCommandWithGlobalFlags(client.argv,`vcr login ${engine}`),when:"Refresh registry credentials (valid ~12 hours)"}]},1),outputError(client,!1,"NOT_AUTHORIZED",message)}return reportEngineCommandFailure(client,engine,verb,result)}function emitVcrArgParseError(client,err,recoverTemplate){let msg=err instanceof Error?err.message:String(err),projectFlagMissingArg=msg.includes("--project")&&msg.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`).":msg,next:[{command:buildCommandWithGlobalFlags(client.argv,recoverTemplate),when:projectFlagMissingArg?"Re-run with a project name or id (replace placeholder)":"See valid usage"}]},1)}export{resolveVcrScope,formatBytes,formatRelativeTime,formatDigest,formatImageStatus,formatImageReference,formatTagReference,validateVcrJsonOutput,validateVcrChoice,requireVcrRepository,requireVcrRepositoryAndTag,requireVcrRepositoryAndImageId,VCR_ENGINES,VCR_LOGIN_USERNAME,resolveRegistry,isEngineInstalled,splitPassthrough,isBuildxAvailable,pushCompressionArgs,AUTH_FAILURE,CREDENTIAL_STORE_CONFLICT,stderrTail,engineLogin,engineLogout,runEngine,handleVcrApiError,reportEngineCommandFailure,reportEnginePushFailure,emitVcrArgParseError};
|
|
@@ -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{Separator}from"./chunk-M2W3HKV3.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{isAPIError}from"./chunk-
|
|
7
|
+
import{Separator}from"./chunk-M2W3HKV3.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{isAPIError}from"./chunk-RINZXCDJ.js";import{eraseLines,link_default,output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);import{URL}from"url";var import_strip_ansi=__toESM(require_strip_ansi(),1);function getLength(input){let biggestLength=0;for(let line of input.split(`
|
|
8
8
|
`)){let str=(0,import_strip_ansi.default)(line);str.length>biggestLength&&(biggestLength=str.length)}return biggestLength}async function list(client,{message="the question",choices:_choices=[{name:`something
|
|
9
9
|
description
|
|
10
10
|
details
|
|
@@ -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{require_dist,require_dist2}from"./chunk-Z7PBDQNR.js";import{require_types}from"./chunk-GHM7V3GG.js";import{require_build_utils}from"./chunk-EWWFNMPZ.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_dist3=__commonJS({"../../internals/service-topology/dist/index.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{INTERNAL_SERVICE_PREFIX:()=>import_fs_detectors2.INTERNAL_SERVICE_PREFIX,autoDetectServices:()=>import_fs_detectors2.autoDetectServices,detectServices:()=>import_fs_detectors2.detectServices,generateServiceRewrites:()=>import_fs_detectors2.generateServiceRewrites,generateServicesRoutes:()=>import_fs_detectors2.generateServicesRoutes,getInternalServiceCronPath:()=>import_fs_detectors2.getInternalServiceCronPath,getInternalServiceCronPathPrefix:()=>import_fs_detectors2.getInternalServiceCronPathPrefix,getInternalServiceFunctionPath:()=>import_fs_detectors2.getInternalServiceFunctionPath,getInternalServiceWorkerPath:()=>import_fs_detectors2.getInternalServiceWorkerPath,getInternalServiceWorkerPathPrefix:()=>import_fs_detectors2.getInternalServiceWorkerPathPrefix,hasLegacyServicesConfig:()=>import_fs_detectors2.hasLegacyServicesConfig,isExperimentalService:()=>import_fs_detectors2.isExperimentalService,isExperimentalServiceV2:()=>import_fs_detectors2.isExperimentalServiceV2,isRouteOwningBuilder:()=>import_fs_detectors2.isRouteOwningBuilder,isStaticBuild:()=>import_fs_detectors2.isStaticBuild,migrateExperimentalServices:()=>import_fs_detectors2.migrateExperimentalServices,planExperimentalServicesMigration:()=>import_fs_detectors2.planExperimentalServicesMigration,resolveAllConfiguredServices:()=>import_fs_detectors2.resolveAllConfiguredServices,resolveAllConfiguredServicesV2:()=>import_fs_detectors2.resolveAllConfiguredServicesV2,resolveConfiguredServiceV2:()=>import_fs_detectors2.resolveConfiguredServiceV2,validateServiceConfigV2:()=>import_fs_detectors2.validateServiceConfigV2});module.exports=__toCommonJS(src_exports);var import_fs_detectors2=require_dist2()}});var import_routing_utils=__toESM(require_dist(),1),import_build_utils=__toESM(require_build_utils(),1),import_types=__toESM(require_types(),1),import_fs_detectors=__toESM(require_dist2(),1);import{getConfigValidator}from"./config-validator.mjs";var imagesSchema={type:"object",additionalProperties:!1,required:["sizes"],properties:{contentDispositionType:{enum:["inline","attachment"]},contentSecurityPolicy:{type:"string",minLength:1,maxLength:256},dangerouslyAllowSVG:{type:"boolean"},domains:{type:"array",minItems:0,maxItems:50,items:{type:"string",minLength:1,maxLength:256}},formats:{type:"array",minItems:1,maxItems:4,items:{enum:["image/avif","image/webp","image/jpeg","image/png"]}},localPatterns:{type:"array",minItems:0,maxItems:25,items:{type:"object",additionalProperties:!1,properties:{pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},minimumCacheTTL:{type:"integer",minimum:1,maximum:31536e4},qualities:{type:"array",minItems:1,maxItems:20,items:{type:"integer",minimum:1,maximum:100}},remotePatterns:{type:"array",minItems:0,maxItems:50,items:{type:"object",additionalProperties:!1,required:["hostname"],properties:{protocol:{enum:["http","https"]},hostname:{type:"string",minLength:1,maxLength:256},port:{type:"string",minLength:0,maxLength:5},pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},sizes:{type:"array",minItems:1,maxItems:50,items:{type:"number"}}}},cronsSchema={type:"array",minItems:0,items:{type:"object",additionalProperties:!1,required:["path","schedule"],properties:{path:{type:"string",minLength:1,maxLength:512,pattern:"^/.*"},schedule:{type:"string",minLength:9,maxLength:256}}}},schedulesSchema={type:"array",minItems:0,maxItems:100,items:{type:"object",additionalProperties:!1,required:["expression","target","name"],properties:{expression:{type:"object",additionalProperties:!1,required:["cron"],properties:{cron:{type:"string"},jitter:{type:"integer",minimum:1,maximum:15}}},target:{oneOf:[{type:"object",additionalProperties:!1,required:["function"],properties:{function:{type:"string",minLength:1}}},{type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256}}}]},name:{type:"string",minLength:1,maxLength:256},timezone:{type:"string",minLength:1,maxLength:50,description:"IANA timezone for cron evaluation. Defaults to UTC."},payload:{}}}},experimentalServicesMountSchema={oneOf:[{type:"string",minLength:1,maxLength:512},{type:"object",additionalProperties:!1,properties:{path:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},anyOf:[{required:["path"]},{required:["subdomain"]}]}]},staticExperimentalServiceScheduleSchema={type:"string",minLength:9,maxLength:256,not:{const:"<dynamic>"}},experimentalServiceScheduleSchema={oneOf:[{type:"string",minLength:9,maxLength:256},{type:"array",minItems:1,items:staticExperimentalServiceScheduleSchema}]},experimentalServiceQueueTopicSchema={type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256},retryAfterSeconds:{type:"integer",minimum:1,maximum:86400},initialDelaySeconds:{type:"integer",minimum:0,maximum:86400}}},experimentalServiceTopicsSchema={oneOf:[{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:256}},{type:"array",minItems:1,items:experimentalServiceQueueTopicSchema}]},envVarNamesSchema={pattern:"^[A-Za-z_][A-Za-z0-9_]*$",maxLength:256},getExperimentalServicesCommonProperties=()=>({entrypoint:{type:"string",minLength:1,maxLength:512},root:{type:"string",minLength:1,maxLength:512},workspace:{type:"string",minLength:1,maxLength:512},framework:{type:"string",minLength:1,maxLength:256},builder:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},buildCommand:{type:"string",minLength:1,maxLength:2048},installCommand:{type:"string",minLength:1,maxLength:2048},preDeployCommand:{type:"string",minLength:1,maxLength:2048},command:{oneOf:[{type:"string",minLength:1,maxLength:2048},{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:2048}}]},memory:{type:"integer",minimum:128,maximum:10240},maxDuration:(0,import_build_utils.getMaxDurationSchema)(),includeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]},excludeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]}}),experimentalServicesRoutableProperties={mount:experimentalServicesMountSchema,routePrefix:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},getExperimentalServicesServiceConfigSchema=()=>({oneOf:[{type:"object",additionalProperties:!1,properties:{...getExperimentalServicesCommonProperties(),...experimentalServicesRoutableProperties,type:{enum:["web"]}}},{type:"object",additionalProperties:!1,required:["type","trigger","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"schedule"},schedule:experimentalServiceScheduleSchema}},{type:"object",additionalProperties:!1,required:["type","trigger","topics"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"queue"},topics:experimentalServiceTopicsSchema,consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","trigger","entrypoint"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"workflow"}}},{type:"object",additionalProperties:!1,required:["type"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"worker"},topics:{type:"array",items:{type:"string",minLength:1,maxLength:256},minItems:1},consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"cron"},schedule:experimentalServiceScheduleSchema}}]}),getExperimentalServicesSchema=()=>({type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:getExperimentalServicesServiceConfigSchema()}),experimentalServiceGroupsSchema={type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:{type:"array",items:{type:"string",minLength:1,maxLength:256}}},servicesPathSchema={type:"string",minLength:1,maxLength:512},servicesCommandSchema={type:"string",minLength:1,maxLength:2048},servicesServiceNamePattern="^[a-z]([a-z_-]*[a-z])?$",servicesBindingSchema={type:"object",additionalProperties:!1,required:["service","format","env"],properties:{type:{description:"Optional binding type marker. Currently the only supported type is `service`. When present this must be `service`.",const:"service"},service:{type:"string",minLength:1,maxLength:64,pattern:servicesServiceNamePattern},format:{const:"url"},env:{type:"string",...envVarNamesSchema}}},servicesBindingsSchema={type:"array",maxItems:100,items:servicesBindingSchema},getServicesServiceConfigSchema=()=>({type:"object",additionalProperties:!1,required:["root"],properties:{root:servicesPathSchema,framework:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},entrypoint:servicesPathSchema,command:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},installCommand:servicesCommandSchema,buildCommand:servicesCommandSchema,devCommand:servicesCommandSchema,ignoreCommand:servicesCommandSchema,outputDirectory:servicesPathSchema,bindings:servicesBindingsSchema,functions:(0,import_build_utils.getFunctionsSchema)(),headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,trailingSlash:import_routing_utils.trailingSlashSchema}}),getServicesSchema=()=>({type:"object",propertyNames:{pattern:servicesServiceNamePattern,maxLength:64},additionalProperties:getServicesServiceConfigSchema()}),proxySchema={type:"object",additionalProperties:!1,required:["entrypoint"],properties:{entrypoint:{type:"string",minLength:1},matcher:{oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,items:{type:"string",minLength:1}}]}}};function buildVercelConfigSchema(){return{type:"object",additionalProperties:!0,properties:{builds:import_build_utils.buildsSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,trailingSlash:import_routing_utils.trailingSlashSchema,functions:(0,import_build_utils.getFunctionsSchema)(),images:imagesSchema,crons:cronsSchema,schedules:schedulesSchema,bunVersion:{type:"string"},proxy:proxySchema,experimentalServices:getExperimentalServicesSchema(),experimentalServiceGroups:experimentalServiceGroupsSchema,services:getServicesSchema(),experimentalServicesV2:getServicesSchema()}}}function validateConfig(config){let validate=getConfigValidator(buildVercelConfigSchema);if(!validate(config)&&validate.errors&&validate.errors[0]){let error=validate.errors[0],fileName=config[import_types.fileNameSymbol]||"vercel.json",niceError=(0,import_build_utils.getPrettyError)(error);return niceError.message=`Invalid ${fileName} - ${niceError.message}`,niceError}for(let[index,schedule]of(config.schedules??[]).entries())if(schedule.timezone!==void 0)try{if(!/^[A-Za-z][A-Za-z0-9_+/-]*$/.test(schedule.timezone))throw new RangeError("Expected a named timezone");new Intl.DateTimeFormat("en-US",{timeZone:schedule.timezone})}catch{return new import_build_utils.NowBuildError({code:"INVALID_SCHEDULE_TIMEZONE",message:`Invalid ${config[import_types.fileNameSymbol]||"vercel.json"} - \`schedules[${index}].timezone\` must be a valid IANA timezone, such as "America/New_York". Omit it to use UTC.`})}for(let[pattern,fn]of Object.entries(config.functions??{}))if(fn.affinity!==void 0)return new import_build_utils.NowBuildError({code:"FUNCTION_AFFINITY_REQUIRES_SERVICE",message:`Function affinity can only be configured under a service. Move functions[${JSON.stringify(pattern)}].affinity into the relevant service's functions configuration.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"});let functionMaps=[config.functions,...Object.values(config.services??{}).map(service=>service.functions),...Object.values(config.experimentalServicesV2??{}).map(service=>service.functions)];for(let functions of functionMaps)for(let[pattern,fn]of Object.entries(functions??{})){let regions=[...new Set(fn.regions)];if(fn.affinity?.mode==="strict"&&(regions.includes("all")||regions.length>1))return new import_build_utils.NowBuildError({code:"INVALID_FUNCTION_AFFINITY_REGIONS",message:`Function affinity mode "strict" requires at most one statically configured region. Update \`functions[${JSON.stringify(pattern)}].regions\` to contain a single region.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"})}if(config.proxy){let proxyError=(0,import_fs_detectors.validateProxyConfig)(config.proxy);if(proxyError)return new import_build_utils.NowBuildError({code:proxyError.code.toUpperCase(),message:proxyError.message})}if(config.functions&&config.builds)return new import_build_utils.NowBuildError({code:"FUNCTIONS_AND_BUILDS",message:"The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",link:"https://vercel.link/functions-and-builds"});if(config.proxy&&config.builds)return new import_build_utils.NowBuildError({code:"PROXY_AND_BUILDS",message:"The `proxy` property cannot be used with the `builds` property. Remove `builds` to use an explicit proxy entrypoint."});let hasExperimentalServices=!!config.experimentalServices;if(hasExperimentalServices&&config.builds)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_BUILDS",message:"The `experimentalServices` property cannot be used in conjunction with the `builds` property. Please remove one of them."});if(hasExperimentalServices&&config.functions)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_FUNCTIONS",message:"The `experimentalServices` property cannot be used in conjunction with the `functions` property. Please remove one of them."});if(config.experimentalServiceGroups&&!config.experimentalServices)return new import_build_utils.NowBuildError({code:"SERVICE_GROUPS_WITHOUT_SERVICES",message:"The `experimentalServiceGroups` property requires `experimentalServices` to be defined. Service groups reference services by name."});let hasServices=config.services!=null,hasExperimentalServicesV2=config.experimentalServicesV2!=null;if(hasServices&&hasExperimentalServicesV2)return new import_build_utils.NowBuildError({code:"SERVICES_AND_EXPERIMENTAL_SERVICES_V2",message:"The `services` property cannot be used in conjunction with its deprecated alias `experimentalServicesV2`. Please use only `services`."});let servicesConfig=config.services??config.experimentalServicesV2,servicesConfigKey=hasServices?"services":"experimentalServicesV2",servicesErrorCodePrefix=hasServices?"SERVICES":"EXPERIMENTAL_SERVICES_V2";if(servicesConfig&&hasExperimentalServices)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_EXPERIMENTAL_SERVICES`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`experimentalServices\` property. Please use only one services configuration.`});if(servicesConfig&&config.builds)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_BUILDS`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`builds\` property. Please remove one of them.`});if(servicesConfig){let ambiguousTopLevel=[];if(config.functions!=null&&ambiguousTopLevel.push("functions"),config.installCommand!=null&&ambiguousTopLevel.push("installCommand"),config.buildCommand!=null&&ambiguousTopLevel.push("buildCommand"),config.devCommand!=null&&ambiguousTopLevel.push("devCommand"),config.ignoreCommand!=null&&ambiguousTopLevel.push("ignoreCommand"),config.outputDirectory!=null&&ambiguousTopLevel.push("outputDirectory"),config.framework!=null&&ambiguousTopLevel.push("framework"),ambiguousTopLevel.length>0){let count=ambiguousTopLevel.length,fields=ambiguousTopLevel.map(field=>`\`${field}\``).join(", ");return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_TOP_LEVEL_BUILD_SETTINGS`,message:`The top-level ${count>1?"properties":"property"} ${fields} cannot be used with \`${servicesConfigKey}\` because the owning service is ambiguous. Move ${count>1?"them":"it"} under the relevant service in \`${servicesConfigKey}\`.`})}}if(servicesConfig){let serviceNames=new Set(Object.keys(servicesConfig));for(let[serviceName,serviceConfig]of Object.entries(servicesConfig))for(let binding of serviceConfig.bindings??[])if(!serviceNames.has(binding.service))return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_BINDING_UNKNOWN_SERVICE`,message:`Service "${serviceName}" declares a binding to unknown service "${binding.service}". Add "${binding.service}" to \`${servicesConfigKey}\` or fix the binding.`})}return null}export{require_dist3 as require_dist,validateConfig};
|
|
7
|
+
import{require_dist,require_dist2}from"./chunk-QRBAWXHP.js";import{require_types}from"./chunk-GHM7V3GG.js";import{require_build_utils}from"./chunk-EWWFNMPZ.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_dist3=__commonJS({"../../internals/service-topology/dist/index.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{INTERNAL_SERVICE_PREFIX:()=>import_fs_detectors2.INTERNAL_SERVICE_PREFIX,autoDetectServices:()=>import_fs_detectors2.autoDetectServices,detectServices:()=>import_fs_detectors2.detectServices,generateServiceRewrites:()=>import_fs_detectors2.generateServiceRewrites,generateServicesRoutes:()=>import_fs_detectors2.generateServicesRoutes,getInternalServiceCronPath:()=>import_fs_detectors2.getInternalServiceCronPath,getInternalServiceCronPathPrefix:()=>import_fs_detectors2.getInternalServiceCronPathPrefix,getInternalServiceFunctionPath:()=>import_fs_detectors2.getInternalServiceFunctionPath,getInternalServiceWorkerPath:()=>import_fs_detectors2.getInternalServiceWorkerPath,getInternalServiceWorkerPathPrefix:()=>import_fs_detectors2.getInternalServiceWorkerPathPrefix,hasLegacyServicesConfig:()=>import_fs_detectors2.hasLegacyServicesConfig,isExperimentalService:()=>import_fs_detectors2.isExperimentalService,isExperimentalServiceV2:()=>import_fs_detectors2.isExperimentalServiceV2,isRouteOwningBuilder:()=>import_fs_detectors2.isRouteOwningBuilder,isStaticBuild:()=>import_fs_detectors2.isStaticBuild,migrateExperimentalServices:()=>import_fs_detectors2.migrateExperimentalServices,planExperimentalServicesMigration:()=>import_fs_detectors2.planExperimentalServicesMigration,resolveAllConfiguredServices:()=>import_fs_detectors2.resolveAllConfiguredServices,resolveAllConfiguredServicesV2:()=>import_fs_detectors2.resolveAllConfiguredServicesV2,resolveConfiguredServiceV2:()=>import_fs_detectors2.resolveConfiguredServiceV2,validateServiceConfigV2:()=>import_fs_detectors2.validateServiceConfigV2});module.exports=__toCommonJS(src_exports);var import_fs_detectors2=require_dist2()}});var import_routing_utils=__toESM(require_dist(),1),import_build_utils=__toESM(require_build_utils(),1),import_types=__toESM(require_types(),1),import_fs_detectors=__toESM(require_dist2(),1);import{getConfigValidator}from"./config-validator.mjs";var imagesSchema={type:"object",additionalProperties:!1,required:["sizes"],properties:{contentDispositionType:{enum:["inline","attachment"]},contentSecurityPolicy:{type:"string",minLength:1,maxLength:256},dangerouslyAllowSVG:{type:"boolean"},domains:{type:"array",minItems:0,maxItems:50,items:{type:"string",minLength:1,maxLength:256}},formats:{type:"array",minItems:1,maxItems:4,items:{enum:["image/avif","image/webp","image/jpeg","image/png"]}},localPatterns:{type:"array",minItems:0,maxItems:25,items:{type:"object",additionalProperties:!1,properties:{pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},minimumCacheTTL:{type:"integer",minimum:1,maximum:31536e4},qualities:{type:"array",minItems:1,maxItems:20,items:{type:"integer",minimum:1,maximum:100}},remotePatterns:{type:"array",minItems:0,maxItems:50,items:{type:"object",additionalProperties:!1,required:["hostname"],properties:{protocol:{enum:["http","https"]},hostname:{type:"string",minLength:1,maxLength:256},port:{type:"string",minLength:0,maxLength:5},pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},sizes:{type:"array",minItems:1,maxItems:50,items:{type:"number"}}}},cronsSchema={type:"array",minItems:0,items:{type:"object",additionalProperties:!1,required:["path","schedule"],properties:{path:{type:"string",minLength:1,maxLength:512,pattern:"^/.*"},schedule:{type:"string",minLength:9,maxLength:256}}}},schedulesSchema={type:"array",minItems:0,maxItems:100,items:{type:"object",additionalProperties:!1,required:["expression","target","name"],properties:{expression:{type:"object",additionalProperties:!1,required:["cron"],properties:{cron:{type:"string"},jitter:{type:"integer",minimum:1,maximum:15}}},target:{oneOf:[{type:"object",additionalProperties:!1,required:["function"],properties:{function:{type:"string",minLength:1}}},{type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256}}}]},name:{type:"string",minLength:1,maxLength:256},timezone:{type:"string",minLength:1,maxLength:50,description:"IANA timezone for cron evaluation. Defaults to UTC."},payload:{}}}},experimentalServicesMountSchema={oneOf:[{type:"string",minLength:1,maxLength:512},{type:"object",additionalProperties:!1,properties:{path:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},anyOf:[{required:["path"]},{required:["subdomain"]}]}]},staticExperimentalServiceScheduleSchema={type:"string",minLength:9,maxLength:256,not:{const:"<dynamic>"}},experimentalServiceScheduleSchema={oneOf:[{type:"string",minLength:9,maxLength:256},{type:"array",minItems:1,items:staticExperimentalServiceScheduleSchema}]},experimentalServiceQueueTopicSchema={type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256},retryAfterSeconds:{type:"integer",minimum:1,maximum:86400},initialDelaySeconds:{type:"integer",minimum:0,maximum:86400}}},experimentalServiceTopicsSchema={oneOf:[{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:256}},{type:"array",minItems:1,items:experimentalServiceQueueTopicSchema}]},envVarNamesSchema={pattern:"^[A-Za-z_][A-Za-z0-9_]*$",maxLength:256},getExperimentalServicesCommonProperties=()=>({entrypoint:{type:"string",minLength:1,maxLength:512},root:{type:"string",minLength:1,maxLength:512},workspace:{type:"string",minLength:1,maxLength:512},framework:{type:"string",minLength:1,maxLength:256},builder:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},buildCommand:{type:"string",minLength:1,maxLength:2048},installCommand:{type:"string",minLength:1,maxLength:2048},preDeployCommand:{type:"string",minLength:1,maxLength:2048},command:{oneOf:[{type:"string",minLength:1,maxLength:2048},{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:2048}}]},memory:{type:"integer",minimum:128,maximum:10240},maxDuration:(0,import_build_utils.getMaxDurationSchema)(),includeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]},excludeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]}}),experimentalServicesRoutableProperties={mount:experimentalServicesMountSchema,routePrefix:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},getExperimentalServicesServiceConfigSchema=()=>({oneOf:[{type:"object",additionalProperties:!1,properties:{...getExperimentalServicesCommonProperties(),...experimentalServicesRoutableProperties,type:{enum:["web"]}}},{type:"object",additionalProperties:!1,required:["type","trigger","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"schedule"},schedule:experimentalServiceScheduleSchema}},{type:"object",additionalProperties:!1,required:["type","trigger","topics"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"queue"},topics:experimentalServiceTopicsSchema,consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","trigger","entrypoint"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"workflow"}}},{type:"object",additionalProperties:!1,required:["type"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"worker"},topics:{type:"array",items:{type:"string",minLength:1,maxLength:256},minItems:1},consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"cron"},schedule:experimentalServiceScheduleSchema}}]}),getExperimentalServicesSchema=()=>({type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:getExperimentalServicesServiceConfigSchema()}),experimentalServiceGroupsSchema={type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:{type:"array",items:{type:"string",minLength:1,maxLength:256}}},servicesPathSchema={type:"string",minLength:1,maxLength:512},servicesCommandSchema={type:"string",minLength:1,maxLength:2048},servicesServiceNamePattern="^[a-z]([a-z_-]*[a-z])?$",servicesBindingSchema={type:"object",additionalProperties:!1,required:["service","format","env"],properties:{type:{description:"Optional binding type marker. Currently the only supported type is `service`. When present this must be `service`.",const:"service"},service:{type:"string",minLength:1,maxLength:64,pattern:servicesServiceNamePattern},format:{const:"url"},env:{type:"string",...envVarNamesSchema}}},servicesBindingsSchema={type:"array",maxItems:100,items:servicesBindingSchema},getServicesServiceConfigSchema=()=>({type:"object",additionalProperties:!1,required:["root"],properties:{root:servicesPathSchema,framework:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},entrypoint:servicesPathSchema,command:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},installCommand:servicesCommandSchema,buildCommand:servicesCommandSchema,devCommand:servicesCommandSchema,ignoreCommand:servicesCommandSchema,outputDirectory:servicesPathSchema,bindings:servicesBindingsSchema,functions:(0,import_build_utils.getFunctionsSchema)(),headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,trailingSlash:import_routing_utils.trailingSlashSchema}}),getServicesSchema=()=>({type:"object",propertyNames:{pattern:servicesServiceNamePattern,maxLength:64},additionalProperties:getServicesServiceConfigSchema()}),proxySchema={type:"object",additionalProperties:!1,required:["entrypoint"],properties:{entrypoint:{type:"string",minLength:1},matcher:{oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,items:{type:"string",minLength:1}}]}}};function buildVercelConfigSchema(){return{type:"object",additionalProperties:!0,properties:{builds:import_build_utils.buildsSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,trailingSlash:import_routing_utils.trailingSlashSchema,functions:(0,import_build_utils.getFunctionsSchema)(),images:imagesSchema,crons:cronsSchema,schedules:schedulesSchema,bunVersion:{type:"string"},proxy:proxySchema,experimentalServices:getExperimentalServicesSchema(),experimentalServiceGroups:experimentalServiceGroupsSchema,services:getServicesSchema(),experimentalServicesV2:getServicesSchema()}}}function validateConfig(config){let validate=getConfigValidator(buildVercelConfigSchema);if(!validate(config)&&validate.errors&&validate.errors[0]){let error=validate.errors[0],fileName=config[import_types.fileNameSymbol]||"vercel.json",niceError=(0,import_build_utils.getPrettyError)(error);return niceError.message=`Invalid ${fileName} - ${niceError.message}`,niceError}for(let[index,schedule]of(config.schedules??[]).entries())if(schedule.timezone!==void 0)try{if(!/^[A-Za-z][A-Za-z0-9_+/-]*$/.test(schedule.timezone))throw new RangeError("Expected a named timezone");new Intl.DateTimeFormat("en-US",{timeZone:schedule.timezone})}catch{return new import_build_utils.NowBuildError({code:"INVALID_SCHEDULE_TIMEZONE",message:`Invalid ${config[import_types.fileNameSymbol]||"vercel.json"} - \`schedules[${index}].timezone\` must be a valid IANA timezone, such as "America/New_York". Omit it to use UTC.`})}for(let[pattern,fn]of Object.entries(config.functions??{}))if(fn.affinity!==void 0)return new import_build_utils.NowBuildError({code:"FUNCTION_AFFINITY_REQUIRES_SERVICE",message:`Function affinity can only be configured under a service. Move functions[${JSON.stringify(pattern)}].affinity into the relevant service's functions configuration.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"});let functionMaps=[config.functions,...Object.values(config.services??{}).map(service=>service.functions),...Object.values(config.experimentalServicesV2??{}).map(service=>service.functions)];for(let functions of functionMaps)for(let[pattern,fn]of Object.entries(functions??{})){let regions=[...new Set(fn.regions)];if(fn.affinity?.mode==="strict"&&(regions.includes("all")||regions.length>1))return new import_build_utils.NowBuildError({code:"INVALID_FUNCTION_AFFINITY_REGIONS",message:`Function affinity mode "strict" requires at most one statically configured region. Update \`functions[${JSON.stringify(pattern)}].regions\` to contain a single region.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"})}if(config.proxy){let proxyError=(0,import_fs_detectors.validateProxyConfig)(config.proxy);if(proxyError)return new import_build_utils.NowBuildError({code:proxyError.code.toUpperCase(),message:proxyError.message})}if(config.functions&&config.builds)return new import_build_utils.NowBuildError({code:"FUNCTIONS_AND_BUILDS",message:"The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",link:"https://vercel.link/functions-and-builds"});if(config.proxy&&config.builds)return new import_build_utils.NowBuildError({code:"PROXY_AND_BUILDS",message:"The `proxy` property cannot be used with the `builds` property. Remove `builds` to use an explicit proxy entrypoint."});let hasExperimentalServices=!!config.experimentalServices;if(hasExperimentalServices&&config.builds)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_BUILDS",message:"The `experimentalServices` property cannot be used in conjunction with the `builds` property. Please remove one of them."});if(hasExperimentalServices&&config.functions)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_FUNCTIONS",message:"The `experimentalServices` property cannot be used in conjunction with the `functions` property. Please remove one of them."});if(config.experimentalServiceGroups&&!config.experimentalServices)return new import_build_utils.NowBuildError({code:"SERVICE_GROUPS_WITHOUT_SERVICES",message:"The `experimentalServiceGroups` property requires `experimentalServices` to be defined. Service groups reference services by name."});let hasServices=config.services!=null,hasExperimentalServicesV2=config.experimentalServicesV2!=null;if(hasServices&&hasExperimentalServicesV2)return new import_build_utils.NowBuildError({code:"SERVICES_AND_EXPERIMENTAL_SERVICES_V2",message:"The `services` property cannot be used in conjunction with its deprecated alias `experimentalServicesV2`. Please use only `services`."});let servicesConfig=config.services??config.experimentalServicesV2,servicesConfigKey=hasServices?"services":"experimentalServicesV2",servicesErrorCodePrefix=hasServices?"SERVICES":"EXPERIMENTAL_SERVICES_V2";if(servicesConfig&&hasExperimentalServices)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_EXPERIMENTAL_SERVICES`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`experimentalServices\` property. Please use only one services configuration.`});if(servicesConfig&&config.builds)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_BUILDS`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`builds\` property. Please remove one of them.`});if(servicesConfig){let ambiguousTopLevel=[];if(config.functions!=null&&ambiguousTopLevel.push("functions"),config.installCommand!=null&&ambiguousTopLevel.push("installCommand"),config.buildCommand!=null&&ambiguousTopLevel.push("buildCommand"),config.devCommand!=null&&ambiguousTopLevel.push("devCommand"),config.ignoreCommand!=null&&ambiguousTopLevel.push("ignoreCommand"),config.outputDirectory!=null&&ambiguousTopLevel.push("outputDirectory"),config.framework!=null&&ambiguousTopLevel.push("framework"),ambiguousTopLevel.length>0){let count=ambiguousTopLevel.length,fields=ambiguousTopLevel.map(field=>`\`${field}\``).join(", ");return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_TOP_LEVEL_BUILD_SETTINGS`,message:`The top-level ${count>1?"properties":"property"} ${fields} cannot be used with \`${servicesConfigKey}\` because the owning service is ambiguous. Move ${count>1?"them":"it"} under the relevant service in \`${servicesConfigKey}\`.`})}}if(servicesConfig){let serviceNames=new Set(Object.keys(servicesConfig));for(let[serviceName,serviceConfig]of Object.entries(servicesConfig))for(let binding of serviceConfig.bindings??[])if(!serviceNames.has(binding.service))return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_BINDING_UNKNOWN_SERVICE`,message:`Service "${serviceName}" declares a binding to unknown service "${binding.service}". Add "${binding.service}" to \`${servicesConfigKey}\` or fix the binding.`})}return null}export{require_dist3 as require_dist,validateConfig};
|