From 406fc508dc946340eb94ddcdf16d3d66aeca8592 Mon Sep 17 00:00:00 2001 From: Tema Smirnov Date: Tue, 28 Aug 2018 11:49:01 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Default=20storage=20type:=20stor?= =?UTF-8?q?ageFileAsync=20->=20storageFileSync,=20see=20#16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/session.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/session.js b/lib/session.js index 8bcc5a6..15c85de 100644 --- a/lib/session.js +++ b/lib/session.js @@ -13,7 +13,7 @@ const * @param {String} [options.property] - Name of property in {@link https://telegraf.js.org/#/?id=context|Telegraf Context} where session object will be located `(default: 'session')` * @param {Object} [options.state] - Initial state of database. You can use it to pre-init database Arrays/Objects to store your own data `(default: {})` * @param {Function} [options.getSessionKey] - Function to get identifier for session from {@link https://telegraf.js.org/#/?id=context|Telegraf Context} (may implement it on your own) - * @param {Object} [options.storage] - lowdb storage option for implementing your own storage read/write operations `(default: {@link LocalSession.storageFileAsync|LocalSession.storageFileAsync})` + * @param {Object} [options.storage] - lowdb storage option for implementing your own storage read/write operations `(default: {@link LocalSession.storageFileSync|LocalSession.storageFileSync})` * @param {Function} [options.storage.read] - lowdb storage read function, must return an object or a Promise * @param {Function} [options.storage.write] - lowdb storage write function, must return undefined or a Promise * @param {Object} [options.format] - lowdb storage format option for implementing your own database format for read/write operations @@ -24,7 +24,8 @@ const class LocalSession { constructor (options = {}) { this.options = Object.assign({ - storage: LocalSession.storageFileAsync, + // TODO: Use storageFileAsync as default with support of Promise or Promise-like initialization, see: https://git.io/fA3ZN + storage: LocalSession.storageFileSync, database: 'sessions.json', property: 'session', state: { },