couchbase 3.2.2 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/binding.gyp +5 -0
- package/deps/lcb/CMakeLists.txt +1 -1
- package/deps/lcb/CONTRIBUTING.md +1 -1
- package/deps/lcb/README.markdown +2 -2
- package/deps/lcb/RELEASE_NOTES.markdown +84 -17
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
- package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/example/minimal/query.c +9 -7
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
- package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
- package/deps/lcb/include/libcouchbase/error.h +6 -1
- package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
- package/deps/lcb/include/libcouchbase/tracing.h +2 -2
- package/deps/lcb/include/memcached/protocol_binary.h +21 -0
- package/deps/lcb/libcouchbase.gyp +353 -349
- package/deps/lcb/packaging/deb/control +1 -1
- package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
- package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
- package/deps/lcb/src/capi/cmd_counter.hh +18 -0
- package/deps/lcb/src/capi/cmd_exists.hh +18 -0
- package/deps/lcb/src/capi/cmd_get.hh +17 -0
- package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
- package/deps/lcb/src/capi/cmd_query.cc +13 -0
- package/deps/lcb/src/capi/cmd_query.hh +22 -14
- package/deps/lcb/src/capi/cmd_remove.hh +18 -0
- package/deps/lcb/src/capi/cmd_search.hh +6 -0
- package/deps/lcb/src/capi/cmd_store.hh +28 -21
- package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
- package/deps/lcb/src/capi/cmd_touch.hh +18 -0
- package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
- package/deps/lcb/src/capi/cmd_view.hh +6 -0
- package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
- package/deps/lcb/src/cntl.cc +42 -8
- package/deps/lcb/src/dns-srv.cc +5 -3
- package/deps/lcb/src/errmap.cc +5 -9
- package/deps/lcb/src/errmap.h +7 -3
- package/deps/lcb/src/handler.cc +24 -18
- package/deps/lcb/src/internal.h +2 -1
- package/deps/lcb/src/lcbio/ctx.cc +4 -2
- package/deps/lcb/src/mcserver/mcserver.cc +8 -5
- package/deps/lcb/src/mcserver/negotiate.cc +42 -17
- package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
- package/deps/lcb/src/n1ql/n1ql.cc +5 -1
- package/deps/lcb/src/n1ql/query_handle.cc +80 -44
- package/deps/lcb/src/n1ql/query_handle.hh +41 -3
- package/deps/lcb/src/operations/counter.cc +13 -1
- package/deps/lcb/src/operations/exists.cc +14 -2
- package/deps/lcb/src/operations/get.cc +14 -2
- package/deps/lcb/src/operations/get_replica.cc +18 -6
- package/deps/lcb/src/operations/observe.cc +1 -1
- package/deps/lcb/src/operations/remove.cc +13 -1
- package/deps/lcb/src/operations/store.cc +13 -1
- package/deps/lcb/src/operations/subdoc.cc +13 -2
- package/deps/lcb/src/operations/touch.cc +14 -2
- package/deps/lcb/src/operations/unlock.cc +14 -2
- package/deps/lcb/src/search/search_handle.cc +26 -8
- package/deps/lcb/src/search/search_handle.hh +29 -0
- package/deps/lcb/src/ssl/ssl_common.c +7 -8
- package/deps/lcb/src/tracing/span.cc +43 -10
- package/deps/lcb/src/tracing/tracing-internal.h +105 -93
- package/deps/lcb/src/utilities.cc +21 -0
- package/deps/lcb/src/utilities.h +3 -0
- package/deps/lcb/src/views/view_handle.cc +13 -5
- package/deps/lcb/src/views/view_handle.hh +29 -0
- package/deps/lcb/tests/CMakeLists.txt +21 -0
- package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
- package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
- package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
- package/deps/lcb/tests/iotests/mock-environment.h +49 -1
- package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
- package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
- package/deps/lcb/tests/iotests/serverparams.h +7 -2
- package/deps/lcb/tests/iotests/t_collections.cc +1 -1
- package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
- package/deps/lcb/tests/iotests/t_get.cc +14 -4
- package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
- package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
- package/deps/lcb/tests/iotests/t_views.cc +1 -0
- package/deps/lcb/tests/iotests/testutil.cc +342 -0
- package/deps/lcb/tests/iotests/testutil.h +164 -0
- package/deps/lcb/tests/mocksupport/procutil.c +32 -28
- package/deps/lcb/tests/mocksupport/server.c +0 -1
- package/deps/lcb/tools/cbc.cc +7 -0
- package/dist/analyticsexecutor.js +2 -2
- package/dist/analyticsindexmanager.js +512 -524
- package/dist/binarycollection.d.ts +17 -0
- package/dist/binding.d.ts +2 -0
- package/dist/binding.js +1 -1
- package/dist/bindingutilities.js +9 -1
- package/dist/bucketmanager.d.ts +32 -23
- package/dist/bucketmanager.js +197 -189
- package/dist/cluster.js +37 -36
- package/dist/collection.js +17 -23
- package/dist/collectionmanager.js +181 -200
- package/dist/connection.js +6 -3
- package/dist/connspec.js +5 -1
- package/dist/couchbase.js +7 -14
- package/dist/datastructures.js +239 -310
- package/dist/diagnosticsexecutor.js +70 -85
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +26 -2
- package/dist/eventingfunctionmanager.js +267 -294
- package/dist/httpexecutor.js +31 -38
- package/dist/logging.js +1 -1
- package/dist/queryexecutor.js +3 -3
- package/dist/queryindexmanager.js +236 -263
- package/dist/scope.js +8 -2
- package/dist/searchexecutor.js +3 -0
- package/dist/searchindexmanager.js +240 -271
- package/dist/searchquery.d.ts +17 -0
- package/dist/searchquery.js +22 -1
- package/dist/searchtypes.d.ts +7 -2
- package/dist/searchtypes.js +2 -2
- package/dist/usermanager.js +250 -263
- package/dist/utilities.d.ts +3 -2
- package/dist/utilities.js +16 -4
- package/dist/viewexecutor.js +1 -1
- package/dist/viewindexmanager.js +131 -150
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/constants.cpp +2 -0
- package/src/instance.cpp +8 -1
- package/src/instance.h +1 -0
- package/src/uv-plugin-all.cpp +1 -0
- package/dist/cas.d.ts +0 -0
- package/dist/cas.js +0 -1
package/dist/utilities.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { CppCas } from './binding';
|
2
1
|
import { DurabilityLevel } from './generaltypes';
|
3
2
|
/**
|
4
3
|
* CAS represents an opaque value which can be used to compare documents to
|
@@ -6,7 +5,7 @@ import { DurabilityLevel } from './generaltypes';
|
|
6
5
|
*
|
7
6
|
* @category Key-Value
|
8
7
|
*/
|
9
|
-
export declare type Cas =
|
8
|
+
export declare type Cas = any;
|
10
9
|
/**
|
11
10
|
* Reprents a node-style callback which receives an optional error or result.
|
12
11
|
*
|
@@ -68,4 +67,6 @@ export declare function nsServerStrToDuraLevel(level: string): DurabilityLevel;
|
|
68
67
|
*/
|
69
68
|
export declare function cbQsStringify(values: {
|
70
69
|
[key: string]: any;
|
70
|
+
}, options?: {
|
71
|
+
boolAsString?: boolean;
|
71
72
|
}): string;
|
package/dist/utilities.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
@@ -123,7 +127,7 @@ function goDurationStrToMs(str) {
|
|
123
127
|
if (str === undefined) {
|
124
128
|
return undefined;
|
125
129
|
}
|
126
|
-
const duration = parse_duration_1.default(str);
|
130
|
+
const duration = (0, parse_duration_1.default)(str);
|
127
131
|
if (duration === null) {
|
128
132
|
return undefined;
|
129
133
|
}
|
@@ -161,6 +165,9 @@ exports.duraLevelToNsServerStr = duraLevelToNsServerStr;
|
|
161
165
|
* @internal
|
162
166
|
*/
|
163
167
|
function nsServerStrToDuraLevel(level) {
|
168
|
+
if (level === undefined) {
|
169
|
+
return generaltypes_1.DurabilityLevel.None;
|
170
|
+
}
|
164
171
|
if (level === 'none') {
|
165
172
|
return generaltypes_1.DurabilityLevel.None;
|
166
173
|
}
|
@@ -181,14 +188,19 @@ exports.nsServerStrToDuraLevel = nsServerStrToDuraLevel;
|
|
181
188
|
/**
|
182
189
|
* @internal
|
183
190
|
*/
|
184
|
-
function cbQsStringify(values) {
|
191
|
+
function cbQsStringify(values, options) {
|
185
192
|
const cbValues = {};
|
186
193
|
for (const i in values) {
|
187
194
|
if (values[i] === undefined) {
|
188
195
|
// skipped
|
189
196
|
}
|
190
197
|
else if (typeof values[i] === 'boolean') {
|
191
|
-
|
198
|
+
if (options && options.boolAsString) {
|
199
|
+
cbValues[i] = values[i] ? 'true' : 'false';
|
200
|
+
}
|
201
|
+
else {
|
202
|
+
cbValues[i] = values[i] ? 1 : 0;
|
203
|
+
}
|
192
204
|
}
|
193
205
|
else {
|
194
206
|
cbValues[i] = values[i];
|
package/dist/viewexecutor.js
CHANGED
@@ -98,7 +98,7 @@ class ViewExecutor {
|
|
98
98
|
queryOpts.startkey_docid = options.idRange.start;
|
99
99
|
queryOpts.endkey_docid = options.idRange.end;
|
100
100
|
}
|
101
|
-
const queryData = utilities_1.cbQsStringify(queryOpts);
|
101
|
+
const queryData = (0, utilities_1.cbQsStringify)(queryOpts, { boolAsString: true });
|
102
102
|
const lcbTimeout = options.timeout ? options.timeout * 1000 : undefined;
|
103
103
|
const emitter = new streamablepromises_1.StreamableRowPromise((rows, meta) => {
|
104
104
|
return new viewtypes_1.ViewResult({
|
package/dist/viewindexmanager.js
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
3
|
exports.ViewIndexManager = exports.DesignDocument = exports.DesignDocumentView = void 0;
|
13
4
|
const errors_1 = require("./errors");
|
@@ -107,38 +98,36 @@ class ViewIndexManager {
|
|
107
98
|
* @param options Optional parameters for this operation.
|
108
99
|
* @param callback A node-style callback to be invoked after execution.
|
109
100
|
*/
|
110
|
-
getAllDesignDocuments(options, callback) {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
101
|
+
async getAllDesignDocuments(options, callback) {
|
102
|
+
if (options instanceof Function) {
|
103
|
+
callback = arguments[0];
|
104
|
+
options = undefined;
|
105
|
+
}
|
106
|
+
if (!options) {
|
107
|
+
options = {};
|
108
|
+
}
|
109
|
+
const parentSpan = options.parentSpan;
|
110
|
+
const timeout = options.timeout;
|
111
|
+
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
112
|
+
const bucketName = this._bucket.name;
|
113
|
+
const res = await this._http.request({
|
114
|
+
type: httpexecutor_1.HttpServiceType.Management,
|
115
|
+
method: httpexecutor_1.HttpMethod.Get,
|
116
|
+
path: `/pools/default/buckets/${bucketName}/ddocs`,
|
117
|
+
parentSpan: parentSpan,
|
118
|
+
timeout: timeout,
|
119
|
+
});
|
120
|
+
if (res.statusCode !== 200) {
|
121
|
+
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
122
|
+
throw new errors_1.CouchbaseError('failed to get design documents', undefined, errCtx);
|
118
123
|
}
|
119
|
-
const
|
120
|
-
const
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
path: `/pools/default/buckets/${bucketName}/ddocs`,
|
127
|
-
parentSpan: parentSpan,
|
128
|
-
timeout: timeout,
|
129
|
-
});
|
130
|
-
if (res.statusCode !== 200) {
|
131
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
132
|
-
throw new errors_1.CouchbaseError('failed to get design documents', undefined, errCtx);
|
133
|
-
}
|
134
|
-
const ddocsData = JSON.parse(res.body.toString());
|
135
|
-
const ddocs = ddocsData.rows.map((ddocData) => {
|
136
|
-
const ddocName = ddocData.doc.meta.id.substr(8);
|
137
|
-
return DesignDocument._fromNsData(ddocName, ddocData.doc.json);
|
138
|
-
});
|
139
|
-
return ddocs;
|
140
|
-
}), callback);
|
141
|
-
});
|
124
|
+
const ddocsData = JSON.parse(res.body.toString());
|
125
|
+
const ddocs = ddocsData.rows.map((ddocData) => {
|
126
|
+
const ddocName = ddocData.doc.meta.id.substr(8);
|
127
|
+
return DesignDocument._fromNsData(ddocName, ddocData.doc.json);
|
128
|
+
});
|
129
|
+
return ddocs;
|
130
|
+
}, callback);
|
142
131
|
}
|
143
132
|
/**
|
144
133
|
* Returns the specified design document.
|
@@ -147,36 +136,34 @@ class ViewIndexManager {
|
|
147
136
|
* @param options Optional parameters for this operation.
|
148
137
|
* @param callback A node-style callback to be invoked after execution.
|
149
138
|
*/
|
150
|
-
getDesignDocument(designDocName, options, callback) {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
173
|
-
}
|
174
|
-
throw new errors_1.CouchbaseError('failed to get the design document', undefined, errCtx);
|
139
|
+
async getDesignDocument(designDocName, options, callback) {
|
140
|
+
if (options instanceof Function) {
|
141
|
+
callback = arguments[1];
|
142
|
+
options = undefined;
|
143
|
+
}
|
144
|
+
if (!options) {
|
145
|
+
options = {};
|
146
|
+
}
|
147
|
+
const parentSpan = options.parentSpan;
|
148
|
+
const timeout = options.timeout;
|
149
|
+
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
150
|
+
const res = await this._http.request({
|
151
|
+
type: httpexecutor_1.HttpServiceType.Views,
|
152
|
+
method: httpexecutor_1.HttpMethod.Get,
|
153
|
+
path: `/_design/${designDocName}`,
|
154
|
+
parentSpan: parentSpan,
|
155
|
+
timeout: timeout,
|
156
|
+
});
|
157
|
+
if (res.statusCode !== 200) {
|
158
|
+
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
159
|
+
if (res.statusCode === 404) {
|
160
|
+
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
175
161
|
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
162
|
+
throw new errors_1.CouchbaseError('failed to get the design document', undefined, errCtx);
|
163
|
+
}
|
164
|
+
const ddocData = JSON.parse(res.body.toString());
|
165
|
+
return DesignDocument._fromNsData(designDocName, ddocData);
|
166
|
+
}, callback);
|
180
167
|
}
|
181
168
|
/**
|
182
169
|
* Creates or updates a design document.
|
@@ -185,37 +172,35 @@ class ViewIndexManager {
|
|
185
172
|
* @param options Optional parameters for this operation.
|
186
173
|
* @param callback A node-style callback to be invoked after execution.
|
187
174
|
*/
|
188
|
-
upsertDesignDocument(designDoc, options, callback) {
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
175
|
+
async upsertDesignDocument(designDoc, options, callback) {
|
176
|
+
if (options instanceof Function) {
|
177
|
+
callback = arguments[1];
|
178
|
+
options = undefined;
|
179
|
+
}
|
180
|
+
if (!options) {
|
181
|
+
options = {};
|
182
|
+
}
|
183
|
+
const parentSpan = options.parentSpan;
|
184
|
+
const timeout = options.timeout;
|
185
|
+
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
186
|
+
const designDocData = {
|
187
|
+
views: designDoc.views,
|
188
|
+
};
|
189
|
+
const encodedData = JSON.stringify(designDocData);
|
190
|
+
const res = await this._http.request({
|
191
|
+
type: httpexecutor_1.HttpServiceType.Views,
|
192
|
+
method: httpexecutor_1.HttpMethod.Put,
|
193
|
+
path: `/_design/${designDoc.name}`,
|
194
|
+
contentType: 'application/json',
|
195
|
+
body: encodedData,
|
196
|
+
parentSpan: parentSpan,
|
197
|
+
timeout: timeout,
|
198
|
+
});
|
199
|
+
if (res.statusCode !== 201) {
|
200
|
+
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
201
|
+
throw new errors_1.CouchbaseError('failed to upsert the design document', undefined, errCtx);
|
196
202
|
}
|
197
|
-
|
198
|
-
const timeout = options.timeout;
|
199
|
-
return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
|
200
|
-
const designDocData = {
|
201
|
-
views: designDoc.views,
|
202
|
-
};
|
203
|
-
const encodedData = JSON.stringify(designDocData);
|
204
|
-
const res = yield this._http.request({
|
205
|
-
type: httpexecutor_1.HttpServiceType.Views,
|
206
|
-
method: httpexecutor_1.HttpMethod.Put,
|
207
|
-
path: `/_design/${designDoc.name}`,
|
208
|
-
contentType: 'application/json',
|
209
|
-
body: encodedData,
|
210
|
-
parentSpan: parentSpan,
|
211
|
-
timeout: timeout,
|
212
|
-
});
|
213
|
-
if (res.statusCode !== 201) {
|
214
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
215
|
-
throw new errors_1.CouchbaseError('failed to upsert the design document', undefined, errCtx);
|
216
|
-
}
|
217
|
-
}), callback);
|
218
|
-
});
|
203
|
+
}, callback);
|
219
204
|
}
|
220
205
|
/**
|
221
206
|
* Drops an existing design document.
|
@@ -224,34 +209,32 @@ class ViewIndexManager {
|
|
224
209
|
* @param options Optional parameters for this operation.
|
225
210
|
* @param callback A node-style callback to be invoked after execution.
|
226
211
|
*/
|
227
|
-
dropDesignDocument(designDocName, options, callback) {
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
250
|
-
}
|
251
|
-
throw new errors_1.CouchbaseError('failed to drop the design document', undefined, errCtx);
|
212
|
+
async dropDesignDocument(designDocName, options, callback) {
|
213
|
+
if (options instanceof Function) {
|
214
|
+
callback = arguments[1];
|
215
|
+
options = undefined;
|
216
|
+
}
|
217
|
+
if (!options) {
|
218
|
+
options = {};
|
219
|
+
}
|
220
|
+
const parentSpan = options.parentSpan;
|
221
|
+
const timeout = options.timeout;
|
222
|
+
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
223
|
+
const res = await this._http.request({
|
224
|
+
type: httpexecutor_1.HttpServiceType.Views,
|
225
|
+
method: httpexecutor_1.HttpMethod.Delete,
|
226
|
+
path: `/_design/${designDocName}`,
|
227
|
+
parentSpan: parentSpan,
|
228
|
+
timeout: timeout,
|
229
|
+
});
|
230
|
+
if (res.statusCode !== 200) {
|
231
|
+
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
232
|
+
if (res.statusCode === 404) {
|
233
|
+
throw new errors_1.DesignDocumentNotFoundError(undefined, errCtx);
|
252
234
|
}
|
253
|
-
|
254
|
-
|
235
|
+
throw new errors_1.CouchbaseError('failed to drop the design document', undefined, errCtx);
|
236
|
+
}
|
237
|
+
}, callback);
|
255
238
|
}
|
256
239
|
/**
|
257
240
|
* Publishes a development design document to be a production design document.
|
@@ -263,30 +246,28 @@ class ViewIndexManager {
|
|
263
246
|
* @param options Optional parameters for this operation.
|
264
247
|
* @param callback A node-style callback to be invoked after execution.
|
265
248
|
*/
|
266
|
-
publishDesignDocument(designDocName, options, callback) {
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
}), callback);
|
289
|
-
});
|
249
|
+
async publishDesignDocument(designDocName, options, callback) {
|
250
|
+
if (options instanceof Function) {
|
251
|
+
callback = arguments[1];
|
252
|
+
options = undefined;
|
253
|
+
}
|
254
|
+
if (!options) {
|
255
|
+
options = {};
|
256
|
+
}
|
257
|
+
const parentSpan = options.parentSpan;
|
258
|
+
const timeout = options.timeout;
|
259
|
+
const timer = new utilities_1.CompoundTimeout(timeout);
|
260
|
+
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
261
|
+
const designDoc = await this.getDesignDocument(`dev_${designDocName}`, {
|
262
|
+
parentSpan: parentSpan,
|
263
|
+
timeout: timer.left(),
|
264
|
+
});
|
265
|
+
// Replace the name without the `dev_` prefix on it.
|
266
|
+
designDoc.name = designDocName;
|
267
|
+
await this.upsertDesignDocument(designDoc, {
|
268
|
+
timeout: timer.left(),
|
269
|
+
});
|
270
|
+
}, callback);
|
290
271
|
}
|
291
272
|
}
|
292
273
|
exports.ViewIndexManager = ViewIndexManager;
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"bugs":{"url":"http://www.couchbase.com/issues/browse/JSCBC"},"description":"The official Couchbase Node.js Client Library.","engines":{"node":">=10.0.0"},"homepage":"http://www.couchbase.com/communities/nodejs","keywords":["couchbase","libcouchbase","memcached","nosql","json","document"],"main":"dist/couchbase.js","types":"dist/couchbase.d.ts","license":"Apache-2.0","name":"couchbase","dependencies":{"bindings":"^1.5.0","debug":"^4.3.
|
1
|
+
{"bugs":{"url":"http://www.couchbase.com/issues/browse/JSCBC"},"description":"The official Couchbase Node.js Client Library.","engines":{"node":">=10.0.0"},"homepage":"http://www.couchbase.com/communities/nodejs","keywords":["couchbase","libcouchbase","memcached","nosql","json","document"],"main":"dist/couchbase.js","types":"dist/couchbase.d.ts","license":"Apache-2.0","name":"couchbase","dependencies":{"bindings":"^1.5.0","debug":"^4.3.4","nan":"^2.15.0","parse-duration":"^1.0.2","prebuild-install":"^7.0.1"},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^3.2.0","@tsconfig/node10":"^1.0.8","@types/bindings":"^1.5.1","@types/debug":"^4.1.7","@types/node":"^17.0.23","@typescript-eslint/eslint-plugin":"^5.18.0","@typescript-eslint/parser":"^5.18.0","chai":"^4.3.6","eslint":"^8.12.0","eslint-config-prettier":"^8.5.0","eslint-plugin-jsdoc":"^38.1.6","eslint-plugin-mocha":"^10.0.3","eslint-plugin-node":"^11.1.0","expose-gc":"^1.0.0","mocha":"^9.2.2","npm-check-updates":"^12.5.8","nyc":"^15.1.0","prebuild":"^11.0.3","prettier":"^2.6.2","segfault-handler":"^1.3.0","semver":"^7.3.6","ts-mocha":"^9.0.2","ts-node":"^10.7.0","typedoc":"^0.22.13","typescript":"^4.6.3","uuid":"^8.3.2"},"repository":{"type":"git","url":"http://github.com/couchbase/couchnode.git"},"version":"3.2.5","config":{"native":false},"scripts":{"install":"prebuild-install || node-gyp rebuild","build":"node-gyp build && tsc","rebuild":"node-gyp rebuild && tsc","prebuild":"prebuild --verbose --strip","prepare":"tsc","build-docs":"typedoc","test":"ts-mocha test/*.test.*","test-fast":"ts-mocha test/*.test.* -ig '(slow)'","cover":"nyc ts-mocha test/*.test.*","cover-fast":"nyc ts-mocha test/*.test.* -ig '(slow)'","lint":"eslint ./lib/ ./test/","check-deps":"ncu"}}
|
package/src/connection.cpp
CHANGED
package/src/constants.cpp
CHANGED
@@ -67,6 +67,8 @@ NAN_MODULE_INIT(Init)
|
|
67
67
|
X(LCB_ERR_SCOPE_NOT_FOUND)
|
68
68
|
X(LCB_ERR_INDEX_NOT_FOUND)
|
69
69
|
X(LCB_ERR_INDEX_EXISTS)
|
70
|
+
X(LCB_ERR_RATE_LIMITED)
|
71
|
+
X(LCB_ERR_QUOTA_LIMITED)
|
70
72
|
X(LCB_ERR_DOCUMENT_NOT_FOUND)
|
71
73
|
X(LCB_ERR_DOCUMENT_UNRETRIEVABLE)
|
72
74
|
X(LCB_ERR_DOCUMENT_LOCKED)
|
package/src/instance.cpp
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "instance.h"
|
2
|
+
#include "connection.h"
|
2
3
|
|
3
4
|
#include "error.h"
|
4
5
|
#include "logger.h"
|
@@ -8,7 +9,8 @@ namespace couchnode
|
|
8
9
|
|
9
10
|
Instance::Instance(lcb_INSTANCE *instance, Logger *logger,
|
10
11
|
RequestTracer *tracer, Meter *meter)
|
11
|
-
:
|
12
|
+
: _connection(nullptr)
|
13
|
+
, _instance(instance)
|
12
14
|
, _logger(logger)
|
13
15
|
, _tracer(tracer)
|
14
16
|
, _meter(meter)
|
@@ -73,6 +75,11 @@ Instance::Instance(lcb_INSTANCE *instance, Logger *logger,
|
|
73
75
|
|
74
76
|
Instance::~Instance()
|
75
77
|
{
|
78
|
+
if (_connection) {
|
79
|
+
_connection->_instance = nullptr;
|
80
|
+
_connection = nullptr;
|
81
|
+
}
|
82
|
+
|
76
83
|
if (_parent) {
|
77
84
|
_parent->remove_instance(this);
|
78
85
|
_parent = nullptr;
|
package/src/instance.h
CHANGED
package/src/uv-plugin-all.cpp
CHANGED
package/dist/cas.d.ts
DELETED
File without changes
|
package/dist/cas.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";
|