couchbase 4.4.6-dev.1 → 4.4.6
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 -1
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/dist/binding.d.ts +3 -0
- package/dist/bindingutilities.d.ts +1 -1
- package/dist/bindingutilities.js +15 -12
- package/dist/transactions.js +3 -0
- package/package.json +8 -8
- package/src/jstocbpp_transactions.hpp +7 -5
@@ -21,7 +21,7 @@ endif()
|
|
21
21
|
|
22
22
|
project(
|
23
23
|
couchbase_cxx_client
|
24
|
-
VERSION "1.0.
|
24
|
+
VERSION "1.0.7"
|
25
25
|
LANGUAGES CXX C)
|
26
26
|
message(STATUS "Couchbase C++ client ${couchbase_cxx_client_VERSION} build ${couchbase_cxx_client_BUILD_NUMBER}, master: ${COUCHBASE_CXX_CLIENT_MASTER_PROJECT}")
|
27
27
|
message(STATUS "System: ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_VERSION}, ${CMAKE_SYSTEM_PROCESSOR}")
|
package/dist/binding.d.ts
CHANGED
@@ -2710,17 +2710,20 @@ export interface CppTxnOperationFailed extends CppErrorBase {
|
|
2710
2710
|
should_not_retry: boolean;
|
2711
2711
|
should_not_rollback: boolean;
|
2712
2712
|
cause: CppTxnExternalException;
|
2713
|
+
message?: string;
|
2713
2714
|
}
|
2714
2715
|
export interface CppTxnOpException extends CppErrorBase {
|
2715
2716
|
ctxtype: 'transaction_op_exception';
|
2716
2717
|
ctx: CppTransactionOpErrorContext | undefined;
|
2717
2718
|
cause: CppTxnExternalException;
|
2719
|
+
message?: string;
|
2718
2720
|
}
|
2719
2721
|
export interface CppTxnError extends CppErrorBase {
|
2720
2722
|
ctxtype: 'transaction_exception';
|
2721
2723
|
result: CppTransactionResult;
|
2722
2724
|
cause: CppTxnExternalException;
|
2723
2725
|
type: CppTxnFailureType;
|
2726
|
+
message?: string;
|
2724
2727
|
}
|
2725
2728
|
export interface CppTransactionErrorContext {
|
2726
2729
|
code: CppErrc;
|
@@ -88,7 +88,7 @@ export declare function endpointStateFromCpp(service: CppDiagEndpointState): End
|
|
88
88
|
/**
|
89
89
|
* @internal
|
90
90
|
*/
|
91
|
-
export declare function txnExternalExceptionStringFromCpp(cause: CppTxnExternalException): string;
|
91
|
+
export declare function txnExternalExceptionStringFromCpp(cause: CppTxnExternalException, message?: string): string;
|
92
92
|
/**
|
93
93
|
* @internal
|
94
94
|
*/
|
package/dist/bindingutilities.js
CHANGED
@@ -431,8 +431,11 @@ exports.endpointStateFromCpp = endpointStateFromCpp;
|
|
431
431
|
/**
|
432
432
|
* @internal
|
433
433
|
*/
|
434
|
-
function txnExternalExceptionStringFromCpp(cause) {
|
434
|
+
function txnExternalExceptionStringFromCpp(cause, message) {
|
435
435
|
if (cause === binding_1.default.txn_external_exception.unknown) {
|
436
|
+
if (message) {
|
437
|
+
return message;
|
438
|
+
}
|
436
439
|
return 'unknown';
|
437
440
|
}
|
438
441
|
else if (cause ===
|
@@ -501,7 +504,7 @@ function txnExternalExceptionStringFromCpp(cause) {
|
|
501
504
|
else if (cause === binding_1.default.txn_external_exception.transaction_already_committed) {
|
502
505
|
return 'transaction_already_committed';
|
503
506
|
}
|
504
|
-
|
507
|
+
return 'unknown';
|
505
508
|
}
|
506
509
|
exports.txnExternalExceptionStringFromCpp = txnExternalExceptionStringFromCpp;
|
507
510
|
/**
|
@@ -513,16 +516,16 @@ function txnOpExeptionFromCpp(err, ctx) {
|
|
513
516
|
}
|
514
517
|
const context = ctx ? ctx : undefined;
|
515
518
|
if (err.cause === binding_1.default.txn_external_exception.document_exists_exception) {
|
516
|
-
return new errs.DocumentExistsError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
519
|
+
return new errs.DocumentExistsError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
517
520
|
}
|
518
521
|
else if (err.cause === binding_1.default.txn_external_exception.document_not_found_exception) {
|
519
|
-
return new errs.DocumentNotFoundError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
522
|
+
return new errs.DocumentNotFoundError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
520
523
|
}
|
521
524
|
else if (err.cause === binding_1.default.txn_external_exception.parsing_failure) {
|
522
|
-
return new errs.ParsingFailureError(new Error(txnExternalExceptionStringFromCpp(err.cause)), context);
|
525
|
+
return new errs.ParsingFailureError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)), context);
|
523
526
|
}
|
524
527
|
else if (err.cause === binding_1.default.txn_external_exception.couchbase_exception) {
|
525
|
-
const cause = txnExternalExceptionStringFromCpp(err.cause);
|
528
|
+
const cause = txnExternalExceptionStringFromCpp(err.cause, err.message);
|
526
529
|
return new errs.CouchbaseError(cause, new Error(cause), context);
|
527
530
|
}
|
528
531
|
return err;
|
@@ -622,12 +625,12 @@ function errorFromCpp(err) {
|
|
622
625
|
}
|
623
626
|
// BUG(JSCBC-1010): We shouldn't need to special case these.
|
624
627
|
if (err.ctxtype === 'transaction_operation_failed') {
|
625
|
-
const cause = txnExternalExceptionStringFromCpp(err.cause);
|
628
|
+
const cause = txnExternalExceptionStringFromCpp(err.cause, err.message);
|
626
629
|
if (cause == 'feature_not_available_exception') {
|
627
630
|
const msg = 'Possibly attempting a binary transaction operation with a server version < 7.6.2';
|
628
631
|
return new errs.TransactionOperationFailedError(new errs.FeatureNotAvailableError(new Error(msg)));
|
629
632
|
}
|
630
|
-
return new errs.TransactionOperationFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
633
|
+
return new errs.TransactionOperationFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
631
634
|
}
|
632
635
|
else if (err.ctxtype === 'transaction_op_exception') {
|
633
636
|
let txnContext = null;
|
@@ -638,15 +641,15 @@ function errorFromCpp(err) {
|
|
638
641
|
}
|
639
642
|
else if (err.ctxtype === 'transaction_exception') {
|
640
643
|
if (err.type === binding_1.default.txn_failure_type.fail) {
|
641
|
-
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
644
|
+
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
642
645
|
}
|
643
646
|
else if (err.type === binding_1.default.txn_failure_type.expiry) {
|
644
|
-
return new errs.TransactionExpiredError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
647
|
+
return new errs.TransactionExpiredError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
645
648
|
}
|
646
649
|
else if (err.type === binding_1.default.txn_failure_type.commit_ambiguous) {
|
647
|
-
return new errs.TransactionCommitAmbiguousError(new Error(txnExternalExceptionStringFromCpp(err.cause)));
|
650
|
+
return new errs.TransactionCommitAmbiguousError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
648
651
|
}
|
649
|
-
|
652
|
+
return new errs.TransactionFailedError(new Error(txnExternalExceptionStringFromCpp(err.cause, err.message)));
|
650
653
|
}
|
651
654
|
const baseErr = err;
|
652
655
|
const contextOrNull = contextFromCpp(err);
|
package/dist/transactions.js
CHANGED
@@ -387,6 +387,9 @@ class Transactions {
|
|
387
387
|
if (e instanceof errors_1.TransactionOperationFailedError) {
|
388
388
|
throw new errors_1.TransactionFailedError(e.cause, e.context);
|
389
389
|
}
|
390
|
+
else if (e instanceof errors_1.TransactionFailedError) {
|
391
|
+
throw e;
|
392
|
+
}
|
390
393
|
throw new errors_1.TransactionFailedError(e);
|
391
394
|
}
|
392
395
|
try {
|
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.6
|
57
|
+
"version": "4.4.6",
|
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.6
|
83
|
-
"@couchbase/couchbase-darwin-x64-napi": "4.4.6
|
84
|
-
"@couchbase/couchbase-linux-arm64-napi": "4.4.6
|
85
|
-
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.6
|
86
|
-
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.6
|
87
|
-
"@couchbase/couchbase-linux-x64-napi": "4.4.6
|
88
|
-
"@couchbase/couchbase-win32-x64-napi": "4.4.6
|
82
|
+
"@couchbase/couchbase-darwin-arm64-napi": "4.4.6",
|
83
|
+
"@couchbase/couchbase-darwin-x64-napi": "4.4.6",
|
84
|
+
"@couchbase/couchbase-linux-arm64-napi": "4.4.6",
|
85
|
+
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.4.6",
|
86
|
+
"@couchbase/couchbase-linuxmusl-x64-napi": "4.4.6",
|
87
|
+
"@couchbase/couchbase-linux-x64-napi": "4.4.6",
|
88
|
+
"@couchbase/couchbase-win32-x64-napi": "4.4.6"
|
89
89
|
},
|
90
90
|
"files": [
|
91
91
|
"LICENSE",
|
@@ -374,6 +374,7 @@ struct js_to_cbpp_t<cbcoretxns::transaction_operation_failed> {
|
|
374
374
|
jsErr.Set("should_not_rollback",
|
375
375
|
cbpp_to_js(env, !err.should_rollback()));
|
376
376
|
jsErr.Set("cause", cbpp_to_js(env, err.cause()));
|
377
|
+
jsErr.Set("message", cbpp_to_js(env, std::string(err.what())));
|
377
378
|
return jsErr.Value();
|
378
379
|
}
|
379
380
|
};
|
@@ -436,16 +437,17 @@ struct js_to_cbpp_t<cbcoretxns::op_exception> {
|
|
436
437
|
template <>
|
437
438
|
struct js_to_cbpp_t<couchbase::core::transaction_op_error_context> {
|
438
439
|
static inline Napi::Value
|
439
|
-
to_js(Napi::Env env,
|
440
|
+
to_js(Napi::Env env,
|
441
|
+
const couchbase::core::transaction_op_error_context &res)
|
440
442
|
{
|
441
443
|
auto resObj = Napi::Object::New(env);
|
442
444
|
resObj.Set("code", cbpp_to_js(env, res.ec()));
|
443
445
|
resObj.Set(
|
444
446
|
"cause",
|
445
|
-
cbpp_to_js<
|
446
|
-
|
447
|
-
|
448
|
-
|
447
|
+
cbpp_to_js<std::variant<std::monostate,
|
448
|
+
couchbase::core::key_value_error_context,
|
449
|
+
couchbase::core::query_error_context>>(
|
450
|
+
env, res.cause()));
|
449
451
|
return resObj;
|
450
452
|
}
|
451
453
|
};
|