Socket
Socket
Sign inDemoInstall

@salutejs/storage-adapter-memory

Package Overview
Dependencies
Maintainers
4
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salutejs/storage-adapter-memory - npm Package Compare versions

Comparing version 0.41.0 to 0.42.0-canary.117.7110907139.0

7

dist/index.d.ts
import { SaluteSession, SaluteSessionStorage } from '@salutejs/scenario';
export declare class SaluteMemoryStorage implements SaluteSessionStorage {
private sessions;
private lifetime;
constructor({ lifetime }?: {
lifetime?: number;
});
resolve(id: string): Promise<SaluteSession>;
save({ id, session, lifetime }: {
save({ id, session }: {
id: string;
session: SaluteSession;
lifetime?: number;
}): Promise<void>;

@@ -10,0 +13,0 @@ reset(id: string): Promise<void>;

@@ -41,4 +41,7 @@ "use strict";

var SaluteMemoryStorage = /** @class */ (function () {
function SaluteMemoryStorage() {
function SaluteMemoryStorage(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.lifetime, lifetime = _c === void 0 ? 60 * 60 * 1000 : _c;
this.sessions = {};
this.lifetime = lifetime;
setInterval(this.validate, 60 * 1000);
}

@@ -58,8 +61,8 @@ SaluteMemoryStorage.prototype.resolve = function (id) {

SaluteMemoryStorage.prototype.save = function (_a) {
var id = _a.id, session = _a.session, _b = _a.lifetime, lifetime = _b === void 0 ? 0 : _b;
var id = _a.id, session = _a.session;
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_c) {
return __generator(this, function (_b) {
this.sessions[id] = session;
if (lifetime > 0) {
this.sessions[id].expires = Date.now() + lifetime;
if (this.lifetime > 0) {
this.sessions[id].expires = Date.now() + this.lifetime;
}

@@ -78,2 +81,3 @@ return [2 /*return*/, Promise.resolve()];

state: {},
expires: this.lifetime > 0 ? Date.now() + this.lifetime : undefined,
};

@@ -80,0 +84,0 @@ return [2 /*return*/, Promise.resolve()];

{
"name": "@salutejs/storage-adapter-memory",
"version": "0.41.0",
"version": "0.42.0-canary.117.7110907139.0",
"description": "In memory storage adapter for SaluteJS",

@@ -32,5 +32,5 @@ "author": "Salute Frontend Team <salute.developers@gmail.com>",

"dependencies": {
"@salutejs/scenario": "0.41.0"
"@salutejs/scenario": "0.42.0-canary.117.7110907139.0"
},
"gitHead": "54a55a1c44b1e3da22b10efef6a34794e463efe1"
"gitHead": "93cdcf2520ce1cbcdeeae3fe1a6fce53dc0a634f"
}

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