@hailer/app-sdk 2.0.0-beta-1 → 2.0.0-beta-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app-sdk.js +2 -2
- package/lib/app-sdk.js.map +3 -3
- package/lib/tools/publish.cjs +218 -186
- package/lib/tools/publish.cjs.map +7 -0
- package/package.json +3 -4
- package/lib/modules/network.d.ts +0 -14
- package/lib/modules/process.d.ts +0 -38
- package/lib/modules/team.d.ts +0 -17
- package/lib/tools/publish.d.ts +0 -1
- package/lib/tools/replace-private.d.ts +0 -1
- package/lib/tools/replace-private.js +0 -33
package/lib/app-sdk.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
Field: ${this.details}, ${this.debug}`}};var w=class{constructor(t){this.client=t}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("user.get",[t])}catch(e){throw new a(e)}})}current(){return n(this,null,function*(){try{return yield this.client.requestAsync("user.current",[])}catch(t){throw new a(t)}})}list(){return n(this,null,function*(){try{return yield this.client.requestAsync("user.list",[])}catch(t){throw new a(t)}})}};var b=class{constructor(t){this.client=t}list(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.kanban.list",[t,...e?[e]:[]])}catch(r){throw new a(r)}})}load(t){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.kanban.load",[t])}catch(e){throw new a(e)}})}updatePriority(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.kanban.updatePriority",[{activityId:t,priority:e}])}catch(r){throw new a(r)}})}};var v=class{constructor(t){this.client=t;this.kanban=new b(t)}list(t,e,r){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.list",[t,e,r])}catch(i){throw new a(i)}})}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.get",[t])}catch(e){throw new a(e)}})}create(t,e,r){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.create",[t,e,...r?[r]:[]])}catch(i){throw new a(i)}})}update(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.update",[t,...e?[e]:[]])}catch(r){throw new a(r)}})}remove(t){return n(this,null,function*(){try{return yield this.client.requestAsync("activity.remove",[t])}catch(e){throw new a(e)}})}};var P=class{constructor(t){this.client=t;this.product={publishTemplate:this.publishTemplate.bind(this),isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getManifest:this.getManifest.bind(this)}}current(){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.current",[])}catch(t){throw new a(t)}})}list(){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.list",[])}catch(t){throw new a(t)}})}publishTemplate(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.product.publishTemplate",[t])}catch(e){throw new a(e)}})}isProductInstalled(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.product.isProductInstalled",[t])}catch(e){throw new a(e)}})}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.product.get",[t])}catch(e){throw new a(e)}})}install(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.product.install",[t])}catch(e){throw new a(e)}})}getManifest(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workspace.product.getManifest",[t])}catch(e){throw new a(e)}})}};var q=class{constructor(t){this.client=t}open(t,e){return n(this,null,function*(){yield this.client.requestAsync("ui.activity.open",[t,...e?[e]:[]])})}create(t,e){return n(this,null,function*(){return yield this.client.requestAsync("ui.activity.create",[t,...e?[e]:[]])})}editMultiple(t){return n(this,null,function*(){return yield this.client.requestAsync("ui.activity.editMultiple",[t])})}};var A=class{constructor(t){this.client=t}open(t,e,r){return n(this,null,function*(){yield this.client.requestAsync("ui.snackbar.open",[t,e,r])})}};var k=class{constructor(t){this.client=t}uploadFile(t,e,r){return n(this,null,function*(){return yield this.client.requestAsync("ui.file.upload",[yield this.toBase64(t),e,!!(r!=null&&r.isPublic)])})}toBase64(t){return new Promise((e,r)=>{let i=new FileReader;i.readAsDataURL(t),i.onload=()=>{var s;return e((s=i.result)!=null?s:"")},i.onerror=r})}};var x=class{constructor(t){this.client=t;this.activity=new q(t),this.snackbar=new A(t),this.insight={create:e=>n(this,null,function*(){yield t.requestAsync("ui.insight.create",[e])}),edit:e=>n(this,null,function*(){yield t.requestAsync("ui.insight.edit",[e])}),delete:e=>n(this,null,function*(){yield t.requestAsync("ui.insight.delete",[e])}),permission:e=>n(this,null,function*(){yield t.requestAsync("ui.insight.permission",[e])})},this.files=new k(t)}};var z=["https://app.hailer.com","https://next.hailer.com","https://testapp.hailer.biz","https://app.hailer.biz","https://localhost:9443"],y="https://api.hailer.com",$={"https://app.hailer.com":y,"https://next.hailer.com":y,"https://app.hailer.biz":"https://api.hailer.biz","https://testapp.hailer.biz":"https://testapi.hailer.biz","https://localhost:9443":"http://localhost:1337"};var O=class{constructor(t){this.options=t}config(){return n(this,null,function*(){let t="manifest.json",e=window.location.origin+window.location.pathname,r=e+t;e.endsWith("/index.html")&&(r=e.slice(0,-10)+t);let i=yield(yield fetch(r)).text(),o=JSON.parse(i).appId;return yield(yield fetch(this.options.publicBackendUrl+"/api/v3/app/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([o])})).json()})}};var C=class{constructor(t){this.options=t}data(t){return n(this,null,function*(){let e=yield fetch(this.options.publicBackendUrl+"/api/v2/forms/process/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new a(yield e.json());return yield e.json()})}submit(t,e){return n(this,null,function*(){let r=yield fetch(this.options.publicBackendUrl+"/api/v2/forms/activity/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new a(yield r.json());return yield r.json()})}};var I=class{constructor(t){this.options=t}data(t){return n(this,null,function*(){let e=yield fetch(this.options.publicBackendUrl+"/api/v3/insight/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new a(yield e.json());return yield e.json()})}dataAsObject(t){return n(this,null,function*(){let r=(yield this.data(t)).data,i=[];return r.rows.forEach(s=>{let o={};r.headers.forEach((l,d)=>{o[l]=s[d]}),i.push(o)}),i})}};var F=class{constructor(t){this.options=t}list(t,e){return n(this,null,function*(){let r=yield fetch(this.options.publicBackendUrl+"/api/v3/product/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new a(yield r.json());return yield r.json()})}get(t){return n(this,null,function*(){let e=yield fetch(this.options.publicBackendUrl+"/api/v3/product/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new a(yield e.json());return yield e.json()})}};var U=class{constructor(t){this.insight=new I(t),this.form=new C(t),this.app=new O(t),this.product=new F(t)}};var S=class{constructor(t){this.client=t}list(){return n(this,null,function*(){try{return yield this.client.requestAsync("workflow.list",[])}catch(t){throw console.error(t.msg,t),new a(t)}})}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("workflow.get",[t])}catch(e){throw new a(e)}})}install(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("workflow.install",[t,e])}catch(r){throw new a(r)}})}};var T=class{constructor(t){this.client=t;this.config={update:(t,e)=>n(this,null,function*(){try{return yield this.client.requestAsync("app.config.update",[t,...e?[e]:[]])}catch(r){throw console.log("Errorasd ",r),new a(r)}})};this.product={isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getInstalledVersion:this.getInstalledVersion.bind(this),getManifest:this.getManifest.bind(this)}}isProductInstalled(t){return n(this,null,function*(){try{return yield this.client.requestAsync("app.product.isProductInstalled",[t])}catch(e){throw new a(e)}})}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("app.product.get",[t])}catch(e){throw new a(e)}})}install(t){return n(this,null,function*(){try{return yield this.client.requestAsync("app.product.install",[t])}catch(e){throw new a(e)}})}getInstalledVersion(t){return n(this,null,function*(){try{return yield this.client.requestAsync("app.product.getInstalledVersion",[t])}catch(e){throw new a(e)}})}getManifest(t){return n(this,null,function*(){try{return yield this.client.requestAsync("app.product.getManifest",[t])}catch(e){throw new a(e)}})}};var _=class{constructor(t){this.client=t}data(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("insight.data",[t,...e?[e]:[]])}catch(r){throw new a(r)}})}list(){return n(this,null,function*(){try{return yield this.client.requestAsync("insight.list",[])}catch(t){throw new a(t)}})}update(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("insight.update",[t,e])}catch(r){throw new a(r)}})}};var R=class{constructor(t){this.client=t;this.map=()=>n(this,null,function*(){try{return yield this.client.requestAsync("permission.map",[])}catch(t){throw console.log("Failed to read permissions from Hailer, error:",t),new a(t)}})}};var M=class{constructor(t){this.client=t}list(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("product.list",[t,e])}catch(r){throw new a(r)}})}get(t){return n(this,null,function*(){try{return yield this.client.requestAsync("product.get",[t])}catch(e){throw new a(e)}})}create(t){return n(this,null,function*(){try{return yield this.client.requestAsync("product.create",[t])}catch(e){throw new a(e)}})}update(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("product.update",[t,e])}catch(r){throw new a(r)}})}remove(t){return n(this,null,function*(){try{return yield this.client.requestAsync("product.remove",[t])}catch(e){throw new a(e)}})}setPublic(t,e){return n(this,null,function*(){try{return yield this.client.requestAsync("product.setPublic",[t,e])}catch(r){throw new a(r)}})}};var W=class{constructor(t={}){this.options=t;this.outside=null;var i;let e=(i=t.allowedUrls)!=null?i:z;this.client=new G.Client(s=>{this.hostUrl&&parent.postMessage(JSON.stringify(s),this.hostUrl)}),this.user=new w(this.client),this.app=new T(this.client),this.activity=new v(this.client),this.insight=new _(this.client),this.workspace=new P(this.client),this.workflow=new S(this.client),this.permission=new R(this.client),this.public=new U(this.options),this.ui=new x(this.client),this.product=new M(this.client);let r=JSON.stringify({op:"register",args:[{appApiVersion:"2"}]});window.location===window.parent.location?(this.options.publicBackendUrl||(this.options.publicBackendUrl=y),this.public.app.config().then(s=>{var o,l;this.outside=!0,(l=(o=this.options).outside)==null||l.call(o,s)}).catch(s=>{var o,l;(l=(o=this.options).error)==null||l.call(o,s),console.error("Failed to get app configuration in Public App.",s)})):(e.forEach(s=>parent.postMessage(r,s)),this.timer=setTimeout(()=>{var s,o;this.outside=!0,(o=(s=this.options).outside)==null||o.call(s)},100)),this.createEventListener()}createEventListener(){window.addEventListener("message",t=>n(this,null,function*(){var r,i;let e=t.data;try{let s=JSON.parse(e);if(s.op==="register"){if(this.appId){console.error("App Id is already set...! Are you using hot-reload?");return}clearTimeout(this.timer),this.appId=s.data.appId,this.workspaceId=s.data.workspaceId,this.hostUrl=t.origin,this.options.publicBackendUrl||(this.options.publicBackendUrl=$[this.hostUrl]||y),this.client.request("ui.settings",[],(o,l,d)=>{var p,u;if(o){console.log("ui.settings error:",o,l);return}(u=(p=this.options).settings)==null||u.call(p,l)}),this.client.request("config",[],(o,l,d)=>{var p,u;if(o){console.log("config error:",o,l);return}(u=(p=this.options).config)==null||u.call(p,l)}),this.client.request("signal",[],(o,l,d)=>{var p,u;if(o){console.log("signal error:",o,l);return}l&&((u=(p=this.options).signals)==null||u.call(p,l))}),this.outside=!1,(i=(r=this.options).connected)==null||i.call(r);return}if(!this.appId)return;this.client.messageReceived(s)}catch(s){console.log("Dropped invalid JSON message")}}))}info(){return{hostUrl:this.hostUrl,config:this.config,outside:this.outside,workspaceId:this.workspaceId}}};export{W as HailerApi,a as HailerError};
|
|
1
|
+
var G=Object.create;var W=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var j=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var tt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!Z.call(o,i)&&i!==e&&W(o,i,{get:()=>t[i],enumerable:!(r=Q(t,i))||r.enumerable});return o};var et=(o,t,e)=>(e=o!=null?G(Y(o)):{},tt(t||!o||!o.__esModule?W(e,"default",{value:o,enumerable:!0}):e,o));var B=j(d=>{"use strict";var it=d&&d.__awaiter||function(o,t,e,r){function i(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function l(c){try{u(r.next(c))}catch(M){a(M)}}function h(c){try{u(r.throw(c))}catch(M){a(M)}}function u(c){c.done?s(c.value):i(c.value).then(l,h)}u((r=r.apply(o,t||[])).next())})};Object.defineProperty(d,"__esModule",{value:!0});d.Client=void 0;var D=class{constructor(t,e){this.write=t,this.requests={},this.id=0,this.mtu=65535,e&&e.mtu&&(this.mtu=e.mtu)}destroy(){this.requests=null,this.write=null}messageReceived(t){let e=!!(t.err||t.ack||t.fin),r=t.ack||t.err||t.sig||t.fin,i=this.requests[r],s;if(i&&typeof i.cb=="function"){let a;t.fin?i.cb.call(i.context,null,null,!0):i.canceled?console.log("This request is canceled. Not calling the callback."):(a=t.err?t.data:null,s=i.cb.call(i.context,a,t.data,e))}return e&&delete this.requests[r],s}requestAsync(t,e){return it(this,void 0,void 0,function*(){return new Promise((r,i)=>{this.request(t,e,(s,a)=>{if(s)return i(a);r(a)})})})}request(t,e,r){this.id++;let i={op:t};return Array.isArray(e)&&(i.args=e),r&&(i.id=this.id,this.requests[i.id]={cb:r,context:{id:i.id,cancel:()=>{setTimeout((s=>()=>{this.requests[s]&&console.log("rpc-client.js: timeout, the request has not been removed while it was canceled",s,this.requests[s])})(i.id),1500),this.requests[i.id].canceled=!0,this.write({end:i.id})},emit:s=>this.write({sig:i.id,data:s})}}),this.write(i),i.id||null}send(t,e){this.write({push:t,data:e})}end(t){this.write({end:t})}};d.Client=D});var N=j(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Server=void 0;var f=console.log,E=class{constructor(t){this.modules={},this.methods={},this.requests={},this.clientIdCounter=0,this.requestId=0,this.invokeId=0,t&&this.insertMethods(t)}destroy(){for(let t in this.requests){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end();delete this.requests[t]}}insertMethods(t){this.addMethods("",t)}addMethods(t,e){let r=t?t+".":"";for(let i in e)if(i!=="_"){if(i.substring(0,1)!=="_"&&e["_"+i])if(typeof e[i]=="function"){let s=e["_"+i].name||i;e["_"+i].fullname=r+s;try{this.modules[r+s]=e["_"+i],this.methods[r+s]=e[i]}catch(a){console.log("Kaboom! ",a)}}else typeof e[i]=="object"&&this.addMethods(r+i,e[i])}}listMethods(t,e,r){let i={};function s(l,h){let u={};for(let c in l)h[c]||(u[c]=l[c]);return u}let a={fullname:!0};for(let l in this.modules)i[l]=s(this.modules[l],a);r(null,i)}clientOffline(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}closeAll(){for(let t in this.requests)for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}parse(t,e,r,i){if(typeof i=="number")try{if(t.push){this.requests[i]&&this.requests[i][t.push]&&this.invokeRaw(t,e,this.requests[i][t.push].context,i);return}if(t.sig){this.requests[i]&&this.requests[i][t.sig]&&this.invokeRaw(t,e,this.requests[i][t.sig].context,i);return}if(t.end){let s=t.end;if(this.requests[i]&&this.requests[i][s]){typeof this.requests[i][s].end=="function"&&this.requests[i][s].end(),e({fin:s}),delete this.requests[i][s];return}if(!this.requests[i][s])return;typeof this.requests[i][s].end=="function"&&this.requests[s].end();return}if(t.op==="methods"){this.listMethods(t.args,r,function(s,a){e({ack:t.id,data:a})});return}if(typeof this.methods[t.op]>"u"){e({err:t.id,data:{code:300,msg:"No method found: "+t.op}});return}this.invokeRaw(t,e,r,i)}catch(s){f("Dynamic RPC failed to execute ",t.op,s,s.stack);try{console.log("RPC caught error",s.stack),e({ack:t.id,err:t.id,data:"caught error in "+t.op+": "+s.toString(),debug:s.stack})}catch(a){e({err:t.id,data:"rpc",errmsg:a.toString()})}}}emit(t,e){for(let r in this.requests)if(this.requests[r]){for(let i in this.requests[r])if(this.requests[r][i].op===t){let{send:s}=this.requests[r][i];s({sig:i,data:e})}}}invokeRaw(t,e,r,i){if(++this.requestId,!this.requests[i])return console.log("Session not opened for client. Use Server.open() first");if(t.push){let s=this.requests[i][t.push];if(t.data===null){console.log("msg.data is null:",t);return}s.data(t.data);return}if(t.sig){let s=this.requests[i][t.sig];try{this.methods[s.op].call(this.requests[i][t.sig],t.data,{send:a=>{typeof s.end=="function"&&s.end(),this.requests[i][t.sig]&&delete this.requests[i][t.sig],e({ack:t.sig,data:a})},emit:a=>(this.requests[i][t.sig]||typeof s.end=="function"&&s.end(),e({sig:t.sig,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.sig],e({err:t.sig,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.sig],e({fin:t.sig})}},r)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[i][t.sig],e({err:t.sig,data:{msg:"rpc failed during execution of "+t.op,code:578}})}return}if(typeof t.id>"u"){let s={};this.methods[t.op].call(s,{args:t.args},{send:()=>{f("Trying to send response to event ("+t.op+"). Dropping.")},emit:()=>{f("Trying to emit response to event ("+t.op+"). Dropping.")},error:()=>{f("Trying to respond with error to event ("+t.op+"). Dropping.")},close:()=>{f("Trying to close event ("+t.op+"). Dropping.")}},r)}else{let s={id:t.id,op:t.op,args:t.args,context:r,end:null,send:e};this.requests[i]||(this.requests[i]={}),this.requests[i][t.id]&&(console.log("Serious warning. There is already a request by that id, we'll kill it off! This session is likely not clean. clientId:",i,"msg",t,"stack trace:",new Error().stack),typeof this.requests[i][t.id].end=="function"&&this.requests[i][t.id].end(),delete this.requests[i][t.id],console.log("Removed old request by same id from same client...")),this.requests[i][t.id]=s;try{this.methods[t.op].call(s,{args:t.args},{send:a=>{typeof s.end=="function"&&s.end(),this.requests[i][t.id]&&delete this.requests[i][t.id],e({ack:t.id,data:a})},emit:a=>(this.requests[i][t.id]||typeof s.end=="function"&&s.end(),e({sig:t.id,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.id],e({err:t.id,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.id],e({fin:t.id})}},r)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[i][t.id],e({err:t.id,data:{msg:"rpc failed during execution of "+t.op,code:578}})}}}close(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e];delete this.requests[t]}open(){let t=++this.clientIdCounter;return this.requests[t]={},t}};y.Server=E});var K=j(p=>{"use strict";var rt=p&&p.__createBinding||(Object.create?function(o,t,e,r){r===void 0&&(r=e),Object.defineProperty(o,r,{enumerable:!0,get:function(){return t[e]}})}:function(o,t,e,r){r===void 0&&(r=e),o[r]=t[e]}),H=p&&p.__exportStar||function(o,t){for(var e in o)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&rt(t,o,e)};Object.defineProperty(p,"__esModule",{value:!0});H(B(),p);H(N(),p)});var $=et(K(),1);var L=class extends Error{constructor(t,e){super(t),this.name=this.constructor.name,this.msg=t,this.code=e,Error.captureStackTrace?.(this,this.constructor)}},n=class extends L{constructor(t){super(t.msg,t.code),this.details=t.details,this.debug=t.debug}toString(){return console.log("Going to log an error... ;-D"),`${super.toString()}
|
|
2
|
+
Field: ${this.details}, ${this.debug}`}};var m=class{constructor(t){this.client=t}async get(t){try{return await this.client.requestAsync("user.get",[t])}catch(e){throw new n(e)}}async current(){try{return await this.client.requestAsync("user.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("user.list",[])}catch(t){throw new n(t)}}};var w=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("activity.kanban.list",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async load(t){try{return await this.client.requestAsync("activity.kanban.load",[t])}catch(e){throw new n(e)}}async updatePriority(t,e){try{return await this.client.requestAsync("activity.kanban.updatePriority",[{activityId:t,priority:e}])}catch(r){throw new n(r)}}};var b=class{constructor(t){this.client=t;this.kanban=new w(t)}async list(t,e,r){try{return await this.client.requestAsync("activity.list",[t,e,r])}catch(i){throw new n(i)}}async get(t){try{return await this.client.requestAsync("activity.get",[t])}catch(e){throw new n(e)}}async create(t,e,r){try{return await this.client.requestAsync("activity.create",[t,e,...r?[r]:[]])}catch(i){throw new n(i)}}async update(t,e){try{return await this.client.requestAsync("activity.update",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async remove(t){try{return await this.client.requestAsync("activity.remove",[t])}catch(e){throw new n(e)}}};var v=class{constructor(t){this.client=t;this.product={publishTemplate:this.publishTemplate.bind(this),isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getManifest:this.getManifest.bind(this)}}async current(){try{return await this.client.requestAsync("workspace.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("workspace.list",[])}catch(t){throw new n(t)}}async publishTemplate(t){try{return await this.client.requestAsync("workspace.product.publishTemplate",[t])}catch(e){throw new n(e)}}async isProductInstalled(t){try{return await this.client.requestAsync("workspace.product.isProductInstalled",[t])}catch(e){throw new n(e)}}async get(t){try{return await this.client.requestAsync("workspace.product.get",[t])}catch(e){throw new n(e)}}async install(t){try{return await this.client.requestAsync("workspace.product.install",[t])}catch(e){throw new n(e)}}async getManifest(t){try{return await this.client.requestAsync("workspace.product.getManifest",[t])}catch(e){throw new n(e)}}};var P=class{constructor(t){this.client=t}async open(t,e){await this.client.requestAsync("ui.activity.open",[t,...e?[e]:[]])}async create(t,e){return await this.client.requestAsync("ui.activity.create",[t,...e?[e]:[]])}async editMultiple(t){return await this.client.requestAsync("ui.activity.editMultiple",[t])}};var q=class{constructor(t){this.client=t}async open(t,e,r){await this.client.requestAsync("ui.snackbar.open",[t,e,r])}};var A=class{constructor(t){this.client=t}async uploadFile(t,e,r){return await this.client.requestAsync("ui.file.upload",[await this.toBase64(t),e,!!r?.isPublic])}toBase64(t){return new Promise((e,r)=>{let i=new FileReader;i.readAsDataURL(t),i.onload=()=>e(i.result??""),i.onerror=r})}};var k=class{constructor(t){this.client=t;this.activity=new P(t),this.snackbar=new q(t),this.insight={create:async e=>{await t.requestAsync("ui.insight.create",[e])},edit:async e=>{await t.requestAsync("ui.insight.edit",[e])},delete:async e=>{await t.requestAsync("ui.insight.delete",[e])},permission:async e=>{await t.requestAsync("ui.insight.permission",[e])}},this.files=new A(t)}};var J=["https://app.hailer.com","https://next.hailer.com","https://testapp.hailer.biz","https://app.hailer.biz","https://app.hailer.local.gd","https://app.k8s.hailer.biz","https://localhost:9443"],g="https://api.hailer.com",z={"https://app.hailer.com":g,"https://next.hailer.com":g,"https://app.hailer.biz":"https://api.hailer.biz","https://testapp.hailer.biz":"https://testapi.hailer.biz","https://app.hailer.local.gd":"https://api.hailer.local.gd","https://app.k8s.hailer.biz":"https://api.k8s.hailer.biz","https://localhost:9443":"http://localhost:1337"};var x=class{constructor(t){this.options=t}async config(){let t="manifest.json",e=window.location.origin+window.location.pathname,r=e+t;e.endsWith("/index.html")&&(r=e.slice(0,-10)+t);let i=await(await fetch(r)).text(),a=JSON.parse(i).appId;return await(await fetch(this.options.publicBackendUrl+"/api/v3/app/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([a])})).json()}};var O=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v2/forms/process/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async submit(t,e){let r=await fetch(this.options.publicBackendUrl+"/api/v2/forms/activity/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new n(await r.json());return await r.json()}};var C=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/insight/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async dataAsObject(t){let r=(await this.data(t)).data,i=[];return r.rows.forEach(s=>{let a={};r.headers.forEach((l,h)=>{a[l]=s[h]}),i.push(a)}),i}};var I=class{constructor(t){this.options=t}async list(t,e){let r=await fetch(this.options.publicBackendUrl+"/api/v3/product/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new n(await r.json());return await r.json()}async get(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/product/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}};var F=class{constructor(t){this.insight=new C(t),this.form=new O(t),this.app=new x(t),this.product=new I(t)}};var U=class{constructor(t){this.client=t}async list(){try{return await this.client.requestAsync("workflow.list",[])}catch(t){throw console.error(t.msg,t),new n(t)}}async get(t){try{return await this.client.requestAsync("workflow.get",[t])}catch(e){throw new n(e)}}async install(t,e){try{return await this.client.requestAsync("workflow.install",[t,e])}catch(r){throw new n(r)}}};var S=class{constructor(t){this.client=t;this.config={update:async(t,e)=>{try{return await this.client.requestAsync("app.config.update",[t,...e?[e]:[]])}catch(r){throw console.log("Errorasd ",r),new n(r)}}};this.product={isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getInstalledVersion:this.getInstalledVersion.bind(this),getManifest:this.getManifest.bind(this)}}async isProductInstalled(t){try{return await this.client.requestAsync("app.product.isProductInstalled",[t])}catch(e){throw new n(e)}}async get(t){try{return await this.client.requestAsync("app.product.get",[t])}catch(e){throw new n(e)}}async install(t){try{return await this.client.requestAsync("app.product.install",[t])}catch(e){throw new n(e)}}async getInstalledVersion(t){try{return await this.client.requestAsync("app.product.getInstalledVersion",[t])}catch(e){throw new n(e)}}async getManifest(t){try{return await this.client.requestAsync("app.product.getManifest",[t])}catch(e){throw new n(e)}}};var T=class{constructor(t){this.client=t}async data(t,e){try{return await this.client.requestAsync("insight.data",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async list(){try{return await this.client.requestAsync("insight.list",[])}catch(t){throw new n(t)}}async update(t,e){try{return await this.client.requestAsync("insight.update",[t,e])}catch(r){throw new n(r)}}};var _=class{constructor(t){this.client=t;this.map=async()=>{try{return await this.client.requestAsync("permission.map",[])}catch(t){throw console.log("Failed to read permissions from Hailer, error:",t),new n(t)}}}};var R=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("product.list",[t,e])}catch(r){throw new n(r)}}async get(t){try{return await this.client.requestAsync("product.get",[t])}catch(e){throw new n(e)}}async create(t){try{return await this.client.requestAsync("product.create",[t])}catch(e){throw new n(e)}}async update(t,e){try{return await this.client.requestAsync("product.update",[t,e])}catch(r){throw new n(r)}}async remove(t){try{return await this.client.requestAsync("product.remove",[t])}catch(e){throw new n(e)}}async setPublic(t,e){try{return await this.client.requestAsync("product.setPublic",[t,e])}catch(r){throw new n(r)}}};var V=class{constructor(t={}){this.options=t;this.outside=null;let e=t.allowedUrls??J;this.client=new $.Client(i=>{this.hostUrl&&parent.postMessage(JSON.stringify(i),this.hostUrl)}),this.user=new m(this.client),this.app=new S(this.client),this.activity=new b(this.client),this.insight=new T(this.client),this.workspace=new v(this.client),this.workflow=new U(this.client),this.permission=new _(this.client),this.public=new F(this.options),this.ui=new k(this.client),this.product=new R(this.client);let r=JSON.stringify({op:"register",args:[{appApiVersion:"2"}]});window.location===window.parent.location?(this.options.publicBackendUrl||(this.options.publicBackendUrl=g),this.public.app.config().then(i=>{this.outside=!0,this.options.outside?.(i)}).catch(i=>{this.options.error?.(i),console.error("Failed to get app configuration in Public App.",i)})):(e.forEach(i=>parent.postMessage(r,i)),this.timer=setTimeout(()=>{this.outside=!0,this.options.outside?.()},100)),this.createEventListener()}createEventListener(){window.addEventListener("message",async t=>{let e=t.data;try{let r=JSON.parse(e);if(r.op==="register"){if(this.appId){console.error("App Id is already set...! Are you using hot-reload?");return}clearTimeout(this.timer),this.appId=r.data.appId,this.workspaceId=r.data.workspaceId,this.hostUrl=t.origin,this.options.publicBackendUrl||(this.options.publicBackendUrl=z[this.hostUrl]||g),this.client.request("ui.settings",[],(i,s,a)=>{if(i){console.log("ui.settings error:",i,s);return}this.options.settings?.(s)}),this.client.request("config",[],(i,s,a)=>{if(i){console.log("config error:",i,s);return}this.options.config?.(s)}),this.client.request("signal",[],(i,s,a)=>{if(i){console.log("signal error:",i,s);return}s&&this.options.signals?.(s)}),this.outside=!1,this.options.connected?.();return}if(!this.appId)return;this.client.messageReceived(r)}catch{console.log("Dropped invalid JSON message")}})}info(){return{hostUrl:this.hostUrl,config:this.config,outside:this.outside,workspaceId:this.workspaceId}}};export{V as HailerApi,n as HailerError};
|
|
3
3
|
//# sourceMappingURL=app-sdk.js.map
|
package/lib/app-sdk.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/@wishcore/wish-rpc/src/rpc-client.ts", "../node_modules/@wishcore/wish-rpc/src/rpc-server.ts", "../node_modules/@wishcore/wish-rpc/src/index.ts", "../src/hailer-api.ts", "../src/types.ts", "../src/modules/user.ts", "../src/modules/activity/kanban.ts", "../src/modules/activity.ts", "../src/modules/workspace.ts", "../src/modules/ui/activity.ts", "../src/modules/ui/snackbar.ts", "../src/modules/ui/files.ts", "../src/modules/ui.ts", "../src/constants.ts", "../src/modules/public/app.ts", "../src/modules/public/form.ts", "../src/modules/public/insight.ts", "../src/modules/public/product.ts", "../src/modules/public.ts", "../src/modules/workflow.ts", "../src/modules/app.ts", "../src/modules/insight.ts", "../src/modules/permission.ts", "../src/modules/product.ts"],
|
|
4
|
-
"sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { ApiInfo, Config, Settings, Signal } from './types';\nimport { Ui } from './modules/ui';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: Settings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: Signal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private config?: Config;\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [{ appApiVersion: '2' }] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('ui.settings', [], (error: any, data: Settings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n this.client.request('signal', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signal error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): ApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n // email: string;\n // lastSeen: number;\n // status?: string;\n // managedUser?: boolean;\n // removed?: number;\n // defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\n\nexport interface ActivityFieldRange {\n start: number;\n end: number;\n }\n\n export interface ActivityFieldLink {\n _id: string;\n name: string;\n }\n \nexport interface ActivityFieldError {\n error?: string\n}\n\nexport type ActivityFieldValue = boolean | number | string | (ActivityFieldCountry & ActivityFieldError & ActivityFieldRange & ActivityFieldLink);\n\nexport type ActivityFieldUpdateValue = ActivityFieldValue | null;\n/*\nexport interface UserMap {\n [userId: string]: User;\n}\n\n*/\n\nexport interface ActivityFieldCountry {\n /** ISO 3166-1 alpha-2 (cca2) */\n code: string;\n}\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n workspaceId: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: {\n [fieldId: string]: ActivityFieldValue\n };\n // fields?: { [fieldId: string]: string | number };\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface Config {\n [fieldName: string]: string;\n}\n\nexport type WorkflowFieldType = (\n 'activitylink' |\n 'country' |\n 'date' |\n 'daterange' |\n 'datetime' |\n 'numeric' |\n 'numericunit' |\n 'teams' |\n 'text' |\n 'textarea' |\n 'textunit' |\n 'textpredefinedoptions' |\n 'time' |\n 'timerange' |\n 'datetimerange' |\n 'users' |\n 'linkedfrom' |\n 'subheader'\n);\n\nexport interface WorkflowField {\n _id: string;\n type: WorkflowFieldType;\n label: string;\n required: boolean;\n unit: string;\n placeholder: string;\n description: string;\n data: string[];\n functionEnabled: boolean;\n editable: boolean;\n}\n\nexport interface Workflow {\n _id: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n workspaceId: string;\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n primaryDateField?: string;\n primaryNumericField?: string\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n/**\n * ```ts\n * { [templateId: string]: string }\n * ```\n */\nexport interface IdsMap {\n [templateId: string]: string;\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport type WorkflowPermission = 'admin' | 'any' | 'ownteam' | 'own' | 'guest' | 'none';\nexport type WorkflowPhasePermission = 'edit' | 'view' | 'none';\n\nexport interface PermissionPath {\n type: 'network' | 'user' | 'team' | 'group';\n id: string;\n permission: WorkflowPermission | WorkflowPhasePermission;\n};\n\nexport interface WorkflowPermissionMap {\n [workflowId: string]: {\n // hasAccess: boolean;\n isAdmin: boolean;\n permission: WorkflowPermission;\n permissions: PermissionPath;\n phases: {\n [phaseId: string]: {\n // name: string;\n // hasAccess: boolean;\n permission: WorkflowPhasePermission,\n permissions: PermissionPath[];\n restricted: boolean;\n }\n };\n teams: string[];\n\n }\n};\n\nexport interface WorkspaceRolesPermission {\n isAdmin: boolean;\n isOwner: boolean;\n isGuest: boolean;\n isInviter: boolean;\n isUser: boolean;\n // custom: roleSchema,\n};\n\nexport interface PermissionMap {\n [userId: string]: {\n workflow: WorkflowPermissionMap,\n workspace: WorkspaceRolesPermission,\n // calendar: calendarPermissionMapSchema,\n // insight: insightPermissionMapSchema,\n // app: appPermissionMapSchema,\n // teams: Joi.array().items(validTeamId),\n // permits: Joi.array().items(Joi.string()),\n },\n};\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n /** To be used with SQLite if we want to.... */\n query?: string;\n sources: InsightWorkflowSource[];\n public: boolean;\n \n // members: Member[];\n // updated: number;\n /** User id of creator */\n // uid: string;\n // workspaceId: string;\n /** sandboxed javascript with access to all activities in given workflows */\n // function?: string;\n\n \n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean,\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\n\n\n/** Simplistic syntax for add/remove/replace */\nexport interface IdSetUpdate {\n /** Clear all existing */\n '*'?: null,\n /** Add: true, Remove: null */\n [id: string]: true | null | undefined\n}\nexport interface ActivityLocation {\n data: {\n lat: number;\n lng: number;\n }[],\n label?: string;\n type: 'area' | 'point' | 'polyline';\n};\nexport interface ActivityUpdateOptions {\n fields?: ActivityFieldUpdateValue,\n teamId?: string,\n location?: ActivityLocation\n phaseId?: string,\n files?: IdSetUpdate,\n followers?: IdSetUpdate,\n};\n\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface Settings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface ApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: Config;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport interface ApiError {\n code: number,\n msg: string, \n debug: object\n}\n\nclass CustomError extends Error {\n public msg: string;\n public code: number;\n \n constructor(message: string, code: number) {\n super(message);\n this.name = this.constructor.name;\n this.msg = message;\n this.code = code;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\nexport class HailerError extends CustomError {\n public debug: object\n public details?: any\n\n constructor(error: {code: number, msg: string, details?: any, debug: any}) {\n super(error.msg, error.code)\n\n this.details = error.details;\n this.debug = error.debug;\n }\n\n toString() {\n console.log('Going to log an error... ;-D');\n return `${super.toString()} \\nField: ${this.details}, ${this.debug}`;\n }\n}\n\nexport interface Signal {\n name: string;\n data: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n targetId: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n /** Available or not in app store */\n public?: boolean;\n workspaceId?: string;\n uid: string;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'document-template',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: Version[];\n cid?: string;\n}\n\nexport interface Version {\n version: string;\n description: string;\n packageHash: string;\n created: number;\n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n return await this.client.requestAsync('user.get', [userId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n return await this.client.requestAsync('user.current', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<User[]> {\n try {\n return await this.client.requestAsync('user.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError, ActivityFieldUpdateValue, ActivityUpdateOptions, ActivityFieldValue } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.list', [processId, phaseId, options]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(workflowId: string | undefined, activities: { name?: string; fields?: { [id: string]: ActivityFieldValue } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.create', [workflowId, activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: ActivityFieldUpdateValue }, phaseId?: string }[],\n options?: ActivityUpdateOptions\n ): Promise<number> {\n try {\n return await this.client.requestAsync('activity.update', [activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n return await this.client.requestAsync('activity.remove', [activities]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion, Workspace } from '../types';\n\nexport class WorkspaceApi {\n product: {\n /** Publish template in Hailer market */\n publishTemplate: (template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }) => Promise<ProductVersion>\n\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install template from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n publishTemplate: this.publishTemplate.bind(this),\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n private async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('workspace.product.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('workspace.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('workspace.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install template from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('workspace.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('workspace.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n },\n location?: {\n type: 'area' | 'point' | 'polyline',\n data: { lng: number, lat: number }[],\n },\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "export const DEFAULT_ALLOWED_URLS = ['https://app.hailer.com', 'https://next.hailer.com', 'https://testapp.hailer.biz', 'https://app.hailer.biz', 'https://localhost:9443'];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { Config } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<Config> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, IdsMap, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n return await this.client.requestAsync('workflow.list', []);\n } catch (error: any) {\n console.error(error.msg, error);\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param workflowId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(workflowId: string): Promise<Workflow> {\n try {\n return await this.client.requestAsync('workflow.get', [workflowId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async install(workflowSpec: any, option?: { workspaceId?: string }): Promise<IdsMap> {\n try {\n return await this.client.requestAsync('workflow.install', [workflowSpec, option]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Config, HailerError, ProductVersion, Version } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n product: {\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install app from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get installed version */\n getInstalledVersion(id: string): Promise<Version>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getInstalledVersion: this.getInstalledVersion.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n config = {\n update: async (config: Config, option?: { appId?: string }): Promise<void> => {\n try {\n return await this.client.requestAsync('app.config.update', [config, ...option ? [option] : []]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('app.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('app.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install app from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('app.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get installed version from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getInstalledVersion(id: string): Promise<Version> {\n try {\n const result = await this.client.requestAsync('app.product.getInstalledVersion', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('app.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n try {\n /*data = [{ insightId, { headers, rows, time } }] */\n return await this.client.requestAsync('insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n /* @private */ async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, PermissionMap } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<PermissionMap> => {\n try {\n return await this.client.requestAsync('permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n try {\n const res = await this.client.requestAsync('product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param versionId link to version\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n versionId: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n"],
|
|
5
|
-
"mappings": "0nCAMA,IAAaA,EAAb,KAAmB,CAKf,YAAoBC,EAAuCC,EAAsB,CAA7D,KAAA,MAAAD,EAJZ,KAAA,SAAuB,CAAA,EACvB,KAAA,GAAK,EACL,KAAA,IAAM,MAGPC,GAAQA,EAAK,MACZ,KAAK,IAAMA,EAAK,IAExB,CAEA,SAAO,CACH,KAAK,SAAW,KAChB,KAAK,MAAQ,IACjB,CAEA,gBAAgBC,EAAG,CAEf,IAAMC,EAAM,CAAC,EAAED,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAEnCE,EAAKF,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAAOA,EAAI,IAE1CG,EAAU,KAAK,SAASD,CAAE,EAC5BE,EAEJ,GAAGD,GAAW,OAAOA,EAAQ,IAAO,WAAY,CAC5C,IAAIE,EACDL,EAAI,IAEHG,EAAQ,GAAG,KAAKA,EAAQ,QAAS,KAAM,KAAM,EAAI,EAE9CA,EAAQ,SACP,QAAQ,IAAI,qDAAqD,GAGjEE,EAAML,EAAI,IAAMA,EAAI,KAAO,KAC3BI,EAASD,EAAQ,GAAG,KAAKA,EAAQ,QAASE,EAAKL,EAAI,KAAMC,CAAG,GAKxE,OAAGA,GAEC,OAAO,KAAK,S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,gBAAiBA,EAAOI,CAAI,EACxC,QAEJL,GAAAjB,EAAA,KAAK,SAAQ,SAAb,MAAAiB,EAAA,KAAAjB,EAAsBsB,EAC1B,CAAC,EAGD,KAAK,OAAO,QAAQ,SAAU,CAAC,EAAG,CAACJ,EAAYI,EAAWE,IAAiB,CA1K/F,IAAAxB,EAAAiB,EA2KwB,GAAIC,EAAO,CACP,QAAQ,IAAI,gBAAiBA,EAAOI,CAAI,EACxC,OAGAA,KACAL,GAAAjB,EAAA,KAAK,SAAQ,UAAb,MAAAiB,EAAA,KAAAjB,EAAuBsB,GAE/B,CAAC,EAED,KAAK,QAAU,IAEfL,GAAAjB,EAAA,KAAK,SAAQ,YAAb,MAAAiB,EAAA,KAAAjB,GACA,OAIJ,GAAI,CAAC,KAAK,MACN,OAGJ,KAAK,OAAO,gBAAgBG,CAAG,CACnC,OAASe,EAAP,CACE,QAAQ,IAAI,8BAA8B,CAC9C,CACJ,EAAC,CACL,CAEA,MAAgB,CACZ,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,QAAS,KAAK,QACd,YAAa,KAAK,WACtB,CACJ,CACJ",
|
|
6
|
-
"names": ["Client", "write", "opts", "msg", "end", "id", "request", "retval", "err", "op", "args", "resolve", "reject", "data", "cb", "exports", "debug", "Server", "methods", "i", "j", "o", "path", "prefix", "ip", "e", "args", "context", "cb", "result", "copy", "s", "filter", "d", "clientId", "msg", "respond", "id", "err", "data", "op", "client", "send", "ctx", "reqCtx", "exports", "__exportStar", "exports", "import_wish_rpc", "CustomError", "message", "code", "
|
|
4
|
+
"sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { ApiInfo, Config, Settings, Signal } from './types';\nimport { Ui } from './modules/ui';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: Settings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: Signal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private config?: Config;\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [{ appApiVersion: '2' }] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('ui.settings', [], (error: any, data: Settings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n this.client.request('signal', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signal error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): ApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n // email: string;\n // lastSeen: number;\n // status?: string;\n // managedUser?: boolean;\n // removed?: number;\n // defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\n\nexport interface ActivityFieldRange {\n start: number;\n end: number;\n }\n\n export interface ActivityFieldLink {\n _id: string;\n name: string;\n }\n \nexport interface ActivityFieldError {\n error?: string\n}\n\nexport type ActivityFieldValue = boolean | number | string | (ActivityFieldCountry & ActivityFieldError & ActivityFieldRange & ActivityFieldLink);\n\nexport type ActivityFieldUpdateValue = ActivityFieldValue | null;\n/*\nexport interface UserMap {\n [userId: string]: User;\n}\n\n*/\n\nexport interface ActivityFieldCountry {\n /** ISO 3166-1 alpha-2 (cca2) */\n code: string;\n}\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n workspaceId: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: {\n [fieldId: string]: ActivityFieldValue\n };\n // fields?: { [fieldId: string]: string | number };\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface Config {\n [fieldName: string]: string;\n}\n\nexport type WorkflowFieldType = (\n 'activitylink' |\n 'country' |\n 'date' |\n 'daterange' |\n 'datetime' |\n 'numeric' |\n 'numericunit' |\n 'teams' |\n 'text' |\n 'textarea' |\n 'textunit' |\n 'textpredefinedoptions' |\n 'time' |\n 'timerange' |\n 'datetimerange' |\n 'users' |\n 'linkedfrom' |\n 'subheader'\n);\n\nexport interface WorkflowField {\n _id: string;\n type: WorkflowFieldType;\n label: string;\n required: boolean;\n unit: string;\n placeholder: string;\n description: string;\n data: string[];\n functionEnabled: boolean;\n editable: boolean;\n}\n\nexport interface Workflow {\n _id: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n workspaceId: string;\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n primaryDateField?: string;\n primaryNumericField?: string\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n/**\n * ```ts\n * { [templateId: string]: string }\n * ```\n */\nexport interface IdsMap {\n [templateId: string]: string;\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport type WorkflowPermission = 'admin' | 'any' | 'ownteam' | 'own' | 'guest' | 'none';\nexport type WorkflowPhasePermission = 'edit' | 'view' | 'none';\n\nexport interface PermissionPath {\n type: 'network' | 'user' | 'team' | 'group';\n id: string;\n permission: WorkflowPermission | WorkflowPhasePermission;\n};\n\nexport interface WorkflowPermissionMap {\n [workflowId: string]: {\n // hasAccess: boolean;\n isAdmin: boolean;\n permission: WorkflowPermission;\n permissions: PermissionPath;\n phases: {\n [phaseId: string]: {\n // name: string;\n // hasAccess: boolean;\n permission: WorkflowPhasePermission,\n permissions: PermissionPath[];\n restricted: boolean;\n }\n };\n teams: string[];\n\n }\n};\n\nexport interface WorkspaceRolesPermission {\n isAdmin: boolean;\n isOwner: boolean;\n isGuest: boolean;\n isInviter: boolean;\n isUser: boolean;\n // custom: roleSchema,\n};\n\nexport interface PermissionMap {\n [userId: string]: {\n workflow: WorkflowPermissionMap,\n workspace: WorkspaceRolesPermission,\n // calendar: calendarPermissionMapSchema,\n // insight: insightPermissionMapSchema,\n // app: appPermissionMapSchema,\n // teams: Joi.array().items(validTeamId),\n // permits: Joi.array().items(Joi.string()),\n },\n};\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n /** To be used with SQLite if we want to.... */\n query?: string;\n sources: InsightWorkflowSource[];\n public: boolean;\n \n // members: Member[];\n // updated: number;\n /** User id of creator */\n // uid: string;\n // workspaceId: string;\n /** sandboxed javascript with access to all activities in given workflows */\n // function?: string;\n\n \n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean,\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\n\n\n/** Simplistic syntax for add/remove/replace */\nexport interface IdSetUpdate {\n /** Clear all existing */\n '*'?: null,\n /** Add: true, Remove: null */\n [id: string]: true | null | undefined\n}\nexport interface ActivityLocation {\n data: {\n lat: number;\n lng: number;\n }[],\n label?: string;\n type: 'area' | 'point' | 'polyline';\n};\nexport interface ActivityUpdateOptions {\n fields?: ActivityFieldUpdateValue,\n teamId?: string,\n location?: ActivityLocation\n phaseId?: string,\n files?: IdSetUpdate,\n followers?: IdSetUpdate,\n};\n\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface Settings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface ApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: Config;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport interface ApiError {\n code: number,\n msg: string, \n debug: object\n}\n\nclass CustomError extends Error {\n public msg: string;\n public code: number;\n \n constructor(message: string, code: number) {\n super(message);\n this.name = this.constructor.name;\n this.msg = message;\n this.code = code;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\nexport class HailerError extends CustomError {\n public debug: object\n public details?: any\n\n constructor(error: {code: number, msg: string, details?: any, debug: any}) {\n super(error.msg, error.code)\n\n this.details = error.details;\n this.debug = error.debug;\n }\n\n toString() {\n console.log('Going to log an error... ;-D');\n return `${super.toString()} \\nField: ${this.details}, ${this.debug}`;\n }\n}\n\nexport interface Signal {\n name: string;\n data: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n targetId: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n /** Available or not in app store */\n public?: boolean;\n workspaceId?: string;\n uid: string;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'document-template',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: Version[];\n cid?: string;\n}\n\nexport interface Version {\n version: string;\n description: string;\n packageHash: string;\n created: number;\n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n return await this.client.requestAsync('user.get', [userId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n return await this.client.requestAsync('user.current', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<User[]> {\n try {\n return await this.client.requestAsync('user.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError, ActivityFieldUpdateValue, ActivityUpdateOptions, ActivityFieldValue } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.list', [processId, phaseId, options]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(workflowId: string | undefined, activities: { name?: string; fields?: { [id: string]: ActivityFieldValue } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n return await this.client.requestAsync('activity.create', [workflowId, activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: ActivityFieldUpdateValue }, phaseId?: string }[],\n options?: ActivityUpdateOptions\n ): Promise<number> {\n try {\n return await this.client.requestAsync('activity.update', [activities, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n return await this.client.requestAsync('activity.remove', [activities]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion, Workspace } from '../types';\n\nexport class WorkspaceApi {\n product: {\n /** Publish template in Hailer market */\n publishTemplate: (template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }) => Promise<ProductVersion>\n\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install template from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n publishTemplate: this.publishTemplate.bind(this),\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n private async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('workspace.product.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('workspace.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('workspace.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install template from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('workspace.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('workspace.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n },\n location?: {\n type: 'area' | 'point' | 'polyline',\n data: { lng: number, lat: number }[],\n },\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "export const DEFAULT_ALLOWED_URLS = [\n 'https://app.hailer.com',\n 'https://next.hailer.com',\n 'https://testapp.hailer.biz',\n 'https://app.hailer.biz',\n 'https://app.hailer.local.gd',\n 'https://app.k8s.hailer.biz',\n 'https://localhost:9443'\n];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://app.hailer.local.gd': 'https://api.hailer.local.gd',\n 'https://app.k8s.hailer.biz': 'https://api.k8s.hailer.biz',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { Config } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<Config> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, IdsMap, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n return await this.client.requestAsync('workflow.list', []);\n } catch (error: any) {\n console.error(error.msg, error);\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param workflowId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(workflowId: string): Promise<Workflow> {\n try {\n return await this.client.requestAsync('workflow.get', [workflowId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async install(workflowSpec: any, option?: { workspaceId?: string }): Promise<IdsMap> {\n try {\n return await this.client.requestAsync('workflow.install', [workflowSpec, option]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Config, HailerError, ProductVersion, Version } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n product: {\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install app from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get installed version */\n getInstalledVersion(id: string): Promise<Version>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getInstalledVersion: this.getInstalledVersion.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n config = {\n update: async (config: Config, option?: { appId?: string }): Promise<void> => {\n try {\n return await this.client.requestAsync('app.config.update', [config, ...option ? [option] : []]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('app.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('app.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install app from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('app.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get installed version from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getInstalledVersion(id: string): Promise<Version> {\n try {\n const result = await this.client.requestAsync('app.product.getInstalledVersion', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('app.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n try {\n /*data = [{ insightId, { headers, rows, time } }] */\n return await this.client.requestAsync('insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n /* @private */ async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, PermissionMap } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<PermissionMap> => {\n try {\n return await this.client.requestAsync('permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n try {\n const res = await this.client.requestAsync('product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param versionId link to version\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n versionId: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n"],
|
|
5
|
+
"mappings": "26BAMA,IAAaA,EAAb,KAAmB,CAKf,YAAoBC,EAAuCC,EAAsB,CAA7D,KAAA,MAAAD,EAJZ,KAAA,SAAuB,CAAA,EACvB,KAAA,GAAK,EACL,KAAA,IAAM,MAGPC,GAAQA,EAAK,MACZ,KAAK,IAAMA,EAAK,IAExB,CAEA,SAAO,CACH,KAAK,SAAW,KAChB,KAAK,MAAQ,IACjB,CAEA,gBAAgBC,EAAG,CAEf,IAAMC,EAAM,CAAC,EAAED,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAEnCE,EAAKF,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAAOA,EAAI,IAE1CG,EAAU,KAAK,SAASD,CAAE,EAC5BE,EAEJ,GAAGD,GAAW,OAAOA,EAAQ,IAAO,WAAY,CAC5C,IAAIE,EACDL,EAAI,IAEHG,EAAQ,GAAG,KAAKA,EAAQ,QAAS,KAAM,KAAM,EAAI,EAE9CA,EAAQ,SACP,Q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,CACvB,GAAI,KAAK,MAAO,CACZ,QAAQ,MAAM,qDAAqD,EACnE,MACJ,CAEA,aAAa,KAAK,KAAK,EAEvB,KAAK,MAAQA,EAAI,KAAK,MACtB,KAAK,YAAcA,EAAI,KAAK,YAG5B,KAAK,QAAUgB,EAAM,OAGhB,KAAK,QAAQ,mBACd,KAAK,QAAQ,iBAAmBE,EAAiB,KAAK,OAAO,GAAKN,GAItE,KAAK,OAAO,QAAQ,cAAe,CAAC,EAAG,CAACE,EAAYG,EAAgBE,IAAiB,CACjF,GAAIL,EAAO,CACP,QAAQ,IAAI,qBAAsBA,EAAOG,CAAI,EAC7C,MACJ,CAEA,KAAK,QAAQ,WAAWA,CAAI,CAChC,CAAC,EAED,KAAK,OAAO,QAAQ,SAAU,CAAC,EAAG,CAACH,EAAYG,EAAWE,IAAiB,CACvE,GAAIL,EAAO,CACP,QAAQ,IAAI,gBAAiBA,EAAOG,CAAI,EACxC,MACJ,CACA,KAAK,QAAQ,SAASA,CAAI,CAC9B,CAAC,EAGD,KAAK,OAAO,QAAQ,SAAU,CAAC,EAAG,CAACH,EAAYG,EAAWE,IAAiB,CACvE,GAAIL,EAAO,CACP,QAAQ,IAAI,gBAAiBA,EAAOG,CAAI,EACxC,MACJ,CAEIA,GACA,KAAK,QAAQ,UAAUA,CAAI,CAEnC,CAAC,EAED,KAAK,QAAU,GAEf,KAAK,QAAQ,YAAY,EACzB,MACJ,CAGA,GAAI,CAAC,KAAK,MACN,OAGJ,KAAK,OAAO,gBAAgBjB,CAAG,CACnC,MAAgB,CACZ,QAAQ,IAAI,8BAA8B,CAC9C,CACJ,CAAC,CACL,CAEA,MAAgB,CACZ,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,QAAS,KAAK,QACd,YAAa,KAAK,WACtB,CACJ,CACJ",
|
|
6
|
+
"names": ["Client", "write", "opts", "msg", "end", "id", "request", "retval", "err", "op", "args", "resolve", "reject", "data", "cb", "exports", "debug", "Server", "methods", "i", "j", "o", "path", "prefix", "ip", "e", "args", "context", "cb", "result", "copy", "s", "filter", "d", "clientId", "msg", "respond", "id", "err", "data", "op", "client", "send", "ctx", "reqCtx", "exports", "__exportStar", "exports", "import_wish_rpc", "CustomError", "message", "code", "HailerError", "error", "UserApi", "client", "userId", "error", "HailerError", "Kanban", "client", "processId", "options", "error", "HailerError", "activityId", "priority", "ActivityApi", "client", "Kanban", "processId", "phaseId", "options", "error", "HailerError", "activityId", "workflowId", "activities", "WorkspaceApi", "client", "error", "HailerError", "template", "id", "Activity", "client", "activityId", "options", "processId", "activityIds", "Snackbar", "client", "text", "buttonLabel", "duration", "Files", "client", "file", "filename", "options", "resolve", "reject", "reader", "Ui", "client", "Activity", "Snackbar", "workspaceId", "insightId", "Files", "DEFAULT_ALLOWED_URLS", "DEFAULT_BACKEND_URL", "publicBackendMap", "App", "options", "manifestFile", "location", "manifestUrl", "manifestContent", "appId", "Form", "options", "formsKey", "res", "HailerError", "formsData", "InsightPublicApi", "options", "insightKey", "res", "HailerError", "input", "data", "row", "object", "header", "headerIndex", "ProductPublicApi", "options", "filter", "res", "HailerError", "id", "HailerPublicApi", "options", "InsightPublicApi", "Form", "App", "ProductPublicApi", "WorkflowApi", "client", "error", "HailerError", "workflowId", "workflowSpec", "option", "AppApi", "client", "config", "option", "error", "HailerError", "id", "InsightApi", "client", "insightId", "options", "error", "HailerError", "update", "PermissionApi", "client", "error", "HailerError", "ProductApi", "client", "filter", "options", "error", "HailerError", "id", "product", "isPublic", "HailerApi", "options", "allowedUrls", "DEFAULT_ALLOWED_URLS", "msg", "UserApi", "AppApi", "ActivityApi", "InsightApi", "WorkspaceApi", "WorkflowApi", "PermissionApi", "HailerPublicApi", "Ui", "ProductApi", "registerMessage", "DEFAULT_BACKEND_URL", "config", "error", "url", "event", "data", "publicBackendMap", "end"]
|
|
7
7
|
}
|
package/lib/tools/publish.cjs
CHANGED
|
@@ -1,201 +1,233 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
24
15
|
};
|
|
25
|
-
var
|
|
26
|
-
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// tools/publish.ts
|
|
26
|
+
var import_cli = require("@hailer/cli");
|
|
27
|
+
var request = __toESM(require("request"));
|
|
28
|
+
var import_fs = require("fs");
|
|
29
|
+
|
|
30
|
+
// tools/minimal-password-prompt.ts
|
|
31
|
+
var stdin = process.stdin;
|
|
32
|
+
var stdout = process.stdout;
|
|
33
|
+
var captureStdin = (onData) => {
|
|
34
|
+
stdin.setEncoding("utf-8");
|
|
35
|
+
stdin.setRawMode(true);
|
|
36
|
+
stdin.on("data", onData);
|
|
37
|
+
stdin.resume();
|
|
27
38
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
var releaseStdin = (onData) => {
|
|
40
|
+
stdin.pause();
|
|
41
|
+
stdin.removeListener("data", onData);
|
|
42
|
+
stdin.setRawMode(false);
|
|
43
|
+
stdout.write("\n");
|
|
44
|
+
};
|
|
45
|
+
var prompt = (question, ctrlcExits = true) => new Promise((resolve, reject) => {
|
|
46
|
+
let input = "";
|
|
47
|
+
const onData = (data) => {
|
|
48
|
+
switch (data) {
|
|
49
|
+
case "\n":
|
|
50
|
+
case "\r":
|
|
51
|
+
case "":
|
|
52
|
+
releaseStdin(onData);
|
|
53
|
+
resolve(input);
|
|
54
|
+
break;
|
|
55
|
+
case "":
|
|
56
|
+
releaseStdin(onData);
|
|
57
|
+
if (ctrlcExits) {
|
|
58
|
+
process.exit();
|
|
59
|
+
} else {
|
|
60
|
+
reject(new Error("Ctrl+C"));
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "\b":
|
|
64
|
+
case "\x7F":
|
|
65
|
+
input = input.slice(0, -1);
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
input += data;
|
|
69
|
+
}
|
|
70
|
+
;
|
|
71
|
+
};
|
|
72
|
+
captureStdin(onData);
|
|
73
|
+
stdout.write(question);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// tools/publish.ts
|
|
77
|
+
var import_util = require("util");
|
|
78
|
+
var import_readline = require("readline");
|
|
35
79
|
if (!process.env.EMAIL && !process.env.LOCAL) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
console.log("Please set environment variable EMAIL to Hailer user name.");
|
|
81
|
+
console.log("");
|
|
82
|
+
console.log("Usage:");
|
|
83
|
+
console.log(" EMAIL=user.name@mail.com npm run publish-production");
|
|
84
|
+
process.exit(10);
|
|
41
85
|
}
|
|
42
86
|
(async () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
87
|
+
let email = process.env.EMAIL;
|
|
88
|
+
let password = process.env.LOCAL || await prompt("enter password for " + email + ": ");
|
|
89
|
+
const market = process.env.MARKET === "true";
|
|
90
|
+
const appPackageFile = process.argv[2];
|
|
91
|
+
const mode = process.argv[3];
|
|
92
|
+
let host = process.env.HOST || "https://localhost:9443";
|
|
93
|
+
switch (mode) {
|
|
94
|
+
case "--development":
|
|
95
|
+
host = process.env.HOST || "https://testapi.hailer.biz";
|
|
96
|
+
break;
|
|
97
|
+
case "--staging":
|
|
98
|
+
host = process.env.HOST || "https://api.hailer.biz";
|
|
99
|
+
break;
|
|
100
|
+
case "--production":
|
|
101
|
+
host = process.env.HOST || "https://api.hailer.com";
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (process.env.LOCAL || mode === "--local") {
|
|
105
|
+
console.log("Overriding credentials with local settings!");
|
|
106
|
+
email = "el@hailero.es";
|
|
107
|
+
password = "el@hailero.es";
|
|
108
|
+
host = process.env.HOST || "https://api.hailer.local.gd";
|
|
109
|
+
}
|
|
110
|
+
const cli = await import_cli.Client.create({ host, username: email, password }).catch(
|
|
111
|
+
(error) => {
|
|
112
|
+
if (error.msg === "Invalid Login Data") {
|
|
113
|
+
console.log("Invalid username or password when logging into Hailer.");
|
|
114
|
+
} else {
|
|
115
|
+
console.log("Hailer Cli Error:", error);
|
|
116
|
+
}
|
|
117
|
+
process.exit(8);
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
if (!appPackageFile?.endsWith(".tgz")) {
|
|
121
|
+
console.log("Failed getting .tgz file, found:", appPackageFile);
|
|
122
|
+
process.exit(7);
|
|
123
|
+
}
|
|
124
|
+
const manifest = JSON.parse((0, import_fs.readFileSync)("./dist/manifest.json").toString());
|
|
125
|
+
const content = (0, import_fs.readFileSync)(appPackageFile);
|
|
126
|
+
const info = await cli.request("v2.core.init", [["network", "networks", "apps"]]);
|
|
127
|
+
if (market) {
|
|
128
|
+
if (!manifest.version) {
|
|
129
|
+
manifest.version = "";
|
|
130
|
+
manifest.versionDescription = "";
|
|
131
|
+
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
132
|
+
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
133
|
+
console.log("");
|
|
134
|
+
console.log("Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.");
|
|
135
|
+
console.log("");
|
|
136
|
+
process.exit(10);
|
|
61
137
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
138
|
+
}
|
|
139
|
+
const getAppById = (manifestAppId) => {
|
|
140
|
+
for (const appMap of Object.values(info.apps)) {
|
|
141
|
+
for (const [appId, app2] of Object.entries(appMap)) {
|
|
142
|
+
if (appId === manifestAppId) {
|
|
143
|
+
return app2;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
67
146
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
147
|
+
return null;
|
|
148
|
+
};
|
|
149
|
+
const app = getAppById(manifest.appId);
|
|
150
|
+
if (!app) {
|
|
151
|
+
console.log("The app was not found using this user:", email);
|
|
152
|
+
process.exit(2);
|
|
153
|
+
}
|
|
154
|
+
const personalApp = !app.cid;
|
|
155
|
+
console.log("Publishing App");
|
|
156
|
+
console.log(" Id:", manifest.appId);
|
|
157
|
+
console.log(" Name:", app.name);
|
|
158
|
+
if (personalApp) {
|
|
159
|
+
console.log(" Workspace: any (personal app)");
|
|
160
|
+
} else {
|
|
161
|
+
console.log(" Workspace:", info.networks[app.cid]?.name, "(" + app.cid + ")");
|
|
162
|
+
}
|
|
163
|
+
console.log(" Environment:", host);
|
|
164
|
+
console.log();
|
|
165
|
+
if (market) {
|
|
166
|
+
console.log(" Note: Also publishing app to Hailer market");
|
|
167
|
+
}
|
|
168
|
+
const promptOverwriteQuestion = async () => {
|
|
169
|
+
if (process.argv.includes("--yes")) {
|
|
170
|
+
return true;
|
|
72
171
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
172
|
+
return new Promise((resolve) => {
|
|
173
|
+
const rl = (0, import_readline.createInterface)(process.stdin, process.stdout);
|
|
174
|
+
rl.setPrompt("Overwrite the app? (Y/n): ");
|
|
175
|
+
rl.prompt();
|
|
176
|
+
rl.on("line", (line) => {
|
|
177
|
+
if (line.trim().toLocaleLowerCase().startsWith("n")) {
|
|
178
|
+
resolve(false);
|
|
179
|
+
} else {
|
|
180
|
+
resolve(true);
|
|
77
181
|
}
|
|
78
|
-
|
|
182
|
+
rl.close();
|
|
183
|
+
});
|
|
79
184
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
185
|
+
};
|
|
186
|
+
const shouldOverwrite = await promptOverwriteQuestion();
|
|
187
|
+
if (!shouldOverwrite) {
|
|
188
|
+
console.log("Aborted publishing app.");
|
|
189
|
+
process.exit(0);
|
|
190
|
+
}
|
|
191
|
+
await new Promise((resolve, reject) => {
|
|
192
|
+
request.post({
|
|
193
|
+
uri: host + "/app/publish",
|
|
194
|
+
headers: { hlrkey: cli.sessionKey },
|
|
195
|
+
formData: {
|
|
196
|
+
file: {
|
|
197
|
+
value: content,
|
|
198
|
+
options: {
|
|
199
|
+
filename: appPackageFile
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
appId: manifest.appId,
|
|
84
203
|
// Market code
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
for (const appMap of Object.values(info.apps)) {
|
|
102
|
-
for (const [appId, app] of Object.entries(appMap)) {
|
|
103
|
-
if (appId === manifestAppId) {
|
|
104
|
-
return app;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return null;
|
|
109
|
-
};
|
|
110
|
-
const app = getAppById(manifest.appId);
|
|
111
|
-
if (!app) {
|
|
112
|
-
console.log('The app was not found using this user:', email);
|
|
113
|
-
process.exit(2);
|
|
114
|
-
}
|
|
115
|
-
const personalApp = !app.cid;
|
|
116
|
-
console.log('Publishing App');
|
|
117
|
-
console.log(' Id:', manifest.appId);
|
|
118
|
-
console.log(' Name:', app.name);
|
|
119
|
-
if (personalApp) {
|
|
120
|
-
console.log(' Workspace: any (personal app)');
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
console.log(' Workspace:', info.networks[app.cid]?.name, '(' + app.cid + ')');
|
|
124
|
-
}
|
|
125
|
-
console.log(' Environment:', host);
|
|
126
|
-
console.log();
|
|
127
|
-
// Market code
|
|
128
|
-
if (market) {
|
|
129
|
-
console.log(' Note: Also publishing app to Hailer market');
|
|
130
|
-
}
|
|
131
|
-
/** Default to publish (yes) */
|
|
132
|
-
const promptOverwriteQuestion = () => {
|
|
133
|
-
return new Promise(resolve => {
|
|
134
|
-
const rl = (0, readline_1.createInterface)(process.stdin, process.stdout);
|
|
135
|
-
rl.setPrompt('Overwrite the app? (Y/n): ');
|
|
136
|
-
rl.prompt();
|
|
137
|
-
rl.on('line', (line) => {
|
|
138
|
-
if (line.trim().toLocaleLowerCase().startsWith('n')) {
|
|
139
|
-
resolve(false);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
resolve(true);
|
|
143
|
-
}
|
|
144
|
-
rl.close();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
const shouldOverwrite = await promptOverwriteQuestion();
|
|
149
|
-
if (!shouldOverwrite) {
|
|
150
|
-
console.log('Aborted publishing app.');
|
|
151
|
-
process.exit(0);
|
|
204
|
+
publishMarket: market.toString()
|
|
205
|
+
}
|
|
206
|
+
}, function(error, resp, body) {
|
|
207
|
+
if (error) {
|
|
208
|
+
console.log("Publish error uploading file:", error);
|
|
209
|
+
process.exit(9);
|
|
210
|
+
}
|
|
211
|
+
let response;
|
|
212
|
+
let infoMarket = "";
|
|
213
|
+
try {
|
|
214
|
+
response = JSON.parse(body);
|
|
215
|
+
if (response.manifest && response.manifest.targetId) {
|
|
216
|
+
infoMarket = "Note! Use targetId in public/manifest.json file when creating the product in market!";
|
|
217
|
+
manifest.targetId = response.manifest.targetId;
|
|
218
|
+
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
219
|
+
(0, import_fs.writeFileSync)("./public/manifest.json", updatedManifestContent, "utf-8");
|
|
152
220
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
filename: appPackageFile,
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
appId: manifest.appId,
|
|
165
|
-
// Market code
|
|
166
|
-
publishMarket: market.toString(),
|
|
167
|
-
}
|
|
168
|
-
}, function (error, resp, body) {
|
|
169
|
-
if (error) {
|
|
170
|
-
console.log('Publish error uploading file:', error);
|
|
171
|
-
process.exit(9);
|
|
172
|
-
}
|
|
173
|
-
let response;
|
|
174
|
-
let infoMarket = '';
|
|
175
|
-
try {
|
|
176
|
-
response = JSON.parse(body);
|
|
177
|
-
// Market code
|
|
178
|
-
if (response.manifest && response.manifest.targetId) {
|
|
179
|
-
infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';
|
|
180
|
-
// Write targetId to manifest.json
|
|
181
|
-
manifest.targetId = response.manifest.targetId;
|
|
182
|
-
// Convert the modified object back to JSON
|
|
183
|
-
const updatedManifestContent = JSON.stringify(manifest, null, 2);
|
|
184
|
-
// Write the updated JSON content back to manifest.json
|
|
185
|
-
(0, fs_1.writeFileSync)('./public/manifest.json', updatedManifestContent, 'utf-8');
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
// ingore
|
|
190
|
-
}
|
|
191
|
-
console.log('App info:', (0, util_1.inspect)(response, { depth: 10, colors: true }));
|
|
192
|
-
console.log();
|
|
193
|
-
console.log(infoMarket);
|
|
194
|
-
console.log();
|
|
195
|
-
console.log('Published successfully!');
|
|
196
|
-
resolve();
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
cli.disconnect();
|
|
221
|
+
} catch (error2) {
|
|
222
|
+
}
|
|
223
|
+
console.log("App info:", (0, import_util.inspect)(response, { depth: 10, colors: true }));
|
|
224
|
+
console.log();
|
|
225
|
+
console.log(infoMarket);
|
|
226
|
+
console.log();
|
|
227
|
+
console.log("Published successfully!");
|
|
228
|
+
resolve();
|
|
200
229
|
});
|
|
230
|
+
});
|
|
231
|
+
cli.disconnect();
|
|
201
232
|
})();
|
|
233
|
+
//# sourceMappingURL=publish.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../tools/publish.ts", "../../tools/minimal-password-prompt.ts"],
|
|
4
|
+
"sourcesContent": ["import { Client } from '@hailer/cli';\nimport * as request from 'request';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { prompt } from './minimal-password-prompt';\nimport { inspect } from 'util';\nimport { createInterface } from 'readline';\n\nif (!process.env.EMAIL && !process.env.LOCAL) {\n console.log('Please set environment variable EMAIL to Hailer user name.');\n console.log('');\n console.log('Usage:');\n console.log(' EMAIL=user.name@mail.com npm run publish-production');\n process.exit(10);\n}\n\n(async () => {\n\n let email = process.env.EMAIL;\n let password = process.env.LOCAL || await prompt('enter password for ' + email + ': ');\n\n // Market code\n const market = process.env.MARKET === 'true';\n\n const appPackageFile = process.argv[2];\n\n /** Alternatives: `--development` | `--staging` | `--production` */\n const mode = process.argv[3];\n\n let host = process.env.HOST || 'https://localhost:9443';\n\n switch (mode) {\n case '--development':\n host = process.env.HOST || 'https://testapi.hailer.biz';\n break;\n case '--staging':\n host = process.env.HOST || 'https://api.hailer.biz';\n break;\n case '--production':\n host = process.env.HOST || 'https://api.hailer.com';\n break;\n }\n\n if (process.env.LOCAL || mode === '--local') {\n console.log('Overriding credentials with local settings!');\n email = 'el@hailero.es';\n password = 'el@hailero.es';\n host = process.env.HOST || 'https://api.hailer.local.gd';\n }\n\n const cli = await Client.create({ host, username: email, password }).catch(\n (error) => {\n if (error.msg === 'Invalid Login Data') {\n console.log('Invalid username or password when logging into Hailer.');\n } else {\n console.log('Hailer Cli Error:', error);\n }\n\n process.exit(8);\n }\n );\n\n if (!appPackageFile?.endsWith('.tgz')) {\n console.log('Failed getting .tgz file, found:', appPackageFile);\n process.exit(7);\n }\n\n const manifest = JSON.parse(readFileSync('./dist/manifest.json').toString());\n const content = readFileSync(appPackageFile);\n const info = await cli.request('v2.core.init', [['network', 'networks', 'apps']]);\n\n // Market code\n if (market) {\n // Check if version exist in manifest.json. If not, add empty version and let user fill it in\n if (!manifest.version) {\n manifest.version = '';\n manifest.versionDescription = '';\n\n // Convert the modified object back to JSON\n const updatedManifestContent = JSON.stringify(manifest, null, 2);\n \n // Write the updated JSON content back to manifest.json\n writeFileSync('./public/manifest.json', updatedManifestContent, 'utf-8');\n\n console.log('');\n console.log('Please set version & versionDescription in file public/manifest.json! You have added MARKET=true in your publish string.');\n console.log('');\n process.exit(10);\n }\n }\n\n const getAppById = (manifestAppId: string): { _id: string, name: string, cid: string } | null => {\n for (const appMap of Object.values(info.apps)) {\n for (const [appId, app] of Object.entries(appMap as any)) {\n if (appId === manifestAppId) {\n return app as any;\n }\n }\n }\n\n return null;\n }\n\n const app = getAppById(manifest.appId);\n\n if (!app) {\n console.log('The app was not found using this user:', email);\n process.exit(2);\n }\n\n const personalApp = !app.cid;\n\n console.log('Publishing App');\n console.log(' Id:', manifest.appId);\n console.log(' Name:', app.name);\n if (personalApp) {\n console.log(' Workspace: any (personal app)');\n } else {\n console.log(' Workspace:', info.networks[app.cid]?.name, '(' + app.cid + ')');\n }\n console.log(' Environment:', host);\n console.log();\n\n // Market code\n if (market) {\n console.log(' Note: Also publishing app to Hailer market');\n }\n\n /** Default to publish (yes) */\n const promptOverwriteQuestion = async () => {\n if (process.argv.includes('--yes')) {\n return true;\n }\n\n return new Promise<boolean>(resolve => {\n const rl = createInterface(process.stdin, process.stdout);\n\n rl.setPrompt('Overwrite the app? (Y/n): ');\n rl.prompt();\n rl.on('line', (line) => {\n if (line.trim().toLocaleLowerCase().startsWith('n')) {\n resolve(false);\n } else {\n resolve(true);\n }\n rl.close();\n });\n });\n }\n\n const shouldOverwrite = await promptOverwriteQuestion();\n\n if (!shouldOverwrite) {\n console.log('Aborted publishing app.');\n process.exit(0);\n }\n\n await new Promise<void>((resolve, reject) => {\n request.post({\n uri: host + '/app/publish',\n headers: { hlrkey: cli.sessionKey },\n formData: {\n file: {\n value: content,\n options: {\n filename: appPackageFile,\n }\n },\n appId: manifest.appId,\n // Market code\n publishMarket: market.toString(),\n }\n }, function (error, resp, body) {\n if (error) {\n console.log('Publish error uploading file:', error);\n process.exit(9);\n }\n\n let response;\n let infoMarket = '';\n\n try {\n response = JSON.parse(body);\n\n // Market code\n if (response.manifest && response.manifest.targetId) {\n infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';\n // Write targetId to manifest.json\n manifest.targetId = response.manifest.targetId;\n\n // Convert the modified object back to JSON\n const updatedManifestContent = JSON.stringify(manifest, null, 2);\n \n // Write the updated JSON content back to manifest.json\n writeFileSync('./public/manifest.json', updatedManifestContent, 'utf-8');\n }\n } catch (error) {\n // ingore\n }\n\n console.log('App info:', inspect(response, { depth: 10, colors: true }));\n console.log();\n console.log(infoMarket);\n console.log();\n console.log('Published successfully!');\n resolve();\n });\n });\n\n cli.disconnect();\n})();\n", "// Re-written to TypeScript to fix typing issue, see: https://www.npmjs.com/package/minimal-password-prompt/v/1.1.0\n\nconst stdin = process.stdin;\nconst stdout = process.stdout;\n\nconst captureStdin = (onData: (data: string) => void) => {\n stdin.setEncoding('utf-8');\n stdin.setRawMode(true);\n stdin.on('data', onData);\n stdin.resume();\n};\n\nconst releaseStdin = (onData: (data: string) => void) => {\n stdin.pause();\n stdin.removeListener('data', onData);\n stdin.setRawMode(false);\n stdout.write('\\n');\n};\n\nexport const prompt = (question: string, ctrlcExits = true): Promise<string> => (\n new Promise((resolve, reject) => {\n let input = '';\n const onData = (data: string) => {\n switch (data) {\n case '\\u000A': // \\n\n case '\\u000D': // \\r\n case '\\u0004': // Ctrl+D\n releaseStdin(onData);\n resolve(input);\n break;\n case '\\u0003': // Ctrl+C\n releaseStdin(onData);\n if (ctrlcExits) { // exit or raise error\n process.exit();\n } else {\n reject(new Error('Ctrl+C'));\n }\n break;\n case '\\u0008': // Backspace\n case '\\u007F': // Delete\n input = input.slice(0, -1);\n break;\n default: // any other\n input += data;\n };\n };\n captureStdin(onData);\n stdout.write(question);\n })\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAuB;AACvB,cAAyB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AyB;AACrC,cAAQ;AAAA,IACZ,CAAC;AAAA,EACL,CAAC;AAED,MAAI,WAAW;AACnB,GAAG;",
|
|
6
|
+
"names": ["app", "error"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hailer/app-sdk",
|
|
3
|
-
"version": "2.0.0-beta-
|
|
3
|
+
"version": "2.0.0-beta-3",
|
|
4
4
|
"description": "SDK for building Hailer Apps",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./lib/**/*"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "
|
|
14
|
+
"build": "esbuild tools/publish.ts --platform=node --packages=external --bundle --format=cjs --sourcemap --outfile=lib/tools/publish.cjs && tsc && esbuild src/index.ts --bundle --format=esm --minify --sourcemap --outfile=lib/app-sdk.js",
|
|
15
15
|
"prepublishOnly": "npm run build",
|
|
16
16
|
"watch": "concurrently --kill-others \"npm run watch-tsc\" \"npm run watch-esbuild\"",
|
|
17
17
|
"watch-tsc": "tsc --watch",
|
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
"docs": "typedoc --entryPointStrategy expand ./src && open-cli ./docs/index.html"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@hailer
|
|
22
|
+
"@hailer/cli": "1.1.8",
|
|
23
23
|
"@wishcore/wish-rpc": "0.6.11",
|
|
24
|
-
"minimal-password-prompt": "1.1.0",
|
|
25
24
|
"request": "2.88.2"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
package/lib/modules/network.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
-
import { Workspace } from '../types';
|
|
3
|
-
export declare class WorkspaceApi {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: Client);
|
|
6
|
-
/**
|
|
7
|
-
* Returns the current network
|
|
8
|
-
*
|
|
9
|
-
* @returns the Hailer Workspace information the user is currently in
|
|
10
|
-
*
|
|
11
|
-
* @throws {HailerError} if request is incorrect
|
|
12
|
-
*/
|
|
13
|
-
current(): Promise<Workspace>;
|
|
14
|
-
}
|
package/lib/modules/process.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
-
import { HailerProcess } from '../types';
|
|
3
|
-
/** @deprecated Use Workflow instead */
|
|
4
|
-
export declare class Process {
|
|
5
|
-
private client;
|
|
6
|
-
constructor(client: Client);
|
|
7
|
-
/**
|
|
8
|
-
* Lists all processes from a workspace
|
|
9
|
-
*
|
|
10
|
-
* @returns all Hailer processes in the workspace the app user is currently in
|
|
11
|
-
*
|
|
12
|
-
* @throws {HailerError} if request is incorrect
|
|
13
|
-
*/
|
|
14
|
-
list(): Promise<{
|
|
15
|
-
[key: string]: HailerProcess;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Gets a single process from a workspace
|
|
19
|
-
*
|
|
20
|
-
* @param processId the id of the process in question
|
|
21
|
-
*
|
|
22
|
-
* @returns the specified Hailer process
|
|
23
|
-
*
|
|
24
|
-
* @throws {HailerError} if request is incorrect
|
|
25
|
-
*/
|
|
26
|
-
get(processId: string): Promise<HailerProcess>;
|
|
27
|
-
/**
|
|
28
|
-
* Gets an id of a field in a process by its name
|
|
29
|
-
*
|
|
30
|
-
* @param processId the id of the process in question
|
|
31
|
-
* @param fieldName name of the field
|
|
32
|
-
*
|
|
33
|
-
* @returns the field id as string
|
|
34
|
-
*
|
|
35
|
-
* @throws {HailerError} if request is incorrect
|
|
36
|
-
*/
|
|
37
|
-
getFieldIdByName(processId: string, fieldName: string): Promise<string>;
|
|
38
|
-
}
|
package/lib/modules/team.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Client } from '@wishcore/wish-rpc';
|
|
2
|
-
import { TeamMap } from '../types';
|
|
3
|
-
export declare class TeamApi {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: Client);
|
|
6
|
-
/**
|
|
7
|
-
* Lists all Hailer teams from a workspace
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @returns list of Hailer teams in the workspace the app user is currently in
|
|
11
|
-
*
|
|
12
|
-
* @throws {HailerError} if request is incorrect
|
|
13
|
-
*/
|
|
14
|
-
list(): Promise<{
|
|
15
|
-
[workspaceId: string]: TeamMap;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
package/lib/tools/publish.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs_1 = require("fs");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const srcFolder = (0, path_1.join)(__dirname, '../src');
|
|
6
|
-
const publicSrcFolder = (0, path_1.join)(__dirname, '../public-src');
|
|
7
|
-
const replacePrivateComments = (fileContent) => {
|
|
8
|
-
// Replaces all occurences of /* @ private */ with private
|
|
9
|
-
return fileContent.replace(/\/\* @private \*\//g, 'private');
|
|
10
|
-
};
|
|
11
|
-
const copyAndReplaceFiles = (src, dest) => {
|
|
12
|
-
(0, fs_1.mkdirSync)(dest, { recursive: true });
|
|
13
|
-
console.log('Created folder: ', dest);
|
|
14
|
-
(0, fs_1.readdirSync)(src).forEach((file) => {
|
|
15
|
-
const srcFile = (0, path_1.join)(src, file);
|
|
16
|
-
const destFile = (0, path_1.join)(dest, file);
|
|
17
|
-
if ((0, fs_1.lstatSync)(srcFile).isDirectory()) {
|
|
18
|
-
copyAndReplaceFiles(srcFile, destFile);
|
|
19
|
-
}
|
|
20
|
-
else if (srcFile.endsWith('.ts')) {
|
|
21
|
-
const updatedContent = replacePrivateComments((0, fs_1.readFileSync)(srcFile, 'utf8'));
|
|
22
|
-
(0, fs_1.writeFileSync)(destFile, updatedContent, 'utf8');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
(0, fs_1.copyFileSync)(srcFile, destFile);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
if ((0, fs_1.existsSync)(publicSrcFolder)) {
|
|
30
|
-
(0, fs_1.rmdirSync)(publicSrcFolder, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
copyAndReplaceFiles(srcFolder, publicSrcFolder);
|
|
33
|
-
console.log('Public source files generated in /public-src/');
|