UNPKG

7.9 kBTypeScriptView Raw
1import { Bucket } from './bucket';
2import { NodeCallback } from './utilities';
3import { DesignDocumentNamespace } from './viewtypes';
4import { CppManagementViewsDesignDocument, CppManagementViewsDesignDocumentView } from './binding';
5/**
6 * Contains information about a view in a design document.
7 *
8 * @category Management
9 */
10export declare class DesignDocumentView {
11 /**
12 * The mapping function to use for this view.
13 */
14 map: string | undefined;
15 /**
16 * The reduction function to use for this view.
17 */
18 reduce: string | undefined;
19 constructor(data: {
20 map?: string;
21 reduce?: string;
22 });
23 /**
24 * @deprecated
25 */
26 constructor(map?: string, reduce?: string);
27 /**
28 * @internal
29 */
30 static _toCppData(name: string, data: DesignDocumentView): CppManagementViewsDesignDocumentView;
31 /**
32 * @internal
33 */
34 static _fromCppData(data: CppManagementViewsDesignDocumentView): DesignDocumentView;
35}
36/**
37 * Contains information about a design document.
38 *
39 * @category Management
40 */
41export declare class DesignDocument {
42 /**
43 * Same as {@link DesignDocumentView}.
44 *
45 * @deprecated Use {@link DesignDocumentView} directly.
46 */
47 static get View(): any;
48 /**
49 * The name of the design document.
50 */
51 name: string;
52 /**
53 * A map of the views that exist in this design document.
54 */
55 views: {
56 [viewName: string]: DesignDocumentView;
57 };
58 /**
59 * The namespace for this design document.
60 */
61 namespace: DesignDocumentNamespace;
62 /**
63 * The revision of the design document.
64 */
65 rev: string | undefined;
66 constructor(data: {
67 name: string;
68 views?: {
69 [viewName: string]: DesignDocumentView;
70 };
71 namespace?: DesignDocumentNamespace;
72 rev?: string;
73 });
74 /**
75 * @deprecated
76 */
77 constructor(name: string, views: {
78 [viewName: string]: DesignDocumentView;
79 });
80 /**
81 * @internal
82 */
83 static _fromNsData(ddocName: string, ddocData: any): DesignDocument;
84 /**
85 * @internal
86 */
87 static _toCppData(data: DesignDocument, namespace: DesignDocumentNamespace): CppManagementViewsDesignDocument;
88 /**
89 * @internal
90 */
91 static _fromCppData(ddoc: CppManagementViewsDesignDocument): DesignDocument;
92}
93/**
94 * @category Management
95 */
96export interface GetAllDesignDocumentOptions {
97 /**
98 * The timeout for this operation, represented in milliseconds.
99 */
100 timeout?: number;
101}
102/**
103 * @category Management
104 */
105export interface GetDesignDocumentOptions {
106 /**
107 * The timeout for this operation, represented in milliseconds.
108 */
109 timeout?: number;
110}
111/**
112 * @category Management
113 */
114export interface UpsertDesignDocumentOptions {
115 /**
116 * The timeout for this operation, represented in milliseconds.
117 */
118 timeout?: number;
119}
120/**
121 * @category Management
122 */
123export interface DropDesignDocumentOptions {
124 /**
125 * The timeout for this operation, represented in milliseconds.
126 */
127 timeout?: number;
128}
129/**
130 * @category Management
131 */
132export interface PublishDesignDocumentOptions {
133 /**
134 * The timeout for this operation, represented in milliseconds.
135 */
136 timeout?: number;
137}
138/**
139 * ViewIndexManager is an interface which enables the management
140 * of view indexes on the cluster.
141 *
142 * @category Management
143 */
144export declare class ViewIndexManager {
145 private _bucket;
146 /**
147 * @internal
148 */
149 constructor(bucket: Bucket);
150 /**
151 * @internal
152 */
153 private get _cluster();
154 /**
155 * Returns a list of all the design documents in this bucket.
156 *
157 * @param options Optional parameters for this operation.
158 * @param callback A node-style callback to be invoked after execution.
159 * @deprecated
160 */
161 getAllDesignDocuments(options?: GetAllDesignDocumentOptions, callback?: NodeCallback<DesignDocument[]>): Promise<DesignDocument[]>;
162 /**
163 * Returns a list of all the design documents in this bucket.
164 *
165 * @param namespace The DesignDocument namespace.
166 * @param options Optional parameters for this operation.
167 * @param callback A node-style callback to be invoked after execution.
168 */
169 getAllDesignDocuments(namespace: DesignDocumentNamespace, options?: GetAllDesignDocumentOptions, callback?: NodeCallback<DesignDocument[]>): Promise<DesignDocument[]>;
170 /**
171 * Returns the specified design document.
172 *
173 * @param designDocName The name of the design document to fetch.
174 * @param options Optional parameters for this operation.
175 * @param callback A node-style callback to be invoked after execution.
176 * @deprecated
177 */
178 getDesignDocument(designDocName: string, options?: GetDesignDocumentOptions, callback?: NodeCallback<DesignDocument>): Promise<DesignDocument>;
179 /**
180 * Returns the specified design document.
181 *
182 * @param designDocName The name of the design document to fetch.
183 * @param namespace The DesignDocument namespace.
184 * @param options Optional parameters for this operation.
185 * @param callback A node-style callback to be invoked after execution.
186 */
187 getDesignDocument(designDocName: string, namespace: DesignDocumentNamespace, options?: GetDesignDocumentOptions, callback?: NodeCallback<DesignDocument>): Promise<DesignDocument>;
188 /**
189 * Creates or updates a design document.
190 *
191 * @param designDoc The DesignDocument to upsert.
192 * @param options Optional parameters for this operation.
193 * @param callback A node-style callback to be invoked after execution.
194 * @deprecated
195 */
196 upsertDesignDocument(designDoc: DesignDocument, options?: UpsertDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
197 /**
198 * Creates or updates a design document.
199 *
200 * @param designDoc The DesignDocument to upsert.
201 * @param namespace The DesignDocument namespace.
202 * @param options Optional parameters for this operation.
203 * @param callback A node-style callback to be invoked after execution.
204 */
205 upsertDesignDocument(designDoc: DesignDocument, namespace?: DesignDocumentNamespace, options?: UpsertDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
206 /**
207 * Drops an existing design document.
208 *
209 * @param designDocName The name of the design document to drop.
210 * @param options Optional parameters for this operation.
211 * @param callback A node-style callback to be invoked after execution.
212 * @deprecated
213 */
214 dropDesignDocument(designDocName: string, options?: DropDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
215 /**
216 * Drops an existing design document.
217 *
218 * @param designDocName The name of the design document to drop.
219 * @param namespace The DesignDocument namespace.
220 * @param options Optional parameters for this operation.
221 * @param callback A node-style callback to be invoked after execution.
222 */
223 dropDesignDocument(designDocName: string, namespace: DesignDocumentNamespace, options?: DropDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
224 /**
225 * Publishes a development design document to be a production design document.
226 * It does this by fetching the design document by the passed name with `dev_`
227 * appended, and then performs an upsert of the production name (no `dev_`)
228 * with the data which was just fetched.
229 *
230 * @param designDocName The name of the design document to publish.
231 * @param options Optional parameters for this operation.
232 * @param callback A node-style callback to be invoked after execution.
233 */
234 publishDesignDocument(designDocName: string, options?: PublishDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
235}