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

@signalapp/mock-server

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalapp/mock-server - npm Package Compare versions

Comparing version

to
10.5.0

{
"name": "@signalapp/mock-server",
"version": "10.4.1",
"version": "10.5.0",
"description": "Mock Signal Server for writing tests",

@@ -12,4 +12,3 @@ "main": "src/index.js",

"protos/compiled.d.ts",
"certs",
"updates-data"
"certs"
],

@@ -16,0 +15,0 @@ "scripts": {

@@ -33,2 +33,3 @@ /// <reference types="node" />

cdn3Path?: string;
updates2Path?: string;
}>;

@@ -35,0 +36,0 @@ export type CreatePrimaryDeviceOptions = Readonly<{

@@ -87,2 +87,3 @@ "use strict";

cdn3Path: this.config.cdn3Path,
updates2Path: this.config.updates2Path,
});

@@ -89,0 +90,0 @@ const server = https_1.default.createServer(this.config.https || {}, (req, res) => {

import { RequestHandler } from 'micro';
import { Server } from './base';
export declare const createHandler: (server: Server, { cdn3Path }: {
export declare const createHandler: (server: Server, { cdn3Path, updates2Path, }: {
cdn3Path: string | undefined;
updates2Path: string | undefined;
}) => RequestHandler;

@@ -33,2 +33,4 @@ "use strict";

return 'application/json';
case 'png':
return 'image/png';
default:

@@ -38,3 +40,3 @@ return 'application/octet-stream';

}
const createHandler = (server, { cdn3Path }) => {
const createHandler = (server, { cdn3Path, updates2Path, }) => {
//

@@ -53,2 +55,3 @@ // CDN

const thePath = req.params._;
(0, assert_1.default)(updates2Path, 'updates2Path must be provided to retrieve from updates2');
if (!thePath) {

@@ -58,6 +61,5 @@ (0, micro_1.send)(res, 400, { error: 'Missing path' });

}
const updatesDir = (0, path_1.join)(__dirname, '..', '..', 'updates-data');
let file;
try {
file = await (0, promises_1.open)((0, path_1.join)(updatesDir, thePath), 'r');
file = await (0, promises_1.open)((0, path_1.join)(updates2Path, thePath), 'r');
const { size, mtime } = await file.stat();

@@ -83,2 +85,3 @@ const etag = `"${mtime.getTime().toString(16)}"`;

const thePath = req.params._;
(0, assert_1.default)(updates2Path, 'updates2Path must be provided to retrieve from updates2');
if (!thePath) {

@@ -88,4 +91,3 @@ (0, micro_1.send)(res, 400, { error: 'Missing path' });

}
const updatesDir = (0, path_1.join)(__dirname, '..', '..', 'updates-data');
const filePath = (0, path_1.join)(updatesDir, thePath);
const filePath = (0, path_1.join)(updates2Path, thePath);
try {

@@ -92,0 +94,0 @@ const { size } = await (0, promises_1.stat)(filePath);