@openfin/cloud-api 0.0.1-alpha.fe757e1 → 0.0.1-alpha.fe96ffc
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +245 -38
- package/dist/index.d.ts +245 -38
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
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 He=Object.create;var Cn=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var ze=(o,c)=>()=>(c||o((c={exports:{}}).exports,c),c.exports),Je=(o,c)=>{for(var s in c)Cn(o,s,{get:c[s],enumerable:!0})},Qe=(o,c,s,d)=>{if(c&&typeof c=="object"||typeof c=="function")for(let p of Ge(c))!Xe.call(o,p)&&p!==s&&Cn(o,p,{get:()=>c[p],enumerable:!(d=Ke(c,p))||d.enumerable});return o};var Ye=(o,c,s)=>(s=o!=null?He(je(o)):{},Qe(c||!o||!o.__esModule?Cn(s,"default",{value:o,enumerable:!0}):s,o));var jn=ze((Lt,Gn)=>{"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})}},c={};o.r(c),o.d(c,{SearchTagBackground:()=>sn,create:()=>Bn,defaultTopic:()=>Vn,subscribe:()=>Mn});var s={};o.r(s),o.d(s,{B:()=>we});var d={};o.r(d),o.d(d,{v:()=>Be});let p="deregistered or does not exist",y=new Error(`provider ${p}`),P=new Error("provider with name already exists"),S=new Error("bad payload"),b=new Error("subscription rejected"),O=new Error(`channel ${p}`),R;function I(){if(R)return R;throw O}function K(){return R}function Rn(n){R=n}var $;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})($||($={}));let on=typeof window<"u"&&typeof fin<"u",Yn=(typeof process>"u"||process.env,typeof window<"u"),Zn=Yn?window.origin:$.Local,G=(on&&fin.me.uuid,on&&fin.me.name,on&&fin.me.entityType,$.Local,$.Dev,$.Staging,$.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:Zn+n),En=(G("http://localhost:4002"),G("http://localhost:4002"),typeof WORKSPACE_DOCS_PLATFORM_URL<"u"&&G(WORKSPACE_DOCS_PLATFORM_URL),typeof WORKSPACE_DOCS_CLIENT_URL<"u"&&G(WORKSPACE_DOCS_CLIENT_URL),"20.1.1");typeof WORKSPACE_BUILD_SHA<"u"&&WORKSPACE_BUILD_SHA;var j,bn;(function(n){n.Workspace="openfin-workspace",n.OldWorkspace="openfin-browser"})(j||(j={})),function(n){n.FinProtocol="fin-protocol"}(bn||(bn={})),j.Workspace;var v,x,rn,sn;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(v||(v={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}(x||(x={})),function(n){n.UserAction="user-action",n.FocusChange="focus-change",n.Reload="reload"}(rn||(rn={})),function(n){n.Active="active",n.Default="default"}(sn||(sn={}));let On=`__search-${`${j.OldWorkspace}-home`}-topic__`,X="0",Pn="1",An="2",In="3",Ln="4",z="5",J="6",ne=()=>{},an=new Set;function ee(n){an.add(n)}function te(n){an.delete(n)}let cn=new Set;function oe(n){cn.add(n)}function ie(n){cn.delete(n)}let q=new Map;async function ln(n){q.set(n.id,n);let e=[...an].map(t=>t());await Promise.all(e)}async function Q(n){q.delete(n);let e=[...cn].map(t=>t());await Promise.all(e)}function un(){return[...q.values()]}function Nn(){q.clear()}function L(n){return q.get(n)}function Fn(n,e,t){return{...n,action:t||{...n.actions[0],trigger:rn.UserAction},dispatcherIdentity:e}}function dn(n,e,t="ascending"){let i=n||[];if(!_optionalChain([e, 'optionalAccess', _2 => _2.length]))return i;let r=[],a=new Map;e.forEach(u=>{if(u.key)return a.set(u.key,u);r.push(u)});let l=i.map(u=>{let{key:h}=u;if(h&&a.has(h)){let C=a.get(h);return a.delete(h),C}return u});return l.push(...a.values(),...r),l=t==="ascending"?l.sort((u,h)=>(_nullishCoalesce(_optionalChain([u, 'optionalAccess', _3 => _3.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _4 => _4.score]), () => (1/0)))):l.sort((u,h)=>(_nullishCoalesce(_optionalChain([h, 'optionalAccess', _5 => _5.score]), () => (1/0)))-(_nullishCoalesce(_optionalChain([u, 'optionalAccess', _6 => _6.score]), () => (1/0)))),l}function kn(n){let e={},t=[],i=[],r=null,a=v.Initial;e.getStatus=()=>a,e.getResultBuffer=()=>t,e.setResultBuffer=u=>{t=u,_optionalChain([t, 'optionalAccess', _7 => _7.length])&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=u=>{i=u,_optionalChain([i, 'optionalAccess', _8 => _8.length])&&e.onChange()},e.setUpdatedContext=u=>{r=u,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=ne;let l={};return e.res=l,l.close=()=>{a!==v.Close&&(a=v.Close,e.onChange())},l.open=()=>{a!==v.Open&&(a=v.Open,e.onChange())},l.respond=u=>{let h=dn(e.getResultBuffer(),u,n);e.setResultBuffer(h)},l.revoke=(...u)=>{let h=new Set(u),C=e.getResultBuffer().filter(({key:f})=>{let g=h.has(f);return g&&h.delete(f),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(f=>h.add(f)),e.setRevokedBuffer([...h]))},l.updateContext=u=>{e.setUpdatedContext(u)},e}function $n(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 Y(){return{name:fin.me.name,uuid:fin.me.uuid}}let xn=50,re=1e3,se=new Map;function pn(){return se}let ae=100;function ce(){return async n=>{if(!n||!n.id||!n.providerId){let f=S;return console.error(f),{error:f.message}}let{id:e,providerId:t}=n,i=L(t);if(!i){let f=y;return console.error(f),{error:f.message}}let r=pn(),a=r.get(n.id);a||(a=$n(e,n),r.set(n.id,a));let l=kn(),u=()=>{let f=l.getResultBuffer();l.setResultBuffer([]);let g=l.getRevokedBuffer();l.setRevokedBuffer([]);let N=l.getUpdatedContext();l.setUpdatedContext(null);let _=l.getStatus();(async function(D){(await I()).dispatch(X,D)})({id:e,providerId:t,results:f,revoked:g,status:_,context:N})},h=!0,C=!1;l.onChange=()=>{if(h)return h=!1,void u();C||(C=!0,setTimeout(()=>{C=!1,u()},ae))};try{let{results:f,context:g}=await i.onUserInput(a.req,l.res),N=l.getStatus();return{id:e,providerId:t,status:N,results:f,context:g}}catch(f){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${t} for search ${e}`,"This is likely a bug in the implementation of the search provider.",f),{id:e,providerId:t,error:_optionalChain([f, 'optionalAccess', _10 => _10.message])}}}}async function _n(n,e){let t=e||await I(),i=Y(),r={...n,identity:i,onResultDispatch:void 0},a=await t.dispatch(An,r);return await ln({identity:i,...n}),a}async function le(n){return await(await I()).dispatch(In,n),Q(n)}async function ue(n,e,t,i){let r=Fn(e,_nullishCoalesce(i, () => (Y())),t),a=L(n);if(a){let{onResultDispatch:u}=a;return u?u(r):void 0}let l={providerId:n,result:r};return(await I()).dispatch(z,l)}async function de(n){let e={...n,context:_optionalChain([n, 'optionalAccess', _11 => _11.context])||{}},t={},i=async function*(a,{setState:l}){let u=await I();for(;;){let h=await u.dispatch(Pn,a),C=h.error;if(C)throw new Error(C);let f=h;if(a.id=f.id,l(f.state),f.done)return f.value;yield f.value}}(e,{setState:a=>{t.state=a}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(a){(await I()).dispatch(J,{id:a})})(t.id)},t.next=()=>{if(r){let a=r;return r=void 0,a}return i.next()},t}async function pe(){return(await I()).dispatch(Ln,null)}async function fe(){let n=await I();R=void 0,Nn(),await n.disconnect()}let he=async()=>{let n=await Tn();for(let e of un())await _n(e,n);return n};async function Tn(){let n=await async function(e){for(let t=0;t<xn;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(i){if(t===xn-1)throw i;await new Promise(r=>setTimeout(r,re))}}(On);return n.register(X,ce()),n.register(J,e=>{let t=pn(),i=t.get(e.id);i&&(i.close(),t.delete(e.id))}),n.register(z,async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(S);let i=L(e.providerId);if(!i)return void console.error(y);let{onResultDispatch:r}=i;return r?(e.result.dispatcherIdentity=_nullishCoalesce(e.result.dispatcherIdentity, () => (t)),r(e.result)):void 0}),n.onDisconnection(async()=>{if(!K())return;let e=pn();for(let{req:t,close:i}of e.values())i(),e.delete(t.id);Rn(he())}),n}async function we(){let n=K();n||(n=Tn(),Rn(n));let e=await n;return{getAllProviders:pe.bind(null),register:_n.bind(null),search:de.bind(null),deregister:le.bind(null),dispatch:ue.bind(null),disconnect:fe.bind(null),channel:e}}let H;function Z(){if(H)return H;throw O}function ge(){return H}function ye(n){H=n}function me(){H=void 0}let fn=new Set;function Ce(n){fn.add(n)}function ve(n){fn.delete(n)}async function Un(){return[...un()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function Se(n){if(L(n.id))throw new Error("provider with name already exists");let e=Y();return await ln({identity:e,...n}),{workspaceVersion:En||"",clientAPIVersion:n.clientAPIVersion||""}}async function Re(n){await Q(n)}async function Ee(n,e,t,i){let r=L(n);if(!r)throw y;let{onResultDispatch:a}=r;if(a)return a(Fn(e,_nullishCoalesce(i, () => (Y())),t))}async function*be(n,e){let t=function(g,N){let _=[],D=[],W=[],E=[];for(let m of g){let F=kn(m.scoreOrder),k={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};_.push(k),D.push(F);let B=(async()=>{try{let{results:M,context:en}=await m.onUserInput(N,F.res);k.results=dn(k.results||[],M,m.scoreOrder),k.context={...k.context,...en}}catch(M){k.error=M}})();B.finally(()=>{B.done=!0}),E.push(B),W.push(W.length)}return{providerResponses:_,listenerResponses:D,openListenerResponses:W,initialResponsePromises:E}}(n.targets?n.targets.map(g=>L(g)).filter(g=>!!g):[...un().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:a,initialResponsePromises:l}=t,u=x.Fetching,h=g=>{u=g,e.setState(u)},C,f=!1;n.onClose(()=>{f=!0,C&&C()});do{let g=!1;if(l.length){let E=[];for(let m of l)m.done?g=!0:E.push(m);l=E,l.length||(h(x.Fetched),g=!0)}let N,_=!1,D=()=>{_=!0,N&&N()},W=[];for(let E of a){let m=r[E],F=i[E],k=m.getStatus();(k===v.Open||u===x.Fetching&&k===v.Initial)&&(W.push(E),m.onChange=D);let B=m.getResultBuffer();B.length&&(m.setResultBuffer([]),F.results=dn(F.results||[],B),g=!0);let M=m.getRevokedBuffer();if(M.length){m.setRevokedBuffer([]);let Ve=new Set(M);F.results=(F.results||[]).filter(({key:qe})=>!Ve.has(qe)),g=!0}let en=m.getUpdatedContext();en&&(m.setUpdatedContext(null),F.context={...F.context,...en},g=!0)}if(a=W,g&&(yield i),f)break;_||(a.length||l.length)&&await Promise.race([...l,new Promise(E=>{N=E}),new Promise(E=>{C=E})])}while(a.length||l.length);return h(x.Complete),i}let hn=0;async function Dn(n){hn+=1;let e=$n(hn.toString(),n),t=be(e.req,{setState:i=>{t.state=i}});return t.id=hn.toString(),t.close=e.close,t.state=x.Fetching,t}let nn=new Map,Oe=1e4;function Pe(){return async n=>{if(!n)return console.error(S),{error:S.message};let e;if(n.id)e=n.id;else{let r=await Dn(n);e=r.id,n.id=r.id,nn.set(e,{generator:r})}let t=nn.get(e);clearTimeout(t.timeout);let i=await t.generator.next();return t.timeout=function(r){return window.setTimeout(()=>{nn.delete(r)},Oe)}(e),{...i,id:n.id,state:t.generator.state}}}function Ae(n,e){return Z().dispatch(n,J,{id:e})}function Ie(){return n=>function(e){let t=nn.get(e);t&&t.generator.close()}(n.id)}async function Le(n,{id:e,query:t,context:i,targets:r=[]}){let a=Z(),l={id:e,query:t,context:i,targets:r,providerId:n.id},u=await a.dispatch(n.identity,X,l),h=u.error;if(h)throw new Error(h);return u}let wn=new Map;function Ne(n,e){return`${n.name}:${n.uuid}:${e}`}let gn=new Map;function Wn(n,e){return`${n}:${e}`}function Fe(n){let e=Ne.bind(null,n.identity),t=Ae.bind(null,n.identity),i=Le.bind(null,n);return async(r,a)=>{let l=e(r.id);if(!wn.has(l)){let f=()=>{t(r.id),wn.delete(l)};wn.set(l,f),r.onClose(f)}let u=Wn(n.id,r.id),h=()=>{gn.delete(u),a.close()};r.onClose(h),gn.set(u,f=>{_optionalChain([f, 'access', _12 => _12.results, 'optionalAccess', _13 => _13.length])&&a.respond(f.results),_optionalChain([f, 'access', _14 => _14.revoked, 'optionalAccess', _15 => _15.length])&&a.revoke(...f.revoked),f.context&&a.updateContext(f.context),f.status===v.Open&&a.open(),f.status===v.Close&&h()});let C=await i(r);return C.status===v.Open&&a.open(),C.status!==v.Close&&C.status!==v.Initial||h(),C}}function ke(n){return async e=>{let t=Z(),i={providerId:n.id,result:e};return t.dispatch(n.identity,z,i)}}let U=new Map;function yn(n){return`${n.name}-${n.uuid}`}function $e(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(S);if(L(n.id))throw P;return n.identity=e,await async function(t){let i=yn(t.identity);U.has(i)||U.set(i,[]),U.get(i).push(t.id),await ln({...t,onUserInput:Fe(t),onResultDispatch:ke(t)})}(n),{workspaceVersion:En||"",clientAPIVersion:n.clientAPIVersion||""}}}function xe(){return(n,e)=>{n?function(t,i){let r=L(t);if(!r)return;if(r.identity.uuid!==i.uuid||r.identity.name!==i.name)throw y;let a=yn(r.identity),l=U.get(a);if(l){let u=l.findIndex(h=>h===t);u!==-1&&(l.splice(u,1),Q(t))}}(n,e):console.error(S)}}let mn=new Set;function _e(n){mn.add(n)}function Te(n){mn.delete(n)}function Ue(){return async n=>{(function(e){let t=yn(e),i=U.get(t);if(i){for(let r of i)Q(r);U.delete(t)}})(n),mn.forEach(e=>e(n))}}async function De(){let n=await(e=On,fin.InterApplicationBus.Channel.create(e));var e;return n.onConnection(async t=>{for(let i of fn)if(!await i(t))throw b}),n.onDisconnection(Ue()),n.register(J,Ie()),n.register(X,t=>{let i=Wn(t.providerId,t.id),r=gn.get(i);r&&r(t)}),n.register(An,$e()),n.register(In,xe()),n.register(Ln,async()=>Un()),n.register(Pn,Pe()),n.register(z,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(S);let r=L(t.providerId);if(!r)throw y;let{onResultDispatch:a}=r;return a?(t.result.dispatcherIdentity=_nullishCoalesce(t.result.dispatcherIdentity, () => (i)),a(t.result)):void 0}),n}async function We(){let n=Z();me(),await n.destroy(),Nn()}async function Be(){let n=ge();n||(n=await De(),ye(n));let e=ve.bind(null),t=Te.bind(null),i=te.bind(null),r=ie.bind(null);return{getAllProviders:Un.bind(null),search:Dn.bind(null),register:Se.bind(null),deregister:Re.bind(null),onSubscription:Ce.bind(null),onDisconnect:_e.bind(null),onRegister:ee.bind(null),onDeregister:oe.bind(null),dispatch:Ee.bind(null),disconnect:We.bind(null),removeListener:a=>{e(a),t(a),i(a),r(a)},channel:n}}let{v:Bn}=d,{B:Mn}=s,Vn="all",Me={create:Bn,subscribe:Mn,defaultTopic:Vn},qn=()=>{window.search=Me},Hn=n=>{let e=()=>{qn(),window.removeEventListener(n,e)};return e};if(typeof window<"u"){qn();let n="load",e=Hn(n);window.addEventListener(n,e);let t="DOMContentLoaded",i=Hn(t);window.addEventListener(t,i)}Gn.exports=c})()});var w="@openfin/cloud-api";async function A(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch (e2){return!1}}function Kn(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 Ze(){return`${window.fin.me.uuid}-cloud-api-notifications`}var vn=null;async function mt(){return vn||(vn=nt()),vn}async function nt(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Kn(window.fin.me);let o=await et();console.log(o),o.register("openfin-cloud-event",s=>{for(let d of _nullishCoalesce(c.get(s.type), () => ([])))typeof s.payload.timestamp=="string"&&(s.payload.timestamp=new Date(s.payload.timestamp)),d(s.payload)});let c=new Map;return{addEventListener:(s,d)=>{let p=c.get(s)||new Set;p.add(d),c.set(s,p)},removeEventListener:(s,d)=>{let p=c.get(s);if(!p){console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,s);return}p.delete(d)===!1&&console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,s)},update:async s=>(await o.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:s}})).payload.response,clear:async s=>(await o.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:s}})).payload.response,createNotification:async s=>(s.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:{...s,id:void 0}}})).payload.response)}}var tn=null;async function et(){return tn||(tn=tt()),tn}async function tt(){let o=await window.fin.InterApplicationBus.Channel.connect(Ze());return o.onDisconnection(c=>{console.warn(`\`${V}\`: Channel Disconnected from`,c,"Reconnecting..."),tn=null}),o}var Sn;function ot(){return`${window.fin.me.uuid}-client-api`}async function T(){return Sn||(Sn=window.fin.InterApplicationBus.Channel.connect(ot())),Sn}async function St(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-settings")}async function Rt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-user-settings")}async function Et(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("set-user-settings",o)}async function bt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-user-permissions")}async function Ot(o,c){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let s=await T();try{await s.dispatch("launch-content",{id:o,options:c})}catch(d){switch(d instanceof Error?d.message:String(d)){case"UnableToLookup":throw new Error(`${w}: \`launchContent\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchContent\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchContent\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchContent\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function Pt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let c=await T();try{await c.dispatch("launch-supertab",{id:o})}catch(s){switch(s instanceof Error?s.message:String(s)){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 At(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let c=await T();try{await c.dispatch("launch-workspace",{id:o})}catch(s){switch(s instanceof Error?s.message:String(s)){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 Qn={};Je(Qn,{register:()=>Jn});var zn=Ye(jn(),1),it="log-message-",rt="open-url",st="provider-status-",at="registered-",ct="1.0";function lt(o,c){let{data:s,...d}=o;return{...d,data:{customData:s,providerId:c,resultType:"app"}}}function Xn(o){return{...o,data:o.data.customData}}async function ut(o,c,s,d=!0){await c("info",`Setting status as ${d?"ready":"not ready"}`);try{await o.dispatch(`${st}${s}`,{isReady:d})}catch(p){let y=["Error setting provider status",p];console.error(...y),c("error",...y)}}async function dt(o,c,s,...d){try{await o.dispatch(`${it}${c}`,{level:s,message:d})}catch(p){console.error("Error logging message",p)}}async function pt(o,c,s,d,p){let{action:y,dispatcherIdentity:P,...S}=p;await s("info","Handling action",{action:y,dispatcherIdentity:P,result:S});let b;try{let R=_optionalChain([Xn, 'call', _16 => _16(p), 'access', _17 => _17.actions, 'optionalAccess', _18 => _18.find, 'call', _19 => _19(({name:K})=>K===y.name)]);if(!R)throw new Error("Original action not found in search result");b=await _asyncOptionalChain([(await d(R,Xn(p))), 'optionalAccess', async _20 => _20.url])}catch(O){throw await s("error","Error handling dispatch",O),O}if(!b){await s("warn","OnActionListener did not return a URL");return}await ht(o,s,c.id,b,P)}async function ft(o,c,s,d){await c("info","Getting search results",{request:d});try{let p=new AbortController;d.onClose(()=>p.abort());let{context:y,query:P}=d,{results:S}=await s({context:y,query:P,signal:p.signal}),b=S.map(O=>lt(O,o.id));return await c("info","Returning results",b),{results:b}}catch(p){let y=["Error handling search",p];throw console.error(...y),c("error",...y),p}}async function ht(o,c,s,d,p){await c("info","Opening URL",{url:d,targetIdentity:p});try{await o.dispatch(rt,{url:d,targetIdentity:p,providerId:s})}catch(y){let P=["Error opening URL",y];console.error(...P),c("error",...P)}}async function Jn(o){let s=(await window.fin.me.getOptions()).customData,{configData:d,id:p,title:y}=s,{onAction:P,onSearch:S}=o,b=await zn.subscribe(),O=b.channel,R=dt.bind(null,O,p);return await b.register({icon:"",id:p,onResultDispatch:pt.bind(null,O,s,R,P),onUserInput:ft.bind(null,s,R,S),title:y}),await b.channel.dispatch(`${at}${p}`,{version:ct}),R("info","Registered search topic",{id:p,title:y}),{customData:d,isReady:ut.bind(null,O,R,p)}}exports.Search = Qn; exports.getAppSettings = St; exports.getAppUserPermissions = bt; exports.getAppUserSettings = Rt; exports.getNotificationsClient = mt; exports.launchContent = Ot; exports.launchSupertab = Pt; exports.launchWorkspace = At; exports.setAppUserSettings = Et;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -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","x","Xe","Ze","Ye","fe","Qe","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,CA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AE,CAAC,CAAA,CAAED,CAAAA,CAAE,CAAA,CAAEC,CAAC,CAAA,CAAED,CAAAA,CAAE,CAAA,CAAEC,CAAAA,CAAE,CAAC,mBAAA,CAAoB,CAAA,CAAA,EAAIG,EAAAA,CAAE,MAAA,CAAO,CAAA,CAAA,EAAIC,EAAAA,CAAG,YAAA,CAAa,CAAA,CAAA,EAAIC,EAAAA,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:()=>x,create:()=>Xe,defaultTopic:()=>Ze,subscribe:()=>Ye});var n={};e.r(n),e.d(n,{B:()=>fe});var o={};e.r(o),e.d(o,{v:()=>Qe});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;!function(e){e.Local=\"local\",e.Dev=\"dev\",e.Staging=\"staging\",e.Prod=\"prod\"}(h||(h={}));const g=\"undefined\"!=typeof window&&\"undefined\"!=typeof fin,w=(\"undefined\"==typeof process||process.env,\"undefined\"!=typeof window),y=w?window.origin:h.Local,v=(g&&fin.me.uuid,g&&fin.me.name,g&&fin.me.entityType,h.Local,h.Dev,h.Staging,h.Prod,e=>e.startsWith(\"http://\")||e.startsWith(\"https://\")?e:y+e),m=(v(\"http://localhost:4002\"),v(\"http://localhost:4002\"),\"undefined\"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&v(WORKSPACE_DOCS_PLATFORM_URL),\"undefined\"!=typeof WORKSPACE_DOCS_CLIENT_URL&&v(WORKSPACE_DOCS_CLIENT_URL),\"20.1.1\");\"undefined\"!=typeof WORKSPACE_BUILD_SHA&&WORKSPACE_BUILD_SHA;var R,C;!function(e){e.Workspace=\"openfin-workspace\",e.OldWorkspace=\"openfin-browser\"}(R||(R={})),function(e){e.FinProtocol=\"fin-protocol\"}(C||(C={}));R.Workspace;var b,S,I,x;!function(e){e[e.Initial=0]=\"Initial\",e[e.Open=1]=\"Open\",e[e.Close=2]=\"Close\"}(b||(b={})),function(e){e.Fetching=\"fetching\",e.Fetched=\"fetched\",e.Complete=\"complete\"}(S||(S={})),function(e){e.UserAction=\"user-action\",e.FocusChange=\"focus-change\",e.Reload=\"reload\"}(I||(I={})),function(e){e.Active=\"active\",e.Default=\"default\"}(x||(x={}));const O=`__search-${`${R.OldWorkspace}-home`}-topic__`,k=\"0\",P=\"1\",B=\"2\",E=\"3\",_=\"4\",A=\"5\",D=\"6\",L=()=>{},U=new Set;function T(e){U.add(e)}function F(e){U.delete(e)}const W=new Set;function $(e){W.add(e)}function M(e){W.delete(e)}const q=new Map;async function K(e){q.set(e.id,e);const t=[...U].map((e=>e()));await Promise.all(t)}async function V(e){q.delete(e);const t=[...W].map((e=>e()));await Promise.all(t)}function j(){return[...q.values()]}function H(){q.clear()}function N(e){return q.get(e)}function z(e,t,n){return{...e,action:n||{...e.actions[0],trigger:I.UserAction},dispatcherIdentity:t}}function J(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 G(e){const t={};let n=[];let o=[];let r=null;let i=b.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=L;const s={};return t.res=s,s.close=()=>{i!==b.Close&&(i=b.Close,t.onChange())},s.open=()=>{i!==b.Open&&(i=b.Open,t.onChange())},s.respond=n=>{const o=J(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 X(){return{name:fin.me.name,uuid:fin.me.uuid}}const Y=50,Z=1e3;const ee=new Map;function te(){return ee}const ne=100;function oe(){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=N(n);if(!o){const e=i;return console.error(e),{error:e.message}}const r=te();let s=r.get(e.id);s||(s=Q(t,e),r.set(e.id,s));const a=G(),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(k,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()}),ne))};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 re(e,t){const n=t||await l(),o=X(),r={...e,identity:o,onResultDispatch:void 0},i=await n.dispatch(B,r);return await K({identity:o,...e}),i}async function ie(e){const t=await l();return await t.dispatch(E,e),V(e)}async function se(e,t,n,o){const r=z(t,o??X(),n),i=N(e);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(r)}const s={providerId:e,result:r};return(await l()).dispatch(A,s)}async function ce(e){const t={...e,context:e?.context||{}},n={},o=async function*(e,{setState:t}){const n=await l();for(;;){const o=await n.dispatch(P,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(D,{id:e})}(n.id)},n.next=()=>{if(r){const e=r;return r=void 0,e}return o.next()},n}async function ae(){return(await l()).dispatch(_,null)}async function ue(){const e=await l();d=void 0,H(),await e.disconnect()}const de=async()=>{const e=await le();for(const t of j())await re(t,e);return e};async function le(){const e=await async function(e){for(let t=0;t<Y;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(e){if(t===Y-1)throw e;await new Promise((e=>setTimeout(e,Z)))}}(O);return e.register(k,oe()),e.register(D,(e=>{const t=te(),n=t.get(e.id);n&&(n.close(),t.delete(e.id))})),e.register(A,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=N(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})),e.onDisconnection((async()=>{if(!f())return;const e=te();for(const{req:t,close:n}of e.values())n(),e.delete(t.id);p(de())})),e}async function fe(){let e=f();e||(e=le(),p(e));const t=await e;return{getAllProviders:ae.bind(null),register:re.bind(null),search:ce.bind(null),deregister:ie.bind(null),dispatch:se.bind(null),disconnect:ue.bind(null),channel:t}}let pe;function he(){if(pe)return pe;throw u}function ge(){return pe}function we(e){pe=e}function ye(){pe=void 0}const ve=new Set;function me(e){ve.add(e)}function Re(e){ve.delete(e)}async function Ce(){return[...j()].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function be(e){if(N(e.id))throw new Error(\"provider with name already exists\");const t=X();return await K({identity:t,...e}),{workspaceVersion:m||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}async function Se(e){await V(e)}async function Ie(e,t,n,o){const r=N(e);if(!r)throw i;const{onResultDispatch:s}=r;if(!s)return;return s(z(t,o??X(),n))}async function*xe(e,t){const n=function(e,t){const n=[],o=[],r=[],i=[];for(const s of e){const e=G(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=J(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=>N(e))).filter((e=>!!e)):[...j().filter((e=>!e.hidden))],e),{providerResponses:o,listenerResponses:r}=n;let{openListenerResponses:i,initialResponsePromises:s}=n,c=S.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(S.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===b.Open||c===S.Fetching&&s===b.Initial)&&(f.push(t),n.onChange=l);const a=n.getResultBuffer();a.length&&(n.setResultBuffer([]),i.results=J(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(S.Complete),o}let Oe=0;async function ke(e){Oe+=1;const t=Q(Oe.toString(),e),n=xe(t.req,{setState:e=>{n.state=e}});return n.id=Oe.toString(),n.close=t.close,n.state=S.Fetching,n}const Pe=new Map,Be=1e4;function Ee(){return async e=>{if(!e)return console.error(c),{error:c.message};let t;if(e.id)t=e.id;else{const n=await ke(e);t=n.id,e.id=n.id,Pe.set(t,{generator:n})}const n=Pe.get(t);clearTimeout(n.timeout);const o=await n.generator.next();return n.timeout=function(e){return window.setTimeout((()=>{Pe.delete(e)}),Be)}(t),{...o,id:e.id,state:n.generator.state}}}function _e(e,t){return he().dispatch(e,D,{id:t})}function Ae(){return e=>function(e){const t=Pe.get(e);t&&t.generator.close()}(e.id)}async function De(e,{id:t,query:n,context:o,targets:r=[]}){const i=he(),s={id:t,query:n,context:o,targets:r,providerId:e.id},c=await i.dispatch(e.identity,k,s),a=c.error;if(a)throw new Error(a);return c}const Le=new Map;function Ue(e,t){return`${e.name}:${e.uuid}:${t}`}const Te=new Map;function Fe(e,t){return`${e}:${t}`}function We(e){const t=Ue.bind(null,e.identity),n=_e.bind(null,e.identity),o=De.bind(null,e);return async(r,i)=>{const s=t(r.id);if(!Le.has(s)){const e=()=>{n(r.id),Le.delete(s)};Le.set(s,e),r.onClose(e)}const c=Fe(e.id,r.id),a=()=>{Te.delete(c),i.close()};r.onClose(a),Te.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===b.Open&&i.open(),e.status===b.Close&&a()}));const u=await o(r);return u.status===b.Open&&i.open(),u.status!==b.Close&&u.status!==b.Initial||a(),u}}function $e(e){return async t=>{const n=he(),o={providerId:e.id,result:t};return n.dispatch(e.identity,A,o)}}const Me=new Map;function qe(e){return`${e.name}-${e.uuid}`}function Ke(){return async(e,t)=>{if(!e||!e.id)return console.error(new Error(JSON.stringify(e))),void console.error(c);if(N(e.id))throw s;return e.identity=t,await async function(e){const t=qe(e.identity);Me.has(t)||Me.set(t,[]),Me.get(t).push(e.id),await K({...e,onUserInput:We(e),onResultDispatch:$e(e)})}(e),{workspaceVersion:m||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}}function Ve(){return(e,t)=>{e?function(e,t){const n=N(e);if(!n)return;if(n.identity.uuid!==t.uuid||n.identity.name!==t.name)throw i;const o=qe(n.identity),r=Me.get(o);if(r){const t=r.findIndex((t=>t===e));-1!==t&&(r.splice(t,1),V(e))}}(e,t):console.error(c)}}const je=new Set;function He(e){je.add(e)}function Ne(e){je.delete(e)}function ze(){return async e=>{!function(e){const t=qe(e),n=Me.get(t);if(n){for(const e of n)V(e);Me.delete(t)}}(e),je.forEach((t=>t(e)))}}async function Je(){const e=await(t=O,fin.InterApplicationBus.Channel.create(t));var t;return e.onConnection((async e=>{for(const t of ve)if(!await t(e))throw a})),e.onDisconnection(ze()),e.register(D,Ae()),e.register(k,(e=>{const t=Fe(e.providerId,e.id),n=Te.get(t);n&&n(e)})),e.register(B,Ke()),e.register(E,Ve()),e.register(_,(async()=>Ce())),e.register(P,Ee()),e.register(A,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=N(e.providerId);if(!n)throw i;const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),e}async function Ge(){const e=he();ye(),await e.destroy(),H()}async function Qe(){let e=ge();e||(e=await Je(),we(e));const t=Re.bind(null),n=Ne.bind(null),o=F.bind(null),r=M.bind(null);return{getAllProviders:Ce.bind(null),search:ke.bind(null),register:be.bind(null),deregister:Se.bind(null),onSubscription:me.bind(null),onDisconnect:He.bind(null),onRegister:T.bind(null),onDeregister:$.bind(null),dispatch:Ie.bind(null),disconnect:Ge.bind(null),removeListener:e=>{t(e),n(e),o(e),r(e)},channel:e}}const{v:Xe}=o,{B:Ye}=n,Ze=\"all\",et={create:Xe,subscribe:Ye,defaultTopic:Ze},tt=()=>{window.search=et},nt=e=>{const t=()=>{tt(),window.removeEventListener(e,t)};return t};if(\"undefined\"!=typeof window){tt();const e=\"load\",t=nt(e);window.addEventListener(e,t);const n=\"DOMContentLoaded\",o=nt(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,257 @@ declare function launchSupertab(id: string): Promise<void>;
|
|
|
298
297
|
*/
|
|
299
298
|
declare function launchWorkspace(id: string): Promise<void>;
|
|
300
299
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
344
|
+
/**
|
|
345
|
+
* A Search Agent returns search results to Here™’s search UI in response to user input, and acts on the user’s actions regarding those results.
|
|
346
|
+
*/
|
|
347
|
+
type SearchAgent = {
|
|
348
|
+
/**
|
|
349
|
+
* The Search Agent’s custom configuration data configured via the Admin Console.
|
|
350
|
+
*/
|
|
351
|
+
readonly customData: unknown;
|
|
352
|
+
/**
|
|
353
|
+
* Sets whether or not the Search Agent is ready to provide search results.
|
|
354
|
+
*
|
|
355
|
+
* When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
|
|
356
|
+
*
|
|
357
|
+
* @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
|
|
358
|
+
*/
|
|
311
359
|
isReady: (ready?: boolean) => Promise<void>;
|
|
312
|
-
readonly name: string;
|
|
313
|
-
showWindow: (options?: ShowWindowOptions) => Promise<void>;
|
|
314
360
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Configuration provided when registering a Search Agent.
|
|
363
|
+
*/
|
|
364
|
+
type SearchAgentRegistrationConfig = {
|
|
365
|
+
/**
|
|
366
|
+
* This listener is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
|
|
367
|
+
*
|
|
368
|
+
* The listener returns a response back to Here™ that includes a URL to navigate to.
|
|
369
|
+
*/
|
|
370
|
+
onAction: OnActionListener;
|
|
371
|
+
/**
|
|
372
|
+
* This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
|
|
373
|
+
*
|
|
374
|
+
* Note: When the Search Agent is not ready this listener will not be called.
|
|
375
|
+
*/
|
|
376
|
+
onSearch: OnSearchListener;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Search request data provided to the {@link OnSearchListener}.
|
|
380
|
+
*/
|
|
381
|
+
type SearchListenerRequest = {
|
|
382
|
+
/**
|
|
383
|
+
* Provides additional context for the search request.
|
|
384
|
+
*/
|
|
385
|
+
context: SearchRequestContext;
|
|
386
|
+
/**
|
|
387
|
+
* The query entered by the user in Here™’s search UI.
|
|
388
|
+
*/
|
|
389
|
+
query: string;
|
|
390
|
+
/**
|
|
391
|
+
* Provide this signal to any `fetch` requests executed in the {@link OnSearchListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
|
|
392
|
+
*/
|
|
393
|
+
signal: AbortSignal;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Context data included with a search request.
|
|
397
|
+
*/
|
|
398
|
+
type SearchRequestContext = {
|
|
399
|
+
/**
|
|
400
|
+
* The page number of the search results to return.
|
|
401
|
+
*/
|
|
402
|
+
pageNumber: number;
|
|
403
|
+
/**
|
|
404
|
+
* The number of search results to return per page.
|
|
405
|
+
*/
|
|
406
|
+
pageSize: number;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Return type of the {@link OnSearchListener}.
|
|
410
|
+
*/
|
|
411
|
+
type SearchResponse = {
|
|
412
|
+
/**
|
|
413
|
+
* The search results to display in Here™’s search UI.
|
|
414
|
+
*/
|
|
415
|
+
results: SearchResult[];
|
|
318
416
|
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
417
|
+
/**
|
|
418
|
+
* A search result returned by a Search Agent in response to a search request.
|
|
419
|
+
*/
|
|
420
|
+
type SearchResult = {
|
|
421
|
+
/**
|
|
422
|
+
* Actions that can be triggered by the user against the search result.
|
|
423
|
+
*/
|
|
424
|
+
actions: SearchAction[];
|
|
425
|
+
/**
|
|
426
|
+
* Additional data that can be used by the {@link OnActionListener} when an action is triggered.
|
|
427
|
+
*/
|
|
428
|
+
data?: Record<string, unknown>;
|
|
429
|
+
/**
|
|
430
|
+
* URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
|
|
431
|
+
*/
|
|
432
|
+
icon?: string;
|
|
433
|
+
/**
|
|
434
|
+
* Unique identifier for the search result.
|
|
435
|
+
*/
|
|
436
|
+
key: string;
|
|
437
|
+
/**
|
|
438
|
+
* Secondary text that will be displayed with the search result in Here™’s search UI.
|
|
439
|
+
*/
|
|
440
|
+
label?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Primary text that will be displayed with the search result in Here™’s search UI.
|
|
443
|
+
*/
|
|
444
|
+
title: string;
|
|
328
445
|
};
|
|
446
|
+
/**
|
|
447
|
+
* Return type of the {@link OnActionListener}.
|
|
448
|
+
*/
|
|
449
|
+
type SearchResultActionResponse = {
|
|
450
|
+
/**
|
|
451
|
+
* URL that Here™ should navigate to.
|
|
452
|
+
*/
|
|
453
|
+
url: string;
|
|
454
|
+
} | undefined;
|
|
329
455
|
|
|
330
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.
|
|
458
|
+
*
|
|
459
|
+
* @param config The configuration for the Search Agent.
|
|
460
|
+
*
|
|
461
|
+
* @returns A promise that resolves with the Search Agent.
|
|
462
|
+
*
|
|
463
|
+
* @example Registering a basic Search Agent:
|
|
464
|
+
* ```ts
|
|
465
|
+
* // Handle incoming action and return a response that includes the URL to navigate to
|
|
466
|
+
* const onAction: Search.OnActionListener = (action, result) => {
|
|
467
|
+
* const { name } = action;
|
|
468
|
+
* const { data, key } = result;
|
|
469
|
+
* const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
|
|
470
|
+
* const { id: ownerId } = owner;
|
|
471
|
+
* console.log(`Action "${name}" triggered on search result with key "${key}"`);
|
|
472
|
+
* switch (name) {
|
|
473
|
+
* case "view-owner":
|
|
474
|
+
* return { url: `${searchResultHostUrl}/people/${ownerId}` };
|
|
475
|
+
* case "view-result":
|
|
476
|
+
* return { url: `${searchResultHostUrl}/record/${key}` };
|
|
477
|
+
* default:
|
|
478
|
+
* console.warn(`Unknown action: ${name}`);
|
|
479
|
+
* }
|
|
480
|
+
* };
|
|
481
|
+
*
|
|
482
|
+
* // Handle incoming search request and return relevant search results
|
|
483
|
+
* const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
|
|
484
|
+
* const { pageNumber, pageSize } = context;
|
|
485
|
+
* try {
|
|
486
|
+
* let results: Search.SearchResult[] = [];
|
|
487
|
+
* const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
|
|
488
|
+
* const response = await fetch(url, { signal });
|
|
489
|
+
* if (!response.ok) {
|
|
490
|
+
* throw new Error(`Request failed: ${response.status}`);
|
|
491
|
+
* }
|
|
492
|
+
* const { searchResults } = await response.json();
|
|
493
|
+
* results = searchResults.map((result) => {
|
|
494
|
+
* const { iconUrl, id: key, owner, subTitle, title } = result;
|
|
495
|
+
* const { name: ownerName } = owner as { id: string, name: string };
|
|
496
|
+
* return {
|
|
497
|
+
* actions: [
|
|
498
|
+
* {
|
|
499
|
+
* name: "view-result",
|
|
500
|
+
* description: `Go to ${title} in My Web App`,
|
|
501
|
+
* },
|
|
502
|
+
* {
|
|
503
|
+
* name: "view-owner",
|
|
504
|
+
* description: `Go to ${ownerName} in My Web App`,
|
|
505
|
+
* title: "View Owner",
|
|
506
|
+
* },
|
|
507
|
+
* ],
|
|
508
|
+
* data: {
|
|
509
|
+
* owner,
|
|
510
|
+
* searchResultHostUrl: `https://my-web-app.com`,
|
|
511
|
+
* },
|
|
512
|
+
* icon: iconUrl,
|
|
513
|
+
* key,
|
|
514
|
+
* label: subTitle,
|
|
515
|
+
* title,
|
|
516
|
+
* };
|
|
517
|
+
* });
|
|
518
|
+
* console.log("Returning results", results);
|
|
519
|
+
* return { results };
|
|
520
|
+
* } catch (err) {
|
|
521
|
+
* if ((err as Error).name === "AbortError") {
|
|
522
|
+
* // Ignore errors for cancelled requests
|
|
523
|
+
* return { results: [] };
|
|
524
|
+
* }
|
|
525
|
+
* throw err;
|
|
526
|
+
* }
|
|
527
|
+
* };
|
|
528
|
+
*
|
|
529
|
+
* // Register the search agent
|
|
530
|
+
* const searchAgent = await Search.register({ onAction, onSearch });
|
|
531
|
+
*
|
|
532
|
+
* // Set the Search Agent as ready to receive search requests
|
|
533
|
+
* await searchAgent.isReady();
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
536
|
+
declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
|
|
331
537
|
|
|
332
|
-
type
|
|
333
|
-
type
|
|
334
|
-
type
|
|
335
|
-
type
|
|
336
|
-
type
|
|
337
|
-
type
|
|
338
|
-
type
|
|
339
|
-
type
|
|
340
|
-
type
|
|
341
|
-
|
|
342
|
-
declare
|
|
343
|
-
|
|
538
|
+
type index_OnActionListener = OnActionListener;
|
|
539
|
+
type index_OnSearchListener = OnSearchListener;
|
|
540
|
+
type index_SearchAction = SearchAction;
|
|
541
|
+
type index_SearchAgent = SearchAgent;
|
|
542
|
+
type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
|
|
543
|
+
type index_SearchListenerRequest = SearchListenerRequest;
|
|
544
|
+
type index_SearchRequestContext = SearchRequestContext;
|
|
545
|
+
type index_SearchResponse = SearchResponse;
|
|
546
|
+
type index_SearchResult = SearchResult;
|
|
547
|
+
type index_SearchResultActionResponse = SearchResultActionResponse;
|
|
548
|
+
declare const index_register: typeof register;
|
|
549
|
+
declare namespace index {
|
|
550
|
+
export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type index_SearchListenerRequest as SearchListenerRequest, type index_SearchRequestContext as SearchRequestContext, type index_SearchResponse as SearchResponse, type index_SearchResult as SearchResult, type index_SearchResultActionResponse as SearchResultActionResponse, index_register as register };
|
|
344
551
|
}
|
|
345
552
|
|
|
346
553
|
declare global {
|
|
@@ -349,4 +556,4 @@ declare global {
|
|
|
349
556
|
}
|
|
350
557
|
}
|
|
351
558
|
|
|
352
|
-
export { type AppPermissions, type LaunchContentOptions,
|
|
559
|
+
export { type AppPermissions, type LaunchContentOptions, index as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
|
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,257 @@ declare function launchSupertab(id: string): Promise<void>;
|
|
|
298
297
|
*/
|
|
299
298
|
declare function launchWorkspace(id: string): Promise<void>;
|
|
300
299
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
344
|
+
/**
|
|
345
|
+
* A Search Agent returns search results to Here™’s search UI in response to user input, and acts on the user’s actions regarding those results.
|
|
346
|
+
*/
|
|
347
|
+
type SearchAgent = {
|
|
348
|
+
/**
|
|
349
|
+
* The Search Agent’s custom configuration data configured via the Admin Console.
|
|
350
|
+
*/
|
|
351
|
+
readonly customData: unknown;
|
|
352
|
+
/**
|
|
353
|
+
* Sets whether or not the Search Agent is ready to provide search results.
|
|
354
|
+
*
|
|
355
|
+
* When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
|
|
356
|
+
*
|
|
357
|
+
* @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
|
|
358
|
+
*/
|
|
311
359
|
isReady: (ready?: boolean) => Promise<void>;
|
|
312
|
-
readonly name: string;
|
|
313
|
-
showWindow: (options?: ShowWindowOptions) => Promise<void>;
|
|
314
360
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Configuration provided when registering a Search Agent.
|
|
363
|
+
*/
|
|
364
|
+
type SearchAgentRegistrationConfig = {
|
|
365
|
+
/**
|
|
366
|
+
* This listener is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
|
|
367
|
+
*
|
|
368
|
+
* The listener returns a response back to Here™ that includes a URL to navigate to.
|
|
369
|
+
*/
|
|
370
|
+
onAction: OnActionListener;
|
|
371
|
+
/**
|
|
372
|
+
* This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
|
|
373
|
+
*
|
|
374
|
+
* Note: When the Search Agent is not ready this listener will not be called.
|
|
375
|
+
*/
|
|
376
|
+
onSearch: OnSearchListener;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Search request data provided to the {@link OnSearchListener}.
|
|
380
|
+
*/
|
|
381
|
+
type SearchListenerRequest = {
|
|
382
|
+
/**
|
|
383
|
+
* Provides additional context for the search request.
|
|
384
|
+
*/
|
|
385
|
+
context: SearchRequestContext;
|
|
386
|
+
/**
|
|
387
|
+
* The query entered by the user in Here™’s search UI.
|
|
388
|
+
*/
|
|
389
|
+
query: string;
|
|
390
|
+
/**
|
|
391
|
+
* Provide this signal to any `fetch` requests executed in the {@link OnSearchListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
|
|
392
|
+
*/
|
|
393
|
+
signal: AbortSignal;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Context data included with a search request.
|
|
397
|
+
*/
|
|
398
|
+
type SearchRequestContext = {
|
|
399
|
+
/**
|
|
400
|
+
* The page number of the search results to return.
|
|
401
|
+
*/
|
|
402
|
+
pageNumber: number;
|
|
403
|
+
/**
|
|
404
|
+
* The number of search results to return per page.
|
|
405
|
+
*/
|
|
406
|
+
pageSize: number;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Return type of the {@link OnSearchListener}.
|
|
410
|
+
*/
|
|
411
|
+
type SearchResponse = {
|
|
412
|
+
/**
|
|
413
|
+
* The search results to display in Here™’s search UI.
|
|
414
|
+
*/
|
|
415
|
+
results: SearchResult[];
|
|
318
416
|
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
417
|
+
/**
|
|
418
|
+
* A search result returned by a Search Agent in response to a search request.
|
|
419
|
+
*/
|
|
420
|
+
type SearchResult = {
|
|
421
|
+
/**
|
|
422
|
+
* Actions that can be triggered by the user against the search result.
|
|
423
|
+
*/
|
|
424
|
+
actions: SearchAction[];
|
|
425
|
+
/**
|
|
426
|
+
* Additional data that can be used by the {@link OnActionListener} when an action is triggered.
|
|
427
|
+
*/
|
|
428
|
+
data?: Record<string, unknown>;
|
|
429
|
+
/**
|
|
430
|
+
* URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
|
|
431
|
+
*/
|
|
432
|
+
icon?: string;
|
|
433
|
+
/**
|
|
434
|
+
* Unique identifier for the search result.
|
|
435
|
+
*/
|
|
436
|
+
key: string;
|
|
437
|
+
/**
|
|
438
|
+
* Secondary text that will be displayed with the search result in Here™’s search UI.
|
|
439
|
+
*/
|
|
440
|
+
label?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Primary text that will be displayed with the search result in Here™’s search UI.
|
|
443
|
+
*/
|
|
444
|
+
title: string;
|
|
328
445
|
};
|
|
446
|
+
/**
|
|
447
|
+
* Return type of the {@link OnActionListener}.
|
|
448
|
+
*/
|
|
449
|
+
type SearchResultActionResponse = {
|
|
450
|
+
/**
|
|
451
|
+
* URL that Here™ should navigate to.
|
|
452
|
+
*/
|
|
453
|
+
url: string;
|
|
454
|
+
} | undefined;
|
|
329
455
|
|
|
330
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.
|
|
458
|
+
*
|
|
459
|
+
* @param config The configuration for the Search Agent.
|
|
460
|
+
*
|
|
461
|
+
* @returns A promise that resolves with the Search Agent.
|
|
462
|
+
*
|
|
463
|
+
* @example Registering a basic Search Agent:
|
|
464
|
+
* ```ts
|
|
465
|
+
* // Handle incoming action and return a response that includes the URL to navigate to
|
|
466
|
+
* const onAction: Search.OnActionListener = (action, result) => {
|
|
467
|
+
* const { name } = action;
|
|
468
|
+
* const { data, key } = result;
|
|
469
|
+
* const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
|
|
470
|
+
* const { id: ownerId } = owner;
|
|
471
|
+
* console.log(`Action "${name}" triggered on search result with key "${key}"`);
|
|
472
|
+
* switch (name) {
|
|
473
|
+
* case "view-owner":
|
|
474
|
+
* return { url: `${searchResultHostUrl}/people/${ownerId}` };
|
|
475
|
+
* case "view-result":
|
|
476
|
+
* return { url: `${searchResultHostUrl}/record/${key}` };
|
|
477
|
+
* default:
|
|
478
|
+
* console.warn(`Unknown action: ${name}`);
|
|
479
|
+
* }
|
|
480
|
+
* };
|
|
481
|
+
*
|
|
482
|
+
* // Handle incoming search request and return relevant search results
|
|
483
|
+
* const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
|
|
484
|
+
* const { pageNumber, pageSize } = context;
|
|
485
|
+
* try {
|
|
486
|
+
* let results: Search.SearchResult[] = [];
|
|
487
|
+
* const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
|
|
488
|
+
* const response = await fetch(url, { signal });
|
|
489
|
+
* if (!response.ok) {
|
|
490
|
+
* throw new Error(`Request failed: ${response.status}`);
|
|
491
|
+
* }
|
|
492
|
+
* const { searchResults } = await response.json();
|
|
493
|
+
* results = searchResults.map((result) => {
|
|
494
|
+
* const { iconUrl, id: key, owner, subTitle, title } = result;
|
|
495
|
+
* const { name: ownerName } = owner as { id: string, name: string };
|
|
496
|
+
* return {
|
|
497
|
+
* actions: [
|
|
498
|
+
* {
|
|
499
|
+
* name: "view-result",
|
|
500
|
+
* description: `Go to ${title} in My Web App`,
|
|
501
|
+
* },
|
|
502
|
+
* {
|
|
503
|
+
* name: "view-owner",
|
|
504
|
+
* description: `Go to ${ownerName} in My Web App`,
|
|
505
|
+
* title: "View Owner",
|
|
506
|
+
* },
|
|
507
|
+
* ],
|
|
508
|
+
* data: {
|
|
509
|
+
* owner,
|
|
510
|
+
* searchResultHostUrl: `https://my-web-app.com`,
|
|
511
|
+
* },
|
|
512
|
+
* icon: iconUrl,
|
|
513
|
+
* key,
|
|
514
|
+
* label: subTitle,
|
|
515
|
+
* title,
|
|
516
|
+
* };
|
|
517
|
+
* });
|
|
518
|
+
* console.log("Returning results", results);
|
|
519
|
+
* return { results };
|
|
520
|
+
* } catch (err) {
|
|
521
|
+
* if ((err as Error).name === "AbortError") {
|
|
522
|
+
* // Ignore errors for cancelled requests
|
|
523
|
+
* return { results: [] };
|
|
524
|
+
* }
|
|
525
|
+
* throw err;
|
|
526
|
+
* }
|
|
527
|
+
* };
|
|
528
|
+
*
|
|
529
|
+
* // Register the search agent
|
|
530
|
+
* const searchAgent = await Search.register({ onAction, onSearch });
|
|
531
|
+
*
|
|
532
|
+
* // Set the Search Agent as ready to receive search requests
|
|
533
|
+
* await searchAgent.isReady();
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
536
|
+
declare function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
|
|
331
537
|
|
|
332
|
-
type
|
|
333
|
-
type
|
|
334
|
-
type
|
|
335
|
-
type
|
|
336
|
-
type
|
|
337
|
-
type
|
|
338
|
-
type
|
|
339
|
-
type
|
|
340
|
-
type
|
|
341
|
-
|
|
342
|
-
declare
|
|
343
|
-
|
|
538
|
+
type index_OnActionListener = OnActionListener;
|
|
539
|
+
type index_OnSearchListener = OnSearchListener;
|
|
540
|
+
type index_SearchAction = SearchAction;
|
|
541
|
+
type index_SearchAgent = SearchAgent;
|
|
542
|
+
type index_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
|
|
543
|
+
type index_SearchListenerRequest = SearchListenerRequest;
|
|
544
|
+
type index_SearchRequestContext = SearchRequestContext;
|
|
545
|
+
type index_SearchResponse = SearchResponse;
|
|
546
|
+
type index_SearchResult = SearchResult;
|
|
547
|
+
type index_SearchResultActionResponse = SearchResultActionResponse;
|
|
548
|
+
declare const index_register: typeof register;
|
|
549
|
+
declare namespace index {
|
|
550
|
+
export { type index_OnActionListener as OnActionListener, type index_OnSearchListener as OnSearchListener, type index_SearchAction as SearchAction, type index_SearchAgent as SearchAgent, type index_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type index_SearchListenerRequest as SearchListenerRequest, type index_SearchRequestContext as SearchRequestContext, type index_SearchResponse as SearchResponse, type index_SearchResult as SearchResult, type index_SearchResultActionResponse as SearchResultActionResponse, index_register as register };
|
|
344
551
|
}
|
|
345
552
|
|
|
346
553
|
declare global {
|
|
@@ -349,4 +556,4 @@ declare global {
|
|
|
349
556
|
}
|
|
350
557
|
}
|
|
351
558
|
|
|
352
|
-
export { type AppPermissions, type LaunchContentOptions,
|
|
559
|
+
export { type AppPermissions, type LaunchContentOptions, index as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
|
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 He=Object.create;var Cn=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var ze=(o,c)=>()=>(c||o((c={exports:{}}).exports,c),c.exports),Je=(o,c)=>{for(var s in c)Cn(o,s,{get:c[s],enumerable:!0})},Qe=(o,c,s,d)=>{if(c&&typeof c=="object"||typeof c=="function")for(let p of Ge(c))!Xe.call(o,p)&&p!==s&&Cn(o,p,{get:()=>c[p],enumerable:!(d=Ke(c,p))||d.enumerable});return o};var Ye=(o,c,s)=>(s=o!=null?He(je(o)):{},Qe(c||!o||!o.__esModule?Cn(s,"default",{value:o,enumerable:!0}):s,o));var jn=ze((Lt,Gn)=>{"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})}},c={};o.r(c),o.d(c,{SearchTagBackground:()=>sn,create:()=>Bn,defaultTopic:()=>Vn,subscribe:()=>Mn});var s={};o.r(s),o.d(s,{B:()=>we});var d={};o.r(d),o.d(d,{v:()=>Be});let p="deregistered or does not exist",y=new Error(`provider ${p}`),P=new Error("provider with name already exists"),S=new Error("bad payload"),b=new Error("subscription rejected"),O=new Error(`channel ${p}`),R;function I(){if(R)return R;throw O}function K(){return R}function Rn(n){R=n}var $;(function(n){n.Local="local",n.Dev="dev",n.Staging="staging",n.Prod="prod"})($||($={}));let on=typeof window<"u"&&typeof fin<"u",Yn=(typeof process>"u"||process.env,typeof window<"u"),Zn=Yn?window.origin:$.Local,G=(on&&fin.me.uuid,on&&fin.me.name,on&&fin.me.entityType,$.Local,$.Dev,$.Staging,$.Prod,n=>n.startsWith("http://")||n.startsWith("https://")?n:Zn+n),En=(G("http://localhost:4002"),G("http://localhost:4002"),typeof WORKSPACE_DOCS_PLATFORM_URL<"u"&&G(WORKSPACE_DOCS_PLATFORM_URL),typeof WORKSPACE_DOCS_CLIENT_URL<"u"&&G(WORKSPACE_DOCS_CLIENT_URL),"20.1.1");typeof WORKSPACE_BUILD_SHA<"u"&&WORKSPACE_BUILD_SHA;var j,bn;(function(n){n.Workspace="openfin-workspace",n.OldWorkspace="openfin-browser"})(j||(j={})),function(n){n.FinProtocol="fin-protocol"}(bn||(bn={})),j.Workspace;var v,x,rn,sn;(function(n){n[n.Initial=0]="Initial",n[n.Open=1]="Open",n[n.Close=2]="Close"})(v||(v={})),function(n){n.Fetching="fetching",n.Fetched="fetched",n.Complete="complete"}(x||(x={})),function(n){n.UserAction="user-action",n.FocusChange="focus-change",n.Reload="reload"}(rn||(rn={})),function(n){n.Active="active",n.Default="default"}(sn||(sn={}));let On=`__search-${`${j.OldWorkspace}-home`}-topic__`,X="0",Pn="1",An="2",In="3",Ln="4",z="5",J="6",ne=()=>{},an=new Set;function ee(n){an.add(n)}function te(n){an.delete(n)}let cn=new Set;function oe(n){cn.add(n)}function ie(n){cn.delete(n)}let q=new Map;async function ln(n){q.set(n.id,n);let e=[...an].map(t=>t());await Promise.all(e)}async function Q(n){q.delete(n);let e=[...cn].map(t=>t());await Promise.all(e)}function un(){return[...q.values()]}function Nn(){q.clear()}function L(n){return q.get(n)}function Fn(n,e,t){return{...n,action:t||{...n.actions[0],trigger:rn.UserAction},dispatcherIdentity:e}}function dn(n,e,t="ascending"){let i=n||[];if(!e?.length)return i;let r=[],a=new Map;e.forEach(u=>{if(u.key)return a.set(u.key,u);r.push(u)});let l=i.map(u=>{let{key:h}=u;if(h&&a.has(h)){let C=a.get(h);return a.delete(h),C}return u});return l.push(...a.values(),...r),l=t==="ascending"?l.sort((u,h)=>(u?.score??1/0)-(h?.score??1/0)):l.sort((u,h)=>(h?.score??1/0)-(u?.score??1/0)),l}function kn(n){let e={},t=[],i=[],r=null,a=v.Initial;e.getStatus=()=>a,e.getResultBuffer=()=>t,e.setResultBuffer=u=>{t=u,t?.length&&e.onChange()},e.getRevokedBuffer=()=>i,e.setRevokedBuffer=u=>{i=u,i?.length&&e.onChange()},e.setUpdatedContext=u=>{r=u,e.onChange()},e.getUpdatedContext=()=>r,e.onChange=ne;let l={};return e.res=l,l.close=()=>{a!==v.Close&&(a=v.Close,e.onChange())},l.open=()=>{a!==v.Open&&(a=v.Open,e.onChange())},l.respond=u=>{let h=dn(e.getResultBuffer(),u,n);e.setResultBuffer(h)},l.revoke=(...u)=>{let h=new Set(u),C=e.getResultBuffer().filter(({key:f})=>{let g=h.has(f);return g&&h.delete(f),!g});e.setResultBuffer(C),h.size&&(e.getRevokedBuffer().forEach(f=>h.add(f)),e.setRevokedBuffer([...h]))},l.updateContext=u=>{e.setUpdatedContext(u)},e}function $n(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 Y(){return{name:fin.me.name,uuid:fin.me.uuid}}let xn=50,re=1e3,se=new Map;function pn(){return se}let ae=100;function ce(){return async n=>{if(!n||!n.id||!n.providerId){let f=S;return console.error(f),{error:f.message}}let{id:e,providerId:t}=n,i=L(t);if(!i){let f=y;return console.error(f),{error:f.message}}let r=pn(),a=r.get(n.id);a||(a=$n(e,n),r.set(n.id,a));let l=kn(),u=()=>{let f=l.getResultBuffer();l.setResultBuffer([]);let g=l.getRevokedBuffer();l.setRevokedBuffer([]);let N=l.getUpdatedContext();l.setUpdatedContext(null);let _=l.getStatus();(async function(D){(await I()).dispatch(X,D)})({id:e,providerId:t,results:f,revoked:g,status:_,context:N})},h=!0,C=!1;l.onChange=()=>{if(h)return h=!1,void u();C||(C=!0,setTimeout(()=>{C=!1,u()},ae))};try{let{results:f,context:g}=await i.onUserInput(a.req,l.res),N=l.getStatus();return{id:e,providerId:t,status:N,results:f,context:g}}catch(f){return console.error(`OpenFin/Workspace/Home. Uncaught exception in search provider ${t} for search ${e}`,"This is likely a bug in the implementation of the search provider.",f),{id:e,providerId:t,error:f?.message}}}}async function _n(n,e){let t=e||await I(),i=Y(),r={...n,identity:i,onResultDispatch:void 0},a=await t.dispatch(An,r);return await ln({identity:i,...n}),a}async function le(n){return await(await I()).dispatch(In,n),Q(n)}async function ue(n,e,t,i){let r=Fn(e,i??Y(),t),a=L(n);if(a){let{onResultDispatch:u}=a;return u?u(r):void 0}let l={providerId:n,result:r};return(await I()).dispatch(z,l)}async function de(n){let e={...n,context:n?.context||{}},t={},i=async function*(a,{setState:l}){let u=await I();for(;;){let h=await u.dispatch(Pn,a),C=h.error;if(C)throw new Error(C);let f=h;if(a.id=f.id,l(f.state),f.done)return f.value;yield f.value}}(e,{setState:a=>{t.state=a}}),r=await i.next();return t.id=e.id||"",t.close=()=>{(async function(a){(await I()).dispatch(J,{id:a})})(t.id)},t.next=()=>{if(r){let a=r;return r=void 0,a}return i.next()},t}async function pe(){return(await I()).dispatch(Ln,null)}async function fe(){let n=await I();R=void 0,Nn(),await n.disconnect()}let he=async()=>{let n=await Tn();for(let e of un())await _n(e,n);return n};async function Tn(){let n=await async function(e){for(let t=0;t<xn;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(i){if(t===xn-1)throw i;await new Promise(r=>setTimeout(r,re))}}(On);return n.register(X,ce()),n.register(J,e=>{let t=pn(),i=t.get(e.id);i&&(i.close(),t.delete(e.id))}),n.register(z,async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(S);let i=L(e.providerId);if(!i)return void console.error(y);let{onResultDispatch:r}=i;return r?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,r(e.result)):void 0}),n.onDisconnection(async()=>{if(!K())return;let e=pn();for(let{req:t,close:i}of e.values())i(),e.delete(t.id);Rn(he())}),n}async function we(){let n=K();n||(n=Tn(),Rn(n));let e=await n;return{getAllProviders:pe.bind(null),register:_n.bind(null),search:de.bind(null),deregister:le.bind(null),dispatch:ue.bind(null),disconnect:fe.bind(null),channel:e}}let H;function Z(){if(H)return H;throw O}function ge(){return H}function ye(n){H=n}function me(){H=void 0}let fn=new Set;function Ce(n){fn.add(n)}function ve(n){fn.delete(n)}async function Un(){return[...un()].map(n=>({...n,onUserInput:void 0,onResultDispatch:void 0}))}async function Se(n){if(L(n.id))throw new Error("provider with name already exists");let e=Y();return await ln({identity:e,...n}),{workspaceVersion:En||"",clientAPIVersion:n.clientAPIVersion||""}}async function Re(n){await Q(n)}async function Ee(n,e,t,i){let r=L(n);if(!r)throw y;let{onResultDispatch:a}=r;if(a)return a(Fn(e,i??Y(),t))}async function*be(n,e){let t=function(g,N){let _=[],D=[],W=[],E=[];for(let m of g){let F=kn(m.scoreOrder),k={results:[],provider:{id:m.id,identity:m.identity,title:m.title,scoreOrder:m.scoreOrder,icon:m.icon,dispatchFocusEvents:m.dispatchFocusEvents}};_.push(k),D.push(F);let B=(async()=>{try{let{results:M,context:en}=await m.onUserInput(N,F.res);k.results=dn(k.results||[],M,m.scoreOrder),k.context={...k.context,...en}}catch(M){k.error=M}})();B.finally(()=>{B.done=!0}),E.push(B),W.push(W.length)}return{providerResponses:_,listenerResponses:D,openListenerResponses:W,initialResponsePromises:E}}(n.targets?n.targets.map(g=>L(g)).filter(g=>!!g):[...un().filter(g=>!g.hidden)],n),{providerResponses:i,listenerResponses:r}=t,{openListenerResponses:a,initialResponsePromises:l}=t,u=x.Fetching,h=g=>{u=g,e.setState(u)},C,f=!1;n.onClose(()=>{f=!0,C&&C()});do{let g=!1;if(l.length){let E=[];for(let m of l)m.done?g=!0:E.push(m);l=E,l.length||(h(x.Fetched),g=!0)}let N,_=!1,D=()=>{_=!0,N&&N()},W=[];for(let E of a){let m=r[E],F=i[E],k=m.getStatus();(k===v.Open||u===x.Fetching&&k===v.Initial)&&(W.push(E),m.onChange=D);let B=m.getResultBuffer();B.length&&(m.setResultBuffer([]),F.results=dn(F.results||[],B),g=!0);let M=m.getRevokedBuffer();if(M.length){m.setRevokedBuffer([]);let Ve=new Set(M);F.results=(F.results||[]).filter(({key:qe})=>!Ve.has(qe)),g=!0}let en=m.getUpdatedContext();en&&(m.setUpdatedContext(null),F.context={...F.context,...en},g=!0)}if(a=W,g&&(yield i),f)break;_||(a.length||l.length)&&await Promise.race([...l,new Promise(E=>{N=E}),new Promise(E=>{C=E})])}while(a.length||l.length);return h(x.Complete),i}let hn=0;async function Dn(n){hn+=1;let e=$n(hn.toString(),n),t=be(e.req,{setState:i=>{t.state=i}});return t.id=hn.toString(),t.close=e.close,t.state=x.Fetching,t}let nn=new Map,Oe=1e4;function Pe(){return async n=>{if(!n)return console.error(S),{error:S.message};let e;if(n.id)e=n.id;else{let r=await Dn(n);e=r.id,n.id=r.id,nn.set(e,{generator:r})}let t=nn.get(e);clearTimeout(t.timeout);let i=await t.generator.next();return t.timeout=function(r){return window.setTimeout(()=>{nn.delete(r)},Oe)}(e),{...i,id:n.id,state:t.generator.state}}}function Ae(n,e){return Z().dispatch(n,J,{id:e})}function Ie(){return n=>function(e){let t=nn.get(e);t&&t.generator.close()}(n.id)}async function Le(n,{id:e,query:t,context:i,targets:r=[]}){let a=Z(),l={id:e,query:t,context:i,targets:r,providerId:n.id},u=await a.dispatch(n.identity,X,l),h=u.error;if(h)throw new Error(h);return u}let wn=new Map;function Ne(n,e){return`${n.name}:${n.uuid}:${e}`}let gn=new Map;function Wn(n,e){return`${n}:${e}`}function Fe(n){let e=Ne.bind(null,n.identity),t=Ae.bind(null,n.identity),i=Le.bind(null,n);return async(r,a)=>{let l=e(r.id);if(!wn.has(l)){let f=()=>{t(r.id),wn.delete(l)};wn.set(l,f),r.onClose(f)}let u=Wn(n.id,r.id),h=()=>{gn.delete(u),a.close()};r.onClose(h),gn.set(u,f=>{f.results?.length&&a.respond(f.results),f.revoked?.length&&a.revoke(...f.revoked),f.context&&a.updateContext(f.context),f.status===v.Open&&a.open(),f.status===v.Close&&h()});let C=await i(r);return C.status===v.Open&&a.open(),C.status!==v.Close&&C.status!==v.Initial||h(),C}}function ke(n){return async e=>{let t=Z(),i={providerId:n.id,result:e};return t.dispatch(n.identity,z,i)}}let U=new Map;function yn(n){return`${n.name}-${n.uuid}`}function $e(){return async(n,e)=>{if(!n||!n.id)return console.error(new Error(JSON.stringify(n))),void console.error(S);if(L(n.id))throw P;return n.identity=e,await async function(t){let i=yn(t.identity);U.has(i)||U.set(i,[]),U.get(i).push(t.id),await ln({...t,onUserInput:Fe(t),onResultDispatch:ke(t)})}(n),{workspaceVersion:En||"",clientAPIVersion:n.clientAPIVersion||""}}}function xe(){return(n,e)=>{n?function(t,i){let r=L(t);if(!r)return;if(r.identity.uuid!==i.uuid||r.identity.name!==i.name)throw y;let a=yn(r.identity),l=U.get(a);if(l){let u=l.findIndex(h=>h===t);u!==-1&&(l.splice(u,1),Q(t))}}(n,e):console.error(S)}}let mn=new Set;function _e(n){mn.add(n)}function Te(n){mn.delete(n)}function Ue(){return async n=>{(function(e){let t=yn(e),i=U.get(t);if(i){for(let r of i)Q(r);U.delete(t)}})(n),mn.forEach(e=>e(n))}}async function De(){let n=await(e=On,fin.InterApplicationBus.Channel.create(e));var e;return n.onConnection(async t=>{for(let i of fn)if(!await i(t))throw b}),n.onDisconnection(Ue()),n.register(J,Ie()),n.register(X,t=>{let i=Wn(t.providerId,t.id),r=gn.get(i);r&&r(t)}),n.register(An,$e()),n.register(In,xe()),n.register(Ln,async()=>Un()),n.register(Pn,Pe()),n.register(z,async(t,i)=>{if(!t||!t.providerId||!t.result)return void console.error(S);let r=L(t.providerId);if(!r)throw y;let{onResultDispatch:a}=r;return a?(t.result.dispatcherIdentity=t.result.dispatcherIdentity??i,a(t.result)):void 0}),n}async function We(){let n=Z();me(),await n.destroy(),Nn()}async function Be(){let n=ge();n||(n=await De(),ye(n));let e=ve.bind(null),t=Te.bind(null),i=te.bind(null),r=ie.bind(null);return{getAllProviders:Un.bind(null),search:Dn.bind(null),register:Se.bind(null),deregister:Re.bind(null),onSubscription:Ce.bind(null),onDisconnect:_e.bind(null),onRegister:ee.bind(null),onDeregister:oe.bind(null),dispatch:Ee.bind(null),disconnect:We.bind(null),removeListener:a=>{e(a),t(a),i(a),r(a)},channel:n}}let{v:Bn}=d,{B:Mn}=s,Vn="all",Me={create:Bn,subscribe:Mn,defaultTopic:Vn},qn=()=>{window.search=Me},Hn=n=>{let e=()=>{qn(),window.removeEventListener(n,e)};return e};if(typeof window<"u"){qn();let n="load",e=Hn(n);window.addEventListener(n,e);let t="DOMContentLoaded",i=Hn(t);window.addEventListener(t,i)}Gn.exports=c})()});var w="@openfin/cloud-api";async function A(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function Kn(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 Ze(){return`${window.fin.me.uuid}-cloud-api-notifications`}var vn=null;async function mt(){return vn||(vn=nt()),vn}async function nt(){if(!window.fin)throw new Error(`\`${V}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${V}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);Kn(window.fin.me);let o=await et();console.log(o),o.register("openfin-cloud-event",s=>{for(let d of c.get(s.type)??[])typeof s.payload.timestamp=="string"&&(s.payload.timestamp=new Date(s.payload.timestamp)),d(s.payload)});let c=new Map;return{addEventListener:(s,d)=>{let p=c.get(s)||new Set;p.add(d),c.set(s,p)},removeEventListener:(s,d)=>{let p=c.get(s);if(!p){console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,s);return}p.delete(d)===!1&&console.warn(`\`${V}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,s)},update:async s=>(await o.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:s}})).payload.response,clear:async s=>(await o.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:s}})).payload.response,createNotification:async s=>(s.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:{...s,id:void 0}}})).payload.response)}}var tn=null;async function et(){return tn||(tn=tt()),tn}async function tt(){let o=await window.fin.InterApplicationBus.Channel.connect(Ze());return o.onDisconnection(c=>{console.warn(`\`${V}\`: Channel Disconnected from`,c,"Reconnecting..."),tn=null}),o}var Sn;function ot(){return`${window.fin.me.uuid}-client-api`}async function T(){return Sn||(Sn=window.fin.InterApplicationBus.Channel.connect(ot())),Sn}async function St(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-settings")}async function Rt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-user-settings")}async function Et(o){if(!window.fin)throw new Error(`\`${w}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("set-user-settings",o)}async function bt(){if(!window.fin)throw new Error(`\`${w}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await T()).dispatch("get-user-permissions")}async function Ot(o,c){if(!window.fin)throw new Error(`\`${w}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let s=await T();try{await s.dispatch("launch-content",{id:o,options:c})}catch(d){switch(d instanceof Error?d.message:String(d)){case"UnableToLookup":throw new Error(`${w}: \`launchContent\` was unable to lookup content with id: ${o}`);case"UnableToLaunch":throw new Error(`${w}: \`launchContent\` was unable to launch content with id: ${o}`);case"NoContentFound":throw new Error(`${w}: \`launchContent\` did not find content with id: ${o}`);default:throw new Error(`${w}: \`launchContent\` was unable to look up or launch content with id: ${o} or the content did not exist.`)}}}async function Pt(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchSupertab\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchSupertab\` cannot be used in a outside of an OpenFin View context`);let c=await T();try{await c.dispatch("launch-supertab",{id:o})}catch(s){switch(s instanceof Error?s.message:String(s)){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 At(o){if(!window.fin)throw new Error(`\`${w}\`: \`launchWorkspace\` cannot be used in a non-OpenFin environment`);if(await A()===!1)throw new Error(`${w}: \`launchWorkspace\` cannot be used in a outside of an OpenFin View context`);let c=await T();try{await c.dispatch("launch-workspace",{id:o})}catch(s){switch(s instanceof Error?s.message:String(s)){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 Qn={};Je(Qn,{register:()=>Jn});var zn=Ye(jn(),1),it="log-message-",rt="open-url",st="provider-status-",at="registered-",ct="1.0";function lt(o,c){let{data:s,...d}=o;return{...d,data:{customData:s,providerId:c,resultType:"app"}}}function Xn(o){return{...o,data:o.data.customData}}async function ut(o,c,s,d=!0){await c("info",`Setting status as ${d?"ready":"not ready"}`);try{await o.dispatch(`${st}${s}`,{isReady:d})}catch(p){let y=["Error setting provider status",p];console.error(...y),c("error",...y)}}async function dt(o,c,s,...d){try{await o.dispatch(`${it}${c}`,{level:s,message:d})}catch(p){console.error("Error logging message",p)}}async function pt(o,c,s,d,p){let{action:y,dispatcherIdentity:P,...S}=p;await s("info","Handling action",{action:y,dispatcherIdentity:P,result:S});let b;try{let R=Xn(p).actions?.find(({name:K})=>K===y.name);if(!R)throw new Error("Original action not found in search result");b=(await d(R,Xn(p)))?.url}catch(O){throw await s("error","Error handling dispatch",O),O}if(!b){await s("warn","OnActionListener did not return a URL");return}await ht(o,s,c.id,b,P)}async function ft(o,c,s,d){await c("info","Getting search results",{request:d});try{let p=new AbortController;d.onClose(()=>p.abort());let{context:y,query:P}=d,{results:S}=await s({context:y,query:P,signal:p.signal}),b=S.map(O=>lt(O,o.id));return await c("info","Returning results",b),{results:b}}catch(p){let y=["Error handling search",p];throw console.error(...y),c("error",...y),p}}async function ht(o,c,s,d,p){await c("info","Opening URL",{url:d,targetIdentity:p});try{await o.dispatch(rt,{url:d,targetIdentity:p,providerId:s})}catch(y){let P=["Error opening URL",y];console.error(...P),c("error",...P)}}async function Jn(o){let s=(await window.fin.me.getOptions()).customData,{configData:d,id:p,title:y}=s,{onAction:P,onSearch:S}=o,b=await zn.subscribe(),O=b.channel,R=dt.bind(null,O,p);return await b.register({icon:"",id:p,onResultDispatch:pt.bind(null,O,s,R,P),onUserInput:ft.bind(null,s,R,S),title:y}),await b.channel.dispatch(`${at}${p}`,{version:ct}),R("info","Registered search topic",{id:p,title:y}),{customData:d,isReady:ut.bind(null,O,R,p)}}export{Qn as Search,St as getAppSettings,bt as getAppUserPermissions,Rt as getAppUserSettings,mt as getNotificationsClient,Ot as launchContent,Pt as launchSupertab,At as launchWorkspace,Et 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,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EAAIH,EAAc,WAC5CI,EAAc,mBAAmBJ,EAAc,WAAW,EAAE,GAClE,QAAQ,MAAM,oBAAoBI,CAAW,EAAE,EAC/C,IAAMC,EAAkB,MAAM,OAAO,IAAI,oBAAoB,QAAQ,OAAOD,CAAW,EACvF,OAAAC,EAAgB,SAASb,EAA0B,MAAOc,GAAqB,CAC3E,GAAM,CAAE,aAAAC,EAAc,SAAAC,EAAU,aAAAC,CAAa,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:()=>x,create:()=>Xe,defaultTopic:()=>Ze,subscribe:()=>Ye});var n={};e.r(n),e.d(n,{B:()=>fe});var o={};e.r(o),e.d(o,{v:()=>Qe});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;!function(e){e.Local=\"local\",e.Dev=\"dev\",e.Staging=\"staging\",e.Prod=\"prod\"}(h||(h={}));const g=\"undefined\"!=typeof window&&\"undefined\"!=typeof fin,w=(\"undefined\"==typeof process||process.env,\"undefined\"!=typeof window),y=w?window.origin:h.Local,v=(g&&fin.me.uuid,g&&fin.me.name,g&&fin.me.entityType,h.Local,h.Dev,h.Staging,h.Prod,e=>e.startsWith(\"http://\")||e.startsWith(\"https://\")?e:y+e),m=(v(\"http://localhost:4002\"),v(\"http://localhost:4002\"),\"undefined\"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&v(WORKSPACE_DOCS_PLATFORM_URL),\"undefined\"!=typeof WORKSPACE_DOCS_CLIENT_URL&&v(WORKSPACE_DOCS_CLIENT_URL),\"20.1.1\");\"undefined\"!=typeof WORKSPACE_BUILD_SHA&&WORKSPACE_BUILD_SHA;var R,C;!function(e){e.Workspace=\"openfin-workspace\",e.OldWorkspace=\"openfin-browser\"}(R||(R={})),function(e){e.FinProtocol=\"fin-protocol\"}(C||(C={}));R.Workspace;var b,S,I,x;!function(e){e[e.Initial=0]=\"Initial\",e[e.Open=1]=\"Open\",e[e.Close=2]=\"Close\"}(b||(b={})),function(e){e.Fetching=\"fetching\",e.Fetched=\"fetched\",e.Complete=\"complete\"}(S||(S={})),function(e){e.UserAction=\"user-action\",e.FocusChange=\"focus-change\",e.Reload=\"reload\"}(I||(I={})),function(e){e.Active=\"active\",e.Default=\"default\"}(x||(x={}));const O=`__search-${`${R.OldWorkspace}-home`}-topic__`,k=\"0\",P=\"1\",B=\"2\",E=\"3\",_=\"4\",A=\"5\",D=\"6\",L=()=>{},U=new Set;function T(e){U.add(e)}function F(e){U.delete(e)}const W=new Set;function $(e){W.add(e)}function M(e){W.delete(e)}const q=new Map;async function K(e){q.set(e.id,e);const t=[...U].map((e=>e()));await Promise.all(t)}async function V(e){q.delete(e);const t=[...W].map((e=>e()));await Promise.all(t)}function j(){return[...q.values()]}function H(){q.clear()}function N(e){return q.get(e)}function z(e,t,n){return{...e,action:n||{...e.actions[0],trigger:I.UserAction},dispatcherIdentity:t}}function J(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 G(e){const t={};let n=[];let o=[];let r=null;let i=b.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=L;const s={};return t.res=s,s.close=()=>{i!==b.Close&&(i=b.Close,t.onChange())},s.open=()=>{i!==b.Open&&(i=b.Open,t.onChange())},s.respond=n=>{const o=J(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 X(){return{name:fin.me.name,uuid:fin.me.uuid}}const Y=50,Z=1e3;const ee=new Map;function te(){return ee}const ne=100;function oe(){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=N(n);if(!o){const e=i;return console.error(e),{error:e.message}}const r=te();let s=r.get(e.id);s||(s=Q(t,e),r.set(e.id,s));const a=G(),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(k,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()}),ne))};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 re(e,t){const n=t||await l(),o=X(),r={...e,identity:o,onResultDispatch:void 0},i=await n.dispatch(B,r);return await K({identity:o,...e}),i}async function ie(e){const t=await l();return await t.dispatch(E,e),V(e)}async function se(e,t,n,o){const r=z(t,o??X(),n),i=N(e);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(r)}const s={providerId:e,result:r};return(await l()).dispatch(A,s)}async function ce(e){const t={...e,context:e?.context||{}},n={},o=async function*(e,{setState:t}){const n=await l();for(;;){const o=await n.dispatch(P,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(D,{id:e})}(n.id)},n.next=()=>{if(r){const e=r;return r=void 0,e}return o.next()},n}async function ae(){return(await l()).dispatch(_,null)}async function ue(){const e=await l();d=void 0,H(),await e.disconnect()}const de=async()=>{const e=await le();for(const t of j())await re(t,e);return e};async function le(){const e=await async function(e){for(let t=0;t<Y;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(e){if(t===Y-1)throw e;await new Promise((e=>setTimeout(e,Z)))}}(O);return e.register(k,oe()),e.register(D,(e=>{const t=te(),n=t.get(e.id);n&&(n.close(),t.delete(e.id))})),e.register(A,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=N(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})),e.onDisconnection((async()=>{if(!f())return;const e=te();for(const{req:t,close:n}of e.values())n(),e.delete(t.id);p(de())})),e}async function fe(){let e=f();e||(e=le(),p(e));const t=await e;return{getAllProviders:ae.bind(null),register:re.bind(null),search:ce.bind(null),deregister:ie.bind(null),dispatch:se.bind(null),disconnect:ue.bind(null),channel:t}}let pe;function he(){if(pe)return pe;throw u}function ge(){return pe}function we(e){pe=e}function ye(){pe=void 0}const ve=new Set;function me(e){ve.add(e)}function Re(e){ve.delete(e)}async function Ce(){return[...j()].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function be(e){if(N(e.id))throw new Error(\"provider with name already exists\");const t=X();return await K({identity:t,...e}),{workspaceVersion:m||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}async function Se(e){await V(e)}async function Ie(e,t,n,o){const r=N(e);if(!r)throw i;const{onResultDispatch:s}=r;if(!s)return;return s(z(t,o??X(),n))}async function*xe(e,t){const n=function(e,t){const n=[],o=[],r=[],i=[];for(const s of e){const e=G(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=J(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=>N(e))).filter((e=>!!e)):[...j().filter((e=>!e.hidden))],e),{providerResponses:o,listenerResponses:r}=n;let{openListenerResponses:i,initialResponsePromises:s}=n,c=S.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(S.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===b.Open||c===S.Fetching&&s===b.Initial)&&(f.push(t),n.onChange=l);const a=n.getResultBuffer();a.length&&(n.setResultBuffer([]),i.results=J(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(S.Complete),o}let Oe=0;async function ke(e){Oe+=1;const t=Q(Oe.toString(),e),n=xe(t.req,{setState:e=>{n.state=e}});return n.id=Oe.toString(),n.close=t.close,n.state=S.Fetching,n}const Pe=new Map,Be=1e4;function Ee(){return async e=>{if(!e)return console.error(c),{error:c.message};let t;if(e.id)t=e.id;else{const n=await ke(e);t=n.id,e.id=n.id,Pe.set(t,{generator:n})}const n=Pe.get(t);clearTimeout(n.timeout);const o=await n.generator.next();return n.timeout=function(e){return window.setTimeout((()=>{Pe.delete(e)}),Be)}(t),{...o,id:e.id,state:n.generator.state}}}function _e(e,t){return he().dispatch(e,D,{id:t})}function Ae(){return e=>function(e){const t=Pe.get(e);t&&t.generator.close()}(e.id)}async function De(e,{id:t,query:n,context:o,targets:r=[]}){const i=he(),s={id:t,query:n,context:o,targets:r,providerId:e.id},c=await i.dispatch(e.identity,k,s),a=c.error;if(a)throw new Error(a);return c}const Le=new Map;function Ue(e,t){return`${e.name}:${e.uuid}:${t}`}const Te=new Map;function Fe(e,t){return`${e}:${t}`}function We(e){const t=Ue.bind(null,e.identity),n=_e.bind(null,e.identity),o=De.bind(null,e);return async(r,i)=>{const s=t(r.id);if(!Le.has(s)){const e=()=>{n(r.id),Le.delete(s)};Le.set(s,e),r.onClose(e)}const c=Fe(e.id,r.id),a=()=>{Te.delete(c),i.close()};r.onClose(a),Te.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===b.Open&&i.open(),e.status===b.Close&&a()}));const u=await o(r);return u.status===b.Open&&i.open(),u.status!==b.Close&&u.status!==b.Initial||a(),u}}function $e(e){return async t=>{const n=he(),o={providerId:e.id,result:t};return n.dispatch(e.identity,A,o)}}const Me=new Map;function qe(e){return`${e.name}-${e.uuid}`}function Ke(){return async(e,t)=>{if(!e||!e.id)return console.error(new Error(JSON.stringify(e))),void console.error(c);if(N(e.id))throw s;return e.identity=t,await async function(e){const t=qe(e.identity);Me.has(t)||Me.set(t,[]),Me.get(t).push(e.id),await K({...e,onUserInput:We(e),onResultDispatch:$e(e)})}(e),{workspaceVersion:m||\"\",clientAPIVersion:e.clientAPIVersion||\"\"}}}function Ve(){return(e,t)=>{e?function(e,t){const n=N(e);if(!n)return;if(n.identity.uuid!==t.uuid||n.identity.name!==t.name)throw i;const o=qe(n.identity),r=Me.get(o);if(r){const t=r.findIndex((t=>t===e));-1!==t&&(r.splice(t,1),V(e))}}(e,t):console.error(c)}}const je=new Set;function He(e){je.add(e)}function Ne(e){je.delete(e)}function ze(){return async e=>{!function(e){const t=qe(e),n=Me.get(t);if(n){for(const e of n)V(e);Me.delete(t)}}(e),je.forEach((t=>t(e)))}}async function Je(){const e=await(t=O,fin.InterApplicationBus.Channel.create(t));var t;return e.onConnection((async e=>{for(const t of ve)if(!await t(e))throw a})),e.onDisconnection(ze()),e.register(D,Ae()),e.register(k,(e=>{const t=Fe(e.providerId,e.id),n=Te.get(t);n&&n(e)})),e.register(B,Ke()),e.register(E,Ve()),e.register(_,(async()=>Ce())),e.register(P,Ee()),e.register(A,(async(e,t)=>{if(!e||!e.providerId||!e.result)return void console.error(c);const n=N(e.providerId);if(!n)throw i;const{onResultDispatch:o}=n;return o?(e.result.dispatcherIdentity=e.result.dispatcherIdentity??t,o(e.result)):void 0})),e}async function Ge(){const e=he();ye(),await e.destroy(),H()}async function Qe(){let e=ge();e||(e=await Je(),we(e));const t=Re.bind(null),n=Ne.bind(null),o=F.bind(null),r=M.bind(null);return{getAllProviders:Ce.bind(null),search:ke.bind(null),register:be.bind(null),deregister:Se.bind(null),onSubscription:me.bind(null),onDisconnect:He.bind(null),onRegister:T.bind(null),onDeregister:$.bind(null),dispatch:Ie.bind(null),disconnect:Ge.bind(null),removeListener:e=>{t(e),n(e),o(e),r(e)},channel:e}}const{v:Xe}=o,{B:Ye}=n,Ze=\"all\",et={create:Xe,subscribe:Ye,defaultTopic:Ze},tt=()=>{window.search=et},nt=e=>{const t=()=>{tt(),window.removeEventListener(e,t)};return t};if(\"undefined\"!=typeof window){tt();const e=\"load\",t=nt(e);window.addEventListener(e,t);const n=\"DOMContentLoaded\",o=nt(n);window.addEventListener(n,o)}module.exports=t})();\n//# sourceMappingURL=index.js.map","import type OpenFin from '@openfin/core';\n\nexport const PACKAGE_NAME = '@openfin/cloud-api';\n\nexport async function isInViewContext(): Promise<boolean> {\n try {\n await window.fin.View.getCurrentSync().getInfo();\n return true;\n } catch {\n return false;\n }\n}\n\nexport function extractAppUuidFromIdentity(identity: OpenFin.Identity): string {\n if (identity.name.startsWith('internal-generated')) {\n throw new Error('Cannot extract app UUID from identity');\n }\n // <uuid>/<name>\n if (/\\/[\\d,a-z-]{36}$/.test(identity.name)) {\n return identity.name.split('/')[0] || '';\n }\n\n return identity.name;\n}\n","// eslint-disable-next-line check-file/no-index\nimport type * as NotificationsTypes from '@openfin/workspace/notifications';\n\nimport type { FlannelChannelClient, NotificationEventsMap, NotificationsClient } from './types';\nimport { extractAppUuidFromIdentity, isInViewContext } from './utils';\n\nconst PACKAGE_NAME = '@openfin/cloud-api';\n\nexport type {\n FlannelChannelProvider as __INTERNAL_FlannelChannelProvider,\n FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest,\n FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse,\n FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest,\n FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse,\n FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest,\n FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse,\n} from './types';\n\nfunction getChannelName() {\n return `${window.fin.me.uuid}-cloud-api-notifications`;\n}\n\nlet notificationsClientPromise: Promise<NotificationsClient> | null = null;\n\n/**\n * @returns A client for interacting with the OpenFin Notifications service\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the app UUID cannot be extracted from the current context\n *\n * @example **Basic Usage** Creating a notification, updating it and then clearing it\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * const notification = await notificationsClient.createNotification({\n * title: 'Hello, World!',\n * body: 'This is a notification from the OpenFin Cloud API',\n * });\n *\n * // Use the `id` from the returned notification to interact with it\n * console.log(notification.id);\n *\n * // Update the notification\n * await notificationsClient.update({\n * id: notification.id,\n * body: 'This is a notification from the OpenFin Cloud API, that has been updated!',\n * })\n *\n * // Clear the notification\n * await notificationsClient.clear(notification.id);\n * ```\n *\n * @example **Advanced Usage** Listening for events\n * ```ts\n * const notificationsClient = await getNotificationsClient();\n *\n * // create the notification\n * const notification = await notificationsClient.createNotification({\n * title: `${window.fin.me.identity.name} Hello, World!`,\n * body: `This is a notification from the cloud API example created at ${new Date().toLocaleTimeString()}`,\n * buttons: [\n * {\n * title: 'Acknowledge',\n * },\n * ],\n * });\n *\n * notificationsClient.addEventListener('notification-action', (event) => {\n * console.log('Notification action:', event);\n * });\n * ```\n */\nasync function getNotificationsClient(): Promise<NotificationsClient> {\n if (!notificationsClientPromise) {\n notificationsClientPromise = getNotificationsClientInternal();\n }\n\n return notificationsClientPromise;\n}\n\nasync function getNotificationsClientInternal(): Promise<NotificationsClient> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getNotificationsClient\\` cannot be used in a non-OpenFin environment`);\n }\n\n extractAppUuidFromIdentity(window.fin.me);\n\n const channelPromise = await getChannelClient();\n console.log(channelPromise);\n\n channelPromise.register('openfin-cloud-event', (message) => {\n for (const listener of eventListeners.get(message.type) ?? []) {\n // `Date` is serialized as a string, so we need to convert it back\n if (typeof message.payload.timestamp === 'string') {\n message.payload.timestamp = new Date(message.payload.timestamp);\n }\n\n listener(message.payload as never);\n }\n });\n\n const eventListeners = new Map<keyof NotificationEventsMap, Set<NotificationEventsMap[keyof NotificationEventsMap]>>();\n\n return {\n addEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName) || new Set();\n listeners.add(listener);\n eventListeners.set(eventName, listeners);\n },\n removeEventListener: <T extends keyof NotificationEventsMap>(eventName: T, listener: NotificationEventsMap[T]) => {\n const listeners = eventListeners.get(eventName);\n if (!listeners) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,\n eventName,\n );\n return;\n }\n\n if (listeners.delete(listener as (args: unknown) => void) === false) {\n console.warn(`\\`${PACKAGE_NAME}\\`: Listener was not found for event. Did you pass a function directly instead of a reference?`, eventName);\n }\n },\n update: async (options: Parameters<typeof NotificationsTypes.update>[0]): ReturnType<typeof NotificationsTypes.update> => {\n const response = await channelPromise.dispatch('openfin-cloud-update-notification', {\n version: 1,\n payload: {\n notification: options,\n },\n });\n return response.payload.response;\n },\n clear: async (notificationId: Parameters<typeof NotificationsTypes.clear>[0]): ReturnType<typeof NotificationsTypes.clear> => {\n const response = await channelPromise.dispatch('openfin-cloud-clear-notification', {\n version: 1,\n payload: {\n notificationId,\n },\n });\n return response.payload.response;\n },\n createNotification: async (\n options: NotificationsTypes.NotificationOptions,\n ): Promise<NotificationsTypes.Notification<NotificationsTypes.NotificationOptions>> => {\n if (options.id) {\n console.warn(\n `\\`${PACKAGE_NAME}\\`: The \\`id\\` property is not supported and will be ignored. If you need to use the \\`id\\` property, you should use the \\`id\\` property of the returned notification object.`,\n );\n }\n const response = await channelPromise.dispatch('openfin-cloud-create-notification', {\n version: 1,\n payload: {\n notification: { ...options, id: undefined },\n },\n });\n return response.payload.response;\n },\n };\n}\n\nlet channelClientPromise: Promise<FlannelChannelClient> | null = null;\n\nasync function getChannelClient(): Promise<FlannelChannelClient> {\n if (!channelClientPromise) {\n channelClientPromise = getChannelClientInternal();\n }\n\n return channelClientPromise;\n}\n\nasync function getChannelClientInternal(): Promise<FlannelChannelClient> {\n const channel = (await window.fin.InterApplicationBus.Channel.connect(getChannelName())) as FlannelChannelClient;\n\n channel.onDisconnection((identity) => {\n console.warn(`\\`${PACKAGE_NAME}\\`: Channel Disconnected from`, identity, 'Reconnecting...');\n channelClientPromise = null;\n });\n\n return channel;\n}\n\nexport { getNotificationsClient };\n","import type OpenFin from '@openfin/core';\n\nimport { isInViewContext, PACKAGE_NAME } from './utils';\n\nlet apiChannelClientPromise: Promise<OpenFin.ChannelClient>;\n\n/**\n * Represents a collection of returned app permissions\n */\nexport type AppPermissions = {\n permissions: {\n /**\n * The name of the permission\n */\n name: string;\n /**\n * The ID of the permission\n */\n id: string;\n }[];\n};\n\nfunction getApiChannelName() {\n return `${window.fin.me.uuid}-client-api`;\n}\n\nasync function getApiChannelClient(): Promise<OpenFin.ChannelClient> {\n if (!apiChannelClientPromise) {\n apiChannelClientPromise = window.fin.InterApplicationBus.Channel.connect(getApiChannelName());\n }\n\n return apiChannelClientPromise;\n}\n\n/**\n * @returns The app settings that have been set against the current app\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-settings');\n}\n\n/**\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserSettings(): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-settings');\n}\n\n/**\n * Assigns a set of user specific settings to the current app\n *\n * @returns The app settings that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function setAppUserSettings(settings: unknown): Promise<unknown> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`setAppUserSettings\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('set-user-settings', settings);\n}\n\n/**\n * @returns The permissions that have been set against the current app for the current user\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n */\nasync function getAppUserPermissions(): Promise<AppPermissions> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`getAppUserPermissions\\` cannot be used in a non-OpenFin environment`);\n }\n\n const channel = await getApiChannelClient();\n\n return channel.dispatch('get-user-permissions');\n}\n\nexport type LaunchContentOptions = {\n /** Object containing query param values to be appended to content's URL */\n queryParams?: Record<string, string>;\n /** Defines behavior when instance of content is already running.\n * If 'multi', copy of the content will be created.\n * If 'single', the existing instance of content will be focused. */\n instanceMode?: 'single' | 'multi';\n} & (\n | {\n targetType?: 'new-window';\n /** Defines the bounds of the window in which content will open */\n bounds?: Partial<OpenFin.Bounds>;\n }\n | {\n targetType: 'window' | 'view';\n targetIdentity: OpenFin.Identity;\n }\n);\n/**\n * A function allowing the easy launching of content\n * @param id The id of the content to launch\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the content\n * @throws {Error} If the function is unable to find content with the provided id.\n */\nasync function launchContent(id: string, options: LaunchContentOptions): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchContent\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-content', { id, options });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchContent\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\n/**\n * A function allowing the easy launching of Supertabs\n * @param id The id of supertab\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the supertab\n * @throws {Error} If the function is unable to find supertab with the provided id.\n */\nasync function launchSupertab(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchSupertab\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-supertab', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchSupertab\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\n/**\n * A function allowing the easy launching of Workspaces\n * @param id The id of workspace\n * @returns nothing\n *\n * @throws {Error} If the function is called outside of an OpenFin environment\n * @throws {Error} If the function is called outside of an OpenFin View context\n * @throws {Error} If the function has been unable to look up or launch the workspace\n * @throws {Error} If the function is unable to find workspace with the provided id.\n */\nasync function launchWorkspace(id: string): Promise<void> {\n if (!window.fin) {\n throw new Error(`\\`${PACKAGE_NAME}\\`: \\`launchWorkspace\\` cannot be used in a non-OpenFin environment`);\n }\n\n if ((await isInViewContext()) === false) {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` cannot be used in a outside of an OpenFin View context`);\n }\n\n const channel = await getApiChannelClient();\n\n try {\n await channel.dispatch('launch-workspace', { id });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n switch (errorMessage) {\n case 'UnableToLookup': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to lookup content with id: ${id}`);\n }\n case 'UnableToLaunch': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to launch content with id: ${id}`);\n }\n case 'NoContentFound': {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` did not find content with id: ${id}`);\n }\n default: {\n throw new Error(`${PACKAGE_NAME}: \\`launchWorkspace\\` was unable to look up or launch content with id: ${id} or the content did not exist.`);\n }\n }\n }\n}\n\nexport { getAppSettings, getAppUserSettings, setAppUserSettings, getAppUserPermissions, launchContent, launchSupertab, launchWorkspace };\n","/* eslint-disable check-file/no-index */\nexport { register } from './search';\nexport type {\n OnActionListener,\n OnSearchListener,\n SearchAction,\n SearchAgent,\n SearchAgentRegistrationConfig,\n SearchListenerRequest,\n SearchRequestContext,\n SearchResponse,\n SearchResult,\n SearchResultActionResponse,\n} from './search.types';\n","import type { OpenFin } from '@openfin/core';\nimport * as WorkspaceSearch from '@openfin/search-api';\n\nimport type {\n LogMessageChannelTopicPayload,\n OnActionListener,\n OnSearchListener,\n OpenUrlChannelTopicPayload,\n ProviderStatusChannelTopicPayload,\n SearchAgent,\n SearchAgentLogLevel,\n SearchAgentRegistrationConfig,\n SearchAgentWindowCreationOptions,\n SearchResult,\n} from './search.types';\n\nconst CHANNEL_TOPIC_LOG_MESSAGE_PREFIX = 'log-message-';\nconst CHANNEL_TOPIC_OPEN_URL = 'open-url';\nconst CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX = 'provider-status-';\nconst CHANNEL_TOPIC_REGISTERED_PREFIX = 'registered-';\nconst SEARCH_PROVIDER_CLIENT_API_VERSION = '1.0';\n\nfunction convertFromSearchResult(result: SearchResult, providerId: string): WorkspaceSearch.SearchResult {\n const { data, ...otherProps } = result;\n return {\n ...otherProps,\n data: {\n customData: data,\n providerId,\n resultType: 'app',\n },\n };\n}\n\nfunction convertToSearchResult(result: WorkspaceSearch.SearchResult): SearchResult {\n return {\n ...result,\n data: result.data.customData,\n };\n}\n\nasync function isReady(\n channel: OpenFin.ChannelClient,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n providerId: string,\n ready: boolean = true,\n): Promise<void> {\n await logMessage('info', `Setting status as ${ready ? 'ready' : 'not ready'}`);\n try {\n await channel.dispatch(`${CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX}${providerId}`, { isReady: ready } satisfies ProviderStatusChannelTopicPayload);\n } catch (error) {\n const args = ['Error setting provider status', error];\n console.error(...args);\n logMessage('error', ...args);\n }\n}\n\nasync function logMessage(channel: OpenFin.ChannelClient, providerId: string, level: SearchAgentLogLevel, ...args: unknown[]) {\n try {\n await channel.dispatch(`${CHANNEL_TOPIC_LOG_MESSAGE_PREFIX}${providerId}`, { level, message: args } satisfies LogMessageChannelTopicPayload);\n } catch (error) {\n console.error('Error logging message', error);\n }\n}\n\nasync function onResultDispatch(\n channel: OpenFin.ChannelClient,\n config: SearchAgentWindowCreationOptions,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n onAction: OnActionListener,\n searchResult: WorkspaceSearch.DispatchedSearchResult,\n): Promise<void> {\n const { action, dispatcherIdentity, ...otherProps } = searchResult;\n await logMessage('info', 'Handling action', { action, dispatcherIdentity, result: otherProps });\n let url: string | undefined;\n try {\n const originalResult = convertToSearchResult(searchResult);\n const originalAction = originalResult.actions?.find(({ name: id }) => id === action.name);\n if (!originalAction) {\n throw new Error('Original action not found in search result');\n }\n const actionResult = await onAction(originalAction, convertToSearchResult(searchResult));\n url = actionResult?.url;\n } catch (error) {\n await logMessage('error', 'Error handling dispatch', error);\n throw error;\n }\n if (!url) {\n await logMessage('warn', 'OnActionListener did not return a URL');\n return;\n }\n await openUrl(channel, logMessage, config.id, url, dispatcherIdentity);\n}\n\nasync function onUserInput(\n config: SearchAgentWindowCreationOptions,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n onSearch: OnSearchListener,\n request: WorkspaceSearch.SearchListenerRequest,\n): Promise<WorkspaceSearch.SearchResponse> {\n await logMessage('info', 'Getting search results', { request });\n try {\n const abortController = new AbortController();\n request.onClose(() => abortController.abort());\n const { context, query } = request;\n const { results } = await onSearch({ context, query, signal: abortController.signal });\n const convertedResults = results.map((result) => convertFromSearchResult(result, config.id));\n await logMessage('info', 'Returning results', convertedResults);\n return { results: convertedResults };\n } catch (error) {\n const args = ['Error handling search', error];\n console.error(...args);\n logMessage('error', ...args);\n throw error;\n }\n}\n\nasync function openUrl(\n channel: OpenFin.ChannelClient,\n logMessage: (level: SearchAgentLogLevel, ...args: unknown[]) => Promise<void>,\n providerId: string,\n url: string,\n targetIdentity: OpenFin.Identity,\n): Promise<void> {\n await logMessage('info', 'Opening URL', { url, targetIdentity });\n try {\n await channel.dispatch(CHANNEL_TOPIC_OPEN_URL, { url, targetIdentity, providerId } satisfies OpenUrlChannelTopicPayload);\n } catch (error) {\n const args = ['Error opening URL', error];\n console.error(...args);\n logMessage('error', ...args);\n }\n}\n\n/**\n * Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.\n *\n * @param config The configuration for the Search Agent.\n *\n * @returns A promise that resolves with the Search Agent.\n *\n * @example Registering a basic Search Agent:\n * ```ts\n * // Handle incoming action and return a response that includes the URL to navigate to\n * const onAction: Search.OnActionListener = (action, result) => {\n * const { name } = action;\n * const { data, key } = result;\n * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };\n * const { id: ownerId } = owner;\n * console.log(`Action \"${name}\" triggered on search result with key \"${key}\"`);\n * switch (name) {\n * case \"view-owner\":\n * return { url: `${searchResultHostUrl}/people/${ownerId}` };\n * case \"view-result\":\n * return { url: `${searchResultHostUrl}/record/${key}` };\n * default:\n * console.warn(`Unknown action: ${name}`);\n * }\n * };\n *\n * // Handle incoming search request and return relevant search results\n * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {\n * const { pageNumber, pageSize } = context;\n * try {\n * let results: Search.SearchResult[] = [];\n * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;\n * const response = await fetch(url, { signal });\n * if (!response.ok) {\n * throw new Error(`Request failed: ${response.status}`);\n * }\n * const { searchResults } = await response.json();\n * results = searchResults.map((result) => {\n * const { iconUrl, id: key, owner, subTitle, title } = result;\n * const { name: ownerName } = owner as { id: string, name: string };\n * return {\n * actions: [\n * {\n * name: \"view-result\",\n * description: `Go to ${title} in My Web App`,\n * },\n * {\n * name: \"view-owner\",\n * description: `Go to ${ownerName} in My Web App`,\n * title: \"View Owner\",\n * },\n * ],\n * data: {\n * owner,\n * searchResultHostUrl: `https://my-web-app.com`,\n * },\n * icon: iconUrl,\n * key,\n * label: subTitle,\n * title,\n * };\n * });\n * console.log(\"Returning results\", results);\n * return { results };\n * } catch (err) {\n * if ((err as Error).name === \"AbortError\") {\n * // Ignore errors for cancelled requests\n * return { results: [] };\n * }\n * throw err;\n * }\n * };\n *\n * // Register the search agent\n * const searchAgent = await Search.register({ onAction, onSearch });\n *\n * // Set the Search Agent as ready to receive search requests\n * await searchAgent.isReady();\n * ```\n */\nexport async function register(config: SearchAgentRegistrationConfig): Promise<SearchAgent> {\n // Get provider configuration from window options custom data\n const windowOptions = await window.fin.me.getOptions();\n const customData = windowOptions.customData as SearchAgentWindowCreationOptions;\n const { configData, id, title } = customData;\n\n // Subscribe to the search topic and register the search provider\n const { onAction, onSearch } = config;\n const topic = await WorkspaceSearch.subscribe();\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore - The following line will error if the @openfin/core version used is different to the one used in @openfin/search-api\n const channel = topic.channel as OpenFin.ChannelClient;\n const logMessageBound = logMessage.bind(null, channel, id);\n await topic.register({\n icon: '',\n id,\n onResultDispatch: onResultDispatch.bind(null, channel, customData, logMessageBound, onAction),\n onUserInput: onUserInput.bind(null, customData, logMessageBound, onSearch),\n title,\n });\n await topic.channel.dispatch(`${CHANNEL_TOPIC_REGISTERED_PREFIX}${id}`, { version: SEARCH_PROVIDER_CLIENT_API_VERSION });\n logMessageBound('info', 'Registered search topic',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AE,IAAAW,EAAK,eAAAY,CAAe,CAAC,EAC/D,GAAI,CACA,MAAMxB,EAAQ,SAASX,GAAwB,CAAE,IAAAuB,EAAK,eAAAY,EAAgB,WAAA7B,CAAW,CAAsC,CAC3H,OAASQ,EAAO,CACZ,IAAMC,EAAO,CAAC,oBAAqBD,CAAK,EACxC,QAAQ,MAAM,GAAGC,CAAI,EACrBH,EAAW,QAAS,GAAGG,CAAI,CAC/B,CACJ,CAkFA,eAAsBqB,GAASlB,EAA6D,CAGxF,IAAMmB,GADgB,MAAM,OAAO,IAAI,GAAG,WAAW,GACpB,WAC3B,CAAE,WAAAC,EAAY,GAAAb,EAAI,MAAAc,CAAM,EAAIF,EAG5B,CAAE,SAAAlB,EAAU,SAAAS,CAAS,EAAIV,EACzBsB,EAAQ,MAAsB,aAAU,EAGxC7B,EAAU6B,EAAM,QAChBC,EAAkB7B,GAAW,KAAK,KAAMD,EAASc,CAAE,EACzD,aAAMe,EAAM,SAAS,CACjB,KAAM,GACN,GAAAf,EACA,iBAAkBR,GAAiB,KAAK,KAAMN,EAAS0B,EAAYI,EAAiBtB,CAAQ,EAC5F,YAAaQ,GAAY,KAAK,KAAMU,EAAYI,EAAiBb,CAAQ,EACzE,MAAAW,CACJ,CAAC,EACD,MAAMC,EAAM,QAAQ,SAAS,GAAGtC,EAA+B,GAAGuB,CAAE,GAAI,CAAE,QAAStB,EAAmC,CAAC,EACvHsC,EAAgB,OAAQ,0BAA2B,CAAE,GAAAhB,EAAI,MAAAc,CAAM,CAAC,EAEzD,CACH,WAAYD,EACZ,QAAS5B,GAAQ,KAAK,KAAMC,EAAS8B,EAAiBhB,CAAE,CAC5D,CACJ","names":["require_search_api","__commonJSMin","exports","module","e","t","n","o","x","Xe","Ze","Ye","fe","Qe","r","i","s","c","a","u","d","l","f","p","h","g","w","y","v","m","R","C","b","S","I","O","k","P","B","E","_","A","D","L","U","T","F","W","$","M","K","V","j","H","N","z","J","G","Q","X","Y","Z","ee","te","ne","oe","re","ie","se","ce","ae","ue","de","le","pe","he","we","ye","ve","me","Re","Ce","be","Se","Ie","xe","Oe","ke","Pe","Be","Ee","_e","Ae","De","Le","Ue","Te","Fe","We","$e","Me","qe","Ke","Ve","je","He","Ne","ze","Je","Ge","et","tt","nt","PACKAGE_NAME","isInViewContext","extractAppUuidFromIdentity","identity","PACKAGE_NAME","getChannelName","notificationsClientPromise","getNotificationsClient","getNotificationsClientInternal","isInViewContext","extractAppUuidFromIdentity","channelPromise","getChannelClient","message","listener","eventListeners","eventName","listeners","options","notificationId","channelClientPromise","getChannelClientInternal","channel","identity","apiChannelClientPromise","getApiChannelName","getApiChannelClient","getAppSettings","PACKAGE_NAME","isInViewContext","getAppUserSettings","setAppUserSettings","settings","getAppUserPermissions","launchContent","id","options","channel","error","launchSupertab","launchWorkspace","search_exports","__export","register","WorkspaceSearch","CHANNEL_TOPIC_LOG_MESSAGE_PREFIX","CHANNEL_TOPIC_OPEN_URL","CHANNEL_TOPIC_PROVIDER_STATUS_PREFIX","CHANNEL_TOPIC_REGISTERED_PREFIX","SEARCH_PROVIDER_CLIENT_API_VERSION","convertFromSearchResult","result","providerId","data","otherProps","convertToSearchResult","isReady","channel","logMessage","ready","error","args","level","onResultDispatch","config","onAction","searchResult","action","dispatcherIdentity","url","originalAction","id","openUrl","onUserInput","onSearch","request","abortController","context","query","results","convertedResults","targetIdentity","register","customData","configData","title","topic","logMessageBound"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/cloud-api",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.fe96ffc",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"exports": {
|
|
@@ -18,16 +18,17 @@
|
|
|
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/
|
|
28
|
+
"@openfin/core": "40.101.1",
|
|
29
|
+
"@openfin/search-api": "^2.0.0",
|
|
30
|
+
"@openfin/typedoc-theme": "^2.0.0",
|
|
31
|
+
"@openfin/workspace": "20.2.0",
|
|
31
32
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
32
33
|
"@typescript-eslint/parser": "^7.15.0",
|
|
33
34
|
"eslint": "^8.57.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.
|
|
41
|
-
"
|
|
41
|
+
"tsup": "^8.3.0",
|
|
42
|
+
"typedoc": "^0.26.11",
|
|
43
|
+
"typescript": "^5.6.3"
|
|
42
44
|
},
|
|
43
45
|
"eslintConfig": {
|
|
44
46
|
"env": {
|