@sap/generator-fiori
Version:
Create an SAPUI5 application using SAP Fiori elements or a freestyle approach
1 lines • 46.7 kB
JavaScript
;exports.id=6859,exports.ids=[6859],exports.modules={45058(e,i,n){n.r(i),n.d(i,{FioriAppGeneratorHeadless:()=>FioriAppGeneratorHeadless,default:()=>v});var a=n(40511),r=n(94443),o=n(11128),s=n(30325),p=n(25182),c=n(11278),l=n(7013),d=n(86985),m=n(76760),g=n(3340),u=n(70071);function _setProjectDefaults(e){const i=e.ui5Version||d.Vo[0].version;return{name:e.name??(0,u.t)("defaults.projectName"),targetFolder:e.targetFolder??process.cwd(),namespace:e.namespace??"",title:e.title??(0,u.t)("defaults.projectTitle"),description:e.description??(0,u.t)("default.projectDescription"),ui5Version:i,localUI5Version:e.localUI5Version??i,ui5Theme:e.ui5Theme??(0,d.UK)(i),skipAnnotations:e.skipAnnotations??g.cY[l.rp.skipAnnotations],enableEslint:e.enableEslint??g.cY[l.rp.enableEslint],enableTypeScript:e.enableTypeScript??g.cY[l.rp.enableTypeScript],sapux:e.sapux||!1,enableVirtualEndpoints:e.enableVirtualEndpoints??!0,flpAppId:""}}function _setServiceDefaults(e,i){let n;if(i?.edmx)n=(0,u.gn)(i.edmx);else{if("FF_SIMPLE"!==e&&!i?.capService?.projectPath)throw Error((0,u.t)("error.appConfigMissingRequiredProperty",{propertyName:"edmx"}));if("FF_SIMPLE"===e)return{source:c.cT.none}}const a={host:i?.host,servicePath:i?.servicePath,client:i?.client,edmx:i?.edmx,version:n,valueListMetadata:i?.externalServices};if(i?.destination)return a.destinationName=i.destination,a.source=c.cT.sapSystem,a;if(i?.apiHubApiKey)a.apiHubConfig={apiHubKey:i.apiHubApiKey,apiHubType:g.sm.apiHub},a.source=c.cT.businessHub;else if(i?.capService?.projectPath){if(!i.capService.serviceName)throw Error((0,u.t)("error.appConfigMissingRequiredProperty",{propertyName:"capService.serviceName"}));a.capService=function _setCAPServicePaths(e){const i=(0,r.getCapFolderPathsSync)(e.projectPath);return{projectPath:e.projectPath,serviceName:e.serviceName,serviceCdsPath:e.serviceCdsPath,appPath:i?.app,capType:(0,g.L_)(e.capType)}}(i.capService),a.version=p.Yw.v4,a.source=c.cT.capProject}else a.source=!i?.servicePath&&i?.edmx?c.cT.metadataFile:i?.edmx?i?.scp?c.cT.sapSystem:c.cT.odataServiceUrl:c.cT.none;return a}var f=n(73024);function resolveMetadata(e){if(e.trimStart().startsWith("<"))return e;const i=(0,m.isAbsolute)(e)?e:(0,m.resolve)(process.cwd(),e);if(!(0,f.existsSync)(i))throw new Error(`Metadata file not found: ${i}`);try{return(0,f.readFileSync)(i,"utf-8")}catch(e){throw new Error(`Failed to read metadata file: ${i}. ${e instanceof Error?e.message:e}`)}}function resolveEntityData(e){if(Array.isArray(e))return e;const i=(0,m.isAbsolute)(e)?e:(0,m.resolve)(process.cwd(),e);if(!(0,f.existsSync)(i))throw new Error(`Entity data file not found: ${i}`);try{return JSON.parse((0,f.readFileSync)(i,"utf-8"))}catch(e){throw new Error(`Failed to read or parse entity data file: ${i}. ${e instanceof Error?e.message:e}`)}}class FioriAppGeneratorHeadless extends o.m{constructor(e,i){super(e,i),this.log((0,s.t)("logMessages.generatingAppWithVersion",{generatorName:"@sap-ux/fiori-app-sub-generator:headless",generatorVersion:this.rootGeneratorVersion()}));try{const e=this.options.appConfig;e.service?.externalServices&&(e.service.externalServices=function resolveExternalServices(e){return e.map(e=>({...e,metadata:resolveMetadata(e.metadata),entityData:e.entityData?resolveEntityData(e.entityData):void 0}))}(e.service.externalServices)),this.state=function transformExtState(e){if("0.2"!==e.version)throw Error((0,u.t)("error.appConfigVersion",{versions:"0.2"}));const{project:i,service:n,floorplan:a}=e,r={project:_setProjectDefaults(i),service:_setServiceDefaults(a,n),floorplan:g.$M[a]??g.g6[a]};return r.service.capService&&(r.project.targetFolder=(0,m.join)(r.service.capService.projectPath,r.service.capService.appPath??"")),"FF_SIMPLE"!==a&&e.entityConfig?(r.entityRelatedConfig=function _setEntityRelatedConfig(e){const i={hierarchyQualifier:e.entityConfig?.hierarchyQualifier,tableType:e.entityConfig?.tableType,addFEOPAnnotations:e.entityConfig?.generateFormAnnotations,addLineItemAnnotations:e.entityConfig?.generateLROPAnnotations};return e.alpOptions&&(i.tableAutoHide=e.alpOptions?.autoHide,i.tableMultiSelect=e.alpOptions?.multiSelect,i.presentationQualifier=e.alpOptions?.qualifier,i.tableSelectionMode=e.alpOptions?.selectionMode,i.smartVariantManagement=e.alpOptions?.smartVariantManagement),e.entityConfig?.mainEntity&&(i.mainEntity={entitySetName:e.entityConfig.mainEntity.entityName,entitySetType:e.entityConfig.mainEntity.type}),e.entityConfig?.navigationEntity&&(i.navigationEntity={entitySetName:e.entityConfig.navigationEntity.EntitySet,navigationPropertyName:e.entityConfig?.navigationEntity.Name}),e.entityConfig?.filterEntityType&&(i.filterEntitySet={entitySetName:e.entityConfig.filterEntityType,entitySetType:e.entityConfig.filterEntityType}),i}(e),n?.annotations&&(r.service.annotations=Array.isArray(n.annotations)?n?.annotations:[n?.annotations])):"FF_SIMPLE"===e.floorplan&&(r.viewName=e.project.viewName),r}(e)}catch(e){this.log((0,s.t)("logMessages.generatorExiting")),this.env.error(e)}}async initializing(){await(0,s.o_)(),await r.TelemetryHelper.initTelemetrySettings({consumerModule:{name:o.$,version:this.rootGeneratorVersion()},internalFeature:(0,a.isInternalFeaturesSettingEnabled)(),watchTelemetrySettingStore:!1}),r.TelemetryHelper.createTelemetryData({AppGenLaunchSource:this.options.appConfig.telemetryData?.generationSourceName??"Headless",AppGenLaunchSourceVersion:this.options.appConfig.telemetryData?.generationSourceVersion??"Not Provided"})}async writing(){return super.writing()}async install(){await super.install()}async end(){await super.end()}}const v=900==n.j?FioriAppGeneratorHeadless:null},68646(e,i,n){n.r(i),n.d(i,{default:()=>r});var a=n(11128);const r=9754==n.j?a.m:null},11128(e,i,n){n.d(i,{$:()=>b,m:()=>FioriAppGenerator});var a=n(73667),r=n(76178),o=n(40511),s=n(25182),p=n(39034),c=n(94443),l=n(11278),d=n(41602),m=n(86985),g=n(76760),u=n(91170),f=n(3340),v=n(70071),y=n(70025);async function runPostGenerationTasks({service:e,project:i},n,o,s,p,l){e.capService||await(0,v.LO)({targetFolder:i.targetFolder,projectName:i.name,flpAppId:i.flpAppId,sapClientParam:e.sapClient?(0,v.rS)(e.sapClient):void 0,odataVersion:e.odataVersion,datasourceType:e.datasourceType,enableVirtualEndpoints:i.enableVirtualEndpoints},n,s,o);const d=(0,c.getHostEnvironment)();if(e.backendSystem&&d!==c.hostEnvironment.bas&&e.backendSystem.newOrUpdated){(await(0,y.cQ)({logger:o,entityName:"system"})).write(e.backendSystem,{force:!0}).catch(i=>{o.error((0,v.t)("logMessages.backendSystemSaveError",{system:e.backendSystem?.name,error:i.message}))})}e.capService&&p&&p.showInformation((0,v.t)("wizardMessages.filesGenerated"),a.MessageType.notification),d!==c.hostEnvironment.bas&&e.apiHubConfig?.apiHubType===f.sm.apiHub&&await async function saveApiHubApiKey(e,i){let n;if(!(0,r.isAppStudio)()){const a=await(0,y.cQ)({logger:i,entityName:"api-hub"}),r=new y.b4({apiKey:e});n=await a.write(r)}return Boolean(n)}(e.apiHubConfig.apiHubKey,o);const m=(0,g.join)(i.targetFolder,i.name);o.info((0,v.t)("logMessages.applicationGenerationSuccess",{targetFolder:m})),await(0,c.sendTelemetry)("GENERATION_SUCCESS",c.TelemetryHelper.telemetryData,m),await async function runPostGenHooks(e,i,n,a){await(0,v.Eu)("app-generated",{hookParameters:{fsPath:e,...a?.cmdParams},vscodeInstance:n,options:{command:a?.cmdName}},i)}(m,o,s,l)}async function installDependencies({appPackagePath:e,capService:i,useNpmWorkspaces:n,ui5Version:a},r){let o;i&&(o={rootPath:i.projectPath,depsInstallPath:n?i.projectPath:e,useWorkspaces:n,ui5Version:a}),await async function installProjectDependencies(e,i,n){const a="win32"===process.platform?"npm.cmd":"npm",r=new v.qo(i),o=[];o.unshift("install");try{i?.info((0,v.t)("logMessages.installingDependencies",{path:e}));const s=performance.now();await r.run(a,o,{cwd:e},!0),c.TelemetryHelper.createTelemetryData({installFailure:!1}),n?.useWorkspaces&&await r.run(a,["install","--no-audit","--no-fund","--silent","--prefer-offline","--no-progress"],{cwd:n.rootPath},!0);const p=performance.now();i?.debug((0,v.t)("logMessages.dependenciesInstalled",{installTime:Math.round((p-s)/1e3)}))}catch(e){i?.info(e??(0,v.t)("logMessages.errorInstallingDependencies")),c.TelemetryHelper.createTelemetryData({installFailure:!0}),(0,c.sendTelemetry)("GENERATION_INSTALL_FAIL",c.TelemetryHelper.telemetryData)}}(o?.depsInstallPath??e,r,o)}var h=n(7013),S=n(47886);function validateViewName(e){if(!e)return(0,v.t)("prompts.viewName.validationMessages.viewNameRequired");const i=/^[a-zA-Z]+[a-zA-Z0-9-_]{0,120}$/.test(e);return e.length>120?(0,v.t)("prompts.viewName.validationMessages.viewNameTooLong"):!!i||(0,v.t)("prompts.viewName.validationMessages.viewNameInvalid")}async function promptUI5ApplicationAnswers({service:e,projectName:i,targetFolder:n,promptSettings:a,floorplan:r,promptExtension:o,entityRelatedConfig:s},p,d){let u;u=d?.actualAdapter?d.actualAdapter:d;const y=await async function createUI5ApplicationPromptOptions(e){const{service:i,appGenStepConfigList:n,floorplan:a,projectName:r,targetFolder:o,promptSettings:s,promptExtension:p,entityRelatedConfig:d}=e,u={hide:s?.[h.rp.ui5Version]?.hide??!1,minUI5Version:s?.[h.rp.ui5Version]?.minUI5Version??(0,v.O3)(i.version??l.Yw.v2,a,d),includeSeparators:(0,c.getHostEnvironment)()!==c.hostEnvironment.cli,useAutocomplete:(0,c.getHostEnvironment)()===c.hostEnvironment.cli},y=i.host?await(0,m.Dk)(i.host):void 0;y&&(u.defaultChoice={name:`${y} (Source system version)`,value:y});let E;E=i.capService?.projectPath?{default:(0,g.join)(i.capService.projectPath,i.capService.appPath??"")}:{defaultValue:o,validateFioriAppFolder:!0};const b={[h.rp.name]:{defaultValue:r},[h.rp.targetFolder]:E,[h.rp.ui5Version]:u,[h.rp.skipAnnotations]:{hide:!i.capService},[h.rp.addDeployConfig]:{validatorCallback:e=>{(0,v.Ks)(e,(0,v.t)("steps.projectAttributesConfig.title"),n,(0,v.t)("steps.deployConfig.title"))}},[h.rp.addFlpConfig]:{validatorCallback:e=>{(0,v.Ks)(e,(0,v.t)("steps.projectAttributesConfig.title"),n,(0,v.t)("steps.flpConfig.title"))}},[h.rp.enableTypeScript]:{default:f.cY[h.rp.enableTypeScript]},[h.rp.enableVirtualEndpoints]:{hide:"Java"===i.capService?.capType},[h.rp.enableEslint]:{hide:!0,default:!0}},C=S(b,s);[h.rp.skipAnnotations,h.rp.enableEslint,h.rp.ui5Theme].forEach(e=>{const i=C[e],n=f.cY[e];i?(i.advancedOption=!0,i.default||void 0===n||(i.default=n)):(C[e]={advancedOption:!0},void 0!==n&&(C[e].default=n))}),p&&Object.entries(p).forEach(([e,i])=>{Object.assign(C[e]??Object.assign(C,{[e]:{}})[e],i)});return C}({service:e,appGenStepConfigList:p,floorplan:r,projectName:i,targetFolder:n,promptSettings:a,promptExtension:o,entityRelatedConfig:s}),E=await(0,h.J1)(u,y,e.capService?.cdsUi5PluginInfo,(0,c.getHostEnvironment)()!==c.hostEnvironment.cli),b=(await(0,m.l_)({minSupportedUI5Version:y.ui5Version?.minUI5Version,onlyVersionNumbers:!0,onlyNpmVersion:!0,ui5SelectedVersion:E?.ui5Version??m.Jz}))[0]?.version;return{ui5AppAnswers:E,localUI5Version:b}}async function promptOdataServiceAnswers(e,i,n,a){let r;r=n?.actualAdapter?n.actualAdapter:n;const s=function createOdataServicePromptOptions(e){let i;const n=(0,c.getHostEnvironment)()!==c.hostEnvironment.cli;e.capService?i=l.cT.capProject:e.promptOptions?.systemSelection?.defaultChoice&&(i=l.cT.sapSystem);return{[l.rp.datasourceType]:{default:i,includeNone:!!e.allowNoDatasource,...e.promptOptions?.datasourceType},[l.rp.metadataFilePath]:{requiredOdataVersion:e.requiredOdataVersion,...e.promptOptions?.metadataFilePath},[l.rp.capProject]:{capSearchPaths:e.workspaceFolders??[],defaultChoice:e.capService?.projectPath,useAutoComplete:(0,c.getHostEnvironment)()===c.hostEnvironment.cli,...e.promptOptions?.capProject},[l.rp.capService]:{defaultChoice:e.capService,...e.promptOptions?.capService},[l.rp.serviceUrl]:{requiredOdataVersion:e.requiredOdataVersion,showCollaborativeDraftWarning:e.showCollabDraftWarning&&n,...e.promptOptions?.serviceUrl},[l.rp.serviceSelection]:{useAutoComplete:(0,c.getHostEnvironment)()===c.hostEnvironment.cli,requiredOdataVersion:e.requiredOdataVersion,showCollaborativeDraftWarning:e.showCollabDraftWarning&&n,...e.promptOptions?.serviceSelection},[l.rp.userSystemName]:{...e.promptOptions?.userSystemName},[l.rp.systemSelection]:{destinationFilters:{odata_abap:!0,full_service_url:!0,partial_service_url:!0},useAutoComplete:!n,includeCloudFoundryAbapEnvChoice:!0,...e.promptOptions?.systemSelection},[l.rp.valueHelpDownload]:{hide:!1,...e.promptOptions?.valueHelpDownload}}}(e),p=await(0,l.J1)(r,s,i,(0,o.isFeatureEnabled)(f.O5.enableGAIntegration),d.ClientFactory.getTelemetryClient(),(0,c.getHostEnvironment)()!==c.hostEnvironment.cli,a);return{host:p.origin,client:p.sapClient,servicePath:p.servicePath,serviceId:p.serviceId,edmx:p.metadata,annotations:p.annotations,valueListMetadata:p.valueListMetadata,version:p.odataVersion,capService:p.capService,source:p.datasourceType,localEdmxFilePath:p.metadataFilePath,connectedSystem:p.connectedSystem,ignoreCertError:p.ignoreCertError}}var E=n(55550);function getTemplateType(e){return{[f.$M.FE_ALP]:"alp",[f.$M.FE_FEOP]:"feop",[f.$M.FE_LROP]:"lrop",[f.$M.FE_OVP]:"ovp",[f.$M.FE_WORKLIST]:"worklist",[f.$M.FE_FPM]:"fpm",[f.g6.FF_SIMPLE]:"basic"}[e]}function canGenerateTests(e){return[s.nY.FormEntryObjectPage,s.nY.AnalyticalListPage,s.nY.ListReportObjectPage,s.nY.Worklist,s.nY.FlexibleProgrammingModel].includes(e)||e===p.nY.Basic}function getUI5Uri(){const e=process.env.UI5_CDN_URL?.replace(/\/{1,2083}$/,"");return e??f.y8.OFFICIAL_URL}function getPreviewSettings(e){let i={};if(e.destinationAuthType===r.Authentication.SAML_ASSERTION||e.connectedSystem?.destination?.Authentication===r.Authentication.SAML_ASSERTION||y.h_.ReentranceTicket===e.connectedSystem?.backendSystem?.authenticationType||e.connectedSystem?.backendSystem?.serviceKeys||(0,c.getHostEnvironment)()===c.hostEnvironment.bas&&e.connectedSystem?.destination&&(0,r.isAbapEnvironmentOnBtp)(e.connectedSystem?.destination)?i={authenticationType:y.h_.ReentranceTicket}:e.apiHubConfig&&(i={apiHub:!0}),"odata_service"===e.connectedSystem?.backendSystem?.connectionType){const n=e.connectedSystem.backendSystem.url;i={...i,connectPath:n?new URL(n).pathname:void 0}}return i}async function transformState({project:e,service:i,floorplan:n,entityRelatedConfig:a,viewName:r},c=!0){const d=function getBaseAppConfig({project:e,service:i,floorplan:n,entityRelatedConfig:a,viewName:r},o){const c=(0,v.R7)(e.name,e.namespace),l=i.capService?(0,v.ms)(i.capService.capType):"EDMXBackend",d=function transformTemplateType(e,i,n){if(e===f.g6.FF_SIMPLE)return{type:p.nY.Basic,settings:{viewName:n}};const a=getTemplateType(e);let r;i?.mainEntity&&(r={mainEntityName:i.mainEntity.entitySetName},i.mainEntity.mainEntityParameterName&&(r.mainEntityParameterName=i.mainEntity.mainEntityParameterName),i?.navigationEntity?.navigationPropertyName&&(r.navigationEntity={EntitySet:i.navigationEntity?.entitySetName,Name:i.navigationEntity?.navigationPropertyName}));const o=i?.addPageBuildingBlock?{pageBuildingBlockTitle:i.pageBuildingBlockTitle}:{};return{type:a,settings:{[s.nY.ListReportObjectPage]:{entityConfig:r,tableType:i?.tableType,hierarchyQualifier:i?.hierarchyQualifier},[s.nY.AnalyticalListPage]:{entityConfig:r,selectionMode:i?.tableSelectionMode,tableType:i?.tableType,hierarchyQualifier:i?.hierarchyQualifier,autoHide:i?.tableAutoHide,multiSelect:i?.tableMultiSelect,qualifier:i?.presentationQualifier?i?.presentationQualifier:void 0,smartVariantManagement:i?.smartVariantManagement},[s.nY.FormEntryObjectPage]:{entityConfig:r},[s.nY.OverviewPage]:{filterEntitySet:i?.filterEntitySet?.entitySetName},[s.nY.Worklist]:{entityConfig:r,tableType:i?.tableType,hierarchyQualifier:i?.hierarchyQualifier},[s.nY.FlexibleProgrammingModel]:{entityConfig:r,...o,pageName:f.wt}}[a]}}(n,a,r),{minUI5Version:g,ui5Version:u}=function getUI5VersionDefault(e,i,n){if(!i||i===m.Jz){return{minUI5Version:(0,v.O3)(n??s.Yw.v4,e)}}return{minUI5Version:i,ui5Version:i}}(n,e.ui5Version,i.version),y={app:{id:c,title:e.title,description:e.description,sourceTemplate:{toolsId:(0,v.We)()},projectType:l},package:{name:e.name,description:e.description,version:"0.0.1",sapuxLayer:(0,v.d1)(!1)},ui5:{version:u,ui5Theme:e.ui5Theme,localVersion:e.localUI5Version,minUI5Version:g,frameworkUrl:i.capService?f.y8.BCP_OFFICIAL_URL:getUI5Uri(),manifestLibs:n===f.g6.FF_SIMPLE?["sap.m","sap.ui.core"]:void 0,ui5Libs:[]},appOptions:{eslint:e.enableEslint,typescript:e.enableTypeScript,sapux:e.sapux,loadReuseLibs:!i.capService&&!e.enableVirtualEndpoints,addTests:canGenerateTests(d.type),generateIndex:o,...!(n===f.g6.FF_SIMPLE)&&{addAnnotations:a?.addFEOPAnnotations||a?.addLineItemAnnotations},useVirtualPreviewEndpoints:e.enableVirtualEndpoints,addCdsUi5Plugin:e.addCdsUi5Plugin??!0},template:d};return y}({project:e,service:i,floorplan:n,entityRelatedConfig:a,viewName:r},c);if(i.source!==l.cT.none){d.service={url:i.host??(i.edmx?void 0:f.HX),path:i.servicePath||f.qE,type:i.capService?E.ServiceType.CDS:E.ServiceType.EDMX,version:i.version??s.Yw.v4,metadata:i.edmx&&!i.capService?i.edmx:void 0,name:f.KL,client:i.client,model:d.template?.type===s.nY.OverviewPage?f.OY:"",previewSettings:i.previewSettings??{},annotations:!0!==e.skipAnnotations?await(0,v.Rh)(e.name,i.annotations?.[0],i?.capService):void 0,ignoreCertError:i.ignoreCertError,externalServices:i.valueListMetadata};const n=i.destinationName??i.connectedSystem?.destination?.Name;if(n&&(d.service.destination={name:n}),i.capService){const e=(0,o.isFeatureEnabled)("sap.ux.testBetaFeatures.disableCapRootPkgJsonUpdates"),{cdsUi5PluginInfo:n,...a}=i.capService;d.service.capService={...a,cdsUi5PluginInfo:n},!0===d.appOptions?.addCdsUi5Plugin&&(d.service.capService.cdsUi5PluginInfo=d.service.capService.cdsUi5PluginInfo??{},d.service.capService.cdsUi5PluginInfo.isWorkspaceEnabled=!0,d.service.capService.cdsUi5PluginInfo.hasCdsUi5Plugin=!0),d.appOptions={...d.appOptions,disableCapRootPkgJsonUpdates:e}}d.service.previewSettings={...d.service.previewSettings,...getPreviewSettings(i)}}return d}const b="@sap/generator-fiori";class FioriAppGenerator extends u{vscode;generationTime0;appWizard;state;static _logger=c.DefaultLogger;generatorVersion=this.rootGeneratorVersion();yeomanUiStepConfig;setPromptsCallback;prompts;fioriSteps;constructor(e,i){super(e,i,{unique:"namespace"}),this.vscode=i.vscode,FioriAppGenerator._logger=this.options.logWrapper??c.DefaultLogger,this.state=i.state??{project:{},service:{}}}static get logger(){return FioriAppGenerator._logger}async initializing(){if(await(0,v.XM)(),this.options.appWizard&&(this.appWizard=this.options.appWizard,(0,v.DH)(FioriAppGenerator._logger,this.options.appWizard)),await(0,d.initTelemetrySettings)({consumerModule:{name:b,version:this.rootGeneratorVersion()},internalFeature:(0,o.isInternalFeaturesSettingEnabled)(),watchTelemetrySettingStore:!1}),c.TelemetryHelper.createTelemetryData({...this.options.telemetryData}),!this.state.project?.ui5Version){const e={useCache:!0};(0,m.l_)(e)}this.options.floorplan&&(this.state.floorplan=this.options.floorplan),this.fioriSteps=this.options.fioriSteps??f.gp,this.yeomanUiStepConfig=this.options.yeomanUiStepConfig,this.prompts=this.yeomanUiStepConfig?.activeSteps}async prompting(){try{const e=this.options,i=this.state.floorplan===f.g6.FF_SIMPLE;if((0,v.rl)(this.fioriSteps,f.vM)){const n=(0,v.pf)(this.appWizard,"service",FioriAppGenerator.logger);(0,v.IA)(FioriAppGenerator.logger,n?.connectedSystem?.serviceProvider);const a={capService:n?.capService??this.state.service?.capService,requiredOdataVersion:(0,v.hs)(this.state.floorplan),allowNoDatasource:i,promptOptions:e.promptSettings?.["@sap/generator-fiori"],showCollabDraftWarning:e.showCollabDraftWarning,workspaceFolders:e.workspaceFolders};let r=await promptOdataServiceAnswers(a,FioriAppGenerator.logger,this.env.adapter,n?.connectedSystem);(0,c.getHostEnvironment)()!==c.hostEnvironment.cli&&(r.source===l.cT.none||r.edmx?(n?.connectedSystem&&JSON.stringify(r.connectedSystem?.backendSystem)===JSON.stringify(n?.connectedSystem?.backendSystem)&&(r.connectedSystem=n?.connectedSystem),(0,v.ls)(this.appWizard,{service:r},FioriAppGenerator.logger)):r=(0,v.pf)(this.appWizard,"service",FioriAppGenerator.logger)??r,r.source===l.cT.none||r.edmx||FioriAppGenerator.logger?.error((0,v.t)("error.fatalError"))),(0,v.IA)(FioriAppGenerator.logger,r?.connectedSystem?.serviceProvider),this.state.service={...this.state?.service,...r}}if(i){const e=await this.prompt([{type:"input",name:"viewName",message:(0,v.t)("prompts.viewName.message"),guiOptions:{breadcrumb:!0},default:"View1",validate:validateViewName}]);this.state.viewName=e.viewName}else if(this.state.service.edmx){const i=getTemplateType(this.state.floorplan),n={defaultMainEntityName:e.preselectedEntityName,useAutoComplete:(0,c.getHostEnvironment)()===c.hostEnvironment.cli,hideTableLayoutPrompts:!1===e.showLayoutPrompts,...i===f.$M.FE_FPM&&{displayPageBuildingBlockPrompt:!0}},a=(0,l.sC)(this.state.service.edmx,i,!!this.state.service.capService,n,this.state.service.annotations?.[0],FioriAppGenerator.logger,(0,c.getHostEnvironment)()!==c.hostEnvironment.cli),r=await this.prompt(a);this.state.entityRelatedConfig=Object.assign(this.state.entityRelatedConfig??{},r)}else FioriAppGenerator.logger.error((0,v.t)("error.edmxNotFound")),this._exitOnError((0,v.t)("error.edmxNotFound"));if(this.state.service.capService&&!this.state.service.capService.cdsUi5PluginInfo&&(this.state.service.capService.cdsUi5PluginInfo=await(0,v.JW)(this.state.service.capService.projectPath,this.fs,this.state.service.capService.cdsVersionInfo)),(0,v.rl)(this.fioriSteps,f.HO)){const{ui5AppAnswers:i,localUI5Version:n}=await promptUI5ApplicationAnswers({projectName:this.state.project?.name,targetFolder:this.state.project?.targetFolder,service:this.state.service,entityRelatedConfig:this.state.entityRelatedConfig,floorplan:this.state.floorplan,promptSettings:e.promptSettings?.["@sap/generator-fiori"],promptExtension:e.extensions},[this.yeomanUiStepConfig],this.env.adapter);this.state.project=Object.assign(this.state.project??{},i,{ui5Version:i?.ui5Version||n,localUI5Version:n}),this.state.project.flpAppId=(0,c.getFlpId)((0,v.R7)(this.state.project.name,i.namespace??""),this.state.floorplan===f.g6.FF_SIMPLE?f.jz:f.Xh)}this.state.project?.addDeployConfig&&((0,v.rl)(this.fioriSteps,f.IE)&&!(0,v.LW)((0,v.t)("steps.deployConfig.title"),this.yeomanUiStepConfig.activeSteps)&&(0,v.Hb)((0,v.t)("steps.projectAttributesConfig.title"),[this.yeomanUiStepConfig],!0,(0,v.t)("steps.deployConfig.title")),await async function addDeployGen({service:e,projectName:i,targetFolder:n,applicationType:a},r,o,s,p){await r("@sap/fiori:deploy-config",{launchDeployConfigAsSubGenerator:!0,appGenServiceHost:e.host,appGenServicePath:e.servicePath,appGenClient:e.client,connectedSystem:e.connectedSystem,apiHubConfig:e.apiHubConfig||void 0,appGenDestination:e.destinationName??e.connectedSystem?.destination?.Name,projectName:i,projectPath:n,appWizard:s,telemetryData:{appType:a},logWrapper:o,subGenPromptOptions:p})}({service:this.state.service,projectName:this.state.project.name,targetFolder:this.state.project.targetFolder,applicationType:this.state.floorplan===f.g6.FF_SIMPLE?"FF":"FE"},this.composeWith.bind(this),FioriAppGenerator.logger,this.appWizard,e.promptSettings?.["@sap-ux/deploy-config-sub-generator"])),this.state.project?.addFlpConfig&&((0,v.rl)(this.fioriSteps,f.v1)&&!(0,v.LW)((0,v.t)("steps.flpConfig.title"),this.yeomanUiStepConfig.activeSteps)&&(0,v.Hb)((0,v.t)("steps.projectAttributesConfig.title"),[this.yeomanUiStepConfig],!0,(0,v.t)("steps.flpConfig.title")),await async function addFlpGen({projectName:e,targetFolder:i,title:n,skipPrompt:a},r,o,s,p,l){let d={launchFlpConfigAsSubGenerator:!0,appWizard:s,vscode:p,appRootPath:(0,g.join)(i,e),logWrapper:o,inquirerPromptOptions:l};a&&(d={...d,skipPrompt:!0,inboundConfig:{semanticObject:(0,c.getSemanticObject)(e),action:f.jz,title:n}}),await r("@sap/fiori:flp-config",d)}({projectName:this.state.project.name,targetFolder:this.state.project.targetFolder,title:this.state.project.title,skipPrompt:!(0,v.rl)(this.fioriSteps,f.v1)},this.composeWith.bind(this),FioriAppGenerator.logger,e.vscode,this.appWizard,e.promptSettings?.["@sap-ux/flp-config-sub-generator"]))}catch(e){FioriAppGenerator.logger.error(`${(0,v.t)("error.fatalError")} : ${e}`),this._exitOnError(e)}}async writing(){try{this.generationTime0=performance.now(),c.TelemetryHelper.markAppGenStartTime();const{service:e,project:i,floorplan:n}=this.state;FioriAppGenerator.logger.info((0,v.t)("logMessages.copyingTemplateFiles",{templateName:this.state.floorplan}));const a=this.destinationRoot((0,g.join)(i.targetFolder,i.name)),o=performance.now();let d;if(this.state.floorplan===f.g6.FF_SIMPLE){const i=await transformState(this.state,!!e.capService||this.options.generateIndexHtml);await(0,p.cM)(a,i,this.fs),d=i}else{const i=await transformState(this.state,!!e.capService||this.options.generateIndexHtml);await(0,s.cM)(a,i,this.fs),d=i}const u=performance.now();FioriAppGenerator.logger.debug(`Writing Fiori application files from template took ${Math.round(u-o)} milliseconds.`),c.TelemetryHelper.createTelemetryData({Template:(0,v.t)(`floorplans.label.${n}`,{odataVersion:e.version}),DataSource:e.source,UI5Version:i.ui5Version||m.Jz,Theme:i.ui5Theme,AppGenVersion:this.generatorVersion,AppGenSourceType:e.source,AppGenSapSystemType:e.source===l.cT.sapSystem&&e.connectedSystem?(0,v.fs)(e.connectedSystem):"n/a",AppGenBusinessHubType:(0,v.fW)(e.apiHubConfig?.apiHubType),EnableEslint:i.enableEslint,EnableTypeScript:i.enableTypeScript,EnableVirtualEndpoints:i.enableVirtualEndpoints,ToolsId:d.app.sourceTemplate?.toolsId,ValueHelpCount:e.valueListMetadata?.length??0}),e.apiHubConfig&&(0,r.isAppStudio)()&&function writeAPIHubKeyFiles(e,i,n){const a=(0,g.join)(i,".env"),r=`API_HUB_API_KEY=${n.apiHubKey}\nAPI_HUB_TYPE=${n.apiHubType}`;e.write(a,r)}(this.fs,a,e.apiHubConfig);const y={ui5Version:d.ui5?.minUI5Version};await async function writeAppGenInfoFiles({project:e,service:i,floorplan:n,entityRelatedConfig:a,appGenInfo:r},o,s,p,l,d){const m=(0,v.t)(`floorplans.label.${n}`,{odataVersion:i.version}),u=(0,v.o_)(i.source,(0,v.Wm)(i.connectedSystem),i.apiHubConfig?.apiHubType),y=Object.assign({generatorName:o,generatorVersion:s,template:m,serviceType:u,serviceUrl:`${i.capService?f.w9:i.host??""}${i.servicePath??""}`||(0,v.t)("texts.notApplicable")},d,r);y.entityRelatedConfig??=[],a?.mainEntity&&y.entityRelatedConfig.push({type:(0,v.t)("readme.label.mainEntity"),value:a.mainEntity.entitySetName}),a?.navigationEntity&&y.entityRelatedConfig.push({type:(0,v.t)("readme.label.navigationEntity"),value:a.navigationEntity.navigationPropertyName||"None"}),a?.filterEntitySet&&y.entityRelatedConfig.push({type:(0,v.t)("readme.label.filterEntityType"),value:a.filterEntitySet.entitySetName});const h=await(0,v.fm)(i.capService,e.name,!!e.enableTypeScript,e.namespace),S={generationDate:y?.generationDate??(new Date).toString(),generatorPlatform:y?.generatorPlatform??(0,c.getHostEnvironment)().name,serviceType:y?.serviceType,metadataFilename:i.localEdmxFilePath?(0,g.basename)(i.localEdmxFilePath):"",serviceId:i.serviceId,serviceUrl:y?.serviceUrl,appName:e.name,appTitle:e.title,appDescription:e.description,appNamespace:e.namespace??"",ui5Theme:e.ui5Theme,ui5Version:y?.ui5Version||e.manifestMinUI5Version||e.ui5Version,enableEslint:e.enableEslint,enableTypeScript:e.enableTypeScript,showMockDataInfo:!!i.edmx&&!i.capService,generatorVersion:y?.generatorVersion??"",template:y?.template??"",generatorName:y?.generatorName??"",entityRelatedConfig:y?.entityRelatedConfig??[],externalParameters:y?.externalParameters,launchText:h,valueHelpDownloaded:i.valueListMetadata&&i.valueListMetadata.length>0};(0,c.generateAppGenInfo)(p,S,l)}(this.state,f.HN,this.generatorVersion,a,this.fs,y)}catch(e){FioriAppGenerator.logger.fatal(`${(0,v.t)("error.errorWritingApplicationFiles")} : ${e}`),this._exitOnError(e)}}async install(){this.options.skipInstall?FioriAppGenerator.logger.info((0,v.t)("logMessages.installSkippedOptionSpecified")):await installDependencies({appPackagePath:this.destinationPath(),capService:this.state.service.capService,useNpmWorkspaces:!!(this.state.project.enableTypeScript||this.state.service.capService?.cdsUi5PluginInfo?.isCdsUi5PluginEnabled||this.state.service.capService?.cdsUi5PluginInfo?.hasCdsUi5Plugin||this.state.service.capService?.cdsUi5PluginInfo?.isWorkspaceEnabled),ui5Version:this.state.project?.ui5Version},FioriAppGenerator.logger)}async end(){(0,v.eg)(this.appWizard,FioriAppGenerator.logger),await runPostGenerationTasks({service:{backendSystem:this.state.service.connectedSystem?.backendSystem,capService:this.state.service.capService,sapClient:this.state.service.client,odataVersion:this.state.service.version,datasourceType:this.state.service.source},project:{targetFolder:this.state.project.targetFolder,name:this.state.project.name,flpAppId:this.state.project.flpAppId,enableVirtualEndpoints:this.state.project.enableVirtualEndpoints}},this.fs,FioriAppGenerator.logger,this.vscode,this.appWizard,this.options.followUpCommand);const e=performance.now();FioriAppGenerator.logger.info(`Total time taken: ${Math.round((e-this.generationTime0)/1e3)} seconds.`)}_exitOnError(e){throw(0,c.sendTelemetry)("GENERATION_WRITING_FAIL",c.TelemetryHelper.telemetryData),(0,c.getHostEnvironment)()!==c.hostEnvironment.cli&&this.appWizard?.showError(`${(0,v.t)("error.fatalError")} : ${e}`,a.MessageType.notification),new Error(`${(0,v.t)("error.fatalError")} : ${e}`)}}},47214(e,i,n){n.d(i,{$M:()=>a.$M,Bb:()=>a.Bb,Bj:()=>a.Bj,FJ:()=>a.FJ,HN:()=>a.HN,HO:()=>a.HO,L_:()=>a.L_,O5:()=>a.O5,XM:()=>r.XM,d2:()=>a.d2,fW:()=>a.fW,g6:()=>a.g6,gn:()=>r.gn,gp:()=>a.gp,kD:()=>r.kD,lR:()=>a.lR,rl:()=>r.rl,sW:()=>r.sW,t:()=>r.t,v1:()=>a.v1,vM:()=>a.vM,x1:()=>a.x1});var a=n(3340),r=(n(68646),n(45058),n(70071));n(11128)},69297(e,i,n){n.d(i,{Bb:()=>c,HN:()=>C,HO:()=>g,HX:()=>y,IE:()=>u,KL:()=>E,N_:()=>w,O5:()=>N,OY:()=>b,Of:()=>A,Xh:()=>T,bM:()=>s,d2:()=>d,ec:()=>F,fW:()=>r,gp:()=>v,jz:()=>I,qE:()=>S,sm:()=>l,v1:()=>f,vM:()=>m,w9:()=>h,wt:()=>P,x1:()=>o,y8:()=>p});var a=n(30325);const r="capNode",o="capJava";var s;!function(e){e.ABAP_CLOUD="abapCloud",e.ON_PREM="onPrem"}(s||(s={}));const p={OFFICIAL_URL:"https://ui5.sap.com",BCP_OFFICIAL_URL:"https://sapui5.hana.ondemand.com",SNAPSHOT_URL:"https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com",VERSIONS_FILE:"neo-app.json"},c="sap-client";var l;!function(e){e.apiHub="API_HUB",e.apiHubEnterprise="API_HUB_ENTERPRISE"}(l||(l={}));const d="FLOORPLAN",m="DATASOURCE_AND_SERVICE",g="PROJECT_ATTRIBUTES",u="DEPLOY_CONFIG",f="FLP_CONFIG",v=[{key:d,name:(0,a.t)("steps.templateSelection.title"),description:(0,a.t)("steps.templateSelection.description"),order:0},{key:m,name:(0,a.t)("steps.datasourceAndServiceSelection.title"),description:(0,a.t)("steps.datasourceAndServiceSelection.description"),order:1},{key:"ENTITY",name:(0,a.t)("steps.entityOrViewConfig.title"),description:(0,a.t)("steps.entityOrViewConfig.description"),order:2},{key:g,name:(0,a.t)("steps.projectAttributesConfig.title"),description:(0,a.t)("steps.projectAttributesConfig.description"),order:3},{key:u,name:(0,a.t)("steps.deployConfig.title"),description:(0,a.t)("steps.deployConfig.description"),dependency:(0,a.t)("steps.projectAttributesConfig.title"),order:4},{key:f,name:(0,a.t)("steps.flpConfig.title"),description:(0,a.t)("steps.flpConfig.description"),dependency:(0,a.t)("steps.projectAttributesConfig.title"),order:5}],y="http://localhost",h="http://localhost:4004",S="/sap/opu/odata",E="mainService",b="mainModel",C="SAP Fiori Application Generator",P="Main",F="1.65.0",A="1.84.0",w="1.136.0",T="tile",I="display";var N;!function(e){e.enableGAIntegration="enableGAIntegration"}(N||(N={}))},62457(e,i,n){n.d(i,{$M:()=>o.FloorplanFE,Bj:()=>m,FJ:()=>d,L_:()=>capTypeConversion,cY:()=>g,g6:()=>o.FloorplanFF,lR:()=>l});var a=n(25182),r=n(39034),o=n(94443),s=n(11278),p=n(7013),c=n(69297);const l={[o.FloorplanFE.FE_LROP]:{supportedODataVersion:[s.Yw.v2,s.Yw.v4],templateType:a.nY.ListReportObjectPage},[o.FloorplanFE.FE_ALP]:{supportedODataVersion:[s.Yw.v2,s.Yw.v4],templateType:a.nY.AnalyticalListPage},[o.FloorplanFE.FE_WORKLIST]:{supportedODataVersion:[s.Yw.v2,s.Yw.v4],templateType:a.nY.Worklist},[o.FloorplanFE.FE_FEOP]:{supportedODataVersion:[s.Yw.v4],templateType:a.nY.FormEntryObjectPage},[o.FloorplanFE.FE_OVP]:{supportedODataVersion:[s.Yw.v2,s.Yw.v4],templateType:a.nY.OverviewPage},[o.FloorplanFE.FE_FPM]:{supportedODataVersion:[s.Yw.v4],templateType:a.nY.FlexibleProgrammingModel},[o.FloorplanFF.FF_SIMPLE]:{supportedODataVersion:[s.Yw.v2,s.Yw.v4],templateType:r.nY.Basic}};function capTypeConversion(e){return e===c.fW||"Node.js"===e?"Node.js":e===c.x1||"Java"===e?"Java":"Node.js"}var d,m;!function(e){e.Worklist="worklist",e.OverviewPage="ovp",e.ListReportObjectPage="lrop",e.AnalyticalListPage="alp",e.FormEntryObjectPage="feop",e.FlexibleProgrammingModel="fpm"}(d||(d={})),function(e){e.Simple="basic"}(m||(m={}));const g={[p.rp.enableEslint]:!0,[p.rp.skipAnnotations]:!1,[p.rp.enableTypeScript]:!1}},3340(e,i,n){n.d(i,{$M:()=>r.$M,Bb:()=>a.Bb,Bj:()=>r.Bj,FJ:()=>r.FJ,HN:()=>a.HN,HO:()=>a.HO,HX:()=>a.HX,IE:()=>a.IE,KL:()=>a.KL,L_:()=>r.L_,N_:()=>a.N_,O5:()=>a.O5,OY:()=>a.OY,Xh:()=>a.Xh,bM:()=>a.bM,cY:()=>r.cY,d2:()=>a.d2,fW:()=>a.fW,g6:()=>r.g6,gp:()=>a.gp,jz:()=>a.jz,lR:()=>r.lR,qE:()=>a.qE,sm:()=>a.sm,v1:()=>a.v1,vM:()=>a.vM,w9:()=>a.w9,wt:()=>a.wt,x1:()=>a.x1,y8:()=>a.y8});var a=n(69297),r=n(62457)},30325(e,i,n){n.d(i,{o_:()=>initI18nFioriAppSubGenerator,t:()=>t});var a=n(68801);const r=JSON.parse('{"floorplans":{"label":{"basic":"Basic{{odataVersion, odataVersionFormatter}}","fpm":"Custom Page{{odataVersion, odataVersionFormatter}}","lrop":"List Report Page{{odataVersion, odataVersionFormatter}}","worklist":"Worklist Page{{odataVersion, odataVersionFormatter}}","alp":"Analytical List Page{{odataVersion, odataVersionFormatter}}","ovp":"Overview Page{{odataVersion, odataVersionFormatter}}","feop":"Form Entry Object Page{{odataVersion, odataVersionFormatter}}"},"description":{"basic":"Create a freestyle application, starting with an empty page.","fpm":"Create an SAP Fiori elements application containing a custom page based on the flexible programming model.","lrop":"Create an SAP Fiori elements application containing a list report and an object page.","worklist":"Create an SAP Fiori elements application containing a worklist and an object page.","alp":"Create an SAP Fiori elements application containing an analytical list and an object page.","ovp":"Create an SAP Fiori elements application containing an overview page.","feop":"Create an SAP Fiori elements application containing an object page optimized for data entry."}},"defaults":{"projectName":"project{{defaultProjectNumber}}","projectTitle":"Application Title","projectDescription":"An SAP Fiori application."},"readme":{"label":{"mainEntity":"Main Entity","filterEntityType":"Filter Entity Type","navigationEntity":"Navigation Entity","sapSystemType":{"onPrem":"ABAP On-Premise","abapCloud":"ABAP Cloud"},"datasourceType":{"sapSystem":"SAP System","buinessHub":"SAP Business Accelerator Hub","apiBusinessHubEnterprise":"SAP API Business Hub Enterprise","capProject":"Local CAP","odataServiceUrl":"OData URL","none":"None","metadataFile":"File","projectSpecificDestination":"MTA File"}},"texts":{"runInstruction":"To launch the generated application, run the following from the generated application root folder:\\n\\n```\\n npm start\\n```"}},"texts":{"notApplicable":"N/A"},"steps":{"templateSelection":{"description":"Choose your application template.","title":"Template Selection"},"datasourceAndServiceSelection":{"description":"Configure the data source and select a service.","title":"Data Source and Service Selection"},"entityOrViewConfig":{"description":"Configure the selected service.","title":"Entity Selection"},"projectAttributesConfig":{"description":"Configure the main project attributes.","title":"Project Attributes"},"deployConfig":{"description":"Configure deployment settings.","title":"Deployment Configuration"},"flpConfig":{"description":"Configure SAP Fiori launchpad settings {{appFolderName}}.","title":"SAP Fiori Launchpad Configuration"}},"logMessages":{"installingDependencies":"Installing dependencies to package path: {{- path}}...","dependenciesInstalled":"Project dependencies installed in {{installTime}} seconds.","errorInstallingDependencies":"An unknown error occurred when installing the project dependencies.","commandFailedWithError":"{{command}} failed with error code: {{errorCode}}.","commandErrorCodeWithStack":"Error code: {{errorCode}} returned from {{command}}. {{stack}}","applicationGenerationSuccess":"The application has been generated and is available at {{- targetFolder}}","copyingTemplateFiles":"Copying {{templateName}} template files...","generatingAppWithVersion":"Generating application with {{- generatorName}} {{generatorVersion}}","warningCachingNotSupported":"Warning: caching is not supported.","attemptingToExecutePostGenerationCommand":"Attempting to execute command after app generation: {{- command}}","installSkippedOptionSpecified":"Option `--skipInstall` was specified. Installation of dependencies will be skipped.","generatorExiting":"Application generation exiting due to error: {{error}}","backendSystemSaveError":"An error occurred when saving the system \'{{system}}\' to the store: {{error}}"},"error":{"fatalError":"An error has occurred, please restart the generator.","errorWritingApplicationFiles":"An error occurred writing application files.","appConfigVersion":"The application config version must match a supported version: {{versions}}.","appConfigUnparseableEdmx":"Application config property: edmx cannot be parsed.","appConfigMissingRequiredProperty":"The application config is missing a required property: {{propertyName}}.","edmxNotFound":"Edmx metadata is required to continue with generation. Application generation exiting.","unsupportedPostGenerationEvent":"Unsupported post generation event: {{event}}.","commandFailed":"Command failed with error.","invalidYUIStepConfig":"Invalid Yeoman UI step config: First step cannot have a dependency property."},"wizardMessages":{"filesGenerated":"The files have been generated."},"prompts":{"viewName":{"message":"View Name","validationMessages":{"viewNameRequired":"You must provide a view name to continue.","viewNameTooLong":"The view name cannot contain more than 120 characters.","viewNameInvalid":"The view name must start with a letter and may contain letters, digits, dashes, and underscores."}}}}'),o=a.createInstance(),s="fiori-app-sub-generator";async function initI18nFioriAppSubGenerator(){await o.init({resources:{en:{[s]:r}},lng:"en",fallbackLng:"en",defaultNS:s,ns:[s],showSupportNotice:!1,interpolation:{format:function odataVersionFormatter(e){return e?` V${e}`:""},defaultVariables:{defaultProjectNumber:1}},missingInterpolationHandler:()=>""})}function t(e,i){return i?.ns||(i=Object.assign(i??{},{ns:s})),o.t(e,i)}initI18nFioriAppSubGenerator().catch(()=>{})},70071(e,i,n){n.d(i,{qo:()=>CommandRunner,sW:()=>P,ls:()=>addToCache,d1:()=>assignSapUxLayerValue,rS:()=>buildSapClientParam,ms:()=>convertCapRuntimeToCapProjectType,eg:()=>deleteCache,LO:()=>generateLaunchConfig,We:()=>generateToolsId,Rh:()=>getAnnotations,R7:()=>getAppId,JW:()=>getCdsUi5PluginInfo,pf:()=>getFromCache,fm:()=>getLaunchText,O3:()=>getMinSupportedUI5Version,gn:()=>getODataVersion,o_:()=>getReadMeDataSourceLabel,hs:()=>getRequiredOdataVersion,fW:()=>getTelemetryBusinessHubType,fs:()=>getTelemetrySapSystemType,kD:()=>getYeomanUiStepConfig,LW:()=>hasActiveStep,rl:()=>hasStep,DH:()=>initAppWizardCache,XM:()=>a.o_,Wm:()=>isAbapCloud,IA:()=>E.restoreServiceProviderLoggers,Eu:()=>runHooks,t:()=>a.t,Hb:()=>updateDependentStep,Ks:()=>validateNextStep});var a=n(30325),r=n(76178),o=n(3340),s=n(91125),p=n(88167),c=n(39933),l=n(25182),d=n(77947),m=n(88242),g=n(11278),u=n(7083),f=n(76760),v=n(13746),y=n(69297),h=n(62457),S=n(70025),E=n(94443);function getODataVersion(e){try{return(0,s.convert)((0,c.qg)(e)).version.startsWith("4")?g.Yw.v4:g.Yw.v2}catch(e){throw Error((0,a.t)("error.appConfigUnparseableEdmx"))}}function getAppId(e,i){return[i,e].filter(e=>!!e).join(".").replace(/[_-]/g,"")}function buildSapClientParam(e){return e?`sap-client=${e}`:""}function getRequiredOdataVersion(e){const i=h.lR[e].supportedODataVersion;return 1===i.length?i[0]:void 0}function getMinSupportedUI5Version(e,i,n){if(i===o.$M.FE_FPM&&n?.addPageBuildingBlock)return o.N_;let a;if(i&&i!==h.g6.FF_SIMPLE){const n=h.lR[i].templateType;a=l.gw[n].minimumUi5Version[e]}return a??(e===g.Yw.v4?y.Of:y.ec)}function generateToolsId(){return(0,v.v4)()}async function getCdsUi5PluginInfo(e,i,n){const a=await(0,u.C2)(e)?void 0:n,r=await(0,p.mF)(e,i,!0,a);return!1===r?void 0:r}function isAbapCloud(e){return e?.backendSystem?"AbapCloud"===(0,S.mq)(e.backendSystem):!!e?.destination&&(0,r.isAbapEnvironmentOnBtp)(e.destination)}function getReadMeDataSourceLabel(e,i=!1,n){let r;if(e===g.cT.sapSystem){r=`${(0,a.t)(`readme.label.datasourceType.${g.cT.sapSystem}`)} (${(0,a.t)(`readme.label.sapSystemType.${i?o.bM.ABAP_CLOUD:o.bM.ON_PREM}`)})`}else e===g.cT.businessHub&&n===o.sm.apiHubEnterprise&&(r=(0,a.t)("readme.label.datasourceType.apiBusinessHubEnterprise"));return r??(0,a.t)(`readme.label.datasourceType.${e}`)}async function getLaunchText(e,i,n,r){if(e){const a=e?.cdsUi5PluginInfo?.isCdsUi5PluginEnabled||n?getAppId(i,r):void 0;return(0,p.Od)(e.capType??"Node.js",i,a)}return(0,a.t)("readme.texts.runInstruction")}async function generateLaunchConfig(e,i,n,o,s=!1){try{if(n){const a=e.datasourceType!==g.cT.metadataFile,p=(0,f.join)(e.targetFolder,e.projectName),c={vscode:n,addStartCmd:a,sapClientParam:e.sapClientParam,flpAppId:e?.enableVirtualEndpoints?"app-preview":e.flpAppId??"",flpSandboxAvailable:!e?.enableVirtualEndpoints,isAppStudio:(0,r.isAppStudio)(),writeToAppOnly:s};e.odataVersion&&(c.odataVersion=e.odataVersion===g.Yw.v2?"2.0":"4.0");const l={name:(0,f.basename)(e.projectName),projectRoot:p,startFile:e?.enableVirtualEndpoints?"test/flp.html":void 0,debugOptions:c};await(0,m.gR)(p,l,i,o),(0,d.ll)(p)}}catch(e){o?.error(`${(0,a.t)("error.errorWritingApplicationFiles")} : ${e}`)}}function convertCapRuntimeToCapProjectType(e="Node.js"){return"Java"===e?"CAPJava":"CAPNodejs"}async function getAnnotations(e,i,n){return n?async function getCdsAnnotations(e,i){const{appPath:n="app",projectPath:a,serviceCdsPath:r,serviceName:o}=e;if(r){const e=(0,f.join)(n,i,"annotation.cds").replace(/\\/g,"/");return{cdsFileContents:`using ${o} as service from '${await(0,u.t)(a,e,r)}';`,projectPath:a,appPath:n,projectName:i}}}(n,e):i?{technicalName:i.TechnicalName,xml:i.Definitions}:void 0}function getTelemetrySapSystemType(e){return isAbapCloud(e)?"SCP":e?.destination&&(0,r.isOnPremiseDestination)(e.destination)||e?.backendSystem&&!e.backendSystem.serviceKeys?"ABAP":e?.serviceProvider?"CF":void 0}function getTelemetryBusinessHubType(e){return e===o.sm.apiHub?"BusinessAcceleratorHub":e===o.sm.apiHubEnterprise?"BusinessHubEnterprise":void 0}var b=n(73667);function getStepIndex(e,i){const n=i.items;return n?.findIndex(i=>i.name===(0,a.t)(e))}function updateDependentStep(e,i,n,a){i.forEach(i=>{const r=i.dependentMap[e],o=[];r.forEach(e=>{const n=getStepIndex(e.name,i.activeSteps);o.push(n)});const s=getStepIndex(e,i.activeSteps);if(a)if(n){let e,n=0;for(const o of r){if(o.name===a){e=o;break}getStepIndex(o.name,i.activeSteps)>=0&&n++}if(e){getStepIndex(e.name,i.activeSteps)<0&&i.activeSteps.splice(s+n+1,0,[{name:e.name,description:e.description}])}}else{const e=getStepIndex(a,i.activeSteps);e>=0&&i.activeSteps.splice(e,1,[])}else if(o.length>0&&o[0]>=0&&!n&&o.forEach(()=>{i.activeSteps.splice(o[0],1,[])}),o.length>0&&o[0]<0&&n)for(let e=0;e<o.length;e++){const n=r[e];i.activeSteps.splice(s+e+1,0,[{name:n.name,description:n.description}])}})}function hasActiveStep(e,i){return getStepIndex(e,i)>-1}function hasStep(e,i){return!!e.find(e=>e.key===i)}function getYeomanUiStepConfig(e){const i=[],n={};e.forEach((e,r)=>{if(e.dependency){if(r-1<0)throw(0,a.t)("error.invalidYUIStepConfig");const i=e.dependency;i&&(n[i]||(n[i]=[]),n[i].push(e))}else i.push(e)});return{activeSteps:new b.Prompts(i),dependentMap:n}}function validateNextStep(e,i,n,a){return n&&updateDependentStep(i,n,e,a),!0}var C=n(31421);class CommandRunner{log;constructor(e){this.log=e}formatLog(e,...i){const n=i.map(e=>e.toString().trim()).join(" ").trim();this.log?.info(e?e+n:n)}run(e,i=[],n={},r=!1){return new Promise((o,s)=>{const p={...n},c=[],l=`\`${e} ${i.join(" ")}\``;"win32"===process.platform&&(p.shell=!0);const d=(0,C.spawn)(e,i,p);let m;r&&this.formatLog("Running: ",l),d.stdout.on("data",e=>{r&&this.formatLog(void 0,e),c.push(e.toString()),m=e.toString()}),d.stderr.on("data",e=>{r&&this.formatLog(void 0,e),c.push(e.toString())}),d.on("error",e=>{s(new Error(`${(0,a.t)("error.commandFailed")}: ${e.message}`))}),d.on("close",(e,i)=>{if(i){const e=-1;return r&&this.formatLog((0,a.t)("logMessages.commandFailedWithError",{command:l,signalCode:e})),s(new Error((0,a.t)("logMessages.commandErrorCodeWithStack",{command:l,signalCode:e,stack:c.join(", ")})))}if(0!==e)return r&&this.formatLog((0,a.t)("logMessages.commandFailedWithError",{command:l,errorCode:e})),s(new Error((0,a.t)("logMessages.commandErrorCodeWithStack",{command:l,errorCode:e,stack:c.join(", ")})));o(m)})})}}const P="sap.ux.application.generated.handler";async function runHooks(e,i,n){if("app-generated"===e)return async function postGenerationHook(e,i){if(e.vscodeInstance)try{const n=e.options?.command??P;i?.info((0,a.t)("logMessages.attemptingToExecutePostGenerationCommand",{command:n})),await(e.vscodeInstance.commands?.executeCommand?.(n,e.hookParameters))}catch(e){try{const n=e.toString().replace("Error: command","Command");i?.warn(n)}catch{}}}(i,n);throw new Error((0,a.t)("error.unsupportedPostGenerationEvent",{event:e}))}var F=n(40511);function assignSapUxLayerValue(e=!1){if(!e)return(0,F.isInternalFeaturesSettingEnabled)()?"VENDOR":"CUSTOMER_BASE"}const A="$fiori-cache",w=(0,E.getHostEnvironment)();function initAppWizardCache(e,i){i&&!i[A]&&(i[A]={},e.debug("AppWizard based cache initialized."))}function addToCache(e,i,n){logIfCacheMissing(e,n),e?.[A]&&Object.assign(e[A],i)}function getFromCache(e,i,n){return logIfCacheMissing(e,n),e?.[A]?.[i]}function deleteCache(e,i){logIfCacheMissing(e,i),e?.[A]&&delete e[A]}function logIfCacheMissing(e,i){w!==E.hostEnvironment.vscode||e?.[A]||i.info((0,a.t)("logMessages.warningCachingNotSupported"))}}};