Module

for-nano

A TypeScript module for interacting with Nano databases

View Source index.ts, line 10

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

View Source constants.ts, line 2

# static constant VERSION

Stores the current package version string for the for-nano module

Package version identifier

View Source index.ts, line 15

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

sequenceDiagram participant F as createdByOnNanoCreateUpdate participant C as Context participant M as Model F->>C: get("user") C-->>F: user object F->>M: set key to user.name Note over F: If no user in context F-->>F: throw UnsupportedError
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

View Source adapter.ts, line 695

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

user string
password string
host string
dbName string

View Source types.ts, line 19