Comparing version 3.2.0 to 3.3.0
@@ -11,3 +11,3 @@ "use strict"; | ||
function operationError(op, err) { | ||
return custom_error_1.default("operationError", `Operation "${op}" error. ${err.message}`, err); | ||
return (0, custom_error_1.default)("operationError", `Operation "${op}" error. ${err.message}`, err); | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -32,3 +32,3 @@ "use strict"; | ||
this.redisInstance.on("end", () => this.setConnectionStatus(ConnectionStatus_1.ConnectionStatus.DISCONNECTED)); | ||
this.withTimeout = (promise) => with_timeout_1.withTimeout(promise, this.options.operationTimeout); | ||
this.withTimeout = (promise) => (0, with_timeout_1.withTimeout)(promise, this.options.operationTimeout); | ||
} | ||
@@ -35,0 +35,0 @@ /** |
@@ -39,6 +39,6 @@ "use strict"; | ||
constructor(options) { | ||
if (exports.isCustomStorageOptions(options)) { | ||
if ((0, exports.isCustomStorageOptions)(options)) { | ||
this.storage = options.storage; | ||
} | ||
else if (exports.isBaseStorageOptions(options)) { | ||
else if ((0, exports.isBaseStorageOptions)(options)) { | ||
this.storage = new BaseStorage_1.BaseStorage({ | ||
@@ -70,3 +70,3 @@ adapter: options.adapter, | ||
this.logger.error(`Storage connection status is "${connectionStatus}", cache is unavailable!. Running executor.`); | ||
return Executor_1.runExecutor(executor); | ||
return (0, Executor_1.runExecutor)(executor); | ||
} | ||
@@ -73,0 +73,0 @@ const { manager: managerName = RefreshAheadManager_1.default.getName(), expiresIn = this.expiresIn } = options; |
@@ -10,3 +10,3 @@ "use strict"; | ||
function parseError(error) { | ||
return custom_error_1.default(constants_1.ERRORS.ParseError, error.message); | ||
return (0, custom_error_1.default)(constants_1.ERRORS.ParseError, error.message); | ||
} | ||
@@ -16,3 +16,3 @@ exports.parseError = parseError; | ||
const text = `Exceeded maximum timeout of ${maxTimeout}`; | ||
return custom_error_1.default(constants_1.ERRORS.RequestMaximumTimeoutExceededError, error ? error.message : text); | ||
return (0, custom_error_1.default)(constants_1.ERRORS.RequestMaximumTimeoutExceededError, error ? error.message : text); | ||
} | ||
@@ -22,3 +22,3 @@ exports.requestMaximumTimeoutExceededError = requestMaximumTimeoutExceededError; | ||
const text = "Error while waiting for result in cache"; | ||
return custom_error_1.default(constants_1.ERRORS.WaitForResultError, error ? error.message : text); | ||
return (0, custom_error_1.default)(constants_1.ERRORS.WaitForResultError, error ? error.message : text); | ||
} | ||
@@ -28,3 +28,3 @@ exports.waitForResultError = waitForResultError; | ||
const text = `Operation timeout after ${timeout}`; | ||
return custom_error_1.default(constants_1.ERRORS.OperationTimeoutError, text); | ||
return (0, custom_error_1.default)(constants_1.ERRORS.OperationTimeoutError, text); | ||
} | ||
@@ -38,5 +38,5 @@ exports.operationTimeoutError = operationTimeoutError; | ||
const text = "Executor should not return undefined. Correct value for emptiness is null."; | ||
return custom_error_1.default(constants_1.ERRORS.ExecutorReturnsUndefinedError, text); | ||
return (0, custom_error_1.default)(constants_1.ERRORS.ExecutorReturnsUndefinedError, text); | ||
} | ||
exports.executorReturnsUndefinedError = executorReturnsUndefinedError; | ||
//# sourceMappingURL=errors.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
if (result === undefined) { | ||
throw errors_1.executorReturnsUndefinedError(); | ||
throw (0, errors_1.executorReturnsUndefinedError)(); | ||
} | ||
@@ -11,0 +11,0 @@ return result; |
@@ -14,3 +14,3 @@ "use strict"; | ||
async get(context) { | ||
return Executor_1.runExecutor(context.executor); | ||
return (0, Executor_1.runExecutor)(context.executor); | ||
} | ||
@@ -17,0 +17,0 @@ } |
@@ -60,6 +60,6 @@ "use strict"; | ||
default: | ||
return deserialize_1.default(rec.value); | ||
return (0, deserialize_1.default)(rec.value); | ||
} | ||
} | ||
await timeout_1.default(this.requestTimeout); | ||
await (0, timeout_1.default)(this.requestTimeout); | ||
return retryRequest(); | ||
@@ -66,0 +66,0 @@ } |
@@ -40,3 +40,3 @@ "use strict"; | ||
this.logger.error(`Error occurred while trying to lock key "${context.key}". Reason: ${keyLockError.message}. Running executor`); | ||
return Executor_1.runExecutor(context.executor); | ||
return (0, Executor_1.runExecutor)(context.executor); | ||
} | ||
@@ -48,3 +48,3 @@ if (!isKeySuccessfullyLocked) { | ||
this.logger.trace(`Running executor for key "${context.key}"`); | ||
const executorResult = await Executor_1.runExecutor(context.executor); | ||
const executorResult = await (0, Executor_1.runExecutor)(context.executor); | ||
await this.set(context.key, executorResult, options); | ||
@@ -51,0 +51,0 @@ return executorResult; |
@@ -23,6 +23,6 @@ "use strict"; | ||
this.logger.error("Failed to get value from storage, falling back to executor", e); | ||
return Executor_1.runExecutor(executor); | ||
return (0, Executor_1.runExecutor)(executor); | ||
} | ||
if (this.isRecordValid(record) && !(await this.storage.isOutdated(record))) { | ||
return deserialize_1.default(record.value); | ||
return (0, deserialize_1.default)(record.value); | ||
} | ||
@@ -29,0 +29,0 @@ const executorContext = { key, executor, options }; |
@@ -34,7 +34,7 @@ "use strict"; | ||
this.logger.error("Failed to get value from storage, falling back to executor", e); | ||
return Executor_1.runExecutor(executor); | ||
return (0, Executor_1.runExecutor)(executor); | ||
} | ||
const executorContext = { key, executor, options }; | ||
if (this.isRecordValid(record) && !(await this.storage.isOutdated(record))) { | ||
const result = deserialize_1.default(record.value); | ||
const result = (0, deserialize_1.default)(record.value); | ||
if (this.isRecordExpireSoon(record)) { | ||
@@ -76,3 +76,3 @@ this.refresh(key, executorContext, options).catch((err) => this.logger.error(err)); | ||
this.logger.trace(`refresh "${key}"`); | ||
const executorResult = await Executor_1.runExecutor(context.executor); | ||
const executorResult = await (0, Executor_1.runExecutor)(context.executor); | ||
await this.storage.set(key, executorResult, options); | ||
@@ -79,0 +79,0 @@ } |
@@ -23,7 +23,7 @@ "use strict"; | ||
this.logger.error("Failed to get value from storage, falling back to executor", e); | ||
return Executor_1.runExecutor(executor); | ||
return (0, Executor_1.runExecutor)(executor); | ||
} | ||
if (this.isRecordValid(record)) { | ||
this.logger.trace("hit", key); | ||
return deserialize_1.default(record.value); | ||
return (0, deserialize_1.default)(record.value); | ||
} | ||
@@ -30,0 +30,0 @@ this.logger.trace("miss", key); |
@@ -52,3 +52,3 @@ "use strict"; | ||
} | ||
const record = deserialize_1.default(value); | ||
const record = (0, deserialize_1.default)(value); | ||
if (!Record_1.Record.isRecord(record)) { | ||
@@ -169,3 +169,3 @@ return null; | ||
const rawKey = this.prefix ? `${this.prefix}-${key}` : key; | ||
return this.hashKeys ? crypto_1.createHash("md5").update(rawKey).digest("hex") : rawKey; | ||
return this.hashKeys ? (0, crypto_1.createHash)("md5").update(rawKey).digest("hex") : rawKey; | ||
} | ||
@@ -217,3 +217,3 @@ createTagKey(tagName) { | ||
catch (error) { | ||
if (errors_1.isOperationTimeoutError(error)) { | ||
if ((0, errors_1.isOperationTimeoutError)(error)) { | ||
this.queueCommand(fn, args); | ||
@@ -220,0 +220,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
setTimeout(() => { | ||
rejectTimeout(errors_1.operationTimeoutError(timeout)); | ||
rejectTimeout((0, errors_1.operationTimeoutError)(timeout)); | ||
}, timeout); | ||
@@ -11,0 +11,0 @@ }); |
{ | ||
"name": "cachalot", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Cache manager for nodejs with support different cache strategies", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"type": "git", | ||
"repository": "https://github.com/TinkoffCreditSystems/cachalot.git" | ||
"repository": "https://github.com/Tinkoff/cachalot.git" | ||
}, | ||
@@ -42,22 +42,22 @@ "engines": { | ||
"devDependencies": { | ||
"@semantic-release/changelog": "^3.0.4", | ||
"@semantic-release/git": "^7.0.16", | ||
"@types/ioredis": "^4.26.4", | ||
"@types/jest": "^26.0.23", | ||
"@types/memcached": "^2.2.6", | ||
"@types/node": "^8.10.61", | ||
"@types/uuid": "^8.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.26.1", | ||
"@typescript-eslint/parser": "^4.26.1", | ||
"coveralls": "^3.1.0", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint": "^7.28.0", | ||
"@semantic-release/changelog": "^6.0.0", | ||
"@semantic-release/git": "^10.0.0", | ||
"@types/ioredis": "^4.27.5", | ||
"@types/jest": "^27.0.2", | ||
"@types/memcached": "^2.2.7", | ||
"@types/node": "^10.17.60", | ||
"@types/uuid": "^8.3.1", | ||
"@typescript-eslint/eslint-plugin": "^4.32.0", | ||
"@typescript-eslint/parser": "^4.32.0", | ||
"coveralls": "^3.1.1", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"ioredis": "^4.27.5", | ||
"jest": "^27.0.4", | ||
"ioredis": "^4.27.9", | ||
"jest": "^27.2.4", | ||
"memcached": "^2.2.2", | ||
"prettier": "^2.3.1", | ||
"semantic-release": "^17.2.3", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.3.2", | ||
"prettier": "^2.4.1", | ||
"semantic-release": "^18.0.0", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "^4.4.3", | ||
"uuid": "^8.3.2" | ||
@@ -64,0 +64,0 @@ }, |
# <img src="assets/logo.svg" alt="cachalot logo" height="100px"> | ||
[![Build status](https://img.shields.io/github/workflow/status/TinkoffCreditSystems/cachalot/CI?style=flat-square)](https://github.com/TinkoffCreditSystems/cachalot/actions?query=branch%3Amaster+workflow%3ACI) | ||
[![Coveralls github](https://img.shields.io/coveralls/github/TinkoffCreditSystems/cachalot.svg?style=flat-square)](https://coveralls.io/github/TinkoffCreditSystems/cachalot) | ||
[![Build status](https://img.shields.io/github/workflow/status/Tinkoff/cachalot/CI?style=flat-square)](https://github.com/Tinkoff/cachalot/actions?query=branch%3Amaster+workflow%3ACI) | ||
[![Coveralls github](https://img.shields.io/coveralls/github/Tinkoff/cachalot.svg?style=flat-square)](https://coveralls.io/github/Tinkoff/cachalot) | ||
[![Written in typescript](https://img.shields.io/badge/written_in-typescript-blue.svg?style=flat-square)](https://www.typescriptlang.org/) | ||
@@ -6,0 +6,0 @@ [![npm](https://img.shields.io/npm/v/cachalot.svg?style=flat-square)](https://www.npmjs.com/package/cachalot) |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
135407
81