redis-memory-server 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Marc Hassan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,18 +1,11 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
16
9
  }) : (function(o, m, k, k2) {
17
10
  if (k2 === undefined) k2 = k;
18
11
  o[k2] = m[k];
@@ -38,55 +31,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
39
32
  });
40
33
  };
41
- var __generator = (this && this.__generator) || function (thisArg, body) {
42
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
43
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
44
- function verb(n) { return function (v) { return step([n, v]); }; }
45
- function step(op) {
46
- if (f) throw new TypeError("Generator is already executing.");
47
- while (_) try {
48
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49
- if (y = 0, t) op = [op[0] & 2, t.value];
50
- switch (op[0]) {
51
- case 0: case 1: t = op; break;
52
- case 4: _.label++; return { value: op[1], done: false };
53
- case 5: _.label++; y = op[1]; op = [0]; continue;
54
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
55
- default:
56
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
57
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
58
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
60
- if (t[2]) _.ops.pop();
61
- _.trys.pop(); continue;
62
- }
63
- op = body.call(thisArg, _);
64
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
65
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66
- }
67
- };
68
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
69
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
70
36
  };
71
37
  Object.defineProperty(exports, "__esModule", { value: true });
72
- var tmp = __importStar(require("tmp"));
73
- var get_port_1 = __importDefault(require("get-port"));
74
- var db_util_1 = require("./util/db_util");
75
- var RedisInstance_1 = __importDefault(require("./util/RedisInstance"));
76
- var debug_1 = __importDefault(require("debug"));
77
- var log = debug_1.default('RedisMS:RedisMemoryServer');
38
+ const tmp = __importStar(require("tmp"));
39
+ const get_port_1 = __importDefault(require("get-port"));
40
+ const db_util_1 = require("./util/db_util");
41
+ const RedisInstance_1 = __importDefault(require("./util/RedisInstance"));
42
+ const debug_1 = __importDefault(require("debug"));
43
+ const log = (0, debug_1.default)('RedisMS:RedisMemoryServer');
78
44
  tmp.setGracefulCleanup();
79
- var RedisMemoryServer = /** @class */ (function () {
45
+ class RedisMemoryServer {
80
46
  /**
81
47
  * Create an Redis-Memory-Sever Instance
82
48
  *
83
49
  * Note: because of JavaScript limitations, autoStart cannot be awaited here, use ".create" for async/await ability
84
50
  * @param opts Redis-Memory-Sever Options
85
51
  */
86
- function RedisMemoryServer(opts) {
52
+ constructor(opts) {
87
53
  this.runningInstance = null;
88
54
  this.instanceInfoSync = null;
89
- this.opts = __assign({}, opts);
55
+ this.opts = Object.assign({}, opts);
90
56
  if ((opts === null || opts === void 0 ? void 0 : opts.autoStart) === true) {
91
57
  log('Autostarting Redis instance...');
92
58
  this.start();
@@ -96,211 +62,159 @@ var RedisMemoryServer = /** @class */ (function () {
96
62
  * Create an Redis-Memory-Sever Instance that can be awaited
97
63
  * @param opts Redis-Memory-Sever Options
98
64
  */
99
- RedisMemoryServer.create = function (opts) {
100
- return __awaiter(this, void 0, void 0, function () {
101
- var instance;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0:
105
- instance = new RedisMemoryServer(__assign(__assign({}, opts), { autoStart: false }));
106
- if (!(opts === null || opts === void 0 ? void 0 : opts.autoStart)) return [3 /*break*/, 2];
107
- return [4 /*yield*/, instance.start()];
108
- case 1:
109
- _a.sent();
110
- _a.label = 2;
111
- case 2: return [2 /*return*/, instance];
112
- }
113
- });
65
+ static create(opts) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ // create an instance WITHOUT autoStart so that the user can await it
68
+ const instance = new RedisMemoryServer(Object.assign(Object.assign({}, opts), { autoStart: false }));
69
+ if (opts === null || opts === void 0 ? void 0 : opts.autoStart) {
70
+ yield instance.start();
71
+ }
72
+ return instance;
114
73
  });
115
- };
74
+ }
116
75
  /**
117
76
  * Start the in-memory Instance
118
77
  * (when options.autoStart is true, this already got called)
119
78
  */
120
- RedisMemoryServer.prototype.start = function () {
121
- return __awaiter(this, void 0, void 0, function () {
122
- var _this = this;
123
- return __generator(this, function (_a) {
124
- log('Called RedisMemoryServer.start() method');
125
- if (this.runningInstance) {
126
- throw new Error('Redis instance already in status startup/running/error. Use debug for more info.');
127
- }
128
- this.runningInstance = this._startUpInstance()
129
- .catch(function (err) {
130
- var _a;
131
- if (err.message === 'redis-server shutting down' || err === 'redis-server shutting down') {
132
- log("Redis did not start. Trying to start on another port one more time...");
133
- if ((_a = _this.opts.instance) === null || _a === void 0 ? void 0 : _a.port) {
134
- _this.opts.instance.port = null;
135
- }
136
- return _this._startUpInstance();
137
- }
138
- throw err;
139
- })
140
- .catch(function (err) {
141
- if (!debug_1.default.enabled('RedisMS:RedisMemoryServer')) {
142
- console.warn('Starting the instance failed, please enable debug for more infomation');
79
+ start() {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ log('Called RedisMemoryServer.start() method');
82
+ if (this.runningInstance) {
83
+ throw new Error('Redis instance already in status startup/running/error. Use debug for more info.');
84
+ }
85
+ this.runningInstance = this._startUpInstance()
86
+ .catch((err) => {
87
+ var _a;
88
+ if (err.message === 'redis-server shutting down' || err === 'redis-server shutting down') {
89
+ log(`Redis did not start. Trying to start on another port one more time...`);
90
+ if ((_a = this.opts.instance) === null || _a === void 0 ? void 0 : _a.port) {
91
+ this.opts.instance.port = null;
143
92
  }
144
- throw err;
145
- });
146
- return [2 /*return*/, this.runningInstance.then(function (data) {
147
- _this.instanceInfoSync = data;
148
- return true;
149
- })];
93
+ return this._startUpInstance();
94
+ }
95
+ throw err;
96
+ })
97
+ .catch((err) => {
98
+ if (!debug_1.default.enabled('RedisMS:RedisMemoryServer')) {
99
+ console.warn('Starting the instance failed, please enable debug for more infomation');
100
+ }
101
+ throw err;
102
+ });
103
+ return this.runningInstance.then((data) => {
104
+ this.instanceInfoSync = data;
105
+ return true;
150
106
  });
151
107
  });
152
- };
108
+ }
153
109
  /**
154
110
  * Internal Function to start an instance
155
111
  * @private
156
112
  */
157
- RedisMemoryServer.prototype._startUpInstance = function () {
113
+ _startUpInstance() {
158
114
  var _a, _b, _c, _d;
159
- return __awaiter(this, void 0, void 0, function () {
160
- var instOpts, data, instance;
161
- var _e;
162
- return __generator(this, function (_f) {
163
- switch (_f.label) {
164
- case 0:
165
- instOpts = (_a = this.opts.instance) !== null && _a !== void 0 ? _a : {};
166
- _e = {};
167
- return [4 /*yield*/, get_port_1.default({ port: (_b = instOpts.port) !== null && _b !== void 0 ? _b : undefined })];
168
- case 1:
169
- data = (_e.port = _f.sent(),
170
- _e.ip = (_c = instOpts.ip) !== null && _c !== void 0 ? _c : '127.0.0.1',
171
- _e.tmpDir = undefined,
172
- _e);
173
- if (instOpts.port != data.port) {
174
- log("starting with port " + data.port + ", since " + instOpts.port + " was locked:", data.port);
175
- }
176
- log("Starting Redis instance with following options: " + JSON.stringify(data));
177
- return [4 /*yield*/, RedisInstance_1.default.run({
178
- instance: {
179
- ip: data.ip,
180
- port: data.port,
181
- args: instOpts.args,
182
- },
183
- binary: this.opts.binary,
184
- spawn: this.opts.spawn,
185
- })];
186
- case 2:
187
- instance = _f.sent();
188
- return [2 /*return*/, __assign(__assign({}, data), { instance: instance, childProcess: (_d = instance.childProcess) !== null && _d !== void 0 ? _d : undefined })];
189
- }
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ /** Shortcut to this.opts.instance */
117
+ const instOpts = (_a = this.opts.instance) !== null && _a !== void 0 ? _a : {};
118
+ const data = {
119
+ port: yield (0, get_port_1.default)({ port: (_b = instOpts.port) !== null && _b !== void 0 ? _b : undefined }),
120
+ ip: (_c = instOpts.ip) !== null && _c !== void 0 ? _c : '127.0.0.1',
121
+ tmpDir: undefined,
122
+ };
123
+ if (instOpts.port != data.port) {
124
+ log(`starting with port ${data.port}, since ${instOpts.port} was locked:`, data.port);
125
+ }
126
+ log(`Starting Redis instance with following options: ${JSON.stringify(data)}`);
127
+ // Download if not exists redis binaries in ~/.redis-prebuilt
128
+ // After that startup Redis instance
129
+ const instance = yield RedisInstance_1.default.run({
130
+ instance: {
131
+ ip: data.ip,
132
+ port: data.port,
133
+ args: instOpts.args,
134
+ },
135
+ binary: this.opts.binary,
136
+ spawn: this.opts.spawn,
190
137
  });
138
+ return Object.assign(Object.assign({}, data), { instance: instance, childProcess: (_d = instance.childProcess) !== null && _d !== void 0 ? _d : undefined });
191
139
  });
192
- };
140
+ }
193
141
  /**
194
142
  * Stop the current In-Memory Instance
195
143
  */
196
- RedisMemoryServer.prototype.stop = function () {
197
- return __awaiter(this, void 0, void 0, function () {
198
- var _a, instance, port, tmpDir;
199
- return __generator(this, function (_b) {
200
- switch (_b.label) {
201
- case 0:
202
- log('Called RedisMemoryServer.stop() method');
203
- // just return "true" if the instance is already running / defined
204
- if (db_util_1.isNullOrUndefined(this.runningInstance)) {
205
- log('Instance is already stopped, returning true');
206
- return [2 /*return*/, true];
207
- }
208
- return [4 /*yield*/, this.ensureInstance()];
209
- case 1:
210
- _a = _b.sent(), instance = _a.instance, port = _a.port, tmpDir = _a.tmpDir;
211
- log("Shutdown Redis server on port " + port + " with pid " + (instance.getPid() || ''));
212
- return [4 /*yield*/, instance.kill()];
213
- case 2:
214
- _b.sent();
215
- this.runningInstance = null;
216
- this.instanceInfoSync = null;
217
- if (tmpDir) {
218
- log("Removing tmpDir " + tmpDir.name);
219
- tmpDir.removeCallback();
220
- }
221
- return [2 /*return*/, true];
222
- }
223
- });
144
+ stop() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ log('Called RedisMemoryServer.stop() method');
147
+ // just return "true" if the instance is already running / defined
148
+ if ((0, db_util_1.isNullOrUndefined)(this.runningInstance)) {
149
+ log('Instance is already stopped, returning true');
150
+ return true;
151
+ }
152
+ const { instance, port, tmpDir } = yield this.ensureInstance();
153
+ log(`Shutdown Redis server on port ${port} with pid ${instance.getPid() || ''}`);
154
+ yield instance.kill();
155
+ this.runningInstance = null;
156
+ this.instanceInfoSync = null;
157
+ if (tmpDir) {
158
+ log(`Removing tmpDir ${tmpDir.name}`);
159
+ tmpDir.removeCallback();
160
+ }
161
+ return true;
224
162
  });
225
- };
163
+ }
226
164
  /**
227
165
  * Get Information about the currently running instance, if it is not running it returns "false"
228
166
  */
229
- RedisMemoryServer.prototype.getInstanceInfo = function () {
167
+ getInstanceInfo() {
230
168
  var _a;
231
169
  return (_a = this.instanceInfoSync) !== null && _a !== void 0 ? _a : false;
232
- };
170
+ }
233
171
  /**
234
172
  * Ensure that the instance is running
235
173
  * -> throws if instance cannot be started
236
174
  */
237
- RedisMemoryServer.prototype.ensureInstance = function () {
238
- return __awaiter(this, void 0, void 0, function () {
239
- return __generator(this, function (_a) {
240
- switch (_a.label) {
241
- case 0:
242
- log('Called RedisMemoryServer.ensureInstance() method');
243
- if (this.runningInstance) {
244
- return [2 /*return*/, this.runningInstance];
245
- }
246
- log(' - no running instance, call `start()` command');
247
- return [4 /*yield*/, this.start()];
248
- case 1:
249
- _a.sent();
250
- log(' - `start()` command was succesfully resolved');
251
- // check again for 1. Typescript-type reasons and 2. if .start failed to throw an error
252
- if (!this.runningInstance) {
253
- throw new Error('Ensure-Instance failed to start an instance!');
254
- }
255
- return [2 /*return*/, this.runningInstance];
256
- }
257
- });
175
+ ensureInstance() {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ log('Called RedisMemoryServer.ensureInstance() method');
178
+ if (this.runningInstance) {
179
+ return this.runningInstance;
180
+ }
181
+ log(' - no running instance, call `start()` command');
182
+ yield this.start();
183
+ log(' - `start()` command was succesfully resolved');
184
+ // check again for 1. Typescript-type reasons and 2. if .start failed to throw an error
185
+ if (!this.runningInstance) {
186
+ throw new Error('Ensure-Instance failed to start an instance!');
187
+ }
188
+ return this.runningInstance;
258
189
  });
259
- };
190
+ }
260
191
  /**
261
192
  * Get a redis host
262
193
  */
263
- RedisMemoryServer.prototype.getHost = function () {
264
- return __awaiter(this, void 0, void 0, function () {
265
- return __generator(this, function (_a) {
266
- return [2 /*return*/, this.getIp()];
267
- });
194
+ getHost() {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ return this.getIp();
268
197
  });
269
- };
198
+ }
270
199
  /**
271
200
  * Get a redis IP
272
201
  */
273
- RedisMemoryServer.prototype.getIp = function () {
274
- return __awaiter(this, void 0, void 0, function () {
275
- var ip;
276
- return __generator(this, function (_a) {
277
- switch (_a.label) {
278
- case 0: return [4 /*yield*/, this.ensureInstance()];
279
- case 1:
280
- ip = (_a.sent()).ip;
281
- return [2 /*return*/, ip];
282
- }
283
- });
202
+ getIp() {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ const { ip } = yield this.ensureInstance();
205
+ return ip;
284
206
  });
285
- };
207
+ }
286
208
  /**
287
209
  * Get the Port of the currently running Instance
288
210
  * Note: calls "ensureInstance"
289
211
  */
290
- RedisMemoryServer.prototype.getPort = function () {
291
- return __awaiter(this, void 0, void 0, function () {
292
- var port;
293
- return __generator(this, function (_a) {
294
- switch (_a.label) {
295
- case 0: return [4 /*yield*/, this.ensureInstance()];
296
- case 1:
297
- port = (_a.sent()).port;
298
- return [2 /*return*/, port];
299
- }
300
- });
212
+ getPort() {
213
+ return __awaiter(this, void 0, void 0, function* () {
214
+ const { port } = yield this.ensureInstance();
215
+ return port;
301
216
  });
302
- };
303
- return RedisMemoryServer;
304
- }());
217
+ }
218
+ }
305
219
  exports.default = RedisMemoryServer;
306
220
  //# sourceMappingURL=RedisMemoryServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedisMemoryServer.js","sourceRoot":"","sources":["../src/RedisMemoryServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA2B;AAC3B,sDAA+B;AAC/B,0CAAmD;AACnD,uEAAiD;AAGjD,gDAA0B;AAE1B,IAAM,GAAG,GAAG,eAAK,CAAC,2BAA2B,CAAC,CAAC;AAE/C,GAAG,CAAC,kBAAkB,EAAE,CAAC;AA6BzB;IAKE;;;;;OAKG;IACH,2BAAY,IAA6B;QAVzC,oBAAe,GAAuC,IAAI,CAAC;QAC3D,qBAAgB,GAA8B,IAAI,CAAC;QAUjD,IAAI,CAAC,IAAI,gBAAQ,IAAI,CAAE,CAAC;QAExB,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,MAAK,IAAI,EAAE;YAC5B,GAAG,CAAC,gCAAgC,CAAC,CAAC;YACtC,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;IAED;;;OAGG;IACU,wBAAM,GAAnB,UAAoB,IAA6B;;;;;;wBAEzC,QAAQ,GAAG,IAAI,iBAAiB,uBACjC,IAAI,KACP,SAAS,EAAE,KAAK,IAChB,CAAC;8BACC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;wBACjB,qBAAM,QAAQ,CAAC,KAAK,EAAE,EAAA;;wBAAtB,SAAsB,CAAC;;4BAGzB,sBAAO,QAAQ,EAAC;;;;KACjB;IAED;;;OAGG;IACG,iCAAK,GAAX;;;;gBACE,GAAG,CAAC,yCAAyC,CAAC,CAAC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BACtC,MAAM,CAAC,cAAc,EAAE,CAAC;aACzB;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;OAEG;IACH,eAAe;;QACb,OAAO,MAAA,IAAI,CAAC,gBAAgB,mCAAI,KAAK,CAAC;IACxC,CAAC;IAED;;;OAGG;IACG,cAAc;;YAClB,GAAG,CAAC,kDAAkD,CAAC,CAAC;YACxD,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,OAAO,IAAI,CAAC,eAAe,CAAC;aAC7B;YACD,GAAG,CAAC,gDAAgD,CAAC,CAAC;YACtD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAErD,uFAAuF;YACvF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;aACjE;YAED,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;KAAA;IAED;;OAEG;IACG,OAAO;;YACX,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KAAA;IAED;;OAEG;IACG,KAAK;;YACT,MAAM,EAAE,EAAE,EAAE,GAAuB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/D,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAED;;;OAGG;IACG,OAAO;;YACX,MAAM,EAAE,IAAI,EAAE,GAAuB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AA9LD,oCA8LC"}
package/lib/index.js CHANGED
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.RedisMemoryServer = exports.RedisInstance = exports.RedisBinary = void 0;
7
7
  require("./util/resolve-config"); // import it for the side-effects (globals)
8
- var RedisBinary_1 = __importDefault(require("./util/RedisBinary"));
8
+ const RedisBinary_1 = __importDefault(require("./util/RedisBinary"));
9
9
  exports.RedisBinary = RedisBinary_1.default;
10
- var RedisInstance_1 = __importDefault(require("./util/RedisInstance"));
10
+ const RedisInstance_1 = __importDefault(require("./util/RedisInstance"));
11
11
  exports.RedisInstance = RedisInstance_1.default;
12
- var RedisMemoryServer_1 = __importDefault(require("./RedisMemoryServer"));
12
+ const RedisMemoryServer_1 = __importDefault(require("./RedisMemoryServer"));
13
13
  exports.RedisMemoryServer = RedisMemoryServer_1.default;
14
14
  exports.default = RedisMemoryServer_1.default;
15
15
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA+B,CAAC,2CAA2C;AAE3E,mEAA6C;AAKpC,sBALF,qBAAW,CAKE;AAJpB,uEAAiD;AAI3B,wBAJf,uBAAa,CAIe;AAHnC,0EAAoD;AAGf,4BAH9B,2BAAiB,CAG8B;AADtD,kBAAe,2BAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA+B,CAAC,2CAA2C;AAE3E,qEAA6C;AAKpC,sBALF,qBAAW,CAKE;AAJpB,yEAAiD;AAI3B,wBAJf,uBAAa,CAIe;AAHnC,4EAAoD;AAGf,4BAH9B,2BAAiB,CAG8B;AADtD,kBAAe,2BAAiB,CAAC"}
package/lib/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export declare type DebugFn = (...args: any[]) => any;
2
- export declare type DebugPropT = boolean;
1
+ export type DebugFn = (...args: any[]) => any;
2
+ export type DebugPropT = boolean;
3
3
  export interface DownloadProgressT {
4
4
  current: number;
5
5
  length: number;
6
6
  totalMb: number;
7
7
  lastPrintedAt: number;
8
8
  }
9
- export declare type CallbackFn = (...args: any[]) => any;
9
+ export type CallbackFn = (...args: any[]) => any;
10
10
  export { SpawnOptions } from 'child_process';
11
11
  export interface RedisMemoryInstancePropBaseT {
12
12
  args?: string[];
@@ -15,6 +15,6 @@ export interface RedisMemoryInstancePropBaseT {
15
15
  export interface RedisMemoryInstancePropT extends RedisMemoryInstancePropBaseT {
16
16
  ip?: string;
17
17
  }
18
- export declare type ErrorVoidCallback = (err: any) => void;
19
- export declare type EmptyVoidCallback = () => void;
18
+ export type ErrorVoidCallback = (err: any) => void;
19
+ export type EmptyVoidCallback = () => void;
20
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAC9C,oBAAY,UAAU,GAAG,OAAO,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;AACnD,oBAAY,iBAAiB,GAAG,MAAM,IAAI,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,E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