UNPKG

1.96 kBTypeScriptView Raw
1/// <reference types="node" />
2import { DurabilityLevel } from './generaltypes';
3/**
4 * CAS represents an opaque value which can be used to compare documents to
5 * determine if a change has occurred.
6 *
7 * @category Key-Value
8 */
9export interface Cas {
10 /**
11 * Generates a string representation of this CAS.
12 */
13 toString(): string;
14 /**
15 * Generates a JSON representation of this CAS.
16 */
17 toJSON(): any;
18}
19/**
20 * CasIn represents the supported types that can be provided to an operation
21 * that receive a CAS.
22 *
23 * @category Key-Value
24 */
25export type CasInput = Cas | string | Buffer;
26/**
27 * Reprents a node-style callback which receives an optional error or result.
28 *
29 * @category Utilities
30 */
31export interface NodeCallback<T> {
32 (err: Error | null, result: T | null): void;
33}
34/**
35 * @internal
36 */
37export declare class PromiseHelper {
38 /**
39 * @internal
40 */
41 static wrapAsync<T, U extends Promise<T>>(fn: () => U, callback?: (err: Error | null, result: T | null) => void): U;
42 /**
43 * @internal
44 */
45 static wrap<T>(fn: (callback: NodeCallback<T>) => void, callback?: NodeCallback<T> | null): Promise<T>;
46}
47/**
48 * @internal
49 */
50export declare class CompoundTimeout {
51 private _start;
52 private _timeout;
53 /**
54 * @internal
55 */
56 constructor(timeout: number | undefined);
57 /**
58 * @internal
59 */
60 left(): number | undefined;
61 /**
62 * @internal
63 */
64 expired(): boolean;
65}
66/**
67 * @internal
68 */
69export declare function duraLevelToNsServerStr(level: DurabilityLevel | string | undefined): string | undefined;
70/**
71 * @internal
72 */
73export declare function nsServerStrToDuraLevel(level: string | undefined): DurabilityLevel;
74/**
75 * @internal
76 */
77export declare function cbQsStringify(values: {
78 [key: string]: any;
79}, options?: {
80 boolAsString?: boolean;
81}): string;
82/**
83 * @internal
84 */
85export declare function expiryToTimestamp(expiry: number): number;
86
\No newline at end of file