Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

redis-memory-server

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-memory-server - npm Package Compare versions

Comparing version
0.13.0
to
0.14.0
+1
-0
lib/util/RedisBinary.d.ts

@@ -9,2 +9,3 @@ export declare const LATEST_VERSION: string;

systemBinary?: string;
ignoreDownloadCache?: boolean;
}

@@ -11,0 +12,0 @@ export default class RedisBinary {

"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 () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -24,3 +57,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

const RedisBinaryDownload_1 = __importDefault(require("./RedisBinaryDownload"));
const resolve_config_1 = __importDefault(require("./resolve-config"));
const resolve_config_1 = __importStar(require("./resolve-config"));
const debug_1 = __importDefault(require("debug"));

@@ -63,3 +96,3 @@ const log = (0, debug_1.default)('RedisMS:RedisBinary');

return __awaiter(this, void 0, void 0, function* () {
const { downloadDir, version } = options;
const { downloadDir, version, ignoreDownloadCache } = options;
// create downloadDir

@@ -84,6 +117,7 @@ yield (0, promises_1.mkdir)(downloadDir, { recursive: true });

// check cache if it got already added to the cache
if (!this.getCachePath(version)) {
if (!this.getCachePath(version) || ignoreDownloadCache) {
const downloader = new RedisBinaryDownload_1.default({
downloadDir,
version,
ignoreDownloadCache,
});

@@ -129,2 +163,3 @@ this.cache[version] = yield downloader.getRedisServerPath();

systemBinary: (0, resolve_config_1.default)('SYSTEM_BINARY'),
ignoreDownloadCache: (0, resolve_config_1.envToBool)((0, resolve_config_1.default)('IGNORE_DOWNLOAD_CACHE')),
};

@@ -154,3 +189,3 @@ /** Provided Options combined with the Default Options */

}
if (!binaryPath) {
if (!binaryPath && !options.ignoreDownloadCache) {
binaryPath = this.getCachePath(options.version);

@@ -157,0 +192,0 @@ }

+3
-1

@@ -7,2 +7,3 @@ import { DownloadProgressT } from '../types';

downloadDir?: string;
ignoreDownloadCache?: boolean;
}

@@ -26,3 +27,4 @@ interface HttpDownloadOptions {

version: string;
constructor({ downloadDir, version }: RedisBinaryDownloadOpts);
ignoreDownloadCache: boolean;
constructor({ downloadDir, version, ignoreDownloadCache }: RedisBinaryDownloadOpts);
/**

@@ -29,0 +31,0 @@ * Get the path of the already downloaded "redis-server" file

@@ -35,5 +35,6 @@ "use strict";

class RedisBinaryDownload {
constructor({ downloadDir, version }) {
constructor({ downloadDir, version, ignoreDownloadCache }) {
this.version = version !== null && version !== void 0 ? version : RedisBinary_1.LATEST_VERSION;
this.downloadDir = path_1.default.resolve(downloadDir || 'redis-download');
this.ignoreDownloadCache = ignoreDownloadCache !== null && ignoreDownloadCache !== void 0 ? ignoreDownloadCache : false;
this.dlProgress = {

@@ -55,3 +56,7 @@ current: 0,

if (yield this.locationExists(redisServerPath)) {
return redisServerPath;
if (!this.ignoreDownloadCache) {
log('Redis binary found, skipping download and install');
return redisServerPath;
}
log('Redis binary found, but ignoring due to "ignoreDownloadCache" being set');
}

@@ -125,4 +130,7 @@ const redisArchive = yield this.startDownload();

if (yield this.locationExists(downloadLocation)) {
log('Already downloaded archive found, skipping download');
return downloadLocation;
if (!this.ignoreDownloadCache) {
log('Already downloaded archive found, skipping download');
return downloadLocation;
}
log('Already downloaded archive found, but ignoring due to "ignoreDownloadCache" being set');
}

@@ -157,3 +165,3 @@ this._downloadingUrl = downloadUrl;

else {
throw new Error(`RedisBinaryDownload: unsupported archive ${redisArchive} (downloaded from ${(_a = this._downloadingUrl) !== null && _a !== void 0 ? _a : 'unkown'}). Broken archive from Redis Provider?`);
throw new Error(`RedisBinaryDownload: unsupported archive ${redisArchive} (downloaded from ${(_a = this._downloadingUrl) !== null && _a !== void 0 ? _a : 'unknown'}). Broken archive from Redis Provider?`);
}

@@ -160,0 +168,0 @@ return extractDir;

{
"name": "redis-memory-server",
"version": "0.13.0",
"version": "0.14.0",
"description": "Redis Server for testing. The server will allow you to connect your favorite client library to the Redis Server and run parallel integration tests isolated from each other.",

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

@@ -15,2 +15,4 @@ # Redis In-Memory Server

All further runs will be fast because they will use the downloaded binaries.
NOTE: If no `version` is specified (or `version` is set to `stable`),
the binary will not be updated after the first run.

@@ -30,2 +32,3 @@ This package automatically downloads source code from [https://download.redis.io/](https://download.redis.io/).

- [Configuring which `redis-server` binary to use](#configuring-which-redis-server-binary-to-use)
- [Using the `stable` version of the binary](#using-the-stable-version-of-the-binary)
- [Usage](#usage)

@@ -69,2 +72,22 @@ - [Simple server start](#simple-server-start)

#### Using the `stable` version of the binary
After the first install of the `stable` version on a machine,
the binary will not be automatically updated on that machine.
This may be a concern because:
1. the install is less deterministic
2. some machines could have vulnerable versions
If this is a concern, either:
1. specify a `version` other than `stable`
2. forcibly update the `stable` binary on demand using a command like:
```bash
REDISMS_IGNORE_DOWNLOAD_CACHE=1 yarn rebuild redis-memory-server
# OR
REDISMS_IGNORE_DOWNLOAD_CACHE=1 npm rebuild redis-memory-server
```
3. specify the `ignoreDownloadCache` option
(NOTE: this will make installs/runs slower)
## Usage

@@ -120,2 +143,3 @@

downloadDir: string, // by default, 'node_modules/.cache/redis-memory-server/redis-binaries'
ignoreDownloadCache: boolean, // by default, false
systemBinary: string, // by default, undefined

@@ -132,2 +156,3 @@ },

REDISMS_VERSION=6.0.10 # default version to download
REDISMS_IGNORE_DOWNLOAD_CACHE=1 # if you want to ignore already downloaded/installed binaries
REDISMS_DEBUG=1 # debug mode, also available case-insensitive values: "on" "yes" "true"

@@ -151,2 +176,3 @@ REDISMS_DOWNLOAD_MIRROR=host # your mirror host to download the redis binary

"version": "6.0.10",
"ignoreDownloadCache": "1",
"debug": "1",

@@ -153,0 +179,0 @@ "downloadMirror": "url",

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