1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports["default"] = void 0;
|
9 |
|
10 | var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
11 |
|
12 | var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
13 |
|
14 | var _rxjs = require("rxjs");
|
15 |
|
16 | var _resultRx = _interopRequireDefault(require("./result-rx"));
|
17 |
|
18 | var _neo4jDriverCore = _interopRequireDefault(require("neo4j-driver-core"));
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | var RxTransaction = function () {
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 | function RxTransaction(txc) {
|
49 | (0, _classCallCheck2["default"])(this, RxTransaction);
|
50 | this._txc = txc;
|
51 | }
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | (0, _createClass2["default"])(RxTransaction, [{
|
63 | key: "run",
|
64 | value: function run(query, parameters) {
|
65 | var _this = this;
|
66 |
|
67 | return new _resultRx["default"](new _rxjs.Observable(function (observer) {
|
68 | try {
|
69 | observer.next(_this._txc.run(query, parameters));
|
70 | observer.complete();
|
71 | } catch (err) {
|
72 | observer.error(err);
|
73 | }
|
74 |
|
75 | return function () {};
|
76 | }));
|
77 | }
|
78 | |
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | }, {
|
86 | key: "commit",
|
87 | value: function commit() {
|
88 | var _this2 = this;
|
89 |
|
90 | return new _rxjs.Observable(function (observer) {
|
91 | _this2._txc.commit().then(function () {
|
92 | observer.complete();
|
93 | })["catch"](function (err) {
|
94 | return observer.error(err);
|
95 | });
|
96 | });
|
97 | }
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | }, {
|
106 | key: "rollback",
|
107 | value: function rollback() {
|
108 | var _this3 = this;
|
109 |
|
110 | return new _rxjs.Observable(function (observer) {
|
111 | _this3._txc.rollback().then(function () {
|
112 | observer.complete();
|
113 | })["catch"](function (err) {
|
114 | return observer.error(err);
|
115 | });
|
116 | });
|
117 | }
|
118 | }]);
|
119 | return RxTransaction;
|
120 | }();
|
121 |
|
122 | exports["default"] = RxTransaction; |
\ | No newline at end of file |