///
///
import { DurabilityLevel } from './generaltypes';
import type { ObservableRequestHandler } from './observabilityhandler';
/**
* CAS represents an opaque value which can be used to compare documents to
* determine if a change has occurred.
*
* @category Key-Value
*/
export interface Cas {
/**
* Generates a string representation of this CAS.
*/
toString(): string;
/**
* Generates a JSON representation of this CAS.
*/
toJSON(): any;
}
/**
* CasIn represents the supported types that can be provided to an operation
* that receive a CAS.
*
* @category Key-Value
*/
export type CasInput = Cas | string | Buffer;
/**
* Reprents a node-style callback which receives an optional error or result.
*
* @category Utilities
*/
export interface NodeCallback {
(err: Error | null, result: T | null): void;
}
/**
* @internal
*/
export declare class PromiseHelper {
/**
* @internal
*/
static wrapAsync>(fn: () => U, callback?: (err: Error | null, result: T | null) => void): U;
/**
* @internal
*/
static wrap(fn: (callback: NodeCallback) => void, callback?: NodeCallback | null): Promise;
}
/**
* Runs a request on the cluster's backend, ending the operation's span
* with its outcome.
*
* @internal
*/
export declare function runOnBackend(obsReqHandler: ObservableRequestHandler | null, run: () => Promise, callback?: NodeCallback): Promise;
/**
* Resolves the callback of an operation that accepts one in the options
* position, as in `get(key, callback)`.
*
* @internal
*/
export declare function callbackOf(options: unknown, callback?: NodeCallback): NodeCallback | undefined;
/**
* Resolves the options of an operation, substituting an empty options object
* when none were given or a callback took their place.
*
* @internal
*/
export declare function optionsOf(options: Opts | undefined): Opts;
/**
* @internal
*/
export declare class CompoundTimeout {
private _start;
private _timeout;
/**
* @internal
*/
constructor(timeout: number | undefined);
/**
* @internal
*/
left(): number | undefined;
/**
* @internal
*/
expired(): boolean;
}
/**
* @internal
*/
export declare function duraLevelToNsServerStr(level: DurabilityLevel | string | undefined): string | undefined;
/**
* Resolves the durability level an operation asked for. The option is typed
* as a {@link DurabilityLevel}, but a JavaScript caller may pass the server's
* string form instead, so that is accepted too.
*
* @internal
*/
export declare function durabilityLevelOf(level: DurabilityLevel | string | undefined): DurabilityLevel | undefined;
/**
* @internal
*/
export declare function nsServerStrToDuraLevel(level: string | undefined): DurabilityLevel;
/**
* @internal
*/
export declare function cbQsStringify(values: {
[key: string]: any;
}, options?: {
boolAsString?: boolean;
}): string;
/**
* @internal
*/
export declare function parseExpiry(expiry?: number | Date): number;
/**
* @internal
*/
export declare function getErrorMessage(error: any): string;