neo4j-driver 5.3.0 → 5.4.0
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/.babelrc +1 -8
- package/README.md +21 -0
- package/lib/browser/neo4j-web.esm.js +31294 -0
- package/lib/browser/neo4j-web.esm.min.js +1 -0
- package/lib/browser/neo4j-web.js +31301 -32537
- package/lib/browser/neo4j-web.min.js +1 -1
- package/lib/docs.js +1 -3
- package/lib/driver.js +78 -89
- package/lib/index.js +319 -547
- package/lib/internal/retry-logic-rx.js +64 -112
- package/lib/internal/server-version.js +77 -116
- package/lib/result-rx.js +292 -433
- package/lib/session-rx.js +128 -207
- package/lib/transaction-managed-rx.js +30 -52
- package/lib/transaction-rx.js +72 -104
- package/lib/version.js +2 -8
- package/package.json +24 -30
- package/spec/support/jasmine.json +0 -1
- package/types/driver.d.ts +1 -1
- package/types/index.d.ts +59 -37
- package/types/result-rx.d.ts +1 -1
- package/types/session-rx.d.ts +1 -1
- package/types/transaction-managed-rx.d.ts +1 -1
- package/types/transaction-rx.d.ts +1 -1
- package/.nycrc +0 -4
- package/support/inject-browser-transform.js +0 -20
package/lib/result-rx.js
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
39
|
/**
|
|
25
40
|
* Copyright (c) "Neo4j"
|
|
26
41
|
* Neo4j Sweden AB [http://neo4j.com]
|
|
@@ -39,53 +54,47 @@ var _operators = require("rxjs/operators");
|
|
|
39
54
|
* See the License for the specific language governing permissions and
|
|
40
55
|
* limitations under the License.
|
|
41
56
|
*/
|
|
42
|
-
|
|
43
57
|
/* eslint-disable-next-line no-unused-vars */
|
|
58
|
+
var neo4j_driver_core_1 = require("neo4j-driver-core");
|
|
59
|
+
var rxjs_1 = require("rxjs");
|
|
60
|
+
var operators_1 = require("rxjs/operators");
|
|
44
61
|
var States = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
READY: 0,
|
|
63
|
+
STREAMING: 1,
|
|
64
|
+
COMPLETED: 2
|
|
48
65
|
};
|
|
49
66
|
/**
|
|
50
67
|
* The reactive result interface.
|
|
51
68
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this._records = undefined;
|
|
68
|
-
this._controls = new StreamControl();
|
|
69
|
-
this._summary = new _rxjs.ReplaySubject();
|
|
70
|
-
this._state = state || States.READY;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Returns an observable that exposes a single item containing field names
|
|
74
|
-
* returned by the executing query.
|
|
75
|
-
*
|
|
76
|
-
* Errors raised by actual query execution can surface on the returned
|
|
77
|
-
* observable stream.
|
|
78
|
-
*
|
|
79
|
-
* @public
|
|
80
|
-
* @returns {Observable<string[]>} - An observable stream (with exactly one element) of field names.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(0, _createClass2["default"])(RxResult, [{
|
|
85
|
-
key: "keys",
|
|
86
|
-
value: function keys() {
|
|
87
|
-
return this._keys;
|
|
69
|
+
var RxResult = /** @class */ (function () {
|
|
70
|
+
/**
|
|
71
|
+
* @constructor
|
|
72
|
+
* @protected
|
|
73
|
+
* @param {Observable<Result>} result - An observable of single Result instance to relay requests.
|
|
74
|
+
* @param {number} state - The streaming state
|
|
75
|
+
*/
|
|
76
|
+
function RxResult(result, state) {
|
|
77
|
+
var replayedResult = result.pipe((0, operators_1.publishReplay)(1), (0, operators_1.refCount)());
|
|
78
|
+
this._result = replayedResult;
|
|
79
|
+
this._keys = replayedResult.pipe((0, operators_1.mergeMap)(function (r) { return (0, rxjs_1.from)(r.keys()); }), (0, operators_1.publishReplay)(1), (0, operators_1.refCount)());
|
|
80
|
+
this._records = undefined;
|
|
81
|
+
this._controls = new StreamControl();
|
|
82
|
+
this._summary = new rxjs_1.ReplaySubject();
|
|
83
|
+
this._state = state || States.READY;
|
|
88
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns an observable that exposes a single item containing field names
|
|
87
|
+
* returned by the executing query.
|
|
88
|
+
*
|
|
89
|
+
* Errors raised by actual query execution can surface on the returned
|
|
90
|
+
* observable stream.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
* @returns {Observable<string[]>} - An observable stream (with exactly one element) of field names.
|
|
94
|
+
*/
|
|
95
|
+
RxResult.prototype.keys = function () {
|
|
96
|
+
return this._keys;
|
|
97
|
+
};
|
|
89
98
|
/**
|
|
90
99
|
* Returns an observable that exposes each record returned by the executing query.
|
|
91
100
|
*
|
|
@@ -94,27 +103,16 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
94
103
|
* @public
|
|
95
104
|
* @returns {Observable<Record>} - An observable stream of records.
|
|
96
105
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
recordsObserver: recordsObserver
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
result.push = function () {
|
|
113
|
-
return _this._push();
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
106
|
+
RxResult.prototype.records = function () {
|
|
107
|
+
var _this = this;
|
|
108
|
+
var result = this._result.pipe((0, operators_1.mergeMap)(function (result) {
|
|
109
|
+
return new rxjs_1.Observable(function (recordsObserver) {
|
|
110
|
+
return _this._startStreaming({ result: result, recordsObserver: recordsObserver });
|
|
111
|
+
});
|
|
112
|
+
}));
|
|
113
|
+
result.push = function () { return _this._push(); };
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
118
116
|
/**
|
|
119
117
|
* Returns an observable that exposes a single item of {@link ResultSummary} that is generated by
|
|
120
118
|
* the server after the streaming of the executing query is completed.
|
|
@@ -124,21 +122,14 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
124
122
|
* @public
|
|
125
123
|
* @returns {Observable<ResultSummary>} - An observable stream (with exactly one element) of result summary.
|
|
126
124
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return _this2._startStreaming({
|
|
136
|
-
result: result,
|
|
137
|
-
summaryObserver: summaryObserver
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
125
|
+
RxResult.prototype.consume = function () {
|
|
126
|
+
var _this = this;
|
|
127
|
+
return this._result.pipe((0, operators_1.mergeMap)(function (result) {
|
|
128
|
+
return new rxjs_1.Observable(function (summaryObserver) {
|
|
129
|
+
return _this._startStreaming({ result: result, summaryObserver: summaryObserver });
|
|
130
|
+
});
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
142
133
|
/**
|
|
143
134
|
* Pauses the automatic streaming of records.
|
|
144
135
|
*
|
|
@@ -146,12 +137,9 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
146
137
|
*
|
|
147
138
|
* @experimental
|
|
148
139
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
value: function pause() {
|
|
153
|
-
this._controls.pause();
|
|
154
|
-
}
|
|
140
|
+
RxResult.prototype.pause = function () {
|
|
141
|
+
this._controls.pause();
|
|
142
|
+
};
|
|
155
143
|
/**
|
|
156
144
|
* Resumes the automatic streaming of records.
|
|
157
145
|
*
|
|
@@ -161,12 +149,9 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
161
149
|
* @experimental
|
|
162
150
|
* @returns {Promise<void>} - A promise that resolves when the stream is resumed.
|
|
163
151
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
value: function resume() {
|
|
168
|
-
return this._controls.resume();
|
|
169
|
-
}
|
|
152
|
+
RxResult.prototype.resume = function () {
|
|
153
|
+
return this._controls.resume();
|
|
154
|
+
};
|
|
170
155
|
/**
|
|
171
156
|
* Pushes the next record to the stream.
|
|
172
157
|
*
|
|
@@ -177,56 +162,39 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
177
162
|
* @experimental
|
|
178
163
|
* @returns {Promise<void>} - A promise that resolves when the push is completed.
|
|
179
164
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
value: function _startStreaming() {
|
|
189
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
190
|
-
result = _ref.result,
|
|
191
|
-
_ref$recordsObserver = _ref.recordsObserver,
|
|
192
|
-
recordsObserver = _ref$recordsObserver === void 0 ? null : _ref$recordsObserver,
|
|
193
|
-
_ref$summaryObserver = _ref.summaryObserver,
|
|
194
|
-
summaryObserver = _ref$summaryObserver === void 0 ? null : _ref$summaryObserver;
|
|
195
|
-
|
|
196
|
-
var subscriptions = [];
|
|
197
|
-
|
|
198
|
-
if (summaryObserver) {
|
|
199
|
-
subscriptions.push(this._summary.subscribe(summaryObserver));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (this._state < States.STREAMING) {
|
|
203
|
-
this._state = States.STREAMING;
|
|
204
|
-
|
|
205
|
-
this._setupRecordsStream(result);
|
|
206
|
-
|
|
207
|
-
if (recordsObserver) {
|
|
208
|
-
subscriptions.push(this._records.subscribe(recordsObserver));
|
|
209
|
-
} else {
|
|
210
|
-
result._cancel();
|
|
165
|
+
RxResult.prototype.push = function () {
|
|
166
|
+
return this._controls.push();
|
|
167
|
+
};
|
|
168
|
+
RxResult.prototype._startStreaming = function (_a) {
|
|
169
|
+
var _b = _a === void 0 ? {} : _a, result = _b.result, _c = _b.recordsObserver, recordsObserver = _c === void 0 ? null : _c, _d = _b.summaryObserver, summaryObserver = _d === void 0 ? null : _d;
|
|
170
|
+
var subscriptions = [];
|
|
171
|
+
if (summaryObserver) {
|
|
172
|
+
subscriptions.push(this._summary.subscribe(summaryObserver));
|
|
211
173
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
|
|
174
|
+
if (this._state < States.STREAMING) {
|
|
175
|
+
this._state = States.STREAMING;
|
|
176
|
+
this._setupRecordsStream(result);
|
|
177
|
+
if (recordsObserver) {
|
|
178
|
+
subscriptions.push(this._records.subscribe(recordsObserver));
|
|
217
179
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
180
|
+
else {
|
|
181
|
+
result._cancel();
|
|
182
|
+
}
|
|
183
|
+
subscriptions.push({
|
|
184
|
+
unsubscribe: function () {
|
|
185
|
+
if (result._cancel) {
|
|
186
|
+
result._cancel();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else if (recordsObserver) {
|
|
192
|
+
recordsObserver.error((0, neo4j_driver_core_1.newError)('Streaming has already started/consumed with a previous records or summary subscription.'));
|
|
193
|
+
}
|
|
194
|
+
return function () {
|
|
195
|
+
subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
196
|
+
};
|
|
197
|
+
};
|
|
230
198
|
/**
|
|
231
199
|
* Create a {@link Observable} for the current {@link RxResult}
|
|
232
200
|
*
|
|
@@ -236,285 +204,176 @@ var RxResult = /*#__PURE__*/function () {
|
|
|
236
204
|
* @since 5.0
|
|
237
205
|
* @return {Observable<RxResult>}
|
|
238
206
|
*/
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
_this3._result.subscribe({
|
|
254
|
-
complete: function complete() {
|
|
255
|
-
return observer.complete();
|
|
256
|
-
},
|
|
257
|
-
next: function next(result) {
|
|
258
|
-
return observer.next(new RxResult(wrap(result)), _this3._state);
|
|
259
|
-
},
|
|
260
|
-
error: function error(e) {
|
|
261
|
-
return observer.error(e);
|
|
262
|
-
}
|
|
207
|
+
RxResult.prototype._toObservable = function () {
|
|
208
|
+
var _this = this;
|
|
209
|
+
function wrap(result) {
|
|
210
|
+
return new rxjs_1.Observable(function (observer) {
|
|
211
|
+
observer.next(result);
|
|
212
|
+
observer.complete();
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return new rxjs_1.Observable(function (observer) {
|
|
216
|
+
_this._result.subscribe({
|
|
217
|
+
complete: function () { return observer.complete(); },
|
|
218
|
+
next: function (result) { return observer.next(new RxResult(wrap(result)), _this._state); },
|
|
219
|
+
error: function (e) { return observer.error(e); }
|
|
220
|
+
});
|
|
263
221
|
});
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
222
|
+
};
|
|
223
|
+
RxResult.prototype._setupRecordsStream = function (result) {
|
|
224
|
+
var _this = this;
|
|
225
|
+
if (this._records) {
|
|
226
|
+
return this._records;
|
|
227
|
+
}
|
|
228
|
+
this._records = createFullyControlledSubject(result[Symbol.asyncIterator](), {
|
|
229
|
+
complete: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
230
|
+
var _a, _b;
|
|
231
|
+
return __generator(this, function (_c) {
|
|
232
|
+
switch (_c.label) {
|
|
233
|
+
case 0:
|
|
234
|
+
this._state = States.COMPLETED;
|
|
235
|
+
_b = (_a = this._summary).next;
|
|
236
|
+
return [4 /*yield*/, result.summary()];
|
|
237
|
+
case 1:
|
|
238
|
+
_b.apply(_a, [_c.sent()]);
|
|
239
|
+
this._summary.complete();
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}); },
|
|
244
|
+
error: function (error) {
|
|
245
|
+
_this._state = States.COMPLETED;
|
|
246
|
+
_this._summary.error(error);
|
|
247
|
+
}
|
|
248
|
+
}, this._controls);
|
|
272
249
|
return this._records;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
250
|
+
};
|
|
251
|
+
return RxResult;
|
|
252
|
+
}());
|
|
253
|
+
exports.default = RxResult;
|
|
254
|
+
function createFullyControlledSubject(iterator, completeObserver, streamControl) {
|
|
255
|
+
var _this = this;
|
|
256
|
+
if (streamControl === void 0) { streamControl = new StreamControl(); }
|
|
257
|
+
var subject = new rxjs_1.Subject();
|
|
258
|
+
var pushNextValue = function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
259
|
+
var _a, done, value, error_1;
|
|
260
|
+
return __generator(this, function (_b) {
|
|
261
|
+
switch (_b.label) {
|
|
262
|
+
case 0:
|
|
263
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
264
|
+
streamControl.pushing = true;
|
|
265
|
+
return [4 /*yield*/, result];
|
|
266
|
+
case 1:
|
|
267
|
+
_a = _b.sent(), done = _a.done, value = _a.value;
|
|
268
|
+
if (done) {
|
|
269
|
+
subject.complete();
|
|
270
|
+
completeObserver.complete();
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
subject.next(value);
|
|
274
|
+
if (!streamControl.paused) {
|
|
275
|
+
pushNextValue(iterator.next())
|
|
276
|
+
.catch(function () { });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return [3 /*break*/, 4];
|
|
280
|
+
case 2:
|
|
281
|
+
error_1 = _b.sent();
|
|
282
|
+
subject.error(error_1);
|
|
283
|
+
completeObserver.error(error_1);
|
|
284
|
+
return [3 /*break*/, 4];
|
|
285
|
+
case 3:
|
|
286
|
+
streamControl.pushing = false;
|
|
287
|
+
return [7 /*endfinally*/];
|
|
288
|
+
case 4: return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}); };
|
|
292
|
+
function push(value) {
|
|
293
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
294
|
+
return __generator(this, function (_a) {
|
|
295
|
+
switch (_a.label) {
|
|
296
|
+
case 0: return [4 /*yield*/, pushNextValue(iterator.next(value))];
|
|
297
|
+
case 1:
|
|
298
|
+
_a.sent();
|
|
299
|
+
return [2 /*return*/];
|
|
297
300
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}));
|
|
301
|
-
|
|
302
|
-
function complete() {
|
|
303
|
-
return _complete.apply(this, arguments);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return complete;
|
|
307
|
-
}(),
|
|
308
|
-
error: function error(_error) {
|
|
309
|
-
_this4._state = States.COMPLETED;
|
|
310
|
-
|
|
311
|
-
_this4._summary.error(_error);
|
|
312
|
-
}
|
|
313
|
-
}, this._controls);
|
|
314
|
-
return this._records;
|
|
301
|
+
});
|
|
302
|
+
});
|
|
315
303
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
exports["default"] = RxResult;
|
|
321
|
-
|
|
322
|
-
function createFullyControlledSubject(iterator, completeObserver) {
|
|
323
|
-
var streamControl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StreamControl();
|
|
324
|
-
var subject = new _rxjs.Subject();
|
|
325
|
-
|
|
326
|
-
var pushNextValue = /*#__PURE__*/function () {
|
|
327
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(result) {
|
|
328
|
-
var _yield$result, done, value;
|
|
329
|
-
|
|
330
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
331
|
-
while (1) {
|
|
332
|
-
switch (_context2.prev = _context2.next) {
|
|
333
|
-
case 0:
|
|
334
|
-
_context2.prev = 0;
|
|
335
|
-
streamControl.pushing = true;
|
|
336
|
-
_context2.next = 4;
|
|
337
|
-
return result;
|
|
338
|
-
|
|
339
|
-
case 4:
|
|
340
|
-
_yield$result = _context2.sent;
|
|
341
|
-
done = _yield$result.done;
|
|
342
|
-
value = _yield$result.value;
|
|
343
|
-
|
|
344
|
-
if (done) {
|
|
345
|
-
subject.complete();
|
|
346
|
-
completeObserver.complete();
|
|
347
|
-
} else {
|
|
348
|
-
subject.next(value);
|
|
349
|
-
|
|
350
|
-
if (!streamControl.paused) {
|
|
351
|
-
pushNextValue(iterator.next())["catch"](function () {});
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
_context2.next = 14;
|
|
356
|
-
break;
|
|
357
|
-
|
|
358
|
-
case 10:
|
|
359
|
-
_context2.prev = 10;
|
|
360
|
-
_context2.t0 = _context2["catch"](0);
|
|
361
|
-
subject.error(_context2.t0);
|
|
362
|
-
completeObserver.error(_context2.t0);
|
|
363
|
-
|
|
364
|
-
case 14:
|
|
365
|
-
_context2.prev = 14;
|
|
366
|
-
streamControl.pushing = false;
|
|
367
|
-
return _context2.finish(14);
|
|
368
|
-
|
|
369
|
-
case 17:
|
|
370
|
-
case "end":
|
|
371
|
-
return _context2.stop();
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}, _callee2, null, [[0, 10, 14, 17]]);
|
|
375
|
-
}));
|
|
376
|
-
|
|
377
|
-
return function pushNextValue(_x) {
|
|
378
|
-
return _ref2.apply(this, arguments);
|
|
379
|
-
};
|
|
380
|
-
}();
|
|
381
|
-
|
|
382
|
-
function push(_x2) {
|
|
383
|
-
return _push.apply(this, arguments);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function _push() {
|
|
387
|
-
_push = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(value) {
|
|
388
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
389
|
-
while (1) {
|
|
390
|
-
switch (_context3.prev = _context3.next) {
|
|
391
|
-
case 0:
|
|
392
|
-
_context3.next = 2;
|
|
393
|
-
return pushNextValue(iterator.next(value));
|
|
394
|
-
|
|
395
|
-
case 2:
|
|
396
|
-
case "end":
|
|
397
|
-
return _context3.stop();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}, _callee3);
|
|
401
|
-
}));
|
|
402
|
-
return _push.apply(this, arguments);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
streamControl.pusher = push;
|
|
406
|
-
push();
|
|
407
|
-
return subject;
|
|
304
|
+
streamControl.pusher = push;
|
|
305
|
+
push();
|
|
306
|
+
return subject;
|
|
408
307
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
return _context4.stop();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}, _callee4);
|
|
422
|
-
}));
|
|
423
|
-
(0, _classCallCheck2["default"])(this, StreamControl);
|
|
424
|
-
this._paused = false;
|
|
425
|
-
this._pushing = false;
|
|
426
|
-
this._push = push;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
(0, _createClass2["default"])(StreamControl, [{
|
|
430
|
-
key: "pause",
|
|
431
|
-
value: function pause() {
|
|
432
|
-
this._paused = true;
|
|
433
|
-
}
|
|
434
|
-
}, {
|
|
435
|
-
key: "paused",
|
|
436
|
-
get: function get() {
|
|
437
|
-
return this._paused;
|
|
308
|
+
var StreamControl = /** @class */ (function () {
|
|
309
|
+
function StreamControl(push) {
|
|
310
|
+
if (push === void 0) { push = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
311
|
+
return [2 /*return*/];
|
|
312
|
+
}); }); }; }
|
|
313
|
+
var _this = this;
|
|
314
|
+
this._paused = false;
|
|
315
|
+
this._pushing = false;
|
|
316
|
+
this._push = push;
|
|
438
317
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
318
|
+
StreamControl.prototype.pause = function () {
|
|
319
|
+
this._paused = true;
|
|
320
|
+
};
|
|
321
|
+
Object.defineProperty(StreamControl.prototype, "paused", {
|
|
322
|
+
get: function () {
|
|
323
|
+
return this._paused;
|
|
324
|
+
},
|
|
325
|
+
enumerable: false,
|
|
326
|
+
configurable: true
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(StreamControl.prototype, "pushing", {
|
|
329
|
+
get: function () {
|
|
330
|
+
return this._pushing;
|
|
331
|
+
},
|
|
332
|
+
set: function (pushing) {
|
|
333
|
+
this._pushing = pushing;
|
|
334
|
+
},
|
|
335
|
+
enumerable: false,
|
|
336
|
+
configurable: true
|
|
337
|
+
});
|
|
338
|
+
StreamControl.prototype.resume = function () {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
340
|
+
var wasPaused;
|
|
341
|
+
return __generator(this, function (_a) {
|
|
342
|
+
switch (_a.label) {
|
|
343
|
+
case 0:
|
|
344
|
+
wasPaused = this._paused;
|
|
345
|
+
this._paused = false;
|
|
346
|
+
if (!(wasPaused && !this._pushing)) return [3 /*break*/, 2];
|
|
347
|
+
return [4 /*yield*/, this._push()];
|
|
348
|
+
case 1:
|
|
349
|
+
_a.sent();
|
|
350
|
+
_a.label = 2;
|
|
351
|
+
case 2: return [2 /*return*/];
|
|
462
352
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
_context6.next = 3;
|
|
491
|
-
return this._push();
|
|
492
|
-
|
|
493
|
-
case 3:
|
|
494
|
-
return _context6.abrupt("return", _context6.sent);
|
|
495
|
-
|
|
496
|
-
case 4:
|
|
497
|
-
case "end":
|
|
498
|
-
return _context6.stop();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}, _callee6, this);
|
|
502
|
-
}));
|
|
503
|
-
|
|
504
|
-
function push() {
|
|
505
|
-
return _push2.apply(this, arguments);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
return push;
|
|
509
|
-
}()
|
|
510
|
-
}, {
|
|
511
|
-
key: "pusher",
|
|
512
|
-
get: function get() {
|
|
513
|
-
return this._push;
|
|
514
|
-
},
|
|
515
|
-
set: function set(push) {
|
|
516
|
-
this._push = push;
|
|
517
|
-
}
|
|
518
|
-
}]);
|
|
519
|
-
return StreamControl;
|
|
520
|
-
}();
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
StreamControl.prototype.push = function () {
|
|
357
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
358
|
+
return __generator(this, function (_a) {
|
|
359
|
+
switch (_a.label) {
|
|
360
|
+
case 0:
|
|
361
|
+
this.pause();
|
|
362
|
+
return [4 /*yield*/, this._push()];
|
|
363
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
Object.defineProperty(StreamControl.prototype, "pusher", {
|
|
369
|
+
get: function () {
|
|
370
|
+
return this._push;
|
|
371
|
+
},
|
|
372
|
+
set: function (push) {
|
|
373
|
+
this._push = push;
|
|
374
|
+
},
|
|
375
|
+
enumerable: false,
|
|
376
|
+
configurable: true
|
|
377
|
+
});
|
|
378
|
+
return StreamControl;
|
|
379
|
+
}());
|