couchbase 3.2.2 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/binding.gyp +5 -0
  2. package/deps/lcb/CMakeLists.txt +1 -1
  3. package/deps/lcb/CONTRIBUTING.md +1 -1
  4. package/deps/lcb/README.markdown +2 -2
  5. package/deps/lcb/RELEASE_NOTES.markdown +84 -17
  6. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  7. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  8. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
  9. package/deps/lcb/doc/Doxyfile +1 -1
  10. package/deps/lcb/example/minimal/query.c +9 -7
  11. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  12. package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
  13. package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
  14. package/deps/lcb/include/libcouchbase/error.h +6 -1
  15. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  16. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  17. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  18. package/deps/lcb/libcouchbase.gyp +353 -349
  19. package/deps/lcb/packaging/deb/control +1 -1
  20. package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
  21. package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
  22. package/deps/lcb/src/capi/cmd_counter.hh +18 -0
  23. package/deps/lcb/src/capi/cmd_exists.hh +18 -0
  24. package/deps/lcb/src/capi/cmd_get.hh +17 -0
  25. package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
  26. package/deps/lcb/src/capi/cmd_query.cc +13 -0
  27. package/deps/lcb/src/capi/cmd_query.hh +22 -14
  28. package/deps/lcb/src/capi/cmd_remove.hh +18 -0
  29. package/deps/lcb/src/capi/cmd_search.hh +6 -0
  30. package/deps/lcb/src/capi/cmd_store.hh +28 -21
  31. package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
  32. package/deps/lcb/src/capi/cmd_touch.hh +18 -0
  33. package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
  34. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  35. package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
  36. package/deps/lcb/src/cntl.cc +42 -8
  37. package/deps/lcb/src/dns-srv.cc +5 -3
  38. package/deps/lcb/src/errmap.cc +5 -9
  39. package/deps/lcb/src/errmap.h +7 -3
  40. package/deps/lcb/src/handler.cc +24 -18
  41. package/deps/lcb/src/internal.h +2 -1
  42. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  43. package/deps/lcb/src/mcserver/mcserver.cc +8 -5
  44. package/deps/lcb/src/mcserver/negotiate.cc +42 -17
  45. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  46. package/deps/lcb/src/n1ql/n1ql.cc +5 -1
  47. package/deps/lcb/src/n1ql/query_handle.cc +80 -44
  48. package/deps/lcb/src/n1ql/query_handle.hh +41 -3
  49. package/deps/lcb/src/operations/counter.cc +13 -1
  50. package/deps/lcb/src/operations/exists.cc +14 -2
  51. package/deps/lcb/src/operations/get.cc +14 -2
  52. package/deps/lcb/src/operations/get_replica.cc +18 -6
  53. package/deps/lcb/src/operations/observe.cc +1 -1
  54. package/deps/lcb/src/operations/remove.cc +13 -1
  55. package/deps/lcb/src/operations/store.cc +13 -1
  56. package/deps/lcb/src/operations/subdoc.cc +13 -2
  57. package/deps/lcb/src/operations/touch.cc +14 -2
  58. package/deps/lcb/src/operations/unlock.cc +14 -2
  59. package/deps/lcb/src/search/search_handle.cc +26 -8
  60. package/deps/lcb/src/search/search_handle.hh +29 -0
  61. package/deps/lcb/src/ssl/ssl_common.c +7 -8
  62. package/deps/lcb/src/tracing/span.cc +43 -10
  63. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  64. package/deps/lcb/src/utilities.cc +21 -0
  65. package/deps/lcb/src/utilities.h +3 -0
  66. package/deps/lcb/src/views/view_handle.cc +13 -5
  67. package/deps/lcb/src/views/view_handle.hh +29 -0
  68. package/deps/lcb/tests/CMakeLists.txt +21 -0
  69. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  70. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  71. package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
  72. package/deps/lcb/tests/iotests/mock-environment.h +49 -1
  73. package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
  74. package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
  75. package/deps/lcb/tests/iotests/serverparams.h +7 -2
  76. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  77. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  78. package/deps/lcb/tests/iotests/t_get.cc +14 -4
  79. package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
  80. package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
  81. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  82. package/deps/lcb/tests/iotests/testutil.cc +342 -0
  83. package/deps/lcb/tests/iotests/testutil.h +164 -0
  84. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  85. package/deps/lcb/tests/mocksupport/server.c +0 -1
  86. package/deps/lcb/tools/cbc.cc +7 -0
  87. package/dist/analyticsexecutor.js +2 -2
  88. package/dist/analyticsindexmanager.js +512 -524
  89. package/dist/binarycollection.d.ts +17 -0
  90. package/dist/binding.d.ts +2 -0
  91. package/dist/binding.js +1 -1
  92. package/dist/bindingutilities.js +9 -1
  93. package/dist/bucketmanager.d.ts +32 -23
  94. package/dist/bucketmanager.js +197 -189
  95. package/dist/cluster.js +37 -36
  96. package/dist/collection.js +17 -23
  97. package/dist/collectionmanager.js +181 -200
  98. package/dist/connection.js +6 -3
  99. package/dist/connspec.js +5 -1
  100. package/dist/couchbase.js +7 -14
  101. package/dist/datastructures.js +239 -310
  102. package/dist/diagnosticsexecutor.js +70 -85
  103. package/dist/errors.d.ts +18 -0
  104. package/dist/errors.js +26 -2
  105. package/dist/eventingfunctionmanager.js +267 -294
  106. package/dist/httpexecutor.js +31 -38
  107. package/dist/logging.js +1 -1
  108. package/dist/queryexecutor.js +3 -3
  109. package/dist/queryindexmanager.js +236 -263
  110. package/dist/scope.js +8 -2
  111. package/dist/searchexecutor.js +3 -0
  112. package/dist/searchindexmanager.js +240 -271
  113. package/dist/searchquery.d.ts +17 -0
  114. package/dist/searchquery.js +22 -1
  115. package/dist/searchtypes.d.ts +7 -2
  116. package/dist/searchtypes.js +2 -2
  117. package/dist/usermanager.js +250 -263
  118. package/dist/utilities.d.ts +3 -2
  119. package/dist/utilities.js +16 -4
  120. package/dist/viewexecutor.js +1 -1
  121. package/dist/viewindexmanager.js +131 -150
  122. package/package.json +1 -1
  123. package/src/connection.cpp +2 -0
  124. package/src/constants.cpp +2 -0
  125. package/src/instance.cpp +8 -1
  126. package/src/instance.h +1 -0
  127. package/src/uv-plugin-all.cpp +1 -0
  128. package/dist/cas.d.ts +0 -0
  129. package/dist/cas.js +0 -1
@@ -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 = CppCas;
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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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
- cbValues[i] = values[i] ? 1 : 0;
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];
@@ -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({
@@ -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
- return __awaiter(this, arguments, void 0, function* () {
112
- if (options instanceof Function) {
113
- callback = arguments[0];
114
- options = undefined;
115
- }
116
- if (!options) {
117
- options = {};
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 parentSpan = options.parentSpan;
120
- const timeout = options.timeout;
121
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
122
- const bucketName = this._bucket.name;
123
- const res = yield this._http.request({
124
- type: httpexecutor_1.HttpServiceType.Management,
125
- method: httpexecutor_1.HttpMethod.Get,
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
- return __awaiter(this, arguments, void 0, function* () {
152
- if (options instanceof Function) {
153
- callback = arguments[1];
154
- options = undefined;
155
- }
156
- if (!options) {
157
- options = {};
158
- }
159
- const parentSpan = options.parentSpan;
160
- const timeout = options.timeout;
161
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
162
- const res = yield this._http.request({
163
- type: httpexecutor_1.HttpServiceType.Views,
164
- method: httpexecutor_1.HttpMethod.Get,
165
- path: `/_design/${designDocName}`,
166
- parentSpan: parentSpan,
167
- timeout: timeout,
168
- });
169
- if (res.statusCode !== 200) {
170
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
171
- if (res.statusCode === 404) {
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
- const ddocData = JSON.parse(res.body.toString());
177
- return DesignDocument._fromNsData(designDocName, ddocData);
178
- }), callback);
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
- return __awaiter(this, arguments, void 0, function* () {
190
- if (options instanceof Function) {
191
- callback = arguments[2];
192
- options = undefined;
193
- }
194
- if (!options) {
195
- options = {};
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
- const parentSpan = options.parentSpan;
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
- return __awaiter(this, arguments, void 0, function* () {
229
- if (options instanceof Function) {
230
- callback = arguments[1];
231
- options = undefined;
232
- }
233
- if (!options) {
234
- options = {};
235
- }
236
- const parentSpan = options.parentSpan;
237
- const timeout = options.timeout;
238
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
239
- const res = yield this._http.request({
240
- type: httpexecutor_1.HttpServiceType.Views,
241
- method: httpexecutor_1.HttpMethod.Delete,
242
- path: `/_design/${designDocName}`,
243
- parentSpan: parentSpan,
244
- timeout: timeout,
245
- });
246
- if (res.statusCode !== 200) {
247
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
248
- if (res.statusCode === 404) {
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
- }), callback);
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
- return __awaiter(this, arguments, void 0, function* () {
268
- if (options instanceof Function) {
269
- callback = arguments[1];
270
- options = undefined;
271
- }
272
- if (!options) {
273
- options = {};
274
- }
275
- const parentSpan = options.parentSpan;
276
- const timeout = options.timeout;
277
- const timer = new utilities_1.CompoundTimeout(timeout);
278
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
279
- const designDoc = yield this.getDesignDocument(`dev_${designDocName}`, {
280
- parentSpan: parentSpan,
281
- timeout: timer.left(),
282
- });
283
- // Replace the name without the `dev_` prefix on it.
284
- designDoc.name = designDocName;
285
- yield this.upsertDesignDocument(designDoc, {
286
- timeout: timer.left(),
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.2","nan":"^2.15.0","parse-duration":"^1.0.0","prebuild-install":"^6.1.4"},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^2.0.4","@types/bindings":"^1.5.1","@types/debug":"^4.1.7","@types/node":"^16.7.2","@typescript-eslint/eslint-plugin":"^4.29.3","@typescript-eslint/parser":"^4.29.3","chai":"^4.3.4","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jsdoc":"^36.0.8","eslint-plugin-mocha":"^9.0.0","eslint-plugin-node":"^11.1.0","expose-gc":"^1.0.0","mocha":"^8.4.0","npm-check-updates":"^11.8.3","nyc":"^15.1.0","prebuild":"^10.0.1","prettier":"^2.3.2","semver":"^7.3.5","ts-mocha":"^8.0.0","ts-node":"^10.2.1","typedoc":"^0.21.6","typescript":"^4.3.5","uuid":"^8.3.2"},"repository":{"type":"git","url":"http://github.com/couchbase/couchnode.git"},"version":"3.2.2","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"}}
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"}}
@@ -207,6 +207,8 @@ NAN_METHOD(Connection::fnNew)
207
207
  Connection *obj = new Connection(inst);
208
208
  obj->Wrap(info.This());
209
209
 
210
+ inst->_connection = obj;
211
+
210
212
  info.GetReturnValue().Set(info.This());
211
213
  }
212
214
 
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
- : _instance(instance)
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
@@ -84,6 +84,7 @@ public:
84
84
  const lcb_RESPHTTP *resp);
85
85
 
86
86
  AddonData *_parent;
87
+ class Connection *_connection;
87
88
  lcb_INSTANCE *_instance;
88
89
  Logger *_logger;
89
90
  RequestTracer *_tracer;
@@ -1 +1,2 @@
1
+ #define LIBCOUCHBASE_INTERNAL
1
2
  #include <libcouchbase/plugins/io/libuv/plugin-libuv.c>
package/dist/cas.d.ts DELETED
File without changes
package/dist/cas.js DELETED
@@ -1 +0,0 @@
1
- "use strict";