@sermas/api-client 1.0.0-alpha.44 → 1.0.0-alpha.45

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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var re=Object.create;var m=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var ae=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var pe=(s,e)=>{for(var t in e)m(s,t,{get:e[t],enumerable:!0})},V=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of oe(e))!ne.call(s,o)&&o!==t&&m(s,o,{get:()=>e[o],enumerable:!(r=se(e,o))||r.enumerable});return s};var de=(s,e,t)=>(t=s!=null?re(ie(s)):{},V(e||!s||!s.__esModule?m(t,"default",{value:s,enumerable:!0}):t,s)),ue=s=>V(m({},"__esModule",{value:!0}),s);var n=(s,e,t)=>(ae(s,typeof e!="symbol"?e+"":e,t),t);var Ae={};pe(Ae,{SermasApiClient:()=>X,sleep:()=>Te});module.exports=ue(Ae);var Y=require("jwt-decode");var k=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}};var P=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var U=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var O=class{constructor(e){this.broker=e}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}};var B=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}};var M=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var _=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}};var h=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new k(e),this.module=new P(e),this.auth=new E(e),this.detection=new U(e),this.dialogue=new O(e),this.session=new B(e),this.ui=new M(e),this.xr=new w(e),this.robotics=new _(e)}};var W=de(require("mqtt"),1);var G,J=s=>{G=s},ce=(s="logger")=>new class{format(e){return`[${s}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=G||ce(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var $=class s{constructor(e){this.config=e;n(this,"logger",new g(s.name));n(this,"client");n(this,"subscriptions",[])}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=W.default.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let o=e.indexOf("#");o>-1&&(e=e.substring(0,o));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,o,i,a]=t,p=t.slice(3);return{type:r,appId:o,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let o=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(o===-1)return null;let i=this.subscriptions[o];this.subscriptions.splice(o,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let o=t.byteLength!==void 0,i;o?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...o?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let o=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(o)>-1;)e=e.replace(o,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var c=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},le={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var I=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,o){super(o);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var L=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},R=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let o=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(o,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new L("Request aborted"))}}get isCancelled(){return this._isCancelled}};var D=s=>typeof s=="string",H=s=>D(s)&&s!=="",z=s=>s instanceof Blob,Q=s=>s instanceof FormData,ge=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},ye=s=>{let e=[],t=(o,i)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(i))}`)},r=(o,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(o,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${o}[${a}]`,p)):t(o,i))};return Object.entries(s).forEach(([o,i])=>r(o,i)),e.length?`?${e.join("&")}`:""},me=(s,e)=>{let t=s.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),o=s.BASE+r;return e.query?o+ye(e.query):o},he=s=>{if(s.formData){let e=new FormData,t=(r,o)=>{D(o)||z(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(s.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(i=>t(r,i)):t(r,o)}),e}},j=async(s,e)=>typeof e=="function"?e(s):e,Ie=async(s,e)=>{let[t,r,o,i]=await Promise.all([j(e,s.TOKEN),j(e,s.USERNAME),j(e,s.PASSWORD),j(e,s.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,u])=>({...p,[d]:String(u)}),{});if(H(t)&&(a.Authorization=`Bearer ${t}`),H(r)&&H(o)){let p=ge(`${r}:${o}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:z(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":D(e.body)?a["Content-Type"]="text/plain":Q(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},Re=s=>{if(s.body!==void 0)return s.mediaType?.includes("application/json")||s.mediaType?.includes("+json")?JSON.stringify(s.body):D(s.body)||z(s.body)||Q(s.body)?s.body:JSON.stringify(s.body)},De=async(s,e,t,r,o,i,a)=>{let p=new AbortController,d={headers:i,body:r??o,method:e.method,signal:p.signal};s.WITH_CREDENTIALS&&(d.credentials=s.CREDENTIALS);for(let u of s.interceptors.request._fns)d=await u(d);return a(()=>p.abort()),await fetch(t,d)},be=(s,e)=>{if(e){let t=s.headers.get(e);if(D(t))return t}},fe=async s=>{if(s.status!==204)try{let e=s.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await s.json();if(t.some(r=>e.includes(r)))return await s.blob();if(e.includes("multipart/form-data"))return await s.formData();if(e.includes("text/"))return await s.text()}}catch(e){console.error(e)}},qe=(s,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...s.errors}[e.status];if(r)throw new y(s,e,r);if(!e.ok){let o=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(s,e,`Generic Error: status: ${o}; status text: ${i}; body: ${a}`)}},K=(s,e)=>new R(async(t,r,o)=>{try{let i=me(s,e),a=he(e),p=Re(e),d=await Ie(s,e);if(!o.isCancelled){let u=await De(s,e,i,p,a,d,o);for(let te of s.interceptors.response._fns)u=await te(u);let Z=await fe(u),ee=be(u,e.responseHeader),F={url:i,ok:u.ok,status:u.status,statusText:u.statusText,body:ee??Z};qe(e,F),t(F.body)}}catch(i){r(i)}});var N=class extends I{constructor(e){super(e)}request(e){return K(this.config,e)}};var b=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var q=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:o}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:o,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:o}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:o}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:o,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:o},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}setTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}addTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var C=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}dataLoggerControllerGetLogs(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:t},body:r,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var v=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}};var S=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:o,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:o}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:o,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var x=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=N){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new c,response:new c}}),this.agent=new b(this.request),this.authentication=new f(this.request),this.detection=new q(this.request),this.dialogue=new T(this.request),this.platform=new C(this.request),this.robotics=new A(this.request),this.session=new v(this.request),this.ui=new S(this.request),this.xr=new x(this.request)}};var Te=(s=1e3)=>new Promise(e=>setTimeout(()=>e(),s)),Ce="http://localhost:8080",X=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&J(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||Ce;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),o=r.protocol.startsWith("https");this.mqttUrl=`ws${o?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new $({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new h(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=(0,Y.jwtDecode)(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let o=e;e=o.access_token,t=o.refresh_token,r=o.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};0&&(module.exports={SermasApiClient,sleep});
1
+ var re=Object.create;var m=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var ae=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var pe=(s,e)=>{for(var t in e)m(s,t,{get:e[t],enumerable:!0})},V=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of oe(e))!ne.call(s,o)&&o!==t&&m(s,o,{get:()=>e[o],enumerable:!(r=se(e,o))||r.enumerable});return s};var de=(s,e,t)=>(t=s!=null?re(ie(s)):{},V(e||!s||!s.__esModule?m(t,"default",{value:s,enumerable:!0}):t,s)),ue=s=>V(m({},"__esModule",{value:!0}),s);var n=(s,e,t)=>(ae(s,typeof e!="symbol"?e+"":e,t),t);var Ae={};pe(Ae,{SermasApiClient:()=>X,sleep:()=>Te});module.exports=ue(Ae);var Y=require("jwt-decode");var k=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}};var P=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var U=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var O=class{constructor(e){this.broker=e}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}};var B=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}};var M=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var _=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}};var h=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new k(e),this.module=new P(e),this.auth=new E(e),this.detection=new U(e),this.dialogue=new O(e),this.session=new B(e),this.ui=new M(e),this.xr=new w(e),this.robotics=new _(e)}};var W=de(require("mqtt"),1);var H,J=s=>{H=s},ce=(s="logger")=>new class{format(e){return`[${s}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=H||ce(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var $=class s{constructor(e){this.config=e;n(this,"logger",new g(s.name));n(this,"client");n(this,"subscriptions",[])}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=W.default.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let o=e.indexOf("#");o>-1&&(e=e.substring(0,o));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,o,i,a]=t,p=t.slice(3);return{type:r,appId:o,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let o=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(o===-1)return null;let i=this.subscriptions[o];this.subscriptions.splice(o,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let o=t.byteLength!==void 0,i;o?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...o?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let o=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(o)>-1;)e=e.replace(o,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var c=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},le={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var I=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,o){super(o);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var L=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},R=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let o=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(o,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new L("Request aborted"))}}get isCancelled(){return this._isCancelled}};var D=s=>typeof s=="string",G=s=>D(s)&&s!=="",z=s=>s instanceof Blob,Q=s=>s instanceof FormData,ge=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},ye=s=>{let e=[],t=(o,i)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(i))}`)},r=(o,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(o,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${o}[${a}]`,p)):t(o,i))};return Object.entries(s).forEach(([o,i])=>r(o,i)),e.length?`?${e.join("&")}`:""},me=(s,e)=>{let t=s.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),o=s.BASE+r;return e.query?o+ye(e.query):o},he=s=>{if(s.formData){let e=new FormData,t=(r,o)=>{D(o)||z(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(s.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(i=>t(r,i)):t(r,o)}),e}},j=async(s,e)=>typeof e=="function"?e(s):e,Ie=async(s,e)=>{let[t,r,o,i]=await Promise.all([j(e,s.TOKEN),j(e,s.USERNAME),j(e,s.PASSWORD),j(e,s.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,u])=>({...p,[d]:String(u)}),{});if(G(t)&&(a.Authorization=`Bearer ${t}`),G(r)&&G(o)){let p=ge(`${r}:${o}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:z(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":D(e.body)?a["Content-Type"]="text/plain":Q(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},Re=s=>{if(s.body!==void 0)return s.mediaType?.includes("application/json")||s.mediaType?.includes("+json")?JSON.stringify(s.body):D(s.body)||z(s.body)||Q(s.body)?s.body:JSON.stringify(s.body)},De=async(s,e,t,r,o,i,a)=>{let p=new AbortController,d={headers:i,body:r??o,method:e.method,signal:p.signal};s.WITH_CREDENTIALS&&(d.credentials=s.CREDENTIALS);for(let u of s.interceptors.request._fns)d=await u(d);return a(()=>p.abort()),await fetch(t,d)},be=(s,e)=>{if(e){let t=s.headers.get(e);if(D(t))return t}},fe=async s=>{if(s.status!==204)try{let e=s.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await s.json();if(t.some(r=>e.includes(r)))return await s.blob();if(e.includes("multipart/form-data"))return await s.formData();if(e.includes("text/"))return await s.text()}}catch(e){console.error(e)}},qe=(s,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...s.errors}[e.status];if(r)throw new y(s,e,r);if(!e.ok){let o=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(s,e,`Generic Error: status: ${o}; status text: ${i}; body: ${a}`)}},K=(s,e)=>new R(async(t,r,o)=>{try{let i=me(s,e),a=he(e),p=Re(e),d=await Ie(s,e);if(!o.isCancelled){let u=await De(s,e,i,p,a,d,o);for(let te of s.interceptors.response._fns)u=await te(u);let Z=await fe(u),ee=be(u,e.responseHeader),F={url:i,ok:u.ok,status:u.status,statusText:u.statusText,body:ee??Z};qe(e,F),t(F.body)}}catch(i){r(i)}});var N=class extends I{constructor(e){super(e)}request(e){return K(this.config,e)}};var b=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var q=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:o}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:o,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:o}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:o}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:o,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:o},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}setTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}addTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var C=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}dataLoggerControllerGetLogs(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:t},body:r,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var v=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}};var S=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:o,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:o}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:o,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var x=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=N){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new c,response:new c}}),this.agent=new b(this.request),this.authentication=new f(this.request),this.detection=new q(this.request),this.dialogue=new T(this.request),this.platform=new C(this.request),this.robotics=new A(this.request),this.session=new v(this.request),this.ui=new S(this.request),this.xr=new x(this.request)}};var Te=(s=1e3)=>new Promise(e=>setTimeout(()=>e(),s)),Ce="http://localhost:8080",X=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&J(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||Ce;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),o=r.protocol.startsWith("https");this.mqttUrl=`ws${o?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new $({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new h(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=(0,Y.jwtDecode)(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let o=e;e=o.access_token,t=o.refresh_token,r=o.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};0&&(module.exports={SermasApiClient,sleep});
2
2
  //# sourceMappingURL=index.cjs.map
package/index.d.cts CHANGED
@@ -338,7 +338,7 @@ type ToolsParameterSchema = {
338
338
  /**
339
339
  * flag as required
340
340
  */
341
- required?: boolean;
341
+ ignore?: boolean;
342
342
  /**
343
343
  * provide a predefined value, useful to fill data otherwise missing from the context
344
344
  */
@@ -397,12 +397,34 @@ type ToolsRequestSchema = {
397
397
  headers?: Record<string, unknown>;
398
398
  };
399
399
  type AppToolsDTO = {
400
+ /**
401
+ * Tool name used in the LLM, a descriptive name may help in identifying it correctly
402
+ */
400
403
  name: string;
404
+ /**
405
+ * Tool description used in the LLM, this is key to correctly match the user intent
406
+ */
401
407
  description: string;
408
+ /**
409
+ * List of parameters of the tool
410
+ */
402
411
  schema?: Array<ToolsParameterSchema>;
412
+ /**
413
+ * Provide details to trigger an HTTP API call on tool match
414
+ */
403
415
  request?: ToolsRequestSchema;
416
+ /**
417
+ * Internal event emitted on match
418
+ */
404
419
  emitter?: string;
405
420
  returnDirect?: boolean;
421
+ /**
422
+ * Ignore the LLM response when the tool matches
423
+ */
424
+ skipResponse?: boolean;
425
+ /**
426
+ * API url to call on tool match, defaults to unauthenticated POST if no `request` are provided.
427
+ */
406
428
  url?: string;
407
429
  };
408
430
  type PlatformAppDto = {
@@ -1395,6 +1417,11 @@ type EmailUIContentDto = {
1395
1417
  */
1396
1418
  chunkId?: string;
1397
1419
  };
1420
+ type UiInteractionButtonDto = {
1421
+ context: Record<string, unknown>;
1422
+ element: string;
1423
+ value: string;
1424
+ };
1398
1425
  type UIInteractionDTO = {
1399
1426
  context: Record<string, unknown>;
1400
1427
  element: string;
@@ -2618,11 +2645,19 @@ interface PlatformAppChangedDto {
2618
2645
  sessionId?: string;
2619
2646
  record: PlatformAppDto;
2620
2647
  }
2621
- interface anonymous_schema_100 {
2648
+ interface anonymous_schema_99 {
2649
+ auth?: string;
2650
+ basic?: anonymous_schema_101;
2651
+ bearer?: anonymous_schema_104;
2652
+ moduleId: string;
2653
+ url: string;
2654
+ headers?: Record<string, any>;
2655
+ }
2656
+ interface anonymous_schema_101 {
2622
2657
  username?: string;
2623
2658
  password: string;
2624
2659
  }
2625
- interface anonymous_schema_103 {
2660
+ interface anonymous_schema_104 {
2626
2661
  clientType?: string;
2627
2662
  clientId?: string;
2628
2663
  clientSecret?: string;
@@ -2689,7 +2724,7 @@ interface StringInferenceValue {
2689
2724
  probability: number;
2690
2725
  value: string;
2691
2726
  }
2692
- type anonymous_schema_172 = 'start' | 'stop';
2727
+ type anonymous_schema_174 = 'start' | 'stop';
2693
2728
  interface UserCharacterizationEventDto {
2694
2729
  appId: string;
2695
2730
  clientId?: string;
@@ -3245,4 +3280,4 @@ declare class SermasApiClient {
3245
3280
  login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
3246
3281
  }
3247
3282
 
3248
- export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsChanged, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, TypeEnum, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_100, type anonymous_schema_103, type anonymous_schema_172, sleep };
3283
+ export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsChanged, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, TypeEnum, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_101, type anonymous_schema_104, type anonymous_schema_174, type anonymous_schema_99, sleep };
package/index.d.ts CHANGED
@@ -338,7 +338,7 @@ type ToolsParameterSchema = {
338
338
  /**
339
339
  * flag as required
340
340
  */
341
- required?: boolean;
341
+ ignore?: boolean;
342
342
  /**
343
343
  * provide a predefined value, useful to fill data otherwise missing from the context
344
344
  */
@@ -397,12 +397,34 @@ type ToolsRequestSchema = {
397
397
  headers?: Record<string, unknown>;
398
398
  };
399
399
  type AppToolsDTO = {
400
+ /**
401
+ * Tool name used in the LLM, a descriptive name may help in identifying it correctly
402
+ */
400
403
  name: string;
404
+ /**
405
+ * Tool description used in the LLM, this is key to correctly match the user intent
406
+ */
401
407
  description: string;
408
+ /**
409
+ * List of parameters of the tool
410
+ */
402
411
  schema?: Array<ToolsParameterSchema>;
412
+ /**
413
+ * Provide details to trigger an HTTP API call on tool match
414
+ */
403
415
  request?: ToolsRequestSchema;
416
+ /**
417
+ * Internal event emitted on match
418
+ */
404
419
  emitter?: string;
405
420
  returnDirect?: boolean;
421
+ /**
422
+ * Ignore the LLM response when the tool matches
423
+ */
424
+ skipResponse?: boolean;
425
+ /**
426
+ * API url to call on tool match, defaults to unauthenticated POST if no `request` are provided.
427
+ */
406
428
  url?: string;
407
429
  };
408
430
  type PlatformAppDto = {
@@ -1395,6 +1417,11 @@ type EmailUIContentDto = {
1395
1417
  */
1396
1418
  chunkId?: string;
1397
1419
  };
1420
+ type UiInteractionButtonDto = {
1421
+ context: Record<string, unknown>;
1422
+ element: string;
1423
+ value: string;
1424
+ };
1398
1425
  type UIInteractionDTO = {
1399
1426
  context: Record<string, unknown>;
1400
1427
  element: string;
@@ -2618,11 +2645,19 @@ interface PlatformAppChangedDto {
2618
2645
  sessionId?: string;
2619
2646
  record: PlatformAppDto;
2620
2647
  }
2621
- interface anonymous_schema_100 {
2648
+ interface anonymous_schema_99 {
2649
+ auth?: string;
2650
+ basic?: anonymous_schema_101;
2651
+ bearer?: anonymous_schema_104;
2652
+ moduleId: string;
2653
+ url: string;
2654
+ headers?: Record<string, any>;
2655
+ }
2656
+ interface anonymous_schema_101 {
2622
2657
  username?: string;
2623
2658
  password: string;
2624
2659
  }
2625
- interface anonymous_schema_103 {
2660
+ interface anonymous_schema_104 {
2626
2661
  clientType?: string;
2627
2662
  clientId?: string;
2628
2663
  clientSecret?: string;
@@ -2689,7 +2724,7 @@ interface StringInferenceValue {
2689
2724
  probability: number;
2690
2725
  value: string;
2691
2726
  }
2692
- type anonymous_schema_172 = 'start' | 'stop';
2727
+ type anonymous_schema_174 = 'start' | 'stop';
2693
2728
  interface UserCharacterizationEventDto {
2694
2729
  appId: string;
2695
2730
  clientId?: string;
@@ -3245,4 +3280,4 @@ declare class SermasApiClient {
3245
3280
  login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
3246
3281
  }
3247
3282
 
3248
- export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsChanged, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, TypeEnum, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_100, type anonymous_schema_103, type anonymous_schema_172, sleep };
3283
+ export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsChanged, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, TypeEnum, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_101, type anonymous_schema_104, type anonymous_schema_174, type anonymous_schema_99, sleep };
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var Y=Object.defineProperty;var Z=(s,e,t)=>e in s?Y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>(Z(s,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var x=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}};var k=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var P=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var U=class{constructor(e){this.broker=e}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}};var O=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}};var B=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var M=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var w=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new x(e),this.module=new k(e),this.auth=new P(e),this.detection=new E(e),this.dialogue=new U(e),this.session=new O(e),this.ui=new B(e),this.xr=new M(e),this.robotics=new w(e)}};import te from"mqtt";var N,X=s=>{N=s},ee=(s="logger")=>new class{format(e){return`[${s}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var _=class s{constructor(e){this.config=e;n(this,"logger",new g(s.name));n(this,"client");n(this,"subscriptions",[])}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let o=e.indexOf("#");o>-1&&(e=e.substring(0,o));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,o,i,a]=t,p=t.slice(3);return{type:r,appId:o,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let o=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(o===-1)return null;let i=this.subscriptions[o];this.subscriptions.splice(o,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let o=t.byteLength!==void 0,i;o?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...o?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let o=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(o)>-1;)e=e.replace(o,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var c=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},re={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,o){super(o);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var $=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},I=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let o=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(o,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new $("Request aborted"))}}get isCancelled(){return this._isCancelled}};var R=s=>typeof s=="string",G=s=>R(s)&&s!=="",H=s=>s instanceof Blob,F=s=>s instanceof FormData,se=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},oe=s=>{let e=[],t=(o,i)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(i))}`)},r=(o,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(o,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${o}[${a}]`,p)):t(o,i))};return Object.entries(s).forEach(([o,i])=>r(o,i)),e.length?`?${e.join("&")}`:""},ie=(s,e)=>{let t=s.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),o=s.BASE+r;return e.query?o+oe(e.query):o},ne=s=>{if(s.formData){let e=new FormData,t=(r,o)=>{R(o)||H(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(s.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(i=>t(r,i)):t(r,o)}),e}},L=async(s,e)=>typeof e=="function"?e(s):e,ae=async(s,e)=>{let[t,r,o,i]=await Promise.all([L(e,s.TOKEN),L(e,s.USERNAME),L(e,s.PASSWORD),L(e,s.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,u])=>({...p,[d]:String(u)}),{});if(G(t)&&(a.Authorization=`Bearer ${t}`),G(r)&&G(o)){let p=se(`${r}:${o}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:H(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":R(e.body)?a["Content-Type"]="text/plain":F(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=s=>{if(s.body!==void 0)return s.mediaType?.includes("application/json")||s.mediaType?.includes("+json")?JSON.stringify(s.body):R(s.body)||H(s.body)||F(s.body)?s.body:JSON.stringify(s.body)},de=async(s,e,t,r,o,i,a)=>{let p=new AbortController,d={headers:i,body:r??o,method:e.method,signal:p.signal};s.WITH_CREDENTIALS&&(d.credentials=s.CREDENTIALS);for(let u of s.interceptors.request._fns)d=await u(d);return a(()=>p.abort()),await fetch(t,d)},ue=(s,e)=>{if(e){let t=s.headers.get(e);if(R(t))return t}},ce=async s=>{if(s.status!==204)try{let e=s.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await s.json();if(t.some(r=>e.includes(r)))return await s.blob();if(e.includes("multipart/form-data"))return await s.formData();if(e.includes("text/"))return await s.text()}}catch(e){console.error(e)}},le=(s,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...s.errors}[e.status];if(r)throw new y(s,e,r);if(!e.ok){let o=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(s,e,`Generic Error: status: ${o}; status text: ${i}; body: ${a}`)}},V=(s,e)=>new I(async(t,r,o)=>{try{let i=ie(s,e),a=ne(e),p=pe(e),d=await ae(s,e);if(!o.isCancelled){let u=await de(s,e,i,p,a,d,o);for(let K of s.interceptors.response._fns)u=await K(u);let W=await ce(u),Q=ue(u,e.responseHeader),z={url:i,ok:u.ok,status:u.status,statusText:u.statusText,body:Q??W};le(e,z),t(z.body)}}catch(i){r(i)}});var j=class extends h{constructor(e){super(e)}request(e){return V(this.config,e)}};var D=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:o}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:o,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:o}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:o}})}};var q=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:o,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:o},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}setTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}addTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var T=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}dataLoggerControllerGetLogs(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:t},body:r,mediaType:"application/json"})}};var C=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var A=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}};var v=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:o,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:o}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:o,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var S=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new c,response:new c}}),this.agent=new D(this.request),this.authentication=new b(this.request),this.detection=new f(this.request),this.dialogue=new q(this.request),this.platform=new T(this.request),this.robotics=new C(this.request),this.session=new A(this.request),this.ui=new v(this.request),this.xr=new S(this.request)}};var Kt=(s=1e3)=>new Promise(e=>setTimeout(()=>e(),s)),ye="http://localhost:8080",J=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&X(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),o=r.protocol.startsWith("https");this.mqttUrl=`ws${o?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new _({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let o=e;e=o.access_token,t=o.refresh_token,r=o.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{J as SermasApiClient,Kt as sleep};
1
+ var Y=Object.defineProperty;var Z=(s,e,t)=>e in s?Y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>(Z(s,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var x=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}};var k=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var P=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var U=class{constructor(e){this.broker=e}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:sessionId",e,t)}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}};var O=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}};var B=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var M=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var w=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new x(e),this.module=new k(e),this.auth=new P(e),this.detection=new E(e),this.dialogue=new U(e),this.session=new O(e),this.ui=new B(e),this.xr=new M(e),this.robotics=new w(e)}};import te from"mqtt";var N,X=s=>{N=s},ee=(s="logger")=>new class{format(e){return`[${s}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var _=class s{constructor(e){this.config=e;n(this,"logger",new g(s.name));n(this,"client");n(this,"subscriptions",[])}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let o=e.indexOf("#");o>-1&&(e=e.substring(0,o));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,o,i,a]=t,p=t.slice(3);return{type:r,appId:o,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let o=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(o===-1)return null;let i=this.subscriptions[o];this.subscriptions.splice(o,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let o=t.byteLength!==void 0,i;o?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...o?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let o=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(o)>-1;)e=e.replace(o,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var c=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},re={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new c,response:new c}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,o){super(o);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var $=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},I=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let o=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(o,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new $("Request aborted"))}}get isCancelled(){return this._isCancelled}};var R=s=>typeof s=="string",H=s=>R(s)&&s!=="",G=s=>s instanceof Blob,F=s=>s instanceof FormData,se=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},oe=s=>{let e=[],t=(o,i)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(i))}`)},r=(o,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(o,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${o}[${a}]`,p)):t(o,i))};return Object.entries(s).forEach(([o,i])=>r(o,i)),e.length?`?${e.join("&")}`:""},ie=(s,e)=>{let t=s.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),o=s.BASE+r;return e.query?o+oe(e.query):o},ne=s=>{if(s.formData){let e=new FormData,t=(r,o)=>{R(o)||G(o)?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(s.formData).filter(([,r])=>r!=null).forEach(([r,o])=>{Array.isArray(o)?o.forEach(i=>t(r,i)):t(r,o)}),e}},L=async(s,e)=>typeof e=="function"?e(s):e,ae=async(s,e)=>{let[t,r,o,i]=await Promise.all([L(e,s.TOKEN),L(e,s.USERNAME),L(e,s.PASSWORD),L(e,s.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,u])=>({...p,[d]:String(u)}),{});if(H(t)&&(a.Authorization=`Bearer ${t}`),H(r)&&H(o)){let p=se(`${r}:${o}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:G(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":R(e.body)?a["Content-Type"]="text/plain":F(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=s=>{if(s.body!==void 0)return s.mediaType?.includes("application/json")||s.mediaType?.includes("+json")?JSON.stringify(s.body):R(s.body)||G(s.body)||F(s.body)?s.body:JSON.stringify(s.body)},de=async(s,e,t,r,o,i,a)=>{let p=new AbortController,d={headers:i,body:r??o,method:e.method,signal:p.signal};s.WITH_CREDENTIALS&&(d.credentials=s.CREDENTIALS);for(let u of s.interceptors.request._fns)d=await u(d);return a(()=>p.abort()),await fetch(t,d)},ue=(s,e)=>{if(e){let t=s.headers.get(e);if(R(t))return t}},ce=async s=>{if(s.status!==204)try{let e=s.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await s.json();if(t.some(r=>e.includes(r)))return await s.blob();if(e.includes("multipart/form-data"))return await s.formData();if(e.includes("text/"))return await s.text()}}catch(e){console.error(e)}},le=(s,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...s.errors}[e.status];if(r)throw new y(s,e,r);if(!e.ok){let o=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(s,e,`Generic Error: status: ${o}; status text: ${i}; body: ${a}`)}},V=(s,e)=>new I(async(t,r,o)=>{try{let i=ie(s,e),a=ne(e),p=pe(e),d=await ae(s,e);if(!o.isCancelled){let u=await de(s,e,i,p,a,d,o);for(let K of s.interceptors.response._fns)u=await K(u);let W=await ce(u),Q=ue(u,e.responseHeader),z={url:i,ok:u.ok,status:u.status,statusText:u.statusText,body:Q??W};le(e,z),t(z.body)}}catch(i){r(i)}});var j=class extends h{constructor(e){super(e)}request(e){return V(this.config,e)}};var D=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:o}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:o,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:o}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:o}})}};var q=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:o,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:o},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}setTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}addTools(e){let{appId:t,requestBody:r,sessionId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{appId}/{sessionId}",path:{appId:t,sessionId:o},body:r,mediaType:"application/json"})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var T=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}dataLoggerControllerGetLogs(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:t},body:r,mediaType:"application/json"})}};var C=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var A=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}};var v=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:o,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:o}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:o,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var S=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new c,response:new c}}),this.agent=new D(this.request),this.authentication=new b(this.request),this.detection=new f(this.request),this.dialogue=new q(this.request),this.platform=new T(this.request),this.robotics=new C(this.request),this.session=new A(this.request),this.ui=new v(this.request),this.xr=new S(this.request)}};var Kt=(s=1e3)=>new Promise(e=>setTimeout(()=>e(),s)),ye="http://localhost:8080",J=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&X(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),o=r.protocol.startsWith("https");this.mqttUrl=`ws${o?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new _({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let o=e;e=o.access_token,t=o.refresh_token,r=o.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let o=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await o.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{J as SermasApiClient,Kt as sleep};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sermas/api-client",
3
- "version": "1.0.0-alpha.44",
3
+ "version": "1.0.0-alpha.45",
4
4
  "description": "Sermas API client",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",