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

@webex/internal-plugin-llm

Package Overview
Dependencies
Maintainers
7
Versions
622
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webex/internal-plugin-llm - npm Package Compare versions

Comparing version 2.31.1 to 2.31.2

17

dist/llm.js

@@ -85,7 +85,7 @@ "use strict";

/**
* If the LLM plugin has been registered and listening
* @instance
* @type {Boolean}
* @public
*/
* If the LLM plugin has been registered and listening
* @instance
* @type {Boolean}
* @public
*/

@@ -146,3 +146,8 @@ /**

(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "disconnectLLM", function () {
return _this.disconnect();
return _this.disconnect().then(function () {
_this.registered = false;
_this.locusUrl = undefined;
_this.binding = undefined;
_this.webSocketUrl = undefined;
});
});

@@ -149,0 +154,0 @@ _this.registered = false;

{
"name": "@webex/internal-plugin-llm",
"version": "2.31.1",
"version": "2.31.2",
"description": "",

@@ -13,4 +13,4 @@ "license": "MIT",

"dependencies": {
"@webex/internal-plugin-llm": "2.31.1",
"@webex/internal-plugin-mercury": "2.31.1"
"@webex/internal-plugin-llm": "2.31.2",
"@webex/internal-plugin-mercury": "2.31.2"
},

@@ -24,6 +24,6 @@ "browserify": {

"devDependencies": {
"@webex/test-helper-chai": "2.31.1",
"@webex/test-helper-mock-webex": "2.31.1",
"@webex/test-helper-chai": "2.31.2",
"@webex/test-helper-mock-webex": "2.31.2",
"sinon": "^9.2.4"
}
}

@@ -46,16 +46,15 @@ import Mercury from '@webex/internal-plugin-mercury';

/**
* If the LLM plugin has been registered and listening
* @instance
* @type {Boolean}
* @public
*/
private registered:boolean = false;
* If the LLM plugin has been registered and listening
* @instance
* @type {Boolean}
* @public
*/
private registered: boolean = false;
private webSocketUrl: string;
private webSocketUrl?: string;
private binding: string;
private binding?: string;
private locusUrl: string;
private locusUrl?: string;
/**

@@ -70,3 +69,2 @@ * Initializes the LLM Plugin

this.registered = false;

@@ -80,12 +78,15 @@ }

*/
private register = (llmSocketUrl:string):Promise<void> => this.request({
method: 'POST',
url: llmSocketUrl,
}).then((res: { body: { webSocketUrl: string; binding: string; }; }) => {
this.webSocketUrl = res.body.webSocketUrl;
this.binding = res.body.binding;
}).catch((error:any) => {
LoggerProxy.logger.error(`Error connecting to websocket: ${error}`);
throw error;
});
private register = (llmSocketUrl: string): Promise<void> =>
this.request({
method: 'POST',
url: llmSocketUrl,
})
.then((res: {body: {webSocketUrl: string; binding: string}}) => {
this.webSocketUrl = res.body.webSocketUrl;
this.binding = res.body.binding;
})
.catch((error: any) => {
LoggerProxy.logger.error(`Error connecting to websocket: ${error}`);
throw error;
});

@@ -98,9 +99,10 @@ /**

*/
public registerAndConnect = (locusUrl:string, datachannelUrl:string):Promise<void> => this.register(datachannelUrl).then(() => {
if (!locusUrl || !datachannelUrl) return undefined;
this.locusUrl = locusUrl;
this.connect(this.webSocketUrl).then(() => {
this.registered = true;
public registerAndConnect = (locusUrl: string, datachannelUrl: string): Promise<void> =>
this.register(datachannelUrl).then(() => {
if (!locusUrl || !datachannelUrl) return undefined;
this.locusUrl = locusUrl;
this.connect(this.webSocketUrl).then(() => {
this.registered = true;
});
});
});

@@ -111,3 +113,3 @@ /**

*/
public isConnected = ():boolean => this.registered;
public isConnected = (): boolean => this.registered;

@@ -118,3 +120,3 @@ /**

*/
public getBinding = ():string => this.binding;
public getBinding = (): string => this.binding;

@@ -125,3 +127,3 @@ /**

*/
public getLocusUrl = ():string => this.locusUrl;
public getLocusUrl = (): string => this.locusUrl;

@@ -132,4 +134,9 @@ /**

*/
public disconnectLLM = (): Promise<void> => this.disconnect();
public disconnectLLM = (): Promise<void> =>
this.disconnect().then(() => {
this.registered = false;
this.locusUrl = undefined;
this.binding = undefined;
this.webSocketUrl = undefined;
});
}

@@ -5,6 +5,4 @@ import MockWebex from '@webex/test-helper-mock-webex';

import Mercury from '@webex/internal-plugin-mercury';
import LLMService from '@webex/internal-plugin-llm';
describe('plugin-llm', () => {

@@ -32,8 +30,7 @@ const locusUrl = 'locusUrl';

binding: 'binding',
webSocketUrl: 'url'
}
webSocketUrl: 'url',
},
});
});
describe('#registerAndConnect', () => {

@@ -44,4 +41,4 @@ it('registers connection', async () => {

binding: 'binding',
webSocketUrl: 'url'
}
webSocketUrl: 'url',
},
});

@@ -53,8 +50,8 @@ assert.equal(llmService.isConnected(), false);

it('doesn\'t registers connection for invalid input', async () => {
it("doesn't registers connection for invalid input", async () => {
llmService.register = sinon.stub().resolves({
body: {
binding: 'binding',
webSocketUrl: 'url'
}
webSocketUrl: 'url',
},
});

@@ -70,8 +67,10 @@ await llmService.registerAndConnect();

sinon.assert.calledOnceWithExactly(
llmService.request,
sinon.match({
method: 'POST',
url: `${datachannelUrl}`,
})
);
sinon.assert.calledOnceWithExactly(llmService.request, sinon.match({
method: 'POST',
url: `${datachannelUrl}`,
}));
assert.equal(llmService.getBinding(), 'binding');

@@ -86,4 +85,4 @@ });

binding: 'binding',
webSocketUrl: 'url'
}
webSocketUrl: 'url',
},
});

@@ -99,2 +98,5 @@ await llmService.registerAndConnect(locusUrl, datachannelUrl);

sinon.assert.calledOnce(llmService.disconnect);
assert.equal(llmService.isConnected(), false);
assert.equal(llmService.getLocusUrl(), undefined);
assert.equal(llmService.getBinding(), undefined);
});

@@ -101,0 +103,0 @@ });

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