index.js 960 B

1234567891011121314151617181920212223242526272829303132
  1. import NeDBBackend from './nedb.js';
  2. import MongoDBBackend from './mongodb.js';
  3. import MemoryBackend from './memory.js';
  4. export { default as NeDBBackend } from './nedb.js';
  5. export { default as MongoDBBackend } from './mongodb.js';
  6. export { default as MemoryBackend } from './memory.js';
  7. export { wrapBackend } from './utils.js';
  8. export const getStoreBackend = (type, options = {}) => {
  9. switch (type) {
  10. case 'nedb':
  11. return NeDBBackend(options);
  12. case 'mongodb':
  13. return MongoDBBackend(options);
  14. default:
  15. return MemoryBackend();
  16. }
  17. };
  18. // Backend interface
  19. /*export const Backend = () => {
  20. return {
  21. async checkSecurity(boxId, id, key) {},
  22. async createOrUpdateBox(boxId, options = { ...DEFAULT_BOX_OPTIONS }) {},
  23. async list(boxId, { limit, sort, skip, onlyFields, q }) {},
  24. async get(boxId, id) {},
  25. async create(boxId, data) {},
  26. async update(boxId, id, body) {},
  27. async delete(boxId, id) {},
  28. };
  29. };*/