@wireapp/store-engine
Provides a storage wrapper API to unify access to different storage technologies.
Last updated 17 hours ago by wireapp-member .
GPL-3.0 · Repository · Original npm · Tarball · package.json
$ cnpm install @wireapp/store-engine 
SYNC missed versions from official npm registry.

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.

You can find the published source code at github.com/wireapp.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

Store Engine

The Store Engine is an interface which can be used to implement various storage technologies in a uniform manner. There is a MemoryEngine which serves as an example. Additional implementations can be found in separate packages.

Popular implementations

Store Engine Description
store-engine Implementation for in-memory.
store-engine-bro-fs Implementation for the browser's File and Directory Entries API.
store-engine-dexie Implementation for the browser's IndexedDB.
store-engine-fs Implementation for Node.js' File System.
store-engine-sqleet Implementation for SQLite 3 (WebAssembly) with encryption.
store-engine-web-storage Implementation for the browser's Web Storage API.

Motivation

Nowadays there are more and more storage possibilities and developers must be familiar with the characteristics of each individual solution to reliably store data. Because it can be sometimes hard to keep up with the highly dynamic world of data storages, we have developed a system which unifies the use of different storages / databases.

Quickstart

Engine instantiation

const {MemoryEngine} = require('@wireapp/store-engine');
const engine = new MemoryEngine();
await engine.init('my-database-name');

API

No matter which engine you use, they all support common CRUD operations.

Example

The following API calls we use this data:

const TABLE_NAME = 'the-simpsons';
const PRIMARY_KEY = 'lisa-simpson';
const ENTITY = {name: 'Lisa Simpson'};

create

engine.create(TABLE_NAME, PRIMARY_KEY, ENTITY).then(primaryKey => {
  console.log(`Saved record with primary key "${primaryKey}".`);
});

delete

engine.delete(TABLE_NAME, PRIMARY_KEY).then(primaryKey => {
  console.log(`Deleted record with primary key "${primaryKey}".`);
});

deleteAll

engine.deleteAll(TABLE_NAME).then(wasDeleted => {
  if (wasDeleted) {
    console.log('The Simpsons have been deleted. Poor Simpsons!');
  }
});

purge

engine.purge().then(() => {
  console.log('The Simpson Universe has been deleted. Doh!');
});

read

engine.read(TABLE_NAME, PRIMARY_KEY).then(record => {
  console.log(`Her name is "${record.name}".`);
});

readAll

engine.readAll(TABLE_NAME).then(records => {
  console.log(`There are "${records.length}" Simpsons in our database.`);
});

readAllPrimaryKeys

engine.readAllPrimaryKeys(TABLE_NAME).then(primaryKeys => {
  console.log(`Identifiers of our Simpsons: "${primaryKeys.join(', ')}"`);
});

update

engine.update(TABLE_NAME, PRIMARY_KEY, {brother: 'Bart Simpson'}).then((primaryKey) => {
  return engine.read(TABLE_NAME, PRIMARY_KEY);
}).then((updatedRecord) => {
  console.log(`The brother of "${updatedRecord.name}" is "${updatedRecord.brother}".`):
})

Transient store

The Store Engine interface also provides a transient store which deletes data after a specified TTL.

Example

const {Store} = require('@wireapp/store-engine');
const {WebStorageEngine} = require('@wireapp/store-engine-web-storage');

const engine = new WebStorageEngine();
const store = new Store.TransientStore(engine);

(async () => {
  const ttl = 1000;

  await engine.init('my-database-name');
  await store.init('the-simpsons');
  const transientBundle = await store.set('bart', {name: 'Bart Simpson'}, ttl);
  console.log(`The record of "${transientBundle.payload.name}" will expire in "${transientBundle.expires}"ms.`);
})();

Current Tags

  • 3.9.18                                ...           latest (17 hours ago)

285 Versions

  • 3.9.18                                ...           17 hours ago
  • 3.9.17                                ...           8 days ago
  • 3.9.16                                ...           18 days ago
  • 3.9.15                                ...           22 days ago
  • 3.9.14                                ...           25 days ago
  • 3.9.13                                ...           a month ago
  • 3.9.12                                ...           a month ago
  • 3.9.11                                ...           a month ago
  • 3.9.10                                ...           a month ago
  • 3.9.9                                ...           2 months ago
  • 3.9.8                                ...           2 months ago
  • 3.9.7                                ...           2 months ago
  • 3.9.6                                ...           2 months ago
  • 3.9.5                                ...           2 months ago
  • 3.9.4                                ...           2 months ago
  • 3.9.3                                ...           2 months ago
  • 3.9.2                                ...           2 months ago
  • 3.9.1                                ...           2 months ago
  • 3.9.0                                ...           2 months ago
  • 3.8.1                                ...           2 months ago
  • 3.8.0                                ...           2 months ago
  • 3.7.0                                ...           2 months ago
  • 3.6.3                                ...           2 months ago
  • 3.6.2                                ...           3 months ago
  • 3.6.1                                ...           3 months ago
  • 3.6.0                                ...           3 months ago
  • 3.5.6                                ...           3 months ago
  • 3.5.5                                ...           3 months ago
  • 3.5.4                                ...           3 months ago
  • 3.5.3                                ...           3 months ago
  • 3.5.2                                ...           3 months ago
  • 3.5.1                                ...           3 months ago
  • 3.5.0                                ...           3 months ago
  • 3.4.0                                ...           3 months ago
  • 3.3.1                                ...           3 months ago
  • 3.3.0                                ...           4 months ago
  • 3.2.0                                ...           4 months ago
  • 3.1.1                                ...           4 months ago
  • 3.1.0                                ...           4 months ago
  • 3.0.14                                ...           4 months ago
  • 3.0.13                                ...           4 months ago
  • 3.0.12                                ...           4 months ago
  • 3.0.11                                ...           4 months ago
  • 3.0.10                                ...           4 months ago
  • 3.0.9                                ...           4 months ago
  • 3.0.8                                ...           4 months ago
  • 3.0.7                                ...           4 months ago
  • 3.0.6                                ...           4 months ago
  • 3.0.5                                ...           4 months ago
  • 3.0.4                                ...           4 months ago
  • 3.0.3                                ...           4 months ago
  • 3.0.2                                ...           4 months ago
  • 3.0.1                                ...           4 months ago
  • 3.0.0                                ...           5 months ago
  • 2.1.4                                ...           5 months ago
  • 2.1.3                                ...           5 months ago
  • 2.1.2                                ...           5 months ago
  • 2.1.1                                ...           5 months ago
  • 2.1.0                                ...           5 months ago
  • 2.0.0                                ...           6 months ago
  • 1.1.47                                ...           6 months ago
  • 1.1.46                                ...           6 months ago
  • 1.1.45                                ...           6 months ago
  • 1.1.44                                ...           6 months ago
  • 1.1.43                                ...           6 months ago
  • 1.1.42                                ...           6 months ago
  • 1.1.41                                ...           6 months ago
  • 1.1.40                                ...           7 months ago
  • 1.1.39                                ...           7 months ago
  • 1.1.38                                ...           7 months ago
  • 1.1.37                                ...           7 months ago
  • 1.1.36                                ...           7 months ago
  • 1.1.35                                ...           7 months ago
  • 1.1.34                                ...           7 months ago
  • 1.1.33                                ...           7 months ago
  • 1.1.32                                ...           7 months ago
  • 1.1.31                                ...           7 months ago
  • 1.1.30                                ...           7 months ago
  • 1.1.29                                ...           7 months ago
  • 1.1.28                                ...           7 months ago
  • 1.1.27                                ...           7 months ago
  • 1.1.26                                ...           8 months ago
  • 1.1.25                                ...           8 months ago
  • 1.1.24                                ...           8 months ago
  • 1.1.23                                ...           8 months ago
  • 1.1.22                                ...           8 months ago
  • 1.1.21                                ...           8 months ago
  • 1.1.20                                ...           9 months ago
  • 1.1.19                                ...           9 months ago
  • 1.1.18                                ...           9 months ago
  • 1.1.17                                ...           9 months ago
  • 1.1.16                                ...           9 months ago
  • 1.1.15                                ...           9 months ago
  • 1.1.14                                ...           10 months ago
  • 1.1.13                                ...           10 months ago
  • 1.1.12                                ...           10 months ago
  • 1.1.11                                ...           10 months ago
  • 1.1.10                                ...           10 months ago
  • 1.1.9                                ...           10 months ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.19                                ...           a year ago
  • 1.0.18                                ...           a year ago
  • 1.0.17                                ...           a year ago
  • 1.0.16                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.12.26                                ...           a year ago
  • 0.12.25                                ...           a year ago
  • 0.12.24                                ...           a year ago
  • 0.12.23                                ...           a year ago
  • 0.12.22                                ...           a year ago
  • 0.12.21                                ...           a year ago
  • 0.12.20                                ...           a year ago
  • 0.12.19                                ...           a year ago
  • 0.12.18                                ...           a year ago
  • 0.12.17                                ...           a year ago
  • 0.12.16                                ...           a year ago
  • 0.12.15                                ...           a year ago
  • 0.12.14                                ...           a year ago
  • 0.12.13                                ...           a year ago
  • 0.12.12                                ...           a year ago
  • 0.12.11                                ...           a year ago
  • 0.12.10                                ...           a year ago
  • 0.12.9                                ...           a year ago
  • 0.12.8                                ...           a year ago
  • 0.12.7                                ...           a year ago
  • 0.12.6                                ...           a year ago
  • 0.12.5                                ...           a year ago
  • 0.12.4                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.56                                ...           a year ago
  • 0.11.55                                ...           a year ago
  • 0.11.53                                ...           a year ago
  • 0.11.52                                ...           a year ago
  • 0.11.51                                ...           a year ago
  • 0.11.50                                ...           a year ago
  • 0.11.49                                ...           a year ago
  • 0.11.48                                ...           a year ago
  • 0.11.47                                ...           a year ago
  • 0.11.46                                ...           a year ago
  • 0.11.45                                ...           a year ago
  • 0.11.44                                ...           a year ago
  • 0.11.43                                ...           a year ago
  • 0.11.42                                ...           a year ago
  • 0.11.41                                ...           a year ago
  • 0.11.40                                ...           a year ago
  • 0.11.39                                ...           a year ago
  • 0.11.38                                ...           a year ago
  • 0.11.37                                ...           a year ago
  • 0.11.36                                ...           a year ago
  • 0.11.35                                ...           a year ago
  • 0.11.34                                ...           a year ago
  • 0.11.33                                ...           a year ago
  • 0.11.32                                ...           a year ago
  • 0.11.31                                ...           a year ago
  • 0.11.30                                ...           a year ago
  • 0.11.29                                ...           a year ago
  • 0.11.28                                ...           a year ago
  • 0.11.27                                ...           a year ago
  • 0.11.26                                ...           a year ago
  • 0.11.25                                ...           a year ago
  • 0.11.24                                ...           a year ago
  • 0.11.23                                ...           a year ago
  • 0.11.22                                ...           a year ago
  • 0.11.21                                ...           a year ago
  • 0.11.20                                ...           a year ago
  • 0.11.19                                ...           a year ago
  • 0.11.18                                ...           a year ago
  • 0.11.17                                ...           a year ago
  • 0.11.16                                ...           a year ago
  • 0.11.15                                ...           a year ago
  • 0.11.14                                ...           a year ago
  • 0.11.13                                ...           a year ago
  • 0.11.12                                ...           a year ago
  • 0.11.11                                ...           a year ago
  • 0.11.10                                ...           a year ago
  • 0.11.9                                ...           a year ago
  • 0.11.8                                ...           a year ago
  • 0.11.7                                ...           a year ago
  • 0.11.6                                ...           a year ago
  • 0.11.5                                ...           a year ago
  • 0.11.4                                ...           a year ago
  • 0.11.3                                ...           a year ago
  • 0.11.2                                ...           a year ago
  • 0.11.1                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.1                                ...           a year ago
  • 0.7.0                                ...           a year ago
  • 0.6.3                                ...           a year ago
  • 0.6.2                                ...           a year ago
  • 0.6.1                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.5.12                                ...           2 years ago
  • 0.5.11                                ...           2 years ago
  • 0.5.10                                ...           2 years ago
  • 0.5.9                                ...           2 years ago
  • 0.5.8                                ...           2 years ago
  • 0.5.7                                ...           2 years ago
  • 0.5.6                                ...           2 years ago
  • 0.5.5                                ...           2 years ago
  • 0.5.4                                ...           2 years ago
  • 0.5.3                                ...           2 years ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.3.9                                ...           2 years ago
  • 0.3.8                                ...           2 years ago
  • 0.3.7                                ...           2 years ago
  • 0.3.6                                ...           2 years ago
  • 0.3.5                                ...           2 years ago
  • 0.3.4                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.15                                ...           2 years ago
  • 0.1.14                                ...           2 years ago
  • 0.1.13                                ...           2 years ago
  • 0.1.12                                ...           2 years ago
  • 0.1.11                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.22                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |