Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as nats.deno from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.28.2/nats-base-client/internal_mod.ts";

§Namespaces

nkeys

§Classes

Bench
Bucket
Connect
DataBuffer
DenoBuffer
Heartbeat
Metric
MsgHdrsImpl
MsgImpl
MuxSubscription
NatsConnectionImpl
NatsError
nkeys.NKeysError
Nuid

Create and initialize a nuid.

Parser
Perf
ProtocolHandler
QueuedIteratorImpl
RequestOne
ServiceError
SubscriptionImpl
Subscriptions
TypedSubscription

TypedSubscription wraps a subscription to provide payload specific subscription semantics. That is messages are a transport for user data, and the data is presented as application specific data to the client.

§Enums

DebugEvents

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

ErrorCode
Events

Events reported by the {@link NatsConnection#status} iterator.

Kind
Match
nkeys.NKeysErrorCode

Possible error codes on exceptions thrown by the library.

nkeys.Prefix
RequestStrategy
ServiceResponseType
ServiceVerb
State

§Variables

Empty
INFO
MAX_SIZE
nuid
ServiceErrorCodeHeader
ServiceErrorHeader
TD
TE

§Functions

backoff

Returns a Backoff with the specified interval policy set.

Base64KeyCodec
buildAuthenticator
canonicalMIMEHeaderKey
checkOptions
checkUnsupportedOption
collect
compare
createInbox
credsAuthenticator

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

deadline
defaultBucketOpts
deferred

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

delay
extend
extractProtocolMessage
getResolveFn
headers
isIP
isNatsError
JSONCodec

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.

jwtAuthenticator

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

millis

Convert the specified Nanos into millis

nanos

Converts the specified millis into Nanos

nkeyAuthenticator

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

nkeys.createAccount

Creates a KeyPair with an account prefix

nkeys.createOperator

Creates a KeyPair with an operator prefix

nkeys.createPair
nkeys.createUser

Creates a KeyPair with an user prefix

nkeys.decode

Decode a base64 encoded string to a binary Uint8Array

nkeys.encode

Encode binary data to a base64 string

nkeys.fromPublic

Creates a KeyPair from a specified public key

nkeys.fromSeed

Creates a KeyPair from a specified seed.

NoopKvCodecs
parseIP
parseSemVer
readAll
render
setTransportFactory
StringCodec

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

syncIterator

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.

timeout
tokenAuthenticator

Returns a token authenticator for the specified token

usernamePasswordAuthenticator

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

writeAll

§Interfaces

ApiError
Authenticator

Authenticator is an interface that returns credentials.

Backoff
BenchOpts
Codec
ConnectionOptions
Deferred
Delay
Dispatcher
JwtAuth
Msg

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

MsgHdrs
NatsConnection
NKeyAuth
nkeys.KeyPair
ParserEvent
PH
Publisher
PublishOptions
QueuedIterator
Request
RequestManyOptions
RequestOptions
Server
ServerInfo

ServerInfo represents information from the connected server

ServersChanged

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

Service
ServiceClient
ServiceGroup
ServiceMsg
ServiceResponse
ServicesAPI
Stats
Status
Sub

Basic interface to a Subscription type

SubOpts

Subscription Options

Timeout
TlsOptions

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.

TokenAuth
Transport
TransportFactory
TypedSubscriptionOptions
UserPass

§Type Aliases

Auth
DispatchedFn

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.

Endpoint

A service Endpoint

EndpointInfo
EndpointOptions
EndpointStats

Statistics for an endpoint

IngestionFilterFn

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

IngestionFilterFnResult
MsgAdapter

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

NamedEndpointStats
Nanos

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

NoAuth
Payload
ProtocolFilterFn

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

ReviverFn

A reviver function

SemVer
ServiceConfig
ServiceHandler
ServiceIdentity
ServiceInfo
ServiceMetadata
ServiceStats

The stats of a service

Subscription

Type alias for NATS core subscriptions

SubscriptionOptions

Subscription Options

SyncIterator
TypedCallback

Callback presented to the user with the converted type