A TypeScript module for interacting with Nano databases
Interfaces
- NanoFlags
Extended repository flags that include user authentication information for Nano database connections
Members
# static constant NanoFlavour
Constant string that identifies the database type as "nano" for use in adapter selection and configuration
Identifier for the Nano database flavor
# static constant PACKAGE_NAME
Stores the current package version string for the for-nano module
Package version identifier
# static constant VERSION
Stores the current package version string for the for-nano module
Package version identifier
# inner constant COMMIT
Stores the current git commit hash for the package. The build replaces the placeholder with the actual commit hash at publish time.
Represents the current commit hash of the module build.
# inner constant FULL_VERSION
Stores the semver version and commit hash for the package.
The build replaces the placeholder with the actual <version>-<commit> value at publish time.
Represents the full version string of the module.
Methods
# static createdByOnNanoCreateUpdate(this, context, data, key, model) → {Promise.<void>}
Callback function used in decorators to automatically set the created_by or updated_by fields with the username from the context when a document is created or updated
Sets the creator or updater field in a model based on the user in the context
Parameters:
| Name | Type | Description |
|---|---|---|
this |
R
|
The repository instance |
context |
Context.<NanoFlags>
|
The operation context containing user information |
data |
V
|
The relation metadata |
key |
The property key to set with the username |
|
model |
M
|
The model instance being created or updated |
A promise that resolves when the operation is complete
Promise.<void>
Type Definitions
object
# NanoConfig
Defines the necessary parameters to establish a connection to a Nano (CouchDB) server and select a database
Connection configuration for Nano
Properties:
| Name | Type | Description |
|---|---|---|
user |
string
|
Username to authenticate against the server |
password |
string
|
Password to authenticate the user |
host |
string
|
Host and port of the server (e.g., "localhost:5984") or full URL host without protocol |
dbName |
string
|
The database name to use on the server |
couchUser |
string
|
|
couchPassword |
string
|
|
host |
string
|
|
dbName |
string
|
|
protocol |
"http"
|
"https"
|
Repository.<M, MangoQuery, NanoAdapter, NanoFlags, Context.<NanoFlags>>
# NanoRepository
A specialized repository type for working with Nano databases, extending the base Repository with Nano-specific adapter, flags, and context types
Type for Nano database repositories