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,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
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -26,51 +17,47 @@ class DiagnoticsExecutor {
26
17
  constructor(conns) {
27
18
  this._conns = conns;
28
19
  }
29
- singleDiagnostics(conn) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- return new Promise((resolve, reject) => {
32
- conn.diag(undefined, (err, data) => {
33
- if (err) {
34
- return reject(err);
35
- }
36
- const parsedReport = JSON.parse(data);
37
- resolve(parsedReport);
38
- });
20
+ async singleDiagnostics(conn) {
21
+ return new Promise((resolve, reject) => {
22
+ conn.diag(undefined, (err, data) => {
23
+ if (err) {
24
+ return reject(err);
25
+ }
26
+ const parsedReport = JSON.parse(data);
27
+ resolve(parsedReport);
39
28
  });
40
29
  });
41
30
  }
42
- diagnostics(options) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- if (this._conns.length === 0) {
45
- throw new Error('found no connections to test');
46
- }
47
- const diagReses = yield Promise.all(this._conns.map((conn) => this.singleDiagnostics(conn)));
48
- const baseConfig = diagReses[0];
49
- const report = {
50
- id: baseConfig.id,
51
- version: baseConfig.version,
52
- sdk: baseConfig.sdk,
53
- services: [],
54
- };
55
- if (options.reportId) {
56
- report.id = options.reportId;
57
- }
58
- diagReses.forEach((diagRes) => {
59
- if (diagRes.config) {
60
- diagRes.config.forEach((svcDiagRes) => {
61
- report.services.push({
62
- id: svcDiagRes.id,
63
- type: svcDiagRes.type,
64
- local: svcDiagRes.local,
65
- remote: svcDiagRes.remote,
66
- lastActivity: svcDiagRes.last_activity_us,
67
- status: svcDiagRes.status,
68
- });
31
+ async diagnostics(options) {
32
+ if (this._conns.length === 0) {
33
+ throw new Error('found no connections to test');
34
+ }
35
+ const diagReses = await Promise.all(this._conns.map((conn) => this.singleDiagnostics(conn)));
36
+ const baseConfig = diagReses[0];
37
+ const report = {
38
+ id: baseConfig.id,
39
+ version: baseConfig.version,
40
+ sdk: baseConfig.sdk,
41
+ services: [],
42
+ };
43
+ if (options.reportId) {
44
+ report.id = options.reportId;
45
+ }
46
+ diagReses.forEach((diagRes) => {
47
+ if (diagRes.config) {
48
+ diagRes.config.forEach((svcDiagRes) => {
49
+ report.services.push({
50
+ id: svcDiagRes.id,
51
+ type: svcDiagRes.type,
52
+ local: svcDiagRes.local,
53
+ remote: svcDiagRes.remote,
54
+ lastActivity: svcDiagRes.last_activity_us,
55
+ status: svcDiagRes.status,
69
56
  });
70
- }
71
- });
72
- return report;
57
+ });
58
+ }
73
59
  });
60
+ return report;
74
61
  }
75
62
  }
76
63
  exports.DiagnoticsExecutor = DiagnoticsExecutor;
@@ -84,42 +71,40 @@ class PingExecutor {
84
71
  constructor(conn) {
85
72
  this._conn = conn;
86
73
  }
87
- ping(options) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- let serviceFlags = 0;
90
- if (Array.isArray(options.serviceTypes)) {
91
- options.serviceTypes.forEach((serviceType) => {
92
- if (serviceType === generaltypes_1.ServiceType.KeyValue) {
93
- serviceFlags |= binding_1.default.LCBX_SERVICETYPE_KEYVALUE;
94
- }
95
- else if (serviceType === generaltypes_1.ServiceType.Views) {
96
- serviceFlags |= binding_1.default.LCBX_SERVICETYPE_VIEWS;
97
- }
98
- else if (serviceType === generaltypes_1.ServiceType.Query) {
99
- serviceFlags |= binding_1.default.LCBX_SERVICETYPE_QUERY;
100
- }
101
- else if (serviceType === generaltypes_1.ServiceType.Search) {
102
- serviceFlags |= binding_1.default.LCBX_SERVICETYPE_SEARCH;
103
- }
104
- else if (serviceType === generaltypes_1.ServiceType.Analytics) {
105
- serviceFlags |= binding_1.default.LCBX_SERVICETYPE_ANALYTICS;
106
- }
107
- else {
108
- throw new Error('invalid service type');
109
- }
110
- });
111
- }
112
- const reportId = options.reportId;
113
- const parentSpan = options.parentSpan;
114
- const timeout = options.timeout;
115
- return new Promise((resolve, reject) => {
116
- this._conn.ping(reportId, serviceFlags, parentSpan, timeout, (err, data) => {
117
- if (err) {
118
- return reject(err);
119
- }
120
- const parsedReport = JSON.parse(data);
121
- resolve(parsedReport);
122
- });
74
+ async ping(options) {
75
+ let serviceFlags = 0;
76
+ if (Array.isArray(options.serviceTypes)) {
77
+ options.serviceTypes.forEach((serviceType) => {
78
+ if (serviceType === generaltypes_1.ServiceType.KeyValue) {
79
+ serviceFlags |= binding_1.default.LCBX_SERVICETYPE_KEYVALUE;
80
+ }
81
+ else if (serviceType === generaltypes_1.ServiceType.Views) {
82
+ serviceFlags |= binding_1.default.LCBX_SERVICETYPE_VIEWS;
83
+ }
84
+ else if (serviceType === generaltypes_1.ServiceType.Query) {
85
+ serviceFlags |= binding_1.default.LCBX_SERVICETYPE_QUERY;
86
+ }
87
+ else if (serviceType === generaltypes_1.ServiceType.Search) {
88
+ serviceFlags |= binding_1.default.LCBX_SERVICETYPE_SEARCH;
89
+ }
90
+ else if (serviceType === generaltypes_1.ServiceType.Analytics) {
91
+ serviceFlags |= binding_1.default.LCBX_SERVICETYPE_ANALYTICS;
92
+ }
93
+ else {
94
+ throw new Error('invalid service type');
95
+ }
96
+ });
97
+ }
98
+ const reportId = options.reportId;
99
+ const parentSpan = options.parentSpan;
100
+ const timeout = options.timeout;
101
+ return new Promise((resolve, reject) => {
102
+ this._conn.ping(reportId, serviceFlags, parentSpan, timeout, (err, data) => {
103
+ if (err) {
104
+ return reject(err);
105
+ }
106
+ const parsedReport = JSON.parse(data);
107
+ resolve(parsedReport);
123
108
  });
124
109
  });
125
110
  }
package/dist/errors.d.ts CHANGED
@@ -217,6 +217,24 @@ export declare class ScopeNotFoundError extends CouchbaseError {
217
217
  export declare class IndexNotFoundError extends CouchbaseError {
218
218
  constructor(cause?: Error, context?: ErrorContext);
219
219
  }
220
+ /**
221
+ * Indicates that a rate limit was exceeded while attempting to
222
+ * execute the operation.
223
+ *
224
+ * @category Error Handling
225
+ */
226
+ export declare class RateLimitedError extends CouchbaseError {
227
+ constructor(cause?: Error, context?: ErrorContext);
228
+ }
229
+ /**
230
+ * Indicates that a quota limit was exceeded while attempting to
231
+ * execute the operation.
232
+ *
233
+ * @category Error Handling
234
+ */
235
+ export declare class QuotaLimitedError extends CouchbaseError {
236
+ constructor(cause?: Error, context?: ErrorContext);
237
+ }
220
238
  /**
221
239
  * Indicates that the referenced index already existed, but was expected
222
240
  * to not yet exist for the operation.
package/dist/errors.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexFailureError = exports.PlanningFailureError = exports.PathExistsError = exports.DeltaInvalidError = exports.NumberTooBigError = exports.DocumentNotJsonError = exports.ValueInvalidError = exports.ValueTooDeepError = exports.PathTooDeepError = exports.PathTooBigError = exports.PathInvalidError = exports.PathMismatchError = exports.PathNotFoundError = exports.MutationLostError = exports.DurableWriteReCommitInProgressError = exports.DurableWriteInProgressError = exports.DurabilityAmbiguousError = exports.DurabilityImpossibleError = exports.DurabilityLevelNotAvailableError = exports.ValueNotJsonError = exports.DocumentExistsError = exports.ValueTooLargeError = exports.DocumentLockedError = exports.DocumentUnretrievableError = exports.DocumentNotFoundError = exports.IndexExistsError = exports.IndexNotFoundError = exports.ScopeNotFoundError = exports.FeatureNotAvailableError = exports.UnambiguousTimeoutError = exports.AmbiguousTimeoutError = exports.UnsupportedOperationError = exports.DecodingFailureError = exports.EncodingFailureError = exports.CollectionNotFoundError = exports.BucketNotFoundError = exports.CasMismatchError = exports.ParsingFailureError = exports.TemporaryFailureError = exports.AuthenticationFailureError = exports.InternalServerFailureError = exports.ServiceNotAvailableError = exports.InvalidArgumentError = exports.RequestCanceledError = exports.TimeoutError = exports.InvalidDurabilityLevel = exports.NeedOpenBucketError = exports.ClusterClosedError = exports.ConnectionClosedError = exports.CouchbaseError = void 0;
4
- exports.EventingFunctionDeployedError = exports.EventingFunctionNotBootstrappedError = exports.EventingFunctionIdenticalKeyspaceError = exports.EventingFunctionCompilationFailureError = exports.EventingFunctionNotDeployedError = exports.EventingFunctionNotFoundError = exports.BucketNotFlushableError = exports.UserExistsError = exports.BucketExistsError = exports.GroupNotFoundError = exports.UserNotFoundError = exports.ScopeExistsError = exports.CollectionExistsError = exports.DesignDocumentNotFoundError = exports.ViewNotFoundError = exports.LinkExistsError = exports.LinkNotFoundError = exports.DataverseExistsError = exports.DatasetExistsError = exports.DataverseNotFoundError = exports.DatasetNotFoundError = exports.JobQueueFullError = exports.CompilationFailureError = exports.PreparedStatementFailureError = void 0;
3
+ exports.PathExistsError = exports.DeltaInvalidError = exports.NumberTooBigError = exports.DocumentNotJsonError = exports.ValueInvalidError = exports.ValueTooDeepError = exports.PathTooDeepError = exports.PathTooBigError = exports.PathInvalidError = exports.PathMismatchError = exports.PathNotFoundError = exports.MutationLostError = exports.DurableWriteReCommitInProgressError = exports.DurableWriteInProgressError = exports.DurabilityAmbiguousError = exports.DurabilityImpossibleError = exports.DurabilityLevelNotAvailableError = exports.ValueNotJsonError = exports.DocumentExistsError = exports.ValueTooLargeError = exports.DocumentLockedError = exports.DocumentUnretrievableError = exports.DocumentNotFoundError = exports.IndexExistsError = exports.QuotaLimitedError = exports.RateLimitedError = exports.IndexNotFoundError = exports.ScopeNotFoundError = exports.FeatureNotAvailableError = exports.UnambiguousTimeoutError = exports.AmbiguousTimeoutError = exports.UnsupportedOperationError = exports.DecodingFailureError = exports.EncodingFailureError = exports.CollectionNotFoundError = exports.BucketNotFoundError = exports.CasMismatchError = exports.ParsingFailureError = exports.TemporaryFailureError = exports.AuthenticationFailureError = exports.InternalServerFailureError = exports.ServiceNotAvailableError = exports.InvalidArgumentError = exports.RequestCanceledError = exports.TimeoutError = exports.InvalidDurabilityLevel = exports.NeedOpenBucketError = exports.ClusterClosedError = exports.ConnectionClosedError = exports.CouchbaseError = void 0;
4
+ exports.EventingFunctionDeployedError = exports.EventingFunctionNotBootstrappedError = exports.EventingFunctionIdenticalKeyspaceError = exports.EventingFunctionCompilationFailureError = exports.EventingFunctionNotDeployedError = exports.EventingFunctionNotFoundError = exports.BucketNotFlushableError = exports.UserExistsError = exports.BucketExistsError = exports.GroupNotFoundError = exports.UserNotFoundError = exports.ScopeExistsError = exports.CollectionExistsError = exports.DesignDocumentNotFoundError = exports.ViewNotFoundError = exports.LinkExistsError = exports.LinkNotFoundError = exports.DataverseExistsError = exports.DatasetExistsError = exports.DataverseNotFoundError = exports.DatasetNotFoundError = exports.JobQueueFullError = exports.CompilationFailureError = exports.PreparedStatementFailureError = exports.IndexFailureError = exports.PlanningFailureError = void 0;
5
5
  require("./errorcontexts");
6
6
  /**
7
7
  * A generic base error that all errors inherit. Exposes the cause and
@@ -288,6 +288,30 @@ class IndexNotFoundError extends CouchbaseError {
288
288
  }
289
289
  }
290
290
  exports.IndexNotFoundError = IndexNotFoundError;
291
+ /**
292
+ * Indicates that a rate limit was exceeded while attempting to
293
+ * execute the operation.
294
+ *
295
+ * @category Error Handling
296
+ */
297
+ class RateLimitedError extends CouchbaseError {
298
+ constructor(cause, context) {
299
+ super('operation was rate limited', cause, context);
300
+ }
301
+ }
302
+ exports.RateLimitedError = RateLimitedError;
303
+ /**
304
+ * Indicates that a quota limit was exceeded while attempting to
305
+ * execute the operation.
306
+ *
307
+ * @category Error Handling
308
+ */
309
+ class QuotaLimitedError extends CouchbaseError {
310
+ constructor(cause, context) {
311
+ super('operation was quota limited', cause, context);
312
+ }
313
+ }
314
+ exports.QuotaLimitedError = QuotaLimitedError;
291
315
  /**
292
316
  * Indicates that the referenced index already existed, but was expected
293
317
  * to not yet exist for the operation.