New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

roku-test-automation

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

roku-test-automation - npm Package Compare versions

Comparing version 1.0.22 to 1.0.24

3

dist/OnDeviceComponent.d.ts

@@ -5,8 +5,7 @@ import { RokuDevice } from './RokuDevice';

export declare class OnDeviceComponent {
private static readonly version;
private callbackListenPort?;
private static readonly version;
private device;
private config;
private client;
private socketConnected;
private handshakeComplete;

@@ -13,0 +12,0 @@ private sentRequests;

@@ -39,3 +39,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var net = require("net");
var udp = require("dgram");
var express = require("express");

@@ -46,9 +46,8 @@ var OnDeviceComponentRequest_1 = require("./types/OnDeviceComponentRequest");

function OnDeviceComponent(device, config) {
this.client = new net.Socket();
this.socketConnected = false;
this.client = udp.createSocket('udp4');
this.handshakeComplete = false;
this.sentRequests = {};
this.app = this.setupExpress();
this.device = device;
this.config = config;
this.app = this.setupExpress();
}

@@ -117,15 +116,33 @@ OnDeviceComponent.prototype.getValueAtKeyPath = function (base, keyPath) {

OnDeviceComponent.prototype.sendHandShakeRequest = function () {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.sendRequest({
type: 'handshake',
args: {
version: OnDeviceComponent.version
}
})];
var retryCount, result, e_1;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
retryCount = 5;
_c.label = 1;
case 1:
result = _a.sent();
return [2 /*return*/, result];
if (!(retryCount > 0)) return [3 /*break*/, 6];
_c.label = 2;
case 2:
_c.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.sendRequest({
type: 'handshake',
args: {
version: OnDeviceComponent.version,
logLevel: (_b = (_a = this.config.device.odc) === null || _a === void 0 ? void 0 : _a.logLevel) !== null && _b !== void 0 ? _b : 'info'
}
}, 1000)];
case 3:
result = _c.sent();
return [2 /*return*/, result.body];
case 4:
e_1 = _c.sent();
retryCount--;
if (retryCount)
console.log('Send handshake failed. Retrying');
return [3 /*break*/, 5];
case 5: return [3 /*break*/, 1];
case 6: throw new Error('Handshake failed');
}

@@ -167,3 +184,7 @@ });

this.sentRequests[requestId] = request;
this.client.write(JSON.stringify(formattedRequest));
this.client.send(JSON.stringify(formattedRequest), 9000, this.device.ip, function (err) {
if (err) {
throw err;
}
});
return [4 /*yield*/, utils.promiseTimeout(promise, timeoutMilliseconds)];

@@ -177,43 +198,24 @@ case 2: return [2 /*return*/, _a.sent()];

OnDeviceComponent.prototype.setupConnections = function () {
var _a;
return __awaiter(this, void 0, void 0, function () {
var callbackListenPort;
var _this = this;
return __generator(this, function (_a) {
// If we already have everything we need then don't want to rerun
if (this.socketConnected && this.callbackListenPort)
return [2 /*return*/];
callbackListenPort = this.config.server.callbackListenPort;
this.server = this.app.listen(callbackListenPort, function () {
console.log("Listening for callbacks on " + callbackListenPort);
});
this.callbackListenPort = callbackListenPort;
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.client.connect(9000, _this.device.ip, function () { return __awaiter(_this, void 0, void 0, function () {
var e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.socketConnected = true;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.sendHandShakeRequest()];
case 2:
_a.sent();
this.handshakeComplete = true;
resolve();
return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
this.shutdown();
reject(e_1.message);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
}); });
_this.client.once('error', function (e) {
console.log(e);
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
// If we already have everything we need then don't want to rerun
if (this.server)
return [2 /*return*/];
callbackListenPort = (_a = this.config.server) === null || _a === void 0 ? void 0 : _a.callbackListenPort;
if (!callbackListenPort)
throw new Error('Config did not have a callback listen port');
this.server = this.app.listen(callbackListenPort, function () {
console.log("Listening for callbacks on " + callbackListenPort);
});
})];
this.callbackListenPort = callbackListenPort;
return [4 /*yield*/, this.sendHandShakeRequest()];
case 1:
_b.sent();
this.handshakeComplete = true;
return [2 /*return*/];
}
});

@@ -223,8 +225,5 @@ });

OnDeviceComponent.prototype.shutdown = function () {
var _a;
if (this.socketConnected) {
this.callbackListenPort = undefined;
this.socketConnected = false;
this.client.end();
(_a = this.server) === null || _a === void 0 ? void 0 : _a.close();
if (this.server) {
this.server.close();
this.server = undefined;
}

@@ -231,0 +230,0 @@ };

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

"debugProxy": t.opt("string"),
"odc": t.opt(t.iface([], {
"logLevel": t.opt(t.union(t.lit('off'), t.lit('error'), t.lit('warn'), t.lit('info'), t.lit('debug'), t.lit('verbose'))),
})),
"screenshotFormat": t.opt("ScreenshotFormat"),

@@ -20,0 +23,0 @@ });

@@ -11,2 +11,5 @@ export interface ConfigOptions {

debugProxy?: string;
odc?: {
logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'verbose';
};
screenshotFormat?: ScreenshotFormat;

@@ -13,0 +16,0 @@ }

{
"name": "roku-test-automation",
"version": "1.0.22",
"version": "1.0.24",
"description": "Helps with automating functional tests",

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

@@ -6,2 +6,5 @@ {

"debugProxy": "",
"odc": {
"logLevel": "info"
},
"screenshotFormat": "jpg"

@@ -8,0 +11,0 @@ },

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