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

@devoinc/app-developer-kit

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devoinc/app-developer-kit - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

1

devoApp/__mocks__/DevoApp.d.ts

@@ -9,4 +9,5 @@ /// <reference types="jest" />

getUserInfo: jest.Mock<any, any>;
isPolicyActionAllowed: jest.Mock<any, any>;
goToQuery: jest.Mock<any, any>;
setAppUnmountCallback: jest.Mock<any, any>;
}

@@ -29,2 +29,3 @@ import { IQueryClient } from '../clients/query/QueryClient.interface';

protected abstract getRuntimeDependencies(): Promise<WebCoreRuntimeDeps>;
abstract isPolicyActionAllowed(action: string, operation: string): boolean;
}

@@ -16,2 +16,3 @@ import { UserInfo, DevoAppConfig, WebCoreRuntimeDeps, Query, NotiPopRequest } from '../types';

getUserInfo(): Promise<UserInfo>;
isPolicyActionAllowed(action: string, operation: string): boolean;
goToQuery(query: Query): Promise<void>;

@@ -18,0 +19,0 @@ createNotiPop(request: NotiPopRequest): Promise<void>;

@@ -62,2 +62,11 @@ import { IClient as IAlertsClient } from '@devoinc/alerts-api-client';

getPreferencesClient(config: PreferencesClientConfig): Promise<PreferencesClient>;
/**
* Checks if the user has a policy
*
* @public
*
* @param action - action to perform.
* @param operation - Type of action (op_view or op_manage).
*/
isPolicyActionAllowed(action: string, operation: string): boolean;
}

2

index.esm.js

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

import{client as e}from"@devoinc/browser-sdk";import{Client as t}from"@devoinc/alerts-api-client";import*as n from"@devoinc/alerts-api-client";export{n as AlertsApiClient};const r=e=>new Promise(((t,n)=>{let r=!1;document.addEventListener("applicationBuilderDependencies",(e=>{var s;e.preventDefault();const o=e,i=null===(s=null==o?void 0:o.detail)||void 0===s?void 0:s.dependencies;i?(r=!0,t(i)):n(new Error("Devo dependencies not found"))})),document.dispatchEvent(new CustomEvent("getVappDeps")),window.setTimeout((()=>{r||n(new Error("Initialization timeout"))}),e)})),s=e=>{const t=n=>{n.preventDefault(),e(),document.removeEventListener("beforeChangeContainer",t)};document.addEventListener("beforeChangeContainer",t)},o=(e,t)=>(e+=` pragma comment.application: "${t.application}"`,e+=` pragma comment.component: "${t.component}"`),i={processQuery:(e,t)=>{const n=i.processQueryDates(e.queryString,e.dates);return{queryString:o(e.queryString,t),dates:n}},processQueryDates:(e,t)=>{let n=t;return e.startsWith("from my.lookuplist.")&&(n=i.getDateForLookupTable()),n},getDateForLookupTable:()=>{const e=new Date,t=new Date(e);t.setDate(e.getDate()-1);return{from:t.setHours(0,0,0,0)-60*t.getTimezoneOffset()*1e3,to:e.setHours(0,0,0,0)-60*e.getTimezoneOffset()*1e3}}};class a{constructor(e,t){if(this._userInfo=e,this._appInfo=t,!t||!t.application||!t.component)throw Error("Need to pass AppInfo to get a query client")}runQuery(e){return new Promise(((t,n)=>{const r=this.getBrowserSDKClient();let s;const o=[],a={fields:{}},c={data:o,metadata:a},p=i.processQuery(e,this._appInfo);r.streamFetch({query:p.queryString,dateFrom:p.dates.from,dateTo:p.dates.to},{data:e=>{this.processEventData(e,s,(e=>{o.push(e)}))},meta:e=>{s=e,s.forEach(((e,t)=>{a.fields[e.name]={index:t,type:e.type}}))},error:e=>{n(e)},done:()=>{t(c)}})}))}runStreamQuery(e,t,n,r,s){const o=this.getBrowserSDKClient();let i;const a=e.dates.from?e.dates.from:Date.now(),c=e.dates.to?e.dates.to:-1,p=o.streamFetch({query:e.queryString,dateFrom:a,dateTo:c},{data:e=>{this.processEventData(e,i,t)},meta:e=>{i=e},progress:e=>{n(e)},error:e=>{r(e)},done:()=>{s()}});return()=>{p&&p.abort()}}getBrowserSDKClient(){const t=this._userInfo.credentials;let n="";return t.standAloneToken&&(n=`Bearer ${t.standAloneToken}`),e({url:t.serrea,apiKey:t.apiKey,apiSecret:t.apiSecret,token:n})}processEventData(e,t,n){e.forEach((e=>{const r={};t&&t.forEach(((t,n)=>{const s=t.name;r[s]=e[n]})),n(r)}))}}class c{constructor(e){this._token=e}getAuthorization(){return this._token}}class p{constructor(e,t){if(this._config=e,this._webPreferences=t,!e||!e.appId)throw Error("PreferencesClient requires a config object with appId");if("number"!=typeof e.appId)throw Error("PreferencesClient config.appId should be a number")}isAllowedDomain(){return this._webPreferences.isAllowedDomain()}isAllowedMultitenant(){return this._webPreferences.isAllowedMultitenant()}getAppPreferences(e){return this._webPreferences.getAppPreferences(this._config.appId,e)}setAppPreferences(e,t){return this._webPreferences.setAppPreferences(this._config.appId,e,t)}}class u extends class{async getQueryClient(e){const t=await this.getUserInfo();return new a(t,e)}async getAlertsClient(){const e=await this.getUserInfo(),n=e.credentials.standAloneToken,r=new c(n),s=e.credentials.alertsURI;return new t(r,s)}async getPreferencesClient(e){const t=await this.getRuntimeDependencies();return new p(e,t.AppPreferences)}}{constructor(e){super(),this._config=e,this._unmountCallback=null==e?void 0:e.onAppUnmount,s((()=>this.onAppUnmount()))}async getUserInfo(){return(await this.getRuntimeDependencies()).userInfo}async goToQuery(e){(await this.getRuntimeDependencies()).goToQuery(e.queryString,e.dates)}async createNotiPop(e){const t=await this.getRuntimeDependencies();t.NotiPop&&new t.NotiPop(e)}setAppUnmountCallback(e){this._unmountCallback=e}async getRuntimeDependencies(){var e,t,n;let s;if(null===(e=this._config)||void 0===e?void 0:e.standaloneDependencies)s=this._config.standaloneDependencies;else{const e=null!==(n=null===(t=this._config)||void 0===t?void 0:t.timeout)&&void 0!==n?n:5e3;s=await r(e)}return s}onAppUnmount(){this._unmountCallback&&this._unmountCallback()}}class l{static init(e){const t=new u(e);return this._instance=t,this._instance}static getInstance(){if(!this._instance)throw new Error("DevoAppProvider is not initialized");return this._instance}}l._instance=void 0;export{l as DevoAppProvider};
import{client as e}from"@devoinc/browser-sdk";import{Client as t}from"@devoinc/alerts-api-client";import*as n from"@devoinc/alerts-api-client";export{n as AlertsApiClient};const r=e=>new Promise(((t,n)=>{let r=!1;document.addEventListener("applicationBuilderDependencies",(e=>{var o;e.preventDefault();const s=e,i=null===(o=null==s?void 0:s.detail)||void 0===o?void 0:o.dependencies;i?(r=!0,t(i)):n(new Error("Devo dependencies not found"))})),document.dispatchEvent(new CustomEvent("getVappDeps")),window.setTimeout((()=>{r||n(new Error("Initialization timeout"))}),e)})),o=e=>{const t=n=>{n.preventDefault(),e(),document.removeEventListener("beforeChangeContainer",t)};document.addEventListener("beforeChangeContainer",t)},s=(e,t)=>(e+=` pragma comment.application: "${t.application}"`,e+=` pragma comment.component: "${t.component}"`),i={processQuery:(e,t)=>{const n=i.processQueryDates(e.queryString,e.dates);return{queryString:s(e.queryString,t),dates:n}},processQueryDates:(e,t)=>{let n=t;return e.startsWith("from my.lookuplist.")&&(n=i.getDateForLookupTable()),n},getDateForLookupTable:()=>{const e=new Date,t=new Date(e);t.setDate(e.getDate()-1);return{from:t.setHours(0,0,0,0)-60*t.getTimezoneOffset()*1e3,to:e.setHours(0,0,0,0)-60*e.getTimezoneOffset()*1e3}}};class a{constructor(e,t){if(this._userInfo=e,this._appInfo=t,!t||!t.application||!t.component)throw Error("Need to pass AppInfo to get a query client")}runQuery(e){return new Promise(((t,n)=>{const r=this.getBrowserSDKClient();let o;const s=[],a={fields:{}},c={data:s,metadata:a},p=i.processQuery(e,this._appInfo);r.streamFetch({query:p.queryString,dateFrom:p.dates.from,dateTo:p.dates.to},{data:e=>{this.processEventData(e,o,(e=>{s.push(e)}))},meta:e=>{o=e,o.forEach(((e,t)=>{a.fields[e.name]={index:t,type:e.type}}))},error:e=>{n(e)},done:()=>{t(c)}})}))}runStreamQuery(e,t,n,r,o){const s=this.getBrowserSDKClient();let i;const a=e.dates.from?e.dates.from:Date.now(),c=e.dates.to?e.dates.to:-1,p=s.streamFetch({query:e.queryString,dateFrom:a,dateTo:c},{data:e=>{this.processEventData(e,i,t)},meta:e=>{i=e},progress:e=>{n(e)},error:e=>{r(e)},done:()=>{o()}});return()=>{p&&p.abort()}}getBrowserSDKClient(){const t=this._userInfo.credentials;let n="";return t.standAloneToken&&(n=`Bearer ${t.standAloneToken}`),e({url:t.serrea,apiKey:t.apiKey,apiSecret:t.apiSecret,token:n})}processEventData(e,t,n){e.forEach((e=>{const r={};t&&t.forEach(((t,n)=>{const o=t.name;r[o]=e[n]})),n(r)}))}}class c{constructor(e){this._token=e}getAuthorization(){return this._token}}class p{constructor(e,t){if(this._config=e,this._webPreferences=t,!e||!e.appId)throw Error("PreferencesClient requires a config object with appId");if("number"!=typeof e.appId)throw Error("PreferencesClient config.appId should be a number")}isAllowedDomain(){return this._webPreferences.isAllowedDomain()}isAllowedMultitenant(){return this._webPreferences.isAllowedMultitenant()}getAppPreferences(e){return this._webPreferences.getAppPreferences(this._config.appId,e)}setAppPreferences(e,t){return this._webPreferences.setAppPreferences(this._config.appId,e,t)}}class u extends class{async getQueryClient(e){const t=await this.getUserInfo();return new a(t,e)}async getAlertsClient(){const e=await this.getUserInfo(),n=e.credentials.standAloneToken,r=new c(n),o=e.credentials.alertsURI;return new t(r,o)}async getPreferencesClient(e){const t=await this.getRuntimeDependencies();return new p(e,t.AppPreferences)}}{constructor(e){super(),this._config=e,this._unmountCallback=null==e?void 0:e.onAppUnmount,o((()=>this.onAppUnmount()))}async getUserInfo(){return(await this.getRuntimeDependencies()).userInfo}isPolicyActionAllowed(e,t){return lt.user.isAllowed(e,t)}async goToQuery(e){(await this.getRuntimeDependencies()).goToQuery(e.queryString,e.dates)}async createNotiPop(e){const t=await this.getRuntimeDependencies();t.NotiPop&&new t.NotiPop(e)}setAppUnmountCallback(e){this._unmountCallback=e}async getRuntimeDependencies(){var e,t,n;let o;if(null===(e=this._config)||void 0===e?void 0:e.standaloneDependencies)o=this._config.standaloneDependencies;else{const e=null!==(n=null===(t=this._config)||void 0===t?void 0:t.timeout)&&void 0!==n?n:5e3;o=await r(e)}return o}onAppUnmount(){this._unmountCallback&&this._unmountCallback()}}class l{static init(e){const t=new u(e);return this._instance=t,this._instance}static getInstance(){if(!this._instance)throw new Error("DevoAppProvider is not initialized");return this._instance}}l._instance=void 0;export{l as DevoAppProvider};
//# sourceMappingURL=index.esm.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@devoinc/browser-sdk"),t=require("@devoinc/alerts-api-client");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(t);const s=e=>new Promise(((t,n)=>{let r=!1;document.addEventListener("applicationBuilderDependencies",(e=>{var s;e.preventDefault();const o=e,i=null===(s=null==o?void 0:o.detail)||void 0===s?void 0:s.dependencies;i?(r=!0,t(i)):n(new Error("Devo dependencies not found"))})),document.dispatchEvent(new CustomEvent("getVappDeps")),window.setTimeout((()=>{r||n(new Error("Initialization timeout"))}),e)})),o=e=>{const t=n=>{n.preventDefault(),e(),document.removeEventListener("beforeChangeContainer",t)};document.addEventListener("beforeChangeContainer",t)},i=(e,t)=>(e+=` pragma comment.application: "${t.application}"`,e+=` pragma comment.component: "${t.component}"`),a={processQuery:(e,t)=>{const n=a.processQueryDates(e.queryString,e.dates);return{queryString:i(e.queryString,t),dates:n}},processQueryDates:(e,t)=>{let n=t;return e.startsWith("from my.lookuplist.")&&(n=a.getDateForLookupTable()),n},getDateForLookupTable:()=>{const e=new Date,t=new Date(e);t.setDate(e.getDate()-1);return{from:t.setHours(0,0,0,0)-60*t.getTimezoneOffset()*1e3,to:e.setHours(0,0,0,0)-60*e.getTimezoneOffset()*1e3}}};class c{constructor(e,t){if(this._userInfo=e,this._appInfo=t,!t||!t.application||!t.component)throw Error("Need to pass AppInfo to get a query client")}runQuery(e){return new Promise(((t,n)=>{const r=this.getBrowserSDKClient();let s;const o=[],i={fields:{}},c={data:o,metadata:i},u=a.processQuery(e,this._appInfo);r.streamFetch({query:u.queryString,dateFrom:u.dates.from,dateTo:u.dates.to},{data:e=>{this.processEventData(e,s,(e=>{o.push(e)}))},meta:e=>{s=e,s.forEach(((e,t)=>{i.fields[e.name]={index:t,type:e.type}}))},error:e=>{n(e)},done:()=>{t(c)}})}))}runStreamQuery(e,t,n,r,s){const o=this.getBrowserSDKClient();let i;const a=e.dates.from?e.dates.from:Date.now(),c=e.dates.to?e.dates.to:-1,u=o.streamFetch({query:e.queryString,dateFrom:a,dateTo:c},{data:e=>{this.processEventData(e,i,t)},meta:e=>{i=e},progress:e=>{n(e)},error:e=>{r(e)},done:()=>{s()}});return()=>{u&&u.abort()}}getBrowserSDKClient(){const t=this._userInfo.credentials;let n="";return t.standAloneToken&&(n=`Bearer ${t.standAloneToken}`),e.client({url:t.serrea,apiKey:t.apiKey,apiSecret:t.apiSecret,token:n})}processEventData(e,t,n){e.forEach((e=>{const r={};t&&t.forEach(((t,n)=>{const s=t.name;r[s]=e[n]})),n(r)}))}}class u{constructor(e){this._token=e}getAuthorization(){return this._token}}class p{constructor(e,t){if(this._config=e,this._webPreferences=t,!e||!e.appId)throw Error("PreferencesClient requires a config object with appId");if("number"!=typeof e.appId)throw Error("PreferencesClient config.appId should be a number")}isAllowedDomain(){return this._webPreferences.isAllowedDomain()}isAllowedMultitenant(){return this._webPreferences.isAllowedMultitenant()}getAppPreferences(e){return this._webPreferences.getAppPreferences(this._config.appId,e)}setAppPreferences(e,t){return this._webPreferences.setAppPreferences(this._config.appId,e,t)}}class l extends class{async getQueryClient(e){const t=await this.getUserInfo();return new c(t,e)}async getAlertsClient(){const e=await this.getUserInfo(),n=e.credentials.standAloneToken,r=new u(n),s=e.credentials.alertsURI;return new t.Client(r,s)}async getPreferencesClient(e){const t=await this.getRuntimeDependencies();return new p(e,t.AppPreferences)}}{constructor(e){super(),this._config=e,this._unmountCallback=null==e?void 0:e.onAppUnmount,o((()=>this.onAppUnmount()))}async getUserInfo(){return(await this.getRuntimeDependencies()).userInfo}async goToQuery(e){(await this.getRuntimeDependencies()).goToQuery(e.queryString,e.dates)}async createNotiPop(e){const t=await this.getRuntimeDependencies();t.NotiPop&&new t.NotiPop(e)}setAppUnmountCallback(e){this._unmountCallback=e}async getRuntimeDependencies(){var e,t,n;let r;if(null===(e=this._config)||void 0===e?void 0:e.standaloneDependencies)r=this._config.standaloneDependencies;else{const e=null!==(n=null===(t=this._config)||void 0===t?void 0:t.timeout)&&void 0!==n?n:5e3;r=await s(e)}return r}onAppUnmount(){this._unmountCallback&&this._unmountCallback()}}class d{static init(e){const t=new l(e);return this._instance=t,this._instance}static getInstance(){if(!this._instance)throw new Error("DevoAppProvider is not initialized");return this._instance}}d._instance=void 0,exports.AlertsApiClient=r,exports.DevoAppProvider=d;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@devoinc/browser-sdk"),t=require("@devoinc/alerts-api-client");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(t);const o=e=>new Promise(((t,n)=>{let r=!1;document.addEventListener("applicationBuilderDependencies",(e=>{var o;e.preventDefault();const s=e,i=null===(o=null==s?void 0:s.detail)||void 0===o?void 0:o.dependencies;i?(r=!0,t(i)):n(new Error("Devo dependencies not found"))})),document.dispatchEvent(new CustomEvent("getVappDeps")),window.setTimeout((()=>{r||n(new Error("Initialization timeout"))}),e)})),s=e=>{const t=n=>{n.preventDefault(),e(),document.removeEventListener("beforeChangeContainer",t)};document.addEventListener("beforeChangeContainer",t)},i=(e,t)=>(e+=` pragma comment.application: "${t.application}"`,e+=` pragma comment.component: "${t.component}"`),a={processQuery:(e,t)=>{const n=a.processQueryDates(e.queryString,e.dates);return{queryString:i(e.queryString,t),dates:n}},processQueryDates:(e,t)=>{let n=t;return e.startsWith("from my.lookuplist.")&&(n=a.getDateForLookupTable()),n},getDateForLookupTable:()=>{const e=new Date,t=new Date(e);t.setDate(e.getDate()-1);return{from:t.setHours(0,0,0,0)-60*t.getTimezoneOffset()*1e3,to:e.setHours(0,0,0,0)-60*e.getTimezoneOffset()*1e3}}};class c{constructor(e,t){if(this._userInfo=e,this._appInfo=t,!t||!t.application||!t.component)throw Error("Need to pass AppInfo to get a query client")}runQuery(e){return new Promise(((t,n)=>{const r=this.getBrowserSDKClient();let o;const s=[],i={fields:{}},c={data:s,metadata:i},u=a.processQuery(e,this._appInfo);r.streamFetch({query:u.queryString,dateFrom:u.dates.from,dateTo:u.dates.to},{data:e=>{this.processEventData(e,o,(e=>{s.push(e)}))},meta:e=>{o=e,o.forEach(((e,t)=>{i.fields[e.name]={index:t,type:e.type}}))},error:e=>{n(e)},done:()=>{t(c)}})}))}runStreamQuery(e,t,n,r,o){const s=this.getBrowserSDKClient();let i;const a=e.dates.from?e.dates.from:Date.now(),c=e.dates.to?e.dates.to:-1,u=s.streamFetch({query:e.queryString,dateFrom:a,dateTo:c},{data:e=>{this.processEventData(e,i,t)},meta:e=>{i=e},progress:e=>{n(e)},error:e=>{r(e)},done:()=>{o()}});return()=>{u&&u.abort()}}getBrowserSDKClient(){const t=this._userInfo.credentials;let n="";return t.standAloneToken&&(n=`Bearer ${t.standAloneToken}`),e.client({url:t.serrea,apiKey:t.apiKey,apiSecret:t.apiSecret,token:n})}processEventData(e,t,n){e.forEach((e=>{const r={};t&&t.forEach(((t,n)=>{const o=t.name;r[o]=e[n]})),n(r)}))}}class u{constructor(e){this._token=e}getAuthorization(){return this._token}}class l{constructor(e,t){if(this._config=e,this._webPreferences=t,!e||!e.appId)throw Error("PreferencesClient requires a config object with appId");if("number"!=typeof e.appId)throw Error("PreferencesClient config.appId should be a number")}isAllowedDomain(){return this._webPreferences.isAllowedDomain()}isAllowedMultitenant(){return this._webPreferences.isAllowedMultitenant()}getAppPreferences(e){return this._webPreferences.getAppPreferences(this._config.appId,e)}setAppPreferences(e,t){return this._webPreferences.setAppPreferences(this._config.appId,e,t)}}class p extends class{async getQueryClient(e){const t=await this.getUserInfo();return new c(t,e)}async getAlertsClient(){const e=await this.getUserInfo(),n=e.credentials.standAloneToken,r=new u(n),o=e.credentials.alertsURI;return new t.Client(r,o)}async getPreferencesClient(e){const t=await this.getRuntimeDependencies();return new l(e,t.AppPreferences)}}{constructor(e){super(),this._config=e,this._unmountCallback=null==e?void 0:e.onAppUnmount,s((()=>this.onAppUnmount()))}async getUserInfo(){return(await this.getRuntimeDependencies()).userInfo}isPolicyActionAllowed(e,t){return lt.user.isAllowed(e,t)}async goToQuery(e){(await this.getRuntimeDependencies()).goToQuery(e.queryString,e.dates)}async createNotiPop(e){const t=await this.getRuntimeDependencies();t.NotiPop&&new t.NotiPop(e)}setAppUnmountCallback(e){this._unmountCallback=e}async getRuntimeDependencies(){var e,t,n;let r;if(null===(e=this._config)||void 0===e?void 0:e.standaloneDependencies)r=this._config.standaloneDependencies;else{const e=null!==(n=null===(t=this._config)||void 0===t?void 0:t.timeout)&&void 0!==n?n:5e3;r=await o(e)}return r}onAppUnmount(){this._unmountCallback&&this._unmountCallback()}}class d{static init(e){const t=new p(e);return this._instance=t,this._instance}static getInstance(){if(!this._instance)throw new Error("DevoAppProvider is not initialized");return this._instance}}d._instance=void 0,exports.AlertsApiClient=r,exports.DevoAppProvider=d;
//# sourceMappingURL=index.js.map
{
"name": "@devoinc/app-developer-kit",
"version": "2.1.1",
"version": "2.1.2",
"description": "Devo Web Browser Applications Development Kit",

@@ -5,0 +5,0 @@ "main": "index.js",

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