couchbase 4.4.5 → 4.4.6-dev.1

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.
Files changed (55) hide show
  1. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +64 -33
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  3. package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/CMakeLists.txt +14 -10
  4. package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/README.md +4 -4
  5. package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy.cc +7 -4
  6. package/deps/couchbase-cxx-client/CMakeLists.txt +1 -1
  7. package/deps/couchbase-cxx-client/README.md +2 -2
  8. package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -2
  9. package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +1 -1
  10. package/deps/couchbase-cxx-client/core/bucket.cxx +16 -14
  11. package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
  12. package/deps/couchbase-cxx-client/core/cluster.cxx +9 -7
  13. package/deps/couchbase-cxx-client/core/cluster.hxx +2 -1
  14. package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +4 -0
  15. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +55 -18
  16. package/deps/couchbase-cxx-client/core/impl/collection.cxx +12 -11
  17. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +7 -7
  18. package/deps/couchbase-cxx-client/core/impl/replica_utils.cxx +5 -5
  19. package/deps/couchbase-cxx-client/core/impl/replica_utils.hxx +2 -1
  20. package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
  21. package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
  22. package/deps/couchbase-cxx-client/core/operations/document_append.cxx +1 -0
  23. package/deps/couchbase-cxx-client/core/operations/document_append.hxx +1 -0
  24. package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +3 -4
  25. package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +3 -3
  26. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +3 -3
  27. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +3 -3
  28. package/deps/couchbase-cxx-client/core/operations/document_prepend.cxx +1 -0
  29. package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +1 -0
  30. package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -1
  31. package/dist/binarycollection.d.ts +11 -1
  32. package/dist/binding.d.ts +4 -0
  33. package/dist/collection.js +4 -0
  34. package/dist/collectionmanager.d.ts +1 -1
  35. package/dist/collectionmanager.js +2 -2
  36. package/package.json +8 -8
  37. package/scripts/buildPrebuild.js +4 -3
  38. package/scripts/prebuilds.js +6 -0
  39. package/src/binding.cpp +2 -0
  40. package/src/connection.cpp +3 -3
  41. package/src/jstocbpp_autogen.hpp +8 -0
  42. package/tools/gen-bindings-json.py +0 -1
  43. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/CONTRIBUTING.md +0 -0
  44. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/COPYING +0 -0
  45. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/SnappyConfig.cmake.in +0 -0
  46. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/config.h.in +0 -0
  47. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.cc +0 -0
  48. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.h +0 -0
  49. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-internal.h +0 -0
  50. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.cc +0 -0
  51. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.h +0 -0
  52. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.cc +0 -0
  53. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.h +0 -0
  54. /package/deps/couchbase-cxx-cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-public.h.in +0 -0
  55. /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, const core::topology::configuration& config) mutable {
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.capabilities.supports_range_scan()) {
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.vbmap.has_value() || config.vbmap->empty()) {
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.vbmap.value(),
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
- const get_options& options) const -> std::future<std::pair<error, get_result>>
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
- couchbase::cas cas,
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, const couchbase::scan_options& options)
1413
- const -> std::future<std::pair<error, scan_result>>
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& config,
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.node_locator != topology::configuration::node_locator_type::vbucket) {
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
- if (!config.num_replicas) {
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)](std::error_code ec,
339
- const core::topology::configuration& config) mutable {
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& config,
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.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()) {
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.nodes[server.value()].server_group) {
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& config,
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
@@ -322,7 +322,7 @@ create_file_logger(const configuration& logger_settings) -> std::optional<std::s
322
322
  if (error) {
323
323
  return error;
324
324
  }
325
- file_logger = std::move(logger);
325
+ update_file_logger(logger);
326
326
  return {};
327
327
  }
328
328
 
@@ -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
@@ -28,6 +28,7 @@ append_request::encode_to(protocol::client_request<protocol::append_request_body
28
28
  {
29
29
  encoded.opaque(opaque);
30
30
  encoded.partition(partition);
31
+ encoded.cas(cas);
31
32
  encoded.body().id(id);
32
33
  encoded.body().content(value);
33
34
  return {};
@@ -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)](std::error_code ec,
69
- const topology::configuration& config) mutable {
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.num_replicas.value_or(0));
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)](std::error_code ec,
65
- const topology::configuration& config) mutable {
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.num_replicas.value_or(0));
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, const topology::configuration& config) mutable {
98
- if (!config.capabilities.supports_subdoc_read_replica()) {
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.num_replicas.value_or(0));
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, const topology::configuration& config) mutable {
96
- if (!config.capabilities.supports_subdoc_read_replica()) {
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.num_replicas.value_or(0));
111
+ config->num_replicas.value_or(0));
112
112
  ec = errc::key_value::document_irretrievable;
113
113
  }
114
114
 
@@ -28,6 +28,7 @@ prepend_request::encode_to(prepend_request::encoded_request_type& encoded,
28
28
  {
29
29
  encoded.opaque(opaque);
30
30
  encoded.partition(partition);
31
+ encoded.cas(cas);
31
32
  encoded.body().id(id);
32
33
  encoded.body().content(value);
33
34
  return {};
@@ -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{};
@@ -17,7 +17,7 @@ components:
17
17
  versions: [ v9.2.1 ]
18
18
  snappy:
19
19
  bd-id: fd5e5c60-2c67-4d20-8be9-b7648156cef3
20
- versions: [ 1.2.1 ]
20
+ versions: [ 1.2.2 ]
21
21
  asio:
22
22
  bd-id: 3739d5e9-9ad8-4845-8077-1770167a69c2
23
23
  versions: [ 1.31.0 ]
@@ -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;
@@ -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,
@@ -48,7 +48,7 @@ export declare class CollectionSpec {
48
48
  *
49
49
  * @see {@link IBucketSettings.maxExpiry}
50
50
  */
51
- maxExpiry: number;
51
+ maxExpiry?: number;
52
52
  /**
53
53
  * The history retention override setting in this collection.
54
54
  * Only supported on Magma Buckets.
@@ -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.maxExpiry || 0;
154
- const history = settings.history || undefined;
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/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.5",
57
+ "version": "4.4.6-dev.1",
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.5",
83
- "@couchbase/couchbase-darwin-x64-napi": "4.4.5",
84
- "@couchbase/couchbase-linux-arm64-napi": "4.4.5",
85
- "@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.5",
86
- "@couchbase/couchbase-linuxmusl-x64-napi": "4.4.5",
87
- "@couchbase/couchbase-linux-x64-napi": "4.4.5",
88
- "@couchbase/couchbase-win32-x64-napi": "4.4.5"
82
+ "@couchbase/couchbase-darwin-arm64-napi": "4.4.6-dev.1",
83
+ "@couchbase/couchbase-darwin-x64-napi": "4.4.6-dev.1",
84
+ "@couchbase/couchbase-linux-arm64-napi": "4.4.6-dev.1",
85
+ "@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.6-dev.1",
86
+ "@couchbase/couchbase-linuxmusl-x64-napi": "4.4.6-dev.1",
87
+ "@couchbase/couchbase-linux-x64-napi": "4.4.6-dev.1",
88
+ "@couchbase/couchbase-win32-x64-napi": "4.4.6-dev.1"
89
89
  },
90
90
  "files": [
91
91
  "LICENSE",
@@ -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 <= runtimeIdx + 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 <= runtimeVersionIdx + 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 <= parallelIdx + 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
@@ -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 {
@@ -442,15 +442,15 @@ Napi::Value Connection::jsScan(const Napi::CallbackInfo &info)
442
442
  bucketName,
443
443
  [barrier](
444
444
  std::error_code ec,
445
- const couchbase::core::topology::configuration &config) mutable {
445
+ std::shared_ptr<couchbase::core::topology::configuration> config) mutable {
446
446
  if (ec) {
447
447
  return barrier->set_value(tl::unexpected(ec));
448
448
  }
449
- if (!config.vbmap || config.vbmap->empty()) {
449
+ if (!config->vbmap || config->vbmap->empty()) {
450
450
  return barrier->set_value(tl::unexpected(
451
451
  couchbase::errc::common::feature_not_available));
452
452
  }
453
- barrier->set_value(config.vbmap.value());
453
+ barrier->set_value(config->vbmap.value());
454
454
  });
455
455
  auto vbucket_map = f.get();
456
456
  if (!vbucket_map.has_value()) {
@@ -1692,6 +1692,7 @@ struct js_to_cbpp_t<couchbase::core::operations::prepend_request> {
1692
1692
  js_to_cbpp<std::vector<std::byte>>(cppObj.value, jsObj.Get("value"));
1693
1693
  js_to_cbpp<std::uint16_t>(cppObj.partition, jsObj.Get("partition"));
1694
1694
  js_to_cbpp<std::uint32_t>(cppObj.opaque, jsObj.Get("opaque"));
1695
+ js_to_cbpp<couchbase::cas>(cppObj.cas, jsObj.Get("cas"));
1695
1696
  js_to_cbpp<couchbase::durability_level>(cppObj.durability_level,
1696
1697
  jsObj.Get("durability_level"));
1697
1698
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -1712,6 +1713,7 @@ struct js_to_cbpp_t<couchbase::core::operations::prepend_request> {
1712
1713
  resObj.Set("partition",
1713
1714
  cbpp_to_js<std::uint16_t>(env, cppObj.partition));
1714
1715
  resObj.Set("opaque", cbpp_to_js<std::uint32_t>(env, cppObj.opaque));
1716
+ resObj.Set("cas", cbpp_to_js<couchbase::cas>(env, cppObj.cas));
1715
1717
  resObj.Set("durability_level", cbpp_to_js<couchbase::durability_level>(
1716
1718
  env, cppObj.durability_level));
1717
1719
  resObj.Set("timeout",
@@ -1737,6 +1739,7 @@ struct js_to_cbpp_t<
1737
1739
  js_to_cbpp<std::vector<std::byte>>(cppObj.value, jsObj.Get("value"));
1738
1740
  js_to_cbpp<std::uint16_t>(cppObj.partition, jsObj.Get("partition"));
1739
1741
  js_to_cbpp<std::uint32_t>(cppObj.opaque, jsObj.Get("opaque"));
1742
+ js_to_cbpp<couchbase::cas>(cppObj.cas, jsObj.Get("cas"));
1740
1743
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
1741
1744
  cppObj.timeout, jsObj.Get("timeout"));
1742
1745
  // retries
@@ -1759,6 +1762,7 @@ struct js_to_cbpp_t<
1759
1762
  resObj.Set("partition",
1760
1763
  cbpp_to_js<std::uint16_t>(env, cppObj.partition));
1761
1764
  resObj.Set("opaque", cbpp_to_js<std::uint32_t>(env, cppObj.opaque));
1765
+ resObj.Set("cas", cbpp_to_js<couchbase::cas>(env, cppObj.cas));
1762
1766
  resObj.Set("timeout",
1763
1767
  cbpp_to_js<std::optional<std::chrono::milliseconds>>(
1764
1768
  env, cppObj.timeout));
@@ -2263,6 +2267,7 @@ struct js_to_cbpp_t<couchbase::core::operations::append_request> {
2263
2267
  js_to_cbpp<std::vector<std::byte>>(cppObj.value, jsObj.Get("value"));
2264
2268
  js_to_cbpp<std::uint16_t>(cppObj.partition, jsObj.Get("partition"));
2265
2269
  js_to_cbpp<std::uint32_t>(cppObj.opaque, jsObj.Get("opaque"));
2270
+ js_to_cbpp<couchbase::cas>(cppObj.cas, jsObj.Get("cas"));
2266
2271
  js_to_cbpp<couchbase::durability_level>(cppObj.durability_level,
2267
2272
  jsObj.Get("durability_level"));
2268
2273
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -2283,6 +2288,7 @@ struct js_to_cbpp_t<couchbase::core::operations::append_request> {
2283
2288
  resObj.Set("partition",
2284
2289
  cbpp_to_js<std::uint16_t>(env, cppObj.partition));
2285
2290
  resObj.Set("opaque", cbpp_to_js<std::uint32_t>(env, cppObj.opaque));
2291
+ resObj.Set("cas", cbpp_to_js<couchbase::cas>(env, cppObj.cas));
2286
2292
  resObj.Set("durability_level", cbpp_to_js<couchbase::durability_level>(
2287
2293
  env, cppObj.durability_level));
2288
2294
  resObj.Set("timeout",
@@ -2308,6 +2314,7 @@ struct js_to_cbpp_t<
2308
2314
  js_to_cbpp<std::vector<std::byte>>(cppObj.value, jsObj.Get("value"));
2309
2315
  js_to_cbpp<std::uint16_t>(cppObj.partition, jsObj.Get("partition"));
2310
2316
  js_to_cbpp<std::uint32_t>(cppObj.opaque, jsObj.Get("opaque"));
2317
+ js_to_cbpp<couchbase::cas>(cppObj.cas, jsObj.Get("cas"));
2311
2318
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
2312
2319
  cppObj.timeout, jsObj.Get("timeout"));
2313
2320
  // retries
@@ -2331,6 +2338,7 @@ struct js_to_cbpp_t<
2331
2338
  resObj.Set("partition",
2332
2339
  cbpp_to_js<std::uint16_t>(env, cppObj.partition));
2333
2340
  resObj.Set("opaque", cbpp_to_js<std::uint32_t>(env, cppObj.opaque));
2341
+ resObj.Set("cas", cbpp_to_js<couchbase::cas>(env, cppObj.cas));
2334
2342
  resObj.Set("timeout",
2335
2343
  cbpp_to_js<std::optional<std::chrono::milliseconds>>(
2336
2344
  env, cppObj.timeout));
@@ -32,7 +32,6 @@ CXX_CLIENT_CACHE = os.path.join(pathlib.Path(__file__).parent.parent, 'deps', 'c
32
32
 
33
33
  CXX_DEPS_INCLUDE_PATHS = {
34
34
  'asio': ['-I{0}/asio/{1}/asio/asio/include'],
35
- 'fmt': ['-I{0}/fmt/{1}/fmt/include'],
36
35
  'gsl': ['-I{0}/gsl/{1}/gsl/include'],
37
36
  'json': ['-I{0}/json/{1}/json/include',
38
37
  '-I{0}/json/{1}/json/external/PEGTL/include'