UNPKG

3.61 kBTypeScriptView Raw
1import { AnalyticsMetaData, AnalyticsQueryOptions, AnalyticsResult } from './analyticstypes';
2import { CppConnection } from './binding';
3import { Bucket } from './bucket';
4import { Cluster } from './cluster';
5import { Collection } from './collection';
6import { QueryMetaData, QueryOptions, QueryResult } from './querytypes';
7import { ScopeSearchIndexManager } from './scopesearchindexmanager';
8import { SearchMetaData, SearchQueryOptions, SearchRequest, SearchResult, SearchRow } from './searchtypes';
9import { StreamableRowPromise } from './streamablepromises';
10import { Transcoder } from './transcoders';
11import { NodeCallback } from './utilities';
12import { ScopeEventingFunctionManager } from './scopeeventingfunctionmanager';
13/**
14 * Exposes the operations which are available to be performed against a scope.
15 * Namely the ability to access to Collections for performing operations.
16 *
17 * @category Core
18 */
19export declare class Scope {
20 /**
21 * @internal
22 */
23 static get DEFAULT_NAME(): string;
24 private _bucket;
25 private _name;
26 private _conn;
27 /**
28 @internal
29 */
30 constructor(bucket: Bucket, scopeName: string);
31 /**
32 @internal
33 */
34 get conn(): CppConnection;
35 /**
36 @internal
37 */
38 get bucket(): Bucket;
39 /**
40 @internal
41 */
42 get cluster(): Cluster;
43 /**
44 @internal
45 */
46 get transcoder(): Transcoder;
47 /**
48 * The name of the scope this Scope object references.
49 */
50 get name(): string;
51 /**
52 * Creates a Collection object reference to a specific collection.
53 *
54 * @param collectionName The name of the collection to reference.
55 */
56 collection(collectionName: string): Collection;
57 /**
58 * Returns a SearchIndexManager which can be used to manage the search
59 * indexes of this scope.
60 */
61 searchIndexes(): ScopeSearchIndexManager;
62 /**
63 * Returns a ScopeEventingFunctionManager which can be used to manage the eventing
64 * functions of this scope.
65 * Uncommitted: This API is subject to change in the future.
66 */
67 eventingFunctions(): ScopeEventingFunctionManager;
68 /**
69 * Executes a N1QL query against the cluster scoped to this scope.
70 *
71 * @param statement The N1QL statement to execute.
72 * @param options Optional parameters for this operation.
73 * @param callback A node-style callback to be invoked after execution.
74 */
75 query<TRow = any>(statement: string, options?: QueryOptions, callback?: NodeCallback<QueryResult<TRow>>): StreamableRowPromise<QueryResult<TRow>, TRow, QueryMetaData>;
76 /**
77 * Executes an analytics query against the cluster scoped this scope.
78 *
79 * @param statement The analytics statement to execute.
80 * @param options Optional parameters for this operation.
81 * @param callback A node-style callback to be invoked after execution.
82 */
83 analyticsQuery<TRow = any>(statement: string, options?: AnalyticsQueryOptions, callback?: NodeCallback<AnalyticsResult<TRow>>): StreamableRowPromise<AnalyticsResult<TRow>, TRow, AnalyticsMetaData>;
84 /**
85 * Executes a search query against the scope.
86 *
87 * @param indexName The name of the index to query.
88 * @param request The SearchRequest describing the search to execute.
89 * @param options Optional parameters for this operation.
90 * @param callback A node-style callback to be invoked after execution.
91 */
92 search(indexName: string, request: SearchRequest, options?: SearchQueryOptions, callback?: NodeCallback<SearchResult>): StreamableRowPromise<SearchResult, SearchRow, SearchMetaData>;
93}