@openfin/cloud-api
Advanced tools
Comparing version 0.0.1-alpha.95a0ee4 to 0.0.1-alpha.97b9d5b
@@ -211,2 +211,48 @@ import * as OpenFin from '@openfin/core'; | ||
export { 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, getNotificationsClient }; | ||
/** | ||
* Represents a collection of returned app permissions | ||
*/ | ||
type AppPermissions = { | ||
permissions: { | ||
/** | ||
* The name of the permission | ||
*/ | ||
name: string; | ||
/** | ||
* The ID of the permission | ||
*/ | ||
id: string; | ||
}[]; | ||
}; | ||
/** | ||
* @returns The app settings that have been set against the current app | ||
* | ||
* @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 | ||
*/ | ||
declare function getAppSettings(): Promise<unknown>; | ||
/** | ||
* @returns The app settings that have been set against the current app for the current user | ||
* | ||
* @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 | ||
*/ | ||
declare function getAppUserSettings(): Promise<unknown>; | ||
/** | ||
* Assigns a set of user specific settings to the current app | ||
* | ||
* @returns The app settings that have been set against the current app for the current user | ||
* | ||
* @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 | ||
*/ | ||
declare function setAppUserSettings(settings: unknown): Promise<unknown>; | ||
/** | ||
* @returns The permissions that have been set against the current app for the current user | ||
* | ||
* @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 | ||
*/ | ||
declare function getAppUserPermissions(): Promise<AppPermissions>; | ||
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, setAppUserSettings }; |
@@ -1,2 +0,2 @@ | ||
var o="@openfin/cloud-api";function l(){return`${window.fin.me.uuid}-cloud-api-notifications`}async function c(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function f(e){if(e.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(e.name)?e.name.split("/")[0]||"":e.name}var r=null;async function y(){return r||(r=p()),r}async function p(){if(!window.fin)throw new Error(`\`${o}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await c()===!1)throw new Error(`${o}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);f(window.fin.me);let e=await d();console.log(e),e.register("openfin-cloud-event",n=>{for(let t of i.get(n.type)??[])typeof n.payload.timestamp=="string"&&(n.payload.timestamp=new Date(n.payload.timestamp)),t(n.payload)});let i=new Map;return{addEventListener:(n,t)=>{let a=i.get(n)||new Set;a.add(t),i.set(n,a)},removeEventListener:(n,t)=>{let a=i.get(n);if(!a){console.warn(`\`${o}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,n);return}a.delete(t)===!1&&console.warn(`\`${o}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,n)},update:async n=>(await e.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:n}})).payload.response,clear:async n=>(await e.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:n}})).payload.response,createNotification:async n=>(n.id&&console.warn(`\`${o}\`: 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 e.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...n,id:void 0}}})).payload.response)}}var s=null;async function d(){return s||(s=u()),s}async function u(){let e=await window.fin.InterApplicationBus.Channel.connect(l());return e.onDisconnection(i=>{console.warn(`\`${o}\`: Channel Disconnected from`,i,"Reconnecting..."),s=null}),e}export{y as getNotificationsClient}; | ||
var t="@openfin/cloud-api";async function a(){try{return await window.fin.View.getCurrentSync().getInfo(),!0}catch{return!1}}function u(e){if(e.name.startsWith("internal-generated"))throw new Error("Cannot extract app UUID from identity");return/\/[\d,a-z-]{36}$/.test(e.name)?e.name.split("/")[0]||"":e.name}var s="@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(`\`${s}\`: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);if(await a()===!1)throw new Error(`${s}: \`getNotificationsClient\` cannot be used in a non-OpenFin environment`);u(window.fin.me);let e=await m();console.log(e),e.register("openfin-cloud-event",n=>{for(let i of o.get(n.type)??[])typeof n.payload.timestamp=="string"&&(n.payload.timestamp=new Date(n.payload.timestamp)),i(n.payload)});let o=new Map;return{addEventListener:(n,i)=>{let r=o.get(n)||new Set;r.add(i),o.set(n,r)},removeEventListener:(n,i)=>{let r=o.get(n);if(!r){console.warn(`\`${s}\`: Listener was not found for event. Did you pass a function directly instead of a reference or forget to add the listener?`,n);return}r.delete(i)===!1&&console.warn(`\`${s}\`: Listener was not found for event. Did you pass a function directly instead of a reference?`,n)},update:async n=>(await e.dispatch("openfin-cloud-update-notification",{version:1,payload:{notification:n}})).payload.response,clear:async n=>(await e.dispatch("openfin-cloud-clear-notification",{version:1,payload:{notificationId:n}})).payload.response,createNotification:async n=>(n.id&&console.warn(`\`${s}\`: 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 e.dispatch("openfin-cloud-create-notification",{version:1,payload:{notification:{...n,id:void 0}}})).payload.response)}}var p=null;async function m(){return p||(p=y()),p}async function y(){let e=await window.fin.InterApplicationBus.Channel.connect(d());return e.onDisconnection(o=>{console.warn(`\`${s}\`: Channel Disconnected from`,o,"Reconnecting..."),p=null}),e}var f;function N(){return`${window.fin.me.uuid}-client-api`}async function c(){return f||(f=window.fin.InterApplicationBus.Channel.connect(N())),f}async function E(){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 P(){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 v(e){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",e)}async function T(){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")}export{E as getAppSettings,T as getAppUserPermissions,P as getAppUserSettings,g as getNotificationsClient,v as setAppUserSettings}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@openfin/cloud-api", | ||
"version": "0.0.1-alpha.95a0ee4", | ||
"version": "0.0.1-alpha.97b9d5b", | ||
"sideEffects": false, | ||
@@ -17,2 +17,3 @@ "description": "", | ||
"build": "tsup --config ./tsup.config.ts", | ||
"build:watch": "tsup --watch --config ./tsup.config.ts", | ||
"lint": "eslint . --ext .ts,.tsx --max-warnings 0" | ||
@@ -28,14 +29,14 @@ }, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-next": "^14.1.0", | ||
"@typescript-eslint/eslint-plugin": "^7.5.0", | ||
"@typescript-eslint/parser": "^7.5.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": "^10.0.0", | ||
"eslint-plugin-simple-import-sort": "^12.0.0", | ||
"eslint-plugin-unicorn": "^51.0.1", | ||
"prettier": "^3.2.5", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3" | ||
"typescript": "^5.4.3" | ||
}, | ||
@@ -42,0 +43,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
66777
284