couchbase 4.4.3 → 4.4.4
Sign up to get free protection for your applications and to get access to all the features.
- package/BUILDING.md +182 -0
- package/CMakeLists.txt +11 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -2
- package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/BUILDING.md +206 -0
- package/deps/couchbase-cxx-client/CMakeLists.txt +3 -1
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/deps/couchbase-cxx-client/cmake/APKBUILD.in +54 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +0 -5
- package/deps/couchbase-cxx-client/cmake/Packaging.cmake +174 -11
- package/deps/couchbase-cxx-client/cmake/RPath.cmake +10 -0
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +4 -0
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +2 -2
- package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +2 -2
- package/deps/couchbase-cxx-client/cmake/debian/changelog.in +5 -0
- package/deps/couchbase-cxx-client/cmake/debian/compat +1 -0
- package/deps/couchbase-cxx-client/cmake/debian/control +40 -0
- package/deps/couchbase-cxx-client/cmake/debian/rules +41 -0
- package/deps/couchbase-cxx-client/cmake/debian/source/format +1 -0
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +27 -3
- package/deps/couchbase-cxx-client/core/impl/error.cxx +24 -3
- package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/search.cxx +2 -0
- package/deps/couchbase-cxx-client/core/io/http_command.hxx +2 -2
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +11 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +47 -6
- package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +23 -17
- package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +23 -15
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +9 -21
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +6 -33
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +41 -41
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +15 -16
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +0 -20
- package/deps/couchbase-cxx-client/couchbase/common_options.hxx +16 -1
- package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +16 -20
- package/dist/analyticsindexmanager.d.ts +98 -14
- package/dist/analyticsindexmanager.js +452 -411
- package/dist/binding.d.ts +53 -4
- package/dist/bindingutilities.d.ts +26 -1
- package/dist/bindingutilities.js +108 -1
- package/dist/couchbase.d.ts +3 -1
- package/dist/couchbase.js +2 -0
- package/dist/rangeScan.d.ts +1 -1
- package/dist/rangeScan.js +1 -1
- package/dist/transactions.d.ts +34 -3
- package/dist/transactions.js +25 -18
- package/dist/transcoders.d.ts +68 -0
- package/dist/transcoders.js +194 -1
- package/dist/usermanager.d.ts +14 -14
- package/dist/usermanager.js +178 -228
- package/dist/utilities.js +4 -6
- package/dist/utilities_internal.js +1 -2
- package/package.json +9 -8
- package/src/connection.cpp +22 -0
- package/src/connection.hpp +12 -0
- package/src/connection_autogen.cpp +100 -0
- package/src/jstocbpp_autogen.hpp +315 -8
- package/src/jstocbpp_transactions.hpp +1 -2
- package/tools/gen-bindings-js.js +38 -3
- package/tools/gen-bindings-json.py +575 -328
package/dist/usermanager.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.UserManager = exports.Group = exports.UserAndMetadata = exports.User = exports.RoleAndOrigin = exports.RoleAndDescription = exports.Role = exports.Origin = void 0;
|
4
|
-
const
|
5
|
-
const httpexecutor_1 = require("./httpexecutor");
|
4
|
+
const bindingutilities_1 = require("./bindingutilities");
|
6
5
|
const utilities_1 = require("./utilities");
|
7
6
|
/**
|
8
7
|
* Contains information about an origin for a role.
|
@@ -20,7 +19,7 @@ class Origin {
|
|
20
19
|
/**
|
21
20
|
* @internal
|
22
21
|
*/
|
23
|
-
static
|
22
|
+
static _fromCppData(data) {
|
24
23
|
return new Origin({
|
25
24
|
type: data.type,
|
26
25
|
name: data.name,
|
@@ -46,33 +45,24 @@ class Role {
|
|
46
45
|
/**
|
47
46
|
* @internal
|
48
47
|
*/
|
49
|
-
static
|
48
|
+
static _fromCppData(data) {
|
50
49
|
return new Role({
|
51
|
-
name: data.
|
52
|
-
bucket: data.
|
53
|
-
scope: data.
|
54
|
-
collection: data.
|
50
|
+
name: data.name,
|
51
|
+
bucket: data.bucket,
|
52
|
+
scope: data.scope,
|
53
|
+
collection: data.collection,
|
55
54
|
});
|
56
55
|
}
|
57
56
|
/**
|
58
57
|
* @internal
|
59
58
|
*/
|
60
|
-
static
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
else if (role.bucket && role.scope) {
|
68
|
-
return `${role.name}[${role.bucket}:${role.scope}]`;
|
69
|
-
}
|
70
|
-
else if (role.bucket) {
|
71
|
-
return `${role.name}[${role.bucket}]`;
|
72
|
-
}
|
73
|
-
else {
|
74
|
-
return role.name;
|
75
|
-
}
|
59
|
+
static _toCppData(data) {
|
60
|
+
return {
|
61
|
+
name: data.name,
|
62
|
+
bucket: data.bucket,
|
63
|
+
scope: data.scope,
|
64
|
+
collection: data.collection,
|
65
|
+
};
|
76
66
|
}
|
77
67
|
}
|
78
68
|
exports.Role = Role;
|
@@ -93,9 +83,10 @@ class RoleAndDescription extends Role {
|
|
93
83
|
/**
|
94
84
|
* @internal
|
95
85
|
*/
|
96
|
-
static
|
86
|
+
static _fromCppData(data) {
|
87
|
+
const role = Role._fromCppData(data);
|
97
88
|
return new RoleAndDescription({
|
98
|
-
...
|
89
|
+
...role,
|
99
90
|
displayName: data.name,
|
100
91
|
description: data.description,
|
101
92
|
});
|
@@ -118,16 +109,15 @@ class RoleAndOrigin extends Role {
|
|
118
109
|
/**
|
119
110
|
* @internal
|
120
111
|
*/
|
121
|
-
static
|
122
|
-
|
123
|
-
if (data.origins) {
|
124
|
-
origins = data.origins.map((originData) => Origin._fromNsData(originData));
|
125
|
-
}
|
126
|
-
else {
|
127
|
-
origins = [];
|
128
|
-
}
|
112
|
+
static _fromCppData(data) {
|
113
|
+
const origins = data.origins.map((origin) => Origin._fromCppData(origin));
|
129
114
|
return new RoleAndOrigin({
|
130
|
-
...Role.
|
115
|
+
...Role._fromCppData({
|
116
|
+
name: data.name,
|
117
|
+
bucket: data.bucket,
|
118
|
+
scope: data.scope,
|
119
|
+
collection: data.collection,
|
120
|
+
}),
|
131
121
|
origins,
|
132
122
|
});
|
133
123
|
}
|
@@ -151,48 +141,38 @@ class User {
|
|
151
141
|
/**
|
152
142
|
* @internal
|
153
143
|
*/
|
154
|
-
static
|
155
|
-
let roles;
|
156
|
-
if (data.roles) {
|
157
|
-
roles = data.roles
|
158
|
-
.filter((roleData) => {
|
159
|
-
// Check whether or not this role has originated from the user directly
|
160
|
-
// or whether it was through a group.
|
161
|
-
if (!roleData.origins || roleData.origins.length === 0) {
|
162
|
-
return false;
|
163
|
-
}
|
164
|
-
return !!roleData.origins.find((originData) => originData.type === 'user');
|
165
|
-
})
|
166
|
-
.map((roleData) => Role._fromNsData(roleData));
|
167
|
-
}
|
168
|
-
else {
|
169
|
-
roles = [];
|
170
|
-
}
|
144
|
+
static _fromCppData(data) {
|
171
145
|
return new User({
|
172
|
-
username: data.
|
173
|
-
displayName: data.
|
146
|
+
username: data.username,
|
147
|
+
displayName: data.display_name,
|
174
148
|
groups: data.groups,
|
175
|
-
roles: roles,
|
149
|
+
roles: data.roles.map((role) => Role._fromCppData(role)),
|
176
150
|
password: undefined,
|
177
151
|
});
|
178
152
|
}
|
179
153
|
/**
|
180
154
|
* @internal
|
181
155
|
*/
|
182
|
-
static
|
183
|
-
|
184
|
-
if (
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
156
|
+
static _toCppData(data) {
|
157
|
+
const roles = [];
|
158
|
+
if (data.roles) {
|
159
|
+
data.roles.forEach((role) => {
|
160
|
+
if (typeof role === 'string') {
|
161
|
+
roles.push({
|
162
|
+
name: role,
|
163
|
+
});
|
164
|
+
}
|
165
|
+
else {
|
166
|
+
roles.push(Role._toCppData(role));
|
167
|
+
}
|
168
|
+
});
|
190
169
|
}
|
191
170
|
return {
|
192
|
-
|
193
|
-
|
194
|
-
|
171
|
+
username: data.username,
|
172
|
+
display_name: data.displayName,
|
173
|
+
groups: data.groups ? data.groups : [],
|
195
174
|
roles: roles,
|
175
|
+
password: data.password,
|
196
176
|
};
|
197
177
|
}
|
198
178
|
}
|
@@ -226,20 +206,23 @@ class UserAndMetadata extends User {
|
|
226
206
|
/**
|
227
207
|
* @internal
|
228
208
|
*/
|
229
|
-
static
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
}
|
209
|
+
static _fromCppData(data) {
|
210
|
+
const user = User._fromCppData({
|
211
|
+
username: data.username,
|
212
|
+
display_name: data.display_name,
|
213
|
+
groups: data.groups,
|
214
|
+
roles: data.roles,
|
215
|
+
password: data.password,
|
216
|
+
});
|
217
|
+
const effectiveRoles = data.effective_roles.map((erole) => RoleAndOrigin._fromCppData(erole));
|
237
218
|
return new UserAndMetadata({
|
238
|
-
...
|
239
|
-
domain: data.domain,
|
219
|
+
...user,
|
220
|
+
domain: (0, bindingutilities_1.authDomainFromCpp)(data.domain),
|
240
221
|
effectiveRoles: effectiveRoles,
|
241
222
|
effectiveRolesAndOrigins: effectiveRoles,
|
242
|
-
passwordChanged:
|
223
|
+
passwordChanged: data.password_changed
|
224
|
+
? new Date(data.password_changed)
|
225
|
+
: undefined,
|
243
226
|
externalGroups: data.external_groups,
|
244
227
|
});
|
245
228
|
}
|
@@ -263,33 +246,36 @@ class Group {
|
|
263
246
|
/**
|
264
247
|
* @internal
|
265
248
|
*/
|
266
|
-
static
|
267
|
-
let roles;
|
268
|
-
if (data.roles) {
|
269
|
-
roles = data.roles.map((roleData) => Role._fromNsData(roleData));
|
270
|
-
}
|
271
|
-
else {
|
272
|
-
roles = [];
|
273
|
-
}
|
249
|
+
static _fromCppData(data) {
|
274
250
|
return new Group({
|
275
|
-
name: data.
|
276
|
-
description: data.description,
|
277
|
-
roles: roles,
|
251
|
+
name: data.name,
|
252
|
+
description: data.description || '',
|
253
|
+
roles: data.roles.map((role) => Role._fromCppData(role)),
|
278
254
|
ldapGroupReference: data.ldap_group_reference,
|
279
255
|
});
|
280
256
|
}
|
281
257
|
/**
|
282
258
|
* @internal
|
283
259
|
*/
|
284
|
-
static
|
285
|
-
|
286
|
-
if (
|
287
|
-
|
260
|
+
static _toCppData(data) {
|
261
|
+
const roles = [];
|
262
|
+
if (data.roles) {
|
263
|
+
data.roles.forEach((role) => {
|
264
|
+
if (typeof role === 'string') {
|
265
|
+
roles.push({
|
266
|
+
name: role,
|
267
|
+
});
|
268
|
+
}
|
269
|
+
else {
|
270
|
+
roles.push(Role._toCppData(role));
|
271
|
+
}
|
272
|
+
});
|
288
273
|
}
|
289
274
|
return {
|
290
|
-
|
275
|
+
name: data.name,
|
276
|
+
description: data.description,
|
291
277
|
roles: roles,
|
292
|
-
ldap_group_reference:
|
278
|
+
ldap_group_reference: data.ldapGroupReference,
|
293
279
|
};
|
294
280
|
}
|
295
281
|
}
|
@@ -307,9 +293,6 @@ class UserManager {
|
|
307
293
|
constructor(cluster) {
|
308
294
|
this._cluster = cluster;
|
309
295
|
}
|
310
|
-
get _http() {
|
311
|
-
return new httpexecutor_1.HttpExecutor(this._cluster.conn);
|
312
|
-
}
|
313
296
|
/**
|
314
297
|
* Returns a specific user by their username.
|
315
298
|
*
|
@@ -325,24 +308,20 @@ class UserManager {
|
|
325
308
|
if (!options) {
|
326
309
|
options = {};
|
327
310
|
}
|
328
|
-
const
|
311
|
+
const cppDomain = (0, bindingutilities_1.authDomainToCpp)(options.domainName || 'local');
|
329
312
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
330
|
-
return utilities_1.PromiseHelper.
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
path: `/settings/rbac/users/${domainName}/${username}`,
|
313
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
314
|
+
this._cluster.conn.managementUserGet({
|
315
|
+
username: username,
|
316
|
+
domain: cppDomain,
|
335
317
|
timeout: timeout,
|
336
|
-
})
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
throw new errors_1.UserNotFoundError(undefined, errCtx);
|
318
|
+
}, (cppErr, resp) => {
|
319
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
320
|
+
if (err) {
|
321
|
+
return wrapCallback(err, null);
|
341
322
|
}
|
342
|
-
|
343
|
-
}
|
344
|
-
const userData = JSON.parse(res.body.toString());
|
345
|
-
return UserAndMetadata._fromNsData(userData);
|
323
|
+
wrapCallback(null, UserAndMetadata._fromCppData(resp.user));
|
324
|
+
});
|
346
325
|
}, callback);
|
347
326
|
}
|
348
327
|
/**
|
@@ -359,22 +338,20 @@ class UserManager {
|
|
359
338
|
if (!options) {
|
360
339
|
options = {};
|
361
340
|
}
|
362
|
-
const
|
341
|
+
const cppDomain = (0, bindingutilities_1.authDomainToCpp)(options.domainName || 'local');
|
363
342
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
364
|
-
return utilities_1.PromiseHelper.
|
365
|
-
|
366
|
-
|
367
|
-
method: httpexecutor_1.HttpMethod.Get,
|
368
|
-
path: `/settings/rbac/users/${domainName}`,
|
343
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
344
|
+
this._cluster.conn.managementUserGetAll({
|
345
|
+
domain: cppDomain,
|
369
346
|
timeout: timeout,
|
347
|
+
}, (cppErr, resp) => {
|
348
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
349
|
+
if (err) {
|
350
|
+
return wrapCallback(err, null);
|
351
|
+
}
|
352
|
+
const users = resp.users.map((user) => UserAndMetadata._fromCppData(user));
|
353
|
+
wrapCallback(null, users);
|
370
354
|
});
|
371
|
-
if (res.statusCode !== 200) {
|
372
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
373
|
-
throw new errors_1.CouchbaseError('failed to get users', undefined, errCtx);
|
374
|
-
}
|
375
|
-
const usersData = JSON.parse(res.body.toString());
|
376
|
-
const users = usersData.map((userData) => UserAndMetadata._fromNsData(userData));
|
377
|
-
return users;
|
378
355
|
}, callback);
|
379
356
|
}
|
380
357
|
/**
|
@@ -392,22 +369,20 @@ class UserManager {
|
|
392
369
|
if (!options) {
|
393
370
|
options = {};
|
394
371
|
}
|
395
|
-
const
|
372
|
+
const cppDomain = (0, bindingutilities_1.authDomainToCpp)(options.domainName || 'local');
|
396
373
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
397
|
-
return utilities_1.PromiseHelper.
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
method: httpexecutor_1.HttpMethod.Put,
|
402
|
-
path: `/settings/rbac/users/${domainName}/${user.username}`,
|
403
|
-
contentType: 'application/x-www-form-urlencoded',
|
404
|
-
body: (0, utilities_1.cbQsStringify)(userData),
|
374
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
375
|
+
this._cluster.conn.managementUserUpsert({
|
376
|
+
user: User._toCppData(user),
|
377
|
+
domain: cppDomain,
|
405
378
|
timeout: timeout,
|
379
|
+
}, (cppErr) => {
|
380
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
381
|
+
if (err) {
|
382
|
+
return wrapCallback(err, null);
|
383
|
+
}
|
384
|
+
wrapCallback(err);
|
406
385
|
});
|
407
|
-
if (res.statusCode !== 200) {
|
408
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
409
|
-
throw new errors_1.CouchbaseError('failed to upsert user', undefined, errCtx);
|
410
|
-
}
|
411
386
|
}, callback);
|
412
387
|
}
|
413
388
|
/**
|
@@ -426,23 +401,17 @@ class UserManager {
|
|
426
401
|
options = {};
|
427
402
|
}
|
428
403
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
429
|
-
return utilities_1.PromiseHelper.
|
430
|
-
|
431
|
-
|
432
|
-
type: httpexecutor_1.HttpServiceType.Management,
|
433
|
-
method: httpexecutor_1.HttpMethod.Post,
|
434
|
-
path: `/controller/changePassword`,
|
435
|
-
contentType: 'application/x-www-form-urlencoded',
|
436
|
-
body: (0, utilities_1.cbQsStringify)(passwordData),
|
404
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
405
|
+
this._cluster.conn.managementChangePassword({
|
406
|
+
newPassword: newPassword,
|
437
407
|
timeout: timeout,
|
438
|
-
})
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
throw new errors_1.UserNotFoundError(undefined, errCtx);
|
408
|
+
}, (cppErr) => {
|
409
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
410
|
+
if (err) {
|
411
|
+
return wrapCallback(err, null);
|
443
412
|
}
|
444
|
-
|
445
|
-
}
|
413
|
+
wrapCallback(err);
|
414
|
+
});
|
446
415
|
}, callback);
|
447
416
|
}
|
448
417
|
/**
|
@@ -460,22 +429,20 @@ class UserManager {
|
|
460
429
|
if (!options) {
|
461
430
|
options = {};
|
462
431
|
}
|
463
|
-
const
|
432
|
+
const cppDomain = (0, bindingutilities_1.authDomainToCpp)(options.domainName || 'local');
|
464
433
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
465
|
-
return utilities_1.PromiseHelper.
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
path: `/settings/rbac/users/${domainName}/${username}`,
|
434
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
435
|
+
this._cluster.conn.managementUserDrop({
|
436
|
+
username: username,
|
437
|
+
domain: cppDomain,
|
470
438
|
timeout: timeout,
|
471
|
-
})
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
throw new errors_1.UserNotFoundError(undefined, errCtx);
|
439
|
+
}, (cppErr) => {
|
440
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
441
|
+
if (err) {
|
442
|
+
return wrapCallback(err, null);
|
476
443
|
}
|
477
|
-
|
478
|
-
}
|
444
|
+
wrapCallback(err);
|
445
|
+
});
|
479
446
|
}, callback);
|
480
447
|
}
|
481
448
|
/**
|
@@ -493,20 +460,17 @@ class UserManager {
|
|
493
460
|
options = {};
|
494
461
|
}
|
495
462
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
496
|
-
return utilities_1.PromiseHelper.
|
497
|
-
|
498
|
-
type: httpexecutor_1.HttpServiceType.Management,
|
499
|
-
method: httpexecutor_1.HttpMethod.Get,
|
500
|
-
path: `/settings/rbac/roles`,
|
463
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
464
|
+
this._cluster.conn.managementRoleGetAll({
|
501
465
|
timeout: timeout,
|
466
|
+
}, (cppErr, resp) => {
|
467
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
468
|
+
if (err) {
|
469
|
+
return wrapCallback(err, null);
|
470
|
+
}
|
471
|
+
const roles = resp.roles.map((role) => Role._fromCppData(role));
|
472
|
+
wrapCallback(null, roles);
|
502
473
|
});
|
503
|
-
if (res.statusCode !== 200) {
|
504
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
505
|
-
throw new errors_1.CouchbaseError('failed to get roles', undefined, errCtx);
|
506
|
-
}
|
507
|
-
const rolesData = JSON.parse(res.body.toString());
|
508
|
-
const roles = rolesData.map((roleData) => RoleAndDescription._fromNsData(roleData));
|
509
|
-
return roles;
|
510
474
|
}, callback);
|
511
475
|
}
|
512
476
|
/**
|
@@ -525,22 +489,17 @@ class UserManager {
|
|
525
489
|
options = {};
|
526
490
|
}
|
527
491
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
528
|
-
return utilities_1.PromiseHelper.
|
529
|
-
|
530
|
-
|
531
|
-
method: httpexecutor_1.HttpMethod.Get,
|
532
|
-
path: `/settings/rbac/groups/${groupName}`,
|
492
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
493
|
+
this._cluster.conn.managementGroupGet({
|
494
|
+
name: groupName,
|
533
495
|
timeout: timeout,
|
534
|
-
})
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
throw new errors_1.GroupNotFoundError(undefined, errCtx);
|
496
|
+
}, (cppErr, resp) => {
|
497
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
498
|
+
if (err) {
|
499
|
+
return wrapCallback(err, null);
|
539
500
|
}
|
540
|
-
|
541
|
-
}
|
542
|
-
const groupData = JSON.parse(res.body.toString());
|
543
|
-
return Group._fromNsData(groupData);
|
501
|
+
wrapCallback(null, Group._fromCppData(resp.group));
|
502
|
+
});
|
544
503
|
}, callback);
|
545
504
|
}
|
546
505
|
/**
|
@@ -558,20 +517,17 @@ class UserManager {
|
|
558
517
|
options = {};
|
559
518
|
}
|
560
519
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
561
|
-
return utilities_1.PromiseHelper.
|
562
|
-
|
563
|
-
type: httpexecutor_1.HttpServiceType.Management,
|
564
|
-
method: httpexecutor_1.HttpMethod.Get,
|
565
|
-
path: `/settings/rbac/groups`,
|
520
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
521
|
+
this._cluster.conn.managementGroupGetAll({
|
566
522
|
timeout: timeout,
|
523
|
+
}, (cppErr, resp) => {
|
524
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
525
|
+
if (err) {
|
526
|
+
return wrapCallback(err, null);
|
527
|
+
}
|
528
|
+
const groups = resp.groups.map((group) => Group._fromCppData(group));
|
529
|
+
wrapCallback(null, groups);
|
567
530
|
});
|
568
|
-
if (res.statusCode !== 200) {
|
569
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
570
|
-
throw new errors_1.CouchbaseError('failed to get groups', undefined, errCtx);
|
571
|
-
}
|
572
|
-
const groupsData = JSON.parse(res.body.toString());
|
573
|
-
const groups = groupsData.map((groupData) => Group._fromNsData(groupData));
|
574
|
-
return groups;
|
575
531
|
}, callback);
|
576
532
|
}
|
577
533
|
/**
|
@@ -590,20 +546,17 @@ class UserManager {
|
|
590
546
|
options = {};
|
591
547
|
}
|
592
548
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
593
|
-
return utilities_1.PromiseHelper.
|
594
|
-
|
595
|
-
|
596
|
-
type: httpexecutor_1.HttpServiceType.Management,
|
597
|
-
method: httpexecutor_1.HttpMethod.Put,
|
598
|
-
path: `/settings/rbac/groups/${group.name}`,
|
599
|
-
contentType: 'application/x-www-form-urlencoded',
|
600
|
-
body: (0, utilities_1.cbQsStringify)(groupData),
|
549
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
550
|
+
this._cluster.conn.managementGroupUpsert({
|
551
|
+
group: Group._toCppData(group),
|
601
552
|
timeout: timeout,
|
553
|
+
}, (cppErr) => {
|
554
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
555
|
+
if (err) {
|
556
|
+
return wrapCallback(err, null);
|
557
|
+
}
|
558
|
+
wrapCallback(err);
|
602
559
|
});
|
603
|
-
if (res.statusCode !== 200) {
|
604
|
-
const errCtx = httpexecutor_1.HttpExecutor.errorContextFromResponse(res);
|
605
|
-
throw new errors_1.CouchbaseError('failed to upsert group', undefined, errCtx);
|
606
|
-
}
|
607
560
|
}, callback);
|
608
561
|
}
|
609
562
|
/**
|
@@ -622,20 +575,17 @@ class UserManager {
|
|
622
575
|
options = {};
|
623
576
|
}
|
624
577
|
const timeout = options.timeout || this._cluster.managementTimeout;
|
625
|
-
return utilities_1.PromiseHelper.
|
626
|
-
|
627
|
-
|
628
|
-
method: httpexecutor_1.HttpMethod.Delete,
|
629
|
-
path: `/settings/rbac/groups/${groupName}`,
|
578
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
579
|
+
this._cluster.conn.managementGroupDrop({
|
580
|
+
name: groupName,
|
630
581
|
timeout: timeout,
|
631
|
-
})
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
throw new errors_1.GroupNotFoundError(undefined, errCtx);
|
582
|
+
}, (cppErr) => {
|
583
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
584
|
+
if (err) {
|
585
|
+
return wrapCallback(err, null);
|
636
586
|
}
|
637
|
-
|
638
|
-
}
|
587
|
+
wrapCallback(err);
|
588
|
+
});
|
639
589
|
}, callback);
|
640
590
|
}
|
641
591
|
}
|
package/dist/utilities.js
CHANGED
@@ -40,9 +40,8 @@ class PromiseHelper {
|
|
40
40
|
// callback specified. We directly return the promise.
|
41
41
|
if (callback) {
|
42
42
|
const prom = fn();
|
43
|
-
prom
|
44
|
-
|
45
|
-
.catch((err) => callback(err, null));
|
43
|
+
prom.then((res) => callback(null, res));
|
44
|
+
prom.catch((err) => callback(err, null));
|
46
45
|
return prom;
|
47
46
|
}
|
48
47
|
return fn();
|
@@ -62,9 +61,8 @@ class PromiseHelper {
|
|
62
61
|
});
|
63
62
|
});
|
64
63
|
if (callback) {
|
65
|
-
prom
|
66
|
-
|
67
|
-
.catch((err) => callback(err, null));
|
64
|
+
prom.then((res) => callback(null, res));
|
65
|
+
prom.catch((err) => callback(err, null));
|
68
66
|
}
|
69
67
|
return prom;
|
70
68
|
}
|
@@ -9,10 +9,9 @@ function generateClientString() {
|
|
9
9
|
// off as some Node.js versions insert strange characters into
|
10
10
|
// the version identifiers (mainly newlines and such).
|
11
11
|
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
|
12
|
-
const couchnodeVer = require('../package.json').version.trim();
|
13
12
|
const nodeVer = process.versions.node.trim();
|
14
13
|
const v8Ver = process.versions.v8.trim();
|
15
14
|
const sslVer = process.versions.openssl.trim();
|
16
|
-
return `
|
15
|
+
return `node/${nodeVer}; v8/${v8Ver}; ssl/${sslVer}`;
|
17
16
|
}
|
18
17
|
exports.generateClientString = generateClientString;
|
package/package.json
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
"type": "git",
|
55
55
|
"url": "http://github.com/couchbase/couchnode.git"
|
56
56
|
},
|
57
|
-
"version": "4.4.
|
57
|
+
"version": "4.4.4",
|
58
58
|
"config": {
|
59
59
|
"native": false
|
60
60
|
},
|
@@ -79,13 +79,13 @@
|
|
79
79
|
]
|
80
80
|
},
|
81
81
|
"optionalDependencies": {
|
82
|
-
"@couchbase/couchbase-darwin-arm64-napi": "4.4.
|
83
|
-
"@couchbase/couchbase-darwin-x64-napi": "4.4.
|
84
|
-
"@couchbase/couchbase-linux-arm64-napi": "4.4.
|
85
|
-
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.
|
86
|
-
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.
|
87
|
-
"@couchbase/couchbase-linux-x64-napi": "4.4.
|
88
|
-
"@couchbase/couchbase-win32-x64-napi": "4.4.
|
82
|
+
"@couchbase/couchbase-darwin-arm64-napi": "4.4.4",
|
83
|
+
"@couchbase/couchbase-darwin-x64-napi": "4.4.4",
|
84
|
+
"@couchbase/couchbase-linux-arm64-napi": "4.4.4",
|
85
|
+
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.4",
|
86
|
+
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.4",
|
87
|
+
"@couchbase/couchbase-linux-x64-napi": "4.4.4",
|
88
|
+
"@couchbase/couchbase-win32-x64-napi": "4.4.4"
|
89
89
|
},
|
90
90
|
"files": [
|
91
91
|
"LICENSE",
|
@@ -93,6 +93,7 @@
|
|
93
93
|
"CONTRIBUTING.md",
|
94
94
|
"package.json",
|
95
95
|
"README.md",
|
96
|
+
"BUILDING.md",
|
96
97
|
"couchbase-sdk-nodejs-black-duck-manifest.yaml",
|
97
98
|
"scripts/*.js",
|
98
99
|
"src/*.{c,h}pp",
|