couchbase 4.2.9 → 4.2.11-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +67 -2
- package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +65 -1
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
- package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
- package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
- package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
- package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
- package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +7 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +10 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -0
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +26 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +8 -3
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +7 -6
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +24 -13
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +14 -0
- package/deps/couchbase-cxx-client/core/origin.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +70 -1
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
- package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +1 -34
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +43 -20
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +5 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +4 -0
- package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
- package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
- package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
- package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
- package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
- package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
- package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
- package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
- package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
- package/dist/binding.d.ts +33 -2
- package/dist/binding.js +4 -1
- package/dist/bindingutilities.d.ts +16 -3
- package/dist/bindingutilities.js +47 -7
- package/dist/cluster.d.ts +12 -1
- package/dist/cluster.js +22 -0
- package/dist/couchbase.d.ts +2 -0
- package/dist/couchbase.js +2 -0
- package/dist/queryindexmanager.d.ts +4 -4
- package/dist/queryindexmanager.js +7 -7
- package/dist/scope.d.ts +21 -0
- package/dist/scope.js +34 -0
- package/dist/scopesearchindexmanager.d.ts +116 -0
- package/dist/scopesearchindexmanager.js +406 -0
- package/dist/sdspecs.js +10 -9
- package/dist/sdutils.d.ts +1 -0
- package/dist/sdutils.js +4 -0
- package/dist/searchexecutor.d.ts +5 -3
- package/dist/searchexecutor.js +27 -4
- package/dist/searchindexmanager.d.ts +58 -3
- package/dist/searchindexmanager.js +188 -104
- package/dist/searchtypes.d.ts +46 -0
- package/dist/searchtypes.js +81 -1
- package/dist/vectorsearch.d.ts +99 -0
- package/dist/vectorsearch.js +132 -0
- package/dist/viewexecutor.js +13 -9
- package/dist/viewindexmanager.d.ts +70 -7
- package/dist/viewindexmanager.js +236 -103
- package/dist/viewtypes.d.ts +26 -0
- package/dist/viewtypes.js +17 -1
- package/package.json +7 -7
- package/src/constants.cpp +12 -0
- package/src/jstocbpp_autogen.hpp +113 -13
- package/tools/gen-bindings-json.py +2 -0
package/dist/viewindexmanager.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ViewIndexManager = exports.DesignDocument = exports.DesignDocumentView = void 0;
|
4
|
-
const errors_1 = require("./errors");
|
5
|
-
const httpexecutor_1 = require("./httpexecutor");
|
6
4
|
const utilities_1 = require("./utilities");
|
5
|
+
const viewtypes_1 = require("./viewtypes");
|
6
|
+
const bindingutilities_1 = require("./bindingutilities");
|
7
7
|
/**
|
8
8
|
* Contains information about a view in a design document.
|
9
9
|
*
|
@@ -27,6 +27,25 @@ class DesignDocumentView {
|
|
27
27
|
this.map = data.map;
|
28
28
|
this.reduce = data.reduce;
|
29
29
|
}
|
30
|
+
/**
|
31
|
+
* @internal
|
32
|
+
*/
|
33
|
+
static _toCppData(name, data) {
|
34
|
+
return {
|
35
|
+
name: name,
|
36
|
+
map: data.map,
|
37
|
+
reduce: data.reduce,
|
38
|
+
};
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* @internal
|
42
|
+
*/
|
43
|
+
static _fromCppData(data) {
|
44
|
+
return new DesignDocumentView({
|
45
|
+
map: data.map,
|
46
|
+
reduce: data.reduce,
|
47
|
+
});
|
48
|
+
}
|
30
49
|
}
|
31
50
|
exports.DesignDocumentView = DesignDocumentView;
|
32
51
|
/**
|
@@ -59,6 +78,8 @@ class DesignDocument {
|
|
59
78
|
}
|
60
79
|
this.name = data.name;
|
61
80
|
this.views = data.views || {};
|
81
|
+
this.namespace = data.namespace || viewtypes_1.DesignDocumentNamespace.Production;
|
82
|
+
this.rev = data.rev;
|
62
83
|
}
|
63
84
|
/**
|
64
85
|
* @internal
|
@@ -74,6 +95,36 @@ class DesignDocument {
|
|
74
95
|
}
|
75
96
|
return new DesignDocument({ name: ddocName, views: views });
|
76
97
|
}
|
98
|
+
/**
|
99
|
+
* @internal
|
100
|
+
*/
|
101
|
+
static _toCppData(data, namespace) {
|
102
|
+
const cppView = {};
|
103
|
+
for (const [k, v] of Object.entries(data.views)) {
|
104
|
+
cppView[k] = DesignDocumentView._toCppData(k, v);
|
105
|
+
}
|
106
|
+
return {
|
107
|
+
rev: data.rev,
|
108
|
+
name: data.name,
|
109
|
+
ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(namespace),
|
110
|
+
views: cppView,
|
111
|
+
};
|
112
|
+
}
|
113
|
+
/**
|
114
|
+
* @internal
|
115
|
+
*/
|
116
|
+
static _fromCppData(ddoc) {
|
117
|
+
const views = {};
|
118
|
+
for (const [viewName, viewData] of Object.entries(ddoc.views)) {
|
119
|
+
views[viewName] = DesignDocumentView._fromCppData(viewData);
|
120
|
+
}
|
121
|
+
return new DesignDocument({
|
122
|
+
name: ddoc.name,
|
123
|
+
views: views,
|
124
|
+
namespace: (0, bindingutilities_1.designDocumentNamespaceFromCpp)(ddoc.ns),
|
125
|
+
rev: ddoc.rev,
|
126
|
+
});
|
127
|
+
}
|
77
128
|
}
|
78
129
|
exports.DesignDocument = DesignDocument;
|
79
130
|
/**
|
@@ -89,12 +140,6 @@ class ViewIndexManager {
|
|
89
140
|
constructor(bucket) {
|
90
141
|
this._bucket = bucket;
|
91
142
|
}
|
92
|
-
/**
|
93
|
-
* @internal
|
94
|
-
*/
|
95
|
-
get _http() {
|
96
|
-
return new httpexecutor_1.HttpExecutor(this._bucket.conn);
|
97
|
-
}
|
98
143
|
/**
|
99
144
|
* @internal
|
100
145
|
*/
|
@@ -102,142 +147,232 @@ class ViewIndexManager {
|
|
102
147
|
return this._bucket.cluster;
|
103
148
|
}
|
104
149
|
/**
|
105
|
-
*
|
106
|
-
*
|
107
|
-
* @param options Optional parameters for this operation.
|
108
|
-
* @param callback A node-style callback to be invoked after execution.
|
150
|
+
* @internal
|
109
151
|
*/
|
110
|
-
async getAllDesignDocuments(
|
111
|
-
|
112
|
-
|
152
|
+
async getAllDesignDocuments() {
|
153
|
+
let namespace;
|
154
|
+
let options;
|
155
|
+
let callback;
|
156
|
+
// deprecated path: options and maybe callback passed in
|
157
|
+
if (typeof arguments[0] === 'object') {
|
158
|
+
namespace = undefined;
|
159
|
+
options = arguments[0];
|
160
|
+
callback = arguments[1];
|
161
|
+
}
|
162
|
+
else if (arguments[0] instanceof Function) {
|
163
|
+
// deprecated path: no options, only callback passed in
|
164
|
+
namespace = undefined;
|
113
165
|
options = undefined;
|
166
|
+
callback = arguments[0];
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
// either no args passed in or desired path (namespace is 1st arg)
|
170
|
+
namespace = arguments[0];
|
171
|
+
// still need to handle possible no options, but callback passed in
|
172
|
+
if (arguments[1] instanceof Function) {
|
173
|
+
callback = arguments[1];
|
174
|
+
options = undefined;
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
options = arguments[1];
|
178
|
+
callback = arguments[2];
|
179
|
+
}
|
114
180
|
}
|
115
181
|
if (!options) {
|
116
182
|
options = {};
|
117
183
|
}
|
118
184
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
path: `/pools/default/buckets/${bucketName}/ddocs`,
|
185
|
+
const ns = namespace !== null && namespace !== void 0 ? namespace : viewtypes_1.DesignDocumentNamespace.Production;
|
186
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
187
|
+
this._cluster.conn.managementViewIndexGetAll({
|
188
|
+
bucket_name: this._bucket.name,
|
189
|
+
ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(ns),
|
125
190
|
timeout: timeout,
|
191
|
+
}, (cppErr, resp) => {
|
192
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
193
|
+
if (err) {
|
194
|
+
return wrapCallback(err, null);
|
195
|
+
}
|
196
|
+
const ddocs = [];
|
197
|
+
for (const ddoc of resp.design_documents) {
|
198
|
+
ddocs.push(DesignDocument._fromCppData(ddoc));
|
199
|
+
}
|
200
|
+
wrapCallback(null, ddocs);
|
126
201
|
});
|
127
|
-
if (res.statusCode !== 200) {
|
128
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
129
|
-
throw new errors_1.CouchbaseError('failed to get design documents', undefined, errCtx);
|
130
|
-
}
|
131
|
-
const ddocsData = JSON.parse(res.body.toString());
|
132
|
-
const ddocs = ddocsData.rows.map((ddocData) => {
|
133
|
-
const ddocName = ddocData.doc.meta.id.substr(8);
|
134
|
-
return DesignDocument._fromNsData(ddocName, ddocData.doc.json);
|
135
|
-
});
|
136
|
-
return ddocs;
|
137
202
|
}, callback);
|
138
203
|
}
|
139
204
|
/**
|
140
|
-
*
|
141
|
-
*
|
142
|
-
* @param designDocName The name of the design document to fetch.
|
143
|
-
* @param options Optional parameters for this operation.
|
144
|
-
* @param callback A node-style callback to be invoked after execution.
|
205
|
+
* @internal
|
145
206
|
*/
|
146
|
-
async getDesignDocument(
|
147
|
-
|
148
|
-
|
207
|
+
async getDesignDocument() {
|
208
|
+
let designDocName = arguments[0];
|
209
|
+
let namespace;
|
210
|
+
let options;
|
211
|
+
let callback;
|
212
|
+
// deprecated path: options and maybe callback passed in
|
213
|
+
if (typeof arguments[1] === 'object') {
|
214
|
+
namespace = undefined;
|
215
|
+
options = arguments[1];
|
216
|
+
callback = arguments[2];
|
217
|
+
}
|
218
|
+
else if (arguments[1] instanceof Function) {
|
219
|
+
// deprecated path: no options, only callback passed in
|
220
|
+
namespace = undefined;
|
149
221
|
options = undefined;
|
222
|
+
callback = arguments[1];
|
223
|
+
}
|
224
|
+
else {
|
225
|
+
// either no other args passed in or desired path (namespace is 2nd arg)
|
226
|
+
namespace = arguments[1];
|
227
|
+
// still need to handle possible no options, but callback passed in
|
228
|
+
if (arguments[2] instanceof Function) {
|
229
|
+
callback = arguments[2];
|
230
|
+
options = undefined;
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
options = arguments[2];
|
234
|
+
callback = arguments[3];
|
235
|
+
}
|
150
236
|
}
|
151
237
|
if (!options) {
|
152
238
|
options = {};
|
153
239
|
}
|
154
240
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
241
|
+
// for compatibility with older SDK versions (i.e. deprecated getDesignDocument())
|
242
|
+
if (designDocName.startsWith('dev_')) {
|
243
|
+
namespace = viewtypes_1.DesignDocumentNamespace.Development;
|
244
|
+
designDocName = designDocName.substring(4);
|
245
|
+
}
|
246
|
+
const ns = namespace !== null && namespace !== void 0 ? namespace : viewtypes_1.DesignDocumentNamespace.Production;
|
247
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
248
|
+
this._cluster.conn.managementViewIndexGet({
|
249
|
+
bucket_name: this._bucket.name,
|
250
|
+
document_name: designDocName,
|
251
|
+
ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(ns),
|
161
252
|
timeout: timeout,
|
162
|
-
})
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
253
|
+
}, (cppErr, resp) => {
|
254
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
255
|
+
if (err) {
|
256
|
+
return wrapCallback(err, null);
|
167
257
|
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
return DesignDocument._fromNsData(designDocName, ddocData);
|
258
|
+
const ddoc = DesignDocument._fromCppData(resp.document);
|
259
|
+
wrapCallback(null, ddoc);
|
260
|
+
});
|
172
261
|
}, callback);
|
173
262
|
}
|
174
263
|
/**
|
175
|
-
*
|
176
|
-
*
|
177
|
-
* @param designDoc The DesignDocument to upsert.
|
178
|
-
* @param options Optional parameters for this operation.
|
179
|
-
* @param callback A node-style callback to be invoked after execution.
|
264
|
+
* @internal
|
180
265
|
*/
|
181
|
-
async upsertDesignDocument(
|
182
|
-
|
183
|
-
|
266
|
+
async upsertDesignDocument() {
|
267
|
+
const designDoc = arguments[0];
|
268
|
+
let namespace;
|
269
|
+
let options;
|
270
|
+
let callback;
|
271
|
+
// deprecated path: options and maybe callback passed in
|
272
|
+
if (typeof arguments[1] === 'object') {
|
273
|
+
namespace = undefined;
|
274
|
+
options = arguments[1];
|
275
|
+
callback = arguments[2];
|
276
|
+
}
|
277
|
+
else if (arguments[1] instanceof Function) {
|
278
|
+
// deprecated path: no options, only callback passed in
|
279
|
+
namespace = undefined;
|
184
280
|
options = undefined;
|
281
|
+
callback = arguments[1];
|
282
|
+
}
|
283
|
+
else {
|
284
|
+
// either no other args passed in or desired path (namespace is 2nd arg)
|
285
|
+
namespace = arguments[1];
|
286
|
+
// still need to handle possible no options, but callback passed in
|
287
|
+
if (arguments[2] instanceof Function) {
|
288
|
+
callback = arguments[2];
|
289
|
+
options = undefined;
|
290
|
+
}
|
291
|
+
else {
|
292
|
+
options = arguments[2];
|
293
|
+
callback = arguments[3];
|
294
|
+
}
|
185
295
|
}
|
186
296
|
if (!options) {
|
187
297
|
options = {};
|
188
298
|
}
|
189
299
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
contentType: 'application/json',
|
201
|
-
body: encodedData,
|
300
|
+
// for compatibility with older SDK versions (i.e. deprecated upsertDesignDocument())
|
301
|
+
if (designDoc.name.startsWith('dev_')) {
|
302
|
+
namespace = viewtypes_1.DesignDocumentNamespace.Development;
|
303
|
+
designDoc.name = designDoc.name.substring(4);
|
304
|
+
}
|
305
|
+
const ns = namespace !== null && namespace !== void 0 ? namespace : viewtypes_1.DesignDocumentNamespace.Production;
|
306
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
307
|
+
this._cluster.conn.managementViewIndexUpsert({
|
308
|
+
bucket_name: this._bucket.name,
|
309
|
+
document: DesignDocument._toCppData(designDoc, ns),
|
202
310
|
timeout: timeout,
|
311
|
+
}, (cppErr) => {
|
312
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
313
|
+
if (err) {
|
314
|
+
return wrapCallback(err, null);
|
315
|
+
}
|
316
|
+
wrapCallback(err);
|
203
317
|
});
|
204
|
-
if (res.statusCode !== 201) {
|
205
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
206
|
-
throw new errors_1.CouchbaseError('failed to upsert the design document', undefined, errCtx);
|
207
|
-
}
|
208
318
|
}, callback);
|
209
319
|
}
|
210
320
|
/**
|
211
|
-
*
|
212
|
-
*
|
213
|
-
* @param designDocName The name of the design document to drop.
|
214
|
-
* @param options Optional parameters for this operation.
|
215
|
-
* @param callback A node-style callback to be invoked after execution.
|
321
|
+
* @internal
|
216
322
|
*/
|
217
|
-
async dropDesignDocument(
|
218
|
-
|
219
|
-
|
323
|
+
async dropDesignDocument() {
|
324
|
+
let designDocName = arguments[0];
|
325
|
+
let namespace;
|
326
|
+
let options;
|
327
|
+
let callback;
|
328
|
+
// deprecated path: options and maybe callback passed in
|
329
|
+
if (typeof arguments[1] === 'object') {
|
330
|
+
namespace = undefined;
|
331
|
+
options = arguments[1];
|
332
|
+
callback = arguments[2];
|
333
|
+
}
|
334
|
+
else if (arguments[1] instanceof Function) {
|
335
|
+
// deprecated path: no options, only callback passed in
|
336
|
+
namespace = undefined;
|
220
337
|
options = undefined;
|
338
|
+
callback = arguments[1];
|
339
|
+
}
|
340
|
+
else {
|
341
|
+
// either no other args passed in or desired path (namespace is 2nd arg)
|
342
|
+
namespace = arguments[1];
|
343
|
+
// still need to handle possible no options, but callback passed in
|
344
|
+
if (arguments[2] instanceof Function) {
|
345
|
+
callback = arguments[2];
|
346
|
+
options = undefined;
|
347
|
+
}
|
348
|
+
else {
|
349
|
+
options = arguments[2];
|
350
|
+
callback = arguments[3];
|
351
|
+
}
|
221
352
|
}
|
222
353
|
if (!options) {
|
223
354
|
options = {};
|
224
355
|
}
|
225
356
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
357
|
+
// for compatibility with older SDK versions (i.e. deprecated dropDesignDocument())
|
358
|
+
if (designDocName.startsWith('dev_')) {
|
359
|
+
namespace = viewtypes_1.DesignDocumentNamespace.Development;
|
360
|
+
designDocName = designDocName.substring(4);
|
361
|
+
}
|
362
|
+
const ns = namespace !== null && namespace !== void 0 ? namespace : viewtypes_1.DesignDocumentNamespace.Production;
|
363
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
364
|
+
this._cluster.conn.managementViewIndexDrop({
|
365
|
+
bucket_name: this._bucket.name,
|
366
|
+
document_name: designDocName,
|
367
|
+
ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(ns),
|
232
368
|
timeout: timeout,
|
233
|
-
})
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
369
|
+
}, (cppErr) => {
|
370
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
371
|
+
if (err) {
|
372
|
+
return wrapCallback(err, null);
|
238
373
|
}
|
239
|
-
|
240
|
-
}
|
374
|
+
wrapCallback(err);
|
375
|
+
});
|
241
376
|
}, callback);
|
242
377
|
}
|
243
378
|
/**
|
@@ -261,12 +396,10 @@ class ViewIndexManager {
|
|
261
396
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
262
397
|
const timer = new utilities_1.CompoundTimeout(timeout);
|
263
398
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
264
|
-
const designDoc = await this.getDesignDocument(
|
399
|
+
const designDoc = await this.getDesignDocument(designDocName, viewtypes_1.DesignDocumentNamespace.Development, {
|
265
400
|
timeout: timer.left(),
|
266
401
|
});
|
267
|
-
|
268
|
-
designDoc.name = designDocName;
|
269
|
-
await this.upsertDesignDocument(designDoc, {
|
402
|
+
await this.upsertDesignDocument(designDoc, viewtypes_1.DesignDocumentNamespace.Production, {
|
270
403
|
timeout: timer.left(),
|
271
404
|
});
|
272
405
|
}, callback);
|
package/dist/viewtypes.d.ts
CHANGED
@@ -69,6 +69,21 @@ export declare class ViewRow<TValue = any, TKey = any> {
|
|
69
69
|
*/
|
70
70
|
constructor(data: ViewRow);
|
71
71
|
}
|
72
|
+
/**
|
73
|
+
* Specifies the namespace for the associated Design Document.
|
74
|
+
*
|
75
|
+
* @category Views
|
76
|
+
*/
|
77
|
+
export declare enum DesignDocumentNamespace {
|
78
|
+
/**
|
79
|
+
* Indicates that the Design Document namespace is within the development environment.
|
80
|
+
*/
|
81
|
+
Development = "development",
|
82
|
+
/**
|
83
|
+
* Indicates that the Design Document namespace is within the producion environment.
|
84
|
+
*/
|
85
|
+
Production = "production"
|
86
|
+
}
|
72
87
|
/**
|
73
88
|
* Represents the various scan consistency options that are available when
|
74
89
|
* querying against the views service.
|
@@ -270,4 +285,15 @@ export interface ViewQueryOptions {
|
|
270
285
|
* @deprecated Use {@link ViewQueryOptions.onError} instead.
|
271
286
|
*/
|
272
287
|
on_error?: ViewErrorMode;
|
288
|
+
/**
|
289
|
+
* Specifies any additional parameters which should be passed to the view engine
|
290
|
+
* when executing the view query.
|
291
|
+
*/
|
292
|
+
raw?: {
|
293
|
+
[key: string]: string;
|
294
|
+
};
|
295
|
+
/**
|
296
|
+
* Specifies the design document namespace to use when executing the view query.
|
297
|
+
*/
|
298
|
+
namespace?: DesignDocumentNamespace;
|
273
299
|
}
|
package/dist/viewtypes.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ViewErrorMode = exports.ViewOrdering = exports.ViewScanConsistency = exports.ViewRow = exports.ViewMetaData = exports.ViewResult = void 0;
|
3
|
+
exports.ViewErrorMode = exports.ViewOrdering = exports.ViewScanConsistency = exports.DesignDocumentNamespace = exports.ViewRow = exports.ViewMetaData = exports.ViewResult = void 0;
|
4
4
|
/**
|
5
5
|
* Contains the results of a view query.
|
6
6
|
*
|
@@ -56,6 +56,22 @@ class ViewRow {
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
exports.ViewRow = ViewRow;
|
59
|
+
/**
|
60
|
+
* Specifies the namespace for the associated Design Document.
|
61
|
+
*
|
62
|
+
* @category Views
|
63
|
+
*/
|
64
|
+
var DesignDocumentNamespace;
|
65
|
+
(function (DesignDocumentNamespace) {
|
66
|
+
/**
|
67
|
+
* Indicates that the Design Document namespace is within the development environment.
|
68
|
+
*/
|
69
|
+
DesignDocumentNamespace["Development"] = "development";
|
70
|
+
/**
|
71
|
+
* Indicates that the Design Document namespace is within the producion environment.
|
72
|
+
*/
|
73
|
+
DesignDocumentNamespace["Production"] = "production";
|
74
|
+
})(DesignDocumentNamespace || (exports.DesignDocumentNamespace = DesignDocumentNamespace = {}));
|
59
75
|
/**
|
60
76
|
* Represents the various scan consistency options that are available when
|
61
77
|
* querying against the views service.
|
package/package.json
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
"type": "git",
|
55
55
|
"url": "http://github.com/couchbase/couchnode.git"
|
56
56
|
},
|
57
|
-
"version": "4.2.
|
57
|
+
"version": "4.2.11-rc.1",
|
58
58
|
"config": {
|
59
59
|
"native": false
|
60
60
|
},
|
@@ -79,12 +79,12 @@
|
|
79
79
|
]
|
80
80
|
},
|
81
81
|
"optionalDependencies": {
|
82
|
-
"@couchbase/couchbase-darwin-arm64-napi": "4.2.
|
83
|
-
"@couchbase/couchbase-darwin-x64-napi": "4.2.
|
84
|
-
"@couchbase/couchbase-linux-arm64-napi": "4.2.
|
85
|
-
"@couchbase/couchbase-linuxmusl-x64-napi": "4.2.
|
86
|
-
"@couchbase/couchbase-linux-x64-napi": "4.2.
|
87
|
-
"@couchbase/couchbase-win32-x64-napi": "4.2.
|
82
|
+
"@couchbase/couchbase-darwin-arm64-napi": "4.2.11-rc.1",
|
83
|
+
"@couchbase/couchbase-darwin-x64-napi": "4.2.11-rc.1",
|
84
|
+
"@couchbase/couchbase-linux-arm64-napi": "4.2.11-rc.1",
|
85
|
+
"@couchbase/couchbase-linuxmusl-x64-napi": "4.2.11-rc.1",
|
86
|
+
"@couchbase/couchbase-linux-x64-napi": "4.2.11-rc.1",
|
87
|
+
"@couchbase/couchbase-win32-x64-napi": "4.2.11-rc.1"
|
88
88
|
},
|
89
89
|
"files": [
|
90
90
|
"LICENSE",
|
package/src/constants.cpp
CHANGED
@@ -865,6 +865,7 @@ void Constants::InitAutogen(Napi::Env env, Napi::Object exports)
|
|
865
865
|
couchbase::key_value_status_code::opaque_no_match},
|
866
866
|
{"locked", couchbase::key_value_status_code::locked},
|
867
867
|
{"not_locked", couchbase::key_value_status_code::not_locked},
|
868
|
+
{"config_only", couchbase::key_value_status_code::config_only},
|
868
869
|
{"auth_stale", couchbase::key_value_status_code::auth_stale},
|
869
870
|
{"auth_error", couchbase::key_value_status_code::auth_error},
|
870
871
|
{"auth_continue",
|
@@ -1051,6 +1052,17 @@ void Constants::InitAutogen(Napi::Env env, Napi::Object exports)
|
|
1051
1052
|
{"three", couchbase::replicate_to::three},
|
1052
1053
|
}));
|
1053
1054
|
|
1055
|
+
exports.Set(
|
1056
|
+
"vector_query_combination",
|
1057
|
+
cbppEnumToJs<couchbase::core::vector_query_combination>(
|
1058
|
+
env,
|
1059
|
+
{
|
1060
|
+
{"combination_and",
|
1061
|
+
couchbase::core::vector_query_combination::combination_and},
|
1062
|
+
{"combination_or",
|
1063
|
+
couchbase::core::vector_query_combination::combination_or},
|
1064
|
+
}));
|
1065
|
+
|
1054
1066
|
//#endregion Autogenerated Constants
|
1055
1067
|
}
|
1056
1068
|
|