🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@salutejs/storage-adapter-memory

Package Overview
Dependencies
Maintainers
4
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salutejs/storage-adapter-memory

In memory storage adapter for SaluteJS

1.3.0
latest
Source
npm
Version published
Weekly downloads
4
-88.57%
Maintainers
4
Weekly downloads
 
Created
Source

@salutejs/storage-adapter-memory

Адаптер для хранения сессии в памяти процесса.

npm i -S @salutejs/storage-adapter-memory

Использование

import { createSaluteRequest, createSaluteResponse, createScenarioWalker } from '@salutejs/scenario';
import { SaluteMemoryStorage } from '@salutejs/memory';
import express from 'express';

//...

const app = express();
app.use(express.json());

const storage = new SaluteMemoryStorage();
const scenarioWalker = createScenarioWalker({
    intents,
    recognizer,
    systemScenario,
    userScenario,
});

app.post('/', async ({ body }, response) => {
    const req = createSaluteRequest(body);
    const res = createSaluteResponse(body);
    const session = await storage.resolve(body.uuid.sessionId);

    await scenarioWalker({ req, res, session });

    await storage.save({ id: body.uuid.sessionId, session });

    response.status(200).json(res.message);
});

FAQs

Package last updated on 04 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts