couchbase 4.4.5 → 4.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +64 -33
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
- package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/CMakeLists.txt +14 -10
- package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/README.md +4 -4
- package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy.cc +7 -4
- package/deps/couchbase-cxx-client/CMakeLists.txt +1 -1
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -2
- package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +1 -1
- package/deps/couchbase-cxx-client/core/bucket.cxx +16 -14
- package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +9 -7
- package/deps/couchbase-cxx-client/core/cluster.hxx +2 -1
- package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +4 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +55 -18
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +12 -11
- package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +7 -7
- package/deps/couchbase-cxx-client/core/impl/replica_utils.cxx +5 -5
- package/deps/couchbase-cxx-client/core/impl/replica_utils.hxx +2 -1
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
- package/deps/couchbase-cxx-client/core/operations/document_append.cxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +3 -4
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/document_prepend.cxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -1
- package/dist/binarycollection.d.ts +11 -1
- package/dist/binding.d.ts +7 -0
- package/dist/bindingutilities.d.ts +1 -1
- package/dist/bindingutilities.js +15 -12
- package/dist/collection.js +4 -0
- package/dist/collectionmanager.d.ts +1 -1
- package/dist/collectionmanager.js +2 -2
- package/dist/transactions.js +3 -0
- package/package.json +8 -8
- package/scripts/buildPrebuild.js +4 -3
- package/scripts/prebuilds.js +6 -0
- package/src/binding.cpp +2 -0
- package/src/connection.cpp +3 -3
- package/src/jstocbpp_autogen.hpp +8 -0
- package/src/jstocbpp_transactions.hpp +7 -5
- package/tools/gen-bindings-json.py +0 -1
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/CONTRIBUTING.md +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/COPYING +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/SnappyConfig.cmake.in +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/config.h.in +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.cc +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.h +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-internal.h +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.cc +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.h +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.cc +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.h +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-public.h.in +0 -0
- /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy.h +0 -0
@@ -884,13 +884,14 @@ public:
|
|
884
884
|
return core_.with_bucket_configuration(
|
885
885
|
bucket_name_,
|
886
886
|
[this, handler = std::move(handler), orchestrator_opts, core_scan_type](
|
887
|
-
std::error_code ec,
|
887
|
+
std::error_code ec,
|
888
|
+
const std::shared_ptr<core::topology::configuration>& config) mutable {
|
888
889
|
if (ec) {
|
889
890
|
return handler(
|
890
891
|
error(ec, "An error occurred when attempting to fetch the bucket configuration."),
|
891
892
|
{});
|
892
893
|
}
|
893
|
-
if (!config
|
894
|
+
if (!config->capabilities.supports_range_scan()) {
|
894
895
|
return handler(error(errc::common::feature_not_available,
|
895
896
|
"This bucket does not support range scan."),
|
896
897
|
{});
|
@@ -913,7 +914,7 @@ public:
|
|
913
914
|
bucket_name_)),
|
914
915
|
{});
|
915
916
|
}
|
916
|
-
if (!config
|
917
|
+
if (!config->vbmap.has_value() || config->vbmap->empty()) {
|
917
918
|
CB_LOG_WARNING("Unable to get vbucket map for `{}` - cannot perform scan operation",
|
918
919
|
bucket_name_);
|
919
920
|
return handler(error(errc::common::request_canceled,
|
@@ -923,7 +924,7 @@ public:
|
|
923
924
|
|
924
925
|
auto orchestrator = core::range_scan_orchestrator(core_.io_context(),
|
925
926
|
agent.value(),
|
926
|
-
config
|
927
|
+
config->vbmap.value(),
|
927
928
|
scope_name_,
|
928
929
|
name_,
|
929
930
|
core_scan_type,
|
@@ -993,8 +994,8 @@ collection::get(std::string document_id, const get_options& options, get_handler
|
|
993
994
|
}
|
994
995
|
|
995
996
|
auto
|
996
|
-
collection::get(std::string document_id,
|
997
|
-
|
997
|
+
collection::get(std::string document_id, const get_options& options) const
|
998
|
+
-> std::future<std::pair<error, get_result>>
|
998
999
|
{
|
999
1000
|
auto barrier = std::make_shared<std::promise<std::pair<error, get_result>>>();
|
1000
1001
|
auto future = barrier->get_future();
|
@@ -1296,9 +1297,8 @@ collection::unlock(std::string document_id,
|
|
1296
1297
|
}
|
1297
1298
|
|
1298
1299
|
auto
|
1299
|
-
collection::unlock(std::string document_id,
|
1300
|
-
|
1301
|
-
const unlock_options& options) const -> std::future<error>
|
1300
|
+
collection::unlock(std::string document_id, couchbase::cas cas, const unlock_options& options) const
|
1301
|
+
-> std::future<error>
|
1302
1302
|
{
|
1303
1303
|
auto barrier = std::make_shared<std::promise<error>>();
|
1304
1304
|
auto future = barrier->get_future();
|
@@ -1409,8 +1409,9 @@ collection::scan(const couchbase::scan_type& scan_type,
|
|
1409
1409
|
}
|
1410
1410
|
|
1411
1411
|
auto
|
1412
|
-
collection::scan(const couchbase::scan_type& scan_type,
|
1413
|
-
|
1412
|
+
collection::scan(const couchbase::scan_type& scan_type,
|
1413
|
+
const couchbase::scan_options& options) const
|
1414
|
+
-> std::future<std::pair<error, scan_result>>
|
1414
1415
|
{
|
1415
1416
|
auto barrier = std::make_shared<std::promise<std::pair<error, scan_result>>>();
|
1416
1417
|
auto future = barrier->get_future();
|
@@ -96,24 +96,24 @@ number_of_replica_nodes_required(couchbase::replicate_to replicate_to) -> std::u
|
|
96
96
|
}
|
97
97
|
|
98
98
|
auto
|
99
|
-
validate_replicas(const topology::configuration
|
99
|
+
validate_replicas(const std::shared_ptr<topology::configuration>& config,
|
100
100
|
couchbase::persist_to persist_to,
|
101
101
|
couchbase::replicate_to replicate_to) -> std::pair<std::error_code, std::uint32_t>
|
102
102
|
{
|
103
|
-
if (config
|
103
|
+
if (config->node_locator != topology::configuration::node_locator_type::vbucket) {
|
104
104
|
return { errc::common::feature_not_available, {} };
|
105
105
|
}
|
106
106
|
|
107
107
|
if (touches_replica(persist_to, replicate_to)) {
|
108
|
-
|
108
|
+
auto number_of_replicas = config->num_replicas;
|
109
|
+
if (!number_of_replicas.has_value()) {
|
109
110
|
return { errc::key_value::durability_impossible, {} };
|
110
111
|
}
|
111
|
-
auto number_of_replicas = config.num_replicas.value();
|
112
112
|
if (number_of_replica_nodes_required(persist_to) > number_of_replicas ||
|
113
113
|
number_of_replica_nodes_required(replicate_to) > number_of_replicas) {
|
114
114
|
return { errc::key_value::durability_impossible, {} };
|
115
115
|
}
|
116
|
-
return { {}, number_of_replicas };
|
116
|
+
return { {}, number_of_replicas.value() };
|
117
117
|
}
|
118
118
|
return { {}, 0 };
|
119
119
|
}
|
@@ -335,8 +335,8 @@ observe_poll(const cluster& core, std::shared_ptr<observe_context> ctx)
|
|
335
335
|
const std::string bucket_name = ctx->bucket_name();
|
336
336
|
core.with_bucket_configuration(
|
337
337
|
bucket_name,
|
338
|
-
[core, ctx = std::move(ctx)](
|
339
|
-
|
338
|
+
[core, ctx = std::move(ctx)](
|
339
|
+
std::error_code ec, const std::shared_ptr<core::topology::configuration>& config) mutable {
|
340
340
|
if (ec) {
|
341
341
|
return ctx->finish(ec);
|
342
342
|
}
|
@@ -25,7 +25,7 @@ namespace couchbase::core::impl
|
|
25
25
|
|
26
26
|
auto
|
27
27
|
effective_nodes(const document_id& id,
|
28
|
-
const topology::configuration
|
28
|
+
const std::shared_ptr<topology::configuration>& config,
|
29
29
|
const read_preference& preference,
|
30
30
|
const std::string& preferred_server_group) -> std::vector<readable_node>
|
31
31
|
{
|
@@ -37,12 +37,12 @@ effective_nodes(const document_id& id,
|
|
37
37
|
std::vector<readable_node> available_nodes{};
|
38
38
|
std::vector<readable_node> local_nodes{};
|
39
39
|
|
40
|
-
for (std::size_t idx = 0U; idx <= config
|
41
|
-
auto [vbid, server] = config
|
42
|
-
if (server.has_value() && server.value() < config
|
40
|
+
for (std::size_t idx = 0U; idx <= config->num_replicas.value_or(0U); ++idx) {
|
41
|
+
auto [vbid, server] = config->map_key(id.key(), idx);
|
42
|
+
if (server.has_value() && server.value() < config->nodes.size()) {
|
43
43
|
const bool is_replica = idx != 0;
|
44
44
|
available_nodes.emplace_back(readable_node{ is_replica, idx });
|
45
|
-
if (preferred_server_group == config
|
45
|
+
if (preferred_server_group == config->nodes[server.value()].server_group) {
|
46
46
|
local_nodes.emplace_back(readable_node{ is_replica, idx });
|
47
47
|
}
|
48
48
|
}
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
#include "couchbase/read_preference.hxx"
|
25
25
|
|
26
|
+
#include <memory>
|
26
27
|
#include <string>
|
27
28
|
#include <vector>
|
28
29
|
|
@@ -42,7 +43,7 @@ struct readable_node {
|
|
42
43
|
*/
|
43
44
|
auto
|
44
45
|
effective_nodes(const document_id& id,
|
45
|
-
const topology::configuration
|
46
|
+
const std::shared_ptr<topology::configuration>& config,
|
46
47
|
const read_preference& preference,
|
47
48
|
const std::string& preferred_server_group) -> std::vector<readable_node>;
|
48
49
|
} // namespace couchbase::core::impl
|
@@ -206,3 +206,8 @@
|
|
206
206
|
* All options classes in the Public API expose the parent_span option.
|
207
207
|
*/
|
208
208
|
#define COUCHBASE_CXX_CLIENT_PUBLIC_API_PARENT_SPAN 1
|
209
|
+
|
210
|
+
/**
|
211
|
+
* core API like with_bucket_configuration() yields shared_ptr instead of configuration copy
|
212
|
+
*/
|
213
|
+
#define COUCHBASE_CXX_CLIENT_CORE_RETURNS_POINTER_TO_CONFIG 1
|
@@ -50,6 +50,7 @@ struct append_request {
|
|
50
50
|
std::vector<std::byte> value;
|
51
51
|
std::uint16_t partition{};
|
52
52
|
std::uint32_t opaque{};
|
53
|
+
couchbase::cas cas{ 0 };
|
53
54
|
couchbase::durability_level durability_level{ durability_level::none };
|
54
55
|
std::optional<std::chrono::milliseconds> timeout{};
|
55
56
|
io::retry_context<false> retries{};
|
@@ -26,7 +26,6 @@
|
|
26
26
|
#include "core/utils/movable_function.hxx"
|
27
27
|
#include "couchbase/error_codes.hxx"
|
28
28
|
|
29
|
-
#include <functional>
|
30
29
|
#include <memory>
|
31
30
|
#include <mutex>
|
32
31
|
|
@@ -65,8 +64,8 @@ struct get_all_replicas_request {
|
|
65
64
|
id = id,
|
66
65
|
timeout = timeout,
|
67
66
|
read_preference = read_preference,
|
68
|
-
h = std::forward<Handler>(handler)](
|
69
|
-
|
67
|
+
h = std::forward<Handler>(handler)](
|
68
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
70
69
|
if (ec) {
|
71
70
|
return h(response_type{ make_key_value_error_context(ec, id) });
|
72
71
|
}
|
@@ -82,7 +81,7 @@ struct get_all_replicas_request {
|
|
82
81
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
83
82
|
id,
|
84
83
|
origin.options().server_group,
|
85
|
-
config
|
84
|
+
config->num_replicas.value_or(0));
|
86
85
|
return h(response_type{
|
87
86
|
make_key_value_error_context(errc::key_value::document_irretrievable, id) });
|
88
87
|
}
|
@@ -61,8 +61,8 @@ struct get_any_replica_request {
|
|
61
61
|
id = id,
|
62
62
|
timeout = timeout,
|
63
63
|
read_preference = read_preference,
|
64
|
-
h = std::forward<Handler>(handler)](
|
65
|
-
|
64
|
+
h = std::forward<Handler>(handler)](
|
65
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
66
66
|
const auto [e, origin] = core->origin();
|
67
67
|
if (e && !ec) {
|
68
68
|
ec = e;
|
@@ -75,7 +75,7 @@ struct get_any_replica_request {
|
|
75
75
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
76
76
|
id,
|
77
77
|
origin.options().server_group,
|
78
|
-
config
|
78
|
+
config->num_replicas.value_or(0));
|
79
79
|
ec = errc::key_value::document_irretrievable;
|
80
80
|
}
|
81
81
|
|
@@ -94,8 +94,8 @@ struct lookup_in_all_replicas_request {
|
|
94
94
|
core->with_bucket_configuration(
|
95
95
|
id.bucket(),
|
96
96
|
[core, id, timeout, specs, parent_span, read_preference, h = std::forward<Handler>(h)](
|
97
|
-
std::error_code ec,
|
98
|
-
if (!config
|
97
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
98
|
+
if (!config->capabilities.supports_subdoc_read_replica()) {
|
99
99
|
ec = errc::common::feature_not_available;
|
100
100
|
}
|
101
101
|
|
@@ -111,7 +111,7 @@ struct lookup_in_all_replicas_request {
|
|
111
111
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
112
112
|
id,
|
113
113
|
origin.options().server_group,
|
114
|
-
config
|
114
|
+
config->num_replicas.value_or(0));
|
115
115
|
ec = errc::key_value::document_irretrievable;
|
116
116
|
}
|
117
117
|
|
@@ -92,8 +92,8 @@ struct lookup_in_any_replica_request {
|
|
92
92
|
return core->with_bucket_configuration(
|
93
93
|
id.bucket(),
|
94
94
|
[core, id, timeout, specs, parent_span, read_preference, h = std::forward<Handler>(h)](
|
95
|
-
std::error_code ec,
|
96
|
-
if (!config
|
95
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
96
|
+
if (!config->capabilities.supports_subdoc_read_replica()) {
|
97
97
|
ec = errc::common::feature_not_available;
|
98
98
|
}
|
99
99
|
const auto [e, origin] = core->origin();
|
@@ -108,7 +108,7 @@ struct lookup_in_any_replica_request {
|
|
108
108
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
109
109
|
id,
|
110
110
|
origin.options().server_group,
|
111
|
-
config
|
111
|
+
config->num_replicas.value_or(0));
|
112
112
|
ec = errc::key_value::document_irretrievable;
|
113
113
|
}
|
114
114
|
|
@@ -50,6 +50,7 @@ struct prepend_request {
|
|
50
50
|
std::vector<std::byte> value;
|
51
51
|
std::uint16_t partition{};
|
52
52
|
std::uint32_t opaque{};
|
53
|
+
couchbase::cas cas{ 0 };
|
53
54
|
couchbase::durability_level durability_level{ durability_level::none };
|
54
55
|
std::optional<std::chrono::milliseconds> timeout{};
|
55
56
|
io::retry_context<false> retries{};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Collection } from './collection';
|
3
3
|
import { CounterResult, MutationResult } from './crudoptypes';
|
4
4
|
import { DurabilityLevel } from './generaltypes';
|
5
|
-
import { NodeCallback } from './utilities';
|
5
|
+
import { CasInput, NodeCallback } from './utilities';
|
6
6
|
/**
|
7
7
|
* @category Key-Value
|
8
8
|
*/
|
@@ -93,6 +93,11 @@ export interface AppendOptions {
|
|
93
93
|
* exclusive of {@link durabilityLevel}.
|
94
94
|
*/
|
95
95
|
durabilityReplicateTo?: number;
|
96
|
+
/**
|
97
|
+
* If specified, indicates that operation should be failed if the CAS
|
98
|
+
* has changed from this value, indicating that the document has changed.
|
99
|
+
*/
|
100
|
+
cas?: CasInput;
|
96
101
|
/**
|
97
102
|
* The timeout for this operation, represented in milliseconds.
|
98
103
|
*/
|
@@ -118,6 +123,11 @@ export interface PrependOptions {
|
|
118
123
|
* exclusive of {@link durabilityLevel}.
|
119
124
|
*/
|
120
125
|
durabilityReplicateTo?: number;
|
126
|
+
/**
|
127
|
+
* If specified, indicates that operation should be failed if the CAS
|
128
|
+
* has changed from this value, indicating that the document has changed.
|
129
|
+
*/
|
130
|
+
cas?: CasInput;
|
121
131
|
/**
|
122
132
|
* The timeout for this operation, represented in milliseconds.
|
123
133
|
*/
|
package/dist/binding.d.ts
CHANGED
@@ -453,6 +453,7 @@ export interface CppPrependRequest {
|
|
453
453
|
value: Buffer;
|
454
454
|
partition: number;
|
455
455
|
opaque: number;
|
456
|
+
cas: CppCasInput;
|
456
457
|
durability_level: CppDurabilityLevel;
|
457
458
|
timeout?: CppMilliseconds;
|
458
459
|
}
|
@@ -461,6 +462,7 @@ export interface CppPrependWithLegacyDurabilityRequest {
|
|
461
462
|
value: Buffer;
|
462
463
|
partition: number;
|
463
464
|
opaque: number;
|
465
|
+
cas: CppCasInput;
|
464
466
|
timeout?: CppMilliseconds;
|
465
467
|
persist_to: CppPersistTo;
|
466
468
|
replicate_to: CppReplicateTo;
|
@@ -556,6 +558,7 @@ export interface CppAppendRequest {
|
|
556
558
|
value: Buffer;
|
557
559
|
partition: number;
|
558
560
|
opaque: number;
|
561
|
+
cas: CppCasInput;
|
559
562
|
durability_level: CppDurabilityLevel;
|
560
563
|
timeout?: CppMilliseconds;
|
561
564
|
}
|
@@ -564,6 +567,7 @@ export interface CppAppendWithLegacyDurabilityRequest {
|
|
564
567
|
value: Buffer;
|
565
568
|
partition: number;
|
566
569
|
opaque: number;
|
570
|
+
cas: CppCasInput;
|
567
571
|
timeout?: CppMilliseconds;
|
568
572
|
persist_to: CppPersistTo;
|
569
573
|
replicate_to: CppReplicateTo;
|
@@ -2706,17 +2710,20 @@ export interface CppTxnOperationFailed extends CppErrorBase {
|
|
2706
2710
|
should_not_retry: boolean;
|
2707
2711
|
should_not_rollback: boolean;
|
2708
2712
|
cause: CppTxnExternalException;
|
2713
|
+
message?: string;
|
2709
2714
|
}
|
2710
2715
|
export interface CppTxnOpException extends CppErrorBase {
|
2711
2716
|
ctxtype: 'transaction_op_exception';
|
2712
2717
|
ctx: CppTransactionOpErrorContext | undefined;
|
2713
2718
|
cause: CppTxnExternalException;
|
2719
|
+
message?: string;
|
2714
2720
|
}
|
2715
2721
|
export interface CppTxnError extends CppErrorBase {
|
2716
2722
|
ctxtype: 'transaction_exception';
|
2717
2723
|
result: CppTransactionResult;
|
2718
2724
|
cause: CppTxnExternalException;
|
2719
2725
|
type: CppTxnFailureType;
|
2726
|
+
message?: string;
|
2720
2727
|
}
|
2721
2728
|
export interface CppTransactionErrorContext {
|
2722
2729
|
code: CppErrc;
|
@@ -88,7 +88,7 @@ export declare function endpointStateFromCpp(service: CppDiagEndpointState): End
|
|
88
88
|
/**
|
89
89
|
* @internal
|
90
90
|
*/
|
91
|
-
export declare function txnExternalExceptionStringFromCpp(cause: CppTxnExternalException): string;
|
91
|
+
export declare function txnExternalExceptionStringFromCpp(cause: CppTxnExternalException, message?: string): string;
|
92
92
|
/**
|
93
93
|
* @internal
|
94
94
|
*/
|
package/dist/bindingutilities.js
CHANGED
@@ -431,8 +431,11 @@ exports.endpointStateFromCpp = endpointStateFromCpp;
|
|
431
431
|
/**
|
432
432
|
* @internal
|
433
433
|
*/
|
434
|
-
function txnExternalExceptionStringFromCpp(cause) {
|
434
|
+
function txnExternalExceptionStringFromCpp(cause, message) {
|
435
435
|
if (cause === binding_1.default.txn_external_exception.unknown) {
|
436
|
+
if (message) {
|
437
|
+
return message;
|
438
|
+
}
|
436
439
|
return 'unknown';
|
437
440
|
}
|
438
441
|
else if (cause ===
|
@@ -501,7 +504,7 @@ function txnExternalExceptionStringFromCpp(cause) {
|
|
501
504
|
else if (cause === binding_1.default.txn_external_exception.transaction_already_committed) {
|
502
505
|
return 'transaction_already_committed';
|
503
506
|
}
|
504
|
-
|
507
|
+
return 'unknown';
|
505
508
|
}
|
506
509
|
exports.txnExternalExceptionStringFromCpp = txnExternalExceptionStringFromCpp;
|
507
510
|
/**
|
@@ -513,16 +516,16 @@ function txnOpExeptionFromCpp(err, ctx) {
|
|
513
516
|
}
|
514
517
|
const context = ctx ? ctx : undefined;
|
515
518
|
if (err.cause === binding_1.default.txn_external_exception.document_exists_exception) {
|
516
|
-
return new errs.DocumentExistsError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
519
|
+
return new errs.DocumentExistsError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
517
520
|
}
|
518
521
|
else if (err.cause === binding_1.default.txn_external_exception.document_not_found_exception) {
|
519
|
-
return new errs.DocumentNotFoundError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
522
|
+
return new errs.DocumentNotFoundError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
520
523
|
}
|
521
524
|
else if (err.cause === binding_1.default.txn_external_exception.parsing_failure) {
|
522
|
-
return new errs.ParsingFailureError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
525
|
+
return new errs.ParsingFailureError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
523
526
|
}
|
524
527
|
else if (err.cause === binding_1.default.txn_external_exception.couchbase_exception) {
|
525
|
-
const cause = txnExternalExceptionStringFromCpp(err.cause);
|
528
|
+
const cause = txnExternalExceptionStringFromCpp(err.cause, err.message);
|
526
529
|
return new errs.CouchbaseError(cause, new Error(cause), context);
|
527
530
|
}
|
528
531
|
return err;
|
@@ -622,12 +625,12 @@ function errorFromCpp(err) {
|
|
622
625
|
}
|
623
626
|
// BUG(JSCBC-1010): We shouldn't need to special case these.
|
624
627
|
if (err.ctxtype === 'transaction_operation_failed') {
|
625
|
-
const cause = txnExternalExceptionStringFromCpp(err.cause);
|
628
|
+
const cause = txnExternalExceptionStringFromCpp(err.cause, err.message);
|
626
629
|
if (cause == 'feature_not_available_exception') {
|
627
630
|
const msg = 'Possibly attempting a binary transaction operation with a server version < 7.6.2';
|
628
631
|
return new errs.TransactionOperationFailedError(new errs.FeatureNotAvailableError(new Error(msg)));
|
629
632
|
}
|
630
|
-
return new errs.TransactionOperationFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
633
|
+
return new errs.TransactionOperationFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
631
634
|
}
|
632
635
|
else if (err.ctxtype === 'transaction_op_exception') {
|
633
636
|
let txnContext = null;
|
@@ -638,15 +641,15 @@ function errorFromCpp(err) {
|
|
638
641
|
}
|
639
642
|
else if (err.ctxtype === 'transaction_exception') {
|
640
643
|
if (err.type === binding_1.default.txn_failure_type.fail) {
|
641
|
-
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
644
|
+
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
642
645
|
}
|
643
646
|
else if (err.type === binding_1.default.txn_failure_type.expiry) {
|
644
|
-
return new errs.TransactionExpiredError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
647
|
+
return new errs.TransactionExpiredError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
645
648
|
}
|
646
649
|
else if (err.type === binding_1.default.txn_failure_type.commit_ambiguous) {
|
647
|
-
return new errs.TransactionCommitAmbiguousError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
650
|
+
return new errs.TransactionCommitAmbiguousError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
648
651
|
}
|
649
|
-
|
652
|
+
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
650
653
|
}
|
651
654
|
const baseErr = err;
|
652
655
|
const contextOrNull = contextFromCpp(err);
|
package/dist/collection.js
CHANGED
@@ -1363,6 +1363,7 @@ class Collection {
|
|
1363
1363
|
const durabilityLevel = options.durabilityLevel;
|
1364
1364
|
const persistTo = options.durabilityPersistTo;
|
1365
1365
|
const replicateTo = options.durabilityReplicateTo;
|
1366
|
+
const cas = options.cas;
|
1366
1367
|
const timeout = options.timeout || this.cluster.kvTimeout;
|
1367
1368
|
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
1368
1369
|
if (!Buffer.isBuffer(value)) {
|
@@ -1371,6 +1372,7 @@ class Collection {
|
|
1371
1372
|
const appendReq = {
|
1372
1373
|
id: this._cppDocId(key),
|
1373
1374
|
value,
|
1375
|
+
cas: cas || binding_1.zeroCas,
|
1374
1376
|
timeout,
|
1375
1377
|
partition: 0,
|
1376
1378
|
opaque: 0,
|
@@ -1414,6 +1416,7 @@ class Collection {
|
|
1414
1416
|
const durabilityLevel = options.durabilityLevel;
|
1415
1417
|
const persistTo = options.durabilityPersistTo;
|
1416
1418
|
const replicateTo = options.durabilityReplicateTo;
|
1419
|
+
const cas = options.cas;
|
1417
1420
|
const timeout = options.timeout || this.cluster.kvTimeout;
|
1418
1421
|
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
1419
1422
|
if (!Buffer.isBuffer(value)) {
|
@@ -1422,6 +1425,7 @@ class Collection {
|
|
1422
1425
|
const prependReq = {
|
1423
1426
|
id: this._cppDocId(key),
|
1424
1427
|
value,
|
1428
|
+
cas: cas || binding_1.zeroCas,
|
1425
1429
|
timeout,
|
1426
1430
|
partition: 0,
|
1427
1431
|
opaque: 0,
|
@@ -150,8 +150,8 @@ class CollectionManager {
|
|
150
150
|
}
|
151
151
|
const bucketName = this._bucket.name;
|
152
152
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
153
|
-
const maxExpiry = settings
|
154
|
-
const history = settings
|
153
|
+
const maxExpiry = settings === null || settings === void 0 ? void 0 : settings.maxExpiry;
|
154
|
+
const history = settings === null || settings === void 0 ? void 0 : settings.history;
|
155
155
|
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
156
156
|
this._cluster.conn.managementCollectionCreate({
|
157
157
|
bucket_name: bucketName,
|
package/dist/transactions.js
CHANGED
@@ -387,6 +387,9 @@ class Transactions {
|
|
387
387
|
if (e instanceof errors_1.TransactionOperationFailedError) {
|
388
388
|
throw new errors_1.TransactionFailedError(e.cause, e.context);
|
389
389
|
}
|
390
|
+
else if (e instanceof errors_1.TransactionFailedError) {
|
391
|
+
throw e;
|
392
|
+
}
|
390
393
|
throw new errors_1.TransactionFailedError(e);
|
391
394
|
}
|
392
395
|
try {
|
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.4.
|
57
|
+
"version": "4.4.6",
|
58
58
|
"config": {
|
59
59
|
"native": false
|
60
60
|
},
|
@@ -79,13 +79,13 @@
|
|
79
79
|
]
|
80
80
|
},
|
81
81
|
"optionalDependencies": {
|
82
|
-
"@couchbase/couchbase-darwin-arm64-napi": "4.4.
|
83
|
-
"@couchbase/couchbase-darwin-x64-napi": "4.4.
|
84
|
-
"@couchbase/couchbase-linux-arm64-napi": "4.4.
|
85
|
-
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.
|
86
|
-
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.
|
87
|
-
"@couchbase/couchbase-linux-x64-napi": "4.4.
|
88
|
-
"@couchbase/couchbase-win32-x64-napi": "4.4.
|
82
|
+
"@couchbase/couchbase-darwin-arm64-napi": "4.4.6",
|
83
|
+
"@couchbase/couchbase-darwin-x64-napi": "4.4.6",
|
84
|
+
"@couchbase/couchbase-linux-arm64-napi": "4.4.6",
|
85
|
+
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.6",
|
86
|
+
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.6",
|
87
|
+
"@couchbase/couchbase-linux-x64-napi": "4.4.6",
|
88
|
+
"@couchbase/couchbase-win32-x64-napi": "4.4.6"
|
89
89
|
},
|
90
90
|
"files": [
|
91
91
|
"LICENSE",
|
package/scripts/buildPrebuild.js
CHANGED
@@ -66,7 +66,7 @@ if (args.length > 0) {
|
|
66
66
|
let rt = undefined
|
67
67
|
if (args[runtimeIdx].includes('=')) {
|
68
68
|
rt = args[runtimeIdx].split('=')[1]
|
69
|
-
} else if (args.length - 1
|
69
|
+
} else if (args.length - 1 >= runtimeIdx + 1) {
|
70
70
|
rt = args[runtimeIdx + 1]
|
71
71
|
}
|
72
72
|
|
@@ -81,7 +81,7 @@ if (args.length > 0) {
|
|
81
81
|
let rtv = undefined
|
82
82
|
if (args[runtimeVersionIdx].includes('=')) {
|
83
83
|
rtv = args[runtimeVersionIdx].split('=')[1]
|
84
|
-
} else if (args.length - 1
|
84
|
+
} else if (args.length - 1 >= runtimeVersionIdx + 1) {
|
85
85
|
rtv = args[runtimeVersionIdx + 1]
|
86
86
|
}
|
87
87
|
|
@@ -112,11 +112,12 @@ if (args.length > 0) {
|
|
112
112
|
let pv = undefined
|
113
113
|
if (args[parallelIdx].includes('=')) {
|
114
114
|
pv = args[parallelIdx].split('=')[1]
|
115
|
-
} else if (args.length - 1
|
115
|
+
} else if (args.length - 1 >= parallelIdx + 1) {
|
116
116
|
pv = args[parallelIdx + 1]
|
117
117
|
}
|
118
118
|
|
119
119
|
if (pv && !isNaN(parseInt(pv))) {
|
120
|
+
const os = require('os')
|
120
121
|
const pvi = parseInt(pv)
|
121
122
|
if (pvi <= os.cpus().length) {
|
122
123
|
cmakeParallel = pvi
|
package/scripts/prebuilds.js
CHANGED
@@ -376,6 +376,9 @@ function matchingPlatformPrebuild(filename, useElectronRuntime = false) {
|
|
376
376
|
_runtime = 'electron'
|
377
377
|
} else if (runtime === 'node') {
|
378
378
|
_runtime = 'napi'
|
379
|
+
} else if (runtime === 'electron') {
|
380
|
+
// NOTE: electron support is experimental
|
381
|
+
_runtime = 'electron'
|
379
382
|
} else {
|
380
383
|
console.log(`Unsupported runtime: ${runtime}`)
|
381
384
|
return false
|
@@ -439,6 +442,9 @@ function resolvePrebuild(
|
|
439
442
|
_runtime = 'electron'
|
440
443
|
} else if (runtime === 'node') {
|
441
444
|
_runtime = 'napi'
|
445
|
+
} else if (runtime === 'electron') {
|
446
|
+
// NOTE: electron support is experimental
|
447
|
+
_runtime = 'electron'
|
442
448
|
} else {
|
443
449
|
throw new Error(`Unsupported runtime: ${runtime}`)
|
444
450
|
}
|
package/src/binding.cpp
CHANGED
@@ -66,6 +66,8 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
66
66
|
couchbase::core::logger::configuration configuration{};
|
67
67
|
configuration.filename = logFileStr;
|
68
68
|
configuration.log_level = cbppLogLevel;
|
69
|
+
const char *enableConsoleLoggingCstr = getenv("CBPPENABLECONSOLE");
|
70
|
+
configuration.console = enableConsoleLoggingCstr != nullptr;
|
69
71
|
couchbase::core::logger::create_file_logger(configuration);
|
70
72
|
|
71
73
|
} else {
|