Package version:

Interface CosmosClientOptions

interface CosmosClientOptions {
    aadCredentials?: TokenCredential;
    agent?: Agent;
    connectionPolicy?: ConnectionPolicy;
    consistencyLevel?:
        | "Strong"
        | "BoundedStaleness"
        | "Session"
        | "Eventual"
        | "ConsistentPrefix";
    defaultHeaders?: CosmosHeaders;
    diagnosticLevel?: CosmosDbDiagnosticLevel;
    endpoint: string;
    httpClient?: HttpClient;
    key?: string;
    permissionFeed?: PermissionDefinition[];
    resourceTokens?: {
        [resourcePath: string]: string;
    };
    tokenProvider?: TokenProvider;
    userAgentSuffix?: string;
}

Properties

aadCredentials?: TokenCredential

AAD token from @azure/identity Obtain a credential object by creating an @azure/identity credential object We will then use your credential object and a scope URL (your cosmos db endpoint) to authenticate requests to Cosmos

agent?: Agent

An optional custom http(s) Agent to be used in NodeJS enironments Use an agent such as https://github.com/TooTallNate/node-proxy-agent if you need to connect to Cosmos via a proxy

connectionPolicy?: ConnectionPolicy

An instance of ConnectionPolicy class. This parameter is optional and the default connectionPolicy will be used if omitted.

consistencyLevel?:
    | "Strong"
    | "BoundedStaleness"
    | "Session"
    | "Eventual"
    | "ConsistentPrefix"

An optional parameter that represents the consistency level. It can take any value from ConsistencyLevel.

defaultHeaders?: CosmosHeaders
diagnosticLevel?: CosmosDbDiagnosticLevel
endpoint: string

The service endpoint to use to create the client.

httpClient?: HttpClient

An optional custom HttpClient shape to customize how requests are made by the HTTP pipeline. See @azure/core-rest-pipeline for details on how to implement this interface.

key?: string

The account master or readonly key

permissionFeed?: PermissionDefinition[]

An array of Permission objects.

resourceTokens?: {
    [resourcePath: string]: string;
}

An object that contains resources tokens. Keys for the object are resource Ids and values are the resource tokens.

tokenProvider?: TokenProvider

A user supplied function for resolving header authorization tokens. Allows users to generating their own auth tokens, potentially using a separate service

userAgentSuffix?: string

A custom string to append to the default SDK user agent.