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

workspace-integrations

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workspace-integrations - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

lib/cli.d.ts

1

lib/http.d.ts

@@ -27,2 +27,3 @@ /**

fullUrl(partialUrl: string): string;
ping(appUrl: string): Promise<any>;
static createAccessToken(oauth: OAuthDetails): Promise<any>;

@@ -29,0 +30,0 @@ static initIntegration: (data: DataObject) => Promise<any>;

@@ -131,2 +131,5 @@ "use strict";

}
ping(appUrl) {
return get(this.accessToken, appUrl);
}
static createAccessToken(oauth) {

@@ -133,0 +136,0 @@ const { clientId, clientSecret, oauthUrl, refreshToken } = oauth;

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

import { Integration, ErrorHandler, Devices, IntegrationConfig, DataObject, Workspaces, AppInfo } from './types';
import { Integration, ActionHandler, ErrorHandler, Devices, IntegrationConfig, DataObject, Workspaces, AppInfo } from './types';
import XapiImpl from './apis/xapi';

@@ -9,11 +9,17 @@ import { OAuthDetails } from './http';

xapi: XapiImpl;
private actionHandler;
private errorHandler;
private appInfo;
private oauth;
private appUrl;
constructor(appInfo: AppInfo, accessToken: string, activationCode: DataObject, oauth: OAuthDetails);
onError(handler: ErrorHandler): void;
onAction(handler: ActionHandler): void;
getAppInfo(): AppInfo;
webexApi(partialUrl: string, method?: string, body?: any, contentType?: string): Promise<any>;
ping(): Promise<any>;
decodeJwt(jwt: string): DataObject;
pollData(): Promise<void>;
processNotifications(notifications: DataObject[]): void;
decodeAndNotifyAction(action: DataObject): Promise<void>;
static connect(options: IntegrationConfig): Promise<IntegrationImpl>;

@@ -20,0 +26,0 @@ refreshToken(): Promise<void>;

@@ -9,2 +9,3 @@ "use strict";

const logger_1 = require("./logger");
const jwt_1 = require("./jwt");
function validateConfig(config) {

@@ -27,2 +28,3 @@ if (!config.clientId || !config.clientSecret || !config.activationCode) {

constructor(appInfo, accessToken, activationCode, oauth) {
this.actionHandler = null;
this.errorHandler = null;

@@ -35,2 +37,3 @@ this.appInfo = appInfo;

this.oauth = oauth;
this.appUrl = activationCode.appUrl;
}

@@ -40,2 +43,5 @@ onError(handler) {

}
onAction(handler) {
this.actionHandler = handler;
}
getAppInfo() {

@@ -47,2 +53,8 @@ return this.appInfo;

}
ping() {
return this.http.ping(this.appUrl);
}
decodeJwt(jwt) {
return (0, jwt_1.decodeAndVerify)(jwt);
}
async pollData() {

@@ -70,4 +82,23 @@ var _a;

logger_1.default.verbose(`Got ${notifications.length} notifications`);
notifications.forEach((not) => this.xapi.processNotification(not));
notifications.forEach((n) => {
if (n.type === 'action') {
this.decodeAndNotifyAction(n);
}
else {
this.xapi.processNotification(n);
}
});
}
async decodeAndNotifyAction(action) {
if (!this.actionHandler)
return;
const { jwt } = action;
const res = await (0, jwt_1.decodeAndVerify)(jwt);
if (res) {
this.actionHandler(res);
}
else {
logger_1.default.error('Not able to verify action message!');
}
}
static async connect(options) {

@@ -86,3 +117,3 @@ validateConfig(options);

});
logger_1.default.info('Successfully initated integration');
logger_1.default.info('Successfully initiated integration');
const { access_token, expires_in } = tokenData;

@@ -89,0 +120,0 @@ const oauth = { clientId, clientSecret, oauthUrl, refreshToken };

@@ -205,2 +205,13 @@ /**

/**
* Checks the state of the integration. Checks that it's able to talk to Webex,
* implying that the access token is valid etc.
* @returns Promise containing the http response from Webex
*/
ping(): Promise<any>;
/**
* Sets an action handler, so you are notified when there are important
* action notifications such as if the integration manifest was updated.
*/
onAction(handler: ActionHandler): any;
/**
* Takes a list of events from Webex and checks if you have event listeners registered that

@@ -214,2 +225,9 @@ * match the incoming notification, and if so deliver it.

webexApi(partialUrl: string, method?: string, body?: any, contentType?: string): Promise<any>;
/**
* Helper function for decoding a JSON Web Token.
* Throws error if not valid.
*
* @param jwt B64-encoded JWT string, as received from Webex
*/
decodeJwt(jwt: string): DataObject;
devices: Devices;

@@ -303,2 +321,3 @@ workspaces: Workspaces;

export type ErrorHandler = (error: string) => any;
export type ActionHandler = (action: DataObject) => any;
/**

@@ -305,0 +324,0 @@ * Info about your integration. Contains much of the information provided by the manifest.

4

package.json
{
"name": "workspace-integrations",
"version": "0.6.1",
"version": "0.6.2",
"description": "Webex Workspace Integrations NodeJS SDK",

@@ -23,3 +23,3 @@ "author": "Tore Bjolseth <Cisco>",

"bin": {
"jwt-decode": "./src/cli.js"
"jwt-decode": "./lib/cli.js"
},

@@ -26,0 +26,0 @@ "files": [

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