couchbase 3.2.2 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/binding.gyp +5 -0
- package/deps/lcb/CMakeLists.txt +1 -1
- package/deps/lcb/CONTRIBUTING.md +1 -1
- package/deps/lcb/README.markdown +2 -2
- package/deps/lcb/RELEASE_NOTES.markdown +84 -17
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
- package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/example/minimal/query.c +9 -7
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
- package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
- package/deps/lcb/include/libcouchbase/error.h +6 -1
- package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
- package/deps/lcb/include/libcouchbase/tracing.h +2 -2
- package/deps/lcb/include/memcached/protocol_binary.h +21 -0
- package/deps/lcb/libcouchbase.gyp +353 -349
- package/deps/lcb/packaging/deb/control +1 -1
- package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
- package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
- package/deps/lcb/src/capi/cmd_counter.hh +18 -0
- package/deps/lcb/src/capi/cmd_exists.hh +18 -0
- package/deps/lcb/src/capi/cmd_get.hh +17 -0
- package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
- package/deps/lcb/src/capi/cmd_query.cc +13 -0
- package/deps/lcb/src/capi/cmd_query.hh +22 -14
- package/deps/lcb/src/capi/cmd_remove.hh +18 -0
- package/deps/lcb/src/capi/cmd_search.hh +6 -0
- package/deps/lcb/src/capi/cmd_store.hh +28 -21
- package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
- package/deps/lcb/src/capi/cmd_touch.hh +18 -0
- package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
- package/deps/lcb/src/capi/cmd_view.hh +6 -0
- package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
- package/deps/lcb/src/cntl.cc +42 -8
- package/deps/lcb/src/dns-srv.cc +5 -3
- package/deps/lcb/src/errmap.cc +5 -9
- package/deps/lcb/src/errmap.h +7 -3
- package/deps/lcb/src/handler.cc +24 -18
- package/deps/lcb/src/internal.h +2 -1
- package/deps/lcb/src/lcbio/ctx.cc +4 -2
- package/deps/lcb/src/mcserver/mcserver.cc +8 -5
- package/deps/lcb/src/mcserver/negotiate.cc +42 -17
- package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
- package/deps/lcb/src/n1ql/n1ql.cc +5 -1
- package/deps/lcb/src/n1ql/query_handle.cc +80 -44
- package/deps/lcb/src/n1ql/query_handle.hh +41 -3
- package/deps/lcb/src/operations/counter.cc +13 -1
- package/deps/lcb/src/operations/exists.cc +14 -2
- package/deps/lcb/src/operations/get.cc +14 -2
- package/deps/lcb/src/operations/get_replica.cc +18 -6
- package/deps/lcb/src/operations/observe.cc +1 -1
- package/deps/lcb/src/operations/remove.cc +13 -1
- package/deps/lcb/src/operations/store.cc +13 -1
- package/deps/lcb/src/operations/subdoc.cc +13 -2
- package/deps/lcb/src/operations/touch.cc +14 -2
- package/deps/lcb/src/operations/unlock.cc +14 -2
- package/deps/lcb/src/search/search_handle.cc +26 -8
- package/deps/lcb/src/search/search_handle.hh +29 -0
- package/deps/lcb/src/ssl/ssl_common.c +7 -8
- package/deps/lcb/src/tracing/span.cc +43 -10
- package/deps/lcb/src/tracing/tracing-internal.h +105 -93
- package/deps/lcb/src/utilities.cc +21 -0
- package/deps/lcb/src/utilities.h +3 -0
- package/deps/lcb/src/views/view_handle.cc +13 -5
- package/deps/lcb/src/views/view_handle.hh +29 -0
- package/deps/lcb/tests/CMakeLists.txt +21 -0
- package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
- package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
- package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
- package/deps/lcb/tests/iotests/mock-environment.h +49 -1
- package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
- package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
- package/deps/lcb/tests/iotests/serverparams.h +7 -2
- package/deps/lcb/tests/iotests/t_collections.cc +1 -1
- package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
- package/deps/lcb/tests/iotests/t_get.cc +14 -4
- package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
- package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
- package/deps/lcb/tests/iotests/t_views.cc +1 -0
- package/deps/lcb/tests/iotests/testutil.cc +342 -0
- package/deps/lcb/tests/iotests/testutil.h +164 -0
- package/deps/lcb/tests/mocksupport/procutil.c +32 -28
- package/deps/lcb/tests/mocksupport/server.c +0 -1
- package/deps/lcb/tools/cbc.cc +7 -0
- package/dist/analyticsexecutor.js +2 -2
- package/dist/analyticsindexmanager.js +512 -524
- package/dist/binarycollection.d.ts +17 -0
- package/dist/binding.d.ts +2 -0
- package/dist/binding.js +1 -1
- package/dist/bindingutilities.js +9 -1
- package/dist/bucketmanager.d.ts +32 -23
- package/dist/bucketmanager.js +197 -189
- package/dist/cluster.js +37 -36
- package/dist/collection.js +17 -23
- package/dist/collectionmanager.js +181 -200
- package/dist/connection.js +6 -3
- package/dist/connspec.js +5 -1
- package/dist/couchbase.js +7 -14
- package/dist/datastructures.js +239 -310
- package/dist/diagnosticsexecutor.js +70 -85
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +26 -2
- package/dist/eventingfunctionmanager.js +267 -294
- package/dist/httpexecutor.js +31 -38
- package/dist/logging.js +1 -1
- package/dist/queryexecutor.js +3 -3
- package/dist/queryindexmanager.js +236 -263
- package/dist/scope.js +8 -2
- package/dist/searchexecutor.js +3 -0
- package/dist/searchindexmanager.js +240 -271
- package/dist/searchquery.d.ts +17 -0
- package/dist/searchquery.js +22 -1
- package/dist/searchtypes.d.ts +7 -2
- package/dist/searchtypes.js +2 -2
- package/dist/usermanager.js +250 -263
- package/dist/utilities.d.ts +3 -2
- package/dist/utilities.js +16 -4
- package/dist/viewexecutor.js +1 -1
- package/dist/viewindexmanager.js +131 -150
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/constants.cpp +2 -0
- package/src/instance.cpp +8 -1
- package/src/instance.h +1 -0
- package/src/uv-plugin-all.cpp +1 -0
- package/dist/cas.d.ts +0 -0
- 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.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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
96
|
-
|
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
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
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
|
-
|
161
|
-
|
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
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
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
|
-
|
197
|
-
|
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()).count;
|
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
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
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
|
-
|
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
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
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
|
-
|
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
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
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
|
-
|
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
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
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
|
-
|
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
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
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
|
-
|
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
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
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
|
-
|
391
|
-
|
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;
|
package/dist/searchquery.d.ts
CHANGED
@@ -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;
|
package/dist/searchquery.js
CHANGED
@@ -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;
|