vercel 59.15.1 → 59.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-7XFD2OHW.js → add-65ZSJF26.js} +1 -1
- package/dist/chunks/{add-HZC7AUBY.js → add-7G6574RA.js} +1 -1
- package/dist/chunks/{add-PYUNJZ6K.js → add-MFTI65B7.js} +1 -1
- package/dist/chunks/{build-EFKQ6BND.js → build-BLQRFSLM.js} +1 -1
- package/dist/chunks/{chunk-KO733OJG.js → chunk-265LYROU.js} +1 -1
- package/dist/chunks/{chunk-HZZ5L472.js → chunk-3EBQRPCU.js} +1 -1
- package/dist/chunks/{chunk-KNEWCUWF.js → chunk-4XH66IEQ.js} +1 -1
- package/dist/chunks/{chunk-EOBD4ZEG.js → chunk-4XO6BRQW.js} +1 -1
- package/dist/chunks/{chunk-3QT7VOE3.js → chunk-65JYSI26.js} +1 -1
- package/dist/chunks/{chunk-JIYY3B4C.js → chunk-6NVGLVCH.js} +1 -1
- package/dist/chunks/{chunk-3IAQUNQH.js → chunk-7FEWFNWG.js} +1 -1
- package/dist/chunks/{chunk-NGNOUPWS.js → chunk-7GU2GVQ7.js} +1 -1
- package/dist/chunks/{chunk-RKAUVPOQ.js → chunk-7HSQ4ULK.js} +1 -1
- package/dist/chunks/{chunk-EE3FVJLV.js → chunk-7V6DZO2T.js} +1 -1
- package/dist/chunks/{chunk-ADUYPK2G.js → chunk-AK5EV3WD.js} +1 -1
- package/dist/chunks/{chunk-XHOGOH6N.js → chunk-BMOWQEWL.js} +1 -1
- package/dist/chunks/{chunk-GTRGQIY2.js → chunk-DFE7LVAK.js} +1 -1
- package/dist/chunks/{chunk-7R5FEXZ5.js → chunk-EIXOJUNN.js} +1 -1
- package/dist/chunks/{chunk-AFPOIDM5.js → chunk-FANE2VO3.js} +1 -1
- package/dist/chunks/{chunk-CGOVWHI3.js → chunk-G4QF3M55.js} +1 -1
- package/dist/chunks/{chunk-NHTF332K.js → chunk-GYGIBRFB.js} +1 -1
- package/dist/chunks/{chunk-SGWVKRSR.js → chunk-IT3UX6V4.js} +1 -1
- package/dist/chunks/chunk-LSBEGBBX.js +9 -0
- package/dist/chunks/{chunk-VLZ47RWM.js → chunk-M67S3ZNJ.js} +2 -2
- package/dist/chunks/chunk-MPV7JL34.js +29 -0
- package/dist/chunks/{chunk-M2XARQBF.js → chunk-NB2UCUFL.js} +1 -1
- package/dist/chunks/{chunk-5QQNYN4N.js → chunk-O3QTFKP3.js} +1 -1
- package/dist/chunks/chunk-OAKO6LVS.js +7 -0
- package/dist/chunks/{chunk-OD6RZ3XZ.js → chunk-OTVTI2GM.js} +1 -1
- package/dist/chunks/chunk-PV5PBVER.js +7 -0
- package/dist/chunks/{chunk-HSJ6AHWG.js → chunk-PZPLBXHU.js} +1 -1
- package/dist/chunks/{chunk-MAVRGZQP.js → chunk-QGHN2WOY.js} +1 -1
- package/dist/chunks/{chunk-LDM3SQAU.js → chunk-R3RHRLGI.js} +1 -1
- package/dist/chunks/{chunk-AUGK2HIT.js → chunk-RN2EWPUH.js} +2 -2
- package/dist/chunks/{chunk-ENS6KX2F.js → chunk-RUJT2JBX.js} +1 -1
- package/dist/chunks/chunk-TEAQZXCV.js +9 -0
- package/dist/chunks/{chunk-TKBXN4H3.js → chunk-TGVB4DJ4.js} +2 -2
- package/dist/chunks/{chunk-WKZ6JSGZ.js → chunk-TKBORMUF.js} +1 -1
- package/dist/chunks/{chunk-D3EHMP4U.js → chunk-V4L6NUSW.js} +1 -1
- package/dist/chunks/{chunk-OK3S6KFX.js → chunk-V6GSMYQB.js} +2 -2
- package/dist/chunks/{chunk-562OXD3F.js → chunk-XK2BQUWV.js} +3 -3
- package/dist/chunks/{chunk-OKZDOANA.js → chunk-XZ2JXEXU.js} +1 -1
- package/dist/chunks/{chunk-2PPXY24N.js → chunk-YCCBAQIH.js} +2 -2
- package/dist/chunks/{chunk-CUAIEGNE.js → chunk-YCD5VEHQ.js} +1 -1
- package/dist/chunks/{chunk-HVUHCRZB.js → chunk-ZM2RFVTV.js} +1 -1
- package/dist/chunks/{clear-5NQAVWIF.js → clear-OJ6EDV3Q.js} +1 -1
- package/dist/chunks/{compile-vercel-config-6J2XUFRK.js → compile-vercel-config-HKMFYX2L.js} +1 -1
- package/dist/chunks/{config-CKYRXZXL.js → config-IVZNLEUK.js} +1 -1
- package/dist/chunks/{config-VNUY4RJ4.js → config-LULRZCTY.js} +1 -1
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{constants-G4UYVLOF.js → constants-NCE2LWSS.js} +1 -1
- package/dist/chunks/{delete-HRJEO4MI.js → delete-DUHLA627.js} +1 -1
- package/dist/chunks/{delete-GTXXCSKQ.js → delete-HBL7TKZ5.js} +1 -1
- package/dist/chunks/{detect-services-GHILEGNU.js → detect-services-5GIRISUS.js} +1 -1
- package/dist/chunks/{disable-RWCRVG5O.js → disable-XTZ2FN2I.js} +1 -1
- package/dist/chunks/{discard-SHFIYCJU.js → discard-4IW37YWA.js} +1 -1
- package/dist/chunks/{edit-DMO3NSO2.js → edit-BBEW6J4Y.js} +1 -1
- package/dist/chunks/{edit-EVQI2RSS.js → edit-PUQ4NHNH.js} +1 -1
- package/dist/chunks/{enable-AWDU6STD.js → enable-4AIU4V44.js} +1 -1
- package/dist/chunks/{export-IQKTA4RS.js → export-NQ4SZHRW.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-VKOWC4PZ.js → generate-cert-for-deploy-IGJNGQLD.js} +1 -1
- package/dist/chunks/{image-LDFYNOCA.js → image-PEDML4FR.js} +1 -1
- package/dist/chunks/{import-builders-P7CXSX2D.js → import-builders-UAMMKJAT.js} +1 -1
- package/dist/chunks/{inspect-53SGDDAH.js → inspect-DXFD47VC.js} +1 -1
- package/dist/chunks/{inspect-5INZDUQS.js → inspect-EEGSI64I.js} +1 -1
- package/dist/chunks/{inspect-WMT2M335.js → inspect-EZP7WID3.js} +1 -1
- package/dist/chunks/{inspect-3N47ODIH.js → inspect-TUXRUGES.js} +1 -1
- package/dist/chunks/{inspect-Y6BUCOUV.js → inspect-WY6ISJM6.js} +1 -1
- package/dist/chunks/{list-K5J7OULR.js → list-EQBJKUH7.js} +1 -1
- package/dist/chunks/{list-BIAPHKFM.js → list-JC24ACBV.js} +1 -1
- package/dist/chunks/{list-DMOCRRSE.js → list-QTYHA5QM.js} +1 -1
- package/dist/chunks/{login-SRVNHI4Y.js → login-WDMVEUBV.js} +1 -1
- package/dist/chunks/{logs-GK7CJBYY.js → logs-JWDSCEI5.js} +1 -1
- package/dist/chunks/{ls-AJWN5ZR4.js → ls-3VJGBK3L.js} +1 -1
- package/dist/chunks/{ls-UVKTHBTE.js → ls-3ZKP7ZPO.js} +1 -1
- package/dist/chunks/{ls-KGIE6HCO.js → ls-BAMHXX2I.js} +1 -1
- package/dist/chunks/{ls-WEG45IOC.js → ls-S6JZYPGH.js} +1 -1
- package/dist/chunks/ls-TYHGH2W4.js +11 -0
- package/dist/chunks/{ls-7ZX6DCJW.js → ls-YA2L3HO5.js} +1 -1
- package/dist/chunks/{ls-BFJWCRLZ.js → ls-YXJ4X57G.js} +1 -1
- package/dist/chunks/mutate-PE6TUYAM.js +9 -0
- package/dist/chunks/notifications-T3RUG34N.js +7 -0
- package/dist/chunks/{open-OEWPI5G6.js → open-BAWCRPNZ.js} +1 -1
- package/dist/chunks/{permissions-EPQBQFE3.js → permissions-4AXOWGE6.js} +1 -1
- package/dist/chunks/{publish-JG7MEPWT.js → publish-2XWTYLVS.js} +1 -1
- package/dist/chunks/{pull-MRKXG6TO.js → pull-KCOUWGVC.js} +1 -1
- package/dist/chunks/{purchase-domain-if-available-O5ARXEZ5.js → purchase-domain-if-available-BLEETOAR.js} +1 -1
- package/dist/chunks/{push-XOXJDFYO.js → push-HVT3DU7K.js} +1 -1
- package/dist/chunks/query-MJ7EBPCB.js +12 -0
- package/dist/chunks/{reorder-5DMRFDBY.js → reorder-2L5YJSXX.js} +1 -1
- package/dist/chunks/{reply-WSRNZWFD.js → reply-PPDMG3MF.js} +1 -1
- package/dist/chunks/{resolve-YJUXQVOZ.js → resolve-YJVUNKED.js} +1 -1
- package/dist/chunks/{restore-QT3DBGKU.js → restore-V6I26UDI.js} +1 -1
- package/dist/chunks/{rm-MVZFU6RG.js → rm-3NXDUNS4.js} +1 -1
- package/dist/chunks/{rm-WB2AIP3N.js → rm-43ZFE4U2.js} +1 -1
- package/dist/chunks/{rm-XRP6MRUT.js → rm-CD6UH446.js} +1 -1
- package/dist/chunks/{rm-PXR4J2US.js → rm-SQNLLMLK.js} +1 -1
- package/dist/chunks/{rm-MHPIUEZ5.js → rm-VUOBWXNR.js} +1 -1
- package/dist/chunks/{rule-inspect-TT3DRGCS.js → rule-inspect-D6NCXGFR.js} +1 -1
- package/dist/chunks/rules-CI4NIZTK.js +7 -0
- package/dist/chunks/schema-C2ZBFLA5.js +14 -0
- package/dist/chunks/{schema-KCNKVFT3.js → schema-GTOTPNEE.js} +1 -1
- package/dist/chunks/{set-7BANEWEL.js → set-5OG2JDEK.js} +1 -1
- package/dist/chunks/{setup-and-link-ZAV3EFGC.js → setup-and-link-KW27P3UH.js} +1 -1
- package/dist/chunks/{tags-VZR66NUC.js → tags-77GJR6ZK.js} +1 -1
- package/dist/chunks/{update-RBFNNSWE.js → update-5BEQ4XCV.js} +2 -2
- package/dist/chunks/utils-BG3TNJBX.js +86 -0
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +3 -3
- package/dist/commands/dev/index.js +4 -4
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +508 -492
- package/dist/index.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +46 -46
- package/dist/chunks/chunk-BATE73HA.js +0 -9
- package/dist/chunks/chunk-EOCTK4EA.js +0 -7
- package/dist/chunks/chunk-FKCOBJFH.js +0 -7
- package/dist/chunks/chunk-G5FC5ZCO.js +0 -9
- package/dist/chunks/chunk-NWFHHUKZ.js +0 -7
- package/dist/chunks/query-AL7C6WV2.js +0 -12
- package/dist/chunks/rules-B5GW4KJH.js +0 -7
- package/dist/chunks/schema-JY5QTZOG.js +0 -14
- package/dist/chunks/utils-B5ZTMQKY.js +0 -58
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_dist,require_dist2}from"./chunk-7RMCBXBB.js";import{require_types}from"./chunk-GHM7V3GG.js";import{require_build_utils}from"./chunk-XFVGX5HG.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,isExperimentalService:()=>import_fs_detectors2.isExperimentalService,isExperimentalServiceV2:()=>import_fs_detectors2.isExperimentalServiceV2,isRouteOwningBuilder:()=>import_fs_detectors2.isRouteOwningBuilder,isStaticBuild:()=>import_fs_detectors2.isStaticBuild,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:"string",minLength:1,maxLength:256}}},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},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[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};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{formatOption,jsonOption,projectOption,yesOption}from"./chunk-JAJW3P42.js";import{packageName}from"./chunk-FI772UVH.js";var projectScopeOption={...projectOption,shorthand:"p",description:"Use a project by name or ID"},listAllOption={name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"List all accessible rules in the selected team"},mutationAllOption={...listAllOption,description:"Apply the rule to all projects in the selected team"},deprecatedItemScopeOptions=[{...projectScopeOption,deprecated:!0},{...listAllOption,deprecated:!0}],bodyOption={name:"body",shorthand:null,type:String,argument:"PATH",deprecated:!1,description:"Read the alert rule body from a JSON file"},rulesLsSubcommand={name:"ls",aliases:["list"],description:"List alert rules for a project or team",arguments:[],options:[projectScopeOption,listAllOption,{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by rule type: built-in or custom"},formatOption,jsonOption],examples:[{name:"List rules affecting the linked project",value:`${packageName} alerts rules ls`},{name:"List all rules in the selected team",value:`${packageName} alerts rules ls --all`},{name:"List custom rules for a project",value:`${packageName} alerts rules ls --project my-app --type custom`},{name:"Write JSON output",value:`${packageName} alerts rules ls --all --json`}]},rulesSchemaSubcommand={name:"schema",aliases:[],description:"Show alert rule request fields and examples",arguments:[],options:[{name:"type",shorthand:null,type:String,argument:"TYPE",deprecated:!1,description:"Rule type to describe: built-in or custom"},formatOption],examples:[{name:"List supported rule types",value:`${packageName} alerts rules schema`},{name:"Show the built-in rule schema",value:`${packageName} alerts rules schema --type built-in`},{name:"Show the custom rule schema as JSON",value:`${packageName} alerts rules schema --type custom --format json`}]},rulesAddSubcommand={name:"add",aliases:["create"],description:"Create an alert rule from a JSON body",arguments:[],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,bodyOption],examples:[{name:"Create a project-scoped rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Create a team-wide built-in rule",value:`${packageName} alerts rules add --all --body ./rule.json`}]},rulesInspectSubcommand={name:"inspect",aliases:["get"],description:"Show one alert rule by ID",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption],examples:[{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules inspect ar_abc123 --json`}]},rulesRmSubcommand={name:"rm",aliases:["remove","delete"],description:"Delete an alert rule",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption,yesOption],examples:[{name:"Delete with confirmation",value:`${packageName} alerts rules rm ar_abc123`},{name:"Delete without a prompt",value:`${packageName} alerts rules rm ar_abc123 --yes`}]},rulesUpdateSubcommand={name:"update",aliases:["patch"],description:"Patch an alert rule or change its scope",arguments:[{name:"ruleId",required:!0}],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,{...bodyOption,description:"Read the partial update body from a JSON file"}],examples:[{name:"Update fields from a file",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Move a rule to a project",value:`${packageName} alerts rules update ar_abc123 --project my-app`}]},rulesAggregateCommand={name:"rules",aliases:[],description:"Create, inspect, list, update, and delete alert rules",arguments:[],subcommands:[rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand],options:[],examples:[{name:"List rules for the linked project",value:`${packageName} alerts rules ls`},{name:"Show the custom rule schema",value:`${packageName} alerts rules schema --type custom`},{name:"Add a rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Update a rule",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Delete a rule",value:`${packageName} alerts rules rm ar_abc123`}]};export{rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesAggregateCommand};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{output_manager_default}from"./chunk-Z6Y55QJW.js";function getRollupColumnName(metric,aggregation){return`${metric}_${aggregation}`.replace(/[./]/g,"_")}function getResolvedOrderMetadata(query,response){let orderBy=query.orderBy??(response.orderBy?"count":void 0),orderDirection=response.orderDirection??query.orderDirection;return{...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}}}function formatQueryJson(query,response){let orderMetadata=getResolvedOrderMetadata(query,response),queryWithResponseMetadata={...query,...orderMetadata};return JSON.stringify({query:queryWithResponseMetadata,summary:response.summary??[],data:response.data??[],...orderMetadata},null,2)}function formatErrorJson(code,message,allowedValues){let error={code,message};return allowedValues&&allowedValues.length>0&&(error.allowedValues=allowedValues),JSON.stringify({error},null,2)}function handleApiError(err,jsonOutput,client,overrides={}){let code,message,override=overrides[err.status];if(override)code=override.code||err.code||"BAD_REQUEST",message=override.message;else switch(err.status){case 402:code=err.code||"PAYMENT_REQUIRED",message=err.serverMessage||"This feature requires an Observability Plus subscription. Upgrade at https://vercel.com/dashboard/settings/billing";break;case 429:code=err.code||"RATE_LIMITED",message=err.serverMessage||"You have reached the metrics query rate limit. Please wait and try again. If you need a higher limit, request one from your Vercel account team.";break;case 403:code="FORBIDDEN",message="You do not have permission to query metrics for this project/team.";break;case 500:code="INTERNAL_ERROR",message="An internal error occurred. Please try again later.";break;case 504:code="TIMEOUT",message="The query timed out. Try a shorter time range or fewer groups.";break;case 400:code=err.code||"BAD_REQUEST",message=err.serverMessage||`API error (${err.status})`;break;default:code=err.code||"BAD_REQUEST",message=err.serverMessage||`API error (${err.status})`}return jsonOutput?client.stdout.write(formatErrorJson(code,message,err.allowedValues)):(output_manager_default.error(message),err.allowedValues&&err.allowedValues.length>0&&output_manager_default.print(`
|
|
8
|
-
Available values: ${err.allowedValues.join(", ")}
|
|
9
|
-
`)),1}export{getRollupColumnName,getResolvedOrderMetadata,formatQueryJson,formatErrorJson,handleApiError};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{formatErrorJson,handleApiError}from"./chunk-G5FC5ZCO.js";import{isAPIError}from"./chunk-R2TGGVCT.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";var OBSERVABILITY_METRICS_PATH="/metrics/v1",METRIC_CATALOG_PAGE_SIZE=250;function toMetricDetail(metric){return{id:metric.id,description:metric.description,dimensions:metric.dimensions,unit:metric.unit,aggregations:metric.aggregations,defaultAggregation:metric.defaultAggregation}}function getDefaultAggregation(detail,metricId){return detail.find(metric=>metric.id===metricId)?.defaultAggregation}async function fetchMetricList(client,accountId){let{metrics}=await client.fetch("/v2/observability/schema",{accountId});return metrics}async function fetchMetricCatalog(client,accountId,kind,search,activeSince){let metrics=[],cursor=null;do{let searchParams=new URLSearchParams({limit:String(METRIC_CATALOG_PAGE_SIZE),kind});search&&searchParams.set("search",search),activeSince&&searchParams.set("activeSince",activeSince),cursor&&searchParams.set("cursor",cursor);let response=await client.fetch(`${OBSERVABILITY_METRICS_PATH}?${searchParams}`,{accountId,bailOn429:!0});metrics.push(...response.metrics.map(metric=>({id:metric.id,description:metric.description,dimensions:metric.dimensions,unit:metric.unit,aggregations:metric.aggregations}))),cursor=response.pagination.hasMore?response.pagination.nextCursor:null}while(cursor);return metrics.filter(metric=>(kind==="all"||(kind==="system"?metric.id.startsWith("vercel."):!metric.id.startsWith("vercel.")))&&(!search||metric.id.startsWith(search))).sort((left,right)=>left.id.localeCompare(right.id))}function fetchCustomMetricCatalog(client,accountId,search,activeSince){return fetchMetricCatalog(client,accountId,"custom",search,activeSince)}async function fetchCatalogMetricDetail(client,accountId,metricId,kind,activeSince){let metrics=await fetchMetricCatalog(client,accountId,kind,metricId,activeSince),exactMetric=metrics.find(metric=>metric.id===metricId);return exactMetric?[exactMetric]:metrics}async function fetchMetricDetail(client,accountId,metricId){return(await client.fetch(`/v2/observability/schema/${encodeURIComponent(metricId)}`,{accountId})).map(toMetricDetail)}async function fetchSchemaOrExit(client,jsonOutput,operation){try{return await operation()}catch(err){if(isAPIError(err))return handleApiError(err,jsonOutput,client,{401:{code:"SCHEMA_UNAUTHORIZED",message:"The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."},403:{code:"SCHEMA_UNAUTHORIZED",message:"The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."}});let message=err instanceof Error?`Failed to fetch metrics schema: ${err.message}`:`Failed to fetch metrics schema: ${String(err)}`;return jsonOutput?client.stdout.write(formatErrorJson("SCHEMA_FETCH_FAILED",message)):output_manager_default.error(message),1}}function fetchCustomMetricDetailOrExit(client,accountId,jsonOutput,metricId){return fetchSchemaOrExit(client,jsonOutput,()=>fetchCatalogMetricDetail(client,accountId,metricId,"custom"))}function fetchCatalogMetricDetailOrExit(client,accountId,jsonOutput,metricId,kind,activeSince){return fetchSchemaOrExit(client,jsonOutput,()=>fetchCatalogMetricDetail(client,accountId,metricId,kind,activeSince))}function fetchMetricCatalogListOrExit(client,accountId,jsonOutput){return fetchSchemaOrExit(client,jsonOutput,()=>fetchMetricCatalog(client,accountId,"all").then(metrics=>metrics.map(({id,description})=>({id,description}))))}function fetchCombinedMetricListOrExit(client,accountId,jsonOutput){return fetchSchemaOrExit(client,jsonOutput,async()=>{let[platformMetrics,customMetrics]=await Promise.all([fetchMetricList(client,accountId),fetchCustomMetricCatalog(client,accountId).catch(()=>[])]);return[...platformMetrics.filter(metric=>metric.id.startsWith("vercel.")),...customMetrics.map(({id,description})=>({id,description}))].sort((left,right)=>left.id.localeCompare(right.id))})}async function fetchMetricDetailOrExit(client,accountId,metricId,jsonOutput){return fetchSchemaOrExit(client,jsonOutput,()=>fetchMetricDetail(client,accountId,metricId))}export{OBSERVABILITY_METRICS_PATH,getDefaultAggregation,fetchCustomMetricDetailOrExit,fetchCatalogMetricDetailOrExit,fetchMetricCatalogListOrExit,fetchCombinedMetricListOrExit,fetchMetricDetailOrExit};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{OBSERVABILITY_METRICS_PATH,fetchCatalogMetricDetailOrExit,fetchMetricDetailOrExit,getDefaultAggregation}from"./chunk-NWFHHUKZ.js";import{computeGranularity,formatText,getDefaultCustomMetricAggregation,isCanonicalAggregation}from"./chunk-OK3S6KFX.js";import{formatErrorJson,formatQueryJson,getRollupColumnName,handleApiError}from"./chunk-G5FC5ZCO.js";import"./chunk-IVSSTHB6.js";import"./chunk-GZNDA6SV.js";import{resolveTimeRange,validateAllProjectMutualExclusivity}from"./chunk-6RIQPTJA.js";import"./chunk-MBL6TXEJ.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{metricsCommand}from"./chunk-WUZD4KBL.js";import"./chunk-JZRMH5UA.js";import"./chunk-QTKJC2O5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import{getScope}from"./chunk-5QQNYN4N.js";import{parseArguments}from"./chunk-HTC6KO2B.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-LNPMDXBJ.js";import"./chunk-MY4MONOH.js";import{getLinkedProject,getProjectByNameOrId}from"./chunk-VLZ47RWM.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-OSCCYU74.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-XSVBYDYI.js";import"./chunk-EVZRQGNK.js";import{ProjectNotFound,isAPIError}from"./chunk-R2TGGVCT.js";import"./chunk-FI772UVH.js";import"./chunk-XFVGX5HG.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import{require_source}from"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);function validateRequiredMetric(metric){return metric?{valid:!0,value:metric}:{valid:!1,code:"MISSING_METRIC",message:`Missing required metric. Specify the metric to query.
|
|
8
|
-
|
|
9
|
-
Run 'vercel metrics schema' to see available metrics.`}}function validateOrderDirection(orderDirection){return orderDirection===void 0?{valid:!0,value:void 0}:orderDirection==="asc"||orderDirection==="desc"?{valid:!0,value:orderDirection}:{valid:!1,code:"INVALID_ORDER",message:`Invalid order "${orderDirection}". Use "asc" or "desc".`,allowedValues:["asc","desc"]}}function validateOrderBy(orderBy){return orderBy===void 0?{valid:!0,value:void 0}:orderBy==="value"||orderBy==="count"?{valid:!0,value:orderBy}:{valid:!1,code:"INVALID_ORDER_BY",message:`Invalid order-by "${orderBy}". Use "value" or "count".`,allowedValues:["value","count"]}}function handleValidationError(result,jsonOutput,client,telemetry){return telemetry.trackCliError(result.code),jsonOutput?client.stdout.write(formatErrorJson(result.code,result.message,result.allowedValues)):(output_manager_default.error(result.message),result.allowedValues&&result.allowedValues.length>0&&output_manager_default.print(`
|
|
10
|
-
Available values: ${result.allowedValues.join(", ")}
|
|
11
|
-
`)),1}var PRODUCTION_ENVIRONMENT_FILTER="environment eq 'production'",PRODUCTION_ENVIRONMENT_KQL_FILTER="environment:production",CUSTOM_METRIC_VALUE_ALIAS="value",CUSTOM_METRIC_COUNT_ALIAS="__seriesCount",SUM_DEFAULT_METRIC_UNITS=new Set(["bytes","count","usd","units"]),FILTER_DEPRECATION_WARNING="OData support in --filter is deprecated and will be removed soon. KQL will be the only supported filter syntax.";function combineFilters(filters,prod,syntax="odata"){let nonEmptyFilters=[...filters?.filter(filter=>filter.length>0)??[],...prod?[syntax==="kql"?PRODUCTION_ENVIRONMENT_KQL_FILTER:PRODUCTION_ENVIRONMENT_FILTER]:[]];if(nonEmptyFilters.length===0)return;if(nonEmptyFilters.length===1)return nonEmptyFilters[0];let conjunction=syntax==="kql"?" AND ":" and ";return nonEmptyFilters.map(filter=>`(${filter})`).join(conjunction)}function usesODataSyntax(filters){return filters?.some(filter=>{let unquoted=filter.replace(/"(?:\\.|[^"\\])*"|'(?:''|[^'])*'/g,"");return/\s(?:eq|ne|gt|ge|lt|le|in)\s/i.test(unquoted)||/\b(?:contains|startswith|endswith)\s*\(/i.test(unquoted)})??!1}function getRequestOrderBy(metric,aggregation,orderBy){return orderBy==="value"?getRollupColumnName(metric,aggregation):void 0}function toBucketSeconds(granularity){return"minutes"in granularity?granularity.minutes*60:"hours"in granularity?granularity.hours*60*60:granularity.days*24*60*60}function alignTimeRangeToGranularity(startTime,endTime,granularity){let bucketMs=toBucketSeconds(granularity)*1e3;return{startTime:new Date(Math.floor(startTime.getTime()/bucketMs)*bucketMs),endTime:new Date(Math.ceil(endTime.getTime()/bucketMs)*bucketMs)}}function getCatalogDefaultAggregation(metric,isPlatformMetric){if(!isPlatformMetric)return getDefaultCustomMetricAggregation(metric.unit,metric.aggregations);let defaultAggregation=SUM_DEFAULT_METRIC_UNITS.has(metric.unit)?"sum":"avg";return metric.aggregations.includes(defaultAggregation)?defaultAggregation:defaultAggregation==="sum"&&metric.aggregations.includes("count")?"count":metric.aggregations.includes("sum")?"sum":metric.aggregations[0]}function toCanonicalMetricSelection(metric,aggregation,supportedAggregations){let[aggregationName,...dimensionParts]=aggregation.split("/"),dimension=dimensionParts.join("/")||void 0,countOnlyMetric=supportedAggregations?.includes("count")===!0&&!supportedAggregations.includes("sum"),additiveAggregation=supportedAggregations?.includes("sum")?"sum":countOnlyMetric||supportedAggregations===void 0&&metric.endsWith(".count")?"count":"sum";return aggregation==="persecond"?{metric,aggregation:additiveAggregation,per:"second"}:aggregation==="percent"?{metric,aggregation:additiveAggregation,normalize:"percent"}:aggregationName==="unique"?dimension?{metric,aggregation:"unique",dimensions:[dimension]}:{valid:!1,code:"UNSUPPORTED_AGGREGATION",message:'The unique aggregation requires a dimension, for example "unique/visitorId".'}:isCanonicalAggregation(aggregation)?{metric,aggregation}:{valid:!1,code:"INVALID_AGGREGATION",message:`Aggregation "${aggregation}" is not supported by the Observability query API.`}}function getCanonicalOrderBy(orderBy,selection,supportedAggregations){if(orderBy==="value")return"value";let supportsCount=supportedAggregations===void 0||supportedAggregations.includes("count");return selection.aggregation==="count"||supportsCount?"count":orderBy==="count"?{valid:!1,code:"INVALID_ORDER_BY",message:"--order-by count is not available because this metric does not support the count aggregation. Use --order-by value.",allowedValues:["value"]}:"value"}function createCanonicalMetricsRequest(options){let metrics={[CUSTOM_METRIC_VALUE_ALIAS]:options.selection},rankMetric=CUSTOM_METRIC_VALUE_ALIAS;return options.groupBy.length>0&&options.orderBy==="count"&&options.selection.aggregation!=="count"&&(metrics[CUSTOM_METRIC_COUNT_ALIAS]={metric:options.metric,aggregation:"count"},rankMetric=CUSTOM_METRIC_COUNT_ALIAS),{scope:{ownerId:options.scope.ownerId,...options.scope.type==="project"?{projectIds:options.scope.projectIds}:{}},timeRange:{start:options.startTime.toISOString(),end:options.endTime.toISOString()},bucketSeconds:toBucketSeconds(options.granularity),...options.groupBy.length>0?{groupBy:options.groupBy}:{},...options.filter?{filter:options.filter}:{},metrics,outputs:[CUSTOM_METRIC_VALUE_ALIAS],...options.groupBy.length>0?{seriesSelection:{limit:options.limit,mode:"exact",rankBy:[{metric:rankMetric,direction:options.orderDirection??"desc"}]}}:{}}}function canonicalResponseToMetricsResponse(response,rollupColumn,orderBy,orderDirection){let toRow=point=>({...point.dimensions,[rollupColumn]:point.values[CUSTOM_METRIC_VALUE_ALIAS]??null});return{...response.series?{data:response.series.map(point=>({timestamp:point.timestamp,...toRow(point)}))}:{},summary:response.summary.map(toRow),statistics:{rowsRead:response.meta.statistics.rowsRead,bytesRead:response.meta.statistics.bytesRead,dbTimeSeconds:response.meta.statistics.databaseElapsedMs/1e3,engineTimeSeconds:response.meta.statistics.elapsedMs/1e3,queryTable:[...new Set(response.meta.sources.map(source=>source.id))].sort().join(",")},...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}}}async function resolveQueryScope(client,telemetry,opts){if(opts.project||opts.all){let{team}=await getScope(client);if(!team)return handleValidationError({valid:!1,code:"NO_TEAM",message:"No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory."},opts.jsonOutput,client,telemetry);if(opts.all)return{scope:{type:"owner",ownerId:team.id},accountId:team.id,teamName:team.slug};let project=await getProjectByNameOrId(client,opts.project,team.id);if(project instanceof ProjectNotFound){let errMsg=`Project "${opts.project}" was not found in team "${team.slug}".`;return handleValidationError({valid:!1,code:"PROJECT_NOT_FOUND",message:errMsg},opts.jsonOutput,client,telemetry)}return{scope:{type:"project",ownerId:team.id,projectIds:[project.id]},accountId:team.id,teamName:team.slug,projectName:project.name}}let linkedProject=await getLinkedProject(client);return linkedProject.status==="error"?(telemetry.trackCliError("LINK_ERROR"),linkedProject.exitCode):linkedProject.status==="not_linked"?handleValidationError({valid:!1,code:"NOT_LINKED",message:"No linked project found. Run `vercel link` to link a project, or use --project <name-or-id> or --all."},opts.jsonOutput,client,telemetry):{scope:{type:"project",ownerId:linkedProject.org.id,projectIds:[linkedProject.project.id]},accountId:linkedProject.org.id,teamName:linkedProject.org.slug,projectName:linkedProject.project.name}}async function query(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(metricsCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return telemetry.trackCliError("INVALID_ARGUMENTS"),printError(err),1}let flags=parsedArgs.flags,positionalArgs=parsedArgs.args.slice(1),positionalMetric=positionalArgs[0]==="query"?positionalArgs[1]:positionalArgs[0],formatResult=validateJsonOutput(flags);if(!formatResult.valid)return telemetry.trackCliError("INVALID_OUTPUT_FORMAT"),output_manager_default.error(formatResult.error),1;let jsonOutput=formatResult.jsonOutput,metricFlag=positionalMetric,aggregationFlag=flags["--aggregation"],groupBy=flags["--group-by"]??[],limit=flags["--limit"],orderByInput=typeof flags["--order-by"]=="string"?flags["--order-by"].trim().toLowerCase():void 0,orderInput=typeof flags["--order"]=="string"?flags["--order"].trim().toLowerCase():void 0,filters=flags["--filter"],prod=flags["--prod"],since=flags["--since"],until=flags["--until"],granularity=flags["--granularity"],bucketTimezone=flags["--bucket-timezone"]?.trim(),project=flags["--project"],all=flags["--all"];telemetry.trackCliArgumentMetricId(metricFlag),telemetry.trackCliOptionAggregation(aggregationFlag),telemetry.trackCliOptionGroupBy(groupBy.length>0?groupBy:void 0),telemetry.trackCliOptionLimit(limit),telemetry.trackCliOptionOrderBy(orderByInput),telemetry.trackCliOptionOrder(orderInput),telemetry.trackCliOptionFilter(filters),telemetry.trackCliFlagProd(prod),telemetry.trackCliOptionSince(since),telemetry.trackCliOptionUntil(until),telemetry.trackCliOptionGranularity(granularity),telemetry.trackCliOptionBucketTimezone(bucketTimezone),telemetry.trackCliOptionProject(project),telemetry.trackCliFlagAll(all),telemetry.trackCliOptionFormat(flags["--format"]);let orderByResult=validateOrderBy(orderByInput);if(!orderByResult.valid)return handleValidationError(orderByResult,jsonOutput,client,telemetry);let orderByMode=orderByResult.value,requiredMetric=validateRequiredMetric(metricFlag);if(!requiredMetric.valid)return handleValidationError(requiredMetric,jsonOutput,client,telemetry);let metric=requiredMetric.value,mutualResult=validateAllProjectMutualExclusivity(all,project);if(!mutualResult.valid)return handleValidationError(mutualResult,jsonOutput,client,telemetry);let orderDirectionResult=validateOrderDirection(orderInput);if(!orderDirectionResult.valid)return handleValidationError(orderDirectionResult,jsonOutput,client,telemetry);let orderDirection=orderDirectionResult.value,scopeResult=await resolveQueryScope(client,telemetry,{project,all,jsonOutput});if(typeof scopeResult=="number")return scopeResult;let{scope,accountId,teamName,projectName}=scopeResult,isPlatformMetric=metric.startsWith("vercel."),useCanonicalQuery=!isPlatformMetric||!process.env.FF_LEGACY_METRICS,filterUsesOData=usesODataSyntax(filters);useCanonicalQuery&&filterUsesOData&&output_manager_default.print(`${import_chalk.default.yellow("!")} ${FILTER_DEPRECATION_WARNING}
|
|
12
|
-
`);let filter=combineFilters(filters,prod,useCanonicalQuery&&!filterUsesOData?"kql":"odata"),startTime,endTime;try{({startTime,endTime}=resolveTimeRange(since,until))}catch(err){let errMsg=err instanceof Error?err.message:String(err);return handleValidationError({valid:!1,code:"INVALID_TIME",message:errMsg},jsonOutput,client,telemetry)}let metricUnit,aggregationInput,canonicalAggregations;if(useCanonicalQuery){let catalogOrExitCode=await fetchCatalogMetricDetailOrExit(client,accountId,jsonOutput,metric,isPlatformMetric?"system":"custom",startTime.toISOString());if(typeof catalogOrExitCode=="number")return telemetry.trackCliError("SCHEMA_FETCH_FAILED"),catalogOrExitCode;let catalogMetric=catalogOrExitCode.find(item=>item.id===metric);if(!catalogMetric)return handleValidationError({valid:!1,code:"UNKNOWN_METRIC",message:`Unknown metric "${metric}".`,allowedValues:catalogOrExitCode.map(item=>item.id)},jsonOutput,client,telemetry);if(metricUnit=catalogMetric.unit,canonicalAggregations=catalogMetric.aggregations,aggregationFlag)aggregationInput=aggregationFlag;else{let defaultAggregation=getCatalogDefaultAggregation(catalogMetric,isPlatformMetric);if(!defaultAggregation)return handleValidationError({valid:!1,code:"INVALID_AGGREGATION",message:`Metric "${metric}" does not support any query aggregations.`},jsonOutput,client,telemetry);aggregationInput=defaultAggregation}}else{let detailOrExitCode=await fetchMetricDetailOrExit(client,accountId,metric,jsonOutput);if(typeof detailOrExitCode=="number")return telemetry.trackCliError("SCHEMA_FETCH_FAILED"),detailOrExitCode;aggregationInput=aggregationFlag??getDefaultAggregation(detailOrExitCode,metric)??"sum",metricUnit=detailOrExitCode.find(item=>item.id===metric)?.unit??"count"}let aggregation=aggregationInput,orderBy=getRequestOrderBy(metric,aggregation,orderByMode),rangeMs=endTime.getTime()-startTime.getTime(),granResult=computeGranularity(rangeMs,granularity),queryTimeRange=useCanonicalQuery?alignTimeRangeToGranularity(startTime,endTime,granResult.duration):{startTime,endTime};!jsonOutput&&granResult.adjusted&&granResult.notice&&output_manager_default.log(`Notice: ${granResult.notice}`);let body,canonicalOrderBy;if(!useCanonicalQuery)body={scope,metric,aggregation,startTime:startTime.toISOString(),endTime:endTime.toISOString(),granularity:granResult.duration,...bucketTimezone?{bucketTimezone}:{},...groupBy.length>0?{groupBy}:{},...filter?{filter}:{},limit:limit??10,...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}};else{if(bucketTimezone)return handleValidationError({valid:!1,code:"UNSUPPORTED_BUCKET_TIMEZONE",message:"--bucket-timezone is not supported by the new Observability query API yet."},jsonOutput,client,telemetry);let selection=toCanonicalMetricSelection(metric,aggregation,canonicalAggregations);if("valid"in selection)return handleValidationError(selection,jsonOutput,client,telemetry);let supportedAggregation=selection.aggregation;if(canonicalAggregations&&!canonicalAggregations.includes(supportedAggregation))return handleValidationError({valid:!1,code:"INVALID_AGGREGATION",message:`Aggregation "${aggregation}" is not valid for metric "${metric}".`,allowedValues:[...canonicalAggregations]},jsonOutput,client,telemetry);let canonicalOrderByResult=groupBy.length>0?getCanonicalOrderBy(orderByMode,selection,canonicalAggregations):void 0;if(canonicalOrderByResult&&typeof canonicalOrderByResult!="string")return handleValidationError(canonicalOrderByResult,jsonOutput,client,telemetry);canonicalOrderBy=canonicalOrderByResult,body=createCanonicalMetricsRequest({scope,metric,selection,startTime:queryTimeRange.startTime,endTime:queryTimeRange.endTime,granularity:granResult.duration,groupBy,filter,limit:limit??10,orderBy:canonicalOrderBy,orderDirection})}let resolvedOrderBy=canonicalOrderBy??orderByMode;jsonOutput||output_manager_default.spinner("Querying metrics...");let response;try{if(!useCanonicalQuery)response=await client.fetch("/v2/observability/query",{method:"POST",body:JSON.stringify(body),headers:{"Content-Type":"application/json"},accountId,bailOn429:!0});else{let canonicalResponse=await client.fetch(OBSERVABILITY_METRICS_PATH,{method:"POST",body:JSON.stringify(body),headers:{"Content-Type":"application/json"},accountId,bailOn429:!0});response=canonicalResponseToMetricsResponse(canonicalResponse,getRollupColumnName(metric,aggregation),canonicalOrderBy,groupBy.length>0?orderDirection??"desc":void 0)}}catch(err){if(isAPIError(err))return telemetry.trackCliError(err.code??"API_ERROR",err.status),handleApiError(err,jsonOutput,client);let errMsg=err instanceof Error?err.message:String(err);return telemetry.trackCliError("NETWORK_ERROR"),jsonOutput?client.stdout.write(formatErrorJson("NETWORK_ERROR",errMsg)):output_manager_default.error(errMsg),1}finally{jsonOutput||output_manager_default.stopSpinner()}return jsonOutput?client.stdout.write(formatQueryJson({metric,aggregation,groupBy,filter,startTime:queryTimeRange.startTime.toISOString(),endTime:queryTimeRange.endTime.toISOString(),granularity:granResult.duration,...bucketTimezone?{bucketTimezone}:{},...resolvedOrderBy?{orderBy:resolvedOrderBy}:{},...orderDirection?{orderDirection}:{}},response)):client.stdout.write(formatText(response,{metric,metricUnit,aggregation,groupBy,filter,scope,projectName,teamName,periodStart:queryTimeRange.startTime.toISOString(),periodEnd:queryTimeRange.endTime.toISOString(),granularity:granResult.duration,bucketTimezone,orderBy:resolvedOrderBy,orderDirection})),0}export{query as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{getSubcommand}from"./chunk-ETV3C2CV.js";import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-NS4FH2TY.js";import"./chunk-JAJW3P42.js";import"./chunk-R2TGGVCT.js";import"./chunk-FI772UVH.js";import"./chunk-XFVGX5HG.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";var RULES_CONFIG={ls:["ls","list"],schema:["schema"],add:["add","create"],inspect:["inspect","get"],rm:["rm","remove","delete"],update:["update","patch"]};async function rules(client,argv){if(argv.length===0||argv[0]?.startsWith("-")){let lsFn=(await import("./ls-WEG45IOC.js")).default;return lsFn(client,argv)}let{subcommand,args,subcommandOriginal}=getSubcommand(argv,RULES_CONFIG);if(subcommand==null)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:`Unknown "alerts rules" subcommand "${argv[0]}".`,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts rules --help"),when:"Show valid rules subcommands"}]},1),output_manager_default.error(`Unknown "alerts rules" subcommand "${argv[0]}". Run \`vercel alerts rules --help\`.`),1;switch(subcommand){case"ls":return(await import("./ls-WEG45IOC.js")).default(client,args);case"schema":return(await import("./schema-KCNKVFT3.js")).default(client,args);case"add":return(await import("./add-PYUNJZ6K.js")).default(client,args);case"inspect":return(await import("./rule-inspect-TT3DRGCS.js")).default(client,args);case"rm":return(await import("./rm-WB2AIP3N.js")).default(client,args);case"update":return(await import("./update-RBFNNSWE.js")).default(client,args);default:return output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`),1}}export{rules as default};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
-
const require = __createRequire(import.meta.url);
|
|
5
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{fetchCatalogMetricDetailOrExit,fetchCombinedMetricListOrExit,fetchCustomMetricDetailOrExit,fetchMetricCatalogListOrExit,fetchMetricDetailOrExit}from"./chunk-NWFHHUKZ.js";import{formatErrorJson}from"./chunk-G5FC5ZCO.js";import{indent_default}from"./chunk-GZNDA6SV.js";import{formatTable}from"./chunk-NUGLE4QY.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{schemaSubcommand}from"./chunk-WUZD4KBL.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import{getScope}from"./chunk-5QQNYN4N.js";import{parseArguments}from"./chunk-HTC6KO2B.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-LNPMDXBJ.js";import"./chunk-MY4MONOH.js";import{require_pluralize}from"./chunk-VLZ47RWM.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-OSCCYU74.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-XSVBYDYI.js";import"./chunk-EVZRQGNK.js";import"./chunk-R2TGGVCT.js";import"./chunk-FI772UVH.js";import"./chunk-XFVGX5HG.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_pluralize=__toESM(require_pluralize(),1);async function schema(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(schemaSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return printError(err),1}let flags=parsedArgs.flags,positionalArgs=parsedArgs.args.slice(1),positionalMetric=positionalArgs[0]==="schema"?positionalArgs[1]:positionalArgs[0],formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let jsonOutput=formatResult.jsonOutput,metric=positionalMetric;telemetry.trackCliArgumentMetricId(metric),telemetry.trackCliOptionFormat(flags["--format"]);let{team}=await getScope(client);if(!team){let message="The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again.";return jsonOutput?client.stdout.write(formatErrorJson("SCHEMA_UNAUTHORIZED",message)):output_manager_default.error(message),1}let useMetricsV1=!process.env.FF_LEGACY_METRICS;if(metric){let isPlatformMetric=metric.startsWith("vercel."),detail;if(useMetricsV1){let result=await fetchCatalogMetricDetailOrExit(client,team.id,jsonOutput,metric,isPlatformMetric?"system":"custom");if(typeof result=="number")return result;detail=result}else if(isPlatformMetric){let result=await fetchMetricDetailOrExit(client,team.id,metric,jsonOutput);if(typeof result=="number")return result;detail=result}else{let result=await fetchCustomMetricDetailOrExit(client,team.id,jsonOutput,metric);if(typeof result=="number")return result;detail=result}if(detail.length===0){let message=`No metrics match "${metric}". Run \`vercel metrics schema\` to see available metrics.`;return jsonOutput?client.stdout.write(formatErrorJson("METRIC_NOT_FOUND",message)):output_manager_default.error(message),1}if(jsonOutput)return client.stdout.write(JSON.stringify(detail,null,2)),0;output_manager_default.log(`Metric: ${metric}`);let metricsTable=formatMetricsTable(toDisplayMetrics(detail));return metricsTable&&(output_manager_default.print(metricsTable),output_manager_default.print(`
|
|
8
|
-
`)),0}let metricsOrExitCode=useMetricsV1?await fetchMetricCatalogListOrExit(client,team.id,jsonOutput):await fetchCombinedMetricListOrExit(client,team.id,jsonOutput);return typeof metricsOrExitCode=="number"?metricsOrExitCode:(jsonOutput?client.stdout.write(JSON.stringify(metricsOrExitCode,null,2)):(output_manager_default.log(`${(0,import_pluralize.default)("Metric",metricsOrExitCode.length,!0)} found`),output_manager_default.print(formatMetricListTable(metricsOrExitCode)),output_manager_default.print(`
|
|
9
|
-
`)),0)}function formatMetricListTable(metrics){return indent_default(formatTable(["Metric","Description"],["l","l"],[{rows:metrics.map(metric=>[metric.id,metric.description])}]),1)}function toDisplayMetrics(metrics){return metrics.map(metric=>{let dimensions=metric.dimensions.map(dimension=>typeof dimension=="string"?dimension:dimension.name);return{id:metric.id,description:metric.description,dimensions,unit:metric.unit,aggregations:metric.aggregations.map(aggregation=>"defaultAggregation"in metric&&aggregation===metric.defaultAggregation?`${aggregation} (default)`:aggregation)}})}function formatMetricsTable(metrics){if(metrics.length===0)return null;let dimensionsByMetric=metrics.map(metric=>metric.dimensions),sharedDimensions=dimensionsByMetric[0].filter(dimension=>dimensionsByMetric.every(metricDimensions=>metricDimensions.includes(dimension))),rows=metrics.map(metric=>{let extraDimensions=metric.dimensions.filter(dimension=>!sharedDimensions.includes(dimension)).map(dimension=>`+${dimension}`),aggregations=metric.aggregations.join(", ");return{metric:metric.id,description:metric.description,unit:metric.unit,aggregations,extraDimensions}}),hasExtraDimensions=rows.some(row=>row.extraDimensions.length>0),tableHeaders=hasExtraDimensions?["Metric","Description","Unit","Aggregations","Dimensions"]:["Metric","Description","Unit","Aggregations"],tableRows=rows.map(row=>hasExtraDimensions?[row.metric,row.description,row.unit,row.aggregations,row.extraDimensions.join(", ")||"\u2014"]:[row.metric,row.description,row.unit,row.aggregations]),sharedDimensionsLine=sharedDimensions.length>0?metrics.length===1?`Dimensions:
|
|
10
|
-
${sharedDimensions.join(", ")}`:`Shared dimensions:
|
|
11
|
-
${sharedDimensions.join(", ")}`:null;return[`
|
|
12
|
-
${indent_default(formatTable(tableHeaders,hasExtraDimensions?["l","l","l","l","l"]:["l","l","l","l"],[{rows:tableRows}]),1)}`,sharedDimensionsLine].filter(Boolean).join(`
|
|
13
|
-
|
|
14
|
-
`)}export{schema as default};
|