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

@replayio/replay

Package Overview
Dependencies
Maintainers
8
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@replayio/replay - npm Package Compare versions

Comparing version 0.20.1 to 0.21.0

src/debug.d.ts

4

package.json
{
"name": "@replayio/replay",
"version": "0.20.1",
"version": "0.21.0",
"description": "CLI tool for uploading and managing recordings",

@@ -45,3 +45,3 @@ "bin": {

},
"gitHead": "a20894aa31f2bdb6c4658c7264c6b848b26b5ee5",
"gitHead": "1f238538500444cf35816e3b586f16e7e2e822d1",
"devDependencies": {

@@ -48,0 +48,0 @@ "@types/debug": "^4.1.7",

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

const crypto_1 = require("crypto");
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const promises_1 = require("fs/promises");

@@ -49,4 +49,3 @@ const path_1 = __importDefault(require("path"));

catch (err) {
debug("Failed to decode token: %s", maskToken(token));
debug(err);
debug("Failed to decode token: %s %e", maskToken(token), err);
return null;

@@ -53,0 +52,0 @@ }

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -22,9 +45,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const sourcemap_upload_1 = require("@replayio/sourcemap-upload");
const commander_1 = require("commander");
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importStar(require("./debug"));
const formatRecordings_1 = require("./cli/formatRecordings");

@@ -149,2 +169,3 @@ const main_1 = require("./main");

console.error("Failed to list all recordings");
(0, debug_1.printLogPath)();
debug("removeRecording error %o", e);

@@ -159,2 +180,5 @@ process.exit(opts.warn ? 0 : 1);

const recordingId = yield (0, main_1.uploadRecording)(id, Object.assign(Object.assign({}, opts), { verbose: true }));
if (!recordingId) {
(0, debug_1.printLogPath)();
}
process.exit(recordingId || opts.warn ? 0 : 1);

@@ -164,2 +188,3 @@ }

console.error("Failed to upload recording");
(0, debug_1.printLogPath)();
debug("uploadRecording error %o", e);

@@ -181,2 +206,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to launch browser");
(0, debug_1.printLogPath)();
debug("launchBrowser error %o", e);

@@ -198,2 +224,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to launch browser");
(0, debug_1.printLogPath)();
debug("launchBrowser error %o", e);

@@ -209,2 +236,5 @@ process.exit(opts.warn ? 0 : 1);

const recordingId = yield (0, main_1.processRecording)(id, Object.assign(Object.assign({}, opts), { verbose: true }));
if (!recordingId) {
(0, debug_1.printLogPath)();
}
process.exit(recordingId || opts.warn ? 0 : 1);

@@ -214,2 +244,3 @@ }

console.error("Failed to process recording");
(0, debug_1.printLogPath)();
debug("processRecording error %o", e);

@@ -229,2 +260,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to upload all recordings");
(0, debug_1.printLogPath)();
debug("uploadAllRecordings error %o", e);

@@ -244,2 +276,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to view recording");
(0, debug_1.printLogPath)();
debug("viewRecording error %o", e);

@@ -255,2 +288,5 @@ process.exit(opts.warn ? 0 : 1);

const viewed = yield (0, main_1.viewLatestRecording)(Object.assign(Object.assign({}, opts), { verbose: true }));
if (!viewed) {
(0, debug_1.printLogPath)();
}
process.exit(viewed || opts.warn ? 0 : 1);

@@ -260,2 +296,3 @@ }

console.error("Failed to view recording");
(0, debug_1.printLogPath)();
debug("viewLatestRecording error %o", e);

@@ -274,2 +311,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to remove recording");
(0, debug_1.printLogPath)();
debug("removeRecording error %o", e);

@@ -287,2 +325,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to remove all recordings");
(0, debug_1.printLogPath)();
debug("removeAllRecordings error %o", e);

@@ -301,2 +340,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to updated browsers");
(0, debug_1.printLogPath)();
debug("updateBrowser error %o", e);

@@ -342,2 +382,3 @@ process.exit(opts.warn ? 0 : 1);

yield (0, main_1.updateMetadata)(Object.assign(Object.assign({}, opts), { verbose: true }));
(0, debug_1.printLogPath)();
process.exit(0);

@@ -360,2 +401,3 @@ }

console.error("Failed to login");
(0, debug_1.printLogPath)();
debug("maybeAuthenticateUser error %o", e);

@@ -384,2 +426,3 @@ process.exit(opts.warn ? 0 : 1);

console.error("Failed to get version information");
(0, debug_1.printLogPath)();
debug("commandVersion error %o", e);

@@ -386,0 +429,0 @@ process.exit(opts.warn ? 0 : 1);

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

Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const ws_1 = __importDefault(require("ws"));

@@ -18,0 +18,0 @@ const utils_1 = require("./utils");

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

exports.query = void 0;
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const node_fetch_1 = __importDefault(require("node-fetch"));

@@ -19,0 +19,0 @@ const debug = (0, debug_1.default)("replay:cli:graphql");

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

const child_process_1 = require("child_process");
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const fs_1 = __importDefault(require("fs"));

@@ -21,0 +21,0 @@ const https_1 = __importDefault(require("https"));

/// <reference types="node" />
import { ensurePuppeteerBrowsersInstalled, ensurePlaywrightBrowsersInstalled, getPlaywrightBrowserPath, getPuppeteerBrowserPath, updateBrowsers } from "./install";
import { BrowserName, ExternalRecordingEntry, FilterOptions, LaunchOptions, ListOptions, MetadataOptions, Options, RecordingEntry, UploadAllOptions } from "./types";
import { BrowserName, ExternalRecordingEntry, FilterOptions, LaunchOptions, ListOptions, MetadataOptions, Options, RecordingEntry, UploadAllOptions, UploadOptions } from "./types";
export type { BrowserName, RecordingEntry } from "./types";

@@ -8,5 +8,5 @@ export declare function updateStatus(recording: RecordingEntry, status: RecordingEntry["status"]): void;

declare function listAllRecordings(opts?: Options & ListOptions): ExternalRecordingEntry[];
declare function uploadRecording(id: string, opts?: Options): Promise<string | null>;
declare function uploadRecording(id: string, opts?: UploadOptions): Promise<string | null>;
declare function processRecording(id: string, opts?: Options): Promise<string | null>;
declare function uploadAllRecordings(opts?: Options & UploadAllOptions): Promise<boolean>;
declare function uploadAllRecordings(opts?: UploadAllOptions): Promise<boolean>;
declare function viewRecording(id: string, opts?: Options): Promise<boolean>;

@@ -13,0 +13,0 @@ declare function viewLatestRecording(opts?: Options): Promise<boolean>;

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

exports.getPuppeteerBrowserPath = exports.getPlaywrightBrowserPath = exports.ensurePuppeteerBrowsersInstalled = exports.ensurePlaywrightBrowsersInstalled = exports.version = exports.launchBrowser = exports.updateMetadata = exports.updateBrowsers = exports.removeAllRecordings = exports.removeRecording = exports.viewLatestRecording = exports.viewRecording = exports.uploadAllRecordings = exports.processRecording = exports.uploadRecording = exports.listAllRecordings = exports.addLocalRecordingMetadata = exports.filterRecordings = exports.updateStatus = void 0;
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const fs_1 = __importDefault(require("fs"));

@@ -138,3 +138,26 @@ const path_1 = __importDefault(require("path"));

}
function doUploadRecording(dir, server, recording, verbose, apiKey, agent, removeAssets = false) {
class RecordingUploadError extends Error {
constructor(message, interiorError) {
super(message);
Object.defineProperty(this, "interiorError", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = "RecordingUploadError";
this.interiorError = interiorError;
Object.setPrototypeOf(this, new.target.prototype); // Restore error prototype chain.
}
}
function handleUploadingError(err, strict, verbose, interiorError) {
(0, utils_1.maybeLog)(verbose, `Upload failed: ${err}`);
if (interiorError) {
debug(interiorError);
}
if (strict) {
throw new RecordingUploadError(err, interiorError);
}
}
function doUploadRecording(dir, server, recording, verbose, apiKey, agent, removeAssets = false, strict = false) {
return __awaiter(this, void 0, void 0, function* () {

@@ -149,3 +172,3 @@ debug("Uploading %s from %s to %s", recording.id, dir, server);

if (reason) {
(0, utils_1.maybeLog)(verbose, `Upload failed: ${reason}`);
handleUploadingError(reason, strict, verbose);
return null;

@@ -169,3 +192,3 @@ }

if (!(yield client.initConnection(server, apiKey, verbose, agent))) {
(0, utils_1.maybeLog)(verbose, `Upload failed: can't connect to server ${server}`);
handleUploadingError(`Cannot connect to server ${server}`, strict, verbose);
return null;

@@ -184,4 +207,3 @@ }

catch (e) {
console.warn("Failed to set recording metadata");
console.warn(e);
handleUploadingError(`Failed to set recording metadata ${e}`, strict, verbose, e);
}

@@ -210,3 +232,3 @@ }

catch (e) {
(0, utils_1.maybeLog)(verbose, `can't upload sourcemap ${sourcemap.path} from disk: ${e}`);
handleUploadingError(`Cannot upload sourcemap ${sourcemap.path} from disk: ${e}`, strict, verbose, e);
}

@@ -233,3 +255,3 @@ }), { concurrency: 10, stopOnError: false });

}
return doUploadRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.agent, true);
return doUploadRecording(dir, server, recording, opts.verbose, opts.apiKey, opts.agent, true, opts.strict);
});

@@ -303,3 +325,3 @@ }

const batchSize = Math.min(opts.batchSize || 20, 25);
const recordingIds = yield (0, p_map_1.default)(recordings, (r) => doUploadRecording(dir, server, r, opts.verbose, opts.apiKey, opts.agent, false), { concurrency: batchSize, stopOnError: false });
const recordingIds = yield (0, p_map_1.default)(recordings, (r) => doUploadRecording(dir, server, r, opts.verbose, opts.apiKey, opts.agent, false, opts.strict), { concurrency: batchSize, stopOnError: false });
recordingIds.forEach(id => {

@@ -306,0 +328,0 @@ const recording = recordings.find(r => r.id === id);

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

exports.addRecordingEvent = exports.removeRecordingsFile = exports.removeRecordingFromLog = exports.readRecordingFile = exports.readRecordings = void 0;
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const fs_1 = __importDefault(require("fs"));

@@ -10,0 +10,0 @@ const path_1 = __importDefault(require("path"));

@@ -50,3 +50,9 @@ export declare type UnstructuredMetadata = Record<string, unknown>;

}
export interface UploadAllOptions extends FilterOptions {
export interface UploadOptions extends Options {
/**
* Fail the recording upload if any part of the upload fails.
*/
strict?: boolean;
}
export interface UploadAllOptions extends FilterOptions, UploadOptions {
batchSize?: number;

@@ -53,0 +59,0 @@ warn?: boolean;

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

const metadata_1 = require("../metadata");
const debug_1 = __importDefault(require("debug"));
const debug_1 = __importDefault(require("./debug"));
const debug = (0, debug_1.default)("replay:cli:upload");

@@ -36,0 +36,0 @@ function sha256(text) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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