Storage classes
Exports
Section titled “Exports”import { AbstractStorage, InMemoryStorage,} from '@labdigital/commercetools-mock'
import { SQLiteStorage } from '@labdigital/commercetools-mock/sqlite'InMemoryStorage
Section titled “InMemoryStorage”The default backend. Construct with no arguments:
new InMemoryStorage()See In-memory storage.
SQLiteStorage
Section titled “SQLiteStorage”Experimental SQLite backend, from the /sqlite entry point.
new SQLiteStorage(options?: { filename?: string })| Option | Default | Description |
|---|---|---|
filename | commercetools-mock.db | Database file path, or ':memory:'. |
Has a close() method to release the connection. See
SQLite storage.
AbstractStorage
Section titled “AbstractStorage”The base class to extend for a custom backend. Key abstract methods (all return Promises):
clear, all, count, add, get, getByKey, delete, query,
addProject, getProject, saveProject, getByContainerAndKey, expand.
close() is a non-abstract no-op you can override if your backend holds
external resources.