@microsoft/managed-apps-cli 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/AddConfig-ZIDAN5AS.js +12 -0
- package/dist/AddConnector-YNHO2HAW.js +23 -0
- package/dist/{AuthStatus-6DMK7O6W.js → AuthStatus-S3K6JJG6.js} +2 -2
- package/dist/{AuthSwitch-NUQIIRCG.js → AuthSwitch-RSQ777N2.js} +2 -2
- package/dist/Bin.js +1 -1
- package/dist/BuildMaafApp-MKHYNTJN.js +11 -0
- package/dist/Cli-7SHW4PIZ.js +54 -0
- package/dist/CloneMaafApp-N5NBJDO4.js +11 -0
- package/dist/CreateMaafApp-OY6P6WIY.js +20 -0
- package/dist/DeleteMaafApp-SJE7YRQZ.js +11 -0
- package/dist/DeployMaafApp-VK4MJKVY.js +14 -0
- package/dist/{Dev-ICCA5DEJ.js → Dev-75M4ANEA.js} +2 -2
- package/dist/{EnvironmentVariableAuthenticationProvider-LYCQ5D47.js → EnvironmentVariableAuthenticationProvider-VNN4AG2E.js} +2 -2
- package/dist/GetMaafBuildStatus-I5Y6STGB.js +11 -0
- package/dist/{GetSettings-ZI2IBKV5.js → GetSettings-5T3STEOV.js} +2 -2
- package/dist/{InfoMaafApp-FL5PICDD.js → InfoMaafApp-OHDDS3OQ.js} +2 -2
- package/dist/Init-NLNDZJBN.js +11 -0
- package/dist/ListConnectorActions-N2IX4VWY.js +11 -0
- package/dist/{ListConnectors-MYUEVJPT.js → ListConnectors-YVJRDRID.js} +2 -2
- package/dist/{ListMaafApps-3W6W6UYP.js → ListMaafApps-3DEVXWSG.js} +2 -2
- package/dist/{Login-7RW6OEST.js → Login-CYDAY6K7.js} +2 -2
- package/dist/{Logout-IXK2TMRL.js → Logout-OB4QJDAY.js} +2 -2
- package/dist/{MockFetch-THQJ4KFB.js → MockFetch-PJWH2XTJ.js} +2 -2
- package/dist/{NodeMsalAuthenticationProvider-VVQ6CCZ5.js → NodeMsalAuthenticationProvider-NT7XAXTC.js} +2 -2
- package/dist/Pack-O5U5MPSJ.js +8 -0
- package/dist/{PlayMaafApp-5H3DCJ2C.js → PlayMaafApp-DLD27TQL.js} +2 -2
- package/dist/RefreshDataSource-JU3V5L2Y.js +11 -0
- package/dist/{RefreshGitAuth-IQBAFR37.js → RefreshGitAuth-N5RQYP3P.js} +2 -2
- package/dist/{RemoveDataSource-PGPLMJUX.js → RemoveDataSource-LXIOJFX4.js} +2 -2
- package/dist/{ServicePrincipalAuthenticationProvider-IZZRJFZQ.js → ServicePrincipalAuthenticationProvider-QJJ5WSV5.js} +2 -2
- package/dist/{SetSetting-SEWDA4TF.js → SetSetting-GNWY5HWU.js} +2 -2
- package/dist/{ShareLinkCreate-T5FN47J2.js → ShareLinkCreate-HJV3TLI3.js} +2 -2
- package/dist/{ShareLinkList-6JCVEYNC.js → ShareLinkList-2NJLTXFX.js} +2 -2
- package/dist/ShareLinkRevoke-G2EXN5WH.js +11 -0
- package/dist/ShareList-CDGJCXBF.js +11 -0
- package/dist/{ShareMaafApp-6MKZ33HW.js → ShareMaafApp-TMTGLD5F.js} +2 -2
- package/dist/{TelemetrySettings-RXPPIEVO.js → TelemetrySettings-KWEGCAGS.js} +2 -2
- package/dist/{UnshareMaafApp-OSE2TOBJ.js → UnshareMaafApp-YZPPEA32.js} +2 -2
- package/dist/chunk-7DFBXNI7.js +11 -0
- package/dist/{chunk-4LIR3ZYP.js → chunk-CBXGTKIE.js} +251 -251
- package/dist/chunk-EKMZGVZA.js +12 -0
- package/dist/chunk-EQHSV77H.js +20 -0
- package/dist/{chunk-6RSE3J4X.js → chunk-HO6LX3K7.js} +2 -2
- package/dist/chunk-II367GCP.js +11 -0
- package/dist/chunk-IMBY742Q.js +11 -0
- package/dist/chunk-IXZUOQPP.js +15 -0
- package/dist/chunk-KZIKF2VH.js +11 -0
- package/dist/chunk-LGJ3PMWD.js +11 -0
- package/dist/{chunk-6LKH5WE7.js → chunk-LSAJM3LO.js} +24 -21
- package/dist/chunk-MAWTAPQE.js +12 -0
- package/dist/chunk-MKCTKQZA.js +13 -0
- package/dist/{chunk-PPW4XUZO.js → chunk-MPRAPBI2.js} +9 -9
- package/dist/chunk-MVRNQN2O.js +38 -0
- package/dist/chunk-PDS5FYC4.js +11 -0
- package/dist/chunk-PVGICWWI.js +44 -0
- package/dist/chunk-QKHCRDMM.js +11 -0
- package/dist/{chunk-SNWTSI75.js → chunk-WADQ54KB.js} +2 -2
- package/dist/{chunk-4VBFOKV6.js → chunk-X5O77GZS.js} +2 -2
- package/dist/{chunk-EX6IKPAO.js → chunk-Y7TZZLPW.js} +2 -2
- package/package.json +4 -4
- package/dist/AddConnector-5DUBFLEK.js +0 -41
- package/dist/BuildMaafApp-A4IUU6LI.js +0 -11
- package/dist/Cli-LYSWG64H.js +0 -54
- package/dist/CloneMaafApp-B672N7T5.js +0 -11
- package/dist/CreateMaafApp-RWL7FXSP.js +0 -20
- package/dist/DeleteMaafApp-GT4CEFAE.js +0 -11
- package/dist/DeployMaafApp-E4TQU6RO.js +0 -14
- package/dist/GetMaafBuildStatus-UGAHVANE.js +0 -11
- package/dist/Init-XCSK3WQM.js +0 -11
- package/dist/ListConnectorActions-B2YD24RX.js +0 -11
- package/dist/Pack-IWU3PFQL.js +0 -8
- package/dist/RefreshDataSource-XQT7LVMO.js +0 -11
- package/dist/ShareLinkRevoke-OH5DZDHR.js +0 -11
- package/dist/ShareList-QCEL7QNJ.js +0 -11
- package/dist/chunk-23T63QIT.js +0 -15
- package/dist/chunk-3JIZGVCA.js +0 -11
- package/dist/chunk-47LJLFDF.js +0 -11
- package/dist/chunk-7BRIEYGR.js +0 -20
- package/dist/chunk-7GGFN2IW.js +0 -11
- package/dist/chunk-AQLFVAFU.js +0 -38
- package/dist/chunk-EQCYKUEU.js +0 -12
- package/dist/chunk-IQGMFWXB.js +0 -12
- package/dist/chunk-KYL2Y5G4.js +0 -11
- package/dist/chunk-LQ65CHNN.js +0 -13
- package/dist/chunk-UNJJUCSA.js +0 -11
- package/dist/chunk-VMSJG53Y.js +0 -11
|
@@ -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{a as V}from"./chunk-HO6LX3K7.js";import{c as Q,e as X}from"./chunk-Y7TZZLPW.js";import{a as p}from"./chunk-KZIKF2VH.js";import{a as H,b as O,d as Ae}from"./chunk-UT667QSU.js";var E=O(P=>{var $=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}},N=class extends ${constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};P.CommanderError=$;P.InvalidArgumentError=N});var D=O(M=>{var{InvalidArgumentError:Oe}=E(),L=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 Oe(`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 xe(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}M.Argument=L;M.humanReadableArgName=xe});var z=O(Z=>{var{humanReadableArgName:we}=D(),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=>we(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 l(m,b){if(b){let F=`${m.padEnd(n+s)}${b}`;return t.wrap(F,i-r,n+s)}return m}function a(m){return m.join(`
|
|
8
|
+
`).replace(/^/gm," ".repeat(r))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,i,0),""]));let c=t.visibleArguments(e).map(m=>l(t.argumentTerm(m),t.argumentDescription(m)));c.length>0&&(h=h.concat(["Arguments:",a(c),""]));let f=t.visibleOptions(e).map(m=>l(t.optionTerm(m),t.optionDescription(m)));if(f.length>0&&(h=h.concat(["Options:",a(f),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(b=>l(t.optionTerm(b),t.optionDescription(b)));m.length>0&&(h=h.concat(["Global Options:",a(m),""]))}let A=t.visibleCommands(e).map(m=>l(t.subcommandTerm(m),t.subcommandDescription(m)));return A.length>0&&(h=h.concat(["Commands:",a(A),""])),h.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 l=t-n;if(l<i)return e;let a=e.slice(0,n),h=e.slice(n).replace(`\r
|
|
10
|
+
`,`
|
|
11
|
+
`),u=" ".repeat(n),f="\\s\u200B",A=new RegExp(`
|
|
12
|
+
|.{1,${l-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),m=h.match(A)||[];return a+m.map((b,F)=>b===`
|
|
13
|
+
`?"":(F>0?u:"")+b.trimEnd()).join(`
|
|
14
|
+
`)}};Z.Help=I});var R=O(S=>{var{InvalidArgumentError:He}=E(),q=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=ee(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 He(`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 Ee(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},W=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 Ee(o){return o.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ee(o){let e,t,n=o.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}}S.Option=q;S.splitOptionFlags=ee;S.DualOptions=W});var ne=O(te=>{function Te(o,e){if(Math.abs(o.length-e.length)>3)return Math.max(o.length,e.length);let t=[];for(let n=0;n<=o.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<=o.length;i++){let r=1;o[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&&o[i-1]===e[n-2]&&o[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[o.length][e.length]}function ve(o,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=o.startsWith("--");t&&(o=o.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 l=Te(o,s),a=Math.max(o.length,s.length);(a-l)/a>r&&(l<i?(i=l,n=[s]):l===i&&n.push(s))}),n.sort((s,l)=>s.localeCompare(l)),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]}?)`:""}te.suggestSimilar=ve});var le=O(ae=>{var Ve=H("events").EventEmitter,j=H("child_process"),y=H("path"),G=H("fs"),d=H("process"),{Argument:$e,humanReadableArgName:De}=D(),{CommanderError:U}=E(),{Help:Se}=z(),{Option:ie,splitOptionFlags:ke,DualOptions:Fe}=R(),{suggestSimilar:re}=ne(),B=class o 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,l]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(s);return i&&(a.description(i),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(r.noHelp||r.hidden),a._executableFile=r.executableFile||null,l&&a.arguments(l),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),i?this:a}createCommand(e){return new o(e)}createHelp(){return Object.assign(new Se,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 U(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 ie(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,l)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let a=this.getOptionValue(n);if(r!==null&&e.parseArg)try{r=e.parseArg(r,a)}catch(h){if(h.code==="commander.invalidArgument"){let u=`${s} ${h.message}`;this.error(u,{exitCode:h.exitCode,code:h.code})}throw h}else r!==null&&e.variadic&&(r=e._concatValue(r,a));r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,l)};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 ie)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 l=i;i=(a,h)=>{let u=l.exec(a);return u?u[0]:h},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 T(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,c){let f=y.resolve(u,c);if(G.existsSync(f))return f;if(i.includes(y.extname(c)))return;let A=i.find(m=>G.existsSync(`${f}${m}`));if(A)return`${f}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=G.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=y.resolve(y.dirname(u),l)}if(l){let u=r(l,s);if(!u&&!e._executableFile&&this._scriptPath){let c=y.basename(this._scriptPath,y.extname(this._scriptPath));c!==this._name&&(u=r(l,`${c}-${e._name}`))}s=u||s}n=i.includes(y.extname(s));let a;d.platform!=="win32"?n?(t.unshift(s),t=oe(d.execArgv).concat(t),a=j.spawn(d.argv[0],t,{stdio:"inherit"})):a=j.spawn(s,t,{stdio:"inherit"}):(t.unshift(s),t=oe(d.execArgv).concat(t),a=j.spawn(d.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{d.on(c,()=>{a.killed===!1&&a.exitCode===null&&a.kill(c)})});let h=this._exitCallback;h?a.on("close",()=>{h(new U(d.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):a.on("close",d.exit.bind(d)),a.on("error",u=>{if(u.code==="ENOENT"){let c=l?`searched for local subcommand relative to directory '${l}'`:"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
|
+
- ${c}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!h)d.exit(1);else{let c=new U(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=a}_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(l){if(l.code==="commander.invalidArgument"){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'. ${l.message}`;this.error(a,{exitCode:l.exitCode,code:l.code})}throw l}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,l)=>e(n,l,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 T(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 se(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),se(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(a){return a.length>1&&a[0]==="-"}let l=null;for(;r.length;){let a=r.shift();if(a==="--"){i===n&&i.push(a),i.push(...r);break}if(l&&!s(a)){this.emit(`option:${l.name()}`,a);continue}if(l=null,s(a)){let h=this._findOption(a);if(h){if(h.required){let u=r.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;r.length>0&&!s(r[0])&&(u=r.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);l=h.variadic?h:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let h=this._findOption(`-${a[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,a.slice(2)):(this.emit(`option:${h.name()}`),r.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let h=a.indexOf("="),u=this._findOption(a.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,a.slice(h+1));continue}}if(s(a)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),r.length>0&&n.push(...r);break}else if(a===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(a),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(a),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(a),r.length>0&&i.push(...r);break}i.push(a)}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 T(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 Fe(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 l=s.attributeName(),a=this.getOptionValue(l),h=this.options.find(c=>c.negate&&l===c.attributeName()),u=this.options.find(c=>!c.negate&&l===c.attributeName());return h&&(h.presetArg===void 0&&a===!1||h.presetArg!==void 0&&a===h.presetArg)?h:u||s},i=s=>{let l=n(s),a=l.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${l.envVar}'`:`option '${l.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(l=>l.long).map(l=>l.long);i=i.concat(s),r=r.parent}while(r&&!r._enablePositionalOptions);t=re(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=re(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=>De(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=y.basename(e,y.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);T(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),T(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 se(o,e){o._hasHelpOption&&e.find(n=>n===o._helpLongFlag||n===o._helpShortFlag)&&(o.outputHelp(),o._exit(0,"commander.helpDisplayed","(outputHelp)"))}function oe(o){return o.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 T(o){let e=[];for(let t=o;t;t=t.parent)e.push(t);return e}ae.Command=B});var ce=O((g,pe)=>{var{Argument:Ne}=D(),{Command:he}=le(),{CommanderError:Pe,InvalidArgumentError:ue}=E(),{Help:Le}=z(),{Option:Me}=R();g=pe.exports=new he;g.program=g;g.Argument=Ne;g.Command=he;g.CommanderError=Pe;g.Help=Le;g.InvalidArgumentError=ue;g.InvalidOptionArgumentError=ue;g.Option=Me});var de=Ae(ce(),1),{program:Be,createCommand:Ke,createArgument:Je,createOption:Ye,CommanderError:Qe,InvalidArgumentError:Xe,InvalidOptionArgumentError:Ze,Command:me,Argument:et,Option:tt,Help:fe}=de.default;var x={auth:{"@description":"Manage authentication state.",commands:{login:{"@helpText":p.auth.login.description,lazyHandler:async()=>(await import("./Login-CYDAY6K7.js")).loginAsync},logout:{"@helpText":p.auth.logout.description,lazyHandler:async()=>(await import("./Logout-OB4QJDAY.js")).logoutAsync},status:{"@helpText":p.auth.status.description,lazyHandler:async()=>(await import("./AuthStatus-S3K6JJG6.js")).authStatusAsync},switch:{"@helpText":p.auth.switch.description,lazyHandler:async()=>(await import("./AuthSwitch-RSQ777N2.js")).authSwitchAsync}}},app:{"@description":"Manage apps and their resources.",commands:{clone:{"@helpText":p.app.clone.description,lazyHandler:async()=>(await import("./CloneMaafApp-N5NBJDO4.js")).cloneMaafAppAsync},create:{"@helpText":p.app.create.description,lazyHandler:async()=>(await import("./CreateMaafApp-OY6P6WIY.js")).createMaafAppAsync},init:{"@helpText":p.app.init.description,lazyHandler:async()=>(await import("./Init-NLNDZJBN.js")).initAsync},list:{"@helpText":p.app.list.description,lazyHandler:async()=>(await import("./ListMaafApps-3DEVXWSG.js")).listMaafAppsAsync},show:{"@helpText":p.app.show.deprecation,lazyHandler:async()=>(await import("./InfoMaafApp-OHDDS3OQ.js")).showMaafAppAsync},share:{typed:!0,"@helpText":p.app.share.description,lazyHandler:async()=>(await import("./ShareMaafApp-TMTGLD5F.js")).shareMaafAppAsync,commands:{link:{typed:!0,"@helpText":p.app.shareLink.description,commands:{create:{"@helpText":p.app.shareLink.create.description,lazyHandler:async()=>(await import("./ShareLinkCreate-HJV3TLI3.js")).shareLinkCreateAsync},list:{"@helpText":p.app.shareLink.list.description,lazyHandler:async()=>(await import("./ShareLinkList-2NJLTXFX.js")).shareLinkListAsync},revoke:{"@helpText":p.app.shareLink.revoke.description,lazyHandler:async()=>(await import("./ShareLinkRevoke-G2EXN5WH.js")).shareLinkRevokeAsync}}},list:{"@helpText":p.app.share.list.description,lazyHandler:async()=>(await import("./ShareList-CDGJCXBF.js")).shareListAsync}}},unshare:{"@helpText":p.app.unshare.description,lazyHandler:async()=>(await import("./UnshareMaafApp-YZPPEA32.js")).unshareMaafAppAsync},info:{"@helpText":p.app.info.description,lazyHandler:async()=>(await import("./InfoMaafApp-OHDDS3OQ.js")).infoMaafAppAsync},build:{"@helpText":p.app.build.description,lazyHandler:async()=>(await import("./BuildMaafApp-MKHYNTJN.js")).buildMaafAppAsync},"build-status":{"@helpText":p.app.buildStatus.description,lazyHandler:async()=>(await import("./GetMaafBuildStatus-I5Y6STGB.js")).getMaafBuildStatusAsync},deploy:{"@helpText":p.app.deploy.description,lazyHandler:async()=>(await import("./DeployMaafApp-VK4MJKVY.js")).deployMaafAppAsync},pack:{"@helpText":p.app.pack.description,lazyHandler:async()=>(await import("./Pack-O5U5MPSJ.js")).packAsync},play:{"@helpText":p.app.play.description,lazyHandler:async()=>(await import("./PlayMaafApp-DLD27TQL.js")).playMaafAppAsync},dev:{"@helpText":p.app.dev.description,lazyHandler:async()=>(await import("./Dev-75M4ANEA.js")).devAsync},delete:{"@helpText":p.app.delete.description,lazyHandler:async()=>(await import("./DeleteMaafApp-SJE7YRQZ.js")).deleteMaafAppAsync},refresh:{typed:!0,commands:{"data-source":{"@helpText":p.app.refresh.dataSource.description,lazyHandler:async()=>(await import("./RefreshDataSource-JU3V5L2Y.js")).refreshDataSourceAsync}}},add:{typed:!0,commands:{config:{"@helpText":p.app.add.config.description,requiresEnvVar:"ALM",lazyHandler:async()=>(await import("./AddConfig-ZIDAN5AS.js")).addConfigAsync},"data-source":{"@helpText":p.app.add.connector.description,lazyHandler:async()=>(await import("./AddConnector-YNHO2HAW.js")).addConnectorAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./AddConnector-YNHO2HAW.js")).addConnectorAsync}}},remove:{typed:!0,commands:{"data-source":{"@helpText":p.app.remove.description,lazyHandler:async()=>(await import("./RemoveDataSource-LXIOJFX4.js")).removeDataSourceAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./RemoveDataSource-LXIOJFX4.js")).removeDataSourceAsync}}},"set-setting":{"@helpText":p.app["set-setting"].description,lazyHandler:async()=>(await import("./SetSetting-GNWY5HWU.js")).setSettingAsync},"get-settings":{"@helpText":p.app["get-settings"].description,lazyHandler:async()=>(await import("./GetSettings-5T3STEOV.js")).getSettingsAsync}}},connector:{"@description":"Discover available connectors and their operations.",commands:{list:{"@helpText":p.connector.list.description,lazyHandler:async()=>(await import("./ListConnectors-YVJRDRID.js")).listConnectorsCliAsync},"list-actions":{"@helpText":p.connector["list-actions"].description,lazyHandler:async()=>(await import("./ListConnectorActions-N2IX4VWY.js")).listConnectorActionsCliAsync}}},git:{"@description":"Manage GitHub integration for apps.",commands:{auth:{typed:!0,commands:{refresh:{"@helpText":p.git.auth.refresh.description,lazyHandler:async()=>(await import("./RefreshGitAuth-N5RQYP3P.js")).refreshGitAuthAsync}}}}},telemetry:{"@description":"Manage CLI telemetry settings.",commands:{enable:{"@helpText":p.telemetry.enable.description,lazyHandler:async()=>(await import("./TelemetrySettings-KWEGCAGS.js")).telemetryEnableAsync},disable:{"@helpText":p.telemetry.disable.description,lazyHandler:async()=>(await import("./TelemetrySettings-KWEGCAGS.js")).telemetryDisableAsync},status:{"@helpText":p.telemetry.status.description,lazyHandler:async()=>(await import("./TelemetrySettings-KWEGCAGS.js")).telemetryStatusAsync}}}};function ge(o){return o.requiresEnvVar===void 0||Q(o.requiresEnvVar)}function C(o){return o.typed===!0}function k(o){return typeof o.lazyHandler=="function"}function w(o,e){if(!Object.prototype.hasOwnProperty.call(o,e))return;let t=o[e];return ge(t)?t:void 0}function K(o){return Object.entries(o).filter(([,e])=>ge(e))}function lt(o,e){let t=o.slice(2);if(t.length===0||t[0].startsWith("-"))return null;let[n]=t;return v(n,e)?_e(e[n].commands,t,1,[n]):null}function _e(o,e,t,n){if(t>=e.length)return null;let i=e[t];if(i.startsWith("-"))return null;let r=w(o,i);if(!r)return null;let s=[...n,i];if(!C(r))return{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1};let l=e[t+1];return l!==void 0&&!l.startsWith("-")&&w(r.commands,l)!==void 0?_e(r.commands,e,t+1,s):k(r)?{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1}:null}function ht(o,e){let t=o.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(!v(r,e))return null;let l=e[r].commands,a=[r],h=!1;for(let u of s){let c=w(l,u);if(!c)return h?{pathTokens:a,unknownToken:u}:null;if(!C(c))return null;a.push(u),l=c.commands,h=!0}return h?{pathTokens:a,unknownToken:void 0}:null}function v(o,e){return o in e}function J(o,e,t){let n=new fe;n.helpWidth=process.stdout.columns??80;let i=Math.max(...t.map(([l])=>l.length),8),r=2,s=2;o.push(e);for(let[l,a]of t){let h=`${l.padEnd(i+s)}${a}`;o.push(n.wrap(h,n.helpWidth-r,i+s,1).replace(/^/gm," ".repeat(r)))}}function ye(){let o=[],e=Object.entries(x);if(e.length>0){let t=Math.max(...e.map(([i])=>i.length)),n=Math.max(t+2,10);o.push("Command Groups:"),o.push("");for(let[i,r]of e)o.push(` ${i.padEnd(n)} ${r["@description"]}`);o.push(""),o.push(`Run '${"ms"} <group> --help' for commands within a group.`)}return o.join(`
|
|
28
|
+
`)}function gt(o){if(!v(o,x))return"";let e=x[o],t=[];t.push(`Usage: ${"ms"} ${o} <command> [flags]`),t.push(""),t.push(e["@description"]),t.push("");let n=[],i=[];for(let[r,s]of K(e.commands))if(C(s)){let l=s["@helpText"];k(s)&&l!==void 0&&n.push([r,l]),i.push([r,s])}else n.push([r,s["@helpText"]]);if(n.length>0&&J(t,"Commands:",n),i.length>0){t.push("");for(let[r,s]of i)J(t,`${r} <type>:`,Y(s,r).map(([l,a])=>[l,a]))}return t.push(""),t.push(`Run '${"ms"} ${o} <command> --help' for command-specific flags.`),t.join(`
|
|
29
|
+
`)}function Y(o,e){let t=[];for(let[n,i]of K(o.commands)){let r=e?`${e} ${n}`:n;C(i)?t.push(...Y(i,r)):t.push([r,i["@helpText"]])}return t}function _t(o){if(o.length<2)return null;let[e,...t]=o;if(!v(e,x))return null;let n=x[e].commands,i;for(let l of t){let a=w(n,l);if(!a)return null;if(i=a,C(a))n=a.commands;else return null}if(!i||!C(i))return null;let r=o.join(" "),s=[];return s.push(`Usage: ${"ms"} ${r} <type> [flags]`),s.push(""),J(s,"Types:",Y(i,"")),s.push(""),s.push(`Run '${"ms"} ${r} <type> --help' for type-specific flags.`),s.join(`
|
|
30
|
+
`)}function be(){return`${"ms"} v${V.version} (preview)`}function Ce(o){let e=new me;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"),o?e.name(`${"ms"} ${o.path.join(" ")}`):(e.name("ms"),e.usage("[option] [command] [<args>]")),e.version(V.version,"-v, --version","output the current version"),e.description(p.global.programDescription),e.addHelpText("beforeAll",()=>`${be()}
|
|
31
|
+
|
|
32
|
+
`),e.addHelpText("after",()=>o?"":`
|
|
33
|
+
`+ye()+`
|
|
34
|
+
`),e}var Ie=new Set(["--help","-h","--version","-v","--json","--no-color","--non-interactive"]);function ze(o){let e=o.slice(2);return e.some(n=>n==="--help"||n==="-h"||n==="--version"||n==="-v")&&e.every(n=>Ie.has(n))}function Dt(o){return ze(o)?(o.includes("--no-color")&&X("NO_COLOR","1"),Ce(null).parse([...o]),!0):!1}export{x as a,lt as b,ht as c,v as d,gt as e,_t as f,be as g,Ce as h,Dt as i};
|
|
35
|
+
/*!
|
|
36
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
37
|
+
*/
|
|
38
|
+
//# sourceMappingURL=chunk-MVRNQN2O.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{a as e}from"./chunk-HO6LX3K7.js";import{b as t,c as s}from"./chunk-Y7TZZLPW.js";import*as r from"os";import*as o from"path";var n=t("WORKING_DIRECTORY")??process.cwd(),E=t("CONFIG_DIR")??o.join(r.homedir(),".ms-cli"),p=o.join(E,"cache","auth"),a=o.join(E,"telemetry"),I="microsoft-managed-apps-cli",C="msal-token-cache",R="x-ms-client-request-id",T="x-ms-client-session-id",i="x-ms-target-url",m="x-ms-auth-resource",x="x-ms-body-token-resource",N="userSettings.json",S=`managed-apps-cli/${e.version}`,O=s("USE_MMA_APP_ID")?"c4ee713f-aede-4371-91fc-921aa3a5ded9":"9cee029c-6210-4654-90bb-17e6e9d36617",A="managedappscli";export{n as a,E as b,p as c,a as d,I as e,C as f,R as g,T as h,i,m as j,x as k,N as l,S as m,O as n,A as o};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-PDS5FYC4.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
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{c as G}from"./chunk-WADQ54KB.js";import{B as U,C as q,D,E as j,F as T,G as E,Ga as S,H as R,Ha as V,I as H,X as F,g as M,j as k,u as P}from"./chunk-CBXGTKIE.js";import{a as B,b as m,f as W}from"./chunk-RBG2H562.js";import{c as Y}from"./chunk-Y7TZZLPW.js";import{a as _,c as N,h as p,i as w}from"./chunk-PVAIJSAI.js";import*as K from"http";import X from"open";var J={defaultBehavior:"Allow",allowedConnectors:[]},I="Reason: The connector service rejected the automatic connection request.";function O(r,t){S().trackErrorEvent("Connection.AutoCreateFailed",{apiId:r,error:t instanceof Error?t.message:String(t)})}async function me(r,t,o){if(r.toLowerCase().startsWith("shared_"))return r;let n=await D(void 0,t??void 0),i=r.toLowerCase(),l=n.find(e=>e.name.toLowerCase()===`shared_${i}`);if(l)return l.name;let d=n.filter(e=>e.properties.displayName.toLowerCase()===i),a=d.length===0,c=a?n.filter(e=>e.properties.displayName.toLowerCase().includes(i)):d;if(c.length===0)return r;if(c.length===1)return a&&!o?.jsonMode&&p(`Resolved '${r}' \u2192 '${c[0].properties.displayName}' (${c[0].name})`),c[0].name;let C=c.map(e=>` ${e.name} (${e.properties.displayName})`).join(`
|
|
8
|
+
`);throw new m(`Multiple connectors match '${r}'. Specify the connector ID directly:
|
|
9
|
+
${C}`)}var z="__create__",Z=600*1e3,x="1";async function fe(r,t){let o=S(),n=await r.getTenantIdAsync();n||(o.trackErrorEvent("DlpSkippedNoTenantId",{apiId:t}),w(`Could not resolve tenant ID; skipping connector policy check. Sign in with '${"ms"} auth login' for full enforcement.`));let[i,l]=await Promise.all([U(t,o),n?H(o,n).catch(()=>(w("Could not verify connector policy; proceeding without enforcement."),J)):Promise.resolve(J)]);if(!i)throw new W(`Connector '${t}' not found. Run '${"ms"} connector list' to see available connector IDs.`);let d=(i.name??t).toLowerCase(),a=new Map(l.allowedConnectors.map(e=>[e.connectorId.toLowerCase(),e])),c=new Set((l.blockedConnectors??[]).map(e=>e.connectorId.toLowerCase()));if(l.defaultBehavior==="Block"?!a.has(d):c.has(d))throw new m(`Connector '${i.properties.displayName??t}' is blocked by your organization's connector policy.`);return{connector:i,tenantId:n,policy:l}}async function pe(r){let t=V(),{argumentProvider:o,apiId:n,connector:i,useSso:l,interactive:d=t.interactive,quiet:a=!1,nonInteractiveReason:c="cli-mode"}=r,C=S(),e=P(),s=await q(n,C);if(!d)return ee({argumentProvider:o,apiId:n,connector:i,connections:s??[],useSso:l,quiet:a,nonInteractiveReason:c});if(l){if(!E(i))throw new m(`--use-sso was set but '${i.properties.displayName??n}' does not support single sign-on (SSO) authentication.
|
|
10
|
+
To fix: Re-run without --use-sso to create a connection interactively.`);let f=(s??[]).filter(u=>R(u,i));if(f.length>0){let[u]=f;return p(`Using existing SSO connection '${u.properties.displayName}' (${u.name}).`),f.length>1&&w(`Multiple SSO connections found for '${i.properties.displayName??n}'. Re-run with --connection-id <id> or -c <id> to use a specific one.`),{connectionId:u.name,autoSelected:!0}}let y=await A(o,n);return N(`Created a new connection '${y.properties.displayName}' (${y.name}).`),{connectionId:y.name,autoSelected:!1}}let g=[...s.map(f=>({value:f.name,label:f.properties.displayName,hint:f.name})),{value:z,label:"(Create a new connection)"}],h=await G({message:"Select a connection:",options:g});if(h===z){if(T(i))try{return{connectionId:(await A(o,n)).name,autoSelected:!1}}catch(v){O(n,v),w("Silent connection creation failed."),p(`Falling back to browser-based connection creation...
|
|
11
|
+
`)}else p(`This connector requires manual interaction. Opening browser for connection creation...
|
|
12
|
+
`);let f=n.startsWith("shared_")?n:`shared_${n}`,y=o.getEnvironmentId();if(!y)throw new m("Missing required information. Make sure you are running this command in a Managed Apps directory.");let u=await oe({connectorName:f,region:e.region,environmentId:y});if(u.status==="created"&&u.connectionName)return N("Connection created successfully!"),u.displayName&&p(` Display Name: ${u.displayName}`),p(` Connection ID: ${u.connectionName}`),{connectionId:u.connectionName,autoSelected:!1};throw u.status==="error"?new B(u.errorMessage??"Connection creation failed in the browser."):new m("Connection creation was cancelled.")}return{connectionId:h,autoSelected:!1}}async function ee(r){let{argumentProvider:t,apiId:o,connector:n,connections:i,useSso:l,quiet:d=!1,nonInteractiveReason:a}=r,c=n.properties.displayName??o;if(l){if(!E(n))throw a==="json-mode"?new m(`--use-sso was set but '${c}' does not support single sign-on (SSO) authentication.
|
|
13
|
+
To fix: Re-run without --use-sso and provide --connection-id <id> or -c <id>.`):new m(`--use-sso was set but '${c}' does not support single sign-on (SSO) authentication.
|
|
14
|
+
To fix: Re-run without both --use-sso and --non-interactive to create a connection interactively.`);let e=i.filter(s=>R(s,n));if(e.length>0){let[s]=e;return d||p(`Using existing SSO connection '${s.properties.displayName}' (${s.name}).`),!d&&e.length>1&&w(`Multiple SSO connections found for '${c}'. Re-run with --connection-id <id> or -c <id> to use a specific one.`),{connectionId:s.name,autoSelected:!0}}try{let s=await A(t,o);return d||N(`Created a new connection '${s.properties.displayName}' (${s.name}).`),{connectionId:s.name,autoSelected:!1}}catch(s){throw O(o,s),a==="json-mode"?new m(`No SSO connection exists for '${c}' and automatic connection creation failed.
|
|
15
|
+
${I}
|
|
16
|
+
To fix: Create a connection, then re-run with --connection-id <id> or -c <id>.`):new m(`No SSO connection exists for '${c}' and automatic connection creation failed.
|
|
17
|
+
${I}
|
|
18
|
+
To fix: Create one interactively (re-run without --non-interactive),
|
|
19
|
+
then re-run with --connection-id <id> or -c <id>.`)}}if(i.length===1){let[e]=i;return d||p(`Using existing connection '${e.properties.displayName}' (${e.name}).`),{connectionId:e.name,autoSelected:!0}}if(i.length===0&&T(n))try{let e=await A(t,o);return d||N(`Created a new connection '${e.properties.displayName}' (${e.name}).`),{connectionId:e.name,autoSelected:!1}}catch(e){throw O(o,e),a==="json-mode"?new m(`No connection exists for '${c}' and automatic connection creation failed.
|
|
20
|
+
${I}
|
|
21
|
+
To fix: Create a connection, then re-run with --connection-id <id> or -c <id>.`):new m(`No connection exists for '${c}' and automatic connection creation failed.
|
|
22
|
+
${I}
|
|
23
|
+
To fix: Create one interactively (re-run without --non-interactive),
|
|
24
|
+
then re-run with --connection-id <id> or -c <id>.`)}throw i.length>1?(d||_({title:`Available connections for ${c}`,columns:[{header:"Display Name",maxWidth:40},{header:"Connection ID"}],rows:i.map(e=>[e.properties.displayName,e.name]),totalLabel:"connection(s) found"}),a==="json-mode"?new m(`Multiple connections exist for '${c}', so one cannot be selected automatically.
|
|
25
|
+
To fix: Re-run with --connection-id <id> or -c <id> to choose one.`):new m(`Multiple connections exist for '${c}', so one cannot be selected automatically.
|
|
26
|
+
To fix: Re-run with --connection-id <id> or -c <id> to choose one,
|
|
27
|
+
or re-run without --non-interactive to select one interactively.`)):a==="json-mode"?new m(`'${c}' requires a connection that cannot be created automatically in JSON mode.
|
|
28
|
+
To fix: Create a connection, then re-run with --connection-id <id> or -c <id>.
|
|
29
|
+
Tip: Run '${"ms"} connector list' to browse available connectors.`):new m(`'${c}' requires a connection that cannot be created automatically in non-interactive mode.
|
|
30
|
+
To fix: Create one interactively (re-run without --non-interactive),
|
|
31
|
+
then re-run with --connection-id <id> or -c <id>.
|
|
32
|
+
Tip: Run '${"ms"} connector list' to browse available connectors.`)}async function A(r,t){let o=S(),n=P();return F({authProvider:r.getAuthenticationProvider(),region:n.region,environmentName:n.environmentName,actionsParams:{connectorId:t},logger:o})}function ne(r,t){return`Note: connection '${r}' was auto-selected for connector '${t}' because no --connection-id was provided. For tabular connectors, the connection needs to have access to the target resource, so this failure may not clearly indicate the root cause:
|
|
33
|
+
- If the connection is broken or expired, re-authenticate it and re-run.
|
|
34
|
+
- If the connection is valid but targets the wrong resource, re-run with an explicit --connection-id <id> for the intended resource.`}async function he(r,t){try{return await r()}catch(o){throw t.autoSelected&&o instanceof Error&&!(o instanceof m)&&(o.message=`${o.message}
|
|
35
|
+
|
|
36
|
+
${ne(t.connectionId,t.connectorLabel)}`),o}}async function ge(r){if(!Y("ENABLE_CONNECTOR_USER_CONSENT"))return;let{apiId:t,connectionId:o}=r,n=r.impact??"The data source was added, but later calls",i=S(),l=i.trackScenario("ConnectorUserConsent",{apiId:t,connectionId:o}),d=a=>(r.defer||w(a),a);try{await j(t,o,i),l.complete();return}catch(a){return l.failure(a),a instanceof M&&a.status===403?d(`Could not request user consent on connection '${o}' (HTTP 403). ${n} against this connection may fail until your tenant admin grants the calling application the 'Connectivity.Connections.UserConsent' delegated permission.`):d(`Could not request user consent on connection '${o}'. ${n} against this connection may fail.`)}}async function oe(r){let{connectorName:t,region:o,environmentId:n}=r,i=crypto.randomUUID();return new Promise((l,d)=>{let a=K.createServer((s,g)=>{let h=new URL(s.url??"/","http://localhost");if(h.pathname==="/callback"&&s.method==="GET"){if(h.searchParams.get("nonce")!==i){g.writeHead(403,{"Content-Type":"text/html; charset=utf-8"}),g.end("<html><body><h2>Connection request verification failed. Please run the CLI command again.</h2></body></html>"),e(),l({status:"cancelled"});return}let y=h.searchParams.get("v");y!==x&&w(`Warning: callback protocol version mismatch (expected ${x}, got ${y??"none"}). Update the CLI to the latest version.`);let u=h.searchParams.get("status"),v=h.searchParams.get("message")??void 0;g.writeHead(200,{"Content-Type":"text/html; charset=utf-8"});let b;if(u==="created")b="<html><body><h2>Connection created! You can close this tab.</h2></body></html>";else if(u==="error"){let L=v?v.replace(/[&<>"']/g,Q=>`&#${Q.charCodeAt(0)};`):"";b=L?`<html><body><h2>Connection creation failed. You can close this tab.</h2><p>${L}</p></body></html>`:"<html><body><h2>Connection creation failed. You can close this tab.</h2></body></html>"}else b="<html><body><h2>Connection creation cancelled. You can close this tab.</h2></body></html>";g.end(b),e(),l(u==="created"?{status:"created",connectionId:h.searchParams.get("connectionId")??void 0,connectionName:h.searchParams.get("connectionName")??void 0,displayName:h.searchParams.get("displayName")??void 0}:u==="error"?{status:"error",errorMessage:v}:{status:"cancelled"});return}g.writeHead(404),g.end("Not found")});a.listen(0,"localhost",async()=>{let s=a.address(),h=`http://localhost:${typeof s=="object"&&s?s.port:0}/callback`,f=k(o,{connector:t,callbackUrl:h,nonce:i,protocolVersion:x,environmentId:n});p(`Opening browser at ${f}`);try{await X(f,{wait:!1})}catch{p(`Could not open browser automatically. Please navigate to:
|
|
37
|
+
${f}`)}p(`Waiting for connection creation... (press Ctrl+C to cancel)
|
|
38
|
+
`)}),a.on("error",s=>{e(),d(s)});let c=setTimeout(()=>{p(`
|
|
39
|
+
Connection creation timed out after 10 minutes.`),e(),l({status:"cancelled"})},Z),C=()=>{p(`
|
|
40
|
+
Cancelling...`),e(),l({status:"cancelled"})};function e(){clearTimeout(c),process.off("SIGINT",C),a.close()}process.on("SIGINT",C)})}export{me as a,fe as b,pe as c,he as d,ge as e};
|
|
41
|
+
/*!
|
|
42
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
43
|
+
*/
|
|
44
|
+
//# sourceMappingURL=chunk-PVGICWWI.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{a as T,b as y,c as h}from"./chunk-IMBY742Q.js";import{a as v,b as U}from"./chunk-X5O77GZS.js";import{Ca as G,Da as x,Ga as E,N as b,c as D}from"./chunk-CBXGTKIE.js";import{c as H}from"./chunk-RBG2H562.js";import{h as d}from"./chunk-PVAIJSAI.js";async function A(r){let{remoteUrl:c,tenantId:l,jsonMode:p,openBrowser:s,verb:f}=r,{host:t,owner:i,repo:n}=D(c),o=i&&n?G(i,n):"",R=t&&i&&n?`https://${t}/${i}/${n}`:c,e=E(),a=B(f);e.trackActivityEvent(a,{repoHost:t,repoHash:o}),p||d("GitHub authentication is required for this action.");let u=M({isJson:p,openBrowser:s}),m=new AbortController,w=()=>{m.abort()};process.once("SIGINT",w);try{await x({remoteUrl:R,tenantId:l,logger:e,display:u,skipBrowser:!1,signal:m.signal})}catch(g){throw e.trackActivityEvent(`${a}.Failed`,{repoHost:t,repoHash:o}),y(g)??g}finally{process.removeListener("SIGINT",w)}e.trackActivityEvent(`${a}.Complete`,{repoHost:t,repoHash:o}),p||d(I(f))}function I(r){switch(r){case"app create":return"Resuming create...";case"app init":return"Resuming init...";case"app build":return"Resuming build...";case"app deploy":return"Resuming deploy..."}}function M(r){return r.isJson?new U:r.openBrowser?v:{...v,openVerificationUri:void 0}}function B(r){switch(r){case"app create":return"Maaf.Create.GitHubDcfRecovery";case"app init":return"Maaf.Init.GitHubDcfRecovery";case"app build":return"Maaf.Build.GitHubDcfRecovery";case"app deploy":return"Maaf.Deploy.GitHubDcfRecovery"}}async function F(r,c,l=A){let{repoType:p,externalRepoUrl:s,tenantId:f,jsonMode:t,openBrowser:i,verb:n}=c;try{return await r({isRetry:!1})}catch(o){if(p!=="github")throw o;if(!h(o)){if(o instanceof b)throw o;let e=y(o);throw e||o}if(!s)throw new H(`GitHub authentication is required, but the app config does not record the external repository URL needed to recover the identity mapping. This app may have been created before the URL was persisted to \`ms.config.json\`. Either add \`externalRepoUrl: "<your repo url>"\` to \`ms.config.json\`, or recreate the app with \`ms app create --repo <your repo url>\`, then run \`ms ${n}\` again.`);await l({remoteUrl:s,tenantId:f,jsonMode:t,openBrowser:i,verb:n});try{return await r({isRetry:!0})}catch(e){if(e instanceof b)throw e;let a=h(e);if(a)throw T(a.payload)??e;let u=y(e);throw u||e}}}export{F as a};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-QKHCRDMM.js.map
|
|
@@ -4,7 +4,7 @@ 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{
|
|
7
|
+
import{Ha as Z}from"./chunk-CBXGTKIE.js";import{b as j}from"./chunk-RBG2H562.js";import{i as k}from"./chunk-PVAIJSAI.js";import{a as G}from"./chunk-MPRAPBI2.js";import{b as Gt,d as mt}from"./chunk-UT667QSU.js";var it=Gt((Ee,Tt)=>{"use strict";var st={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"},Qt={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},te={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?st.up():"");return t&&(e+=st.left),e}};Tt.exports={cursor:st,scroll:Qt,erase:te,beep:"\x07"}});import{styleText as ee}from"node:util";import{stdout as At,stdin as se}from"node:process";import ie from"node:readline";var gt=(()=>{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}})(),ft=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,$t=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 kt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,yt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Wt=/\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"),Ut=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Bt=new RegExp("\\p{M}+","gu"),Kt={limit:1/0,ellipsis:""},wt=(t,e={},s={})=>{let i=e.limit??1/0,r=e.ellipsis??"",n=e?.ellipsisWidth??(r?wt(r,Kt,s).width:0),o=0,a=s.controlWidth??0,l=s.tabWidth??8,h=s.emojiWidth??2,m=2,c=s.regularWidth??1,d=s.wideWidth??m,y=[[Ut,c],[kt,o],[jt,a],[Wt,l],[vt,h],[yt,d]],g=0,f=0,b=t.length,E=0,A=!1,V=b,F=Math.max(0,i-n),v=0,I=0,w=0,_=0;t:for(;;){if(I>v||f>=b&&f>g){let S=t.slice(v,I)||t.slice(g,f);E=0;for(let O of S.replaceAll(Bt,"")){let x=O.codePointAt(0)||0;if(ft(x)?_=m:$t(x)?_=d:_=c,w+_>F&&(V=Math.min(V,Math.max(v,g)+E)),w+_>i){A=!0;break t}E+=O.length,w+=_}v=I=0}if(f>=b)break t;for(let S=0,O=y.length;S<O;S++){let[x,dt]=y[S];if(x.lastIndex=f,x.test(t)){if(E=x===yt?gt(t.slice(f,x.lastIndex)):x===vt?1:x.lastIndex-f,_=E*dt,w+_>F&&(V=Math.min(V,f+Math.floor((F-w)/dt))),w+_>i){A=!0;break t}w+=_,v=g,I=f,f=g=x.lastIndex;continue t}}f+=1}return{width:A?F:w,index:A?V:b,truncated:A,ellipsed:A&&i>=n}},It=wt;var Ht={limit:1/0,ellipsis:"",ellipsisWidth:0},qt=(t,e={})=>It(t,Ht,e).width,T=qt;var W="\x1B",Ct="\x9B",Jt=39,tt="\x07",Et="[",Yt="]",Mt="m",et=`${Yt}8;;`,bt=new RegExp(`(?:\\${Et}(?<code>\\d+)m|\\${et}(?<uri>.*)${tt})`,"y"),_t=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=>`${W}${Et}${t}${Mt}`,xt=t=>`${W}${et}${t}${tt}`,Q=(t,e,s)=>{let i=e[Symbol.iterator](),r=!1,n=!1,o=t.at(-1),a=o===void 0?0:T(o),l=i.next(),h=i.next(),m=0;for(;!l.done;){let c=l.value,d=T(c);a+d<=s?t[t.length-1]+=c:(t.push(c),a=0),(c===W||c===Ct)&&(r=!0,n=e.startsWith(et,m+1)),r?n?c===tt&&(r=!1,n=!1):c===Mt&&(r=!1):(a+=d,a===s&&!h.done&&(t.push(""),a=0)),l=h,h=i.next(),m+=c.length}o=t.at(-1),!a&&o!==void 0&&o.length&&t.length>1&&(t[t.length-2]+=t.pop())},zt=t=>{let e=t.split(" "),s=e.length;for(;s&&!T(e[s-1]);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},Xt=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",r,n,o=t.split(" "),a=[""],l=0;for(let c=0;c<o.length;c++){let d=o[c];if(s.trim!==!1){let g=a.at(-1)??"",f=g.trimStart();g.length!==f.length&&(a[a.length-1]=f,l=T(f))}c!==0&&(l>=e&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),l=0),(l||s.trim===!1)&&(a[a.length-1]+=" ",l++));let y=T(d);if(s.hard&&y>e){let g=e-l,f=1+Math.floor((y-g-1)/e);Math.floor((y-1)/e)<f&&a.push(""),Q(a,d,e),l=T(a.at(-1)??"");continue}if(l+y>e&&l&&y){if(s.wordWrap===!1&&l<e){Q(a,d,e),l=T(a.at(-1)??"");continue}a.push(""),l=0}if(l+y>e&&s.wordWrap===!1){Q(a,d,e),l=T(a.at(-1)??"");continue}a[a.length-1]+=d,l+=y}s.trim!==!1&&(a=a.map(c=>zt(c)));let h=a.join(`
|
|
8
8
|
`),m=!1;for(let c=0;c<h.length;c++){let d=h[c];if(i+=d,m)m=!1;else if(m=d>="\uD800"&&d<="\uDBFF",m)continue;if(d===W||d===Ct){bt.lastIndex=c+1;let g=bt.exec(h)?.groups;if(g?.code!==void 0){let f=Number.parseFloat(g.code);r=f===Jt?void 0:f}else g?.uri!==void 0&&(n=g.uri.length===0?void 0:g.uri)}if(h[c+1]===`
|
|
9
9
|
`){n&&(i+=xt(""));let y=r?_t(r):void 0;r&&y&&(i+=St(y))}else d===`
|
|
10
10
|
`&&(r&&_t(r)&&(i+=St(r)),n&&(i+=xt(n)))}return i},Zt=/\r?\n/;function R(t,e,s){return String(t).normalize().split(Zt).map(i=>Xt(i,e,s)).join(`
|
|
@@ -47,4 +47,4 @@ ${a}
|
|
|
47
47
|
/*!
|
|
48
48
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
49
49
|
*/
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-WADQ54KB.js.map
|
|
@@ -4,8 +4,8 @@ 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{d as s}from"./chunk-
|
|
7
|
+
import{d as s}from"./chunk-Y7TZZLPW.js";import{e as a,h as i}from"./chunk-PVAIJSAI.js";import{spawn as f}from"node:child_process";var g={showUserCode({userCode:t,verificationUri:e,expiresIn:r}){i(""),i("First copy your one-time code:"),i(""),i(` ${t}`),i(""),i("Then visit this URL to sign in to GitHub:"),i(""),i(` ${e}`),i(""),i(`(Code expires in ${Math.round(r/60)} minutes.)`)},showWaiting(){i("Waiting for authentication...")},openVerificationUri(t){return l(t,{skip:!1})}},p=class{showUserCode(e){this._emit({phase:"github-auth-initiated",sessionId:e.sessionId,userCode:e.userCode,verificationUri:e.verificationUri,expiresIn:e.expiresIn,pollIntervalSeconds:e.pollIntervalSeconds})}showWaiting(){}showPollIteration(){this._emit({phase:"github-auth-pending"})}showComplete(e){this._emit({phase:"github-auth-complete",githubLogin:e.githubLogin,mappingExpiresAt:e.mappingExpiresAt})}_emit(e){a(e)}};function l(t,e){if(e.skip||process.stdin.isTTY===!1||s("MS_NO_BROWSER")==="1"||s("CI")==="true")return!1;let r;try{r=new URL(t)}catch{return!1}if(r.protocol!=="https:")return!1;try{let n=c(t,process.platform);if(!n)return!1;let o=f(n.file,n.args,{shell:!1,detached:!0,stdio:"ignore"});return o.on("error",()=>{}),o.unref(),!0}catch{return!1}}function c(t,e){switch(e){case"win32":return{file:"cmd.exe",args:["/c","start","",t]};case"darwin":return{file:"open",args:[t]};case"linux":return{file:"xdg-open",args:[t]};default:return}}export{g as a,p as b};
|
|
8
8
|
/*!
|
|
9
9
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
10
|
*/
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-X5O77GZS.js.map
|
|
@@ -4,8 +4,8 @@ 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
|
-
var N=`${"ms".toUpperCase()}_CLI_`;function
|
|
7
|
+
var N=`${"ms".toUpperCase()}_CLI_`;function e(E){return`${N}${E}`}function O(E){return process.env[e(E)]}function n(E){return O(E)==="true"}function I(E){return process.env[E]}function C(E,_){process.env[E]=_}function R(){return{...process.env}}export{e as a,O as b,n as c,I as d,C as e,R as f};
|
|
8
8
|
/*!
|
|
9
9
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
10
|
*/
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-Y7TZZLPW.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/managed-apps-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Command-line interface for building and managing Microsoft Managed Apps",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"git": ">=2.27.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@microsoft/managed-apps-actions": "0.
|
|
39
|
-
"@microsoft/managed-apps-codegen": "0.3.
|
|
40
|
-
"@microsoft/managed-apps-common": "0.
|
|
38
|
+
"@microsoft/managed-apps-actions": "0.17.1",
|
|
39
|
+
"@microsoft/managed-apps-codegen": "0.3.2",
|
|
40
|
+
"@microsoft/managed-apps-common": "0.22.0",
|
|
41
41
|
"@azure/msal-node": "5.2.2",
|
|
42
42
|
"@clack/prompts": "1.4.0",
|
|
43
43
|
"@microsoft/1ds-core-js": "4.3.11",
|
|
@@ -1,41 +0,0 @@
|
|
|
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 ve,b as B,c as Ce,d as J,e as ye,g as we}from"./chunk-SNWTSI75.js";import{A as z,B as se,C as ce,D as le,M as j,N as me,O as ue,T as fe,U as ge,e as ee,f as ne,i as te,q as U,u as oe,ua as $,v as ae,va as x,w as ie,x as re,y as G,z as Y}from"./chunk-4LIR3ZYP.js";import{a as de,b as u,f as pe}from"./chunk-RBG2H562.js";import"./chunk-UNJJUCSA.js";import"./chunk-6RSE3J4X.js";import{c as he}from"./chunk-EX6IKPAO.js";import{b as P,c as b}from"./chunk-3JIZGVCA.js";import{a as V,c as T,h,i as I}from"./chunk-PVAIJSAI.js";import{a as w}from"./chunk-47LJLFDF.js";import"./chunk-PPW4XUZO.js";import"./chunk-Y5AMO72S.js";import"./chunk-UT667QSU.js";var De=["shared_commondataserviceforapps","commondataserviceforapps"];function H(e){let t=e.toLowerCase();return De.some(n=>t===n||t.endsWith(`/${n}`))}import*as Ie from"http";import xe from"open";var be={defaultBehavior:"Allow",allowedConnectors:[]};async function Se(e,t){if(e.toLowerCase().startsWith("shared_"))return e;let n=await ie(void 0,t??void 0),o=e.toLowerCase(),r=n.filter(a=>a.properties.displayName.toLowerCase()===o),i=r.length===0,c=i?n.filter(a=>a.properties.displayName.toLowerCase().includes(o)):r;if(c.length===0)return e;if(c.length===1)return i&&h(`Resolved '${e}' \u2192 '${c[0].properties.displayName}' (${c[0].name})`),c[0].name;let f=c.map(a=>` ${a.name} (${a.properties.displayName})`).join(`
|
|
8
|
-
`);throw new u(`Multiple connectors match '${e}'. Specify the connector ID directly:
|
|
9
|
-
${f}`)}var Ae="__create__",ke=600*1e3,K="1";async function Ne(e,t){let n=$(),o=await e.getTenantIdAsync();o||(n.trackErrorEvent("DlpSkippedNoTenantId",{apiId:t}),I(`Could not resolve tenant ID; skipping connector policy check. Sign in with '${"ms"} auth login' for full enforcement.`));let[r,i]=await Promise.all([oe(t,n),o?se(n,o).catch(()=>(I("Could not verify connector policy; proceeding without enforcement."),be)):Promise.resolve(be)]);if(!r)throw new pe(`Connector '${t}' not found. Run '${"ms"} connector list' to see available connector IDs.`);let c=(r.name??t).toLowerCase(),f=new Map(i.allowedConnectors.map(p=>[p.connectorId.toLowerCase(),p])),a=new Set((i.blockedConnectors??[]).map(p=>p.connectorId.toLowerCase()));if(i.defaultBehavior==="Block"?!f.has(c):a.has(c))throw new u(`Connector '${r.properties.displayName??t}' is blocked by your organization's connector policy.`);return{connector:r,tenantId:o,policy:i}}async function Q(e){let{argumentProvider:t,apiId:n,connector:o,useSso:r}=e,i=x(),c=$(),f=U(),a=await ae(n,c);if(!i.interactive)return Le({argumentProvider:t,apiId:n,connector:o,connections:a??[],useSso:r});if(r){if(!Y(o))throw new u(`--use-sso was set but '${o.properties.displayName??n}' does not support single sign-on (SSO) authentication.
|
|
10
|
-
To fix: Re-run without --use-sso to create a connection interactively.`);let l=(a??[]).filter(s=>z(s,o));if(l.length>0){let[s]=l;return h(`Using existing SSO connection '${s.properties.displayName}' (${s.name}).`),l.length>1&&I(`Multiple SSO connections found for '${o.properties.displayName??n}'. Re-run with --connection-id <id> or -c <id> to use a specific one.`),{connectionId:s.name,autoSelected:!0}}let m=await W(t,n);return T(`Created a new connection '${m.properties.displayName}' (${m.name}).`),{connectionId:m.name,autoSelected:!1}}let d=[...a.map(l=>({value:l.name,label:l.properties.displayName,hint:l.name})),{value:Ae,label:"(Create a new connection)"}],p=await Ce({message:"Select a connection:",options:d});if(p===Ae){if(G(o))try{return{connectionId:(await W(t,n)).name,autoSelected:!1}}catch(y){I(`Silent connection creation failed: ${y instanceof Error?y.message:String(y)}`),h(`Falling back to browser-based connection creation...
|
|
11
|
-
`)}else h(`This connector requires manual interaction. Opening browser for connection creation...
|
|
12
|
-
`);let l=n.startsWith("shared_")?n:`shared_${n}`,m=t.getEnvironmentId();if(!m)throw new u("Missing required information. Make sure you are running this command in a Managed Apps directory.");let s=await Fe({connectorName:l,region:f.region,environmentId:m});if(s.status==="created"&&s.connectionName)return T("Connection created successfully!"),s.displayName&&h(` Display Name: ${s.displayName}`),h(` Connection ID: ${s.connectionName}`),{connectionId:s.connectionName,autoSelected:!1};throw s.status==="error"?new de(s.errorMessage??"Connection creation failed in the browser."):new u("Connection creation was cancelled.")}return{connectionId:p,autoSelected:!1}}async function Le(e){let{argumentProvider:t,apiId:n,connector:o,connections:r,useSso:i}=e,c=o.properties.displayName??n;if(i){if(!Y(o))throw new u(`--use-sso was set but '${c}' does not support single sign-on (SSO) authentication.
|
|
13
|
-
To fix: Re-run without both --use-sso and --non-interactive to create a connection interactively.`);let a=r.filter(d=>z(d,o));if(a.length>0){let[d]=a;return h(`Using existing SSO connection '${d.properties.displayName}' (${d.name}).`),a.length>1&&I(`Multiple SSO connections found for '${c}'. Re-run with --connection-id <id> or -c <id> to use a specific one.`),{connectionId:d.name,autoSelected:!0}}try{let d=await W(t,n);return T(`Created a new connection '${d.properties.displayName}' (${d.name}).`),{connectionId:d.name,autoSelected:!1}}catch(d){let p=d instanceof Error?d.message:String(d);throw new u(`No SSO connection exists for '${c}' and automatic connection creation failed.
|
|
14
|
-
Reason: ${p}
|
|
15
|
-
To fix: Create one interactively (re-run without --non-interactive),
|
|
16
|
-
then re-run with --connection-id <id> or -c <id>.`)}}if(r.length===1){let[a]=r;return h(`Using existing connection '${a.properties.displayName}' (${a.name}).`),{connectionId:a.name,autoSelected:!0}}if(r.length===0&&G(o))try{let a=await W(t,n);return T(`Created a new connection '${a.properties.displayName}' (${a.name}).`),{connectionId:a.name,autoSelected:!1}}catch(a){let d=a instanceof Error?a.message:String(a);throw new u(`No connection exists for '${c}' and automatic connection creation failed.
|
|
17
|
-
Reason: ${d}
|
|
18
|
-
To fix: Create one interactively (re-run without --non-interactive),
|
|
19
|
-
then re-run with --connection-id <id> or -c <id>.`)}throw r.length>1?(V({title:`Available connections for ${c}`,columns:[{header:"Display Name",maxWidth:40},{header:"Connection ID"}],rows:r.map(a=>[a.properties.displayName,a.name]),totalLabel:"connection(s) found"}),new u(`Multiple connections exist for '${c}', so one cannot be selected automatically.
|
|
20
|
-
To fix: Re-run with --connection-id <id> or -c <id> to choose one,
|
|
21
|
-
or re-run without --non-interactive to select one interactively.`)):new u(`'${c}' requires a connection that cannot be created automatically in non-interactive mode.
|
|
22
|
-
To fix: Create one interactively (re-run without --non-interactive),
|
|
23
|
-
then re-run with --connection-id <id> or -c <id>.
|
|
24
|
-
Tip: Run '${"ms"} connector list' to browse available connectors.`)}async function W(e,t){let n=$(),o=U();return ue({authProvider:e.getAuthenticationProvider(),region:o.region,environmentName:o.environmentName,actionsParams:{connectorId:t},logger:n})}function Oe(e,t){return`Note: connection '${e}' was auto-selected for connector '${t}' because no --connection-id was provided. For tabular connectors, the connection needs to have access to the target resource, so this failure may not clearly indicate the root cause:
|
|
25
|
-
- If the connection is broken or expired, re-authenticate it and re-run.
|
|
26
|
-
- If the connection is valid but targets the wrong resource, re-run with an explicit --connection-id <id> for the intended resource.`}async function q(e,t){try{return await e()}catch(n){throw t.autoSelected&&n instanceof Error&&!(n instanceof u)&&(n.message=`${n.message}
|
|
27
|
-
|
|
28
|
-
${Oe(t.connectionId,t.connectorLabel)}`),n}}async function X(e){if(!he("ENABLE_CONNECTOR_USER_CONSENT"))return;let{apiId:t,connectionId:n}=e,o=$(),r=o.trackScenario("ConnectorUserConsent",{apiId:t,connectionId:n});try{await re(t,n,o),r.complete()}catch(i){if(i instanceof ne&&i.status===403){r.failure(i),I(`Could not request user consent on connection '${n}' (HTTP 403). The data source was added, but later calls against this connection may fail until your tenant admin grants the calling application the 'Connectivity.Connections.UserConsent' delegated permission.`);return}r.failure(i);let c=i instanceof Error?i.message:String(i);I(`Could not request user consent on connection '${n}': ${c}. The data source was added, but later calls against this connection may fail.`)}}async function Fe(e){let{connectorName:t,region:n,environmentId:o}=e,r=crypto.randomUUID();return new Promise((i,c)=>{let f=Ie.createServer((l,m)=>{let s=new URL(l.url??"/","http://localhost");if(s.pathname==="/callback"&&l.method==="GET"){if(s.searchParams.get("nonce")!==r){m.writeHead(403,{"Content-Type":"text/html; charset=utf-8"}),m.end("<html><body><h2>Connection request verification failed. Please run the CLI command again.</h2></body></html>"),p(),i({status:"cancelled"});return}let E=s.searchParams.get("v");E!==K&&I(`Warning: callback protocol version mismatch (expected ${K}, got ${E??"none"}). Update the CLI to the latest version.`);let D=s.searchParams.get("status"),A=s.searchParams.get("message")??void 0;m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"});let g;if(D==="created")g="<html><body><h2>Connection created! You can close this tab.</h2></body></html>";else if(D==="error"){let v=A?A.replace(/[&<>"']/g,R=>`&#${R.charCodeAt(0)};`):"";g=v?`<html><body><h2>Connection creation failed. You can close this tab.</h2><p>${v}</p></body></html>`:"<html><body><h2>Connection creation failed. You can close this tab.</h2></body></html>"}else g="<html><body><h2>Connection creation cancelled. You can close this tab.</h2></body></html>";m.end(g),p(),i(D==="created"?{status:"created",connectionId:s.searchParams.get("connectionId")??void 0,connectionName:s.searchParams.get("connectionName")??void 0,displayName:s.searchParams.get("displayName")??void 0}:D==="error"?{status:"error",errorMessage:A}:{status:"cancelled"});return}m.writeHead(404),m.end("Not found")});f.listen(0,"localhost",async()=>{let l=f.address(),s=`http://localhost:${typeof l=="object"&&l?l.port:0}/callback`,y=te(n,{connector:t,callbackUrl:s,nonce:r,protocolVersion:K,environmentId:o});h(`Opening browser at ${y}`);try{await xe(y,{wait:!1})}catch{h(`Could not open browser automatically. Please navigate to:
|
|
29
|
-
${y}`)}h(`Waiting for connection creation... (press Ctrl+C to cancel)
|
|
30
|
-
`)}),f.on("error",l=>{p(),c(l)});let a=setTimeout(()=>{h(`
|
|
31
|
-
Connection creation timed out after 10 minutes.`),p(),i({status:"cancelled"})},ke),d=()=>{h(`
|
|
32
|
-
Cancelling...`),p(),i({status:"cancelled"})};function p(){clearTimeout(a),process.off("SIGINT",d),f.close()}process.on("SIGINT",d)})}function Te(e){e.length!==0&&I(`The following connector operations are blocked by your organization's policy and were not generated.
|
|
33
|
-
Ask your admin to allow them on 'Microsoft Dataverse' to restore the missing service methods:
|
|
34
|
-
`+e.map(({operationId:t,methodName:n})=>` \u2022 ${t} (generates ${n}())`).join(`
|
|
35
|
-
`))}async function Pe(e){let{argumentProvider:t,connector:n,apiId:o,connectionIdFlag:r,datasetFlag:i,tableFlag:c,skipCodegen:f,useV1Codegen:a,useSso:d}=e,p=x(),{fileConfig:l,cliFs:m}=p,s=U(),y=t.getAuthenticationProvider(),E=$(),D={appConfigPath:l.appConfigPath,schemaPath:l.schemaPath,codeGenPath:l.codeGenPath},A={vfs:m,authProvider:y,httpClient:t.getHttpClient(),region:s.region,environmentName:s.environmentName,localFilePaths:D,logger:E},g=n.properties.displayName??o,v=r,R=!1;if(!v){let L=await Q({argumentProvider:t,apiId:o,connector:n,useSso:d});v=L.connectionId,R=L.autoSelected}let M={autoSelected:R,connectionId:v,connectorLabel:g};await X({apiId:o,connectionId:v});let S=i;if(!S){let L={...A,actionsParams:{apiId:o,connectionId:v}},{value:_}=await q(()=>fe(L),M);if(!p.interactive)throw V({title:`Available datasets for ${g}`,columns:[{header:"Display Name",maxWidth:40},{header:"Dataset Name"}],rows:_.map(C=>[C.DisplayName||C.Name,C.Name]),emptyMessage:"No datasets found for this connection.",totalLabel:"dataset(s) found"}),new u("Re-run with --dataset <name> or -d <name>.");S=await J({message:"Select a dataset:",options:_.map(C=>({value:C.Name,label:C.DisplayName||C.Name,hint:C.Name})),manualPromptMessage:"Enter dataset name:"})}let F=c;if(!F){let L={...A,actionsParams:{apiId:o,connectionId:v,dataset:S}},{value:_}=await q(()=>ge(L),M);if(!p.interactive)throw V({title:`Available tables in dataset '${S}'`,columns:[{header:"Display Name",maxWidth:40},{header:"Table Name"}],rows:_.map(C=>[C.DisplayName||C.Name,C.Name]),emptyMessage:"No tables found in this dataset.",totalLabel:"table(s) found"}),new u("Re-run with --table <name> or -t <name>.");F=await J({message:"Select a table:",options:_.map(C=>({value:C.Name,label:C.DisplayName||C.Name,hint:C.Name})),manualPromptMessage:"Enter table name:"})}let k={...A,actionsParams:{apiId:o,connectionId:v,dataset:S,tableName:F,skipCodegen:f,useV1Codegen:a}},N=await q(()=>me(k),M);T(`Data source '${N}' added successfully (table '${F}' from connector '${g}').`),h(`Hint: Run '${"ms"} app dev' to test locally, or '${"ms"} app deploy' to deploy.`)}async function Z(e){let{argumentProvider:t,connector:n,apiId:o,connectionIdFlag:r,skipCodegen:i,useV1Codegen:c,useSso:f,policy:a,dataverseEnvironmentId:d,dataverseTable:p,forceTableBinding:l}=e,m=x(),{fileConfig:s,cliFs:y}=m,E=U(),D=t.getAuthenticationProvider(),A=$(),g=(n.properties.connectionParameterSets?.values?.length??0)>1,v=r;g&&!v&&(v=(await Q({argumentProvider:t,apiId:o,connector:n,useSso:f})).connectionId),g&&v&&await X({apiId:o,connectionId:v});let R=a?le(a,n.name??o):void 0,M=H(o),S=await Re({isCommonDataServiceForApps:M,forceTableBinding:!!l,dataverseEnvironmentId:d,dataverseTable:p}),F=N=>({vfs:y,authProvider:D,httpClient:t.getHttpClient(),region:E.region,environmentName:E.environmentName,actionsParams:{apiId:o,connectionId:v,skipCodegen:i,useV1Codegen:c,actionPolicy:R,...N},localFilePaths:{appConfigPath:s.appConfigPath,schemaPath:s.schemaPath,codeGenPath:s.codeGenPath},logger:A}),k;try{k=await j(F(S))}catch(N){throw N instanceof ce||N instanceof ee?new u(N.message):N}if(k.filteredCount>0&&h(`Skipped ${k.filteredCount} of ${k.totalCount} actions due to your organization's connector policy.`),Te(k.skippedDataverseMethods),T(`Data source '${k.dataSourceName}' added successfully (connector '${n.properties.displayName??o}').`),S?.dataverseTable&&T(`Dataverse table '${S.dataverseTable}' bound successfully.`),M&&m.interactive&&!S&&await B({message:"Connect this to a specific Dataverse table?",initialValue:!0})){let L=await j(F(await $e({})));T("Dataverse table binding added successfully."),Te(L.skippedDataverseMethods)}h(`Hint: Run '${"ms"} app dev' to test locally, or '${"ms"} app deploy' to deploy.`)}async function Re(e){if(!e.isCommonDataServiceForApps)return;let t=x(),n=!!e.dataverseTable;if(!t.interactive)return n?{dataverseEnvironmentId:e.dataverseEnvironmentId,dataverseTable:e.dataverseTable}:void 0;if(!(!n&&!e.forceTableBinding))return $e({dataverseEnvironmentId:e.dataverseEnvironmentId,dataverseTable:e.dataverseTable})}async function $e(e){let t=e.dataverseTable??await ve({message:"Dataverse table logical name:"});return{dataverseEnvironmentId:e.dataverseEnvironmentId,dataverseTable:t}}function Ee(e){return e.properties.capabilities?.some(t=>t.toLowerCase()==="tabular")??!1}async function fn(e){Ue(e),await e.runVerb(),we();let t=await e.getOption("connector"),n=await e.getOption("connectionId",!0),o=await e.getOption("dataset",!0),r=await e.getOption("table",!0),i=await e.getOption("as",!0),c=await e.getOption("dataverseEnvironmentId",!0),f=!!await e.getOption("skipCodegen",!0),a=!!await e.getOption("useV1Codegen",!0),d=!!await e.getOption("useSso",!0),p;if(i!==void 0&&i!==""){let g=i.toLowerCase();if(g!=="table"&&g!=="action")throw new u(`Invalid value for --as: '${i}'. Expected 'table' or 'action'.`);p=g}let l=await Se(t,$()),{connector:m,policy:s}=await Ne(e,l),y=m.properties.displayName??l,E=Ee(m);if(H(l)){if(o)throw new u("--dataset is not used with the Common Data Service for Apps connector. Use --table to specify a Dataverse logical name.");let g=p==="table";if(!x().interactive&&(g||c)&&!r)throw new u("Adding a Dataverse table requires --table <logical-name> for the Common Data Service for Apps connector. --dataverse-environment-id is optional and defaults to the app environment.");await Z({argumentProvider:e,connector:m,apiId:l,connectionIdFlag:n,skipCodegen:f,useV1Codegen:a,useSso:d,policy:s,dataverseEnvironmentId:c,dataverseTable:r,forceTableBinding:g});return}if(c)throw new u("--dataverse-environment-id can only be used with the Common Data Service for Apps connector (--connector shared_commondataserviceforapps or --connector commondataserviceforapps).");let A=await Me({isTabular:E,asFlag:p,connectorLabel:y});if(A==="action"&&(o||r))throw new u("--dataset and --table cannot be used with --as action. Re-run with --as table, or omit those flags.");A==="table"?await Pe({argumentProvider:e,connector:m,apiId:l,connectionIdFlag:n,datasetFlag:o,tableFlag:r,skipCodegen:f,useV1Codegen:a,useSso:d}):await Z({argumentProvider:e,connector:m,apiId:l,connectionIdFlag:n,skipCodegen:f,useV1Codegen:a,useSso:d,policy:s})}async function Me(e){let{isTabular:t,asFlag:n,connectorLabel:o}=e,r=x();if(!t){if(n==="table")throw new u(`Connector '${o}' does not support tabular data sources. Re-run without --as table, or with --as action.`);return"action"}if(n)return n;if(!r.interactive)throw new u(`Connector '${o}' supports both tables and actions. Specify --as table or --as action.`);return await B({message:`Connector '${o}' supports tables. Add a table? (No \u2192 add actions instead)`,initialValue:!0})?"table":"action"}function Ue(e){e.getResolvedCommand()?.path.at(-1)==="connector"?(e.setDescription(`${w.app.add.connector.deprecation}
|
|
36
|
-
|
|
37
|
-
${w.app.add.connector.description}`),e.addExamples(w.app.add.connector.deprecatedExamples)):(e.setDescription(w.app.add.connector.description),e.addExamples(w.app.add.connector.examples)),e.addOptions([ye({flags:{key:P.Connector.name},env:P.Connector.envVar,message:P.Connector.promptMessage,description:w.app.add.connector.options.connector}),{flags:{key:P.ConnectionId.name,alias:P.ConnectionId.alias},env:P.ConnectionId.envVar,description:w.app.add.connector.options.connectionId,optionalInNonInteractive:!0},{flags:{key:P.Dataset.name,alias:P.Dataset.alias},env:P.Dataset.envVar,description:w.app.add.connector.options.dataset,optionalInNonInteractive:!0},{flags:{key:b.Table.name,alias:b.Table.alias},env:b.Table.envVar,description:w.app.add.connector.options.table,optionalInNonInteractive:!0},{flags:{key:b.As.name},env:b.As.envVar,description:w.app.add.connector.options.as,optionalInNonInteractive:!0},{flags:{key:b.DataverseEnvironmentId.name},env:b.DataverseEnvironmentId.envVar,description:w.app.add.connector.options.dataverseEnvironmentId,optionalInNonInteractive:!0}]),e.addSwitch({flags:{key:b.SkipCodegen.name},env:b.SkipCodegen.env,description:w.app.add.connector.options.skipCodegen}),e.addSwitch({flags:{key:b.UseSso.name},env:b.UseSso.env,description:w.app.add.connector.options.useSso}),e.addSwitch({flags:{key:b.UseV1Codegen.name},env:b.UseV1Codegen.env,description:"Use V1 (legacy) code generation instead of V2.",hidden:!0})}export{fn as addConnectorAsync};
|
|
38
|
-
/*!
|
|
39
|
-
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
40
|
-
*/
|
|
41
|
-
//# sourceMappingURL=AddConnector-5DUBFLEK.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
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 $}from"./chunk-VMSJG53Y.js";import"./chunk-OL6CTXQR.js";import{a as R}from"./chunk-KYL2Y5G4.js";import"./chunk-7GGFN2IW.js";import"./chunk-4VBFOKV6.js";import{d as I}from"./chunk-7BRIEYGR.js";import{h as B}from"./chunk-SNWTSI75.js";import{X as S,ua as M,va as N}from"./chunk-4LIR3ZYP.js";import{b as c}from"./chunk-RBG2H562.js";import"./chunk-UNJJUCSA.js";import"./chunk-6RSE3J4X.js";import"./chunk-EX6IKPAO.js";import{n as e}from"./chunk-3JIZGVCA.js";import{c as p,d as r,e as A,h as b}from"./chunk-PVAIJSAI.js";import{a as i}from"./chunk-47LJLFDF.js";import{a as h}from"./chunk-PPW4XUZO.js";import"./chunk-Y5AMO72S.js";import"./chunk-UT667QSU.js";async function Q(t){if(D(t),await t.runVerb(),!t.getEnvironmentId())throw new c(`\`ms app build-app\` is deprecated and the \`--environment-id\` flag has been removed. The replacement flow is \`ms app create\` (scaffolds the app and writes ${h}) followed by \`ms app deploy\`. To run this deprecated command, invoke it from a directory with a ${h} (created by \`ms app create\`).`);let a=await t.getTenantIdAsync();if(!a)throw new c("Unable to determine tenant ID. Ensure you are logged in.");let l=await B(t),v=await t.getOption(e.NoWait.camelName)===!1,o=await t.getOption("commit",!0),m,y=!1;if(!o){let n=I();if(!n)throw new c("Could not determine the latest commit ID. Use --commit or -c to specify it.");o=n.commitSha,m=n.detached?void 0:n.branch,y=!0}let d=t.isJsonMode();y&&!d&&b(m?`Using branch '${m}' at commit ${o}.`:`Detached HEAD at commit ${o}.`);let w=N().appConfig,u=w?.repoType,C=w?.externalRepoUrl,F=await t.getOption(e.OpenBrowser.camelName,!0)??!1,k=await t.getOption(e.ForceReauth.camelName,!0)??!1;d&&u==="github"&&A({phase:"build-validation"});let g=await R(({isRetry:n})=>S({logger:M(),actionsParams:{appName:l,commitSha:o,...k&&!n&&u==="github"&&{forceReauth:!0}}}),{repoType:u,externalRepoUrl:C,tenantId:a,jsonMode:d,openBrowser:F,verb:"app build"});if(g===null){O(t.isJsonMode(),o);return}if(v){J(t.isJsonMode(),l,o);return}let f=await $({appName:l,commitSha:o,initialWaitMs:g.retryAfterMs??1e3,isJsonMode:t.isJsonMode()});t.isJsonMode()?r(f):(p(`Build status: ${f.status}`),f.status==="Succeeded"&&b(`Run \`ms app dev\` to run your app locally, or \`ms app deploy --commit ${o}\` to make this app live.`))}function D(t){t.setDescription(i.app.build.description),t.addExamples(i.app.build.examples),t.addOptions([{flags:{key:e.AppName.name},env:e.AppName.envVar,description:i.app.build.options.appName,optionalInNonInteractive:!0},{flags:{key:e.CommitSha.name,alias:e.CommitSha.alias},env:e.CommitSha.envVar,description:i.app.build.options.commitSha,optionalInNonInteractive:!0}]),t.addSwitch({flags:{key:e.NoWait.name},description:i.app.build.options.noWait}),t.addSwitch({flags:{key:e.OpenBrowser.name},description:i.app.build.options.openBrowser}),t.addSwitch({flags:{key:e.ForceReauth.name},description:i.app.build.options.forceReauth})}function J(t,s,a){if(t){r({commitSha:a,buildStatusCommand:`ms app build-status --app ${s} --commit ${a}`});return}p(`Build started for commit ${a}. Run \`ms app build-status --app ${s} --commit ${a}\` to check status.`)}function O(t,s){if(t){r({cached:!0,commitSha:s});return}p("Build already up to date for this commit.")}export{Q as buildMaafAppAsync};
|
|
8
|
-
/*!
|
|
9
|
-
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
-
*/
|
|
11
|
-
//# sourceMappingURL=BuildMaafApp-A4IUU6LI.js.map
|