@microsoft/cmr-cli 0.0.0-stage → 0.32.3
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/LICENSE +21 -0
- package/README.md +172 -2
- package/THIRD-PARTY-NOTICES.txt +9751 -0
- package/dist/Add-FU57YE5G.js +11 -0
- package/dist/AddConfig-CI7KNLIG.js +12 -0
- package/dist/AddConnector-WH4IU3ND.js +16 -0
- package/dist/AddDeployment-GWFCPAL5.js +11 -0
- package/dist/AddDeploymentBinding-RFLI6DKH.js +18 -0
- package/dist/AddRayfin-VRCFEOIL.js +38 -0
- package/dist/Alter-JFFT5JOA.js +11 -0
- package/dist/AuthStatus-WCZYGI5G.js +11 -0
- package/dist/AuthSwitch-XJMG7IUR.js +13 -0
- package/dist/Bin.js +12 -0
- package/dist/BuildMaafApp-7AUZHYOQ.js +11 -0
- package/dist/Clear-7B7CDIPV.js +11 -0
- package/dist/Cli-XZ4SJKBZ.js +47 -0
- package/dist/CloneMaafApp-7W246RZA.js +12 -0
- package/dist/CreateMaafApp-6MSPHUU4.js +22 -0
- package/dist/CreateMaafProject-JKMF5TH3.js +11 -0
- package/dist/DeleteMaafApp-TFGWGJO3.js +11 -0
- package/dist/DeployMaafApp-K2APWFOD.js +8 -0
- package/dist/DeployMaafProject-6WRKGIIW.js +11 -0
- package/dist/DeploymentApprovals-WTXBXCKE.js +11 -0
- package/dist/Dev-CIEWFRXR.js +15 -0
- package/dist/EnvironmentVariableAuthenticationProvider-EBRBQ5I2.js +11 -0
- package/dist/FeatureSettings-77LZQSKD.js +11 -0
- package/dist/GenerateCode-UQCHTRGP.js +13 -0
- package/dist/GetMaafBuildStatus-6ZSLIZCH.js +11 -0
- package/dist/GetMaafProjectDeployStatus-NZEMVQGJ.js +12 -0
- package/dist/GetSettings-MVVEXMJC.js +11 -0
- package/dist/InfoMaafApp-7Z6OJCHD.js +13 -0
- package/dist/InfoMaafProject-SQYB736C.js +11 -0
- package/dist/Init-PBH2IXVK.js +11 -0
- package/dist/ListConnectorActions-UERYZ2C7.js +11 -0
- package/dist/ListConnectors-2FUTJMHY.js +11 -0
- package/dist/ListDeployments-4YWCHVKF.js +11 -0
- package/dist/ListMaafApps-ZATO77G3.js +11 -0
- package/dist/ListMaafProjects-GNUXZSYL.js +11 -0
- package/dist/ListSchema-QKVHVPHB.js +8 -0
- package/dist/ListSettings-IIA5OGMP.js +12 -0
- package/dist/Login-BT6UTPCZ.js +11 -0
- package/dist/Logout-FBJE35Q5.js +11 -0
- package/dist/MockFetch-LQLQGTNT.js +13 -0
- package/dist/NoOpAuthenticationProvider-ZZK2OB27.js +11 -0
- package/dist/NodeMsalAuthenticationProvider-5TJFMHR4.js +17 -0
- package/dist/Pack-TSFHSTB5.js +8 -0
- package/dist/PackProject-T575KJQ4.js +14 -0
- package/dist/PlayMaafApp-74TQEAO5.js +8 -0
- package/dist/ProjectApprovals-5KLYEM7V.js +13 -0
- package/dist/ProjectRoleAssignments-AI2FQ2VX.js +11 -0
- package/dist/RefreshDataSource-VARFN3IV.js +11 -0
- package/dist/RefreshGitAuth-DC5NAZBJ.js +11 -0
- package/dist/Remove-MCQZVI3K.js +11 -0
- package/dist/RemoveDataSource-RRND46QZ.js +14 -0
- package/dist/RemoveDeployment-STNFNNZF.js +11 -0
- package/dist/ServicePrincipalAuthenticationProvider-7RBHTYYY.js +11 -0
- package/dist/SetSetting-CEH44OT3.js +11 -0
- package/dist/SetSetting-Q7EQNOTI.js +11 -0
- package/dist/ShareLinkCreate-ZUVHUQLH.js +11 -0
- package/dist/ShareLinkList-IEYU6NZW.js +11 -0
- package/dist/ShareLinkRevoke-22RFGOFJ.js +11 -0
- package/dist/ShareList-6UWIHPBM.js +11 -0
- package/dist/ShareMaafApp-SFNOOMOD.js +11 -0
- package/dist/TelemetrySettings-XCT73DEI.js +11 -0
- package/dist/UnshareMaafApp-TU7U3LQ3.js +11 -0
- package/dist/acorn-CYBWGE5M.js +23 -0
- package/dist/angular-Q62TJP23.js +11 -0
- package/dist/babel-AOXBHIIS.js +22 -0
- package/dist/chunk-2LDU3F6O.js +11 -0
- package/dist/chunk-2LKCCYRF.js +11 -0
- package/dist/chunk-2VJIWD7V.js +11 -0
- package/dist/chunk-3E7QQ2BR.js +11 -0
- package/dist/chunk-3YRE4IQ3.js +132 -0
- package/dist/chunk-4U53RYJJ.js +11 -0
- package/dist/chunk-4XKA5APP.js +42915 -0
- package/dist/chunk-5MHBEEMZ.js +11 -0
- package/dist/chunk-6EF722GY.js +94 -0
- package/dist/chunk-A4PVXTJS.js +13 -0
- package/dist/chunk-ADRQC63G.js +14 -0
- package/dist/chunk-ATUGCFVC.js +11 -0
- package/dist/chunk-BA52TY55.js +12 -0
- package/dist/chunk-BRRT2E75.js +38 -0
- package/dist/chunk-DGUO74I3.js +15 -0
- package/dist/chunk-DKSLWH4O.js +18 -0
- package/dist/chunk-EFY2BSWB.js +12 -0
- package/dist/chunk-FHE3OXIP.js +11 -0
- package/dist/chunk-GE3UFHZ5.js +54 -0
- package/dist/chunk-HBLO3WDD.js +13 -0
- package/dist/chunk-HOIFXUTG.js +11 -0
- package/dist/chunk-HSNRWBA6.js +11 -0
- package/dist/chunk-KKC5ZK4D.js +77 -0
- package/dist/chunk-KT2SUHGM.js +11 -0
- package/dist/chunk-NYPHWF7Q.js +32 -0
- package/dist/chunk-OL6CTXQR.js +11 -0
- package/dist/chunk-OUKOEUZA.js +12 -0
- package/dist/chunk-PEZMQ2A3.js +11 -0
- package/dist/chunk-PLFDUGBA.js +12 -0
- package/dist/chunk-PZIEJEF5.js +11 -0
- package/dist/chunk-Q3ONTUZ7.js +11 -0
- package/dist/chunk-QLK3ZVWP.js +11 -0
- package/dist/chunk-RDXQ3ZPT.js +11 -0
- package/dist/chunk-RFLXPXBN.js +11 -0
- package/dist/chunk-SIEI2EB5.js +12 -0
- package/dist/chunk-SQI4XLR7.js +11 -0
- package/dist/chunk-TMYOZDLM.js +11 -0
- package/dist/chunk-TXMTKOEJ.js +12 -0
- package/dist/chunk-TYRVM4PP.js +8 -0
- package/dist/chunk-UEZV46GZ.js +44 -0
- package/dist/chunk-UT667QSU.js +8 -0
- package/dist/chunk-UXKJNXTZ.js +11 -0
- package/dist/chunk-WTTK2GTG.js +11 -0
- package/dist/chunk-WV7D7PTW.js +12 -0
- package/dist/chunk-WWVAS3DS.js +11 -0
- package/dist/chunk-XIX2O22O.js +11 -0
- package/dist/chunk-Y5AMO72S.js +10 -0
- package/dist/chunk-YRPTITKD.js +12 -0
- package/dist/chunk-ZB6MB7GZ.js +17 -0
- package/dist/dist-7N5TXK2L.js +45 -0
- package/dist/estree-HPTPQIMZ.js +51 -0
- package/dist/flow-B6JUMONE.js +27 -0
- package/dist/glimmer-36KZ3DJ5.js +44 -0
- package/dist/graphql-E6CIFZFV.js +35 -0
- package/dist/html-BUTTPQE6.js +32 -0
- package/dist/markdown-K2C5OZHT.js +69 -0
- package/dist/meriyah-27UE2OSX.js +12 -0
- package/dist/native/arm64/dpapi.node +0 -0
- package/dist/native/ia32/dpapi.node +0 -0
- package/dist/native/x64/dpapi.node +0 -0
- package/dist/postcss-QUHZLBB7.js +68 -0
- package/dist/rayfin-pack-HOUOLOHQ.js +164 -0
- package/dist/typescript-G2G6TDZF.js +28 -0
- package/dist/yaml-W5P5CGFK.js +166 -0
- package/package.json +62 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{h as he,i as we,k as ve}from"./chunk-NYPHWF7Q.js";import{b as Ae}from"./chunk-PLFDUGBA.js";import{a as $e}from"./chunk-6EF722GY.js";import{e as ge}from"./chunk-QLK3ZVWP.js";import{b as ye}from"./chunk-PZIEJEF5.js";import{a as Y}from"./chunk-OL6CTXQR.js";import{a as fe}from"./chunk-RDXQ3ZPT.js";import{e as de,f as ce,m as ue}from"./chunk-ZB6MB7GZ.js";import{b as Z}from"./chunk-2LKCCYRF.js";import{b as q,l as le}from"./chunk-GE3UFHZ5.js";import{A as V,D as O,Ea as re,Ja as se,Ka as pe,Nb as U,Ob as M,Qa as W,Ra as j,ca as ie,k as ne,v as ae,w as D,x as s,z as I}from"./chunk-4XKA5APP.js";import{a as me,m as z}from"./chunk-2LDU3F6O.js";import{y as f,z as P}from"./chunk-4U53RYJJ.js";import{a as g}from"./chunk-HOIFXUTG.js";import{C as B,D as $,E as oe,I as m,K as F,a as C}from"./chunk-KKC5ZK4D.js";import{d as Be}from"./chunk-UT667QSU.js";import{promises as Pe}from"node:fs";import*as L from"node:path";import*as De from"node:zlib";var Oe=10*1024*1024;function be(e,t){try{return Ue(e,t)}catch{return}}function Ue(e,t){let o=Me(e);if(o<0)return;let a=33639248,n=e.readUInt16LE(o+10),r=e.readUInt32LE(o+16);for(let d=0;d<n;d++){if(e.readUInt32LE(r)!==a)return;let i=e.readUInt16LE(r+10),c=e.readUInt32LE(r+20),u=e.readUInt16LE(r+28),w=e.readUInt16LE(r+30),p=e.readUInt16LE(r+32),h=e.readUInt32LE(r+42);if(e.subarray(r+46,r+46+u).toString("utf8")===t){let k=e.readUInt16LE(h+26),S=e.readUInt16LE(h+28),l=h+30+k+S,b=e.subarray(l,l+c);return i===0?b.toString("utf8"):i===8?De.inflateRawSync(b,{maxOutputLength:Oe}).toString("utf8"):void 0}r+=46+u+w+p}}function Me(e){let o=Math.max(0,e.length-22-65535);for(let a=e.length-22;a>=o;a--){if(e.readUInt32LE(a)!==101010256)continue;let n=e.readUInt16LE(a+20);if(a+22+n===e.length)return a}return-1}import{promises as Ce}from"node:fs";var Ie=Be($e(),1);function He(e){return e?.code==="ENOENT"?"continue":e instanceof Error?e:new Error(String(e))}function Le(e){return`zipBuildArtifact: skipping missing entry: ${e?.path??"<unknown>"}`}async function ke(e,t,o){let a=await Ce.stat(e).catch(()=>null);if(!a)throw new s(`buildPath not found: ${e}`);if(!a.isDirectory())throw new s(`buildPath is not a directory: ${e}`);let n=await Ce.stat(t).catch(()=>null);if(!n||!n.isFile())throw new s(`appConfigPath does not point to a file: ${t}`);let r=o?.maxBytes;return new Promise((d,i)=>{let c=[],u=0,w=!1,p=(0,Ie.default)("zip",{zlib:{level:9}});p.on("data",h=>{if(!w){if(u+=h.length,r!==void 0&&u>r){w=!0,p.abort(),i(new O({capBytes:r,bytes:u}));return}c.push(h)}}),p.on("warning",h=>{if(w)return;let A=He(h);if(A==="continue"){F(Le(h));return}i(A)}),p.on("error",h=>{w||i(h)}),p.on("end",()=>{w||d(Buffer.concat(c))}),p.directory(e,!1),p.file(t,{name:C}),p.finalize()})}var _e=1200*1e3,Ge=6e4,Je=2e3,Ve="--no-wait requires Managed DevOps deployment; the selected backend does not return a trackable deployment ID.",Se=`External artifact deployment is not enabled for this environment.
|
|
8
|
+
To enable it, contact your administrator to turn on the
|
|
9
|
+
AllowExternalArtifactDeployment environment setting.`;function K(e){return`${(e/(1024*1024)).toFixed(1)} MB`}function X(e,t){return e!==void 0?`Build artifact is ${K(e)}, which exceeds the ${K(t)} limit.`:`Build artifact exceeds the ${K(t)} limit.`}function We(e){let t=e.id||e.name;if(!t)throw new D("Deploy succeeded but the server response did not include an app identifier.");return{appId:t,displayName:e.displayName,commitHash:e.commitHash??null,appPlayUri:e.appPlayUri??null}}function Ne(e){return{appId:e.appId,displayName:e.name,commitHash:e.commitSha,appPlayUri:e.appPlayUri}}function Q(e,t=e.commitSha){return{deploymentId:e.deploymentId,appName:e.appName,commitHash:t}}function ee(e){let t,o;return{onProgress:a=>{e?.(a),a.type==="submitted"&&(o=a.commitSha),a.type==="status"&&a.deploymentStatus==="AwaitingApproval"&&(t=a.deploymentId)},getHandoff:()=>t?{deploymentId:t,commitHash:o}:void 0}}function N(e){if(e.body)try{let t=JSON.parse(e.body);if(typeof t?.error?.message=="string")return t.error.message}catch{}}function je(e){let t=e.reason==="resultUnavailable"?`Run \`${"ms"} app info\` to view the deployed app.`:e.operationId?`Run \`${"ms"} app info\` to check which commit is live before deploying again.`:void 0;return t&&(e.message=`${e.message} ${t}`),e}function qe(e,t){if(e instanceof O)return new s(X(e.bytes,e.capBytes),e.errorData,{errorCode:"BuildArtifactTooLarge",telemetryDetails:e.errorData});if(e instanceof ie)return je(e);if(!(e instanceof ne))return null;let o={httpStatus:e.status,serverErrorCode:e.code},a=t.repoType!=="none";if(e.status===400&&e.code==="ArtifactNotAllowedForGitRepo"){let n=N(e);return new I(n?`Artifact upload rejected for this git-backed app: ${n}`:`The server reports this app is git-backed; --artifact uploads are not allowed. Update \`${C}\` so \`repoType\` matches the server's record, then re-run with --commit.`,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"DeploymentModeMismatch",exitCode:1,telemetryDetails:o})}if(e.status===400&&e.code==="CommitNotAllowedForArtifactDeploy")return new s("This app uses external artifact deployment. Pass --artifact <path> instead of --commit.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"DeploymentModeMismatch",telemetryDetails:o});if(e.status===400&&e.code==="InvalidRequestContent")return new s("Invalid deploy request \u2014 verify the environment and app id.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InvalidDeployRequest",telemetryDetails:o});if(e.status===400&&e.code==="ServicePrincipalNotSupportedForMaafOperations")return new s("Service principal callers are not supported for `ms app deploy`. Use interactive auth.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"UnsupportedCallerType",telemetryDetails:o});if(e.status===400&&e.code==="BadRequest"){let n=N(e);return a?new s(n??"Invalid commit ID. Use a 40-character lowercase hex value.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InvalidCommitSha",telemetryDetails:o}):new s(`Build artifact rejected: ${n??e.message}`,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildArtifactRejected",telemetryDetails:o})}if(e.status===400&&e.code==="BuildNotAvailable")return new D("No completed build is available for this commit. Run `ms app build` first, or wait for the build to complete before retrying.",void 0,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildNotAvailable",errorCategory:ae.Platform,retryable:!0,telemetryDetails:o});if(e.status===403&&e.code==="ExternalArtifactDeploymentDisabled")return new I(Se,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"ExternalArtifactDeploymentDisabled",exitCode:1,telemetryDetails:Z("deployment_configuration",o)});if(e.status===403&&e.code==="InsufficientPrivilege"){let n=N(e);return new I(n?`${n} Ask an admin to grant the required privilege.`:"You don't have the required privilege to deploy this app. Ask an admin to grant deploy permission on the environment.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InsufficientPrivilege",exitCode:1,telemetryDetails:o})}if(e.status===403&&e.code==="CodeAppOperationNotAllowedInEnvironment")return new I(Se,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"CodeAppOperationNotAllowedInEnvironment",exitCode:1,telemetryDetails:Z("environment_configuration",o)});if(e.status===403&&e.code==="Forbidden")return new I("You don't have permission to deploy this app. Ask an admin to grant you Contributor on the repo.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"RepositoryPermissionDenied",exitCode:1,telemetryDetails:o});if(e.status===404&&e.code==="CommitNotFound"){let n=N(e);return new s(n??"Commit not found on main.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"CommitNotFound",telemetryDetails:o})}if(e.status===404&&e.code==="ApplicationNotFound")return new s(`App '${t.appName}' not found in environment ${t.environmentId}.`);if(e.status===404&&e.code==="PowerConfigNotFound")return new D(`Build output is missing the app config (\`${C}\`). Ensure the config is present at the root of the build output and re-run the build.`);if(e.status===404&&e.code==="OperationNotFound")return new D("Build operation not found on the server. The operation may have been cleaned up; re-run `ms app deploy` to start a fresh build.");if(e.status===409&&e.code==="BuildInProgress")return new D("A build is currently in progress for this app. Run `ms app build-status` to check progress, then retry the deploy.");if(e.status===409&&e.code==="NoGreenBuildAvailable")return new D("No successful build is available to deploy. Push a commit and wait for the build to succeed before retrying.");if(e.status===409&&e.code==="RepoTypeMismatch"){let n=N(e);return new s(n?`Repo type mismatch: ${n}`:"The app's repoType in ms.config.json doesn't match the server's record. Update ms.config.json to match.")}if(e.status===413)return new D(X(void 0,524288e3));if(e.status===422&&e.code==="ArtifactInvalid"){let n=N(e)??e.message;return new s(`Artifact validation failed: ${n}`)}return e.status===502&&e.code==="MaafBuildServiceUnavailable"?new V("Build service is temporarily unavailable. Try again.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildServiceUnavailable",exitCode:1,retryable:!0,telemetryDetails:o}):e.status===503&&e.code==="AuthorizationCheckFailed"?new V("Authorization service is temporarily unavailable. Try again.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"AuthorizationServiceUnavailable",exitCode:1,retryable:!0,telemetryDetails:o}):null}async function Ye(e){let{provider:t,appName:o,force:a,forceReauth:n,waitForDeployment:r,onDeployProgress:d}=e,i=e.commitFromFlag,c,u=!1;if(!i){let l=de();if(!l)throw new s("Could not determine the latest commit ID. Use --commit or -c to specify it.");i=l.commitSha,c=l.detached?void 0:l.branch,u=!0}if(u&&!t.isJsonMode()&&m(c?`Using branch '${c}' at commit ${i}.`:`Detached HEAD at commit ${i}.`),!a){let l=ue();if(l&&M().interactive&&!t.isJsonMode()){if(F(l),!await q({message:"Deploy anyway?",initialValue:!1}))return m("Deploy cancelled."),null}else if(l)throw new s(`${l} Run again with --force to deploy anyway.`)}let w=U(),p=await re({logger:w,actionsParams:{appName:o,commitSha:i,...n&&{forceReauth:!0}}});if(p===null)t.isJsonMode()||m(`A cached build exists for commit ${i}; `+(r?"deploying it.":"submitting its deployment."));else{t.isJsonMode()||m("Build queued; waiting for completion...");let l=await ye({appName:o,commitSha:i,initialWaitMs:p.retryAfterMs??Je,isJsonMode:t.isJsonMode(),deadlineMs:_e,maxIntervalMs:Ge,spinnerLabel:"Waiting for build..."});if(l.status!=="Succeeded")throw new D(`Unexpected terminal build status "${l.status}". Commit ID: ${i}.`)}let h={appName:o,commitSha:i,...e.targetName!==void 0&&{deploymentName:e.targetName},...n&&{forceReauth:!0}};if(!r){let l=await pe({logger:w,actionsParams:h});return{kind:"submitted",value:Q(l)}}let A=e.useManagedDevOpsDeployment?ee(d):void 0,k;try{k=await se({logger:w,actionsParams:h,onProgress:A?.onProgress??d,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(l){let b=A?.getHandoff();if(!b)throw l;return{kind:"awaitingApproval",value:{deploymentId:b.deploymentId,appName:o,commitHash:i}}}let S=A?.getHandoff();return S?{kind:"awaitingApproval",value:{deploymentId:S.deploymentId,appName:o,commitHash:i}}:{kind:"deployed",value:We(k)}}function Ze(e){let t=be(e,"manifest.json");if(t===void 0)return;let o;try{o=JSON.parse(t)}catch{return}let a=o?.backends?.default?.kind;if(!(typeof a!="string"||a.toLowerCase()!=="rayfin")&&!z("rayfin"))throw new s(`This artifact packages a Rayfin backend (manifest.json "backends.default.kind": "rayfin"), but the rayfin CLI feature is not enabled in this environment. Enable it (${me("rayfin")}=1 or \`ms feature enable rayfin\`) before deploying a pre-built Rayfin artifact, or rebuild the artifact without a Rayfin backend.`)}async function ze(e){let t=L.resolve(e.artifactPath);if(L.extname(t).toLowerCase()!==".zip")throw new s(`--artifact must point to a .zip file. Received: ${e.artifactPath}`);let o=await Ke(t);if(!o||!o.isFile())throw new s(`--artifact file not found or not a regular file: ${e.artifactPath}`);if(o.size>524288e3)throw new s(X(o.size,524288e3));let a=await Pe.readFile(t);Ze(a),e.provider.isJsonMode()||m(e.waitForDeployment?"Uploading artifact and deploying...":"Uploading artifact and submitting deployment...");let n={logger:U(),actionsParams:{appName:e.appName,zipBuffer:a,...e.targetName!==void 0&&{deploymentName:e.targetName}}};if(!e.waitForDeployment){let{commitSha:c,submission:u}=await j(n);return{kind:"submitted",value:Q(u,c)}}let r=ee(e.onDeployProgress),d;try{d=await W({...n,onProgress:r.onProgress,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(c){let u=r.getHandoff();if(!u?.commitHash)throw c;return{kind:"awaitingApproval",value:{deploymentId:u.deploymentId,appName:e.appName,commitHash:u.commitHash}}}let i=r.getHandoff();return i?{kind:"awaitingApproval",value:{deploymentId:i.deploymentId,appName:e.appName,commitHash:d.commitSha}}:{kind:"deployed",value:Ne(d)}}async function Ke(e){try{return await Pe.stat(e)}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return null;throw t}}async function Xe(e){if(he(e.appConfig),!(e.provider.isJsonMode()||!M().interactive)){let c=e.appConfig.buildType==="none"?"package the prebuilt app assets and deploy the resulting artifact":"build the app and deploy the resulting artifact";if(!await q({message:`This will ${c} to environment ${e.environmentId}. Continue?`,initialValue:!1}))return m("Aborted."),null}let{packAppOutputDir:o}=await ve({quiet:e.provider.isJsonMode()}),a=await ke(o,e.appConfigPath,{maxBytes:524288e3});e.provider.isJsonMode()||m(e.waitForDeployment?"Uploading build artifact and deploying...":"Uploading build artifact and submitting deployment...");let n={logger:U(),actionsParams:{appName:e.appName,zipBuffer:a,...e.targetName!==void 0&&{deploymentName:e.targetName}}};if(!e.waitForDeployment){let{commitSha:c,submission:u}=await j(n);return{kind:"submitted",value:Q(u,c)}}let r=ee(e.onDeployProgress),d;try{d=await W({...n,onProgress:r.onProgress,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(c){let u=r.getHandoff();if(!u?.commitHash)throw c;return{kind:"awaitingApproval",value:{deploymentId:u.deploymentId,appName:e.appName,commitHash:u.commitHash}}}let i=r.getHandoff();return i?{kind:"awaitingApproval",value:{deploymentId:i.deploymentId,appName:e.appName,commitHash:d.commitSha}}:{kind:"deployed",value:Ne(d)}}async function $t(e){await Qe(e,!1,et)}async function Qe(e,t,o){it(e,t),await e.runVerb();let a=t||e.isManagedDevOpsDeploymentEnabled(),n=await e.getOption(f.NoWait.camelName,!0)!==!1;if(!n&&!a)throw new s(Ve);let r=await e.getOption("commit",!0),d=t?void 0:await e.getOption("artifact",!0);if(r&&d)throw new s("Pass either --commit or --artifact, not both. --commit triggers a build for the commit; --artifact deploys a pre-built zip.");let i=await o(e),{appName:c,tenantId:u,environmentId:w,repoType:p,externalRepoUrl:h,appConfig:A,appConfigPath:k,interactive:S}=i,l=(await e.getOption(f.Target.name,!0))?.trim();if(l!==void 0&&ge(l,`--${f.Target.name}`),p==="none"&&r)throw new s("This app uses external artifact deployment. Pass --artifact <path> instead of --commit.");if(d&&p!=="none")throw new s(`--artifact is only valid for apps created with \`repoType: 'none'\`. This app's repoType is \`${p}\`; deploy via \`--commit\` (or omit it to use the current HEAD).`);let b=r&&p!=="none"?ce(r,!0):r,Re=await e.getOption(f.OpenBrowser.camelName,!0)??!1,Fe=await e.getOption(f.ForceReauth.camelName,!0)??!1,xe=await e.getOption(f.Force.name,!0)??!1,E=e.isJsonMode(),te=S&&process.stdout.isTTY===!0,_=a&&!E&&n?nt(te):void 0,G=_?.onProgress,x=n?ot({print:!E,animate:te}):void 0,J=x?.onProgress;E&&p==="github"&&oe({phase:"deploy-validation"});let y;try{if(d)y=await ze({provider:e,appName:c,artifactPath:d,waitForDeployment:n,targetName:l,onDeployProgress:G,onAppFrameworkProgress:J});else if(p==="native"||p==="github")y=await fe(async({isRetry:T})=>{try{return await Ye({provider:e,appName:c,commitFromFlag:b,force:xe,forceReauth:Fe&&!T&&p==="github",waitForDeployment:n,targetName:l,useManagedDevOpsDeployment:a,onDeployProgress:G,onAppFrameworkProgress:J})}catch(Te){throw _?.stop(),x?.stop(),Te}},{repoType:p,externalRepoUrl:h,tenantId:u,jsonMode:E,openBrowser:Re,verb:t?"project deploy":"app deploy"});else{if(!A||!k)throw new s("`ms project deploy` currently supports only git-backed managed projects.");y=await Xe({provider:e,appName:c,appConfig:A,appConfigPath:k,environmentId:w,waitForDeployment:n,targetName:l,onDeployProgress:G,onAppFrameworkProgress:J})}}catch(R){let T=qe(R,{repoType:p,appName:c,environmentId:w});throw T||R}finally{_?.stop(),x?.stop()}if(y===null)return;if(y.kind==="submitted"){E?$({status:"submitted",deploymentId:y.value.deploymentId,appName:y.value.appName,commitHash:y.value.commitHash,repoType:p}):(B(`Deployment submitted for app '${y.value.appName}'.`),m(`Deployment ID: ${y.value.deploymentId}`),m(`Commit: ${y.value.commitHash}`));return}if(y.kind==="awaitingApproval"){E?$({status:"awaitingApproval",deploymentId:y.value.deploymentId,appName:y.value.appName,commitHash:y.value.commitHash,repoType:p}):(B(`Deployment is awaiting approval for app '${y.value.appName}'.`),m(`Deployment ID: ${y.value.deploymentId}`),m(`Commit: ${y.value.commitHash}`));return}let v=tt(y.value,x?.getCompletion());if(l&&v.appPlayUri&&(v.appPlayUri=Ae(v.appPlayUri,"live",void 0,"main",l)??v.appPlayUri),E)$({...v,repoType:p});else{B(`Deployed app '${v.displayName}' (${v.appId}).`),v.commitHash&&m(`Commit: ${v.commitHash}`),v.appPlayUri&&m(`Play URL: ${v.appPlayUri}`),v.operationId&&m(`Operation: ${v.operationId}`);for(let R of v.warnings??[])F(R)}}async function et(e){let{appConfig:t,fileConfig:o,interactive:a}=M();if(!t)throw new I(`${C} is required. Run this command from a directory created by \`ms app create\`.`);if(!o?.appConfigPath)throw new I(`${C} path is unavailable.`);we(t,d=>new s(d));let n=e.getEnvironmentId();if(!n)throw new s(`No environment ID found. Run this command from a directory with a ${C} (created by \`ms app create\`).`);let r=await e.getTenantIdAsync();if(!r)throw new s("Unable to determine tenant ID. Ensure you are logged in.");return{appName:await le(e),tenantId:r,environmentId:n,repoType:t.repoType??"native",externalRepoUrl:t.externalRepoUrl,appConfig:t,appConfigPath:o.appConfigPath,interactive:a}}function tt(e,t){return t?{...e,commitHash:t.commitHash,operationId:t.operationId,...t.warnings.length>0&&{warnings:t.warnings}}:e}function ot(e){let t,o=!1,a,n=()=>{o&&(t?.stop(),o=!1)},r=()=>{e.animate&&(t??=new Y,t.start("Waiting for deployment..."),o=!0)},d=i=>i==="Pending"||i==="Running"||i==="Recovering";return{onProgress:i=>{switch(i.type){case"accepted":if(a=void 0,!e.print||!d(i.operationStatus))return;n(),m(`Deployment accepted. The service is migrating app data; commit ${i.commitHash} goes live when the migration finishes.`),m(`Operation: ${i.operationId}`),r();return;case"status":if(!e.print)return;n(),m(`Deployment status: ${i.operationStatus}`),d(i.operationStatus)&&r();return;case"completed":n(),a=i;return}},getCompletion:()=>a,stop:n}}function nt(e){let t,o=!1,a,n=()=>{o&&(t?.stop(),o=!1)},r=()=>{e&&(t??=new Y,t.start("Waiting for deployment..."),o=!0)};return{onProgress:i=>{let c=at(i);if(c!==a)switch(a=c,i.type){case"submitting":n(),m("Submitting deployment...");break;case"submitted":n(),m(`Deployment ID: ${i.deploymentId}`),r();break;case"status":switch(n(),m(`Deployment status: ${i.deploymentStatus}`),i.deploymentStatus){case"Pending":case"AwaitingApproval":case"ValidatingAssets":case"ValidationCompleted":case"Running":case"RollingBack":r();break}break}},stop:()=>{n(),a=void 0}}}function at(e){switch(e.type){case"submitting":return e.type;case"submitted":return`${e.type}:${e.deploymentId}`;case"status":return`${e.type}:${e.deploymentId}:${e.deploymentStatus}`}}function it(e,t){let o=z("alm"),a=t?g.project.deploy:g.app.deploy;e.setDescription(a.description),e.addExamples(t?g.project.deploy.examples:o?g.app.deploy.examples:g.app.deploy.examples.filter(n=>!n.includes(" --target "))),e.addOptions([...t?[{flags:{key:P.ProjectId.name,alias:P.ProjectId.alias},description:g.project.deploy.options.projectId,optionalInNonInteractive:!0},{flags:{key:P.EnvironmentId.name,alias:P.EnvironmentId.alias},env:P.EnvironmentId.envVar,description:g.project.deploy.options.environmentId,optionalInNonInteractive:!0}]:[{flags:{key:f.AppName.name},env:f.AppName.envVar,description:g.app.deploy.options.app,optionalInNonInteractive:!0}],{flags:{key:f.CommitSha.name,alias:f.CommitSha.alias},env:f.CommitSha.envVar,description:g.app.deploy.options.commit,optionalInNonInteractive:!0},...t?[]:[{flags:{key:f.Artifact.name},env:f.Artifact.envVar,description:g.app.deploy.options.artifact,optionalInNonInteractive:!0}],...t||o?[{flags:{key:f.Target.name},env:f.Target.envVar,description:g.app.deploy.options.target,optionalInNonInteractive:!0}]:[]]),e.addSwitch({flags:{key:f.OpenBrowser.name},description:g.app.deploy.options.openBrowser}),e.addSwitch({flags:{key:f.Force.name},description:g.app.deploy.options.force}),e.addSwitch({flags:{key:f.NoWait.name},description:t?g.project.deploy.options.noWait:g.app.deploy.options.noWait}),e.addSwitch({flags:{key:f.ForceReauth.name},description:g.app.deploy.options.forceReauth})}export{$t as a,Qe as b};
|
|
10
|
+
/*!
|
|
11
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
//# sourceMappingURL=chunk-A4PVXTJS.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{Ob as d,a as S,h as C,i as w,rb as A,sb as c,tb as b,wb as x,x as u,xb as O}from"./chunk-4XKA5APP.js";import{b as i}from"./chunk-4U53RYJJ.js";import v from"node:path";var k=new Map([["'state.schemaPath' and 'data.schemaPath' must have exactly the same value when both are configured.","state.schemaPath and data.schemaPath must match exactly when both are configured."],["'state.schemaPath' and legacy 'db.schemaPath' must have exactly the same value when both are configured.","state.schemaPath and db.schemaPath must match exactly when both are configured."],["'data.schemaPath' and legacy 'db.schemaPath' must have exactly the same value.","data.schemaPath and db.schemaPath must match exactly when both are configured."],["No state schema is configured. Set 'state.schemaPath' in ms.config.json.","Configure state.schemaPath in ms.config.json before using the 'ms project state' commands."]]),R="state/schema.json",p=["state","data","db"];function H(){let{appConfig:e,fileConfig:n}=d();return g(n.appConfigPath,e??{})}async function z(){let{appConfig:e,cliFs:n,fileConfig:t}=d();if(e===void 0)return{actionOptions:g(t.appConfigPath,{}),commitConfigAsync:async()=>{}};let a=await C(t.appConfigPath),r=E(a),f=!1;if(r===void 0){let s=N(a);for(let m of new Set(["state",...s]))a[m]={...a[m]??{},schemaPath:R};f=!0,r=o(()=>c(a))}if(!V(a)){let s=L(r.schemaConfigPath);a[s]={...a[s]??{},enabled:!0},f=!0}let P=g(t.appConfigPath,a),y=await F(P,n);return{actionOptions:P,commitConfigAsync:async()=>{if(f)try{await w(t.appConfigPath,a)}catch(s){try{await D(y,n)}catch(m){throw new AggregateError([s,m],`Failed to update app configuration and roll back schema '${y.schemaPath}'.`)}throw s}}}}function o(e){try{return e()}catch(n){throw j(n)}}async function G(e){try{return await e()}catch(n){throw j(n)}}function g(e,n){let t=v.dirname(v.resolve(e)),{configuredPath:a,schemaConfigPath:r}=o(()=>c(n));return{appRoot:t,configuredPath:a,configuredPathLabel:r}}async function F(e,n){let t=o(()=>b(e));return await n.exists(t)?{schemaPath:t,existed:!0,contents:await n.readFile(t,"utf-8")}:{schemaPath:t,existed:!1}}async function D(e,n){if(e.existed){await n.writeFile(e.schemaPath,e.contents??"",{encoding:"utf-8"});return}await n.exists(e.schemaPath)&&await n.unlink(e.schemaPath)}function E(e){if($(e))return o(()=>c(e))}function $(e){return p.some(n=>{let t=e[n];return t===void 0?!1:(l(t)||o(()=>c(e)),Object.prototype.hasOwnProperty.call(t,"schemaPath")&&typeof t.schemaPath!="string"&&o(()=>c(e)),typeof t.schemaPath=="string")})}function N(e){return p.filter(n=>{let t=e[n];return t===void 0?!1:(l(t)||o(()=>c(e)),!0)})}function V(e){return p.some(n=>{let t=e[n];return l(t)&&t.enabled!==void 0})}function L(e){return e.slice(0,e.indexOf("."))}function l(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function j(e){if(A(e))return new u(e.message,{code:e.code,jsonPath:e.jsonPath});if(S(e)){let n=e.code==="CodegenConfigInvalid"?k.get(e.message)??e.message:e.message,t=e.recoveryPaths?.length?`
|
|
8
|
+
Recovery paths:
|
|
9
|
+
${e.recoveryPaths.map(a=>` ${a}`).join(`
|
|
10
|
+
`)}`:"";return new u(`${n}${t}`,{code:e.code,jsonPath:e.jsonPath,recoveryPaths:e.recoveryPaths})}return e}function h(e,n){if(n!==void 0){if(n==="true")return!0;if(n==="false")return!1;throw new u(`--${e} must be 'true' or 'false', but was '${n}'.`)}}function I(e,n){if(n===void 0)return;if(n==="")return null;let t=Number(n);if(!Number.isInteger(t)||t<0)throw new u(`--${e} must be a non-negative whole number, but was '${n}'.`);return t}function T(e){if(e===void 0)return;if(e==="")return null;let n=Number(e);return e.trim().length>0&&Number.isFinite(n)?n:e}async function J(e){let n=async r=>await e.getOption(r,!0),t=await n("format"),a=await n("kind");return{required:h("required",await n("required")),index:h("index",await n("index")),ignoreCase:h("index-ignore-case",await n("indexIgnoreCase")),ignoreAccents:h("index-ignore-accents",await n("indexIgnoreAccents")),maxLength:I("max-length",await n("maxLength")),minLength:I("min-length",await n("minLength")),maxValue:T(await n("maxValue")),minValue:T(await n("minValue")),format:t===void 0?void 0:t===""?null:o(()=>x(t)),kind:a===void 0?void 0:a===""?null:o(()=>O(a))}}function Q(e,n){return n!==void 0?!0:Object.values(e).some(t=>t!==void 0)}function W(e){return[i.Required.name,i.Index.name,i.IndexIgnoreCase.name,i.IndexIgnoreAccents.name,i.MaxLength.name,i.MinLength.name,i.MaxValue.name,i.MinValue.name,i.Format.name,i.Kind.name].map(t=>({flags:{key:t},description:e[t],optionalInNonInteractive:!0}))}export{H as a,z as b,o as c,G as d,h as e,J as f,Q as g,W as h};
|
|
11
|
+
/*!
|
|
12
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=chunk-ADRQC63G.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import*as n from"fs";import*as e from"path";var i=["bun","pnpm","yarn","npm"];function p(a,s){let t=s?.packageManager?.split("@")[0];return t&&i.includes(t)?t:n.existsSync(e.join(a,"bun.lockb"))||n.existsSync(e.join(a,"bun.lock"))?"bun":n.existsSync(e.join(a,"pnpm-lock.yaml"))?"pnpm":n.existsSync(e.join(a,"yarn.lock"))?"yarn":"npm"}import*as r from"fs";import*as c from"path";function g(a){let s=c.join(a,"package.json");return r.existsSync(s)?JSON.parse(r.readFileSync(s,"utf8")):{}}export{p as a,g as b};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-ATUGCFVC.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as w}from"./chunk-TYRVM4PP.js";import{b as y}from"./chunk-2LKCCYRF.js";import{A as m,k as c,x as l,y as f}from"./chunk-4XKA5APP.js";import{a as t}from"./chunk-FHE3OXIP.js";import{K as p,m as g}from"./chunk-KKC5ZK4D.js";import{d as T}from"./chunk-UT667QSU.js";function I(e){if(e.body)try{let n=JSON.parse(e.body);if(typeof n?.error?.message=="string"&&n.error.message.trim())return n.error.message}catch{}}var h=new Set(["NetworkConnectionRefused","NetworkConnectionReset","NetworkConnectionTimedOut","NetworkDnsResolutionFailed","ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ETIMEDOUT","ECONNRESET","ConnectionRefused","ConnectionClosed","FailedToOpenSocket"]);function A(e){if(!(e instanceof Error)||e instanceof c)return!1;let n=e.code;return typeof n=="string"&&h.has(n)||h.has(e.name)}function x(e,n){let{environmentId:i}=n;if(A(e))return new m(`Could not reach environment ${i}. Its endpoint did not resolve or did not respond, which usually means the environment id is wrong or the environment does not exist in this cloud \u2014 verify the id and the --cloud value. If the id is correct, check your network connection, VPN, or proxy.`,{underlyingError:e.message,environmentId:i},{errorCode:"EnvironmentUnreachable",retryable:!0});if(!(e instanceof c))return null;let o=I(e),s=n.repoType==="native",r="Ask an admin to grant you the required permission in this environment.";if(e.status===401)return new f(o??"Your sign-in session has expired or is invalid. Run `ms auth login` and try again.",void 0,{errorCode:"AuthenticationRequired"});if(e.status===403){let a=o??(s?`You do not have permission to create repositories in environment ${i}.`:`You do not have permission to create an app in environment ${i}.`);return new f(`${a} ${r}`,void 0,{errorCode:"EnvironmentPermissionDenied",telemetryDetails:y("environment_permission",{httpStatus:e.status})})}return e.status===404?new l(o??`Environment ${i} was not found. Verify the environment id and that you have access to it.`,{environmentId:i},{errorCode:"EnvironmentNotFound"}):e.status===409?new l(o??`An app with the same name already exists in environment ${i}. Choose a different name.`,{environmentId:i},{errorCode:"AppAlreadyExists"}):e.status===429||e.status===503?new m(o??"The service is temporarily unavailable or rate-limited. Wait a moment and try again.",{httpStatus:e.status},{errorCode:"ServiceUnavailable",retryable:!0,telemetryDetails:{httpStatus:e.status}}):null}function S(e){let n=e.buildType?.trim().toLowerCase()||void 0;if(n!==void 0&&n!=="build"&&n!=="none")throw new l("'--build-type' must be one of: build, none.");let i=n;return{...i!==void 0&&{buildType:i},buildPath:e.buildPath??(i==="none"?"./artifacts":"./dist"),...i!=="none"&&{buildCommand:e.buildCommand??"npm run build"},buildEntryPoint:e.buildEntryPoint??"index.html"}}function V(e){let n=S(e),i={version:g,appId:e.appId,appDisplayName:e.appDisplayName,environmentId:e.environmentId,description:e.description,repoType:e.repoType,cloud:e.cloud,buildPath:n.buildPath};return n.buildCommand!==void 0&&(i.buildCommand=n.buildCommand),i.buildEntryPoint=n.buildEntryPoint,n.buildType!==void 0&&(i.buildType=n.buildType),e.repositoryId&&(i.repositoryId=e.repositoryId),e.externalRepoUrl&&(i.externalRepoUrl=e.externalRepoUrl),e.iconPath&&(i.iconPath=e.iconPath),e.localAppUrl&&(i.localAppUrl=e.localAppUrl),e.connectionReferences!==void 0&&(i.connectionReferences=e.connectionReferences),e.appSettings!==void 0&&(i.appSettings=e.appSettings),i}import*as d from"fs";import*as v from"path";var u=T(w(),1);var P="https://registry.npmjs.org",N=5e3;async function C(e,n=t.version){if(!u.default.valid(n))return;if(u.default.prerelease(n)===null)return n;let i=await $(e);return i?`^${i}`:void 0}async function $(e){try{let{data:n}=await e.get(`${P}/${t.name}/latest`,{headers:{"user-agent":`${t.name}/${t.version}`},signal:AbortSignal.timeout(N)});return typeof n?.version=="string"&&u.default.valid(n.version)?n.version:void 0}catch{return}}async function Y(e,n,i){let o=v.join(e,"package.json");if(!d.existsSync(o))return;let s=await C(i);if(!s){n||p(`Skipping the project-local CLI pin: '${t.version}' is not a published release and no published version could be resolved. Install '${t.name}' into the project manually if you want a project-local CLI.`);return}!n&&s!==t.version&&p(`'${t.version}' is a prerelease build; pinning the latest published CLI ('${s}') into the app instead.`);try{let r=JSON.parse(d.readFileSync(o,"utf8")),a="@microsoft/managed-apps-cli",b=r.dependencies?.[a]!==void 0||r.devDependencies?.[a]!==void 0;delete r.dependencies?.[a],delete r.devDependencies?.[a],r.devDependencies=Object.fromEntries(Object.entries({...r.devDependencies,[t.name]:s}).sort(([E],[R])=>E.localeCompare(R,"en"))),d.writeFileSync(o,`${JSON.stringify(r,null,2)}
|
|
8
|
+
`),b&&!n&&p(`Replaced '${a}' with '${t.name}' because both provide 'ms'. Migrate SDK dependencies, imports, generated sources, and Vite configuration together.`)}catch(r){n||p(`Could not pin '${t.name}' into ${o} (${r instanceof Error?r.message:String(r)}). Add "${t.name}": "${s}" to devDependencies manually.`)}}export{x as a,S as b,V as c,Y as d};
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=chunk-BA52TY55.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{m as z}from"./chunk-2LDU3F6O.js";import{a as D}from"./chunk-FHE3OXIP.js";import{a as l}from"./chunk-HOIFXUTG.js";import{a as H,b as x,d as xe}from"./chunk-UT667QSU.js";var v=x(M=>{var S=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},P=class extends S{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};M.CommanderError=S;M.InvalidArgumentError=P});var F=x(L=>{var{InvalidArgumentError:we}=v(),q=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new we(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Oe(a){let e=a.name()+(a.variadic===!0?"...":"");return a.required?"<"+e+">":"["+e+"]"}L.Argument=q;L.humanReadableArgName=Oe});var W=x(se=>{var{humanReadableArgName:He}=F(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden);if(e._hasImplicitHelpCommand()){let[,n,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),r=e.createCommand(n).helpOption(!1);r.description(e._helpCommandDescription),i&&r.arguments(i),t.push(r)}return this.sortSubcommands&&t.sort((n,i)=>n.name().localeCompare(i.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(r=>!r.hidden),n=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(n||i){let r;n?i?r=e.createOption(e._helpFlags,e._helpDescription):r=e.createOption(e._helpShortFlag,e._helpDescription):r=e.createOption(e._helpLongFlag,e._helpDescription),t.push(r)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(t=>t.description)?e._args:[]}subcommandTerm(e){let t=e._args.map(n=>He(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth||80,r=2,s=2;function p(m,b){if(b){let j=`${m.padEnd(n+s)}${b}`;return t.wrap(j,i-r,n+s)}return m}function o(m){return m.join(`
|
|
8
|
+
`).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,i,0),""]));let h=t.visibleArguments(e).map(m=>p(t.argumentTerm(m),t.argumentDescription(m)));h.length>0&&(c=c.concat(["Arguments:",o(h),""]));let f=t.visibleOptions(e).map(m=>p(t.optionTerm(m),t.optionDescription(m)));if(f.length>0&&(c=c.concat(["Options:",o(f),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(b=>p(t.optionTerm(b),t.optionDescription(b)));m.length>0&&(c=c.concat(["Global Options:",o(m),""]))}let C=t.visibleCommands(e).map(m=>p(t.subcommandTerm(m),t.subcommandDescription(m)));return C.length>0&&(c=c.concat(["Commands:",o(C),""])),c.join(`
|
|
9
|
+
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",s=new RegExp(`[\\n][${r}]+`);if(e.match(s))return e;let p=t-n;if(p<i)return e;let o=e.slice(0,n),c=e.slice(n).replace(`\r
|
|
10
|
+
`,`
|
|
11
|
+
`),u=" ".repeat(n),f="\\s\u200B",C=new RegExp(`
|
|
12
|
+
|.{1,${p-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),m=c.match(C)||[];return o+m.map((b,j)=>b===`
|
|
13
|
+
`?"":(j>0?u:"")+b.trimEnd()).join(`
|
|
14
|
+
`)}};se.Help=I});var G=x(k=>{var{InvalidArgumentError:Te}=v(),R=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ae(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Te(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ve(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},U=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function ve(a){return a.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ae(a){let e,t,n=a.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(e=n.shift()),t=n.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}k.Option=R;k.splitOptionFlags=ae;k.DualOptions=U});var le=x(oe=>{function Ee(a,e){if(Math.abs(a.length-e.length)>3)return Math.max(a.length,e.length);let t=[];for(let n=0;n<=a.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=a.length;i++){let r=1;a[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&a[i-1]===e[n-2]&&a[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[a.length][e.length]}function De(a,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=a.startsWith("--");t&&(a=a.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,r=.4;return e.forEach(s=>{if(s.length<=1)return;let p=Ee(a,s),o=Math.max(a.length,s.length);(o-p)/o>r&&(p<i?(i=p,n=[s]):p===i&&n.push(s))}),n.sort((s,p)=>s.localeCompare(p)),t&&(n=n.map(s=>`--${s}`)),n.length>1?`
|
|
15
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
16
|
+
(Did you mean ${n[0]}?)`:""}oe.suggestSimilar=De});var me=x(de=>{var Ve=H("events").EventEmitter,B=H("child_process"),_=H("path"),K=H("fs"),d=H("process"),{Argument:$e,humanReadableArgName:Se}=F(),{CommanderError:J}=v(),{Help:Fe}=W(),{Option:pe,splitOptionFlags:ke,DualOptions:je}=G(),{suggestSimilar:ce}=le(),Y=class a extends Ve{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>d.stdout.write(t),writeErr:t=>d.stderr.write(t),getOutHelpWidth:()=>d.stdout.isTTY?d.stdout.columns:void 0,getErrHelpWidth:()=>d.stderr.isTTY?d.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,s,p]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(s);return i&&(o.description(i),o._executableHandler=!0),r.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(r.noHelp||r.hidden),o._executableFile=r.executableFile||null,p&&o.arguments(p),this.commands.push(o),o.parent=this,o.copyInheritedSettings(this),i?this:o}createCommand(e){return new a(e)}createHelp(){return Object.assign(new Fe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
17
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new $e(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return e===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof e=="string"&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
18
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new J(e,t,n)),d.exit(e)}action(e){let t=n=>{let i=this._args.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new pe(e,t)}addOption(e){let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");this.options.push(e);let i=(r,s,p)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let o=this.getOptionValue(n);if(r!==null&&e.parseArg)try{r=e.parseArg(r,o)}catch(c){if(c.code==="commander.invalidArgument"){let u=`${s} ${c.message}`;this.error(u,{exitCode:c.exitCode,code:c.code})}throw c}else r!==null&&e.variadic&&(r=e._concatValue(r,o));r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,p)};return this.on("option:"+t,r=>{let s=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,s,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let s=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,s,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof pe)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(r).argParser(i);else if(i instanceof RegExp){let p=i;i=(o,c)=>{let u=p.exec(o);return u?u[0]:c},s.default(r).argParser(i)}else s.default(i);return this.addOption(s)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return E(this).forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=d.argv,d.versions&&d.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":d.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,h){let f=_.resolve(u,h);if(K.existsSync(f))return f;if(i.includes(_.extname(h)))return;let C=i.find(m=>K.existsSync(`${f}${m}`));if(C)return`${f}${C}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let u;try{u=K.realpathSync(this._scriptPath)}catch{u=this._scriptPath}p=_.resolve(_.dirname(u),p)}if(p){let u=r(p,s);if(!u&&!e._executableFile&&this._scriptPath){let h=_.basename(this._scriptPath,_.extname(this._scriptPath));h!==this._name&&(u=r(p,`${h}-${e._name}`))}s=u||s}n=i.includes(_.extname(s));let o;d.platform!=="win32"?n?(t.unshift(s),t=he(d.execArgv).concat(t),o=B.spawn(d.argv[0],t,{stdio:"inherit"})):o=B.spawn(s,t,{stdio:"inherit"}):(t.unshift(s),t=he(d.execArgv).concat(t),o=B.spawn(d.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{d.on(h,()=>{o.killed===!1&&o.exitCode===null&&o.kill(h)})});let c=this._exitCallback;c?o.on("close",()=>{c(new J(d.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):o.on("close",d.exit.bind(d)),o.on("error",u=>{if(u.code==="ENOENT"){let h=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${s}' does not exist
|
|
19
|
+
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
+
- ${h}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!c)d.exit(1);else{let h=new J(1,"commander.executeSubCommandAsync","(error)");h.nestedError=u,c(h)}}),this.runningCommand=o}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_checkNumberOfArguments(){this._args.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let s=i;if(i!==null&&n.parseArg)try{s=n.parseArg(i,r)}catch(p){if(p.code==="commander.invalidArgument"){let o=`error: command-argument value '${i}' is invalid for argument '${n.name()}'. ${p.message}`;this.error(o,{exitCode:p.exitCode,code:p.code})}throw p}return s};this._checkNumberOfArguments();let t=[];this._args.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((s,p)=>e(n,p,s),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return E(this).reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(s=>{i.push({hookedCommand:r,callback:s})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return e.length===1&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return ue(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),ue(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(r,e,t)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function s(o){return o.length>1&&o[0]==="-"}let p=null;for(;r.length;){let o=r.shift();if(o==="--"){i===n&&i.push(o),i.push(...r);break}if(p&&!s(o)){this.emit(`option:${p.name()}`,o);continue}if(p=null,s(o)){let c=this._findOption(o);if(c){if(c.required){let u=r.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;r.length>0&&!s(r[0])&&(u=r.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);p=c.variadic?c:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let c=this._findOption(`-${o[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,o.slice(2)):(this.emit(`option:${c.name()}`),r.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let c=o.indexOf("="),u=this._findOption(o.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,o.slice(c+1));continue}}if(s(o)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(o)){t.push(o),r.length>0&&n.push(...r);break}else if(o===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(o),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(o),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(o),r.length>0&&i.push(...r);break}i.push(o)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return E(this).reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
22
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in d.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,d.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new je(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=s=>{let p=s.attributeName(),o=this.getOptionValue(p),c=this.options.find(h=>h.negate&&p===h.attributeName()),u=this.options.find(h=>!h.negate&&p===h.attributeName());return c&&(c.presetArg===void 0&&o===!1||c.presetArg!==void 0&&o===c.presetArg)?c:u||s},i=s=>{let p=n(s),o=p.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${p.envVar}'`:`option '${p.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let s=r.createHelp().visibleOptions(r).filter(p=>p.long).map(p=>p.long);i=i.concat(s),r=r.parent}while(r&&!r._enablePositionalOptions);t=ce(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this._args.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=ce(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
25
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this._args.map(n=>Se(n));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=_.basename(e,_.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;return t.error?n=i=>this._outputConfiguration.writeErr(i):n=i=>this._outputConfiguration.writeOut(i),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getHelpContext(e);E(this).reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation(n);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this.emit(this._helpLongFlag),this.emit("afterHelp",n),E(this).forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let n=ke(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(e){this.outputHelp(e);let t=d.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let s;typeof t=="function"?s=t({error:r.error,command:r.command}):s=t,s&&r.write(`${s}
|
|
27
|
+
`)}),this}};function ue(a,e){a._hasHelpOption&&e.find(n=>n===a._helpLongFlag||n===a._helpShortFlag)&&(a.outputHelp(),a._exit(0,"commander.helpDisplayed","(outputHelp)"))}function he(a){return a.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function E(a){let e=[];for(let t=a;t;t=t.parent)e.push(t);return e}de.Command=Y});var _e=x((g,ye)=>{var{Argument:ze}=F(),{Command:fe}=me(),{CommanderError:Ne,InvalidArgumentError:ge}=v(),{Help:Pe}=W(),{Option:Me}=G();g=ye.exports=new fe;g.program=g;g.Argument=ze;g.Command=fe;g.CommanderError=Ne;g.Help=Pe;g.InvalidArgumentError=ge;g.InvalidOptionArgumentError=ge;g.Option=Me});function te(a){return a.requiresFeature===void 0||z(a.requiresFeature)}function A(a){return a.typed===!0}function V(a){return typeof a.lazyHandler=="function"}function w(a,e){if(!Object.prototype.hasOwnProperty.call(a,e))return;let t=a[e];return te(t)?t:void 0}function $(a){return Object.entries(a).filter(([,e])=>te(e))}function N(a){return a.requiresFeature!==void 0&&!z(a.requiresFeature)?!1:$(a.commands).length>0}function ne(a){return Object.entries(a).filter(([,e])=>N(e))}function We(a,e){let t=a.slice(2);if(t.length===0||t[0].startsWith("-"))return null;let[n]=t;return T(n,e)?ie(e[n].commands,t,1,[n]):null}function ie(a,e,t,n){if(t>=e.length)return null;let i=e[t];if(i.startsWith("-"))return null;let r=w(a,i);if(!r)return null;let s=[...n,i];if(!A(r))return{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1,...r.localOnly?{localOnly:r.localOnly}:{}};let p=e[t+1];return p!==void 0&&!p.startsWith("-")&&w(r.commands,p)!==void 0?ie(r.commands,e,t+1,s):V(r)?{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1}:null}function Re(a,e){let t=a.slice(2),n=t.findIndex(u=>u.startsWith("-")),i=n===-1?t:t.slice(0,n);if(i.length<2)return null;let[r,...s]=i;if(!T(r,e))return null;let p=e[r].commands,o=[r],c=!1;for(let u of s){let h=w(p,u);if(!h)return c?{pathTokens:o,unknownToken:u}:null;if(!A(h))return null;o.push(u),p=h.commands,c=!0}return c?{pathTokens:o,unknownToken:void 0}:null}function T(a,e){return Object.prototype.hasOwnProperty.call(e,a)?N(e[a]):!1}var O={auth:{"@description":"Manage authentication state.",commands:{login:{"@helpText":l.auth.login.description,lazyHandler:async()=>(await import("./Login-BT6UTPCZ.js")).loginAsync},logout:{"@helpText":l.auth.logout.description,lazyHandler:async()=>(await import("./Logout-FBJE35Q5.js")).logoutAsync},status:{"@helpText":l.auth.status.description,lazyHandler:async()=>(await import("./AuthStatus-WCZYGI5G.js")).authStatusAsync},switch:{"@helpText":l.auth.switch.description,lazyHandler:async()=>(await import("./AuthSwitch-XJMG7IUR.js")).authSwitchAsync}}},app:{"@description":"Manage apps and their resources.",commands:{clone:{"@helpText":l.app.clone.description,lazyHandler:async()=>(await import("./CloneMaafApp-7W246RZA.js")).cloneMaafAppAsync},create:{"@helpText":l.app.create.description,lazyHandler:async()=>(await import("./CreateMaafApp-6MSPHUU4.js")).createMaafAppAsync},init:{"@helpText":l.app.init.description,lazyHandler:async()=>(await import("./Init-PBH2IXVK.js")).initAsync},list:{"@helpText":l.app.list.description,lazyHandler:async()=>(await import("./ListMaafApps-ZATO77G3.js")).listMaafAppsAsync},show:{"@helpText":l.app.show.deprecation,lazyHandler:async()=>(await import("./InfoMaafApp-7Z6OJCHD.js")).showMaafAppAsync},share:{typed:!0,"@helpText":l.app.share.description,lazyHandler:async()=>(await import("./ShareMaafApp-SFNOOMOD.js")).shareMaafAppAsync,commands:{link:{typed:!0,"@helpText":l.app.shareLink.description,commands:{create:{"@helpText":l.app.shareLink.create.description,lazyHandler:async()=>(await import("./ShareLinkCreate-ZUVHUQLH.js")).shareLinkCreateAsync},list:{"@helpText":l.app.shareLink.list.description,lazyHandler:async()=>(await import("./ShareLinkList-IEYU6NZW.js")).shareLinkListAsync},revoke:{"@helpText":l.app.shareLink.revoke.description,lazyHandler:async()=>(await import("./ShareLinkRevoke-22RFGOFJ.js")).shareLinkRevokeAsync}}},list:{"@helpText":l.app.share.list.description,lazyHandler:async()=>(await import("./ShareList-6UWIHPBM.js")).shareListAsync}}},unshare:{"@helpText":l.app.unshare.description,lazyHandler:async()=>(await import("./UnshareMaafApp-TU7U3LQ3.js")).unshareMaafAppAsync},info:{"@helpText":l.app.info.description,lazyHandler:async()=>(await import("./InfoMaafApp-7Z6OJCHD.js")).infoMaafAppAsync},build:{"@helpText":l.app.build.description,lazyHandler:async()=>(await import("./BuildMaafApp-7AUZHYOQ.js")).buildMaafAppAsync},"build-status":{"@helpText":l.app.buildStatus.description,lazyHandler:async()=>(await import("./GetMaafBuildStatus-6ZSLIZCH.js")).getMaafBuildStatusAsync},deploy:{"@helpText":l.app.deploy.description,lazyHandler:async()=>(await import("./DeployMaafApp-K2APWFOD.js")).deployMaafAppAsync},pack:{"@helpText":l.app.pack.description,lazyHandler:async()=>(await import("./Pack-TSFHSTB5.js")).packAsync},play:{"@helpText":l.app.play.description,lazyHandler:async()=>(await import("./PlayMaafApp-74TQEAO5.js")).playMaafAppAsync},dev:{"@helpText":l.app.dev.description,lazyHandler:async()=>(await import("./Dev-CIEWFRXR.js")).devAsync},delete:{"@helpText":l.app.delete.description,lazyHandler:async()=>(await import("./DeleteMaafApp-TFGWGJO3.js")).deleteMaafAppAsync},refresh:{typed:!0,commands:{"data-source":{"@helpText":l.app.refresh.dataSource.description,lazyHandler:async()=>(await import("./RefreshDataSource-VARFN3IV.js")).refreshDataSourceAsync}}},override:{typed:!0,requiresFeature:"alm",commands:{"data-source":{"@helpText":l.app.override.dataSource.description,lazyHandler:async()=>(await import("./AddDeploymentBinding-RFLI6DKH.js")).overrideDataSourceAsync}}},add:{typed:!0,commands:{config:{"@helpText":l.app.add.config.description,requiresFeature:"alm",lazyHandler:async()=>(await import("./AddConfig-CI7KNLIG.js")).addConfigAsync},backend:{"@helpText":l.app.add.backend.description,requiresFeature:"rayfin",lazyHandler:async()=>(await import("./AddRayfin-VRCFEOIL.js")).addRayfinAsync},"data-source":{"@helpText":l.app.add.connector.description,lazyHandler:async()=>(await import("./AddConnector-WH4IU3ND.js")).addConnectorAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./AddConnector-WH4IU3ND.js")).addConnectorAsync}}},remove:{typed:!0,commands:{"data-source":{"@helpText":l.app.remove.description,lazyHandler:async()=>(await import("./RemoveDataSource-RRND46QZ.js")).removeDataSourceAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./RemoveDataSource-RRND46QZ.js")).removeDataSourceAsync}}},"set-setting":{"@helpText":l.app["set-setting"].description,lazyHandler:async()=>(await import("./SetSetting-CEH44OT3.js")).setSettingAsync},"get-settings":{"@helpText":l.app["get-settings"].description,lazyHandler:async()=>(await import("./GetSettings-MVVEXMJC.js")).getSettingsAsync}}},project:{"@description":"Manage projects.",commands:{assign:{"@helpText":l.project.assign.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./ProjectRoleAssignments-AI2FQ2VX.js")).assignProjectRoleAsyncVerb},unassign:{"@helpText":l.project.unassign.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./ProjectRoleAssignments-AI2FQ2VX.js")).unassignProjectRoleAsyncVerb},add:{typed:!0,requiresFeature:"projects",commands:{"deployment-target":{"@helpText":l.project.add.deployment.description,lazyHandler:async()=>(await import("./AddDeployment-GWFCPAL5.js")).addDeploymentAsync},approval:{"@helpText":l.project.add.approval.description,lazyHandler:async()=>(await import("./ProjectApprovals-5KLYEM7V.js")).addProjectApprovalAsync}}},create:{"@helpText":l.project.create.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./CreateMaafProject-JKMF5TH3.js")).createMaafProjectAsync},info:{"@helpText":l.project.info.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./InfoMaafProject-SQYB736C.js")).infoMaafProjectAsync},list:{typed:!0,"@helpText":l.project.list.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./ListMaafProjects-GNUXZSYL.js")).listMaafProjectsAsync,commands:{approval:{"@helpText":l.project.list.approval.description,lazyHandler:async()=>(await import("./ProjectApprovals-5KLYEM7V.js")).listProjectApprovalAsync}}},remove:{typed:!0,requiresFeature:"projects",commands:{"deployment-target":{"@helpText":l.project.remove.deployment.description,lazyHandler:async()=>(await import("./RemoveDeployment-STNFNNZF.js")).removeDeploymentAsync},approval:{"@helpText":l.project.remove.approval.description,lazyHandler:async()=>(await import("./ProjectApprovals-5KLYEM7V.js")).removeProjectApprovalAsync}}},build:{"@helpText":l.project.build.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./BuildMaafApp-7AUZHYOQ.js")).buildMaafProjectAsync},deploy:{"@helpText":l.project.deploy.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./DeployMaafProject-6WRKGIIW.js")).deployMaafProjectAsync},"deployment-status":{"@helpText":l.project.deployStatus.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./GetMaafProjectDeployStatus-NZEMVQGJ.js")).getMaafProjectDeployStatusAsync},"build-status":{"@helpText":l.project.buildStatus.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./GetMaafBuildStatus-6ZSLIZCH.js")).getMaafProjectBuildStatusAsync},pack:{"@helpText":l.project.pack.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./PackProject-T575KJQ4.js")).packProjectAsync},state:{typed:!0,"@helpText":l.project.state.description,requiresFeature:"state",commands:{clear:{"@helpText":l.project.state.clear.description,lazyHandler:async()=>(await import("./Clear-7B7CDIPV.js")).clearDataAsync},"generate-code":{"@helpText":l.project.state["generate-code"].description,localOnly:!0,lazyHandler:async()=>(await import("./GenerateCode-UQCHTRGP.js")).dataGenerateCodeAsync},add:{"@helpText":l.project.state.add.description,lazyHandler:async()=>(await import("./Add-FU57YE5G.js")).dataAddAsync},alter:{"@helpText":l.project.state.alter.description,lazyHandler:async()=>(await import("./Alter-JFFT5JOA.js")).dataAlterAsync},remove:{"@helpText":l.project.state.remove.description,lazyHandler:async()=>(await import("./Remove-MCQZVI3K.js")).dataRemoveAsync},"list-schema":{"@helpText":l.project.state["list-schema"].description,lazyHandler:async()=>(await import("./ListSchema-QKVHVPHB.js")).dataListSchemaAsync},"list-settings":{"@helpText":l.project.state["list-settings"].description,lazyHandler:async()=>(await import("./ListSettings-IIA5OGMP.js")).dataListSettingsAsync},"set-setting":{"@helpText":l.project.state["set-setting"].description,lazyHandler:async()=>(await import("./SetSetting-Q7EQNOTI.js")).dataSetSettingAsync}}}}},connector:{"@description":"Discover available connectors and their operations.",commands:{list:{"@helpText":l.connector.list.description,lazyHandler:async()=>(await import("./ListConnectors-2FUTJMHY.js")).listConnectorsCliAsync},"list-actions":{"@helpText":l.connector["list-actions"].description,lazyHandler:async()=>(await import("./ListConnectorActions-UERYZ2C7.js")).listConnectorActionsCliAsync}}},deployment:{"@description":"Inspect deployment history and manage deployment approvals.",requiresFeature:"projects",commands:{list:{"@helpText":l.deployment.list.description,requiresFeature:"projects",lazyHandler:async()=>(await import("./ListDeployments-4YWCHVKF.js")).listDeploymentsAsync},status:{"@helpText":l.deployment.status.description,lazyHandler:async()=>(await import("./GetMaafProjectDeployStatus-NZEMVQGJ.js")).getMaafProjectDeployStatusAsync},approve:{"@helpText":l.deployment.approve.description,lazyHandler:async()=>(await import("./DeploymentApprovals-WTXBXCKE.js")).approveDeploymentAsync},reject:{"@helpText":l.deployment.reject.description,lazyHandler:async()=>(await import("./DeploymentApprovals-WTXBXCKE.js")).rejectDeploymentAsync},cancel:{"@helpText":l.deployment.cancel.description,lazyHandler:async()=>(await import("./DeploymentApprovals-WTXBXCKE.js")).cancelDeploymentAsync}}},git:{"@description":"Manage GitHub integration for apps.",commands:{auth:{typed:!0,commands:{refresh:{"@helpText":l.git.auth.refresh.description,lazyHandler:async()=>(await import("./RefreshGitAuth-DC5NAZBJ.js")).refreshGitAuthAsync}}}}},telemetry:{"@description":"Manage CLI telemetry settings.",commands:{enable:{"@helpText":l.telemetry.enable.description,lazyHandler:async()=>(await import("./TelemetrySettings-XCT73DEI.js")).telemetryEnableAsync},disable:{"@helpText":l.telemetry.disable.description,lazyHandler:async()=>(await import("./TelemetrySettings-XCT73DEI.js")).telemetryDisableAsync},status:{"@helpText":l.telemetry.status.description,lazyHandler:async()=>(await import("./TelemetrySettings-XCT73DEI.js")).telemetryStatusAsync}}},feature:{"@description":"Manage experimental and preview CLI features.",commands:{list:{"@helpText":l.feature.list.description,lazyHandler:async()=>(await import("./FeatureSettings-77LZQSKD.js")).featureListAsync},status:{"@helpText":l.feature.status.description,lazyHandler:async()=>(await import("./FeatureSettings-77LZQSKD.js")).featureStatusAsync},enable:{"@helpText":l.feature.enable.description,lazyHandler:async()=>(await import("./FeatureSettings-77LZQSKD.js")).featureEnableAsync},disable:{"@helpText":l.feature.disable.description,lazyHandler:async()=>(await import("./FeatureSettings-77LZQSKD.js")).featureDisableAsync},reset:{"@helpText":l.feature.reset.description,lazyHandler:async()=>(await import("./FeatureSettings-77LZQSKD.js")).featureResetAsync}}}};function re(){return`${"ms"} v${D.version} (preview)`}var be=xe(_e(),1),{program:it,createCommand:rt,createArgument:st,createOption:at,CommanderError:ot,InvalidArgumentError:lt,InvalidOptionArgumentError:pt,Command:Q,Argument:ct,Option:ut,Help:Ae}=be.default;function X(a,e,t){let n=new Ae;n.helpWidth=process.stdout.columns??80;let i=Math.max(...t.map(([p])=>p.length),8),r=2,s=2;a.push(e);for(let[p,o]of t){let c=`${p.padEnd(i+s)}${o}`;a.push(n.wrap(c,n.helpWidth-r,i+s,1).replace(/^/gm," ".repeat(r)))}}function Ce(){let a=[],e=ne(O);if(e.length>0){let t=Math.max(...e.map(([i])=>i.length)),n=Math.max(t+2,10);a.push("Command Groups:"),a.push("");for(let[i,r]of e)a.push(` ${i.padEnd(n)} ${r["@description"]}`);a.push(""),a.push(`Run '${"ms"} <group> --help' for commands within a group.`)}return a.join(`
|
|
28
|
+
`)}function _t(a){if(!T(a,O))return"";let e=O[a],t=[];t.push(`Usage: ${"ms"} ${a} <command> [flags]`),t.push(""),t.push(e["@description"]),t.push("");let n=[],i=[];for(let[r,s]of $(e.commands))if(A(s)){let p=s["@helpText"];V(s)&&p!==void 0?(n.push([r,p]),i.push([r,s])):p!==void 0?n.push([r,p]):i.push([r,s])}else n.push([r,s["@helpText"]]);if(n.length>0&&X(t,"Commands:",n),i.length>0){t.push("");for(let[r,s]of i)X(t,`${r} <type>:`,Z(s,r).map(([p,o])=>[p,o]))}return t.push(""),t.push(`Run '${"ms"} ${a} <command> --help' for command-specific flags.`),t.join(`
|
|
29
|
+
`)}function Z(a,e){let t=[];for(let[n,i]of $(a.commands)){let r=e?`${e} ${n}`:n;A(i)?t.push(...Z(i,r)):t.push([r,i["@helpText"]])}return t}function bt(a){if(a.length<2)return null;let[e,...t]=a;if(!T(e,O))return null;let n=O[e].commands,i;for(let p of t){let o=w(n,p);if(!o)return null;if(i=o,A(o))n=o.commands;else return null}if(!i||!A(i))return null;let r=a.join(" "),s=[];return s.push(`Usage: ${"ms"} ${r} <type> [flags]`),s.push(""),X(s,"Types:",Z(i,"")),s.push(""),s.push(`Run '${"ms"} ${r} <type> --help' for type-specific flags.`),s.join(`
|
|
30
|
+
`)}var ee=class extends Q{parseOptions(e){let t=super.parseOptions(e),n=t.unknown.indexOf("--"),i=t.unknown.slice(0,n===-1?void 0:n).find(r=>r==="--version"||r==="-v");return i&&this.error(`unknown option '${i}'`,{code:"commander.unknownOption"}),t}};function vt(a){let e=a?new ee:new Q;return e.option("--non-interactive","Run in non-interactive mode (no prompts, all parameters must be provided via flags or environment variables)"),e.option("--json","Format output as JSON"),e.option("--no-color","Disable colored output"),a?(e.name(`${"ms"} ${a.path.join(" ")}`),a.localOnly&&e.allowExcessArguments(!1)):(e.name("ms"),e.usage("[option] [command] [<args>]"),e.version(D.version,"-v, --version","output the current version")),e.description(l.global.programDescription),e.addHelpText("beforeAll",()=>`${re()}
|
|
31
|
+
|
|
32
|
+
`),e.addHelpText("after",()=>a?"":`
|
|
33
|
+
`+Ce()+`
|
|
34
|
+
`),e}export{re as a,We as b,Re as c,T as d,O as e,_t as f,bt as g,vt as h};
|
|
35
|
+
/*!
|
|
36
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
37
|
+
*/
|
|
38
|
+
//# sourceMappingURL=chunk-BRRT2E75.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{m as E}from"./chunk-GE3UFHZ5.js";import{B as u,K as w,p as c,q as v,s as l,t as p,x as a}from"./chunk-4XKA5APP.js";import{p as y}from"./chunk-FHE3OXIP.js";import{I as m,L as f}from"./chunk-KKC5ZK4D.js";async function A(n,r,t){try{let e=await n;if(e.status===200){if(e.data.operationSuccess===!1||e.data.environmentFound===!1||e.data.errorCode)throw new c(200,e.data.message,e.data.errorCode);let i=e.data.environment?.name;if(!i)throw new u("Routing service returned 200 with no environment name.");return i}let o=await p(r,e.pollingUrl,e.authResource,t);if(!o.environment?.name)throw new u("Routing service finished provisioning but returned no environment name.");return o.environment.name}catch(e){throw P(e)}}function P(n){if(n instanceof c){let r=n.apiMessage?` ${n.apiMessage}`:" Ensure your account has the required permissions to create a Developer environment.";return new a(`Could not provision a Developer environment for your tenant (status ${n.status}).${r}`)}return n instanceof v?new a("Timed out waiting for a Developer environment to provision. Try again."):n instanceof Error?n:new Error(String(n))}function k(n,r,t,e,o){let{trackBackgroundFailure:i=!0,dogfood:I=!1}=o??{},g=n.getHttpClient(),{region:R}=w(),d=A(l(g,r,y,{provisionDataverse:!1,...I?{dogfood:!0}:{}},R,t),g,t);return i&&d.catch(s=>{t.trackErrorEvent(`${e}.RoutingEnvironmentBackgroundFailure`,{error:s instanceof Error?s.message:String(s)})}),d}function h(n){let r=n instanceof Error?n.message:String(n);f(`Failed to resolve a developer environment.
|
|
8
|
+
|
|
9
|
+
${r}
|
|
10
|
+
|
|
11
|
+
To retry, run the same command again. Alternatively, pass --environment-id <id> to use a known environment.`)}async function D(n,r){if(n)return n;if(!r)throw new a("Unable to resolve a developer environment. Pass --environment-id <id> to specify one explicitly.");try{return await r}catch(t){throw h(t),t}}async function L(n,r,t){let e=await E(n,{failIfMissing:!1});if(e)return e;let o=await n.getTenantIdAsync();if(!o)throw new a("Unable to determine tenant ID. Ensure you are logged in.");t?.jsonMode||m("No environment specified \u2014 resolving your developer environment\u2026");let i=await C(n,o,r,t?.telemetryNamespace??"BrowseVerb");return n.updateEnvironmentId(i),t?.jsonMode||m(`Using developer environment ${i}.`),i}async function C(n,r,t,e){try{return await k(n,r,t,e,{trackBackgroundFailure:!1})}catch(o){throw h(o),o}}export{k as a,D as b,L as c};
|
|
12
|
+
/*!
|
|
13
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
14
|
+
*/
|
|
15
|
+
//# sourceMappingURL=chunk-DGUO74I3.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{j as P,o as k}from"./chunk-GE3UFHZ5.js";import{J as N,L as A,M as w,Ob as I,Q as b,c as v,x as l}from"./chunk-4XKA5APP.js";import{a as O,b as x,c as S,d as L,e as T,f as M,g as $,h as z}from"./chunk-BRRT2E75.js";import{m as D}from"./chunk-2LDU3F6O.js";import{a as C,b as _}from"./chunk-OUKOEUZA.js";import{l as h}from"./chunk-4U53RYJJ.js";import{a as R}from"./chunk-HOIFXUTG.js";import{I as f,f as m,g as p}from"./chunk-KKC5ZK4D.js";var F={treatment:"presenceOnly"};function E(s){let e=s.trim();if(!e)return"path:empty";let t=/^([a-zA-Z]:[\\/]|\\\\|\/)/.test(e),n=e.lastIndexOf("."),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),r=n>i?e.slice(n).toLowerCase():"";return`path:${t?"absolute":"relative"}${r?`:${r}`:""}`}function H(s){try{let e=new URL(s),t=e.hostname.toLowerCase(),n=t==="localhost"||t==="127.0.0.1"||t==="::1"?"localhost":"remote",i=e.protocol.replace(":","")||"unknown";return`url:${n}:${i}`}catch{return"url:unparseable"}}function G(s){let e=s.trim().toLowerCase();if(!e||e==="none")return"repo:none";if(e==="native")return"repo:native";try{let t=new URL(s).hostname.toLowerCase();return t==="github.com"?"repo:github.com":t.includes("ghe")?"repo:ghe":"repo:other"}catch{return"repo:other"}}function J(s){let e=s.trim().toLowerCase();return e==="build"||e==="none"?e:"invalid"}function Y(s){let e=s.trim(),t=e.match(/\/environments\/([^/]+)\/?$/i);return v(t?t[1]:e)}var B={connector:{treatment:"full"},solutionId:{treatment:"full"},connectionId:{treatment:"full"},connection:{treatment:"full"},connectionRef:{treatment:"full"},as:{treatment:"full"},dataverseEnvironmentId:{treatment:"full"},environmentId:{treatment:"full",normalize:Y},linkId:{treatment:"full"},repositoryId:{treatment:"full"},appId:{treatment:"full"},template:{treatment:"full"},commit:{treatment:"full"},cloud:{treatment:"full"},port:{treatment:"full"},mode:{treatment:"full"},permission:{treatment:"full"},access:{treatment:"full"},skipCodegen:{treatment:"full"},useV1Codegen:{treatment:"full"},useSso:{treatment:"full"},offline:{treatment:"full"},configOnly:{treatment:"full"},onlyAllowed:{treatment:"full"},force:{treatment:"full"},forceReauth:{treatment:"full"},openBrowser:{treatment:"full"},wait:{treatment:"full"},browser:{treatment:"full"},showLog:{treatment:"full"},deviceCode:{treatment:"full"},nonInteractive:{treatment:"full"},json:{treatment:"full"},color:{treatment:"full"},buildPath:{treatment:"descriptor",describe:E},buildEntryPoint:{treatment:"descriptor",describe:E},iconPath:{treatment:"descriptor",describe:E},artifact:{treatment:"descriptor",describe:E},localAppUrl:{treatment:"descriptor",describe:H},repo:{treatment:"descriptor",describe:G},buildType:{treatment:"descriptor",describe:J},displayName:{treatment:"presenceOnly"},description:{treatment:"presenceOnly"},search:{treatment:"presenceOnly"},app:{treatment:"presenceOnly"},name:{treatment:"presenceOnly"},buildCommand:{treatment:"presenceOnly"},dataset:{treatment:"presenceOnly"},sqlStoredProcedure:{treatment:"presenceOnly"},resourceName:{treatment:"presenceOnly"},stage:{treatment:"presenceOnly"},status:{treatment:"presenceOnly"},table:{treatment:"presenceOnly"},top:{treatment:"presenceOnly"}};function W(s){return B[s]??F}function V(s,e){let t=W(s);if(e==null||e==="")return{treatment:t.treatment};switch(t.treatment){case"full":{if(typeof e=="string"||typeof e=="number"||typeof e=="boolean"){if(t.normalize){if(typeof e!="string")return{treatment:"presenceOnly"};let n=t.normalize(e);return n===void 0?{treatment:"presenceOnly"}:{treatment:"full",value:n}}return{treatment:"full",value:e}}return{treatment:"presenceOnly"}}case"descriptor":{let n=typeof e=="string"?e:String(e);try{return{treatment:"descriptor",value:t.describe(n)}}catch{return{treatment:"descriptor",value:"unparseable"}}}default:return{treatment:"presenceOnly"}}}function c(s){return typeof s!="string"?void 0:s.trim()||void 0}function q(s){return s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var j=class{constructor(e,t,n,i,r=x(process.argv,T)){this._httpClient=e;this._logger=t;this._authenticationProvider=n;this._accountManager=i;this._resolvedCommand=r,this._resolvedCommand&&(this._verb=this._resolvedCommand.path.join(" "),this._tokensConsumed=this._resolvedCommand.tokensConsumed),this._program=z(this._resolvedCommand);let o=I(),a=c(o.appConfig?.environmentId),d=c(_("MAAF_DEBUG_ENVIRONMENT_ID"));this._configEnvironmentId=a,this._debugEnvironmentId=d,this._environmentId=a??d,!a&&d&&!this._resolvedCommand?.localOnly&&f(`[debug] ${C("MAAF_DEBUG_ENVIRONMENT_ID")} is set to '${d}'.`);let u=this._resolvedCommand?.localOnly?void 0:o.appConfig?.cloud;if(u){let y=u.toLowerCase();if(!m.includes(y))throw new l(`Invalid cloud value '${u}' in the local config. Valid values are: ${m.join(", ")}.`);this._cloud=y,this._region=p(this._cloud)}this._cloud||this.addOption({flags:{key:h.Cloud.name},env:h.Cloud.envVar,default:"public",description:R.global.cloud}),this._resolvedCommand?.localOnly||N({httpClient:this._httpClient,logger:this._logger,region:this._region??p("public"),environmentName:this._resolveEnvironmentId()||"default",featureGates:{useManagedDevOpsDeployment:this.isManagedDevOpsDeploymentEnabled()}})}_httpClient;_logger;_authenticationProvider;_accountManager;_environmentId;_configEnvironmentId;_debugEnvironmentId;_environmentIdNotified=!1;_cloud;_region;_verb;_resolvedCommand;_tokensConsumed=0;_program;_options={};_positionalArgNames=[];_isParsed=!1;_parameterTelemetry=new Map;isManagedDevOpsDeploymentEnabled(){return D("projects")}addSwitch(e){this._createOption(e,!1)}addSwitches(e){e.forEach(t=>this._createOption(t,!1))}consumePositionalArg(e){let t=e.startsWith("[")||e.startsWith("<")?e.slice(1,-1):e;this._program.argument(`[${t}]`),this._positionalArgNames.push(e),this._program.usage(`${this._positionalArgNames.join(" ")} [options]`)}consumePositionalArgs(e){this._program.argument(`[${e}...]`),this._positionalArgNames.push(`<${e}...>`),this._program.usage(`${this._positionalArgNames.join(" ")} [options]`)}getPositionalArg(e){let t=this._program.processedArgs[e];return typeof t=="string"?t:void 0}getPositionalArgs(e){let t=this._program.processedArgs[e];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}addOption(e){this._createOption(e)}addOptions(e){e.forEach(t=>this._createOption(t))}async runVerb(){if(this._tokensConsumed>0){let e=[process.argv[0],process.argv[1],...process.argv.slice(2+this._tokensConsumed)];this._program.parse(e)}else this._program.parse();if(this._isParsed=!0,this._captureExplicitCliParameters(),this.useProjectConfigDefaults(),await this._getRequiredVariables(),!this._region)throw new l(`Region is not set. Use --cloud or set the ${C("CLOUD_INSTANCE")} environment variable.`);this._resolvedCommand?.localOnly||(this._logger.setTelemetryContext({region:this._region}),await this._authenticationProvider.initAsync(this._region)),this._logger.trackActivityEvent("Initialize",{verb:this._verb})}handleGlobalHelpOrFlagsAndExit(){let e=process.argv[2];if(e||this._program.help(),e.startsWith("-")){this._program.parse(process.argv),this._isParsed=!0;return}if(this._resolvedCommand||this._rejectNonRootVersionFlag(),this._tryPrintDeepTypedHelp()&&process.exit(0),!this._resolvedCommand){let t=S(process.argv,T);if(t){if(t.unknownToken!==void 0)throw new l(`Unknown type '${t.unknownToken}' for '${"ms"} ${t.pathTokens.join(" ")}'. Run "${"ms"} ${t.pathTokens.join(" ")} --help" for available types.`);let n=$(t.pathTokens);n&&(f(`${O()}
|
|
8
|
+
|
|
9
|
+
${n}`),process.exit(0))}if(L(e,T)){let n=process.argv[3];if(n&&!n.startsWith("-"))throw new l(`Unknown command '${n}' under '${"ms"} ${e}'. Run "${"ms"} ${e} --help" for available commands.`);f(`${O()}
|
|
10
|
+
|
|
11
|
+
${M(e)}`),process.exit(0)}throw new l(`Unknown command '${e}'. Run "${"ms"} --help" for available commands.`)}}_tryPrintDeepTypedHelp(){let e=process.argv.slice(2),t=e.findIndex(r=>r==="--help"||r==="-h");if(t===-1)return!1;let n=e.slice(0,t).filter(r=>!r.startsWith("-"));if(this._resolvedCommand&&n.length<=this._resolvedCommand.tokensConsumed)return!1;let i=$(n);return i?(this._rejectNonRootVersionFlag(),f(`${O()}
|
|
12
|
+
|
|
13
|
+
${i}`),!0):!1}_rejectNonRootVersionFlag(){let e=process.argv.slice(2),t=e.indexOf("--"),n=e.slice(0,t===-1?void 0:t).find(i=>i==="--version"||i==="-v");n&&this._program.error(`unknown option '${n}'`,{code:"commander.unknownOption"})}getVerb(){if(!this._resolvedCommand)throw new l(`No command specified. Run "${"ms"} --help" for available commands.`);return this._verb}getResolvedCommand(){return this._resolvedCommand}async getOption(e,t){let n=I(),i=this._program.getOptionValueSource(e),r=i==="cli"?this._program.getOptionValue(e):void 0,o=this._options[e],a=i==="cli"?"cli":void 0;if(r===void 0&&o&&o.env&&(r=_(o.env),r!==void 0&&(a="env")),r===void 0&&o&&o.default!==void 0&&(r=o.default),!r&&!t&&o?.customPrompt){if(n.interactive)r=await o.customPrompt(),r&&(a="prompt");else if(!o.optionalInNonInteractive){let d=o.flags.key,u=o.flags.alias,y=u?`--${d} (-${u})`:`--${d}`,U=o.env?` or environment variable (${C(o.env)})`:"";throw new l(`Missing required option ${y}${U}. In non-interactive mode, all parameters must be provided via flags or environment variables.`)}}return a&&this._recordParameter(e,a,r),r}getAuthenticationProvider(){return this._authenticationProvider}getAccountManager(){if(!this._accountManager)throw new l("Account management commands (auth login/logout/status/switch) are only available in interactive mode. They cannot be used with service principal or HTTP forward authentication.");return this._accountManager}getHttpClient(){return this._httpClient}async getTenantIdAsync(){if(!(this._accountManager!==void 0)){let t=this._authenticationProvider.getUserTenantId();if(t)return t}if(this._region&&this._region!=="local"&&this._region!=="dev"){let t=b()[this._region];await this._authenticationProvider.getAccessTokenForResource(t)}return this._authenticationProvider.getUserTenantId()}getAuthResourceUrl(){let e=this._region??p("public");return e==="local"||e==="dev"?b().test:b()[e]}getCloud(){return this._cloud}useProjectConfigDefaults(){let e=I().projectConfig;if(!e||this._resolvedCommand?.localOnly)return;if(!this._configEnvironmentId){let n=c(e.environmentId);n&&(this._configEnvironmentId=n,this._environmentId=n,A(P(n)))}let t=this._program.getOptionValueSource(h.Cloud.name)==="cli"||_(h.Cloud.envVar)!==void 0;if(!this._cloud&&!t&&e.cloud){let n=e.cloud.toLowerCase();if(!m.includes(n))throw new l(`Invalid cloud value '${e.cloud}' in the local project config. Valid values are: ${m.join(", ")}.`);this._cloud=n,this._region=p(this._cloud),w(this._region)}}getLoginAuthority(e){return k(this._region,e)}setDescription(e){this._program.description(e)}isJsonMode(){return this._isParsed?this._program.opts().json===!0:process.argv.includes("--json")}addExamples(e){!e||e.length===0||this._program.addHelpText("after",()=>{let t=["","Examples:"];return e.forEach(n=>{t.push(` $ ${n}`)}),t.join(`
|
|
14
|
+
`)})}getRegisteredFlags(){let e=new Set;for(let t of this._program.options)t.long&&e.add(t.long),t.negate&&t.long?.startsWith("--no-")&&e.add(`--${t.long.slice(5)}`);return e}getEnvironmentId(e={}){let t=this._resolveEnvironmentId(e);return t&&this.updateEnvironmentId(t),t}_resolveEnvironmentId(e={}){let t=this._options.environmentId,n=c(this._program.getOptionValue("environmentId")),i=c(t?.env?_(t.env):void 0),r=e.overridesOnly?void 0:c(e.includeConfig===!1?this._debugEnvironmentId:this._environmentId),o=n??i??r;if(!o)return;let a;n?a="cli":i?a="env":e.includeConfig===!1?a="debug-env":c(this._configEnvironmentId)===o?a="config":c(this._debugEnvironmentId)===o&&(a="debug-env");let d=v(P(o));if(!d)throw new l("Invalid environment ID. Use a GUID or Default-<GUID>.");return a&&this._recordParameter("environmentId",a,d),d}updateEnvironmentId(e){if(this._environmentIdNotified)return;let t=v(P(e.trim()));if(!t)throw new l("Invalid environment ID. Use a GUID or Default-<GUID>.");this._environmentId=t,A(t),this._region&&this._logger.setTelemetryContext({environmentId:t,region:this._region}),this._environmentIdNotified=!0}async _getRequiredVariables(){if(!this._cloud){let e=await this.getOption("cloud");if(e){let t=e.toLowerCase();if(!m.includes(t))throw new l(`Invalid --cloud value '${e}'. Valid values are: ${m.join(", ")}.`);this._cloud=t,this._region=p(this._cloud),this._resolvedCommand?.localOnly||w(this._region)}}}_recordParameter(e,t,n){n==null||n===""||this._parameterTelemetry.set(e,{source:t,value:n})}_captureExplicitCliParameters(){for(let e of Object.keys(this._options))this._program.getOptionValueSource(e)==="cli"&&this._recordParameter(e,"cli",this._program.getOptionValue(e))}buildParameterTelemetryPayload(){let e={};for(let[t,n]of this._parameterTelemetry.entries()){let i=this._options[t]?.flags.key??q(t),r=V(t,n.value);e[i]=r.value!==void 0?{source:n.source,value:r.value}:{source:n.source}}return this._finalizeParameterTelemetryPayload(e)}_finalizeParameterTelemetryPayload(e){let n=JSON.stringify(e);if(n.length<=4e3)return{paramsJson:n,paramsTruncated:!1};let i={};for(let[r,o]of Object.entries(e))i[r]={source:o.source};return{paramsJson:JSON.stringify(i),paramsTruncated:!0}}_createOption(e,t=!0){let i=t&&(e.default!==void 0||e.optionalInNonInteractive===!0)?`[optional] ${e.description??""}`:e.description,r=this._program.createOption(t?this._createFlags(e.flags):this._createSwitchFlags(e.flags),i);e.parseArg&&r.argParser(e.parseArg),(!this._resolvedCommand||e.hidden)&&r.hideHelp(),this._program.addOption(r),this._options[r.attributeName()]=e}_createFlags(e){let{key:t,alias:n}=e;return n?`-${n}, --${t} <${t}>`:`--${t} <${t}>`}_createSwitchFlags(e){let{key:t,alias:n}=e;return n?`-${n}, --${t}`:`--${t}`}};export{c as a,j as b};
|
|
15
|
+
/*!
|
|
16
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
17
|
+
*/
|
|
18
|
+
//# sourceMappingURL=chunk-DKSLWH4O.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{d as i}from"./chunk-ZB6MB7GZ.js";import{z as o}from"./chunk-4XKA5APP.js";var a=["repository not found","fatal: repository","could not read username","terminal prompts disabled","authentication failed","permission denied","403","remote: not found"];function u(r){let t=r.stderr;return typeof t=="string"?t:Buffer.isBuffer(t)?t.toString():t instanceof Uint8Array?Buffer.from(t).toString():""}function c(r,t){let e=r instanceof Error?r.message:String(r),n=t.trim();return!n||e.includes(n)?e:`${e}
|
|
8
|
+
${n}`}function d(r){let t=r.toLowerCase();return a.some(e=>t.includes(e))}function f(){return"Make sure the repository exists and that you have access to it."}function g({directory:r,repoUrl:t}){try{i(["-c","http.sslVersion=tlsv1.3","clone","--",t,r],{emitStderr:!1})}catch(e){let n=u(e);n&&process.stderr.write(n);let s=d(n)?`Failed to clone '${t}' into '${r}'. ${f()}`:`Failed to clone '${t}' into '${r}'. See the git output above for details.`;throw new o(s,{underlyingError:c(e,n)})}}export{c as a,d as b,f as c,g as d};
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=chunk-EFY2BSWB.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{b as t,e as s}from"./chunk-OUKOEUZA.js";var o={name:"@microsoft/cmr-cli",version:"0.32.3",type:"module",description:"Command-line interface for building and managing Copilot Managed Runtime",license:"MIT",bin:{ms:"./dist/Bin.js"},files:["dist","!dist/*.map","LICENSE","README.md","THIRD-PARTY-NOTICES.txt"],scripts:{build:"bun scripts/build.ts","generate:cgmanifest":"bun scripts/generate-cgmanifest.ts","benchmark:startup":"bun scripts/benchmark-startup.ts",dev:"tsc -p tsconfig.json --watch","check-types":"tsc --noEmit",lint:"eslint src/",test:"bun test --isolate src/","test:e2e":"bun test src/__tests__/e2e/",clean:"bun ../../scripts/clean.ts dist .turbo tsconfig.tsbuildinfo THIRD-PARTY-NOTICES.txt"},dependencies:{"@azure/msal-node-runtime":"0.20.6","@napi-rs/keyring":"2.1.0",esbuild:"catalog:build",open:"11.0.0"},engines:{node:">=24.11.0",git:">=2.27.0"},devDependencies:{"@microsoft/cmr-apps-actions":"workspace:*","@microsoft/cmr-apps-codegen":"workspace:*","@microsoft/cmr-apps-common":"workspace:*","@azure/msal-node":"5.2.2","@azure/msal-node-extensions":"5.2.2","@clack/prompts":"1.4.0","@microsoft/1ds-core-js":"4.3.11","@microsoft/1ds-post-js":"4.3.11","@repo/repo-config":"workspace:*","@rnx-kit/third-party-notices":"3.0.0","@types/archiver":"6.0.3","@types/bun":"1.3.13","@types/node":"catalog:","@types/semver":"7.7.1",archiver:"7.0.1",commander:"10.0.1",json5:"2.2.3",memfs:"^4.57.2",semver:"7.7.4","tsc-esm-fix":"catalog:build",typescript:"5.9.3","typescript-5-7":"npm:typescript@5.7.2","typescript-5-8":"npm:typescript@5.8.3","typescript-6":"npm:typescript@6.0.2"}};import*as c from"os";import*as e from"path";var m=t("WORKING_DIRECTORY")??process.cwd(),n=t("CONFIG_DIR")??e.join(c.homedir(),".ms-cli"),E=e.join(n,"cache","auth"),d=e.join(n,"telemetry"),_="microsoft-managed-apps-cli",l="msal-token-cache",I="x-ms-client-request-id",R="x-ms-client-session-id",T="x-ms-target-url",C="x-ms-auth-resource",u="x-ms-body-token-resource",g="userSettings.json",x=`managed-apps-cli/${o.version}`,f=s("USE_MMA_APP_ID")?"c4ee713f-aede-4371-91fc-921aa3a5ded9":"9cee029c-6210-4654-90bb-17e6e9d36617",N="managedappscli";export{o as a,m as b,n as c,E as d,d as e,_ as f,l as g,I as h,R as i,T as j,C as k,u as l,g as m,x as n,f as o,N as p};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-FHE3OXIP.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{Ob as et,u as Q,w as tt,x as N}from"./chunk-4XKA5APP.js";import{K as D,a as j}from"./chunk-KKC5ZK4D.js";import{b as Ut,d as dt}from"./chunk-UT667QSU.js";var ot=Ut((Re,Mt)=>{"use strict";var nt={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let s="";return t<0?s+=`\x1B[${-t}D`:t>0&&(s+=`\x1B[${t}C`),e<0?s+=`\x1B[${-e}A`:e>0&&(s+=`\x1B[${e}B`),s},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},ie={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},re={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let s=0;s<t;s++)e+=this.line+(s<t-1?nt.up():"");return t&&(e+=nt.left),e}};Mt.exports={cursor:nt,scroll:ie,erase:re,beep:"\x07"}});import{styleText as at}from"node:util";import{stdout as Pt,stdin as ne}from"node:process";import oe from"node:readline";var mt=(()=>{let t=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return e=>{let s=0;for(t.lastIndex=0;t.test(e);)s+=1;return e.length-s}})(),gt=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,ft=t=>t===8987||t===9001||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t>=131072&&t<=196605||t>=196608&&t<=262141;var Bt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,$t=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Ht=/\t{1,1000}/y,vt=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),qt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,zt=new RegExp("\\p{M}+","gu"),Jt={limit:1/0,ellipsis:""},yt=(t,e={},s={})=>{let i=e.limit??1/0,r=e.ellipsis??"",o=e?.ellipsisWidth??(r?yt(r,Jt,s).width:0),n=0,a=s.controlWidth??0,l=s.tabWidth??8,h=s.emojiWidth??2,d=2,c=s.regularWidth??1,p=s.wideWidth??d,v=[[qt,c],[Bt,n],[Kt,a],[Ht,l],[vt,h],[$t,p]],f=0,$=0,I=t.length,S=0,P=!1,F=I,_=Math.max(0,i-o),y=0,b=0,w=0,x=0;t:for(;;){if(b>y||$>=I&&$>f){let C=t.slice(y,b)||t.slice(f,$);S=0;for(let O of C.replaceAll(zt,"")){let E=O.codePointAt(0)||0;if(gt(E)?x=d:ft(E)?x=p:x=c,w+x>_&&(F=Math.min(F,Math.max(y,f)+S)),w+x>i){P=!0;break t}S+=O.length,w+=x}y=b=0}if($>=I)break t;for(let C=0,O=v.length;C<O;C++){let[E,pt]=v[C];if(E.lastIndex=$,E.test(t)){if(S=E===$t?mt(t.slice($,E.lastIndex)):E===vt?1:E.lastIndex-$,x=S*pt,w+x>_&&(F=Math.min(F,$+Math.floor((_-w)/pt))),w+x>i){P=!0;break t}w+=x,y=f,b=$,$=f=E.lastIndex;continue t}}$+=1}return{width:P?_:w,index:P?F:I,truncated:P,ellipsed:P&&i>=o}},wt=yt;var Yt={limit:1/0,ellipsis:"",ellipsisWidth:0},Xt=(t,e={})=>wt(t,Yt,e).width,A=Xt;var U="\x1B",xt="\x9B",Zt=39,it="\x07",Ct="[",Qt="]",Et="m",rt=`${Qt}8;;`,It=new RegExp(`(?:\\${Ct}(?<code>\\d+)m|\\${rt}(?<uri>.*)${it})`,"y"),bt=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},St=t=>`${U}${Ct}${t}${Et}`,_t=t=>`${U}${rt}${t}${it}`,st=(t,e,s)=>{let i=e[Symbol.iterator](),r=!1,o=!1,n=t.at(-1),a=n===void 0?0:A(n),l=i.next(),h=i.next(),d=0;for(;!l.done;){let c=l.value,p=A(c);a+p<=s?t[t.length-1]+=c:(t.push(c),a=0),(c===U||c===xt)&&(r=!0,o=e.startsWith(rt,d+1)),r?o?c===it&&(r=!1,o=!1):c===Et&&(r=!1):(a+=p,a===s&&!h.done&&(t.push(""),a=0)),l=h,h=i.next(),d+=c.length}n=t.at(-1),!a&&n!==void 0&&n.length&&t.length>1&&(t[t.length-2]+=t.pop())},te=t=>{let e=t.split(" "),s=e.length;for(;s&&!A(e[s-1]);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},ee=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",r,o,n=t.split(" "),a=[""],l=0;for(let c=0;c<n.length;c++){let p=n[c];if(s.trim!==!1){let f=a.at(-1)??"",$=f.trimStart();f.length!==$.length&&(a[a.length-1]=$,l=A($))}c!==0&&(l>=e&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),l=0),(l||s.trim===!1)&&(a[a.length-1]+=" ",l++));let v=A(p);if(s.hard&&v>e){let f=e-l,$=1+Math.floor((v-f-1)/e);Math.floor((v-1)/e)<$&&a.push(""),st(a,p,e),l=A(a.at(-1)??"");continue}if(l+v>e&&l&&v){if(s.wordWrap===!1&&l<e){st(a,p,e),l=A(a.at(-1)??"");continue}a.push(""),l=0}if(l+v>e&&s.wordWrap===!1){st(a,p,e),l=A(a.at(-1)??"");continue}a[a.length-1]+=p,l+=v}s.trim!==!1&&(a=a.map(c=>te(c)));let h=a.join(`
|
|
8
|
+
`),d=!1;for(let c=0;c<h.length;c++){let p=h[c];if(i+=p,d)d=!1;else if(d=p>="\uD800"&&p<="\uDBFF",d)continue;if(p===U||p===xt){It.lastIndex=c+1;let f=It.exec(h)?.groups;if(f?.code!==void 0){let $=Number.parseFloat(f.code);r=$===Zt?void 0:$}else f?.uri!==void 0&&(o=f.uri.length===0?void 0:f.uri)}if(h[c+1]===`
|
|
9
|
+
`){o&&(i+=_t(""));let v=r?bt(r):void 0;r&&v&&(i+=St(v))}else p===`
|
|
10
|
+
`&&(r&&bt(r)&&(i+=St(r)),o&&(i+=_t(o)))}return i},se=/\r?\n/;function R(t,e,s){return String(t).normalize().split(se).map(i=>ee(i,e,s)).join(`
|
|
11
|
+
`)}var M=dt(ot(),1);function L(t,e,s){if(!s.some(n=>!n.disabled))return t;let i=t+e,r=Math.max(s.length-1,0),o=i<0?r:i>r?0:i;return s[o].disabled?L(o,e<0?-1:1,s):o}var ae=["up","down","left","right","space","enter","cancel"],ue=["January","February","March","April","May","June","July","August","September","October","November","December"],V={actions:new Set(ae),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...ue],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(t,e)=>`There are only ${t} days in ${e}`,afterMin:t=>`Date must be on or after ${t.toISOString().slice(0,10)}`,beforeMax:t=>`Date must be on or before ${t.toISOString().slice(0,10)}`}}};function Tt(t,e){if(typeof t=="string")return V.aliases.get(t)===e;for(let s of t)if(s!==void 0&&Tt(s,e))return!0;return!1}function le(t,e){if(t===e)return;let s=t.split(`
|
|
12
|
+
`),i=e.split(`
|
|
13
|
+
`),r=Math.max(s.length,i.length),o=[];for(let n=0;n<r;n++)s[n]!==i[n]&&o.push(n);return{lines:o,numLinesBefore:s.length,numLinesAfter:i.length,numLines:r}}var We=globalThis.process.platform.startsWith("win"),ut=Symbol("clack:cancel");function k(t){return t===ut}function B(t,e){let s=t;s.isTTY&&s.setRawMode(e)}var lt=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,ct=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20;function G(t,e,s,i=s,r=s,o){let n=lt(t??Pt);return R(e,n-s.length,{hard:!0,trim:!1}).split(`
|
|
14
|
+
`).map((a,l,h)=>{let d=o?o(a,l):a;return l===0?`${i}${d}`:l===h.length-1?`${r}${d}`:`${s}${d}`}).join(`
|
|
15
|
+
`)}var z=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,e=!0){let{input:s=ne,output:i=Pt,render:r,signal:o,...n}=t;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=e,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){let s=this._subscribers.get(t)??[];s.push(e),this._subscribers.set(t,s)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){let s=this._subscribers.get(t)??[],i=[];for(let r of s)r.cb(...e),r.once&&i.push(()=>s.splice(s.indexOf(r),1));for(let r of i)r()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(ut);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=oe.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),B(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(ut)})})}_isActionKey(t,e){return t===" "}_shouldSubmit(t,e){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,e){this.userInput=t??"",this.emit("userInput",this.userInput),e&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(t,e)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&V.aliases.has(e.name)&&this.emit("cursor",V.aliases.get(e.name)),V.actions.has(e.name)&&this.emit("cursor",e.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t?.toLowerCase(),e),e?.name==="return"&&this._shouldSubmit(t,e)){if(this.opts.validate){let s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Tt([t,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
16
|
+
`),B(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=R(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
17
|
+
`).length-1;this.output.write(M.cursor.move(-999,t*-1))}render(){let t=R(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(M.cursor.hide);else{let e=le(this._prevFrame,t),s=ct(this.output);if(this.restoreCursor(),e){let i=Math.max(0,e.numLinesAfter-s),r=Math.max(0,e.numLinesBefore-s),o=e.lines.find(n=>n>=i);if(o===void 0){this._prevFrame=t;return}if(e.lines.length===1){this.output.write(M.cursor.move(0,o-r)),this.output.write(M.erase.lines(1));let n=t.split(`
|
|
18
|
+
`);this.output.write(n[o]),this._prevFrame=t,this.output.write(M.cursor.move(0,n.length-o-1));return}else if(e.lines.length>1){if(i<r)o=i;else{let a=o-r;a>0&&this.output.write(M.cursor.move(0,a))}this.output.write(M.erase.down());let n=t.split(`
|
|
19
|
+
`).slice(o);this.output.write(n.join(`
|
|
20
|
+
`)),this._prevFrame=t;return}}this.output.write(M.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function ce(t,e){if(t===void 0||e.length===0)return 0;let s=e.findIndex(i=>i.value===t);return s!==-1?s:0}function he(t,e){return(e.label??String(e.value)).toLowerCase().includes(t.toLowerCase())}function pe(t,e){if(e)return t?e:e[0]}var At=class extends z{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#i="";#e;#s;#r;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return at(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let t=this.userInput.slice(0,this._cursor),[e,...s]=this.userInput.slice(this._cursor);return`${t}${at("inverse",e)}${s.join("")}`}get options(){return typeof this.#s=="function"?this.#s():this.#s}constructor(t){super(t),this.#s=t.options,this.#r=t.placeholder;let e=this.options;this.filteredOptions=[...e],this.multiple=t.multiple===!0,this.#e=typeof t.options=="function"?t.filter:t.filter??he;let s;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?s=t.initialValue:s=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(let i of s){let r=e.findIndex(o=>o.value===i);r!==-1&&(this.toggleSelected(i),this.#t=r)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(i,r)=>this.#n(i,r)),this.on("userInput",i=>this.#o(i))}_isActionKey(t,e){return t===" "||this.multiple&&this.isNavigating&&e.name==="space"&&t!==void 0&&t!==""}#n(t,e){let s=e.name==="up",i=e.name==="down",r=e.name==="return",o=this.userInput===""||this.userInput===" ",n=this.#r,a=this.options,l=n!==void 0&&n!==""&&a.some(h=>!h.disabled&&(this.#e?this.#e(n,h):!0));if(e.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(n,!0),this.isNavigating=!1;return}s||i?(this.#t=L(this.#t,s?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):r?this.value=pe(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(e.name==="tab"||this.isNavigating&&e.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(t){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(t)?this.selectedValues=this.selectedValues.filter(e=>e!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#o(t){if(t!==this.#i){this.#i=t;let e=this.options;t&&this.#e?this.filteredOptions=e.filter(r=>this.#e?.(t,r)):this.filteredOptions=[...e];let s=ce(this.focusedValue,this.filteredOptions);this.#t=L(s,0,this.filteredOptions);let i=this.filteredOptions[this.#t];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},K=class extends z{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(M.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var H=class extends z{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let s=this.options.findIndex(({value:r})=>r===e.initialValue),i=s===-1?0:s;this.cursor=this.options[i].disabled?L(i,1,this.options):i,this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=L(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=L(this.cursor,1,this.options);break}this.changeValue()})}};var q=class extends z{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let s=e.slice(0,this.cursor),[i,...r]=e.slice(this.cursor);return`${s}${at("inverse",i)}${r.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as u,stripVTControlCharacters as es}from"node:util";import T from"node:process";var Ot=dt(ot(),1);function de(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var me=de();var m=(t,e)=>me?t:e,ge=m("\u25C6","*"),fe=m("\u25A0","x"),$e=m("\u25B2","x"),ve=m("\u25C7","o"),ns=m("\u250C","T"),g=m("\u2502","|"),W=m("\u2514","\u2014"),os=m("\u2510","T"),as=m("\u2518","\u2014"),ht=m("\u25CF",">"),Y=m("\u25CB"," "),us=m("\u25FB","[\u2022]"),ye=m("\u25FC","[+]"),Vt=m("\u25FB","[ ]"),ls=m("\u25AA","\u2022"),cs=m("\u2500","-"),hs=m("\u256E","+"),ps=m("\u251C","+"),ds=m("\u256F","+"),ms=m("\u2570","+"),gs=m("\u256D","+"),fs=m("\u25CF","\u2022"),$s=m("\u25C6","*"),vs=m("\u25B2","!"),ys=m("\u25A0","x"),X=t=>{switch(t){case"initial":case"active":return u("cyan",ge);case"cancel":return u("red",fe);case"error":return u("yellow",$e);case"submit":return u("green",ve)}},we=t=>{switch(t){case"initial":case"active":return u("cyan",g);case"cancel":return u("red",g);case"error":return u("yellow",g);case"submit":return u("green",g)}},Ft=(t,e,s,i,r,o=!1)=>{let n=e,a=0;if(o)for(let l=i-1;l>=s&&(n-=t[l].length,a++,!(n<=r));l--);else for(let l=s;l<i&&(n-=t[l].length,a++,!(n<=r));l++);return{lineCount:n,removals:a}},kt=({cursor:t,options:e,style:s,output:i=process.stdout,maxItems:r=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:n=4})=>{let a=lt(i)-o,l=ct(i),h=u("dim","..."),d=Math.max(l-n,0),c=Math.max(Math.min(r,d),5),p=0;t>=c-3&&(p=Math.max(Math.min(t-c+3,e.length-c),0));let v=c<e.length&&p>0,f=c<e.length&&p+c<e.length,$=Math.min(p+c,e.length),I=[],S=0;v&&S++,f&&S++;let P=p+(v?1:0),F=$-(f?1:0);for(let y=P;y<F;y++){let b=R(s(e[y],y===t),a,{hard:!0,trim:!1}).split(`
|
|
21
|
+
`);I.push(b),S+=b.length}if(S>d){let y=0,b=0,w=S,x=t-P,C=d,O=()=>Ft(I,w,0,x,C),E=()=>Ft(I,w,x+1,I.length,C,!0);v?({lineCount:w,removals:y}=O(),w>C&&(f||(C-=1),{lineCount:w,removals:b}=E())):(f||(C-=1),{lineCount:w,removals:b}=E(),w>C&&(C-=1,{lineCount:w,removals:y}=O())),y>0&&(v=!0,I.splice(0,y)),b>0&&(f=!0,I.splice(I.length-b,b))}let _=[];v&&_.push(h);for(let y of I)for(let b of y)_.push(b);return f&&_.push(h),_};function Ie(t,e){if(!t)return!0;let s=(e.label??String(e.value??"")).toLowerCase(),i=(e.hint??"").toLowerCase(),r=String(e.value).toLowerCase(),o=t.toLowerCase();return s.includes(o)||i.includes(o)||r.includes(o)}var Rt=t=>{let e=(i,r,o,n)=>{let a=o.includes(i.value),l=i.label??String(i.value??""),h=i.hint&&n!==void 0&&i.value===n?u("dim",` (${i.hint})`):"",d=a?u("green",ye):u("dim",Vt);return i.disabled?`${u("gray",Vt)} ${u(["strikethrough","gray"],l)}`:r?`${d} ${l}${h}`:`${d} ${u("dim",l)}`},s=new At({options:t.options,multiple:!0,placeholder:t.placeholder,filter:t.filter??((i,r)=>Ie(i,r)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){let i=t.withGuide??V.withGuide,r=`${i?`${u("gray",g)}
|
|
22
|
+
`:""}${X(this.state)} ${t.message}
|
|
23
|
+
`,o=this.userInput,n=t.placeholder,a=o===""&&n!==void 0,l=this.isNavigating||a?u("dim",a?n:o):this.userInputWithCursor,h=this.options,d=this.filteredOptions.length!==h.length?u("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${r}${i?`${u("gray",g)} `:""}${u("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${r}${i?`${u("gray",g)} `:""}${u(["strikethrough","dim"],o)}`;default:{let c=this.state==="error"?"yellow":"cyan",p=i?`${u(c,g)} `:"",v=i?u(c,W):"",f=[`${u("dim","\u2191/\u2193")} to navigate`,`${u("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${u("dim","Enter:")} confirm`,`${u("dim","Type:")} to search`],$=this.filteredOptions.length===0&&o?[`${p}${u("yellow","No matches found")}`]:[],I=this.state==="error"?[`${p}${u("yellow",this.error)}`]:[],S=[...`${r}${i?u(c,g):""}`.split(`
|
|
24
|
+
`),`${p}${u("dim","Search:")} ${l}${d}`,...$,...I],P=[`${p}${f.join(" \u2022 ")}`,v],F=kt({cursor:this.cursor,options:this.filteredOptions,style:(_,y)=>e(_,y,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:S.length+P.length});return[...S,...F.map(_=>`${p}${_}`),...P].join(`
|
|
25
|
+
`)}}}});return s.prompt()};var Lt=t=>{let e=t.active??"Yes",s=t.inactive??"No";return new K({active:e,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){let i=t.withGuide??V.withGuide,r=`${X(this.state)} `,o=i?`${u("gray",g)} `:"",n=G(t.output,t.message,o,r),a=`${i?`${u("gray",g)}
|
|
26
|
+
`:""}${n}
|
|
27
|
+
`,l=this.value?e:s;switch(this.state){case"submit":{let h=i?`${u("gray",g)} `:"";return`${a}${h}${u("dim",l)}`}case"cancel":{let h=i?`${u("gray",g)} `:"";return`${a}${h}${u(["strikethrough","dim"],l)}${i?`
|
|
28
|
+
${u("gray",g)}`:""}`}default:{let h=i?`${u("cyan",g)} `:"",d=i?u("cyan",W):"";return`${a}${h}${this.value?`${u("green",ht)} ${e}`:`${u("dim",Y)} ${u("dim",e)}`}${t.vertical?i?`
|
|
29
|
+
${u("cyan",g)} `:`
|
|
30
|
+
`:` ${u("dim","/")} `}${this.value?`${u("dim",Y)} ${u("dim",s)}`:`${u("green",ht)} ${s}`}
|
|
31
|
+
${d}
|
|
32
|
+
`}}}}).prompt()};var ws={light:m("\u2500","-"),heavy:m("\u2501","="),block:m("\u2588","#")};var J=(t,e)=>t.includes(`
|
|
33
|
+
`)?t.split(`
|
|
34
|
+
`).map(s=>e(s)).join(`
|
|
35
|
+
`):e(t),Dt=t=>{let e=(s,i)=>{let r=s.label??String(s.value);switch(i){case"disabled":return`${u("gray",Y)} ${J(r,o=>u("gray",o))}${s.hint?` ${u("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${J(r,o=>u("dim",o))}`;case"active":return`${u("green",ht)} ${r}${s.hint?` ${u("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${J(r,o=>u(["strikethrough","dim"],o))}`;default:return`${u("dim",Y)} ${J(r,o=>u("dim",o))}`}};return new H({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){let s=t.withGuide??V.withGuide,i=`${X(this.state)} `,r=`${we(this.state)} `,o=G(t.output,t.message,r,i),n=`${s?`${u("gray",g)}
|
|
36
|
+
`:""}${o}
|
|
37
|
+
`;switch(this.state){case"submit":{let a=s?`${u("gray",g)} `:"",l=G(t.output,e(this.options[this.cursor],"selected"),a);return`${n}${l}`}case"cancel":{let a=s?`${u("gray",g)} `:"",l=G(t.output,e(this.options[this.cursor],"cancelled"),a);return`${n}${l}${s?`
|
|
38
|
+
${u("gray",g)}`:""}`}default:{let a=s?`${u("cyan",g)} `:"",l=s?u("cyan",W):"",h=n.split(`
|
|
39
|
+
`).length,d=s?2:1;return`${n}${a}${kt({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:a.length,rowPadding:h+d,style:(c,p)=>e(c,c.disabled?"disabled":p?"active":"inactive")}).join(`
|
|
40
|
+
${a}`)}
|
|
41
|
+
${l}
|
|
42
|
+
`}}}}).prompt()};var Is=`${u("gray",g)} `;var Nt=t=>new q({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){let e=t?.withGuide??V.withGuide,s=`${`${e?`${u("gray",g)}
|
|
43
|
+
`:""}${X(this.state)} `}${t.message}
|
|
44
|
+
`,i=t.placeholder?u("inverse",t.placeholder[0])+u("dim",t.placeholder.slice(1)):u(["inverse","hidden"],"_"),r=this.userInput?this.userInputWithCursor:i,o=this.value??"";switch(this.state){case"error":{let n=this.error?` ${u("yellow",this.error)}`:"",a=e?`${u("yellow",g)} `:"",l=e?u("yellow",W):"";return`${s.trim()}
|
|
45
|
+
${a}${r}
|
|
46
|
+
${l}${n}
|
|
47
|
+
`}case"submit":{let n=o?` ${u("dim",o)}`:"",a=e?u("gray",g):"";return`${s}${a}${n}`}case"cancel":{let n=o?` ${u(["strikethrough","dim"],o)}`:"",a=e?u("gray",g):"";return`${s}${a}${n}${o.trim()?`
|
|
48
|
+
${a}`:""}`}default:{let n=e?`${u("cyan",g)} `:"",a=e?u("cyan",W):"";return`${s}${n}${r}
|
|
49
|
+
${a}
|
|
50
|
+
`}}}}).prompt();async function Z(t){let e=await Nt(t);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}async function Ps(t){if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);let e=await Lt(t);if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}async function _e(t){let e=await Dt(t);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}var xe=new Set(["__enter_manually__","__prev_page__","__next_page__","__search_again__"]),Gt=10;function Ts(t,e){if(xe.has(t))throw new N(`${e} uses a reserved internal prompt value. Choose or enter a different value.`)}async function Wt(t){let e={enterManually:"(Enter manually...)",previousPage:"\u2190 Previous page",nextPage:"Next page \u2192",searchAgain:"(Search / filter...)"},s=await _e({message:t.message,options:[...t.items.map(i=>({...i,value:{kind:"value",value:i.value,source:"option"}})),...t.controls.map(({control:i,label:r})=>({value:{kind:"control",control:i},label:r??e[i]}))]});return s.kind==="control"&&s.control==="enterManually"?{kind:"value",value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"}:s.kind==="control"?{kind:"control",control:s.control}:s}function As(t,e){return[...Array.isArray(e)?e:[],t]}async function Vs(t){let e=[...t.options.map(n=>({...n,value:{kind:"value",value:n.value}})),{value:{kind:"manual"},label:"(Enter a table name manually...)"}],s=await Rt({message:t.message,options:e,maxItems:t.maxItems??Gt,required:!0,filter:(n,a)=>{let l=n.toLowerCase(),h=a.value.kind==="value"?a.value.value:"";return[a.label??"",a.hint??"",h].some(d=>d.toLowerCase().includes(l))}});k(s)&&(D("Operation cancelled by user."),process.exit(0));let i=s,r=i.flatMap(n=>n.kind==="value"?[{value:n.value,source:"option"}]:[]);i.some(n=>n.kind==="manual")&&r.push({value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"});let o=new Map;for(let n of r)o.has(n.value)||o.set(n.value,n);return[...o.values()]}async function Fs(t){return(await Ce(t)).value}async function Ce(t){let e=t.pageSize??Gt,s=t.options;if(s.length<=e){let o=await jt(t.message,s,t.manualPromptMessage,!1);if(o.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:o.value,source:o.source}}let i="",r={kind:"control",control:"searchAgain"};for(;r.kind==="control"&&r.control==="searchAgain";){let o=i.toLowerCase(),n=i?s.filter(l=>l.label.toLowerCase().includes(o)||l.value.toLowerCase().includes(o)):s,a=i?` \u2014 filtering "${i}" (${n.length}/${s.length})`:` (${s.length} total)`;r=await Ee(`${t.message}${a}`,n,t.manualPromptMessage,e),r.kind==="control"&&r.control==="searchAgain"&&(i=await Z({message:"Filter (leave blank to show all):"}))}if(r.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:r.value,source:r.source}}async function Ee(t,e,s,i){if(e.length<=i)return jt(t,e,s,!0);let r=Math.ceil(e.length/i),o=0,n={kind:"control",control:"previousPage"};for(;n.kind==="control"&&(n.control==="previousPage"||n.control==="nextPage");){let a=o*i,l=e.slice(a,a+i),h=[];if(o>0&&h.push({control:"previousPage"}),o<r-1){let c=e.length-(a+i);h.push({control:"nextPage",label:`Next page \u2192 (${c} more)`})}h.push({control:"searchAgain"},{control:"enterManually"});let d=`${t} [page ${o+1}/${r}]`;n=await Wt({message:d,items:l,controls:h,manualPromptMessage:s}),n.kind==="control"&&n.control==="previousPage"?o--:n.kind==="control"&&n.control==="nextPage"&&o++}return n}async function jt(t,e,s,i){return Wt({message:t,items:e,controls:i?[{control:"searchAgain"},{control:"enterManually"}]:[{control:"enterManually"}],manualPromptMessage:s})}function Os(t){let{flags:e,env:s,message:i,initialValue:r,description:o,default:n}=t;return{flags:e,env:s,description:o,default:n,customPrompt:async()=>await Z({message:i,initialValue:r})}}function Me(t){let e=t.match(/\/environments\/([^/]+)\/?$/);return e?e[1]:t}function ks(){if(!et().appConfig)throw new N(`No ${j} found in the current directory. Run \`${"ms"} app create\` to scaffold an app, or run this command from an existing app directory.`)}async function Rs(t){let e=await t.getOption("app",!0),s=et().appConfig?.appId,i=e??s;if(!i)throw new N(`Argument app is required. Use --app to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return i}async function Ls(t,e={}){let{failIfMissing:s=!0}=e,i=e.overridesOnly?t.getEnvironmentId({overridesOnly:!0}):t.getEnvironmentId();if(!i){if(s)throw new N(`No environment ID found. Use --environment-id or -e to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return}return Me(i)}function Ds(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function Ns(t,e){switch(t){case"gcchigh":case"dod":return`https://login.microsoftonline.us/${e||"organizations"}`;case"mooncake":return`https://login.partner.microsoftonline.cn/${e||"organizations"}`;default:return`https://login.microsoftonline.com/${e||"organizations"}`}}export{Z as a,Ps as b,_e as c,Ts as d,As as e,Vs as f,Fs as g,Ce as h,Os as i,Me as j,ks as k,Rs as l,Ls as m,Ds as n,Ns as o};
|
|
51
|
+
/*!
|
|
52
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
53
|
+
*/
|
|
54
|
+
//# sourceMappingURL=chunk-GE3UFHZ5.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as p,b}from"./chunk-UT667QSU.js";var i=b((l,m)=>{var u=p("buffer"),e=u.Buffer;function a(r,f){for(var n in r)f[n]=r[n]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?m.exports=u:(a(u,l),l.Buffer=o);function o(r,f,n){return e(r,f,n)}o.prototype=Object.create(e.prototype);a(e,o);o.from=function(r,f,n){if(typeof r=="number")throw new TypeError("Argument must not be a number");return e(r,f,n)};o.alloc=function(r,f,n){if(typeof r!="number")throw new TypeError("Argument must be a number");var t=e(r);return f!==void 0?typeof n=="string"?t.fill(f,n):t.fill(f):t.fill(0),t};o.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return e(r)};o.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(r)}});export{i as a};
|
|
8
|
+
/*! Bundled license information:
|
|
9
|
+
|
|
10
|
+
safe-buffer/index.js:
|
|
11
|
+
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
12
|
+
*/
|
|
13
|
+
//# sourceMappingURL=chunk-HBLO3WDD.js.map
|