couchbase 4.2.10 → 4.2.11-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/deps/couchbase-cxx-client/core/bucket.cxx +23 -8
  2. package/deps/couchbase-cxx-client/core/bucket.hxx +1 -0
  3. package/deps/couchbase-cxx-client/core/cluster.cxx +29 -3
  4. package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
  5. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
  6. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +7 -1
  7. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +10 -0
  8. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +24 -1
  9. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
  10. package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
  11. package/deps/couchbase-cxx-client/core/meta/features.hxx +16 -1
  12. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +1 -1
  13. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +1 -1
  14. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +2 -2
  15. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +10 -10
  16. package/deps/couchbase-cxx-client/core/operations/document_view.cxx +3 -0
  17. package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
  18. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +24 -13
  19. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -1
  20. package/deps/couchbase-cxx-client/core/origin.cxx +14 -0
  21. package/deps/couchbase-cxx-client/core/origin.hxx +6 -0
  22. package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -0
  23. package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
  24. package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +70 -1
  25. package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
  26. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +1 -34
  27. package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +2 -2
  28. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +43 -20
  29. package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +5 -0
  30. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
  31. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
  32. package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
  33. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
  34. package/dist/binding.d.ts +24 -2
  35. package/dist/bindingutilities.d.ts +11 -3
  36. package/dist/bindingutilities.js +33 -7
  37. package/dist/couchbase.d.ts +1 -0
  38. package/dist/couchbase.js +1 -0
  39. package/dist/queryindexmanager.d.ts +4 -4
  40. package/dist/queryindexmanager.js +7 -7
  41. package/dist/scope.d.ts +21 -0
  42. package/dist/scope.js +34 -0
  43. package/dist/scopesearchindexmanager.d.ts +116 -0
  44. package/dist/scopesearchindexmanager.js +406 -0
  45. package/dist/sdspecs.js +10 -9
  46. package/dist/sdutils.d.ts +1 -0
  47. package/dist/sdutils.js +4 -0
  48. package/dist/searchexecutor.d.ts +3 -1
  49. package/dist/searchexecutor.js +9 -2
  50. package/dist/searchindexmanager.d.ts +58 -3
  51. package/dist/searchindexmanager.js +188 -104
  52. package/dist/viewexecutor.js +13 -9
  53. package/dist/viewindexmanager.d.ts +70 -7
  54. package/dist/viewindexmanager.js +236 -103
  55. package/dist/viewtypes.d.ts +26 -0
  56. package/dist/viewtypes.js +17 -1
  57. package/package.json +7 -7
  58. package/src/constants.cpp +1 -0
  59. package/src/jstocbpp_autogen.hpp +89 -6
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SearchIndexManager = exports.SearchIndex = void 0;
4
- const errors_1 = require("./errors");
5
- const httpexecutor_1 = require("./httpexecutor");
6
4
  const utilities_1 = require("./utilities");
5
+ const bindingutilities_1 = require("./bindingutilities");
7
6
  /**
8
7
  * This class is currently incomplete and must be casted to `any` in
9
8
  * TypeScript to be used.
@@ -15,7 +14,57 @@ class SearchIndex {
15
14
  * @internal
16
15
  */
17
16
  constructor(data) {
17
+ this.uuid = data.uuid;
18
18
  this.name = data.name;
19
+ this.sourceName = data.sourceName;
20
+ this.type = data.type;
21
+ this.params = data.params;
22
+ this.sourceUuid = data.sourceUuid;
23
+ this.sourceParams = data.sourceParams;
24
+ this.sourceType = data.sourceType;
25
+ this.planParams = data.planParams;
26
+ }
27
+ /**
28
+ * @internal
29
+ */
30
+ static _toCppData(data) {
31
+ return {
32
+ uuid: data.uuid,
33
+ name: data.name,
34
+ type: data.type,
35
+ params_json: JSON.stringify(data.params),
36
+ source_uuid: data.sourceUuid,
37
+ source_name: data.sourceName,
38
+ source_type: data.sourceType,
39
+ source_params_json: JSON.stringify(data.sourceParams),
40
+ plan_params_json: JSON.stringify(data.planParams),
41
+ };
42
+ }
43
+ /**
44
+ * @internal
45
+ */
46
+ static _fromCppData(data) {
47
+ const idx = new SearchIndex({
48
+ uuid: data.uuid,
49
+ name: data.name,
50
+ type: data.type,
51
+ params: {},
52
+ sourceUuid: data.source_uuid,
53
+ sourceName: data.source_name,
54
+ sourceType: data.source_type,
55
+ sourceParams: {},
56
+ planParams: {},
57
+ });
58
+ if (data.params_json) {
59
+ idx.params = JSON.parse(data.params_json);
60
+ }
61
+ if (data.source_params_json) {
62
+ idx.sourceParams = JSON.parse(data.source_params_json);
63
+ }
64
+ if (data.plan_params_json) {
65
+ idx.planParams = JSON.parse(data.plan_params_json);
66
+ }
67
+ return idx;
19
68
  }
20
69
  }
21
70
  exports.SearchIndex = SearchIndex;
@@ -32,9 +81,6 @@ class SearchIndexManager {
32
81
  constructor(cluster) {
33
82
  this._cluster = cluster;
34
83
  }
35
- get _http() {
36
- return new httpexecutor_1.HttpExecutor(this._cluster.conn);
37
- }
38
84
  /**
39
85
  * Returns an index by it's name.
40
86
  *
@@ -51,18 +97,18 @@ class SearchIndexManager {
51
97
  options = {};
52
98
  }
53
99
  const timeout = options.timeout || this._cluster.managementTimeout;
54
- return utilities_1.PromiseHelper.wrapAsync(async () => {
55
- const res = await this._http.request({
56
- type: httpexecutor_1.HttpServiceType.Search,
57
- method: httpexecutor_1.HttpMethod.Get,
58
- path: `/api/index/${indexName}`,
100
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
101
+ this._cluster.conn.managementSearchIndexGet({
102
+ index_name: indexName,
59
103
  timeout: timeout,
104
+ }, (cppErr, resp) => {
105
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
106
+ if (err) {
107
+ return wrapCallback(err, null);
108
+ }
109
+ const index = SearchIndex._fromCppData(resp.index);
110
+ wrapCallback(null, index);
60
111
  });
61
- if (res.statusCode !== 200) {
62
- throw new errors_1.IndexNotFoundError();
63
- }
64
- const idxData = JSON.parse(res.body.toString());
65
- return idxData.indexDef;
66
112
  }, callback);
67
113
  }
68
114
  /**
@@ -80,18 +126,17 @@ class SearchIndexManager {
80
126
  options = {};
81
127
  }
82
128
  const timeout = options.timeout || this._cluster.managementTimeout;
83
- return utilities_1.PromiseHelper.wrapAsync(async () => {
84
- const res = await this._http.request({
85
- type: httpexecutor_1.HttpServiceType.Search,
86
- method: httpexecutor_1.HttpMethod.Get,
87
- path: `/api/index`,
129
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
130
+ this._cluster.conn.managementSearchIndexGetAll({
88
131
  timeout: timeout,
132
+ }, (cppErr, resp) => {
133
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
134
+ if (err) {
135
+ return wrapCallback(err, null);
136
+ }
137
+ const indexes = resp.indexes.map((indexData) => SearchIndex._fromCppData(indexData));
138
+ wrapCallback(null, indexes);
89
139
  });
90
- if (res.statusCode !== 200) {
91
- throw new Error('failed to fetch search indices');
92
- }
93
- const idxsData = JSON.parse(res.body.toString());
94
- return Object.values(idxsData.indexDefs.indexDefs);
95
140
  }, callback);
96
141
  }
97
142
  /**
@@ -109,20 +154,18 @@ class SearchIndexManager {
109
154
  if (!options) {
110
155
  options = {};
111
156
  }
112
- const indexName = indexDefinition.name;
113
157
  const timeout = options.timeout || this._cluster.managementTimeout;
114
- return utilities_1.PromiseHelper.wrapAsync(async () => {
115
- const res = await this._http.request({
116
- type: httpexecutor_1.HttpServiceType.Search,
117
- method: httpexecutor_1.HttpMethod.Put,
118
- path: `/api/index/${indexName}`,
119
- contentType: 'application/json',
120
- body: JSON.stringify(indexDefinition),
158
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
159
+ this._cluster.conn.managementSearchIndexUpsert({
160
+ index: SearchIndex._toCppData(indexDefinition),
121
161
  timeout: timeout,
162
+ }, (cppErr) => {
163
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
164
+ if (err) {
165
+ return wrapCallback(err, null);
166
+ }
167
+ wrapCallback(err);
122
168
  });
123
- if (res.statusCode !== 200) {
124
- throw new Error('failed to create index');
125
- }
126
169
  }, callback);
127
170
  }
128
171
  /**
@@ -141,17 +184,17 @@ class SearchIndexManager {
141
184
  options = {};
142
185
  }
143
186
  const timeout = options.timeout || this._cluster.managementTimeout;
144
- return utilities_1.PromiseHelper.wrapAsync(async () => {
145
- const res = await this._http.request({
146
- type: httpexecutor_1.HttpServiceType.Search,
147
- method: httpexecutor_1.HttpMethod.Delete,
148
- path: `/api/index/${indexName}`,
187
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
188
+ this._cluster.conn.managementSearchIndexDrop({
189
+ index_name: indexName,
149
190
  timeout: timeout,
191
+ }, (cppErr) => {
192
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
193
+ if (err) {
194
+ return wrapCallback(err, null);
195
+ }
196
+ wrapCallback(err);
150
197
  });
151
- if (res.statusCode !== 200) {
152
- throw new Error('failed to delete search index');
153
- }
154
- return JSON.parse(res.body.toString());
155
198
  }, callback);
156
199
  }
157
200
  /**
@@ -170,17 +213,17 @@ class SearchIndexManager {
170
213
  options = {};
171
214
  }
172
215
  const timeout = options.timeout || this._cluster.managementTimeout;
173
- return utilities_1.PromiseHelper.wrapAsync(async () => {
174
- const res = await this._http.request({
175
- type: httpexecutor_1.HttpServiceType.Search,
176
- method: httpexecutor_1.HttpMethod.Get,
177
- path: `/api/index/${indexName}/count`,
216
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
217
+ this._cluster.conn.managementSearchIndexGetDocumentsCount({
218
+ index_name: indexName,
178
219
  timeout: timeout,
220
+ }, (cppErr, resp) => {
221
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
222
+ if (err) {
223
+ return wrapCallback(err, null);
224
+ }
225
+ wrapCallback(null, resp.count);
179
226
  });
180
- if (res.statusCode !== 200) {
181
- throw new Error('failed to get search indexed documents count');
182
- }
183
- return JSON.parse(res.body.toString()).count;
184
227
  }, callback);
185
228
  }
186
229
  /**
@@ -199,16 +242,18 @@ class SearchIndexManager {
199
242
  options = {};
200
243
  }
201
244
  const timeout = options.timeout || this._cluster.managementTimeout;
202
- return utilities_1.PromiseHelper.wrapAsync(async () => {
203
- const res = await this._http.request({
204
- type: httpexecutor_1.HttpServiceType.Search,
205
- method: httpexecutor_1.HttpMethod.Post,
206
- path: `/api/index/${indexName}/ingestControl/pause`,
245
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
246
+ this._cluster.conn.managementSearchIndexControlIngest({
247
+ index_name: indexName,
248
+ pause: true,
207
249
  timeout: timeout,
250
+ }, (cppErr) => {
251
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
252
+ if (err) {
253
+ return wrapCallback(err, null);
254
+ }
255
+ wrapCallback(err);
208
256
  });
209
- if (res.statusCode !== 200) {
210
- throw new Error('failed to pause search index ingestion');
211
- }
212
257
  }, callback);
213
258
  }
214
259
  /**
@@ -227,16 +272,18 @@ class SearchIndexManager {
227
272
  options = {};
228
273
  }
229
274
  const timeout = options.timeout || this._cluster.managementTimeout;
230
- return utilities_1.PromiseHelper.wrapAsync(async () => {
231
- const res = await this._http.request({
232
- type: httpexecutor_1.HttpServiceType.Search,
233
- method: httpexecutor_1.HttpMethod.Post,
234
- path: `/api/index/${indexName}/ingestControl/resume`,
275
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
276
+ this._cluster.conn.managementSearchIndexControlIngest({
277
+ index_name: indexName,
278
+ pause: false,
235
279
  timeout: timeout,
280
+ }, (cppErr) => {
281
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
282
+ if (err) {
283
+ return wrapCallback(err, null);
284
+ }
285
+ wrapCallback(err);
236
286
  });
237
- if (res.statusCode !== 200) {
238
- throw new Error('failed to resume search index ingestion');
239
- }
240
287
  }, callback);
241
288
  }
242
289
  /**
@@ -255,16 +302,18 @@ class SearchIndexManager {
255
302
  options = {};
256
303
  }
257
304
  const timeout = options.timeout || this._cluster.managementTimeout;
258
- return utilities_1.PromiseHelper.wrapAsync(async () => {
259
- const res = await this._http.request({
260
- type: httpexecutor_1.HttpServiceType.Search,
261
- method: httpexecutor_1.HttpMethod.Post,
262
- path: `/api/index/${indexName}/queryControl/allow`,
305
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
306
+ this._cluster.conn.managementSearchIndexControlQuery({
307
+ index_name: indexName,
308
+ allow: true,
263
309
  timeout: timeout,
310
+ }, (cppErr) => {
311
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
312
+ if (err) {
313
+ return wrapCallback(err, null);
314
+ }
315
+ wrapCallback(err);
264
316
  });
265
- if (res.statusCode !== 200) {
266
- throw new Error('failed to allow search index quering');
267
- }
268
317
  }, callback);
269
318
  }
270
319
  /**
@@ -283,16 +332,18 @@ class SearchIndexManager {
283
332
  options = {};
284
333
  }
285
334
  const timeout = options.timeout || this._cluster.managementTimeout;
286
- return utilities_1.PromiseHelper.wrapAsync(async () => {
287
- const res = await this._http.request({
288
- type: httpexecutor_1.HttpServiceType.Search,
289
- method: httpexecutor_1.HttpMethod.Post,
290
- path: `/api/index/${indexName}/queryControl/disallow`,
335
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
336
+ this._cluster.conn.managementSearchIndexControlQuery({
337
+ index_name: indexName,
338
+ allow: false,
291
339
  timeout: timeout,
340
+ }, (cppErr) => {
341
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
342
+ if (err) {
343
+ return wrapCallback(err, null);
344
+ }
345
+ wrapCallback(err);
292
346
  });
293
- if (res.statusCode !== 200) {
294
- throw new Error('failed to disallow search index quering');
295
- }
296
347
  }, callback);
297
348
  }
298
349
  /**
@@ -311,16 +362,48 @@ class SearchIndexManager {
311
362
  options = {};
312
363
  }
313
364
  const timeout = options.timeout || this._cluster.managementTimeout;
314
- return utilities_1.PromiseHelper.wrapAsync(async () => {
315
- const res = await this._http.request({
316
- type: httpexecutor_1.HttpServiceType.Search,
317
- method: httpexecutor_1.HttpMethod.Post,
318
- path: `/api/index/${indexName}/planFreezeControl/freeze`,
365
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
366
+ this._cluster.conn.managementSearchIndexControlPlanFreeze({
367
+ index_name: indexName,
368
+ freeze: true,
369
+ timeout: timeout,
370
+ }, (cppErr) => {
371
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
372
+ if (err) {
373
+ return wrapCallback(err, null);
374
+ }
375
+ wrapCallback(err);
376
+ });
377
+ }, callback);
378
+ }
379
+ /**
380
+ * Unfreezes the indexing plan for execution of queries.
381
+ *
382
+ * @param indexName The name of the index to freeze the plan of.
383
+ * @param options Optional parameters for this operation.
384
+ * @param callback A node-style callback to be invoked after execution.
385
+ */
386
+ async unfreezePlan(indexName, options, callback) {
387
+ if (options instanceof Function) {
388
+ callback = arguments[1];
389
+ options = undefined;
390
+ }
391
+ if (!options) {
392
+ options = {};
393
+ }
394
+ const timeout = options.timeout || this._cluster.managementTimeout;
395
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
396
+ this._cluster.conn.managementSearchIndexControlPlanFreeze({
397
+ index_name: indexName,
398
+ freeze: false,
319
399
  timeout: timeout,
400
+ }, (cppErr) => {
401
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
402
+ if (err) {
403
+ return wrapCallback(err, null);
404
+ }
405
+ wrapCallback(err);
320
406
  });
321
- if (res.statusCode !== 200) {
322
- throw new Error('failed to freeze search index plan');
323
- }
324
407
  }, callback);
325
408
  }
326
409
  /**
@@ -340,18 +423,19 @@ class SearchIndexManager {
340
423
  options = {};
341
424
  }
342
425
  const timeout = options.timeout || this._cluster.managementTimeout;
343
- return utilities_1.PromiseHelper.wrapAsync(async () => {
344
- const res = await this._http.request({
345
- type: httpexecutor_1.HttpServiceType.Search,
346
- method: httpexecutor_1.HttpMethod.Post,
347
- path: `/api/index/${indexName}/analyzeDoc`,
348
- body: JSON.stringify(document),
426
+ return utilities_1.PromiseHelper.wrap((wrapCallback) => {
427
+ this._cluster.conn.managementSearchIndexAnalyzeDocument({
428
+ index_name: indexName,
429
+ encoded_document: JSON.stringify(document),
349
430
  timeout: timeout,
431
+ }, (cppErr, resp) => {
432
+ const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
433
+ if (err) {
434
+ return wrapCallback(err, null);
435
+ }
436
+ const result = JSON.parse(resp.analysis);
437
+ wrapCallback(result, null);
350
438
  });
351
- if (res.statusCode !== 200) {
352
- throw new Error('failed to perform search index document analysis');
353
- }
354
- return JSON.parse(res.body.toString()).analyze;
355
439
  }, callback);
356
440
  }
357
441
  }
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.ViewExecutor = void 0;
7
4
  /* eslint jsdoc/require-jsdoc: off */
8
- const binding_1 = __importDefault(require("./binding"));
9
5
  const bindingutilities_1 = require("./bindingutilities");
10
6
  const streamablepromises_1 = require("./streamablepromises");
11
7
  const viewtypes_1 = require("./viewtypes");
@@ -29,6 +25,7 @@ class ViewExecutor {
29
25
  * @internal
30
26
  */
31
27
  query(designDoc, viewName, options) {
28
+ var _a;
32
29
  const emitter = new streamablepromises_1.StreamableRowPromise((rows, meta) => {
33
30
  return new viewtypes_1.ViewResult({
34
31
  rows: rows,
@@ -36,12 +33,18 @@ class ViewExecutor {
36
33
  });
37
34
  });
38
35
  const timeout = options.timeout || this._cluster.viewTimeout;
36
+ const raw = options.raw || {};
37
+ const ns = (_a = options.namespace) !== null && _a !== void 0 ? _a : viewtypes_1.DesignDocumentNamespace.Production;
38
+ let fullSet = options.full_set;
39
+ if (typeof options.fullSet !== 'undefined') {
40
+ fullSet = options.fullSet;
41
+ }
39
42
  this._cluster.conn.documentView({
40
43
  timeout: timeout,
41
44
  bucket_name: this._bucket.name,
42
45
  document_name: designDoc,
43
46
  view_name: viewName,
44
- ns: binding_1.default.design_document_namespace.production,
47
+ ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(ns),
45
48
  limit: options.limit,
46
49
  skip: options.skip,
47
50
  consistency: (0, bindingutilities_1.viewScanConsistencyToCpp)(options.scanConsistency),
@@ -55,10 +58,10 @@ class ViewExecutor {
55
58
  : undefined,
56
59
  inclusive_end: options.range ? options.range.inclusiveEnd : undefined,
57
60
  start_key_doc_id: options.idRange && options.idRange.start
58
- ? JSON.stringify(options.idRange.start)
61
+ ? options.idRange.start
59
62
  : undefined,
60
63
  end_key_doc_id: options.idRange && options.idRange.end
61
- ? JSON.stringify(options.idRange.end)
64
+ ? options.idRange.end
62
65
  : undefined,
63
66
  reduce: options.reduce,
64
67
  group: options.group,
@@ -66,7 +69,8 @@ class ViewExecutor {
66
69
  order: (0, bindingutilities_1.viewOrderingToCpp)(options.order),
67
70
  debug: false,
68
71
  query_string: [],
69
- raw: {},
72
+ raw: raw,
73
+ full_set: fullSet,
70
74
  }, (cppErr, resp) => {
71
75
  const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
72
76
  if (err) {
@@ -78,7 +82,7 @@ class ViewExecutor {
78
82
  emitter.emit('row', new viewtypes_1.ViewRow({
79
83
  value: JSON.parse(row.value),
80
84
  id: row.id,
81
- key: row.key,
85
+ key: JSON.parse(row.key),
82
86
  }));
83
87
  });
84
88
  {
@@ -1,5 +1,7 @@
1
1
  import { Bucket } from './bucket';
2
2
  import { NodeCallback } from './utilities';
3
+ import { DesignDocumentNamespace } from './viewtypes';
4
+ import { CppManagementViewsDesignDocument, CppManagementViewsDesignDocumentView } from './binding';
3
5
  /**
4
6
  * Contains information about a view in a design document.
5
7
  *
@@ -9,19 +11,27 @@ export declare class DesignDocumentView {
9
11
  /**
10
12
  * The mapping function to use for this view.
11
13
  */
12
- map: string;
14
+ map: string | undefined;
13
15
  /**
14
16
  * The reduction function to use for this view.
15
17
  */
16
18
  reduce: string | undefined;
17
19
  constructor(data: {
18
- map: string;
20
+ map?: string;
19
21
  reduce?: string;
20
22
  });
21
23
  /**
22
24
  * @deprecated
23
25
  */
24
- constructor(map: string, reduce?: string);
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;
25
35
  }
26
36
  /**
27
37
  * Contains information about a design document.
@@ -45,11 +55,21 @@ export declare class DesignDocument {
45
55
  views: {
46
56
  [viewName: string]: DesignDocumentView;
47
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;
48
66
  constructor(data: {
49
67
  name: string;
50
68
  views?: {
51
69
  [viewName: string]: DesignDocumentView;
52
70
  };
71
+ namespace?: DesignDocumentNamespace;
72
+ rev?: string;
53
73
  });
54
74
  /**
55
75
  * @deprecated
@@ -61,6 +81,14 @@ export declare class DesignDocument {
61
81
  * @internal
62
82
  */
63
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;
64
92
  }
65
93
  /**
66
94
  * @category Management
@@ -119,10 +147,6 @@ export declare class ViewIndexManager {
119
147
  * @internal
120
148
  */
121
149
  constructor(bucket: Bucket);
122
- /**
123
- * @internal
124
- */
125
- private get _http();
126
150
  /**
127
151
  * @internal
128
152
  */
@@ -132,32 +156,71 @@ export declare class ViewIndexManager {
132
156
  *
133
157
  * @param options Optional parameters for this operation.
134
158
  * @param callback A node-style callback to be invoked after execution.
159
+ * @deprecated
135
160
  */
136
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[]>;
137
170
  /**
138
171
  * Returns the specified design document.
139
172
  *
140
173
  * @param designDocName The name of the design document to fetch.
141
174
  * @param options Optional parameters for this operation.
142
175
  * @param callback A node-style callback to be invoked after execution.
176
+ * @deprecated
143
177
  */
144
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>;
145
188
  /**
146
189
  * Creates or updates a design document.
147
190
  *
148
191
  * @param designDoc The DesignDocument to upsert.
149
192
  * @param options Optional parameters for this operation.
150
193
  * @param callback A node-style callback to be invoked after execution.
194
+ * @deprecated
151
195
  */
152
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>;
153
206
  /**
154
207
  * Drops an existing design document.
155
208
  *
156
209
  * @param designDocName The name of the design document to drop.
157
210
  * @param options Optional parameters for this operation.
158
211
  * @param callback A node-style callback to be invoked after execution.
212
+ * @deprecated
159
213
  */
160
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>;
161
224
  /**
162
225
  * Publishes a development design document to be a production design document.
163
226
  * It does this by fetching the design document by the passed name with `dev_`