A TypeScript adapter for PouchDB integration
Interfaces
- PouchFlags
Extends the base repository flags with PouchDB-specific properties. These flags are used to pass additional information during repository operations.
Members
# static constant DefaultLocalStoragePath
Used when creating a local PouchDB instance without a remote host; combined with dbName to form the filesystem path.
Default relative path where local PouchDB databases are stored
# static constant PouchFlavour
A string constant that identifies the PouchDB implementation in the decorator system. This is used to target decorators specifically for PouchDB adapters.
Identifier for PouchDB flavor in the decorator system
# static constant VERSION
Stores the current version of the for-pouch package
Package version identifier
Methods
# static createdByOnPouchCreateUpdate(this, context, data, key, model) → {Promise.<void>}
This function is used as a decorator handler to automatically set the creator ID field on a model when it's being created or updated. It extracts the UUID from the context and assigns it to the specified key.
Sets the creator ID on a model during creation or update operations
Parameters:
Name | Type | Description |
---|---|---|
this |
R
|
The repository instance |
context |
Context.<PouchFlags>
|
The operation context containing flags |
data |
V
|
The relations metadata |
key |
The property key to set on the model |
|
model |
M
|
The model instance to modify |
A promise that resolves when the operation is complete
Promise.<void>
Type Definitions
object
# PouchConfig
Defines connection credentials, local storage options, database name, and a list of PouchDB plugins to register before client creation.
Configuration options for initializing a PouchDB adapter
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
user |
string
|
<optional> |
Username for remote HTTP/S connections |
password |
string
|
<optional> |
Password for remote HTTP/S connections |
host |
string
|
<optional> |
Host (and optional port) of the remote CouchDB-compatible server |
protocol |
"http"
|
"https"
|
<optional> |
Network protocol to use when connecting remotely |
port |
number
|
<optional> |
Optional explicit port number; if provided may be part of host instead |
dbName |
string
|
Database name used in the URL or local path |
|
storagePath |
string
|
<optional> |
Relative base path for local databases; defaults to |
plugins |
Array.<any>
|
List of PouchDB plugins (modules) to register with the client |
|
user |
string
|
<optional> |
|
password |
string
|
<optional> |
|
host |
string
|
<optional> |
|
protocol |
"http"
|
"https"
|
<optional> |
|
port |
number
|
<optional> |
|
dbName |
string
|
||
storagePath |
string
|
<optional> |
|
plugins |
Array
|