couchbase 4.2.10 → 4.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deps/couchbase-cxx-client/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +25 -10
- package/deps/couchbase-cxx-client/core/bucket.hxx +1 -0
- package/deps/couchbase-cxx-client/core/cluster.cxx +29 -3
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +7 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +10 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +35 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -0
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +16 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +2 -2
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +10 -10
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +24 -13
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/origin.cxx +14 -0
- package/deps/couchbase-cxx-client/core/origin.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +141 -0
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +64 -0
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +224 -336
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +5 -6
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +6 -4
- package/deps/couchbase-cxx-client/core/scan_result.hxx +1 -11
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +70 -1
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +1 -34
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +43 -20
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +5 -0
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
- package/deps/couchbase-cxx-client/couchbase/error_context.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/search_result.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -0
- package/dist/binding.d.ts +24 -2
- package/dist/bindingutilities.d.ts +11 -3
- package/dist/bindingutilities.js +33 -7
- package/dist/couchbase.d.ts +1 -0
- package/dist/couchbase.js +1 -0
- package/dist/queryindexmanager.d.ts +4 -4
- package/dist/queryindexmanager.js +7 -7
- package/dist/scope.d.ts +21 -0
- package/dist/scope.js +34 -0
- package/dist/scopesearchindexmanager.d.ts +116 -0
- package/dist/scopesearchindexmanager.js +406 -0
- package/dist/sdspecs.js +10 -9
- package/dist/sdutils.d.ts +1 -0
- package/dist/sdutils.js +4 -0
- package/dist/searchexecutor.d.ts +3 -1
- package/dist/searchexecutor.js +9 -2
- package/dist/searchindexmanager.d.ts +58 -3
- package/dist/searchindexmanager.js +188 -104
- package/dist/viewexecutor.js +13 -9
- package/dist/viewindexmanager.d.ts +70 -7
- package/dist/viewindexmanager.js +236 -103
- package/dist/viewtypes.d.ts +26 -0
- package/dist/viewtypes.js +17 -1
- package/package.json +7 -7
- package/src/constants.cpp +1 -0
- package/src/jstocbpp_autogen.hpp +89 -7
- package/deps/couchbase-cxx-client/core/scan_options.hxx +0 -44
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Cluster } from './cluster';
|
|
2
|
+
import { NodeCallback } from './utilities';
|
|
3
|
+
import { GetSearchIndexOptions, GetAllSearchIndexesOptions, UpsertSearchIndexOptions, GetSearchIndexedDocumentsCountOptions, DropSearchIndexOptions, PauseSearchIngestOptions, ResumeSearchIngestOptions, AllowSearchQueryingOptions, DisallowSearchQueryingOptions, FreezeSearchPlanOptions, UnfreezeSearchPlanOptions, AnalyzeSearchDocumentOptions, ISearchIndex, SearchIndex } from './searchindexmanager';
|
|
4
|
+
/**
|
|
5
|
+
* SearchIndexManager provides an interface for managing the
|
|
6
|
+
* search indexes on the cluster.
|
|
7
|
+
*
|
|
8
|
+
* Volatile: This API is subject to change at any time.
|
|
9
|
+
*
|
|
10
|
+
* @category Management
|
|
11
|
+
*/
|
|
12
|
+
export declare class ScopeSearchIndexManager {
|
|
13
|
+
private _cluster;
|
|
14
|
+
private _bucketName;
|
|
15
|
+
private _scopeName;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
constructor(cluster: Cluster, bucketName: string, scopeName: string);
|
|
20
|
+
/**
|
|
21
|
+
* Returns an index by it's name.
|
|
22
|
+
*
|
|
23
|
+
* @param indexName The index to retrieve.
|
|
24
|
+
* @param options Optional parameters for this operation.
|
|
25
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
26
|
+
*/
|
|
27
|
+
getIndex(indexName: string, options?: GetSearchIndexOptions, callback?: NodeCallback<SearchIndex>): Promise<SearchIndex>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a list of all existing indexes.
|
|
30
|
+
*
|
|
31
|
+
* @param options Optional parameters for this operation.
|
|
32
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
33
|
+
*/
|
|
34
|
+
getAllIndexes(options?: GetAllSearchIndexesOptions, callback?: NodeCallback<SearchIndex[]>): Promise<SearchIndex[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates or updates an existing index.
|
|
37
|
+
*
|
|
38
|
+
* @param indexDefinition The index to update.
|
|
39
|
+
* @param options Optional parameters for this operation.
|
|
40
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
41
|
+
*/
|
|
42
|
+
upsertIndex(indexDefinition: ISearchIndex, options?: UpsertSearchIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Drops an index.
|
|
45
|
+
*
|
|
46
|
+
* @param indexName The name of the index to drop.
|
|
47
|
+
* @param options Optional parameters for this operation.
|
|
48
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
49
|
+
*/
|
|
50
|
+
dropIndex(indexName: string, options?: DropSearchIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the number of documents that have been indexed.
|
|
53
|
+
*
|
|
54
|
+
* @param indexName The name of the index to return the count for.
|
|
55
|
+
* @param options Optional parameters for this operation.
|
|
56
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
57
|
+
*/
|
|
58
|
+
getIndexedDocumentsCount(indexName: string, options?: GetSearchIndexedDocumentsCountOptions, callback?: NodeCallback<number>): Promise<number>;
|
|
59
|
+
/**
|
|
60
|
+
* Pauses the ingestion of documents into an index.
|
|
61
|
+
*
|
|
62
|
+
* @param indexName The name of the index to pause.
|
|
63
|
+
* @param options Optional parameters for this operation.
|
|
64
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
65
|
+
*/
|
|
66
|
+
pauseIngest(indexName: string, options?: PauseSearchIngestOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Resumes the ingestion of documents into an index.
|
|
69
|
+
*
|
|
70
|
+
* @param indexName The name of the index to resume.
|
|
71
|
+
* @param options Optional parameters for this operation.
|
|
72
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
73
|
+
*/
|
|
74
|
+
resumeIngest(indexName: string, options?: ResumeSearchIngestOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Enables querying of an index.
|
|
77
|
+
*
|
|
78
|
+
* @param indexName The name of the index to enable querying for.
|
|
79
|
+
* @param options Optional parameters for this operation.
|
|
80
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
81
|
+
*/
|
|
82
|
+
allowQuerying(indexName: string, options?: AllowSearchQueryingOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Disables querying of an index.
|
|
85
|
+
*
|
|
86
|
+
* @param indexName The name of the index to disable querying for.
|
|
87
|
+
* @param options Optional parameters for this operation.
|
|
88
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
89
|
+
*/
|
|
90
|
+
disallowQuerying(indexName: string, options?: DisallowSearchQueryingOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Freezes the indexing plan for execution of queries.
|
|
93
|
+
*
|
|
94
|
+
* @param indexName The name of the index to freeze the plan of.
|
|
95
|
+
* @param options Optional parameters for this operation.
|
|
96
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
97
|
+
*/
|
|
98
|
+
freezePlan(indexName: string, options?: FreezeSearchPlanOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Unfreezes the indexing plan for execution of queries.
|
|
101
|
+
*
|
|
102
|
+
* @param indexName The name of the index to freeze the plan of.
|
|
103
|
+
* @param options Optional parameters for this operation.
|
|
104
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
105
|
+
*/
|
|
106
|
+
unfreezePlan(indexName: string, options?: UnfreezeSearchPlanOptions, callback?: NodeCallback<void>): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Performs analysis of a specific document by an index.
|
|
109
|
+
*
|
|
110
|
+
* @param indexName The name of the index to use for the analysis.
|
|
111
|
+
* @param document The document to analyze.
|
|
112
|
+
* @param options Optional parameters for this operation.
|
|
113
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
114
|
+
*/
|
|
115
|
+
analyzeDocument(indexName: string, document: any, options?: AnalyzeSearchDocumentOptions, callback?: NodeCallback<any>): Promise<any>;
|
|
116
|
+
}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScopeSearchIndexManager = void 0;
|
|
4
|
+
const utilities_1 = require("./utilities");
|
|
5
|
+
const bindingutilities_1 = require("./bindingutilities");
|
|
6
|
+
const searchindexmanager_1 = require("./searchindexmanager");
|
|
7
|
+
/**
|
|
8
|
+
* SearchIndexManager provides an interface for managing the
|
|
9
|
+
* search indexes on the cluster.
|
|
10
|
+
*
|
|
11
|
+
* Volatile: This API is subject to change at any time.
|
|
12
|
+
*
|
|
13
|
+
* @category Management
|
|
14
|
+
*/
|
|
15
|
+
class ScopeSearchIndexManager {
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
constructor(cluster, bucketName, scopeName) {
|
|
20
|
+
this._cluster = cluster;
|
|
21
|
+
this._bucketName = bucketName;
|
|
22
|
+
this._scopeName = scopeName;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns an index by it's name.
|
|
26
|
+
*
|
|
27
|
+
* @param indexName The index to retrieve.
|
|
28
|
+
* @param options Optional parameters for this operation.
|
|
29
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
30
|
+
*/
|
|
31
|
+
async getIndex(indexName, options, callback) {
|
|
32
|
+
if (options instanceof Function) {
|
|
33
|
+
callback = arguments[1];
|
|
34
|
+
options = undefined;
|
|
35
|
+
}
|
|
36
|
+
if (!options) {
|
|
37
|
+
options = {};
|
|
38
|
+
}
|
|
39
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
40
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
41
|
+
this._cluster.conn.managementSearchIndexGet({
|
|
42
|
+
index_name: indexName,
|
|
43
|
+
timeout: timeout,
|
|
44
|
+
bucket_name: this._bucketName,
|
|
45
|
+
scope_name: this._scopeName,
|
|
46
|
+
}, (cppErr, resp) => {
|
|
47
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
48
|
+
if (err) {
|
|
49
|
+
return wrapCallback(err, null);
|
|
50
|
+
}
|
|
51
|
+
const index = searchindexmanager_1.SearchIndex._fromCppData(resp.index);
|
|
52
|
+
wrapCallback(null, index);
|
|
53
|
+
});
|
|
54
|
+
}, callback);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns a list of all existing indexes.
|
|
58
|
+
*
|
|
59
|
+
* @param options Optional parameters for this operation.
|
|
60
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
61
|
+
*/
|
|
62
|
+
async getAllIndexes(options, callback) {
|
|
63
|
+
if (options instanceof Function) {
|
|
64
|
+
callback = arguments[0];
|
|
65
|
+
options = undefined;
|
|
66
|
+
}
|
|
67
|
+
if (!options) {
|
|
68
|
+
options = {};
|
|
69
|
+
}
|
|
70
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
71
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
72
|
+
this._cluster.conn.managementSearchIndexGetAll({
|
|
73
|
+
timeout: timeout,
|
|
74
|
+
bucket_name: this._bucketName,
|
|
75
|
+
scope_name: this._scopeName,
|
|
76
|
+
}, (cppErr, resp) => {
|
|
77
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
78
|
+
if (err) {
|
|
79
|
+
return wrapCallback(err, null);
|
|
80
|
+
}
|
|
81
|
+
const indexes = resp.indexes.map((indexData) => searchindexmanager_1.SearchIndex._fromCppData(indexData));
|
|
82
|
+
wrapCallback(null, indexes);
|
|
83
|
+
});
|
|
84
|
+
}, callback);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates or updates an existing index.
|
|
88
|
+
*
|
|
89
|
+
* @param indexDefinition The index to update.
|
|
90
|
+
* @param options Optional parameters for this operation.
|
|
91
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
92
|
+
*/
|
|
93
|
+
async upsertIndex(indexDefinition, options, callback) {
|
|
94
|
+
if (options instanceof Function) {
|
|
95
|
+
callback = arguments[1];
|
|
96
|
+
options = undefined;
|
|
97
|
+
}
|
|
98
|
+
if (!options) {
|
|
99
|
+
options = {};
|
|
100
|
+
}
|
|
101
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
102
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
103
|
+
this._cluster.conn.managementSearchIndexUpsert({
|
|
104
|
+
index: searchindexmanager_1.SearchIndex._toCppData(indexDefinition),
|
|
105
|
+
timeout: timeout,
|
|
106
|
+
bucket_name: this._bucketName,
|
|
107
|
+
scope_name: this._scopeName,
|
|
108
|
+
}, (cppErr) => {
|
|
109
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
110
|
+
if (err) {
|
|
111
|
+
return wrapCallback(err, null);
|
|
112
|
+
}
|
|
113
|
+
wrapCallback(err);
|
|
114
|
+
});
|
|
115
|
+
}, callback);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Drops an index.
|
|
119
|
+
*
|
|
120
|
+
* @param indexName The name of the index to drop.
|
|
121
|
+
* @param options Optional parameters for this operation.
|
|
122
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
123
|
+
*/
|
|
124
|
+
async dropIndex(indexName, options, callback) {
|
|
125
|
+
if (options instanceof Function) {
|
|
126
|
+
callback = arguments[1];
|
|
127
|
+
options = undefined;
|
|
128
|
+
}
|
|
129
|
+
if (!options) {
|
|
130
|
+
options = {};
|
|
131
|
+
}
|
|
132
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
133
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
134
|
+
this._cluster.conn.managementSearchIndexDrop({
|
|
135
|
+
index_name: indexName,
|
|
136
|
+
timeout: timeout,
|
|
137
|
+
bucket_name: this._bucketName,
|
|
138
|
+
scope_name: this._scopeName,
|
|
139
|
+
}, (cppErr) => {
|
|
140
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
141
|
+
if (err) {
|
|
142
|
+
return wrapCallback(err, null);
|
|
143
|
+
}
|
|
144
|
+
wrapCallback(err);
|
|
145
|
+
});
|
|
146
|
+
}, callback);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the number of documents that have been indexed.
|
|
150
|
+
*
|
|
151
|
+
* @param indexName The name of the index to return the count for.
|
|
152
|
+
* @param options Optional parameters for this operation.
|
|
153
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
154
|
+
*/
|
|
155
|
+
async getIndexedDocumentsCount(indexName, options, callback) {
|
|
156
|
+
if (options instanceof Function) {
|
|
157
|
+
callback = arguments[1];
|
|
158
|
+
options = undefined;
|
|
159
|
+
}
|
|
160
|
+
if (!options) {
|
|
161
|
+
options = {};
|
|
162
|
+
}
|
|
163
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
164
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
165
|
+
this._cluster.conn.managementSearchIndexGetDocumentsCount({
|
|
166
|
+
index_name: indexName,
|
|
167
|
+
timeout: timeout,
|
|
168
|
+
bucket_name: this._bucketName,
|
|
169
|
+
scope_name: this._scopeName,
|
|
170
|
+
}, (cppErr, resp) => {
|
|
171
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
172
|
+
if (err) {
|
|
173
|
+
return wrapCallback(err, null);
|
|
174
|
+
}
|
|
175
|
+
wrapCallback(null, resp.count);
|
|
176
|
+
});
|
|
177
|
+
}, callback);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Pauses the ingestion of documents into an index.
|
|
181
|
+
*
|
|
182
|
+
* @param indexName The name of the index to pause.
|
|
183
|
+
* @param options Optional parameters for this operation.
|
|
184
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
185
|
+
*/
|
|
186
|
+
async pauseIngest(indexName, options, callback) {
|
|
187
|
+
if (options instanceof Function) {
|
|
188
|
+
callback = arguments[1];
|
|
189
|
+
options = undefined;
|
|
190
|
+
}
|
|
191
|
+
if (!options) {
|
|
192
|
+
options = {};
|
|
193
|
+
}
|
|
194
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
195
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
196
|
+
this._cluster.conn.managementSearchIndexControlIngest({
|
|
197
|
+
index_name: indexName,
|
|
198
|
+
pause: true,
|
|
199
|
+
timeout: timeout,
|
|
200
|
+
bucket_name: this._bucketName,
|
|
201
|
+
scope_name: this._scopeName,
|
|
202
|
+
}, (cppErr) => {
|
|
203
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
204
|
+
if (err) {
|
|
205
|
+
return wrapCallback(err, null);
|
|
206
|
+
}
|
|
207
|
+
wrapCallback(err);
|
|
208
|
+
});
|
|
209
|
+
}, callback);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Resumes the ingestion of documents into an index.
|
|
213
|
+
*
|
|
214
|
+
* @param indexName The name of the index to resume.
|
|
215
|
+
* @param options Optional parameters for this operation.
|
|
216
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
217
|
+
*/
|
|
218
|
+
async resumeIngest(indexName, options, callback) {
|
|
219
|
+
if (options instanceof Function) {
|
|
220
|
+
callback = arguments[1];
|
|
221
|
+
options = undefined;
|
|
222
|
+
}
|
|
223
|
+
if (!options) {
|
|
224
|
+
options = {};
|
|
225
|
+
}
|
|
226
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
227
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
228
|
+
this._cluster.conn.managementSearchIndexControlIngest({
|
|
229
|
+
index_name: indexName,
|
|
230
|
+
pause: false,
|
|
231
|
+
timeout: timeout,
|
|
232
|
+
bucket_name: this._bucketName,
|
|
233
|
+
scope_name: this._scopeName,
|
|
234
|
+
}, (cppErr) => {
|
|
235
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
236
|
+
if (err) {
|
|
237
|
+
return wrapCallback(err, null);
|
|
238
|
+
}
|
|
239
|
+
wrapCallback(err);
|
|
240
|
+
});
|
|
241
|
+
}, callback);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Enables querying of an index.
|
|
245
|
+
*
|
|
246
|
+
* @param indexName The name of the index to enable querying for.
|
|
247
|
+
* @param options Optional parameters for this operation.
|
|
248
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
249
|
+
*/
|
|
250
|
+
async allowQuerying(indexName, options, callback) {
|
|
251
|
+
if (options instanceof Function) {
|
|
252
|
+
callback = arguments[1];
|
|
253
|
+
options = undefined;
|
|
254
|
+
}
|
|
255
|
+
if (!options) {
|
|
256
|
+
options = {};
|
|
257
|
+
}
|
|
258
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
259
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
260
|
+
this._cluster.conn.managementSearchIndexControlQuery({
|
|
261
|
+
index_name: indexName,
|
|
262
|
+
allow: true,
|
|
263
|
+
timeout: timeout,
|
|
264
|
+
bucket_name: this._bucketName,
|
|
265
|
+
scope_name: this._scopeName,
|
|
266
|
+
}, (cppErr) => {
|
|
267
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
268
|
+
if (err) {
|
|
269
|
+
return wrapCallback(err, null);
|
|
270
|
+
}
|
|
271
|
+
wrapCallback(err);
|
|
272
|
+
});
|
|
273
|
+
}, callback);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Disables querying of an index.
|
|
277
|
+
*
|
|
278
|
+
* @param indexName The name of the index to disable querying for.
|
|
279
|
+
* @param options Optional parameters for this operation.
|
|
280
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
281
|
+
*/
|
|
282
|
+
async disallowQuerying(indexName, options, callback) {
|
|
283
|
+
if (options instanceof Function) {
|
|
284
|
+
callback = arguments[1];
|
|
285
|
+
options = undefined;
|
|
286
|
+
}
|
|
287
|
+
if (!options) {
|
|
288
|
+
options = {};
|
|
289
|
+
}
|
|
290
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
291
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
292
|
+
this._cluster.conn.managementSearchIndexControlQuery({
|
|
293
|
+
index_name: indexName,
|
|
294
|
+
allow: false,
|
|
295
|
+
timeout: timeout,
|
|
296
|
+
bucket_name: this._bucketName,
|
|
297
|
+
scope_name: this._scopeName,
|
|
298
|
+
}, (cppErr) => {
|
|
299
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
300
|
+
if (err) {
|
|
301
|
+
return wrapCallback(err, null);
|
|
302
|
+
}
|
|
303
|
+
wrapCallback(err);
|
|
304
|
+
});
|
|
305
|
+
}, callback);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Freezes the indexing plan for execution of queries.
|
|
309
|
+
*
|
|
310
|
+
* @param indexName The name of the index to freeze the plan of.
|
|
311
|
+
* @param options Optional parameters for this operation.
|
|
312
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
313
|
+
*/
|
|
314
|
+
async freezePlan(indexName, options, callback) {
|
|
315
|
+
if (options instanceof Function) {
|
|
316
|
+
callback = arguments[1];
|
|
317
|
+
options = undefined;
|
|
318
|
+
}
|
|
319
|
+
if (!options) {
|
|
320
|
+
options = {};
|
|
321
|
+
}
|
|
322
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
323
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
324
|
+
this._cluster.conn.managementSearchIndexControlPlanFreeze({
|
|
325
|
+
index_name: indexName,
|
|
326
|
+
freeze: true,
|
|
327
|
+
timeout: timeout,
|
|
328
|
+
bucket_name: this._bucketName,
|
|
329
|
+
scope_name: this._scopeName,
|
|
330
|
+
}, (cppErr) => {
|
|
331
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
332
|
+
if (err) {
|
|
333
|
+
return wrapCallback(err, null);
|
|
334
|
+
}
|
|
335
|
+
wrapCallback(err);
|
|
336
|
+
});
|
|
337
|
+
}, callback);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Unfreezes the indexing plan for execution of queries.
|
|
341
|
+
*
|
|
342
|
+
* @param indexName The name of the index to freeze the plan of.
|
|
343
|
+
* @param options Optional parameters for this operation.
|
|
344
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
345
|
+
*/
|
|
346
|
+
async unfreezePlan(indexName, options, callback) {
|
|
347
|
+
if (options instanceof Function) {
|
|
348
|
+
callback = arguments[1];
|
|
349
|
+
options = undefined;
|
|
350
|
+
}
|
|
351
|
+
if (!options) {
|
|
352
|
+
options = {};
|
|
353
|
+
}
|
|
354
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
355
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
356
|
+
this._cluster.conn.managementSearchIndexControlPlanFreeze({
|
|
357
|
+
index_name: indexName,
|
|
358
|
+
freeze: false,
|
|
359
|
+
timeout: timeout,
|
|
360
|
+
bucket_name: this._bucketName,
|
|
361
|
+
scope_name: this._scopeName,
|
|
362
|
+
}, (cppErr) => {
|
|
363
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
364
|
+
if (err) {
|
|
365
|
+
return wrapCallback(err, null);
|
|
366
|
+
}
|
|
367
|
+
wrapCallback(err);
|
|
368
|
+
});
|
|
369
|
+
}, callback);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Performs analysis of a specific document by an index.
|
|
373
|
+
*
|
|
374
|
+
* @param indexName The name of the index to use for the analysis.
|
|
375
|
+
* @param document The document to analyze.
|
|
376
|
+
* @param options Optional parameters for this operation.
|
|
377
|
+
* @param callback A node-style callback to be invoked after execution.
|
|
378
|
+
*/
|
|
379
|
+
async analyzeDocument(indexName, document, options, callback) {
|
|
380
|
+
if (options instanceof Function) {
|
|
381
|
+
callback = arguments[2];
|
|
382
|
+
options = undefined;
|
|
383
|
+
}
|
|
384
|
+
if (!options) {
|
|
385
|
+
options = {};
|
|
386
|
+
}
|
|
387
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
|
388
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
|
389
|
+
this._cluster.conn.managementSearchIndexAnalyzeDocument({
|
|
390
|
+
index_name: indexName,
|
|
391
|
+
encoded_document: JSON.stringify(document),
|
|
392
|
+
timeout: timeout,
|
|
393
|
+
bucket_name: this._bucketName,
|
|
394
|
+
scope_name: this._scopeName,
|
|
395
|
+
}, (cppErr, resp) => {
|
|
396
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
397
|
+
if (err) {
|
|
398
|
+
return wrapCallback(err, null);
|
|
399
|
+
}
|
|
400
|
+
const result = JSON.parse(resp.analysis);
|
|
401
|
+
wrapCallback(result, null);
|
|
402
|
+
});
|
|
403
|
+
}, callback);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
exports.ScopeSearchIndexManager = ScopeSearchIndexManager;
|
package/dist/sdspecs.js
CHANGED
|
@@ -81,19 +81,19 @@ class MutateInMacro {
|
|
|
81
81
|
* A macro which references the cas of a document.
|
|
82
82
|
*/
|
|
83
83
|
static get Cas() {
|
|
84
|
-
return new MutateInMacro('${
|
|
84
|
+
return new MutateInMacro('${Mutation.CAS}');
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* A macro which references the seqno of a document.
|
|
88
88
|
*/
|
|
89
89
|
static get SeqNo() {
|
|
90
|
-
return new MutateInMacro('${
|
|
90
|
+
return new MutateInMacro('${Mutation.seqno}');
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* A macro which references the crc32 of the value of a document.
|
|
94
94
|
*/
|
|
95
95
|
static get ValueCrc32c() {
|
|
96
|
-
return new MutateInMacro('${
|
|
96
|
+
return new MutateInMacro('${Mutation.value_crc32c}');
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.MutateInMacro = MutateInMacro;
|
|
@@ -200,18 +200,19 @@ class MutateInSpec {
|
|
|
200
200
|
options = {};
|
|
201
201
|
}
|
|
202
202
|
let flags = 0;
|
|
203
|
-
if (
|
|
204
|
-
value = value._value;
|
|
203
|
+
if (options.createPath) {
|
|
205
204
|
flags |=
|
|
206
205
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag
|
|
207
|
-
.
|
|
206
|
+
.create_parents;
|
|
208
207
|
}
|
|
209
|
-
if (
|
|
208
|
+
if (value instanceof MutateInMacro) {
|
|
209
|
+
value = value._value;
|
|
210
210
|
flags |=
|
|
211
211
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag
|
|
212
|
-
.
|
|
212
|
+
.expand_macros |
|
|
213
|
+
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag.xattr;
|
|
213
214
|
}
|
|
214
|
-
if (options.xattr) {
|
|
215
|
+
else if (options.xattr) {
|
|
215
216
|
flags |=
|
|
216
217
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag.xattr;
|
|
217
218
|
}
|
package/dist/sdutils.d.ts
CHANGED
package/dist/sdutils.js
CHANGED
|
@@ -100,5 +100,9 @@ class SdUtils {
|
|
|
100
100
|
const parts = this._parsePath(path);
|
|
101
101
|
return this._getByPath(value, parts);
|
|
102
102
|
}
|
|
103
|
+
static convertMacroCasToCas(cas) {
|
|
104
|
+
const buf = Buffer.from(cas.startsWith('0x') ? cas.slice(2) : cas, 'hex');
|
|
105
|
+
return `0x${buf.reverse().toString('hex')}`;
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
exports.SdUtils = SdUtils;
|
package/dist/searchexecutor.d.ts
CHANGED
|
@@ -7,10 +7,12 @@ import { StreamableRowPromise } from './streamablepromises';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class SearchExecutor {
|
|
9
9
|
private _cluster;
|
|
10
|
+
private _bucketName;
|
|
11
|
+
private _scopeName;
|
|
10
12
|
/**
|
|
11
13
|
* @internal
|
|
12
14
|
*/
|
|
13
|
-
constructor(cluster: Cluster);
|
|
15
|
+
constructor(cluster: Cluster, bucketName?: string, scopeName?: string);
|
|
14
16
|
/**
|
|
15
17
|
* @internal
|
|
16
18
|
*/
|
package/dist/searchexecutor.js
CHANGED
|
@@ -13,8 +13,10 @@ class SearchExecutor {
|
|
|
13
13
|
/**
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
|
-
constructor(cluster) {
|
|
16
|
+
constructor(cluster, bucketName, scopeName) {
|
|
17
17
|
this._cluster = cluster;
|
|
18
|
+
this._bucketName = bucketName;
|
|
19
|
+
this._scopeName = scopeName;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* @internal
|
|
@@ -70,11 +72,16 @@ class SearchExecutor {
|
|
|
70
72
|
request.show_request = false;
|
|
71
73
|
if (query.vectorSearch) {
|
|
72
74
|
request.vector_search = JSON.stringify(query.vectorSearch.queries);
|
|
73
|
-
if (query.vectorSearch.options &&
|
|
75
|
+
if (query.vectorSearch.options &&
|
|
76
|
+
query.vectorSearch.options.vectorQueryCombination) {
|
|
74
77
|
request.vector_query_combination = (0, bindingutilities_1.vectorQueryCombinationToCpp)(query.vectorSearch.options.vectorQueryCombination);
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
81
|
+
if (this._bucketName && this._scopeName) {
|
|
82
|
+
request.bucket_name = this._bucketName;
|
|
83
|
+
request.scope_name = this._scopeName;
|
|
84
|
+
}
|
|
78
85
|
this._cluster.conn.search(request, (cppErr, resp) => {
|
|
79
86
|
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
|
80
87
|
if (err) {
|