@recordreplay/recordings-cli
Advanced tools
Comparing version 0.10.3 to 0.10.4-beta.1
{ | ||
"name": "@recordreplay/recordings-cli", | ||
"version": "0.10.3", | ||
"version": "0.10.4-beta.1", | ||
"description": "CLI tool for uploading and managing recordings", | ||
@@ -24,4 +24,5 @@ "bin": { | ||
"commander": "^7.2.0", | ||
"https-proxy-agent": "^5.0.0", | ||
"ws": "^7.5.0" | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
const HttpsProxyAgent = require("https-proxy-agent"); | ||
const WebSocket = require("ws"); | ||
@@ -7,4 +8,8 @@ const { defer } = require("./utils"); | ||
class ProtocolClient { | ||
constructor(address, callbacks) { | ||
this.socket = new WebSocket(address); | ||
constructor(address, callbacks, opts = {}) { | ||
const agent = opts.proxy ? new HttpsProxyAgent(new URL(opts.proxy)) : undefined; | ||
this.socket = new WebSocket(address, { | ||
agent | ||
}); | ||
this.callbacks = callbacks; | ||
@@ -11,0 +16,0 @@ |
@@ -9,2 +9,3 @@ export interface BaseOptions { | ||
server?: string; | ||
proxy?: string; | ||
} | ||
@@ -11,0 +12,0 @@ |
@@ -252,5 +252,5 @@ const fs = require("fs"); | ||
async function doUploadCrash(dir, server, recording, verbose, apiKey) { | ||
async function doUploadCrash(dir, server, recording, verbose, apiKey, proxy) { | ||
maybeLog(verbose, `Starting crash data upload for ${recording.id}...`); | ||
if (!(await initConnection(server, apiKey, verbose))) { | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
maybeLog(verbose, `Crash data upload failed: can't connect to server ${server}`); | ||
@@ -267,3 +267,3 @@ return null; | ||
async function doUploadRecording(dir, server, recording, verbose, apiKey) { | ||
async function doUploadRecording(dir, server, recording, verbose, apiKey, proxy) { | ||
maybeLog(verbose, `Starting upload for ${recording.id}...`); | ||
@@ -280,3 +280,3 @@ if (recording.status == "uploaded" && recording.recordingId) { | ||
if (recording.status == "crashed") { | ||
await doUploadCrash(dir, server, recording, verbose, apiKey); | ||
await doUploadCrash(dir, server, recording, verbose, apiKey, proxy); | ||
maybeLog(verbose, `Upload failed: crashed while recording`); | ||
@@ -292,3 +292,3 @@ return null; | ||
} | ||
if (!(await initConnection(server, apiKey, verbose))) { | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
maybeLog(verbose, `Upload failed: can't connect to server ${server}`); | ||
@@ -324,3 +324,3 @@ return null; | ||
} | ||
return doUploadRecording(dir, server, recording, opts.verbose, opts.apiKey); | ||
return doUploadRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.proxy); | ||
} | ||
@@ -330,7 +330,7 @@ | ||
const server = getServer(opts); | ||
const { apiKey, verbose } = opts; | ||
const { apiKey, verbose, proxy } = opts; | ||
maybeLog(verbose, `Processing recording ${recordingId}...`); | ||
if (!(await initConnection(server, apiKey, verbose))) { | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
maybeLog(verbose, `Processing failed: can't connect to server ${server}`); | ||
@@ -376,3 +376,4 @@ return false; | ||
opts.verbose, | ||
opts.apiKey | ||
opts.apiKey, | ||
opts.proxy | ||
)) | ||
@@ -402,3 +403,3 @@ ) { | ||
async function doViewRecording(dir, server, recording, verbose, apiKey) { | ||
async function doViewRecording(dir, server, recording, verbose, apiKey, proxy) { | ||
let recordingId; | ||
@@ -414,3 +415,4 @@ if (recording.status == "uploaded") { | ||
verbose, | ||
apiKey | ||
apiKey, | ||
proxy | ||
); | ||
@@ -438,3 +440,3 @@ if (!recordingId) { | ||
} | ||
return doViewRecording(dir, server, recording, opts.verbose, opts.apiKey); | ||
return doViewRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.proxy); | ||
} | ||
@@ -455,3 +457,4 @@ | ||
opts.verbose, | ||
opts.apiKey | ||
opts.apiKey, | ||
opts.proxy | ||
); | ||
@@ -458,0 +461,0 @@ } |
@@ -6,3 +6,3 @@ const ProtocolClient = require("./client"); | ||
async function initConnection(server, accessToken, verbose) { | ||
async function initConnection(server, accessToken, verbose, proxy) { | ||
if (!gClient) { | ||
@@ -27,2 +27,4 @@ const { promise, resolve } = defer(); | ||
}, | ||
}, { | ||
proxy | ||
}); | ||
@@ -29,0 +31,0 @@ return promise; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40636
1099
3
4
+ Addedhttps-proxy-agent@^5.0.0
+ Addedagent-base@6.0.2(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedms@2.1.3(transitive)