Module

for-nano

A TypeScript module for interacting with Nano databases

View Source index.ts, line 11

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 PACKAGE_NAME

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

Package version identifier

View Source index.ts, line 37

# static constant VERSION

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

Package version identifier

View Source index.ts, line 16

# 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.

View Source index.ts, line 23

# 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.

View Source index.ts, line 30

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 778

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"

View Source types.ts, line 25

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

View Source NanoRepository.ts, line 3