@openfin/cloud-api 0.0.1-alpha.fbf0042 → 0.0.1-alpha.fc110d0

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/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var We=Object.create;var mn=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Ge=(o,l)=>()=>(l||o((l={exports:{}}).exports,l),l.exports),je=(o,l)=>{for(var a in l)mn(o,a,{get:l[a],enumerable:!0})},Xe=(o,l,a,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of qe(l))!Ke.call(o,p)&&p!==a&&mn(o,p,{get:()=>l[p],enumerable:!(d=Ve(l,p))||d.enumerable});return o};var ze=(o,l,a)=>(a=o!=null?We(He(o)):{},Xe(l||!o||!o.__esModule?mn(a,"default",{value:o,enumerable:!0}):a,o));var Hn=Ge((At,qn)=>{"use strict";(()=>{"use strict";var o={d:(n,e)=>{for(var t in e)o.o(e,t)&&!o.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},l={};o.r(l),o.d(l,{SearchTagBackground:()=>on,create:()=>Un,defaultTopic:()=>Bn,subscribe:()=>Dn});var a={};o.r(a),o.d(a,{B:()=>ue});var d={};o.r(d),o.d(d,{v:()=>Ue});let p="deregistered or does not exist",y=new Error(`provider ${p}`),O=new Error("provider with name already exists"),S=new Error("bad payload"),b=new Error("subscription rejected"),P=new Error(`channel ${p}`),R;function I(){if(R)return R;throw P}function K(){return R}function Sn(n){R=n}var v,x,tn,on;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(v||(v={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}(x||(x={})),function(n){n.UserAction="user-action",n.FocusChange="focus-change",n.Reload="reload"}(tn||(tn={})),function(n){n.Active="active",n.Default="default"}(on||(on={}));let G="0",Rn="1",En="2",bn="3",Pn="4",j="5",X="6",zn=()=>{},rn=new Set;function Jn(n){rn.add(n)}function Qn(n){rn.delete(n)}let sn=new Set;function Yn(n){sn.add(n)}function Zn(n){sn.delete(n)}let q=new Map;async function an(n){q.set(n.id,n);let e=[...rn].map(t=>t());await Promise.all(e)}async function z(n){q.delete(n);let e=[...sn].map(t=>t());await Promise.all(e)}function cn(){return[...q.values()]}function On(){q.clear()}function L(n){return q.get(n)}function An(n,e,t){return{...n,action:t||{...n.actions[0],trigger:tn.UserAction},dispatcherIdentity:e}}function ln(n,e,t="ascending"){let i=n||[];if(!_optionalChain([e, 'optionalAccess', _2 => _2.length]))return i;let r=[],s=new Map;e.forEach(u=>{if(u.key)return s.set(u.key,u);r.push(u)});let c=i.map(u=>{let{key:h}=u;if(h&&s.has(h)){let C=s.get(h);return s.delete(h),C}return u});return c.push(...s.values(),...r),c=t==="ascending"?c.sort((u,h)=>(_nullishCoalesce(_optionalChain([u, 'optionalAccess', _3 => _3.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _4 => _4.score]), () => (1/0)))):c.sort((u,h)=>(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _5 => _5.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([u, 'optionalAccess', _6 => _6.score]), () => (1/0)))),c}function In(n){let e={},t=[],i=[],r=null,s=v.Initial;e.getStatus=()=>s,e.getResultBuffer=()=>t,e.setResultBuffer=u=>{t=u,_optionalChain([t, 'optionalAccess', _7 => _7.length])&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=u=>{i=u,_optionalChain([i, 'optionalAccess', _8 => _8.length])&&e.onChange()},e.setUpdatedContext=u=>{r=u,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=zn;let c={};return e.res=c,c.close=()=>{s!==v.Close&&(s=v.Close,e.onChange())},c.open=()=>{s!==v.Open&&(s=v.Open,e.onChange())},c.respond=u=>{let h=ln(e.getResultBuffer(),u,n);e.setResultBuffer(h)},c.revoke=(...u)=>{let h=new Set(u),C=e.getResultBuffer().filter(({key:f})=>{let g=h.has(f);return g&&h.delete(f),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(f=>h.add(f)),e.setRevokedBuffer([...h]))},c.updateContext=u=>{e.setUpdatedContext(u)},e}function Ln(n,e){let t=new Set,i=!1;return{close:()=>{i=!0;for(let r of t)r()},req:{id:n,...e,context:_optionalChain([e, 'optionalAccess', _9 => _9.context])||{},onClose:r=>{t.add(r),i&&r()},removeListener:r=>{t.delete(r)}}}}function J(){return{name:fin.me.name,uuid:fin.me.uuid}}let Nn=50,ne=1e3,ee=new Map;function un(){return ee}let te=100;function oe(){return async n=>{if(!n||!n.id||!n.providerId){let f=S;return console.error(f),{error:f.message}}let{id:e,providerId:t}=n,i=L(t);if(!i){let f=y;return console.error(f),{error:f.message}}let r=un(),s=r.get(n.id);s||(s=Ln(e,n),r.set(n.id,s));let c=In(),u=()=>{let f=c.getResultBuffer();c.setResultBuffer([]);let g=c.getRevokedBuffer();c.setRevokedBuffer([]);let N=c.getUpdatedContext();c.setUpdatedContext(null);let T=c.getStatus();(async function(D){(await I()).dispatch(G,D)})({id:e,providerId:t,results:f,revoked:g,status:T,context:N})},h=!0,C=!1;c.onChange=()=>{if(h)return h=!1,void u();C||(C=!0,setTimeout(()=>{C=!1,u()},te))};try{let{results:f,context:g}=await i.onUserInput(s.req,c.res),N=c.getStatus();return{id:e,providerId:t,status:N,results:f,context:g}}catch(f){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${t} for search ${e}`,"This is likely a bug in the implementation of the search provider.",f),{id:e,providerId:t,error:_optionalChain([f, 'optionalAccess', _10 => _10.message])}}}}async function Fn(n,e){let t=e||await I(),i=J(),r={...n,identity:i,onResultDispatch:void 0},s=await t.dispatch(En,r);return await an({identity:i,...n}),s}async function ie(n){return await(await I()).dispatch(bn,n),z(n)}async function re(n,e,t,i){let r=An(e,_nullishCoalesce(i, () => (J())),t),s=L(n);if(s){let{onResultDispatch:u}=s;return u?u(r):void 0}let c={providerId:n,result:r};return(await I()).dispatch(j,c)}async function se(n){let e={...n,context:_optionalChain([n, 'optionalAccess', _11 => _11.context])||{}},t={},i=async function*(s,{setState:c}){let u=await I();for(;;){let h=await u.dispatch(Rn,s),C=h.error;if(C)throw new Error(C);let f=h;if(s.id=f.id,c(f.state),f.done)return f.value;yield f.value}}(e,{setState:s=>{t.state=s}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(s){(await I()).dispatch(X,{id:s})})(t.id)},t.next=()=>{if(r){let s=r;return r=void 0,s}return i.next()},t}async function ae(){return(await I()).dispatch(Pn,null)}async function ce(){let n=await I();R=void 0,On(),await n.disconnect()}let le=async n=>{let e=await $n(n);for(let t of cn())await Fn(t,e);return e};async function $n(n){let e=await async function(t){for(let i=0;i<Nn;i++)try{return await fin.InterApplicationBus.Channel.connect(t,{wait:!1})}catch(r){if(i===Nn-1)throw r;await new Promise(s=>setTimeout(s,ne))}}(n);return e.register(G,oe()),e.register(X,t=>{let i=un(),r=i.get(t.id);r&&(r.close(),i.delete(t.id))}),e.register(j,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(S);let r=L(t.providerId);if(!r)return void console.error(y);let{onResultDispatch:s}=r;return s?(t.result.dispatcherIdentity=_nullishCoalesce(t.result.dispatcherIdentity, () => (i)),s(t.result)):void 0}),e.onDisconnection(function(t){return async()=>{if(!K())return;let i=un();for(let{req:r,close:s}of i.values())s(),i.delete(r.id);Sn(le(t))}}(n)),e}async function ue(n){let e=K();e||(e=$n(n),Sn(e));let t=await e;return{getAllProviders:ae.bind(null),register:Fn.bind(null),search:se.bind(null),deregister:ie.bind(null),dispatch:re.bind(null),disconnect:ce.bind(null),channel:t}}let H;function Q(){if(H)return H;throw P}function de(){return H}function pe(n){H=n}function fe(){H=void 0}let dn=new Set;function he(n){dn.add(n)}function we(n){dn.delete(n)}var k;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})(k||(k={}));let pn=typeof window<"u"&&typeof fin<"u",ge=(typeof process>"u"||process.env,typeof window<"u"),ye=ge?window.origin:k.Local,Y=(pn&&fin.me.uuid,pn&&fin.me.name,pn&&fin.me.entityType,k.Local,k.Dev,k.Staging,k.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:ye+n),xn=(Y("http://localhost:4002"),Y("http://localhost:4002"),typeof WORKSPACE_DOCS_PLATFORM_URL<"u"&&Y(WORKSPACE_DOCS_PLATFORM_URL),typeof WORKSPACE_DOCS_CLIENT_URL<"u"&&Y(WORKSPACE_DOCS_CLIENT_URL),"20.3.6");typeof WORKSPACE_BUILD_SHA<"u"&&WORKSPACE_BUILD_SHA;async function kn(){return[...cn()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function me(n){if(L(n.id))throw new Error("provider with name already exists");let e=J();return await an({identity:e,...n}),{workspaceVersion:xn||"",clientAPIVersion:n.clientAPIVersion||""}}async function Ce(n){await z(n)}async function ve(n,e,t,i){let r=L(n);if(!r)throw y;let{onResultDispatch:s}=r;if(s)return s(An(e,_nullishCoalesce(i, () => (J())),t))}async function*Se(n,e){let t=function(g,N){let T=[],D=[],B=[],E=[];for(let m of g){let F=In(m.scoreOrder),$={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};T.push($),D.push(F);let M=(async()=>{try{let{results:W,context:nn}=await m.onUserInput(N,F.res);$.results=ln($.results||[],W,m.scoreOrder),$.context={...$.context,...nn}}catch(W){$.error=W}})();M.finally(()=>{M.done=!0}),E.push(M),B.push(B.length)}return{providerResponses:T,listenerResponses:D,openListenerResponses:B,initialResponsePromises:E}}(n.targets?n.targets.map(g=>L(g)).filter(g=>!!g):[...cn().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:s,initialResponsePromises:c}=t,u=x.Fetching,h=g=>{u=g,e.setState(u)},C,f=!1;n.onClose(()=>{f=!0,C&&C()});do{let g=!1;if(c.length){let E=[];for(let m of c)m.done?g=!0:E.push(m);c=E,c.length||(h(x.Fetched),g=!0)}let N,T=!1,D=()=>{T=!0,N&&N()},B=[];for(let E of s){let m=r[E],F=i[E],$=m.getStatus();($===v.Open||u===x.Fetching&&$===v.Initial)&&(B.push(E),m.onChange=D);let M=m.getResultBuffer();M.length&&(m.setResultBuffer([]),F.results=ln(F.results||[],M),g=!0);let W=m.getRevokedBuffer();if(W.length){m.setRevokedBuffer([]);let Be=new Set(W);F.results=(F.results||[]).filter(({key:Me})=>!Be.has(Me)),g=!0}let nn=m.getUpdatedContext();nn&&(m.setUpdatedContext(null),F.context={...F.context,...nn},g=!0)}if(s=B,g&&(yield i),f)break;T||(s.length||c.length)&&await Promise.race([...c,new Promise(E=>{N=E}),new Promise(E=>{C=E})])}while(s.length||c.length);return h(x.Complete),i}let fn=0;async function Tn(n){fn+=1;let e=Ln(fn.toString(),n),t=Se(e.req,{setState:i=>{t.state=i}});return t.id=fn.toString(),t.close=e.close,t.state=x.Fetching,t}let Z=new Map,Re=1e4;function Ee(){return async n=>{if(!n)return console.error(S),{error:S.message};let e;if(n.id)e=n.id;else{let r=await Tn(n);e=r.id,n.id=r.id,Z.set(e,{generator:r})}let t=Z.get(e);clearTimeout(t.timeout);let i=await t.generator.next();return t.timeout=function(r){return window.setTimeout(()=>{Z.delete(r)},Re)}(e),{...i,id:n.id,state:t.generator.state}}}function be(n,e){return Q().dispatch(n,X,{id:e})}function Pe(){return n=>function(e){let t=Z.get(e);t&&t.generator.close()}(n.id)}async function Oe(n,{id:e,query:t,context:i,targets:r=[]}){let s=Q(),c={id:e,query:t,context:i,targets:r,providerId:n.id},u=await s.dispatch(n.identity,G,c),h=u.error;if(h)throw new Error(h);return u}let hn=new Map;function Ae(n,e){return`${n.name}:${n.uuid}:${e}`}let wn=new Map;function _n(n,e){return`${n}:${e}`}function Ie(n){let e=Ae.bind(null,n.identity),t=be.bind(null,n.identity),i=Oe.bind(null,n);return async(r,s)=>{let c=e(r.id);if(!hn.has(c)){let f=()=>{t(r.id),hn.delete(c)};hn.set(c,f),r.onClose(f)}let u=_n(n.id,r.id),h=()=>{wn.delete(u),s.close()};r.onClose(h),wn.set(u,f=>{_optionalChain([f, 'access', _12 => _12.results, 'optionalAccess', _13 => _13.length])&&s.respond(f.results),_optionalChain([f, 'access', _14 => _14.revoked, 'optionalAccess', _15 => _15.length])&&s.revoke(...f.revoked),f.context&&s.updateContext(f.context),f.status===v.Open&&s.open(),f.status===v.Close&&h()});let C=await i(r);return C.status===v.Open&&s.open(),C.status!==v.Close&&C.status!==v.Initial||h(),C}}function Le(n){return async e=>{let t=Q(),i={providerId:n.id,result:e};return t.dispatch(n.identity,j,i)}}let U=new Map;function gn(n){return`${n.name}-${n.uuid}`}function Ne(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(S);if(L(n.id))throw O;return n.identity=e,await async function(t){let i=gn(t.identity);U.has(i)||U.set(i,[]),U.get(i).push(t.id),await an({...t,onUserInput:Ie(t),onResultDispatch:Le(t)})}(n),{workspaceVersion:xn||"",clientAPIVersion:n.clientAPIVersion||""}}}function Fe(){return(n,e)=>{n?function(t,i){let r=L(t);if(!r)return;if(r.identity.uuid!==i.uuid||r.identity.name!==i.name)throw y;let s=gn(r.identity),c=U.get(s);if(c){let u=c.findIndex(h=>h===t);u!==-1&&(c.splice(u,1),z(t))}}(n,e):console.error(S)}}let yn=new Set;function $e(n){yn.add(n)}function xe(n){yn.delete(n)}function ke(){return async n=>{(function(e){let t=gn(e),i=U.get(t);if(i){for(let r of i)z(r);U.delete(t)}})(n),yn.forEach(e=>e(n))}}async function Te(n){let e=await(t=n,fin.InterApplicationBus.Channel.create(t));var t;return e.onConnection(async i=>{for(let r of dn)if(!await r(i))throw b}),e.onDisconnection(ke()),e.register(X,Pe()),e.register(G,i=>{let r=_n(i.providerId,i.id),s=wn.get(r);s&&s(i)}),e.register(En,Ne()),e.register(bn,Fe()),e.register(Pn,async()=>kn()),e.register(Rn,Ee()),e.register(j,async(i,r)=>{if(!i||!i.providerId||!i.result)return void console.error(S);let s=L(i.providerId);if(!s)throw y;let{onResultDispatch:c}=s;return c?(i.result.dispatcherIdentity=_nullishCoalesce(i.result.dispatcherIdentity, () => (r)),c(i.result)):void 0}),e}async function _e(){let n=Q();fe(),await n.destroy(),On()}async function Ue(n){let e=de();e||(e=await Te(n),pe(e));let t=we.bind(null),i=xe.bind(null),r=Qn.bind(null),s=Zn.bind(null);return{getAllProviders:kn.bind(null),search:Tn.bind(null),register:me.bind(null),deregister:Ce.bind(null),onSubscription:he.bind(null),onDisconnect:$e.bind(null),onRegister:Jn.bind(null),onDeregister:Yn.bind(null),dispatch:ve.bind(null),disconnect:_e.bind(null),removeListener:c=>{t(c),i(c),r(c),s(c)},channel:e}}let{v:Un}=d,{B:Dn}=a,Bn="all",De={create:Un,subscribe:Dn,defaultTopic:Bn},Mn=()=>{window.search=De},Wn=n=>{let e=()=>{Mn(),window.removeEventListener(n,e)};return e};if(typeof window<"u"){Mn();let n="load",e=Wn(n);window.addEventListener(n,e);let t="DOMContentLoaded",i=Wn(t);window.addEventListener(t,i)}qn.exports=l})()});var w="@openfin/cloud-api";async function A(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch (e2){return!1}}function Vn(o){if(o.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(o.name)?o.name.split("/")[0]||"":o.name}var V="@openfin/cloud-api";function Je(){return`${window.fin.me.uuid}-cloud-api-notifications`}var Cn=null;async function gt(){return Cn||(Cn=Qe()),Cn}async function Qe(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Vn(window.fin.me);let o=await Ye();console.log(o),o.register("openfin-cloud-event",a=>{for(let d of _nullishCoalesce(l.get(a.type), () => ([])))typeof a.payload.timestamp=="string"&&(a.payload.timestamp=new Date(a.payload.timestamp)),d(a.payload)});let l=new Map;return{addEventListener:(a,d)=>{let p=l.get(a)||new Set;p.add(d),l.set(a,p)},removeEventListener:(a,d)=>{let p=l.get(a);if(!p){console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,a);return}p.delete(d)===!1&&console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,a)},update:async a=>(await o.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:a}})).payload.response,clear:async a=>(await o.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:a}})).payload.response,createNotification:async a=>(a.id&&console.warn(`\`${V}\`: The \`id\` property is not supported and will be ignored. If you need to use the \`id\` property, you should use the \`id\` property of the returned notification object.`),(await o.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...a,id:void 0}}})).payload.response)}}var en=null;async function Ye(){return en||(en=Ze()),en}async function Ze(){let o=await window.fin.InterApplicationBus.Channel.connect(Je());return o.onDisconnection(l=>{console.warn(`\`${V}\`: Channel Disconnected from`,l,"Reconnecting..."),en=null}),o}var vn;function nt(){return`${window.fin.me.uuid}-client-api`}async function _(){return vn||(vn=window.fin.InterApplicationBus.Channel.connect(nt())),vn}async function Ct(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-settings")}async function vt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-settings")}async function St(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("set-user-settings",o)}async function Rt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-permissions")}async function Et(o,l){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let a=await _();try{await a.dispatch("launch-content",{id:o,options:l})}catch(d){switch(d instanceof Error?d.message:String(d)){case"UnableToLookup":throw new Error(`${w}: \`launchContent\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchContent\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchContent\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchContent\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function bt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let l=await _();try{await l.dispatch("launch-supertab",{id:o})}catch(a){switch(a instanceof Error?a.message:String(a)){case"UnableToLookup":throw new Error(`${w}: \`launchSupertab\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchSupertab\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchSupertab\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchSupertab\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function Pt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let l=await _();try{await l.dispatch("launch-workspace",{id:o})}catch(a){switch(a instanceof Error?a.message:String(a)){case"UnableToLookup":throw new Error(`${w}: \`launchWorkspace\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchWorkspace\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchWorkspace\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchWorkspace\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}var Xn={};je(Xn,{register:()=>jn});var Gn=ze(Hn(),1),et="log-message-",tt="open-url",ot="provider-status-",it="registered-",rt="1.0";function st(o,l){let{data:a,...d}=o;return{...d,data:{customData:a,providerId:l,resultType:"app"}}}function Kn(o){return{...o,data:o.data.customData}}function at(){return`${window.fin.me.identity.uuid}-cloud-api-search`}async function ct(o,l,a,d=!0){await l("info",`Setting status as ${d?"ready":"not ready"}`);try{await o.dispatch(`${ot}${a}`,{isReady:d})}catch(p){let y=["Error setting provider status",p];console.error(...y),l("error",...y)}}async function lt(o,l,a,...d){try{await o.dispatch(`${et}${l}`,{level:a,message:d})}catch(p){console.error("Error logging message",p)}}async function ut(o,l,a,d,p){let{action:y,dispatcherIdentity:O,...S}=p;await a("info","Handling action",{action:y,dispatcherIdentity:O,result:S});let b;try{let R=_optionalChain([Kn, 'call', _16 => _16(p), 'access', _17 => _17.actions, 'optionalAccess', _18 => _18.find, 'call', _19 => _19(({name:K})=>K===y.name)]);if(!R)throw new Error("Original action not found in search result");b=await _asyncOptionalChain([(await d(R,Kn(p))), 'optionalAccess', async _20 => _20.url])}catch(P){throw await a("error","Error handling dispatch",P),P}if(!b){await a("warn","OnActionListener did not return a URL");return}await pt(o,a,l.id,b,O)}async function dt(o,l,a,d){await l("info","Getting search results",{request:d});try{let p=new AbortController;d.onClose(()=>p.abort());let{context:y,query:O}=d,{results:S}=await a({context:y,query:O,signal:p.signal}),b=S.map(P=>st(P,o.id));return await l("info","Returning results",b),{results:b}}catch(p){let y=["Error handling search",p];throw console.error(...y),l("error",...y),p}}async function pt(o,l,a,d,p){await l("info","Opening URL",{url:d,targetIdentity:p});try{await o.dispatch(tt,{url:d,targetIdentity:p,providerId:a})}catch(y){let O=["Error opening URL",y];console.error(...O),l("error",...O)}}async function jn(o){let a=(await window.fin.me.getOptions()).customData,{configData:d,id:p,title:y}=a,{onAction:O,onSearch:S}=o,b=await Gn.subscribe(at()),P=b.channel,R=lt.bind(null,P,p);return await b.register({icon:"",id:p,onResultDispatch:ut.bind(null,P,a,R,O),onUserInput:dt.bind(null,a,R,S),title:y}),await b.channel.dispatch(`${it}${p}`,{version:rt}),R("info","Registered search topic",{id:p,title:y}),{customData:d,isReady:ct.bind(null,P,R,p)}}exports.Search = Xn; exports.getAppSettings = Ct; exports.getAppUserPermissions = Rt; exports.getAppUserSettings = vt; exports.getNotificationsClient = gt; exports.launchContent = Et; exports.launchSupertab = bt; exports.launchWorkspace = Pt; exports.setAppUserSettings = St;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var t="@openfin/cloud-api";async function a(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch (e2){return!1}}function u(n){if(n.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(n.name)?n.name.split("/")[0]||"":n.name}var r="@openfin/cloud-api";function d(){return`${window.fin.me.uuid}-cloud-api-notifications`}var l=null;async function g(){return l||(l=w()),l}async function w(){if(!window.fin)throw new Error(`\`${r}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${r}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);u(window.fin.me);let n=await h();console.log(n),n.register("openfin-cloud-event",e=>{for(let o of _nullishCoalesce(i.get(e.type), () => ([])))typeof e.payload.timestamp=="string"&&(e.payload.timestamp=new Date(e.payload.timestamp)),o(e.payload)});let i=new Map;return{addEventListener:(e,o)=>{let s=i.get(e)||new Set;s.add(o),i.set(e,s)},removeEventListener:(e,o)=>{let s=i.get(e);if(!s){console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,e);return}s.delete(o)===!1&&console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,e)},update:async e=>(await n.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:e}})).payload.response,clear:async e=>(await n.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:e}})).payload.response,createNotification:async e=>(e.id&&console.warn(`\`${r}\`: The \`id\` property is not supported and will be ignored. If you need to use the \`id\` property, you should use the \`id\` property of the returned notification object.`),(await n.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...e,id:void 0}}})).payload.response)}}var p=null;async function h(){return p||(p=m()),p}async function m(){let n=await window.fin.InterApplicationBus.Channel.connect(d());return n.onDisconnection(i=>{console.warn(`\`${r}\`: Channel Disconnected from`,i,"Reconnecting..."),p=null}),n}var f;function y(){return`${window.fin.me.uuid}-client-api`}async function c(){return f||(f=window.fin.InterApplicationBus.Channel.connect(y())),f}async function A(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-settings")}async function v(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-settings")}async function P(n){if(!window.fin)throw new Error(`\`${t}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("set-user-settings",n)}async function $(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-permissions")}async function T(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let i=await c();try{await i.dispatch("launch-content",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchContent\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchContent\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchContent\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchContent\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}exports.getAppSettings = A; exports.getAppUserPermissions = $; exports.getAppUserSettings = v; exports.getNotificationsClient = g; exports.launchContent = T; exports.setAppUserSettings = P;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/openfin-direct/openfin-direct/packages/cloud-api/dist/index.cjs","../node_modules/@openfin/search-api/index.js"],"names":["require_search_api","__commonJSMin","exports","module","e","t","n","o","y","Je","Qe","Ge","oe","ze","r","i"],"mappings":"AAAA,gtCAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,G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C,CAAAA,CAAE,IAAI,KAAA,CAAM,CAAA,SAAA,EAAYD,CAAC,CAAA,CAAA","file":"/home/runner/work/openfin-direct/openfin-direct/packages/cloud-api/dist/index.cjs","sourcesContent":[null,"(()=>{\"use strict\";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})}},t={};e.r(t),e.d(t,{SearchTagBackground:()=>y,create:()=>Je,defaultTopic:()=>Qe,subscribe:()=>Ge});var n={};e.r(n),e.d(n,{B:()=>oe});var o={};e.r(o),e.d(o,{v:()=>ze});const r=\"deregistered or does not exist\",i=new Error(`provider ${r}`),s=new Error(\"provider with name already exists\"),c=new Error(\"bad payload\"),a=new Error(\"subscription rejected\"),u=new Error(`channel ${r}`);let d;function l(){if(d)return d;throw u}function f(){return d}function p(e){d=e}var h,g,w,y;!function(e){e[e.Initial=0]=\"Initial\",e[e.Open=1]=\"Open\",e[e.Close=2]=\"Close\"}(h||(h={})),function(e){e.Fetching=\"fetching\",e.Fetched=\"fetched\",e.Complete=\"complete\"}(g||(g={})),function(e){e.UserAction=\"user-action\",e.FocusChange=\"focus-change\",e.Reload=\"reload\"}(w||(w={})),function(e){e.Active=\"active\",e.Default=\"default\"}(y||(y={}));const v=\"0\",m=\"1\",R=\"2\",C=\"3\",b=\"4\",S=\"5\",I=\"6\",x=()=>{},O=new Set;function P(e){O.add(e)}function B(e){O.delete(e)}const E=new Set;function k(e){E.add(e)}function A(e){E.delete(e)}const D=new Map;async function L(e){D.set(e.id,e);const t=[...O].map((e=>e()));await Promise.all(t)}async function U(e){D.delete(e);const t=[...E].map((e=>e()));await Promise.all(t)}function _(){return[...D.values()]}function T(){D.clear()}function F(e){return D.get(e)}function M(e,t,n){return{...e,action:n||{...e.actions[0],trigger:w.UserAction},dispatcherIdentity:t}}function $(e,t,n=\"ascending\"){const o=e||[];if(!t?.length)return o;const r=[],i=new Map;t.forEach((e=>{if(e.key)return i.set(e.key,e);r.push(e)}));let s=o.map((e=>{const{key:t}=e;if(t&&i.has(t)){const e=i.get(t);return i.delete(t),e}return e}));return s.push(...i.values(),...r),s=\"ascending\"===n?s.sort(((e,t)=>(e?.score??1/0)-(t?.score??1/0))):s.sort(((e,t)=>(t?.score??1/0)-(e?.score??1/0))),s}function W(e){const t={};let n=[];let o=[];let r=null;let i=h.Initial;t.getStatus=()=>i,t.getResultBuffer=()=>n,t.setResultBuffer=e=>{n=e,n?.length&&t.onChange()},t.getRevokedBuffer=()=>o,t.setRevokedBuffer=e=>{o=e,o?.length&&t.onChange()},t.setUpdatedContext=e=>{r=e,t.onChange()},t.getUpdatedContext=()=>r,t.onChange=x;const s={};return t.res=s,s.close=()=>{i!==h.Close&&(i=h.Close,t.onChange())},s.open=()=>{i!==h.Open&&(i=h.Open,t.onChange())},s.respond=n=>{const o=$(t.getResultBuffer(),n,e);t.setResultBuffer(o)},s.revoke=(...e)=>{const n=new Set(e),o=t.getResultBuffer().filter((({key:e})=>{const t=n.has(e);return t&&n.delete(e),!t}));t.setResultBuffer(o),n.size&&(t.getRevokedBuffer().forEach((e=>n.add(e))),t.setRevokedBuffer([...n]))},s.updateContext=e=>{t.setUpdatedContext(e)},t}function q(e,t){const n=new Set;let o=!1;return{close:()=>{o=!0;for(const e of n)e()},req:{id:e,...t,context:t?.context||{},onClose:e=>{n.add(e),o&&e()},removeListener:e=>{n.delete(e)}}}}function K(){return{name:fin.me.name,uuid:fin.me.uuid}}const V=50,j=1e3;const H=new Map;function N(){return H}const z=100;function J(){return async e=>{if(!e||!e.id||!e.providerId){const e=c;return console.error(e),{error:e.message}}const{id:t,providerId:n}=e,o=F(n);if(!o){const e=i;return console.error(e),{error:e.message}}const r=N();let s=r.get(e.id);s||(s=q(t,e),r.set(e.id,s));const a=W(),u=()=>{const e=a.getResultBuffer();a.setResultBuffer([]);const o=a.getRevokedBuffer();a.setRevokedBuffer([]);const r=a.getUpdatedContext();a.setUpdatedContext(null);const i=a.getStatus();!async function(e){(await l()).dispatch(v,e)}({id:t,providerId:n,results:e,revoked:o,status:i,context:r})};let d=!0,f=!1;a.onChange=()=>{if(d)return d=!1,void u();f||(f=!0,setTimeout((()=>{f=!1,u()}),z))};try{const{results:e,context:r}=await o.onUserInput(s.req,a.res),i=a.getStatus();return{id:t,providerId:n,status:i,results:e,context:r}}catch(e){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${n} for search ${t}`,\"This is likely a bug in the implementation of the search provider.\",e),{id:t,providerId:n,error:e?.message}}}}async function G(e,t){const n=t||await l(),o=K(),r={...e,identity:o,onResultDispatch:void 0},i=await n.dispatch(R,r);return await L({identity:o,...e}),i}async function Q(e){const t=await l();return await t.dispatch(C,e),U(e)}async function X(e,t,n,o){const r=M(t,o??K(),n),i=F(e);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(r)}const s={providerId:e,result:r};return(await l()).dispatch(S,s)}async function Y(e){const t={...e,context:e?.context||{}},n={},o=async function*(e,{setState:t}){const n=await l();for(;;){const o=await n.dispatch(m,e),r=o.error;if(r)throw new Error(r);const i=o;if(e.id=i.id,t(i.state),i.done)return i.value;yield i.value}}(t,{setState:e=>{n.state=e}});let r=await o.next();return n.id=t.id||\"\",n.close=()=>{!async function(e){(await l()).dispatch(I,{id:e})}(n.id)},n.next=()=>{if(r){const e=r;return r=void 0,e}return o.next()},n}async function Z(){return(await l()).dispatch(b,null)}async function ee(){const e=await l();d=void 0,T(),await e.disconnect()}const te=async e=>{const t=await ne(e);for(const e of _())await G(e,t);return t};async function ne(e){const t=await async function(e){for(let t=0;t<V;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(e){if(t===V-1)throw e;await new Promise((e=>setTimeout(e,j)))}}(e);return t.register(v,J()),t.register(I,(e=>{const t=N(),n=t.get(e.id);n&&(n.close(),t.delete(e.id))})),t.register(S,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=F(e.providerId);if(!n)return void console.error(i);const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),t.onDisconnection(function(e){return async()=>{if(!f())return;const t=N();for(const{req:e,close:n}of t.values())n(),t.delete(e.id);p(te(e))}}(e)),t}async function oe(e){let t=f();t||(t=ne(e),p(t));const n=await t;return{getAllProviders:Z.bind(null),register:G.bind(null),search:Y.bind(null),deregister:Q.bind(null),dispatch:X.bind(null),disconnect:ee.bind(null),channel:n}}let re;function ie(){if(re)return re;throw u}function se(){return re}function ce(e){re=e}function ae(){re=void 0}const ue=new Set;function de(e){ue.add(e)}function le(e){ue.delete(e)}var fe;!function(e){e.Local=\"local\",e.Dev=\"dev\",e.Staging=\"staging\",e.Prod=\"prod\"}(fe||(fe={}));const pe=\"undefined\"!=typeof window&&\"undefined\"!=typeof fin,he=(\"undefined\"==typeof process||process.env,\"undefined\"!=typeof window),ge=he?window.origin:fe.Local,we=(pe&&fin.me.uuid,pe&&fin.me.name,pe&&fin.me.entityType,fe.Local,fe.Dev,fe.Staging,fe.Prod,e=>e.startsWith(\"http://\")||e.startsWith(\"https://\")?e:ge+e),ye=(we(\"http://localhost:4002\"),we(\"http://localhost:4002\"),\"undefined\"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&we(WORKSPACE_DOCS_PLATFORM_URL),\"undefined\"!=typeof WORKSPACE_DOCS_CLIENT_URL&&we(WORKSPACE_DOCS_CLIENT_URL),\"20.3.6\");\"undefined\"!=typeof WORKSPACE_BUILD_SHA&&WORKSPACE_BUILD_SHA;async function ve(){return[..._()].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function me(e){if(F(e.id))throw new Error(\"provider with name already exists\");const t=K();return await L({identity:t,...e}),{workspaceVersion:ye||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}async function Re(e){await U(e)}async function Ce(e,t,n,o){const r=F(e);if(!r)throw i;const{onResultDispatch:s}=r;if(!s)return;return s(M(t,o??K(),n))}async function*be(e,t){const n=function(e,t){const n=[],o=[],r=[],i=[];for(const s of e){const e=W(s.scoreOrder),c={results:[],provider:{id:s.id,identity:s.identity,title:s.title,scoreOrder:s.scoreOrder,icon:s.icon,dispatchFocusEvents:s.dispatchFocusEvents}};n.push(c),o.push(e);const a=(async()=>{try{const{results:n,context:o}=await s.onUserInput(t,e.res);c.results=$(c.results||[],n,s.scoreOrder),c.context={...c.context,...o}}catch(e){c.error=e}})();a.finally((()=>{a.done=!0})),i.push(a),r.push(r.length)}return{providerResponses:n,listenerResponses:o,openListenerResponses:r,initialResponsePromises:i}}(e.targets?e.targets.map((e=>F(e))).filter((e=>!!e)):[..._().filter((e=>!e.hidden))],e),{providerResponses:o,listenerResponses:r}=n;let{openListenerResponses:i,initialResponsePromises:s}=n,c=g.Fetching;const a=e=>{c=e,t.setState(c)};let u,d=!1;e.onClose((()=>{d=!0,u&&u()}));do{let e=!1;if(s.length){const t=[];for(const n of s)n.done?e=!0:t.push(n);s=t,s.length||(a(g.Fetched),e=!0)}let t,n=!1;const l=()=>{n=!0,t&&t()},f=[];for(const t of i){const n=r[t],i=o[t],s=n.getStatus();(s===h.Open||c===g.Fetching&&s===h.Initial)&&(f.push(t),n.onChange=l);const a=n.getResultBuffer();a.length&&(n.setResultBuffer([]),i.results=$(i.results||[],a),e=!0);const u=n.getRevokedBuffer();if(u.length){n.setRevokedBuffer([]);const t=new Set(u);i.results=(i.results||[]).filter((({key:e})=>!t.has(e))),e=!0}const d=n.getUpdatedContext();d&&(n.setUpdatedContext(null),i.context={...i.context,...d},e=!0)}if(i=f,e&&(yield o),d)break;n||(i.length||s.length)&&await Promise.race([...s,new Promise((e=>{t=e})),new Promise((e=>{u=e}))])}while(i.length||s.length);return a(g.Complete),o}let Se=0;async function Ie(e){Se+=1;const t=q(Se.toString(),e),n=be(t.req,{setState:e=>{n.state=e}});return n.id=Se.toString(),n.close=t.close,n.state=g.Fetching,n}const xe=new Map,Oe=1e4;function Pe(){return async e=>{if(!e)return console.error(c),{error:c.message};let t;if(e.id)t=e.id;else{const n=await Ie(e);t=n.id,e.id=n.id,xe.set(t,{generator:n})}const n=xe.get(t);clearTimeout(n.timeout);const o=await n.generator.next();return n.timeout=function(e){return window.setTimeout((()=>{xe.delete(e)}),Oe)}(t),{...o,id:e.id,state:n.generator.state}}}function Be(e,t){return ie().dispatch(e,I,{id:t})}function Ee(){return e=>function(e){const t=xe.get(e);t&&t.generator.close()}(e.id)}async function ke(e,{id:t,query:n,context:o,targets:r=[]}){const i=ie(),s={id:t,query:n,context:o,targets:r,providerId:e.id},c=await i.dispatch(e.identity,v,s),a=c.error;if(a)throw new Error(a);return c}const Ae=new Map;function De(e,t){return`${e.name}:${e.uuid}:${t}`}const Le=new Map;function Ue(e,t){return`${e}:${t}`}function _e(e){const t=De.bind(null,e.identity),n=Be.bind(null,e.identity),o=ke.bind(null,e);return async(r,i)=>{const s=t(r.id);if(!Ae.has(s)){const e=()=>{n(r.id),Ae.delete(s)};Ae.set(s,e),r.onClose(e)}const c=Ue(e.id,r.id),a=()=>{Le.delete(c),i.close()};r.onClose(a),Le.set(c,(e=>{e.results?.length&&i.respond(e.results),e.revoked?.length&&i.revoke(...e.revoked),e.context&&i.updateContext(e.context),e.status===h.Open&&i.open(),e.status===h.Close&&a()}));const u=await o(r);return u.status===h.Open&&i.open(),u.status!==h.Close&&u.status!==h.Initial||a(),u}}function Te(e){return async t=>{const n=ie(),o={providerId:e.id,result:t};return n.dispatch(e.identity,S,o)}}const Fe=new Map;function Me(e){return`${e.name}-${e.uuid}`}function $e(){return async(e,t)=>{if(!e||!e.id)return console.error(new Error(JSON.stringify(e))),void console.error(c);if(F(e.id))throw s;return e.identity=t,await async function(e){const t=Me(e.identity);Fe.has(t)||Fe.set(t,[]),Fe.get(t).push(e.id),await L({...e,onUserInput:_e(e),onResultDispatch:Te(e)})}(e),{workspaceVersion:ye||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}}function We(){return(e,t)=>{e?function(e,t){const n=F(e);if(!n)return;if(n.identity.uuid!==t.uuid||n.identity.name!==t.name)throw i;const o=Me(n.identity),r=Fe.get(o);if(r){const t=r.findIndex((t=>t===e));-1!==t&&(r.splice(t,1),U(e))}}(e,t):console.error(c)}}const qe=new Set;function Ke(e){qe.add(e)}function Ve(e){qe.delete(e)}function je(){return async e=>{!function(e){const t=Me(e),n=Fe.get(t);if(n){for(const e of n)U(e);Fe.delete(t)}}(e),qe.forEach((t=>t(e)))}}async function He(e){const t=await(n=e,fin.InterApplicationBus.Channel.create(n));var n;return t.onConnection((async e=>{for(const t of ue)if(!await t(e))throw a})),t.onDisconnection(je()),t.register(I,Ee()),t.register(v,(e=>{const t=Ue(e.providerId,e.id),n=Le.get(t);n&&n(e)})),t.register(R,$e()),t.register(C,We()),t.register(b,(async()=>ve())),t.register(m,Pe()),t.register(S,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=F(e.providerId);if(!n)throw i;const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),t}async function Ne(){const e=ie();ae(),await e.destroy(),T()}async function ze(e){let t=se();t||(t=await He(e),ce(t));const n=le.bind(null),o=Ve.bind(null),r=B.bind(null),i=A.bind(null);return{getAllProviders:ve.bind(null),search:Ie.bind(null),register:me.bind(null),deregister:Re.bind(null),onSubscription:de.bind(null),onDisconnect:Ke.bind(null),onRegister:P.bind(null),onDeregister:k.bind(null),dispatch:Ce.bind(null),disconnect:Ne.bind(null),removeListener:e=>{n(e),o(e),r(e),i(e)},channel:t}}const{v:Je}=o,{B:Ge}=n,Qe=\"all\",Xe={create:Je,subscribe:Ge,defaultTopic:Qe},Ye=()=>{window.search=Xe},Ze=e=>{const t=()=>{Ye(),window.removeEventListener(e,t)};return t};if(\"undefined\"!=typeof window){Ye();const e=\"load\",t=Ze(e);window.addEventListener(e,t);const n=\"DOMContentLoaded\",o=Ze(n);window.addEventListener(n,o)}module.exports=t})();\n//# sourceMappingURL=index.js.map"]}
1
+ {"version":3,"sources":["../src/utils.ts","../src/notifications.ts","../src/client-api.ts"],"names":["PACKAGE_NAME","isInViewContext","extractAppUuidFromIdentity","identity","getChannelName","notificationsClientPromise","getNotificationsClient","getNotificationsClientInternal","channelPromise","getChannelClient","message","listener","eventListeners","eventName","listeners","options","notificationId","channelClientPromise","getChannelClientInternal","channel","apiChannelClientPromise","getApiChannelName","getApiChannelClient","getAppSettings","getAppUserSettings","setAppUserSettings","settings","getAppUserPermissions","launchContent","id","error"],"mappings":"AAEO,IAAMA,EAAe,qBAE5B,eAAsBC,GAAoC,CACtD,GAAI,CACA,aAAM,OAAO,IAAI,KAAK,eAAe,EAAE,QAAQ,EACxC,EACX,MAAQ,CACJ,MAAO,EACX,CACJ,CAEO,SAASC,EAA2BC,EAAoC,CAC3E,GAAIA,EAAS,KAAK,WAAW,oBAAoB,EAC7C,MAAM,IAAI,MAAM,uCAAuC,EAG3D,MAAI,mBAAmB,KAAKA,EAAS,IAAI,EAC9BA,EAAS,KAAK,MAAM,GAAG,EAAE,CAAC,GAAK,GAGnCA,EAAS,IACpB,CCjBA,IAAMH,EAAe,qBAmBrB,SAASI,GAAiB,CACtB,MAAO,GAAG,OAAO,IAAI,GAAG,IAAI,0BAChC,CAEA,IAAIC,EAAkE,KAmDtE,eAAeC,GAAuD,CAClE,OAAKD,IACDA,EAA6BE,EAA+B,GAGzDF,CACX,CAEA,eAAeE,GAA+D,CAC1E,GAAI,CAAC,OAAO,IACR,MAAM,IAAI,MAAM,KAAKP,CAAY,4EAA4E,EAGjH,GAAK,MAAMC,EAAgB,IAAO,GAC9B,MAAM,IAAI,MAAM,GAAGD,CAAY,0EAA0E,EAG7GE,EAA2B,OAAO,IAAI,EAAE,EAExC,IAAMM,EAAiB,MAAMC,EAAiB,EAC9C,QAAQ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hH,GAAK,MAAMC,EAAgB,IAAO,GAC9B,MAAM,IAAI,MAAM,GAAGD,CAAY,yEAAyE,EAK5G,OAFgB,MAAMsB,EAAoB,GAE3B,SAAS,sBAAsB,CAClD,CAYA,eAAeM,EAAcC,EAA2B,CACpD,GAAI,CAAC,OAAO,IACR,MAAM,IAAI,MAAM,KAAK7B,CAAY,mEAAmE,EAGxG,GAAK,MAAMC,EAAgB,IAAO,GAC9B,MAAM,IAAI,MAAM,GAAGD,CAAY,4EAA4E,EAG/G,IAAMmB,EAAU,MAAMG,EAAoB,EAE1C,GAAI,CACA,MAAMH,EAAQ,SAAS,iBAAkB,CAAE,GAAAU,CAAG,CAAC,CACnD,OAASC,EAAO,CAEZ,OADqBA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACpD,CAClB,IAAK,iBACD,MAAM,IAAI,MAAM,GAAG9B,CAAY,6DAA6D6B,CAAE,EAAE,EAEpG,IAAK,iBACD,MAAM,IAAI,MAAM,GAAG7B,CAAY,6DAA6D6B,CAAE,EAAE,EAEpG,IAAK,iBACD,MAAM,IAAI,MAAM,GAAG7B,CAAY,qDAAqD6B,CAAE,EAAE,EAE5F,QACI,MAAM,IAAI,MAAM,GAAG7B,CAAY,wEAAwE6B,CAAE,gCAAgC,CAEjJ,CACJ,CACJ","sourcesContent":["import type OpenFin from '@openfin/core';\n\nexport const PACKAGE_NAME = '@openfin/cloud-api';\n\nexport async function isInViewContext(): Promise<boolean> {\n try {\n await window.fin.View.getCurrentSync().getInfo();\n return true;\n } catch {\n return false;\n }\n}\n\nexport function extractAppUuidFromIdentity(identity: OpenFin.Identity): string {\n if (identity.name.startsWith('internal-generated')) {\n throw new Error('Cannot extract app UUID from identity');\n }\n // <uuid>/<name>\n if (/\\/[\\d,a-z-]{36}$/.test(identity.name)) {\n return identity.name.split('/')[0] || '';\n }\n\n return identity.name;\n}\n","// eslint-disable-next-line check-file/no-index\nimport type * as NotificationsTypes from 'openfin-notifications';\n\nimport type { FlannelChannelClient, NotificationEventsMap, NotificationsClient } from './types';\nimport { extractAppUuidFromIdentity, isInViewContext } from './utils';\n\nconst PACKAGE_NAME = '@openfin/cloud-api';\n\nexport type {\n FlannelChannelProvider as __INTERNAL_FlannelChannelProvider,\n FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest,\n FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse,\n FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest,\n FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse,\n FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest,\n FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse,\n} from './types';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface Window {\n fin: typeof import('@openfin/core').fin;\n }\n}\n\nfunction getChannelName() {\n return `${window.fin.me.uuid}-cloud-api-notifications`;\n}\n\nlet notificationsClientPromise: Promise<NotificationsClient> | null = null;\n\n/**\n * @returns A client for interacting with the OpenFin Notifications service\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the app UUID cannot be extracted from the current context\n *\n * @example **Basic Usage** Creating a notification, updating it and then clearing it\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * const notification = await notificationsClient.createNotification({\n * title: 'Hello, World!',\n * body: 'This is a notification from the OpenFin Cloud API',\n * });\n *\n * // Use the `id` from the returned notification to interact with it\n * console.log(notification.id);\n *\n * // Update the notification\n * await notificationsClient.update({\n * id: notification.id,\n * body: 'This is a notification from the OpenFin Cloud API, that has been updated!',\n * })\n *\n * // Clear the notification\n * await notificationsClient.clear(notification.id);\n * ```\n *\n * @example **Advanced Usage** Listening for events\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * // create the notification\n * const notification = await notificationsClient.createNotification({\n * title: `${window.fin.me.identity.name} Hello, World!`,\n * body: `This is a notification from the cloud API example created at ${new Date().toLocaleTimeString()}`,\n * buttons: [\n * {\n * title: 'Acknowledge',\n * },\n * ],\n * });\n *\n * notificationsClient.addEventListener('notification-action', (event) => {\n * console.log('Notification action:', event);\n * });\n * ```\n */\nasync function getNotificationsClient(): Promise<NotificationsClient> {\n if (!notificationsClientPromise) {\n notificationsClientPromise = getNotificationsClientInternal();\n }\n\n return notificationsClientPromise;\n}\n\nasync function getNotificationsClientInternal(): Promise<NotificationsClient> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n extractAppUuidFromIdentity(window.fin.me);\n\n const channelPromise = await getChannelClient();\n console.log(channelPromise);\n\n channelPromise.register('openfin-cloud-event', (message) => {\n for (const listener of eventListeners.get(message.type) ?? []) {\n // `Date` is serialized as a string, so we need to convert it back\n if (typeof message.payload.timestamp === 'string') {\n message.payload.timestamp = new Date(message.payload.timestamp);\n }\n\n listener(message.payload as never);\n }\n });\n\n const eventListeners = new Map<keyof NotificationEventsMap, Set<NotificationEventsMap[keyof NotificationEventsMap]>>();\n\n return {\n addEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName) || new Set();\n listeners.add(listener);\n eventListeners.set(eventName, listeners);\n },\n removeEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName);\n if (!listeners) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,\n eventName,\n );\n return;\n }\n\n if (listeners.delete(listener as (args: unknown) => void) === false) {\n console.warn(`\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference?`, eventName);\n }\n },\n update: async (options: Parameters<typeof NotificationsTypes.update>[0]): ReturnType<typeof NotificationsTypes.update> => {\n const response = await channelPromise.dispatch('openfin-cloud-update-notification', {\n version: 1,\n payload: {\n notification: options,\n },\n });\n return response.payload.response;\n },\n clear: async (notificationId: Parameters<typeof NotificationsTypes.clear>[0]): ReturnType<typeof NotificationsTypes.clear> => {\n const response = await channelPromise.dispatch('openfin-cloud-clear-notification', {\n version: 1,\n payload: {\n notificationId,\n },\n });\n return response.payload.response;\n },\n createNotification: async (\n options: NotificationsTypes.NotificationOptions,\n ): Promise<NotificationsTypes.Notification<NotificationsTypes.NotificationOptions>> => {\n if (options.id) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: The \\`id\\` property is not supported and will be ignored. If you need to use the \\`id\\` property, you should use the \\`id\\` property of the returned notification object.`,\n );\n }\n const response = await channelPromise.dispatch('openfin-cloud-create-notification', {\n version: 1,\n payload: {\n notification: { ...options, id: undefined },\n },\n });\n return response.payload.response;\n },\n };\n}\n\nlet channelClientPromise: Promise<FlannelChannelClient> | null = null;\n\nasync function getChannelClient(): Promise<FlannelChannelClient> {\n if (!channelClientPromise) {\n channelClientPromise = getChannelClientInternal();\n }\n\n return channelClientPromise;\n}\n\nasync function getChannelClientInternal(): Promise<FlannelChannelClient> {\n const channel = (await window.fin.InterApplicationBus.Channel.connect(getChannelName())) as FlannelChannelClient;\n\n channel.onDisconnection((identity) => {\n console.warn(`\\`${PACKAGE_NAME}\\`: Channel Disconnected from`, identity, 'Reconnecting...');\n channelClientPromise = null;\n });\n\n return channel;\n}\n\nexport { getNotificationsClient };\n","import type OpenFin from '@openfin/core';\n\nimport { isInViewContext, PACKAGE_NAME } from './utils';\n\nlet apiChannelClientPromise: Promise<OpenFin.ChannelClient>;\n\n/**\n * Represents a collection of returned app permissions\n */\nexport type AppPermissions = {\n permissions: {\n /**\n * The name of the permission\n */\n name: string;\n /**\n * The ID of the permission\n */\n id: string;\n }[];\n};\n\nfunction getApiChannelName() {\n return `${window.fin.me.uuid}-client-api`;\n}\n\nasync function getApiChannelClient(): Promise<OpenFin.ChannelClient> {\n if (!apiChannelClientPromise) {\n apiChannelClientPromise = window.fin.InterApplicationBus.Channel.connect(getApiChannelName());\n }\n\n return apiChannelClientPromise;\n}\n\n/**\n * @returns The app settings that have been set against the current app\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-settings');\n}\n\n/**\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-settings');\n}\n\n/**\n * Assigns a set of user specific settings to the current app\n *\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function setAppUserSettings(settings: unknown): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('set-user-settings', settings);\n}\n\n/**\n * @returns The permissions that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserPermissions(): Promise<AppPermissions> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-permissions');\n}\n\n/**\n * A function allowing the easy launching of content\n * @param id The id of the content to launch\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the content\n * @throws {Error} If the function is unable to find content with the provided id.\n */\nasync function launchContent(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchContent\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-content', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\nexport { getAppSettings, getAppUserSettings, setAppUserSettings, getAppUserPermissions, launchContent };\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as OpenFin from '@openfin/core';
2
2
  import OpenFin__default from '@openfin/core';
3
- import * as NotificationsTypes from '@openfin/workspace/notifications';
3
+ import * as NotificationsTypes from 'openfin-notifications';
4
4
 
5
5
  /**
6
6
  * NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
@@ -152,6 +152,11 @@ type FlannelChannelProvider = {
152
152
  register: <T extends keyof FlannelProvider>(action: T, handler: (payload: Parameters<FlannelProvider[T]>[0], id: OpenFin__default.ProviderIdentity | OpenFin__default.ClientIdentity) => ReturnType<FlannelProvider[T]>) => boolean;
153
153
  } & Omit<OpenFin__default.ChannelProvider, 'dispatch' | 'register'>;
154
154
 
155
+ declare global {
156
+ interface Window {
157
+ fin: typeof OpenFin.fin;
158
+ }
159
+ }
155
160
  /**
156
161
  * @returns A client for interacting with the OpenFin Notifications service
157
162
  *
@@ -248,21 +253,6 @@ declare function setAppUserSettings(settings: unknown): Promise<unknown>;
248
253
  * @throws {Error} If the function is called outside of an OpenFin View context
249
254
  */
250
255
  declare function getAppUserPermissions(): Promise<AppPermissions>;
251
- type LaunchContentOptions = {
252
- /** Object containing query param values to be appended to content's URL */
253
- queryParams?: Record<string, string>;
254
- /** Defines behavior when instance of content is already running.
255
- * If 'multi', copy of the content will be created.
256
- * If 'single', the existing instance of content will be focused. */
257
- instanceMode?: 'single' | 'multi';
258
- } & ({
259
- targetType?: 'new-window';
260
- /** Defines the bounds of the window in which content will open */
261
- bounds?: Partial<OpenFin__default.Bounds>;
262
- } | {
263
- targetType: 'window' | 'view';
264
- targetIdentity: OpenFin__default.Identity;
265
- });
266
256
  /**
267
257
  * A function allowing the easy launching of content
268
258
  * @param id The id of the content to launch
@@ -273,287 +263,6 @@ type LaunchContentOptions = {
273
263
  * @throws {Error} If the function has been unable to look up or launch the content
274
264
  * @throws {Error} If the function is unable to find content with the provided id.
275
265
  */
276
- declare function launchContent(id: string, options: LaunchContentOptions): Promise<void>;
277
- /**
278
- * A function allowing the easy launching of Supertabs
279
- * @param id The id of supertab
280
- * @returns nothing
281
- *
282
- * @throws {Error} If the function is called outside of an OpenFin environment
283
- * @throws {Error} If the function is called outside of an OpenFin View context
284
- * @throws {Error} If the function has been unable to look up or launch the supertab
285
- * @throws {Error} If the function is unable to find supertab with the provided id.
286
- */
287
- declare function launchSupertab(id: string): Promise<void>;
288
- /**
289
- * A function allowing the easy launching of Workspaces
290
- * @param id The id of workspace
291
- * @returns nothing
292
- *
293
- * @throws {Error} If the function is called outside of an OpenFin environment
294
- * @throws {Error} If the function is called outside of an OpenFin View context
295
- * @throws {Error} If the function has been unable to look up or launch the workspace
296
- * @throws {Error} If the function is unable to find workspace with the provided id.
297
- */
298
- declare function launchWorkspace(id: string): Promise<void>;
299
-
300
- /**
301
- * Function that is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
302
- *
303
- * @param action The action that was triggered.
304
- * @param result The search result that the action was triggered on.
305
- *
306
- * @returns Result that includes the URL that Here™ should navigate to, or `undefined` if no navigation is required.
307
- */
308
- type OnActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
309
- /**
310
- * Function that is called when the Search Agent receives a query from Here™’s search UI
311
- *
312
- * @param request Search request data that includes the query.
313
- *
314
- * @returns Search response data that includes the search results.
315
- */
316
- type OnSearchListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
317
- /**
318
- * An action that can be triggered by a user on a search result returned by a Search Agent.
319
- *
320
- * Actions are displayed as buttons alongside search results in Here™’s search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
321
- */
322
- type SearchAction = {
323
- /**
324
- * URL or data URI of an icon that will be displayed within the action button when Here™ is in Light mode.
325
- */
326
- darkIcon?: string;
327
- /**
328
- * A fuller description of the action that will be displayed in Here™’s search UI when the user hovers over the action button.
329
- */
330
- description?: string;
331
- /**
332
- * URL or data URI of an icon that will be displayed within the action button when Here™ is in Dark mode.
333
- */
334
- lightIcon?: string;
335
- /**
336
- * Internal identifier for the action which is used to identify the action in the {@link OnActionListener}.
337
- */
338
- name: string;
339
- /**
340
- * Compact title of the action displayed within the action button.
341
- */
342
- title?: string;
343
- };
344
- /**
345
- * A Search Agent returns search results to Here™’s search UI in response to user input, and acts on the user’s actions regarding those results.
346
- */
347
- type SearchAgent = {
348
- /**
349
- * The Search Agent’s custom configuration data configured via the Admin Console.
350
- */
351
- readonly customData: unknown;
352
- /**
353
- * Sets whether or not the Search Agent is ready to provide search results.
354
- *
355
- * When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
356
- *
357
- * @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
358
- */
359
- isReady: (ready?: boolean) => Promise<void>;
360
- };
361
- /**
362
- * Configuration provided when registering a Search Agent.
363
- */
364
- type SearchAgentRegistrationConfig = {
365
- /**
366
- * This listener is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
367
- *
368
- * The listener returns a response back to Here™ that includes a URL to navigate to.
369
- */
370
- onAction: OnActionListener;
371
- /**
372
- * This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
373
- *
374
- * Note: When the Search Agent is not ready this listener will not be called.
375
- */
376
- onSearch: OnSearchListener;
377
- };
378
- /**
379
- * Search request data provided to the {@link OnSearchListener}.
380
- */
381
- type SearchListenerRequest = {
382
- /**
383
- * Provides additional context for the search request.
384
- */
385
- context: SearchRequestContext;
386
- /**
387
- * The query entered by the user in Here™’s search UI.
388
- */
389
- query: string;
390
- /**
391
- * Provide this signal to any `fetch` requests executed in the {@link OnSearchListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
392
- */
393
- signal: AbortSignal;
394
- };
395
- /**
396
- * Context data included with a search request.
397
- */
398
- type SearchRequestContext = {
399
- /**
400
- * The page number of the search results to return.
401
- */
402
- pageNumber: number;
403
- /**
404
- * The number of search results to return per page.
405
- */
406
- pageSize: number;
407
- };
408
- /**
409
- * Return type of the {@link OnSearchListener}.
410
- */
411
- type SearchResponse = {
412
- /**
413
- * The search results to display in Here™’s search UI.
414
- */
415
- results: SearchResult[];
416
- };
417
- /**
418
- * A search result returned by a Search Agent in response to a search request.
419
- */
420
- type SearchResult = {
421
- /**
422
- * Actions that can be triggered by the user against the search result.
423
- */
424
- actions: SearchAction[];
425
- /**
426
- * Additional data that can be used by the {@link OnActionListener} when an action is triggered.
427
- */
428
- data?: Record<string, unknown>;
429
- /**
430
- * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
431
- */
432
- icon?: string;
433
- /**
434
- * Unique identifier for the search result.
435
- */
436
- key: string;
437
- /**
438
- * Secondary text that will be displayed with the search result in Here™’s search UI.
439
- */
440
- label?: string;
441
- /**
442
- * Primary text that will be displayed with the search result in Here™’s search UI.
443
- */
444
- title: string;
445
- };
446
- /**
447
- * Return type of the {@link OnActionListener}.
448
- */
449
- type SearchResultActionResponse = {
450
- /**
451
- * URL that Here™ should navigate to.
452
- */
453
- url: string;
454
- } | undefined;
455
-
456
- /**
457
- * Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.
458
- *
459
- * @param config The configuration for the Search Agent.
460
- *
461
- * @returns A promise that resolves with the Search Agent.
462
- *
463
- * @example Registering a basic Search Agent:
464
- * ```ts
465
- * // Handle incoming action and return a response that includes the URL to navigate to
466
- * const onAction: Search.OnActionListener = (action, result) => {
467
- * const { name } = action;
468
- * const { data, key } = result;
469
- * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
470
- * const { id: ownerId } = owner;
471
- * console.log(`Action "${name}" triggered on search result with key "${key}"`);
472
- * switch (name) {
473
- * case "view-owner":
474
- * return { url: `${searchResultHostUrl}/people/${ownerId}` };
475
- * case "view-result":
476
- * return { url: `${searchResultHostUrl}/record/${key}` };
477
- * default:
478
- * console.warn(`Unknown action: ${name}`);
479
- * }
480
- * };
481
- *
482
- * // Handle incoming search request and return relevant search results
483
- * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
484
- * const { pageNumber, pageSize } = context;
485
- * try {
486
- * let results: Search.SearchResult[] = [];
487
- * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
488
- * const response = await fetch(url, { signal });
489
- * if (!response.ok) {
490
- * throw new Error(`Request failed: ${response.status}`);
491
- * }
492
- * const { searchResults } = await response.json();
493
- * results = searchResults.map((result) => {
494
- * const { iconUrl, id: key, owner, subTitle, title } = result;
495
- * const { name: ownerName } = owner as { id: string, name: string };
496
- * return {
497
- * actions: [
498
- * {
499
- * name: "view-result",
500
- * description: `Go to ${title} in My Web App`,
501
- * },
502
- * {
503
- * name: "view-owner",
504
- * description: `Go to ${ownerName} in My Web App`,
505
- * title: "View Owner",
506
- * },
507
- * ],
508
- * data: {
509
- * owner,
510
- * searchResultHostUrl: `https://my-web-app.com`,
511
- * },
512
- * icon: iconUrl,
513
- * key,
514
- * label: subTitle,
515
- * title,
516
- * };
517
- * });
518
- * console.log("Returning results", results);
519
- * return { results };
520
- * } catch (err) {
521
- * if ((err as Error).name === "AbortError") {
522
- * // Ignore errors for cancelled requests
523
- * return { results: [] };
524
- * }
525
- * throw err;
526
- * }
527
- * };
528
- *
529
- * // Register the search agent
530
- * const searchAgent = await Search.register({ onAction, onSearch });
531
- *
532
- * // Set the Search Agent as ready to receive search requests
533
- * await searchAgent.isReady();
534
- * ```
535
- */
536
- declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
537
-
538
- type index_OnActionListener = OnActionListener;
539
- type index_OnSearchListener = OnSearchListener;
540
- type index_SearchAction = SearchAction;
541
- type index_SearchAgent = SearchAgent;
542
- type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
543
- type index_SearchListenerRequest = SearchListenerRequest;
544
- type index_SearchRequestContext = SearchRequestContext;
545
- type index_SearchResponse = SearchResponse;
546
- type index_SearchResult = SearchResult;
547
- type index_SearchResultActionResponse = SearchResultActionResponse;
548
- declare const index_register: typeof register;
549
- declare namespace index {
550
- export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type index_SearchListenerRequest as SearchListenerRequest, type index_SearchRequestContext as SearchRequestContext, type index_SearchResponse as SearchResponse, type index_SearchResult as SearchResult, type index_SearchResultActionResponse as SearchResultActionResponse, index_register as register };
551
- }
552
-
553
- declare global {
554
- interface Window {
555
- fin: typeof OpenFin.fin;
556
- }
557
- }
266
+ declare function launchContent(id: string): Promise<void>;
558
267
 
559
- export { type AppPermissions, type LaunchContentOptions, index as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
268
+ export { type AppPermissions, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, setAppUserSettings };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as OpenFin from '@openfin/core';
2
2
  import OpenFin__default from '@openfin/core';
3
- import * as NotificationsTypes from '@openfin/workspace/notifications';
3
+ import * as NotificationsTypes from 'openfin-notifications';
4
4
 
5
5
  /**
6
6
  * NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
@@ -152,6 +152,11 @@ type FlannelChannelProvider = {
152
152
  register: <T extends keyof FlannelProvider>(action: T, handler: (payload: Parameters<FlannelProvider[T]>[0], id: OpenFin__default.ProviderIdentity | OpenFin__default.ClientIdentity) => ReturnType<FlannelProvider[T]>) => boolean;
153
153
  } & Omit<OpenFin__default.ChannelProvider, 'dispatch' | 'register'>;
154
154
 
155
+ declare global {
156
+ interface Window {
157
+ fin: typeof OpenFin.fin;
158
+ }
159
+ }
155
160
  /**
156
161
  * @returns A client for interacting with the OpenFin Notifications service
157
162
  *
@@ -248,21 +253,6 @@ declare function setAppUserSettings(settings: unknown): Promise<unknown>;
248
253
  * @throws {Error} If the function is called outside of an OpenFin View context
249
254
  */
250
255
  declare function getAppUserPermissions(): Promise<AppPermissions>;
251
- type LaunchContentOptions = {
252
- /** Object containing query param values to be appended to content's URL */
253
- queryParams?: Record<string, string>;
254
- /** Defines behavior when instance of content is already running.
255
- * If 'multi', copy of the content will be created.
256
- * If 'single', the existing instance of content will be focused. */
257
- instanceMode?: 'single' | 'multi';
258
- } & ({
259
- targetType?: 'new-window';
260
- /** Defines the bounds of the window in which content will open */
261
- bounds?: Partial<OpenFin__default.Bounds>;
262
- } | {
263
- targetType: 'window' | 'view';
264
- targetIdentity: OpenFin__default.Identity;
265
- });
266
256
  /**
267
257
  * A function allowing the easy launching of content
268
258
  * @param id The id of the content to launch
@@ -273,287 +263,6 @@ type LaunchContentOptions = {
273
263
  * @throws {Error} If the function has been unable to look up or launch the content
274
264
  * @throws {Error} If the function is unable to find content with the provided id.
275
265
  */
276
- declare function launchContent(id: string, options: LaunchContentOptions): Promise<void>;
277
- /**
278
- * A function allowing the easy launching of Supertabs
279
- * @param id The id of supertab
280
- * @returns nothing
281
- *
282
- * @throws {Error} If the function is called outside of an OpenFin environment
283
- * @throws {Error} If the function is called outside of an OpenFin View context
284
- * @throws {Error} If the function has been unable to look up or launch the supertab
285
- * @throws {Error} If the function is unable to find supertab with the provided id.
286
- */
287
- declare function launchSupertab(id: string): Promise<void>;
288
- /**
289
- * A function allowing the easy launching of Workspaces
290
- * @param id The id of workspace
291
- * @returns nothing
292
- *
293
- * @throws {Error} If the function is called outside of an OpenFin environment
294
- * @throws {Error} If the function is called outside of an OpenFin View context
295
- * @throws {Error} If the function has been unable to look up or launch the workspace
296
- * @throws {Error} If the function is unable to find workspace with the provided id.
297
- */
298
- declare function launchWorkspace(id: string): Promise<void>;
299
-
300
- /**
301
- * Function that is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
302
- *
303
- * @param action The action that was triggered.
304
- * @param result The search result that the action was triggered on.
305
- *
306
- * @returns Result that includes the URL that Here™ should navigate to, or `undefined` if no navigation is required.
307
- */
308
- type OnActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
309
- /**
310
- * Function that is called when the Search Agent receives a query from Here™’s search UI
311
- *
312
- * @param request Search request data that includes the query.
313
- *
314
- * @returns Search response data that includes the search results.
315
- */
316
- type OnSearchListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
317
- /**
318
- * An action that can be triggered by a user on a search result returned by a Search Agent.
319
- *
320
- * Actions are displayed as buttons alongside search results in Here™’s search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
321
- */
322
- type SearchAction = {
323
- /**
324
- * URL or data URI of an icon that will be displayed within the action button when Here™ is in Light mode.
325
- */
326
- darkIcon?: string;
327
- /**
328
- * A fuller description of the action that will be displayed in Here™’s search UI when the user hovers over the action button.
329
- */
330
- description?: string;
331
- /**
332
- * URL or data URI of an icon that will be displayed within the action button when Here™ is in Dark mode.
333
- */
334
- lightIcon?: string;
335
- /**
336
- * Internal identifier for the action which is used to identify the action in the {@link OnActionListener}.
337
- */
338
- name: string;
339
- /**
340
- * Compact title of the action displayed within the action button.
341
- */
342
- title?: string;
343
- };
344
- /**
345
- * A Search Agent returns search results to Here™’s search UI in response to user input, and acts on the user’s actions regarding those results.
346
- */
347
- type SearchAgent = {
348
- /**
349
- * The Search Agent’s custom configuration data configured via the Admin Console.
350
- */
351
- readonly customData: unknown;
352
- /**
353
- * Sets whether or not the Search Agent is ready to provide search results.
354
- *
355
- * When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
356
- *
357
- * @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
358
- */
359
- isReady: (ready?: boolean) => Promise<void>;
360
- };
361
- /**
362
- * Configuration provided when registering a Search Agent.
363
- */
364
- type SearchAgentRegistrationConfig = {
365
- /**
366
- * This listener is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
367
- *
368
- * The listener returns a response back to Here™ that includes a URL to navigate to.
369
- */
370
- onAction: OnActionListener;
371
- /**
372
- * This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
373
- *
374
- * Note: When the Search Agent is not ready this listener will not be called.
375
- */
376
- onSearch: OnSearchListener;
377
- };
378
- /**
379
- * Search request data provided to the {@link OnSearchListener}.
380
- */
381
- type SearchListenerRequest = {
382
- /**
383
- * Provides additional context for the search request.
384
- */
385
- context: SearchRequestContext;
386
- /**
387
- * The query entered by the user in Here™’s search UI.
388
- */
389
- query: string;
390
- /**
391
- * Provide this signal to any `fetch` requests executed in the {@link OnSearchListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
392
- */
393
- signal: AbortSignal;
394
- };
395
- /**
396
- * Context data included with a search request.
397
- */
398
- type SearchRequestContext = {
399
- /**
400
- * The page number of the search results to return.
401
- */
402
- pageNumber: number;
403
- /**
404
- * The number of search results to return per page.
405
- */
406
- pageSize: number;
407
- };
408
- /**
409
- * Return type of the {@link OnSearchListener}.
410
- */
411
- type SearchResponse = {
412
- /**
413
- * The search results to display in Here™’s search UI.
414
- */
415
- results: SearchResult[];
416
- };
417
- /**
418
- * A search result returned by a Search Agent in response to a search request.
419
- */
420
- type SearchResult = {
421
- /**
422
- * Actions that can be triggered by the user against the search result.
423
- */
424
- actions: SearchAction[];
425
- /**
426
- * Additional data that can be used by the {@link OnActionListener} when an action is triggered.
427
- */
428
- data?: Record<string, unknown>;
429
- /**
430
- * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
431
- */
432
- icon?: string;
433
- /**
434
- * Unique identifier for the search result.
435
- */
436
- key: string;
437
- /**
438
- * Secondary text that will be displayed with the search result in Here™’s search UI.
439
- */
440
- label?: string;
441
- /**
442
- * Primary text that will be displayed with the search result in Here™’s search UI.
443
- */
444
- title: string;
445
- };
446
- /**
447
- * Return type of the {@link OnActionListener}.
448
- */
449
- type SearchResultActionResponse = {
450
- /**
451
- * URL that Here™ should navigate to.
452
- */
453
- url: string;
454
- } | undefined;
455
-
456
- /**
457
- * Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.
458
- *
459
- * @param config The configuration for the Search Agent.
460
- *
461
- * @returns A promise that resolves with the Search Agent.
462
- *
463
- * @example Registering a basic Search Agent:
464
- * ```ts
465
- * // Handle incoming action and return a response that includes the URL to navigate to
466
- * const onAction: Search.OnActionListener = (action, result) => {
467
- * const { name } = action;
468
- * const { data, key } = result;
469
- * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
470
- * const { id: ownerId } = owner;
471
- * console.log(`Action "${name}" triggered on search result with key "${key}"`);
472
- * switch (name) {
473
- * case "view-owner":
474
- * return { url: `${searchResultHostUrl}/people/${ownerId}` };
475
- * case "view-result":
476
- * return { url: `${searchResultHostUrl}/record/${key}` };
477
- * default:
478
- * console.warn(`Unknown action: ${name}`);
479
- * }
480
- * };
481
- *
482
- * // Handle incoming search request and return relevant search results
483
- * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
484
- * const { pageNumber, pageSize } = context;
485
- * try {
486
- * let results: Search.SearchResult[] = [];
487
- * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
488
- * const response = await fetch(url, { signal });
489
- * if (!response.ok) {
490
- * throw new Error(`Request failed: ${response.status}`);
491
- * }
492
- * const { searchResults } = await response.json();
493
- * results = searchResults.map((result) => {
494
- * const { iconUrl, id: key, owner, subTitle, title } = result;
495
- * const { name: ownerName } = owner as { id: string, name: string };
496
- * return {
497
- * actions: [
498
- * {
499
- * name: "view-result",
500
- * description: `Go to ${title} in My Web App`,
501
- * },
502
- * {
503
- * name: "view-owner",
504
- * description: `Go to ${ownerName} in My Web App`,
505
- * title: "View Owner",
506
- * },
507
- * ],
508
- * data: {
509
- * owner,
510
- * searchResultHostUrl: `https://my-web-app.com`,
511
- * },
512
- * icon: iconUrl,
513
- * key,
514
- * label: subTitle,
515
- * title,
516
- * };
517
- * });
518
- * console.log("Returning results", results);
519
- * return { results };
520
- * } catch (err) {
521
- * if ((err as Error).name === "AbortError") {
522
- * // Ignore errors for cancelled requests
523
- * return { results: [] };
524
- * }
525
- * throw err;
526
- * }
527
- * };
528
- *
529
- * // Register the search agent
530
- * const searchAgent = await Search.register({ onAction, onSearch });
531
- *
532
- * // Set the Search Agent as ready to receive search requests
533
- * await searchAgent.isReady();
534
- * ```
535
- */
536
- declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
537
-
538
- type index_OnActionListener = OnActionListener;
539
- type index_OnSearchListener = OnSearchListener;
540
- type index_SearchAction = SearchAction;
541
- type index_SearchAgent = SearchAgent;
542
- type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
543
- type index_SearchListenerRequest = SearchListenerRequest;
544
- type index_SearchRequestContext = SearchRequestContext;
545
- type index_SearchResponse = SearchResponse;
546
- type index_SearchResult = SearchResult;
547
- type index_SearchResultActionResponse = SearchResultActionResponse;
548
- declare const index_register: typeof register;
549
- declare namespace index {
550
- export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type index_SearchListenerRequest as SearchListenerRequest, type index_SearchRequestContext as SearchRequestContext, type index_SearchResponse as SearchResponse, type index_SearchResult as SearchResult, type index_SearchResultActionResponse as SearchResultActionResponse, index_register as register };
551
- }
552
-
553
- declare global {
554
- interface Window {
555
- fin: typeof OpenFin.fin;
556
- }
557
- }
266
+ declare function launchContent(id: string): Promise<void>;
558
267
 
559
- export { type AppPermissions, type LaunchContentOptions, index as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
268
+ export { type AppPermissions, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, setAppUserSettings };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var We=Object.create;var mn=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Ge=(o,l)=>()=>(l||o((l={exports:{}}).exports,l),l.exports),je=(o,l)=>{for(var a in l)mn(o,a,{get:l[a],enumerable:!0})},Xe=(o,l,a,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of qe(l))!Ke.call(o,p)&&p!==a&&mn(o,p,{get:()=>l[p],enumerable:!(d=Ve(l,p))||d.enumerable});return o};var ze=(o,l,a)=>(a=o!=null?We(He(o)):{},Xe(l||!o||!o.__esModule?mn(a,"default",{value:o,enumerable:!0}):a,o));var Hn=Ge((At,qn)=>{"use strict";(()=>{"use strict";var o={d:(n,e)=>{for(var t in e)o.o(e,t)&&!o.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},l={};o.r(l),o.d(l,{SearchTagBackground:()=>on,create:()=>Un,defaultTopic:()=>Bn,subscribe:()=>Dn});var a={};o.r(a),o.d(a,{B:()=>ue});var d={};o.r(d),o.d(d,{v:()=>Ue});let p="deregistered or does not exist",y=new Error(`provider ${p}`),O=new Error("provider with name already exists"),S=new Error("bad payload"),b=new Error("subscription rejected"),P=new Error(`channel ${p}`),R;function I(){if(R)return R;throw P}function K(){return R}function Sn(n){R=n}var v,x,tn,on;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(v||(v={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}(x||(x={})),function(n){n.UserAction="user-action",n.FocusChange="focus-change",n.Reload="reload"}(tn||(tn={})),function(n){n.Active="active",n.Default="default"}(on||(on={}));let G="0",Rn="1",En="2",bn="3",Pn="4",j="5",X="6",zn=()=>{},rn=new Set;function Jn(n){rn.add(n)}function Qn(n){rn.delete(n)}let sn=new Set;function Yn(n){sn.add(n)}function Zn(n){sn.delete(n)}let q=new Map;async function an(n){q.set(n.id,n);let e=[...rn].map(t=>t());await Promise.all(e)}async function z(n){q.delete(n);let e=[...sn].map(t=>t());await Promise.all(e)}function cn(){return[...q.values()]}function On(){q.clear()}function L(n){return q.get(n)}function An(n,e,t){return{...n,action:t||{...n.actions[0],trigger:tn.UserAction},dispatcherIdentity:e}}function ln(n,e,t="ascending"){let i=n||[];if(!e?.length)return i;let r=[],s=new Map;e.forEach(u=>{if(u.key)return s.set(u.key,u);r.push(u)});let c=i.map(u=>{let{key:h}=u;if(h&&s.has(h)){let C=s.get(h);return s.delete(h),C}return u});return c.push(...s.values(),...r),c=t==="ascending"?c.sort((u,h)=>(u?.score??1/0)-(h?.score??1/0)):c.sort((u,h)=>(h?.score??1/0)-(u?.score??1/0)),c}function In(n){let e={},t=[],i=[],r=null,s=v.Initial;e.getStatus=()=>s,e.getResultBuffer=()=>t,e.setResultBuffer=u=>{t=u,t?.length&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=u=>{i=u,i?.length&&e.onChange()},e.setUpdatedContext=u=>{r=u,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=zn;let c={};return e.res=c,c.close=()=>{s!==v.Close&&(s=v.Close,e.onChange())},c.open=()=>{s!==v.Open&&(s=v.Open,e.onChange())},c.respond=u=>{let h=ln(e.getResultBuffer(),u,n);e.setResultBuffer(h)},c.revoke=(...u)=>{let h=new Set(u),C=e.getResultBuffer().filter(({key:f})=>{let g=h.has(f);return g&&h.delete(f),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(f=>h.add(f)),e.setRevokedBuffer([...h]))},c.updateContext=u=>{e.setUpdatedContext(u)},e}function Ln(n,e){let t=new Set,i=!1;return{close:()=>{i=!0;for(let r of t)r()},req:{id:n,...e,context:e?.context||{},onClose:r=>{t.add(r),i&&r()},removeListener:r=>{t.delete(r)}}}}function J(){return{name:fin.me.name,uuid:fin.me.uuid}}let Nn=50,ne=1e3,ee=new Map;function un(){return ee}let te=100;function oe(){return async n=>{if(!n||!n.id||!n.providerId){let f=S;return console.error(f),{error:f.message}}let{id:e,providerId:t}=n,i=L(t);if(!i){let f=y;return console.error(f),{error:f.message}}let r=un(),s=r.get(n.id);s||(s=Ln(e,n),r.set(n.id,s));let c=In(),u=()=>{let f=c.getResultBuffer();c.setResultBuffer([]);let g=c.getRevokedBuffer();c.setRevokedBuffer([]);let N=c.getUpdatedContext();c.setUpdatedContext(null);let T=c.getStatus();(async function(D){(await I()).dispatch(G,D)})({id:e,providerId:t,results:f,revoked:g,status:T,context:N})},h=!0,C=!1;c.onChange=()=>{if(h)return h=!1,void u();C||(C=!0,setTimeout(()=>{C=!1,u()},te))};try{let{results:f,context:g}=await i.onUserInput(s.req,c.res),N=c.getStatus();return{id:e,providerId:t,status:N,results:f,context:g}}catch(f){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${t} for search ${e}`,"This is likely a bug in the implementation of the search provider.",f),{id:e,providerId:t,error:f?.message}}}}async function Fn(n,e){let t=e||await I(),i=J(),r={...n,identity:i,onResultDispatch:void 0},s=await t.dispatch(En,r);return await an({identity:i,...n}),s}async function ie(n){return await(await I()).dispatch(bn,n),z(n)}async function re(n,e,t,i){let r=An(e,i??J(),t),s=L(n);if(s){let{onResultDispatch:u}=s;return u?u(r):void 0}let c={providerId:n,result:r};return(await I()).dispatch(j,c)}async function se(n){let e={...n,context:n?.context||{}},t={},i=async function*(s,{setState:c}){let u=await I();for(;;){let h=await u.dispatch(Rn,s),C=h.error;if(C)throw new Error(C);let f=h;if(s.id=f.id,c(f.state),f.done)return f.value;yield f.value}}(e,{setState:s=>{t.state=s}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(s){(await I()).dispatch(X,{id:s})})(t.id)},t.next=()=>{if(r){let s=r;return r=void 0,s}return i.next()},t}async function ae(){return(await I()).dispatch(Pn,null)}async function ce(){let n=await I();R=void 0,On(),await n.disconnect()}let le=async n=>{let e=await $n(n);for(let t of cn())await Fn(t,e);return e};async function $n(n){let e=await async function(t){for(let i=0;i<Nn;i++)try{return await fin.InterApplicationBus.Channel.connect(t,{wait:!1})}catch(r){if(i===Nn-1)throw r;await new Promise(s=>setTimeout(s,ne))}}(n);return e.register(G,oe()),e.register(X,t=>{let i=un(),r=i.get(t.id);r&&(r.close(),i.delete(t.id))}),e.register(j,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(S);let r=L(t.providerId);if(!r)return void console.error(y);let{onResultDispatch:s}=r;return s?(t.result.dispatcherIdentity=t.result.dispatcherIdentity??i,s(t.result)):void 0}),e.onDisconnection(function(t){return async()=>{if(!K())return;let i=un();for(let{req:r,close:s}of i.values())s(),i.delete(r.id);Sn(le(t))}}(n)),e}async function ue(n){let e=K();e||(e=$n(n),Sn(e));let t=await e;return{getAllProviders:ae.bind(null),register:Fn.bind(null),search:se.bind(null),deregister:ie.bind(null),dispatch:re.bind(null),disconnect:ce.bind(null),channel:t}}let H;function Q(){if(H)return H;throw P}function de(){return H}function pe(n){H=n}function fe(){H=void 0}let dn=new Set;function he(n){dn.add(n)}function we(n){dn.delete(n)}var k;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})(k||(k={}));let pn=typeof window<"u"&&typeof fin<"u",ge=(typeof process>"u"||process.env,typeof window<"u"),ye=ge?window.origin:k.Local,Y=(pn&&fin.me.uuid,pn&&fin.me.name,pn&&fin.me.entityType,k.Local,k.Dev,k.Staging,k.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:ye+n),xn=(Y("http://localhost:4002"),Y("http://localhost:4002"),typeof WORKSPACE_DOCS_PLATFORM_URL<"u"&&Y(WORKSPACE_DOCS_PLATFORM_URL),typeof WORKSPACE_DOCS_CLIENT_URL<"u"&&Y(WORKSPACE_DOCS_CLIENT_URL),"20.3.6");typeof WORKSPACE_BUILD_SHA<"u"&&WORKSPACE_BUILD_SHA;async function kn(){return[...cn()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function me(n){if(L(n.id))throw new Error("provider with name already exists");let e=J();return await an({identity:e,...n}),{workspaceVersion:xn||"",clientAPIVersion:n.clientAPIVersion||""}}async function Ce(n){await z(n)}async function ve(n,e,t,i){let r=L(n);if(!r)throw y;let{onResultDispatch:s}=r;if(s)return s(An(e,i??J(),t))}async function*Se(n,e){let t=function(g,N){let T=[],D=[],B=[],E=[];for(let m of g){let F=In(m.scoreOrder),$={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};T.push($),D.push(F);let M=(async()=>{try{let{results:W,context:nn}=await m.onUserInput(N,F.res);$.results=ln($.results||[],W,m.scoreOrder),$.context={...$.context,...nn}}catch(W){$.error=W}})();M.finally(()=>{M.done=!0}),E.push(M),B.push(B.length)}return{providerResponses:T,listenerResponses:D,openListenerResponses:B,initialResponsePromises:E}}(n.targets?n.targets.map(g=>L(g)).filter(g=>!!g):[...cn().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:s,initialResponsePromises:c}=t,u=x.Fetching,h=g=>{u=g,e.setState(u)},C,f=!1;n.onClose(()=>{f=!0,C&&C()});do{let g=!1;if(c.length){let E=[];for(let m of c)m.done?g=!0:E.push(m);c=E,c.length||(h(x.Fetched),g=!0)}let N,T=!1,D=()=>{T=!0,N&&N()},B=[];for(let E of s){let m=r[E],F=i[E],$=m.getStatus();($===v.Open||u===x.Fetching&&$===v.Initial)&&(B.push(E),m.onChange=D);let M=m.getResultBuffer();M.length&&(m.setResultBuffer([]),F.results=ln(F.results||[],M),g=!0);let W=m.getRevokedBuffer();if(W.length){m.setRevokedBuffer([]);let Be=new Set(W);F.results=(F.results||[]).filter(({key:Me})=>!Be.has(Me)),g=!0}let nn=m.getUpdatedContext();nn&&(m.setUpdatedContext(null),F.context={...F.context,...nn},g=!0)}if(s=B,g&&(yield i),f)break;T||(s.length||c.length)&&await Promise.race([...c,new Promise(E=>{N=E}),new Promise(E=>{C=E})])}while(s.length||c.length);return h(x.Complete),i}let fn=0;async function Tn(n){fn+=1;let e=Ln(fn.toString(),n),t=Se(e.req,{setState:i=>{t.state=i}});return t.id=fn.toString(),t.close=e.close,t.state=x.Fetching,t}let Z=new Map,Re=1e4;function Ee(){return async n=>{if(!n)return console.error(S),{error:S.message};let e;if(n.id)e=n.id;else{let r=await Tn(n);e=r.id,n.id=r.id,Z.set(e,{generator:r})}let t=Z.get(e);clearTimeout(t.timeout);let i=await t.generator.next();return t.timeout=function(r){return window.setTimeout(()=>{Z.delete(r)},Re)}(e),{...i,id:n.id,state:t.generator.state}}}function be(n,e){return Q().dispatch(n,X,{id:e})}function Pe(){return n=>function(e){let t=Z.get(e);t&&t.generator.close()}(n.id)}async function Oe(n,{id:e,query:t,context:i,targets:r=[]}){let s=Q(),c={id:e,query:t,context:i,targets:r,providerId:n.id},u=await s.dispatch(n.identity,G,c),h=u.error;if(h)throw new Error(h);return u}let hn=new Map;function Ae(n,e){return`${n.name}:${n.uuid}:${e}`}let wn=new Map;function _n(n,e){return`${n}:${e}`}function Ie(n){let e=Ae.bind(null,n.identity),t=be.bind(null,n.identity),i=Oe.bind(null,n);return async(r,s)=>{let c=e(r.id);if(!hn.has(c)){let f=()=>{t(r.id),hn.delete(c)};hn.set(c,f),r.onClose(f)}let u=_n(n.id,r.id),h=()=>{wn.delete(u),s.close()};r.onClose(h),wn.set(u,f=>{f.results?.length&&s.respond(f.results),f.revoked?.length&&s.revoke(...f.revoked),f.context&&s.updateContext(f.context),f.status===v.Open&&s.open(),f.status===v.Close&&h()});let C=await i(r);return C.status===v.Open&&s.open(),C.status!==v.Close&&C.status!==v.Initial||h(),C}}function Le(n){return async e=>{let t=Q(),i={providerId:n.id,result:e};return t.dispatch(n.identity,j,i)}}let U=new Map;function gn(n){return`${n.name}-${n.uuid}`}function Ne(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(S);if(L(n.id))throw O;return n.identity=e,await async function(t){let i=gn(t.identity);U.has(i)||U.set(i,[]),U.get(i).push(t.id),await an({...t,onUserInput:Ie(t),onResultDispatch:Le(t)})}(n),{workspaceVersion:xn||"",clientAPIVersion:n.clientAPIVersion||""}}}function Fe(){return(n,e)=>{n?function(t,i){let r=L(t);if(!r)return;if(r.identity.uuid!==i.uuid||r.identity.name!==i.name)throw y;let s=gn(r.identity),c=U.get(s);if(c){let u=c.findIndex(h=>h===t);u!==-1&&(c.splice(u,1),z(t))}}(n,e):console.error(S)}}let yn=new Set;function $e(n){yn.add(n)}function xe(n){yn.delete(n)}function ke(){return async n=>{(function(e){let t=gn(e),i=U.get(t);if(i){for(let r of i)z(r);U.delete(t)}})(n),yn.forEach(e=>e(n))}}async function Te(n){let e=await(t=n,fin.InterApplicationBus.Channel.create(t));var t;return e.onConnection(async i=>{for(let r of dn)if(!await r(i))throw b}),e.onDisconnection(ke()),e.register(X,Pe()),e.register(G,i=>{let r=_n(i.providerId,i.id),s=wn.get(r);s&&s(i)}),e.register(En,Ne()),e.register(bn,Fe()),e.register(Pn,async()=>kn()),e.register(Rn,Ee()),e.register(j,async(i,r)=>{if(!i||!i.providerId||!i.result)return void console.error(S);let s=L(i.providerId);if(!s)throw y;let{onResultDispatch:c}=s;return c?(i.result.dispatcherIdentity=i.result.dispatcherIdentity??r,c(i.result)):void 0}),e}async function _e(){let n=Q();fe(),await n.destroy(),On()}async function Ue(n){let e=de();e||(e=await Te(n),pe(e));let t=we.bind(null),i=xe.bind(null),r=Qn.bind(null),s=Zn.bind(null);return{getAllProviders:kn.bind(null),search:Tn.bind(null),register:me.bind(null),deregister:Ce.bind(null),onSubscription:he.bind(null),onDisconnect:$e.bind(null),onRegister:Jn.bind(null),onDeregister:Yn.bind(null),dispatch:ve.bind(null),disconnect:_e.bind(null),removeListener:c=>{t(c),i(c),r(c),s(c)},channel:e}}let{v:Un}=d,{B:Dn}=a,Bn="all",De={create:Un,subscribe:Dn,defaultTopic:Bn},Mn=()=>{window.search=De},Wn=n=>{let e=()=>{Mn(),window.removeEventListener(n,e)};return e};if(typeof window<"u"){Mn();let n="load",e=Wn(n);window.addEventListener(n,e);let t="DOMContentLoaded",i=Wn(t);window.addEventListener(t,i)}qn.exports=l})()});var w="@openfin/cloud-api";async function A(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function Vn(o){if(o.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(o.name)?o.name.split("/")[0]||"":o.name}var V="@openfin/cloud-api";function Je(){return`${window.fin.me.uuid}-cloud-api-notifications`}var Cn=null;async function gt(){return Cn||(Cn=Qe()),Cn}async function Qe(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Vn(window.fin.me);let o=await Ye();console.log(o),o.register("openfin-cloud-event",a=>{for(let d of l.get(a.type)??[])typeof a.payload.timestamp=="string"&&(a.payload.timestamp=new Date(a.payload.timestamp)),d(a.payload)});let l=new Map;return{addEventListener:(a,d)=>{let p=l.get(a)||new Set;p.add(d),l.set(a,p)},removeEventListener:(a,d)=>{let p=l.get(a);if(!p){console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,a);return}p.delete(d)===!1&&console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,a)},update:async a=>(await o.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:a}})).payload.response,clear:async a=>(await o.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:a}})).payload.response,createNotification:async a=>(a.id&&console.warn(`\`${V}\`: The \`id\` property is not supported and will be ignored. If you need to use the \`id\` property, you should use the \`id\` property of the returned notification object.`),(await o.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...a,id:void 0}}})).payload.response)}}var en=null;async function Ye(){return en||(en=Ze()),en}async function Ze(){let o=await window.fin.InterApplicationBus.Channel.connect(Je());return o.onDisconnection(l=>{console.warn(`\`${V}\`: Channel Disconnected from`,l,"Reconnecting..."),en=null}),o}var vn;function nt(){return`${window.fin.me.uuid}-client-api`}async function _(){return vn||(vn=window.fin.InterApplicationBus.Channel.connect(nt())),vn}async function Ct(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-settings")}async function vt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-settings")}async function St(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("set-user-settings",o)}async function Rt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-permissions")}async function Et(o,l){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let a=await _();try{await a.dispatch("launch-content",{id:o,options:l})}catch(d){switch(d instanceof Error?d.message:String(d)){case"UnableToLookup":throw new Error(`${w}: \`launchContent\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchContent\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchContent\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchContent\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function bt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let l=await _();try{await l.dispatch("launch-supertab",{id:o})}catch(a){switch(a instanceof Error?a.message:String(a)){case"UnableToLookup":throw new Error(`${w}: \`launchSupertab\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchSupertab\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchSupertab\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchSupertab\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function Pt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let l=await _();try{await l.dispatch("launch-workspace",{id:o})}catch(a){switch(a instanceof Error?a.message:String(a)){case"UnableToLookup":throw new Error(`${w}: \`launchWorkspace\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchWorkspace\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchWorkspace\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchWorkspace\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}var Xn={};je(Xn,{register:()=>jn});var Gn=ze(Hn(),1),et="log-message-",tt="open-url",ot="provider-status-",it="registered-",rt="1.0";function st(o,l){let{data:a,...d}=o;return{...d,data:{customData:a,providerId:l,resultType:"app"}}}function Kn(o){return{...o,data:o.data.customData}}function at(){return`${window.fin.me.identity.uuid}-cloud-api-search`}async function ct(o,l,a,d=!0){await l("info",`Setting status as ${d?"ready":"not ready"}`);try{await o.dispatch(`${ot}${a}`,{isReady:d})}catch(p){let y=["Error setting provider status",p];console.error(...y),l("error",...y)}}async function lt(o,l,a,...d){try{await o.dispatch(`${et}${l}`,{level:a,message:d})}catch(p){console.error("Error logging message",p)}}async function ut(o,l,a,d,p){let{action:y,dispatcherIdentity:O,...S}=p;await a("info","Handling action",{action:y,dispatcherIdentity:O,result:S});let b;try{let R=Kn(p).actions?.find(({name:K})=>K===y.name);if(!R)throw new Error("Original action not found in search result");b=(await d(R,Kn(p)))?.url}catch(P){throw await a("error","Error handling dispatch",P),P}if(!b){await a("warn","OnActionListener did not return a URL");return}await pt(o,a,l.id,b,O)}async function dt(o,l,a,d){await l("info","Getting search results",{request:d});try{let p=new AbortController;d.onClose(()=>p.abort());let{context:y,query:O}=d,{results:S}=await a({context:y,query:O,signal:p.signal}),b=S.map(P=>st(P,o.id));return await l("info","Returning results",b),{results:b}}catch(p){let y=["Error handling search",p];throw console.error(...y),l("error",...y),p}}async function pt(o,l,a,d,p){await l("info","Opening URL",{url:d,targetIdentity:p});try{await o.dispatch(tt,{url:d,targetIdentity:p,providerId:a})}catch(y){let O=["Error opening URL",y];console.error(...O),l("error",...O)}}async function jn(o){let a=(await window.fin.me.getOptions()).customData,{configData:d,id:p,title:y}=a,{onAction:O,onSearch:S}=o,b=await Gn.subscribe(at()),P=b.channel,R=lt.bind(null,P,p);return await b.register({icon:"",id:p,onResultDispatch:ut.bind(null,P,a,R,O),onUserInput:dt.bind(null,a,R,S),title:y}),await b.channel.dispatch(`${it}${p}`,{version:rt}),R("info","Registered search topic",{id:p,title:y}),{customData:d,isReady:ct.bind(null,P,R,p)}}export{Xn as Search,Ct as getAppSettings,Rt as getAppUserPermissions,vt as getAppUserSettings,gt as getNotificationsClient,Et as launchContent,bt as launchSupertab,Pt as launchWorkspace,St as setAppUserSettings};
1
+ var t="@openfin/cloud-api";async function a(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function u(n){if(n.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(n.name)?n.name.split("/")[0]||"":n.name}var r="@openfin/cloud-api";function d(){return`${window.fin.me.uuid}-cloud-api-notifications`}var l=null;async function g(){return l||(l=w()),l}async function w(){if(!window.fin)throw new Error(`\`${r}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${r}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);u(window.fin.me);let n=await h();console.log(n),n.register("openfin-cloud-event",e=>{for(let o of i.get(e.type)??[])typeof e.payload.timestamp=="string"&&(e.payload.timestamp=new Date(e.payload.timestamp)),o(e.payload)});let i=new Map;return{addEventListener:(e,o)=>{let s=i.get(e)||new Set;s.add(o),i.set(e,s)},removeEventListener:(e,o)=>{let s=i.get(e);if(!s){console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,e);return}s.delete(o)===!1&&console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,e)},update:async e=>(await n.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:e}})).payload.response,clear:async e=>(await n.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:e}})).payload.response,createNotification:async e=>(e.id&&console.warn(`\`${r}\`: The \`id\` property is not supported and will be ignored. If you need to use the \`id\` property, you should use the \`id\` property of the returned notification object.`),(await n.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...e,id:void 0}}})).payload.response)}}var p=null;async function h(){return p||(p=m()),p}async function m(){let n=await window.fin.InterApplicationBus.Channel.connect(d());return n.onDisconnection(i=>{console.warn(`\`${r}\`: Channel Disconnected from`,i,"Reconnecting..."),p=null}),n}var f;function y(){return`${window.fin.me.uuid}-client-api`}async function c(){return f||(f=window.fin.InterApplicationBus.Channel.connect(y())),f}async function A(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-settings")}async function v(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-settings")}async function P(n){if(!window.fin)throw new Error(`\`${t}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("set-user-settings",n)}async function $(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-permissions")}async function T(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let i=await c();try{await i.dispatch("launch-content",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchContent\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchContent\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchContent\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchContent\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}export{A as getAppSettings,$ as getAppUserPermissions,v as getAppUserSettings,g as getNotificationsClient,T as launchContent,P as setAppUserSettings};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../node_modules/@openfin/search-api/index.js","../src/utils.ts","../src/notifications.ts","../src/client-api.ts","../src/search/index.ts","../src/search/search.ts"],"sourcesContent":["(()=>{\"use strict\";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})}},t={};e.r(t),e.d(t,{SearchTagBackground:()=>y,create:()=>Je,defaultTopic:()=>Qe,subscribe:()=>Ge});var n={};e.r(n),e.d(n,{B:()=>oe});var o={};e.r(o),e.d(o,{v:()=>ze});const r=\"deregistered or does not exist\",i=new Error(`provider ${r}`),s=new Error(\"provider with name already exists\"),c=new Error(\"bad payload\"),a=new Error(\"subscription rejected\"),u=new Error(`channel ${r}`);let d;function l(){if(d)return d;throw u}function f(){return d}function p(e){d=e}var h,g,w,y;!function(e){e[e.Initial=0]=\"Initial\",e[e.Open=1]=\"Open\",e[e.Close=2]=\"Close\"}(h||(h={})),function(e){e.Fetching=\"fetching\",e.Fetched=\"fetched\",e.Complete=\"complete\"}(g||(g={})),function(e){e.UserAction=\"user-action\",e.FocusChange=\"focus-change\",e.Reload=\"reload\"}(w||(w={})),function(e){e.Active=\"active\",e.Default=\"default\"}(y||(y={}));const v=\"0\",m=\"1\",R=\"2\",C=\"3\",b=\"4\",S=\"5\",I=\"6\",x=()=>{},O=new Set;function P(e){O.add(e)}function B(e){O.delete(e)}const E=new Set;function k(e){E.add(e)}function A(e){E.delete(e)}const D=new Map;async function L(e){D.set(e.id,e);const t=[...O].map((e=>e()));await Promise.all(t)}async function U(e){D.delete(e);const t=[...E].map((e=>e()));await Promise.all(t)}function _(){return[...D.values()]}function T(){D.clear()}function F(e){return D.get(e)}function M(e,t,n){return{...e,action:n||{...e.actions[0],trigger:w.UserAction},dispatcherIdentity:t}}function $(e,t,n=\"ascending\"){const o=e||[];if(!t?.length)return o;const r=[],i=new Map;t.forEach((e=>{if(e.key)return i.set(e.key,e);r.push(e)}));let s=o.map((e=>{const{key:t}=e;if(t&&i.has(t)){const e=i.get(t);return i.delete(t),e}return e}));return s.push(...i.values(),...r),s=\"ascending\"===n?s.sort(((e,t)=>(e?.score??1/0)-(t?.score??1/0))):s.sort(((e,t)=>(t?.score??1/0)-(e?.score??1/0))),s}function W(e){const t={};let n=[];let o=[];let r=null;let i=h.Initial;t.getStatus=()=>i,t.getResultBuffer=()=>n,t.setResultBuffer=e=>{n=e,n?.length&&t.onChange()},t.getRevokedBuffer=()=>o,t.setRevokedBuffer=e=>{o=e,o?.length&&t.onChange()},t.setUpdatedContext=e=>{r=e,t.onChange()},t.getUpdatedContext=()=>r,t.onChange=x;const s={};return t.res=s,s.close=()=>{i!==h.Close&&(i=h.Close,t.onChange())},s.open=()=>{i!==h.Open&&(i=h.Open,t.onChange())},s.respond=n=>{const o=$(t.getResultBuffer(),n,e);t.setResultBuffer(o)},s.revoke=(...e)=>{const n=new Set(e),o=t.getResultBuffer().filter((({key:e})=>{const t=n.has(e);return t&&n.delete(e),!t}));t.setResultBuffer(o),n.size&&(t.getRevokedBuffer().forEach((e=>n.add(e))),t.setRevokedBuffer([...n]))},s.updateContext=e=>{t.setUpdatedContext(e)},t}function q(e,t){const n=new Set;let o=!1;return{close:()=>{o=!0;for(const e of n)e()},req:{id:e,...t,context:t?.context||{},onClose:e=>{n.add(e),o&&e()},removeListener:e=>{n.delete(e)}}}}function K(){return{name:fin.me.name,uuid:fin.me.uuid}}const V=50,j=1e3;const H=new Map;function N(){return H}const z=100;function J(){return async e=>{if(!e||!e.id||!e.providerId){const e=c;return console.error(e),{error:e.message}}const{id:t,providerId:n}=e,o=F(n);if(!o){const e=i;return console.error(e),{error:e.message}}const r=N();let s=r.get(e.id);s||(s=q(t,e),r.set(e.id,s));const a=W(),u=()=>{const e=a.getResultBuffer();a.setResultBuffer([]);const o=a.getRevokedBuffer();a.setRevokedBuffer([]);const r=a.getUpdatedContext();a.setUpdatedContext(null);const i=a.getStatus();!async function(e){(await l()).dispatch(v,e)}({id:t,providerId:n,results:e,revoked:o,status:i,context:r})};let d=!0,f=!1;a.onChange=()=>{if(d)return d=!1,void u();f||(f=!0,setTimeout((()=>{f=!1,u()}),z))};try{const{results:e,context:r}=await o.onUserInput(s.req,a.res),i=a.getStatus();return{id:t,providerId:n,status:i,results:e,context:r}}catch(e){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${n} for search ${t}`,\"This is likely a bug in the implementation of the search provider.\",e),{id:t,providerId:n,error:e?.message}}}}async function G(e,t){const n=t||await l(),o=K(),r={...e,identity:o,onResultDispatch:void 0},i=await n.dispatch(R,r);return await L({identity:o,...e}),i}async function Q(e){const t=await l();return await t.dispatch(C,e),U(e)}async function X(e,t,n,o){const r=M(t,o??K(),n),i=F(e);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(r)}const s={providerId:e,result:r};return(await l()).dispatch(S,s)}async function Y(e){const t={...e,context:e?.context||{}},n={},o=async function*(e,{setState:t}){const n=await l();for(;;){const o=await n.dispatch(m,e),r=o.error;if(r)throw new Error(r);const i=o;if(e.id=i.id,t(i.state),i.done)return i.value;yield i.value}}(t,{setState:e=>{n.state=e}});let r=await o.next();return n.id=t.id||\"\",n.close=()=>{!async function(e){(await l()).dispatch(I,{id:e})}(n.id)},n.next=()=>{if(r){const e=r;return r=void 0,e}return o.next()},n}async function Z(){return(await l()).dispatch(b,null)}async function ee(){const e=await l();d=void 0,T(),await e.disconnect()}const te=async e=>{const t=await ne(e);for(const e of _())await G(e,t);return t};async function ne(e){const t=await async function(e){for(let t=0;t<V;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(e){if(t===V-1)throw e;await new Promise((e=>setTimeout(e,j)))}}(e);return t.register(v,J()),t.register(I,(e=>{const t=N(),n=t.get(e.id);n&&(n.close(),t.delete(e.id))})),t.register(S,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=F(e.providerId);if(!n)return void console.error(i);const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),t.onDisconnection(function(e){return async()=>{if(!f())return;const t=N();for(const{req:e,close:n}of t.values())n(),t.delete(e.id);p(te(e))}}(e)),t}async function oe(e){let t=f();t||(t=ne(e),p(t));const n=await t;return{getAllProviders:Z.bind(null),register:G.bind(null),search:Y.bind(null),deregister:Q.bind(null),dispatch:X.bind(null),disconnect:ee.bind(null),channel:n}}let re;function ie(){if(re)return re;throw u}function se(){return re}function ce(e){re=e}function ae(){re=void 0}const ue=new Set;function de(e){ue.add(e)}function le(e){ue.delete(e)}var fe;!function(e){e.Local=\"local\",e.Dev=\"dev\",e.Staging=\"staging\",e.Prod=\"prod\"}(fe||(fe={}));const pe=\"undefined\"!=typeof window&&\"undefined\"!=typeof fin,he=(\"undefined\"==typeof process||process.env,\"undefined\"!=typeof window),ge=he?window.origin:fe.Local,we=(pe&&fin.me.uuid,pe&&fin.me.name,pe&&fin.me.entityType,fe.Local,fe.Dev,fe.Staging,fe.Prod,e=>e.startsWith(\"http://\")||e.startsWith(\"https://\")?e:ge+e),ye=(we(\"http://localhost:4002\"),we(\"http://localhost:4002\"),\"undefined\"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&we(WORKSPACE_DOCS_PLATFORM_URL),\"undefined\"!=typeof WORKSPACE_DOCS_CLIENT_URL&&we(WORKSPACE_DOCS_CLIENT_URL),\"20.3.6\");\"undefined\"!=typeof WORKSPACE_BUILD_SHA&&WORKSPACE_BUILD_SHA;async function ve(){return[..._()].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function me(e){if(F(e.id))throw new Error(\"provider with name already exists\");const t=K();return await L({identity:t,...e}),{workspaceVersion:ye||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}async function Re(e){await U(e)}async function Ce(e,t,n,o){const r=F(e);if(!r)throw i;const{onResultDispatch:s}=r;if(!s)return;return s(M(t,o??K(),n))}async function*be(e,t){const n=function(e,t){const n=[],o=[],r=[],i=[];for(const s of e){const e=W(s.scoreOrder),c={results:[],provider:{id:s.id,identity:s.identity,title:s.title,scoreOrder:s.scoreOrder,icon:s.icon,dispatchFocusEvents:s.dispatchFocusEvents}};n.push(c),o.push(e);const a=(async()=>{try{const{results:n,context:o}=await s.onUserInput(t,e.res);c.results=$(c.results||[],n,s.scoreOrder),c.context={...c.context,...o}}catch(e){c.error=e}})();a.finally((()=>{a.done=!0})),i.push(a),r.push(r.length)}return{providerResponses:n,listenerResponses:o,openListenerResponses:r,initialResponsePromises:i}}(e.targets?e.targets.map((e=>F(e))).filter((e=>!!e)):[..._().filter((e=>!e.hidden))],e),{providerResponses:o,listenerResponses:r}=n;let{openListenerResponses:i,initialResponsePromises:s}=n,c=g.Fetching;const a=e=>{c=e,t.setState(c)};let u,d=!1;e.onClose((()=>{d=!0,u&&u()}));do{let e=!1;if(s.length){const t=[];for(const n of s)n.done?e=!0:t.push(n);s=t,s.length||(a(g.Fetched),e=!0)}let t,n=!1;const l=()=>{n=!0,t&&t()},f=[];for(const t of i){const n=r[t],i=o[t],s=n.getStatus();(s===h.Open||c===g.Fetching&&s===h.Initial)&&(f.push(t),n.onChange=l);const a=n.getResultBuffer();a.length&&(n.setResultBuffer([]),i.results=$(i.results||[],a),e=!0);const u=n.getRevokedBuffer();if(u.length){n.setRevokedBuffer([]);const t=new Set(u);i.results=(i.results||[]).filter((({key:e})=>!t.has(e))),e=!0}const d=n.getUpdatedContext();d&&(n.setUpdatedContext(null),i.context={...i.context,...d},e=!0)}if(i=f,e&&(yield o),d)break;n||(i.length||s.length)&&await Promise.race([...s,new Promise((e=>{t=e})),new Promise((e=>{u=e}))])}while(i.length||s.length);return a(g.Complete),o}let Se=0;async function Ie(e){Se+=1;const t=q(Se.toString(),e),n=be(t.req,{setState:e=>{n.state=e}});return n.id=Se.toString(),n.close=t.close,n.state=g.Fetching,n}const xe=new Map,Oe=1e4;function Pe(){return async e=>{if(!e)return console.error(c),{error:c.message};let t;if(e.id)t=e.id;else{const n=await Ie(e);t=n.id,e.id=n.id,xe.set(t,{generator:n})}const n=xe.get(t);clearTimeout(n.timeout);const o=await n.generator.next();return n.timeout=function(e){return window.setTimeout((()=>{xe.delete(e)}),Oe)}(t),{...o,id:e.id,state:n.generator.state}}}function Be(e,t){return ie().dispatch(e,I,{id:t})}function Ee(){return e=>function(e){const t=xe.get(e);t&&t.generator.close()}(e.id)}async function ke(e,{id:t,query:n,context:o,targets:r=[]}){const i=ie(),s={id:t,query:n,context:o,targets:r,providerId:e.id},c=await i.dispatch(e.identity,v,s),a=c.error;if(a)throw new Error(a);return c}const Ae=new Map;function De(e,t){return`${e.name}:${e.uuid}:${t}`}const Le=new Map;function Ue(e,t){return`${e}:${t}`}function _e(e){const t=De.bind(null,e.identity),n=Be.bind(null,e.identity),o=ke.bind(null,e);return async(r,i)=>{const s=t(r.id);if(!Ae.has(s)){const e=()=>{n(r.id),Ae.delete(s)};Ae.set(s,e),r.onClose(e)}const c=Ue(e.id,r.id),a=()=>{Le.delete(c),i.close()};r.onClose(a),Le.set(c,(e=>{e.results?.length&&i.respond(e.results),e.revoked?.length&&i.revoke(...e.revoked),e.context&&i.updateContext(e.context),e.status===h.Open&&i.open(),e.status===h.Close&&a()}));const u=await o(r);return u.status===h.Open&&i.open(),u.status!==h.Close&&u.status!==h.Initial||a(),u}}function Te(e){return async t=>{const n=ie(),o={providerId:e.id,result:t};return n.dispatch(e.identity,S,o)}}const Fe=new Map;function Me(e){return`${e.name}-${e.uuid}`}function $e(){return async(e,t)=>{if(!e||!e.id)return console.error(new Error(JSON.stringify(e))),void console.error(c);if(F(e.id))throw s;return e.identity=t,await async function(e){const t=Me(e.identity);Fe.has(t)||Fe.set(t,[]),Fe.get(t).push(e.id),await L({...e,onUserInput:_e(e),onResultDispatch:Te(e)})}(e),{workspaceVersion:ye||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}}function We(){return(e,t)=>{e?function(e,t){const n=F(e);if(!n)return;if(n.identity.uuid!==t.uuid||n.identity.name!==t.name)throw i;const o=Me(n.identity),r=Fe.get(o);if(r){const t=r.findIndex((t=>t===e));-1!==t&&(r.splice(t,1),U(e))}}(e,t):console.error(c)}}const qe=new Set;function Ke(e){qe.add(e)}function Ve(e){qe.delete(e)}function je(){return async e=>{!function(e){const t=Me(e),n=Fe.get(t);if(n){for(const e of n)U(e);Fe.delete(t)}}(e),qe.forEach((t=>t(e)))}}async function He(e){const t=await(n=e,fin.InterApplicationBus.Channel.create(n));var n;return t.onConnection((async e=>{for(const t of ue)if(!await t(e))throw a})),t.onDisconnection(je()),t.register(I,Ee()),t.register(v,(e=>{const t=Ue(e.providerId,e.id),n=Le.get(t);n&&n(e)})),t.register(R,$e()),t.register(C,We()),t.register(b,(async()=>ve())),t.register(m,Pe()),t.register(S,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=F(e.providerId);if(!n)throw i;const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),t}async function Ne(){const e=ie();ae(),await e.destroy(),T()}async function ze(e){let t=se();t||(t=await He(e),ce(t));const n=le.bind(null),o=Ve.bind(null),r=B.bind(null),i=A.bind(null);return{getAllProviders:ve.bind(null),search:Ie.bind(null),register:me.bind(null),deregister:Re.bind(null),onSubscription:de.bind(null),onDisconnect:Ke.bind(null),onRegister:P.bind(null),onDeregister:k.bind(null),dispatch:Ce.bind(null),disconnect:Ne.bind(null),removeListener:e=>{n(e),o(e),r(e),i(e)},channel:t}}const{v:Je}=o,{B:Ge}=n,Qe=\"all\",Xe={create:Je,subscribe:Ge,defaultTopic:Qe},Ye=()=>{window.search=Xe},Ze=e=>{const t=()=>{Ye(),window.removeEventListener(e,t)};return t};if(\"undefined\"!=typeof window){Ye();const e=\"load\",t=Ze(e);window.addEventListener(e,t);const n=\"DOMContentLoaded\",o=Ze(n);window.addEventListener(n,o)}module.exports=t})();\n//# sourceMappingURL=index.js.map","import type OpenFin from '@openfin/core';\n\nexport const PACKAGE_NAME = '@openfin/cloud-api';\n\nexport async function isInViewContext(): Promise<boolean> {\n try {\n await window.fin.View.getCurrentSync().getInfo();\n return true;\n } catch {\n return false;\n }\n}\n\nexport function extractAppUuidFromIdentity(identity: OpenFin.Identity): string {\n if (identity.name.startsWith('internal-generated')) {\n throw new Error('Cannot extract app UUID from identity');\n }\n // <uuid>/<name>\n if (/\\/[\\d,a-z-]{36}$/.test(identity.name)) {\n return identity.name.split('/')[0] || '';\n }\n\n return identity.name;\n}\n","// eslint-disable-next-line check-file/no-index\nimport type * as NotificationsTypes from '@openfin/workspace/notifications';\n\nimport type { FlannelChannelClient, NotificationEventsMap, NotificationsClient } from './types';\nimport { extractAppUuidFromIdentity, isInViewContext } from './utils';\n\nconst PACKAGE_NAME = '@openfin/cloud-api';\n\nexport type {\n FlannelChannelProvider as __INTERNAL_FlannelChannelProvider,\n FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest,\n FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse,\n FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest,\n FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse,\n FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest,\n FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse,\n} from './types';\n\nfunction getChannelName() {\n return `${window.fin.me.uuid}-cloud-api-notifications`;\n}\n\nlet notificationsClientPromise: Promise<NotificationsClient> | null = null;\n\n/**\n * @returns A client for interacting with the OpenFin Notifications service\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the app UUID cannot be extracted from the current context\n *\n * @example **Basic Usage** Creating a notification, updating it and then clearing it\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * const notification = await notificationsClient.createNotification({\n * title: 'Hello, World!',\n * body: 'This is a notification from the OpenFin Cloud API',\n * });\n *\n * // Use the `id` from the returned notification to interact with it\n * console.log(notification.id);\n *\n * // Update the notification\n * await notificationsClient.update({\n * id: notification.id,\n * body: 'This is a notification from the OpenFin Cloud API, that has been updated!',\n * })\n *\n * // Clear the notification\n * await notificationsClient.clear(notification.id);\n * ```\n *\n * @example **Advanced Usage** Listening for events\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * // create the notification\n * const notification = await notificationsClient.createNotification({\n * title: `${window.fin.me.identity.name} Hello, World!`,\n * body: `This is a notification from the cloud API example created at ${new Date().toLocaleTimeString()}`,\n * buttons: [\n * {\n * title: 'Acknowledge',\n * },\n * ],\n * });\n *\n * notificationsClient.addEventListener('notification-action', (event) => {\n * console.log('Notification action:', event);\n * });\n * ```\n */\nasync function getNotificationsClient(): Promise<NotificationsClient> {\n if (!notificationsClientPromise) {\n notificationsClientPromise = getNotificationsClientInternal();\n }\n\n return notificationsClientPromise;\n}\n\nasync function getNotificationsClientInternal(): Promise<NotificationsClient> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n extractAppUuidFromIdentity(window.fin.me);\n\n const channelPromise = await getChannelClient();\n console.log(channelPromise);\n\n channelPromise.register('openfin-cloud-event', (message) => {\n for (const listener of eventListeners.get(message.type) ?? []) {\n // `Date` is serialized as a string, so we need to convert it back\n if (typeof message.payload.timestamp === 'string') {\n message.payload.timestamp = new Date(message.payload.timestamp);\n }\n\n listener(message.payload as never);\n }\n });\n\n const eventListeners = new Map<keyof NotificationEventsMap, Set<NotificationEventsMap[keyof NotificationEventsMap]>>();\n\n return {\n addEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName) || new Set();\n listeners.add(listener);\n eventListeners.set(eventName, listeners);\n },\n removeEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName);\n if (!listeners) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,\n eventName,\n );\n return;\n }\n\n if (listeners.delete(listener as (args: unknown) => void) === false) {\n console.warn(`\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference?`, eventName);\n }\n },\n update: async (options: Parameters<typeof NotificationsTypes.update>[0]): ReturnType<typeof NotificationsTypes.update> => {\n const response = await channelPromise.dispatch('openfin-cloud-update-notification', {\n version: 1,\n payload: {\n notification: options,\n },\n });\n return response.payload.response;\n },\n clear: async (notificationId: Parameters<typeof NotificationsTypes.clear>[0]): ReturnType<typeof NotificationsTypes.clear> => {\n const response = await channelPromise.dispatch('openfin-cloud-clear-notification', {\n version: 1,\n payload: {\n notificationId,\n },\n });\n return response.payload.response;\n },\n createNotification: async (\n options: NotificationsTypes.NotificationOptions,\n ): Promise<NotificationsTypes.Notification<NotificationsTypes.NotificationOptions>> => {\n if (options.id) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: The \\`id\\` property is not supported and will be ignored. If you need to use the \\`id\\` property, you should use the \\`id\\` property of the returned notification object.`,\n );\n }\n const response = await channelPromise.dispatch('openfin-cloud-create-notification', {\n version: 1,\n payload: {\n notification: { ...options, id: undefined },\n },\n });\n return response.payload.response;\n },\n };\n}\n\nlet channelClientPromise: Promise<FlannelChannelClient> | null = null;\n\nasync function getChannelClient(): Promise<FlannelChannelClient> {\n if (!channelClientPromise) {\n channelClientPromise = getChannelClientInternal();\n }\n\n return channelClientPromise;\n}\n\nasync function getChannelClientInternal(): Promise<FlannelChannelClient> {\n const channel = (await window.fin.InterApplicationBus.Channel.connect(getChannelName())) as FlannelChannelClient;\n\n channel.onDisconnection((identity) => {\n console.warn(`\\`${PACKAGE_NAME}\\`: Channel Disconnected from`, identity, 'Reconnecting...');\n channelClientPromise = null;\n });\n\n return channel;\n}\n\nexport { getNotificationsClient };\n","import type OpenFin from '@openfin/core';\n\nimport { isInViewContext, PACKAGE_NAME } from './utils';\n\nlet apiChannelClientPromise: Promise<OpenFin.ChannelClient>;\n\n/**\n * Represents a collection of returned app permissions\n */\nexport type AppPermissions = {\n permissions: {\n /**\n * The name of the permission\n */\n name: string;\n /**\n * The ID of the permission\n */\n id: string;\n }[];\n};\n\nfunction getApiChannelName() {\n return `${window.fin.me.uuid}-client-api`;\n}\n\nasync function getApiChannelClient(): Promise<OpenFin.ChannelClient> {\n if (!apiChannelClientPromise) {\n apiChannelClientPromise = window.fin.InterApplicationBus.Channel.connect(getApiChannelName());\n }\n\n return apiChannelClientPromise;\n}\n\n/**\n * @returns The app settings that have been set against the current app\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-settings');\n}\n\n/**\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-settings');\n}\n\n/**\n * Assigns a set of user specific settings to the current app\n *\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function setAppUserSettings(settings: unknown): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('set-user-settings', settings);\n}\n\n/**\n * @returns The permissions that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserPermissions(): Promise<AppPermissions> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-permissions');\n}\n\nexport type LaunchContentOptions = {\n /** Object containing query param values to be appended to content's URL */\n queryParams?: Record<string, string>;\n /** Defines behavior when instance of content is already running.\n * If 'multi', copy of the content will be created.\n * If 'single', the existing instance of content will be focused. */\n instanceMode?: 'single' | 'multi';\n} & (\n | {\n targetType?: 'new-window';\n /** Defines the bounds of the window in which content will open */\n bounds?: Partial<OpenFin.Bounds>;\n }\n | {\n targetType: 'window' | 'view';\n targetIdentity: OpenFin.Identity;\n }\n);\n/**\n * A function allowing the easy launching of content\n * @param id The id of the content to launch\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the content\n * @throws {Error} If the function is unable to find content with the provided id.\n */\nasync function launchContent(id: string, options: LaunchContentOptions): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchContent\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-content', { id, options });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\n/**\n * A function allowing the easy launching of Supertabs\n * @param id The id of supertab\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the supertab\n * @throws {Error} If the function is unable to find supertab with the provided id.\n */\nasync function launchSupertab(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchSupertab\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-supertab', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\n/**\n * A function allowing the easy launching of Workspaces\n * @param id The id of workspace\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the workspace\n * @throws {Error} If the function is unable to find workspace with the provided id.\n */\nasync function launchWorkspace(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchWorkspace\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-workspace', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\nexport { getAppSettings, getAppUserSettings, setAppUserSettings, getAppUserPermissions, launchContent, launchSupertab, launchWorkspace };\n","/* eslint-disable check-file/no-index */\nexport { register } from './search';\nexport type {\n OnActionListener,\n OnSearchListener,\n SearchAction,\n SearchAgent,\n SearchAgentRegistrationConfig,\n SearchListenerRequest,\n SearchRequestContext,\n SearchResponse,\n SearchResult,\n SearchResultActionResponse,\n} from './search.types';\n","import type { OpenFin } from '@openfin/core';\nimport * as WorkspaceSearch from '@openfin/search-api';\n\nimport type {\n LogMessageChannelTopicPayload,\n OnActionListener,\n OnSearchListener,\n OpenUrlChannelTopicPayload,\n ProviderStatusChannelTopicPayload,\n SearchAgent,\n SearchAgentLogLevel,\n SearchAgentRegistrationConfig,\n SearchAgentWindowCreationOptions,\n SearchResult,\n} from './search.types';\n\nconst CHANNEL_TOPIC_LOG_MESSAGE_PREFIX = 'log-message-';\nconst CHANNEL_TOPIC_OPEN_URL = 'open-url';\nconst CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX = 'provider-status-';\nconst CHANNEL_TOPIC_REGISTERED_PREFIX = 'registered-';\nconst SEARCH_PROVIDER_CLIENT_API_VERSION = '1.0';\n\nfunction convertFromSearchResult(result: SearchResult, providerId: string): WorkspaceSearch.SearchResult {\n const { data, ...otherProps } = result;\n return {\n ...otherProps,\n data: {\n customData: data,\n providerId,\n resultType: 'app',\n },\n };\n}\n\nfunction convertToSearchResult(result: WorkspaceSearch.SearchResult): SearchResult {\n return {\n ...result,\n data: result.data.customData,\n };\n}\n\nfunction getSearchApiChannelName(): string {\n return `${window.fin.me.identity.uuid}-cloud-api-search`;\n}\n\nasync function isReady(\n channel: OpenFin.ChannelClient,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n providerId: string,\n ready: boolean = true,\n): Promise<void> {\n await logMessage('info', `Setting status as ${ready ? 'ready' : 'not ready'}`);\n try {\n await channel.dispatch(`${CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX}${providerId}`, { isReady: ready } satisfies ProviderStatusChannelTopicPayload);\n } catch (error) {\n const args = ['Error setting provider status', error];\n console.error(...args);\n logMessage('error', ...args);\n }\n}\n\nasync function logMessage(channel: OpenFin.ChannelClient, providerId: string, level: SearchAgentLogLevel, ...args: unknown[]) {\n try {\n await channel.dispatch(`${CHANNEL_TOPIC_LOG_MESSAGE_PREFIX}${providerId}`, { level, message: args } satisfies LogMessageChannelTopicPayload);\n } catch (error) {\n console.error('Error logging message', error);\n }\n}\n\nasync function onResultDispatch(\n channel: OpenFin.ChannelClient,\n config: SearchAgentWindowCreationOptions,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n onAction: OnActionListener,\n searchResult: WorkspaceSearch.DispatchedSearchResult,\n): Promise<void> {\n const { action, dispatcherIdentity, ...otherProps } = searchResult;\n await logMessage('info', 'Handling action', { action, dispatcherIdentity, result: otherProps });\n let url: string | undefined;\n try {\n const originalResult = convertToSearchResult(searchResult);\n const originalAction = originalResult.actions?.find(({ name: id }) => id === action.name);\n if (!originalAction) {\n throw new Error('Original action not found in search result');\n }\n const actionResult = await onAction(originalAction, convertToSearchResult(searchResult));\n url = actionResult?.url;\n } catch (error) {\n await logMessage('error', 'Error handling dispatch', error);\n throw error;\n }\n if (!url) {\n await logMessage('warn', 'OnActionListener did not return a URL');\n return;\n }\n await openUrl(channel, logMessage, config.id, url, dispatcherIdentity);\n}\n\nasync function onUserInput(\n config: SearchAgentWindowCreationOptions,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n onSearch: OnSearchListener,\n request: WorkspaceSearch.SearchListenerRequest,\n): Promise<WorkspaceSearch.SearchResponse> {\n await logMessage('info', 'Getting search results', { request });\n try {\n const abortController = new AbortController();\n request.onClose(() => abortController.abort());\n const { context, query } = request;\n const { results } = await onSearch({ context, query, signal: abortController.signal });\n const convertedResults = results.map((result) => convertFromSearchResult(result, config.id));\n await logMessage('info', 'Returning results', convertedResults);\n return { results: convertedResults };\n } catch (error) {\n const args = ['Error handling search', error];\n console.error(...args);\n logMessage('error', ...args);\n throw error;\n }\n}\n\nasync function openUrl(\n channel: OpenFin.ChannelClient,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n providerId: string,\n url: string,\n targetIdentity: OpenFin.Identity,\n): Promise<void> {\n await logMessage('info', 'Opening URL', { url, targetIdentity });\n try {\n await channel.dispatch(CHANNEL_TOPIC_OPEN_URL, { url, targetIdentity, providerId } satisfies OpenUrlChannelTopicPayload);\n } catch (error) {\n const args = ['Error opening URL', error];\n console.error(...args);\n logMessage('error', ...args);\n }\n}\n\n/**\n * Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.\n *\n * @param config The configuration for the Search Agent.\n *\n * @returns A promise that resolves with the Search Agent.\n *\n * @example Registering a basic Search Agent:\n * ```ts\n * // Handle incoming action and return a response that includes the URL to navigate to\n * const onAction: Search.OnActionListener = (action, result) => {\n * const { name } = action;\n * const { data, key } = result;\n * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };\n * const { id: ownerId } = owner;\n * console.log(`Action \"${name}\" triggered on search result with key \"${key}\"`);\n * switch (name) {\n * case \"view-owner\":\n * return { url: `${searchResultHostUrl}/people/${ownerId}` };\n * case \"view-result\":\n * return { url: `${searchResultHostUrl}/record/${key}` };\n * default:\n * console.warn(`Unknown action: ${name}`);\n * }\n * };\n *\n * // Handle incoming search request and return relevant search results\n * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {\n * const { pageNumber, pageSize } = context;\n * try {\n * let results: Search.SearchResult[] = [];\n * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;\n * const response = await fetch(url, { signal });\n * if (!response.ok) {\n * throw new Error(`Request failed: ${response.status}`);\n * }\n * const { searchResults } = await response.json();\n * results = searchResults.map((result) => {\n * const { iconUrl, id: key, owner, subTitle, title } = result;\n * const { name: ownerName } = owner as { id: string, name: string };\n * return {\n * actions: [\n * {\n * name: \"view-result\",\n * description: `Go to ${title} in My Web App`,\n * },\n * {\n * name: \"view-owner\",\n * description: `Go to ${ownerName} in My Web App`,\n * title: \"View Owner\",\n * },\n * ],\n * data: {\n * owner,\n * searchResultHostUrl: `https://my-web-app.com`,\n * },\n * icon: iconUrl,\n * key,\n * label: subTitle,\n * title,\n * };\n * });\n * console.log(\"Returning results\", results);\n * return { results };\n * } catch (err) {\n * if ((err as Error).name === \"AbortError\") {\n * // Ignore errors for cancelled requests\n * return { results: [] };\n * }\n * throw err;\n * }\n * };\n *\n * // Register the search agent\n * const searchAgent = await Search.register({ onAction, onSearch });\n *\n * // Set the Search Agent as ready to receive search requests\n * await searchAgent.isReady();\n * ```\n */\nexport async function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent> {\n // Get provider configuration from window options custom data\n const windowOptions = await window.fin.me.getOptions();\n const customData = windowOptions.customData as SearchAgentWindowCreationOptions;\n const { configData, id, title } = customData;\n\n // Subscribe to the search topic and register the search provider\n const { onAction, onSearch } = config;\n const topic = await WorkspaceSearch.subscribe(getSearchApiChannelName());\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore - The following line will error if the @openfin/core version used is different to the one used in @openfin/search-api\n const channel = topic.channel as OpenFin.ChannelClient;\n const logMessageBound = logMessage.bind(null, channel, id);\n await topic.register({\n icon: '',\n id,\n onResultDispatch: onResultDispatch.bind(null, channel, customData, logMessageBound, onAction),\n onUserInput: onUserInput.bind(null, customData, logMessageBound, onSearch),\n title,\n });\n await topic.channel.dispatch(`${CHANNEL_TOPIC_REGISTERED_PREFIX}${id}`, { version: SEARCH_PROVIDER_CLIENT_API_VERSION });\n logMessageBound('info', 'Registered search topic', { id, title });\n\n return {\n customData: configData,\n isReady: isReady.bind(null, channel, logMessageBound, id),\n };\n}\n"],"mappings":"klBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,eAAC,IAAI,CAAC,aAAa,IAAIC,EAAE,CAAC,EAAE,CAACC,EAAEC,IAAI,CAAC,QAAQC,KAAKD,EAAEF,EAAE,EAAEE,EAAEC,CAAC,GAAG,CAACH,EAAE,EAAEC,EAAEE,CAAC,GAAG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I,GAAG,WAAW,GACpB,WAC3B,CAAE,WAAAC,EAAY,GAAAb,EAAI,MAAAc,CAAM,EAAIF,EAG5B,CAAE,SAAAlB,EAAU,SAAAS,CAAS,EAAIV,EACzBsB,EAAQ,MAAsB,aAAU/B,GAAwB,CAAC,EAGjEE,EAAU6B,EAAM,QAChBC,EAAkB7B,GAAW,KAAK,KAAMD,EAASc,CAAE,EACzD,aAAMe,EAAM,SAAS,CACjB,KAAM,GACN,GAAAf,EACA,iBAAkBR,GAAiB,KAAK,KAAMN,EAAS0B,EAAYI,EAAiBtB,CAAQ,EAC5F,YAAaQ,GAAY,KAAK,KAAMU,EAAYI,EAAiBb,CAAQ,EACzE,MAAAW,CACJ,CAAC,EACD,MAAMC,EAAM,QAAQ,SAAS,GAAGvC,EAA+B,GAAGwB,CAAE,GAAI,CAAE,QAASvB,EAAmC,CAAC,EACvHuC,EAAgB,OAAQ,0BAA2B,CAAE,GAAAhB,EAAI,MAAAc,CAAM,CAAC,EAEzD,CACH,WAAYD,EACZ,QAAS5B,GAAQ,KAAK,KAAMC,EAAS8B,EAAiBhB,CAAE,CAC5D,CACJ","names":["require_search_api","__commonJSMin","exports","module","e","t","n","o","y","Je","Qe","Ge","oe","ze","r","i","s","c","a","u","d","l","f","p","h","g","w","v","m","R","C","b","S","I","x","O","P","B","E","k","A","D","L","U","_","T","F","M","$","W","q","K","V","j","H","N","z","J","G","Q","X","Y","Z","ee","te","ne","re","ie","se","ce","ae","ue","de","le","fe","pe","he","ge","we","ye","ve","Re","Ce","be","Se","Ie","xe","Oe","Pe","Be","Ee","ke","Ae","De","Le","Ue","_e","Te","Fe","Me","$e","We","qe","Ke","Ve","je","He","Ne","Xe","Ye","Ze","PACKAGE_NAME","isInViewContext","extractAppUuidFromIdentity","identity","PACKAGE_NAME","getChannelName","notificationsClientPromise","getNotificationsClient","getNotificationsClientInternal","isInViewContext","extractAppUuidFromIdentity","channelPromise","getChannelClient","message","listener","eventListeners","eventName","listeners","options","notificationId","channelClientPromise","getChannelClientInternal","channel","identity","apiChannelClientPromise","getApiChannelName","getApiChannelClient","getAppSettings","PACKAGE_NAME","isInViewContext","getAppUserSettings","setAppUserSettings","settings","getAppUserPermissions","launchContent","id","options","channel","error","launchSupertab","launchWorkspace","search_exports","__export","register","WorkspaceSearch","CHANNEL_TOPIC_LOG_MESSAGE_PREFIX","CHANNEL_TOPIC_OPEN_URL","CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX","CHANNEL_TOPIC_REGISTERED_PREFIX","SEARCH_PROVIDER_CLIENT_API_VERSION","convertFromSearchResult","result","providerId","data","otherProps","convertToSearchResult","getSearchApiChannelName","isReady","channel","logMessage","ready","error","args","level","onResultDispatch","config","onAction","searchResult","action","dispatcherIdentity","url","originalAction","id","openUrl","onUserInput","onSearch","request","abortController","context","query","results","convertedResults","targetIdentity","register","customData","configData","title","topic","logMessageBound"]}
1
+ {"version":3,"sources":["../src/utils.ts","../src/notifications.ts","../src/client-api.ts"],"sourcesContent":["import type OpenFin from '@openfin/core';\n\nexport const PACKAGE_NAME = '@openfin/cloud-api';\n\nexport async function isInViewContext(): Promise<boolean> {\n try {\n await window.fin.View.getCurrentSync().getInfo();\n return true;\n } catch {\n return false;\n }\n}\n\nexport function extractAppUuidFromIdentity(identity: OpenFin.Identity): string {\n if (identity.name.startsWith('internal-generated')) {\n throw new Error('Cannot extract app UUID from identity');\n }\n // <uuid>/<name>\n if (/\\/[\\d,a-z-]{36}$/.test(identity.name)) {\n return identity.name.split('/')[0] || '';\n }\n\n return identity.name;\n}\n","// eslint-disable-next-line check-file/no-index\nimport type * as NotificationsTypes from 'openfin-notifications';\n\nimport type { FlannelChannelClient, NotificationEventsMap, NotificationsClient } from './types';\nimport { extractAppUuidFromIdentity, isInViewContext } from './utils';\n\nconst PACKAGE_NAME = '@openfin/cloud-api';\n\nexport type {\n FlannelChannelProvider as __INTERNAL_FlannelChannelProvider,\n FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest,\n FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse,\n FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest,\n FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse,\n FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest,\n FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse,\n} from './types';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface Window {\n fin: typeof import('@openfin/core').fin;\n }\n}\n\nfunction getChannelName() {\n return `${window.fin.me.uuid}-cloud-api-notifications`;\n}\n\nlet notificationsClientPromise: Promise<NotificationsClient> | null = null;\n\n/**\n * @returns A client for interacting with the OpenFin Notifications service\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the app UUID cannot be extracted from the current context\n *\n * @example **Basic Usage** Creating a notification, updating it and then clearing it\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * const notification = await notificationsClient.createNotification({\n * title: 'Hello, World!',\n * body: 'This is a notification from the OpenFin Cloud API',\n * });\n *\n * // Use the `id` from the returned notification to interact with it\n * console.log(notification.id);\n *\n * // Update the notification\n * await notificationsClient.update({\n * id: notification.id,\n * body: 'This is a notification from the OpenFin Cloud API, that has been updated!',\n * })\n *\n * // Clear the notification\n * await notificationsClient.clear(notification.id);\n * ```\n *\n * @example **Advanced Usage** Listening for events\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * // create the notification\n * const notification = await notificationsClient.createNotification({\n * title: `${window.fin.me.identity.name} Hello, World!`,\n * body: `This is a notification from the cloud API example created at ${new Date().toLocaleTimeString()}`,\n * buttons: [\n * {\n * title: 'Acknowledge',\n * },\n * ],\n * });\n *\n * notificationsClient.addEventListener('notification-action', (event) => {\n * console.log('Notification action:', event);\n * });\n * ```\n */\nasync function getNotificationsClient(): Promise<NotificationsClient> {\n if (!notificationsClientPromise) {\n notificationsClientPromise = getNotificationsClientInternal();\n }\n\n return notificationsClientPromise;\n}\n\nasync function getNotificationsClientInternal(): Promise<NotificationsClient> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n extractAppUuidFromIdentity(window.fin.me);\n\n const channelPromise = await getChannelClient();\n console.log(channelPromise);\n\n channelPromise.register('openfin-cloud-event', (message) => {\n for (const listener of eventListeners.get(message.type) ?? []) {\n // `Date` is serialized as a string, so we need to convert it back\n if (typeof message.payload.timestamp === 'string') {\n message.payload.timestamp = new Date(message.payload.timestamp);\n }\n\n listener(message.payload as never);\n }\n });\n\n const eventListeners = new Map<keyof NotificationEventsMap, Set<NotificationEventsMap[keyof NotificationEventsMap]>>();\n\n return {\n addEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName) || new Set();\n listeners.add(listener);\n eventListeners.set(eventName, listeners);\n },\n removeEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName);\n if (!listeners) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,\n eventName,\n );\n return;\n }\n\n if (listeners.delete(listener as (args: unknown) => void) === false) {\n console.warn(`\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference?`, eventName);\n }\n },\n update: async (options: Parameters<typeof NotificationsTypes.update>[0]): ReturnType<typeof NotificationsTypes.update> => {\n const response = await channelPromise.dispatch('openfin-cloud-update-notification', {\n version: 1,\n payload: {\n notification: options,\n },\n });\n return response.payload.response;\n },\n clear: async (notificationId: Parameters<typeof NotificationsTypes.clear>[0]): ReturnType<typeof NotificationsTypes.clear> => {\n const response = await channelPromise.dispatch('openfin-cloud-clear-notification', {\n version: 1,\n payload: {\n notificationId,\n },\n });\n return response.payload.response;\n },\n createNotification: async (\n options: NotificationsTypes.NotificationOptions,\n ): Promise<NotificationsTypes.Notification<NotificationsTypes.NotificationOptions>> => {\n if (options.id) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: The \\`id\\` property is not supported and will be ignored. If you need to use the \\`id\\` property, you should use the \\`id\\` property of the returned notification object.`,\n );\n }\n const response = await channelPromise.dispatch('openfin-cloud-create-notification', {\n version: 1,\n payload: {\n notification: { ...options, id: undefined },\n },\n });\n return response.payload.response;\n },\n };\n}\n\nlet channelClientPromise: Promise<FlannelChannelClient> | null = null;\n\nasync function getChannelClient(): Promise<FlannelChannelClient> {\n if (!channelClientPromise) {\n channelClientPromise = getChannelClientInternal();\n }\n\n return channelClientPromise;\n}\n\nasync function getChannelClientInternal(): Promise<FlannelChannelClient> {\n const channel = (await window.fin.InterApplicationBus.Channel.connect(getChannelName())) as FlannelChannelClient;\n\n channel.onDisconnection((identity) => {\n console.warn(`\\`${PACKAGE_NAME}\\`: Channel Disconnected from`, identity, 'Reconnecting...');\n channelClientPromise = null;\n });\n\n return channel;\n}\n\nexport { getNotificationsClient };\n","import type OpenFin from '@openfin/core';\n\nimport { isInViewContext, PACKAGE_NAME } from './utils';\n\nlet apiChannelClientPromise: Promise<OpenFin.ChannelClient>;\n\n/**\n * Represents a collection of returned app permissions\n */\nexport type AppPermissions = {\n permissions: {\n /**\n * The name of the permission\n */\n name: string;\n /**\n * The ID of the permission\n */\n id: string;\n }[];\n};\n\nfunction getApiChannelName() {\n return `${window.fin.me.uuid}-client-api`;\n}\n\nasync function getApiChannelClient(): Promise<OpenFin.ChannelClient> {\n if (!apiChannelClientPromise) {\n apiChannelClientPromise = window.fin.InterApplicationBus.Channel.connect(getApiChannelName());\n }\n\n return apiChannelClientPromise;\n}\n\n/**\n * @returns The app settings that have been set against the current app\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-settings');\n}\n\n/**\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-settings');\n}\n\n/**\n * Assigns a set of user specific settings to the current app\n *\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function setAppUserSettings(settings: unknown): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('set-user-settings', settings);\n}\n\n/**\n * @returns The permissions that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserPermissions(): Promise<AppPermissions> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-permissions');\n}\n\n/**\n * A function allowing the easy launching of content\n * @param id The id of the content to launch\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the content\n * @throws {Error} If the function is unable to find content with the provided id.\n */\nasync function launchContent(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchContent\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-content', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\nexport { getAppSettings, getAppUserSettings, setAppUserSettings, getAppUserPermissions, launchContent };\n"],"mappings":"AAEO,IAAMA,EAAe,qBAE5B,eAAsBC,GAAoC,CACtD,GAAI,CACA,aAAM,OAAO,IAAI,KAAK,eAAe,EAAE,QAAQ,EACxC,EACX,MAAQ,CACJ,MAAO,EACX,CACJ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ACD,MAAM,IAAI,MAAM,GAAGP,CAAY,6DAA6DO,CAAE,EAAE,EAEpG,IAAK,iBACD,MAAM,IAAI,MAAM,GAAGP,CAAY,qDAAqDO,CAAE,EAAE,EAE5F,QACI,MAAM,IAAI,MAAM,GAAGP,CAAY,wEAAwEO,CAAE,gCAAgC,CAEjJ,CACJ,CACJ","names":["PACKAGE_NAME","isInViewContext","extractAppUuidFromIdentity","identity","PACKAGE_NAME","getChannelName","notificationsClientPromise","getNotificationsClient","getNotificationsClientInternal","isInViewContext","extractAppUuidFromIdentity","channelPromise","getChannelClient","message","listener","eventListeners","eventName","listeners","options","notificationId","channelClientPromise","getChannelClientInternal","channel","identity","apiChannelClientPromise","getApiChannelName","getApiChannelClient","getAppSettings","PACKAGE_NAME","isInViewContext","getAppUserSettings","setAppUserSettings","settings","getAppUserPermissions","launchContent","id","channel","error"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/cloud-api",
3
- "version": "0.0.1-alpha.fbf0042",
3
+ "version": "0.0.1-alpha.fc110d0",
4
4
  "sideEffects": false,
5
5
  "description": "",
6
6
  "exports": {
@@ -18,29 +18,28 @@
18
18
  "typecheck": "tsc --noEmit",
19
19
  "test": "echo \"Error: no test specified\" && exit 1",
20
20
  "lint": "eslint . --max-warnings 0",
21
- "lint:fix": "eslint . --fix --max-warnings 0",
22
- "docs": "typedoc --treatWarningsAsErrors"
21
+ "lint:fix": "eslint . --fix --max-warnings 0"
23
22
  },
24
23
  "files": [
25
24
  "dist"
26
25
  ],
26
+ "dependencies": {
27
+ "@openfin/core": "^34.78.80",
28
+ "openfin-notifications": "^2.3.2"
29
+ },
27
30
  "devDependencies": {
28
- "@openfin/core": "^40.102.1",
29
- "@openfin/search-api": "^2.0.1",
30
- "@openfin/typedoc-theme": "^2.0.0",
31
- "@openfin/workspace": "20.3.9",
32
- "@typescript-eslint/eslint-plugin": "^8.20.0",
33
- "@typescript-eslint/parser": "^8.20.0",
31
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
32
+ "@typescript-eslint/parser": "^7.15.0",
34
33
  "eslint": "^8.57.0",
34
+ "eslint-config-next": "^14.1.4",
35
35
  "eslint-config-prettier": "^9.1.0",
36
- "eslint-plugin-check-file": "^2.8.0",
37
- "eslint-plugin-prettier": "^5.2.1",
38
- "eslint-plugin-simple-import-sort": "^12.1.1",
39
- "eslint-plugin-unicorn": "^55.0.0",
40
- "prettier": "^3.3.3",
41
- "tsup": "^8.3.0",
42
- "typedoc": "^0.26.11",
43
- "typescript": "^5.6.3"
36
+ "eslint-plugin-check-file": "^2.6.2",
37
+ "eslint-plugin-prettier": "^5.1.3",
38
+ "eslint-plugin-simple-import-sort": "^12.0.0",
39
+ "eslint-plugin-unicorn": "^51.0.1",
40
+ "prettier": "^3.2.5",
41
+ "tsup": "^8.0.1",
42
+ "typescript": "^5.5.4"
44
43
  },
45
44
  "eslintConfig": {
46
45
  "env": {