couchbase 4.2.9 → 4.2.11-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +67 -2
- package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +65 -1
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
- package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
- package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
- package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
- package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
- package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
- 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 +48 -33
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -0
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +26 -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 +8 -3
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
- 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/collection_create.cxx +7 -6
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -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/operations/management/search_index_analyze_document.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
- 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/topology/capabilities.hxx +70 -1
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
- package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
- 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/core/transactions/internal/utils.hxx +4 -0
- package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
- package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
- package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
- package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
- package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
- package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
- package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
- package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
- package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
- package/dist/binding.d.ts +33 -2
- package/dist/binding.js +4 -1
- package/dist/bindingutilities.d.ts +16 -3
- package/dist/bindingutilities.js +47 -7
- package/dist/cluster.d.ts +12 -1
- package/dist/cluster.js +22 -0
- package/dist/couchbase.d.ts +2 -0
- package/dist/couchbase.js +2 -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 +5 -3
- package/dist/searchexecutor.js +27 -4
- package/dist/searchindexmanager.d.ts +58 -3
- package/dist/searchindexmanager.js +188 -104
- package/dist/searchtypes.d.ts +46 -0
- package/dist/searchtypes.js +81 -1
- package/dist/vectorsearch.d.ts +99 -0
- package/dist/vectorsearch.js +132 -0
- 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 +12 -0
- package/src/jstocbpp_autogen.hpp +113 -13
- package/tools/gen-bindings-json.py +2 -0
package/dist/searchtypes.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SearchScanConsistency = exports.HighlightStyle = exports.SearchResult = exports.SearchRow = exports.SearchMetaData = void 0;
|
3
|
+
exports.SearchRequest = exports.SearchScanConsistency = exports.HighlightStyle = exports.SearchResult = exports.SearchRow = exports.SearchMetaData = void 0;
|
4
|
+
const errors_1 = require("./errors");
|
5
|
+
const searchquery_1 = require("./searchquery");
|
6
|
+
const vectorsearch_1 = require("./vectorsearch");
|
4
7
|
/**
|
5
8
|
* SearchMetaData represents the meta-data available from a search query.
|
6
9
|
* This class is currently incomplete and must be casted to `any` in
|
@@ -67,3 +70,80 @@ var SearchScanConsistency;
|
|
67
70
|
*/
|
68
71
|
SearchScanConsistency["NotBounded"] = "not_bounded";
|
69
72
|
})(SearchScanConsistency || (exports.SearchScanConsistency = SearchScanConsistency = {}));
|
73
|
+
/**
|
74
|
+
* Represents a search query and/or vector search to execute via the Couchbase Full Text Search (FTS) service.
|
75
|
+
*
|
76
|
+
* Volatile: This API is subject to change at any time.
|
77
|
+
*
|
78
|
+
* @category Full Text Search
|
79
|
+
*/
|
80
|
+
class SearchRequest {
|
81
|
+
constructor(query) {
|
82
|
+
if (query instanceof searchquery_1.SearchQuery) {
|
83
|
+
this._searchQuery = query;
|
84
|
+
}
|
85
|
+
else if (query instanceof vectorsearch_1.VectorSearch) {
|
86
|
+
this._vectorSearch = query;
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
throw new errors_1.InvalidArgumentError(new Error('Must provide either a SearchQuery or VectorSearch when creating SearchRequest.'));
|
90
|
+
}
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* @internal
|
94
|
+
*/
|
95
|
+
get searchQuery() {
|
96
|
+
return this._searchQuery;
|
97
|
+
}
|
98
|
+
/**
|
99
|
+
* @internal
|
100
|
+
*/
|
101
|
+
get vectorSearch() {
|
102
|
+
return this._vectorSearch;
|
103
|
+
}
|
104
|
+
/**
|
105
|
+
* Adds a search query to the request if the request does not already have a search query.
|
106
|
+
*
|
107
|
+
* Volatile: This API is subject to change at any time.
|
108
|
+
*
|
109
|
+
* @param query A SearchQuery to add to the request.
|
110
|
+
*/
|
111
|
+
withSearchQuery(query) {
|
112
|
+
if (!(query instanceof searchquery_1.SearchQuery)) {
|
113
|
+
throw new errors_1.InvalidArgumentError(new Error('Must provide a SearchQuery.'));
|
114
|
+
}
|
115
|
+
if (this._searchQuery) {
|
116
|
+
throw new errors_1.InvalidArgumentError(new Error('Request already has a SearchQuery.'));
|
117
|
+
}
|
118
|
+
this._searchQuery = query;
|
119
|
+
return this;
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Adds a vector search to the request if the request does not already have a vector search.
|
123
|
+
*
|
124
|
+
* Volatile: This API is subject to change at any time.
|
125
|
+
*
|
126
|
+
* @param search A VectorSearch to add to the request.
|
127
|
+
*/
|
128
|
+
withVectorSearch(search) {
|
129
|
+
if (!(search instanceof vectorsearch_1.VectorSearch)) {
|
130
|
+
throw new errors_1.InvalidArgumentError(new Error('Must provide a VectorSearch.'));
|
131
|
+
}
|
132
|
+
if (this._vectorSearch) {
|
133
|
+
throw new errors_1.InvalidArgumentError(new Error('Request already has a VectorSearch.'));
|
134
|
+
}
|
135
|
+
this._vectorSearch = search;
|
136
|
+
return this;
|
137
|
+
}
|
138
|
+
/**
|
139
|
+
* Creates a search request.
|
140
|
+
*
|
141
|
+
* Volatile: This API is subject to change at any time.
|
142
|
+
*
|
143
|
+
* @param query Either a SearchQuery or VectorSearch to add to the search request.
|
144
|
+
*/
|
145
|
+
static create(query) {
|
146
|
+
return new SearchRequest(query);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
exports.SearchRequest = SearchRequest;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/**
|
2
|
+
* Specifies how multiple vector searches are combined.
|
3
|
+
*
|
4
|
+
* Volatile: This API is subject to change at any time.
|
5
|
+
*
|
6
|
+
* @category Full Text Search
|
7
|
+
*/
|
8
|
+
export declare enum VectorQueryCombination {
|
9
|
+
/**
|
10
|
+
* Indicates that multiple vector queries should be combined with logical AND.
|
11
|
+
*/
|
12
|
+
AND = "and",
|
13
|
+
/**
|
14
|
+
* Indicates that multiple vector queries should be combined with logical OR.
|
15
|
+
*/
|
16
|
+
OR = "or"
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Volatile: This API is subject to change at any time.
|
20
|
+
*
|
21
|
+
* @category Full Text Search
|
22
|
+
*/
|
23
|
+
export interface VectorSearchOptions {
|
24
|
+
/**
|
25
|
+
* Specifies how multiple vector queries should be combined.
|
26
|
+
*/
|
27
|
+
vectorQueryCombination?: VectorQueryCombination;
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Represents a vector query.
|
31
|
+
*
|
32
|
+
* Volatile: This API is subject to change at any time.
|
33
|
+
*
|
34
|
+
* @category Full Text Search
|
35
|
+
*/
|
36
|
+
export declare class VectorQuery {
|
37
|
+
private _fieldName;
|
38
|
+
private _vector;
|
39
|
+
private _numCandidates;
|
40
|
+
private _boost;
|
41
|
+
constructor(fieldName: string, vector: number[]);
|
42
|
+
/**
|
43
|
+
* @internal
|
44
|
+
*/
|
45
|
+
toJSON(): any;
|
46
|
+
/**
|
47
|
+
* Adds boost option to vector query.
|
48
|
+
*
|
49
|
+
* Volatile: This API is subject to change at any time.
|
50
|
+
*
|
51
|
+
* @param boost A floating point value.
|
52
|
+
*/
|
53
|
+
boost(boost: number): VectorQuery;
|
54
|
+
/**
|
55
|
+
* Adds numCandidates option to vector query. Value must be >= 1.
|
56
|
+
*
|
57
|
+
* Volatile: This API is subject to change at any time.
|
58
|
+
*
|
59
|
+
* @param numCandidates An integer value.
|
60
|
+
*/
|
61
|
+
numCandidates(numCandidates: number): VectorQuery;
|
62
|
+
/**
|
63
|
+
* Creates a vector query.
|
64
|
+
*
|
65
|
+
* Volatile: This API is subject to change at any time.
|
66
|
+
*
|
67
|
+
* @param fieldName The name of the field in the JSON document that holds the vector.
|
68
|
+
* @param vector List of floating point values that represent the vector.
|
69
|
+
*/
|
70
|
+
static create(fieldName: string, vector: number[]): VectorQuery;
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* Represents a vector search.
|
74
|
+
*
|
75
|
+
* Volatile: This API is subject to change at any time.
|
76
|
+
*
|
77
|
+
* @category Full Text Search
|
78
|
+
*/
|
79
|
+
export declare class VectorSearch {
|
80
|
+
private _queries;
|
81
|
+
private _options;
|
82
|
+
constructor(queries: VectorQuery[], options?: VectorSearchOptions);
|
83
|
+
/**
|
84
|
+
* @internal
|
85
|
+
*/
|
86
|
+
get queries(): VectorQuery[];
|
87
|
+
/**
|
88
|
+
* @internal
|
89
|
+
*/
|
90
|
+
get options(): VectorSearchOptions | undefined;
|
91
|
+
/**
|
92
|
+
* Creates a vector search.
|
93
|
+
*
|
94
|
+
* Volatile: This API is subject to change at any time.
|
95
|
+
*
|
96
|
+
* @param query A vectory query that should be a part of the vector search.
|
97
|
+
*/
|
98
|
+
static fromVectorQuery(query: VectorQuery): VectorSearch;
|
99
|
+
}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.VectorSearch = exports.VectorQuery = exports.VectorQueryCombination = void 0;
|
4
|
+
const errors_1 = require("./errors");
|
5
|
+
/**
|
6
|
+
* Specifies how multiple vector searches are combined.
|
7
|
+
*
|
8
|
+
* Volatile: This API is subject to change at any time.
|
9
|
+
*
|
10
|
+
* @category Full Text Search
|
11
|
+
*/
|
12
|
+
var VectorQueryCombination;
|
13
|
+
(function (VectorQueryCombination) {
|
14
|
+
/**
|
15
|
+
* Indicates that multiple vector queries should be combined with logical AND.
|
16
|
+
*/
|
17
|
+
VectorQueryCombination["AND"] = "and";
|
18
|
+
/**
|
19
|
+
* Indicates that multiple vector queries should be combined with logical OR.
|
20
|
+
*/
|
21
|
+
VectorQueryCombination["OR"] = "or";
|
22
|
+
})(VectorQueryCombination || (exports.VectorQueryCombination = VectorQueryCombination = {}));
|
23
|
+
/**
|
24
|
+
* Represents a vector query.
|
25
|
+
*
|
26
|
+
* Volatile: This API is subject to change at any time.
|
27
|
+
*
|
28
|
+
* @category Full Text Search
|
29
|
+
*/
|
30
|
+
class VectorQuery {
|
31
|
+
constructor(fieldName, vector) {
|
32
|
+
this._fieldName = fieldName;
|
33
|
+
if (!Array.isArray(vector) || vector.length == 0) {
|
34
|
+
throw new errors_1.InvalidArgumentError(new Error('Provided vector must be an array and cannot be empty.'));
|
35
|
+
}
|
36
|
+
this._vector = vector;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* @internal
|
40
|
+
*/
|
41
|
+
toJSON() {
|
42
|
+
var _a;
|
43
|
+
const output = {
|
44
|
+
field: this._fieldName,
|
45
|
+
vector: this._vector,
|
46
|
+
k: (_a = this._numCandidates) !== null && _a !== void 0 ? _a : 3,
|
47
|
+
};
|
48
|
+
if (this._boost) {
|
49
|
+
output['boost'] = this._boost;
|
50
|
+
}
|
51
|
+
return output;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Adds boost option to vector query.
|
55
|
+
*
|
56
|
+
* Volatile: This API is subject to change at any time.
|
57
|
+
*
|
58
|
+
* @param boost A floating point value.
|
59
|
+
*/
|
60
|
+
boost(boost) {
|
61
|
+
this._boost = boost;
|
62
|
+
return this;
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Adds numCandidates option to vector query. Value must be >= 1.
|
66
|
+
*
|
67
|
+
* Volatile: This API is subject to change at any time.
|
68
|
+
*
|
69
|
+
* @param numCandidates An integer value.
|
70
|
+
*/
|
71
|
+
numCandidates(numCandidates) {
|
72
|
+
if (numCandidates < 1) {
|
73
|
+
throw new errors_1.InvalidArgumentError(new Error('Provided value for numCandidates must be >= 1.'));
|
74
|
+
}
|
75
|
+
this._numCandidates = numCandidates;
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Creates a vector query.
|
80
|
+
*
|
81
|
+
* Volatile: This API is subject to change at any time.
|
82
|
+
*
|
83
|
+
* @param fieldName The name of the field in the JSON document that holds the vector.
|
84
|
+
* @param vector List of floating point values that represent the vector.
|
85
|
+
*/
|
86
|
+
static create(fieldName, vector) {
|
87
|
+
return new VectorQuery(fieldName, vector);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
exports.VectorQuery = VectorQuery;
|
91
|
+
/**
|
92
|
+
* Represents a vector search.
|
93
|
+
*
|
94
|
+
* Volatile: This API is subject to change at any time.
|
95
|
+
*
|
96
|
+
* @category Full Text Search
|
97
|
+
*/
|
98
|
+
class VectorSearch {
|
99
|
+
constructor(queries, options) {
|
100
|
+
if (!Array.isArray(queries) || queries.length == 0) {
|
101
|
+
throw new errors_1.InvalidArgumentError(new Error('Provided queries must be an array and cannot be empty.'));
|
102
|
+
}
|
103
|
+
if (!queries.every((q) => q instanceof VectorQuery)) {
|
104
|
+
throw new errors_1.InvalidArgumentError(new Error('All provided queries must be a VectorQuery.'));
|
105
|
+
}
|
106
|
+
this._queries = queries;
|
107
|
+
this._options = options;
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* @internal
|
111
|
+
*/
|
112
|
+
get queries() {
|
113
|
+
return this._queries;
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* @internal
|
117
|
+
*/
|
118
|
+
get options() {
|
119
|
+
return this._options;
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Creates a vector search.
|
123
|
+
*
|
124
|
+
* Volatile: This API is subject to change at any time.
|
125
|
+
*
|
126
|
+
* @param query A vectory query that should be a part of the vector search.
|
127
|
+
*/
|
128
|
+
static fromVectorQuery(query) {
|
129
|
+
return new VectorSearch([query]);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
exports.VectorSearch = VectorSearch;
|
package/dist/viewexecutor.js
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.ViewExecutor = void 0;
|
7
4
|
/* eslint jsdoc/require-jsdoc: off */
|
8
|
-
const binding_1 = __importDefault(require("./binding"));
|
9
5
|
const bindingutilities_1 = require("./bindingutilities");
|
10
6
|
const streamablepromises_1 = require("./streamablepromises");
|
11
7
|
const viewtypes_1 = require("./viewtypes");
|
@@ -29,6 +25,7 @@ class ViewExecutor {
|
|
29
25
|
* @internal
|
30
26
|
*/
|
31
27
|
query(designDoc, viewName, options) {
|
28
|
+
var _a;
|
32
29
|
const emitter = new streamablepromises_1.StreamableRowPromise((rows, meta) => {
|
33
30
|
return new viewtypes_1.ViewResult({
|
34
31
|
rows: rows,
|
@@ -36,12 +33,18 @@ class ViewExecutor {
|
|
36
33
|
});
|
37
34
|
});
|
38
35
|
const timeout = options.timeout || this._cluster.viewTimeout;
|
36
|
+
const raw = options.raw || {};
|
37
|
+
const ns = (_a = options.namespace) !== null && _a !== void 0 ? _a : viewtypes_1.DesignDocumentNamespace.Production;
|
38
|
+
let fullSet = options.full_set;
|
39
|
+
if (typeof options.fullSet !== 'undefined') {
|
40
|
+
fullSet = options.fullSet;
|
41
|
+
}
|
39
42
|
this._cluster.conn.documentView({
|
40
43
|
timeout: timeout,
|
41
44
|
bucket_name: this._bucket.name,
|
42
45
|
document_name: designDoc,
|
43
46
|
view_name: viewName,
|
44
|
-
ns:
|
47
|
+
ns: (0, bindingutilities_1.designDocumentNamespaceToCpp)(ns),
|
45
48
|
limit: options.limit,
|
46
49
|
skip: options.skip,
|
47
50
|
consistency: (0, bindingutilities_1.viewScanConsistencyToCpp)(options.scanConsistency),
|
@@ -55,10 +58,10 @@ class ViewExecutor {
|
|
55
58
|
: undefined,
|
56
59
|
inclusive_end: options.range ? options.range.inclusiveEnd : undefined,
|
57
60
|
start_key_doc_id: options.idRange && options.idRange.start
|
58
|
-
?
|
61
|
+
? options.idRange.start
|
59
62
|
: undefined,
|
60
63
|
end_key_doc_id: options.idRange && options.idRange.end
|
61
|
-
?
|
64
|
+
? options.idRange.end
|
62
65
|
: undefined,
|
63
66
|
reduce: options.reduce,
|
64
67
|
group: options.group,
|
@@ -66,7 +69,8 @@ class ViewExecutor {
|
|
66
69
|
order: (0, bindingutilities_1.viewOrderingToCpp)(options.order),
|
67
70
|
debug: false,
|
68
71
|
query_string: [],
|
69
|
-
raw:
|
72
|
+
raw: raw,
|
73
|
+
full_set: fullSet,
|
70
74
|
}, (cppErr, resp) => {
|
71
75
|
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
72
76
|
if (err) {
|
@@ -78,7 +82,7 @@ class ViewExecutor {
|
|
78
82
|
emitter.emit('row', new viewtypes_1.ViewRow({
|
79
83
|
value: JSON.parse(row.value),
|
80
84
|
id: row.id,
|
81
|
-
key: row.key,
|
85
|
+
key: JSON.parse(row.key),
|
82
86
|
}));
|
83
87
|
});
|
84
88
|
{
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { Bucket } from './bucket';
|
2
2
|
import { NodeCallback } from './utilities';
|
3
|
+
import { DesignDocumentNamespace } from './viewtypes';
|
4
|
+
import { CppManagementViewsDesignDocument, CppManagementViewsDesignDocumentView } from './binding';
|
3
5
|
/**
|
4
6
|
* Contains information about a view in a design document.
|
5
7
|
*
|
@@ -9,19 +11,27 @@ export declare class DesignDocumentView {
|
|
9
11
|
/**
|
10
12
|
* The mapping function to use for this view.
|
11
13
|
*/
|
12
|
-
map: string;
|
14
|
+
map: string | undefined;
|
13
15
|
/**
|
14
16
|
* The reduction function to use for this view.
|
15
17
|
*/
|
16
18
|
reduce: string | undefined;
|
17
19
|
constructor(data: {
|
18
|
-
map
|
20
|
+
map?: string;
|
19
21
|
reduce?: string;
|
20
22
|
});
|
21
23
|
/**
|
22
24
|
* @deprecated
|
23
25
|
*/
|
24
|
-
constructor(map
|
26
|
+
constructor(map?: string, reduce?: string);
|
27
|
+
/**
|
28
|
+
* @internal
|
29
|
+
*/
|
30
|
+
static _toCppData(name: string, data: DesignDocumentView): CppManagementViewsDesignDocumentView;
|
31
|
+
/**
|
32
|
+
* @internal
|
33
|
+
*/
|
34
|
+
static _fromCppData(data: CppManagementViewsDesignDocumentView): DesignDocumentView;
|
25
35
|
}
|
26
36
|
/**
|
27
37
|
* Contains information about a design document.
|
@@ -45,11 +55,21 @@ export declare class DesignDocument {
|
|
45
55
|
views: {
|
46
56
|
[viewName: string]: DesignDocumentView;
|
47
57
|
};
|
58
|
+
/**
|
59
|
+
* The namespace for this design document.
|
60
|
+
*/
|
61
|
+
namespace: DesignDocumentNamespace;
|
62
|
+
/**
|
63
|
+
* The revision of the design document.
|
64
|
+
*/
|
65
|
+
rev: string | undefined;
|
48
66
|
constructor(data: {
|
49
67
|
name: string;
|
50
68
|
views?: {
|
51
69
|
[viewName: string]: DesignDocumentView;
|
52
70
|
};
|
71
|
+
namespace?: DesignDocumentNamespace;
|
72
|
+
rev?: string;
|
53
73
|
});
|
54
74
|
/**
|
55
75
|
* @deprecated
|
@@ -61,6 +81,14 @@ export declare class DesignDocument {
|
|
61
81
|
* @internal
|
62
82
|
*/
|
63
83
|
static _fromNsData(ddocName: string, ddocData: any): DesignDocument;
|
84
|
+
/**
|
85
|
+
* @internal
|
86
|
+
*/
|
87
|
+
static _toCppData(data: DesignDocument, namespace: DesignDocumentNamespace): CppManagementViewsDesignDocument;
|
88
|
+
/**
|
89
|
+
* @internal
|
90
|
+
*/
|
91
|
+
static _fromCppData(ddoc: CppManagementViewsDesignDocument): DesignDocument;
|
64
92
|
}
|
65
93
|
/**
|
66
94
|
* @category Management
|
@@ -119,10 +147,6 @@ export declare class ViewIndexManager {
|
|
119
147
|
* @internal
|
120
148
|
*/
|
121
149
|
constructor(bucket: Bucket);
|
122
|
-
/**
|
123
|
-
* @internal
|
124
|
-
*/
|
125
|
-
private get _http();
|
126
150
|
/**
|
127
151
|
* @internal
|
128
152
|
*/
|
@@ -132,32 +156,71 @@ export declare class ViewIndexManager {
|
|
132
156
|
*
|
133
157
|
* @param options Optional parameters for this operation.
|
134
158
|
* @param callback A node-style callback to be invoked after execution.
|
159
|
+
* @deprecated
|
135
160
|
*/
|
136
161
|
getAllDesignDocuments(options?: GetAllDesignDocumentOptions, callback?: NodeCallback<DesignDocument[]>): Promise<DesignDocument[]>;
|
162
|
+
/**
|
163
|
+
* Returns a list of all the design documents in this bucket.
|
164
|
+
*
|
165
|
+
* @param namespace The DesignDocument namespace.
|
166
|
+
* @param options Optional parameters for this operation.
|
167
|
+
* @param callback A node-style callback to be invoked after execution.
|
168
|
+
*/
|
169
|
+
getAllDesignDocuments(namespace: DesignDocumentNamespace, options?: GetAllDesignDocumentOptions, callback?: NodeCallback<DesignDocument[]>): Promise<DesignDocument[]>;
|
137
170
|
/**
|
138
171
|
* Returns the specified design document.
|
139
172
|
*
|
140
173
|
* @param designDocName The name of the design document to fetch.
|
141
174
|
* @param options Optional parameters for this operation.
|
142
175
|
* @param callback A node-style callback to be invoked after execution.
|
176
|
+
* @deprecated
|
143
177
|
*/
|
144
178
|
getDesignDocument(designDocName: string, options?: GetDesignDocumentOptions, callback?: NodeCallback<DesignDocument>): Promise<DesignDocument>;
|
179
|
+
/**
|
180
|
+
* Returns the specified design document.
|
181
|
+
*
|
182
|
+
* @param designDocName The name of the design document to fetch.
|
183
|
+
* @param namespace The DesignDocument namespace.
|
184
|
+
* @param options Optional parameters for this operation.
|
185
|
+
* @param callback A node-style callback to be invoked after execution.
|
186
|
+
*/
|
187
|
+
getDesignDocument(designDocName: string, namespace: DesignDocumentNamespace, options?: GetDesignDocumentOptions, callback?: NodeCallback<DesignDocument>): Promise<DesignDocument>;
|
145
188
|
/**
|
146
189
|
* Creates or updates a design document.
|
147
190
|
*
|
148
191
|
* @param designDoc The DesignDocument to upsert.
|
149
192
|
* @param options Optional parameters for this operation.
|
150
193
|
* @param callback A node-style callback to be invoked after execution.
|
194
|
+
* @deprecated
|
151
195
|
*/
|
152
196
|
upsertDesignDocument(designDoc: DesignDocument, options?: UpsertDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
|
197
|
+
/**
|
198
|
+
* Creates or updates a design document.
|
199
|
+
*
|
200
|
+
* @param designDoc The DesignDocument to upsert.
|
201
|
+
* @param namespace The DesignDocument namespace.
|
202
|
+
* @param options Optional parameters for this operation.
|
203
|
+
* @param callback A node-style callback to be invoked after execution.
|
204
|
+
*/
|
205
|
+
upsertDesignDocument(designDoc: DesignDocument, namespace?: DesignDocumentNamespace, options?: UpsertDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
|
153
206
|
/**
|
154
207
|
* Drops an existing design document.
|
155
208
|
*
|
156
209
|
* @param designDocName The name of the design document to drop.
|
157
210
|
* @param options Optional parameters for this operation.
|
158
211
|
* @param callback A node-style callback to be invoked after execution.
|
212
|
+
* @deprecated
|
159
213
|
*/
|
160
214
|
dropDesignDocument(designDocName: string, options?: DropDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
|
215
|
+
/**
|
216
|
+
* Drops an existing design document.
|
217
|
+
*
|
218
|
+
* @param designDocName The name of the design document to drop.
|
219
|
+
* @param namespace The DesignDocument namespace.
|
220
|
+
* @param options Optional parameters for this operation.
|
221
|
+
* @param callback A node-style callback to be invoked after execution.
|
222
|
+
*/
|
223
|
+
dropDesignDocument(designDocName: string, namespace: DesignDocumentNamespace, options?: DropDesignDocumentOptions, callback?: NodeCallback<void>): Promise<void>;
|
161
224
|
/**
|
162
225
|
* Publishes a development design document to be a production design document.
|
163
226
|
* It does this by fetching the design document by the passed name with `dev_`
|