@microsoft/cmr-cli 0.32.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +37 -14
  2. package/THIRD-PARTY-NOTICES.txt +287 -30
  3. package/dist/Add-4RULNL6A.js +11 -0
  4. package/dist/AddConfig-D2DCR3JH.js +12 -0
  5. package/dist/AddConnector-5ZR5AF6H.js +19 -0
  6. package/dist/AddDeployment-7U4I5IC4.js +11 -0
  7. package/dist/AddDeploymentBinding-BZVRRZ7H.js +18 -0
  8. package/dist/AddRayfin-45ASHNIX.js +87 -0
  9. package/dist/Alter-36TSNZ4M.js +11 -0
  10. package/dist/{AuthStatus-WCZYGI5G.js → AuthStatus-W5ZHOAVD.js} +2 -2
  11. package/dist/AuthSwitch-7HRPTGEG.js +13 -0
  12. package/dist/Bin.js +1 -1
  13. package/dist/BuildMaafApp-TLQXOVQC.js +11 -0
  14. package/dist/Clear-X55BZKYF.js +11 -0
  15. package/dist/Cli-EEO7V3MZ.js +47 -0
  16. package/dist/CloneMaafApp-4EHW3HE2.js +12 -0
  17. package/dist/CreateMaafApp-VNXWCAP4.js +23 -0
  18. package/dist/CreateMaafProject-WVBNZPVL.js +11 -0
  19. package/dist/DeleteMaafApp-UGUKARMO.js +11 -0
  20. package/dist/DeployMaafApp-GJO567TK.js +8 -0
  21. package/dist/DeployMaafProject-4TSW2SFJ.js +11 -0
  22. package/dist/DeploymentApprovals-SZKNJT76.js +11 -0
  23. package/dist/Dev-ZD3L6WYY.js +15 -0
  24. package/dist/{EnvironmentVariableAuthenticationProvider-EBRBQ5I2.js → EnvironmentVariableAuthenticationProvider-EURTERVX.js} +2 -2
  25. package/dist/FeatureSettings-GG7JGFIY.js +11 -0
  26. package/dist/{GenerateCode-UQCHTRGP.js → GenerateCode-PNYC45SK.js} +2 -2
  27. package/dist/GetMaafBuildStatus-UTPVWF5L.js +11 -0
  28. package/dist/GetMaafProjectDeployStatus-PLK52YC4.js +12 -0
  29. package/dist/{GetSettings-MVVEXMJC.js → GetSettings-RLRDJEC7.js} +2 -2
  30. package/dist/InfoMaafApp-CTB6IPRU.js +13 -0
  31. package/dist/InfoMaafProject-TULH566X.js +11 -0
  32. package/dist/Init-TYWP2E6U.js +11 -0
  33. package/dist/ListConnectorActions-UQS6D4UN.js +11 -0
  34. package/dist/ListConnectors-OCDO64AT.js +11 -0
  35. package/dist/ListDeployments-PDLJ3IEI.js +11 -0
  36. package/dist/ListMaafApps-UAWTTCGB.js +11 -0
  37. package/dist/ListMaafProjects-T3Q2GEDX.js +11 -0
  38. package/dist/{ListSchema-QKVHVPHB.js → ListSchema-G673LK5Q.js} +2 -2
  39. package/dist/{ListSettings-IIA5OGMP.js → ListSettings-EXCK5ZS6.js} +2 -2
  40. package/dist/{Login-BT6UTPCZ.js → Login-XZATPT4L.js} +2 -2
  41. package/dist/{Logout-FBJE35Q5.js → Logout-2XM4IMZF.js} +2 -2
  42. package/dist/{MockFetch-LQLQGTNT.js → MockFetch-LW3KYEGC.js} +2 -2
  43. package/dist/NodeMsalAuthenticationProvider-ALMFNUEV.js +17 -0
  44. package/dist/Pack-RH4D4C7W.js +8 -0
  45. package/dist/PackProject-5DUWSBFA.js +14 -0
  46. package/dist/PlayMaafApp-5BXGXE6O.js +8 -0
  47. package/dist/ProjectApprovals-K3JF6D72.js +13 -0
  48. package/dist/ProjectRoleAssignments-7IUDEVBN.js +11 -0
  49. package/dist/RefreshDataSource-CMHDF2GP.js +11 -0
  50. package/dist/RefreshGitAuth-4TRO5IOQ.js +11 -0
  51. package/dist/Remove-KZD3SDDC.js +11 -0
  52. package/dist/{RemoveDataSource-RRND46QZ.js → RemoveDataSource-C7UXOUNH.js} +3 -3
  53. package/dist/RemoveDeployment-ZQJWQPD6.js +11 -0
  54. package/dist/ServicePrincipalAuthenticationProvider-3NPJTLF5.js +11 -0
  55. package/dist/SetSetting-3XO6HPG7.js +11 -0
  56. package/dist/{SetSetting-Q7EQNOTI.js → SetSetting-ZW7F43GC.js} +2 -2
  57. package/dist/ShareLinkCreate-JXPW5H7A.js +11 -0
  58. package/dist/ShareLinkList-ICYPRIQV.js +11 -0
  59. package/dist/ShareLinkRevoke-JVMQZF7K.js +11 -0
  60. package/dist/ShareList-YGSTFMVE.js +11 -0
  61. package/dist/ShareMaafApp-ZCY72WHK.js +11 -0
  62. package/dist/{TelemetrySettings-XCT73DEI.js → TelemetrySettings-P6WYWGW4.js} +2 -2
  63. package/dist/UnshareMaafApp-N4UR6Q4A.js +11 -0
  64. package/dist/{chunk-QLK3ZVWP.js → chunk-2SRFM7D6.js} +2 -2
  65. package/dist/chunk-3YCPXSCO.js +11 -0
  66. package/dist/chunk-45EZLDPE.js +147 -0
  67. package/dist/{chunk-2LKCCYRF.js → chunk-4PI5THLA.js} +2 -2
  68. package/dist/{chunk-TMYOZDLM.js → chunk-6KOL66SF.js} +2 -2
  69. package/dist/{chunk-2VJIWD7V.js → chunk-74RNALDY.js} +2 -2
  70. package/dist/{chunk-SIEI2EB5.js → chunk-7AEULMP2.js} +2 -2
  71. package/dist/chunk-7LAMG4KK.js +12 -0
  72. package/dist/chunk-A5INC5TY.js +11 -0
  73. package/dist/chunk-AICYZHWK.js +11 -0
  74. package/dist/chunk-B4NTYKGH.js +12 -0
  75. package/dist/chunk-BAQPANON.js +11 -0
  76. package/dist/{chunk-DKSLWH4O.js → chunk-BMOTNINY.js} +6 -6
  77. package/dist/{chunk-OUKOEUZA.js → chunk-C7UWPNC3.js} +1 -1
  78. package/dist/{chunk-Q3ONTUZ7.js → chunk-CLY3OASM.js} +2 -2
  79. package/dist/chunk-DLUQVMUE.js +11 -0
  80. package/dist/{chunk-KT2SUHGM.js → chunk-ENDUKF4E.js} +2 -2
  81. package/dist/{chunk-UEZV46GZ.js → chunk-FESGOCAP.js} +7 -7
  82. package/dist/{chunk-BRRT2E75.js → chunk-GO22IDEN.js} +6 -6
  83. package/dist/{chunk-WTTK2GTG.js → chunk-HHW4SKVU.js} +2 -2
  84. package/dist/{chunk-PEZMQ2A3.js → chunk-HZGDQAKA.js} +2 -2
  85. package/dist/{chunk-HSNRWBA6.js → chunk-IMVZRBSQ.js} +2 -2
  86. package/dist/chunk-K77VBHFP.js +12 -0
  87. package/dist/{chunk-DGUO74I3.js → chunk-KD4NQIYX.js} +3 -3
  88. package/dist/{chunk-3E7QQ2BR.js → chunk-KN66FSQK.js} +2 -2
  89. package/dist/{chunk-UXKJNXTZ.js → chunk-KPKJZKWW.js} +2 -2
  90. package/dist/chunk-NMZFJESU.js +12 -0
  91. package/dist/{chunk-PZIEJEF5.js → chunk-NNYOT7IR.js} +2 -2
  92. package/dist/{chunk-EFY2BSWB.js → chunk-OH3TCDCC.js} +2 -2
  93. package/dist/{chunk-XIX2O22O.js → chunk-OHQNTYJG.js} +2 -2
  94. package/dist/{chunk-KKC5ZK4D.js → chunk-PYPCPMCR.js} +21 -21
  95. package/dist/{chunk-ZB6MB7GZ.js → chunk-R2IECDVU.js} +3 -3
  96. package/dist/{chunk-ADRQC63G.js → chunk-RA74M3YD.js} +2 -2
  97. package/dist/{chunk-4XKA5APP.js → chunk-RSHOMYG6.js} +228 -227
  98. package/dist/chunk-UHNOINTO.js +11 -0
  99. package/dist/{chunk-4U53RYJJ.js → chunk-WS6TGUH7.js} +2 -2
  100. package/dist/{chunk-6EF722GY.js → chunk-XC7Y6E2C.js} +11 -11
  101. package/dist/chunk-XJXWNOJR.js +11 -0
  102. package/dist/chunk-Y2D37EFX.js +13 -0
  103. package/dist/{chunk-RFLXPXBN.js → chunk-YEWRCEPT.js} +2 -2
  104. package/dist/chunk-Z4UX3JOS.js +12 -0
  105. package/dist/chunk-ZBQT5XZJ.js +32 -0
  106. package/dist/chunk-ZGBTKTTU.js +11 -0
  107. package/dist/{chunk-GE3UFHZ5.js → chunk-ZLK2CMMJ.js} +23 -23
  108. package/dist/chunk-ZWJ5T5VI.js +11 -0
  109. package/dist/node-PLZPXPD7.js +29 -0
  110. package/dist/typescript-6OTSQQEW.js +458 -0
  111. package/package.json +5 -4
  112. package/dist/Add-FU57YE5G.js +0 -11
  113. package/dist/AddConfig-CI7KNLIG.js +0 -12
  114. package/dist/AddConnector-WH4IU3ND.js +0 -16
  115. package/dist/AddDeployment-GWFCPAL5.js +0 -11
  116. package/dist/AddDeploymentBinding-RFLI6DKH.js +0 -18
  117. package/dist/AddRayfin-VRCFEOIL.js +0 -38
  118. package/dist/Alter-JFFT5JOA.js +0 -11
  119. package/dist/AuthSwitch-XJMG7IUR.js +0 -13
  120. package/dist/BuildMaafApp-7AUZHYOQ.js +0 -11
  121. package/dist/Clear-7B7CDIPV.js +0 -11
  122. package/dist/Cli-XZ4SJKBZ.js +0 -47
  123. package/dist/CloneMaafApp-7W246RZA.js +0 -12
  124. package/dist/CreateMaafApp-6MSPHUU4.js +0 -22
  125. package/dist/CreateMaafProject-JKMF5TH3.js +0 -11
  126. package/dist/DeleteMaafApp-TFGWGJO3.js +0 -11
  127. package/dist/DeployMaafApp-K2APWFOD.js +0 -8
  128. package/dist/DeployMaafProject-6WRKGIIW.js +0 -11
  129. package/dist/DeploymentApprovals-WTXBXCKE.js +0 -11
  130. package/dist/Dev-CIEWFRXR.js +0 -15
  131. package/dist/FeatureSettings-77LZQSKD.js +0 -11
  132. package/dist/GetMaafBuildStatus-6ZSLIZCH.js +0 -11
  133. package/dist/GetMaafProjectDeployStatus-NZEMVQGJ.js +0 -12
  134. package/dist/InfoMaafApp-7Z6OJCHD.js +0 -13
  135. package/dist/InfoMaafProject-SQYB736C.js +0 -11
  136. package/dist/Init-PBH2IXVK.js +0 -11
  137. package/dist/ListConnectorActions-UERYZ2C7.js +0 -11
  138. package/dist/ListConnectors-2FUTJMHY.js +0 -11
  139. package/dist/ListDeployments-4YWCHVKF.js +0 -11
  140. package/dist/ListMaafApps-ZATO77G3.js +0 -11
  141. package/dist/ListMaafProjects-GNUXZSYL.js +0 -11
  142. package/dist/NodeMsalAuthenticationProvider-5TJFMHR4.js +0 -17
  143. package/dist/Pack-TSFHSTB5.js +0 -8
  144. package/dist/PackProject-T575KJQ4.js +0 -14
  145. package/dist/PlayMaafApp-74TQEAO5.js +0 -8
  146. package/dist/ProjectApprovals-5KLYEM7V.js +0 -13
  147. package/dist/ProjectRoleAssignments-AI2FQ2VX.js +0 -11
  148. package/dist/RefreshDataSource-VARFN3IV.js +0 -11
  149. package/dist/RefreshGitAuth-DC5NAZBJ.js +0 -11
  150. package/dist/Remove-MCQZVI3K.js +0 -11
  151. package/dist/RemoveDeployment-STNFNNZF.js +0 -11
  152. package/dist/ServicePrincipalAuthenticationProvider-7RBHTYYY.js +0 -11
  153. package/dist/SetSetting-CEH44OT3.js +0 -11
  154. package/dist/ShareLinkCreate-ZUVHUQLH.js +0 -11
  155. package/dist/ShareLinkList-IEYU6NZW.js +0 -11
  156. package/dist/ShareLinkRevoke-22RFGOFJ.js +0 -11
  157. package/dist/ShareList-6UWIHPBM.js +0 -11
  158. package/dist/ShareMaafApp-SFNOOMOD.js +0 -11
  159. package/dist/UnshareMaafApp-TU7U3LQ3.js +0 -11
  160. package/dist/chunk-2LDU3F6O.js +0 -11
  161. package/dist/chunk-5MHBEEMZ.js +0 -11
  162. package/dist/chunk-A4PVXTJS.js +0 -13
  163. package/dist/chunk-BA52TY55.js +0 -12
  164. package/dist/chunk-FHE3OXIP.js +0 -11
  165. package/dist/chunk-HOIFXUTG.js +0 -11
  166. package/dist/chunk-NYPHWF7Q.js +0 -32
  167. package/dist/chunk-PLFDUGBA.js +0 -12
  168. package/dist/chunk-RDXQ3ZPT.js +0 -11
  169. package/dist/chunk-TXMTKOEJ.js +0 -12
  170. package/dist/chunk-WV7D7PTW.js +0 -12
  171. package/dist/chunk-WWVAS3DS.js +0 -11
  172. package/dist/chunk-YRPTITKD.js +0 -12
  173. package/dist/rayfin-pack-HOUOLOHQ.js +0 -164
@@ -4,14 +4,14 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{A as B,u as v,w as R,x as $,y as L,z as h}from"./chunk-4XKA5APP.js";import{o as _}from"./chunk-FHE3OXIP.js";import{f as D,j as F}from"./chunk-OUKOEUZA.js";import{I}from"./chunk-KKC5ZK4D.js";function C(e){try{return new URL(e).host}catch{return e}}function fe(e,t,i){t||I(`Authenticating to ${C(e)} for ${i}. A browser window may open. Sign in with the account associated with this tenant.`)}import{execFileSync as P}from"child_process";var j=[{patterns:[/403 forbidden/i,/returned error: 403/i,/remote:.*access denied/i],bucket:"auth-403",retryable:!1,errorCode:"GitAccessDenied",build:e=>`Git reached the remote but access was denied while ${e} (HTTP 403). This usually means one of:
7
+ import{A as h,B as L,v,x as R,y as I,z as $}from"./chunk-RSHOMYG6.js";import{o as F}from"./chunk-DLUQVMUE.js";import{f as B,j as D}from"./chunk-C7UWPNC3.js";import{N as _}from"./chunk-PYPCPMCR.js";function C(e){try{return new URL(e).host}catch{return e}}function fe(e,t,i){t||_(`Authenticating to ${C(e)} for ${i}. A browser window may open. Sign in with the account associated with this tenant.`)}import{execFileSync as P}from"child_process";var j=[{patterns:[/403 forbidden/i,/returned error: 403/i,/remote:.*access denied/i],bucket:"auth-403",retryable:!1,errorCode:"GitAccessDenied",build:e=>`Git reached the remote but access was denied while ${e} (HTTP 403). This usually means one of:
8
8
  - the signed-in account is in the wrong tenant, or lacks permission to this app's repo; or
9
9
  - Git Credential Manager returned a cached credential for a different account than your current 'ms auth' sign-in (a stale or mismatched credential).
10
- Confirm 'ms auth status' shows the account and tenant for this environment. If it doesn't match, clear the cached git credential for the host ('git credential-manager erase', or remove it from your OS credential store) so Git re-prompts, then re-run.`},{patterns:[/terminal prompts disabled/i,/could not read username/i,/could not read password/i],bucket:"auth-prompt-unavailable",retryable:!1,errorCode:"GitCredentialPromptUnavailable",build:e=>`Git could not obtain a credential while ${e}: there is no cached credential and the session can't prompt for one. Make sure Git Credential Manager is installed, then re-run in an interactive terminal so the browser sign-in can complete.`},{patterns:[/authentication failed/i,/invalid username or password/i],bucket:"auth-invalid-credential",retryable:!0,errorCode:"GitAuthenticationFailed",build:e=>`Git authentication failed while ${e}: the credential was missing, invalid, or expired. When the browser opens, sign in with the account for this environment's tenant; if a stale credential is cached, clear it in Git Credential Manager and re-run.`}],W=[/could not resolve host/i,/failed to connect/i,/connection timed out/i,/operation timed out after \d+ milliseconds/i,/connection refused/i,/network is unreachable/i,/temporary failure in name resolution/i,/recv failure: connection was reset/i,/connection reset by peer/i,/requested url returned error: 50[234]/i],Y=[/ssl certificate problem/i,/certificate verify failed/i,/server certificate verification failed/i,/unable to get local issuer certificate/i,/schannel:.*certificate/i,/peer certificate cannot be authenticated/i,/ssl peer certificate or ssh remote key was not ok/i,/problem with the ssl ca cert/i],X=[/could not resolve proxy/i,/failed to connect to .* proxy/i,/failed to connect to \S*proxy\S*/i,/proxy authentication required/i,/received http code 407 from proxy/i],q=[/could not create work tree dir/i,/destination path .* already exists/i,/permission denied/i,/access(?: is)? denied/i,/unable to create (?:file|directory)/i,/unable to write new index file/i,/invalid path/i,/filename too long/i,/no space left on device/i,/read-only file system/i];function J(e,t){if(typeof e!="object"||e===null)return null;let{code:i,errno:r}=e,n={action:t.action};return i==="ENOENT"?new h(`Git could not be started while ${t.action} because the executable was not found. Install Git and make sure 'git' is available on PATH, then retry.`,{...n,classifierBucket:"process-not-found"},{errorCode:"GitProcessNotFound",retryable:!1,telemetryDetails:{classifierBucket:"process-not-found"}}):i==="EACCES"?new h(`Git could not be started while ${t.action} because the executable is not permitted to run. Check the Git executable's permissions and your endpoint security policy, then retry.`,{...n,classifierBucket:"process-access-denied"},{errorCode:"GitProcessAccessDenied",retryable:!1,telemetryDetails:{classifierBucket:"process-access-denied"}}):i==="EBADARCH"||r===86||r===-86?new h(`Git could not be started while ${t.action} because the executable is incompatible with this Mac. Install a Git build for this Mac's architecture, then retry.`,{...n,classifierBucket:"process-bad-architecture"},{errorCode:"GitProcessBadArchitecture",retryable:!1,telemetryDetails:{classifierBucket:"process-bad-architecture"}}):null}function K(e){return e.replace(/(\b[a-z][a-z0-9+.-]*:\/\/)[^/\s@]+@/gi,"$1[REDACTED]@")}function b(e,t,i){let r=J(i,t);if(r)return r;let n=K(e.trimEnd());if(!n)return null;for(let o of j)if(o.patterns.some(u=>u.test(n)))return new L(o.build(t.action),{classifierBucket:o.bucket,action:t.action},{errorCode:o.errorCode,retryable:o.retryable,telemetryDetails:{classifierBucket:o.bucket}});return Y.some(o=>o.test(n))?new h(`Git could not establish a trusted TLS connection while ${t.action}. Check the system clock, certificate trust store, and any corporate TLS inspection configuration. The CLI will not disable certificate verification.`,{classifierBucket:"tls-certificate",action:t.action},{errorCode:"GitTlsCertificateError",retryable:!1,telemetryDetails:{classifierBucket:"tls-certificate"}}):X.some(o=>o.test(n))?new h(`Git could not use the configured proxy while ${t.action}. Check Git and system proxy settings, including proxy authentication, then retry.`,{classifierBucket:"proxy-configuration",action:t.action},{errorCode:"GitProxyConfigurationError",retryable:!1,telemetryDetails:{classifierBucket:"proxy-configuration"}}):q.some(o=>o.test(n))?new h(`Git could not write the local repository while ${t.action}. Check that the target directory is empty and writable, that its path is supported by Git, and that sufficient disk space is available.`,{classifierBucket:"local-filesystem",action:t.action},{errorCode:"GitFilesystemError",retryable:!1,telemetryDetails:{classifierBucket:"local-filesystem"}}):W.some(o=>o.test(n))?new B(`Git could not reach the remote while ${t.action}. Check your network connection (and proxy settings, if any) and try again.`,{classifierBucket:"network",action:t.action},{errorCode:"GitNetworkError",retryable:!0,telemetryDetails:{classifierBucket:"network"}}):null}function M(e){return e?.retryable===!0}function S(e){return e==null?"":Buffer.isBuffer(e)?e.toString():e}var Q=64*1024*1024,T=[2,31,0];function Z(){try{let t=P("git",["--version"],{stdio:["ignore","pipe","ignore"],encoding:"utf8"}).match(/git version (\d+)\.(\d+)(?:\.(\d+))?/);if(!t)return!0;let i=[Number(t[1]),Number(t[2]),Number(t[3]??0)];for(let r=0;r<T.length;r++)if(i[r]!==T[r])return i[r]>T[r];return!0}catch{return!0}}function ee(e,t){let i=t?.filter(o=>o.length>0);if(!i?.length)return{args:[...e]};if(!Z())return{args:[...i.flatMap(o=>["-c",`http.extraHeader=${o}`]),...e]};let r=Number(D("GIT_CONFIG_COUNT")??"0");if(!Number.isSafeInteger(r)||r<0)throw new Error("GIT_CONFIG_COUNT must be a non-negative integer.");let n=F();for(let[o,u]of i.entries()){let a=r+o;n[`GIT_CONFIG_KEY_${a}`]="http.extraHeader",n[`GIT_CONFIG_VALUE_${a}`]=u}return n.GIT_CONFIG_COUNT=String(r+i.length),{args:[...e],env:n}}function m(e,t={}){let{cwd:i,allowFailure:r=!1,captureStdout:n=!1,emitStderr:o=!0,classify:u,network:a=!1,httpExtraHeaders:s}=t,d=a&&!u&&!r,f=ee(e,s);try{let l=P("git",f.args,{cwd:i,stdio:["ignore",n?"pipe":"ignore",d?"inherit":"pipe"],maxBuffer:Q,env:f.env});return{success:!0,status:0,stdout:n?S(l):"",stderr:""}}catch(l){let g=l,y=S(g.stderr);if(u&&!r){let E=y||S(g.stdout)||(l instanceof Error?l.message:String(l)),G=b(E,u,l);if(G)throw G}if(o&&y&&process.stderr.write(y),!r)throw l;return{success:!1,status:typeof g.status=="number"?g.status:null,stdout:S(g.stdout),stderr:y,error:l instanceof Error?l:new Error(String(l))}}}import{execFileSync as w}from"child_process";import*as c from"fs";import*as p from"path";function U({gitUrl:e,loginAuthority:t,authResource:i,platform:r=process.platform}){let n;try{n=new URL(e)}catch(d){throw new Error(`Git credential helper setup requires a valid HTTPS remote URL: ${d instanceof Error?d.message:String(d)}`)}if(n.protocol!=="https:")throw new Error(`Git credential helper setup requires an HTTPS remote URL, got '${n.protocol}'.`);let o=n.host,u=`${t}/oauth2/v2.0`,a=`credential.https://${o}`,s=[[`${a}.oauthAuthorizeEndpoint`,`${u}/authorize?prompt=select_account`],[`${a}.oauthTokenEndpoint`,`${u}/token`],[`${a}.oauthDeviceEndpoint`,`${u}/devicecode`],[`${a}.oauthClientId`,_],[`${a}.oauthScopes`,`${i}/.default offline_access`],[`${a}.oauthRedirectUri`,"http://localhost"]];return r==="win32"&&s.push([`${a}.credentialStore`,"dpapi"]),s}var te=/^[0-9a-f]{4,39}$/i;function xe(){let e=m(["rev-parse","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!e.success)return null;let t=m(["rev-parse","--abbrev-ref","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!t.success)return null;let i=e.stdout.trim(),r=t.stdout.trim();return{branch:r,commitSha:i,detached:r==="HEAD"}}function Ne(e,t){if(!t||!te.test(e))return e;let i=m(["rev-parse","--verify","--end-of-options",`${e}^{commit}`],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),r=i.stdout.trim();if(!i.success||!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(r))throw new $("The abbreviated --commit value could not be resolved to a unique commit in the current Git repository. Use a full commit SHA, or run this command from the repository that contains the commit.");return r}function Oe(){let e=m(["config","--get","remote.origin.url"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(e.success)return e.stdout.trim()||void 0}var re=["https://","ssh://","git@"],ie=["-c","http.sslVersion=tlsv1.3"];function ne(e){return re.some(t=>e.startsWith(t))&&e.trim()===e&&!e.startsWith("-")&&!/[\r\n\0]/.test(e)}function O(e){return e.replace(/:\/\/[^\s/]+@/g,"://[REDACTED]@")}function Ae(e,t=process.cwd()){try{return e!==void 0&&!ne(e)?{success:!1,error:"Unsafe git remote URL."}:(A({remoteUrl:e,cwd:t}),{success:!0})}catch(i){return{success:!1,error:O(i instanceof Error?i.message:String(i))}}}function oe({directory:e,gitUrl:t,loginAuthority:i,authResource:r,emitRemoteError:n=!0}){let o=V({gitUrl:t,loginAuthority:i,authResource:r});A({remoteUrl:t,cwd:e,createDirectory:!0,initialBranch:"main",localConfig:o,updateExistingRemote:!0,emitRemoteError:n,skipInitIfRepoExists:!0})}function Ie(e,t,i,r,n=!0){let o=[...ie,"fetch","origin",...i?[i]:[]];m(o,{cwd:e,network:!0,allowFailure:!0,emitStderr:!1,httpExtraHeaders:r}).success||m(o,{cwd:e,network:!0,classify:{action:`fetching from ${C(t)}`},emitStderr:n,httpExtraHeaders:r})}function $e({directory:e,gitUrl:t,loginAuthority:i,authResource:r,onProgress:n}){let o=V({gitUrl:t,loginAuthority:i,authResource:r}),a=[...o.flatMap(([g,y])=>["-c",`${g}=${y}`]),"-c","http.sslVersion=tlsv1.3","clone","--",t],s=ce(e);n?.(`Cloning platform-managed repository into temporary folder '${s}'...`);let d=m([...a,s],{network:!0,allowFailure:!0,emitStderr:!1});if(!d.success){let g=`cloning from ${C(t)}`,y=b(d.stderr||d.stdout||d.error.message,{action:g},d.error);if(H(s,d,t),!M(y))throw y??k(g);n?.("Retrying platform-managed repository clone...");let E=m([...a,s],{network:!0,allowFailure:!0,emitStderr:!1});if(!E.success){let G=b(E.stderr||E.stdout||E.error.message,{action:g},E.error);throw H(s,E,t),G??k(g)}}n?.("Saving Git Credential Manager configuration...");let f;try{A({cwd:s,localConfig:o,skipInitIfRepoExists:!0})}catch{f="the repository-local Git configuration could not be updated"}n?.(`Moving cloned repository into '${p.resolve(e)}'...`);let l=le(s,e);return{configPersisted:f===void 0,...f?{configError:f}:{},...l?{cleanupWarning:l}:{}}}function H(e,t,i){try{c.rmSync(e,{recursive:!0,force:!0})}catch{throw se({cloneStderr:t.stderr||t.stdout||t.error.message,cloneError:t.error,gitUrl:i})}}function k(e){return new R(`Git failed while ${e}. The failure was not recognized as safely retryable, so the CLI did not retry it. Check the target directory, Git configuration, and network settings, then run the command again.`,v.GeneralError,{classifierBucket:"unclassified",action:e},{errorCode:"GitCloneUnclassified",retryable:!1,telemetryDetails:{classifierBucket:"unclassified"}})}function se({cloneStderr:e,cloneError:t,gitUrl:i}){let r=`cloning from ${C(i)}`,n=b(e,{action:r},t),o=n?.message??k(r).message;return new R(`Git clone failed, and the CLI could not remove its temporary clone storage safely. Close any process using Git files, remove the '.ms-clone-*' directory beside the target directory, and run the command again.
10
+ Confirm 'ms auth status' shows the account and tenant for this environment. If it doesn't match, clear the cached git credential for the host ('git credential-manager erase', or remove it from your OS credential store) so Git re-prompts, then re-run.`},{patterns:[/terminal prompts disabled/i,/could not read username/i,/could not read password/i],bucket:"auth-prompt-unavailable",retryable:!1,errorCode:"GitCredentialPromptUnavailable",build:e=>`Git could not obtain a credential while ${e}: there is no cached credential and the session can't prompt for one. Make sure Git Credential Manager is installed, then re-run in an interactive terminal so the browser sign-in can complete.`},{patterns:[/authentication failed/i,/invalid username or password/i],bucket:"auth-invalid-credential",retryable:!0,errorCode:"GitAuthenticationFailed",build:e=>`Git authentication failed while ${e}: the credential was missing, invalid, or expired. When the browser opens, sign in with the account for this environment's tenant; if a stale credential is cached, clear it in Git Credential Manager and re-run.`}],W=[/could not resolve host/i,/failed to connect/i,/connection timed out/i,/operation timed out after \d+ milliseconds/i,/connection refused/i,/network is unreachable/i,/temporary failure in name resolution/i,/recv failure: connection was reset/i,/connection reset by peer/i,/requested url returned error: 50[234]/i],Y=[/ssl certificate problem/i,/certificate verify failed/i,/server certificate verification failed/i,/unable to get local issuer certificate/i,/schannel:.*certificate/i,/peer certificate cannot be authenticated/i,/ssl peer certificate or ssh remote key was not ok/i,/problem with the ssl ca cert/i],X=[/could not resolve proxy/i,/failed to connect to .* proxy/i,/failed to connect to \S*proxy\S*/i,/proxy authentication required/i,/received http code 407 from proxy/i],q=[/could not create work tree dir/i,/destination path .* already exists/i,/permission denied/i,/access(?: is)? denied/i,/unable to create (?:file|directory)/i,/unable to write new index file/i,/invalid path/i,/filename too long/i,/no space left on device/i,/read-only file system/i];function J(e,t){if(typeof e!="object"||e===null)return null;let{code:i,errno:r}=e,n={action:t.action};return i==="ENOENT"?new h(`Git could not be started while ${t.action} because the executable was not found. Install Git and make sure 'git' is available on PATH, then retry.`,{...n,classifierBucket:"process-not-found"},{errorCode:"GitProcessNotFound",retryable:!1,telemetryDetails:{classifierBucket:"process-not-found"}}):i==="EACCES"?new h(`Git could not be started while ${t.action} because the executable is not permitted to run. Check the Git executable's permissions and your endpoint security policy, then retry.`,{...n,classifierBucket:"process-access-denied"},{errorCode:"GitProcessAccessDenied",retryable:!1,telemetryDetails:{classifierBucket:"process-access-denied"}}):i==="EBADARCH"||r===86||r===-86?new h(`Git could not be started while ${t.action} because the executable is incompatible with this Mac. Install a Git build for this Mac's architecture, then retry.`,{...n,classifierBucket:"process-bad-architecture"},{errorCode:"GitProcessBadArchitecture",retryable:!1,telemetryDetails:{classifierBucket:"process-bad-architecture"}}):null}function K(e){return e.replace(/(\b[a-z][a-z0-9+.-]*:\/\/)[^/\s@]+@/gi,"$1[REDACTED]@")}function b(e,t,i){let r=J(i,t);if(r)return r;let n=K(e.trimEnd());if(!n)return null;for(let o of j)if(o.patterns.some(u=>u.test(n)))return new $(o.build(t.action),{classifierBucket:o.bucket,action:t.action},{errorCode:o.errorCode,retryable:o.retryable,telemetryDetails:{classifierBucket:o.bucket}});return Y.some(o=>o.test(n))?new h(`Git could not establish a trusted TLS connection while ${t.action}. Check the system clock, certificate trust store, and any corporate TLS inspection configuration. The CLI will not disable certificate verification.`,{classifierBucket:"tls-certificate",action:t.action},{errorCode:"GitTlsCertificateError",retryable:!1,telemetryDetails:{classifierBucket:"tls-certificate"}}):X.some(o=>o.test(n))?new h(`Git could not use the configured proxy while ${t.action}. Check Git and system proxy settings, including proxy authentication, then retry.`,{classifierBucket:"proxy-configuration",action:t.action},{errorCode:"GitProxyConfigurationError",retryable:!1,telemetryDetails:{classifierBucket:"proxy-configuration"}}):q.some(o=>o.test(n))?new h(`Git could not write the local repository while ${t.action}. Check that the target directory is empty and writable, that its path is supported by Git, and that sufficient disk space is available.`,{classifierBucket:"local-filesystem",action:t.action},{errorCode:"GitFilesystemError",retryable:!1,telemetryDetails:{classifierBucket:"local-filesystem"}}):W.some(o=>o.test(n))?new L(`Git could not reach the remote while ${t.action}. Check your network connection (and proxy settings, if any) and try again.`,{classifierBucket:"network",action:t.action},{errorCode:"GitNetworkError",retryable:!0,telemetryDetails:{classifierBucket:"network"}}):null}function M(e){return e?.retryable===!0}function S(e){return e==null?"":Buffer.isBuffer(e)?e.toString():e}var Q=64*1024*1024,T=[2,31,0];function Z(){try{let t=P("git",["--version"],{stdio:["ignore","pipe","ignore"],encoding:"utf8"}).match(/git version (\d+)\.(\d+)(?:\.(\d+))?/);if(!t)return!0;let i=[Number(t[1]),Number(t[2]),Number(t[3]??0)];for(let r=0;r<T.length;r++)if(i[r]!==T[r])return i[r]>T[r];return!0}catch{return!0}}function ee(e,t){let i=t?.filter(o=>o.length>0);if(!i?.length)return{args:[...e]};if(!Z())return{args:[...i.flatMap(o=>["-c",`http.extraHeader=${o}`]),...e]};let r=Number(B("GIT_CONFIG_COUNT")??"0");if(!Number.isSafeInteger(r)||r<0)throw new Error("GIT_CONFIG_COUNT must be a non-negative integer.");let n=D();for(let[o,u]of i.entries()){let a=r+o;n[`GIT_CONFIG_KEY_${a}`]="http.extraHeader",n[`GIT_CONFIG_VALUE_${a}`]=u}return n.GIT_CONFIG_COUNT=String(r+i.length),{args:[...e],env:n}}function m(e,t={}){let{cwd:i,allowFailure:r=!1,captureStdout:n=!1,emitStderr:o=!0,classify:u,network:a=!1,httpExtraHeaders:s}=t,d=a&&!u&&!r,f=ee(e,s);try{let l=P("git",f.args,{cwd:i,stdio:["ignore",n?"pipe":"ignore",d?"inherit":"pipe"],maxBuffer:Q,env:f.env});return{success:!0,status:0,stdout:n?S(l):"",stderr:""}}catch(l){let g=l,y=S(g.stderr);if(u&&!r){let E=y||S(g.stdout)||(l instanceof Error?l.message:String(l)),G=b(E,u,l);if(G)throw G}if(o&&y&&process.stderr.write(y),!r)throw l;return{success:!1,status:typeof g.status=="number"?g.status:null,stdout:S(g.stdout),stderr:y,error:l instanceof Error?l:new Error(String(l))}}}import{execFileSync as w}from"child_process";import*as c from"fs";import*as p from"path";function U({gitUrl:e,loginAuthority:t,authResource:i,platform:r=process.platform}){let n;try{n=new URL(e)}catch(d){throw new Error(`Git credential helper setup requires a valid HTTPS remote URL: ${d instanceof Error?d.message:String(d)}`)}if(n.protocol!=="https:")throw new Error(`Git credential helper setup requires an HTTPS remote URL, got '${n.protocol}'.`);let o=n.host,u=`${t}/oauth2/v2.0`,a=`credential.https://${o}`,s=[[`${a}.oauthAuthorizeEndpoint`,`${u}/authorize?prompt=select_account`],[`${a}.oauthTokenEndpoint`,`${u}/token`],[`${a}.oauthDeviceEndpoint`,`${u}/devicecode`],[`${a}.oauthClientId`,F],[`${a}.oauthScopes`,`${i}/.default offline_access`],[`${a}.oauthRedirectUri`,"http://localhost"]];return r==="win32"&&s.push([`${a}.credentialStore`,"dpapi"]),s}var te=/^[0-9a-f]{4,39}$/i;function xe(){let e=m(["rev-parse","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!e.success)return null;let t=m(["rev-parse","--abbrev-ref","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!t.success)return null;let i=e.stdout.trim(),r=t.stdout.trim();return{branch:r,commitSha:i,detached:r==="HEAD"}}function Ne(e,t){if(!t||!te.test(e))return e;let i=m(["rev-parse","--verify","--end-of-options",`${e}^{commit}`],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),r=i.stdout.trim();if(!i.success||!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(r))throw new I("The abbreviated --commit value could not be resolved to a unique commit in the current Git repository. Use a full commit SHA, or run this command from the repository that contains the commit.");return r}function Oe(){let e=m(["config","--get","remote.origin.url"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(e.success)return e.stdout.trim()||void 0}var re=["https://","ssh://","git@"],ie=["-c","http.sslVersion=tlsv1.3"];function ne(e){return re.some(t=>e.startsWith(t))&&e.trim()===e&&!e.startsWith("-")&&!/[\r\n\0]/.test(e)}function O(e){return e.replace(/:\/\/[^\s/]+@/g,"://[REDACTED]@")}function Ae(e,t=process.cwd()){try{return e!==void 0&&!ne(e)?{success:!1,error:"Unsafe git remote URL."}:(A({remoteUrl:e,cwd:t}),{success:!0})}catch(i){return{success:!1,error:O(i instanceof Error?i.message:String(i))}}}function oe({directory:e,gitUrl:t,loginAuthority:i,authResource:r,emitRemoteError:n=!0}){let o=V({gitUrl:t,loginAuthority:i,authResource:r});A({remoteUrl:t,cwd:e,createDirectory:!0,initialBranch:"main",localConfig:o,updateExistingRemote:!0,emitRemoteError:n,skipInitIfRepoExists:!0})}function Ie(e,t,i,r,n=!0){let o=[...ie,"fetch","origin",...i?[i]:[]];m(o,{cwd:e,network:!0,allowFailure:!0,emitStderr:!1,httpExtraHeaders:r}).success||m(o,{cwd:e,network:!0,classify:{action:`fetching from ${C(t)}`},emitStderr:n,httpExtraHeaders:r})}function $e({directory:e,gitUrl:t,loginAuthority:i,authResource:r,onProgress:n}){let o=V({gitUrl:t,loginAuthority:i,authResource:r}),a=[...o.flatMap(([g,y])=>["-c",`${g}=${y}`]),"-c","http.sslVersion=tlsv1.3","clone","--",t],s=ce(e);n?.(`Cloning platform-managed repository into temporary folder '${s}'...`);let d=m([...a,s],{network:!0,allowFailure:!0,emitStderr:!1});if(!d.success){let g=`cloning from ${C(t)}`,y=b(d.stderr||d.stdout||d.error.message,{action:g},d.error);if(H(s,d,t),!M(y))throw y??k(g);n?.("Retrying platform-managed repository clone...");let E=m([...a,s],{network:!0,allowFailure:!0,emitStderr:!1});if(!E.success){let G=b(E.stderr||E.stdout||E.error.message,{action:g},E.error);throw H(s,E,t),G??k(g)}}n?.("Saving Git Credential Manager configuration...");let f;try{A({cwd:s,localConfig:o,skipInitIfRepoExists:!0})}catch{f="the repository-local Git configuration could not be updated"}n?.(`Moving cloned repository into '${p.resolve(e)}'...`);let l=le(s,e);return{configPersisted:f===void 0,...f?{configError:f}:{},...l?{cleanupWarning:l}:{}}}function H(e,t,i){try{c.rmSync(e,{recursive:!0,force:!0})}catch{throw se({cloneStderr:t.stderr||t.stdout||t.error.message,cloneError:t.error,gitUrl:i})}}function k(e){return new R(`Git failed while ${e}. The failure was not recognized as safely retryable, so the CLI did not retry it. Check the target directory, Git configuration, and network settings, then run the command again.`,v.GeneralError,{classifierBucket:"unclassified",action:e},{errorCode:"GitCloneUnclassified",retryable:!1,telemetryDetails:{classifierBucket:"unclassified"}})}function se({cloneStderr:e,cloneError:t,gitUrl:i}){let r=`cloning from ${C(i)}`,n=b(e,{action:r},t),o=n?.message??k(r).message;return new R(`Git clone failed, and the CLI could not remove its temporary clone storage safely. Close any process using Git files, remove the '.ms-clone-*' directory beside the target directory, and run the command again.
11
11
 
12
12
  Original clone failure:
13
13
  ${o}`,n?.exitCode??v.GeneralError,{...n?.errorData,cleanupFailed:!0},{errorCode:"GitCloneCleanupFailed",retryable:!1,telemetryDetails:{classifierBucket:n?.telemetryDetails?.classifierBucket??"unclassified",cleanupFailed:!0}})}var ae=new Set(["EACCES","EBUSY","EEXIST","EIO","EINVAL","EISDIR","ELOOP","EMFILE","ENAMETOOLONG","ENFILE","ENOENT","ENOMEM","ENOSPC","ENOTDIR","ENOTEMPTY","ENOTSUP","EPERM","EROFS","EXDEV"]);function x(e){let t=e&&typeof e=="object"&&"code"in e?e.code:void 0;return typeof t=="string"&&ae.has(t)?t:"UNKNOWN"}function N(e){switch(e){case"EACCES":case"EPERM":case"EROFS":return"Check folder permissions and security software restrictions, and close programs using the clone files.";case"EBUSY":return"Close programs using the clone files, including editors and Git processes.";case"EEXIST":case"ENOTEMPTY":return"The destination is no longer empty. Choose an unused destination; do not overwrite existing files.";case"ENOSPC":return"Free disk space before recovering the clone.";case"ENOENT":case"ENOTDIR":return"Check that the parent folder still exists and is a directory.";case"EXDEV":return"The folders are on different filesystems. Copy the preserved clone to the destination instead of renaming it.";default:return"Check available disk space, folder permissions, and programs using the clone files."}}function ce(e){let t=p.dirname(p.resolve(e));try{return c.mkdtempSync(p.join(t,".ms-clone-"))}catch(i){let r=x(i);throw new h(`The CLI could not create temporary storage for the repository clone (create-staging: ${r}).`,{classifierBucket:"local-filesystem"},{errorCode:"GitCloneStagingFailed",retryable:!1,telemetryDetails:{classifierBucket:"local-filesystem",operation:"create-staging",systemErrorCode:r},outputDetails:{serverMessage:`Temporary storage parent: '${t}'. ${N(r)} Then run the clone command again.`}})}}function le(e,t){let i="read-target";try{if(!c.existsSync(t)){i="rename",c.renameSync(e,t);return}if(c.readdirSync(t).length>0)throw Object.assign(new Error("Target directory is no longer empty."),{code:"ENOTEMPTY"});i="read-staging";for(let r of c.readdirSync(e))i="copy",c.cpSync(p.join(e,r),p.join(t,r),{recursive:!0,force:!1,errorOnExist:!0})}catch(r){let n=x(r);throw new h(`The repository was cloned, but the CLI could not move it into the target directory (${i}: ${n}).`,{classifierBucket:"local-filesystem"},{errorCode:"GitClonePromotionFailed",retryable:!1,telemetryDetails:{classifierBucket:"local-filesystem",operation:i,systemErrorCode:n},outputDetails:{operation:i,systemErrorCode:n,stagingDirectory:e,targetDirectory:p.resolve(t),serverMessage:`The complete clone is preserved at '${e}'. Target: '${p.resolve(t)}'. ${N(n)} Inspect the target before changing it; it may contain existing or partially copied files. Move the preserved clone to an unused destination to recover without cloning again.`}})}try{c.rmSync(e,{recursive:!0,force:!0})}catch(r){let n=x(r);return`Repository cloned successfully into '${p.resolve(t)}', but temporary folder cleanup failed (cleanup: ${n}). ${N(n)} The target is ready to use. Remove only the leftover temporary folder '${e}' when it is no longer in use; do not clone again.`}}function Le(e){try{return oe(e),{success:!0}}catch(t){return{success:!1,error:O(t instanceof Error?t.message:String(t))}}}function V({gitUrl:e,loginAuthority:t,authResource:i}){try{return U({gitUrl:e,loginAuthority:t,authResource:i})}catch(r){throw new h(`Git credential helper setup failed: ${r instanceof Error?r.message:String(r)}`)}}function A({remoteUrl:e,cwd:t,createDirectory:i=!1,initialBranch:r,localConfig:n=[],updateExistingRemote:o=!1,emitRemoteError:u=!1,skipInitIfRepoExists:a=!1}){i&&c.mkdirSync(t,{recursive:!0});let s={stdio:"pipe",windowsHide:!0,cwd:t};a&&c.existsSync(p.join(t,".git"))||(w("git",["init"],s),r&&w("git",["symbolic-ref","HEAD",`refs/heads/${r}`],s));for(let[f,l]of n)w("git",["config","--local",f,l],s);if(e)try{w("git",["remote","add","origin",e],s)}catch(f){if(!o||!z(f).includes("already exists"))throw u&&process.stderr.write(O(z(f))),f;w("git",["remote","set-url","origin",e],s)}}function z(e){return typeof e=="object"&&e!==null&&"stderr"in e&&Buffer.isBuffer(e.stderr)?e.stderr.toString():""}function ue(){let e=m(["status","--porcelain"],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),t=m(["rev-list","--count","origin/main..main"],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),i=t.stdout.trim();return{hasUncommittedChanges:e.success?e.stdout.trim().length>0:null,isMainAheadOfOrigin:t.success&&/^\d+$/.test(i)?Number(i)>0:null}}function Be(){let e=ue(),t=[];return e.hasUncommittedChanges===!0&&t.push("There are uncommitted changes in the working tree. These will not be included in the remote build/deploy until they are committed and pushed. Run `git commit` and then `git push`."),e.isMainAheadOfOrigin===!0&&t.push("Local 'main' is ahead of 'origin/main'. These will not be included in the remote build/deploy until they are pushed. Run `git push`."),t.length>0?t.join(" "):null}export{C as a,fe as b,b as c,m as d,xe as e,Ne as f,Oe as g,Ae as h,oe as i,Ie as j,$e as k,Le as l,Be as m};
14
14
  /*!
15
15
  * Copyright (C) Microsoft Corporation. All rights reserved.
16
16
  */
17
- //# sourceMappingURL=chunk-ZB6MB7GZ.js.map
17
+ //# sourceMappingURL=chunk-R2IECDVU.js.map
@@ -4,11 +4,11 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
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?`
7
+ import{Pb as d,a as S,h as C,i as w,sb as A,tb as c,ub as b,xb as x,y as u,yb as O}from"./chunk-RSHOMYG6.js";import{b as i}from"./chunk-WS6TGUH7.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
8
  Recovery paths:
9
9
  ${e.recoveryPaths.map(a=>` ${a}`).join(`
10
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
11
  /*!
12
12
  * Copyright (C) Microsoft Corporation. All rights reserved.
13
13
  */
14
- //# sourceMappingURL=chunk-ADRQC63G.js.map
14
+ //# sourceMappingURL=chunk-RA74M3YD.js.map