Database Adapter + Kysely
Breaking Changes
Auto-create instance
All stores now accept only the instance of the underlying driver. Verrou no longer creates client instances for you. Take the redis driver, for example. Before, you could do this:
const verrou = new Verrou({
logger,
default: 'redis',
stores: {
memory: { driver: memoryStore() },
redis: { driver: redisStore({ connection: { host: '127.0.0.1', port: 6379 }) },
},
})From now on, you'll need to create your instance beforehand and pass it to Verrou :
const ioredis = new Redis({ host: 'localhost', port: 6379 }) // create the client
const verrou = new Verrou({
logger,
default: 'redis',
stores: {
memory: { driver: memoryStore() },
redis: { driver: redisStore({ connection: ioredis }) }, // pass it to verrou
},
})Disconnecting
Any notion of disconnecting has been removed from Verrou. You'll have to manage the disconnection of your drivers yourself. The disconnect and disconnectAll methods have been removed.
Since you instantiate your client yourself, managing disconnection is simple:
const ioredis = new Redis({ host: 'localhost', port: 6379 })
const verrou = new Verrou({
logger,
default: 'redis',
stores: {
memory: { driver: memoryStore() },
redis: { driver: redisStore({ connection: ioredis }) },
},
})
// do some things
await ioredis.quit()DatabaseStore
- the
databaseStoreis now called theknexStoreand can be imported from@verrou/core/drivers/knex.
Changes
- We now have an adapter system for the
databaseStore, which makes it easy to change knex for something else in case you're using another ORM and just want to have a connection to your DB from your application. - Added an adapter + store
kyselyStoreimportable from@verrou/core/drivers/kysely. See documentation - Added
autoCreateTableproperty for database driver.
Commits
- chore: update readme (428d0ae)
- doc: update documentation about drivers usage (257971b)
- refactor: update playground (d34b727)
- refactor: drivers only accept instance instead of creating it (9808fc6)
- refactor: remove all disconnect features (c96d91e)
- style: lint files (6e6ff05)
- feat: add DatabaseStore + adapter system (c3a5691)
- chore: fix typos (d905df0)
- style: lint (31c5bf7)
- feat: add kysely adapter (7b4d0c8)
- chore: add dynamodb as optional peer dep (d5142f1)
- style: lint (12da6e9)
- feat: add
autoCreateTableoptions for database driver (2d980cf) - chore: update documentation (b7cf5ce)
- chore: update dependencies (e8c93e3)
- Update quick_setup.md (1a3e5d5)
- chore(docs): add algolia search (16c80c3)
- feat: add more logging (5e26853)
- chore: add pino to playground (6d461c4)
- docs: fix typo (fcea658)
- docs: fix install command (874eacb)
- chore: add og image (43f6dff)
- docs: fix wrong example (a159504)
- docs: add pretty banner (513cc39)
- Update README.md (0e6947d)
- docs: note about documentation (61087f8)