@sap-ux/fiori-mcp-server 1.17.2 → 1.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -18984,7 +18984,7 @@ No aiResponse provided. Generate the code following the rules below, then call t
18984
18984
  This is the **final step** of the workflow and performs the actual modification.
18985
18985
  You MUST provide the exact parameter information obtained from get_functionality_details (Step 2).`,annotations:{title:"Execute Fiori Functionality",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:Rp(r5n),outputSchema:Rp(T5n)},...sUl?p3o:[]],f3o=new Set(p3o.map(t=>t.name));var B1t=class{applicationKey="";extensionName="";extensionVersion="";getApplicationKey(){return this.applicationKey}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.extensionName}};var oLa=vr(r2n(),1);var gMt=class{extensionName;eventName;constructor(e,r){this.extensionName=e,this.eventName=r}getExtensionName(){return this.extensionName}getEventName(){return this.eventName}toString(){return`${this.extensionName}/${this.eventName}`}};var _V;(function(t){t[t.OnePercent=0]="OnePercent",t[t.TenPercent=1]="TenPercent",t[t.NoSampling=2]="NoSampling"})(_V||(_V={}));process.env.OTEL_RESOURCE_ATTRIBUTES??="service.name=masked,service.instance.id=masked";function LTr(t){if(t.setUseDiskRetryCaching)try{t.setUseDiskRetryCaching(!0)}catch{}t.context.tags??={},t.context.tags["ai.location.ip"]="0.0.0.0",t.context.tags["microsoft.client.ip"]="0.0.0.0",t.context.tags["ai.cloud.roleInstance"]="masked",t.context.tags["ai.cloud.role"]="masked",t.context.tags["ai.device.type"]="masked"}var n2n={name:"@sap-ux/telemetry",version:"2.0.17",description:"Library for sending usage telemetry data",type:"module",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/telemetry"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Atelemetry"},license:"Apache-2.0",private:!1,main:"dist/index.js",scripts:{build:"tsc --build",watch:"tsc --watch",clean:"rimraf --glob dist coverage *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",example:"ts-node example/index.ts"},dependencies:{"@sap-ux/store":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/nodejs-utils":"workspace:*",applicationinsights:"3.17.1",axios:"1.21.1","performance-now":"2.1.0",yaml:"2.9.1"},devDependencies:{"@jest/globals":"30.5.2","jest-extended":"7.0.0",memfs:"3.4.13",unionfs:"4.6.0",dotenv:"18.0.10"},files:["dist","LICENSE","!dist/*.map","!dist/**/*.map"],engines:{node:">=22.x"}};var SD={azureInstrumentationKey:"",azureIngestionEndpoint:"https://westus2-0.in.applicationinsights.azure.com/",azureLiveEndpoint:"https://westus2.livediagnostics.monitor.azure.com/",telemetryEnabled:!0,telemetryLibName:n2n.name,telemetryLibVersion:n2n.version,consumerModuleName:"",consumerModuleVersion:""};process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL??="true";var yMt=class extends B1t{clients;constructor(e,r,n){super(),this.clients=new Map,this.applicationKey=e,this.extensionVersion=n,this.extensionName=r;let i=this.createTelemetryClient(_V.OnePercent),a=this.createTelemetryClient(_V.TenPercent),s=this.createTelemetryClient(_V.NoSampling);this.clients.set(_V.OnePercent,i),this.clients.set(_V.TenPercent,a),this.clients.set(_V.NoSampling,s)}reportBlocking(e,r,n,i,a=!1){if(!a||SD.telemetryEnabled){let{client:s,event:c}=this.prepareClientAndEvent(e,r,n,i);return this.trackEventBlocking(s,c)}return Promise.resolve()}async report(e,r,n,i,a,s){if(s!==void 0&&!s||!SD.telemetryEnabled)return;let{client:c,event:l}=this.prepareClientAndEvent(e,r,n,i);this.trackEvent(c,l)}prepareClientAndEvent(e,r,n,i=_V.NoSampling){let a=this.clients.get(i),c={name:new gMt(this.extensionName,e).toString(),properties:r,measurements:n};return{client:a,event:c}}async trackEventBlocking(e,r){process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&(e.trackEvent(r),await e.flush())}trackEvent(e,r){return process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"?(e.trackEvent(r),!0):!1}createTelemetryClient(e){let r;switch(e){case _V.OnePercent:r=1;break;case _V.TenPercent:r=10;break;case _V.NoSampling:default:r=100;break}let n=new oLa.TelemetryClient(this.applicationKey);return n.config.samplingPercentage=r,LTr(n),n}};var i2n=()=>{let t=new Date().getTime();return new Date(t).toISOString()};var vMt=class extends yMt{constructor(e,r,n){super(e,r,n)}async report(e,r,n,i,a,s){let c=await $Tr(a),l={v:this.extensionVersion,datetime:i2n()},u={...r,...c,...l};await super.report(e,u,n,i,a,s)}async reportEvent(e,r,n,i){let{finalProperties:a,finalMeasurements:s}=await this.collectToolsSuiteTelemetry(e,n);return super.report(e.eventName,a,s,r,n,i)}async reportEventBlocking(e,r,n,i){let{finalProperties:a,finalMeasurements:s}=await this.collectToolsSuiteTelemetry(e,n);return super.reportBlocking(e.eventName,a,s,r,i)}async collectToolsSuiteTelemetry(e,r){let n=await $Tr(r),i={v:this.extensionVersion,datetime:i2n()},a={...e.properties,...n,...i},s={...e.measurements};return{finalProperties:a,finalMeasurements:s}}};var aLa=vr(X0(),1),sLa=vr(gvt(),1);import Iie from"node:fs";import lwe from"node:path";var FTr={internalFeature:!1};var _Mt;(function(t){t.UNKNOWN="UNKNOWN",t.NO_TOOLS_ID="NO_TOOLS_ID"})(_Mt||(_Mt={}));var hfe;(function(t){t.CAPJava="CAPJava",t.CAPNode="CAPNode",t.ABAP="ABAP",t.UNKNOWN="UNKNOWN"})(hfe||(hfe={}));var f6e;(function(t){t.CF="CF",t.ABAP="ABAP",t.UNKNOWN_DEPLOY_CONFIG="UNKNOWN_DEPLOY_CONFIG",t.NO_DEPLOY_CONFIG="NO_DEPLOY_CONFIG"})(f6e||(f6e={}));var wD;(function(t){t.DevSpace="cmn.devspace",t.AppStudio="cmn.appstudio",t.AppStudioBackwardCompatible="appstudio",t.InternlVsExternal="cmn.internalFeatures",t.InternlVsExternalBackwardCompatible="internalVsExternal",t.TemplateType="cmn.template",t.DeployTargetType="cmn.deployTarget",t.ODataSourceType="cmn.odataSource",t.AppToolsId="cmn.toolsId",t.NodeVersion="cmn.nodeVersion",t.AppProgrammingLanguage="cmn.appLanguage",t.TemplateId="cmn.templateId",t.TemplateVersion="cmn.templateVersion",t.ApplicationType="cmn.applicationType",t.IdeType="cmn.ideType"})(wD||(wD={}));async function $Tr(t){let e=await a2n(),r={};return t&&(r=await B8u(t.appPath)),{...e,...r}}async function a2n(){let t={};return t[wD.DevSpace]=await F8u(),t[wD.AppStudio]=Ny(),t[wD.AppStudioBackwardCompatible]=t[wD.AppStudio],t[wD.InternlVsExternal]=H8u(),t[wD.InternlVsExternalBackwardCompatible]=t[wD.InternlVsExternal],t[wD.NodeVersion]=await G8u(),t[wD.IdeType]=s2n(),t}async function F8u(){if(Ny())try{if(!process.env.H2O_URL||!process.env.WORKSPACE_ID)return"";let t=process.env.H2O_URL,e=process.env.WORKSPACE_ID.replace("workspaces-",""),r=`${t}/ws-manager/api/v1/workspace/${e}`,n=await aLa.default.get(r);if(n.data)return n.data?.config?.annotations?.pack}catch{}return""}async function B8u(t){if(!t)return{};let e=await j8u(t),r=await q8u(t),n=await Vze(t),i=await U8u(t);n==="Fiori Reuse"&&(i=hfe.UNKNOWN);let a=await z8u(t),s=await Sqt(t),c={};return c[wD.TemplateType]=e,c[wD.DeployTargetType]=r,c[wD.ODataSourceType]=i,c[wD.AppToolsId]=a.toolsId??"",c[wD.AppProgrammingLanguage]=s,c[wD.TemplateId]=a.id??"",c[wD.TemplateVersion]=a.version??"",c[wD.ApplicationType]=n??"",c}async function j8u(t){let e=lwe.join(t,"README.md"),r=lwe.join(t,".appGenInfo.json");if(Iie.existsSync(r)){let n=await Iie.promises.readFile(r,"utf-8"),i=JSON.parse(n);if(i?.generationParameters?.template)return i.generationParameters.template.trim()}if(Iie.existsSync(e)){let n=await Iie.promises.readFile(e,"utf-8");if(n){let i="",a=n.split(/\r?\n/);for(let s of a){let l=/\|\*\*Template Used\*\*<br>(.*?)\|/.exec(s);if(l&&l.length>=2){i=l[1].trim();break}}return i}}return""}async function U8u(t){try{let e;try{e=await zve(t)}catch{}if(!e)try{let i=lwe.dirname(t);e=await zve(i,!1)}catch{}let r=!1;if(!e){let i=lwe.dirname(t),a=lwe.dirname(i);r=await o_t(a),e=r?a:t}if(r)return hfe.CAPJava;let n=await qze(e);return V8u(n)}catch{return hfe.UNKNOWN}}function V8u(t){return t==="EDMXBackend"?hfe.ABAP:t==="CAPNodejs"?hfe.CAPNode:t==="CAPJava"?hfe.CAPJava:hfe.UNKNOWN}async function q8u(t){let e=f6e.NO_DEPLOY_CONFIG,r=lwe.join(t,"ui5-deploy.yaml");try{await Iie.promises.access(r);let n=await Iie.promises.readFile(r,"utf-8"),a=sLa.default.parse(n)?.builder?.customTasks;a?e=a.some(c=>c.name==="deploy-to-abap")?f6e.ABAP:f6e.CF:e=f6e.UNKNOWN_DEPLOY_CONFIG}catch{}return e}function H8u(){return FTr.internalFeature?"internal":"external"}async function z8u(t){let e=await Yg(t),r={manifest:lwe.join(e,"manifest.json"),appdescr:lwe.join(e,"manifest.appdescr_variant"),ui5Yaml:lwe.join(t,"ui5.yaml")};try{if(Iie.existsSync(r.manifest)){let n=await Iie.promises.readFile(r.manifest,"utf-8"),i=JSON.parse(n);return o2n(i["sap.app"]?.sourceTemplate??{})}if(Iie.existsSync(r.appdescr)&&Iie.existsSync(r.ui5Yaml)){let n=await Iie.promises.readFile(r.ui5Yaml,"utf-8"),a=(await PX.newInstance(n)).getCustomConfiguration("adp");return o2n(a?.support??{})}}catch{}return o2n({})}function o2n(t){return{id:t.id??"",version:t.version??"",toolsId:t.toolsId??_Mt.NO_TOOLS_ID}}async function G8u(){try{return(await new TOe().run("node",["-v"])??"unknown").replaceAll(/(?:^v)|([\r\n]{1,100})/g,"")}catch{return"unknown"}}function s2n(){if(Ny())return"appstudio";let t=process.env.VSCODE_CWD?.toLowerCase()??"",e=process.env.VSCODE_PID,r=process.env.TERM_PROGRAM??"",n=process.env.VSCODE_APPNAME?.toLowerCase()??"";return!e&&!t&&r!=="vscode"&&r!=="vscode-insiders"?"unknown":process.env.CURSOR_TRACE_ID||n.includes("cursor")||t.includes("cursor")?"cursor":n.includes("windsurf")||t.includes("windsurf")||t.includes("codeium")?"windsurf":n.includes("antigravity")||t.includes("antigravity")?"antigravity":n.includes("trae")||t.includes("trae")?"trae":n.includes("kiro")||t.includes("kiro")?"kiro":n.includes("vscodium")||n.includes("codium")||t.includes("vscodium")||t.includes("codium")?"vscodium":n.includes("code-server")||t.includes("code-server")||process.env.CODE_SERVER_SESSION?"code-server":n.includes("insiders")||t.includes("code - insiders")||t.includes("code insiders")||t.includes("vscode-insiders")||r==="vscode-insiders"?"vscode-insiders":e||r==="vscode"?"vscode":"unknown"}var cLa=vr(r2n(),1);var Hft;(function(t){t.Test="test",t.TELEMETRY_SETTINGS_INIT_FAILED="TELEMETRY_SETTINGS_INIT_FAILED",t.DISABLE_TELEMETRY="DISABLE_TELEMETRY"})(Hft||(Hft={}));var W8u=t=>{let e=[/sap-ux.+/gi,/[-a-zA-Z]+\/ide-extension\/.+/gi,/(\/telemetry\/.+)/gi],r=[],n=t.split(`
18986
18986
  `).filter(i=>!!/^\s*at .*(\S+:\d+|\(native\))/m.exec(i));return n.length&&n.forEach(i=>{let a=i.replace(/^\s+/,""),c=/ (\((.+):(\d+):(\d+)\)$)/.exec(i);if(!c)return;let l=null,u=c[2].replace(/\\/g,"/");for(let m of e){let g=m.exec(u);if(g){l=g[0];break}}if(!l)return;a=a.replace(c[0],"");let d=a.split(/\s+/).slice(1).join(""),p=c[3],f=c[4],h=`${d} at (${l}:${p}:${f});`;r.push(h)}),r},BTr,lLa=()=>(BTr||(BTr=new cLa.TelemetryClient(M9.buildConnectionString(SD.azureInstrumentationKey)),LTr(BTr)),BTr),uLa=t=>{let e={message:t.message};if(t.stack){let n=W8u(t.stack);n.length&&(e.stack=n.join(`
18987
- `))}let r={name:Hft.TELEMETRY_SETTINGS_INIT_FAILED,properties:e,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&lLa().trackEvent(r)},dLa=(t,e)=>{let r={name:Hft.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!t}`,...e},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&lLa().trackEvent(r)};import K8u from"node:os";import Y8u from"node:path";import X8u from"node:fs";var J8u={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},Z8u=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],Q8u=t=>{let e=process.platform,r=t[e];if(Ny()&&(r=t.theia),!r)return null;let n=K8u.homedir();return Y8u.join(n,r)};async function eGu(t){let e;try{e=await t.read(new ADe)}catch{}if(e)SD.telemetryEnabled=e.enableTelemetry;else{let r=Q8u(J8u);if(!r)await jTr(!0);else{let n;try{n=await X8u.promises.readFile(r,"utf-8");let i=JSON.parse(n),s=Z8u.map(c=>i[c]??!0).reduce((c,l)=>c&&l,!0);await jTr(s)}catch{await jTr(!0)}}}}function tGu(t){oor(T4e.TelemetrySetting,()=>{t.read(new ADe).then(e=>{e&&(SD.telemetryEnabled=e.enableTelemetry)}).catch(()=>{})})}var c2n=async t=>{try{SD.consumerModuleName=t.consumerModule.name,SD.consumerModuleVersion=t.consumerModule.version,FTr.internalFeature=t.internalFeature??!1,t.resourceId&&(SD.azureInstrumentationKey=t.resourceId),t.ingestionEndpoint&&(SD.azureIngestionEndpoint=t.ingestionEndpoint),t.liveEndpoint&&(SD.azureLiveEndpoint=t.liveEndpoint);let e=await Ene({entityName:"telemetrySetting"});await eGu(e),t.watchTelemetrySettingStore&&tGu(e)}catch(e){uLa(e)}};async function jTr(t){try{let r=await Ene({entityName:"telemetrySetting"}),n=new qOt({enableTelemetry:t});await r.write(n),SD.telemetryEnabled=t}catch{}let e=await a2n();dLa(t,e)}var rGu="ApplicationInsightsInstrumentationKeyPLACEH0LDER",M9=class t{static clientMap=new Map;static getTelemetryClient(){return t.getTelemetryClientByClass(vMt)}static getTelemetryClientByClass(e){let r=t.clientMap.get(e.name);if(r)return r;let n=t.buildConnectionString(SD.azureInstrumentationKey);return r=new e(n,SD.consumerModuleName,SD.consumerModuleVersion),t.clientMap.set(e.name,r),r}static buildConnectionString(e){return e?`InstrumentationKey=${e===rGu?"00000000-0000-0000-0000-000000000000":e};IngestionEndpoint=${SD.azureIngestionEndpoint};LiveEndpoint=${SD.azureLiveEndpoint};`:""}};var uee;(function(t){t.START_MARK="START_MARK",t.END_MARK="END_MARK",t.MEASUREMENT="MEASUREMENT"})(uee||(uee={}));var UTr=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var bMt=class{startTime;name;type;getStartTime(){return this.startTime}constructor(e,r,n){this.startTime=n,this.name=e,this.startTime=n,this.type=r}},VTr=class extends bMt{startTime;duration;constructor(e,r,n){super(e,uee.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};import{performance as nGu}from"node:perf_hooks";var iGu=()=>nGu.now(),v$=class t extends UTr{static initTiming;static now=iGu;static entries=[];static initialize(){t.initTiming=t.now()}static mark(e,r,n){let i=new bMt(e,r,n);t.entries.push(i)}static startMark(e){let r=t.now(),n=e+r;return t.mark(n,uee.START_MARK,r),n}static endMark(e){let r=t.now();t.mark(e,uee.END_MARK,r)}static measure(e){let r=t.getEntriesByNameType(e,uee.START_MARK).slice(-1)[0],n=t.getEntriesByNameType(e,uee.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${e}' doesn't exist.`);if(!r||!n){let l=r?uee.END_MARK:uee.START_MARK;throw new Error(`Failed to execute 'measure': mark '${e}'of type '${l}' doesn't exist.`)}let i=r.getStartTime(),s=n.getStartTime()-i,c=new VTr(`${e}`,t.now(),s);t.entries.push(c)}static getEntries(){return t.entries}static getEntriesByName(e){return t.entries.filter(r=>r.name===e)}static getEntriesByNameType(e,r){return t.entries.filter(n=>n.name===e&&n.type===r)}static getEntriesByType(e){return t.entries.filter(r=>r.type===e)}static getMeasurementDuration(e){return t.getEntriesByNameType(e,uee.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){t.entries=[]}};v$.initialize();var oGu=(t,e)=>new Error(`Wrong path for '${t}' field is specified in instructions with index - ${e}`),aGu=(t,e,r,n)=>{let i=e.split("/"),a=t,s=0;for(;s<i.length;){if(a=a[i[s]],a===void 0)throw oGu(r,n);s++}return a},pLa=(t,e)=>{let r={},n={},i=null;e.paramIndex!==void 0&&(i=t[e.paramIndex]);let a=e.key?e.key:"data",s="";return typeof e.value=="string"?s=e.value:e.value!==void 0&&e.paramIndex!==void 0?s=aGu(i,e.value.path,"val",e.paramIndex):s=i,typeof s=="number"&&!Number.isNaN(s)?n[a]=s:r[a]=s,[r,n]},l2n=(t,e)=>{let r,n,i={},a={};if(Array.isArray(e))for(let s of e)[r,n]=pLa(t,s),i={...i,...r},a={...a,...n};else[i,a]=pLa(t,e);return[i,a]};var fLa=(t,e,r,n)=>(...i)=>{let a=e.apply(t,i);return M9.getTelemetryClient().report(r,{},{},n),a},hLa=(t,e,r,n)=>async(...i)=>{let a=await e.apply(t,i);return M9.getTelemetryClient().report(r,{},{},n),a},mLa=(t,e,r,n)=>(...i)=>{let a=v$.startMark("mark"),s=e.apply(t,i);v$.endMark(a),v$.measure(a);let c=v$.getMeasurementDuration(a);return M9.getTelemetryClient().report(r,{},{ms:c},n),s},gLa=(t,e,r,n)=>async(...i)=>{let a=v$.startMark("mark"),s=await e.apply(t,i);v$.endMark(a),v$.measure(a);let c=v$.getMeasurementDuration(a);return M9.getTelemetryClient().report(r,{},{ms:c},n),s},yLa=(t,e,r,n,i)=>(...a)=>{let s=e.apply(t,a),[c,l]=l2n(a,i);return M9.getTelemetryClient().report(r,c,l,n),s},vLa=(t,e,r,n,i)=>async(...a)=>{let s=await e.apply(t,a),[c,l]=l2n(a,i);return M9.getTelemetryClient().report(r,c,l,n),s};var uwe;(function(t){t.NOTIFICATION="notify",t.DURATION="duration",t.CAPTURE_PARAM="captureParam"})(uwe||(uwe={}));var qTr=new Map;qTr.set(uwe.NOTIFICATION,fLa);qTr.set(uwe.DURATION,mLa);qTr.set(uwe.CAPTURE_PARAM,yLa);var HTr=new Map;HTr.set(uwe.NOTIFICATION,hLa);HTr.set(uwe.DURATION,gLa);HTr.set(uwe.CAPTURE_PARAM,vLa);var L$a=vr(I$a(),1);import{randomUUID as HWu}from"node:crypto";var jWu=["@sap-ux","fiori-mcp-server"].join("/");var UWu="1.17.2",D$a={name:jWu,version:UWu};var N$a={telemetry:{unknownOs:"Unknown"}};var E2n="fiori-mcp-server",R$a=gy.createInstance();async function qWu(){await R$a.init({resources:{en:{[E2n]:N$a}},lng:"en",fallbackLng:"en",defaultNS:E2n,ns:[E2n]})}function k$a(t,e){return R$a.t(t,e)}qWu().catch(()=>{});var{version:zWu}=D$a,M$a="@sap-ux/fiori-mcp-server",$$a="unknown-tool",GWu="0a65e45d-6bf4-421d-b845-61e888c50e9e",yfe=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static initSessionId(){this._sessionId=HWu(),Qn.info(`Telemetry session initialized with ID: ${this._sessionId}`)}static async initTelemetrySettings(e){this._sessionId||this.initSessionId();let r={consumerModule:{name:M$a,version:zWu},watchTelemetrySettingStore:!1,internalFeature:Lxt(),resourceId:GWu,...e};try{await c2n(r)}catch(n){Qn.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=k$a("telemetry.unknownOs");try{i=(0,L$a.default)()}catch{}this._telemetryData={Platform:Ny()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...e};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){this.markToolsEndTime();let n=r.markName?v$.getMeasurementDuration(r.markName):void 0;return{eventName:e,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:v$.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(v$.endMark(this._telemetryData.markName),v$.measure(this._telemetryData.markName))}static async sendTelemetry(e,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(e,i);await M9.getTelemetryClient().reportEvent(a,_V.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return M$a}};var F$a="2024-11-05";function WWu(t){return bLe.includes(t)?t:bLe.includes(F$a)?F$a:bLe[bLe.length-1]}var sSr=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new Ajt({name:"fiori-mcp",version:OHe,icons:[{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.svg",mimeType:"image/svg+xml"},{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.png",mimeType:"image/png"}],title:"MCP Server for SAP Fiori"},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=r=>Qn.error(`[MCP Error] ${r}`);let e=async()=>{await aur(),await this.server.close(),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}async setupTelemetry(){await yfe.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(cgt,async e=>{this.mcpClientName=e.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=e.params.clientInfo?.version||"unknown-version",Qn.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await yfe.sendTelemetry(hTo,r),{protocolVersion:WWu(e.params.protocolVersion),capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:OHe},instructions:`
18987
+ `))}let r={name:Hft.TELEMETRY_SETTINGS_INIT_FAILED,properties:e,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&lLa().trackEvent(r)},dLa=(t,e)=>{let r={name:Hft.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!t}`,...e},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&lLa().trackEvent(r)};import K8u from"node:os";import Y8u from"node:path";import X8u from"node:fs";var J8u={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},Z8u=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],Q8u=t=>{let e=process.platform,r=t[e];if(Ny()&&(r=t.theia),!r)return null;let n=K8u.homedir();return Y8u.join(n,r)};async function eGu(t){let e;try{e=await t.read(new ADe)}catch{}if(e)SD.telemetryEnabled=e.enableTelemetry;else{let r=Q8u(J8u);if(!r)await jTr(!0);else{let n;try{n=await X8u.promises.readFile(r,"utf-8");let i=JSON.parse(n),s=Z8u.map(c=>i[c]??!0).reduce((c,l)=>c&&l,!0);await jTr(s)}catch{await jTr(!0)}}}}function tGu(t){oor(T4e.TelemetrySetting,()=>{t.read(new ADe).then(e=>{e&&(SD.telemetryEnabled=e.enableTelemetry)}).catch(()=>{})})}var c2n=async t=>{try{SD.consumerModuleName=t.consumerModule.name,SD.consumerModuleVersion=t.consumerModule.version,FTr.internalFeature=t.internalFeature??!1,t.resourceId&&(SD.azureInstrumentationKey=t.resourceId),t.ingestionEndpoint&&(SD.azureIngestionEndpoint=t.ingestionEndpoint),t.liveEndpoint&&(SD.azureLiveEndpoint=t.liveEndpoint);let e=await Ene({entityName:"telemetrySetting"});await eGu(e),t.watchTelemetrySettingStore&&tGu(e)}catch(e){uLa(e)}};async function jTr(t){try{let r=await Ene({entityName:"telemetrySetting"}),n=new qOt({enableTelemetry:t});await r.write(n),SD.telemetryEnabled=t}catch{}let e=await a2n();dLa(t,e)}var rGu="ApplicationInsightsInstrumentationKeyPLACEH0LDER",M9=class t{static clientMap=new Map;static getTelemetryClient(){return t.getTelemetryClientByClass(vMt)}static getTelemetryClientByClass(e){let r=t.clientMap.get(e.name);if(r)return r;let n=t.buildConnectionString(SD.azureInstrumentationKey);return r=new e(n,SD.consumerModuleName,SD.consumerModuleVersion),t.clientMap.set(e.name,r),r}static buildConnectionString(e){return e?`InstrumentationKey=${e===rGu?"00000000-0000-0000-0000-000000000000":e};IngestionEndpoint=${SD.azureIngestionEndpoint};LiveEndpoint=${SD.azureLiveEndpoint};`:""}};var uee;(function(t){t.START_MARK="START_MARK",t.END_MARK="END_MARK",t.MEASUREMENT="MEASUREMENT"})(uee||(uee={}));var UTr=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var bMt=class{startTime;name;type;getStartTime(){return this.startTime}constructor(e,r,n){this.startTime=n,this.name=e,this.startTime=n,this.type=r}},VTr=class extends bMt{startTime;duration;constructor(e,r,n){super(e,uee.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};import{performance as nGu}from"node:perf_hooks";var iGu=()=>nGu.now(),v$=class t extends UTr{static initTiming;static now=iGu;static entries=[];static initialize(){t.initTiming=t.now()}static mark(e,r,n){let i=new bMt(e,r,n);t.entries.push(i)}static startMark(e){let r=t.now(),n=e+r;return t.mark(n,uee.START_MARK,r),n}static endMark(e){let r=t.now();t.mark(e,uee.END_MARK,r)}static measure(e){let r=t.getEntriesByNameType(e,uee.START_MARK).slice(-1)[0],n=t.getEntriesByNameType(e,uee.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${e}' doesn't exist.`);if(!r||!n){let l=r?uee.END_MARK:uee.START_MARK;throw new Error(`Failed to execute 'measure': mark '${e}'of type '${l}' doesn't exist.`)}let i=r.getStartTime(),s=n.getStartTime()-i,c=new VTr(`${e}`,t.now(),s);t.entries.push(c)}static getEntries(){return t.entries}static getEntriesByName(e){return t.entries.filter(r=>r.name===e)}static getEntriesByNameType(e,r){return t.entries.filter(n=>n.name===e&&n.type===r)}static getEntriesByType(e){return t.entries.filter(r=>r.type===e)}static getMeasurementDuration(e){return t.getEntriesByNameType(e,uee.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){t.entries=[]}};v$.initialize();var oGu=(t,e)=>new Error(`Wrong path for '${t}' field is specified in instructions with index - ${e}`),aGu=(t,e,r,n)=>{let i=e.split("/"),a=t,s=0;for(;s<i.length;){if(a=a[i[s]],a===void 0)throw oGu(r,n);s++}return a},pLa=(t,e)=>{let r={},n={},i=null;e.paramIndex!==void 0&&(i=t[e.paramIndex]);let a=e.key?e.key:"data",s="";return typeof e.value=="string"?s=e.value:e.value!==void 0&&e.paramIndex!==void 0?s=aGu(i,e.value.path,"val",e.paramIndex):s=i,typeof s=="number"&&!Number.isNaN(s)?n[a]=s:r[a]=s,[r,n]},l2n=(t,e)=>{let r,n,i={},a={};if(Array.isArray(e))for(let s of e)[r,n]=pLa(t,s),i={...i,...r},a={...a,...n};else[i,a]=pLa(t,e);return[i,a]};var fLa=(t,e,r,n)=>(...i)=>{let a=e.apply(t,i);return M9.getTelemetryClient().report(r,{},{},n),a},hLa=(t,e,r,n)=>async(...i)=>{let a=await e.apply(t,i);return M9.getTelemetryClient().report(r,{},{},n),a},mLa=(t,e,r,n)=>(...i)=>{let a=v$.startMark("mark"),s=e.apply(t,i);v$.endMark(a),v$.measure(a);let c=v$.getMeasurementDuration(a);return M9.getTelemetryClient().report(r,{},{ms:c},n),s},gLa=(t,e,r,n)=>async(...i)=>{let a=v$.startMark("mark"),s=await e.apply(t,i);v$.endMark(a),v$.measure(a);let c=v$.getMeasurementDuration(a);return M9.getTelemetryClient().report(r,{},{ms:c},n),s},yLa=(t,e,r,n,i)=>(...a)=>{let s=e.apply(t,a),[c,l]=l2n(a,i);return M9.getTelemetryClient().report(r,c,l,n),s},vLa=(t,e,r,n,i)=>async(...a)=>{let s=await e.apply(t,a),[c,l]=l2n(a,i);return M9.getTelemetryClient().report(r,c,l,n),s};var uwe;(function(t){t.NOTIFICATION="notify",t.DURATION="duration",t.CAPTURE_PARAM="captureParam"})(uwe||(uwe={}));var qTr=new Map;qTr.set(uwe.NOTIFICATION,fLa);qTr.set(uwe.DURATION,mLa);qTr.set(uwe.CAPTURE_PARAM,yLa);var HTr=new Map;HTr.set(uwe.NOTIFICATION,hLa);HTr.set(uwe.DURATION,gLa);HTr.set(uwe.CAPTURE_PARAM,vLa);var L$a=vr(I$a(),1);import{randomUUID as HWu}from"node:crypto";var jWu=["@sap-ux","fiori-mcp-server"].join("/");var UWu="1.17.3",D$a={name:jWu,version:UWu};var N$a={telemetry:{unknownOs:"Unknown"}};var E2n="fiori-mcp-server",R$a=gy.createInstance();async function qWu(){await R$a.init({resources:{en:{[E2n]:N$a}},lng:"en",fallbackLng:"en",defaultNS:E2n,ns:[E2n]})}function k$a(t,e){return R$a.t(t,e)}qWu().catch(()=>{});var{version:zWu}=D$a,M$a="@sap-ux/fiori-mcp-server",$$a="unknown-tool",GWu="0a65e45d-6bf4-421d-b845-61e888c50e9e",yfe=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static initSessionId(){this._sessionId=HWu(),Qn.info(`Telemetry session initialized with ID: ${this._sessionId}`)}static async initTelemetrySettings(e){this._sessionId||this.initSessionId();let r={consumerModule:{name:M$a,version:zWu},watchTelemetrySettingStore:!1,internalFeature:Lxt(),resourceId:GWu,...e};try{await c2n(r)}catch(n){Qn.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=k$a("telemetry.unknownOs");try{i=(0,L$a.default)()}catch{}this._telemetryData={Platform:Ny()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...e};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){this.markToolsEndTime();let n=r.markName?v$.getMeasurementDuration(r.markName):void 0;return{eventName:e,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:v$.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(v$.endMark(this._telemetryData.markName),v$.measure(this._telemetryData.markName))}static async sendTelemetry(e,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(e,i);await M9.getTelemetryClient().reportEvent(a,_V.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return M$a}};var F$a="2024-11-05";function WWu(t){return bLe.includes(t)?t:bLe.includes(F$a)?F$a:bLe[bLe.length-1]}var sSr=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new Ajt({name:"fiori-mcp",version:OHe,icons:[{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.svg",mimeType:"image/svg+xml"},{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.png",mimeType:"image/png"}],title:"MCP Server for SAP Fiori"},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=r=>Qn.error(`[MCP Error] ${r}`);let e=async()=>{await aur(),await this.server.close(),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}async setupTelemetry(){await yfe.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(cgt,async e=>{this.mcpClientName=e.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=e.params.clientInfo?.version||"unknown-version",Qn.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await yfe.sendTelemetry(hTo,r),{protocolVersion:WWu(e.params.protocolVersion),capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:OHe},instructions:`
18988
18988
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
18989
18989
  \u{1F6A8}\u{1F6A8}\u{1F6A8} STOP - READ THIS BEFORE CALLING ANY TOOLS \u{1F6A8}\u{1F6A8}\u{1F6A8}
18990
18990
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-mcp-server",
3
3
  "description": "SAP Fiori - Model Context Protocol (MCP) server",
4
- "version": "1.17.2",
4
+ "version": "1.17.3",
5
5
  "mcpName": "io.github.SAP/fiori-mcp-server",
6
6
  "keywords": [
7
7
  "SAP Fiori tools",
@@ -59,28 +59,28 @@
59
59
  "ts-node": "10.9.2",
60
60
  "xml-formatter": "3.7.1",
61
61
  "zod": "4.6.7",
62
- "@sap-ux/adp-tooling": "1.2.4",
63
62
  "@sap-ux/axios-extension": "2.1.8",
64
63
  "@sap-ux/btp-utils": "2.0.9",
65
64
  "@sap-ux/fe-fpm-writer": "1.5.2",
66
65
  "@sap-ux/feature-toggle": "1.0.5",
67
66
  "@sap-ux/fiori-annotation-api": "1.1.9",
68
67
  "@sap-ux/fiori-docs-embeddings": "1.3.0",
69
- "@sap-ux/i18n": "1.0.8",
70
68
  "@sap-ux/logger": "1.0.3",
71
- "@sap-ux/nodejs-utils": "1.0.16",
72
- "@sap-ux/odata-annotation-core": "1.0.5",
69
+ "@sap-ux/i18n": "1.0.8",
73
70
  "@sap-ux/odata-annotation-core-types": "1.0.5",
71
+ "@sap-ux/nodejs-utils": "1.0.16",
74
72
  "@sap-ux/odata-entity-model": "1.0.1",
75
73
  "@sap-ux/odata-service-writer": "1.0.31",
74
+ "@sap-ux/odata-annotation-core": "1.0.5",
76
75
  "@sap-ux/project-access": "2.3.6",
77
76
  "@sap-ux/project-input-validator": "1.0.29",
78
77
  "@sap-ux/store": "2.0.9",
79
- "@sap-ux/system-access": "1.0.22",
80
78
  "@sap-ux/telemetry": "2.0.17",
79
+ "@sap-ux/system-access": "1.0.22",
81
80
  "@sap-ux/text-document-utils": "1.0.5",
82
81
  "@sap-ux/ui5-config": "1.0.13",
83
- "@sap-ux/ui5-info": "1.0.9"
82
+ "@sap-ux/ui5-info": "1.0.9",
83
+ "@sap-ux/adp-tooling": "1.2.4"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=22.x"