couchbase 3.2.4 → 3.2.5

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 (70) hide show
  1. package/binding.gyp +5 -0
  2. package/deps/lcb/CMakeLists.txt +1 -1
  3. package/deps/lcb/RELEASE_NOTES.markdown +12 -0
  4. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  5. package/deps/lcb/doc/Doxyfile +1 -1
  6. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  7. package/deps/lcb/include/libcouchbase/couchbase.h +52 -0
  8. package/deps/lcb/include/libcouchbase/error.h +4 -1
  9. package/deps/lcb/libcouchbase.gyp +7 -1
  10. package/deps/lcb/src/capi/cmd_counter.hh +12 -0
  11. package/deps/lcb/src/capi/cmd_exists.hh +12 -0
  12. package/deps/lcb/src/capi/cmd_get.hh +12 -0
  13. package/deps/lcb/src/capi/cmd_get_replica.hh +14 -1
  14. package/deps/lcb/src/capi/cmd_query.cc +13 -0
  15. package/deps/lcb/src/capi/cmd_query.hh +22 -14
  16. package/deps/lcb/src/capi/cmd_remove.hh +12 -0
  17. package/deps/lcb/src/capi/cmd_store.hh +12 -0
  18. package/deps/lcb/src/capi/cmd_subdoc.hh +12 -0
  19. package/deps/lcb/src/capi/cmd_touch.hh +12 -0
  20. package/deps/lcb/src/capi/cmd_unlock.hh +12 -0
  21. package/deps/lcb/src/capi/collection_qualifier.hh +4 -6
  22. package/deps/lcb/src/internal.h +2 -1
  23. package/deps/lcb/src/mcserver/negotiate.cc +3 -0
  24. package/deps/lcb/src/n1ql/n1ql.cc +5 -1
  25. package/deps/lcb/src/n1ql/query_handle.cc +55 -30
  26. package/deps/lcb/src/n1ql/query_handle.hh +14 -2
  27. package/deps/lcb/src/operations/counter.cc +12 -0
  28. package/deps/lcb/src/operations/exists.cc +12 -0
  29. package/deps/lcb/src/operations/get.cc +12 -0
  30. package/deps/lcb/src/operations/get_replica.cc +18 -6
  31. package/deps/lcb/src/operations/remove.cc +12 -0
  32. package/deps/lcb/src/operations/store.cc +12 -0
  33. package/deps/lcb/src/operations/subdoc.cc +12 -0
  34. package/deps/lcb/src/operations/touch.cc +12 -0
  35. package/deps/lcb/src/operations/unlock.cc +12 -0
  36. package/deps/lcb/src/search/search_handle.cc +1 -2
  37. package/deps/lcb/src/ssl/ssl_common.c +1 -1
  38. package/deps/lcb/src/utilities.cc +21 -0
  39. package/deps/lcb/src/utilities.h +3 -0
  40. package/deps/lcb/tests/iotests/mock-environment.cc +10 -1
  41. package/deps/lcb/tests/iotests/mock-environment.h +2 -1
  42. package/deps/lcb/tests/iotests/serverparams.h +7 -2
  43. package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
  44. package/deps/lcb/tests/iotests/testutil.cc +174 -0
  45. package/deps/lcb/tests/iotests/testutil.h +53 -0
  46. package/dist/analyticsexecutor.js +2 -2
  47. package/dist/analyticsindexmanager.js +3 -3
  48. package/dist/binarycollection.d.ts +17 -0
  49. package/dist/binding.js +1 -1
  50. package/dist/bindingutilities.js +5 -1
  51. package/dist/bucketmanager.d.ts +1 -22
  52. package/dist/bucketmanager.js +5 -5
  53. package/dist/cluster.js +1 -1
  54. package/dist/collection.js +6 -6
  55. package/dist/collectionmanager.js +2 -2
  56. package/dist/connection.js +3 -3
  57. package/dist/connspec.js +5 -1
  58. package/dist/couchbase.js +5 -1
  59. package/dist/httpexecutor.js +5 -1
  60. package/dist/logging.js +1 -1
  61. package/dist/queryexecutor.js +3 -3
  62. package/dist/searchindexmanager.js +1 -1
  63. package/dist/usermanager.js +2 -2
  64. package/dist/utilities.d.ts +1 -2
  65. package/dist/utilities.js +9 -2
  66. package/dist/viewexecutor.js +1 -1
  67. package/package.json +1 -1
  68. package/src/uv-plugin-all.cpp +1 -0
  69. package/dist/cas.d.ts +0 -0
  70. package/dist/cas.js +0 -1
@@ -629,3 +629,177 @@ void TestMeter::destroy_lcb_meter()
629
629
  lcbmeter_ = nullptr;
630
630
  }
631
631
  }
632
+
633
+ void enforce_rate_limits(lcb_INSTANCE *instance)
634
+ {
635
+ (void)lcb_install_callback(instance, LCB_CALLBACK_HTTP, (lcb_RESPCALLBACK)http_callback);
636
+
637
+ lcb_CMDHTTP *cmd;
638
+ std::string path = "/internalSettings";
639
+ std::string body = "enforceLimits=true";
640
+
641
+ lcb_cmdhttp_create(&cmd, LCB_HTTP_TYPE_MANAGEMENT);
642
+ lcb_cmdhttp_method(cmd, LCB_HTTP_METHOD_POST);
643
+ lcb_cmdhttp_path(cmd, path.c_str(), path.size());
644
+ lcb_cmdhttp_body(cmd, body.c_str(), body.size());
645
+
646
+ http_result result{};
647
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_http(instance, &result, cmd));
648
+ lcb_cmdhttp_destroy(cmd);
649
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_wait(instance, LCB_WAIT_DEFAULT));
650
+ ASSERT_STATUS_EQ(LCB_SUCCESS, result.rc);
651
+ }
652
+
653
+ void create_rate_limited_user(lcb_INSTANCE *instance, const std::string &username, const rate_limits &limits)
654
+ {
655
+ (void)lcb_install_callback(instance, LCB_CALLBACK_HTTP, (lcb_RESPCALLBACK)http_callback);
656
+
657
+ lcb_CMDHTTP *cmd;
658
+ std::string path = "/settings/rbac/users/local/" + username;
659
+ std::string body = "password=password&roles=admin";
660
+ Json::Value json_limits;
661
+ if (limits.kv_limits.enforce) {
662
+ Json::Value kv_limits;
663
+ if (limits.kv_limits.num_connections > 0) {
664
+ kv_limits["num_connections"] = limits.kv_limits.num_connections;
665
+ }
666
+ if (limits.kv_limits.num_ops_per_min > 0) {
667
+ kv_limits["num_ops_per_min"] = limits.kv_limits.num_ops_per_min;
668
+ }
669
+ if (limits.kv_limits.ingress_mib_per_min > 0) {
670
+ kv_limits["ingress_mib_per_min"] = limits.kv_limits.ingress_mib_per_min;
671
+ }
672
+ if (limits.kv_limits.egress_mib_per_min > 0) {
673
+ kv_limits["egress_mib_per_min"] = limits.kv_limits.egress_mib_per_min;
674
+ }
675
+ json_limits["kv"] = kv_limits;
676
+ }
677
+ if (limits.query_limits.enforce) {
678
+ Json::Value query_limits;
679
+ if (limits.query_limits.num_concurrent_requests > 0) {
680
+ query_limits["num_concurrent_requests"] = limits.query_limits.num_concurrent_requests;
681
+ }
682
+ if (limits.query_limits.num_queries_per_min > 0) {
683
+ query_limits["num_queries_per_min"] = limits.query_limits.num_queries_per_min;
684
+ }
685
+ if (limits.query_limits.ingress_mib_per_min > 0) {
686
+ query_limits["ingress_mib_per_min"] = limits.query_limits.ingress_mib_per_min;
687
+ }
688
+ if (limits.query_limits.egress_mib_per_min > 0) {
689
+ query_limits["egress_mib_per_min"] = limits.query_limits.egress_mib_per_min;
690
+ }
691
+ json_limits["query"] = query_limits;
692
+ }
693
+ if (limits.search_limits.enforce) {
694
+ Json::Value fts_limits;
695
+ if (limits.search_limits.num_concurrent_requests > 0) {
696
+ fts_limits["num_concurrent_requests"] = limits.search_limits.num_concurrent_requests;
697
+ }
698
+ if (limits.search_limits.num_queries_per_min > 0) {
699
+ fts_limits["num_queries_per_min"] = limits.search_limits.num_queries_per_min;
700
+ }
701
+ if (limits.search_limits.ingress_mib_per_min > 0) {
702
+ fts_limits["ingress_mib_per_min"] = limits.search_limits.ingress_mib_per_min;
703
+ }
704
+ if (limits.search_limits.egress_mib_per_min > 0) {
705
+ fts_limits["egress_mib_per_min"] = limits.search_limits.egress_mib_per_min;
706
+ }
707
+ json_limits["fts"] = fts_limits;
708
+ }
709
+ std::string j_limits = Json::FastWriter().write(json_limits);
710
+ body += "&limits=" + j_limits;
711
+ std::string content_type = "application/x-www-form-urlencoded";
712
+
713
+ lcb_cmdhttp_create(&cmd, LCB_HTTP_TYPE_MANAGEMENT);
714
+ lcb_cmdhttp_method(cmd, LCB_HTTP_METHOD_PUT);
715
+ lcb_cmdhttp_path(cmd, path.c_str(), path.size());
716
+ lcb_cmdhttp_body(cmd, body.c_str(), body.size());
717
+ lcb_cmdhttp_content_type(cmd, content_type.c_str(), content_type.size());
718
+
719
+ http_result result{};
720
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_http(instance, &result, cmd));
721
+ lcb_cmdhttp_destroy(cmd);
722
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_wait(instance, LCB_WAIT_DEFAULT));
723
+ ASSERT_STATUS_EQ(LCB_SUCCESS, result.rc);
724
+ }
725
+
726
+ void create_rate_limited_scope(lcb_INSTANCE *instance, const std::string &bucket, std::string &scope,
727
+ const scope_rate_limits &limits)
728
+ {
729
+ (void)lcb_install_callback(instance, LCB_CALLBACK_HTTP, (lcb_RESPCALLBACK)http_callback);
730
+
731
+ lcb_CMDHTTP *cmd;
732
+ std::string path = "/pools/default/buckets/" + bucket + "/scopes";
733
+ std::string body = "name=" + scope;
734
+ Json::Value json_limits;
735
+ if (limits.kv_scope_limits.enforce) {
736
+ Json::Value kv_limits;
737
+ kv_limits["data_size"] = limits.kv_scope_limits.data_size;
738
+ json_limits["kv"] = kv_limits;
739
+ }
740
+ if (limits.index_scope_limits.enforce) {
741
+ Json::Value index_limits;
742
+ index_limits["num_indexes"] = limits.index_scope_limits.num_indexes;
743
+ json_limits["index"] = index_limits;
744
+ }
745
+ std::string j_limits = Json::FastWriter().write(json_limits);
746
+ body += "&limits=" + j_limits;
747
+ std::string content_type = "application/x-www-form-urlencoded";
748
+
749
+ lcb_cmdhttp_create(&cmd, LCB_HTTP_TYPE_MANAGEMENT);
750
+ lcb_cmdhttp_method(cmd, LCB_HTTP_METHOD_POST);
751
+ lcb_cmdhttp_path(cmd, path.c_str(), path.size());
752
+ lcb_cmdhttp_body(cmd, body.c_str(), body.size());
753
+ lcb_cmdhttp_content_type(cmd, content_type.c_str(), content_type.size());
754
+
755
+ http_result result{};
756
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_http(instance, &result, cmd));
757
+ lcb_cmdhttp_destroy(cmd);
758
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_wait(instance, LCB_WAIT_DEFAULT));
759
+ ASSERT_STATUS_EQ(LCB_SUCCESS, result.rc);
760
+ }
761
+
762
+ void drop_user(lcb_INSTANCE *instance, const std::string &username)
763
+ {
764
+ (void)lcb_install_callback(instance, LCB_CALLBACK_HTTP, (lcb_RESPCALLBACK)http_callback);
765
+
766
+ lcb_CMDHTTP *cmd;
767
+ std::string path = "/settings/rbac/users/local/" + username;
768
+
769
+ lcb_cmdhttp_create(&cmd, LCB_HTTP_TYPE_MANAGEMENT);
770
+ lcb_cmdhttp_method(cmd, LCB_HTTP_METHOD_DELETE);
771
+ lcb_cmdhttp_path(cmd, path.c_str(), path.size());
772
+
773
+ http_result result{};
774
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_http(instance, &result, cmd));
775
+ lcb_cmdhttp_destroy(cmd);
776
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_wait(instance, LCB_WAIT_DEFAULT));
777
+ ASSERT_STATUS_EQ(LCB_SUCCESS, result.rc);
778
+ }
779
+
780
+ void create_search_index(lcb_INSTANCE *instance, const std::string &index_name, const std::string &type,
781
+ const std::string &source_type, const std::string &source_name)
782
+ {
783
+ (void)lcb_install_callback(instance, LCB_CALLBACK_HTTP, (lcb_RESPCALLBACK)http_callback);
784
+
785
+ lcb_CMDHTTP *cmd;
786
+ std::string path = "/api/index/" + index_name;
787
+ Json::Value json_body;
788
+ json_body["name"] = index_name;
789
+ json_body["type"] = type;
790
+ json_body["sourceName"] = source_name;
791
+ json_body["sourceType"] = source_type;
792
+
793
+ auto body = Json::FastWriter().write(json_body);
794
+
795
+ lcb_cmdhttp_create(&cmd, LCB_HTTP_TYPE_SEARCH);
796
+ lcb_cmdhttp_method(cmd, LCB_HTTP_METHOD_PUT);
797
+ lcb_cmdhttp_path(cmd, path.c_str(), path.size());
798
+ lcb_cmdhttp_body(cmd, body.c_str(), body.size());
799
+
800
+ http_result result{};
801
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_http(instance, &result, cmd));
802
+ lcb_cmdhttp_destroy(cmd);
803
+ ASSERT_STATUS_EQ(LCB_SUCCESS, lcb_wait(instance, LCB_WAIT_DEFAULT));
804
+ ASSERT_STATUS_EQ(LCB_SUCCESS, result.rc);
805
+ }
@@ -323,4 +323,57 @@ class TestMeter
323
323
  bool enabled_{false};
324
324
  };
325
325
 
326
+ struct kv_rate_limits {
327
+ uint32_t num_connections{0};
328
+ uint32_t num_ops_per_min{0};
329
+ uint32_t ingress_mib_per_min{0};
330
+ uint32_t egress_mib_per_min{0};
331
+ bool enforce{false};
332
+ };
333
+
334
+ struct query_rate_limits {
335
+ uint32_t ingress_mib_per_min{0};
336
+ uint32_t egress_mib_per_min{0};
337
+ uint32_t num_concurrent_requests{0};
338
+ uint32_t num_queries_per_min{0};
339
+ bool enforce{false};
340
+ };
341
+
342
+ struct search_rate_limits {
343
+ uint32_t ingress_mib_per_min{0};
344
+ uint32_t egress_mib_per_min{0};
345
+ uint32_t num_concurrent_requests{0};
346
+ uint32_t num_queries_per_min{0};
347
+ bool enforce{false};
348
+ };
349
+
350
+ struct rate_limits {
351
+ kv_rate_limits kv_limits{};
352
+ query_rate_limits query_limits{};
353
+ search_rate_limits search_limits{};
354
+ };
355
+
356
+ struct kv_scope_rate_limits {
357
+ uint32_t data_size;
358
+ bool enforce{false};
359
+ };
360
+
361
+ struct index_scope_rate_limits {
362
+ uint32_t num_indexes{0};
363
+ bool enforce{false};
364
+ };
365
+
366
+ struct scope_rate_limits {
367
+ kv_scope_rate_limits kv_scope_limits;
368
+ index_scope_rate_limits index_scope_limits;
369
+ };
370
+
371
+ void enforce_rate_limits(lcb_INSTANCE *instance);
372
+ void create_rate_limited_user(lcb_INSTANCE *instance, const std::string &username, const rate_limits &limits);
373
+ void drop_user(lcb_INSTANCE *instance, const std::string &username);
374
+ void create_rate_limited_scope(lcb_INSTANCE *instance, const std::string &bucket, std::string &scope,
375
+ const scope_rate_limits &limits);
376
+ void create_search_index(lcb_INSTANCE *instance, const std::string &index_name, const std::string &type,
377
+ const std::string &source_type, const std::string &source_name);
378
+
326
379
  #endif
@@ -82,8 +82,8 @@ class AnalyticsExecutor {
82
82
  }
83
83
  const metricsData = metaData.metrics || {};
84
84
  const metrics = new analyticstypes_1.AnalyticsMetrics({
85
- elapsedTime: utilities_1.goDurationStrToMs(metricsData.elapsedTime) || 0,
86
- executionTime: utilities_1.goDurationStrToMs(metricsData.executionTime) || 0,
85
+ elapsedTime: (0, utilities_1.goDurationStrToMs)(metricsData.elapsedTime) || 0,
86
+ executionTime: (0, utilities_1.goDurationStrToMs)(metricsData.executionTime) || 0,
87
87
  resultCount: metricsData.resultCount || 0,
88
88
  resultSize: metricsData.resultSize || 0,
89
89
  errorCount: metricsData.errorCount || 0,
@@ -801,7 +801,7 @@ class AnalyticsIndexManager {
801
801
  method: httpexecutor_1.HttpMethod.Post,
802
802
  path: linkData.httpPath,
803
803
  contentType: 'application/x-www-form-urlencoded',
804
- body: utilities_1.cbQsStringify({
804
+ body: (0, utilities_1.cbQsStringify)({
805
805
  linkData,
806
806
  httpPath: undefined,
807
807
  }),
@@ -845,7 +845,7 @@ class AnalyticsIndexManager {
845
845
  method: httpexecutor_1.HttpMethod.Put,
846
846
  path: linkData.httpPath,
847
847
  contentType: 'application/x-www-form-urlencoded',
848
- body: utilities_1.cbQsStringify({
848
+ body: (0, utilities_1.cbQsStringify)({
849
849
  linkData,
850
850
  httpPath: undefined,
851
851
  }),
@@ -904,7 +904,7 @@ class AnalyticsIndexManager {
904
904
  method: httpexecutor_1.HttpMethod.Delete,
905
905
  path: httpPath,
906
906
  contentType: 'application/x-www-form-urlencoded',
907
- body: utilities_1.cbQsStringify(httpParams),
907
+ body: (0, utilities_1.cbQsStringify)(httpParams),
908
908
  parentSpan: parentSpan,
909
909
  timeout: timeout,
910
910
  });
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Collection } from './collection';
3
3
  import { CounterResult, MutationResult } from './crudoptypes';
4
+ import { DurabilityLevel } from './generaltypes';
4
5
  import { RequestSpan } from './tracing';
5
6
  import { NodeCallback } from './utilities';
6
7
  /**
@@ -17,6 +18,10 @@ export interface IncrementOptions {
17
18
  * The expiry time that should be set for the document, expressed in seconds.
18
19
  */
19
20
  expiry?: number;
21
+ /**
22
+ * Specifies the level of synchronous durability for this operation.
23
+ */
24
+ durabilityLevel?: DurabilityLevel;
20
25
  /**
21
26
  * The parent tracing span that this operation will be part of.
22
27
  */
@@ -40,6 +45,10 @@ export interface DecrementOptions {
40
45
  * The expiry time that should be set for the document, expressed in seconds.
41
46
  */
42
47
  expiry?: number;
48
+ /**
49
+ * Specifies the level of synchronous durability for this operation.
50
+ */
51
+ durabilityLevel?: DurabilityLevel;
43
52
  /**
44
53
  * The parent tracing span that this operation will be part of.
45
54
  */
@@ -53,6 +62,10 @@ export interface DecrementOptions {
53
62
  * @category Key-Value
54
63
  */
55
64
  export interface AppendOptions {
65
+ /**
66
+ * Specifies the level of synchronous durability for this operation.
67
+ */
68
+ durabilityLevel?: DurabilityLevel;
56
69
  /**
57
70
  * The parent tracing span that this operation will be part of.
58
71
  */
@@ -66,6 +79,10 @@ export interface AppendOptions {
66
79
  * @category Key-Value
67
80
  */
68
81
  export interface PrependOptions {
82
+ /**
83
+ * Specifies the level of synchronous durability for this operation.
84
+ */
85
+ durabilityLevel?: DurabilityLevel;
69
86
  /**
70
87
  * The parent tracing span that this operation will be part of.
71
88
  */
package/dist/binding.js CHANGED
@@ -67,5 +67,5 @@ var CppAnalyticsQueryRespFlags;
67
67
  (function (CppAnalyticsQueryRespFlags) {
68
68
  })(CppAnalyticsQueryRespFlags = exports.CppAnalyticsQueryRespFlags || (exports.CppAnalyticsQueryRespFlags = {}));
69
69
  // Load it with require
70
- const binding = bindings_1.default('couchbase_impl');
70
+ const binding = (0, bindings_1.default)('couchbase_impl');
71
71
  exports.default = binding;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -283,26 +283,6 @@ export interface ICreateBucketSettings extends IBucketSettings {
283
283
  */
284
284
  conflictResolutionType: ConflictResolutionType | string;
285
285
  }
286
- /**
287
- * We intentionally do not export this class as it is never returned back
288
- * to the user, but we still need the ability to translate to NS data.
289
- *
290
- * @internal
291
- */
292
- declare class CreateBucketSettings extends BucketSettings implements ICreateBucketSettings {
293
- /**
294
- * Specifies the conflict resolution mode to use for XDCR of this bucket.
295
- */
296
- conflictResolutionType: ConflictResolutionType;
297
- /**
298
- * @internal
299
- */
300
- constructor(data: CreateBucketSettings);
301
- /**
302
- * @internal
303
- */
304
- static _toNsData(data: ICreateBucketSettings): any;
305
- }
306
286
  /**
307
287
  * @category Management
308
288
  */
@@ -401,7 +381,7 @@ export declare class BucketManager {
401
381
  * @param options Optional parameters for this operation.
402
382
  * @param callback A node-style callback to be invoked after execution.
403
383
  */
404
- createBucket(settings: CreateBucketSettings, options?: CreateBucketOptions, callback?: NodeCallback<void>): Promise<void>;
384
+ createBucket(settings: ICreateBucketSettings, options?: CreateBucketOptions, callback?: NodeCallback<void>): Promise<void>;
405
385
  /**
406
386
  * Updates the settings for an existing bucket.
407
387
  *
@@ -442,4 +422,3 @@ export declare class BucketManager {
442
422
  */
443
423
  flushBucket(bucketName: string, options?: FlushBucketOptions, callback?: NodeCallback<void>): Promise<void>;
444
424
  }
445
- export {};
@@ -164,7 +164,7 @@ class BucketSettings {
164
164
  * @deprecated Use {@link IBucketSettings.minimumDurabilityLevel} instead.
165
165
  */
166
166
  get durabilityMinLevel() {
167
- return utilities_1.duraLevelToNsServerStr(this.minimumDurabilityLevel);
167
+ return (0, utilities_1.duraLevelToNsServerStr)(this.minimumDurabilityLevel);
168
168
  }
169
169
  /**
170
170
  * @internal
@@ -182,7 +182,7 @@ class BucketSettings {
182
182
  maxTTL: data.maxTTL || data.maxExpiry,
183
183
  compressionMode: data.compressionMode,
184
184
  durabilityMinLevel: data.durabilityMinLevel ||
185
- utilities_1.duraLevelToNsServerStr(data.minimumDurabilityLevel),
185
+ (0, utilities_1.duraLevelToNsServerStr)(data.minimumDurabilityLevel),
186
186
  };
187
187
  }
188
188
  /**
@@ -200,7 +200,7 @@ class BucketSettings {
200
200
  evictionPolicy: data.evictionPolicy,
201
201
  maxExpiry: data.maxTTL,
202
202
  compressionMode: data.compressionMode,
203
- minimumDurabilityLevel: utilities_1.nsServerStrToDuraLevel(data.durabilityMinLevel),
203
+ minimumDurabilityLevel: (0, utilities_1.nsServerStrToDuraLevel)(data.durabilityMinLevel),
204
204
  maxTTL: 0,
205
205
  durabilityMinLevel: '',
206
206
  ejectionMethod: '',
@@ -272,7 +272,7 @@ class BucketManager {
272
272
  method: httpexecutor_1.HttpMethod.Post,
273
273
  path: `/pools/default/buckets`,
274
274
  contentType: 'application/x-www-form-urlencoded',
275
- body: utilities_1.cbQsStringify(bucketData),
275
+ body: (0, utilities_1.cbQsStringify)(bucketData),
276
276
  parentSpan: parentSpan,
277
277
  timeout: timeout,
278
278
  });
@@ -310,7 +310,7 @@ class BucketManager {
310
310
  method: httpexecutor_1.HttpMethod.Post,
311
311
  path: `/pools/default/buckets/${settings.name}`,
312
312
  contentType: 'application/x-www-form-urlencoded',
313
- body: utilities_1.cbQsStringify(bucketData),
313
+ body: (0, utilities_1.cbQsStringify)(bucketData),
314
314
  parentSpan: parentSpan,
315
315
  timeout: timeout,
316
316
  });
package/dist/cluster.js CHANGED
@@ -378,7 +378,7 @@ class Cluster {
378
378
  conn = new connection_1.Connection(connOpts);
379
379
  conn.connect((err) => {
380
380
  if (err) {
381
- logging_1.libLogger('failed to connect to bucket: %O', err);
381
+ (0, logging_1.libLogger)('failed to connect to bucket: %O', err);
382
382
  conn.close(() => undefined);
383
383
  }
384
384
  });
@@ -278,7 +278,7 @@ class Collection {
278
278
  options = {};
279
279
  }
280
280
  const cas = options.cas || null;
281
- const cppDuraMode = bindingutilities_1.duraLevelToCppDuraMode(options.durabilityLevel);
281
+ const cppDuraMode = (0, bindingutilities_1.duraLevelToCppDuraMode)(options.durabilityLevel);
282
282
  const persistTo = options.durabilityPersistTo;
283
283
  const replicateTo = options.durabilityReplicateTo;
284
284
  const parentSpan = options.parentSpan;
@@ -342,7 +342,7 @@ class Collection {
342
342
  if (!options) {
343
343
  options = {};
344
344
  }
345
- const cppDuraMode = bindingutilities_1.duraLevelToCppDuraMode(options.durabilityLevel);
345
+ const cppDuraMode = (0, bindingutilities_1.duraLevelToCppDuraMode)(options.durabilityLevel);
346
346
  const persistTo = options.durabilityPersistTo;
347
347
  const replicateTo = options.durabilityReplicateTo;
348
348
  const parentSpan = options.parentSpan;
@@ -445,7 +445,7 @@ class Collection {
445
445
  if (res && res.content) {
446
446
  for (let i = 0; i < res.content.length; ++i) {
447
447
  const itemRes = res.content[i];
448
- itemRes.error = bindingutilities_1.translateCppError(itemRes.error);
448
+ itemRes.error = (0, bindingutilities_1.translateCppError)(itemRes.error);
449
449
  if (itemRes.value && itemRes.value.length > 0) {
450
450
  itemRes.value = JSON.parse(itemRes.value);
451
451
  }
@@ -516,7 +516,7 @@ class Collection {
516
516
  }
517
517
  const expiry = options.preserveExpiry ? -1 : options.expiry;
518
518
  const cas = options.cas;
519
- const cppDuraMode = bindingutilities_1.duraLevelToCppDuraMode(options.durabilityLevel);
519
+ const cppDuraMode = (0, bindingutilities_1.duraLevelToCppDuraMode)(options.durabilityLevel);
520
520
  const persistTo = options.durabilityPersistTo;
521
521
  const replicateTo = options.durabilityReplicateTo;
522
522
  const parentSpan = options.parentSpan;
@@ -619,7 +619,7 @@ class Collection {
619
619
  }
620
620
  const expiry = options.preserveExpiry ? -1 : options.expiry;
621
621
  const cas = options.cas;
622
- const cppDuraMode = bindingutilities_1.duraLevelToCppDuraMode(options.durabilityLevel);
622
+ const cppDuraMode = (0, bindingutilities_1.duraLevelToCppDuraMode)(options.durabilityLevel);
623
623
  const persistTo = options.durabilityPersistTo;
624
624
  const replicateTo = options.durabilityReplicateTo;
625
625
  const transcoder = options.transcoder || this.transcoder;
@@ -647,7 +647,7 @@ class Collection {
647
647
  }
648
648
  const initial = options.initial;
649
649
  const expiry = options.expiry;
650
- const cppDuraMode = bindingutilities_1.duraLevelToCppDuraMode(options.durabilityLevel);
650
+ const cppDuraMode = (0, bindingutilities_1.duraLevelToCppDuraMode)(options.durabilityLevel);
651
651
  const persistTo = options.durabilityPersistTo;
652
652
  const replicateTo = options.durabilityReplicateTo;
653
653
  const parentSpan = options.parentSpan;
@@ -158,7 +158,7 @@ class CollectionManager {
158
158
  method: httpexecutor_1.HttpMethod.Post,
159
159
  path: `/pools/default/buckets/${bucketName}/scopes/${collectionSpec.scopeName}/collections`,
160
160
  contentType: 'application/x-www-form-urlencoded',
161
- body: utilities_1.cbQsStringify(collectionData),
161
+ body: (0, utilities_1.cbQsStringify)(collectionData),
162
162
  parentSpan: parentSpan,
163
163
  timeout: timeout,
164
164
  });
@@ -248,7 +248,7 @@ class CollectionManager {
248
248
  method: httpexecutor_1.HttpMethod.Post,
249
249
  path: `/pools/default/buckets/${bucketName}/scopes`,
250
250
  contentType: 'application/x-www-form-urlencoded',
251
- body: utilities_1.cbQsStringify({
251
+ body: (0, utilities_1.cbQsStringify)({
252
252
  name: scopeName,
253
253
  }),
254
254
  parentSpan: parentSpan,
@@ -147,7 +147,7 @@ class Connection {
147
147
  this._inst.connect((err) => {
148
148
  if (err) {
149
149
  this._closed = true;
150
- this._closedErr = bindingutilities_1.translateCppError(err);
150
+ this._closedErr = (0, bindingutilities_1.translateCppError)(err);
151
151
  callback(this._closedErr);
152
152
  this._connectWaiters.forEach((waitFn) => waitFn());
153
153
  this._connectWaiters = [];
@@ -162,7 +162,7 @@ class Connection {
162
162
  selectBucket(bucketName, callback) {
163
163
  this._inst.selectBucket(bucketName, (err) => {
164
164
  if (err) {
165
- return callback(bindingutilities_1.translateCppError(err));
165
+ return callback((0, bindingutilities_1.translateCppError)(err));
166
166
  }
167
167
  this._opened = true;
168
168
  callback(null);
@@ -245,7 +245,7 @@ class Connection {
245
245
  return callback(this._closedErr);
246
246
  }
247
247
  wrappedArgs.push((err, ...cbArgs) => {
248
- const translatedErr = bindingutilities_1.translateCppError(err);
248
+ const translatedErr = (0, bindingutilities_1.translateCppError)(err);
249
249
  callback.apply(undefined, [translatedErr, ...cbArgs]);
250
250
  });
251
251
  fn.apply(thisArg, wrappedArgs);
package/dist/connspec.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/couchbase.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/logging.js CHANGED
@@ -45,7 +45,7 @@ var LogSeverity;
45
45
  /**
46
46
  * @internal
47
47
  */
48
- const libLogger = debug_1.default('couchnode');
48
+ const libLogger = (0, debug_1.default)('couchnode');
49
49
  exports.libLogger = libLogger;
50
50
  const lcbLogger = libLogger.extend('lcb');
51
51
  const severityLoggers = {
@@ -52,7 +52,7 @@ class QueryExecutor {
52
52
  queryObj.pipeline_cap = options.pipelineCap.toString();
53
53
  }
54
54
  if (options.scanWait) {
55
- queryObj.scan_wait = utilities_1.msToGoDurationStr(options.scanWait);
55
+ queryObj.scan_wait = (0, utilities_1.msToGoDurationStr)(options.scanWait);
56
56
  }
57
57
  if (options.scanCap) {
58
58
  queryObj.scan_cap = options.scanCap.toString();
@@ -115,8 +115,8 @@ class QueryExecutor {
115
115
  if (metaData.metrics) {
116
116
  const metricsData = metaData.metrics;
117
117
  metrics = new querytypes_1.QueryMetrics({
118
- elapsedTime: utilities_1.goDurationStrToMs(metricsData.elapsedTime) || 0,
119
- executionTime: utilities_1.goDurationStrToMs(metricsData.executionTime) || 0,
118
+ elapsedTime: (0, utilities_1.goDurationStrToMs)(metricsData.elapsedTime) || 0,
119
+ executionTime: (0, utilities_1.goDurationStrToMs)(metricsData.executionTime) || 0,
120
120
  sortCount: metricsData.sortCount || 0,
121
121
  resultCount: metricsData.resultCount || 0,
122
122
  resultSize: metricsData.resultSize || 0,
@@ -188,7 +188,7 @@ class SearchIndexManager {
188
188
  if (res.statusCode !== 200) {
189
189
  throw new Error('failed to get search indexed documents count');
190
190
  }
191
- return JSON.parse(res.body.toString());
191
+ return JSON.parse(res.body.toString()).count;
192
192
  }, callback);
193
193
  }
194
194
  /**
@@ -406,7 +406,7 @@ class UserManager {
406
406
  method: httpexecutor_1.HttpMethod.Put,
407
407
  path: `/settings/rbac/users/${domainName}/${user.username}`,
408
408
  contentType: 'application/x-www-form-urlencoded',
409
- body: utilities_1.cbQsStringify(userData),
409
+ body: (0, utilities_1.cbQsStringify)(userData),
410
410
  parentSpan: parentSpan,
411
411
  timeout: timeout,
412
412
  });
@@ -577,7 +577,7 @@ class UserManager {
577
577
  method: httpexecutor_1.HttpMethod.Put,
578
578
  path: `/settings/rbac/groups/${group.name}`,
579
579
  contentType: 'application/x-www-form-urlencoded',
580
- body: utilities_1.cbQsStringify(groupData),
580
+ body: (0, utilities_1.cbQsStringify)(groupData),
581
581
  parentSpan: parentSpan,
582
582
  timeout: timeout,
583
583
  });
@@ -1,4 +1,3 @@
1
- import { CppCas } from './binding';
2
1
  import { DurabilityLevel } from './generaltypes';
3
2
  /**
4
3
  * CAS represents an opaque value which can be used to compare documents to
@@ -6,7 +5,7 @@ import { DurabilityLevel } from './generaltypes';
6
5
  *
7
6
  * @category Key-Value
8
7
  */
9
- export declare type Cas = CppCas;
8
+ export declare type Cas = any;
10
9
  /**
11
10
  * Reprents a node-style callback which receives an optional error or result.
12
11
  *