couchbase 3.2.2 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/binding.gyp +5 -0
  2. package/deps/lcb/CMakeLists.txt +1 -1
  3. package/deps/lcb/CONTRIBUTING.md +1 -1
  4. package/deps/lcb/README.markdown +2 -2
  5. package/deps/lcb/RELEASE_NOTES.markdown +84 -17
  6. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  7. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  8. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
  9. package/deps/lcb/doc/Doxyfile +1 -1
  10. package/deps/lcb/example/minimal/query.c +9 -7
  11. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  12. package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
  13. package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
  14. package/deps/lcb/include/libcouchbase/error.h +6 -1
  15. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  16. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  17. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  18. package/deps/lcb/libcouchbase.gyp +353 -349
  19. package/deps/lcb/packaging/deb/control +1 -1
  20. package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
  21. package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
  22. package/deps/lcb/src/capi/cmd_counter.hh +18 -0
  23. package/deps/lcb/src/capi/cmd_exists.hh +18 -0
  24. package/deps/lcb/src/capi/cmd_get.hh +17 -0
  25. package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
  26. package/deps/lcb/src/capi/cmd_query.cc +13 -0
  27. package/deps/lcb/src/capi/cmd_query.hh +22 -14
  28. package/deps/lcb/src/capi/cmd_remove.hh +18 -0
  29. package/deps/lcb/src/capi/cmd_search.hh +6 -0
  30. package/deps/lcb/src/capi/cmd_store.hh +28 -21
  31. package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
  32. package/deps/lcb/src/capi/cmd_touch.hh +18 -0
  33. package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
  34. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  35. package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
  36. package/deps/lcb/src/cntl.cc +42 -8
  37. package/deps/lcb/src/dns-srv.cc +5 -3
  38. package/deps/lcb/src/errmap.cc +5 -9
  39. package/deps/lcb/src/errmap.h +7 -3
  40. package/deps/lcb/src/handler.cc +24 -18
  41. package/deps/lcb/src/internal.h +2 -1
  42. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  43. package/deps/lcb/src/mcserver/mcserver.cc +8 -5
  44. package/deps/lcb/src/mcserver/negotiate.cc +42 -17
  45. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  46. package/deps/lcb/src/n1ql/n1ql.cc +5 -1
  47. package/deps/lcb/src/n1ql/query_handle.cc +80 -44
  48. package/deps/lcb/src/n1ql/query_handle.hh +41 -3
  49. package/deps/lcb/src/operations/counter.cc +13 -1
  50. package/deps/lcb/src/operations/exists.cc +14 -2
  51. package/deps/lcb/src/operations/get.cc +14 -2
  52. package/deps/lcb/src/operations/get_replica.cc +18 -6
  53. package/deps/lcb/src/operations/observe.cc +1 -1
  54. package/deps/lcb/src/operations/remove.cc +13 -1
  55. package/deps/lcb/src/operations/store.cc +13 -1
  56. package/deps/lcb/src/operations/subdoc.cc +13 -2
  57. package/deps/lcb/src/operations/touch.cc +14 -2
  58. package/deps/lcb/src/operations/unlock.cc +14 -2
  59. package/deps/lcb/src/search/search_handle.cc +26 -8
  60. package/deps/lcb/src/search/search_handle.hh +29 -0
  61. package/deps/lcb/src/ssl/ssl_common.c +7 -8
  62. package/deps/lcb/src/tracing/span.cc +43 -10
  63. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  64. package/deps/lcb/src/utilities.cc +21 -0
  65. package/deps/lcb/src/utilities.h +3 -0
  66. package/deps/lcb/src/views/view_handle.cc +13 -5
  67. package/deps/lcb/src/views/view_handle.hh +29 -0
  68. package/deps/lcb/tests/CMakeLists.txt +21 -0
  69. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  70. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  71. package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
  72. package/deps/lcb/tests/iotests/mock-environment.h +49 -1
  73. package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
  74. package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
  75. package/deps/lcb/tests/iotests/serverparams.h +7 -2
  76. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  77. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  78. package/deps/lcb/tests/iotests/t_get.cc +14 -4
  79. package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
  80. package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
  81. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  82. package/deps/lcb/tests/iotests/testutil.cc +342 -0
  83. package/deps/lcb/tests/iotests/testutil.h +164 -0
  84. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  85. package/deps/lcb/tests/mocksupport/server.c +0 -1
  86. package/deps/lcb/tools/cbc.cc +7 -0
  87. package/dist/analyticsexecutor.js +2 -2
  88. package/dist/analyticsindexmanager.js +512 -524
  89. package/dist/binarycollection.d.ts +17 -0
  90. package/dist/binding.d.ts +2 -0
  91. package/dist/binding.js +1 -1
  92. package/dist/bindingutilities.js +9 -1
  93. package/dist/bucketmanager.d.ts +32 -23
  94. package/dist/bucketmanager.js +197 -189
  95. package/dist/cluster.js +37 -36
  96. package/dist/collection.js +17 -23
  97. package/dist/collectionmanager.js +181 -200
  98. package/dist/connection.js +6 -3
  99. package/dist/connspec.js +5 -1
  100. package/dist/couchbase.js +7 -14
  101. package/dist/datastructures.js +239 -310
  102. package/dist/diagnosticsexecutor.js +70 -85
  103. package/dist/errors.d.ts +18 -0
  104. package/dist/errors.js +26 -2
  105. package/dist/eventingfunctionmanager.js +267 -294
  106. package/dist/httpexecutor.js +31 -38
  107. package/dist/logging.js +1 -1
  108. package/dist/queryexecutor.js +3 -3
  109. package/dist/queryindexmanager.js +236 -263
  110. package/dist/scope.js +8 -2
  111. package/dist/searchexecutor.js +3 -0
  112. package/dist/searchindexmanager.js +240 -271
  113. package/dist/searchquery.d.ts +17 -0
  114. package/dist/searchquery.js +22 -1
  115. package/dist/searchtypes.d.ts +7 -2
  116. package/dist/searchtypes.js +2 -2
  117. package/dist/usermanager.js +250 -263
  118. package/dist/utilities.d.ts +3 -2
  119. package/dist/utilities.js +16 -4
  120. package/dist/viewexecutor.js +1 -1
  121. package/dist/viewindexmanager.js +131 -150
  122. package/package.json +1 -1
  123. package/src/connection.cpp +2 -0
  124. package/src/constants.cpp +2 -0
  125. package/src/instance.cpp +8 -1
  126. package/src/instance.h +1 -0
  127. package/src/uv-plugin-all.cpp +1 -0
  128. package/dist/cas.d.ts +0 -0
  129. package/dist/cas.js +0 -1
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.EventingFunctionManager = exports.EventingState = exports.EventingFunctionState = exports.EventingFunction = exports.EventingFunctionSettings = exports.EventingFunctionConstantBinding = exports.EventingFunctionUrlBinding = exports.EventingFunctionUrlAuthBearer = exports.EventingFunctionUrlAuthDigest = exports.EventingFunctionUrlAuthBasic = exports.EventingFunctionBucketBinding = exports.EventingFunctionKeyspace = exports.EventingFunctionUrlAuthMethod = exports.EventingFunctionBucketAccess = exports.EventingFunctionLogLevel = exports.EventingFunctionLanguageCompatibility = exports.EventingFunctionStatus = exports.EventingFunctionProcessingStatus = exports.EventingFunctionDeploymentStatus = exports.EventingFunctionDcpBoundary = void 0;
13
4
  const errors_1 = require("./errors");
@@ -659,45 +650,43 @@ class EventingFunctionManager {
659
650
  * @param options Optional parameters for this operation.
660
651
  * @param callback A node-style callback to be invoked after execution.
661
652
  */
662
- upsertFunction(functionDefinition, options, callback) {
663
- return __awaiter(this, arguments, void 0, function* () {
664
- if (options instanceof Function) {
665
- callback = arguments[2];
666
- options = undefined;
667
- }
668
- if (!options) {
669
- options = {};
670
- }
671
- const functionName = functionDefinition.name;
672
- const parentSpan = options.parentSpan;
673
- const timeout = options.timeout;
674
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
675
- const encodedData = EventingFunction._toEvtData(functionDefinition);
676
- const res = yield this._http.request({
677
- type: httpexecutor_1.HttpServiceType.Eventing,
678
- method: httpexecutor_1.HttpMethod.Post,
679
- path: `/api/v1/functions/${functionName}`,
680
- contentType: 'application/json',
681
- body: JSON.stringify(encodedData),
682
- parentSpan: parentSpan,
683
- timeout: timeout,
684
- });
685
- if (res.statusCode !== 200) {
686
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
687
- const errText = res.body.toString().toLowerCase();
688
- if (errText.includes('err_collection_missing')) {
689
- throw new errors_1.CollectionNotFoundError(undefined, errCtx);
690
- }
691
- if (errText.includes('err_src_mb_same')) {
692
- throw new errors_1.EventingFunctionIdenticalKeyspaceError(undefined, errCtx);
693
- }
694
- if (errText.includes('err_handler_compilation')) {
695
- throw new errors_1.EventingFunctionCompilationFailureError(undefined, errCtx);
696
- }
697
- throw new errors_1.CouchbaseError('failed to upsert function', undefined, errCtx);
653
+ async upsertFunction(functionDefinition, options, callback) {
654
+ if (options instanceof Function) {
655
+ callback = arguments[1];
656
+ options = undefined;
657
+ }
658
+ if (!options) {
659
+ options = {};
660
+ }
661
+ const functionName = functionDefinition.name;
662
+ const parentSpan = options.parentSpan;
663
+ const timeout = options.timeout;
664
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
665
+ const encodedData = EventingFunction._toEvtData(functionDefinition);
666
+ const res = await this._http.request({
667
+ type: httpexecutor_1.HttpServiceType.Eventing,
668
+ method: httpexecutor_1.HttpMethod.Post,
669
+ path: `/api/v1/functions/${functionName}`,
670
+ contentType: 'application/json',
671
+ body: JSON.stringify(encodedData),
672
+ parentSpan: parentSpan,
673
+ timeout: timeout,
674
+ });
675
+ if (res.statusCode !== 200) {
676
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
677
+ const errText = res.body.toString().toLowerCase();
678
+ if (errText.includes('err_collection_missing')) {
679
+ throw new errors_1.CollectionNotFoundError(undefined, errCtx);
698
680
  }
699
- }), callback);
700
- });
681
+ if (errText.includes('err_src_mb_same')) {
682
+ throw new errors_1.EventingFunctionIdenticalKeyspaceError(undefined, errCtx);
683
+ }
684
+ if (errText.includes('err_handler_compilation')) {
685
+ throw new errors_1.EventingFunctionCompilationFailureError(undefined, errCtx);
686
+ }
687
+ throw new errors_1.CouchbaseError('failed to upsert function', undefined, errCtx);
688
+ }
689
+ }, callback);
701
690
  }
702
691
  /**
703
692
  * Deletes an eventing function.
@@ -706,42 +695,40 @@ class EventingFunctionManager {
706
695
  * @param options Optional parameters for this operation.
707
696
  * @param callback A node-style callback to be invoked after execution.
708
697
  */
709
- dropFunction(name, options, callback) {
710
- return __awaiter(this, arguments, void 0, function* () {
711
- if (options instanceof Function) {
712
- callback = arguments[2];
713
- options = undefined;
714
- }
715
- if (!options) {
716
- options = {};
717
- }
718
- const functionName = name;
719
- const parentSpan = options.parentSpan;
720
- const timeout = options.timeout;
721
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
722
- const res = yield this._http.request({
723
- type: httpexecutor_1.HttpServiceType.Eventing,
724
- method: httpexecutor_1.HttpMethod.Delete,
725
- path: `/api/v1/functions/${functionName}`,
726
- parentSpan: parentSpan,
727
- timeout: timeout,
728
- });
729
- if (res.statusCode !== 200) {
730
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
731
- const errText = res.body.toString().toLowerCase();
732
- if (errText.includes('err_app_not_found_ts')) {
733
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
734
- }
735
- if (errText.includes('err_app_not_deployed')) {
736
- throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
737
- }
738
- if (errText.includes('err_app_not_undeployed')) {
739
- throw new errors_1.EventingFunctionDeployedError(undefined, errCtx);
740
- }
741
- throw new errors_1.CouchbaseError('failed to drop function', undefined, errCtx);
698
+ async dropFunction(name, options, callback) {
699
+ if (options instanceof Function) {
700
+ callback = arguments[1];
701
+ options = undefined;
702
+ }
703
+ if (!options) {
704
+ options = {};
705
+ }
706
+ const functionName = name;
707
+ const parentSpan = options.parentSpan;
708
+ const timeout = options.timeout;
709
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
710
+ const res = await this._http.request({
711
+ type: httpexecutor_1.HttpServiceType.Eventing,
712
+ method: httpexecutor_1.HttpMethod.Delete,
713
+ path: `/api/v1/functions/${functionName}`,
714
+ parentSpan: parentSpan,
715
+ timeout: timeout,
716
+ });
717
+ if (res.statusCode !== 200) {
718
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
719
+ const errText = res.body.toString().toLowerCase();
720
+ if (errText.includes('err_app_not_found_ts')) {
721
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
742
722
  }
743
- }), callback);
744
- });
723
+ if (errText.includes('err_app_not_deployed')) {
724
+ throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
725
+ }
726
+ if (errText.includes('err_app_not_undeployed')) {
727
+ throw new errors_1.EventingFunctionDeployedError(undefined, errCtx);
728
+ }
729
+ throw new errors_1.CouchbaseError('failed to drop function', undefined, errCtx);
730
+ }
731
+ }, callback);
745
732
  }
746
733
  /**
747
734
  * Fetches all eventing functions.
@@ -749,34 +736,32 @@ class EventingFunctionManager {
749
736
  * @param options Optional parameters for this operation.
750
737
  * @param callback A node-style callback to be invoked after execution.
751
738
  */
752
- getAllFunctions(options, callback) {
753
- return __awaiter(this, arguments, void 0, function* () {
754
- if (options instanceof Function) {
755
- callback = arguments[0];
756
- options = undefined;
757
- }
758
- if (!options) {
759
- options = {};
739
+ async getAllFunctions(options, callback) {
740
+ if (options instanceof Function) {
741
+ callback = arguments[0];
742
+ options = undefined;
743
+ }
744
+ if (!options) {
745
+ options = {};
746
+ }
747
+ const parentSpan = options.parentSpan;
748
+ const timeout = options.timeout;
749
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
750
+ const res = await this._http.request({
751
+ type: httpexecutor_1.HttpServiceType.Eventing,
752
+ method: httpexecutor_1.HttpMethod.Get,
753
+ path: `/api/v1/functions`,
754
+ parentSpan: parentSpan,
755
+ timeout: timeout,
756
+ });
757
+ if (res.statusCode !== 200) {
758
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
759
+ throw new errors_1.CouchbaseError('failed to get functions', undefined, errCtx);
760
760
  }
761
- const parentSpan = options.parentSpan;
762
- const timeout = options.timeout;
763
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
764
- const res = yield this._http.request({
765
- type: httpexecutor_1.HttpServiceType.Eventing,
766
- method: httpexecutor_1.HttpMethod.Get,
767
- path: `/api/v1/functions`,
768
- parentSpan: parentSpan,
769
- timeout: timeout,
770
- });
771
- if (res.statusCode !== 200) {
772
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
773
- throw new errors_1.CouchbaseError('failed to get functions', undefined, errCtx);
774
- }
775
- const functionsData = JSON.parse(res.body.toString());
776
- const functions = functionsData.map((functionData) => EventingFunction._fromEvtData(functionData));
777
- return functions;
778
- }), callback);
779
- });
761
+ const functionsData = JSON.parse(res.body.toString());
762
+ const functions = functionsData.map((functionData) => EventingFunction._fromEvtData(functionData));
763
+ return functions;
764
+ }, callback);
780
765
  }
781
766
  /**
782
767
  * Fetches a specific eventing function.
@@ -785,38 +770,36 @@ class EventingFunctionManager {
785
770
  * @param options Optional parameters for this operation.
786
771
  * @param callback A node-style callback to be invoked after execution.
787
772
  */
788
- getFunction(name, options, callback) {
789
- return __awaiter(this, arguments, void 0, function* () {
790
- if (options instanceof Function) {
791
- callback = arguments[1];
792
- options = undefined;
793
- }
794
- if (!options) {
795
- options = {};
796
- }
797
- const functionName = name;
798
- const parentSpan = options.parentSpan;
799
- const timeout = options.timeout;
800
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
801
- const res = yield this._http.request({
802
- type: httpexecutor_1.HttpServiceType.Eventing,
803
- method: httpexecutor_1.HttpMethod.Get,
804
- path: `/api/v1/functions/${functionName}`,
805
- parentSpan: parentSpan,
806
- timeout: timeout,
807
- });
808
- if (res.statusCode !== 200) {
809
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
810
- const errText = res.body.toString().toLowerCase();
811
- if (errText.includes('err_app_not_found_ts')) {
812
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
813
- }
814
- throw new errors_1.CouchbaseError('failed to get function', undefined, errCtx);
773
+ async getFunction(name, options, callback) {
774
+ if (options instanceof Function) {
775
+ callback = arguments[1];
776
+ options = undefined;
777
+ }
778
+ if (!options) {
779
+ options = {};
780
+ }
781
+ const functionName = name;
782
+ const parentSpan = options.parentSpan;
783
+ const timeout = options.timeout;
784
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
785
+ const res = await this._http.request({
786
+ type: httpexecutor_1.HttpServiceType.Eventing,
787
+ method: httpexecutor_1.HttpMethod.Get,
788
+ path: `/api/v1/functions/${functionName}`,
789
+ parentSpan: parentSpan,
790
+ timeout: timeout,
791
+ });
792
+ if (res.statusCode !== 200) {
793
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
794
+ const errText = res.body.toString().toLowerCase();
795
+ if (errText.includes('err_app_not_found_ts')) {
796
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
815
797
  }
816
- const functionData = JSON.parse(res.body.toString());
817
- return EventingFunction._fromEvtData(functionData);
818
- }), callback);
819
- });
798
+ throw new errors_1.CouchbaseError('failed to get function', undefined, errCtx);
799
+ }
800
+ const functionData = JSON.parse(res.body.toString());
801
+ return EventingFunction._fromEvtData(functionData);
802
+ }, callback);
820
803
  }
821
804
  /**
822
805
  * Deploys an eventing function.
@@ -825,39 +808,37 @@ class EventingFunctionManager {
825
808
  * @param options Optional parameters for this operation.
826
809
  * @param callback A node-style callback to be invoked after execution.
827
810
  */
828
- deployFunction(name, options, callback) {
829
- return __awaiter(this, arguments, void 0, function* () {
830
- if (options instanceof Function) {
831
- callback = arguments[2];
832
- options = undefined;
833
- }
834
- if (!options) {
835
- options = {};
836
- }
837
- const functionName = name;
838
- const parentSpan = options.parentSpan;
839
- const timeout = options.timeout;
840
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
841
- const res = yield this._http.request({
842
- type: httpexecutor_1.HttpServiceType.Eventing,
843
- method: httpexecutor_1.HttpMethod.Post,
844
- path: `/api/v1/functions/${functionName}/deploy`,
845
- parentSpan: parentSpan,
846
- timeout: timeout,
847
- });
848
- if (res.statusCode !== 200) {
849
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
850
- const errText = res.body.toString().toLowerCase();
851
- if (errText.includes('err_app_not_found_ts')) {
852
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
853
- }
854
- if (errText.includes('err_app_not_bootstrapped')) {
855
- throw new errors_1.EventingFunctionNotBootstrappedError(undefined, errCtx);
856
- }
857
- throw new errors_1.CouchbaseError('failed to deploy function', undefined, errCtx);
811
+ async deployFunction(name, options, callback) {
812
+ if (options instanceof Function) {
813
+ callback = arguments[1];
814
+ options = undefined;
815
+ }
816
+ if (!options) {
817
+ options = {};
818
+ }
819
+ const functionName = name;
820
+ const parentSpan = options.parentSpan;
821
+ const timeout = options.timeout;
822
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
823
+ const res = await this._http.request({
824
+ type: httpexecutor_1.HttpServiceType.Eventing,
825
+ method: httpexecutor_1.HttpMethod.Post,
826
+ path: `/api/v1/functions/${functionName}/deploy`,
827
+ parentSpan: parentSpan,
828
+ timeout: timeout,
829
+ });
830
+ if (res.statusCode !== 200) {
831
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
832
+ const errText = res.body.toString().toLowerCase();
833
+ if (errText.includes('err_app_not_found_ts')) {
834
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
858
835
  }
859
- }), callback);
860
- });
836
+ if (errText.includes('err_app_not_bootstrapped')) {
837
+ throw new errors_1.EventingFunctionNotBootstrappedError(undefined, errCtx);
838
+ }
839
+ throw new errors_1.CouchbaseError('failed to deploy function', undefined, errCtx);
840
+ }
841
+ }, callback);
861
842
  }
862
843
  /**
863
844
  * Undeploys an eventing function.
@@ -866,39 +847,37 @@ class EventingFunctionManager {
866
847
  * @param options Optional parameters for this operation.
867
848
  * @param callback A node-style callback to be invoked after execution.
868
849
  */
869
- undeployFunction(name, options, callback) {
870
- return __awaiter(this, arguments, void 0, function* () {
871
- if (options instanceof Function) {
872
- callback = arguments[2];
873
- options = undefined;
874
- }
875
- if (!options) {
876
- options = {};
877
- }
878
- const functionName = name;
879
- const parentSpan = options.parentSpan;
880
- const timeout = options.timeout;
881
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
882
- const res = yield this._http.request({
883
- type: httpexecutor_1.HttpServiceType.Eventing,
884
- method: httpexecutor_1.HttpMethod.Post,
885
- path: `/api/v1/functions/${functionName}/undeploy`,
886
- parentSpan: parentSpan,
887
- timeout: timeout,
888
- });
889
- if (res.statusCode !== 200) {
890
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
891
- const errText = res.body.toString().toLowerCase();
892
- if (errText.includes('err_app_not_found_ts')) {
893
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
894
- }
895
- if (errText.includes('err_app_not_deployed')) {
896
- throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
897
- }
898
- throw new errors_1.CouchbaseError('failed to undeploy function', undefined, errCtx);
850
+ async undeployFunction(name, options, callback) {
851
+ if (options instanceof Function) {
852
+ callback = arguments[1];
853
+ options = undefined;
854
+ }
855
+ if (!options) {
856
+ options = {};
857
+ }
858
+ const functionName = name;
859
+ const parentSpan = options.parentSpan;
860
+ const timeout = options.timeout;
861
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
862
+ const res = await this._http.request({
863
+ type: httpexecutor_1.HttpServiceType.Eventing,
864
+ method: httpexecutor_1.HttpMethod.Post,
865
+ path: `/api/v1/functions/${functionName}/undeploy`,
866
+ parentSpan: parentSpan,
867
+ timeout: timeout,
868
+ });
869
+ if (res.statusCode !== 200) {
870
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
871
+ const errText = res.body.toString().toLowerCase();
872
+ if (errText.includes('err_app_not_found_ts')) {
873
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
899
874
  }
900
- }), callback);
901
- });
875
+ if (errText.includes('err_app_not_deployed')) {
876
+ throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
877
+ }
878
+ throw new errors_1.CouchbaseError('failed to undeploy function', undefined, errCtx);
879
+ }
880
+ }, callback);
902
881
  }
903
882
  /**
904
883
  * Pauses an eventing function.
@@ -907,39 +886,37 @@ class EventingFunctionManager {
907
886
  * @param options Optional parameters for this operation.
908
887
  * @param callback A node-style callback to be invoked after execution.
909
888
  */
910
- pauseFunction(name, options, callback) {
911
- return __awaiter(this, arguments, void 0, function* () {
912
- if (options instanceof Function) {
913
- callback = arguments[2];
914
- options = undefined;
915
- }
916
- if (!options) {
917
- options = {};
918
- }
919
- const functionName = name;
920
- const parentSpan = options.parentSpan;
921
- const timeout = options.timeout;
922
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
923
- const res = yield this._http.request({
924
- type: httpexecutor_1.HttpServiceType.Eventing,
925
- method: httpexecutor_1.HttpMethod.Post,
926
- path: `/api/v1/functions/${functionName}/pause`,
927
- parentSpan: parentSpan,
928
- timeout: timeout,
929
- });
930
- if (res.statusCode !== 200) {
931
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
932
- const errText = res.body.toString().toLowerCase();
933
- if (errText.includes('err_app_not_found_ts')) {
934
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
935
- }
936
- if (errText.includes('err_app_not_bootstrapped')) {
937
- throw new errors_1.EventingFunctionNotBootstrappedError(undefined, errCtx);
938
- }
939
- throw new errors_1.CouchbaseError('failed to pause function', undefined, errCtx);
889
+ async pauseFunction(name, options, callback) {
890
+ if (options instanceof Function) {
891
+ callback = arguments[1];
892
+ options = undefined;
893
+ }
894
+ if (!options) {
895
+ options = {};
896
+ }
897
+ const functionName = name;
898
+ const parentSpan = options.parentSpan;
899
+ const timeout = options.timeout;
900
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
901
+ const res = await this._http.request({
902
+ type: httpexecutor_1.HttpServiceType.Eventing,
903
+ method: httpexecutor_1.HttpMethod.Post,
904
+ path: `/api/v1/functions/${functionName}/pause`,
905
+ parentSpan: parentSpan,
906
+ timeout: timeout,
907
+ });
908
+ if (res.statusCode !== 200) {
909
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
910
+ const errText = res.body.toString().toLowerCase();
911
+ if (errText.includes('err_app_not_found_ts')) {
912
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
940
913
  }
941
- }), callback);
942
- });
914
+ if (errText.includes('err_app_not_bootstrapped')) {
915
+ throw new errors_1.EventingFunctionNotBootstrappedError(undefined, errCtx);
916
+ }
917
+ throw new errors_1.CouchbaseError('failed to pause function', undefined, errCtx);
918
+ }
919
+ }, callback);
943
920
  }
944
921
  /**
945
922
  * Resumes an eventing function.
@@ -948,39 +925,37 @@ class EventingFunctionManager {
948
925
  * @param options Optional parameters for this operation.
949
926
  * @param callback A node-style callback to be invoked after execution.
950
927
  */
951
- resumeFunction(name, options, callback) {
952
- return __awaiter(this, arguments, void 0, function* () {
953
- if (options instanceof Function) {
954
- callback = arguments[2];
955
- options = undefined;
956
- }
957
- if (!options) {
958
- options = {};
959
- }
960
- const functionName = name;
961
- const parentSpan = options.parentSpan;
962
- const timeout = options.timeout;
963
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
964
- const res = yield this._http.request({
965
- type: httpexecutor_1.HttpServiceType.Eventing,
966
- method: httpexecutor_1.HttpMethod.Post,
967
- path: `/api/v1/functions/${functionName}/resume`,
968
- parentSpan: parentSpan,
969
- timeout: timeout,
970
- });
971
- if (res.statusCode !== 200) {
972
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
973
- const errText = res.body.toString().toLowerCase();
974
- if (errText.includes('err_app_not_found_ts')) {
975
- throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
976
- }
977
- if (errText.includes('err_app_not_deployed')) {
978
- throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
979
- }
980
- throw new errors_1.CouchbaseError('failed to resume function', undefined, errCtx);
928
+ async resumeFunction(name, options, callback) {
929
+ if (options instanceof Function) {
930
+ callback = arguments[1];
931
+ options = undefined;
932
+ }
933
+ if (!options) {
934
+ options = {};
935
+ }
936
+ const functionName = name;
937
+ const parentSpan = options.parentSpan;
938
+ const timeout = options.timeout;
939
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
940
+ const res = await this._http.request({
941
+ type: httpexecutor_1.HttpServiceType.Eventing,
942
+ method: httpexecutor_1.HttpMethod.Post,
943
+ path: `/api/v1/functions/${functionName}/resume`,
944
+ parentSpan: parentSpan,
945
+ timeout: timeout,
946
+ });
947
+ if (res.statusCode !== 200) {
948
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
949
+ const errText = res.body.toString().toLowerCase();
950
+ if (errText.includes('err_app_not_found_ts')) {
951
+ throw new errors_1.EventingFunctionNotFoundError(undefined, errCtx);
981
952
  }
982
- }), callback);
983
- });
953
+ if (errText.includes('err_app_not_deployed')) {
954
+ throw new errors_1.EventingFunctionNotDeployedError(undefined, errCtx);
955
+ }
956
+ throw new errors_1.CouchbaseError('failed to resume function', undefined, errCtx);
957
+ }
958
+ }, callback);
984
959
  }
985
960
  /**
986
961
  * Fetches the status of all eventing functions.
@@ -988,33 +963,31 @@ class EventingFunctionManager {
988
963
  * @param options Optional parameters for this operation.
989
964
  * @param callback A node-style callback to be invoked after execution.
990
965
  */
991
- functionsStatus(options, callback) {
992
- return __awaiter(this, arguments, void 0, function* () {
993
- if (options instanceof Function) {
994
- callback = arguments[0];
995
- options = undefined;
996
- }
997
- if (!options) {
998
- options = {};
966
+ async functionsStatus(options, callback) {
967
+ if (options instanceof Function) {
968
+ callback = arguments[0];
969
+ options = undefined;
970
+ }
971
+ if (!options) {
972
+ options = {};
973
+ }
974
+ const parentSpan = options.parentSpan;
975
+ const timeout = options.timeout;
976
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
977
+ const res = await this._http.request({
978
+ type: httpexecutor_1.HttpServiceType.Eventing,
979
+ method: httpexecutor_1.HttpMethod.Get,
980
+ path: `/api/v1/status`,
981
+ parentSpan: parentSpan,
982
+ timeout: timeout,
983
+ });
984
+ if (res.statusCode !== 200) {
985
+ const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
986
+ throw new errors_1.CouchbaseError('failed to fetch functions status', undefined, errCtx);
999
987
  }
1000
- const parentSpan = options.parentSpan;
1001
- const timeout = options.timeout;
1002
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
1003
- const res = yield this._http.request({
1004
- type: httpexecutor_1.HttpServiceType.Eventing,
1005
- method: httpexecutor_1.HttpMethod.Get,
1006
- path: `/api/v1/status`,
1007
- parentSpan: parentSpan,
1008
- timeout: timeout,
1009
- });
1010
- if (res.statusCode !== 200) {
1011
- const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
1012
- throw new errors_1.CouchbaseError('failed to fetch functions status', undefined, errCtx);
1013
- }
1014
- const statusData = JSON.parse(res.body.toString());
1015
- return EventingState._fromEvtData(statusData);
1016
- }), callback);
1017
- });
988
+ const statusData = JSON.parse(res.body.toString());
989
+ return EventingState._fromEvtData(statusData);
990
+ }, callback);
1018
991
  }
1019
992
  }
1020
993
  exports.EventingFunctionManager = EventingFunctionManager;