couchbase 4.2.1 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/CMakeLists.txt +1 -0
  2. package/deps/couchbase-cxx-client/.gitmodules +3 -0
  3. package/deps/couchbase-cxx-client/.idea/misc.xml +1 -0
  4. package/deps/couchbase-cxx-client/.idea/vcs.xml +1 -0
  5. package/deps/couchbase-cxx-client/CMakeLists.txt +11 -1
  6. package/deps/couchbase-cxx-client/README.md +3 -3
  7. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +4 -1
  8. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +13 -1
  9. package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
  10. package/deps/couchbase-cxx-client/core/cluster.hxx +15 -5
  11. package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +17 -6
  12. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -1
  13. package/deps/couchbase-cxx-client/core/impl/collection_query_index_manager.cxx +93 -0
  14. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +11 -0
  15. package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +119 -0
  16. package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +108 -0
  17. package/deps/couchbase-cxx-client/core/impl/get.cxx +1 -1
  18. package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +76 -0
  19. package/deps/couchbase-cxx-client/core/impl/query.cxx +5 -7
  20. package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +168 -0
  21. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +15 -1
  22. package/deps/couchbase-cxx-client/core/logger/configuration.hxx +3 -0
  23. package/deps/couchbase-cxx-client/core/logger/level.hxx +21 -0
  24. package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -6
  25. package/deps/couchbase-cxx-client/core/meta/CMakeLists.txt +4 -2
  26. package/deps/couchbase-cxx-client/core/meta/features.hxx +31 -0
  27. package/deps/couchbase-cxx-client/core/meta/version.cxx +67 -5
  28. package/deps/couchbase-cxx-client/core/meta/version.hxx +12 -1
  29. package/deps/couchbase-cxx-client/core/metrics/CMakeLists.txt +4 -1
  30. package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +46 -5
  31. package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +10 -26
  32. package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +3 -2
  33. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +10 -12
  34. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -3
  35. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +8 -14
  36. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -1
  37. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +15 -8
  38. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +7 -14
  39. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +2 -0
  40. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +11 -16
  41. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +2 -0
  42. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +8 -12
  43. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +4 -3
  44. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +21 -12
  45. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -2
  46. package/deps/couchbase-cxx-client/core/origin.hxx +1 -1
  47. package/deps/couchbase-cxx-client/core/platform/uuid.cc +1 -2
  48. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -1
  49. package/deps/couchbase-cxx-client/core/query_context.hxx +79 -0
  50. package/deps/couchbase-cxx-client/core/tracing/CMakeLists.txt +3 -1
  51. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +19 -4
  52. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +2 -2
  53. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +10 -4
  54. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +52 -63
  55. package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +8 -3
  56. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +163 -126
  57. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +24 -37
  58. package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +4 -4
  59. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +51 -13
  60. package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +26 -1
  61. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +21 -0
  62. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +40 -18
  63. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +5 -0
  64. package/deps/couchbase-cxx-client/core/transactions/result.hxx +26 -0
  65. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +48 -47
  66. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +6 -6
  67. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +33 -19
  68. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +18 -2
  69. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +25 -2
  70. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +4 -4
  71. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +49 -56
  72. package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +7 -7
  73. package/deps/couchbase-cxx-client/core/transactions.hxx +0 -12
  74. package/deps/couchbase-cxx-client/core/utils/binary.hxx +1 -1
  75. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +55 -0
  76. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +12 -45
  77. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +1 -1
  78. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +6 -7
  79. package/deps/couchbase-cxx-client/couchbase/collection.hxx +8 -0
  80. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +218 -0
  81. package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +3 -0
  82. package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +166 -0
  83. package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +172 -0
  84. package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +129 -0
  85. package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +116 -0
  86. package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +1 -1
  87. package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +46 -0
  88. package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +70 -0
  89. package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +46 -0
  90. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +100 -0
  91. package/deps/couchbase-cxx-client/{core → couchbase}/management/query_index.hxx +2 -2
  92. package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +16 -0
  93. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +178 -6
  94. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +1 -18
  95. package/deps/couchbase-cxx-client/couchbase/scope.hxx +5 -2
  96. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +16 -0
  97. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +11 -4
  98. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +5 -3
  99. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +16 -0
  100. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +0 -6
  101. package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +115 -0
  102. package/deps/couchbase-cxx-client/examples/minimal.cxx +3 -1
  103. package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +72 -0
  104. package/deps/couchbase-cxx-client/test/test_integration_management.cxx +727 -310
  105. package/deps/couchbase-cxx-client/test/test_integration_query.cxx +4 -8
  106. package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +14 -0
  107. package/deps/couchbase-cxx-client/test/test_transaction_transaction_public_blocking_api.cxx +34 -19
  108. package/deps/couchbase-cxx-client/test/test_unit_transaction_logging.cxx +66 -22
  109. package/deps/couchbase-cxx-client/test/test_unit_utils.cxx +51 -0
  110. package/deps/couchbase-cxx-client/test/tools/tool_kv_loader.cxx +2 -2
  111. package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -0
  112. package/deps/couchbase-cxx-client/test/utils/wait_until.cxx +4 -4
  113. package/deps/couchbase-cxx-client/third_party/docopt/.travis.yml +103 -0
  114. package/deps/couchbase-cxx-client/third_party/docopt/CMakeLists.txt +129 -0
  115. package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-Boost-1.0 +23 -0
  116. package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-MIT +23 -0
  117. package/deps/couchbase-cxx-client/third_party/docopt/README.rst +479 -0
  118. package/deps/couchbase-cxx-client/third_party/docopt/docopt-config.cmake +1 -0
  119. package/deps/couchbase-cxx-client/third_party/docopt/docopt.cpp +687 -0
  120. package/deps/couchbase-cxx-client/third_party/docopt/docopt.h +98 -0
  121. package/deps/couchbase-cxx-client/third_party/docopt/docopt.pc.in +9 -0
  122. package/deps/couchbase-cxx-client/third_party/docopt/docopt_private.h +676 -0
  123. package/deps/couchbase-cxx-client/third_party/docopt/docopt_util.h +122 -0
  124. package/deps/couchbase-cxx-client/third_party/docopt/docopt_value.h +341 -0
  125. package/deps/couchbase-cxx-client/third_party/docopt/examples/naval_fate.cpp +36 -0
  126. package/deps/couchbase-cxx-client/third_party/docopt/main.cpp +16 -0
  127. package/deps/couchbase-cxx-client/third_party/docopt/run_testcase.cpp +40 -0
  128. package/deps/couchbase-cxx-client/third_party/docopt/run_tests.py +72 -0
  129. package/deps/couchbase-cxx-client/third_party/docopt/testcases.docopt +957 -0
  130. package/deps/couchbase-cxx-client/tools/CMakeLists.txt +14 -0
  131. package/deps/couchbase-cxx-client/tools/cbc.cxx +65 -0
  132. package/deps/couchbase-cxx-client/tools/command.hxx +31 -0
  133. package/deps/couchbase-cxx-client/tools/command_registry.cxx +43 -0
  134. package/deps/couchbase-cxx-client/tools/command_registry.hxx +39 -0
  135. package/deps/couchbase-cxx-client/tools/get.cxx +267 -0
  136. package/deps/couchbase-cxx-client/tools/get.hxx +26 -0
  137. package/deps/couchbase-cxx-client/tools/query.cxx +441 -0
  138. package/deps/couchbase-cxx-client/tools/query.hxx +26 -0
  139. package/deps/couchbase-cxx-client/tools/utils.cxx +418 -0
  140. package/deps/couchbase-cxx-client/tools/utils.hxx +150 -0
  141. package/deps/couchbase-cxx-client/tools/version.cxx +82 -0
  142. package/deps/couchbase-cxx-client/tools/version.hxx +26 -0
  143. package/dist/authenticators.d.ts +2 -2
  144. package/dist/authenticators.js +1 -2
  145. package/dist/binding.d.ts +32 -16
  146. package/dist/cluster.js +14 -7
  147. package/dist/collection.d.ts +6 -0
  148. package/dist/collection.js +8 -0
  149. package/dist/queryexecutor.js +1 -1
  150. package/dist/queryindexmanager.d.ts +100 -4
  151. package/dist/queryindexmanager.js +344 -118
  152. package/dist/transactions.js +0 -2
  153. package/package.json +1 -1
  154. package/src/connection.cpp +2 -0
  155. package/src/connection.hpp +1 -0
  156. package/src/connection_autogen.cpp +16 -0
  157. package/src/jstocbpp_autogen.hpp +93 -23
  158. package/src/jstocbpp_basic.hpp +24 -0
  159. package/src/jstocbpp_transactions.hpp +0 -8
  160. package/tools/gen-bindings-js.js +1 -0
  161. package/tools/gen-bindings-json.py +4 -2
  162. package/deps/couchbase-cxx-client/core/transactions/logging.cxx +0 -107
@@ -1256,12 +1256,11 @@ struct js_to_cbpp_t<couchbase::core::management::search::index> {
1256
1256
  };
1257
1257
 
1258
1258
  template <>
1259
- struct js_to_cbpp_t<couchbase::core::management::query::index> {
1260
- static inline couchbase::core::management::query::index
1261
- from_js(Napi::Value jsVal)
1259
+ struct js_to_cbpp_t<couchbase::management::query::index> {
1260
+ static inline couchbase::management::query::index from_js(Napi::Value jsVal)
1262
1261
  {
1263
1262
  auto jsObj = jsVal.ToObject();
1264
- couchbase::core::management::query::index cppObj;
1263
+ couchbase::management::query::index cppObj;
1265
1264
  js_to_cbpp<bool>(cppObj.is_primary, jsObj.Get("is_primary"));
1266
1265
  js_to_cbpp<std::string>(cppObj.name, jsObj.Get("name"));
1267
1266
  js_to_cbpp<std::string>(cppObj.state, jsObj.Get("state"));
@@ -1280,8 +1279,7 @@ struct js_to_cbpp_t<couchbase::core::management::query::index> {
1280
1279
  return cppObj;
1281
1280
  }
1282
1281
  static inline Napi::Value
1283
- to_js(Napi::Env env,
1284
- const couchbase::core::management::query::index &cppObj)
1282
+ to_js(Napi::Env env, const couchbase::management::query::index &cppObj)
1285
1283
  {
1286
1284
  auto resObj = Napi::Object::New(env);
1287
1285
  resObj.Set("is_primary", cbpp_to_js<bool>(env, cppObj.is_primary));
@@ -2434,12 +2432,8 @@ struct js_to_cbpp_t<couchbase::core::operations::query_request> {
2434
2432
  cppObj.scan_consistency, jsObj.Get("scan_consistency"));
2435
2433
  js_to_cbpp<std::vector<couchbase::mutation_token>>(
2436
2434
  cppObj.mutation_state, jsObj.Get("mutation_state"));
2437
- js_to_cbpp<std::optional<std::string>>(cppObj.bucket_name,
2438
- jsObj.Get("bucket_name"));
2439
- js_to_cbpp<std::optional<std::string>>(cppObj.scope_name,
2440
- jsObj.Get("scope_name"));
2441
- js_to_cbpp<std::optional<std::string>>(cppObj.scope_qualifier,
2442
- jsObj.Get("scope_qualifier"));
2435
+ js_to_cbpp<std::optional<std::string>>(cppObj.query_context,
2436
+ jsObj.Get("query_context"));
2443
2437
  js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
2444
2438
  jsObj.Get("client_context_id"));
2445
2439
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -2492,12 +2486,8 @@ struct js_to_cbpp_t<couchbase::core::operations::query_request> {
2492
2486
  resObj.Set("mutation_state",
2493
2487
  cbpp_to_js<std::vector<couchbase::mutation_token>>(
2494
2488
  env, cppObj.mutation_state));
2495
- resObj.Set("bucket_name", cbpp_to_js<std::optional<std::string>>(
2496
- env, cppObj.bucket_name));
2497
- resObj.Set("scope_name", cbpp_to_js<std::optional<std::string>>(
2498
- env, cppObj.scope_name));
2499
- resObj.Set("scope_qualifier", cbpp_to_js<std::optional<std::string>>(
2500
- env, cppObj.scope_qualifier));
2489
+ resObj.Set("query_context", cbpp_to_js<std::optional<std::string>>(
2490
+ env, cppObj.query_context));
2501
2491
  resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
2502
2492
  env, cppObj.client_context_id));
2503
2493
  resObj.Set("timeout",
@@ -4893,7 +4883,7 @@ struct js_to_cbpp_t<
4893
4883
  cppObj;
4894
4884
  // ctx
4895
4885
  js_to_cbpp<std::string>(cppObj.status, jsObj.Get("status"));
4896
- js_to_cbpp<std::vector<couchbase::core::management::query::index>>(
4886
+ js_to_cbpp<std::vector<couchbase::management::query::index>>(
4897
4887
  cppObj.indexes, jsObj.Get("indexes"));
4898
4888
  return cppObj;
4899
4889
  }
@@ -4904,10 +4894,9 @@ struct js_to_cbpp_t<
4904
4894
  auto resObj = Napi::Object::New(env);
4905
4895
  // ctx
4906
4896
  resObj.Set("status", cbpp_to_js<std::string>(env, cppObj.status));
4907
- resObj.Set(
4908
- "indexes",
4909
- cbpp_to_js<std::vector<couchbase::core::management::query::index>>(
4910
- env, cppObj.indexes));
4897
+ resObj.Set("indexes",
4898
+ cbpp_to_js<std::vector<couchbase::management::query::index>>(
4899
+ env, cppObj.indexes));
4911
4900
  return resObj;
4912
4901
  }
4913
4902
  };
@@ -4926,6 +4915,8 @@ struct js_to_cbpp_t<
4926
4915
  js_to_cbpp<std::string>(cppObj.scope_name, jsObj.Get("scope_name"));
4927
4916
  js_to_cbpp<std::string>(cppObj.collection_name,
4928
4917
  jsObj.Get("collection_name"));
4918
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
4919
+ jsObj.Get("query_ctx"));
4929
4920
  js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
4930
4921
  jsObj.Get("client_context_id"));
4931
4922
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -4943,6 +4934,8 @@ struct js_to_cbpp_t<
4943
4934
  cbpp_to_js<std::string>(env, cppObj.scope_name));
4944
4935
  resObj.Set("collection_name",
4945
4936
  cbpp_to_js<std::string>(env, cppObj.collection_name));
4937
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
4938
+ env, cppObj.query_ctx));
4946
4939
  resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
4947
4940
  env, cppObj.client_context_id));
4948
4941
  resObj.Set("timeout",
@@ -5281,6 +5274,8 @@ struct js_to_cbpp_t<couchbase::core::operations::management::
5281
5274
  jsObj.Get("scope_name"));
5282
5275
  js_to_cbpp<std::optional<std::string>>(cppObj.collection_name,
5283
5276
  jsObj.Get("collection_name"));
5277
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
5278
+ jsObj.Get("query_ctx"));
5284
5279
  js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
5285
5280
  jsObj.Get("client_context_id"));
5286
5281
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -5298,6 +5293,8 @@ struct js_to_cbpp_t<couchbase::core::operations::management::
5298
5293
  env, cppObj.scope_name));
5299
5294
  resObj.Set("collection_name", cbpp_to_js<std::optional<std::string>>(
5300
5295
  env, cppObj.collection_name));
5296
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
5297
+ env, cppObj.query_ctx));
5301
5298
  resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
5302
5299
  env, cppObj.client_context_id));
5303
5300
  resObj.Set("timeout",
@@ -5683,6 +5680,8 @@ struct js_to_cbpp_t<
5683
5680
  js_to_cbpp<std::string>(cppObj.collection_name,
5684
5681
  jsObj.Get("collection_name"));
5685
5682
  js_to_cbpp<std::string>(cppObj.index_name, jsObj.Get("index_name"));
5683
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
5684
+ jsObj.Get("query_ctx"));
5686
5685
  js_to_cbpp<bool>(cppObj.is_primary, jsObj.Get("is_primary"));
5687
5686
  js_to_cbpp<bool>(cppObj.ignore_if_does_not_exist,
5688
5687
  jsObj.Get("ignore_if_does_not_exist"));
@@ -5706,6 +5705,8 @@ struct js_to_cbpp_t<
5706
5705
  cbpp_to_js<std::string>(env, cppObj.collection_name));
5707
5706
  resObj.Set("index_name",
5708
5707
  cbpp_to_js<std::string>(env, cppObj.index_name));
5708
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
5709
+ env, cppObj.query_ctx));
5709
5710
  resObj.Set("is_primary", cbpp_to_js<bool>(env, cppObj.is_primary));
5710
5711
  resObj.Set("ignore_if_does_not_exist",
5711
5712
  cbpp_to_js<bool>(env, cppObj.ignore_if_does_not_exist));
@@ -6005,6 +6006,8 @@ struct js_to_cbpp_t<
6005
6006
  js_to_cbpp<std::string>(cppObj.index_name, jsObj.Get("index_name"));
6006
6007
  js_to_cbpp<std::vector<std::string>>(cppObj.fields,
6007
6008
  jsObj.Get("fields"));
6009
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
6010
+ jsObj.Get("query_ctx"));
6008
6011
  js_to_cbpp<bool>(cppObj.is_primary, jsObj.Get("is_primary"));
6009
6012
  js_to_cbpp<bool>(cppObj.ignore_if_exists,
6010
6013
  jsObj.Get("ignore_if_exists"));
@@ -6034,6 +6037,8 @@ struct js_to_cbpp_t<
6034
6037
  cbpp_to_js<std::string>(env, cppObj.index_name));
6035
6038
  resObj.Set("fields",
6036
6039
  cbpp_to_js<std::vector<std::string>>(env, cppObj.fields));
6040
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
6041
+ env, cppObj.query_ctx));
6037
6042
  resObj.Set("is_primary", cbpp_to_js<bool>(env, cppObj.is_primary));
6038
6043
  resObj.Set("ignore_if_exists",
6039
6044
  cbpp_to_js<bool>(env, cppObj.ignore_if_exists));
@@ -6583,6 +6588,63 @@ struct js_to_cbpp_t<
6583
6588
  }
6584
6589
  };
6585
6590
 
6591
+ template <>
6592
+ struct js_to_cbpp_t<
6593
+ couchbase::core::operations::management::change_password_response> {
6594
+ static inline couchbase::core::operations::management::
6595
+ change_password_response
6596
+ from_js(Napi::Value jsVal)
6597
+ {
6598
+ auto jsObj = jsVal.ToObject();
6599
+ couchbase::core::operations::management::change_password_response
6600
+ cppObj;
6601
+ // ctx
6602
+ return cppObj;
6603
+ }
6604
+ static inline Napi::Value to_js(
6605
+ Napi::Env env,
6606
+ const couchbase::core::operations::management::change_password_response
6607
+ &cppObj)
6608
+ {
6609
+ auto resObj = Napi::Object::New(env);
6610
+ // ctx
6611
+ return resObj;
6612
+ }
6613
+ };
6614
+
6615
+ template <>
6616
+ struct js_to_cbpp_t<
6617
+ couchbase::core::operations::management::change_password_request> {
6618
+ static inline couchbase::core::operations::management::
6619
+ change_password_request
6620
+ from_js(Napi::Value jsVal)
6621
+ {
6622
+ auto jsObj = jsVal.ToObject();
6623
+ couchbase::core::operations::management::change_password_request cppObj;
6624
+ js_to_cbpp<std::string>(cppObj.newPassword, jsObj.Get("newPassword"));
6625
+ js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
6626
+ jsObj.Get("client_context_id"));
6627
+ js_to_cbpp<std::optional<std::chrono::milliseconds>>(
6628
+ cppObj.timeout, jsObj.Get("timeout"));
6629
+ return cppObj;
6630
+ }
6631
+ static inline Napi::Value
6632
+ to_js(Napi::Env env,
6633
+ const couchbase::core::operations::management::change_password_request
6634
+ &cppObj)
6635
+ {
6636
+ auto resObj = Napi::Object::New(env);
6637
+ resObj.Set("newPassword",
6638
+ cbpp_to_js<std::string>(env, cppObj.newPassword));
6639
+ resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
6640
+ env, cppObj.client_context_id));
6641
+ resObj.Set("timeout",
6642
+ cbpp_to_js<std::optional<std::chrono::milliseconds>>(
6643
+ env, cppObj.timeout));
6644
+ return resObj;
6645
+ }
6646
+ };
6647
+
6586
6648
  template <>
6587
6649
  struct js_to_cbpp_t<couchbase::core::operations::management::
6588
6650
  cluster_developer_preview_enable_response> {
@@ -9407,6 +9469,8 @@ struct js_to_cbpp_t<couchbase::core::operations::management::
9407
9469
  js_to_cbpp<std::string>(cppObj.scope_name, jsObj.Get("scope_name"));
9408
9470
  js_to_cbpp<std::string>(cppObj.collection_name,
9409
9471
  jsObj.Get("collection_name"));
9472
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
9473
+ jsObj.Get("query_ctx"));
9410
9474
  js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
9411
9475
  jsObj.Get("client_context_id"));
9412
9476
  js_to_cbpp<std::optional<std::chrono::milliseconds>>(
@@ -9424,6 +9488,8 @@ struct js_to_cbpp_t<couchbase::core::operations::management::
9424
9488
  cbpp_to_js<std::string>(env, cppObj.scope_name));
9425
9489
  resObj.Set("collection_name",
9426
9490
  cbpp_to_js<std::string>(env, cppObj.collection_name));
9491
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
9492
+ env, cppObj.query_ctx));
9427
9493
  resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
9428
9494
  env, cppObj.client_context_id));
9429
9495
  resObj.Set("timeout",
@@ -9506,6 +9572,8 @@ struct js_to_cbpp_t<
9506
9572
  js_to_cbpp<std::string>(cppObj.scope_name, jsObj.Get("scope_name"));
9507
9573
  js_to_cbpp<std::string>(cppObj.collection_name,
9508
9574
  jsObj.Get("collection_name"));
9575
+ js_to_cbpp<couchbase::core::query_context>(cppObj.query_ctx,
9576
+ jsObj.Get("query_ctx"));
9509
9577
  js_to_cbpp<std::vector<std::string>>(cppObj.index_names,
9510
9578
  jsObj.Get("index_names"));
9511
9579
  js_to_cbpp<std::optional<std::string>>(cppObj.client_context_id,
@@ -9526,6 +9594,8 @@ struct js_to_cbpp_t<
9526
9594
  cbpp_to_js<std::string>(env, cppObj.scope_name));
9527
9595
  resObj.Set("collection_name",
9528
9596
  cbpp_to_js<std::string>(env, cppObj.collection_name));
9597
+ resObj.Set("query_ctx", cbpp_to_js<couchbase::core::query_context>(
9598
+ env, cppObj.query_ctx));
9529
9599
  resObj.Set("index_names", cbpp_to_js<std::vector<std::string>>(
9530
9600
  env, cppObj.index_names));
9531
9601
  resObj.Set("client_context_id", cbpp_to_js<std::optional<std::string>>(
@@ -6,6 +6,7 @@
6
6
  #include "mutationtoken.hpp"
7
7
 
8
8
  #include <core/cluster.hxx>
9
+ #include <core/query_context.hxx>
9
10
 
10
11
  namespace couchnode
11
12
  {
@@ -107,4 +108,27 @@ struct js_to_cbpp_t<couchbase::mutation_token> {
107
108
  }
108
109
  };
109
110
 
111
+ template <>
112
+ struct js_to_cbpp_t<couchbase::core::query_context> {
113
+ static inline Napi::Value
114
+ to_js(Napi::Env env, const couchbase::core::query_context &cppObj)
115
+ {
116
+ auto resObj = Napi::Object::New(env);
117
+ resObj.Set("bucket_name", cbpp_to_js(env, cppObj.bucket_name()));
118
+ resObj.Set("scope_name", cbpp_to_js(env, cppObj.scope_name()));
119
+ return resObj;
120
+ }
121
+
122
+ static inline couchbase::core::query_context from_js(Napi::Value jsVal)
123
+ {
124
+ auto jsObj = jsVal.ToObject();
125
+ auto bucket_name = js_to_cbpp<std::string>(jsObj.Get("bucket_name"));
126
+ auto scope_name = js_to_cbpp<std::string>(jsObj.Get("scope_name"));
127
+ if (!bucket_name.empty() || !scope_name.empty()) {
128
+ return couchbase::core::query_context(bucket_name, scope_name);
129
+ }
130
+ return couchbase::core::query_context();
131
+ }
132
+ };
133
+
110
134
  } // namespace couchnode
@@ -327,14 +327,6 @@ struct js_to_cbpp_t<cbtxns::transaction_query_options> {
327
327
  if (named_parameters.has_value() && named_parameters.value().size() > 0) {
328
328
  cppObj.encoded_named_parameters(named_parameters.value());
329
329
  }
330
-
331
- auto bucket_name =
332
- js_to_cbpp<std::optional<std::string>>(jsObj.Get("bucket_name"));
333
- auto scope_name =
334
- js_to_cbpp<std::optional<std::string>>(jsObj.Get("scope_name"));
335
- if (bucket_name.has_value() && scope_name.has_value()) {
336
- cppObj.scope_qualifier(fmt::format("default:`{}`.`{}`", bucket_name.value(), scope_name.value()));
337
- }
338
330
 
339
331
  return cppObj;
340
332
  }
@@ -6,6 +6,7 @@ const CustomDefinedTypes = [
6
6
  'couchbase::cas',
7
7
  'couchbase::mutation_token',
8
8
  'couchbase::retry_strategy',
9
+ 'couchbase::core::query_context',
9
10
  ]
10
11
 
11
12
  const handleJsVariant = {
@@ -28,7 +28,7 @@ fileList = [
28
28
  "core/management/eventing_status.hxx",
29
29
  "core/management/rbac.hxx",
30
30
  "core/management/search_index.hxx",
31
- "core/management/query_index.hxx",
31
+ "couchbase/management/query_index.hxx",
32
32
  "couchbase/retry_reason.hxx",
33
33
  "core/topology/collections_manifest.hxx",
34
34
  "core/protocol/client_opcode.hxx",
@@ -63,6 +63,7 @@ fileList = [
63
63
  "core/range_scan_options.hxx",
64
64
  "core/scan_options.hxx",
65
65
  "core/range_scan_orchestrator_options.hxx",
66
+ "core/query_context.hxx",
66
67
  ]
67
68
 
68
69
  typeList = [
@@ -91,7 +92,7 @@ typeList = [
91
92
  "couchbase::core::management::rbac::user_and_metadata",
92
93
  "couchbase::core::management::rbac::group",
93
94
  "couchbase::core::management::search::index",
94
- "couchbase::core::management::query::index",
95
+ "couchbase::management::query::index",
95
96
  "couchbase::retry_reason",
96
97
  "couchbase::core::topology::collections_manifest",
97
98
  "couchbase::core::protocol::status",
@@ -154,6 +155,7 @@ typeList = [
154
155
  "couchbase::core::range_scan_create_result",
155
156
  "couchbase::core::range_scan_continue_result",
156
157
  "couchbase::core::range_scan_cancel_result",
158
+ "couchbase::core::query_context",
157
159
  ]
158
160
 
159
161
  # end of configurable part
@@ -1,107 +0,0 @@
1
- /*
2
- * Copyright 2021-Present Couchbase, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #include "internal/logging.hxx"
18
- #include "core/transactions.hxx"
19
-
20
- #include <spdlog/sinks/stdout_sinks.h>
21
-
22
- namespace couchbase::core::transactions
23
- {
24
- // TODO: consider always using async logger? Makes life easier, I think, in
25
- // wrappers. For instance, in python the GIL may, or may not, be held
26
- // by the thread that is logging. So there are deadlock possibilities
27
- // that can only be worked around by making the custom sink asynchronous.
28
- // A single thread in the thread pool that services each async logger would
29
- // keep ordering in place, _and_ make a much simpler sink to implement.
30
- // That would have to also be done in the client, and of course, there is the
31
- // sizing of the queue to take into account, etc...
32
- std::shared_ptr<spdlog::logger>
33
- init_txn_log()
34
- {
35
- static auto txnlogger = spdlog::stderr_logger_mt(TXN_LOG);
36
- return txnlogger;
37
- }
38
-
39
- std::shared_ptr<spdlog::logger>
40
- init_attempt_cleanup_log()
41
- {
42
- static auto txnlogger = spdlog::stderr_logger_mt(ATTEMPT_CLEANUP_LOG);
43
- return txnlogger;
44
- }
45
- std::shared_ptr<spdlog::logger>
46
- init_lost_attempts_log()
47
- {
48
- static auto txnlogger = spdlog::stderr_logger_mt(LOST_ATTEMPT_CLEANUP_LOG);
49
- return txnlogger;
50
- }
51
-
52
- // TODO: better integration with client, so we don't need to repeat this private
53
- // method.
54
- spdlog::level::level_enum
55
- translate_level(core::logger::level level)
56
- {
57
- switch (level) {
58
- case core::logger::level::trace:
59
- return spdlog::level::level_enum::trace;
60
- case core::logger::level::debug:
61
- return spdlog::level::level_enum::debug;
62
- case core::logger::level::info:
63
- return spdlog::level::level_enum::info;
64
- case core::logger::level::warn:
65
- return spdlog::level::level_enum::warn;
66
- case core::logger::level::err:
67
- return spdlog::level::level_enum::err;
68
- case core::logger::level::critical:
69
- return spdlog::level::level_enum::critical;
70
- case core::logger::level::off:
71
- return spdlog::level::level_enum::off;
72
- }
73
- return spdlog::level::level_enum::trace;
74
- }
75
-
76
- void
77
- set_transactions_log_level(core::logger::level level)
78
- {
79
- spdlog::level::level_enum lvl = translate_level(level);
80
- txn_log->set_level(lvl);
81
- attempt_cleanup_log->set_level(lvl);
82
- lost_attempts_cleanup_log->set_level(lvl);
83
- }
84
-
85
- // This cannot be done in multiple threads at the same time. We could
86
- // consider a mutex, but eventually we will merge with the cxx_client so
87
- // this will be fine for now. Unsure if this will lead to issues if called
88
- // while logging is happening in other threads. Do this once, at startup.
89
- void
90
- create_loggers(core::logger::level level, spdlog::sink_ptr sink)
91
- {
92
- if (nullptr != sink) {
93
- sink->set_level(translate_level(level));
94
- txn_log->flush();
95
- txn_log->sinks().clear();
96
- txn_log->sinks().push_back(sink);
97
- attempt_cleanup_log->flush();
98
- attempt_cleanup_log->sinks().clear();
99
- attempt_cleanup_log->sinks().push_back(sink);
100
- lost_attempts_cleanup_log->flush();
101
- lost_attempts_cleanup_log->sinks().clear();
102
- lost_attempts_cleanup_log->sinks().push_back(sink);
103
- }
104
- set_transactions_log_level(level);
105
- }
106
-
107
- } // namespace couchbase::core::transactions