@openfin/cloud-api 0.0.1-alpha.fe757e1 → 0.0.1-alpha.ff44012

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(); } }var v=Object.defineProperty;var E=(n,o)=>{for(var e in o)v(n,e,{get:o[e],enumerable:!0})};var t="@openfin/cloud-api";async function r(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch (e2){return!1}}function y(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 c="@openfin/cloud-api";function F(){return`${window.fin.me.uuid}-cloud-api-notifications`}var d=null;async function U(){return d||(d=P()),d}async function P(){if(!window.fin)throw new Error(`\`${c}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${c}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);y(window.fin.me);let n=await S();console.log(n),n.register("openfin-cloud-event",e=>{for(let i of _nullishCoalesce(o.get(e.type), () => ([])))typeof e.payload.timestamp=="string"&&(e.payload.timestamp=new Date(e.payload.timestamp)),i(e.payload)});let o=new Map;return{addEventListener:(e,i)=>{let a=o.get(e)||new Set;a.add(i),o.set(e,a)},removeEventListener:(e,i)=>{let a=o.get(e);if(!a){console.warn(`\`${c}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,e);return}a.delete(i)===!1&&console.warn(`\`${c}\`: 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(`\`${c}\`: 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 u=null;async function S(){return u||(u=$()),u}async function $(){let n=await window.fin.InterApplicationBus.Channel.connect(F());return n.onDisconnection(o=>{console.warn(`\`${c}\`: Channel Disconnected from`,o,"Reconnecting..."),u=null}),n}var f;function b(){return`${window.fin.me.uuid}-client-api`}async function s(){return f||(f=window.fin.InterApplicationBus.Channel.connect(b())),f}async function q(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-settings")}async function D(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-user-settings")}async function V(n){if(!window.fin)throw new Error(`\`${t}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("set-user-settings",n)}async function B(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-user-permissions")}async function G(n,o){if(!window.fin)throw new Error(`\`${t}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let e=await s();try{await e.dispatch("launch-content",{id:n,options:o})}catch(i){switch(i instanceof Error?i.message:String(i)){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.`)}}}async function K(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let o=await s();try{await o.dispatch("launch-supertab",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchSupertab\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchSupertab\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchSupertab\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchSupertab\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}async function j(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let o=await s();try{await o.dispatch("launch-workspace",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchWorkspace\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchWorkspace\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchWorkspace\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchWorkspace\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}var g={};E(g,{register:()=>k});var A="get-results",R="handle-action",T={id:"",onClose:function(n){console.warn("Function not implemented.")},removeListener:function(n){console.warn("Function not implemented.")},query:""},O={open:function(){console.warn("Function not implemented.")},close:function(){console.warn("Function not implemented.")},respond:function(n){console.warn("Function not implemented.")},revoke:function(...n){console.warn("Function not implemented.")},updateContext:function(n){console.warn("Function not implemented.")}},k=async n=>{let o=await window.fin.me.getOptions(),{configuration:e,id:i,name:a}=o.customData,w=`search-provider-${o.customData.id}`;console.debug(`creating channel ${w}`);let h=await window.fin.InterApplicationBus.Channel.create(w);return h.register(R,async l=>{let{searchResult:p,actionId:m,viewIdentity:C}=l,N={action:{name:m,trigger:"user-action"},dispatcherIdentity:C,key:"",title:p.title,actions:[],data:p};return await n.onAction(N)}),h.register(A,async l=>{let p=Object.assign({},T,l);return(await n.onSearch(p,O)).results}),{configData:e,hideWindow:async function(){console.warn("Function not implemented.")},id:i,isReady:async function(l){console.warn("Function not implemented.")},name:a,showWindow:async function(){console.warn("Function not implemented.")}}};exports.Search = g; exports.getAppSettings = q; exports.getAppUserPermissions = B; exports.getAppUserSettings = D; exports.getNotificationsClient = U; exports.launchContent = G; exports.launchSupertab = K; exports.launchWorkspace = j; exports.setAppUserSettings = V;
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 Ve=Object.create;var mn=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var Ge=(o,u)=>()=>(u||o((u={exports:{}}).exports,u),u.exports),ze=(o,u)=>{for(var a in u)mn(o,a,{get:u[a],enumerable:!0})},Xe=(o,u,a,l)=>{if(u&&typeof u=="object"||typeof u=="function")for(let f of He(u))!je.call(o,f)&&f!==a&&mn(o,f,{get:()=>u[f],enumerable:!(l=qe(u,f))||l.enumerable});return o};var Je=(o,u,a)=>(a=o!=null?Ve(Ke(o)):{},Xe(u||!o||!o.__esModule?mn(a,"default",{value:o,enumerable:!0}):a,o));var Hn=Ge((It,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})}},u={};o.r(u),o.d(u,{SearchTagBackground:()=>on,create:()=>Un,defaultTopic:()=>Bn,subscribe:()=>Dn});var a={};o.r(a),o.d(a,{B:()=>de});var l={};o.r(l),o.d(l,{v:()=>De});let f="deregistered or does not exist",y=new Error(`provider ${f}`),A=new Error("provider with name already exists"),v=new Error("bad payload"),b=new Error("subscription rejected"),R=new Error(`channel ${f}`),x;function O(){if(x)return x;throw R}function K(){return x}function Sn(n){x=n}var S,$,tn,on;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(S||(S={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}($||($={})),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 j="0",Rn="1",En="2",bn="3",An="4",G="5",z="6",Jn=()=>{},rn=new Set;function Qn(n){rn.add(n)}function Yn(n){rn.delete(n)}let sn=new Set;function Zn(n){sn.add(n)}function ne(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 X(n){q.delete(n);let e=[...sn].map(t=>t());await Promise.all(e)}function cn(){return[...q.values()]}function Pn(){q.clear()}function I(n){return q.get(n)}function On(n,e,t){return{...n,action:t||{...n.actions[0],trigger:tn.UserAction},dispatcherIdentity:e}}function un(n,e,t="ascending"){let i=n||[];if(!_optionalChain([e, 'optionalAccess', _2 => _2.length]))return i;let r=[],s=new Map;e.forEach(d=>{if(d.key)return s.set(d.key,d);r.push(d)});let c=i.map(d=>{let{key:h}=d;if(h&&s.has(h)){let C=s.get(h);return s.delete(h),C}return d});return c.push(...s.values(),...r),c=t==="ascending"?c.sort((d,h)=>(_nullishCoalesce(_optionalChain([d, 'optionalAccess', _3 => _3.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _4 => _4.score]), () => (1/0)))):c.sort((d,h)=>(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _5 => _5.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([d, 'optionalAccess', _6 => _6.score]), () => (1/0)))),c}function In(n){let e={},t=[],i=[],r=null,s=S.Initial;e.getStatus=()=>s,e.getResultBuffer=()=>t,e.setResultBuffer=d=>{t=d,_optionalChain([t, 'optionalAccess', _7 => _7.length])&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=d=>{i=d,_optionalChain([i, 'optionalAccess', _8 => _8.length])&&e.onChange()},e.setUpdatedContext=d=>{r=d,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=Jn;let c={};return e.res=c,c.close=()=>{s!==S.Close&&(s=S.Close,e.onChange())},c.open=()=>{s!==S.Open&&(s=S.Open,e.onChange())},c.respond=d=>{let h=un(e.getResultBuffer(),d,n);e.setResultBuffer(h)},c.revoke=(...d)=>{let h=new Set(d),C=e.getResultBuffer().filter(({key:p})=>{let g=h.has(p);return g&&h.delete(p),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(p=>h.add(p)),e.setRevokedBuffer([...h]))},c.updateContext=d=>{e.setUpdatedContext(d)},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,ee=1e3,te=new Map;function ln(){return te}let oe=100;function ie(){return async n=>{if(!n||!n.id||!n.providerId){let p=v;return console.error(p),{error:p.message}}let{id:e,providerId:t}=n,i=I(t);if(!i){let p=y;return console.error(p),{error:p.message}}let r=ln(),s=r.get(n.id);s||(s=Ln(e,n),r.set(n.id,s));let c=In(),d=()=>{let p=c.getResultBuffer();c.setResultBuffer([]);let g=c.getRevokedBuffer();c.setRevokedBuffer([]);let L=c.getUpdatedContext();c.setUpdatedContext(null);let k=c.getStatus();(async function(D){(await O()).dispatch(j,D)})({id:e,providerId:t,results:p,revoked:g,status:k,context:L})},h=!0,C=!1;c.onChange=()=>{if(h)return h=!1,void d();C||(C=!0,setTimeout(()=>{C=!1,d()},oe))};try{let{results:p,context:g}=await i.onUserInput(s.req,c.res),L=c.getStatus();return{id:e,providerId:t,status:L,results:p,context:g}}catch(p){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.",p),{id:e,providerId:t,error:_optionalChain([p, 'optionalAccess', _10 => _10.message])}}}}async function Fn(n,e){let t=e||await O(),i=J(),r={...n,identity:i,onResultDispatch:void 0},s=await t.dispatch(En,r);return await an({identity:i,...n}),s}async function re(n){return await(await O()).dispatch(bn,n),X(n)}async function se(n,e,t,i){let r=On(e,_nullishCoalesce(i, () => (J())),t),s=I(n);if(s){let{onResultDispatch:d}=s;return d?d(r):void 0}let c={providerId:n,result:r};return(await O()).dispatch(G,c)}async function ae(n){let e={...n,context:_optionalChain([n, 'optionalAccess', _11 => _11.context])||{}},t={},i=async function*(s,{setState:c}){let d=await O();for(;;){let h=await d.dispatch(Rn,s),C=h.error;if(C)throw new Error(C);let p=h;if(s.id=p.id,c(p.state),p.done)return p.value;yield p.value}}(e,{setState:s=>{t.state=s}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(s){(await O()).dispatch(z,{id:s})})(t.id)},t.next=()=>{if(r){let s=r;return r=void 0,s}return i.next()},t}async function ce(){return(await O()).dispatch(An,null)}async function ue(){let n=await O();x=void 0,Pn(),await n.disconnect()}let le=async n=>{let e=await xn(n);for(let t of cn())await Fn(t,e);return e};async function xn(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,ee))}}(n);return e.register(j,ie()),e.register(z,t=>{let i=ln(),r=i.get(t.id);r&&(r.close(),i.delete(t.id))}),e.register(G,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(v);let r=I(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=ln();for(let{req:r,close:s}of i.values())s(),i.delete(r.id);Sn(le(t))}}(n)),e}async function de(n){let e=K();e||(e=xn(n),Sn(e));let t=await e;return{getAllProviders:ce.bind(null),register:Fn.bind(null),search:ae.bind(null),deregister:re.bind(null),dispatch:se.bind(null),disconnect:ue.bind(null),channel:t}}let H;function Q(){if(H)return H;throw R}function pe(){return H}function fe(n){H=n}function he(){H=void 0}let dn=new Set;function we(n){dn.add(n)}function ge(n){dn.delete(n)}var T;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})(T||(T={}));let pn=typeof window<"u"&&typeof fin<"u",ye=(typeof process>"u"||process.env,typeof window<"u"),me=ye?window.origin:T.Local,Y=(pn&&fin.me.uuid,pn&&fin.me.name,pn&&fin.me.entityType,T.Local,T.Dev,T.Staging,T.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:me+n),$n=(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 Tn(){return[...cn()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function Ce(n){if(I(n.id))throw new Error("provider with name already exists");let e=J();return await an({identity:e,...n}),{workspaceVersion:$n||"",clientAPIVersion:n.clientAPIVersion||""}}async function ve(n){await X(n)}async function Se(n,e,t,i){let r=I(n);if(!r)throw y;let{onResultDispatch:s}=r;if(s)return s(On(e,_nullishCoalesce(i, () => (J())),t))}async function*Re(n,e){let t=function(g,L){let k=[],D=[],B=[],E=[];for(let m of g){let N=In(m.scoreOrder),F={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};k.push(F),D.push(N);let M=(async()=>{try{let{results:W,context:nn}=await m.onUserInput(L,N.res);F.results=un(F.results||[],W,m.scoreOrder),F.context={...F.context,...nn}}catch(W){F.error=W}})();M.finally(()=>{M.done=!0}),E.push(M),B.push(B.length)}return{providerResponses:k,listenerResponses:D,openListenerResponses:B,initialResponsePromises:E}}(n.targets?n.targets.map(g=>I(g)).filter(g=>!!g):[...cn().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:s,initialResponsePromises:c}=t,d=$.Fetching,h=g=>{d=g,e.setState(d)},C,p=!1;n.onClose(()=>{p=!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($.Fetched),g=!0)}let L,k=!1,D=()=>{k=!0,L&&L()},B=[];for(let E of s){let m=r[E],N=i[E],F=m.getStatus();(F===S.Open||d===$.Fetching&&F===S.Initial)&&(B.push(E),m.onChange=D);let M=m.getResultBuffer();M.length&&(m.setResultBuffer([]),N.results=un(N.results||[],M),g=!0);let W=m.getRevokedBuffer();if(W.length){m.setRevokedBuffer([]);let Me=new Set(W);N.results=(N.results||[]).filter(({key:We})=>!Me.has(We)),g=!0}let nn=m.getUpdatedContext();nn&&(m.setUpdatedContext(null),N.context={...N.context,...nn},g=!0)}if(s=B,g&&(yield i),p)break;k||(s.length||c.length)&&await Promise.race([...c,new Promise(E=>{L=E}),new Promise(E=>{C=E})])}while(s.length||c.length);return h($.Complete),i}let fn=0;async function kn(n){fn+=1;let e=Ln(fn.toString(),n),t=Re(e.req,{setState:i=>{t.state=i}});return t.id=fn.toString(),t.close=e.close,t.state=$.Fetching,t}let Z=new Map,Ee=1e4;function be(){return async n=>{if(!n)return console.error(v),{error:v.message};let e;if(n.id)e=n.id;else{let r=await kn(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)},Ee)}(e),{...i,id:n.id,state:t.generator.state}}}function Ae(n,e){return Q().dispatch(n,z,{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},d=await s.dispatch(n.identity,j,c),h=d.error;if(h)throw new Error(h);return d}let hn=new Map;function Ie(n,e){return`${n.name}:${n.uuid}:${e}`}let wn=new Map;function _n(n,e){return`${n}:${e}`}function Le(n){let e=Ie.bind(null,n.identity),t=Ae.bind(null,n.identity),i=Oe.bind(null,n);return async(r,s)=>{let c=e(r.id);if(!hn.has(c)){let p=()=>{t(r.id),hn.delete(c)};hn.set(c,p),r.onClose(p)}let d=_n(n.id,r.id),h=()=>{wn.delete(d),s.close()};r.onClose(h),wn.set(d,p=>{_optionalChain([p, 'access', _12 => _12.results, 'optionalAccess', _13 => _13.length])&&s.respond(p.results),_optionalChain([p, 'access', _14 => _14.revoked, 'optionalAccess', _15 => _15.length])&&s.revoke(...p.revoked),p.context&&s.updateContext(p.context),p.status===S.Open&&s.open(),p.status===S.Close&&h()});let C=await i(r);return C.status===S.Open&&s.open(),C.status!==S.Close&&C.status!==S.Initial||h(),C}}function Ne(n){return async e=>{let t=Q(),i={providerId:n.id,result:e};return t.dispatch(n.identity,G,i)}}let U=new Map;function gn(n){return`${n.name}-${n.uuid}`}function Fe(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(v);if(I(n.id))throw A;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:Le(t),onResultDispatch:Ne(t)})}(n),{workspaceVersion:$n||"",clientAPIVersion:n.clientAPIVersion||""}}}function xe(){return(n,e)=>{n?function(t,i){let r=I(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 d=c.findIndex(h=>h===t);d!==-1&&(c.splice(d,1),X(t))}}(n,e):console.error(v)}}let yn=new Set;function $e(n){yn.add(n)}function Te(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)X(r);U.delete(t)}})(n),yn.forEach(e=>e(n))}}async function _e(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(z,Pe()),e.register(j,i=>{let r=_n(i.providerId,i.id),s=wn.get(r);s&&s(i)}),e.register(En,Fe()),e.register(bn,xe()),e.register(An,async()=>Tn()),e.register(Rn,be()),e.register(G,async(i,r)=>{if(!i||!i.providerId||!i.result)return void console.error(v);let s=I(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 Ue(){let n=Q();he(),await n.destroy(),Pn()}async function De(n){let e=pe();e||(e=await _e(n),fe(e));let t=ge.bind(null),i=Te.bind(null),r=Yn.bind(null),s=ne.bind(null);return{getAllProviders:Tn.bind(null),search:kn.bind(null),register:Ce.bind(null),deregister:ve.bind(null),onSubscription:we.bind(null),onDisconnect:$e.bind(null),onRegister:Qn.bind(null),onDeregister:Zn.bind(null),dispatch:Se.bind(null),disconnect:Ue.bind(null),removeListener:c=>{t(c),i(c),r(c),s(c)},channel:e}}let{v:Un}=l,{B:Dn}=a,Bn="all",Be={create:Un,subscribe:Dn,defaultTopic:Bn},Mn=()=>{window.search=Be},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=u})()});var w="@openfin/cloud-api";async function P(){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 Qe(){return`${window.fin.me.uuid}-cloud-api-notifications`}var Cn=null;async function yt(){return Cn||(Cn=Ye()),Cn}async function Ye(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Vn(window.fin.me);let o=await Ze();console.log(o),o.register("openfin-cloud-event",a=>{for(let l of _nullishCoalesce(u.get(a.type), () => ([])))typeof a.payload.timestamp=="string"&&(a.payload.timestamp=new Date(a.payload.timestamp)),l(a.payload)});let u=new Map;return{addEventListener:(a,l)=>{let f=u.get(a)||new Set;f.add(l),u.set(a,f)},removeEventListener:(a,l)=>{let f=u.get(a);if(!f){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}f.delete(l)===!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 Ze(){return en||(en=nt()),en}async function nt(){let o=await window.fin.InterApplicationBus.Channel.connect(Qe());return o.onDisconnection(u=>{console.warn(`\`${V}\`: Channel Disconnected from`,u,"Reconnecting..."),en=null}),o}var vn;function et(){return`${window.fin.me.uuid}-client-api`}async function _(){return vn||(vn=window.fin.InterApplicationBus.Channel.connect(et())),vn}async function vt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-settings")}async function St(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-settings")}async function Rt(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("set-user-settings",o)}async function Et(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-permissions")}async function bt(o,u){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await P()===!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:u})}catch(l){switch(l instanceof Error?l.message:String(l)){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 At(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let u=await _();try{await u.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 P()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let u=await _();try{await u.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={};ze(Xn,{getAgentConfiguration:()=>Gn,register:()=>zn});var jn=Je(Hn(),1),tt="log-message-",ot="open-url",it="provider-status-",rt="registered-",st="1.0";function at(o,u){let{data:a,iconSize:l,rightSideIcon:f,...y}=o;return{...y,data:{customData:a,iconSize:l,providerId:u,resultType:"app",rightSideIcon:f}}}function Kn(o){return{...o,data:o.data.customData}}async function Gn(){let{customData:o}=await window.fin.me.getOptions();return o}function ct(){return`${window.fin.me.identity.uuid}-cloud-api-search`}async function ut(o,u,a,l=!0){await u("info",`Setting status as ${l?"ready":"not ready"}`);try{await o.dispatch(`${it}${a}`,{isReady:l})}catch(f){let y=["Error setting provider status",f];console.error(...y),u("error",...y)}}async function lt(o,u,a,...l){try{await o.dispatch(`${tt}${u}`,{level:a,message:l})}catch(f){console.error("Error logging message",f)}}async function dt(o,u,a,l,f){let{action:y,dispatcherIdentity:A,...v}=f;await a("info","Handling action",{action:y,dispatcherIdentity:A,result:v});let b;try{let x=_optionalChain([Kn, 'call', _16 => _16(f), 'access', _17 => _17.actions, 'optionalAccess', _18 => _18.find, 'call', _19 => _19(({name:K})=>K===y.name)]);if(!x)throw new Error("Original action not found in search result");b=await _asyncOptionalChain([(await l(x,Kn(f))), 'optionalAccess', async _20 => _20.url])}catch(R){throw await a("error","Error handling dispatch",R),R}if(!b){await a("warn","OnActionListener did not return a URL");return}await ft(o,a,u,b,A)}async function pt(o,u,a,l){await u("info","Getting search results",{request:l});try{let f=new AbortController;l.onClose(()=>f.abort());let{context:y,query:A}=l,{results:v}=await a({context:y,query:A,signal:f.signal}),b=v.map(R=>at(R,o));return await u("info","Returning results",b),{results:b}}catch(f){let y=["Error handling search",f];throw console.error(...y),u("error",...y),f}}async function ft(o,u,a,l,f){await u("info","Opening URL",{url:l,targetIdentity:f});try{await o.dispatch(ot,{url:l,targetIdentity:f,providerId:a})}catch(y){let A=["Error opening URL",y];console.error(...A),u("error",...A)}}async function zn(o){let a=(await window.fin.me.getOptions()).customData,{id:l,title:f}=a,{onAction:y,onSearch:A}=o,v=await jn.subscribe(ct()),b=v.channel,R=lt.bind(null,b,l);return await v.register({icon:"",id:l,onResultDispatch:dt.bind(null,b,l,R,y),onUserInput:pt.bind(null,l,R,A),title:f}),await v.channel.dispatch(`${rt}${l}`,{version:st}),R("info","Registered search topic",{id:l,title:f}),{isReady:ut.bind(null,b,R,l)}}exports.Search = Xn; exports.getAppSettings = vt; exports.getAppUserPermissions = Et; exports.getAppUserSettings = St; exports.getNotificationsClient = yt; exports.launchContent = bt; exports.launchSupertab = At; exports.launchWorkspace = Pt; exports.setAppUserSettings = Rt;
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","../src/utils.ts","../src/notifications.ts"],"names":["PACKAGE_NAME","isInViewContext","extractAppUuidFromIdentity","identity","getChannelName"],"mappings":"AAAA,iLAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CCElF,IAAMA,CAAAA,CAAe,oBAAA,CAE5B,MAAA,SAAsBC,CAAAA,CAAAA,CAAoC,CACtD,GAAI,CACA,OAAA,MAAM,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,cAAA,CAAe,CAAA,CAAE,OAAA,CAAQ,CAAA,CACxC,CAAA,CACX,CAAA,UAAQ,CACJ,MAAO,CAAA,CACX,CACJ,CAEO,SAASC,CAAAA,CAA2BC,CAAAA,CAAoC,CAC3E,EAAA,CAAIA,CAAAA,CAAS,IAAA,CAAK,UAAA,CAAW,oBAAoB,CAAA,CAC7C,MAAM,IAAI,KAAA,CAAM,uCAAuC,CAAA,CAG3D,MAAI,kBAAA,CAAmB,IAAA,CAAKA,CAAAA,CAAS,IAAI,CAAA,CAC9BA,CAAAA,CAAS,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,EAAK,EAAA,CAGnCA,CAAAA,CAAS,IACpB,CCjBA,IAAMH,CAAAA,CAAe,oBAAA,CAYrB,SAASI,CAAAA,CAAAA,CAAiB,CACtB,MAAO,CAAA,EAAA","file":"/home/runner/work/openfin-direct/openfin-direct/packages/cloud-api/dist/index.cjs","sourcesContent":[null,"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"]}
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,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AA,CAAG,SAAA,CAAU,CAAA,CAAA,EAAIC,EAAE,CAAC,CAAA,CAAE,IAAIL,CAAAA,CAAE,CAAC,CAAA,CAAEF,CAAAA,CAAE,CAAA,CAAEE,CAAC,CAAA,CAAEF,CAAAA,CAAE,CAAA,CAAEE,CAAAA,CAAE,CAAC,CAAA,CAAE,CAAA,CAAA,EAAIM,EAAE,CAAC,CAAA,CAAE,IAAIL,CAAAA,CAAE,CAAC,CAAA,CAAEH,CAAAA,CAAE,CAAA,CAAEG,CAAC,CAAA,CAAEH,CAAAA,CAAE,CAAA,CAAEG,CAAAA,CAAE,CAAC,CAAA,CAAE,CAAA,CAAA,EAAIM,EAAE,CAAC,CAAA,CAAE,IAAMC,CAAAA,CAAE,gCAAA,CAAiCC,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"]}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as OpenFin from '@openfin/core';
2
2
  import OpenFin__default from '@openfin/core';
3
3
  import * as NotificationsTypes from '@openfin/workspace/notifications';
4
- import { CLIDispatchedSearchResult, CLISearchListenerRequest, CLISearchListenerResponse, CLISearchResponse, SearchResult as SearchResult$1 } from '@openfin/workspace';
5
4
 
6
5
  /**
7
6
  * NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
@@ -298,49 +297,310 @@ declare function launchSupertab(id: string): Promise<void>;
298
297
  */
299
298
  declare function launchWorkspace(id: string): Promise<void>;
300
299
 
301
- type ActionedSearchResult = CLIDispatchedSearchResult;
302
- type SearchActionResponse = {
303
- url: string;
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;
304
343
  };
305
- type SearchListenerRequest = CLISearchListenerRequest;
306
- type SearchListenerResponse = CLISearchListenerResponse;
307
- type SearchProvider = {
308
- readonly configData: unknown;
309
- hideWindow: () => Promise<void>;
310
- readonly id: string;
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
+ * Sets whether or not the Search Agent is ready to provide search results.
350
+ *
351
+ * When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
352
+ *
353
+ * @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
354
+ */
311
355
  isReady: (ready?: boolean) => Promise<void>;
312
- readonly name: string;
313
- showWindow: (options?: ShowWindowOptions) => Promise<void>;
314
356
  };
315
- type SearchProviderRegistrationConfig = {
316
- onAction(result: ActionedSearchResult): Promise<SearchActionResponse | undefined>;
317
- onSearch(request: SearchListenerRequest, response: SearchListenerResponse): Promise<SearchResponse>;
357
+ /**
358
+ * The Search Agent’s configuration data as configured in the Here™ Admin Console.
359
+ *
360
+ * @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
361
+ */
362
+ type SearchAgentConfigurationData<T> = {
363
+ /**
364
+ * Custom configuration data specific to the Search Agent.
365
+ */
366
+ customData?: T;
367
+ /**
368
+ * Optional description of the Search Agent.
369
+ */
370
+ description?: string;
371
+ /**
372
+ * Unique identifier for the Search Agent.
373
+ */
374
+ id: string;
375
+ /**
376
+ * The display title of the Search Agent.
377
+ */
378
+ title: string;
379
+ /**
380
+ * The URL of the Search Agent.
381
+ */
382
+ url: string;
318
383
  };
319
- type SearchResponse = CLISearchResponse;
320
- type SearchResult = SearchResult$1;
321
- type ShowWindowOptions = {
322
- center?: boolean;
323
- height?: number;
324
- left?: number;
325
- resizable?: boolean;
326
- top?: number;
327
- width?: number;
384
+ /**
385
+ * Configuration provided when registering a Search Agent.
386
+ */
387
+ type SearchAgentRegistrationConfig = {
388
+ /**
389
+ * 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.
390
+ *
391
+ * The listener returns a response back to Here™ that includes a URL to navigate to.
392
+ */
393
+ onAction: OnActionListener;
394
+ /**
395
+ * This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
396
+ *
397
+ * Note: When the Search Agent is not ready this listener will not be called.
398
+ */
399
+ onSearch: OnSearchListener;
328
400
  };
401
+ /**
402
+ * Search request data provided to the {@link OnSearchListener}.
403
+ */
404
+ type SearchListenerRequest = {
405
+ /**
406
+ * Provides additional context for the search request.
407
+ */
408
+ context: SearchRequestContext;
409
+ /**
410
+ * The query entered by the user in Here™’s search UI.
411
+ */
412
+ query: string;
413
+ /**
414
+ * 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.
415
+ */
416
+ signal: AbortSignal;
417
+ };
418
+ /**
419
+ * Context data included with a search request.
420
+ */
421
+ type SearchRequestContext = {
422
+ /**
423
+ * The page number of the search results to return.
424
+ */
425
+ pageNumber: number;
426
+ /**
427
+ * The number of search results to return per page.
428
+ */
429
+ pageSize: number;
430
+ /**
431
+ * The unique ID of the query.
432
+ */
433
+ queryId: string;
434
+ };
435
+ /**
436
+ * Return type of the {@link OnSearchListener}.
437
+ */
438
+ type SearchResponse = {
439
+ /**
440
+ * The search results to display in Here™’s search UI.
441
+ */
442
+ results: SearchResult[];
443
+ };
444
+ /**
445
+ * A search result returned by a Search Agent in response to a search request.
446
+ */
447
+ type SearchResult = {
448
+ /**
449
+ * Actions that can be triggered by the user against the search result.
450
+ */
451
+ actions: SearchAction[];
452
+ /**
453
+ * Additional data that can be used by the {@link OnActionListener} when an action is triggered.
454
+ */
455
+ data?: Record<string, unknown>;
456
+ /**
457
+ * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
458
+ */
459
+ icon?: string;
460
+ /**
461
+ * Unique identifier for the search result.
462
+ */
463
+ key: string;
464
+ /**
465
+ * Secondary text that will be displayed with the search result in Here™’s search UI.
466
+ */
467
+ label?: string;
468
+ /**
469
+ * Primary text that will be displayed with the search result in Here™’s search UI.
470
+ */
471
+ title: string;
472
+ };
473
+ /**
474
+ * Return type of the {@link OnActionListener}.
475
+ */
476
+ type SearchResultActionResponse = {
477
+ /**
478
+ * URL that Here™ should navigate to.
479
+ */
480
+ url: string;
481
+ } | undefined;
329
482
 
330
- declare const register: (config: SearchProviderRegistrationConfig) => Promise<SearchProvider>;
483
+ /**
484
+ * Retrieves the Search Agent’s configuration data, as has been configured in the Here™ Admin Console.
485
+ *
486
+ * @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
487
+ *
488
+ * @example Retrieving the Search Agent’s configuration data:
489
+ * ```ts
490
+ * import { Search } from "@openfin/cloud-api";
491
+ *
492
+ * // Get the configuration data
493
+ * const configData = await Search.getAgentConfiguration<{ customField1: string, customField2: string }>();
494
+ *
495
+ * // Pick out the standard configuration properties
496
+ * const { customData, description, id, title, url } = configData;
497
+ *
498
+ * // Pick out the custom configuration properties
499
+ * if (customData) {
500
+ * const { customField1, customField2 } = customData;
501
+ * }
502
+ * ```
503
+ */
504
+ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
505
+ /**
506
+ * 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.
507
+ *
508
+ * @param config The configuration for the Search Agent.
509
+ *
510
+ * @returns A promise that resolves with the Search Agent.
511
+ *
512
+ * @example Registering a basic Search Agent:
513
+ * ```ts
514
+ * import { Search } from "@openfin/cloud-api";
515
+ *
516
+ * // Handle incoming action and return a response that includes the URL to navigate to
517
+ * const onAction: Search.OnActionListener = (action, result) => {
518
+ * const { name } = action;
519
+ * const { data, key } = result;
520
+ * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
521
+ * const { id: ownerId } = owner;
522
+ * console.log(`Action "${name}" triggered on search result with key "${key}"`);
523
+ * switch (name) {
524
+ * case "view-owner":
525
+ * return { url: `${searchResultHostUrl}/people/${ownerId}` };
526
+ * case "view-result":
527
+ * return { url: `${searchResultHostUrl}/record/${key}` };
528
+ * default:
529
+ * console.warn(`Unknown action: ${name}`);
530
+ * }
531
+ * };
532
+ *
533
+ * // Handle incoming search request and return relevant search results
534
+ * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
535
+ * const { pageNumber, pageSize } = context;
536
+ * try {
537
+ * let results: Search.SearchResult[] = [];
538
+ * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
539
+ * const response = await fetch(url, { signal });
540
+ * if (!response.ok) {
541
+ * throw new Error(`Request failed: ${response.status}`);
542
+ * }
543
+ * const { searchResults } = await response.json();
544
+ * results = searchResults.map((result) => {
545
+ * const { iconUrl, id: key, owner, subTitle, title } = result;
546
+ * const { name: ownerName } = owner as { id: string, name: string };
547
+ * return {
548
+ * actions: [
549
+ * {
550
+ * name: "view-result",
551
+ * description: `Go to ${title} in My Web App`,
552
+ * },
553
+ * {
554
+ * name: "view-owner",
555
+ * description: `Go to ${ownerName} in My Web App`,
556
+ * title: "View Owner",
557
+ * },
558
+ * ],
559
+ * data: {
560
+ * owner,
561
+ * searchResultHostUrl: `https://my-web-app.com`,
562
+ * },
563
+ * icon: iconUrl,
564
+ * key,
565
+ * label: subTitle,
566
+ * title,
567
+ * };
568
+ * });
569
+ * console.log("Returning results", results);
570
+ * return { results };
571
+ * } catch (err) {
572
+ * if ((err as Error).name === "AbortError") {
573
+ * // Ignore errors for cancelled requests
574
+ * return { results: [] };
575
+ * }
576
+ * throw err;
577
+ * }
578
+ * };
579
+ *
580
+ * // Register the search agent
581
+ * const searchAgent = await Search.register({ onAction, onSearch });
582
+ *
583
+ * // Set the Search Agent as ready to receive search requests
584
+ * await searchAgent.isReady();
585
+ * ```
586
+ */
587
+ declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
331
588
 
332
- type search_ActionedSearchResult = ActionedSearchResult;
333
- type search_SearchActionResponse = SearchActionResponse;
334
- type search_SearchListenerRequest = SearchListenerRequest;
335
- type search_SearchListenerResponse = SearchListenerResponse;
336
- type search_SearchProvider = SearchProvider;
337
- type search_SearchProviderRegistrationConfig = SearchProviderRegistrationConfig;
338
- type search_SearchResponse = SearchResponse;
339
- type search_SearchResult = SearchResult;
340
- type search_ShowWindowOptions = ShowWindowOptions;
341
- declare const search_register: typeof register;
342
- declare namespace search {
343
- export { type search_ActionedSearchResult as ActionedSearchResult, type search_SearchActionResponse as SearchActionResponse, type search_SearchListenerRequest as SearchListenerRequest, type search_SearchListenerResponse as SearchListenerResponse, type search_SearchProvider as SearchProvider, type search_SearchProviderRegistrationConfig as SearchProviderRegistrationConfig, type search_SearchResponse as SearchResponse, type search_SearchResult as SearchResult, type search_ShowWindowOptions as ShowWindowOptions, search_register as register };
589
+ type index_OnActionListener = OnActionListener;
590
+ type index_OnSearchListener = OnSearchListener;
591
+ type index_SearchAction = SearchAction;
592
+ type index_SearchAgent = SearchAgent;
593
+ type index_SearchAgentConfigurationData<T> = SearchAgentConfigurationData<T>;
594
+ type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
595
+ type index_SearchListenerRequest = SearchListenerRequest;
596
+ type index_SearchRequestContext = SearchRequestContext;
597
+ type index_SearchResponse = SearchResponse;
598
+ type index_SearchResult = SearchResult;
599
+ type index_SearchResultActionResponse = SearchResultActionResponse;
600
+ declare const index_getAgentConfiguration: typeof getAgentConfiguration;
601
+ declare const index_register: typeof register;
602
+ declare namespace index {
603
+ export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentConfigurationData as SearchAgentConfigurationData, 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_getAgentConfiguration as getAgentConfiguration, index_register as register };
344
604
  }
345
605
 
346
606
  declare global {
@@ -349,4 +609,4 @@ declare global {
349
609
  }
350
610
  }
351
611
 
352
- export { type AppPermissions, type LaunchContentOptions, search 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 };
612
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as OpenFin from '@openfin/core';
2
2
  import OpenFin__default from '@openfin/core';
3
3
  import * as NotificationsTypes from '@openfin/workspace/notifications';
4
- import { CLIDispatchedSearchResult, CLISearchListenerRequest, CLISearchListenerResponse, CLISearchResponse, SearchResult as SearchResult$1 } from '@openfin/workspace';
5
4
 
6
5
  /**
7
6
  * NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
@@ -298,49 +297,310 @@ declare function launchSupertab(id: string): Promise<void>;
298
297
  */
299
298
  declare function launchWorkspace(id: string): Promise<void>;
300
299
 
301
- type ActionedSearchResult = CLIDispatchedSearchResult;
302
- type SearchActionResponse = {
303
- url: string;
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;
304
343
  };
305
- type SearchListenerRequest = CLISearchListenerRequest;
306
- type SearchListenerResponse = CLISearchListenerResponse;
307
- type SearchProvider = {
308
- readonly configData: unknown;
309
- hideWindow: () => Promise<void>;
310
- readonly id: string;
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
+ * Sets whether or not the Search Agent is ready to provide search results.
350
+ *
351
+ * When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
352
+ *
353
+ * @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
354
+ */
311
355
  isReady: (ready?: boolean) => Promise<void>;
312
- readonly name: string;
313
- showWindow: (options?: ShowWindowOptions) => Promise<void>;
314
356
  };
315
- type SearchProviderRegistrationConfig = {
316
- onAction(result: ActionedSearchResult): Promise<SearchActionResponse | undefined>;
317
- onSearch(request: SearchListenerRequest, response: SearchListenerResponse): Promise<SearchResponse>;
357
+ /**
358
+ * The Search Agent’s configuration data as configured in the Here™ Admin Console.
359
+ *
360
+ * @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
361
+ */
362
+ type SearchAgentConfigurationData<T> = {
363
+ /**
364
+ * Custom configuration data specific to the Search Agent.
365
+ */
366
+ customData?: T;
367
+ /**
368
+ * Optional description of the Search Agent.
369
+ */
370
+ description?: string;
371
+ /**
372
+ * Unique identifier for the Search Agent.
373
+ */
374
+ id: string;
375
+ /**
376
+ * The display title of the Search Agent.
377
+ */
378
+ title: string;
379
+ /**
380
+ * The URL of the Search Agent.
381
+ */
382
+ url: string;
318
383
  };
319
- type SearchResponse = CLISearchResponse;
320
- type SearchResult = SearchResult$1;
321
- type ShowWindowOptions = {
322
- center?: boolean;
323
- height?: number;
324
- left?: number;
325
- resizable?: boolean;
326
- top?: number;
327
- width?: number;
384
+ /**
385
+ * Configuration provided when registering a Search Agent.
386
+ */
387
+ type SearchAgentRegistrationConfig = {
388
+ /**
389
+ * 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.
390
+ *
391
+ * The listener returns a response back to Here™ that includes a URL to navigate to.
392
+ */
393
+ onAction: OnActionListener;
394
+ /**
395
+ * This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
396
+ *
397
+ * Note: When the Search Agent is not ready this listener will not be called.
398
+ */
399
+ onSearch: OnSearchListener;
328
400
  };
401
+ /**
402
+ * Search request data provided to the {@link OnSearchListener}.
403
+ */
404
+ type SearchListenerRequest = {
405
+ /**
406
+ * Provides additional context for the search request.
407
+ */
408
+ context: SearchRequestContext;
409
+ /**
410
+ * The query entered by the user in Here™’s search UI.
411
+ */
412
+ query: string;
413
+ /**
414
+ * 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.
415
+ */
416
+ signal: AbortSignal;
417
+ };
418
+ /**
419
+ * Context data included with a search request.
420
+ */
421
+ type SearchRequestContext = {
422
+ /**
423
+ * The page number of the search results to return.
424
+ */
425
+ pageNumber: number;
426
+ /**
427
+ * The number of search results to return per page.
428
+ */
429
+ pageSize: number;
430
+ /**
431
+ * The unique ID of the query.
432
+ */
433
+ queryId: string;
434
+ };
435
+ /**
436
+ * Return type of the {@link OnSearchListener}.
437
+ */
438
+ type SearchResponse = {
439
+ /**
440
+ * The search results to display in Here™’s search UI.
441
+ */
442
+ results: SearchResult[];
443
+ };
444
+ /**
445
+ * A search result returned by a Search Agent in response to a search request.
446
+ */
447
+ type SearchResult = {
448
+ /**
449
+ * Actions that can be triggered by the user against the search result.
450
+ */
451
+ actions: SearchAction[];
452
+ /**
453
+ * Additional data that can be used by the {@link OnActionListener} when an action is triggered.
454
+ */
455
+ data?: Record<string, unknown>;
456
+ /**
457
+ * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
458
+ */
459
+ icon?: string;
460
+ /**
461
+ * Unique identifier for the search result.
462
+ */
463
+ key: string;
464
+ /**
465
+ * Secondary text that will be displayed with the search result in Here™’s search UI.
466
+ */
467
+ label?: string;
468
+ /**
469
+ * Primary text that will be displayed with the search result in Here™’s search UI.
470
+ */
471
+ title: string;
472
+ };
473
+ /**
474
+ * Return type of the {@link OnActionListener}.
475
+ */
476
+ type SearchResultActionResponse = {
477
+ /**
478
+ * URL that Here™ should navigate to.
479
+ */
480
+ url: string;
481
+ } | undefined;
329
482
 
330
- declare const register: (config: SearchProviderRegistrationConfig) => Promise<SearchProvider>;
483
+ /**
484
+ * Retrieves the Search Agent’s configuration data, as has been configured in the Here™ Admin Console.
485
+ *
486
+ * @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
487
+ *
488
+ * @example Retrieving the Search Agent’s configuration data:
489
+ * ```ts
490
+ * import { Search } from "@openfin/cloud-api";
491
+ *
492
+ * // Get the configuration data
493
+ * const configData = await Search.getAgentConfiguration<{ customField1: string, customField2: string }>();
494
+ *
495
+ * // Pick out the standard configuration properties
496
+ * const { customData, description, id, title, url } = configData;
497
+ *
498
+ * // Pick out the custom configuration properties
499
+ * if (customData) {
500
+ * const { customField1, customField2 } = customData;
501
+ * }
502
+ * ```
503
+ */
504
+ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
505
+ /**
506
+ * 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.
507
+ *
508
+ * @param config The configuration for the Search Agent.
509
+ *
510
+ * @returns A promise that resolves with the Search Agent.
511
+ *
512
+ * @example Registering a basic Search Agent:
513
+ * ```ts
514
+ * import { Search } from "@openfin/cloud-api";
515
+ *
516
+ * // Handle incoming action and return a response that includes the URL to navigate to
517
+ * const onAction: Search.OnActionListener = (action, result) => {
518
+ * const { name } = action;
519
+ * const { data, key } = result;
520
+ * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
521
+ * const { id: ownerId } = owner;
522
+ * console.log(`Action "${name}" triggered on search result with key "${key}"`);
523
+ * switch (name) {
524
+ * case "view-owner":
525
+ * return { url: `${searchResultHostUrl}/people/${ownerId}` };
526
+ * case "view-result":
527
+ * return { url: `${searchResultHostUrl}/record/${key}` };
528
+ * default:
529
+ * console.warn(`Unknown action: ${name}`);
530
+ * }
531
+ * };
532
+ *
533
+ * // Handle incoming search request and return relevant search results
534
+ * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
535
+ * const { pageNumber, pageSize } = context;
536
+ * try {
537
+ * let results: Search.SearchResult[] = [];
538
+ * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
539
+ * const response = await fetch(url, { signal });
540
+ * if (!response.ok) {
541
+ * throw new Error(`Request failed: ${response.status}`);
542
+ * }
543
+ * const { searchResults } = await response.json();
544
+ * results = searchResults.map((result) => {
545
+ * const { iconUrl, id: key, owner, subTitle, title } = result;
546
+ * const { name: ownerName } = owner as { id: string, name: string };
547
+ * return {
548
+ * actions: [
549
+ * {
550
+ * name: "view-result",
551
+ * description: `Go to ${title} in My Web App`,
552
+ * },
553
+ * {
554
+ * name: "view-owner",
555
+ * description: `Go to ${ownerName} in My Web App`,
556
+ * title: "View Owner",
557
+ * },
558
+ * ],
559
+ * data: {
560
+ * owner,
561
+ * searchResultHostUrl: `https://my-web-app.com`,
562
+ * },
563
+ * icon: iconUrl,
564
+ * key,
565
+ * label: subTitle,
566
+ * title,
567
+ * };
568
+ * });
569
+ * console.log("Returning results", results);
570
+ * return { results };
571
+ * } catch (err) {
572
+ * if ((err as Error).name === "AbortError") {
573
+ * // Ignore errors for cancelled requests
574
+ * return { results: [] };
575
+ * }
576
+ * throw err;
577
+ * }
578
+ * };
579
+ *
580
+ * // Register the search agent
581
+ * const searchAgent = await Search.register({ onAction, onSearch });
582
+ *
583
+ * // Set the Search Agent as ready to receive search requests
584
+ * await searchAgent.isReady();
585
+ * ```
586
+ */
587
+ declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
331
588
 
332
- type search_ActionedSearchResult = ActionedSearchResult;
333
- type search_SearchActionResponse = SearchActionResponse;
334
- type search_SearchListenerRequest = SearchListenerRequest;
335
- type search_SearchListenerResponse = SearchListenerResponse;
336
- type search_SearchProvider = SearchProvider;
337
- type search_SearchProviderRegistrationConfig = SearchProviderRegistrationConfig;
338
- type search_SearchResponse = SearchResponse;
339
- type search_SearchResult = SearchResult;
340
- type search_ShowWindowOptions = ShowWindowOptions;
341
- declare const search_register: typeof register;
342
- declare namespace search {
343
- export { type search_ActionedSearchResult as ActionedSearchResult, type search_SearchActionResponse as SearchActionResponse, type search_SearchListenerRequest as SearchListenerRequest, type search_SearchListenerResponse as SearchListenerResponse, type search_SearchProvider as SearchProvider, type search_SearchProviderRegistrationConfig as SearchProviderRegistrationConfig, type search_SearchResponse as SearchResponse, type search_SearchResult as SearchResult, type search_ShowWindowOptions as ShowWindowOptions, search_register as register };
589
+ type index_OnActionListener = OnActionListener;
590
+ type index_OnSearchListener = OnSearchListener;
591
+ type index_SearchAction = SearchAction;
592
+ type index_SearchAgent = SearchAgent;
593
+ type index_SearchAgentConfigurationData<T> = SearchAgentConfigurationData<T>;
594
+ type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
595
+ type index_SearchListenerRequest = SearchListenerRequest;
596
+ type index_SearchRequestContext = SearchRequestContext;
597
+ type index_SearchResponse = SearchResponse;
598
+ type index_SearchResult = SearchResult;
599
+ type index_SearchResultActionResponse = SearchResultActionResponse;
600
+ declare const index_getAgentConfiguration: typeof getAgentConfiguration;
601
+ declare const index_register: typeof register;
602
+ declare namespace index {
603
+ export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentConfigurationData as SearchAgentConfigurationData, 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_getAgentConfiguration as getAgentConfiguration, index_register as register };
344
604
  }
345
605
 
346
606
  declare global {
@@ -349,4 +609,4 @@ declare global {
349
609
  }
350
610
  }
351
611
 
352
- export { type AppPermissions, type LaunchContentOptions, search 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 };
612
+ 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 };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var v=Object.defineProperty;var E=(n,o)=>{for(var e in o)v(n,e,{get:o[e],enumerable:!0})};var t="@openfin/cloud-api";async function r(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function y(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 c="@openfin/cloud-api";function F(){return`${window.fin.me.uuid}-cloud-api-notifications`}var d=null;async function U(){return d||(d=P()),d}async function P(){if(!window.fin)throw new Error(`\`${c}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${c}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);y(window.fin.me);let n=await S();console.log(n),n.register("openfin-cloud-event",e=>{for(let i of o.get(e.type)??[])typeof e.payload.timestamp=="string"&&(e.payload.timestamp=new Date(e.payload.timestamp)),i(e.payload)});let o=new Map;return{addEventListener:(e,i)=>{let a=o.get(e)||new Set;a.add(i),o.set(e,a)},removeEventListener:(e,i)=>{let a=o.get(e);if(!a){console.warn(`\`${c}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,e);return}a.delete(i)===!1&&console.warn(`\`${c}\`: 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(`\`${c}\`: 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 u=null;async function S(){return u||(u=$()),u}async function $(){let n=await window.fin.InterApplicationBus.Channel.connect(F());return n.onDisconnection(o=>{console.warn(`\`${c}\`: Channel Disconnected from`,o,"Reconnecting..."),u=null}),n}var f;function b(){return`${window.fin.me.uuid}-client-api`}async function s(){return f||(f=window.fin.InterApplicationBus.Channel.connect(b())),f}async function q(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-settings")}async function D(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-user-settings")}async function V(n){if(!window.fin)throw new Error(`\`${t}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("set-user-settings",n)}async function B(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await s()).dispatch("get-user-permissions")}async function G(n,o){if(!window.fin)throw new Error(`\`${t}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let e=await s();try{await e.dispatch("launch-content",{id:n,options:o})}catch(i){switch(i instanceof Error?i.message:String(i)){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.`)}}}async function K(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let o=await s();try{await o.dispatch("launch-supertab",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchSupertab\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchSupertab\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchSupertab\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchSupertab\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}async function j(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await r()===!1)throw new Error(`${t}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let o=await s();try{await o.dispatch("launch-workspace",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchWorkspace\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchWorkspace\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchWorkspace\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchWorkspace\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}var g={};E(g,{register:()=>k});var A="get-results",R="handle-action",T={id:"",onClose:function(n){console.warn("Function not implemented.")},removeListener:function(n){console.warn("Function not implemented.")},query:""},O={open:function(){console.warn("Function not implemented.")},close:function(){console.warn("Function not implemented.")},respond:function(n){console.warn("Function not implemented.")},revoke:function(...n){console.warn("Function not implemented.")},updateContext:function(n){console.warn("Function not implemented.")}},k=async n=>{let o=await window.fin.me.getOptions(),{configuration:e,id:i,name:a}=o.customData,w=`search-provider-${o.customData.id}`;console.debug(`creating channel ${w}`);let h=await window.fin.InterApplicationBus.Channel.create(w);return h.register(R,async l=>{let{searchResult:p,actionId:m,viewIdentity:C}=l,N={action:{name:m,trigger:"user-action"},dispatcherIdentity:C,key:"",title:p.title,actions:[],data:p};return await n.onAction(N)}),h.register(A,async l=>{let p=Object.assign({},T,l);return(await n.onSearch(p,O)).results}),{configData:e,hideWindow:async function(){console.warn("Function not implemented.")},id:i,isReady:async function(l){console.warn("Function not implemented.")},name:a,showWindow:async function(){console.warn("Function not implemented.")}}};export{g as Search,q as getAppSettings,B as getAppUserPermissions,D as getAppUserSettings,U as getNotificationsClient,G as launchContent,K as launchSupertab,j as launchWorkspace,V as setAppUserSettings};
1
+ var Ve=Object.create;var mn=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var Ge=(o,u)=>()=>(u||o((u={exports:{}}).exports,u),u.exports),ze=(o,u)=>{for(var a in u)mn(o,a,{get:u[a],enumerable:!0})},Xe=(o,u,a,l)=>{if(u&&typeof u=="object"||typeof u=="function")for(let f of He(u))!je.call(o,f)&&f!==a&&mn(o,f,{get:()=>u[f],enumerable:!(l=qe(u,f))||l.enumerable});return o};var Je=(o,u,a)=>(a=o!=null?Ve(Ke(o)):{},Xe(u||!o||!o.__esModule?mn(a,"default",{value:o,enumerable:!0}):a,o));var Hn=Ge((It,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})}},u={};o.r(u),o.d(u,{SearchTagBackground:()=>on,create:()=>Un,defaultTopic:()=>Bn,subscribe:()=>Dn});var a={};o.r(a),o.d(a,{B:()=>de});var l={};o.r(l),o.d(l,{v:()=>De});let f="deregistered or does not exist",y=new Error(`provider ${f}`),A=new Error("provider with name already exists"),v=new Error("bad payload"),b=new Error("subscription rejected"),R=new Error(`channel ${f}`),x;function O(){if(x)return x;throw R}function K(){return x}function Sn(n){x=n}var S,$,tn,on;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(S||(S={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}($||($={})),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 j="0",Rn="1",En="2",bn="3",An="4",G="5",z="6",Jn=()=>{},rn=new Set;function Qn(n){rn.add(n)}function Yn(n){rn.delete(n)}let sn=new Set;function Zn(n){sn.add(n)}function ne(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 X(n){q.delete(n);let e=[...sn].map(t=>t());await Promise.all(e)}function cn(){return[...q.values()]}function Pn(){q.clear()}function I(n){return q.get(n)}function On(n,e,t){return{...n,action:t||{...n.actions[0],trigger:tn.UserAction},dispatcherIdentity:e}}function un(n,e,t="ascending"){let i=n||[];if(!e?.length)return i;let r=[],s=new Map;e.forEach(d=>{if(d.key)return s.set(d.key,d);r.push(d)});let c=i.map(d=>{let{key:h}=d;if(h&&s.has(h)){let C=s.get(h);return s.delete(h),C}return d});return c.push(...s.values(),...r),c=t==="ascending"?c.sort((d,h)=>(d?.score??1/0)-(h?.score??1/0)):c.sort((d,h)=>(h?.score??1/0)-(d?.score??1/0)),c}function In(n){let e={},t=[],i=[],r=null,s=S.Initial;e.getStatus=()=>s,e.getResultBuffer=()=>t,e.setResultBuffer=d=>{t=d,t?.length&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=d=>{i=d,i?.length&&e.onChange()},e.setUpdatedContext=d=>{r=d,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=Jn;let c={};return e.res=c,c.close=()=>{s!==S.Close&&(s=S.Close,e.onChange())},c.open=()=>{s!==S.Open&&(s=S.Open,e.onChange())},c.respond=d=>{let h=un(e.getResultBuffer(),d,n);e.setResultBuffer(h)},c.revoke=(...d)=>{let h=new Set(d),C=e.getResultBuffer().filter(({key:p})=>{let g=h.has(p);return g&&h.delete(p),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(p=>h.add(p)),e.setRevokedBuffer([...h]))},c.updateContext=d=>{e.setUpdatedContext(d)},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,ee=1e3,te=new Map;function ln(){return te}let oe=100;function ie(){return async n=>{if(!n||!n.id||!n.providerId){let p=v;return console.error(p),{error:p.message}}let{id:e,providerId:t}=n,i=I(t);if(!i){let p=y;return console.error(p),{error:p.message}}let r=ln(),s=r.get(n.id);s||(s=Ln(e,n),r.set(n.id,s));let c=In(),d=()=>{let p=c.getResultBuffer();c.setResultBuffer([]);let g=c.getRevokedBuffer();c.setRevokedBuffer([]);let L=c.getUpdatedContext();c.setUpdatedContext(null);let k=c.getStatus();(async function(D){(await O()).dispatch(j,D)})({id:e,providerId:t,results:p,revoked:g,status:k,context:L})},h=!0,C=!1;c.onChange=()=>{if(h)return h=!1,void d();C||(C=!0,setTimeout(()=>{C=!1,d()},oe))};try{let{results:p,context:g}=await i.onUserInput(s.req,c.res),L=c.getStatus();return{id:e,providerId:t,status:L,results:p,context:g}}catch(p){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.",p),{id:e,providerId:t,error:p?.message}}}}async function Fn(n,e){let t=e||await O(),i=J(),r={...n,identity:i,onResultDispatch:void 0},s=await t.dispatch(En,r);return await an({identity:i,...n}),s}async function re(n){return await(await O()).dispatch(bn,n),X(n)}async function se(n,e,t,i){let r=On(e,i??J(),t),s=I(n);if(s){let{onResultDispatch:d}=s;return d?d(r):void 0}let c={providerId:n,result:r};return(await O()).dispatch(G,c)}async function ae(n){let e={...n,context:n?.context||{}},t={},i=async function*(s,{setState:c}){let d=await O();for(;;){let h=await d.dispatch(Rn,s),C=h.error;if(C)throw new Error(C);let p=h;if(s.id=p.id,c(p.state),p.done)return p.value;yield p.value}}(e,{setState:s=>{t.state=s}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(s){(await O()).dispatch(z,{id:s})})(t.id)},t.next=()=>{if(r){let s=r;return r=void 0,s}return i.next()},t}async function ce(){return(await O()).dispatch(An,null)}async function ue(){let n=await O();x=void 0,Pn(),await n.disconnect()}let le=async n=>{let e=await xn(n);for(let t of cn())await Fn(t,e);return e};async function xn(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,ee))}}(n);return e.register(j,ie()),e.register(z,t=>{let i=ln(),r=i.get(t.id);r&&(r.close(),i.delete(t.id))}),e.register(G,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(v);let r=I(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=ln();for(let{req:r,close:s}of i.values())s(),i.delete(r.id);Sn(le(t))}}(n)),e}async function de(n){let e=K();e||(e=xn(n),Sn(e));let t=await e;return{getAllProviders:ce.bind(null),register:Fn.bind(null),search:ae.bind(null),deregister:re.bind(null),dispatch:se.bind(null),disconnect:ue.bind(null),channel:t}}let H;function Q(){if(H)return H;throw R}function pe(){return H}function fe(n){H=n}function he(){H=void 0}let dn=new Set;function we(n){dn.add(n)}function ge(n){dn.delete(n)}var T;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})(T||(T={}));let pn=typeof window<"u"&&typeof fin<"u",ye=(typeof process>"u"||process.env,typeof window<"u"),me=ye?window.origin:T.Local,Y=(pn&&fin.me.uuid,pn&&fin.me.name,pn&&fin.me.entityType,T.Local,T.Dev,T.Staging,T.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:me+n),$n=(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 Tn(){return[...cn()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function Ce(n){if(I(n.id))throw new Error("provider with name already exists");let e=J();return await an({identity:e,...n}),{workspaceVersion:$n||"",clientAPIVersion:n.clientAPIVersion||""}}async function ve(n){await X(n)}async function Se(n,e,t,i){let r=I(n);if(!r)throw y;let{onResultDispatch:s}=r;if(s)return s(On(e,i??J(),t))}async function*Re(n,e){let t=function(g,L){let k=[],D=[],B=[],E=[];for(let m of g){let N=In(m.scoreOrder),F={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};k.push(F),D.push(N);let M=(async()=>{try{let{results:W,context:nn}=await m.onUserInput(L,N.res);F.results=un(F.results||[],W,m.scoreOrder),F.context={...F.context,...nn}}catch(W){F.error=W}})();M.finally(()=>{M.done=!0}),E.push(M),B.push(B.length)}return{providerResponses:k,listenerResponses:D,openListenerResponses:B,initialResponsePromises:E}}(n.targets?n.targets.map(g=>I(g)).filter(g=>!!g):[...cn().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:s,initialResponsePromises:c}=t,d=$.Fetching,h=g=>{d=g,e.setState(d)},C,p=!1;n.onClose(()=>{p=!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($.Fetched),g=!0)}let L,k=!1,D=()=>{k=!0,L&&L()},B=[];for(let E of s){let m=r[E],N=i[E],F=m.getStatus();(F===S.Open||d===$.Fetching&&F===S.Initial)&&(B.push(E),m.onChange=D);let M=m.getResultBuffer();M.length&&(m.setResultBuffer([]),N.results=un(N.results||[],M),g=!0);let W=m.getRevokedBuffer();if(W.length){m.setRevokedBuffer([]);let Me=new Set(W);N.results=(N.results||[]).filter(({key:We})=>!Me.has(We)),g=!0}let nn=m.getUpdatedContext();nn&&(m.setUpdatedContext(null),N.context={...N.context,...nn},g=!0)}if(s=B,g&&(yield i),p)break;k||(s.length||c.length)&&await Promise.race([...c,new Promise(E=>{L=E}),new Promise(E=>{C=E})])}while(s.length||c.length);return h($.Complete),i}let fn=0;async function kn(n){fn+=1;let e=Ln(fn.toString(),n),t=Re(e.req,{setState:i=>{t.state=i}});return t.id=fn.toString(),t.close=e.close,t.state=$.Fetching,t}let Z=new Map,Ee=1e4;function be(){return async n=>{if(!n)return console.error(v),{error:v.message};let e;if(n.id)e=n.id;else{let r=await kn(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)},Ee)}(e),{...i,id:n.id,state:t.generator.state}}}function Ae(n,e){return Q().dispatch(n,z,{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},d=await s.dispatch(n.identity,j,c),h=d.error;if(h)throw new Error(h);return d}let hn=new Map;function Ie(n,e){return`${n.name}:${n.uuid}:${e}`}let wn=new Map;function _n(n,e){return`${n}:${e}`}function Le(n){let e=Ie.bind(null,n.identity),t=Ae.bind(null,n.identity),i=Oe.bind(null,n);return async(r,s)=>{let c=e(r.id);if(!hn.has(c)){let p=()=>{t(r.id),hn.delete(c)};hn.set(c,p),r.onClose(p)}let d=_n(n.id,r.id),h=()=>{wn.delete(d),s.close()};r.onClose(h),wn.set(d,p=>{p.results?.length&&s.respond(p.results),p.revoked?.length&&s.revoke(...p.revoked),p.context&&s.updateContext(p.context),p.status===S.Open&&s.open(),p.status===S.Close&&h()});let C=await i(r);return C.status===S.Open&&s.open(),C.status!==S.Close&&C.status!==S.Initial||h(),C}}function Ne(n){return async e=>{let t=Q(),i={providerId:n.id,result:e};return t.dispatch(n.identity,G,i)}}let U=new Map;function gn(n){return`${n.name}-${n.uuid}`}function Fe(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(v);if(I(n.id))throw A;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:Le(t),onResultDispatch:Ne(t)})}(n),{workspaceVersion:$n||"",clientAPIVersion:n.clientAPIVersion||""}}}function xe(){return(n,e)=>{n?function(t,i){let r=I(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 d=c.findIndex(h=>h===t);d!==-1&&(c.splice(d,1),X(t))}}(n,e):console.error(v)}}let yn=new Set;function $e(n){yn.add(n)}function Te(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)X(r);U.delete(t)}})(n),yn.forEach(e=>e(n))}}async function _e(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(z,Pe()),e.register(j,i=>{let r=_n(i.providerId,i.id),s=wn.get(r);s&&s(i)}),e.register(En,Fe()),e.register(bn,xe()),e.register(An,async()=>Tn()),e.register(Rn,be()),e.register(G,async(i,r)=>{if(!i||!i.providerId||!i.result)return void console.error(v);let s=I(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 Ue(){let n=Q();he(),await n.destroy(),Pn()}async function De(n){let e=pe();e||(e=await _e(n),fe(e));let t=ge.bind(null),i=Te.bind(null),r=Yn.bind(null),s=ne.bind(null);return{getAllProviders:Tn.bind(null),search:kn.bind(null),register:Ce.bind(null),deregister:ve.bind(null),onSubscription:we.bind(null),onDisconnect:$e.bind(null),onRegister:Qn.bind(null),onDeregister:Zn.bind(null),dispatch:Se.bind(null),disconnect:Ue.bind(null),removeListener:c=>{t(c),i(c),r(c),s(c)},channel:e}}let{v:Un}=l,{B:Dn}=a,Bn="all",Be={create:Un,subscribe:Dn,defaultTopic:Bn},Mn=()=>{window.search=Be},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=u})()});var w="@openfin/cloud-api";async function P(){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 Qe(){return`${window.fin.me.uuid}-cloud-api-notifications`}var Cn=null;async function yt(){return Cn||(Cn=Ye()),Cn}async function Ye(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Vn(window.fin.me);let o=await Ze();console.log(o),o.register("openfin-cloud-event",a=>{for(let l of u.get(a.type)??[])typeof a.payload.timestamp=="string"&&(a.payload.timestamp=new Date(a.payload.timestamp)),l(a.payload)});let u=new Map;return{addEventListener:(a,l)=>{let f=u.get(a)||new Set;f.add(l),u.set(a,f)},removeEventListener:(a,l)=>{let f=u.get(a);if(!f){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}f.delete(l)===!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 Ze(){return en||(en=nt()),en}async function nt(){let o=await window.fin.InterApplicationBus.Channel.connect(Qe());return o.onDisconnection(u=>{console.warn(`\`${V}\`: Channel Disconnected from`,u,"Reconnecting..."),en=null}),o}var vn;function et(){return`${window.fin.me.uuid}-client-api`}async function _(){return vn||(vn=window.fin.InterApplicationBus.Channel.connect(et())),vn}async function vt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-settings")}async function St(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-settings")}async function Rt(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("set-user-settings",o)}async function Et(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await _()).dispatch("get-user-permissions")}async function bt(o,u){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await P()===!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:u})}catch(l){switch(l instanceof Error?l.message:String(l)){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 At(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await P()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let u=await _();try{await u.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 P()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let u=await _();try{await u.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={};ze(Xn,{getAgentConfiguration:()=>Gn,register:()=>zn});var jn=Je(Hn(),1),tt="log-message-",ot="open-url",it="provider-status-",rt="registered-",st="1.0";function at(o,u){let{data:a,iconSize:l,rightSideIcon:f,...y}=o;return{...y,data:{customData:a,iconSize:l,providerId:u,resultType:"app",rightSideIcon:f}}}function Kn(o){return{...o,data:o.data.customData}}async function Gn(){let{customData:o}=await window.fin.me.getOptions();return o}function ct(){return`${window.fin.me.identity.uuid}-cloud-api-search`}async function ut(o,u,a,l=!0){await u("info",`Setting status as ${l?"ready":"not ready"}`);try{await o.dispatch(`${it}${a}`,{isReady:l})}catch(f){let y=["Error setting provider status",f];console.error(...y),u("error",...y)}}async function lt(o,u,a,...l){try{await o.dispatch(`${tt}${u}`,{level:a,message:l})}catch(f){console.error("Error logging message",f)}}async function dt(o,u,a,l,f){let{action:y,dispatcherIdentity:A,...v}=f;await a("info","Handling action",{action:y,dispatcherIdentity:A,result:v});let b;try{let x=Kn(f).actions?.find(({name:K})=>K===y.name);if(!x)throw new Error("Original action not found in search result");b=(await l(x,Kn(f)))?.url}catch(R){throw await a("error","Error handling dispatch",R),R}if(!b){await a("warn","OnActionListener did not return a URL");return}await ft(o,a,u,b,A)}async function pt(o,u,a,l){await u("info","Getting search results",{request:l});try{let f=new AbortController;l.onClose(()=>f.abort());let{context:y,query:A}=l,{results:v}=await a({context:y,query:A,signal:f.signal}),b=v.map(R=>at(R,o));return await u("info","Returning results",b),{results:b}}catch(f){let y=["Error handling search",f];throw console.error(...y),u("error",...y),f}}async function ft(o,u,a,l,f){await u("info","Opening URL",{url:l,targetIdentity:f});try{await o.dispatch(ot,{url:l,targetIdentity:f,providerId:a})}catch(y){let A=["Error opening URL",y];console.error(...A),u("error",...A)}}async function zn(o){let a=(await window.fin.me.getOptions()).customData,{id:l,title:f}=a,{onAction:y,onSearch:A}=o,v=await jn.subscribe(ct()),b=v.channel,R=lt.bind(null,b,l);return await v.register({icon:"",id:l,onResultDispatch:dt.bind(null,b,l,R,y),onUserInput:pt.bind(null,l,R,A),title:f}),await v.channel.dispatch(`${rt}${l}`,{version:st}),R("info","Registered search topic",{id:l,title:f}),{isReady:ut.bind(null,b,R,l)}}export{Xn as Search,vt as getAppSettings,Et as getAppUserPermissions,St as getAppUserSettings,yt as getNotificationsClient,bt as launchContent,At as launchSupertab,Pt as launchWorkspace,Rt as setAppUserSettings};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils.ts","../src/notifications.ts","../src/client-api.ts","../src/search/search.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/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 @typescript-eslint/no-unused-vars */\n\nimport type { ActionTrigger, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchResult } from '@openfin/workspace';\n\nimport type { SearchProvider, SearchProviderProxyPayloadInternal, SearchProviderRegistrationConfig, SearchProviderWindowCreationOptions } from './search.types';\n\nconst TOPIC_NAME_GET_RESULTS = 'get-results';\nconst TOPIC_NAME_HANDLE_ACTION = 'handle-action';\n\nconst searchListenerRequest: SearchListenerRequest = {\n id: '',\n onClose: function (listener: () => void): void {\n console.warn('Function not implemented.');\n },\n removeListener: function (listener: () => void): void {\n console.warn('Function not implemented.');\n },\n query: '',\n};\n\nconst searchListenerResponse: SearchListenerResponse = {\n open: function (): void {\n console.warn('Function not implemented.');\n },\n close: function (): void {\n console.warn('Function not implemented.');\n },\n respond: function (results: SearchResult[]): void {\n console.warn('Function not implemented.');\n },\n revoke: function (...resultKeys: string[]): void {\n console.warn('Function not implemented.');\n },\n updateContext: function (context: unknown): void {\n console.warn('Function not implemented.');\n },\n};\n\nexport const register = async (config: SearchProviderRegistrationConfig): Promise<SearchProvider> => {\n // TODO: Update this to use @openfin/search-api\n const windowOptions = await window.fin.me.getOptions();\n const { configuration, id, name } = windowOptions.customData as SearchProviderWindowCreationOptions;\n const channelName = `search-provider-${windowOptions.customData.id}`;\n console.debug(`creating channel ${channelName}`);\n const channelProvider = await window.fin.InterApplicationBus.Channel.create(channelName);\n channelProvider.register(TOPIC_NAME_HANDLE_ACTION, async (payload: unknown) => {\n const { searchResult, actionId, viewIdentity } = payload as SearchProviderProxyPayloadInternal;\n const result: DispatchedSearchResult = {\n action: { name: actionId, trigger: 'user-action' as typeof ActionTrigger.UserAction },\n dispatcherIdentity: viewIdentity,\n key: '',\n title: searchResult.title,\n actions: [],\n data: searchResult,\n };\n const response = await config.onAction(result);\n return response;\n });\n channelProvider.register(TOPIC_NAME_GET_RESULTS, async (payload) => {\n const request = Object.assign({}, searchListenerRequest, payload);\n const response = await config.onSearch(request, searchListenerResponse);\n return response.results;\n });\n\n return {\n configData: configuration,\n hideWindow: async function (): Promise<void> {\n console.warn('Function not implemented.');\n },\n id,\n isReady: async function (ready?: boolean): Promise<void> {\n console.warn('Function not implemented.');\n },\n name,\n showWindow: async function (): Promise<void> {\n console.warn('Function not implemented.');\n },\n };\n};\n\nexport type {\n ActionedSearchResult,\n SearchActionResponse,\n SearchListenerRequest,\n SearchListenerResponse,\n SearchProvider,\n SearchProviderRegistrationConfig,\n SearchResponse,\n SearchResult,\n ShowWindowOptions,\n} from './search.types';\n"],"mappings":"0FAEO,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,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,EAAIH,EAC3CI,EAAiC,CACnC,OAAQ,CAAE,KAAMF,EAAU,QAAS,aAAiD,EACpF,mBAAoBC,EACpB,IAAK,GACL,MAAOF,EAAa,MACpB,QAAS,CAAC,EACV,KAAMA,CACV,EAEA,OADiB,MAAMR,EAAO,SAASW,CAAM,CAEjD,CAAC,EACDL,EAAgB,SAASd,EAAwB,MAAOe,GAAY,CAChE,IAAMK,EAAU,OAAO,OAAO,CAAC,EAAGlB,EAAuBa,CAAO,EAEhE,OADiB,MAAMP,EAAO,SAASY,EAAShB,CAAsB,GACtD,OACpB,CAAC,EAEM,CACH,WAAYM,EACZ,WAAY,gBAAiC,CACzC,QAAQ,KAAK,2BAA2B,CAC5C,EACA,GAAAC,EACA,QAAS,eAAgBU,EAAgC,CACrD,QAAQ,KAAK,2BAA2B,CAC5C,EACA,KAAAT,EACA,WAAY,gBAAiC,CACzC,QAAQ,KAAK,2BAA2B,CAC5C,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","options","channel","error","launchSupertab","launchWorkspace","search_exports","__export","register","TOPIC_NAME_GET_RESULTS","TOPIC_NAME_HANDLE_ACTION","searchListenerRequest","listener","searchListenerResponse","results","resultKeys","context","config","windowOptions","configuration","id","name","channelName","channelProvider","payload","searchResult","actionId","viewIdentity","result","request","ready"]}
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 { getAgentConfiguration, register } from './search';\nexport type {\n OnActionListener,\n OnSearchListener,\n SearchAction,\n SearchAgent,\n SearchAgentConfigurationData,\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 SearchAgentConfigurationData,\n SearchAgentLogLevel,\n SearchAgentRegistrationConfig,\n SearchAgentWindowCustomData,\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, iconSize, rightSideIcon, ...otherProps } = result as SearchResult & {\n iconSize?: 'standard' | 'large';\n rightSideIcon?: string;\n };\n return {\n ...otherProps,\n data: {\n customData: data,\n iconSize,\n providerId,\n resultType: 'app',\n rightSideIcon,\n },\n };\n}\n\nfunction convertToSearchResult(result: WorkspaceSearch.SearchResult): SearchResult {\n return {\n ...result,\n data: result.data.customData,\n };\n}\n\n/**\n * Retrieves the Search Agent’s configuration data, as has been configured in the Here™ Admin Console.\n *\n * @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.\n *\n * @example Retrieving the Search Agent’s configuration data:\n * ```ts\n * import { Search } from \"@openfin/cloud-api\";\n *\n * // Get the configuration data\n * const configData = await Search.getAgentConfiguration<{ customField1: string, customField2: string }>();\n *\n * // Pick out the standard configuration properties\n * const { customData, description, id, title, url } = configData;\n *\n * // Pick out the custom configuration properties\n * if (customData) {\n * const { customField1, customField2 } = customData;\n * }\n * ```\n */\nexport async function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>> {\n const { customData } = await window.fin.me.getOptions();\n return customData;\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 agentId: string,\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, agentId, url, dispatcherIdentity);\n}\n\nasync function onUserInput(\n agentId: string,\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, agentId));\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 * import { Search } from \"@openfin/cloud-api\";\n *\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 SearchAgentWindowCustomData;\n const { 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, id, logMessageBound, onAction),\n onUserInput: onUserInput.bind(null, id, 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 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,OAAO,eAAeF,EAAEE,EAAE,CAAC,WAAW,GAAG,IAAID,EAAEC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAACH,EAAEC,IAAI,OAAO,UAAU,eAAe,KAAKD,EAAEC,CAAC,EAAE,EAAED,GAAG,CAAc,OAAO,OAApB,KAA4B,OAAO,aAAa,OAAO,eAAeA,EAAE,OAAO,YAAY,CAAC,MAAM,QAAQ,CAAC,EAAE,OAAO,eAAeA,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAEC,EAAE,CAAC,EAAED,EAAE,EAAEC,CAAC,EAAED,EAAE,EAAEC,EAAE,CAAC,oBAAoB,IAAIG,GAAE,OAAO,IAAIC,GAAG,aAAa,IAAIC,GAAG,UAAU,IAAIC,EAAE,CAAC,EAAE,IAAIL,EAAE,CAAC,EAAEF,EAAE,EAAEE,CAAC,EAAEF,EAAE,EAAEE,EAAE,CAAC,EAAE,IAAIM,EAAE,CAAC,EAAE,IAAIL,EAAE,CAAC,EAAEH,EAAE,EAAEG,CAAC,EAAEH,EAAE,EAAEG,EAAE,CAAC,EAAE,IAAIM,EAAE,CAAC,EAA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0BAA2B,CAAE,GAAAf,EAAI,MAAAa,CAAM,CAAC,EAEzD,CACH,QAAS5B,GAAQ,KAAK,KAAMC,EAAS6B,EAAiBf,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","me","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","getAgentConfiguration","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","iconSize","rightSideIcon","otherProps","convertToSearchResult","getAgentConfiguration","customData","getSearchApiChannelName","isReady","channel","logMessage","ready","error","args","level","onResultDispatch","agentId","onAction","searchResult","action","dispatcherIdentity","url","originalAction","id","openUrl","onUserInput","onSearch","request","abortController","context","query","results","convertedResults","targetIdentity","register","config","title","topic","logMessageBound"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/cloud-api",
3
- "version": "0.0.1-alpha.fe757e1",
3
+ "version": "0.0.1-alpha.ff44012",
4
4
  "sideEffects": false,
5
5
  "description": "",
6
6
  "exports": {
@@ -18,18 +18,19 @@
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"
21
+ "lint:fix": "eslint . --fix --max-warnings 0",
22
+ "docs": "typedoc --treatWarningsAsErrors"
22
23
  },
23
24
  "files": [
24
25
  "dist"
25
26
  ],
26
- "dependencies": {
27
- "@openfin/core": "^38.83.75"
28
- },
29
27
  "devDependencies": {
30
- "@openfin/workspace": "^19.3.0",
31
- "@typescript-eslint/eslint-plugin": "^7.5.0",
32
- "@typescript-eslint/parser": "^7.15.0",
28
+ "@openfin/core": "41.102.4",
29
+ "@openfin/search-api": "^2.0.1",
30
+ "@openfin/typedoc-theme": "^2.0.0",
31
+ "@openfin/workspace": "22.2.18",
32
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
33
+ "@typescript-eslint/parser": "^8.20.0",
33
34
  "eslint": "^8.57.0",
34
35
  "eslint-config-prettier": "^9.1.0",
35
36
  "eslint-plugin-check-file": "^2.8.0",
@@ -37,8 +38,9 @@
37
38
  "eslint-plugin-simple-import-sort": "^12.1.1",
38
39
  "eslint-plugin-unicorn": "^55.0.0",
39
40
  "prettier": "^3.3.3",
40
- "tsup": "^8.2.4",
41
- "typescript": "^5.5.4"
41
+ "tsup": "^8.3.0",
42
+ "typedoc": "^0.26.11",
43
+ "typescript": "^5.6.3"
42
44
  },
43
45
  "eslintConfig": {
44
46
  "env": {