couchbase 3.2.0 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/README.md +24 -18
  2. package/binding.gyp +88 -85
  3. package/deps/lcb/CMakeLists.txt +1 -1
  4. package/deps/lcb/CONTRIBUTING.md +1 -1
  5. package/deps/lcb/README.markdown +2 -2
  6. package/deps/lcb/RELEASE_NOTES.markdown +99 -14
  7. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  8. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  9. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -7
  10. package/deps/lcb/doc/Doxyfile +1 -1
  11. package/deps/lcb/example/CMakeLists.txt +4 -4
  12. package/deps/lcb/example/libuvdirect/main.c +39 -12
  13. package/deps/lcb/example/minimal/durability.cc +149 -0
  14. package/deps/lcb/example/minimal/query.c +11 -9
  15. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  16. package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
  17. package/deps/lcb/include/libcouchbase/couchbase.h +80 -5
  18. package/deps/lcb/include/libcouchbase/error.h +2 -0
  19. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  20. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  21. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  22. package/deps/lcb/libcouchbase.gyp +347 -349
  23. package/deps/lcb/packaging/deb/control +1 -1
  24. package/deps/lcb/src/analytics/analytics_handle.cc +13 -5
  25. package/deps/lcb/src/analytics/analytics_handle.hh +29 -0
  26. package/deps/lcb/src/bootstrap.cc +6 -3
  27. package/deps/lcb/src/capi/cmd_analytics.cc +12 -1
  28. package/deps/lcb/src/capi/cmd_analytics.hh +30 -0
  29. package/deps/lcb/src/capi/cmd_counter.hh +23 -0
  30. package/deps/lcb/src/capi/cmd_exists.hh +24 -1
  31. package/deps/lcb/src/capi/cmd_get.hh +22 -0
  32. package/deps/lcb/src/capi/cmd_get_replica.hh +23 -0
  33. package/deps/lcb/src/capi/cmd_http.hh +7 -0
  34. package/deps/lcb/src/capi/cmd_query.cc +11 -1
  35. package/deps/lcb/src/capi/cmd_query.hh +31 -0
  36. package/deps/lcb/src/capi/cmd_remove.hh +23 -0
  37. package/deps/lcb/src/capi/cmd_search.cc +6 -0
  38. package/deps/lcb/src/capi/cmd_search.hh +23 -0
  39. package/deps/lcb/src/capi/cmd_store.hh +33 -21
  40. package/deps/lcb/src/capi/cmd_subdoc.hh +35 -0
  41. package/deps/lcb/src/capi/cmd_touch.hh +23 -0
  42. package/deps/lcb/src/capi/cmd_unlock.hh +23 -0
  43. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  44. package/deps/lcb/src/capi/collection_qualifier.hh +2 -2
  45. package/deps/lcb/src/cntl.cc +45 -11
  46. package/deps/lcb/src/crypto.cc +2 -2
  47. package/deps/lcb/src/dns-srv.cc +5 -3
  48. package/deps/lcb/src/errmap.cc +5 -9
  49. package/deps/lcb/src/errmap.h +7 -3
  50. package/deps/lcb/src/handler.cc +24 -18
  51. package/deps/lcb/src/hostlist.h +2 -2
  52. package/deps/lcb/src/http/http-priv.h +2 -2
  53. package/deps/lcb/src/http/http.cc +5 -2
  54. package/deps/lcb/src/instance.cc +20 -11
  55. package/deps/lcb/src/internal.h +9 -0
  56. package/deps/lcb/src/lcbio/connect.cc +14 -2
  57. package/deps/lcb/src/lcbio/connect.h +2 -2
  58. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  59. package/deps/lcb/src/lcbio/ioutils.cc +9 -10
  60. package/deps/lcb/src/lcbio/manager.cc +1 -1
  61. package/deps/lcb/src/mcserver/mcserver.cc +9 -6
  62. package/deps/lcb/src/mcserver/negotiate.cc +39 -17
  63. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  64. package/deps/lcb/src/n1ql/query_handle.cc +41 -19
  65. package/deps/lcb/src/n1ql/query_handle.hh +28 -1
  66. package/deps/lcb/src/operations/counter.cc +18 -5
  67. package/deps/lcb/src/operations/exists.cc +25 -4
  68. package/deps/lcb/src/operations/get.cc +39 -19
  69. package/deps/lcb/src/operations/get_replica.cc +28 -8
  70. package/deps/lcb/src/operations/observe.cc +1 -1
  71. package/deps/lcb/src/operations/ping.cc +8 -8
  72. package/deps/lcb/src/operations/pktfwd.cc +2 -1
  73. package/deps/lcb/src/operations/remove.cc +39 -22
  74. package/deps/lcb/src/operations/store.cc +18 -5
  75. package/deps/lcb/src/operations/subdoc.cc +18 -6
  76. package/deps/lcb/src/operations/touch.cc +34 -16
  77. package/deps/lcb/src/operations/unlock.cc +24 -5
  78. package/deps/lcb/src/packetutils.h +3 -2
  79. package/deps/lcb/src/retryq.cc +24 -5
  80. package/deps/lcb/src/search/search.cc +1 -0
  81. package/deps/lcb/src/search/search_handle.cc +30 -8
  82. package/deps/lcb/src/search/search_handle.hh +29 -0
  83. package/deps/lcb/src/settings.cc +1 -1
  84. package/deps/lcb/src/ssl/ssl_common.c +6 -7
  85. package/deps/lcb/src/tracing/span.cc +47 -14
  86. package/deps/lcb/src/tracing/tracer.cc +11 -2
  87. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  88. package/deps/lcb/src/utilities.cc +43 -0
  89. package/deps/lcb/src/utilities.h +53 -0
  90. package/deps/lcb/src/vbucket/vbucket.c +34 -33
  91. package/deps/lcb/src/views/view_handle.cc +13 -5
  92. package/deps/lcb/src/views/view_handle.hh +29 -0
  93. package/deps/lcb/tests/CMakeLists.txt +21 -0
  94. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  95. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  96. package/deps/lcb/tests/basic/t_n1qlstrings.cc +73 -0
  97. package/deps/lcb/tests/iotests/mock-environment.cc +30 -1
  98. package/deps/lcb/tests/iotests/mock-environment.h +49 -0
  99. package/deps/lcb/tests/iotests/mock-unit-test.cc +104 -6
  100. package/deps/lcb/tests/iotests/mock-unit-test.h +34 -0
  101. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  102. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  103. package/deps/lcb/tests/iotests/t_get.cc +109 -7
  104. package/deps/lcb/tests/iotests/t_http.cc +9 -4
  105. package/deps/lcb/tests/iotests/t_lock.cc +18 -0
  106. package/deps/lcb/tests/iotests/t_mutate.cc +157 -63
  107. package/deps/lcb/tests/iotests/t_n1ql.cc +330 -33
  108. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  109. package/deps/lcb/tests/iotests/testutil.cc +168 -0
  110. package/deps/lcb/tests/iotests/testutil.h +116 -0
  111. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  112. package/deps/lcb/tests/mocksupport/server.c +0 -1
  113. package/deps/lcb/tests/mocksupport/timeout.c +2 -2
  114. package/deps/lcb/tools/cbc.cc +7 -0
  115. package/dist/analyticsindexmanager.js +512 -524
  116. package/dist/binding.d.ts +3 -0
  117. package/dist/bindingutilities.js +4 -0
  118. package/dist/bucket.js +1 -1
  119. package/dist/bucketmanager.d.ts +31 -1
  120. package/dist/bucketmanager.js +194 -186
  121. package/dist/cluster.d.ts +7 -0
  122. package/dist/cluster.js +48 -38
  123. package/dist/collection.js +11 -17
  124. package/dist/collectionmanager.js +181 -197
  125. package/dist/connection.d.ts +3 -1
  126. package/dist/connection.js +27 -16
  127. package/dist/couchbase.d.ts +1 -0
  128. package/dist/couchbase.js +3 -13
  129. package/dist/datastructures.js +239 -310
  130. package/dist/diagnosticsexecutor.js +70 -85
  131. package/dist/errors.d.ts +70 -0
  132. package/dist/errors.js +96 -2
  133. package/dist/eventingfunctionmanager.d.ts +804 -0
  134. package/dist/eventingfunctionmanager.js +993 -0
  135. package/dist/httpexecutor.d.ts +2 -1
  136. package/dist/httpexecutor.js +30 -37
  137. package/dist/queryindexmanager.js +240 -266
  138. package/dist/scope.js +10 -4
  139. package/dist/sdspecs.d.ts +1 -1
  140. package/dist/searchexecutor.js +3 -0
  141. package/dist/searchindexmanager.js +240 -271
  142. package/dist/searchquery.d.ts +17 -0
  143. package/dist/searchquery.js +22 -1
  144. package/dist/searchtypes.d.ts +7 -2
  145. package/dist/searchtypes.js +2 -2
  146. package/dist/usermanager.js +251 -264
  147. package/dist/utilities.d.ts +2 -0
  148. package/dist/utilities.js +7 -2
  149. package/dist/viewexecutor.js +1 -1
  150. package/dist/viewindexmanager.js +131 -150
  151. package/package.json +1 -1
  152. package/src/addondata.cpp +58 -0
  153. package/src/addondata.h +40 -0
  154. package/src/binding.cpp +3 -1
  155. package/src/cas.h +2 -2
  156. package/src/connection.cpp +25 -178
  157. package/src/connection.h +8 -65
  158. package/src/connection_ops.cpp +57 -34
  159. package/src/constants.cpp +3 -0
  160. package/src/instance.cpp +235 -0
  161. package/src/instance.h +102 -0
  162. package/src/{connection_callbacks.cpp → instance_callbacks.cpp} +34 -34
  163. package/src/logger.cpp +11 -1
  164. package/src/logger.h +3 -0
  165. package/src/metrics.cpp +10 -0
  166. package/src/metrics.h +3 -0
  167. package/src/mutationtoken.h +2 -2
  168. package/src/opbuilder.h +13 -15
  169. package/src/respreader.cpp +1 -0
  170. package/src/respreader.h +6 -4
  171. package/src/tracespan.h +11 -11
  172. package/src/tracing.cpp +11 -0
  173. package/src/tracing.h +3 -0
  174. package/src/valueparser.h +5 -0
  175. package/deps/lcb/example/observe/durability.c +0 -110
@@ -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.SearchIndexManager = exports.SearchIndex = void 0;
13
4
  const errors_1 = require("./errors");
@@ -51,31 +42,29 @@ class SearchIndexManager {
51
42
  * @param options Optional parameters for this operation.
52
43
  * @param callback A node-style callback to be invoked after execution.
53
44
  */
54
- getIndex(indexName, options, callback) {
55
- return __awaiter(this, arguments, void 0, function* () {
56
- if (options instanceof Function) {
57
- callback = arguments[1];
58
- options = undefined;
45
+ async getIndex(indexName, options, callback) {
46
+ if (options instanceof Function) {
47
+ callback = arguments[1];
48
+ options = undefined;
49
+ }
50
+ if (!options) {
51
+ options = {};
52
+ }
53
+ const parentSpan = options.parentSpan;
54
+ const timeout = options.timeout;
55
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
56
+ const res = await this._http.request({
57
+ type: httpexecutor_1.HttpServiceType.Search,
58
+ method: httpexecutor_1.HttpMethod.Get,
59
+ path: `/api/index/${indexName}`,
60
+ parentSpan: parentSpan,
61
+ timeout: timeout,
62
+ });
63
+ if (res.statusCode !== 200) {
64
+ throw new errors_1.IndexNotFoundError();
59
65
  }
60
- if (!options) {
61
- options = {};
62
- }
63
- const parentSpan = options.parentSpan;
64
- const timeout = options.timeout;
65
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
66
- const res = yield this._http.request({
67
- type: httpexecutor_1.HttpServiceType.Search,
68
- method: httpexecutor_1.HttpMethod.Get,
69
- path: `/api/index/${indexName}`,
70
- parentSpan: parentSpan,
71
- timeout: timeout,
72
- });
73
- if (res.statusCode !== 200) {
74
- throw new errors_1.IndexNotFoundError();
75
- }
76
- return JSON.parse(res.body.toString());
77
- }), callback);
78
- });
66
+ return JSON.parse(res.body.toString());
67
+ }, callback);
79
68
  }
80
69
  /**
81
70
  * Returns a list of all existing indexes.
@@ -83,31 +72,29 @@ class SearchIndexManager {
83
72
  * @param options Optional parameters for this operation.
84
73
  * @param callback A node-style callback to be invoked after execution.
85
74
  */
86
- getAllIndexes(options, callback) {
87
- return __awaiter(this, arguments, void 0, function* () {
88
- if (options instanceof Function) {
89
- callback = arguments[0];
90
- options = undefined;
91
- }
92
- if (!options) {
93
- options = {};
75
+ async getAllIndexes(options, callback) {
76
+ if (options instanceof Function) {
77
+ callback = arguments[0];
78
+ options = undefined;
79
+ }
80
+ if (!options) {
81
+ options = {};
82
+ }
83
+ const parentSpan = options.parentSpan;
84
+ const timeout = options.timeout;
85
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
86
+ const res = await this._http.request({
87
+ type: httpexecutor_1.HttpServiceType.Search,
88
+ method: httpexecutor_1.HttpMethod.Get,
89
+ path: `/api/index`,
90
+ parentSpan: parentSpan,
91
+ timeout: timeout,
92
+ });
93
+ if (res.statusCode !== 200) {
94
+ throw new Error('failed to fetch search indices');
94
95
  }
95
- const parentSpan = options.parentSpan;
96
- const timeout = options.timeout;
97
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
98
- const res = yield this._http.request({
99
- type: httpexecutor_1.HttpServiceType.Search,
100
- method: httpexecutor_1.HttpMethod.Get,
101
- path: `/api/index`,
102
- parentSpan: parentSpan,
103
- timeout: timeout,
104
- });
105
- if (res.statusCode !== 200) {
106
- throw new Error('failed to fetch search indices');
107
- }
108
- return JSON.parse(res.body.toString());
109
- }), callback);
110
- });
96
+ return JSON.parse(res.body.toString());
97
+ }, callback);
111
98
  }
112
99
  /**
113
100
  * Creates or updates an existing index.
@@ -116,33 +103,31 @@ class SearchIndexManager {
116
103
  * @param options Optional parameters for this operation.
117
104
  * @param callback A node-style callback to be invoked after execution.
118
105
  */
119
- upsertIndex(indexDefinition, options, callback) {
120
- return __awaiter(this, arguments, void 0, function* () {
121
- if (options instanceof Function) {
122
- callback = arguments[2];
123
- options = undefined;
124
- }
125
- if (!options) {
126
- options = {};
106
+ async upsertIndex(indexDefinition, options, callback) {
107
+ if (options instanceof Function) {
108
+ callback = arguments[1];
109
+ options = undefined;
110
+ }
111
+ if (!options) {
112
+ options = {};
113
+ }
114
+ const indexName = indexDefinition.name;
115
+ const parentSpan = options.parentSpan;
116
+ const timeout = options.timeout;
117
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
118
+ const res = await this._http.request({
119
+ type: httpexecutor_1.HttpServiceType.Search,
120
+ method: httpexecutor_1.HttpMethod.Put,
121
+ path: `/api/index/${indexName}`,
122
+ contentType: 'application/json',
123
+ body: JSON.stringify(indexDefinition),
124
+ parentSpan: parentSpan,
125
+ timeout: timeout,
126
+ });
127
+ if (res.statusCode !== 200) {
128
+ throw new Error('failed to create index');
127
129
  }
128
- const indexName = indexDefinition.name;
129
- const parentSpan = options.parentSpan;
130
- const timeout = options.timeout;
131
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
132
- const res = yield this._http.request({
133
- type: httpexecutor_1.HttpServiceType.Search,
134
- method: httpexecutor_1.HttpMethod.Put,
135
- path: `/api/index/${indexName}`,
136
- contentType: 'application/json',
137
- body: JSON.stringify(indexDefinition),
138
- parentSpan: parentSpan,
139
- timeout: timeout,
140
- });
141
- if (res.statusCode !== 200) {
142
- throw new Error('failed to create index');
143
- }
144
- }), callback);
145
- });
130
+ }, callback);
146
131
  }
147
132
  /**
148
133
  * Drops an index.
@@ -151,31 +136,29 @@ class SearchIndexManager {
151
136
  * @param options Optional parameters for this operation.
152
137
  * @param callback A node-style callback to be invoked after execution.
153
138
  */
154
- dropIndex(indexName, options, callback) {
155
- return __awaiter(this, arguments, void 0, function* () {
156
- if (options instanceof Function) {
157
- callback = arguments[1];
158
- options = undefined;
139
+ async dropIndex(indexName, options, callback) {
140
+ if (options instanceof Function) {
141
+ callback = arguments[1];
142
+ options = undefined;
143
+ }
144
+ if (!options) {
145
+ options = {};
146
+ }
147
+ const parentSpan = options.parentSpan;
148
+ const timeout = options.timeout;
149
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
150
+ const res = await this._http.request({
151
+ type: httpexecutor_1.HttpServiceType.Search,
152
+ method: httpexecutor_1.HttpMethod.Delete,
153
+ path: `/api/index/${indexName}`,
154
+ parentSpan: parentSpan,
155
+ timeout: timeout,
156
+ });
157
+ if (res.statusCode !== 200) {
158
+ throw new Error('failed to delete search index');
159
159
  }
160
- if (!options) {
161
- options = {};
162
- }
163
- const parentSpan = options.parentSpan;
164
- const timeout = options.timeout;
165
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
166
- const res = yield this._http.request({
167
- type: httpexecutor_1.HttpServiceType.Search,
168
- method: httpexecutor_1.HttpMethod.Delete,
169
- path: `/api/index/${indexName}`,
170
- parentSpan: parentSpan,
171
- timeout: timeout,
172
- });
173
- if (res.statusCode !== 200) {
174
- throw new Error('failed to delete search index');
175
- }
176
- return JSON.parse(res.body.toString());
177
- }), callback);
178
- });
160
+ return JSON.parse(res.body.toString());
161
+ }, callback);
179
162
  }
180
163
  /**
181
164
  * Returns the number of documents that have been indexed.
@@ -184,31 +167,29 @@ class SearchIndexManager {
184
167
  * @param options Optional parameters for this operation.
185
168
  * @param callback A node-style callback to be invoked after execution.
186
169
  */
187
- getIndexedDocumentsCount(indexName, options, callback) {
188
- return __awaiter(this, arguments, void 0, function* () {
189
- if (options instanceof Function) {
190
- callback = arguments[1];
191
- options = undefined;
192
- }
193
- if (!options) {
194
- options = {};
170
+ async getIndexedDocumentsCount(indexName, options, callback) {
171
+ if (options instanceof Function) {
172
+ callback = arguments[1];
173
+ options = undefined;
174
+ }
175
+ if (!options) {
176
+ options = {};
177
+ }
178
+ const parentSpan = options.parentSpan;
179
+ const timeout = options.timeout;
180
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
181
+ const res = await this._http.request({
182
+ type: httpexecutor_1.HttpServiceType.Search,
183
+ method: httpexecutor_1.HttpMethod.Get,
184
+ path: `/api/index/${indexName}/count`,
185
+ parentSpan: parentSpan,
186
+ timeout: timeout,
187
+ });
188
+ if (res.statusCode !== 200) {
189
+ throw new Error('failed to get search indexed documents count');
195
190
  }
196
- const parentSpan = options.parentSpan;
197
- const timeout = options.timeout;
198
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
199
- const res = yield this._http.request({
200
- type: httpexecutor_1.HttpServiceType.Search,
201
- method: httpexecutor_1.HttpMethod.Get,
202
- path: `/api/index/${indexName}/count`,
203
- parentSpan: parentSpan,
204
- timeout: timeout,
205
- });
206
- if (res.statusCode !== 200) {
207
- throw new Error('failed to get search indexed documents count');
208
- }
209
- return JSON.parse(res.body.toString());
210
- }), callback);
211
- });
191
+ return JSON.parse(res.body.toString());
192
+ }, callback);
212
193
  }
213
194
  /**
214
195
  * Pauses the ingestion of documents into an index.
@@ -217,30 +198,28 @@ class SearchIndexManager {
217
198
  * @param options Optional parameters for this operation.
218
199
  * @param callback A node-style callback to be invoked after execution.
219
200
  */
220
- pauseIngest(indexName, options, callback) {
221
- return __awaiter(this, arguments, void 0, function* () {
222
- if (options instanceof Function) {
223
- callback = arguments[1];
224
- options = undefined;
225
- }
226
- if (!options) {
227
- options = {};
201
+ async pauseIngest(indexName, options, callback) {
202
+ if (options instanceof Function) {
203
+ callback = arguments[1];
204
+ options = undefined;
205
+ }
206
+ if (!options) {
207
+ options = {};
208
+ }
209
+ const parentSpan = options.parentSpan;
210
+ const timeout = options.timeout;
211
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
212
+ const res = await this._http.request({
213
+ type: httpexecutor_1.HttpServiceType.Search,
214
+ method: httpexecutor_1.HttpMethod.Post,
215
+ path: `/api/index/${indexName}/ingestControl/pause`,
216
+ parentSpan: parentSpan,
217
+ timeout: timeout,
218
+ });
219
+ if (res.statusCode !== 200) {
220
+ throw new Error('failed to pause search index ingestion');
228
221
  }
229
- const parentSpan = options.parentSpan;
230
- const timeout = options.timeout;
231
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
232
- const res = yield this._http.request({
233
- type: httpexecutor_1.HttpServiceType.Search,
234
- method: httpexecutor_1.HttpMethod.Post,
235
- path: `/api/index/${indexName}/ingestControl/pause`,
236
- parentSpan: parentSpan,
237
- timeout: timeout,
238
- });
239
- if (res.statusCode !== 200) {
240
- throw new Error('failed to pause search index ingestion');
241
- }
242
- }), callback);
243
- });
222
+ }, callback);
244
223
  }
245
224
  /**
246
225
  * Resumes the ingestion of documents into an index.
@@ -249,30 +228,28 @@ class SearchIndexManager {
249
228
  * @param options Optional parameters for this operation.
250
229
  * @param callback A node-style callback to be invoked after execution.
251
230
  */
252
- resumeIngest(indexName, options, callback) {
253
- return __awaiter(this, arguments, void 0, function* () {
254
- if (options instanceof Function) {
255
- callback = arguments[1];
256
- options = undefined;
231
+ async resumeIngest(indexName, options, callback) {
232
+ if (options instanceof Function) {
233
+ callback = arguments[1];
234
+ options = undefined;
235
+ }
236
+ if (!options) {
237
+ options = {};
238
+ }
239
+ const parentSpan = options.parentSpan;
240
+ const timeout = options.timeout;
241
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
242
+ const res = await this._http.request({
243
+ type: httpexecutor_1.HttpServiceType.Search,
244
+ method: httpexecutor_1.HttpMethod.Post,
245
+ path: `/api/index/${indexName}/ingestControl/resume`,
246
+ parentSpan: parentSpan,
247
+ timeout: timeout,
248
+ });
249
+ if (res.statusCode !== 200) {
250
+ throw new Error('failed to resume search index ingestion');
257
251
  }
258
- if (!options) {
259
- options = {};
260
- }
261
- const parentSpan = options.parentSpan;
262
- const timeout = options.timeout;
263
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
264
- const res = yield this._http.request({
265
- type: httpexecutor_1.HttpServiceType.Search,
266
- method: httpexecutor_1.HttpMethod.Post,
267
- path: `/api/index/${indexName}/ingestControl/resume`,
268
- parentSpan: parentSpan,
269
- timeout: timeout,
270
- });
271
- if (res.statusCode !== 200) {
272
- throw new Error('failed to resume search index ingestion');
273
- }
274
- }), callback);
275
- });
252
+ }, callback);
276
253
  }
277
254
  /**
278
255
  * Enables querying of an index.
@@ -281,30 +258,28 @@ class SearchIndexManager {
281
258
  * @param options Optional parameters for this operation.
282
259
  * @param callback A node-style callback to be invoked after execution.
283
260
  */
284
- allowQuerying(indexName, options, callback) {
285
- return __awaiter(this, arguments, void 0, function* () {
286
- if (options instanceof Function) {
287
- callback = arguments[1];
288
- options = undefined;
289
- }
290
- if (!options) {
291
- options = {};
261
+ async allowQuerying(indexName, options, callback) {
262
+ if (options instanceof Function) {
263
+ callback = arguments[1];
264
+ options = undefined;
265
+ }
266
+ if (!options) {
267
+ options = {};
268
+ }
269
+ const parentSpan = options.parentSpan;
270
+ const timeout = options.timeout;
271
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
272
+ const res = await this._http.request({
273
+ type: httpexecutor_1.HttpServiceType.Search,
274
+ method: httpexecutor_1.HttpMethod.Post,
275
+ path: `/api/index/${indexName}/queryControl/allow`,
276
+ parentSpan: parentSpan,
277
+ timeout: timeout,
278
+ });
279
+ if (res.statusCode !== 200) {
280
+ throw new Error('failed to allow search index quering');
292
281
  }
293
- const parentSpan = options.parentSpan;
294
- const timeout = options.timeout;
295
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
296
- const res = yield this._http.request({
297
- type: httpexecutor_1.HttpServiceType.Search,
298
- method: httpexecutor_1.HttpMethod.Post,
299
- path: `/api/index/${indexName}/queryControl/allow`,
300
- parentSpan: parentSpan,
301
- timeout: timeout,
302
- });
303
- if (res.statusCode !== 200) {
304
- throw new Error('failed to allow search index quering');
305
- }
306
- }), callback);
307
- });
282
+ }, callback);
308
283
  }
309
284
  /**
310
285
  * Disables querying of an index.
@@ -313,30 +288,28 @@ class SearchIndexManager {
313
288
  * @param options Optional parameters for this operation.
314
289
  * @param callback A node-style callback to be invoked after execution.
315
290
  */
316
- disallowQuerying(indexName, options, callback) {
317
- return __awaiter(this, arguments, void 0, function* () {
318
- if (options instanceof Function) {
319
- callback = arguments[1];
320
- options = undefined;
321
- }
322
- if (!options) {
323
- options = {};
291
+ async disallowQuerying(indexName, options, callback) {
292
+ if (options instanceof Function) {
293
+ callback = arguments[1];
294
+ options = undefined;
295
+ }
296
+ if (!options) {
297
+ options = {};
298
+ }
299
+ const parentSpan = options.parentSpan;
300
+ const timeout = options.timeout;
301
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
302
+ const res = await this._http.request({
303
+ type: httpexecutor_1.HttpServiceType.Search,
304
+ method: httpexecutor_1.HttpMethod.Post,
305
+ path: `/api/index/${indexName}/queryControl/disallow`,
306
+ parentSpan: parentSpan,
307
+ timeout: timeout,
308
+ });
309
+ if (res.statusCode !== 200) {
310
+ throw new Error('failed to disallow search index quering');
324
311
  }
325
- const parentSpan = options.parentSpan;
326
- const timeout = options.timeout;
327
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
328
- const res = yield this._http.request({
329
- type: httpexecutor_1.HttpServiceType.Search,
330
- method: httpexecutor_1.HttpMethod.Post,
331
- path: `/api/index/${indexName}/queryControl/disallow`,
332
- parentSpan: parentSpan,
333
- timeout: timeout,
334
- });
335
- if (res.statusCode !== 200) {
336
- throw new Error('failed to disallow search index quering');
337
- }
338
- }), callback);
339
- });
312
+ }, callback);
340
313
  }
341
314
  /**
342
315
  * Freezes the indexing plan for execution of queries.
@@ -345,30 +318,28 @@ class SearchIndexManager {
345
318
  * @param options Optional parameters for this operation.
346
319
  * @param callback A node-style callback to be invoked after execution.
347
320
  */
348
- freezePlan(indexName, options, callback) {
349
- return __awaiter(this, arguments, void 0, function* () {
350
- if (options instanceof Function) {
351
- callback = arguments[1];
352
- options = undefined;
321
+ async freezePlan(indexName, options, callback) {
322
+ if (options instanceof Function) {
323
+ callback = arguments[1];
324
+ options = undefined;
325
+ }
326
+ if (!options) {
327
+ options = {};
328
+ }
329
+ const parentSpan = options.parentSpan;
330
+ const timeout = options.timeout;
331
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
332
+ const res = await this._http.request({
333
+ type: httpexecutor_1.HttpServiceType.Search,
334
+ method: httpexecutor_1.HttpMethod.Post,
335
+ path: `/api/index/${indexName}/planFreezeControl/freeze`,
336
+ parentSpan: parentSpan,
337
+ timeout: timeout,
338
+ });
339
+ if (res.statusCode !== 200) {
340
+ throw new Error('failed to freeze search index plan');
353
341
  }
354
- if (!options) {
355
- options = {};
356
- }
357
- const parentSpan = options.parentSpan;
358
- const timeout = options.timeout;
359
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
360
- const res = yield this._http.request({
361
- type: httpexecutor_1.HttpServiceType.Search,
362
- method: httpexecutor_1.HttpMethod.Post,
363
- path: `/api/index/${indexName}/planFreezeControl/freeze`,
364
- parentSpan: parentSpan,
365
- timeout: timeout,
366
- });
367
- if (res.statusCode !== 200) {
368
- throw new Error('failed to freeze search index plan');
369
- }
370
- }), callback);
371
- });
342
+ }, callback);
372
343
  }
373
344
  /**
374
345
  * Performs analysis of a specific document by an index.
@@ -378,32 +349,30 @@ class SearchIndexManager {
378
349
  * @param options Optional parameters for this operation.
379
350
  * @param callback A node-style callback to be invoked after execution.
380
351
  */
381
- analyzeDocument(indexName, document, options, callback) {
382
- return __awaiter(this, arguments, void 0, function* () {
383
- if (options instanceof Function) {
384
- callback = arguments[2];
385
- options = undefined;
386
- }
387
- if (!options) {
388
- options = {};
352
+ async analyzeDocument(indexName, document, options, callback) {
353
+ if (options instanceof Function) {
354
+ callback = arguments[2];
355
+ options = undefined;
356
+ }
357
+ if (!options) {
358
+ options = {};
359
+ }
360
+ const parentSpan = options.parentSpan;
361
+ const timeout = options.timeout;
362
+ return utilities_1.PromiseHelper.wrapAsync(async () => {
363
+ const res = await this._http.request({
364
+ type: httpexecutor_1.HttpServiceType.Search,
365
+ method: httpexecutor_1.HttpMethod.Post,
366
+ path: `/api/index/${indexName}/analyzeDoc`,
367
+ body: JSON.stringify(document),
368
+ parentSpan: parentSpan,
369
+ timeout: timeout,
370
+ });
371
+ if (res.statusCode !== 200) {
372
+ throw new Error('failed to perform search index document analysis');
389
373
  }
390
- const parentSpan = options.parentSpan;
391
- const timeout = options.timeout;
392
- return utilities_1.PromiseHelper.wrapAsync(() => __awaiter(this, void 0, void 0, function* () {
393
- const res = yield this._http.request({
394
- type: httpexecutor_1.HttpServiceType.Search,
395
- method: httpexecutor_1.HttpMethod.Post,
396
- path: `/api/index/${indexName}/analyzeDoc`,
397
- body: JSON.stringify(document),
398
- parentSpan: parentSpan,
399
- timeout: timeout,
400
- });
401
- if (res.statusCode !== 200) {
402
- throw new Error('failed to perform search index document analysis');
403
- }
404
- return JSON.parse(res.body.toString()).analyze;
405
- }), callback);
406
- });
374
+ return JSON.parse(res.body.toString()).analyze;
375
+ }, callback);
407
376
  }
408
377
  }
409
378
  exports.SearchIndexManager = SearchIndexManager;
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Specifies how the individual match terms should be logically concatenated.
3
+ *
4
+ * @experimental This API is subject to change without notice.
5
+ * @category Full Text Search
6
+ */
7
+ export declare enum MatchOperator {
8
+ /**
9
+ * Specifies that individual match terms are concatenated with a logical OR - this is the default if not provided.
10
+ */
11
+ Or = "or",
12
+ /**
13
+ * Specifies that individual match terms are concatenated with a logical AND.
14
+ */
15
+ And = "and"
16
+ }
1
17
  /**
2
18
  * GeoPoint represents a specific coordinate on earth. We support
3
19
  * a number of different variants of geopoints being specified.
@@ -86,6 +102,7 @@ export declare class MatchSearchQuery extends SearchQuery {
86
102
  * @internal
87
103
  */
88
104
  constructor(match: string);
105
+ operator(op: MatchOperator): MatchSearchQuery;
89
106
  field(field: string): MatchSearchQuery;
90
107
  analyzer(analyzer: string): MatchSearchQuery;
91
108
  prefixLength(prefixLength: number): MatchSearchQuery;
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
2
  /* eslint jsdoc/require-jsdoc: off */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.GeoPolygonSearchQuery = exports.GeoBoundingBoxSearchQuery = exports.GeoDistanceSearchQuery = exports.MatchNoneSearchQuery = exports.MatchAllSearchQuery = exports.PrefixSearchQuery = exports.PhraseSearchQuery = exports.TermSearchQuery = exports.BooleanFieldSearchQuery = exports.DocIdSearchQuery = exports.WildcardSearchQuery = exports.BooleanSearchQuery = exports.DisjunctionSearchQuery = exports.ConjunctionSearchQuery = exports.DateRangeSearchQuery = exports.NumericRangeSearchQuery = exports.QueryStringSearchQuery = exports.RegexpSearchQuery = exports.MatchPhraseSearchQuery = exports.MatchSearchQuery = exports.SearchQuery = void 0;
4
+ exports.GeoPolygonSearchQuery = exports.GeoBoundingBoxSearchQuery = exports.GeoDistanceSearchQuery = exports.MatchNoneSearchQuery = exports.MatchAllSearchQuery = exports.PrefixSearchQuery = exports.PhraseSearchQuery = exports.TermSearchQuery = exports.BooleanFieldSearchQuery = exports.DocIdSearchQuery = exports.WildcardSearchQuery = exports.BooleanSearchQuery = exports.DisjunctionSearchQuery = exports.ConjunctionSearchQuery = exports.DateRangeSearchQuery = exports.NumericRangeSearchQuery = exports.QueryStringSearchQuery = exports.RegexpSearchQuery = exports.MatchPhraseSearchQuery = exports.MatchSearchQuery = exports.SearchQuery = exports.MatchOperator = void 0;
5
+ /**
6
+ * Specifies how the individual match terms should be logically concatenated.
7
+ *
8
+ * @experimental This API is subject to change without notice.
9
+ * @category Full Text Search
10
+ */
11
+ var MatchOperator;
12
+ (function (MatchOperator) {
13
+ /**
14
+ * Specifies that individual match terms are concatenated with a logical OR - this is the default if not provided.
15
+ */
16
+ MatchOperator["Or"] = "or";
17
+ /**
18
+ * Specifies that individual match terms are concatenated with a logical AND.
19
+ */
20
+ MatchOperator["And"] = "and";
21
+ })(MatchOperator = exports.MatchOperator || (exports.MatchOperator = {}));
5
22
  function _parseGeoPoint(v) {
6
23
  if (Array.isArray(v)) {
7
24
  return v;
@@ -145,6 +162,10 @@ class MatchSearchQuery extends SearchQuery {
145
162
  match: match,
146
163
  });
147
164
  }
165
+ operator(op) {
166
+ this._data.operator = op;
167
+ return this;
168
+ }
148
169
  field(field) {
149
170
  this._data.field = field;
150
171
  return this;