UNPKG

3.26 kBTypeScriptView Raw
1import { CppConnection } from './binding';
2import { Cluster } from './cluster';
3import { Collection } from './collection';
4import { CollectionManager } from './collectionmanager';
5import { PingOptions, PingResult } from './diagnosticstypes';
6import { Scope } from './scope';
7import { StreamableRowPromise } from './streamablepromises';
8import { Transcoder } from './transcoders';
9import { NodeCallback } from './utilities';
10import { ViewIndexManager } from './viewindexmanager';
11import { ViewMetaData, ViewQueryOptions, ViewResult, ViewRow } from './viewtypes';
12/**
13 * Exposes the operations which are available to be performed against a bucket.
14 * Namely the ability to access to Collections as well as performing management
15 * operations against the bucket.
16 *
17 * @category Core
18 */
19export declare class Bucket {
20 private _cluster;
21 private _name;
22 private _conn;
23 /**
24 @internal
25 */
26 constructor(cluster: Cluster, bucketName: string);
27 /**
28 @internal
29 */
30 get conn(): CppConnection;
31 /**
32 @internal
33 */
34 get cluster(): Cluster;
35 /**
36 @internal
37 */
38 get transcoder(): Transcoder;
39 /**
40 * The name of the bucket this Bucket object references.
41 */
42 get name(): string;
43 /**
44 * Creates a Scope object reference to a specific scope.
45 *
46 * @param scopeName The name of the scope to reference.
47 */
48 scope(scopeName: string): Scope;
49 /**
50 * Creates a Scope object reference to the default scope.
51 */
52 defaultScope(): Scope;
53 /**
54 * Creates a Collection object reference to a specific collection.
55 *
56 * @param collectionName The name of the collection to reference.
57 */
58 collection(collectionName: string): Collection;
59 /**
60 * Creates a Collection object reference to the default collection.
61 */
62 defaultCollection(): Collection;
63 /**
64 * Returns a ViewIndexManager which can be used to manage the view indexes
65 * of this bucket.
66 */
67 viewIndexes(): ViewIndexManager;
68 /**
69 * Returns a CollectionManager which can be used to manage the collections
70 * of this bucket.
71 */
72 collections(): CollectionManager;
73 /**
74 * Executes a view query.
75 *
76 * @param designDoc The name of the design document containing the view to execute.
77 * @param viewName The name of the view to execute.
78 * @param options Optional parameters for this operation.
79 * @param callback A node-style callback to be invoked after execution.
80 */
81 viewQuery<TValue = any, TKey = any>(designDoc: string, viewName: string, options?: ViewQueryOptions, callback?: NodeCallback<ViewResult<TValue, TKey>>): StreamableRowPromise<ViewResult<TValue, TKey>, ViewRow<TValue, TKey>, ViewMetaData>;
82 /**
83 * Performs a ping operation against the cluster. Pinging the bucket services
84 * which are specified (or all services if none are specified). Returns a report
85 * which describes the outcome of the ping operations which were performed.
86 *
87 * @param options Optional parameters for this operation.
88 * @param callback A node-style callback to be invoked after execution.
89 */
90 ping(options?: PingOptions, callback?: NodeCallback<PingResult>): Promise<PingResult>;
91}