Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openfin/cloud-api

Package Overview
Dependencies
Maintainers
0
Versions
369
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfin/cloud-api - npm Package Compare versions

Comparing version 0.0.1-alpha.db4be82 to 0.0.1-alpha.dbde670

100

dist/index.d.ts
import * as OpenFin from '@openfin/core';
import OpenFin__default from '@openfin/core';
import * as NotificationsTypes from 'openfin-notifications';
import * as NotificationsTypes from '@openfin/workspace/notifications';
import { CLIDispatchedSearchResult, CLISearchListenerRequest, CLISearchListenerResponse, CLISearchResponse, SearchResult as SearchResult$1 } from '@openfin/workspace';

@@ -155,7 +156,2 @@ /**

declare global {
interface Window {
fin: typeof OpenFin.fin;
}
}
/**

@@ -257,2 +253,17 @@ * @returns A client for interacting with the OpenFin Notifications service

declare function getAppUserPermissions(): Promise<AppPermissions>;
type LaunchContentOptions = {
/** Object containing query param values to be appended to content's URL */
queryParams?: Record<string, string>;
/** Defines behavior when instance of content is already running.
* If 'multi', copy of the content will be created.
* If 'single', the existing instance of content will be focused. */
instanceMode?: 'single' | 'multi';
} & ({
targetType?: 'new-window';
/** Defines the bounds of the window in which content will open */
bounds?: Partial<OpenFin__default.Bounds>;
} | {
targetType: 'window' | 'view';
targetIdentity: OpenFin__default.Identity;
});
/**

@@ -268,4 +279,77 @@ * A function allowing the easy launching of content

*/
declare function launchContent(id: string): Promise<void>;
declare function launchContent(id: string, options: LaunchContentOptions): Promise<void>;
/**
* A function allowing the easy launching of Supertabs
* @param id The id of supertab
* @returns nothing
*
* @throws {Error} If the function is called outside of an OpenFin environment
* @throws {Error} If the function is called outside of an OpenFin View context
* @throws {Error} If the function has been unable to look up or launch the supertab
* @throws {Error} If the function is unable to find supertab with the provided id.
*/
declare function launchSupertab(id: string): Promise<void>;
/**
* A function allowing the easy launching of Workspaces
* @param id The id of workspace
* @returns nothing
*
* @throws {Error} If the function is called outside of an OpenFin environment
* @throws {Error} If the function is called outside of an OpenFin View context
* @throws {Error} If the function has been unable to look up or launch the workspace
* @throws {Error} If the function is unable to find workspace with the provided id.
*/
declare function launchWorkspace(id: string): Promise<void>;
export { type AppPermissions, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, setAppUserSettings };
type ActionedSearchResult = CLIDispatchedSearchResult;
type SearchActionResponse = {
url: string;
};
type SearchListenerRequest = CLISearchListenerRequest;
type SearchListenerResponse = CLISearchListenerResponse;
type SearchProvider = {
readonly configData: unknown;
hideWindow: () => Promise<void>;
readonly id: string;
isReady: (ready?: boolean) => Promise<void>;
readonly name: string;
showWindow: (options?: ShowWindowOptions) => Promise<void>;
};
type SearchProviderRegistrationConfig = {
onAction(result: ActionedSearchResult): Promise<SearchActionResponse | undefined>;
onSearch(request: SearchListenerRequest, response: SearchListenerResponse): Promise<SearchResponse>;
};
type SearchResponse = CLISearchResponse;
type SearchResult = SearchResult$1;
type ShowWindowOptions = {
center?: boolean;
height?: number;
left?: number;
resizable?: boolean;
top?: number;
width?: number;
};
declare const register: (config: SearchProviderRegistrationConfig) => Promise<SearchProvider>;
type search_ActionedSearchResult = ActionedSearchResult;
type search_SearchActionResponse = SearchActionResponse;
type search_SearchListenerRequest = SearchListenerRequest;
type search_SearchListenerResponse = SearchListenerResponse;
type search_SearchProvider = SearchProvider;
type search_SearchProviderRegistrationConfig = SearchProviderRegistrationConfig;
type search_SearchResponse = SearchResponse;
type search_SearchResult = SearchResult;
type search_ShowWindowOptions = ShowWindowOptions;
declare const search_register: typeof register;
declare namespace search {
export { type search_ActionedSearchResult as ActionedSearchResult, type search_SearchActionResponse as SearchActionResponse, type search_SearchListenerRequest as SearchListenerRequest, type search_SearchListenerResponse as SearchListenerResponse, type search_SearchProvider as SearchProvider, type search_SearchProviderRegistrationConfig as SearchProviderRegistrationConfig, type search_SearchResponse as SearchResponse, type search_SearchResult as SearchResult, type search_ShowWindowOptions as ShowWindowOptions, search_register as register };
}
declare global {
interface Window {
fin: typeof OpenFin.fin;
}
}
export { type AppPermissions, type LaunchContentOptions, search as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };

2

dist/index.js

@@ -1,2 +0,2 @@

var t="@openfin/cloud-api";async function a(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function u(n){if(n.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(n.name)?n.name.split("/")[0]||"":n.name}var r="@openfin/cloud-api";function d(){return`${window.fin.me.uuid}-cloud-api-notifications`}var l=null;async function g(){return l||(l=w()),l}async function w(){if(!window.fin)throw new Error(`\`${r}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${r}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);u(window.fin.me);let n=await h();console.log(n),n.register("openfin-cloud-event",e=>{for(let o of i.get(e.type)??[])typeof e.payload.timestamp=="string"&&(e.payload.timestamp=new Date(e.payload.timestamp)),o(e.payload)});let i=new Map;return{addEventListener:(e,o)=>{let s=i.get(e)||new Set;s.add(o),i.set(e,s)},removeEventListener:(e,o)=>{let s=i.get(e);if(!s){console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,e);return}s.delete(o)===!1&&console.warn(`\`${r}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,e)},update:async e=>(await n.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:e}})).payload.response,clear:async e=>(await n.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:e}})).payload.response,createNotification:async e=>(e.id&&console.warn(`\`${r}\`: The \`id\` property is not supported and will be ignored. If you need to use the \`id\` property, you should use the \`id\` property of the returned notification object.`),(await n.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...e,id:void 0}}})).payload.response)}}var p=null;async function h(){return p||(p=m()),p}async function m(){let n=await window.fin.InterApplicationBus.Channel.connect(d());return n.onDisconnection(i=>{console.warn(`\`${r}\`: Channel Disconnected from`,i,"Reconnecting..."),p=null}),n}var f;function y(){return`${window.fin.me.uuid}-client-api`}async function c(){return f||(f=window.fin.InterApplicationBus.Channel.connect(y())),f}async function A(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-settings")}async function v(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-settings")}async function P(n){if(!window.fin)throw new Error(`\`${t}\`: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`setAppUserSettings\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("set-user-settings",n)}async function $(){if(!window.fin)throw new Error(`\`${t}\`: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`getAppUserPermissions\` cannot be used in a non-OpenFin environment`);return(await c()).dispatch("get-user-permissions")}async function T(n){if(!window.fin)throw new Error(`\`${t}\`: \`launchContent\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${t}: \`launchContent\` cannot be used in a outside of an OpenFin View context`);let i=await c();try{await i.dispatch("launch-content",{id:n})}catch(e){switch(e instanceof Error?e.message:String(e)){case"UnableToLookup":throw new Error(`${t}: \`launchContent\` was unable to lookup content with id: ${n}`);case"UnableToLaunch":throw new Error(`${t}: \`launchContent\` was unable to launch content with id: ${n}`);case"NoContentFound":throw new Error(`${t}: \`launchContent\` did not find content with id: ${n}`);default:throw new Error(`${t}: \`launchContent\` was unable to look up or launch content with id: ${n} or the content did not exist.`)}}}export{A as getAppSettings,$ as getAppUserPermissions,v as getAppUserSettings,g as getNotificationsClient,T as launchContent,P as setAppUserSettings};
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};
//# sourceMappingURL=index.js.map
{
"name": "@openfin/cloud-api",
"version": "0.0.1-alpha.db4be82",
"version": "0.0.1-alpha.dbde670",
"sideEffects": false,

@@ -27,18 +27,17 @@ "description": "",

"dependencies": {
"@openfin/core": "^34.78.80",
"openfin-notifications": "^2.3.2"
"@openfin/core": "40.100.7"
},
"devDependencies": {
"@openfin/workspace": "20.1.1",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@typescript-eslint/parser": "^7.15.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.4",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-check-file": "^2.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-unicorn": "^51.0.1",
"prettier": "^3.2.5",
"tsup": "^8.0.1",
"typescript": "^5.4.3"
"eslint-plugin-check-file": "^2.8.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unicorn": "^55.0.0",
"prettier": "^3.3.3",
"tsup": "^8.3.0",
"typescript": "^5.6.3"
},

@@ -45,0 +44,0 @@ "eslintConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc