@probitas/expect
Type-safe expectation library for Probitas scenario testing with specialized assertions for various client types.
This module provides a unified expect() function that automatically dispatches to the appropriate
expectation based on the input type, along with specialized expectations for each client type.
Features
- Type-safe expectations: Compile-time safety with TypeScript
- Unified API: Single
expect()function that dispatches to specialized expectations - Client-specific assertions: Tailored expectations for HTTP, GraphQL, SQL, Redis, MongoDB, and more
- Method chaining: Fluent API for readable test assertions
- Consistent naming: All methods follow
toBeXxxortoHaveXxxpatterns - Generic fallback: Chainable wrapper for @std/expect matchers
Usage
Unified expect Function
The expect() function automatically dispatches to the appropriate expectation based on the input type:
Installation
deno add jsr:@probitas/expectClasses
#ConnectRpcError
class ConnectRpcError extends ClientErrorClientErrorError class for ConnectRPC/gRPC errors.
Use statusCode to distinguish between different gRPC error codes.
| Name | Description |
|---|---|
name | — |
kind | — |
statusCode | — |
statusMessage | — |
metadata | — |
details | — |
Constructor
new ConnectRpcError(
message: string,
statusCode: ConnectRpcStatusCode,
statusMessage: string,
options?: ConnectRpcErrorOptions,
)Properties
- readonly
namestring - readonly
kind"connectrpc" - readonly
statusMessagestring - readonly
metadataHeaders | null
#ConnectRpcNetworkError
class ConnectRpcNetworkError extends ClientErrorClientErrorError thrown when a network-level failure occurs.
This error indicates that the request could not be processed by the server due to network issues (connection refused, DNS resolution failure, timeout, etc.). Unlike ConnectRpcError, this error means the server was never reached.
Constructor
new ConnectRpcNetworkError(message: string, options?: ErrorOptions)Properties
- readonly
namestring - readonly
kind"connectrpc"
#ConstraintError
class ConstraintError extends SqlErrorSqlErrorError thrown when a constraint violation occurs.
| Name | Description |
|---|---|
name | — |
kind | — |
constraint | — |
Constructor
new ConstraintError(
message: string,
constraint: string,
options?: SqlErrorOptions,
)Properties
- readonly
namestring - readonly
kind"constraint" - readonly
constraintstring
#DeadlockError
class DeadlockError extends SqlErrorSqlErrorError thrown when a deadlock is detected.
Constructor
new DeadlockError(message: string, options?: SqlErrorOptions)Properties
- readonly
namestring - readonly
kind"deadlock"
#DenoKvAtomicBuilderImpl
class DenoKvAtomicBuilderImpl implements DenoKvAtomicBuilderDenoKvAtomicBuilderImplementation of DenoKvAtomicBuilder.
Constructor
new DenoKvAtomicBuilderImpl(kv: Deno.Kv, options?: AtomicBuilderOptions)Methods
check(): unknownset(): unknowndelete(): unknownsum(): unknownmin(): unknownmax(): unknowncommit(): unknown#DenoKvConnectionError
class DenoKvConnectionError extends DenoKvErrorDenoKvErrorError thrown when a connection to Deno KV fails.
This typically occurs when:
- Network errors prevent reaching Deno Deploy KV
- Authentication/authorization fails
- Service is unavailable
Constructor
new DenoKvConnectionError(message: string, options?: ErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#DenoKvError
class DenoKvError extends ClientErrorClientErrorBase error class for Deno KV operations.
Use the kind property to distinguish between error types:
"kv": General KV operation error"quota": Quota limit exceeded"connection": Network/connection failure
| Name | Description |
|---|---|
name | — |
Constructor
new DenoKvError(message: string, _: unknown, options?: ErrorOptions)Properties
- readonly
namestring
#ExpectationError
class ExpectationError extends ErrorErrorCustom error class for expectation failures.
This class is used to identify expectation errors and format them differently from regular errors (e.g., without "Error:" prefix in reporters).
Constructor
new ExpectationError(message: string)#GraphqlExecutionError
class GraphqlExecutionError extends ClientErrorClientErrorError thrown for GraphQL execution errors.
This error is returned when the GraphQL server processes the request but returns errors in the response (validation errors, resolver errors, etc.).
Constructor
new GraphqlExecutionError(
errors: readonly GraphqlErrorItem[],
options?: ErrorOptions,
)Properties
- readonly
namestring - readonly
kind"graphql" GraphQL errors from response
#GraphqlNetworkError
class GraphqlNetworkError extends ClientErrorClientErrorError thrown for network-level failures.
This error indicates that the request could not reach or be processed by the GraphQL server (connection refused, HTTP errors, etc.).
Constructor
new GraphqlNetworkError(message: string, options?: ErrorOptions)Properties
- readonly
namestring - readonly
kind"network"
#HttpError
class HttpError extends ClientErrorClientErrorHTTP error class for non-2xx responses.
This error is thrown (or returned in response.error) when the server responds with a 4xx or 5xx status code. It includes the response body for inspecting error details.
Examples
Check status code and body
import { createHttpClient, HttpError } from "@probitas/client-http";
const http = createHttpClient({ url: "http://localhost:3000", throwOnError: true });
try {
await http.get("/not-found");
} catch (error) {
if (error instanceof HttpError && error.status === 404) {
console.log("Not found:", error.text);
}
}
| Name | Description |
|---|---|
name | — |
kind | — |
status | HTTP status code |
statusText | HTTP status text |
headers | Response headers (null if not available) |
body() | Response body as raw bytes (null if no body) |
arrayBuffer() | Get body as ArrayBuffer (null if no body) |
blob() | Get body as Blob (null if no body) |
text() | Get body as text (null if no body) |
json() | Get body as parsed JSON (null if no body). |
Constructor
new HttpError(status: number, statusText: string, options?: HttpErrorOptions)Properties
- readonly
namestring - readonly
kind"http" - readonly
statusnumberHTTP status code
- readonly
statusTextstringHTTP status text
- readonly
headersHeaders | nullResponse headers (null if not available)
Methods
body(): unknownResponse body as raw bytes (null if no body)
arrayBuffer(): unknownGet body as ArrayBuffer (null if no body)
blob(): unknownGet body as Blob (null if no body)
text(): unknownGet body as text (null if no body)
json(): unknownGet body as parsed JSON (null if no body).
#HttpNetworkError
class HttpNetworkError extends ClientErrorClientErrorError thrown when a network-level failure occurs.
This error indicates that the request could not be processed by the server due to network issues (connection refused, DNS resolution failure, etc.).
Constructor
new HttpNetworkError(message: string, options?: ErrorOptions)Properties
- readonly
namestring - readonly
kind"network"
#MongoConnectionError
class MongoConnectionError extends MongoErrorMongoErrorError thrown when a MongoDB connection cannot be established.
Constructor
new MongoConnectionError(message: string, options?: MongoErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#MongoDuplicateKeyError
class MongoDuplicateKeyError extends MongoErrorMongoErrorError thrown when a duplicate key constraint is violated.
| Name | Description |
|---|---|
name | — |
kind | — |
keyPattern | — |
keyValue | — |
Constructor
new MongoDuplicateKeyError(
message: string,
keyPattern: Record<string, number>,
keyValue: Record<string, unknown>,
options?: MongoErrorOptions,
)Properties
- readonly
namestring - readonly
kind"duplicate_key" - readonly
keyPatternRecord<string, number> - readonly
keyValueRecord<string, unknown>
#MongoError
class MongoError extends ClientErrorClientErrorBase error class for MongoDB client errors.
Constructor
new MongoError(message: string, _: unknown, options?: MongoErrorOptions)Properties
- readonly
namestring - readonly
code?number
#MongoNotFoundError
class MongoNotFoundError extends MongoErrorMongoErrorError thrown when a document is not found (for firstOrThrow, lastOrThrow).
Constructor
new MongoNotFoundError(message: string, options?: MongoErrorOptions)Properties
- readonly
namestring - readonly
kind"not_found"
#MongoQueryError
class MongoQueryError extends MongoErrorMongoErrorError thrown when a MongoDB query fails.
| Name | Description |
|---|---|
name | — |
kind | — |
collection | — |
Constructor
new MongoQueryError(
message: string,
collection: string,
options?: MongoErrorOptions,
)Properties
- readonly
namestring - readonly
kind"query" - readonly
collectionstring
#MongoValidationError
class MongoValidationError extends MongoErrorMongoErrorError thrown when document validation fails.
| Name | Description |
|---|---|
name | — |
kind | — |
validationErrors | — |
Constructor
new MongoValidationError(
message: string,
validationErrors: readonly string[],
options?: MongoErrorOptions,
)Properties
- readonly
namestring - readonly
kind"validation" - readonly
validationErrorsreadonly string[]
#MongoWriteError
class MongoWriteError extends MongoErrorMongoErrorError thrown when a write operation fails.
| Name | Description |
|---|---|
name | — |
kind | — |
writeErrors | — |
Constructor
new MongoWriteError(
message: string,
writeErrors: readonly { index: number; code: number; message: string }[],
options?: MongoErrorOptions,
)Properties
- readonly
namestring - readonly
kind"write" - readonly
writeErrorsreadonly { index: number; code: number; message: string }[]
#QuerySyntaxError
class QuerySyntaxError extends SqlErrorSqlErrorError thrown when a SQL query has syntax errors.
Constructor
new QuerySyntaxError(message: string, options?: SqlErrorOptions)Properties
- readonly
namestring - readonly
kind"query"
#RabbitMqChannelError
class RabbitMqChannelError extends RabbitMqErrorRabbitMqErrorError thrown when a RabbitMQ channel operation fails.
Constructor
new RabbitMqChannelError(message: string, options?: RabbitMqChannelErrorOptions)Properties
- readonly
namestring - readonly
kind"channel" - readonly
channelId?number
#RabbitMqConnectionError
class RabbitMqConnectionError extends RabbitMqErrorRabbitMqErrorError thrown when a RabbitMQ connection cannot be established.
Constructor
new RabbitMqConnectionError(message: string, options?: RabbitMqErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#RabbitMqError
class RabbitMqError extends ClientErrorClientErrorBase error class for RabbitMQ client errors.
Constructor
new RabbitMqError(message: string, _: unknown, options?: RabbitMqErrorOptions)Properties
- readonly
namestring - readonly
code?number
#RabbitMqNotFoundError
class RabbitMqNotFoundError extends RabbitMqErrorRabbitMqErrorError thrown when a RabbitMQ resource (queue or exchange) is not found.
Constructor
new RabbitMqNotFoundError(
message: string,
options: RabbitMqNotFoundErrorOptions,
)Properties
- readonly
namestring - readonly
kind"not_found" - readonly
resourcestring
#RabbitMqPreconditionFailedError
class RabbitMqPreconditionFailedError extends RabbitMqErrorRabbitMqErrorError thrown when a RabbitMQ precondition check fails.
Constructor
new RabbitMqPreconditionFailedError(
message: string,
options: RabbitMqPreconditionFailedErrorOptions,
)Properties
- readonly
namestring - readonly
kind"precondition_failed" - readonly
reasonstring
#RedisCommandError
class RedisCommandError extends RedisErrorRedisErrorError thrown when a Redis command fails.
Constructor
new RedisCommandError(message: string, options: RedisCommandErrorOptions)Properties
- readonly
namestring - readonly
kind"command" - readonly
commandstring
#RedisConnectionError
class RedisConnectionError extends RedisErrorRedisErrorError thrown when a Redis connection cannot be established.
Constructor
new RedisConnectionError(message: string, options?: RedisErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#RedisError
class RedisError extends ClientErrorClientErrorBase error class for Redis client errors.
Constructor
new RedisError(message: string, _: unknown, options?: RedisErrorOptions)Properties
- readonly
namestring - readonly
code?string
#RedisScriptError
class RedisScriptError extends RedisErrorRedisErrorError thrown when a Redis Lua script fails.
Constructor
new RedisScriptError(message: string, options: RedisScriptErrorOptions)Properties
- readonly
namestring - readonly
kind"script" - readonly
scriptstring
#SqlConnectionError
class SqlConnectionError extends SqlErrorSqlErrorError thrown when a connection or network-level error occurs.
This includes:
- Connection refused (server not running)
- Authentication failure
- Connection timeout
- Pool exhaustion
- TLS handshake failure
- DNS resolution failure
Constructor
new SqlConnectionError(message: string, options?: SqlErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#SqlError
class SqlError extends ClientErrorClientErrorBase error class for SQL-specific errors. Extends ClientError with SQL-specific properties.
Constructor
new SqlError(message: string, kind: SqlErrorKind, options?: SqlErrorOptions)Properties
- readonly
namestring - readonly
sqlStatestring | null
#SqsBatchError
class SqsBatchError extends SqsErrorSqsErrorError thrown when a batch operation partially fails.
| Name | Description |
|---|---|
name | — |
kind | — |
failedCount | — |
Constructor
new SqsBatchError(
message: string,
failedCount: number,
options?: SqsErrorOptions,
)Properties
- readonly
namestring - readonly
kind"batch" - readonly
failedCountnumber
#SqsCommandError
class SqsCommandError extends SqsErrorSqsErrorError thrown when an SQS command fails.
Constructor
new SqsCommandError(message: string, options: SqsCommandErrorOptions)Properties
- readonly
namestring - readonly
kind"command" - readonly
operationstring
#SqsConnectionError
class SqsConnectionError extends SqsErrorSqsErrorError thrown when an SQS connection cannot be established.
Constructor
new SqsConnectionError(message: string, options?: SqsErrorOptions)Properties
- readonly
namestring - readonly
kind"connection"
#SqsError
class SqsError extends ClientErrorClientErrorBase error class for SQS client errors.
Constructor
new SqsError(message: string, _: unknown, options?: SqsErrorOptions)Properties
- readonly
namestring - readonly
code?string
#SqsMessageNotFoundError
class SqsMessageNotFoundError extends SqsErrorSqsErrorError thrown when a message is not found or receipt handle is invalid.
Constructor
new SqsMessageNotFoundError(message: string, options?: SqsErrorOptions)Properties
- readonly
namestring - readonly
kind"message_not_found"
#SqsMessageTooLargeError
class SqsMessageTooLargeError extends SqsErrorSqsErrorError thrown when a message exceeds the size limit.
Constructor
new SqsMessageTooLargeError(
message: string,
size: number,
maxSize: number,
options?: SqsErrorOptions,
)Properties
- readonly
namestring - readonly
kind"message_too_large" - readonly
sizenumber - readonly
maxSizenumber
#SqsQueueNotFoundError
class SqsQueueNotFoundError extends SqsErrorSqsErrorError thrown when a queue is not found.
Constructor
new SqsQueueNotFoundError(
message: string,
queueUrl: string,
options?: SqsErrorOptions,
)Properties
- readonly
namestring - readonly
kind"queue_not_found" - readonly
queueUrlstring
Interfaces
#AnythingExpectation
interface AnythingExpectationChainable expectation interface for any value using @std/expect matchers.
Unlike @std/expect which returns void from matchers, this interface returns
this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBe() | Asserts that the value is strictly equal (`===`) to the expected value. |
toEqual() | Asserts that the value is deeply equal to the expected value. |
toStrictEqual() | Asserts that the value is strictly deeply equal to the expected value. |
toMatch() | Asserts that the string matches the expected pattern. |
toMatchObject() | Asserts that the object matches a subset of properties. |
toBeDefined() | Asserts that the value is not `undefined`. |
toBeUndefined() | Asserts that the value is `undefined`. |
toBeNull() | Asserts that the value is `null`. |
toBeNaN() | Asserts that the value is `NaN`. |
toBeTruthy() | Asserts that the value is truthy (not `false`, `0`, `""`, `null`, `undefined`, or `NaN`). |
toBeFalsy() | Asserts that the value is falsy (`false`, `0`, `""`, `null`, `undefined`, or `NaN`). |
toContain() | Asserts that an array or string contains the expected item or substring. |
toContainEqual() | Asserts that an array contains an item equal to the expected value. |
toHaveLength() | Asserts that the array or string has the expected length. |
toBeGreaterThan() | Asserts that the number is greater than the expected value. |
toBeGreaterThanOrEqual() | Asserts that the number is greater than or equal to the expected value. |
toBeLessThan() | Asserts that the number is less than the expected value. |
toBeLessThanOrEqual() | Asserts that the number is less than or equal to the expected value. |
toBeCloseTo() | Asserts that the number is close to the expected value within a certain precision. |
toBeInstanceOf() | Asserts that the value is an instance of the expected class. |
toThrow() | Asserts that a function throws an error matching the expected pattern. |
toHaveProperty() | Asserts that the object has a property at the specified path. |
toHaveBeenCalled() | Asserts that a mock function was called at least once. |
toHaveBeenCalledTimes() | Asserts that a mock function was called exactly the specified number of times. |
toHaveBeenCalledWith() | Asserts that a mock function was called with the specified arguments. |
toHaveBeenLastCalledWith() | Asserts that a mock function was last called with the specified arguments. |
toHaveBeenNthCalledWith() | Asserts that the nth call of a mock function was with the specified arguments. |
toHaveReturned() | Asserts that a mock function returned successfully at least once. |
toHaveReturnedTimes() | Asserts that a mock function returned successfully the specified number of times. |
toHaveReturnedWith() | Asserts that a mock function returned the specified value at least once. |
toHaveLastReturnedWith() | Asserts that a mock function last returned the specified value. |
toHaveNthReturnedWith() | Asserts that the nth call of a mock function returned the specified value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBe(expected: unknown): thisAsserts that the value is strictly equal (===) to the expected value.
Parameters
expectedunknown- The expected value
toEqual(expected: unknown): thisAsserts that the value is deeply equal to the expected value.
Parameters
expectedunknown- The expected value
toStrictEqual(expected: unknown): thisAsserts that the value is strictly deeply equal to the expected value.
Unlike toEqual, this checks object types and undefined properties.
Parameters
expectedunknown- The expected value
toMatch(expected: string | RegExp): thisAsserts that the string matches the expected pattern.
Parameters
expectedstring | RegExp- A string or RegExp pattern
toMatchObject(expected: Record<string, unknown>): thisAsserts that the object matches a subset of properties.
Parameters
expectedRecord<string, unknown>- An object containing expected properties
toBeDefined(): thisAsserts that the value is not undefined.
toBeUndefined(): thisAsserts that the value is undefined.
toBeNull(): thisAsserts that the value is null.
toBeNaN(): thisAsserts that the value is NaN.
toBeTruthy(): thisAsserts that the value is truthy (not false, 0, "", null, undefined, or NaN).
toBeFalsy(): thisAsserts that the value is falsy (false, 0, "", null, undefined, or NaN).
toContain(expected: unknown): thisAsserts that an array or string contains the expected item or substring.
Parameters
expectedunknown- The item or substring to check for
toContainEqual(expected: unknown): thisAsserts that an array contains an item equal to the expected value.
Parameters
expectedunknown- The item to check for equality
toHaveLength(expected: number): thisAsserts that the array or string has the expected length.
Parameters
expectednumber- The expected length
toBeGreaterThan(expected: number): thisAsserts that the number is greater than the expected value.
Parameters
expectednumber- The value to compare against
toBeGreaterThanOrEqual(expected: number): thisAsserts that the number is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toBeLessThan(expected: number): thisAsserts that the number is less than the expected value.
Parameters
expectednumber- The value to compare against
toBeLessThanOrEqual(expected: number): thisAsserts that the number is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toBeCloseTo(expected: number, numDigits?: number): thisAsserts that the number is close to the expected value within a certain precision.
Parameters
expectednumber- The expected value
numDigits?number- Number of decimal digits to check (default: 2)
toBeInstanceOf(expected: (_: any[]) => unknown): thisAsserts that the value is an instance of the expected class.
Parameters
expected(_: any[]) => unknown- The expected constructor/class
toThrow(expected?: string | RegExp | Error): thisAsserts that a function throws an error matching the expected pattern.
Parameters
expected?string | RegExp | Error- Optional string, RegExp, or Error to match
toHaveProperty(keyPath: string | string[], expectedValue?: unknown): thisAsserts that the object has a property at the specified path.
Parameters
keyPathstring | string[]- The property path (string or array of strings)
expectedValue?unknown- Optional expected value at the path
toHaveBeenCalled(): thisAsserts that a mock function was called at least once.
toHaveBeenCalledTimes(expected: number): thisAsserts that a mock function was called exactly the specified number of times.
Parameters
expectednumber- The expected number of calls
toHaveBeenCalledWith(_: unknown[]): thisAsserts that a mock function was called with the specified arguments.
Parameters
_unknown[]
toHaveBeenLastCalledWith(_: unknown[]): thisAsserts that a mock function was last called with the specified arguments.
Parameters
_unknown[]
toHaveBeenNthCalledWith(n: number, _: unknown[]): thisAsserts that the nth call of a mock function was with the specified arguments.
Parameters
nnumber- The call index (1-based)
_unknown[]
toHaveReturned(): thisAsserts that a mock function returned successfully at least once.
toHaveReturnedTimes(expected: number): thisAsserts that a mock function returned successfully the specified number of times.
Parameters
expectednumber- The expected number of successful returns
toHaveReturnedWith(expected: unknown): thisAsserts that a mock function returned the specified value at least once.
Parameters
expectedunknown- The expected return value
toHaveLastReturnedWith(expected: unknown): thisAsserts that a mock function last returned the specified value.
Parameters
expectedunknown- The expected return value
toHaveNthReturnedWith(n: number, expected: unknown): thisAsserts that the nth call of a mock function returned the specified value.
Parameters
nnumber- The call index (1-based)
expectedunknown- The expected return value
#AtomicBuilderOptions
interface AtomicBuilderOptionsOptions for atomic operations.
| Name | Description |
|---|---|
throwOnError | Whether to throw errors instead of returning them in the result. |
Properties
- readonly
throwOnError?booleanWhether to throw errors instead of returning them in the result.
#ConnectRpcClient
interface ConnectRpcClient extends AsyncDisposableConnectRPC client interface.
Field Name Conventions
This client automatically handles field name conversion between protobuf and JavaScript:
- Request fields: Accept both
snake_case(protobuf style) andcamelCase(JavaScript style) - Response fields: Converted to JavaScript conventions based on response type:
response.data: Plain JSON object withcamelCasefield names (no$typeName)response.raw: Original protobuf Message object with all metadata (includes$typeName)
Examples
const client = createConnectRpcClient({ url: "http://localhost:50051" });
// Request: Both formats work
await client.call("echo.Echo", "echoWithDelay", {
message: "hello",
delayMs: 100, // camelCase (recommended)
// delay_ms: 100, // snake_case also works
});
// Response: data is JSON, raw is protobuf Message
const response = await client.call("echo.Echo", "echo", { message: "test" });
console.log(response.data); // { message: "test", metadata: {...} }
console.log(response.raw); // { $typeName: "echo.EchoResponse", message: "test", ... }
| Name | Description |
|---|---|
config | Client configuration |
reflection | Reflection API (only available when schema: "reflection") |
call() | Make a unary RPC call. |
serverStream() | Make a server streaming RPC call. |
clientStream() | Make a client streaming RPC call. |
bidiStream() | Make a bidirectional streaming RPC call. |
close() | Close the client connection. |
Properties
Client configuration
Reflection API (only available when schema: "reflection")
Methods
call<TRequest>(
serviceName: string,
methodName: string,
request: TRequest,
options?: ConnectRpcOptions,
): Promise<ConnectRpcResponse>Make a unary RPC call.
Parameters
serviceNamestring- Service name (e.g., "echo.EchoService")
methodNamestring- Method name (e.g., "echo")
requestTRequest- Request message
options?ConnectRpcOptions- Call options
serverStream<TRequest>(
serviceName: string,
methodName: string,
request: TRequest,
options?: ConnectRpcOptions,
): AsyncIterable<ConnectRpcResponse>Make a server streaming RPC call.
Parameters
serviceNamestring- Service name
methodNamestring- Method name
requestTRequest- Request message
options?ConnectRpcOptions- Call options
clientStream<TRequest>(
serviceName: string,
methodName: string,
requests: AsyncIterable<TRequest>,
options?: ConnectRpcOptions,
): Promise<ConnectRpcResponse>Make a client streaming RPC call.
Parameters
serviceNamestring- Service name
methodNamestring- Method name
requestsAsyncIterable<TRequest>- Async iterable of request messages
options?ConnectRpcOptions- Call options
bidiStream<TRequest>(
serviceName: string,
methodName: string,
requests: AsyncIterable<TRequest>,
options?: ConnectRpcOptions,
): AsyncIterable<ConnectRpcResponse>Make a bidirectional streaming RPC call.
Parameters
serviceNamestring- Service name
methodNamestring- Method name
requestsAsyncIterable<TRequest>- Async iterable of request messages
options?ConnectRpcOptions- Call options
close(): Promise<void>Close the client connection.
#ConnectRpcClientConfig
interface ConnectRpcClientConfig extends CommonOptionsConfiguration for creating a ConnectRPC client.
| Name | Description |
|---|---|
url | Server URL for ConnectRPC connections. |
protocol | Protocol to use. |
httpVersion | HTTP version to use. |
tls | TLS configuration. |
metadata | Default metadata to send with every request. |
schema | Schema resolution configuration. |
useBinaryFormat | Whether to use binary format for messages. |
throwOnError | Whether to throw ConnectRpcError on non-OK responses (code !== 0) or failures. |
Properties
Server URL for ConnectRPC connections.
Can be a URL string or a connection configuration object.
Protocol to use.
HTTP version to use.
TLS configuration. If not provided, uses insecure credentials.
- readonly
metadata?HeadersInitDefault metadata to send with every request.
Schema resolution configuration.
- "reflection": Use Server Reflection to discover services dynamically (default)
- string: Path to FileDescriptorSet binary file (from
buf build --output set.binpb) - Uint8Array: FileDescriptorSet binary data
- FileDescriptorSet: Pre-parsed FileDescriptorSet message object
- readonly
useBinaryFormat?booleanWhether to use binary format for messages.
- readonly
throwOnError?booleanWhether to throw ConnectRpcError on non-OK responses (code !== 0) or failures. Can be overridden per-request via ConnectRpcOptions.throwOnError.
#ConnectRpcConnectionConfig
interface ConnectRpcConnectionConfig extends CommonConnectionConfigConnectRPC connection configuration.
Extends CommonConnectionConfig with ConnectRPC-specific options.
Properties
- readonly
protocol?"http" | "https"Protocol to use.
- readonly
path?stringService path prefix.
#ConnectRpcErrorOptions
interface ConnectRpcErrorOptions extends ErrorOptionsOptions for ConnectRpcError construction.
| Name | Description |
|---|---|
metadata | Headers/metadata from the ConnectRPC response. |
details | Rich error details from google.rpc.Status. |
Properties
- readonly
metadata?Headers | nullHeaders/metadata from the ConnectRPC response.
Rich error details from google.rpc.Status.
#ConnectRpcOptions
interface ConnectRpcOptions extends CommonOptionsOptions for individual ConnectRPC calls.
| Name | Description |
|---|---|
metadata | Metadata to send with the request. |
throwOnError | Whether to throw ConnectRpcError on non-OK responses (code !== 0) or failures. |
Properties
- readonly
metadata?HeadersInitMetadata to send with the request.
- readonly
throwOnError?booleanWhether to throw ConnectRpcError on non-OK responses (code !== 0) or failures. Overrides ConnectRpcClientConfig.throwOnError.
#ConnectRpcResponseError
interface ConnectRpcResponseError<T = any> extends ConnectRpcResponseBase<T>ConnectRPC response with gRPC error (statusCode !== 0).
The server processed the request but returned an error status.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
statusCode | gRPC status code (1-16). |
statusMessage | Status message describing the error. |
headers | Response headers. |
trailers | Response trailers (sent at end of RPC). |
raw | Raw ConnectError. |
data | No data for error responses. |
Properties
- readonly
processedtrue - readonly
okfalse gRPC status code (1-16).
- readonly
statusMessagestringStatus message describing the error.
- readonly
headersHeadersResponse headers.
- readonly
trailersHeadersResponse trailers (sent at end of RPC).
- readonly
rawConnectErrorRaw ConnectError.
- readonly
datanullNo data for error responses.
#ConnectRpcResponseErrorParams
interface ConnectRpcResponseErrorParamsParameters for creating an error ConnectRpcResponse.
Properties
- readonly
errorConnectError - readonly
headersHeaders - readonly
trailersHeaders - readonly
durationnumber
#ConnectRpcResponseExpectation
interface ConnectRpcResponseExpectationFluent assertion interface for ConnectRpcResponse.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the response is successful (code 0). |
toHaveStatusCode() | Asserts that the code equals the expected value. |
toHaveStatusCodeEqual() | Asserts that the code equals the expected value using deep equality. |
toHaveStatusCodeStrictEqual() | Asserts that the code strictly equals the expected value. |
toHaveStatusCodeSatisfying() | Asserts that the code satisfies the provided matcher function. |
toHaveStatusCodeNaN() | Asserts that the code is NaN. |
toHaveStatusCodeGreaterThan() | Asserts that the code is greater than the expected value. |
toHaveStatusCodeGreaterThanOrEqual() | Asserts that the code is greater than or equal to the expected value. |
toHaveStatusCodeLessThan() | Asserts that the code is less than the expected value. |
toHaveStatusCodeLessThanOrEqual() | Asserts that the code is less than or equal to the expected value. |
toHaveStatusCodeCloseTo() | Asserts that the code is close to the expected value. |
toHaveStatusCodeOneOf() | Asserts that the code is one of the specified values. |
toHaveStatusMessage() | Asserts that the message equals the expected value. |
toHaveStatusMessageEqual() | Asserts that the message equals the expected value using deep equality. |
toHaveStatusMessageStrictEqual() | Asserts that the message strictly equals the expected value. |
toHaveStatusMessageSatisfying() | Asserts that the message satisfies the provided matcher function. |
toHaveStatusMessageContaining() | Asserts that the message contains the specified substring. |
toHaveStatusMessageMatching() | Asserts that the message matches the specified regular expression. |
toHaveStatusMessagePresent() | Asserts that the message is present (not null or undefined). |
toHaveStatusMessageNull() | Asserts that the message is null. |
toHaveStatusMessageUndefined() | Asserts that the message is undefined. |
toHaveStatusMessageNullish() | Asserts that the message is nullish (null or undefined). |
toHaveHeaders() | Asserts that the headers equal the expected value. |
toHaveHeadersEqual() | Asserts that the headers equal the expected value using deep equality. |
toHaveHeadersStrictEqual() | Asserts that the headers strictly equal the expected value. |
toHaveHeadersSatisfying() | Asserts that the headers satisfy the provided matcher function. |
toHaveHeadersMatching() | Asserts that the headers match the specified subset. |
toHaveHeadersProperty() | Asserts that the headers have the specified property. |
toHaveHeadersPropertyContaining() | Asserts that the headers property contains the expected value. |
toHaveHeadersPropertyMatching() | Asserts that the headers property matches the specified subset. |
toHaveHeadersPropertySatisfying() | Asserts that the headers property satisfies the provided matcher function. |
toHaveTrailers() | Asserts that the trailers equal the expected value. |
toHaveTrailersEqual() | Asserts that the trailers equal the expected value using deep equality. |
toHaveTrailersStrictEqual() | Asserts that the trailers strictly equal the expected value. |
toHaveTrailersSatisfying() | Asserts that the trailers satisfy the provided matcher function. |
toHaveTrailersMatching() | Asserts that the trailers match the specified subset. |
toHaveTrailersProperty() | Asserts that the trailers have the specified property. |
toHaveTrailersPropertyContaining() | Asserts that the trailers property contains the expected value. |
toHaveTrailersPropertyMatching() | Asserts that the trailers property matches the specified subset. |
toHaveTrailersPropertySatisfying() | Asserts that the trailers property satisfies the provided matcher function. |
toHaveData() | Asserts that the data equals the expected value. |
toHaveDataEqual() | Asserts that the data equals the expected value using deep equality. |
toHaveDataStrictEqual() | Asserts that the data strictly equals the expected value. |
toHaveDataSatisfying() | Asserts that the data satisfies the provided matcher function. |
toHaveDataPresent() | Asserts that the data is present (not null or undefined). |
toHaveDataNull() | Asserts that the data is null. |
toHaveDataUndefined() | Asserts that the data is undefined. |
toHaveDataNullish() | Asserts that the data is nullish (null or undefined). |
toHaveDataMatching() | Asserts that the data matches the specified subset. |
toHaveDataProperty() | Asserts that the data has the specified property. |
toHaveDataPropertyContaining() | Asserts that the data property contains the expected value. |
toHaveDataPropertyMatching() | Asserts that the data property matches the specified subset. |
toHaveDataPropertySatisfying() | Asserts that the data property satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the response is successful (code 0).
toHaveStatusCode(expected: unknown): thisAsserts that the code equals the expected value.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeEqual(expected: unknown): thisAsserts that the code equals the expected value using deep equality.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeStrictEqual(expected: unknown): thisAsserts that the code strictly equals the expected value.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeSatisfying(
matcher: (value: ConnectRpcStatusCode) => unknown,
): thisAsserts that the code satisfies the provided matcher function.
Parameters
matcher(value: ConnectRpcStatusCode) => unknown- A function that receives the code and performs assertions
toHaveStatusCodeNaN(): thisAsserts that the code is NaN.
toHaveStatusCodeGreaterThan(expected: number): thisAsserts that the code is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeGreaterThanOrEqual(expected: number): thisAsserts that the code is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeLessThan(expected: number): thisAsserts that the code is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeLessThanOrEqual(expected: number): thisAsserts that the code is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeCloseTo(expected: number, numDigits?: number): thisAsserts that the code is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveStatusCodeOneOf(values: unknown[]): thisAsserts that the code is one of the specified values.
Parameters
valuesunknown[]- Array of acceptable values
toHaveStatusMessage(expected: unknown): thisAsserts that the message equals the expected value.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageEqual(expected: unknown): thisAsserts that the message equals the expected value using deep equality.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageStrictEqual(expected: unknown): thisAsserts that the message strictly equals the expected value.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageSatisfying(matcher: (value: string) => unknown): thisAsserts that the message satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the message and performs assertions
toHaveStatusMessageContaining(substr: string): thisAsserts that the message contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveStatusMessageMatching(expected: RegExp): thisAsserts that the message matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveStatusMessagePresent(): thisAsserts that the message is present (not null or undefined).
toHaveStatusMessageNull(): thisAsserts that the message is null.
toHaveStatusMessageUndefined(): thisAsserts that the message is undefined.
toHaveStatusMessageNullish(): thisAsserts that the message is nullish (null or undefined).
toHaveHeaders(expected: unknown): thisAsserts that the headers equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersEqual(expected: unknown): thisAsserts that the headers equal the expected value using deep equality.
Parameters
expectedunknown- The expected headers value
toHaveHeadersStrictEqual(expected: unknown): thisAsserts that the headers strictly equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersSatisfying(matcher: (value: ConnectRpcHeaders) => unknown): thisAsserts that the headers satisfy the provided matcher function.
Parameters
matcher(value: ConnectRpcHeaders) => unknown- A function that receives the headers and performs assertions
toHaveHeadersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the headers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveHeadersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the headers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveHeadersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the headers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveTrailers(expected: unknown): thisAsserts that the trailers equal the expected value.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersEqual(expected: unknown): thisAsserts that the trailers equal the expected value using deep equality.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersStrictEqual(expected: unknown): thisAsserts that the trailers strictly equal the expected value.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersSatisfying(matcher: (value: ConnectRpcTrailers) => unknown): thisAsserts that the trailers satisfy the provided matcher function.
Parameters
matcher(value: ConnectRpcTrailers) => unknown- A function that receives the trailers and performs assertions
toHaveTrailersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the trailers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveTrailersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the trailers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveTrailersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the trailers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveTrailersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the trailers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveTrailersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the trailers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveData(expected: unknown): thisAsserts that the data equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataEqual(expected: unknown): thisAsserts that the data equals the expected value using deep equality.
Parameters
expectedunknown- The expected data value
toHaveDataStrictEqual(expected: unknown): thisAsserts that the data strictly equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataSatisfying(
matcher: (value: Record<string, any> | null) => unknown,
): thisAsserts that the data satisfies the provided matcher function.
Parameters
matcher(value: Record<string, any> | null) => unknown- A function that receives the data and performs assertions
toHaveDataPresent(): thisAsserts that the data is present (not null or undefined).
toHaveDataNull(): thisAsserts that the data is null.
toHaveDataUndefined(): thisAsserts that the data is undefined.
toHaveDataNullish(): thisAsserts that the data is nullish (null or undefined).
toHaveDataMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataProperty(keyPath: string | string[], value?: unknown): thisAsserts that the data has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveDataPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the data property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveDataPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the data property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#ConnectRpcResponseFailure
interface ConnectRpcResponseFailure<T = any> extends ConnectRpcResponseBase<T>Failed ConnectRPC request (network error, connection refused, etc.).
The request did not reach gRPC processing.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
statusCode | Status code (null for network failures). |
statusMessage | Status message (null for network failures). |
headers | Response headers (null for failures). |
trailers | Response trailers (null for failures). |
raw | No raw response (request didn't reach server). |
data | No data (request didn't reach server). |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
statusCodenullStatus code (null for network failures).
- readonly
statusMessagenullStatus message (null for network failures).
- readonly
headersnullResponse headers (null for failures).
- readonly
trailersnullResponse trailers (null for failures).
- readonly
rawnullNo raw response (request didn't reach server).
- readonly
datanullNo data (request didn't reach server).
#ConnectRpcResponseFailureParams
interface ConnectRpcResponseFailureParamsParameters for creating a failure ConnectRpcResponse.
Properties
- readonly
durationnumber
#ConnectRpcResponseSuccess
interface ConnectRpcResponseSuccess<T = any> extends ConnectRpcResponseBase<T>Successful ConnectRPC response (statusCode === 0).
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
statusCode | gRPC status code (always 0 for success). |
statusMessage | Status message (null for successful responses). |
headers | Response headers. |
trailers | Response trailers (sent at end of RPC). |
raw | Raw protobuf Message object. |
data | Response data as plain JavaScript object (JSON representation). |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
statusCode0gRPC status code (always 0 for success).
- readonly
statusMessagenullStatus message (null for successful responses).
- readonly
headersHeadersResponse headers.
- readonly
trailersHeadersResponse trailers (sent at end of RPC).
- readonly
rawunknownRaw protobuf Message object.
- readonly
dataT | nullResponse data as plain JavaScript object (JSON representation).
#ConnectRpcResponseSuccessParams
interface ConnectRpcResponseSuccessParams<T = any>Parameters for creating a successful ConnectRpcResponse.
Properties
- readonly
responseT | null - readonly
schemaDescMessage | null - readonly
headersHeaders - readonly
trailersHeaders - readonly
durationnumber
#CookieConfig
interface CookieConfigCookie handling configuration.
| Name | Description |
|---|---|
disabled | Disable automatic cookie handling. |
initial | Initial cookies to populate the cookie jar. |
Properties
- readonly
disabled?booleanDisable automatic cookie handling. When disabled, cookies are not stored or sent automatically.
- readonly
initial?Record<string, string>Initial cookies to populate the cookie jar.
#DenoKvAtomicBuilder
interface DenoKvAtomicBuilderBuilder for atomic KV operations.
| Name | Description |
|---|---|
check() | Add version checks to the atomic operation. |
set() | Set a value in the KV store. |
delete() | Delete a key from the KV store. |
sum() | Atomically add to a bigint value (Deno.KvU64). |
min() | Atomically set to minimum of current and provided value. |
max() | Atomically set to maximum of current and provided value. |
commit() | Commit the atomic operation. |
Methods
check(_: Deno.AtomicCheck[]): thisAdd version checks to the atomic operation. If any check fails, the entire operation will fail.
Parameters
_Deno.AtomicCheck[]
set<T = any>(key: Deno.KvKey, value: T, options?: { expireIn?: number }): thisSet a value in the KV store.
Parameters
keyDeno.KvKeyvalueToptions?{ expireIn?: number }
delete(key: Deno.KvKey): thisDelete a key from the KV store.
Parameters
keyDeno.KvKey
sum(key: Deno.KvKey, n: bigint): thisAtomically add to a bigint value (Deno.KvU64).
Parameters
keyDeno.KvKeynbigint
min(key: Deno.KvKey, n: bigint): thisAtomically set to minimum of current and provided value.
Parameters
keyDeno.KvKeynbigint
max(key: Deno.KvKey, n: bigint): thisAtomically set to maximum of current and provided value.
Parameters
keyDeno.KvKeynbigint
commit(): Promise<DenoKvAtomicResult>Commit the atomic operation.
#DenoKvAtomicOptions
interface DenoKvAtomicOptions extends DenoKvOptionsOptions for atomic operations.
#DenoKvAtomicResultCheckFailed
interface DenoKvAtomicResultCheckFailed extends DenoKvAtomicResultBaseAtomic operation check failed (version mismatch).
This is NOT an error - it's an expected outcome when using optimistic concurrency. Retry the operation with updated versionstamps.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
errornull - readonly
versionstampnull
#DenoKvAtomicResultCommitted
interface DenoKvAtomicResultCommitted extends DenoKvAtomicResultBaseAtomic operation successfully committed.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
versionstampstring
#DenoKvAtomicResultError
interface DenoKvAtomicResultError extends DenoKvAtomicResultBaseAtomic operation failed with KV error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
versionstampnull
#DenoKvAtomicResultExpectation
interface DenoKvAtomicResultExpectationFluent API for validating DenoKvAtomicResult.
Provides chainable assertions specifically designed for Deno KV atomic operation results.
All assertion methods return this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveVersionstamp() | Asserts that the versionstamp equals the expected value. |
toHaveVersionstampEqual() | Asserts that the versionstamp equals the expected value using deep equality. |
toHaveVersionstampStrictEqual() | Asserts that the versionstamp strictly equals the expected value. |
toHaveVersionstampSatisfying() | Asserts that the versionstamp satisfies the provided matcher function. |
toHaveVersionstampContaining() | Asserts that the versionstamp contains the specified substring. |
toHaveVersionstampMatching() | Asserts that the versionstamp matches the specified regular expression. |
toHaveVersionstampPresent() | Asserts that the versionstamp is present (not null or undefined). |
toHaveVersionstampNull() | Asserts that the versionstamp is null. |
toHaveVersionstampUndefined() | Asserts that the versionstamp is undefined. |
toHaveVersionstampNullish() | Asserts that the versionstamp is nullish (null or undefined). |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveVersionstamp(expected: unknown): thisAsserts that the versionstamp equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampEqual(expected: unknown): thisAsserts that the versionstamp equals the expected value using deep equality.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampStrictEqual(expected: unknown): thisAsserts that the versionstamp strictly equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampSatisfying(matcher: (value: string) => unknown): thisAsserts that the versionstamp satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the versionstamp and performs assertions
toHaveVersionstampContaining(substr: string): thisAsserts that the versionstamp contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveVersionstampMatching(expected: RegExp): thisAsserts that the versionstamp matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveVersionstampPresent(): thisAsserts that the versionstamp is present (not null or undefined).
toHaveVersionstampNull(): thisAsserts that the versionstamp is null.
toHaveVersionstampUndefined(): thisAsserts that the versionstamp is undefined.
toHaveVersionstampNullish(): thisAsserts that the versionstamp is nullish (null or undefined).
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#DenoKvAtomicResultFailure
interface DenoKvAtomicResultFailure extends DenoKvAtomicResultBaseAtomic operation failed with connection error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
versionstampnull
#DenoKvClient
interface DenoKvClient extends AsyncDisposableDeno KV client for Probitas scenario testing.
| Name | Description |
|---|---|
config | Client configuration. |
get() | Get a single value by key. |
getMany() | Get multiple values by keys. |
set() | Set a value. |
delete() | Delete a key. |
list() | List entries by selector. |
atomic() | Create an atomic operation builder. |
close() | Close the KV connection. |
Properties
Client configuration.
Methods
get<T = any>(
key: Deno.KvKey,
options?: DenoKvGetOptions,
): Promise<DenoKvGetResult<T>>Get a single value by key.
Parameters
keyDeno.KvKeyoptions?DenoKvGetOptions
getMany<T extends readonly any[]>(
keys: readonly [unknown],
options?: DenoKvGetOptions,
): Promise<unknown>Get multiple values by keys.
Parameters
keysreadonly [unknown]options?DenoKvGetOptions
set<T = any>(
key: Deno.KvKey,
value: T,
options?: DenoKvSetOptions,
): Promise<DenoKvSetResult>Set a value.
Parameters
keyDeno.KvKeyvalueToptions?DenoKvSetOptions
delete(
key: Deno.KvKey,
options?: DenoKvDeleteOptions,
): Promise<DenoKvDeleteResult>Delete a key.
Parameters
keyDeno.KvKeyoptions?DenoKvDeleteOptions
list<T = any>(
selector: Deno.KvListSelector,
options?: DenoKvListOptions,
): Promise<DenoKvListResult<T>>List entries by selector.
Parameters
selectorDeno.KvListSelectoroptions?DenoKvListOptions
atomic(options?: DenoKvAtomicOptions): DenoKvAtomicBuilderCreate an atomic operation builder.
Parameters
options?DenoKvAtomicOptions
close(): Promise<void>Close the KV connection.
#DenoKvClientConfig
interface DenoKvClientConfig extends DenoKvOptionsConfiguration for DenoKvClient.
| Name | Description |
|---|---|
path | Path to the KV database file. |
Properties
- readonly
path?stringPath to the KV database file. If not specified, uses in-memory storage or Deno Deploy's KV.
#DenoKvDeleteOptions
interface DenoKvDeleteOptions extends DenoKvOptionsOptions for delete operations.
#DenoKvDeleteResultError
interface DenoKvDeleteResultError extends DenoKvDeleteResultBaseDelete operation result with KV error.
Properties
- readonly
processedtrue - readonly
okfalse
#DenoKvDeleteResultExpectation
interface DenoKvDeleteResultExpectationFluent API for validating DenoKvDeleteResult.
Provides chainable assertions specifically designed for Deno KV delete operation results.
All assertion methods return this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#DenoKvDeleteResultFailure
interface DenoKvDeleteResultFailure extends DenoKvDeleteResultBaseDelete operation result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#DenoKvDeleteResultSuccess
interface DenoKvDeleteResultSuccess extends DenoKvDeleteResultBaseSuccessful delete operation result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#DenoKvEntry
interface DenoKvEntry<T = any>A single entry in the KV store.
| Name | Description |
|---|---|
key | — |
value | — |
versionstamp | — |
Properties
- readonly
keyDeno.KvKey - readonly
valueT - readonly
versionstampstring
#DenoKvGetOptions
interface DenoKvGetOptions extends DenoKvOptionsOptions for get operations.
#DenoKvGetResultError
interface DenoKvGetResultError<T = any> extends DenoKvGetResultBase<T>Get operation result with KV error (quota exceeded, etc.).
Properties
- readonly
processedtrue - readonly
okfalse - readonly
keyDeno.KvKey - readonly
valuenull - readonly
versionstampnull
#DenoKvGetResultExpectation
interface DenoKvGetResultExpectation<_T = unknown>Fluent API for validating DenoKvGetResult.
Provides chainable assertions specifically designed for Deno KV get operation results.
All assertion methods return this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveKey() | Asserts that the key equals the expected value. |
toHaveKeyEqual() | Asserts that the key equals the expected value using deep equality. |
toHaveKeyStrictEqual() | Asserts that the key strictly equals the expected value. |
toHaveKeySatisfying() | Asserts that the key satisfies the provided matcher function. |
toHaveKeyContaining() | Asserts that the key array contains the specified item. |
toHaveKeyContainingEqual() | Asserts that the key array contains an item equal to the specified value. |
toHaveKeyMatching() | Asserts that the key array matches the specified subset. |
toHaveKeyEmpty() | Asserts that the key array is empty. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValuePresent() | Asserts that the value is present (not null or undefined). |
toHaveValueNull() | Asserts that the value is null. |
toHaveValueUndefined() | Asserts that the value is undefined. |
toHaveValueNullish() | Asserts that the value is nullish (null or undefined). |
toHaveValueMatching() | Asserts that the value matches the specified subset. |
toHaveValueProperty() | Asserts that the value has the specified property. |
toHaveValuePropertyContaining() | Asserts that the value property contains the expected value. |
toHaveValuePropertyMatching() | Asserts that the value property matches the specified subset. |
toHaveValuePropertySatisfying() | Asserts that the value property satisfies the provided matcher function. |
toHaveVersionstamp() | Asserts that the versionstamp equals the expected value. |
toHaveVersionstampEqual() | Asserts that the versionstamp equals the expected value using deep equality. |
toHaveVersionstampStrictEqual() | Asserts that the versionstamp strictly equals the expected value. |
toHaveVersionstampSatisfying() | Asserts that the versionstamp satisfies the provided matcher function. |
toHaveVersionstampContaining() | Asserts that the versionstamp contains the specified substring. |
toHaveVersionstampMatching() | Asserts that the versionstamp matches the specified regular expression. |
toHaveVersionstampPresent() | Asserts that the versionstamp is present (not null or undefined). |
toHaveVersionstampNull() | Asserts that the versionstamp is null. |
toHaveVersionstampUndefined() | Asserts that the versionstamp is undefined. |
toHaveVersionstampNullish() | Asserts that the versionstamp is nullish (null or undefined). |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveKey(expected: unknown): thisAsserts that the key equals the expected value.
Parameters
expectedunknown- The expected key value
toHaveKeyEqual(expected: unknown): thisAsserts that the key equals the expected value using deep equality.
Parameters
expectedunknown- The expected key value
toHaveKeyStrictEqual(expected: unknown): thisAsserts that the key strictly equals the expected value.
Parameters
expectedunknown- The expected key value
toHaveKeySatisfying(matcher: (value: DenoKvKey<_T>) => unknown): thisAsserts that the key satisfies the provided matcher function.
Parameters
matcher(value: DenoKvKey<_T>) => unknown- A function that receives the key and performs assertions
toHaveKeyContaining(item: unknown): thisAsserts that the key array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveKeyContainingEqual(item: unknown): thisAsserts that the key array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveKeyMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the key array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveKeyEmpty(): thisAsserts that the key array is empty.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: any) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the value and performs assertions
toHaveValuePresent(): thisAsserts that the value is present (not null or undefined).
toHaveValueNull(): thisAsserts that the value is null.
toHaveValueUndefined(): thisAsserts that the value is undefined.
toHaveValueNullish(): thisAsserts that the value is nullish (null or undefined).
toHaveValueMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the value matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveValueProperty(keyPath: string | string[], value?: unknown): thisAsserts that the value has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveValuePropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the value property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveValuePropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the value property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveValuePropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the value property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveVersionstamp(expected: unknown): thisAsserts that the versionstamp equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampEqual(expected: unknown): thisAsserts that the versionstamp equals the expected value using deep equality.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampStrictEqual(expected: unknown): thisAsserts that the versionstamp strictly equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampSatisfying(matcher: (value: string) => unknown): thisAsserts that the versionstamp satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the versionstamp and performs assertions
toHaveVersionstampContaining(substr: string): thisAsserts that the versionstamp contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveVersionstampMatching(expected: RegExp): thisAsserts that the versionstamp matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveVersionstampPresent(): thisAsserts that the versionstamp is present (not null or undefined).
toHaveVersionstampNull(): thisAsserts that the versionstamp is null.
toHaveVersionstampUndefined(): thisAsserts that the versionstamp is undefined.
toHaveVersionstampNullish(): thisAsserts that the versionstamp is nullish (null or undefined).
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#DenoKvGetResultFailure
interface DenoKvGetResultFailure<T = any> extends DenoKvGetResultBase<T>Get operation result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
keynull - readonly
valuenull - readonly
versionstampnull
#DenoKvGetResultSuccess
interface DenoKvGetResultSuccess<T = any> extends DenoKvGetResultBase<T>Successful get operation result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
keyDeno.KvKey - readonly
valueT | null - readonly
versionstampstring | null
#DenoKvListOptions
interface DenoKvListOptions extends DenoKvOptionsOptions for list operations.
| Name | Description |
|---|---|
limit | Maximum number of entries to return. |
cursor | Cursor for pagination. |
reverse | Whether to iterate in reverse order. |
Properties
- readonly
limit?numberMaximum number of entries to return.
- readonly
cursor?stringCursor for pagination.
- readonly
reverse?booleanWhether to iterate in reverse order.
#DenoKvListResultError
interface DenoKvListResultError<T = any> extends DenoKvListResultBase<T>List operation result with KV error.
Properties
- readonly
processedtrue - readonly
okfalse
#DenoKvListResultExpectation
interface DenoKvListResultExpectation<_T = unknown>Fluent API for validating DenoKvListResult.
Provides chainable assertions specifically designed for Deno KV list operation results.
All assertion methods return this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveEntries() | Asserts that the entries equal the expected value. |
toHaveEntriesEqual() | Asserts that the entries equal the expected value using deep equality. |
toHaveEntriesStrictEqual() | Asserts that the entries strictly equal the expected value. |
toHaveEntriesSatisfying() | Asserts that the entries satisfy the provided matcher function. |
toHaveEntriesContaining() | Asserts that the entries array contains the specified item. |
toHaveEntriesContainingEqual() | Asserts that the entries array contains an item equal to the specified value. |
toHaveEntriesMatching() | Asserts that the entries array matches the specified subset. |
toHaveEntriesEmpty() | Asserts that the entries array is empty. |
toHaveEntryCount() | Asserts that the entry count equals the expected value. |
toHaveEntryCountEqual() | Asserts that the entry count equals the expected value using deep equality. |
toHaveEntryCountStrictEqual() | Asserts that the entry count strictly equals the expected value. |
toHaveEntryCountSatisfying() | Asserts that the entry count satisfies the provided matcher function. |
toHaveEntryCountNaN() | Asserts that the entry count is NaN. |
toHaveEntryCountGreaterThan() | Asserts that the entry count is greater than the expected value. |
toHaveEntryCountGreaterThanOrEqual() | Asserts that the entry count is greater than or equal to the expected value. |
toHaveEntryCountLessThan() | Asserts that the entry count is less than the expected value. |
toHaveEntryCountLessThanOrEqual() | Asserts that the entry count is less than or equal to the expected value. |
toHaveEntryCountCloseTo() | Asserts that the entry count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveEntries(expected: unknown): thisAsserts that the entries equal the expected value.
Parameters
expectedunknown- The expected entries value
toHaveEntriesEqual(expected: unknown): thisAsserts that the entries equal the expected value using deep equality.
Parameters
expectedunknown- The expected entries value
toHaveEntriesStrictEqual(expected: unknown): thisAsserts that the entries strictly equal the expected value.
Parameters
expectedunknown- The expected entries value
toHaveEntriesSatisfying(matcher: (value: DenoKvEntries<_T>) => unknown): thisAsserts that the entries satisfy the provided matcher function.
Parameters
matcher(value: DenoKvEntries<_T>) => unknown- A function that receives the entries and performs assertions
toHaveEntriesContaining(item: unknown): thisAsserts that the entries array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveEntriesContainingEqual(item: unknown): thisAsserts that the entries array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveEntriesMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the entries array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveEntriesEmpty(): thisAsserts that the entries array is empty.
toHaveEntryCount(expected: unknown): thisAsserts that the entry count equals the expected value.
Parameters
expectedunknown- The expected entry count
toHaveEntryCountEqual(expected: unknown): thisAsserts that the entry count equals the expected value using deep equality.
Parameters
expectedunknown- The expected entry count
toHaveEntryCountStrictEqual(expected: unknown): thisAsserts that the entry count strictly equals the expected value.
Parameters
expectedunknown- The expected entry count
toHaveEntryCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the entry count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the entry count and performs assertions
toHaveEntryCountNaN(): thisAsserts that the entry count is NaN.
toHaveEntryCountGreaterThan(expected: number): thisAsserts that the entry count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveEntryCountGreaterThanOrEqual(expected: number): thisAsserts that the entry count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveEntryCountLessThan(expected: number): thisAsserts that the entry count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveEntryCountLessThanOrEqual(expected: number): thisAsserts that the entry count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveEntryCountCloseTo(expected: number, numDigits?: number): thisAsserts that the entry count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#DenoKvListResultFailure
interface DenoKvListResultFailure<T = any> extends DenoKvListResultBase<T>List operation result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#DenoKvListResultSuccess
interface DenoKvListResultSuccess<T = any> extends DenoKvListResultBase<T>Successful list operation result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#DenoKvOptions
interface DenoKvOptions extends CommonOptionsOptions for Deno KV operations.
Extends CommonOptions with error handling behavior configuration.
| Name | Description |
|---|---|
throwOnError | Whether to throw errors instead of returning them in the result. |
Properties
- readonly
throwOnError?booleanWhether to throw errors instead of returning them in the result.
false(default): Errors are returned in the result'serrorpropertytrue: Errors are thrown as exceptions
This applies to both KV errors (quota exceeded, etc.) and connection errors. Note: Atomic check failures are NOT errors and will never be thrown.
#DenoKvSetOptions
interface DenoKvSetOptions extends DenoKvOptionsOptions for set operations.
| Name | Description |
|---|---|
expireIn | Time-to-live in milliseconds. |
Properties
- readonly
expireIn?numberTime-to-live in milliseconds. The entry will automatically expire after this duration.
#DenoKvSetResultError
interface DenoKvSetResultError extends DenoKvSetResultBaseSet operation result with KV error (quota exceeded, etc.).
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
versionstampnull
#DenoKvSetResultExpectation
interface DenoKvSetResultExpectationFluent API for validating DenoKvSetResult.
Provides chainable assertions specifically designed for Deno KV set operation results.
All assertion methods return this to enable method chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveVersionstamp() | Asserts that the versionstamp equals the expected value. |
toHaveVersionstampEqual() | Asserts that the versionstamp equals the expected value using deep equality. |
toHaveVersionstampStrictEqual() | Asserts that the versionstamp strictly equals the expected value. |
toHaveVersionstampSatisfying() | Asserts that the versionstamp satisfies the provided matcher function. |
toHaveVersionstampContaining() | Asserts that the versionstamp contains the specified substring. |
toHaveVersionstampMatching() | Asserts that the versionstamp matches the specified regular expression. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveVersionstamp(expected: unknown): thisAsserts that the versionstamp equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampEqual(expected: unknown): thisAsserts that the versionstamp equals the expected value using deep equality.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampStrictEqual(expected: unknown): thisAsserts that the versionstamp strictly equals the expected value.
Parameters
expectedunknown- The expected versionstamp value
toHaveVersionstampSatisfying(matcher: (value: string) => unknown): thisAsserts that the versionstamp satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the versionstamp and performs assertions
toHaveVersionstampContaining(substr: string): thisAsserts that the versionstamp contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveVersionstampMatching(expected: RegExp): thisAsserts that the versionstamp matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#DenoKvSetResultFailure
interface DenoKvSetResultFailure extends DenoKvSetResultBaseSet operation result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
versionstampnull
#DenoKvSetResultSuccess
interface DenoKvSetResultSuccess extends DenoKvSetResultBaseSuccessful set operation result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
versionstamp | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
versionstampstring
#ErrorDetail
interface ErrorDetailRich error detail from google.rpc.Status.
ConnectRPC errors can include structured details encoded in error responses. These details follow the google.protobuf.Any format with a type URL and value.
Properties
- readonly
typeUrlstringType URL identifying the error detail type. Common types include:
- "type.googleapis.com/google.rpc.BadRequest"
- "type.googleapis.com/google.rpc.DebugInfo"
- "type.googleapis.com/google.rpc.RetryInfo"
- "type.googleapis.com/google.rpc.QuotaFailure"
- readonly
valueunknownDecoded error detail value. The structure depends on the typeUrl.
#GraphqlClient
interface GraphqlClient extends AsyncDisposableGraphQL client interface.
| Name | Description |
|---|---|
config | Client configuration |
query() | Execute a GraphQL query |
mutation() | Execute a GraphQL mutation |
execute() | Execute a GraphQL document (query or mutation) |
subscribe() | Subscribe to a GraphQL subscription via WebSocket |
close() | Close the client and release resources |
Properties
Client configuration
Methods
query<TData = any, TVariables = Record<string, any>>(
query: string,
variables?: TVariables,
options?: GraphqlOptions,
): Promise<GraphqlResponse<TData>>Execute a GraphQL query
Parameters
querystringvariables?TVariablesoptions?GraphqlOptions
mutation<TData = any, TVariables = Record<string, any>>(
mutation: string,
variables?: TVariables,
options?: GraphqlOptions,
): Promise<GraphqlResponse<TData>>Execute a GraphQL mutation
Parameters
mutationstringvariables?TVariablesoptions?GraphqlOptions
execute<TData = any, TVariables = Record<string, any>>(
document: string,
variables?: TVariables,
options?: GraphqlOptions,
): Promise<GraphqlResponse<TData>>Execute a GraphQL document (query or mutation)
Parameters
documentstringvariables?TVariablesoptions?GraphqlOptions
subscribe<TData = any, TVariables = Record<string, any>>(
document: string,
variables?: TVariables,
options?: GraphqlOptions,
): AsyncIterable<GraphqlResponse<TData>>Subscribe to a GraphQL subscription via WebSocket
Parameters
documentstringvariables?TVariablesoptions?GraphqlOptions
close(): Promise<void>Close the client and release resources
#GraphqlClientConfig
interface GraphqlClientConfig extends CommonOptionsGraphQL client configuration.
| Name | Description |
|---|---|
url | GraphQL endpoint URL. |
headers | Default headers for all requests |
wsEndpoint | WebSocket endpoint URL (for subscriptions) |
fetch | Custom fetch implementation (for testing/mocking) |
throwOnError | Whether to throw GraphqlError when response contains errors or request fails. |
Properties
GraphQL endpoint URL.
Can be a URL string or a connection configuration object.
- readonly
headers?HeadersInitDefault headers for all requests
- readonly
wsEndpoint?stringWebSocket endpoint URL (for subscriptions)
- readonly
fetch?fetchCustom fetch implementation (for testing/mocking)
- readonly
throwOnError?booleanWhether to throw GraphqlError when response contains errors or request fails. Can be overridden per-request via GraphqlOptions.
#GraphqlConnectionConfig
interface GraphqlConnectionConfig extends CommonConnectionConfigGraphQL connection configuration.
Extends CommonConnectionConfig with GraphQL-specific options.
Properties
- readonly
protocol?"http" | "https"Protocol to use.
- readonly
path?stringGraphQL endpoint path.
#GraphqlErrorItem
interface GraphqlErrorItemGraphQL error item as per GraphQL specification.
| Name | Description |
|---|---|
message | Error message |
locations | Location(s) in the GraphQL document where the error occurred |
path | Path to the field that caused the error |
extensions | Additional error metadata |
Properties
- readonly
messagestringError message
- readonly
locationsreadonly { line: number; column: number }[] | nullLocation(s) in the GraphQL document where the error occurred
- readonly
pathreadonly unknown[] | nullPath to the field that caused the error
- readonly
extensionsRecord<string, unknown> | nullAdditional error metadata
#GraphqlOptions
interface GraphqlOptions extends CommonOptionsOptions for individual GraphQL requests.
| Name | Description |
|---|---|
headers | Additional request headers |
operationName | Operation name (for documents with multiple operations) |
throwOnError | Whether to throw GraphqlError when response contains errors or request fails. |
Properties
- readonly
headers?HeadersInitAdditional request headers
- readonly
operationName?stringOperation name (for documents with multiple operations)
- readonly
throwOnError?booleanWhether to throw GraphqlError when response contains errors or request fails.
#GraphqlResponseError
interface GraphqlResponseError<T = any> extends GraphqlResponseBase<T>GraphQL response with execution errors.
Note: GraphQL allows partial success where both data and errors are present. Use data() to access any partial data.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
status | HTTP status code. |
headers | HTTP response headers. |
extensions | Response extensions. |
raw | Raw Web standard Response. |
data | Response data (null if no data, may be partial data with errors). |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
statusnumberHTTP status code.
- readonly
headersHeadersHTTP response headers.
- readonly
extensionsRecord<string, unknown> | nullResponse extensions.
- readonly
rawglobalThis.ResponseRaw Web standard Response.
- readonly
dataT | nullResponse data (null if no data, may be partial data with errors).
#GraphqlResponseErrorParams
interface GraphqlResponseErrorParams<T>Parameters for creating an error GraphqlResponse.
Properties
- readonly
urlstring - readonly
dataT | null - readonly
extensionsRecord<string, unknown> | null - readonly
durationnumber - readonly
statusnumber - readonly
rawglobalThis.Response
#GraphqlResponseExpectation
interface GraphqlResponseExpectationFluent API for GraphQL response validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the response is successful (no errors). |
toHaveStatus() | Asserts that the status equals the expected value. |
toHaveStatusEqual() | Asserts that the status equals the expected value using deep equality. |
toHaveStatusStrictEqual() | Asserts that the status strictly equals the expected value. |
toHaveStatusSatisfying() | Asserts that the status satisfies the provided matcher function. |
toHaveStatusNaN() | Asserts that the status is NaN. |
toHaveStatusGreaterThan() | Asserts that the status is greater than the expected value. |
toHaveStatusGreaterThanOrEqual() | Asserts that the status is greater than or equal to the expected value. |
toHaveStatusLessThan() | Asserts that the status is less than the expected value. |
toHaveStatusLessThanOrEqual() | Asserts that the status is less than or equal to the expected value. |
toHaveStatusCloseTo() | Asserts that the status is close to the expected value. |
toHaveStatusOneOf() | Asserts that the status is one of the specified values. |
toHaveHeaders() | Asserts that the headers equal the expected value. |
toHaveHeadersEqual() | Asserts that the headers equal the expected value using deep equality. |
toHaveHeadersStrictEqual() | Asserts that the headers strictly equal the expected value. |
toHaveHeadersSatisfying() | Asserts that the headers satisfy the provided matcher function. |
toHaveHeadersMatching() | Asserts that the headers match the specified subset. |
toHaveHeadersProperty() | Asserts that the headers have the specified property. |
toHaveHeadersPropertyContaining() | Asserts that the headers property contains the expected value. |
toHaveHeadersPropertyMatching() | Asserts that the headers property matches the specified subset. |
toHaveHeadersPropertySatisfying() | Asserts that the headers property satisfies the provided matcher function. |
toHaveError() | Asserts that the error equals the expected value. |
toHaveErrorEqual() | Asserts that the error equals the expected value using deep equality. |
toHaveErrorStrictEqual() | Asserts that the error strictly equals the expected value. |
toHaveErrorSatisfying() | Asserts that the error satisfies the provided matcher function. |
toHaveErrorPresent() | Asserts that the error is present (not null or undefined). |
toHaveErrorNull() | Asserts that the error is null. |
toHaveErrorUndefined() | Asserts that the error is undefined. |
toHaveErrorNullish() | Asserts that the error is nullish (null or undefined). |
toHaveExtensions() | Asserts that the extensions equal the expected value. |
toHaveExtensionsEqual() | Asserts that the extensions equal the expected value using deep equality. |
toHaveExtensionsStrictEqual() | Asserts that the extensions strictly equal the expected value. |
toHaveExtensionsSatisfying() | Asserts that the extensions satisfy the provided matcher function. |
toHaveExtensionsMatching() | Asserts that the extensions match the specified subset. |
toHaveExtensionsProperty() | Asserts that the extensions have the specified property. |
toHaveExtensionsPropertyContaining() | Asserts that the extensions property contains the expected value. |
toHaveExtensionsPropertyMatching() | Asserts that the extensions property matches the specified subset. |
toHaveExtensionsPropertySatisfying() | Asserts that the extensions property satisfies the provided matcher function. |
toHaveExtensionsPresent() | Asserts that the extensions are present (not null or undefined). |
toHaveExtensionsNull() | Asserts that the extensions are null. |
toHaveExtensionsUndefined() | Asserts that the extensions are undefined. |
toHaveExtensionsNullish() | Asserts that the extensions are nullish (null or undefined). |
toHaveData() | Asserts that the data equals the expected value. |
toHaveDataEqual() | Asserts that the data equals the expected value using deep equality. |
toHaveDataStrictEqual() | Asserts that the data strictly equals the expected value. |
toHaveDataSatisfying() | Asserts that the data satisfies the provided matcher function. |
toHaveDataMatching() | Asserts that the data matches the specified subset. |
toHaveDataProperty() | Asserts that the data has the specified property. |
toHaveDataPropertyContaining() | Asserts that the data property contains the specified value. |
toHaveDataPropertyMatching() | Asserts that the data property matches the specified subset. |
toHaveDataPropertySatisfying() | Asserts that the data property satisfies the provided matcher function. |
toHaveDataPresent() | Asserts that the data is present (not null or undefined). |
toHaveDataNull() | Asserts that the data is null. |
toHaveDataUndefined() | Asserts that the data is undefined. |
toHaveDataNullish() | Asserts that the data is nullish (null or undefined). |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the response is successful (no errors).
toHaveStatus(expected: unknown): thisAsserts that the status equals the expected value.
Parameters
expectedunknown- The expected status value
toHaveStatusEqual(expected: unknown): thisAsserts that the status equals the expected value using deep equality.
Parameters
expectedunknown- The expected status value
toHaveStatusStrictEqual(expected: unknown): thisAsserts that the status strictly equals the expected value.
Parameters
expectedunknown- The expected status value
toHaveStatusSatisfying(matcher: (value: number) => unknown): thisAsserts that the status satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the status and performs assertions
toHaveStatusNaN(): thisAsserts that the status is NaN.
toHaveStatusGreaterThan(expected: number): thisAsserts that the status is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusGreaterThanOrEqual(expected: number): thisAsserts that the status is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusLessThan(expected: number): thisAsserts that the status is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusLessThanOrEqual(expected: number): thisAsserts that the status is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCloseTo(expected: number, numDigits?: number): thisAsserts that the status is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveStatusOneOf(values: unknown[]): thisAsserts that the status is one of the specified values.
Parameters
valuesunknown[]- Array of acceptable values
toHaveHeaders(expected: unknown): thisAsserts that the headers equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersEqual(expected: unknown): thisAsserts that the headers equal the expected value using deep equality.
Parameters
expectedunknown- The expected headers value
toHaveHeadersStrictEqual(expected: unknown): thisAsserts that the headers strictly equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersSatisfying(matcher: (value: GraphqlHeaders) => unknown): thisAsserts that the headers satisfy the provided matcher function.
Parameters
matcher(value: GraphqlHeaders) => unknown- A function that receives the headers and performs assertions
toHaveHeadersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the headers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveHeadersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the headers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveHeadersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the headers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveError(expected: unknown): thisAsserts that the error equals the expected value.
Parameters
expectedunknown- The expected error value
toHaveErrorEqual(expected: unknown): thisAsserts that the error equals the expected value using deep equality.
Parameters
expectedunknown- The expected error value
toHaveErrorStrictEqual(expected: unknown): thisAsserts that the error strictly equals the expected value.
Parameters
expectedunknown- The expected error value
toHaveErrorSatisfying(matcher: (value: any) => unknown): thisAsserts that the error satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the error and performs assertions
toHaveErrorPresent(): thisAsserts that the error is present (not null or undefined).
toHaveErrorNull(): thisAsserts that the error is null.
toHaveErrorUndefined(): thisAsserts that the error is undefined.
toHaveErrorNullish(): thisAsserts that the error is nullish (null or undefined).
toHaveExtensions(expected: unknown): thisAsserts that the extensions equal the expected value.
Parameters
expectedunknown- The expected extensions value
toHaveExtensionsEqual(expected: unknown): thisAsserts that the extensions equal the expected value using deep equality.
Parameters
expectedunknown- The expected extensions value
toHaveExtensionsStrictEqual(expected: unknown): thisAsserts that the extensions strictly equal the expected value.
Parameters
expectedunknown- The expected extensions value
toHaveExtensionsSatisfying(
matcher: (value: Record<string, any>) => unknown,
): thisAsserts that the extensions satisfy the provided matcher function.
Parameters
matcher(value: Record<string, any>) => unknown- A function that receives the extensions and performs assertions
toHaveExtensionsMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the extensions match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveExtensionsProperty(keyPath: string | string[], value?: unknown): thisAsserts that the extensions have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveExtensionsPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the extensions property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveExtensionsPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the extensions property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveExtensionsPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the extensions property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveExtensionsPresent(): thisAsserts that the extensions are present (not null or undefined).
toHaveExtensionsNull(): thisAsserts that the extensions are null.
toHaveExtensionsUndefined(): thisAsserts that the extensions are undefined.
toHaveExtensionsNullish(): thisAsserts that the extensions are nullish (null or undefined).
toHaveData(expected: unknown): thisAsserts that the data equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataEqual(expected: unknown): thisAsserts that the data equals the expected value using deep equality.
Parameters
expectedunknown- The expected data value
toHaveDataStrictEqual(expected: unknown): thisAsserts that the data strictly equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataSatisfying(matcher: (value: any) => unknown): thisAsserts that the data satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the data and performs assertions
toHaveDataMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataProperty(keyPath: string | string[], value?: unknown): thisAsserts that the data has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value
toHaveDataPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the data property contains the specified value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The value to search for
toHaveDataPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the data property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDataPresent(): thisAsserts that the data is present (not null or undefined).
toHaveDataNull(): thisAsserts that the data is null.
toHaveDataUndefined(): thisAsserts that the data is undefined.
toHaveDataNullish(): thisAsserts that the data is nullish (null or undefined).
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#GraphqlResponseFailure
interface GraphqlResponseFailure<T = any> extends GraphqlResponseBase<T>Failed GraphQL request (network error, HTTP error, etc.).
The request did not reach GraphQL processing.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
extensions | Response extensions (always null for failures). |
status | HTTP status code (null for network failures). |
headers | HTTP response headers (null for failures). |
raw | No raw response (request didn't reach server). |
data | No data (request didn't reach server). |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
extensionsnullResponse extensions (always null for failures).
- readonly
statusnullHTTP status code (null for network failures).
- readonly
headersnullHTTP response headers (null for failures).
- readonly
rawnullNo raw response (request didn't reach server).
- readonly
datanullNo data (request didn't reach server).
#GraphqlResponseFailureParams
interface GraphqlResponseFailureParamsParameters for creating a failure GraphqlResponse.
Properties
- readonly
urlstring - readonly
durationnumber
#GraphqlResponseSuccess
interface GraphqlResponseSuccess<T = any> extends GraphqlResponseBase<T>Successful GraphQL response (no errors).
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
status | HTTP status code. |
headers | HTTP response headers. |
extensions | Response extensions. |
raw | Raw Web standard Response. |
data | Response data (null if no data). |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
statusnumberHTTP status code.
- readonly
headersHeadersHTTP response headers.
- readonly
extensionsRecord<string, unknown> | nullResponse extensions.
- readonly
rawglobalThis.ResponseRaw Web standard Response.
- readonly
dataT | nullResponse data (null if no data).
#GraphqlResponseSuccessParams
interface GraphqlResponseSuccessParams<T>Parameters for creating a successful GraphqlResponse.
Properties
- readonly
urlstring - readonly
dataT | null - readonly
extensionsRecord<string, unknown> | null - readonly
durationnumber - readonly
statusnumber - readonly
rawglobalThis.Response
#GrpcClientConfig
interface GrpcClientConfig extends Omit<ConnectRpcClientConfig, "protocol">Configuration for creating a gRPC client.
This is a subset of ConnectRpcClientConfig with protocol fixed to "grpc".
#GrpcResponseExpectation
interface GrpcResponseExpectationFluent expectation interface for gRPC responses.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the response is successful (code 0). |
toHaveStatusCode() | Asserts that the code equals the expected value. |
toHaveStatusCodeEqual() | Asserts that the code equals the expected value using deep equality. |
toHaveStatusCodeStrictEqual() | Asserts that the code strictly equals the expected value. |
toHaveStatusCodeSatisfying() | Asserts that the code satisfies the provided matcher function. |
toHaveStatusCodeNaN() | Asserts that the code is NaN. |
toHaveStatusCodeGreaterThan() | Asserts that the code is greater than the expected value. |
toHaveStatusCodeGreaterThanOrEqual() | Asserts that the code is greater than or equal to the expected value. |
toHaveStatusCodeLessThan() | Asserts that the code is less than the expected value. |
toHaveStatusCodeLessThanOrEqual() | Asserts that the code is less than or equal to the expected value. |
toHaveStatusCodeCloseTo() | Asserts that the code is close to the expected value. |
toHaveStatusCodeOneOf() | Asserts that the code is one of the specified values. |
toHaveStatusMessage() | Asserts that the message equals the expected value. |
toHaveStatusMessageEqual() | Asserts that the message equals the expected value using deep equality. |
toHaveStatusMessageStrictEqual() | Asserts that the message strictly equals the expected value. |
toHaveStatusMessageSatisfying() | Asserts that the message satisfies the provided matcher function. |
toHaveStatusMessageContaining() | Asserts that the message contains the specified substring. |
toHaveStatusMessageMatching() | Asserts that the message matches the specified regular expression. |
toHaveStatusMessagePresent() | Asserts that the message is present (not null or undefined). |
toHaveStatusMessageNull() | Asserts that the message is null. |
toHaveStatusMessageUndefined() | Asserts that the message is undefined. |
toHaveStatusMessageNullish() | Asserts that the message is nullish (null or undefined). |
toHaveHeaders() | Asserts that the headers equal the expected value. |
toHaveHeadersEqual() | Asserts that the headers equal the expected value using deep equality. |
toHaveHeadersStrictEqual() | Asserts that the headers strictly equal the expected value. |
toHaveHeadersSatisfying() | Asserts that the headers satisfy the provided matcher function. |
toHaveHeadersMatching() | Asserts that the headers match the specified subset. |
toHaveHeadersProperty() | Asserts that the headers have the specified property. |
toHaveHeadersPropertyContaining() | Asserts that the headers property contains the expected value. |
toHaveHeadersPropertyMatching() | Asserts that the headers property matches the specified subset. |
toHaveHeadersPropertySatisfying() | Asserts that the headers property satisfies the provided matcher function. |
toHaveTrailers() | Asserts that the trailers equal the expected value. |
toHaveTrailersEqual() | Asserts that the trailers equal the expected value using deep equality. |
toHaveTrailersStrictEqual() | Asserts that the trailers strictly equal the expected value. |
toHaveTrailersSatisfying() | Asserts that the trailers satisfy the provided matcher function. |
toHaveTrailersMatching() | Asserts that the trailers match the specified subset. |
toHaveTrailersProperty() | Asserts that the trailers have the specified property. |
toHaveTrailersPropertyContaining() | Asserts that the trailers property contains the expected value. |
toHaveTrailersPropertyMatching() | Asserts that the trailers property matches the specified subset. |
toHaveTrailersPropertySatisfying() | Asserts that the trailers property satisfies the provided matcher function. |
toHaveData() | Asserts that the data equals the expected value. |
toHaveDataEqual() | Asserts that the data equals the expected value using deep equality. |
toHaveDataStrictEqual() | Asserts that the data strictly equals the expected value. |
toHaveDataSatisfying() | Asserts that the data satisfies the provided matcher function. |
toHaveDataPresent() | Asserts that the data is present (not null or undefined). |
toHaveDataNull() | Asserts that the data is null. |
toHaveDataUndefined() | Asserts that the data is undefined. |
toHaveDataNullish() | Asserts that the data is nullish (null or undefined). |
toHaveDataMatching() | Asserts that the data matches the specified subset. |
toHaveDataProperty() | Asserts that the data has the specified property. |
toHaveDataPropertyContaining() | Asserts that the data property contains the expected value. |
toHaveDataPropertyMatching() | Asserts that the data property matches the specified subset. |
toHaveDataPropertySatisfying() | Asserts that the data property satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the response is successful (code 0).
toHaveStatusCode(expected: unknown): thisAsserts that the code equals the expected value.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeEqual(expected: unknown): thisAsserts that the code equals the expected value using deep equality.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeStrictEqual(expected: unknown): thisAsserts that the code strictly equals the expected value.
Parameters
expectedunknown- The expected code value
toHaveStatusCodeSatisfying(matcher: (value: GrpcStatusCode) => unknown): thisAsserts that the code satisfies the provided matcher function.
Parameters
matcher(value: GrpcStatusCode) => unknown- A function that receives the code and performs assertions
toHaveStatusCodeNaN(): thisAsserts that the code is NaN.
toHaveStatusCodeGreaterThan(expected: number): thisAsserts that the code is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeGreaterThanOrEqual(expected: number): thisAsserts that the code is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeLessThan(expected: number): thisAsserts that the code is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeLessThanOrEqual(expected: number): thisAsserts that the code is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCodeCloseTo(expected: number, numDigits?: number): thisAsserts that the code is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveStatusCodeOneOf(values: unknown[]): thisAsserts that the code is one of the specified values.
Parameters
valuesunknown[]- Array of acceptable values
toHaveStatusMessage(expected: unknown): thisAsserts that the message equals the expected value.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageEqual(expected: unknown): thisAsserts that the message equals the expected value using deep equality.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageStrictEqual(expected: unknown): thisAsserts that the message strictly equals the expected value.
Parameters
expectedunknown- The expected message value
toHaveStatusMessageSatisfying(matcher: (value: string) => unknown): thisAsserts that the message satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the message and performs assertions
toHaveStatusMessageContaining(substr: string): thisAsserts that the message contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveStatusMessageMatching(expected: RegExp): thisAsserts that the message matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveStatusMessagePresent(): thisAsserts that the message is present (not null or undefined).
toHaveStatusMessageNull(): thisAsserts that the message is null.
toHaveStatusMessageUndefined(): thisAsserts that the message is undefined.
toHaveStatusMessageNullish(): thisAsserts that the message is nullish (null or undefined).
toHaveHeaders(expected: unknown): thisAsserts that the headers equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersEqual(expected: unknown): thisAsserts that the headers equal the expected value using deep equality.
Parameters
expectedunknown- The expected headers value
toHaveHeadersStrictEqual(expected: unknown): thisAsserts that the headers strictly equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersSatisfying(matcher: (value: GrpcHeaders) => unknown): thisAsserts that the headers satisfy the provided matcher function.
Parameters
matcher(value: GrpcHeaders) => unknown- A function that receives the headers and performs assertions
toHaveHeadersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the headers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveHeadersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the headers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveHeadersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the headers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveTrailers(expected: unknown): thisAsserts that the trailers equal the expected value.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersEqual(expected: unknown): thisAsserts that the trailers equal the expected value using deep equality.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersStrictEqual(expected: unknown): thisAsserts that the trailers strictly equal the expected value.
Parameters
expectedunknown- The expected trailers value
toHaveTrailersSatisfying(matcher: (value: GrpcTrailers) => unknown): thisAsserts that the trailers satisfy the provided matcher function.
Parameters
matcher(value: GrpcTrailers) => unknown- A function that receives the trailers and performs assertions
toHaveTrailersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the trailers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveTrailersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the trailers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveTrailersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the trailers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveTrailersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the trailers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveTrailersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the trailers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveData(expected: unknown): thisAsserts that the data equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataEqual(expected: unknown): thisAsserts that the data equals the expected value using deep equality.
Parameters
expectedunknown- The expected data value
toHaveDataStrictEqual(expected: unknown): thisAsserts that the data strictly equals the expected value.
Parameters
expectedunknown- The expected data value
toHaveDataSatisfying(
matcher: (value: Record<string, any> | null) => unknown,
): thisAsserts that the data satisfies the provided matcher function.
Parameters
matcher(value: Record<string, any> | null) => unknown- A function that receives the data and performs assertions
toHaveDataPresent(): thisAsserts that the data is present (not null or undefined).
toHaveDataNull(): thisAsserts that the data is null.
toHaveDataUndefined(): thisAsserts that the data is undefined.
toHaveDataNullish(): thisAsserts that the data is nullish (null or undefined).
toHaveDataMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataProperty(keyPath: string | string[], value?: unknown): thisAsserts that the data has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveDataPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the data property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveDataPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the data property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDataPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the data property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#HttpClient
interface HttpClient extends AsyncDisposableHTTP client interface.
| Name | Description |
|---|---|
config | Client configuration |
get() | Send GET request |
head() | Send HEAD request |
post() | Send POST request |
put() | Send PUT request |
patch() | Send PATCH request |
delete() | Send DELETE request |
options() | Send OPTIONS request |
request() | Send request with arbitrary method |
getCookies() | Get all cookies in the cookie jar. |
setCookie() | Set a cookie in the cookie jar. |
clearCookies() | Clear all cookies from the cookie jar. |
close() | Close the client and release resources |
Properties
Client configuration
Methods
get(path: string, options?: HttpOptions): Promise<HttpResponse>Send GET request
Parameters
pathstringoptions?HttpOptions
head(path: string, options?: HttpOptions): Promise<HttpResponse>Send HEAD request
Parameters
pathstringoptions?HttpOptions
post(path: string, options?: HttpRequestOptions): Promise<HttpResponse>Send POST request
Parameters
pathstringoptions?HttpRequestOptions
put(path: string, options?: HttpRequestOptions): Promise<HttpResponse>Send PUT request
Parameters
pathstringoptions?HttpRequestOptions
patch(path: string, options?: HttpRequestOptions): Promise<HttpResponse>Send PATCH request
Parameters
pathstringoptions?HttpRequestOptions
delete(path: string, options?: HttpRequestOptions): Promise<HttpResponse>Send DELETE request
Parameters
pathstringoptions?HttpRequestOptions
options(path: string, options?: HttpOptions): Promise<HttpResponse>Send OPTIONS request
Parameters
pathstringoptions?HttpOptions
request(
method: string,
path: string,
options?: HttpRequestOptions,
): Promise<HttpResponse>Send request with arbitrary method
Parameters
methodstringpathstringoptions?HttpRequestOptions
getCookies(): Record<string, string>Get all cookies in the cookie jar. Returns empty object if cookies are disabled.
setCookie(name: string, value: string): voidSet a cookie in the cookie jar.
Parameters
namestringvaluestring
clearCookies(): voidClear all cookies from the cookie jar. No-op if cookies are disabled.
close(): Promise<void>Close the client and release resources
#HttpClientConfig
interface HttpClientConfig extends CommonOptionsHTTP client configuration.
| Name | Description |
|---|---|
url | Base URL for all requests. |
headers | Default headers for all requests |
fetch | Custom fetch implementation (for testing/mocking) |
redirect | Default redirect handling mode. |
throwOnError | Whether to throw HttpError for non-2xx responses. |
cookies | Cookie handling configuration. |
Properties
Base URL for all requests.
Can be a URL string or a connection configuration object.
- readonly
headers?HeadersInitDefault headers for all requests
- readonly
fetch?fetchCustom fetch implementation (for testing/mocking)
Default redirect handling mode. Can be overridden per-request via HttpOptions.
- readonly
throwOnError?booleanWhether to throw HttpError for non-2xx responses. Can be overridden per-request via HttpOptions.
#HttpConnectionConfig
interface HttpConnectionConfig extends CommonConnectionConfigHTTP connection configuration.
Extends CommonConnectionConfig with HTTP-specific options.
Properties
- readonly
protocol?"http" | "https"Protocol to use.
- readonly
path?stringBase path prefix for all requests.
#HttpErrorOptions
interface HttpErrorOptions extends ErrorOptionsOptions for creating an HttpError.
Properties
- readonly
body?Uint8Array | nullResponse body as raw bytes
- readonly
headers?Headers | nullResponse headers
#HttpOptions
interface HttpOptions extends CommonOptionsOptions for individual HTTP requests.
| Name | Description |
|---|---|
query | Query parameters (arrays for multi-value params) |
headers | Additional request headers |
redirect | Redirect handling mode. |
throwOnError | Whether to throw HttpError for non-2xx responses. |
Properties
Query parameters (arrays for multi-value params)
- readonly
headers?HeadersInitAdditional request headers
Redirect handling mode.
- readonly
throwOnError?booleanWhether to throw HttpError for non-2xx responses. When false, non-2xx responses are returned as HttpResponse.
#HttpRequestOptions
interface HttpRequestOptions extends HttpOptionsOptions for HTTP requests that may include a body.
| Name | Description |
|---|---|
body | Request body |
Properties
Request body
#HttpResponseError
interface HttpResponseError<T = any> extends HttpResponseBase<T>HTTP response for error responses (4xx/5xx status codes).
Server received and processed the request, but returned an error status.
| Name | Description |
|---|---|
processed | Server processed the request. |
ok | Response was not successful (4xx/5xx). |
error | Error describing the HTTP error. |
status | HTTP status code (4xx/5xx). |
statusText | HTTP status text. |
headers | Response headers. |
raw | Raw Web standard Response. |
Properties
- readonly
processedtrueServer processed the request.
- readonly
okfalseResponse was not successful (4xx/5xx).
Error describing the HTTP error.
- readonly
statusnumberHTTP status code (4xx/5xx).
- readonly
statusTextstringHTTP status text.
- readonly
headersHeadersResponse headers.
- readonly
rawglobalThis.ResponseRaw Web standard Response.
#HttpResponseExpectation
interface HttpResponseExpectationFluent API for HTTP response validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the response is successful (status 2xx). |
toHaveStatus() | Asserts that the status equals the expected value. |
toHaveStatusEqual() | Asserts that the status equals the expected value using deep equality. |
toHaveStatusStrictEqual() | Asserts that the status strictly equals the expected value. |
toHaveStatusSatisfying() | Asserts that the status satisfies the provided matcher function. |
toHaveStatusNaN() | Asserts that the status is NaN. |
toHaveStatusGreaterThan() | Asserts that the status is greater than the expected value. |
toHaveStatusGreaterThanOrEqual() | Asserts that the status is greater than or equal to the expected value. |
toHaveStatusLessThan() | Asserts that the status is less than the expected value. |
toHaveStatusLessThanOrEqual() | Asserts that the status is less than or equal to the expected value. |
toHaveStatusCloseTo() | Asserts that the status is close to the expected value. |
toHaveStatusOneOf() | Asserts that the status is one of the specified values. |
toHaveStatusText() | Asserts that the status text equals the expected value. |
toHaveStatusTextEqual() | Asserts that the status text equals the expected value using deep equality. |
toHaveStatusTextStrictEqual() | Asserts that the status text strictly equals the expected value. |
toHaveStatusTextSatisfying() | Asserts that the status text satisfies the provided matcher function. |
toHaveStatusTextContaining() | Asserts that the status text contains the specified substring. |
toHaveStatusTextMatching() | Asserts that the status text matches the specified regular expression. |
toHaveHeaders() | Asserts that the headers equal the expected value. |
toHaveHeadersEqual() | Asserts that the headers equal the expected value using deep equality. |
toHaveHeadersStrictEqual() | Asserts that the headers strictly equal the expected value. |
toHaveHeadersSatisfying() | Asserts that the headers satisfy the provided matcher function. |
toHaveHeadersMatching() | Asserts that the headers match the specified subset. |
toHaveHeadersProperty() | Asserts that the headers have the specified property. |
toHaveHeadersPropertyContaining() | Asserts that the headers property contains the expected value. |
toHaveHeadersPropertyMatching() | Asserts that the headers property matches the specified subset. |
toHaveHeadersPropertySatisfying() | Asserts that the headers property satisfies the provided matcher function. |
toHaveUrl() | Asserts that the URL equals the expected value. |
toHaveUrlEqual() | Asserts that the URL equals the expected value using deep equality. |
toHaveUrlStrictEqual() | Asserts that the URL strictly equals the expected value. |
toHaveUrlSatisfying() | Asserts that the URL satisfies the provided matcher function. |
toHaveUrlContaining() | Asserts that the URL contains the specified substring. |
toHaveUrlMatching() | Asserts that the URL matches the specified regular expression. |
toHaveBody() | Asserts that the body equals the expected value. |
toHaveBodyEqual() | Asserts that the body equals the expected value using deep equality. |
toHaveBodyStrictEqual() | Asserts that the body strictly equals the expected value. |
toHaveBodySatisfying() | Asserts that the body satisfies the provided matcher function. |
toHaveBodyPresent() | Asserts that the body is present (not null or undefined). |
toHaveBodyNull() | Asserts that the body is null. |
toHaveBodyUndefined() | Asserts that the body is undefined. |
toHaveBodyNullish() | Asserts that the body is nullish (null or undefined). |
toHaveBodyLength() | Asserts that the body length equals the expected value. |
toHaveBodyLengthEqual() | Asserts that the body length equals the expected value using deep equality. |
toHaveBodyLengthStrictEqual() | Asserts that the body length strictly equals the expected value. |
toHaveBodyLengthSatisfying() | Asserts that the body length satisfies the provided matcher function. |
toHaveBodyLengthNaN() | Asserts that the body length is NaN. |
toHaveBodyLengthGreaterThan() | Asserts that the body length is greater than the expected value. |
toHaveBodyLengthGreaterThanOrEqual() | Asserts that the body length is greater than or equal to the expected value. |
toHaveBodyLengthLessThan() | Asserts that the body length is less than the expected value. |
toHaveBodyLengthLessThanOrEqual() | Asserts that the body length is less than or equal to the expected value. |
toHaveBodyLengthCloseTo() | Asserts that the body length is close to the expected value. |
toHaveText() | Asserts that the text equals the expected value. |
toHaveTextEqual() | Asserts that the text equals the expected value using deep equality. |
toHaveTextStrictEqual() | Asserts that the text strictly equals the expected value. |
toHaveTextSatisfying() | Asserts that the text satisfies the provided matcher function. |
toHaveTextContaining() | Asserts that the text contains the specified substring. |
toHaveTextMatching() | Asserts that the text matches the specified regular expression. |
toHaveTextPresent() | Asserts that the text is present (not null or undefined). |
toHaveTextNull() | Asserts that the text is null. |
toHaveTextUndefined() | Asserts that the text is undefined. |
toHaveTextNullish() | Asserts that the text is nullish (null or undefined). |
toHaveTextLength() | Asserts that the text length equals the expected value. |
toHaveTextLengthEqual() | Asserts that the text length equals the expected value using deep equality. |
toHaveTextLengthStrictEqual() | Asserts that the text length strictly equals the expected value. |
toHaveTextLengthSatisfying() | Asserts that the text length satisfies the provided matcher function. |
toHaveTextLengthNaN() | Asserts that the text length is NaN. |
toHaveTextLengthGreaterThan() | Asserts that the text length is greater than the expected value. |
toHaveTextLengthGreaterThanOrEqual() | Asserts that the text length is greater than or equal to the expected value. |
toHaveTextLengthLessThan() | Asserts that the text length is less than the expected value. |
toHaveTextLengthLessThanOrEqual() | Asserts that the text length is less than or equal to the expected value. |
toHaveTextLengthCloseTo() | Asserts that the text length is close to the expected value. |
toHaveJson() | Asserts that the JSON equals the expected value. |
toHaveJsonEqual() | Asserts that the JSON equals the expected value using deep equality. |
toHaveJsonStrictEqual() | Asserts that the JSON strictly equals the expected value. |
toHaveJsonSatisfying() | Asserts that the JSON satisfies the provided matcher function. |
toHaveJsonPresent() | Asserts that the JSON is present (not null or undefined). |
toHaveJsonNull() | Asserts that the JSON is null. |
toHaveJsonUndefined() | Asserts that the JSON is undefined. |
toHaveJsonNullish() | Asserts that the JSON is nullish (null or undefined). |
toHaveJsonMatching() | Asserts that the JSON matches the specified subset. |
toHaveJsonProperty() | Asserts that the JSON has the specified property. |
toHaveJsonPropertyContaining() | Asserts that the JSON property contains the expected value. |
toHaveJsonPropertyMatching() | Asserts that the JSON property matches the specified subset. |
toHaveJsonPropertySatisfying() | Asserts that the JSON property satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the response is successful (status 2xx).
toHaveStatus(expected: unknown): thisAsserts that the status equals the expected value.
Parameters
expectedunknown- The expected status value
toHaveStatusEqual(expected: unknown): thisAsserts that the status equals the expected value using deep equality.
Parameters
expectedunknown- The expected status value
toHaveStatusStrictEqual(expected: unknown): thisAsserts that the status strictly equals the expected value.
Parameters
expectedunknown- The expected status value
toHaveStatusSatisfying(matcher: (value: number) => unknown): thisAsserts that the status satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the status and performs assertions
toHaveStatusNaN(): thisAsserts that the status is NaN.
toHaveStatusGreaterThan(expected: number): thisAsserts that the status is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusGreaterThanOrEqual(expected: number): thisAsserts that the status is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusLessThan(expected: number): thisAsserts that the status is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusLessThanOrEqual(expected: number): thisAsserts that the status is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveStatusCloseTo(expected: number, numDigits?: number): thisAsserts that the status is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveStatusOneOf(values: unknown[]): thisAsserts that the status is one of the specified values.
Parameters
valuesunknown[]- Array of acceptable values
toHaveStatusText(expected: unknown): thisAsserts that the status text equals the expected value.
Parameters
expectedunknown- The expected status text
toHaveStatusTextEqual(expected: unknown): thisAsserts that the status text equals the expected value using deep equality.
Parameters
expectedunknown- The expected status text
toHaveStatusTextStrictEqual(expected: unknown): thisAsserts that the status text strictly equals the expected value.
Parameters
expectedunknown- The expected status text
toHaveStatusTextSatisfying(matcher: (value: string) => unknown): thisAsserts that the status text satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the status text and performs assertions
toHaveStatusTextContaining(substr: string): thisAsserts that the status text contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveStatusTextMatching(expected: RegExp): thisAsserts that the status text matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveHeaders(expected: unknown): thisAsserts that the headers equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersEqual(expected: unknown): thisAsserts that the headers equal the expected value using deep equality.
Parameters
expectedunknown- The expected headers value
toHaveHeadersStrictEqual(expected: unknown): thisAsserts that the headers strictly equal the expected value.
Parameters
expectedunknown- The expected headers value
toHaveHeadersSatisfying(matcher: (value: HttpHeaders) => unknown): thisAsserts that the headers satisfy the provided matcher function.
Parameters
matcher(value: HttpHeaders) => unknown- A function that receives the headers and performs assertions
toHaveHeadersMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers match the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersProperty(keyPath: string | string[], value?: unknown): thisAsserts that the headers have the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveHeadersPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the headers property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveHeadersPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the headers property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveHeadersPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the headers property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveUrl(expected: unknown): thisAsserts that the URL equals the expected value.
Parameters
expectedunknown- The expected URL value
toHaveUrlEqual(expected: unknown): thisAsserts that the URL equals the expected value using deep equality.
Parameters
expectedunknown- The expected URL value
toHaveUrlStrictEqual(expected: unknown): thisAsserts that the URL strictly equals the expected value.
Parameters
expectedunknown- The expected URL value
toHaveUrlSatisfying(matcher: (value: string) => unknown): thisAsserts that the URL satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the URL and performs assertions
toHaveUrlContaining(substr: string): thisAsserts that the URL contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveUrlMatching(expected: RegExp): thisAsserts that the URL matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveBody(expected: unknown): thisAsserts that the body equals the expected value.
Parameters
expectedunknown- The expected body value
toHaveBodyEqual(expected: unknown): thisAsserts that the body equals the expected value using deep equality.
Parameters
expectedunknown- The expected body value
toHaveBodyStrictEqual(expected: unknown): thisAsserts that the body strictly equals the expected value.
Parameters
expectedunknown- The expected body value
toHaveBodySatisfying(matcher: (value: Uint8Array | null) => unknown): thisAsserts that the body satisfies the provided matcher function.
Parameters
matcher(value: Uint8Array | null) => unknown- A function that receives the body and performs assertions
toHaveBodyPresent(): thisAsserts that the body is present (not null or undefined).
toHaveBodyNull(): thisAsserts that the body is null.
toHaveBodyUndefined(): thisAsserts that the body is undefined.
toHaveBodyNullish(): thisAsserts that the body is nullish (null or undefined).
toHaveBodyLength(expected: unknown): thisAsserts that the body length equals the expected value.
Parameters
expectedunknown- The expected body length
toHaveBodyLengthEqual(expected: unknown): thisAsserts that the body length equals the expected value using deep equality.
Parameters
expectedunknown- The expected body length
toHaveBodyLengthStrictEqual(expected: unknown): thisAsserts that the body length strictly equals the expected value.
Parameters
expectedunknown- The expected body length
toHaveBodyLengthSatisfying(matcher: (value: number) => unknown): thisAsserts that the body length satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the body length and performs assertions
toHaveBodyLengthNaN(): thisAsserts that the body length is NaN.
toHaveBodyLengthGreaterThan(expected: number): thisAsserts that the body length is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveBodyLengthGreaterThanOrEqual(expected: number): thisAsserts that the body length is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveBodyLengthLessThan(expected: number): thisAsserts that the body length is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveBodyLengthLessThanOrEqual(expected: number): thisAsserts that the body length is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveBodyLengthCloseTo(expected: number, numDigits?: number): thisAsserts that the body length is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveText(expected: unknown): thisAsserts that the text equals the expected value.
Parameters
expectedunknown- The expected text value
toHaveTextEqual(expected: unknown): thisAsserts that the text equals the expected value using deep equality.
Parameters
expectedunknown- The expected text value
toHaveTextStrictEqual(expected: unknown): thisAsserts that the text strictly equals the expected value.
Parameters
expectedunknown- The expected text value
toHaveTextSatisfying(matcher: (value: string) => unknown): thisAsserts that the text satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the text and performs assertions
toHaveTextContaining(substr: string): thisAsserts that the text contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveTextMatching(expected: RegExp): thisAsserts that the text matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveTextPresent(): thisAsserts that the text is present (not null or undefined).
toHaveTextNull(): thisAsserts that the text is null.
toHaveTextUndefined(): thisAsserts that the text is undefined.
toHaveTextNullish(): thisAsserts that the text is nullish (null or undefined).
toHaveTextLength(expected: unknown): thisAsserts that the text length equals the expected value.
Parameters
expectedunknown- The expected text length
toHaveTextLengthEqual(expected: unknown): thisAsserts that the text length equals the expected value using deep equality.
Parameters
expectedunknown- The expected text length
toHaveTextLengthStrictEqual(expected: unknown): thisAsserts that the text length strictly equals the expected value.
Parameters
expectedunknown- The expected text length
toHaveTextLengthSatisfying(matcher: (value: number) => unknown): thisAsserts that the text length satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the text length and performs assertions
toHaveTextLengthNaN(): thisAsserts that the text length is NaN.
toHaveTextLengthGreaterThan(expected: number): thisAsserts that the text length is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveTextLengthGreaterThanOrEqual(expected: number): thisAsserts that the text length is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveTextLengthLessThan(expected: number): thisAsserts that the text length is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveTextLengthLessThanOrEqual(expected: number): thisAsserts that the text length is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveTextLengthCloseTo(expected: number, numDigits?: number): thisAsserts that the text length is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveJson(expected: unknown): thisAsserts that the JSON equals the expected value.
Parameters
expectedunknown- The expected JSON value
toHaveJsonEqual(expected: unknown): thisAsserts that the JSON equals the expected value using deep equality.
Parameters
expectedunknown- The expected JSON value
toHaveJsonStrictEqual(expected: unknown): thisAsserts that the JSON strictly equals the expected value.
Parameters
expectedunknown- The expected JSON value
toHaveJsonSatisfying(
matcher: (value: Record<string, any> | null) => unknown,
): thisAsserts that the JSON satisfies the provided matcher function.
Parameters
matcher(value: Record<string, any> | null) => unknown- A function that receives the JSON and performs assertions
toHaveJsonPresent(): thisAsserts that the JSON is present (not null or undefined).
toHaveJsonNull(): thisAsserts that the JSON is null.
toHaveJsonUndefined(): thisAsserts that the JSON is undefined.
toHaveJsonNullish(): thisAsserts that the JSON is nullish (null or undefined).
toHaveJsonMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the JSON matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveJsonProperty(keyPath: string | string[], value?: unknown): thisAsserts that the JSON has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveJsonPropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the JSON property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveJsonPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the JSON property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveJsonPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the JSON property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#HttpResponseFailure
interface HttpResponseFailure<T = any> extends HttpResponseBase<T>HTTP response for request failures (network errors, timeouts, etc.).
Request could not be processed by the server (network error, DNS failure, connection refused, timeout, aborted, etc.).
| Name | Description |
|---|---|
processed | Server did not process the request. |
ok | Request failed. |
error | Error describing the failure (ConnectionError, TimeoutError, AbortError). |
status | No HTTP status (request didn't reach server). |
statusText | No HTTP status text (request didn't reach server). |
headers | No headers (request didn't reach server). |
body | No body (request didn't reach server). |
raw | No raw response (request didn't reach server). |
Properties
- readonly
processedfalseServer did not process the request.
- readonly
okfalseRequest failed.
Error describing the failure (ConnectionError, TimeoutError, AbortError).
- readonly
statusnullNo HTTP status (request didn't reach server).
- readonly
statusTextnullNo HTTP status text (request didn't reach server).
- readonly
headersnullNo headers (request didn't reach server).
- readonly
bodynullNo body (request didn't reach server).
- readonly
rawnullNo raw response (request didn't reach server).
#HttpResponseSuccess
interface HttpResponseSuccess<T = any> extends HttpResponseBase<T>HTTP response for successful requests (2xx status codes).
Wraps Web standard Response, allowing body to be read synchronously and multiple times (unlike the streaming-based standard Response).
| Name | Description |
|---|---|
processed | Server processed the request. |
ok | Response was successful (2xx). |
error | No error for successful responses. |
status | HTTP status code (200-299). |
statusText | HTTP status text. |
headers | Response headers. |
raw | Raw Web standard Response. |
Properties
- readonly
processedtrueServer processed the request.
- readonly
oktrueResponse was successful (2xx).
- readonly
errornullNo error for successful responses.
- readonly
statusnumberHTTP status code (200-299).
- readonly
statusTextstringHTTP status text.
- readonly
headersHeadersResponse headers.
- readonly
rawglobalThis.ResponseRaw Web standard Response.
#MethodInfo
interface MethodInfoMethod information from reflection.
| Name | Description |
|---|---|
name | Method name (e.g., "Echo") |
localName | Local name (camelCase) |
kind | Method kind |
inputType | Input message type name |
outputType | Output message type name |
idempotent | Whether the method is idempotent |
Properties
- readonly
namestringMethod name (e.g., "Echo")
- readonly
localNamestringLocal name (camelCase)
- readonly
kind"unary" | "server_streaming" | "client_streaming" | "bidi_streaming"Method kind
- readonly
inputTypestringInput message type name
- readonly
outputTypestringOutput message type name
- readonly
idempotentbooleanWhether the method is idempotent
#MongoClient
interface MongoClient extends AsyncDisposableMongoDB client interface
| Name | Description |
|---|---|
config | — |
collection() | — |
db() | — |
transaction() | — |
close() | — |
Properties
Methods
collection<T extends Document = Document>(name: string): MongoCollection<T>Parameters
namestring
db(name: string): MongoClientParameters
namestring
transaction<T>(fn: (session: MongoSession) => unknown): Promise<T>Parameters
fn(session: MongoSession) => unknown
close(): Promise<void>#MongoClientConfig
interface MongoClientConfig extends MongoOptionsMongoDB client configuration.
Examples
Using a connection string
const config: MongoClientConfig = {
url: "mongodb://localhost:27017",
database: "testdb",
};
Using a configuration object
const config: MongoClientConfig = {
url: {
host: "localhost",
port: 27017,
username: "admin",
password: "secret",
authSource: "admin",
},
database: "testdb",
};
| Name | Description |
|---|---|
url | MongoDB connection URL or configuration object. |
database | Database name to connect to. |
Properties
MongoDB connection URL or configuration object.
- readonly
databasestringDatabase name to connect to.
#MongoCollection
interface MongoCollection<T extends Document>MongoDB collection interface
| Name | Description |
|---|---|
find() | — |
findOne() | — |
insertOne() | — |
insertMany() | — |
updateOne() | — |
updateMany() | — |
deleteOne() | — |
deleteMany() | — |
aggregate() | — |
countDocuments() | — |
Methods
find(filter?: Filter, options?: MongoFindOptions): Promise<MongoFindResult<T>>Parameters
filter?Filteroptions?MongoFindOptions
findOne(filter: Filter, options?: MongoOptions): Promise<MongoFindOneResult<T>>Parameters
filterFilteroptions?MongoOptions
insertOne(
doc: Omit<T, "_id">,
options?: MongoOptions,
): Promise<MongoInsertOneResult>Parameters
docOmit<T, "_id">options?MongoOptions
insertMany(
docs: Omit<T, "_id">[],
options?: MongoOptions,
): Promise<MongoInsertManyResult>Parameters
docsOmit<T, "_id">[]options?MongoOptions
updateOne(
filter: Filter,
update: UpdateFilter,
options?: MongoUpdateOptions,
): Promise<MongoUpdateResult>Parameters
filterFilterupdateUpdateFilteroptions?MongoUpdateOptions
updateMany(
filter: Filter,
update: UpdateFilter,
options?: MongoUpdateOptions,
): Promise<MongoUpdateResult>Parameters
filterFilterupdateUpdateFilteroptions?MongoUpdateOptions
deleteOne(filter: Filter, options?: MongoOptions): Promise<MongoDeleteResult>Parameters
filterFilteroptions?MongoOptions
deleteMany(filter: Filter, options?: MongoOptions): Promise<MongoDeleteResult>Parameters
filterFilteroptions?MongoOptions
aggregate<R = T>(
pipeline: Document[],
options?: MongoOptions,
): Promise<MongoFindResult<R>>Parameters
pipelineDocument[]options?MongoOptions
countDocuments(
filter?: Filter,
options?: MongoOptions,
): Promise<MongoCountResult>Parameters
filter?Filteroptions?MongoOptions
#MongoConnectionConfig
interface MongoConnectionConfig extends CommonConnectionConfigMongoDB connection configuration.
Extends CommonConnectionConfig with MongoDB-specific options.
| Name | Description |
|---|---|
database | Database name to connect to. |
authSource | Authentication database. |
replicaSet | Replica set name. |
Properties
- readonly
database?stringDatabase name to connect to.
- readonly
authSource?stringAuthentication database.
- readonly
replicaSet?stringReplica set name.
#MongoCountResultError
interface MongoCountResultError extends MongoCountResultBaseCount result with MongoDB error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
countnull
#MongoCountResultExpectation
interface MongoCountResultExpectationFluent API for MongoDB count result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the count result is successful. |
toHaveCount() | Asserts that the count equals the expected value. |
toHaveCountEqual() | Asserts that the count equals the expected value using deep equality. |
toHaveCountStrictEqual() | Asserts that the count strictly equals the expected value. |
toHaveCountSatisfying() | Asserts that the count satisfies the provided matcher function. |
toHaveCountNaN() | Asserts that the count is NaN. |
toHaveCountGreaterThan() | Asserts that the count is greater than the expected value. |
toHaveCountGreaterThanOrEqual() | Asserts that the count is greater than or equal to the expected value. |
toHaveCountLessThan() | Asserts that the count is less than the expected value. |
toHaveCountLessThanOrEqual() | Asserts that the count is less than or equal to the expected value. |
toHaveCountCloseTo() | Asserts that the count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the count result is successful.
toHaveCount(expected: unknown): thisAsserts that the count equals the expected value.
Parameters
expectedunknown- The expected count
toHaveCountEqual(expected: unknown): thisAsserts that the count equals the expected value using deep equality.
Parameters
expectedunknown- The expected count
toHaveCountStrictEqual(expected: unknown): thisAsserts that the count strictly equals the expected value.
Parameters
expectedunknown- The expected count
toHaveCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the count and performs assertions
toHaveCountNaN(): thisAsserts that the count is NaN.
toHaveCountGreaterThan(expected: number): thisAsserts that the count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveCountGreaterThanOrEqual(expected: number): thisAsserts that the count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveCountLessThan(expected: number): thisAsserts that the count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveCountLessThanOrEqual(expected: number): thisAsserts that the count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveCountCloseTo(expected: number, numDigits?: number): thisAsserts that the count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoCountResultFailure
interface MongoCountResultFailure extends MongoCountResultBaseCount result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
countnull
#MongoCountResultSuccess
interface MongoCountResultSuccess extends MongoCountResultBaseSuccessful count result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
countnumber
#MongoDeleteResultError
interface MongoDeleteResultError extends MongoDeleteResultBaseDelete result with MongoDB error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
deletedCount | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
deletedCountnull
#MongoDeleteResultExpectation
interface MongoDeleteResultExpectationFluent API for MongoDB delete result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the delete result is successful. |
toHaveDeletedCount() | Asserts that the deleted count equals the expected value. |
toHaveDeletedCountEqual() | Asserts that the deleted count equals the expected value using deep equality. |
toHaveDeletedCountStrictEqual() | Asserts that the deleted count strictly equals the expected value. |
toHaveDeletedCountSatisfying() | Asserts that the deleted count satisfies the provided matcher function. |
toHaveDeletedCountNaN() | Asserts that the deleted count is NaN. |
toHaveDeletedCountGreaterThan() | Asserts that the deleted count is greater than the expected value. |
toHaveDeletedCountGreaterThanOrEqual() | Asserts that the deleted count is greater than or equal to the expected value. |
toHaveDeletedCountLessThan() | Asserts that the deleted count is less than the expected value. |
toHaveDeletedCountLessThanOrEqual() | Asserts that the deleted count is less than or equal to the expected value. |
toHaveDeletedCountCloseTo() | Asserts that the deleted count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the delete result is successful.
toHaveDeletedCount(expected: unknown): thisAsserts that the deleted count equals the expected value.
Parameters
expectedunknown- The expected deleted count
toHaveDeletedCountEqual(expected: unknown): thisAsserts that the deleted count equals the expected value using deep equality.
Parameters
expectedunknown- The expected deleted count
toHaveDeletedCountStrictEqual(expected: unknown): thisAsserts that the deleted count strictly equals the expected value.
Parameters
expectedunknown- The expected deleted count
toHaveDeletedCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the deleted count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the deleted count and performs assertions
toHaveDeletedCountNaN(): thisAsserts that the deleted count is NaN.
toHaveDeletedCountGreaterThan(expected: number): thisAsserts that the deleted count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDeletedCountGreaterThanOrEqual(expected: number): thisAsserts that the deleted count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDeletedCountLessThan(expected: number): thisAsserts that the deleted count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDeletedCountLessThanOrEqual(expected: number): thisAsserts that the deleted count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDeletedCountCloseTo(expected: number, numDigits?: number): thisAsserts that the deleted count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoDeleteResultFailure
interface MongoDeleteResultFailure extends MongoDeleteResultBaseDelete result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
deletedCount | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
deletedCountnull
#MongoDeleteResultSuccess
interface MongoDeleteResultSuccess extends MongoDeleteResultBaseSuccessful delete result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
deletedCount | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
deletedCountnumber
#MongoErrorOptions
interface MongoErrorOptions extends ErrorOptionsOptions for MongoDB errors.
| Name | Description |
|---|---|
code | — |
Properties
- readonly
code?number
#MongoFindOneResultError
interface MongoFindOneResultError<T = Document> extends MongoFindOneResultBase<T>FindOne result with MongoDB error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
docnull
#MongoFindOneResultExpectation
interface MongoFindOneResultExpectation<_T = unknown>Fluent API for MongoDB findOne result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the findOne result is successful. |
toHaveDoc() | Asserts that the doc equals the expected value. |
toHaveDocEqual() | Asserts that the doc equals the expected value using deep equality. |
toHaveDocStrictEqual() | Asserts that the doc strictly equals the expected value. |
toHaveDocSatisfying() | Asserts that the doc satisfies the provided matcher function. |
toHaveDocPresent() | Asserts that the doc is present (not null or undefined). |
toHaveDocNull() | Asserts that the doc is null. |
toHaveDocUndefined() | Asserts that the doc is undefined. |
toHaveDocNullish() | Asserts that the doc is nullish (null or undefined). |
toHaveDocMatching() | Asserts that the doc matches the specified subset. |
toHaveDocProperty() | Asserts that the doc has the specified property. |
toHaveDocPropertyContaining() | Asserts that the doc property contains the expected value. |
toHaveDocPropertyMatching() | Asserts that the doc property matches the specified subset. |
toHaveDocPropertySatisfying() | Asserts that the doc property satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the findOne result is successful.
toHaveDoc(expected: unknown): thisAsserts that the doc equals the expected value.
Parameters
expectedunknown- The expected doc value
toHaveDocEqual(expected: unknown): thisAsserts that the doc equals the expected value using deep equality.
Parameters
expectedunknown- The expected doc value
toHaveDocStrictEqual(expected: unknown): thisAsserts that the doc strictly equals the expected value.
Parameters
expectedunknown- The expected doc value
toHaveDocSatisfying(matcher: (value: MongoFindOneDoc<_T>) => unknown): thisAsserts that the doc satisfies the provided matcher function.
Parameters
matcher(value: MongoFindOneDoc<_T>) => unknown- A function that receives the doc and performs assertions
toHaveDocPresent(): thisAsserts that the doc is present (not null or undefined).
toHaveDocNull(): thisAsserts that the doc is null.
toHaveDocUndefined(): thisAsserts that the doc is undefined.
toHaveDocNullish(): thisAsserts that the doc is nullish (null or undefined).
toHaveDocMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the doc matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDocProperty(keyPath: string | string[], value?: unknown): thisAsserts that the doc has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveDocPropertyContaining(keyPath: string | string[], expected: unknown): thisAsserts that the doc property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveDocPropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the doc property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDocPropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the doc property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoFindOneResultFailure
interface MongoFindOneResultFailure<T = Document> extends MongoFindOneResultBase<T>FindOne result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
docnull
#MongoFindOneResultSuccess
interface MongoFindOneResultSuccess<T = Document> extends MongoFindOneResultBase<T>Successful findOne result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
docT | null
#MongoFindOptions
interface MongoFindOptions extends MongoOptionsMongoDB find options
| Name | Description |
|---|---|
sort | — |
limit | — |
skip | — |
projection | — |
Properties
- readonly
sort?Record<string, 1 | -1> - readonly
limit?number - readonly
skip?number - readonly
projection?Record<string, 0 | 1>
#MongoFindResultError
interface MongoFindResultError<T = Document> extends MongoFindResultBase<T>Find result with MongoDB error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
docsreadonly T[]
#MongoFindResultExpectation
interface MongoFindResultExpectation<_T = unknown>Fluent API for MongoDB find result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the find result is successful. |
toHaveDocs() | Asserts that the docs equal the expected value. |
toHaveDocsEqual() | Asserts that the docs equal the expected value using deep equality. |
toHaveDocsStrictEqual() | Asserts that the docs strictly equal the expected value. |
toHaveDocsSatisfying() | Asserts that the docs satisfy the provided matcher function. |
toHaveDocsContaining() | Asserts that the docs array contains the specified item. |
toHaveDocsContainingEqual() | Asserts that the docs array contains an item equal to the specified value. |
toHaveDocsMatching() | Asserts that the docs array matches the specified subset. |
toHaveDocsEmpty() | Asserts that the docs array is empty. |
toHaveDocsCount() | Asserts that the docs count equals the expected value. |
toHaveDocsCountEqual() | Asserts that the docs count equals the expected value using deep equality. |
toHaveDocsCountStrictEqual() | Asserts that the docs count strictly equals the expected value. |
toHaveDocsCountSatisfying() | Asserts that the docs count satisfies the provided matcher function. |
toHaveDocsCountNaN() | Asserts that the docs count is NaN. |
toHaveDocsCountGreaterThan() | Asserts that the docs count is greater than the expected value. |
toHaveDocsCountGreaterThanOrEqual() | Asserts that the docs count is greater than or equal to the expected value. |
toHaveDocsCountLessThan() | Asserts that the docs count is less than the expected value. |
toHaveDocsCountLessThanOrEqual() | Asserts that the docs count is less than or equal to the expected value. |
toHaveDocsCountCloseTo() | Asserts that the docs count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the find result is successful.
toHaveDocs(expected: unknown): thisAsserts that the docs equal the expected value.
Parameters
expectedunknown- The expected docs value
toHaveDocsEqual(expected: unknown): thisAsserts that the docs equal the expected value using deep equality.
Parameters
expectedunknown- The expected docs value
toHaveDocsStrictEqual(expected: unknown): thisAsserts that the docs strictly equal the expected value.
Parameters
expectedunknown- The expected docs value
toHaveDocsSatisfying(matcher: (value: MongoFindDocs<_T>) => unknown): thisAsserts that the docs satisfy the provided matcher function.
Parameters
matcher(value: MongoFindDocs<_T>) => unknown- A function that receives the docs and performs assertions
toHaveDocsContaining(item: unknown): thisAsserts that the docs array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveDocsContainingEqual(item: unknown): thisAsserts that the docs array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveDocsMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the docs array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveDocsEmpty(): thisAsserts that the docs array is empty.
toHaveDocsCount(expected: unknown): thisAsserts that the docs count equals the expected value.
Parameters
expectedunknown- The expected docs count
toHaveDocsCountEqual(expected: unknown): thisAsserts that the docs count equals the expected value using deep equality.
Parameters
expectedunknown- The expected docs count
toHaveDocsCountStrictEqual(expected: unknown): thisAsserts that the docs count strictly equals the expected value.
Parameters
expectedunknown- The expected docs count
toHaveDocsCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the docs count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the docs count and performs assertions
toHaveDocsCountNaN(): thisAsserts that the docs count is NaN.
toHaveDocsCountGreaterThan(expected: number): thisAsserts that the docs count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDocsCountGreaterThanOrEqual(expected: number): thisAsserts that the docs count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDocsCountLessThan(expected: number): thisAsserts that the docs count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDocsCountLessThanOrEqual(expected: number): thisAsserts that the docs count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDocsCountCloseTo(expected: number, numDigits?: number): thisAsserts that the docs count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoFindResultFailure
interface MongoFindResultFailure<T = Document> extends MongoFindResultBase<T>Find result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
docsnull
#MongoFindResultSuccess
interface MongoFindResultSuccess<T = Document> extends MongoFindResultBase<T>Successful find result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
docsreadonly T[]
#MongoInsertManyResultError
interface MongoInsertManyResultError extends MongoInsertManyResultBaseInsertMany result with MongoDB error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedIds | — |
insertedCount | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
insertedIdsnull - readonly
insertedCountnull
#MongoInsertManyResultExpectation
interface MongoInsertManyResultExpectationFluent API for MongoDB insertMany result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the insert result is successful. |
toHaveInsertedIds() | Asserts that the inserted IDs equal the expected value. |
toHaveInsertedIdsEqual() | Asserts that the inserted IDs equal the expected value using deep equality. |
toHaveInsertedIdsStrictEqual() | Asserts that the inserted IDs strictly equal the expected value. |
toHaveInsertedIdsSatisfying() | Asserts that the inserted IDs satisfy the provided matcher function. |
toHaveInsertedIdsContaining() | Asserts that the inserted IDs array contains the specified item. |
toHaveInsertedIdsContainingEqual() | Asserts that the inserted IDs array contains an item equal to the specified value. |
toHaveInsertedIdsMatching() | Asserts that the inserted IDs array matches the specified subset. |
toHaveInsertedIdsEmpty() | Asserts that the inserted IDs array is empty. |
toHaveInsertedCount() | Asserts that the inserted count equals the expected value. |
toHaveInsertedCountEqual() | Asserts that the inserted count equals the expected value using deep equality. |
toHaveInsertedCountStrictEqual() | Asserts that the inserted count strictly equals the expected value. |
toHaveInsertedCountSatisfying() | Asserts that the inserted count satisfies the provided matcher function. |
toHaveInsertedCountNaN() | Asserts that the inserted count is NaN. |
toHaveInsertedCountGreaterThan() | Asserts that the inserted count is greater than the expected value. |
toHaveInsertedCountGreaterThanOrEqual() | Asserts that the inserted count is greater than or equal to the expected value. |
toHaveInsertedCountLessThan() | Asserts that the inserted count is less than the expected value. |
toHaveInsertedCountLessThanOrEqual() | Asserts that the inserted count is less than or equal to the expected value. |
toHaveInsertedCountCloseTo() | Asserts that the inserted count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the insert result is successful.
toHaveInsertedIds(expected: unknown): thisAsserts that the inserted IDs equal the expected value.
Parameters
expectedunknown- The expected inserted IDs
toHaveInsertedIdsEqual(expected: unknown): thisAsserts that the inserted IDs equal the expected value using deep equality.
Parameters
expectedunknown- The expected inserted IDs
toHaveInsertedIdsStrictEqual(expected: unknown): thisAsserts that the inserted IDs strictly equal the expected value.
Parameters
expectedunknown- The expected inserted IDs
toHaveInsertedIdsSatisfying(matcher: (value: string[]) => unknown): thisAsserts that the inserted IDs satisfy the provided matcher function.
Parameters
matcher(value: string[]) => unknown- A function that receives the inserted IDs and performs assertions
toHaveInsertedIdsContaining(item: unknown): thisAsserts that the inserted IDs array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveInsertedIdsContainingEqual(item: unknown): thisAsserts that the inserted IDs array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveInsertedIdsMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the inserted IDs array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveInsertedIdsEmpty(): thisAsserts that the inserted IDs array is empty.
toHaveInsertedCount(expected: unknown): thisAsserts that the inserted count equals the expected value.
Parameters
expectedunknown- The expected inserted count
toHaveInsertedCountEqual(expected: unknown): thisAsserts that the inserted count equals the expected value using deep equality.
Parameters
expectedunknown- The expected inserted count
toHaveInsertedCountStrictEqual(expected: unknown): thisAsserts that the inserted count strictly equals the expected value.
Parameters
expectedunknown- The expected inserted count
toHaveInsertedCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the inserted count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the inserted count and performs assertions
toHaveInsertedCountNaN(): thisAsserts that the inserted count is NaN.
toHaveInsertedCountGreaterThan(expected: number): thisAsserts that the inserted count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveInsertedCountGreaterThanOrEqual(expected: number): thisAsserts that the inserted count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveInsertedCountLessThan(expected: number): thisAsserts that the inserted count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveInsertedCountLessThanOrEqual(expected: number): thisAsserts that the inserted count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveInsertedCountCloseTo(expected: number, numDigits?: number): thisAsserts that the inserted count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoInsertManyResultFailure
interface MongoInsertManyResultFailure extends MongoInsertManyResultBaseInsertMany result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedIds | — |
insertedCount | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
insertedIdsnull - readonly
insertedCountnull
#MongoInsertManyResultSuccess
interface MongoInsertManyResultSuccess extends MongoInsertManyResultBaseSuccessful insertMany result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedIds | — |
insertedCount | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
insertedIdsreadonly string[] - readonly
insertedCountnumber
#MongoInsertOneResultError
interface MongoInsertOneResultError extends MongoInsertOneResultBaseInsertOne result with MongoDB error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedId | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
insertedIdnull
#MongoInsertOneResultExpectation
interface MongoInsertOneResultExpectationFluent API for MongoDB insertOne result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the insert result is successful. |
toHaveInsertedId() | Asserts that the inserted ID equals the expected value. |
toHaveInsertedIdEqual() | Asserts that the inserted ID equals the expected value using deep equality. |
toHaveInsertedIdStrictEqual() | Asserts that the inserted ID strictly equals the expected value. |
toHaveInsertedIdSatisfying() | Asserts that the inserted ID satisfies the provided matcher function. |
toHaveInsertedIdContaining() | Asserts that the inserted ID contains the specified substring. |
toHaveInsertedIdMatching() | Asserts that the inserted ID matches the specified regular expression. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the insert result is successful.
toHaveInsertedId(expected: unknown): thisAsserts that the inserted ID equals the expected value.
Parameters
expectedunknown- The expected inserted ID
toHaveInsertedIdEqual(expected: unknown): thisAsserts that the inserted ID equals the expected value using deep equality.
Parameters
expectedunknown- The expected inserted ID
toHaveInsertedIdStrictEqual(expected: unknown): thisAsserts that the inserted ID strictly equals the expected value.
Parameters
expectedunknown- The expected inserted ID
toHaveInsertedIdSatisfying(matcher: (value: string) => unknown): thisAsserts that the inserted ID satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the inserted ID and performs assertions
toHaveInsertedIdContaining(substr: string): thisAsserts that the inserted ID contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveInsertedIdMatching(expected: RegExp): thisAsserts that the inserted ID matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoInsertOneResultFailure
interface MongoInsertOneResultFailure extends MongoInsertOneResultBaseInsertOne result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedId | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
insertedIdnull
#MongoInsertOneResultSuccess
interface MongoInsertOneResultSuccess extends MongoInsertOneResultBaseSuccessful insertOne result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
insertedId | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
insertedIdstring
#MongoOptions
interface MongoOptions extends CommonOptionsCommon options with throwOnError support.
| Name | Description |
|---|---|
throwOnError | If true, throws errors instead of returning them in the result. |
Properties
- readonly
throwOnError?booleanIf true, throws errors instead of returning them in the result. If false (default), errors are returned in the result object.
#MongoSession
interface MongoSessionMongoDB session interface (for transactions)
| Name | Description |
|---|---|
collection() | — |
Methods
collection<T extends Document = Document>(name: string): MongoCollection<T>Parameters
namestring
#MongoUpdateOptions
interface MongoUpdateOptions extends MongoOptionsMongoDB update options
| Name | Description |
|---|---|
upsert | — |
Properties
- readonly
upsert?boolean
#MongoUpdateResultError
interface MongoUpdateResultError extends MongoUpdateResultBaseUpdate result with MongoDB error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
matchedCount | — |
modifiedCount | — |
upsertedId | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
matchedCountnull - readonly
modifiedCountnull - readonly
upsertedIdnull
#MongoUpdateResultExpectation
interface MongoUpdateResultExpectationFluent API for MongoDB update result validation.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the update result is successful. |
toHaveMatchedCount() | Asserts that the matched count equals the expected value. |
toHaveMatchedCountEqual() | Asserts that the matched count equals the expected value using deep equality. |
toHaveMatchedCountStrictEqual() | Asserts that the matched count strictly equals the expected value. |
toHaveMatchedCountSatisfying() | Asserts that the matched count satisfies the provided matcher function. |
toHaveMatchedCountNaN() | Asserts that the matched count is NaN. |
toHaveMatchedCountGreaterThan() | Asserts that the matched count is greater than the expected value. |
toHaveMatchedCountGreaterThanOrEqual() | Asserts that the matched count is greater than or equal to the expected value. |
toHaveMatchedCountLessThan() | Asserts that the matched count is less than the expected value. |
toHaveMatchedCountLessThanOrEqual() | Asserts that the matched count is less than or equal to the expected value. |
toHaveMatchedCountCloseTo() | Asserts that the matched count is close to the expected value. |
toHaveModifiedCount() | Asserts that the modified count equals the expected value. |
toHaveModifiedCountEqual() | Asserts that the modified count equals the expected value using deep equality. |
toHaveModifiedCountStrictEqual() | Asserts that the modified count strictly equals the expected value. |
toHaveModifiedCountSatisfying() | Asserts that the modified count satisfies the provided matcher function. |
toHaveModifiedCountNaN() | Asserts that the modified count is NaN. |
toHaveModifiedCountGreaterThan() | Asserts that the modified count is greater than the expected value. |
toHaveModifiedCountGreaterThanOrEqual() | Asserts that the modified count is greater than or equal to the expected value. |
toHaveModifiedCountLessThan() | Asserts that the modified count is less than the expected value. |
toHaveModifiedCountLessThanOrEqual() | Asserts that the modified count is less than or equal to the expected value. |
toHaveModifiedCountCloseTo() | Asserts that the modified count is close to the expected value. |
toHaveUpsertedId() | Asserts that the upserted ID equals the expected value. |
toHaveUpsertedIdEqual() | Asserts that the upserted ID equals the expected value using deep equality. |
toHaveUpsertedIdStrictEqual() | Asserts that the upserted ID strictly equals the expected value. |
toHaveUpsertedIdSatisfying() | Asserts that the upserted ID satisfies the provided matcher function. |
toHaveUpsertedIdPresent() | Asserts that the upserted ID is present (not null or undefined). |
toHaveUpsertedIdNull() | Asserts that the upserted ID is null. |
toHaveUpsertedIdUndefined() | Asserts that the upserted ID is undefined. |
toHaveUpsertedIdNullish() | Asserts that the upserted ID is nullish (null or undefined). |
toHaveUpsertedIdContaining() | Asserts that the upserted ID contains the specified substring. |
toHaveUpsertedIdMatching() | Asserts that the upserted ID matches the specified regular expression. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the update result is successful.
toHaveMatchedCount(expected: unknown): thisAsserts that the matched count equals the expected value.
Parameters
expectedunknown- The expected matched count
toHaveMatchedCountEqual(expected: unknown): thisAsserts that the matched count equals the expected value using deep equality.
Parameters
expectedunknown- The expected matched count
toHaveMatchedCountStrictEqual(expected: unknown): thisAsserts that the matched count strictly equals the expected value.
Parameters
expectedunknown- The expected matched count
toHaveMatchedCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the matched count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the matched count and performs assertions
toHaveMatchedCountNaN(): thisAsserts that the matched count is NaN.
toHaveMatchedCountGreaterThan(expected: number): thisAsserts that the matched count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMatchedCountGreaterThanOrEqual(expected: number): thisAsserts that the matched count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMatchedCountLessThan(expected: number): thisAsserts that the matched count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMatchedCountLessThanOrEqual(expected: number): thisAsserts that the matched count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMatchedCountCloseTo(expected: number, numDigits?: number): thisAsserts that the matched count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveModifiedCount(expected: unknown): thisAsserts that the modified count equals the expected value.
Parameters
expectedunknown- The expected modified count
toHaveModifiedCountEqual(expected: unknown): thisAsserts that the modified count equals the expected value using deep equality.
Parameters
expectedunknown- The expected modified count
toHaveModifiedCountStrictEqual(expected: unknown): thisAsserts that the modified count strictly equals the expected value.
Parameters
expectedunknown- The expected modified count
toHaveModifiedCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the modified count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the modified count and performs assertions
toHaveModifiedCountNaN(): thisAsserts that the modified count is NaN.
toHaveModifiedCountGreaterThan(expected: number): thisAsserts that the modified count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveModifiedCountGreaterThanOrEqual(expected: number): thisAsserts that the modified count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveModifiedCountLessThan(expected: number): thisAsserts that the modified count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveModifiedCountLessThanOrEqual(expected: number): thisAsserts that the modified count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveModifiedCountCloseTo(expected: number, numDigits?: number): thisAsserts that the modified count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveUpsertedId(expected: unknown): thisAsserts that the upserted ID equals the expected value.
Parameters
expectedunknown- The expected upserted ID
toHaveUpsertedIdEqual(expected: unknown): thisAsserts that the upserted ID equals the expected value using deep equality.
Parameters
expectedunknown- The expected upserted ID
toHaveUpsertedIdStrictEqual(expected: unknown): thisAsserts that the upserted ID strictly equals the expected value.
Parameters
expectedunknown- The expected upserted ID
toHaveUpsertedIdSatisfying(matcher: (value: MongoUpsertedId) => unknown): thisAsserts that the upserted ID satisfies the provided matcher function.
Parameters
matcher(value: MongoUpsertedId) => unknown- A function that receives the upserted ID and performs assertions
toHaveUpsertedIdPresent(): thisAsserts that the upserted ID is present (not null or undefined).
toHaveUpsertedIdNull(): thisAsserts that the upserted ID is null.
toHaveUpsertedIdUndefined(): thisAsserts that the upserted ID is undefined.
toHaveUpsertedIdNullish(): thisAsserts that the upserted ID is nullish (null or undefined).
toHaveUpsertedIdContaining(substr: string): thisAsserts that the upserted ID contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveUpsertedIdMatching(expected: RegExp): thisAsserts that the upserted ID matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#MongoUpdateResultFailure
interface MongoUpdateResultFailure extends MongoUpdateResultBaseUpdate result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
matchedCount | — |
modifiedCount | — |
upsertedId | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
matchedCountnull - readonly
modifiedCountnull - readonly
upsertedIdnull
#MongoUpdateResultSuccess
interface MongoUpdateResultSuccess extends MongoUpdateResultBaseSuccessful update result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
matchedCount | — |
modifiedCount | — |
upsertedId | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
matchedCountnumber - readonly
modifiedCountnumber - readonly
upsertedIdstring | null
#RabbitMqAckResultError
interface RabbitMqAckResultError extends RabbitMqAckResultBaseAck result with RabbitMQ error.
Properties
- readonly
processedtrue - readonly
okfalse
#RabbitMqAckResultExpectation
interface RabbitMqAckResultExpectationFluent API for RabbitMQ ack result validation.
Provides chainable assertions for message acknowledgment results. Ack results only have ok and duration properties.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RabbitMqAckResultFailure
interface RabbitMqAckResultFailure extends RabbitMqAckResultBaseAck result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#RabbitMqAckResultSuccess
interface RabbitMqAckResultSuccess extends RabbitMqAckResultBaseSuccessful ack result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#RabbitMqChannel
interface RabbitMqChannel extends AsyncDisposableRabbitMQ channel interface.
| Name | Description |
|---|---|
assertExchange() | — |
deleteExchange() | — |
assertQueue() | — |
deleteQueue() | — |
purgeQueue() | — |
bindQueue() | — |
unbindQueue() | — |
publish() | — |
sendToQueue() | — |
get() | — |
consume() | — |
ack() | — |
nack() | — |
reject() | — |
prefetch() | — |
close() | — |
Methods
assertExchange(
name: string,
type: RabbitMqExchangeType,
options?: RabbitMqExchangeOptions,
): Promise<RabbitMqExchangeResult>Parameters
namestringoptions?RabbitMqExchangeOptions
deleteExchange(
name: string,
options?: RabbitMqOptions,
): Promise<RabbitMqExchangeResult>Parameters
namestringoptions?RabbitMqOptions
assertQueue(
name: string,
options?: RabbitMqQueueOptions,
): Promise<RabbitMqQueueResult>Parameters
namestringoptions?RabbitMqQueueOptions
deleteQueue(
name: string,
options?: RabbitMqOptions,
): Promise<RabbitMqQueueResult>Parameters
namestringoptions?RabbitMqOptions
purgeQueue(
name: string,
options?: RabbitMqOptions,
): Promise<RabbitMqQueueResult>Parameters
namestringoptions?RabbitMqOptions
bindQueue(
queue: string,
exchange: string,
routingKey: string,
options?: RabbitMqOptions,
): Promise<RabbitMqExchangeResult>Parameters
queuestringexchangestringroutingKeystringoptions?RabbitMqOptions
unbindQueue(
queue: string,
exchange: string,
routingKey: string,
options?: RabbitMqOptions,
): Promise<RabbitMqExchangeResult>Parameters
queuestringexchangestringroutingKeystringoptions?RabbitMqOptions
publish(
exchange: string,
routingKey: string,
content: Uint8Array,
options?: RabbitMqPublishOptions,
): Promise<RabbitMqPublishResult>Parameters
exchangestringroutingKeystringcontentUint8Arrayoptions?RabbitMqPublishOptions
sendToQueue(
queue: string,
content: Uint8Array,
options?: RabbitMqPublishOptions,
): Promise<RabbitMqPublishResult>Parameters
queuestringcontentUint8Arrayoptions?RabbitMqPublishOptions
get(queue: string, options?: RabbitMqOptions): Promise<RabbitMqConsumeResult>Parameters
queuestringoptions?RabbitMqOptions
consume(
queue: string,
options?: RabbitMqConsumeOptions,
): AsyncIterable<RabbitMqMessage>Parameters
queuestringoptions?RabbitMqConsumeOptions
ack(
message: RabbitMqMessage,
options?: RabbitMqOptions,
): Promise<RabbitMqAckResult>Parameters
messageRabbitMqMessageoptions?RabbitMqOptions
nack(
message: RabbitMqMessage,
options?: RabbitMqNackOptions,
): Promise<RabbitMqAckResult>Parameters
messageRabbitMqMessageoptions?RabbitMqNackOptions
reject(
message: RabbitMqMessage,
options?: RabbitMqRejectOptions,
): Promise<RabbitMqAckResult>Parameters
messageRabbitMqMessageoptions?RabbitMqRejectOptions
prefetch(count: number): Promise<void>Parameters
countnumber
close(): Promise<void>#RabbitMqChannelErrorOptions
interface RabbitMqChannelErrorOptions extends RabbitMqErrorOptionsOptions for RabbitMQ channel errors.
| Name | Description |
|---|---|
channelId | — |
Properties
- readonly
channelId?number
#RabbitMqClient
interface RabbitMqClient extends AsyncDisposableRabbitMQ client interface.
Properties
Methods
channel(): Promise<RabbitMqChannel>close(): Promise<void>#RabbitMqClientConfig
interface RabbitMqClientConfig extends CommonOptionsRabbitMQ client configuration.
| Name | Description |
|---|---|
url | RabbitMQ connection URL or configuration object. |
heartbeat | Heartbeat interval in seconds |
prefetch | Default prefetch count for channels |
throwOnError | Whether to throw errors instead of returning them in results. |
Properties
RabbitMQ connection URL or configuration object.
- readonly
heartbeat?numberHeartbeat interval in seconds
- readonly
prefetch?numberDefault prefetch count for channels
- readonly
throwOnError?booleanWhether to throw errors instead of returning them in results.
#RabbitMqConnectionConfig
interface RabbitMqConnectionConfig extends CommonConnectionConfigRabbitMQ connection configuration.
Extends CommonConnectionConfig with RabbitMQ-specific options.
| Name | Description |
|---|---|
vhost | Virtual host. |
Properties
- readonly
vhost?stringVirtual host.
#RabbitMqConsumeOptions
interface RabbitMqConsumeOptions extends RabbitMqOptionsConsume options.
Properties
- readonly
noAck?boolean - readonly
exclusive?boolean - readonly
priority?number
#RabbitMqConsumeResultError
interface RabbitMqConsumeResultError extends RabbitMqConsumeResultBaseConsume result with RabbitMQ error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
messagenull
#RabbitMqConsumeResultExpectation
interface RabbitMqConsumeResultExpectationFluent API for RabbitMQ consume result validation.
Provides chainable assertions specifically designed for message consumption results including message content, properties, headers, and metadata.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveMessage() | Asserts that the message equals the expected value. |
toHaveMessageEqual() | Asserts that the message equals the expected value using deep equality. |
toHaveMessageStrictEqual() | Asserts that the message strictly equals the expected value. |
toHaveMessageSatisfying() | Asserts that the message satisfies the provided matcher function. |
toHaveMessagePresent() | Asserts that the message is present (not null or undefined). |
toHaveMessageNull() | Asserts that the message is null (no message received). |
toHaveMessageUndefined() | Asserts that the message is undefined. |
toHaveMessageNullish() | Asserts that the message is nullish (null or undefined). |
toHaveMessageMatching() | Asserts that the message matches the specified subset. |
toHaveMessageProperty() | Asserts that the message has the specified property. |
toHaveMessagePropertyContaining() | Asserts that the message property contains the expected value. |
toHaveMessagePropertyMatching() | Asserts that the message property matches the specified subset. |
toHaveMessagePropertySatisfying() | Asserts that the message property satisfies the provided matcher function. |
toHaveContent() | Asserts that the content equals the expected value. |
toHaveContentEqual() | Asserts that the content equals the expected value using deep equality. |
toHaveContentStrictEqual() | Asserts that the content strictly equals the expected value. |
toHaveContentSatisfying() | Asserts that the content satisfies the provided matcher function. |
toHaveContentPresent() | Asserts that the content is present (not null or undefined). |
toHaveContentNull() | Asserts that the content is null. |
toHaveContentUndefined() | Asserts that the content is undefined. |
toHaveContentNullish() | Asserts that the content is nullish (null or undefined). |
toHaveContentLength() | Asserts that the content length equals the expected value. |
toHaveContentLengthEqual() | Asserts that the content length equals the expected value using deep equality. |
toHaveContentLengthStrictEqual() | Asserts that the content length strictly equals the expected value. |
toHaveContentLengthSatisfying() | Asserts that the content length satisfies the provided matcher function. |
toHaveContentLengthNaN() | Asserts that the content length is NaN. |
toHaveContentLengthGreaterThan() | Asserts that the content length is greater than the expected value. |
toHaveContentLengthGreaterThanOrEqual() | Asserts that the content length is greater than or equal to the expected value. |
toHaveContentLengthLessThan() | Asserts that the content length is less than the expected value. |
toHaveContentLengthLessThanOrEqual() | Asserts that the content length is less than or equal to the expected value. |
toHaveContentLengthCloseTo() | Asserts that the content length is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveMessage(expected: unknown): thisAsserts that the message equals the expected value.
Parameters
expectedunknown- The expected message
toHaveMessageEqual(expected: unknown): thisAsserts that the message equals the expected value using deep equality.
Parameters
expectedunknown- The expected message
toHaveMessageStrictEqual(expected: unknown): thisAsserts that the message strictly equals the expected value.
Parameters
expectedunknown- The expected message
toHaveMessageSatisfying(matcher: (value: any) => unknown): thisAsserts that the message satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the message and performs assertions
toHaveMessagePresent(): thisAsserts that the message is present (not null or undefined).
toHaveMessageNull(): thisAsserts that the message is null (no message received).
toHaveMessageUndefined(): thisAsserts that the message is undefined.
toHaveMessageNullish(): thisAsserts that the message is nullish (null or undefined).
toHaveMessageMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the message matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveMessageProperty(keyPath: string | string[], value?: unknown): thisAsserts that the message has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveMessagePropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the message property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveMessagePropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the message property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveMessagePropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the message property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveContent(expected: unknown): thisAsserts that the content equals the expected value.
Parameters
expectedunknown- The expected content
toHaveContentEqual(expected: unknown): thisAsserts that the content equals the expected value using deep equality.
Parameters
expectedunknown- The expected content
toHaveContentStrictEqual(expected: unknown): thisAsserts that the content strictly equals the expected value.
Parameters
expectedunknown- The expected content
toHaveContentSatisfying(matcher: (value: any) => unknown): thisAsserts that the content satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the content and performs assertions
toHaveContentPresent(): thisAsserts that the content is present (not null or undefined).
toHaveContentNull(): thisAsserts that the content is null.
toHaveContentUndefined(): thisAsserts that the content is undefined.
toHaveContentNullish(): thisAsserts that the content is nullish (null or undefined).
toHaveContentLength(expected: unknown): thisAsserts that the content length equals the expected value.
Parameters
expectedunknown- The expected content length
toHaveContentLengthEqual(expected: unknown): thisAsserts that the content length equals the expected value using deep equality.
Parameters
expectedunknown- The expected content length
toHaveContentLengthStrictEqual(expected: unknown): thisAsserts that the content length strictly equals the expected value.
Parameters
expectedunknown- The expected content length
toHaveContentLengthSatisfying(matcher: (value: number) => unknown): thisAsserts that the content length satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the content length and performs assertions
toHaveContentLengthNaN(): thisAsserts that the content length is NaN.
toHaveContentLengthGreaterThan(expected: number): thisAsserts that the content length is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveContentLengthGreaterThanOrEqual(expected: number): thisAsserts that the content length is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveContentLengthLessThan(expected: number): thisAsserts that the content length is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveContentLengthLessThanOrEqual(expected: number): thisAsserts that the content length is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveContentLengthCloseTo(expected: number, numDigits?: number): thisAsserts that the content length is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RabbitMqConsumeResultFailure
interface RabbitMqConsumeResultFailure extends RabbitMqConsumeResultBaseConsume result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
messagenull
#RabbitMqConsumeResultSuccess
interface RabbitMqConsumeResultSuccess extends RabbitMqConsumeResultBaseSuccessful consume result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#RabbitMqErrorOptions
interface RabbitMqErrorOptions extends ErrorOptionsOptions for RabbitMQ errors.
| Name | Description |
|---|---|
code | — |
Properties
- readonly
code?number
#RabbitMqExchangeOptions
interface RabbitMqExchangeOptions extends RabbitMqOptionsExchange options.
| Name | Description |
|---|---|
durable | — |
autoDelete | — |
internal | — |
arguments | — |
Properties
- readonly
durable?boolean - readonly
autoDelete?boolean - readonly
internal?boolean - readonly
arguments?Record<string, unknown>
#RabbitMqExchangeResultError
interface RabbitMqExchangeResultError extends RabbitMqExchangeResultBaseExchange result with RabbitMQ error.
Properties
- readonly
processedtrue - readonly
okfalse
#RabbitMqExchangeResultExpectation
interface RabbitMqExchangeResultExpectationFluent API for RabbitMQ exchange result validation.
Provides chainable assertions for exchange declaration/deletion results. Exchange results only have ok and duration properties.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RabbitMqExchangeResultFailure
interface RabbitMqExchangeResultFailure extends RabbitMqExchangeResultBaseExchange result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#RabbitMqExchangeResultSuccess
interface RabbitMqExchangeResultSuccess extends RabbitMqExchangeResultBaseSuccessful exchange result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#RabbitMqMessage
interface RabbitMqMessageRabbitMQ message.
| Name | Description |
|---|---|
content | — |
properties | — |
fields | — |
Properties
- readonly
contentUint8Array
#RabbitMqMessageFields
interface RabbitMqMessageFieldsRabbitMQ message fields.
| Name | Description |
|---|---|
deliveryTag | — |
redelivered | — |
exchange | — |
routingKey | — |
Properties
- readonly
deliveryTagbigint - readonly
redeliveredboolean - readonly
exchangestring - readonly
routingKeystring
#RabbitMqMessageProperties
interface RabbitMqMessagePropertiesRabbitMQ message properties.
| Name | Description |
|---|---|
contentType | — |
contentEncoding | — |
headers | — |
deliveryMode | 1: non-persistent, 2: persistent |
priority | — |
correlationId | — |
replyTo | — |
expiration | — |
messageId | — |
timestamp | — |
type | — |
userId | — |
appId | — |
Properties
- readonly
contentType?string - readonly
contentEncoding?string - readonly
headers?Record<string, unknown> - readonly
deliveryMode?1 | 21: non-persistent, 2: persistent
- readonly
priority?number - readonly
correlationId?string - readonly
replyTo?string - readonly
expiration?string - readonly
messageId?string - readonly
timestamp?number - readonly
type?string - readonly
userId?string - readonly
appId?string
#RabbitMqNackOptions
interface RabbitMqNackOptions extends RabbitMqOptionsNack options.
Properties
- readonly
requeue?boolean - readonly
allUpTo?boolean
#RabbitMqNotFoundErrorOptions
interface RabbitMqNotFoundErrorOptions extends RabbitMqErrorOptionsOptions for RabbitMQ not found errors.
| Name | Description |
|---|---|
resource | — |
Properties
- readonly
resourcestring
#RabbitMqOptions
interface RabbitMqOptions extends CommonOptionsBase options for RabbitMQ operations.
| Name | Description |
|---|---|
throwOnError | Whether to throw errors instead of returning them in results. |
Properties
- readonly
throwOnError?booleanWhether to throw errors instead of returning them in results. Overrides the client-level
throwOnErrorsetting.
#RabbitMqPreconditionFailedErrorOptions
interface RabbitMqPreconditionFailedErrorOptions extends RabbitMqErrorOptionsOptions for RabbitMQ precondition failed errors.
| Name | Description |
|---|---|
reason | — |
Properties
- readonly
reasonstring
#RabbitMqPublishOptions
interface RabbitMqPublishOptions extends RabbitMqOptionsPublish options.
| Name | Description |
|---|---|
persistent | — |
contentType | — |
contentEncoding | — |
headers | — |
correlationId | — |
replyTo | — |
expiration | — |
messageId | — |
priority | — |
Properties
- readonly
persistent?boolean - readonly
contentType?string - readonly
contentEncoding?string - readonly
headers?Record<string, unknown> - readonly
correlationId?string - readonly
replyTo?string - readonly
expiration?string - readonly
messageId?string - readonly
priority?number
#RabbitMqPublishResultError
interface RabbitMqPublishResultError extends RabbitMqPublishResultBasePublish result with RabbitMQ error.
Properties
- readonly
processedtrue - readonly
okfalse
#RabbitMqPublishResultExpectation
interface RabbitMqPublishResultExpectationFluent API for RabbitMQ publish result validation. Publish results only have ok and duration properties.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RabbitMqPublishResultFailure
interface RabbitMqPublishResultFailure extends RabbitMqPublishResultBasePublish result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#RabbitMqPublishResultSuccess
interface RabbitMqPublishResultSuccess extends RabbitMqPublishResultBaseSuccessful publish result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#RabbitMqQueueOptions
interface RabbitMqQueueOptions extends RabbitMqOptionsQueue options.
| Name | Description |
|---|---|
durable | — |
exclusive | — |
autoDelete | — |
arguments | — |
messageTtl | — |
maxLength | — |
deadLetterExchange | — |
deadLetterRoutingKey | — |
Properties
- readonly
durable?boolean - readonly
exclusive?boolean - readonly
autoDelete?boolean - readonly
arguments?Record<string, unknown> - readonly
messageTtl?number - readonly
maxLength?number - readonly
deadLetterExchange?string - readonly
deadLetterRoutingKey?string
#RabbitMqQueueResultError
interface RabbitMqQueueResultError extends RabbitMqQueueResultBaseQueue result with RabbitMQ error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
queue | — |
messageCount | — |
consumerCount | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
queuenull - readonly
messageCountnull - readonly
consumerCountnull
#RabbitMqQueueResultExpectation
interface RabbitMqQueueResultExpectationFluent API for RabbitMQ queue result validation.
Provides chainable assertions specifically designed for queue declaration results (e.g., assertQueue, checkQueue operations).
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveQueue() | Asserts that the queue name equals the expected value. |
toHaveQueueEqual() | Asserts that the queue name equals the expected value using deep equality. |
toHaveQueueStrictEqual() | Asserts that the queue name strictly equals the expected value. |
toHaveQueueSatisfying() | Asserts that the queue name satisfies the provided matcher function. |
toHaveQueueContaining() | Asserts that the queue name contains the specified substring. |
toHaveQueueMatching() | Asserts that the queue name matches the specified regular expression. |
toHaveMessageCount() | Asserts that the message count equals the expected value. |
toHaveMessageCountEqual() | Asserts that the message count equals the expected value using deep equality. |
toHaveMessageCountStrictEqual() | Asserts that the message count strictly equals the expected value. |
toHaveMessageCountSatisfying() | Asserts that the message count satisfies the provided matcher function. |
toHaveMessageCountNaN() | Asserts that the message count is NaN. |
toHaveMessageCountGreaterThan() | Asserts that the message count is greater than the expected value. |
toHaveMessageCountGreaterThanOrEqual() | Asserts that the message count is greater than or equal to the expected value. |
toHaveMessageCountLessThan() | Asserts that the message count is less than the expected value. |
toHaveMessageCountLessThanOrEqual() | Asserts that the message count is less than or equal to the expected value. |
toHaveMessageCountCloseTo() | Asserts that the message count is close to the expected value. |
toHaveConsumerCount() | Asserts that the consumer count equals the expected value. |
toHaveConsumerCountEqual() | Asserts that the consumer count equals the expected value using deep equality. |
toHaveConsumerCountStrictEqual() | Asserts that the consumer count strictly equals the expected value. |
toHaveConsumerCountSatisfying() | Asserts that the consumer count satisfies the provided matcher function. |
toHaveConsumerCountNaN() | Asserts that the consumer count is NaN. |
toHaveConsumerCountGreaterThan() | Asserts that the consumer count is greater than the expected value. |
toHaveConsumerCountGreaterThanOrEqual() | Asserts that the consumer count is greater than or equal to the expected value. |
toHaveConsumerCountLessThan() | Asserts that the consumer count is less than the expected value. |
toHaveConsumerCountLessThanOrEqual() | Asserts that the consumer count is less than or equal to the expected value. |
toHaveConsumerCountCloseTo() | Asserts that the consumer count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveQueue(expected: unknown): thisAsserts that the queue name equals the expected value.
Parameters
expectedunknown- The expected queue name
toHaveQueueEqual(expected: unknown): thisAsserts that the queue name equals the expected value using deep equality.
Parameters
expectedunknown- The expected queue name
toHaveQueueStrictEqual(expected: unknown): thisAsserts that the queue name strictly equals the expected value.
Parameters
expectedunknown- The expected queue name
toHaveQueueSatisfying(matcher: (value: string) => unknown): thisAsserts that the queue name satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the queue name and performs assertions
toHaveQueueContaining(substr: string): thisAsserts that the queue name contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveQueueMatching(expected: RegExp): thisAsserts that the queue name matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveMessageCount(expected: unknown): thisAsserts that the message count equals the expected value.
Parameters
expectedunknown- The expected message count
toHaveMessageCountEqual(expected: unknown): thisAsserts that the message count equals the expected value using deep equality.
Parameters
expectedunknown- The expected message count
toHaveMessageCountStrictEqual(expected: unknown): thisAsserts that the message count strictly equals the expected value.
Parameters
expectedunknown- The expected message count
toHaveMessageCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the message count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the message count and performs assertions
toHaveMessageCountNaN(): thisAsserts that the message count is NaN.
toHaveMessageCountGreaterThan(expected: number): thisAsserts that the message count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessageCountGreaterThanOrEqual(expected: number): thisAsserts that the message count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessageCountLessThan(expected: number): thisAsserts that the message count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessageCountLessThanOrEqual(expected: number): thisAsserts that the message count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessageCountCloseTo(expected: number, numDigits?: number): thisAsserts that the message count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveConsumerCount(expected: unknown): thisAsserts that the consumer count equals the expected value.
Parameters
expectedunknown- The expected consumer count
toHaveConsumerCountEqual(expected: unknown): thisAsserts that the consumer count equals the expected value using deep equality.
Parameters
expectedunknown- The expected consumer count
toHaveConsumerCountStrictEqual(expected: unknown): thisAsserts that the consumer count strictly equals the expected value.
Parameters
expectedunknown- The expected consumer count
toHaveConsumerCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the consumer count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the consumer count and performs assertions
toHaveConsumerCountNaN(): thisAsserts that the consumer count is NaN.
toHaveConsumerCountGreaterThan(expected: number): thisAsserts that the consumer count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveConsumerCountGreaterThanOrEqual(expected: number): thisAsserts that the consumer count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveConsumerCountLessThan(expected: number): thisAsserts that the consumer count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveConsumerCountLessThanOrEqual(expected: number): thisAsserts that the consumer count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveConsumerCountCloseTo(expected: number, numDigits?: number): thisAsserts that the consumer count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RabbitMqQueueResultFailure
interface RabbitMqQueueResultFailure extends RabbitMqQueueResultBaseQueue result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
queue | — |
messageCount | — |
consumerCount | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
queuenull - readonly
messageCountnull - readonly
consumerCountnull
#RabbitMqQueueResultSuccess
interface RabbitMqQueueResultSuccess extends RabbitMqQueueResultBaseSuccessful queue result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
queue | — |
messageCount | — |
consumerCount | — |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
queuestring - readonly
messageCountnumber - readonly
consumerCountnumber
#RabbitMqRejectOptions
interface RabbitMqRejectOptions extends RabbitMqOptionsReject options.
| Name | Description |
|---|---|
requeue | — |
Properties
- readonly
requeue?boolean
#RedisArrayResultError
interface RedisArrayResultError<T = string> extends RedisArrayResultBase<T>Array result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisArrayResultExpectation
interface RedisArrayResultExpectationFluent API for Redis array result validation.
Provides chainable assertions specifically designed for array-based results (e.g., LRANGE, SMEMBERS, KEYS operations).
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValueContaining() | Asserts that the value array contains the specified item. |
toHaveValueContainingEqual() | Asserts that the value array contains an item equal to the specified value. |
toHaveValueMatching() | Asserts that the value array matches the specified subset. |
toHaveValueEmpty() | Asserts that the value array is empty. |
toHaveValueCount() | Asserts that the value count equals the expected value. |
toHaveValueCountEqual() | Asserts that the value count equals the expected value using deep equality. |
toHaveValueCountStrictEqual() | Asserts that the value count strictly equals the expected value. |
toHaveValueCountSatisfying() | Asserts that the value count satisfies the provided matcher function. |
toHaveValueCountNaN() | Asserts that the value count is NaN. |
toHaveValueCountGreaterThan() | Asserts that the value count is greater than the expected value. |
toHaveValueCountGreaterThanOrEqual() | Asserts that the value count is greater than or equal to the expected value. |
toHaveValueCountLessThan() | Asserts that the value count is less than the expected value. |
toHaveValueCountLessThanOrEqual() | Asserts that the value count is less than or equal to the expected value. |
toHaveValueCountCloseTo() | Asserts that the value count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: RedisArrayValue) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: RedisArrayValue) => unknown- A function that receives the value and performs assertions
toHaveValueContaining(item: unknown): thisAsserts that the value array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveValueContainingEqual(item: unknown): thisAsserts that the value array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveValueMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the value array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveValueEmpty(): thisAsserts that the value array is empty.
toHaveValueCount(expected: unknown): thisAsserts that the value count equals the expected value.
Parameters
expectedunknown- The expected value count
toHaveValueCountEqual(expected: unknown): thisAsserts that the value count equals the expected value using deep equality.
Parameters
expectedunknown- The expected value count
toHaveValueCountStrictEqual(expected: unknown): thisAsserts that the value count strictly equals the expected value.
Parameters
expectedunknown- The expected value count
toHaveValueCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the value count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the value count and performs assertions
toHaveValueCountNaN(): thisAsserts that the value count is NaN.
toHaveValueCountGreaterThan(expected: number): thisAsserts that the value count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueCountGreaterThanOrEqual(expected: number): thisAsserts that the value count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueCountLessThan(expected: number): thisAsserts that the value count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueCountLessThanOrEqual(expected: number): thisAsserts that the value count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueCountCloseTo(expected: number, numDigits?: number): thisAsserts that the value count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisArrayResultFailure
interface RedisArrayResultFailure<T = string> extends RedisArrayResultBase<T>Array result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisArrayResultSuccess
interface RedisArrayResultSuccess<T = string> extends RedisArrayResultBase<T>Successful array result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
valuereadonly T[]
#RedisClient
interface RedisClient extends AsyncDisposableRedis client interface
Properties
Methods
get(key: string, options?: RedisCommandOptions): Promise<RedisGetResult>Parameters
keystringoptions?RedisCommandOptions
set(
key: string,
value: string,
options?: RedisSetOptions,
): Promise<RedisSetResult>Parameters
keystringvaluestringoptions?RedisSetOptions
del(keys: string[], options?: RedisCommandOptions): Promise<RedisCountResult>Parameters
keysstring[]options?RedisCommandOptions
incr(key: string, options?: RedisCommandOptions): Promise<RedisCountResult>Parameters
keystringoptions?RedisCommandOptions
decr(key: string, options?: RedisCommandOptions): Promise<RedisCountResult>Parameters
keystringoptions?RedisCommandOptions
hget(
key: string,
field: string,
options?: RedisCommandOptions,
): Promise<RedisGetResult>Parameters
keystringfieldstringoptions?RedisCommandOptions
hset(
key: string,
field: string,
value: string,
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringfieldstringvaluestringoptions?RedisCommandOptions
hgetall(key: string, options?: RedisCommandOptions): Promise<RedisHashResult>Parameters
keystringoptions?RedisCommandOptions
hdel(
key: string,
fields: string[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringfieldsstring[]options?RedisCommandOptions
lpush(
key: string,
values: string[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringvaluesstring[]options?RedisCommandOptions
rpush(
key: string,
values: string[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringvaluesstring[]options?RedisCommandOptions
lpop(key: string, options?: RedisCommandOptions): Promise<RedisGetResult>Parameters
keystringoptions?RedisCommandOptions
rpop(key: string, options?: RedisCommandOptions): Promise<RedisGetResult>Parameters
keystringoptions?RedisCommandOptions
lrange(
key: string,
start: number,
stop: number,
options?: RedisCommandOptions,
): Promise<RedisArrayResult>Parameters
keystringstartnumberstopnumberoptions?RedisCommandOptions
llen(key: string, options?: RedisCommandOptions): Promise<RedisCountResult>Parameters
keystringoptions?RedisCommandOptions
sadd(
key: string,
members: string[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringmembersstring[]options?RedisCommandOptions
srem(
key: string,
members: string[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringmembersstring[]options?RedisCommandOptions
smembers(key: string, options?: RedisCommandOptions): Promise<RedisArrayResult>Parameters
keystringoptions?RedisCommandOptions
sismember(
key: string,
member: string,
options?: RedisCommandOptions,
): Promise<RedisCommonResult<boolean>>Parameters
keystringmemberstringoptions?RedisCommandOptions
zadd(
key: string,
entries: { score: number; member: string }[],
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
keystringentries{ score: number; member: string }[]options?RedisCommandOptions
zrange(
key: string,
start: number,
stop: number,
options?: RedisCommandOptions,
): Promise<RedisArrayResult>Parameters
keystringstartnumberstopnumberoptions?RedisCommandOptions
zscore(
key: string,
member: string,
options?: RedisCommandOptions,
): Promise<RedisCommonResult<number | null>>Parameters
keystringmemberstringoptions?RedisCommandOptions
publish(
channel: string,
message: string,
options?: RedisCommandOptions,
): Promise<RedisCountResult>Parameters
channelstringmessagestringoptions?RedisCommandOptions
subscribe(channel: string): AsyncIterable<RedisMessage>Parameters
channelstring
multi(): RedisTransactioncommand<T = any>(
cmd: string,
args: unknown[],
options?: RedisCommandOptions,
): Promise<RedisCommonResult<T>>Parameters
cmdstringargsunknown[]options?RedisCommandOptions
close(): Promise<void>#RedisClientConfig
interface RedisClientConfig extends CommonOptionsRedis client configuration.
| Name | Description |
|---|---|
url | Redis connection URL or configuration object. |
throwOnError | Whether to throw an error when operations fail. |
Properties
Redis connection URL or configuration object.
- readonly
throwOnError?booleanWhether to throw an error when operations fail.
When
true, failures will throw an error instead of returning a result withok: false. This can be overridden per-command.
#RedisCommandErrorOptions
interface RedisCommandErrorOptions extends RedisErrorOptionsOptions for Redis command errors.
| Name | Description |
|---|---|
command | — |
Properties
- readonly
commandstring
#RedisCommandOptions
interface RedisCommandOptions extends CommonOptionsRedis command options.
Extends CommonOptions with Redis-specific behavior options.
| Name | Description |
|---|---|
throwOnError | Whether to throw an error when the operation fails. |
Properties
- readonly
throwOnError?booleanWhether to throw an error when the operation fails.
When
true, failures will throw an error instead of returning a result withok: false.
#RedisCommonResultError
interface RedisCommonResultError<T = any> extends RedisCommonResultBase<T>Common result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisCommonResultExpectation
interface RedisCommonResultExpectationFluent API for Redis common result validation.
Provides chainable assertions for generic Redis operation results.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: any) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisCommonResultFailure
interface RedisCommonResultFailure<T = any> extends RedisCommonResultBase<T>Common result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisCommonResultSuccess
interface RedisCommonResultSuccess<T = any> extends RedisCommonResultBase<T>Successful common result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
valueT
#RedisConnectionConfig
interface RedisConnectionConfig extends CommonConnectionConfigRedis connection configuration.
Extends CommonConnectionConfig with Redis-specific options.
| Name | Description |
|---|---|
db | Database index. |
Properties
- readonly
db?numberDatabase index.
#RedisCountResultError
interface RedisCountResultError extends RedisCountResultBaseCount result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisCountResultExpectation
interface RedisCountResultExpectationFluent API for Redis count result validation.
Provides chainable assertions specifically designed for count-based results (e.g., DEL, LPUSH, SCARD operations).
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValueNaN() | Asserts that the value is NaN. |
toHaveValueGreaterThan() | Asserts that the value is greater than the expected value. |
toHaveValueGreaterThanOrEqual() | Asserts that the value is greater than or equal to the expected value. |
toHaveValueLessThan() | Asserts that the value is less than the expected value. |
toHaveValueLessThanOrEqual() | Asserts that the value is less than or equal to the expected value. |
toHaveValueCloseTo() | Asserts that the value is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: number) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the value and performs assertions
toHaveValueNaN(): thisAsserts that the value is NaN.
toHaveValueGreaterThan(expected: number): thisAsserts that the value is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueGreaterThanOrEqual(expected: number): thisAsserts that the value is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueLessThan(expected: number): thisAsserts that the value is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueLessThanOrEqual(expected: number): thisAsserts that the value is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveValueCloseTo(expected: number, numDigits?: number): thisAsserts that the value is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisCountResultFailure
interface RedisCountResultFailure extends RedisCountResultBaseCount result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisCountResultSuccess
interface RedisCountResultSuccess extends RedisCountResultBaseSuccessful count result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
valuenumber
#RedisErrorOptions
interface RedisErrorOptions extends ErrorOptionsOptions for Redis errors.
| Name | Description |
|---|---|
code | — |
Properties
- readonly
code?string
#RedisGetResultError
interface RedisGetResultError extends RedisGetResultBaseGET result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisGetResultExpectation
interface RedisGetResultExpectationFluent API for Redis get result validation.
Provides chainable assertions specifically designed for Redis GET operation results.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValueContaining() | Asserts that the value contains the specified substring. |
toHaveValueMatching() | Asserts that the value matches the specified regular expression. |
toHaveValuePresent() | Asserts that the value is present (not null or undefined). |
toHaveValueNull() | Asserts that the value is null. |
toHaveValueUndefined() | Asserts that the value is undefined. |
toHaveValueNullish() | Asserts that the value is nullish (null or undefined). |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: string) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the value and performs assertions
toHaveValueContaining(substr: string): thisAsserts that the value contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveValueMatching(expected: RegExp): thisAsserts that the value matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveValuePresent(): thisAsserts that the value is present (not null or undefined).
toHaveValueNull(): thisAsserts that the value is null.
toHaveValueUndefined(): thisAsserts that the value is undefined.
toHaveValueNullish(): thisAsserts that the value is nullish (null or undefined).
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisGetResultFailure
interface RedisGetResultFailure extends RedisGetResultBaseGET result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisGetResultSuccess
interface RedisGetResultSuccess extends RedisGetResultBaseSuccessful GET result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
valuestring | null
#RedisHashResultError
interface RedisHashResultError extends RedisHashResultBaseHash result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisHashResultExpectation
interface RedisHashResultExpectationFluent API for Redis hash result validation.
Provides chainable assertions specifically designed for hash-based results (e.g., HGETALL, HMGET operations).
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValueMatching() | Asserts that the value matches the specified subset. |
toHaveValueProperty() | Asserts that the value has the specified property. |
toHaveValuePropertyContaining() | Asserts that the value property contains the expected value. |
toHaveValuePropertyMatching() | Asserts that the value property matches the specified subset. |
toHaveValuePropertySatisfying() | Asserts that the value property satisfies the provided matcher function. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: any) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the value and performs assertions
toHaveValueMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the value matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveValueProperty(keyPath: string | string[], value?: unknown): thisAsserts that the value has the specified property.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
value?unknown- Optional expected value at the key path
toHaveValuePropertyContaining(
keyPath: string | string[],
expected: unknown,
): thisAsserts that the value property contains the expected value.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
expectedunknown- The expected contained value
toHaveValuePropertyMatching(
keyPath: string | string[],
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the value property matches the specified subset.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveValuePropertySatisfying(
keyPath: string | string[],
matcher: (value: any) => unknown,
): thisAsserts that the value property satisfies the provided matcher function.
Parameters
keyPathstring | string[]- Property path as dot-separated string (
"user.name") or array (["user", "name"]). Use array format for properties containing dots.
- Property path as dot-separated string (
matcher(value: any) => unknown- A function that receives the property value and performs assertions
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisHashResultFailure
interface RedisHashResultFailure extends RedisHashResultBaseHash result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisHashResultSuccess
interface RedisHashResultSuccess extends RedisHashResultBaseSuccessful hash result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
valueRecord<string, string>
#RedisMessage
interface RedisMessageRedis Pub/Sub message
Properties
- readonly
channelstring - readonly
messagestring
#RedisScriptErrorOptions
interface RedisScriptErrorOptions extends RedisErrorOptionsOptions for Redis script errors.
| Name | Description |
|---|---|
script | — |
Properties
- readonly
scriptstring
#RedisSetOptions
interface RedisSetOptions extends RedisCommandOptionsRedis SET options
| Name | Description |
|---|---|
ex | Expiration in seconds |
px | Expiration in milliseconds |
nx | Only set if key does not exist |
xx | Only set if key exists |
Properties
- readonly
ex?numberExpiration in seconds
- readonly
px?numberExpiration in milliseconds
- readonly
nx?booleanOnly set if key does not exist
- readonly
xx?booleanOnly set if key exists
#RedisSetResultError
interface RedisSetResultError extends RedisSetResultBaseSET result with Redis error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
valuenull
#RedisSetResultExpectation
interface RedisSetResultExpectationFluent API for Redis set result validation.
Provides chainable assertions specifically designed for Redis SET operation results.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveValue() | Asserts that the value equals the expected value. |
toHaveValueEqual() | Asserts that the value equals the expected value using deep equality. |
toHaveValueStrictEqual() | Asserts that the value strictly equals the expected value. |
toHaveValueSatisfying() | Asserts that the value satisfies the provided matcher function. |
toHaveValueContaining() | Asserts that the value contains the specified substring. |
toHaveValueMatching() | Asserts that the value matches the specified regular expression. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveValue(expected: unknown): thisAsserts that the value equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueEqual(expected: unknown): thisAsserts that the value equals the expected value using deep equality.
Parameters
expectedunknown- The expected value
toHaveValueStrictEqual(expected: unknown): thisAsserts that the value strictly equals the expected value.
Parameters
expectedunknown- The expected value
toHaveValueSatisfying(matcher: (value: RedisSetValue) => unknown): thisAsserts that the value satisfies the provided matcher function.
Parameters
matcher(value: RedisSetValue) => unknown- A function that receives the value and performs assertions
toHaveValueContaining(substr: string): thisAsserts that the value contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveValueMatching(expected: RegExp): thisAsserts that the value matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#RedisSetResultFailure
interface RedisSetResultFailure extends RedisSetResultBaseSET result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
valuenull
#RedisSetResultSuccess
interface RedisSetResultSuccess extends RedisSetResultBaseSuccessful SET result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
value"OK"
#RedisTransaction
interface RedisTransactionRedis transaction interface
Methods
get(key: string): thisParameters
keystring
set(key: string, value: string, options?: RedisSetOptions): thisParameters
keystringvaluestringoptions?RedisSetOptions
del(_: string[]): thisParameters
_string[]
incr(key: string): thisParameters
keystring
decr(key: string): thisParameters
keystring
hget(key: string, field: string): thisParameters
keystringfieldstring
hset(key: string, field: string, value: string): thisParameters
keystringfieldstringvaluestring
hgetall(key: string): thisParameters
keystring
hdel(key: string, _: string[]): thisParameters
keystring_string[]
lpush(key: string, _: string[]): thisParameters
keystring_string[]
rpush(key: string, _: string[]): thisParameters
keystring_string[]
lpop(key: string): thisParameters
keystring
rpop(key: string): thisParameters
keystring
lrange(key: string, start: number, stop: number): thisParameters
keystringstartnumberstopnumber
llen(key: string): thisParameters
keystring
sadd(key: string, _: string[]): thisParameters
keystring_string[]
srem(key: string, _: string[]): thisParameters
keystring_string[]
smembers(key: string): thisParameters
keystring
sismember(key: string, member: string): thisParameters
keystringmemberstring
zadd(key: string, _: { score: number; member: string }[]): thisParameters
keystring_{ score: number; member: string }[]
zrange(key: string, start: number, stop: number): thisParameters
keystringstartnumberstopnumber
zscore(key: string, member: string): thisParameters
keystringmemberstring
exec(options?: RedisCommandOptions): Promise<RedisArrayResult<unknown>>Parameters
options?RedisCommandOptions
discard(): void#ReflectionApi
interface ReflectionApiReflection API for ConnectRPC client. Only available when client is created with schema: "reflection".
| Name | Description |
|---|---|
enabled | Check if reflection is enabled. |
listServices() | List all available services on the server. |
getServiceInfo() | Get detailed information about a specific service. |
listMethods() | Get methods for a specific service. |
hasService() | Check if a service exists. |
Properties
- readonly
enabledbooleanCheck if reflection is enabled.
Methods
listServices(): Promise<ServiceInfo[]>List all available services on the server.
getServiceInfo(serviceName: string): Promise<ServiceDetail>Get detailed information about a specific service.
Parameters
serviceNamestring- Fully qualified service name (e.g., "echo.EchoService")
listMethods(serviceName: string): Promise<MethodInfo[]>Get methods for a specific service.
Parameters
serviceNamestring- Fully qualified service name
hasService(serviceName: string): Promise<boolean>Check if a service exists.
Parameters
serviceNamestring- Fully qualified service name
#ServiceDetail
interface ServiceDetailDetailed service information.
| Name | Description |
|---|---|
name | Service name |
fullName | Fully qualified service name |
packageName | Package name |
protoFile | Proto file name |
methods | All methods |
Properties
- readonly
namestringService name
- readonly
fullNamestringFully qualified service name
- readonly
packageNamestringPackage name
- readonly
protoFilestringProto file name
All methods
#ServiceInfo
interface ServiceInfoService information from reflection.
Properties
- readonly
namestringFully qualified service name (e.g., "echo.EchoService")
- readonly
filestringProto file name
#SqlErrorOptions
interface SqlErrorOptions extends ErrorOptionsOptions for SqlError constructor.
| Name | Description |
|---|---|
sqlState | SQL State code (e.g., "23505" for unique violation) |
Properties
- readonly
sqlState?stringSQL State code (e.g., "23505" for unique violation)
#SqlQueryOptions
interface SqlQueryOptions extends CommonOptionsOptions for individual SQL queries.
| Name | Description |
|---|---|
throwOnError | Whether to throw an error for query failures. |
Properties
- readonly
throwOnError?booleanWhether to throw an error for query failures. When false, failures are returned as SqlQueryResultError or SqlQueryResultFailure.
#SqlQueryResultError
interface SqlQueryResultError<T = any> extends SqlQueryResultBase<T>SQL query result for query errors (syntax errors, constraint violations, etc.).
Server received and processed the query, but it failed due to a SQL error.
| Name | Description |
|---|---|
processed | Server processed the query. |
ok | Query failed. |
error | Error describing the SQL error. |
rows | Empty rows for failed queries. |
rowCount | Zero affected rows for failed queries. |
lastInsertId | No lastInsertId for failed queries. |
warnings | No warnings for failed queries. |
Properties
- readonly
processedtrueServer processed the query.
- readonly
okfalseQuery failed.
Error describing the SQL error.
- readonly
rowsreadonly never[]Empty rows for failed queries.
- readonly
rowCount0Zero affected rows for failed queries.
- readonly
lastInsertIdnullNo lastInsertId for failed queries.
- readonly
warningsnullNo warnings for failed queries.
#SqlQueryResultExpectation
interface SqlQueryResultExpectationExpectation interface for SQL query results.
All methods return this for chaining.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveRows() | Asserts that the rows equal the expected value. |
toHaveRowsEqual() | Asserts that the rows equal the expected value using deep equality. |
toHaveRowsStrictEqual() | Asserts that the rows strictly equal the expected value. |
toHaveRowsSatisfying() | Asserts that the rows satisfy the provided matcher function. |
toHaveRowsContaining() | Asserts that the rows array contains the specified item. |
toHaveRowsContainingEqual() | Asserts that the rows array contains an item equal to the specified value. |
toHaveRowsMatching() | Asserts that the rows array matches the specified subset. |
toHaveRowsEmpty() | Asserts that the rows array is empty. |
toHaveRowCount() | Asserts that the row count equals the expected value. |
toHaveRowCountEqual() | Asserts that the row count equals the expected value using deep equality. |
toHaveRowCountStrictEqual() | Asserts that the row count strictly equals the expected value. |
toHaveRowCountSatisfying() | Asserts that the row count satisfies the provided matcher function. |
toHaveRowCountNaN() | Asserts that the row count is NaN. |
toHaveRowCountGreaterThan() | Asserts that the row count is greater than the expected value. |
toHaveRowCountGreaterThanOrEqual() | Asserts that the row count is greater than or equal to the expected value. |
toHaveRowCountLessThan() | Asserts that the row count is less than the expected value. |
toHaveRowCountLessThanOrEqual() | Asserts that the row count is less than or equal to the expected value. |
toHaveRowCountCloseTo() | Asserts that the row count is close to the expected value. |
toHaveLastInsertId() | Asserts that the last insert ID equals the expected value. |
toHaveLastInsertIdEqual() | Asserts that the last insert ID equals the expected value using deep equality. |
toHaveLastInsertIdStrictEqual() | Asserts that the last insert ID strictly equals the expected value. |
toHaveLastInsertIdSatisfying() | Asserts that the last insert ID satisfies the provided matcher function. |
toHaveLastInsertIdPresent() | Asserts that the last insert ID is present (not null or undefined). |
toHaveLastInsertIdNull() | Asserts that the last insert ID is null. |
toHaveLastInsertIdUndefined() | Asserts that the last insert ID is undefined. |
toHaveLastInsertIdNullish() | Asserts that the last insert ID is nullish (null or undefined). |
toHaveWarnings() | Asserts that the warnings equal the expected value. |
toHaveWarningsEqual() | Asserts that the warnings equal the expected value using deep equality. |
toHaveWarningsStrictEqual() | Asserts that the warnings strictly equal the expected value. |
toHaveWarningsSatisfying() | Asserts that the warnings satisfy the provided matcher function. |
toHaveWarningsPresent() | Asserts that the warnings are present (not null or undefined). |
toHaveWarningsNull() | Asserts that the warnings are null. |
toHaveWarningsUndefined() | Asserts that the warnings are undefined. |
toHaveWarningsNullish() | Asserts that the warnings are nullish (null or undefined). |
toHaveWarningsContaining() | Asserts that the warnings array contains the specified item. |
toHaveWarningsContainingEqual() | Asserts that the warnings array contains an item equal to the specified value. |
toHaveWarningsMatching() | Asserts that the warnings array matches the specified subset. |
toHaveWarningsEmpty() | Asserts that the warnings array is empty. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveRows(expected: unknown): thisAsserts that the rows equal the expected value.
Parameters
expectedunknown- The expected rows value
toHaveRowsEqual(expected: unknown): thisAsserts that the rows equal the expected value using deep equality.
Parameters
expectedunknown- The expected rows value
toHaveRowsStrictEqual(expected: unknown): thisAsserts that the rows strictly equal the expected value.
Parameters
expectedunknown- The expected rows value
toHaveRowsSatisfying(matcher: (value: SqlRows) => unknown): thisAsserts that the rows satisfy the provided matcher function.
Parameters
matcher(value: SqlRows) => unknown- A function that receives the rows and performs assertions
toHaveRowsContaining(item: unknown): thisAsserts that the rows array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveRowsContainingEqual(item: unknown): thisAsserts that the rows array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveRowsMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the rows array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveRowsEmpty(): thisAsserts that the rows array is empty.
toHaveRowCount(expected: unknown): thisAsserts that the row count equals the expected value.
Parameters
expectedunknown- The expected row count
toHaveRowCountEqual(expected: unknown): thisAsserts that the row count equals the expected value using deep equality.
Parameters
expectedunknown- The expected row count
toHaveRowCountStrictEqual(expected: unknown): thisAsserts that the row count strictly equals the expected value.
Parameters
expectedunknown- The expected row count
toHaveRowCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the row count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the row count and performs assertions
toHaveRowCountNaN(): thisAsserts that the row count is NaN.
toHaveRowCountGreaterThan(expected: number): thisAsserts that the row count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveRowCountGreaterThanOrEqual(expected: number): thisAsserts that the row count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveRowCountLessThan(expected: number): thisAsserts that the row count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveRowCountLessThanOrEqual(expected: number): thisAsserts that the row count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveRowCountCloseTo(expected: number, numDigits?: number): thisAsserts that the row count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveLastInsertId(expected: unknown): thisAsserts that the last insert ID equals the expected value.
Parameters
expectedunknown- The expected last insert ID
toHaveLastInsertIdEqual(expected: unknown): thisAsserts that the last insert ID equals the expected value using deep equality.
Parameters
expectedunknown- The expected last insert ID
toHaveLastInsertIdStrictEqual(expected: unknown): thisAsserts that the last insert ID strictly equals the expected value.
Parameters
expectedunknown- The expected last insert ID
toHaveLastInsertIdSatisfying(matcher: (value: any) => unknown): thisAsserts that the last insert ID satisfies the provided matcher function.
Parameters
matcher(value: any) => unknown- A function that receives the last insert ID and performs assertions
toHaveLastInsertIdPresent(): thisAsserts that the last insert ID is present (not null or undefined).
toHaveLastInsertIdNull(): thisAsserts that the last insert ID is null.
toHaveLastInsertIdUndefined(): thisAsserts that the last insert ID is undefined.
toHaveLastInsertIdNullish(): thisAsserts that the last insert ID is nullish (null or undefined).
toHaveWarnings(expected: unknown): thisAsserts that the warnings equal the expected value.
Parameters
expectedunknown- The expected warnings value
toHaveWarningsEqual(expected: unknown): thisAsserts that the warnings equal the expected value using deep equality.
Parameters
expectedunknown- The expected warnings value
toHaveWarningsStrictEqual(expected: unknown): thisAsserts that the warnings strictly equal the expected value.
Parameters
expectedunknown- The expected warnings value
toHaveWarningsSatisfying(matcher: (value: SqlWarnings) => unknown): thisAsserts that the warnings satisfy the provided matcher function.
Parameters
matcher(value: SqlWarnings) => unknown- A function that receives the warnings and performs assertions
toHaveWarningsPresent(): thisAsserts that the warnings are present (not null or undefined).
toHaveWarningsNull(): thisAsserts that the warnings are null.
toHaveWarningsUndefined(): thisAsserts that the warnings are undefined.
toHaveWarningsNullish(): thisAsserts that the warnings are nullish (null or undefined).
toHaveWarningsContaining(item: unknown): thisAsserts that the warnings array contains the specified item.
Parameters
itemunknown- The item to search for
toHaveWarningsContainingEqual(item: unknown): thisAsserts that the warnings array contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveWarningsMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the warnings array matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveWarningsEmpty(): thisAsserts that the warnings array is empty.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqlQueryResultFailure
interface SqlQueryResultFailure<T = any> extends SqlQueryResultBase<T>SQL query result for connection failures (network errors, timeouts, etc.).
Query could not be processed by the server (connection refused, timeout, pool exhausted, authentication failure, etc.).
| Name | Description |
|---|---|
processed | Server did not process the query. |
ok | Query failed. |
error | Error describing the failure. |
rows | No rows (query didn't reach server). |
rowCount | No row count (query didn't reach server). |
lastInsertId | No lastInsertId (query didn't reach server). |
warnings | No warnings (query didn't reach server). |
Properties
- readonly
processedfalseServer did not process the query.
- readonly
okfalseQuery failed.
Error describing the failure.
- readonly
rowsnullNo rows (query didn't reach server).
- readonly
rowCountnullNo row count (query didn't reach server).
- readonly
lastInsertIdnullNo lastInsertId (query didn't reach server).
- readonly
warningsnullNo warnings (query didn't reach server).
#SqlQueryResultSuccess
interface SqlQueryResultSuccess<T = any> extends SqlQueryResultBase<T>SQL query result for successful queries.
The query was executed successfully and returned results.
| Name | Description |
|---|---|
processed | Server processed the query. |
ok | Query succeeded. |
error | No error for successful queries. |
rows | Query result rows. |
rowCount | Number of affected rows. |
lastInsertId | Last inserted ID (for INSERT statements). |
warnings | Warning messages from the database. |
Properties
- readonly
processedtrueServer processed the query.
- readonly
oktrueQuery succeeded.
- readonly
errornullNo error for successful queries.
- readonly
rowsreadonly T[]Query result rows.
- readonly
rowCountnumberNumber of affected rows.
- readonly
lastInsertIdbigint | string | nullLast inserted ID (for INSERT statements).
- readonly
warningsunknown | nullWarning messages from the database.
#SqlQueryResultSuccessParams
interface SqlQueryResultSuccessParams<T = any>Parameters for creating a SqlQueryResultSuccess.
| Name | Description |
|---|---|
rows | The result rows |
rowCount | Number of affected rows (for INSERT/UPDATE/DELETE) |
duration | Query execution duration in milliseconds |
lastInsertId | Last inserted ID (for INSERT statements) |
warnings | Warning messages from the database |
Properties
- readonly
rowsreadonly T[]The result rows
- readonly
rowCountnumberNumber of affected rows (for INSERT/UPDATE/DELETE)
- readonly
durationnumberQuery execution duration in milliseconds
- readonly
lastInsertId?bigint | stringLast inserted ID (for INSERT statements)
- readonly
warnings?readonly string[]Warning messages from the database
#SqlTransaction
interface SqlTransactionSQL transaction interface. Implementations should provide actual database-specific transaction handling.
| Name | Description |
|---|---|
query() | Execute a query within the transaction. |
queryOne() | Execute a query and return the first row or undefined. |
commit() | Commit the transaction. |
rollback() | Rollback the transaction. |
Methods
query<T = Record<string, any>>(
sql: string,
params?: unknown[],
options?: SqlQueryOptions,
): Promise<SqlQueryResult<T>>Execute a query within the transaction.
Parameters
sqlstring- SQL query string
params?unknown[]- Optional query parameters
options?SqlQueryOptions- Optional query options
queryOne<T = Record<string, any>>(
sql: string,
params?: unknown[],
options?: SqlQueryOptions,
): Promise<T | undefined>Execute a query and return the first row or undefined.
Parameters
sqlstring- SQL query string
params?unknown[]- Optional query parameters
options?SqlQueryOptions- Optional query options
commit(): Promise<void>Commit the transaction.
rollback(): Promise<void>Rollback the transaction.
#SqlTransactionOptions
interface SqlTransactionOptionsOptions for starting a transaction.
| Name | Description |
|---|---|
isolationLevel | Isolation level for the transaction |
Properties
Isolation level for the transaction
#SqsBatchFailedEntry
interface SqsBatchFailedEntryFailed batch entry.
Properties
- readonly
idstring - readonly
codestring - readonly
messagestring
#SqsBatchMessage
interface SqsBatchMessageBatch message for sendBatch.
| Name | Description |
|---|---|
id | — |
body | — |
delaySeconds | — |
messageAttributes | — |
Properties
- readonly
idstring - readonly
bodystring - readonly
delaySeconds?number
#SqsBatchSuccessEntry
interface SqsBatchSuccessEntrySuccessful batch send entry.
Properties
- readonly
messageIdstring - readonly
idstring
#SqsClient
interface SqsClient extends AsyncDisposableSQS client interface.
| Name | Description |
|---|---|
config | — |
queueUrl | The current queue URL. |
setQueueUrl() | Set the queue URL for subsequent operations. |
ensureQueue() | Ensure a queue exists. |
deleteQueue() | Delete a queue by URL. |
send() | Send a message to the queue. |
sendBatch() | Send multiple messages to the queue in a single request. |
receive() | Receive messages from the queue. |
delete() | Delete a message from the queue. |
deleteBatch() | Delete multiple messages from the queue in a single request. |
purge() | Purge all messages from the queue. |
close() | Close the client and release resources. |
Properties
- readonly
queueUrlstring | undefinedThe current queue URL. Can be set via config, ensureQueue(), or setQueueUrl().
Methods
setQueueUrl(queueUrl: string): voidSet the queue URL for subsequent operations.
Parameters
queueUrlstring
ensureQueue(
queueName: string,
options?: SqsEnsureQueueOptions,
): Promise<SqsEnsureQueueResult>Ensure a queue exists. Creates the queue if it doesn't exist. If the queue already exists with the same attributes, returns the existing queue URL. Also sets the queue URL for subsequent operations.
Parameters
queueNamestringoptions?SqsEnsureQueueOptions
deleteQueue(
queueUrl: string,
options?: SqsDeleteQueueOptions,
): Promise<SqsDeleteQueueResult>Delete a queue by URL.
Parameters
queueUrlstringoptions?SqsDeleteQueueOptions
send(body: string, options?: SqsSendOptions): Promise<SqsSendResult>Send a message to the queue.
Parameters
bodystringoptions?SqsSendOptions
sendBatch(
messages: SqsBatchMessage[],
options?: SqsBatchOptions,
): Promise<SqsSendBatchResult>Send multiple messages to the queue in a single request.
Parameters
messagesSqsBatchMessage[]options?SqsBatchOptions
receive(options?: SqsReceiveOptions): Promise<SqsReceiveResult>Receive messages from the queue.
Parameters
options?SqsReceiveOptions
delete(
receiptHandle: string,
options?: SqsDeleteOptions,
): Promise<SqsDeleteResult>Delete a message from the queue.
Parameters
receiptHandlestringoptions?SqsDeleteOptions
deleteBatch(
receiptHandles: string[],
options?: SqsBatchOptions,
): Promise<SqsDeleteBatchResult>Delete multiple messages from the queue in a single request.
Parameters
receiptHandlesstring[]options?SqsBatchOptions
purge(options?: SqsOptions): Promise<SqsDeleteResult>Purge all messages from the queue.
Parameters
options?SqsOptions
close(): Promise<void>Close the client and release resources.
#SqsClientConfig
interface SqsClientConfig extends SqsOptionsSQS client configuration.
| Name | Description |
|---|---|
region | AWS region |
credentials | AWS credentials |
queueUrl | SQS queue URL (optional - can be set later or used with ensureQueue) |
url | SQS endpoint URL (e.g., "http://localhost:4566" for LocalStack). |
Properties
- readonly
regionstringAWS region
- readonly
credentials?{ accessKeyId: string; secretAccessKey: string }AWS credentials
- readonly
queueUrl?stringSQS queue URL (optional - can be set later or used with ensureQueue)
SQS endpoint URL (e.g., "http://localhost:4566" for LocalStack). Can be a string URL or a connection config object. Optional for real AWS (uses default endpoint), required for LocalStack.
#SqsCommandErrorOptions
interface SqsCommandErrorOptions extends SqsErrorOptionsOptions for SQS command errors.
| Name | Description |
|---|---|
operation | — |
Properties
- readonly
operationstring
#SqsConnectionConfig
interface SqsConnectionConfig extends CommonConnectionConfigSQS connection configuration.
Extends CommonConnectionConfig with SQS-specific options.
| Name | Description |
|---|---|
protocol | Protocol to use. |
path | Custom path (for LocalStack or custom endpoints). |
region | AWS region (required for AWS, optional for LocalStack). |
Properties
- readonly
protocol?"http" | "https"Protocol to use.
- readonly
path?stringCustom path (for LocalStack or custom endpoints).
- readonly
region?stringAWS region (required for AWS, optional for LocalStack).
#SqsDeleteBatchResultError
interface SqsDeleteBatchResultError extends SqsDeleteBatchResultBaseBatch delete result with SQS error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | — |
failed | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
successfulreadonly [] - readonly
failedreadonly []
#SqsDeleteBatchResultExpectation
interface SqsDeleteBatchResultExpectationProperties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thistoHaveSuccessful(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulSatisfying(
matcher: (value: SqsDeleteBatchSuccessful) => unknown,
): thisParameters
matcher(value: SqsDeleteBatchSuccessful) => unknown
toHaveSuccessfulContaining(item: unknown): thisParameters
itemunknown
toHaveSuccessfulContainingEqual(item: unknown): thisParameters
itemunknown
toHaveSuccessfulMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisParameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]
toHaveSuccessfulEmpty(): thistoHaveSuccessfulCount(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountSatisfying(matcher: (value: number) => unknown): thisParameters
matcher(value: number) => unknown
toHaveSuccessfulCountNaN(): thistoHaveSuccessfulCountGreaterThan(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountGreaterThanOrEqual(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountLessThan(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountLessThanOrEqual(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountCloseTo(expected: number, numDigits?: number): thisParameters
expectednumbernumDigits?number
toHaveFailed(expected: unknown): thisParameters
expectedunknown
toHaveFailedEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedSatisfying(matcher: (value: SqsDeleteBatchFailed) => unknown): thisParameters
matcher(value: SqsDeleteBatchFailed) => unknown
toHaveFailedContaining(item: unknown): thisParameters
itemunknown
toHaveFailedContainingEqual(item: unknown): thisParameters
itemunknown
toHaveFailedMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisParameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]
toHaveFailedEmpty(): thistoHaveFailedCount(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountSatisfying(matcher: (value: number) => unknown): thisParameters
matcher(value: number) => unknown
toHaveFailedCountNaN(): thistoHaveFailedCountGreaterThan(expected: number): thisParameters
expectednumber
toHaveFailedCountGreaterThanOrEqual(expected: number): thisParameters
expectednumber
toHaveFailedCountLessThan(expected: number): thisParameters
expectednumber
toHaveFailedCountLessThanOrEqual(expected: number): thisParameters
expectednumber
toHaveFailedCountCloseTo(expected: number, numDigits?: number): thisParameters
expectednumbernumDigits?number
toHaveDuration(expected: unknown): thisParameters
expectedunknown
toHaveDurationEqual(expected: unknown): thisParameters
expectedunknown
toHaveDurationStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisParameters
matcher(value: number) => unknown
toHaveDurationNaN(): thistoHaveDurationGreaterThan(expected: number): thisParameters
expectednumber
toHaveDurationGreaterThanOrEqual(expected: number): thisParameters
expectednumber
toHaveDurationLessThan(expected: number): thisParameters
expectednumber
toHaveDurationLessThanOrEqual(expected: number): thisParameters
expectednumber
toHaveDurationCloseTo(expected: number, numDigits?: number): thisParameters
expectednumbernumDigits?number
#SqsDeleteBatchResultFailure
interface SqsDeleteBatchResultFailure extends SqsDeleteBatchResultBaseBatch delete result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | — |
failed | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
successfulnull - readonly
failednull
#SqsDeleteBatchResultSuccess
interface SqsDeleteBatchResultSuccess extends SqsDeleteBatchResultBaseSuccessful batch delete result.
Note: ok: true even if some messages failed (partial failure).
Check failed.length > 0 to detect partial failures.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | Array of message IDs that were successfully deleted. |
failed | Array of messages that failed to delete (may be non-empty even with ok: true). |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
successfulreadonly string[]Array of message IDs that were successfully deleted.
Array of messages that failed to delete (may be non-empty even with ok: true).
#SqsDeleteOptions
interface SqsDeleteOptions extends SqsOptionsOptions for deleting a message.
#SqsDeleteQueueOptions
interface SqsDeleteQueueOptions extends SqsOptionsOptions for deleting a queue.
#SqsDeleteQueueResultError
interface SqsDeleteQueueResultError extends SqsDeleteQueueResultBaseDelete queue result with SQS error.
Properties
- readonly
processedtrue - readonly
okfalse
#SqsDeleteQueueResultExpectation
interface SqsDeleteQueueResultExpectationFluent API for SQS delete queue result validation.
Provides chainable assertions for queue deletion results. Delete queue results only have ok and duration properties.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsDeleteQueueResultFailure
interface SqsDeleteQueueResultFailure extends SqsDeleteQueueResultBaseDelete queue result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#SqsDeleteQueueResultSuccess
interface SqsDeleteQueueResultSuccess extends SqsDeleteQueueResultBaseSuccessful delete queue result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#SqsDeleteResultError
interface SqsDeleteResultError extends SqsDeleteResultBaseDelete result with SQS error.
Properties
- readonly
processedtrue - readonly
okfalse
#SqsDeleteResultExpectation
interface SqsDeleteResultExpectationFluent API for SQS delete result validation.
Provides chainable assertions for message deletion results. Delete results only have ok and duration properties.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsDeleteResultFailure
interface SqsDeleteResultFailure extends SqsDeleteResultBaseDelete result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse
#SqsDeleteResultSuccess
interface SqsDeleteResultSuccess extends SqsDeleteResultBaseSuccessful delete result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull
#SqsEnsureQueueOptions
interface SqsEnsureQueueOptions extends SqsOptionsOptions for ensuring a queue exists.
| Name | Description |
|---|---|
attributes | Queue attributes (e.g., DelaySeconds, MessageRetentionPeriod) |
tags | Queue tags |
Properties
- readonly
attributes?Record<string, string>Queue attributes (e.g., DelaySeconds, MessageRetentionPeriod)
#SqsEnsureQueueResultError
interface SqsEnsureQueueResultError extends SqsEnsureQueueResultBaseEnsure queue result with SQS error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
queueUrlnull
#SqsEnsureQueueResultExpectation
interface SqsEnsureQueueResultExpectationFluent API for SQS ensure queue result validation.
Provides chainable assertions for queue creation/retrieval results including queue URL.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveQueueUrl() | Asserts that the queue URL equals the expected value. |
toHaveQueueUrlEqual() | Asserts that the queue URL equals the expected value using deep equality. |
toHaveQueueUrlStrictEqual() | Asserts that the queue URL strictly equals the expected value. |
toHaveQueueUrlSatisfying() | Asserts that the queue URL satisfies the provided matcher function. |
toHaveQueueUrlContaining() | Asserts that the queue URL contains the specified substring. |
toHaveQueueUrlMatching() | Asserts that the queue URL matches the specified regular expression. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveQueueUrl(expected: unknown): thisAsserts that the queue URL equals the expected value.
Parameters
expectedunknown- The expected queue URL
toHaveQueueUrlEqual(expected: unknown): thisAsserts that the queue URL equals the expected value using deep equality.
Parameters
expectedunknown- The expected queue URL
toHaveQueueUrlStrictEqual(expected: unknown): thisAsserts that the queue URL strictly equals the expected value.
Parameters
expectedunknown- The expected queue URL
toHaveQueueUrlSatisfying(matcher: (value: string) => unknown): thisAsserts that the queue URL satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the queue URL and performs assertions
toHaveQueueUrlContaining(substr: string): thisAsserts that the queue URL contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveQueueUrlMatching(expected: RegExp): thisAsserts that the queue URL matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsEnsureQueueResultFailure
interface SqsEnsureQueueResultFailure extends SqsEnsureQueueResultBaseEnsure queue result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
queueUrlnull
#SqsEnsureQueueResultSuccess
interface SqsEnsureQueueResultSuccess extends SqsEnsureQueueResultBaseSuccessful ensure queue result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
queueUrlstringURL of the queue (existing or newly created).
#SqsErrorOptions
interface SqsErrorOptions extends ErrorOptionsOptions for SQS errors.
| Name | Description |
|---|---|
code | — |
Properties
- readonly
code?string
#SqsMessage
interface SqsMessageSQS message received from a queue.
| Name | Description |
|---|---|
messageId | — |
body | — |
receiptHandle | — |
attributes | — |
messageAttributes | — |
md5OfBody | — |
Properties
- readonly
messageIdstring - readonly
bodystring - readonly
receiptHandlestring - readonly
attributesRecord<string, string> - readonly
md5OfBodystring
#SqsMessageAttribute
interface SqsMessageAttributeSQS message attributes.
| Name | Description |
|---|---|
dataType | — |
stringValue | — |
binaryValue | — |
Properties
- readonly
dataType"String" | "Number" | "Binary" - readonly
stringValue?string - readonly
binaryValue?Uint8Array
#SqsOptions
interface SqsOptions extends CommonOptionsCommon options with throwOnError support.
| Name | Description |
|---|---|
throwOnError | If true, throws errors instead of returning them in the result. |
Properties
- readonly
throwOnError?booleanIf true, throws errors instead of returning them in the result. If false (default), errors are returned in the result object.
#SqsReceiveOptions
interface SqsReceiveOptions extends SqsOptionsOptions for receiving messages.
| Name | Description |
|---|---|
maxMessages | Maximum number of messages to receive (1-10, default: 1) |
waitTimeSeconds | Wait time in seconds for long polling (0-20) |
visibilityTimeout | Visibility timeout in seconds (0-43200) |
attributeNames | System attribute names to retrieve |
messageAttributeNames | Message attribute names to retrieve |
Properties
- readonly
maxMessages?numberMaximum number of messages to receive (1-10, default: 1)
- readonly
waitTimeSeconds?numberWait time in seconds for long polling (0-20)
- readonly
visibilityTimeout?numberVisibility timeout in seconds (0-43200)
- readonly
attributeNames?readonly string[]System attribute names to retrieve
- readonly
messageAttributeNames?readonly string[]Message attribute names to retrieve
#SqsReceiveResultError
interface SqsReceiveResultError extends SqsReceiveResultBaseReceive result with SQS error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
messagesreadonly []
#SqsReceiveResultExpectation
interface SqsReceiveResultExpectationFluent API for SQS receive result validation.
Provides chainable assertions specifically designed for message receive results including messages array and message count.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveMessages() | Asserts that the messages equals the expected value. |
toHaveMessagesEqual() | Asserts that the messages equals the expected value using deep equality. |
toHaveMessagesStrictEqual() | Asserts that the messages strictly equals the expected value. |
toHaveMessagesSatisfying() | Asserts that the messages satisfies the provided matcher function. |
toHaveMessagesContaining() | Asserts that the messages contains the specified item. |
toHaveMessagesContainingEqual() | Asserts that the messages contains an item equal to the specified value. |
toHaveMessagesMatching() | Asserts that the messages matches the specified subset. |
toHaveMessagesEmpty() | Asserts that the messages is empty. |
toHaveMessagesCount() | Asserts that the messages count equals the expected value. |
toHaveMessagesCountEqual() | Asserts that the messages count equals the expected value using deep equality. |
toHaveMessagesCountStrictEqual() | Asserts that the messages count strictly equals the expected value. |
toHaveMessagesCountSatisfying() | Asserts that the messages count satisfies the provided matcher function. |
toHaveMessagesCountNaN() | Asserts that the messages count is NaN. |
toHaveMessagesCountGreaterThan() | Asserts that the messages count is greater than the expected value. |
toHaveMessagesCountGreaterThanOrEqual() | Asserts that the messages count is greater than or equal to the expected value. |
toHaveMessagesCountLessThan() | Asserts that the messages count is less than the expected value. |
toHaveMessagesCountLessThanOrEqual() | Asserts that the messages count is less than or equal to the expected value. |
toHaveMessagesCountCloseTo() | Asserts that the messages count is close to the expected value. |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveMessages(expected: unknown): thisAsserts that the messages equals the expected value.
Parameters
expectedunknown- The expected messages
toHaveMessagesEqual(expected: unknown): thisAsserts that the messages equals the expected value using deep equality.
Parameters
expectedunknown- The expected messages
toHaveMessagesStrictEqual(expected: unknown): thisAsserts that the messages strictly equals the expected value.
Parameters
expectedunknown- The expected messages
toHaveMessagesSatisfying(matcher: (value: SqsMessages) => unknown): thisAsserts that the messages satisfies the provided matcher function.
Parameters
matcher(value: SqsMessages) => unknown- A function that receives the messages and performs assertions
toHaveMessagesContaining(item: unknown): thisAsserts that the messages contains the specified item.
Parameters
itemunknown- The item to search for
toHaveMessagesContainingEqual(item: unknown): thisAsserts that the messages contains an item equal to the specified value.
Parameters
itemunknown- The item to search for using deep equality
toHaveMessagesMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisAsserts that the messages matches the specified subset.
Parameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]- The subset to match against
toHaveMessagesEmpty(): thisAsserts that the messages is empty.
toHaveMessagesCount(expected: unknown): thisAsserts that the messages count equals the expected value.
Parameters
expectedunknown- The expected messages count
toHaveMessagesCountEqual(expected: unknown): thisAsserts that the messages count equals the expected value using deep equality.
Parameters
expectedunknown- The expected messages count
toHaveMessagesCountStrictEqual(expected: unknown): thisAsserts that the messages count strictly equals the expected value.
Parameters
expectedunknown- The expected messages count
toHaveMessagesCountSatisfying(matcher: (value: number) => unknown): thisAsserts that the messages count satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the messages count and performs assertions
toHaveMessagesCountNaN(): thisAsserts that the messages count is NaN.
toHaveMessagesCountGreaterThan(expected: number): thisAsserts that the messages count is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessagesCountGreaterThanOrEqual(expected: number): thisAsserts that the messages count is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessagesCountLessThan(expected: number): thisAsserts that the messages count is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessagesCountLessThanOrEqual(expected: number): thisAsserts that the messages count is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveMessagesCountCloseTo(expected: number, numDigits?: number): thisAsserts that the messages count is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsReceiveResultFailure
interface SqsReceiveResultFailure extends SqsReceiveResultBaseReceive result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
messagesnull
#SqsReceiveResultSuccess
interface SqsReceiveResultSuccess extends SqsReceiveResultBaseSuccessful receive result.
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull Array of received messages (may be empty).
#SqsSendBatchResultError
interface SqsSendBatchResultError extends SqsSendBatchResultBaseBatch send result with SQS error.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | — |
failed | — |
Properties
- readonly
processedtrue - readonly
okfalse - readonly
successfulreadonly [] - readonly
failedreadonly []
#SqsSendBatchResultExpectation
interface SqsSendBatchResultExpectationFluent API for SQS send batch result validation.
Provides chainable assertions specifically designed for batch message send results including successful and failed messages arrays.
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveSuccessful(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulSatisfying(
matcher: (value: SqsSendBatchSuccessful) => unknown,
): thisParameters
matcher(value: SqsSendBatchSuccessful) => unknown
toHaveSuccessfulContaining(item: unknown): thisParameters
itemunknown
toHaveSuccessfulContainingEqual(item: unknown): thisParameters
itemunknown
toHaveSuccessfulMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisParameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]
toHaveSuccessfulEmpty(): thistoHaveSuccessfulCount(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveSuccessfulCountSatisfying(matcher: (value: number) => unknown): thisParameters
matcher(value: number) => unknown
toHaveSuccessfulCountNaN(): thistoHaveSuccessfulCountGreaterThan(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountGreaterThanOrEqual(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountLessThan(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountLessThanOrEqual(expected: number): thisParameters
expectednumber
toHaveSuccessfulCountCloseTo(expected: number, numDigits?: number): thisParameters
expectednumbernumDigits?number
toHaveFailed(expected: unknown): thisParameters
expectedunknown
toHaveFailedEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedSatisfying(matcher: (value: SqsSendBatchFailed) => unknown): thisParameters
matcher(value: SqsSendBatchFailed) => unknown
toHaveFailedContaining(item: unknown): thisParameters
itemunknown
toHaveFailedContainingEqual(item: unknown): thisParameters
itemunknown
toHaveFailedMatching(
subset: Record<PropertyKey, unknown> | Record<PropertyKey, unknown>[],
): thisParameters
subsetRecord<PropertyKey, unknown> | Record<PropertyKey, unknown>[]
toHaveFailedEmpty(): thistoHaveFailedCount(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountStrictEqual(expected: unknown): thisParameters
expectedunknown
toHaveFailedCountSatisfying(matcher: (value: number) => unknown): thisParameters
matcher(value: number) => unknown
toHaveFailedCountNaN(): thistoHaveFailedCountGreaterThan(expected: number): thisParameters
expectednumber
toHaveFailedCountGreaterThanOrEqual(expected: number): thisParameters
expectednumber
toHaveFailedCountLessThan(expected: number): thisParameters
expectednumber
toHaveFailedCountLessThanOrEqual(expected: number): thisParameters
expectednumber
toHaveFailedCountCloseTo(expected: number, numDigits?: number): thisParameters
expectednumbernumDigits?number
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsSendBatchResultFailure
interface SqsSendBatchResultFailure extends SqsSendBatchResultBaseBatch send result with connection failure.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | — |
failed | — |
Properties
- readonly
processedfalse - readonly
okfalse - readonly
successfulnull - readonly
failednull
#SqsSendBatchResultSuccess
interface SqsSendBatchResultSuccess extends SqsSendBatchResultBaseSuccessful batch send result.
Note: ok: true even if some messages failed (partial failure).
Check failed.length > 0 to detect partial failures.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
successful | Array of successfully sent messages. |
failed | Array of messages that failed to send (may be non-empty even with ok: true). |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull Array of successfully sent messages.
Array of messages that failed to send (may be non-empty even with ok: true).
#SqsSendOptions
interface SqsSendOptions extends SqsOptionsOptions for sending a message.
| Name | Description |
|---|---|
delaySeconds | Delay in seconds before the message becomes visible (0-900) |
messageAttributes | Message attributes |
messageGroupId | Message group ID (required for FIFO queues) |
messageDeduplicationId | Message deduplication ID (required for FIFO queues without content-based deduplication) |
Properties
- readonly
delaySeconds?numberDelay in seconds before the message becomes visible (0-900)
Message attributes
- readonly
messageGroupId?stringMessage group ID (required for FIFO queues)
- readonly
messageDeduplicationId?stringMessage deduplication ID (required for FIFO queues without content-based deduplication)
#SqsSendResultError
interface SqsSendResultError extends SqsSendResultBaseSend result with SQS error.
Properties
- readonly
processedtrue - readonly
okfalse - readonly
messageIdnull - readonly
md5OfBodynull - readonly
sequenceNumbernull
#SqsSendResultExpectation
interface SqsSendResultExpectationFluent API for SQS send result validation.
Provides chainable assertions specifically designed for single message send results including message ID and sequence number.
| Name | Description |
|---|---|
not | Negates the next assertion. |
toBeOk() | Asserts that the result is successful. |
toHaveMessageId() | Asserts that the message ID equals the expected value. |
toHaveMessageIdEqual() | Asserts that the message ID equals the expected value using deep equality. |
toHaveMessageIdStrictEqual() | Asserts that the message ID strictly equals the expected value. |
toHaveMessageIdSatisfying() | Asserts that the message ID satisfies the provided matcher function. |
toHaveMessageIdContaining() | Asserts that the message ID contains the specified substring. |
toHaveMessageIdMatching() | Asserts that the message ID matches the specified regular expression. |
toHaveMd5OfBody() | Asserts that the MD5 of body equals the expected value. |
toHaveMd5OfBodyEqual() | Asserts that the MD5 of body equals the expected value using deep equality. |
toHaveMd5OfBodyStrictEqual() | Asserts that the MD5 of body strictly equals the expected value. |
toHaveMd5OfBodySatisfying() | Asserts that the MD5 of body satisfies the provided matcher function. |
toHaveMd5OfBodyContaining() | Asserts that the MD5 of body contains the specified substring. |
toHaveMd5OfBodyMatching() | Asserts that the MD5 of body matches the specified regular expression. |
toHaveSequenceNumber() | Asserts that the sequence number equals the expected value. |
toHaveSequenceNumberEqual() | Asserts that the sequence number equals the expected value using deep equality. |
toHaveSequenceNumberStrictEqual() | Asserts that the sequence number strictly equals the expected value. |
toHaveSequenceNumberSatisfying() | Asserts that the sequence number satisfies the provided matcher function. |
toHaveSequenceNumberContaining() | Asserts that the sequence number contains the specified substring. |
toHaveSequenceNumberMatching() | Asserts that the sequence number matches the specified regular expression. |
toHaveSequenceNumberPresent() | Asserts that the sequence number is present (not null or undefined). |
toHaveSequenceNumberNull() | Asserts that the sequence number is null. |
toHaveSequenceNumberUndefined() | Asserts that the sequence number is undefined. |
toHaveSequenceNumberNullish() | Asserts that the sequence number is nullish (null or undefined). |
toHaveDuration() | Asserts that the duration equals the expected value. |
toHaveDurationEqual() | Asserts that the duration equals the expected value using deep equality. |
toHaveDurationStrictEqual() | Asserts that the duration strictly equals the expected value. |
toHaveDurationSatisfying() | Asserts that the duration satisfies the provided matcher function. |
toHaveDurationNaN() | Asserts that the duration is NaN. |
toHaveDurationGreaterThan() | Asserts that the duration is greater than the expected value. |
toHaveDurationGreaterThanOrEqual() | Asserts that the duration is greater than or equal to the expected value. |
toHaveDurationLessThan() | Asserts that the duration is less than the expected value. |
toHaveDurationLessThanOrEqual() | Asserts that the duration is less than or equal to the expected value. |
toHaveDurationCloseTo() | Asserts that the duration is close to the expected value. |
Properties
- readonly
notthisNegates the next assertion.
Methods
toBeOk(): thisAsserts that the result is successful.
toHaveMessageId(expected: unknown): thisAsserts that the message ID equals the expected value.
Parameters
expectedunknown- The expected message ID
toHaveMessageIdEqual(expected: unknown): thisAsserts that the message ID equals the expected value using deep equality.
Parameters
expectedunknown- The expected message ID
toHaveMessageIdStrictEqual(expected: unknown): thisAsserts that the message ID strictly equals the expected value.
Parameters
expectedunknown- The expected message ID
toHaveMessageIdSatisfying(matcher: (value: string) => unknown): thisAsserts that the message ID satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the message ID and performs assertions
toHaveMessageIdContaining(substr: string): thisAsserts that the message ID contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveMessageIdMatching(expected: RegExp): thisAsserts that the message ID matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveMd5OfBody(expected: unknown): thisAsserts that the MD5 of body equals the expected value.
Parameters
expectedunknown- The expected MD5 hash
toHaveMd5OfBodyEqual(expected: unknown): thisAsserts that the MD5 of body equals the expected value using deep equality.
Parameters
expectedunknown- The expected MD5 hash
toHaveMd5OfBodyStrictEqual(expected: unknown): thisAsserts that the MD5 of body strictly equals the expected value.
Parameters
expectedunknown- The expected MD5 hash
toHaveMd5OfBodySatisfying(matcher: (value: string) => unknown): thisAsserts that the MD5 of body satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the MD5 hash and performs assertions
toHaveMd5OfBodyContaining(substr: string): thisAsserts that the MD5 of body contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveMd5OfBodyMatching(expected: RegExp): thisAsserts that the MD5 of body matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveSequenceNumber(expected: unknown): thisAsserts that the sequence number equals the expected value.
Parameters
expectedunknown- The expected sequence number
toHaveSequenceNumberEqual(expected: unknown): thisAsserts that the sequence number equals the expected value using deep equality.
Parameters
expectedunknown- The expected sequence number
toHaveSequenceNumberStrictEqual(expected: unknown): thisAsserts that the sequence number strictly equals the expected value.
Parameters
expectedunknown- The expected sequence number
toHaveSequenceNumberSatisfying(matcher: (value: string) => unknown): thisAsserts that the sequence number satisfies the provided matcher function.
Parameters
matcher(value: string) => unknown- A function that receives the sequence number and performs assertions
toHaveSequenceNumberContaining(substr: string): thisAsserts that the sequence number contains the specified substring.
Parameters
substrstring- The substring to search for
toHaveSequenceNumberMatching(expected: RegExp): thisAsserts that the sequence number matches the specified regular expression.
Parameters
expectedRegExp- The regular expression to match against
toHaveSequenceNumberPresent(): thisAsserts that the sequence number is present (not null or undefined).
toHaveSequenceNumberNull(): thisAsserts that the sequence number is null.
toHaveSequenceNumberUndefined(): thisAsserts that the sequence number is undefined.
toHaveSequenceNumberNullish(): thisAsserts that the sequence number is nullish (null or undefined).
toHaveDuration(expected: unknown): thisAsserts that the duration equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationEqual(expected: unknown): thisAsserts that the duration equals the expected value using deep equality.
Parameters
expectedunknown- The expected duration value
toHaveDurationStrictEqual(expected: unknown): thisAsserts that the duration strictly equals the expected value.
Parameters
expectedunknown- The expected duration value
toHaveDurationSatisfying(matcher: (value: number) => unknown): thisAsserts that the duration satisfies the provided matcher function.
Parameters
matcher(value: number) => unknown- A function that receives the duration and performs assertions
toHaveDurationNaN(): thisAsserts that the duration is NaN.
toHaveDurationGreaterThan(expected: number): thisAsserts that the duration is greater than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationGreaterThanOrEqual(expected: number): thisAsserts that the duration is greater than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThan(expected: number): thisAsserts that the duration is less than the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationLessThanOrEqual(expected: number): thisAsserts that the duration is less than or equal to the expected value.
Parameters
expectednumber- The value to compare against
toHaveDurationCloseTo(expected: number, numDigits?: number): thisAsserts that the duration is close to the expected value.
Parameters
expectednumber- The expected value
numDigits?number- The number of decimal digits to check (default: 2)
#SqsSendResultFailure
interface SqsSendResultFailure extends SqsSendResultBaseSend result with connection failure.
Properties
- readonly
processedfalse - readonly
okfalse - readonly
messageIdnull - readonly
md5OfBodynull - readonly
sequenceNumbernull
#SqsSendResultSuccess
interface SqsSendResultSuccess extends SqsSendResultBaseSuccessful send result.
| Name | Description |
|---|---|
processed | — |
ok | — |
error | — |
messageId | Unique identifier for the sent message. |
md5OfBody | MD5 hash of the message body (for integrity verification). |
sequenceNumber | Sequence number for FIFO queues (present only for FIFO queues). |
Properties
- readonly
processedtrue - readonly
oktrue - readonly
errornull - readonly
messageIdstringUnique identifier for the sent message.
- readonly
md5OfBodystringMD5 hash of the message body (for integrity verification).
- readonly
sequenceNumberstring | nullSequence number for FIFO queues (present only for FIFO queues).
#TlsConfig
interface TlsConfigTLS configuration for ConnectRPC connections.
| Name | Description |
|---|---|
rootCerts | Root CA certificate (PEM format). |
clientCert | Client certificate (PEM format). |
clientKey | Client private key (PEM format). |
insecure | Skip server certificate verification (use only for testing). |
Properties
- readonly
rootCerts?Uint8ArrayRoot CA certificate (PEM format).
- readonly
clientCert?Uint8ArrayClient certificate (PEM format).
- readonly
clientKey?Uint8ArrayClient private key (PEM format).
- readonly
insecure?booleanSkip server certificate verification (use only for testing).
Functions
#createConnectRpcClient
function createConnectRpcClient(
config: ConnectRpcClientConfig,
): ConnectRpcClientCreate a new ConnectRPC client instance.
The client supports multiple protocols (Connect, gRPC, gRPC-Web) and provides Server Reflection for runtime service discovery without compile-time code generation.
Parameters
configConnectRpcClientConfig- Client configuration including server URL and protocol options
Returns
ConnectRpcClient — A new ConnectRPC client instance
Examples
Basic usage with reflection
import { createConnectRpcClient } from "@probitas/client-connectrpc";
const client = createConnectRpcClient({
url: "http://localhost:50051",
});
// Call a method
const response = await client.call(
"echo.EchoService",
"echo",
{ message: "Hello!" }
);
console.log(response.data);
await client.close();
Service discovery with reflection
import { createConnectRpcClient } from "@probitas/client-connectrpc";
const client = createConnectRpcClient({
url: "http://localhost:50051",
});
// Discover available services
const services = await client.reflection.listServices();
console.log("Services:", services);
// Get method information
const info = await client.reflection.getServiceInfo("echo.EchoService");
console.log("Methods:", info.methods);
await client.close();
Using different protocols
import { createConnectRpcClient } from "@probitas/client-connectrpc";
// Connect protocol (HTTP/1.1 or HTTP/2)
const connectClient = createConnectRpcClient({
url: "http://localhost:8080",
protocol: "connect",
});
// gRPC protocol (HTTP/2 with binary protobuf)
const grpcClient = createConnectRpcClient({
url: "http://localhost:50051",
protocol: "grpc",
});
// gRPC-Web protocol (for browser compatibility)
const grpcWebClient = createConnectRpcClient({
url: "http://localhost:8080",
protocol: "grpc-web",
});
await connectClient.close();
await grpcClient.close();
await grpcWebClient.close();
Using connection config object
import { createConnectRpcClient } from "@probitas/client-connectrpc";
const client = createConnectRpcClient({
url: {
host: "grpc.example.com",
port: 443,
protocol: "https",
},
});
await client.close();
Using await using for automatic cleanup
import { createConnectRpcClient } from "@probitas/client-connectrpc";
await using client = createConnectRpcClient({
url: "http://localhost:50051",
});
const res = await client.call("echo.EchoService", "echo", { message: "test" });
// Client automatically closed when scope exits
#createDenoKvClient
async function createDenoKvClient(
config?: DenoKvClientConfig,
): Promise<DenoKvClient>Create a new Deno KV client instance.
The client provides key-value operations with support for atomic transactions, time-to-live (TTL), and prefix-based listing.
Parameters
config?DenoKvClientConfig- Deno KV client configuration (optional)
Returns
Promise<DenoKvClient> — A promise resolving to a new Deno KV client instance
Examples
Basic usage with in-memory database
import { createDenoKvClient } from "@probitas/client-deno-kv";
interface User {
name: string;
email: string;
}
const kv = await createDenoKvClient();
await kv.set(["users", "123"], { name: "Alice", email: "alice@example.com" });
const result = await kv.get<User>(["users", "123"]);
if (result.ok) {
console.log(result.value); // { name: "Alice", email: "alice@example.com" }
}
await kv.close();
Using persistent storage
import { createDenoKvClient } from "@probitas/client-deno-kv";
const kv = await createDenoKvClient({
path: "./data.kv",
});
await kv.close();
Set with expiration (TTL)
import { createDenoKvClient } from "@probitas/client-deno-kv";
const kv = await createDenoKvClient();
const sessionId = "abc123";
const sessionData = { userId: "123", token: "xyz" };
await kv.set(["sessions", sessionId], sessionData, {
expireIn: 3600_000, // Expire in 1 hour
});
await kv.close();
List entries by prefix
import { createDenoKvClient } from "@probitas/client-deno-kv";
interface User {
name: string;
email: string;
}
const kv = await createDenoKvClient();
const result = await kv.list<User>({ prefix: ["users"] });
if (result.ok) {
for (const entry of result.entries) {
console.log(entry.key, entry.value);
}
}
await kv.close();
Atomic transactions
import { createDenoKvClient } from "@probitas/client-deno-kv";
const kv = await createDenoKvClient();
const atomicResult = await kv.atomic()
.check({ key: ["counter"], versionstamp: null })
.set(["counter"], 1)
.commit();
await kv.close();
Using await using for automatic cleanup
import { createDenoKvClient } from "@probitas/client-deno-kv";
await using kv = await createDenoKvClient();
await kv.set(["test"], "value");
// Client automatically closed when scope exits
Error handling with Failure pattern
import { createDenoKvClient } from "@probitas/client-deno-kv";
async function example() {
const kv = await createDenoKvClient();
const result = await kv.get<string>(["key"]);
if (!result.ok) {
if (!result.processed) {
// Connection failure
console.error("Connection failed:", result.error.message);
} else {
// KV error (quota exceeded, etc.)
console.error("KV error:", result.error.message);
}
await kv.close();
return;
}
console.log("Value:", result.value);
await kv.close();
}
Using throwOnError for traditional exception handling
import { createDenoKvClient, DenoKvError } from "@probitas/client-deno-kv";
const kv = await createDenoKvClient({ throwOnError: true });
try {
const result = await kv.get<string>(["key"]);
console.log("Value:", result.value);
} catch (error) {
if (error instanceof DenoKvError) {
console.error("KV error:", error.message);
}
}
await kv.close();
#createGraphqlClient
function createGraphqlClient(config: GraphqlClientConfig): GraphqlClientCreate a new GraphQL client instance.
The client provides methods for executing GraphQL queries, mutations, and subscriptions with automatic error handling and response parsing.
Parameters
configGraphqlClientConfig- Client configuration including URL and default options
Returns
GraphqlClient — A new GraphQL client instance
Examples
Basic query
import { createGraphqlClient } from "@probitas/client-graphql";
const client = createGraphqlClient({
url: "http://localhost:4000/graphql",
});
const response = await client.query(`
query GetUser($id: ID!) {
user(id: $id) { id name email }
}
`, { id: "123" });
console.log(response.data);
await client.close();
Using connection config object
import { createGraphqlClient } from "@probitas/client-graphql";
const client = createGraphqlClient({
url: { host: "api.example.com", port: 443, protocol: "https" },
});
await client.close();
Mutation with error handling
import { createGraphqlClient } from "@probitas/client-graphql";
const client = createGraphqlClient({ url: "http://localhost:4000/graphql" });
const response = await client.mutation(`
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) { id }
}
`, { input: { name: "Alice", email: "alice@example.com" } });
if (response.ok) {
console.log("Created user:", (response.data as any).createUser.id);
}
await client.close();
Using await using for automatic cleanup
import { createGraphqlClient } from "@probitas/client-graphql";
await using client = createGraphqlClient({
url: "http://localhost:4000/graphql",
});
const response = await client.query(`{ __typename }`);
// Client automatically closed when scope exits
#createGrpcClient
function createGrpcClient(config: GrpcClientConfig): ConnectRpcClientCreate a new gRPC client instance.
This is a thin wrapper around createConnectRpcClient with protocol: "grpc" fixed.
The client provides Server Reflection support for runtime service discovery.
Parameters
configGrpcClientConfig- Client configuration including server address
Returns
ConnectRpcClient — A new gRPC client instance
Examples
Basic usage with reflection
import { createGrpcClient } from "@probitas/client-grpc";
const client = createGrpcClient({
url: "http://localhost:50051",
});
// Call a method
const response = await client.call(
"echo.EchoService",
"echo",
{ message: "Hello!" }
);
console.log(response.data);
await client.close();
Service discovery with reflection
import { createGrpcClient } from "@probitas/client-grpc";
const client = createGrpcClient({
url: "http://localhost:50051",
});
// Discover available services
const services = await client.reflection.listServices();
console.log("Available services:", services);
// Get method information
const info = await client.reflection.getServiceInfo("echo.EchoService");
console.log("Methods:", info.methods);
await client.close();
Testing error responses
import { createGrpcClient } from "@probitas/client-grpc";
const client = createGrpcClient({ url: "http://localhost:50051" });
const response = await client.call(
"user.UserService",
"getUser",
{ id: "non-existent" },
{ throwOnError: false }
);
if (!response.ok) {
console.log("Error code:", response.statusCode); // NOT_FOUND = 5
}
await client.close();
Using await using for automatic cleanup
import { createGrpcClient } from "@probitas/client-grpc";
await using client = createGrpcClient({
url: "http://localhost:50051",
});
const res = await client.call("echo.EchoService", "echo", { message: "test" });
console.log(res.data);
// Client automatically closed when scope exits
#createHttpClient
function createHttpClient(config: HttpClientConfig): HttpClientCreate a new HTTP client instance.
The client provides methods for making HTTP requests with automatic cookie handling, response body pre-loading, and error handling.
Parameters
configHttpClientConfig- Client configuration including URL and default options
Returns
HttpClient — A new HTTP client instance
Examples
Basic usage with string URL
import { createHttpClient } from "@probitas/client-http";
const http = createHttpClient({ url: "http://localhost:3000" });
const response = await http.get("/users/123");
console.log(response.json);
await http.close();
With connection config object
import { createHttpClient } from "@probitas/client-http";
const http = createHttpClient({
url: { host: "api.example.com", port: 443, protocol: "https" },
});
await http.close();
With default headers
import { createHttpClient } from "@probitas/client-http";
const http = createHttpClient({
url: "http://localhost:3000",
headers: {
"Authorization": "Bearer token123",
"Accept": "application/json",
},
});
await http.close();
Using await using for automatic cleanup
import { createHttpClient } from "@probitas/client-http";
await using http = createHttpClient({ url: "http://localhost:3000" });
const response = await http.get("/health");
console.log(response.ok);
#createMongoClient
async function createMongoClient(
config: MongoClientConfig,
): Promise<MongoClient>Create a new MongoDB client instance.
The client provides typed collection access, aggregation pipelines, transaction support, and comprehensive CRUD operations.
Parameters
configMongoClientConfig- MongoDB client configuration
Returns
Promise<MongoClient> — A promise resolving to a new MongoDB client instance
Examples
Basic usage with connection string
import { createMongoClient } from "@probitas/client-mongodb";
const mongo = await createMongoClient({
url: "mongodb://localhost:27017",
database: "testdb",
});
const users = mongo.collection<{ name: string; age: number }>("users");
const result = await users.find({ age: { $gte: 18 } });
if (result.ok) {
console.log(result.docs[0]);
} else {
console.error("Error:", result.error.message);
}
await mongo.close();
Using connection config object
import { createMongoClient } from "@probitas/client-mongodb";
const mongo = await createMongoClient({
url: {
host: "localhost",
port: 27017,
username: "admin",
password: "secret",
authSource: "admin",
},
database: "testdb",
});
await mongo.close();
Insert and query documents
import { createMongoClient } from "@probitas/client-mongodb";
interface User { name: string; age: number }
const mongo = await createMongoClient({
url: "mongodb://localhost:27017",
database: "testdb",
});
const users = mongo.collection<User>("users");
// Insert a document
const insertResult = await users.insertOne({ name: "Alice", age: 30 });
if (insertResult.ok) {
console.log("Inserted ID:", insertResult.insertedId);
}
// Find documents with projection and sorting
const findResult = await users.find(
{ age: { $gte: 25 } },
{ sort: { name: 1 }, limit: 10 }
);
if (findResult.ok) {
console.log("Found:", findResult.docs.length);
}
await mongo.close();
Transaction with auto-commit/rollback
import { createMongoClient } from "@probitas/client-mongodb";
interface User { _id?: unknown; name: string; age: number }
const mongo = await createMongoClient({
url: "mongodb://localhost:27017",
database: "testdb",
});
await mongo.transaction(async (session) => {
const users = session.collection<User>("users");
const insertResult = await users.insertOne({ name: "Bob", age: 25 });
if (!insertResult.ok) throw insertResult.error;
const updateResult = await users.updateOne(
{ name: "Alice" },
{ $inc: { age: 1 } }
);
if (!updateResult.ok) throw updateResult.error;
});
await mongo.close();
Aggregation pipeline
import { createMongoClient } from "@probitas/client-mongodb";
interface User { name: string; age: number; department: string }
const mongo = await createMongoClient({
url: "mongodb://localhost:27017",
database: "testdb",
});
const users = mongo.collection<User>("users");
const result = await users.aggregate<{ _id: string; avgAge: number }>([
{ $group: { _id: "$department", avgAge: { $avg: "$age" } } },
{ $sort: { avgAge: -1 } },
]);
if (result.ok) {
console.log(result.docs);
}
await mongo.close();
Using await using for automatic cleanup
import { createMongoClient } from "@probitas/client-mongodb";
await using mongo = await createMongoClient({
url: "mongodb://localhost:27017",
database: "testdb",
});
const result = await mongo.collection("users").find({});
if (result.ok) {
console.log(result.docs);
}
// Client automatically closed when scope exits
#createRabbitMqClient
async function createRabbitMqClient(
config: RabbitMqClientConfig,
): Promise<RabbitMqClient>Create a new RabbitMQ client instance.
The client provides queue and exchange management, message publishing and consumption, and acknowledgment handling via AMQP protocol.
Parameters
configRabbitMqClientConfig- RabbitMQ client configuration
Returns
Promise<RabbitMqClient> — A promise resolving to a new RabbitMQ client instance
Examples
Basic usage with string URL
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
const rabbit = await createRabbitMqClient({
url: "amqp://guest:guest@localhost:5672",
});
const channel = await rabbit.channel();
await channel.assertQueue("my-queue", { durable: true });
const content = new TextEncoder().encode(JSON.stringify({ type: "ORDER" }));
await channel.sendToQueue("my-queue", content, { persistent: true });
await channel.close();
await rabbit.close();
With connection config object
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
const rabbit = await createRabbitMqClient({
url: {
host: "localhost",
port: 5672,
username: "guest",
password: "guest",
vhost: "/",
},
});
await rabbit.close();
Exchange and binding
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
const rabbit = await createRabbitMqClient({ url: "amqp://localhost:5672" });
const channel = await rabbit.channel();
// Create exchange and queue
await channel.assertExchange("events", "topic", { durable: true });
await channel.assertQueue("user-events");
await channel.bindQueue("user-events", "events", "user.*");
// Publish to exchange
const content = new TextEncoder().encode(JSON.stringify({ id: 1 }));
await channel.publish("events", "user.created", content);
await rabbit.close();
Consuming messages
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
const rabbit = await createRabbitMqClient({ url: "amqp://localhost:5672" });
const channel = await rabbit.channel();
await channel.assertQueue("my-queue");
for await (const message of channel.consume("my-queue")) {
console.log("Received:", new TextDecoder().decode(message.content));
await channel.ack(message);
break;
}
await rabbit.close();
Get single message (polling)
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
const rabbit = await createRabbitMqClient({ url: "amqp://localhost:5672" });
const channel = await rabbit.channel();
await channel.assertQueue("my-queue");
const result = await channel.get("my-queue");
if (result.message) {
await channel.ack(result.message);
}
await rabbit.close();
Using await using for automatic cleanup
import { createRabbitMqClient } from "@probitas/client-rabbitmq";
await using rabbit = await createRabbitMqClient({
url: "amqp://localhost:5672",
});
const channel = await rabbit.channel();
await channel.assertQueue("test");
// Client automatically closed when scope exits
#createRedisClient
async function createRedisClient(
config: RedisClientConfig,
): Promise<RedisClient>Create a new Redis client instance.
The client provides comprehensive Redis data structure support including strings, hashes, lists, sets, sorted sets, pub/sub, and transactions.
Parameters
configRedisClientConfig- Redis client configuration
Returns
Promise<RedisClient> — A promise resolving to a new Redis client instance
Examples
Using URL string
import { createRedisClient } from "@probitas/client-redis";
const client = await createRedisClient({
url: "redis://localhost:6379/0",
});
await client.set("key", "value");
const result = await client.get("key");
if (result.ok) {
console.log(result.value); // "value"
}
await client.close();
Using connection config object
import { createRedisClient } from "@probitas/client-redis";
const client = await createRedisClient({
url: {
host: "localhost",
port: 6379,
password: "secret",
db: 0,
},
});
await client.close();
Set with expiration
import { createRedisClient } from "@probitas/client-redis";
const client = await createRedisClient({ url: "redis://localhost:6379" });
const sessionData = JSON.stringify({ userId: "123" });
const data = "temporary value";
// Set key with 1 hour TTL
await client.set("session", sessionData, { ex: 3600 });
// Set key with 5 second TTL in milliseconds
await client.set("temp", data, { px: 5000 });
await client.close();
Hash operations
import { createRedisClient } from "@probitas/client-redis";
const client = await createRedisClient({ url: "redis://localhost:6379" });
await client.hset("user:123", "name", "Alice");
await client.hset("user:123", "email", "alice@example.com");
const user = await client.hgetall("user:123");
if (user.ok) {
console.log(user.value); // { name: "Alice", email: "alice@example.com" }
}
await client.close();
Pub/Sub
import { createRedisClient } from "@probitas/client-redis";
const client = await createRedisClient({ url: "redis://localhost:6379" });
// Subscribe to channel (this would run indefinitely in practice)
// for await (const message of client.subscribe("events")) {
// console.log("Received:", message.message);
// }
// Publish to channel
await client.publish("events", JSON.stringify({ type: "user.created" }));
await client.close();
Using await using for automatic cleanup
import { createRedisClient } from "@probitas/client-redis";
await using client = await createRedisClient({
url: "redis://localhost:6379",
});
await client.set("test", "value");
// Client automatically closed when scope exits
#createSqsClient
function createSqsClient(config: SqsClientConfig): Promise<SqsClient>Create a new Amazon SQS client instance.
The client provides queue management, message publishing and consumption, batch operations, and supports both standard and FIFO queues via AWS SDK.
Parameters
configSqsClientConfig- SQS client configuration
Returns
Promise<SqsClient> — A promise resolving to a new SQS client instance
Examples
Basic usage with existing queue
import { createSqsClient } from "@probitas/client-sqs";
async function example() {
const sqs = await createSqsClient({
region: "ap-northeast-1",
queueUrl: "https://sqs.ap-northeast-1.amazonaws.com/123456789/my-queue",
credentials: { accessKeyId: "test", secretAccessKey: "test" },
});
// Send a message
const sendResult = await sqs.send(JSON.stringify({
type: "ORDER",
orderId: "123",
}));
if (sendResult.ok) {
console.log("Message ID:", sendResult.messageId);
} else {
console.error("Error:", sendResult.error.message);
}
await sqs.close();
}
Using LocalStack for local development
import { createSqsClient } from "@probitas/client-sqs";
async function example() {
const sqs = await createSqsClient({
region: "us-east-1",
url: "http://localhost:4566",
credentials: {
accessKeyId: "test",
secretAccessKey: "test",
},
});
// Create queue dynamically (also sets queueUrl)
const result = await sqs.ensureQueue("test-queue");
if (result.ok) {
console.log(result.queueUrl); // http://localhost:4566/000000000000/test-queue
}
await sqs.close();
}
Receiving messages with long polling
import { createSqsClient } from "@probitas/client-sqs";
async function example() {
const sqs = await createSqsClient({
region: "us-east-1",
url: "http://localhost:4566",
credentials: { accessKeyId: "test", secretAccessKey: "test" },
});
await sqs.ensureQueue("test-queue");
// Long polling waits up to 20 seconds for messages
const receiveResult = await sqs.receive({
maxMessages: 10,
waitTimeSeconds: 20,
visibilityTimeout: 30,
});
if (receiveResult.ok) {
console.log("Received:", receiveResult.messages.length);
// Process and acknowledge messages
for (const msg of receiveResult.messages) {
const data = JSON.parse(msg.body);
console.log("Processing:", data);
// Delete after successful processing
await sqs.delete(msg.receiptHandle);
}
}
await sqs.close();
}
Batch operations for high throughput
import { createSqsClient } from "@probitas/client-sqs";
async function example() {
const sqs = await createSqsClient({
region: "us-east-1",
url: "http://localhost:4566",
credentials: { accessKeyId: "test", secretAccessKey: "test" },
});
await sqs.ensureQueue("test-queue");
// Send multiple messages in a single API call
const batchResult = await sqs.sendBatch([
{ id: "1", body: JSON.stringify({ event: "user.created", userId: "a1" }) },
{ id: "2", body: JSON.stringify({ event: "user.created", userId: "a2" }) },
{ id: "3", body: JSON.stringify({ event: "user.updated", userId: "a3" }) },
]);
if (batchResult.ok) {
console.log(`Sent: ${batchResult.successful.length}`);
console.log(`Failed: ${batchResult.failed.length}`);
}
// Batch delete processed messages
const receiveResult = await sqs.receive({ maxMessages: 10 });
if (receiveResult.ok) {
const handles = receiveResult.messages.map((m) => m.receiptHandle);
await sqs.deleteBatch(handles);
}
await sqs.close();
}
Using await using for automatic cleanup
import { createSqsClient } from "@probitas/client-sqs";
async function example() {
await using sqs = await createSqsClient({
region: "us-east-1",
url: "http://localhost:4566",
credentials: { accessKeyId: "test", secretAccessKey: "test" },
});
await sqs.ensureQueue("test-queue");
await sqs.send("Hello, SQS!");
// Client automatically closed when scope exits
}
#expect(11 overloads)
function expect<T extends HttpResponse>(
value: NotAny<T>,
): HttpResponseExpectationUnified expect function that dispatches to the appropriate expectation function based on the type of the input object.
Parameters
valueNotAny<T>
Examples
import { expect } from "./expect.ts";
// Falls back to expectAnything (chainable @std/expect) for other values
expect(42).toBe(42).toBeGreaterThan(40);
expect("hello world").toContain("world");
expect({ a: 1, b: 2 }).toMatchObject({ a: 1 });
Show all 11 overloads
function expect<T extends HttpResponse>(
value: NotAny<T>,
): HttpResponseExpectationUnified expect function that dispatches to the appropriate expectation function based on the type of the input object.
Parameters
valueNotAny<T>
function expect<T extends ConnectRpcResponse>(
value: NotAny<T>,
): ConnectRpcResponseExpectationParameters
valueNotAny<T>
function expect<T extends GraphqlResponse>(
value: NotAny<T>,
): GraphqlResponseExpectationParameters
valueNotAny<T>
function expect<T extends SqlQueryResult>(
value: NotAny<T>,
): SqlQueryResultExpectationParameters
valueNotAny<T>
function expect<T extends DenoKvResult>(value: NotAny<T>): DenoKvExpectation<T>Parameters
valueNotAny<T>
function expect<T extends RedisResult>(value: NotAny<T>): RedisExpectation<T>Parameters
valueNotAny<T>
function expect<T extends MongoResult>(value: NotAny<T>): MongoExpectation<T>Parameters
valueNotAny<T>
function expect<T extends RabbitMqResult>(
value: NotAny<T>,
): RabbitMqExpectation<T>Parameters
valueNotAny<T>
function expect<T extends SqsResult>(value: NotAny<T>): SqsExpectation<T>Parameters
valueNotAny<T>
function expect(value: any): AnythingExpectationParameters
valueany
function expect(value: unknown): unknownParameters
valueunknown
#expectAnything
function expectAnything<T>(value: T): AnythingExpectationCreates a chainable expectation for any value using @std/expect matchers.
This wrapper allows method chaining, unlike @std/expect which returns void.
Parameters
valueT- Value to test
Returns
AnythingExpectation — Chainable expectation interface
Examples
import { expectAnything } from "@probitas/expect";
// Method chaining
expectAnything(42)
.toBeDefined()
.toBeGreaterThan(40)
.toBeLessThan(50);
// Negation with continued chaining
expectAnything("hello")
.not.toBe("world")
.not.toBeNull()
.toContain("ello");
#expectConnectRpcResponse
function expectConnectRpcResponse(
response: ConnectRpcResponse,
): ConnectRpcResponseExpectationParameters
responseConnectRpcResponse
#expectDenoKvResult
function expectDenoKvResult<R extends DenoKvResult>(
result: R,
): DenoKvExpectation<R>Create a fluent expectation chain for any Deno KV result validation.
This unified function accepts any Deno KV result type and returns the appropriate expectation interface based on the result's type discriminator.
Parameters
resultR
Examples
import type { DenoKvGetResult, DenoKvSetResult, DenoKvListResult, DenoKvDeleteResult, DenoKvAtomicResult } from "@probitas/client-deno-kv";
import { expectDenoKvResult } from "./deno_kv.ts";
// For GET result - returns DenoKvGetResultExpectation<T>
const getResult = {
kind: "deno-kv:get",
ok: true,
key: ["users", "1"],
value: { name: "Alice" },
versionstamp: "00000000000000010000",
duration: 0,
} as unknown as DenoKvGetResult<{ name: string }>;
expectDenoKvResult(getResult).toBeOk().toHaveValuePresent();
// For SET result - returns DenoKvSetResultExpectation
const setResult = {
kind: "deno-kv:set",
ok: true,
versionstamp: "00000000000000010000",
duration: 0,
} as unknown as DenoKvSetResult;
expectDenoKvResult(setResult).toBeOk().toHaveVersionstamp("00000000000000010000");
// For LIST result - returns DenoKvListResultExpectation<T>
const listResult = {
kind: "deno-kv:list",
ok: true,
entries: [{ key: ["users", "1"], value: { name: "Alice" }, versionstamp: "00000000000000010000" }],
duration: 0,
} as unknown as DenoKvListResult<{ name: string }>;
expectDenoKvResult(listResult).toBeOk().toHaveEntryCount(1);
// For DELETE result - returns DenoKvDeleteResultExpectation
const deleteResult = {
kind: "deno-kv:delete",
ok: true,
duration: 0,
} as unknown as DenoKvDeleteResult;
expectDenoKvResult(deleteResult).toBeOk();
// For ATOMIC result - returns DenoKvAtomicResultExpectation
const atomicResult = {
kind: "deno-kv:atomic",
ok: true,
versionstamp: "00000000000000010000",
duration: 0,
} as unknown as DenoKvAtomicResult;
expectDenoKvResult(atomicResult).toBeOk().toHaveVersionstamp("00000000000000010000");
#expectGraphqlResponse
function expectGraphqlResponse(
response: GraphqlResponse,
): GraphqlResponseExpectationParameters
responseGraphqlResponse
#expectGrpcResponse
function expectGrpcResponse(response: GrpcResponse): GrpcResponseExpectationParameters
responseGrpcResponse
#expectHttpResponse
function expectHttpResponse(response: HttpResponse): HttpResponseExpectationParameters
responseHttpResponse
#expectMongoResult
function expectMongoResult<R extends MongoResult>(
result: R,
): MongoExpectation<R>Create a fluent expectation chain for any MongoDB result validation.
This unified function accepts any MongoDB result type and returns the appropriate expectation interface based on the result's type discriminator.
Parameters
resultR
Examples
import type { MongoFindResult, MongoInsertOneResult, MongoUpdateResult, MongoDeleteResult, MongoFindOneResult, MongoCountResult } from "@probitas/client-mongodb";
import { expectMongoResult } from "./mongodb.ts";
// For find result - returns MongoFindResultExpectation
const findResult = {
kind: "mongo:find",
ok: true,
docs: [{ name: "Alice" }],
duration: 0,
} as unknown as MongoFindResult;
expectMongoResult(findResult).toBeOk().toHaveDocsCount(1);
// For insert result - returns MongoInsertOneResultExpectation
const insertResult = {
kind: "mongo:insert-one",
ok: true,
insertedId: "123",
duration: 0,
} as unknown as MongoInsertOneResult;
expectMongoResult(insertResult).toBeOk().toHaveInsertedId("123");
// For update result - returns MongoUpdateResultExpectation
const updateResult = {
kind: "mongo:update",
ok: true,
matchedCount: 1,
modifiedCount: 1,
duration: 0,
} as unknown as MongoUpdateResult;
expectMongoResult(updateResult).toBeOk().toHaveMatchedCount(1).toHaveModifiedCount(1);
// For delete result - returns MongoDeleteResultExpectation
const deleteResult = {
kind: "mongo:delete",
ok: true,
deletedCount: 1,
duration: 0,
} as unknown as MongoDeleteResult;
expectMongoResult(deleteResult).toBeOk().toHaveDeletedCount(1);
// For findOne result - returns MongoFindOneResultExpectation
const findOneResult = {
kind: "mongo:find-one",
ok: true,
doc: { name: "Alice" },
duration: 0,
} as unknown as MongoFindOneResult;
expectMongoResult(findOneResult).toBeOk().toHaveDocPresent();
// For count result - returns MongoCountResultExpectation
const countResult = {
kind: "mongo:count",
ok: true,
count: 10,
duration: 0,
} as unknown as MongoCountResult;
expectMongoResult(countResult).toBeOk().toHaveCount(10);
#expectRabbitMqResult
function expectRabbitMqResult<R extends RabbitMqResult>(
result: R,
): RabbitMqExpectation<R>Create a fluent expectation chain for any RabbitMQ result validation.
This unified function accepts any RabbitMQ result type and returns the appropriate expectation interface based on the result's type discriminator.
Parameters
resultR
Examples
import type { RabbitMqPublishResult, RabbitMqConsumeResult, RabbitMqQueueResult, RabbitMqExchangeResult, RabbitMqAckResult } from "@probitas/client-rabbitmq";
import { expectRabbitMqResult } from "./rabbitmq.ts";
// For publish result - returns RabbitMqPublishResultExpectation
const publishResult = {
kind: "rabbitmq:publish",
ok: true,
duration: 0,
} as unknown as RabbitMqPublishResult;
expectRabbitMqResult(publishResult).toBeOk();
// For consume result - returns RabbitMqConsumeResultExpectation
const consumeResult = {
kind: "rabbitmq:consume",
ok: true,
message: { content: new Uint8Array() },
duration: 0,
} as unknown as RabbitMqConsumeResult;
expectRabbitMqResult(consumeResult).toBeOk().toHaveMessagePresent();
// For queue result - returns RabbitMqQueueResultExpectation
const queueResult = {
kind: "rabbitmq:queue",
ok: true,
queue: "my-queue",
messageCount: 0,
consumerCount: 0,
duration: 0,
} as unknown as RabbitMqQueueResult;
expectRabbitMqResult(queueResult).toBeOk().toHaveMessageCount(0);
// For exchange result - returns RabbitMqExchangeResultExpectation
const exchangeResult = {
kind: "rabbitmq:exchange",
ok: true,
duration: 0,
} as unknown as RabbitMqExchangeResult;
expectRabbitMqResult(exchangeResult).toBeOk();
// For ack result - returns RabbitMqAckResultExpectation
const ackResult = {
kind: "rabbitmq:ack",
ok: true,
duration: 0,
} as unknown as RabbitMqAckResult;
expectRabbitMqResult(ackResult).toBeOk();
#expectRedisResult
function expectRedisResult<R extends RedisResult>(
result: R,
): RedisExpectation<R>Create a fluent expectation chain for any Redis result validation.
This unified function accepts any Redis result type and returns the appropriate expectation interface based on the result's type discriminator.
Parameters
resultR
Examples
import type { RedisGetResult, RedisCountResult, RedisArrayResult } from "@probitas/client-redis";
import { expectRedisResult } from "./redis.ts";
// For GET result - returns RedisGetResultExpectation
const getResult = {
kind: "redis:get",
ok: true,
value: "expected",
duration: 0,
} as unknown as RedisGetResult;
expectRedisResult(getResult).toBeOk().toHaveValue("expected");
// For COUNT result - returns RedisCountResultExpectation
const countResult = {
kind: "redis:count",
ok: true,
value: 1,
duration: 0,
} as unknown as RedisCountResult;
expectRedisResult(countResult).toBeOk().toHaveValue(1);
// For ARRAY result - returns RedisArrayResultExpectation
const arrayResult = {
kind: "redis:array",
ok: true,
value: ["a", "b", "item"],
duration: 0,
} as unknown as RedisArrayResult<string>;
expectRedisResult(arrayResult).toBeOk().toHaveValueCount(3).toHaveValueContaining("item");
#expectSqlQueryResult
function expectSqlQueryResult<T = Record<string, any>>(
result: SqlQueryResult<T>,
): SqlQueryResultExpectationParameters
resultSqlQueryResult<T>
#expectSqsResult
function expectSqsResult<R extends SqsResult>(result: R): SqsExpectation<R>Create a fluent expectation chain for any SQS result validation.
This unified function accepts any SQS result type and returns the appropriate expectation interface based on the result's type discriminator. Supports send, sendBatch, receive, delete, deleteBatch, ensureQueue, and deleteQueue results.
Parameters
resultR- The SQS result to create expectations for
Returns
SqsExpectation<R> — A typed expectation object matching the result type
Examples
Send result validation
import type { SqsSendResult } from "@probitas/client-sqs";
import { expectSqsResult } from "./sqs.ts";
const sendResult = {
kind: "sqs:send",
ok: true,
messageId: "msg-123",
md5OfBody: "abc123",
sequenceNumber: undefined,
duration: 50,
} as unknown as SqsSendResult;
expectSqsResult(sendResult)
.toBeOk()
.toHaveMessageIdContaining("msg")
.toHaveDurationLessThan(1000);
Receive result validation
import type { SqsReceiveResult } from "@probitas/client-sqs";
import { expectSqsResult } from "./sqs.ts";
const receiveResult = {
kind: "sqs:receive",
ok: true,
messages: [{ body: "test message" }],
duration: 0,
} as unknown as SqsReceiveResult;
expectSqsResult(receiveResult)
.toBeOk()
.toHaveMessagesCountGreaterThanOrEqual(1);
Batch operations
import type { SqsSendBatchResult } from "@probitas/client-sqs";
import { expectSqsResult } from "./sqs.ts";
const batchResult = {
kind: "sqs:send-batch",
ok: true,
successful: [{ id: "1" }, { id: "2" }],
failed: [],
duration: 0,
} as unknown as SqsSendBatchResult;
expectSqsResult(batchResult)
.toBeOk()
.toHaveSuccessfulCount(2)
.toHaveFailedEmpty();
Queue management
import type { SqsEnsureQueueResult } from "@probitas/client-sqs";
import { expectSqsResult } from "./sqs.ts";
const ensureResult = {
kind: "sqs:ensure-queue",
ok: true,
queueUrl: "https://sqs.example.com/test-queue",
duration: 0,
} as unknown as SqsEnsureQueueResult;
expectSqsResult(ensureResult)
.toBeOk()
.toHaveQueueUrlContaining("test-queue");
#fromConnectError
function fromConnectError(
error: ConnectError,
metadata?: Headers,
): ConnectRpcErrorConvert ConnectRPC's ConnectError to ConnectRpcError.
Parameters
errorConnectError- The ConnectError from @connectrpc/connect
metadata?Headers- Optional metadata from the response
Returns
ConnectRpcError — ConnectRpcError with statusCode for discrimination
#getStatusName
function getStatusName(code: ConnectRpcStatusCode): stringGet the name of a ConnectRPC/gRPC status code.
Parameters
Examples
getStatusName(0); // "OK"
getStatusName(5); // "NOT_FOUND"
getStatusName(16); // "UNAUTHENTICATED"
#isConnectRpcStatusCode
function isConnectRpcStatusCode(code: number): code is ConnectRpcStatusCodeCheck if a number is a valid ConnectRPC/gRPC status code.
Parameters
codenumber
Examples
isConnectRpcStatusCode(0); // true
isConnectRpcStatusCode(16); // true
isConnectRpcStatusCode(99); // false
#isExpectationError
function isExpectationError(err: unknown): booleanCheck if an error is an ExpectationError.
Handles both same-process (instanceof) and cross-process (name check) scenarios, supporting worker serialization.
Parameters
errunknown
Types
#BodyInit
type BodyInit = string | Uint8Array | FormData | URLSearchParams | unknownRequest body type.
#ConnectProtocol
type ConnectProtocol = "connect" | "grpc" | "grpc-web"Protocol to use for ConnectRPC transport.
#ConnectRpcErrorType
type ConnectRpcErrorType = ConnectRpcError | ConnectRpcNetworkErrorConnectRPC error type union.
Contains either:
- ConnectRpcError: gRPC error returned by the server
- ConnectRpcNetworkError: Network-level failure before reaching the server
#ConnectRpcFailureError
type ConnectRpcFailureError = ConnectRpcNetworkError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the request reaches the server.
#ConnectRpcResponse
type ConnectRpcResponse<T = any> = ConnectRpcResponseSuccess<T>
| ConnectRpcResponseError<T>
| ConnectRpcResponseFailure<T>ConnectRPC response union type.
Use processed to distinguish between server responses and failures:
processed === true: Server responded (Success or Error)processed === false: Request failed (Failure)
Use ok to check for success:
ok === true: Success (statusCode === 0)ok === false: Error or Failure
#ConnectRpcStatusCode
type ConnectRpcStatusCode = unknownConnectRPC/gRPC status code type. Derived from ConnectRpcStatus values.
#DenoKvAtomicResult
type DenoKvAtomicResult = DenoKvAtomicResultCommitted
| DenoKvAtomicResultCheckFailed
| DenoKvAtomicResultError
| DenoKvAtomicResultFailureResult of an atomic operation.
Use ok and error to distinguish between outcomes:
ok === true: Committed successfullyok === false && error === null: Check failed (retry with new versionstamp)ok === false && error !== null: KV error or connection failure
#DenoKvDeleteResult
type DenoKvDeleteResult = DenoKvDeleteResultSuccess | DenoKvDeleteResultError | DenoKvDeleteResultFailureResult of a delete operation.
#DenoKvExpectation
type DenoKvExpectation<R extends DenoKvResult> = R extends DenoKvGetResult<infer T>
? DenoKvGetResultExpectation<T>
: R extends DenoKvListResult<infer T>
? DenoKvListResultExpectation<T>
: R extends DenoKvSetResult
? DenoKvSetResultExpectation
: R extends DenoKvDeleteResult
? DenoKvDeleteResultExpectation
: R extends DenoKvAtomicResult ? DenoKvAtomicResultExpectation : neverExpectation type returned by expectDenoKvResult based on the result type.
#DenoKvFailureError
type DenoKvFailureError = DenoKvConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the operation reaches the Deno KV server.
#DenoKvGetResult
type DenoKvGetResult<T = any> = DenoKvGetResultSuccess<T> | DenoKvGetResultError<T> | DenoKvGetResultFailure<T>Result of a get operation.
Use ok to check for success, then narrow the type:
ok === true: Success - value may be presentok === false && processed === true: KV error (quota, etc.)ok === false && processed === false: Connection failure
#DenoKvListResult
type DenoKvListResult<T = any> = DenoKvListResultSuccess<T>
| DenoKvListResultError<T>
| DenoKvListResultFailure<T>Result of a list operation.
#DenoKvResult
type DenoKvResult<T = any> = DenoKvGetResult<T>
| DenoKvSetResult
| DenoKvDeleteResult
| DenoKvListResult<T>
| DenoKvAtomicResultUnion of all Deno KV result types.
#DenoKvSetResult
type DenoKvSetResult = DenoKvSetResultSuccess | DenoKvSetResultError | DenoKvSetResultFailureResult of a set operation.
#FileDescriptorSet
type FileDescriptorSet = MessageShape<FileDescriptorSetSchema>FileDescriptorSet message type from @bufbuild/protobuf. This is the decoded protobuf message containing file descriptors.
#Filter
type Filter = Record<string, any>MongoDB filter type (simplified for compatibility with mongodb driver) Allows query operators like $gte, $lt, $in, etc.
#GraphqlFailureError
type GraphqlFailureError = GraphqlNetworkError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the request reaches the GraphQL server.
#GraphqlResponse
type GraphqlResponse<T = any> = GraphqlResponseSuccess<T> | GraphqlResponseError<T> | GraphqlResponseFailure<T>GraphQL response union type.
Use processed to distinguish between server responses and failures:
processed === true: Server responded (Success or Error)processed === false: Request failed (Failure)
Use ok to check for success:
ok === true: Success (no errors)ok === false: Error or Failure
#HttpFailureError
type HttpFailureError = HttpNetworkError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the request reaches the server.
#HttpResponse
type HttpResponse<T = any> = HttpResponseSuccess<T> | HttpResponseError<T> | HttpResponseFailure<T>HTTP response union type representing all possible response states.
- Success (2xx):
processed: true, ok: true, error: null - Error (4xx/5xx):
processed: true, ok: false, error: HttpError - Failure (network error):
processed: false, ok: false, error: Error
#MongoCountResult
type MongoCountResult = MongoCountResultSuccess | MongoCountResultError | MongoCountResultFailureCount result.
#MongoDeleteResult
type MongoDeleteResult = MongoDeleteResultSuccess | MongoDeleteResultError | MongoDeleteResultFailureDelete result.
#MongoExpectation
type MongoExpectation<R extends MongoResult> = R extends MongoFindResult<infer T>
? MongoFindResultExpectation<T>
: R extends MongoInsertOneResult
? MongoInsertOneResultExpectation
: R extends MongoInsertManyResult
? MongoInsertManyResultExpectation
: R extends MongoUpdateResult
? MongoUpdateResultExpectation
: R extends MongoDeleteResult
? MongoDeleteResultExpectation
: R extends MongoFindOneResult<infer T>
? MongoFindOneResultExpectation<T>
: R extends MongoCountResult ? MongoCountResultExpectation : neverExpectation type returned by expectMongoResult based on the result type.
#MongoFailureError
type MongoFailureError = MongoConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the operation reaches the MongoDB server.
#MongoFindOneResult
type MongoFindOneResult<T = Document> = MongoFindOneResultSuccess<T>
| MongoFindOneResultError<T>
| MongoFindOneResultFailure<T>FindOne result.
#MongoFindResult
type MongoFindResult<T = Document> = MongoFindResultSuccess<T> | MongoFindResultError<T> | MongoFindResultFailure<T>Query result (find, aggregate).
#MongoInsertManyResult
type MongoInsertManyResult = MongoInsertManyResultSuccess
| MongoInsertManyResultError
| MongoInsertManyResultFailureInsert many result.
#MongoInsertOneResult
type MongoInsertOneResult = MongoInsertOneResultSuccess
| MongoInsertOneResultError
| MongoInsertOneResultFailureInsert one result.
#MongoOperationError
type MongoOperationError = MongoQueryError
| MongoDuplicateKeyError
| MongoValidationError
| MongoWriteError
| MongoNotFoundError
| MongoErrorError types that indicate a MongoDB operation error. These are errors where the operation reached the server but failed.
#MongoResult
type MongoResult<T = any> = MongoFindResult<T>
| MongoInsertOneResult
| MongoInsertManyResult
| MongoUpdateResult
| MongoDeleteResult
| MongoFindOneResult<T>
| MongoCountResultUnion of all MongoDB result types.
#MongoUpdateResult
type MongoUpdateResult = MongoUpdateResultSuccess | MongoUpdateResultError | MongoUpdateResultFailureUpdate result.
#QueryParams
type QueryParams = URLSearchParams | Record<string, QueryValue | QueryValue[]>Query parameters type - accepts URLSearchParams or plain object.
#RabbitMqAckResult
type RabbitMqAckResult = RabbitMqAckResultSuccess | RabbitMqAckResultError | RabbitMqAckResultFailureAck/Nack result.
#RabbitMqConsumeResult
type RabbitMqConsumeResult = RabbitMqConsumeResultSuccess
| RabbitMqConsumeResultError
| RabbitMqConsumeResultFailureConsume result (single message retrieval).
#RabbitMqExchangeResult
type RabbitMqExchangeResult = RabbitMqExchangeResultSuccess
| RabbitMqExchangeResultError
| RabbitMqExchangeResultFailureExchange declaration result.
#RabbitMqExchangeType
type RabbitMqExchangeType = "direct" | "topic" | "fanout" | "headers"Exchange type.
#RabbitMqExpectation
type RabbitMqExpectation<R extends RabbitMqResult> = R extends RabbitMqConsumeResult
? RabbitMqConsumeResultExpectation
: R extends RabbitMqQueueResult
? RabbitMqQueueResultExpectation
: R extends RabbitMqPublishResult
? RabbitMqPublishResultExpectation
: R extends RabbitMqExchangeResult
? RabbitMqExchangeResultExpectation
: R extends RabbitMqAckResult ? RabbitMqAckResultExpectation : neverExpectation type returned by expectRabbitMqResult based on the result type.
#RabbitMqFailureError
type RabbitMqFailureError = RabbitMqConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the operation reaches the RabbitMQ server.
#RabbitMqOperationError
type RabbitMqOperationError = RabbitMqChannelError
| RabbitMqNotFoundError
| RabbitMqPreconditionFailedError
| RabbitMqErrorError types that indicate a RabbitMQ operation error. These are errors where the operation reached the server but failed.
#RabbitMqPublishResult
type RabbitMqPublishResult = RabbitMqPublishResultSuccess
| RabbitMqPublishResultError
| RabbitMqPublishResultFailurePublish result.
#RabbitMqQueueResult
type RabbitMqQueueResult = RabbitMqQueueResultSuccess
| RabbitMqQueueResultError
| RabbitMqQueueResultFailureQueue declaration result.
#RabbitMqResult
type RabbitMqResult = RabbitMqPublishResult
| RabbitMqConsumeResult
| RabbitMqAckResult
| RabbitMqQueueResult
| RabbitMqExchangeResultUnion of all RabbitMQ result types.
#RedirectMode
type RedirectMode = "follow" | "manual" | "error"Redirect handling mode.
- "follow": Automatically follow redirects (default)
- "manual": Return redirect response without following
- "error": Throw error on redirect
#RedisArrayResult
type RedisArrayResult<T = string> = RedisArrayResultSuccess<T>
| RedisArrayResultError<T>
| RedisArrayResultFailure<T>Redis array result (LRANGE, SMEMBERS, etc.).
#RedisCommonResult
type RedisCommonResult<T = any> = RedisCommonResultSuccess<T>
| RedisCommonResultError<T>
| RedisCommonResultFailure<T>Redis operation result (common/generic).
Used for operations without a more specific result type.
#RedisCountResult
type RedisCountResult = RedisCountResultSuccess | RedisCountResultError | RedisCountResultFailureRedis numeric result (DEL, LPUSH, SADD, etc.).
#RedisExpectation
type RedisExpectation<R extends RedisResult> = R extends RedisCountResult
? RedisCountResultExpectation
: R extends RedisArrayResult
? RedisArrayResultExpectation
: R extends RedisGetResult
? RedisGetResultExpectation
: R extends RedisSetResult
? RedisSetResultExpectation
: R extends RedisHashResult
? RedisHashResultExpectation
: R extends RedisCommonResult ? RedisCommonResultExpectation : neverExpectation type returned by expectRedisResult based on the result type.
#RedisFailureError
type RedisFailureError = RedisConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the operation reaches the Redis server.
#RedisGetResult
type RedisGetResult = RedisGetResultSuccess | RedisGetResultError | RedisGetResultFailureRedis GET result.
#RedisHashResult
type RedisHashResult = RedisHashResultSuccess | RedisHashResultError | RedisHashResultFailureRedis hash result (HGETALL).
#RedisOperationError
type RedisOperationError = RedisCommandError | RedisScriptError | RedisErrorError types that indicate the operation was processed but failed. These are errors returned by the Redis server.
#RedisResult
type RedisResult<T = any> = RedisCommonResult<T>
| RedisGetResult
| RedisSetResult
| RedisCountResult
| RedisArrayResult<T>
| RedisHashResultUnion of all Redis result types.
#RedisSetResult
type RedisSetResult = RedisSetResultSuccess | RedisSetResultError | RedisSetResultFailureRedis SET result.
#SqlErrorKind
type SqlErrorKind = "query" | "constraint" | "deadlock" | "connection" | "unknown"SQL-specific error kinds.
#SqlFailureError
type SqlFailureError = SqlConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the query reaches the SQL server.
#SqlIsolationLevel
type SqlIsolationLevel = "read_uncommitted" | "read_committed" | "repeatable_read" | "serializable"Transaction isolation level.
#SqlOperationError
type SqlOperationError = QuerySyntaxError | ConstraintError | DeadlockError | SqlErrorError types that indicate an operation was processed by the server. These errors occur after the query reaches the SQL server.
#SqlQueryResult
type SqlQueryResult<T = any> = SqlQueryResultSuccess<T> | SqlQueryResultError<T> | SqlQueryResultFailure<T>SQL query result union type representing all possible result states.
- Success:
processed: true, ok: true, error: null - Error:
processed: true, ok: false, error: SqlError - Failure:
processed: false, ok: false, error: SqlConnectionError
#SqsDeleteBatchResult
type SqsDeleteBatchResult = SqsDeleteBatchResultSuccess
| SqsDeleteBatchResultError
| SqsDeleteBatchResultFailureResult of batch deleting messages.
#SqsDeleteQueueResult
type SqsDeleteQueueResult = SqsDeleteQueueResultSuccess
| SqsDeleteQueueResultError
| SqsDeleteQueueResultFailureResult of deleting a queue.
#SqsDeleteResult
type SqsDeleteResult = SqsDeleteResultSuccess | SqsDeleteResultError | SqsDeleteResultFailureResult of deleting a message.
#SqsEnsureQueueResult
type SqsEnsureQueueResult = SqsEnsureQueueResultSuccess
| SqsEnsureQueueResultError
| SqsEnsureQueueResultFailureResult of ensuring a queue exists.
#SqsExpectation
type SqsExpectation<R extends SqsResult> = R extends SqsSendResult
? SqsSendResultExpectation
: R extends SqsSendBatchResult
? SqsSendBatchResultExpectation
: R extends SqsReceiveResult
? SqsReceiveResultExpectation
: R extends SqsDeleteResult
? SqsDeleteResultExpectation
: R extends SqsDeleteBatchResult
? SqsSendBatchResultExpectation
: R extends SqsEnsureQueueResult
? SqsEnsureQueueResultExpectation
: R extends SqsDeleteQueueResult ? SqsDeleteQueueResultExpectation : neverExpectation type returned by expectSqsResult based on the result type.
#SqsFailureError
type SqsFailureError = SqsConnectionError | AbortError | TimeoutErrorError types that indicate the operation was not processed. These are errors that occur before the operation reaches the SQS service.
#SqsOperationError
type SqsOperationError = SqsCommandError
| SqsQueueNotFoundError
| SqsMessageTooLargeError
| SqsBatchError
| SqsMessageNotFoundError
| SqsErrorError types that indicate an operation was processed by the server. These errors occur after the operation reaches the SQS service.
#SqsReceiveResult
type SqsReceiveResult = SqsReceiveResultSuccess | SqsReceiveResultError | SqsReceiveResultFailureResult of receiving messages.
#SqsResult
type SqsResult = SqsSendResult
| SqsSendBatchResult
| SqsReceiveResult
| SqsDeleteResult
| SqsDeleteBatchResult
| SqsEnsureQueueResult
| SqsDeleteQueueResultUnion type of all SQS result types.
#SqsSendBatchResult
type SqsSendBatchResult = SqsSendBatchResultSuccess | SqsSendBatchResultError | SqsSendBatchResultFailureResult of batch sending messages.
#SqsSendResult
type SqsSendResult = SqsSendResultSuccess | SqsSendResultError | SqsSendResultFailureResult of sending a message.
#UpdateFilter
type UpdateFilter = Record<string, any>MongoDB update filter type (simplified for compatibility with mongodb driver) Allows update operators like $set, $inc, $unset, etc.
Variables
#ConnectRpcStatus
const ConnectRpcStatus: {
OK: number;
CANCELLED: number;
UNKNOWN: number;
INVALID_ARGUMENT: number;
DEADLINE_EXCEEDED: number;
NOT_FOUND: number;
ALREADY_EXISTS: number;
PERMISSION_DENIED: number;
RESOURCE_EXHAUSTED: number;
FAILED_PRECONDITION: number;
ABORTED: number;
OUT_OF_RANGE: number;
UNIMPLEMENTED: number;
INTERNAL: number;
UNAVAILABLE: number;
DATA_LOSS: number;
UNAUTHENTICATED: number;
}ConnectRPC/gRPC status codes. These codes are used by both gRPC and ConnectRPC protocols.
#outdent
const outdent: Outdent