@recordreplay/recordings-cli
Advanced tools
Comparing version 0.10.4-beta.1 to 0.10.4-beta.2
{ | ||
"name": "@recordreplay/recordings-cli", | ||
"version": "0.10.4-beta.1", | ||
"version": "0.10.4-beta.2", | ||
"description": "CLI tool for uploading and managing recordings", | ||
@@ -24,5 +24,4 @@ "bin": { | ||
"commander": "^7.2.0", | ||
"https-proxy-agent": "^5.0.0", | ||
"ws": "^7.5.0" | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
const HttpsProxyAgent = require("https-proxy-agent"); | ||
const WebSocket = require("ws"); | ||
@@ -9,6 +8,4 @@ const { defer } = require("./utils"); | ||
constructor(address, callbacks, opts = {}) { | ||
const agent = opts.proxy ? new HttpsProxyAgent(new URL(opts.proxy)) : undefined; | ||
this.socket = new WebSocket(address, { | ||
agent | ||
agent: opts.agent, | ||
}); | ||
@@ -50,3 +47,9 @@ this.callbacks = callbacks; | ||
this.socket.send( | ||
JSON.stringify({ id, method, params, binary: data ? true : undefined, sessionId }) | ||
JSON.stringify({ | ||
id, | ||
method, | ||
params, | ||
binary: data ? true : undefined, | ||
sessionId, | ||
}) | ||
); | ||
@@ -53,0 +56,0 @@ if (data) { |
@@ -0,1 +1,3 @@ | ||
import type { Agent } from "http"; | ||
export interface BaseOptions { | ||
@@ -9,3 +11,3 @@ directory?: string; | ||
server?: string; | ||
proxy?: string; | ||
agent?: Agent; | ||
} | ||
@@ -22,7 +24,7 @@ | ||
recordingId?: string; | ||
} | ||
}; | ||
/** | ||
* Lists all locally-stored recordings | ||
* | ||
* | ||
* @param opts BaseOptions | ||
@@ -34,3 +36,3 @@ */ | ||
* Uploads the recording. | ||
* | ||
* | ||
* Returns the recording ID if successful. | ||
@@ -42,3 +44,6 @@ * | ||
*/ | ||
export function uploadRecording(recordingId: number, opts?: ConnectOptions): Promise<string | null>; | ||
export function uploadRecording( | ||
recordingId: number, | ||
opts?: ConnectOptions | ||
): Promise<string | null>; | ||
@@ -55,7 +60,10 @@ /** | ||
*/ | ||
export function processRecording(recordingId: number, opts?: ConnectOptions): Promise<string | null>; | ||
export function processRecording( | ||
recordingId: number, | ||
opts?: ConnectOptions | ||
): Promise<string | null>; | ||
/** | ||
* Uploads all pending recordings. | ||
* | ||
* | ||
* Returns `true` if all were uploaded successfully | ||
@@ -77,3 +85,6 @@ * | ||
*/ | ||
export function viewRecording(recordingId: number, opts?: ConnectOptions): Promise<boolean>; | ||
export function viewRecording( | ||
recordingId: number, | ||
opts?: ConnectOptions | ||
): Promise<boolean>; | ||
@@ -100,3 +111,6 @@ /** | ||
*/ | ||
export function removeRecording(recordingId: number, opts?: BaseOptions): boolean; | ||
export function removeRecording( | ||
recordingId: number, | ||
opts?: BaseOptions | ||
): boolean; | ||
@@ -103,0 +117,0 @@ /** |
@@ -194,5 +194,7 @@ const fs = require("fs"); | ||
// except to mark crashes as uploaded. | ||
if (recording.status == "unusable" || | ||
recording.status == "crashUploaded" || | ||
(recording.status == "crashed" && status != "crashUploaded")) { | ||
if ( | ||
recording.status == "unusable" || | ||
recording.status == "crashUploaded" || | ||
(recording.status == "crashed" && status != "crashUploaded") | ||
) { | ||
return; | ||
@@ -253,11 +255,16 @@ } | ||
async function doUploadCrash(dir, server, recording, verbose, apiKey, proxy) { | ||
async function doUploadCrash(dir, server, recording, verbose, apiKey, agent) { | ||
maybeLog(verbose, `Starting crash data upload for ${recording.id}...`); | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
maybeLog(verbose, `Crash data upload failed: can't connect to server ${server}`); | ||
if (!(await initConnection(server, apiKey, verbose, agent))) { | ||
maybeLog( | ||
verbose, | ||
`Crash data upload failed: can't connect to server ${server}` | ||
); | ||
return null; | ||
} | ||
await Promise.all((recording.crashData || []).map(async data => { | ||
await connectionReportCrash(data); | ||
})); | ||
await Promise.all( | ||
(recording.crashData || []).map(async (data) => { | ||
await connectionReportCrash(data); | ||
}) | ||
); | ||
addRecordingEvent(dir, "crashUploaded", recording.id, { server }); | ||
@@ -268,3 +275,10 @@ maybeLog(verbose, `Crash data upload finished.`); | ||
async function doUploadRecording(dir, server, recording, verbose, apiKey, proxy) { | ||
async function doUploadRecording( | ||
dir, | ||
server, | ||
recording, | ||
verbose, | ||
apiKey, | ||
agent | ||
) { | ||
maybeLog(verbose, `Starting upload for ${recording.id}...`); | ||
@@ -281,3 +295,3 @@ if (recording.status == "uploaded" && recording.recordingId) { | ||
if (recording.status == "crashed") { | ||
await doUploadCrash(dir, server, recording, verbose, apiKey, proxy); | ||
await doUploadCrash(dir, server, recording, verbose, apiKey, agent); | ||
maybeLog(verbose, `Upload failed: crashed while recording`); | ||
@@ -293,3 +307,3 @@ return null; | ||
} | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
if (!(await initConnection(server, apiKey, verbose, agent))) { | ||
maybeLog(verbose, `Upload failed: can't connect to server ${server}`); | ||
@@ -325,3 +339,10 @@ return null; | ||
} | ||
return doUploadRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.proxy); | ||
return doUploadRecording( | ||
dir, | ||
server, | ||
recording, | ||
opts.verbose, | ||
opts.apiKey, | ||
opts.agent | ||
); | ||
} | ||
@@ -331,7 +352,7 @@ | ||
const server = getServer(opts); | ||
const { apiKey, verbose, proxy } = opts; | ||
const { apiKey, verbose, agent } = opts; | ||
maybeLog(verbose, `Processing recording ${recordingId}...`); | ||
if (!(await initConnection(server, apiKey, verbose, proxy))) { | ||
if (!(await initConnection(server, apiKey, verbose, agent))) { | ||
maybeLog(verbose, `Processing failed: can't connect to server ${server}`); | ||
@@ -378,3 +399,3 @@ return false; | ||
opts.apiKey, | ||
opts.proxy | ||
opts.agent | ||
)) | ||
@@ -404,3 +425,3 @@ ) { | ||
async function doViewRecording(dir, server, recording, verbose, apiKey, proxy) { | ||
async function doViewRecording(dir, server, recording, verbose, apiKey, agent) { | ||
let recordingId; | ||
@@ -417,3 +438,3 @@ if (recording.status == "uploaded") { | ||
apiKey, | ||
proxy | ||
agent | ||
); | ||
@@ -441,3 +462,10 @@ if (!recordingId) { | ||
} | ||
return doViewRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.proxy); | ||
return doViewRecording( | ||
dir, | ||
server, | ||
recording, | ||
opts.verbose, | ||
opts.apiKey, | ||
opts.agent | ||
); | ||
} | ||
@@ -459,3 +487,3 @@ | ||
opts.apiKey, | ||
opts.proxy | ||
opts.agent | ||
); | ||
@@ -462,0 +490,0 @@ } |
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
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
40684
2
1144
3
- Removedhttps-proxy-agent@^5.0.0
- Removedagent-base@6.0.2(transitive)
- Removeddebug@4.4.0(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedms@2.1.3(transitive)