Socket
Socket
Sign inDemoInstall

@salutejs/storage-adapter-memory

Package Overview
Dependencies
2
Maintainers
4
Versions
226
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @salutejs/storage-adapter-memory

In memory storage adapter for SaluteJS


Version published
Weekly downloads
334
increased by215.09%
Maintainers
4
Created
Weekly downloads
 

Readme

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

Last updated on 20 Mar 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc