Skip to main content
Module

x/nats/nats-base-client/mod.ts

Deno client for NATS, the cloud native messaging system
Very Popular
Go to Latest
import * as nats from "https://deno.land/x/nats@v1.23.0/nats-base-client/mod.ts";

Enums

Other events that can be reported by the NatsConnection#status iterator. These can usually be safely ignored, as higher-order functionality of the client will handle them.

Events reported by the NatsConnection#status iterator.

Possible error codes on exceptions thrown by the library.

Functions

Returns a Backoff with the specified interval policy set.

Returns an Authenticator function that returns a JwtAuth. This is a convenience Authenticator that parses the specified creds and delegates to the jwtAuthenticator.

Returns a Promise that has a resolve/reject methods that can be used to resolve and defer the Deferred.

Returns a Codec for encoding JavaScript object to JSON and serialize them to an Uint8Array, and conversely, from an Uint8Array to JSON to a JavaScript Object.

Returns an Authenticator function that returns a JwtAuth. If a seed is provided, the public key, and signature are calculated.

Convert the specified Nanos into millis

Converts the specified millis into Nanos

Returns an Authenticator that returns a NKeyAuth based that uses the specified seed or function returning a seed.

Creates a KeyPair with an account prefix

Creates a KeyPair with an operator prefix

Creates a KeyPair with an user prefix

Decode a base64 encoded string to a binary Uint8Array

Encode binary data to a base64 string

Creates a KeyPair from a specified public key

Creates a KeyPair from a specified seed.

Returns a Codec for encoding strings to a message payload and decoding message payloads into strings.

syncIterator is a utility function that allows an AsyncIterator to be triggered by calling next() - the utility will yield null if the underlying iterator is closed. Note it is possibly an error to call use this function on an AsyncIterable that has already been started (Symbol.asyncIterator() has been called) from a looping construct.

Returns a token authenticator for the specified token

Returns a user/pass authenticator for the specified user and optional password

Interfaces

Authenticator is an interface that returns credentials.

Represents a message delivered by NATS. This interface is used by Subscribers.

ServerInfo represents information from the connected server

ServerChanged records servers in the cluster that were added or deleted.

Basic interface to a Subscription type

Subscription Options

TlsOptions that can be specified to a client. Note that the options are typically runtime specific, so some clients won't support them at all. In other cases they will match to the runtime's TLS options.

Type Aliases

DispatcherFn allows for values to be processed after being presented to the iterator. Note that if the ProtocolFilter rejected the value it will not be presented to the DispatchedFn. Any processing should instead have been handled by the ProtocolFilterFn.

A service Endpoint

Statistics for an endpoint

IngestionFilterFn prevents a value from being ingested by the iterator. It is executed on push. If ingest is false the value shouldn't be pushed. If protcol is true, the value is a protcol value

Converts a NATS message into some other type. Implementers are expected to: return [err, null] if the message callback is invoked with an error. return [err, null] if converting the message yielded an error, note that iterators will stop on the error, but callbacks will be presented with the error. return [null, T] if the conversion worked correctly

Value expressed as Nanoseconds - use the nanos(millis) function to convert millis to nanoseconds. Note that in some environments this could overflow.

ProtocolFilterFn allows filtering of values that shouldn't be presented to the iterator. ProtocolFilterFn is executed when a value is about to be presented

A reviver function

The stats of a service

Type alias for NATS core subscriptions

Subscription Options

Callback presented to the user with the converted type