Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "connection"

import type { Config } from "arangojs/connection";

TODO

Index

Type aliases

ArangoResponseMetadata

ArangoResponseMetadata: { code: number; error: false }

Generic properties shared by all ArangoDB HTTP API responses.

Type declaration

  • code: number

    The response status code, typically 200.

  • error: false

    Indicates that the request was successful.

Config

Config: { agent?: any; agentOptions?: undefined | {}; arangoVersion?: undefined | number; databaseName?: undefined | string; headers?: Headers; loadBalancingStrategy?: LoadBalancingStrategy; maxRetries?: false | number; url?: string | string[] }

TODO

Type declaration

  • Optional agent?: any

    An http Agent instance to use for connections.

    By default a new http.Agent (or https.Agent for TLS) instance will be created using the agentOptions.

    This option has no effect when using the browser version of arangojs.

  • Optional agentOptions?: undefined | {}

    Default (Node.js): {maxSockets: 3, keepAlive: true, keepAliveMsecs: 1000}

    Default (Browser): {maxSockets: 3, keepAlive: false}

    An object with options for the agent. This will be ignored if agent is also provided.

    The option maxSockets can also be used to limit how many requests arangojs will perform concurrently. The maximum number of requests is equal to maxSockets * 2 with keepAlive: true or equal to maxSockets with keepAlive: false.

    In the browser version of arangojs this option can be used to pass additional options to the underlying calls of the xhr module.

  • Optional arangoVersion?: undefined | number

    Default: 30400

    Numeric representation of the ArangoDB version the driver should expect. The format is defined as XYYZZ where X is the major version, Y is the zero-filled two-digit minor version and Z is the zero-filled two-digit bugfix version, e.g. 30102 for 3.1.2, 20811 for 2.8.11.

    Depending on this value certain methods may become unavailable or change their behavior to remain compatible with different versions of ArangoDB.

  • Optional databaseName?: undefined | string

    Default: "_system"

    Name of the database to use.

  • Optional headers?: Headers

    An object with additional headers to send with every request.

    If an "authorization" header is provided, it will be overridden when using Database.useBasicAuth or Database.useBearerAuth.

  • Optional loadBalancingStrategy?: LoadBalancingStrategy

    Default: "NONE"

    Determines the behavior when multiple URLs are provided:

    • "NONE": No load balancing. All requests will be handled by the first URL in the list until a network error is encountered. On network error, arangojs will advance to using the next URL in the list.

    • "ONE_RANDOM": Randomly picks one URL from the list initially, then behaves like "NONE".

    • "ROUND_ROBIN": Every sequential request uses the next URL in the list.

  • Optional maxRetries?: false | number

    Default: 0

    Determines the behavior when a request fails because the underlying connection to the server could not be opened (i.e. ECONNREFUSED in Node.js):

    • false: the request fails immediately.

    • 0: the request is retried until a server can be reached but only a total number of times matching the number of known servers (including the initial failed request).

    • any other number: the request is retried until a server can be reached the request has been retried a total of maxRetries number of times (not including the initial failed request).

    When working with a single server without leader/follower failover, the retries (if any) will be made to the same server.

    This setting currently has no effect when using arangojs in a browser.

    Note: Requests bound to a specific server (e.g. fetching query results) will never be retried automatically and ignore this setting.

  • Optional url?: string | string[]

    Default: "http://localhost:8529"

    Base URL of the ArangoDB server or list of server URLs.

    When working with a cluster or a single server with leader/follower failover, the method db.acquireHostList can be used to automatically pick up additional coordinators/followers at any point.

    When running ArangoDB on a unix socket, e.g. /tmp/arangodb.sock, the following URL formats are supported for unix sockets:

    • unix:///tmp/arangodb.sock (no SSL)
    • http+unix:///tmp/arangodb.sock (or https+unix:// for SSL)
    • http://unix:/tmp/arangodb.sock (or https://unix: for SSL)

    Additionally ssl and tls are treated as synonymous with https and tcp is treated as synonymous with http, so the following URLs are considered identical:

    • tcp://localhost:8529 and http://localhost:8529
    • ssl://localhost:8529 and https://localhost:8529
    • tcp+unix:///tmp/arangodb.sock and http+unix:///tmp/arangodb.sock
    • ssl+unix:///tmp/arangodb.sock and https+unix:///tmp/arangodb.sock
    • tcp://unix:/tmp/arangodb.sock and http://unix:/tmp/arangodb.sock
    • ssl://unix:/tmp/arangodb.sock and https://unix:/tmp/arangodb.sock

    If you want to use ArangoDB with authentication, see Database.useBasicAuth and Database.useBearerAuth.

Headers

Headers: {}

An arbitrary object with string values representing HTTP headers and their values.

Header names should always be lowercase.

Type declaration

  • [key: string]: string

LoadBalancingStrategy

LoadBalancingStrategy: "NONE" | "ROUND_ROBIN" | "ONE_RANDOM"

Determines the behavior when multiple URLs are used:

  • "NONE": No load balancing. All requests will be handled by the first URL in the list until a network error is encountered. On network error, arangojs will advance to using the next URL in the list.

  • "ONE_RANDOM": Randomly picks one URL from the list initially, then behaves like "NONE".

  • "ROUND_ROBIN": Every sequential request uses the next URL in the list.

Params

Params: {}

An arbitrary object with scalar values representing query string parameters and their values.

Type declaration

  • [key: string]: any

RequestOptions

RequestOptions: { allowDirtyRead?: undefined | false | true; basePath?: undefined | string; body?: any; expectBinary?: undefined | false | true; headers?: Headers; host?: undefined | number; isBinary?: undefined | false | true; method?: undefined | string; path?: undefined | string; qs?: string | Params; timeout?: undefined | number }

TODO

Type declaration

  • Optional allowDirtyRead?: undefined | false | true
  • Optional basePath?: undefined | string
  • Optional body?: any
  • Optional expectBinary?: undefined | false | true
  • Optional headers?: Headers
  • Optional host?: undefined | number
  • Optional isBinary?: undefined | false | true
  • Optional method?: undefined | string
  • Optional path?: undefined | string
  • Optional qs?: string | Params
  • Optional timeout?: undefined | number

Generated using TypeDoc