dexie-cloud-addon 4.0.1-beta.38 → 4.0.1-beta.39
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/dist/modern/dexie-cloud-addon.js +3 -3
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/service-worker.js +14 -1634
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/types/DexieCloudAPI.d.ts +11 -11
- package/dist/umd/dexie-cloud-addon.js +2743 -3822
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +2 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +47 -1668
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +14 -26
- package/dist/module-es5/dexie-cloud-addon.js +0 -7420
- package/dist/module-es5/dexie-cloud-addon.js.map +0 -1
- package/dist/module-es5/dexie-cloud-addon.min.js +0 -2
- package/dist/module-es5/dexie-cloud-addon.min.js.map +0 -1
- package/dist/types/DexieCloudEntity.d.ts +0 -8
- package/dist/types/DexieCloudServerState.d.ts +0 -5
- package/dist/types/WebSocketStatus.d.ts +0 -1
- package/dist/types/createMyMembersObservable.d.ts +0 -14
- package/dist/types/currentUserObservable.d.ts +0 -3
- package/dist/types/helpers/BroadcastedLocalEvent.d.ts +0 -8
- package/dist/types/helpers/visibleState.d.ts +0 -1
- package/dist/types/permissionsLookup.d.ts +0 -9
- package/dist/types/permissionsLookupObservable.d.ts +0 -14
- package/dist/types/sync/globalizePrivateIds.d.ts +0 -4
- package/dist/types/sync/syncServerToClientOnly.d.ts +0 -3
- package/dist/types/types/CloudConnectionStatus.d.ts +0 -0
- package/dist/types/types/ConnectionStatus.d.ts +0 -0
- package/dist/types/types/LoginState.d.ts +0 -41
- package/dist/types/types/SyncConnectionStatus.d.ts +0 -1
- package/dist/types/types/SyncFlowStatus.d.ts +0 -6
- package/dist/types/types/SyncStatus.d.ts +0 -6
- package/dist/umd-modern/dexie-cloud-addon.js +0 -6355
- package/dist/umd-modern/dexie-cloud-addon.js.map +0 -1
- package/dist/umd-modern/dexie-cloud-addon.min.js +0 -2
- package/dist/umd-modern/dexie-cloud-addon.min.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('dexie'), require('rxjs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['dexie', 'rxjs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Dexie, global.rxjs));
|
|
5
|
-
})(this, (function (Dexie, rxjs) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('dexie'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['dexie', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Dexie, global.rxjs, global.rxjs.operators));
|
|
5
|
+
})(this, (function (Dexie, rxjs, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -22,22 +22,6 @@
|
|
|
22
22
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
23
|
PERFORMANCE OF THIS SOFTWARE.
|
|
24
24
|
***************************************************************************** */
|
|
25
|
-
/* global Reflect, Promise */
|
|
26
|
-
|
|
27
|
-
var extendStatics = function(d, b) {
|
|
28
|
-
extendStatics = Object.setPrototypeOf ||
|
|
29
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
30
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
31
|
-
return extendStatics(d, b);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function __extends(d, b) {
|
|
35
|
-
if (typeof b !== "function" && b !== null)
|
|
36
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
37
|
-
extendStatics(d, b);
|
|
38
|
-
function __() { this.constructor = d; }
|
|
39
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
40
|
-
}
|
|
41
25
|
|
|
42
26
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
43
27
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -47,97 +31,6 @@
|
|
|
47
31
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
48
32
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49
33
|
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function __generator(thisArg, body) {
|
|
53
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
54
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
55
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
56
|
-
function step(op) {
|
|
57
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (_) try {
|
|
59
|
-
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;
|
|
60
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
-
switch (op[0]) {
|
|
62
|
-
case 0: case 1: t = op; break;
|
|
63
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
64
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
65
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
66
|
-
default:
|
|
67
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
68
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
69
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
70
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
71
|
-
if (t[2]) _.ops.pop();
|
|
72
|
-
_.trys.pop(); continue;
|
|
73
|
-
}
|
|
74
|
-
op = body.call(thisArg, _);
|
|
75
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
76
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function __values(o) {
|
|
81
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
82
|
-
if (m) return m.call(o);
|
|
83
|
-
if (o && typeof o.length === "number") return {
|
|
84
|
-
next: function () {
|
|
85
|
-
if (o && i >= o.length) o = void 0;
|
|
86
|
-
return { value: o && o[i++], done: !o };
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function __read(o, n) {
|
|
93
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
94
|
-
if (!m) return o;
|
|
95
|
-
var i = m.call(o), r, ar = [], e;
|
|
96
|
-
try {
|
|
97
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
98
|
-
}
|
|
99
|
-
catch (error) { e = { error: error }; }
|
|
100
|
-
finally {
|
|
101
|
-
try {
|
|
102
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
103
|
-
}
|
|
104
|
-
finally { if (e) throw e.error; }
|
|
105
|
-
}
|
|
106
|
-
return ar;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function __spreadArray(to, from, pack) {
|
|
110
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
111
|
-
if (ar || !(i in from)) {
|
|
112
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
113
|
-
ar[i] = from[i];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function __await(v) {
|
|
120
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
124
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
125
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
126
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
127
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
128
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
129
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
130
|
-
function fulfill(value) { resume("next", value); }
|
|
131
|
-
function reject(value) { resume("throw", value); }
|
|
132
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function __asyncValues(o) {
|
|
136
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
137
|
-
var m = o[Symbol.asyncIterator], i;
|
|
138
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
139
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
140
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
141
34
|
}
|
|
142
35
|
|
|
143
36
|
const UNAUTHORIZED_USER = {
|
|
@@ -291,1520 +184,6 @@
|
|
|
291
184
|
}
|
|
292
185
|
}
|
|
293
186
|
|
|
294
|
-
function isFunction(value) {
|
|
295
|
-
return typeof value === 'function';
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function hasLift(source) {
|
|
299
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
300
|
-
}
|
|
301
|
-
function operate(init) {
|
|
302
|
-
return function (source) {
|
|
303
|
-
if (hasLift(source)) {
|
|
304
|
-
return source.lift(function (liftedSource) {
|
|
305
|
-
try {
|
|
306
|
-
return init(liftedSource, this);
|
|
307
|
-
}
|
|
308
|
-
catch (err) {
|
|
309
|
-
this.error(err);
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
throw new TypeError('Unable to lift unknown Observable type');
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
318
|
-
|
|
319
|
-
function isPromise(value) {
|
|
320
|
-
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function createErrorClass(createImpl) {
|
|
324
|
-
var _super = function (instance) {
|
|
325
|
-
Error.call(instance);
|
|
326
|
-
instance.stack = new Error().stack;
|
|
327
|
-
};
|
|
328
|
-
var ctorFunc = createImpl(_super);
|
|
329
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
330
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
331
|
-
return ctorFunc;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
335
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
336
|
-
_super(this);
|
|
337
|
-
this.message = errors
|
|
338
|
-
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
339
|
-
: '';
|
|
340
|
-
this.name = 'UnsubscriptionError';
|
|
341
|
-
this.errors = errors;
|
|
342
|
-
};
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
function arrRemove(arr, item) {
|
|
346
|
-
if (arr) {
|
|
347
|
-
var index = arr.indexOf(item);
|
|
348
|
-
0 <= index && arr.splice(index, 1);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
var Subscription = (function () {
|
|
353
|
-
function Subscription(initialTeardown) {
|
|
354
|
-
this.initialTeardown = initialTeardown;
|
|
355
|
-
this.closed = false;
|
|
356
|
-
this._parentage = null;
|
|
357
|
-
this._finalizers = null;
|
|
358
|
-
}
|
|
359
|
-
Subscription.prototype.unsubscribe = function () {
|
|
360
|
-
var e_1, _a, e_2, _b;
|
|
361
|
-
var errors;
|
|
362
|
-
if (!this.closed) {
|
|
363
|
-
this.closed = true;
|
|
364
|
-
var _parentage = this._parentage;
|
|
365
|
-
if (_parentage) {
|
|
366
|
-
this._parentage = null;
|
|
367
|
-
if (Array.isArray(_parentage)) {
|
|
368
|
-
try {
|
|
369
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
370
|
-
var parent_1 = _parentage_1_1.value;
|
|
371
|
-
parent_1.remove(this);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
375
|
-
finally {
|
|
376
|
-
try {
|
|
377
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
378
|
-
}
|
|
379
|
-
finally { if (e_1) throw e_1.error; }
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
_parentage.remove(this);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
var initialFinalizer = this.initialTeardown;
|
|
387
|
-
if (isFunction(initialFinalizer)) {
|
|
388
|
-
try {
|
|
389
|
-
initialFinalizer();
|
|
390
|
-
}
|
|
391
|
-
catch (e) {
|
|
392
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
var _finalizers = this._finalizers;
|
|
396
|
-
if (_finalizers) {
|
|
397
|
-
this._finalizers = null;
|
|
398
|
-
try {
|
|
399
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
400
|
-
var finalizer = _finalizers_1_1.value;
|
|
401
|
-
try {
|
|
402
|
-
execFinalizer(finalizer);
|
|
403
|
-
}
|
|
404
|
-
catch (err) {
|
|
405
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
406
|
-
if (err instanceof UnsubscriptionError) {
|
|
407
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
errors.push(err);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
416
|
-
finally {
|
|
417
|
-
try {
|
|
418
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
419
|
-
}
|
|
420
|
-
finally { if (e_2) throw e_2.error; }
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
if (errors) {
|
|
424
|
-
throw new UnsubscriptionError(errors);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
Subscription.prototype.add = function (teardown) {
|
|
429
|
-
var _a;
|
|
430
|
-
if (teardown && teardown !== this) {
|
|
431
|
-
if (this.closed) {
|
|
432
|
-
execFinalizer(teardown);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
if (teardown instanceof Subscription) {
|
|
436
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
teardown._addParent(this);
|
|
440
|
-
}
|
|
441
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
Subscription.prototype._hasParent = function (parent) {
|
|
446
|
-
var _parentage = this._parentage;
|
|
447
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
448
|
-
};
|
|
449
|
-
Subscription.prototype._addParent = function (parent) {
|
|
450
|
-
var _parentage = this._parentage;
|
|
451
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
452
|
-
};
|
|
453
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
454
|
-
var _parentage = this._parentage;
|
|
455
|
-
if (_parentage === parent) {
|
|
456
|
-
this._parentage = null;
|
|
457
|
-
}
|
|
458
|
-
else if (Array.isArray(_parentage)) {
|
|
459
|
-
arrRemove(_parentage, parent);
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
Subscription.prototype.remove = function (teardown) {
|
|
463
|
-
var _finalizers = this._finalizers;
|
|
464
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
465
|
-
if (teardown instanceof Subscription) {
|
|
466
|
-
teardown._removeParent(this);
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
Subscription.EMPTY = (function () {
|
|
470
|
-
var empty = new Subscription();
|
|
471
|
-
empty.closed = true;
|
|
472
|
-
return empty;
|
|
473
|
-
})();
|
|
474
|
-
return Subscription;
|
|
475
|
-
}());
|
|
476
|
-
Subscription.EMPTY;
|
|
477
|
-
function isSubscription(value) {
|
|
478
|
-
return (value instanceof Subscription ||
|
|
479
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
480
|
-
}
|
|
481
|
-
function execFinalizer(finalizer) {
|
|
482
|
-
if (isFunction(finalizer)) {
|
|
483
|
-
finalizer();
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
finalizer.unsubscribe();
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
var config = {
|
|
491
|
-
onUnhandledError: null,
|
|
492
|
-
onStoppedNotification: null,
|
|
493
|
-
Promise: undefined,
|
|
494
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
495
|
-
useDeprecatedNextContext: false,
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
var timeoutProvider = {
|
|
499
|
-
setTimeout: function (handler, timeout) {
|
|
500
|
-
var args = [];
|
|
501
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
502
|
-
args[_i - 2] = arguments[_i];
|
|
503
|
-
}
|
|
504
|
-
var delegate = timeoutProvider.delegate;
|
|
505
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
506
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
507
|
-
}
|
|
508
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
509
|
-
},
|
|
510
|
-
clearTimeout: function (handle) {
|
|
511
|
-
var delegate = timeoutProvider.delegate;
|
|
512
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
513
|
-
},
|
|
514
|
-
delegate: undefined,
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
function reportUnhandledError(err) {
|
|
518
|
-
timeoutProvider.setTimeout(function () {
|
|
519
|
-
var onUnhandledError = config.onUnhandledError;
|
|
520
|
-
if (onUnhandledError) {
|
|
521
|
-
onUnhandledError(err);
|
|
522
|
-
}
|
|
523
|
-
else {
|
|
524
|
-
throw err;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
function noop() { }
|
|
530
|
-
|
|
531
|
-
var COMPLETE_NOTIFICATION = (function () { return createNotification('C', undefined, undefined); })();
|
|
532
|
-
function errorNotification(error) {
|
|
533
|
-
return createNotification('E', undefined, error);
|
|
534
|
-
}
|
|
535
|
-
function nextNotification(value) {
|
|
536
|
-
return createNotification('N', value, undefined);
|
|
537
|
-
}
|
|
538
|
-
function createNotification(kind, value, error) {
|
|
539
|
-
return {
|
|
540
|
-
kind: kind,
|
|
541
|
-
value: value,
|
|
542
|
-
error: error,
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
var context = null;
|
|
547
|
-
function errorContext(cb) {
|
|
548
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
549
|
-
var isRoot = !context;
|
|
550
|
-
if (isRoot) {
|
|
551
|
-
context = { errorThrown: false, error: null };
|
|
552
|
-
}
|
|
553
|
-
cb();
|
|
554
|
-
if (isRoot) {
|
|
555
|
-
var _a = context, errorThrown = _a.errorThrown, error = _a.error;
|
|
556
|
-
context = null;
|
|
557
|
-
if (errorThrown) {
|
|
558
|
-
throw error;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
cb();
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
var Subscriber = (function (_super) {
|
|
568
|
-
__extends(Subscriber, _super);
|
|
569
|
-
function Subscriber(destination) {
|
|
570
|
-
var _this = _super.call(this) || this;
|
|
571
|
-
_this.isStopped = false;
|
|
572
|
-
if (destination) {
|
|
573
|
-
_this.destination = destination;
|
|
574
|
-
if (isSubscription(destination)) {
|
|
575
|
-
destination.add(_this);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
_this.destination = EMPTY_OBSERVER;
|
|
580
|
-
}
|
|
581
|
-
return _this;
|
|
582
|
-
}
|
|
583
|
-
Subscriber.create = function (next, error, complete) {
|
|
584
|
-
return new SafeSubscriber(next, error, complete);
|
|
585
|
-
};
|
|
586
|
-
Subscriber.prototype.next = function (value) {
|
|
587
|
-
if (this.isStopped) {
|
|
588
|
-
handleStoppedNotification(nextNotification(value), this);
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
this._next(value);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
Subscriber.prototype.error = function (err) {
|
|
595
|
-
if (this.isStopped) {
|
|
596
|
-
handleStoppedNotification(errorNotification(err), this);
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
this.isStopped = true;
|
|
600
|
-
this._error(err);
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
Subscriber.prototype.complete = function () {
|
|
604
|
-
if (this.isStopped) {
|
|
605
|
-
handleStoppedNotification(COMPLETE_NOTIFICATION, this);
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
this.isStopped = true;
|
|
609
|
-
this._complete();
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
Subscriber.prototype.unsubscribe = function () {
|
|
613
|
-
if (!this.closed) {
|
|
614
|
-
this.isStopped = true;
|
|
615
|
-
_super.prototype.unsubscribe.call(this);
|
|
616
|
-
this.destination = null;
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
Subscriber.prototype._next = function (value) {
|
|
620
|
-
this.destination.next(value);
|
|
621
|
-
};
|
|
622
|
-
Subscriber.prototype._error = function (err) {
|
|
623
|
-
try {
|
|
624
|
-
this.destination.error(err);
|
|
625
|
-
}
|
|
626
|
-
finally {
|
|
627
|
-
this.unsubscribe();
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
Subscriber.prototype._complete = function () {
|
|
631
|
-
try {
|
|
632
|
-
this.destination.complete();
|
|
633
|
-
}
|
|
634
|
-
finally {
|
|
635
|
-
this.unsubscribe();
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
return Subscriber;
|
|
639
|
-
}(Subscription));
|
|
640
|
-
var _bind = Function.prototype.bind;
|
|
641
|
-
function bind(fn, thisArg) {
|
|
642
|
-
return _bind.call(fn, thisArg);
|
|
643
|
-
}
|
|
644
|
-
var ConsumerObserver = (function () {
|
|
645
|
-
function ConsumerObserver(partialObserver) {
|
|
646
|
-
this.partialObserver = partialObserver;
|
|
647
|
-
}
|
|
648
|
-
ConsumerObserver.prototype.next = function (value) {
|
|
649
|
-
var partialObserver = this.partialObserver;
|
|
650
|
-
if (partialObserver.next) {
|
|
651
|
-
try {
|
|
652
|
-
partialObserver.next(value);
|
|
653
|
-
}
|
|
654
|
-
catch (error) {
|
|
655
|
-
handleUnhandledError(error);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
ConsumerObserver.prototype.error = function (err) {
|
|
660
|
-
var partialObserver = this.partialObserver;
|
|
661
|
-
if (partialObserver.error) {
|
|
662
|
-
try {
|
|
663
|
-
partialObserver.error(err);
|
|
664
|
-
}
|
|
665
|
-
catch (error) {
|
|
666
|
-
handleUnhandledError(error);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
handleUnhandledError(err);
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
ConsumerObserver.prototype.complete = function () {
|
|
674
|
-
var partialObserver = this.partialObserver;
|
|
675
|
-
if (partialObserver.complete) {
|
|
676
|
-
try {
|
|
677
|
-
partialObserver.complete();
|
|
678
|
-
}
|
|
679
|
-
catch (error) {
|
|
680
|
-
handleUnhandledError(error);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
};
|
|
684
|
-
return ConsumerObserver;
|
|
685
|
-
}());
|
|
686
|
-
var SafeSubscriber = (function (_super) {
|
|
687
|
-
__extends(SafeSubscriber, _super);
|
|
688
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
689
|
-
var _this = _super.call(this) || this;
|
|
690
|
-
var partialObserver;
|
|
691
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
692
|
-
partialObserver = {
|
|
693
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
694
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
695
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
var context_1;
|
|
700
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
701
|
-
context_1 = Object.create(observerOrNext);
|
|
702
|
-
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
703
|
-
partialObserver = {
|
|
704
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
705
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
706
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
else {
|
|
710
|
-
partialObserver = observerOrNext;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
714
|
-
return _this;
|
|
715
|
-
}
|
|
716
|
-
return SafeSubscriber;
|
|
717
|
-
}(Subscriber));
|
|
718
|
-
function handleUnhandledError(error) {
|
|
719
|
-
{
|
|
720
|
-
reportUnhandledError(error);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function defaultErrorHandler(err) {
|
|
724
|
-
throw err;
|
|
725
|
-
}
|
|
726
|
-
function handleStoppedNotification(notification, subscriber) {
|
|
727
|
-
var onStoppedNotification = config.onStoppedNotification;
|
|
728
|
-
onStoppedNotification && timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); });
|
|
729
|
-
}
|
|
730
|
-
var EMPTY_OBSERVER = {
|
|
731
|
-
closed: true,
|
|
732
|
-
next: noop,
|
|
733
|
-
error: defaultErrorHandler,
|
|
734
|
-
complete: noop,
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
738
|
-
|
|
739
|
-
function identity(x) {
|
|
740
|
-
return x;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
function pipeFromArray(fns) {
|
|
744
|
-
if (fns.length === 0) {
|
|
745
|
-
return identity;
|
|
746
|
-
}
|
|
747
|
-
if (fns.length === 1) {
|
|
748
|
-
return fns[0];
|
|
749
|
-
}
|
|
750
|
-
return function piped(input) {
|
|
751
|
-
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
var Observable = (function () {
|
|
756
|
-
function Observable(subscribe) {
|
|
757
|
-
if (subscribe) {
|
|
758
|
-
this._subscribe = subscribe;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
Observable.prototype.lift = function (operator) {
|
|
762
|
-
var observable = new Observable();
|
|
763
|
-
observable.source = this;
|
|
764
|
-
observable.operator = operator;
|
|
765
|
-
return observable;
|
|
766
|
-
};
|
|
767
|
-
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
768
|
-
var _this = this;
|
|
769
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
770
|
-
errorContext(function () {
|
|
771
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
772
|
-
subscriber.add(operator
|
|
773
|
-
?
|
|
774
|
-
operator.call(subscriber, source)
|
|
775
|
-
: source
|
|
776
|
-
?
|
|
777
|
-
_this._subscribe(subscriber)
|
|
778
|
-
:
|
|
779
|
-
_this._trySubscribe(subscriber));
|
|
780
|
-
});
|
|
781
|
-
return subscriber;
|
|
782
|
-
};
|
|
783
|
-
Observable.prototype._trySubscribe = function (sink) {
|
|
784
|
-
try {
|
|
785
|
-
return this._subscribe(sink);
|
|
786
|
-
}
|
|
787
|
-
catch (err) {
|
|
788
|
-
sink.error(err);
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
792
|
-
var _this = this;
|
|
793
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
794
|
-
return new promiseCtor(function (resolve, reject) {
|
|
795
|
-
var subscriber = new SafeSubscriber({
|
|
796
|
-
next: function (value) {
|
|
797
|
-
try {
|
|
798
|
-
next(value);
|
|
799
|
-
}
|
|
800
|
-
catch (err) {
|
|
801
|
-
reject(err);
|
|
802
|
-
subscriber.unsubscribe();
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
error: reject,
|
|
806
|
-
complete: resolve,
|
|
807
|
-
});
|
|
808
|
-
_this.subscribe(subscriber);
|
|
809
|
-
});
|
|
810
|
-
};
|
|
811
|
-
Observable.prototype._subscribe = function (subscriber) {
|
|
812
|
-
var _a;
|
|
813
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
814
|
-
};
|
|
815
|
-
Observable.prototype[observable] = function () {
|
|
816
|
-
return this;
|
|
817
|
-
};
|
|
818
|
-
Observable.prototype.pipe = function () {
|
|
819
|
-
var operations = [];
|
|
820
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
821
|
-
operations[_i] = arguments[_i];
|
|
822
|
-
}
|
|
823
|
-
return pipeFromArray(operations)(this);
|
|
824
|
-
};
|
|
825
|
-
Observable.prototype.toPromise = function (promiseCtor) {
|
|
826
|
-
var _this = this;
|
|
827
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
828
|
-
return new promiseCtor(function (resolve, reject) {
|
|
829
|
-
var value;
|
|
830
|
-
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
831
|
-
});
|
|
832
|
-
};
|
|
833
|
-
Observable.create = function (subscribe) {
|
|
834
|
-
return new Observable(subscribe);
|
|
835
|
-
};
|
|
836
|
-
return Observable;
|
|
837
|
-
}());
|
|
838
|
-
function getPromiseCtor(promiseCtor) {
|
|
839
|
-
var _a;
|
|
840
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
841
|
-
}
|
|
842
|
-
function isObserver(value) {
|
|
843
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
844
|
-
}
|
|
845
|
-
function isSubscriber(value) {
|
|
846
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
function isInteropObservable(input) {
|
|
850
|
-
return isFunction(input[observable]);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
function isAsyncIterable(obj) {
|
|
854
|
-
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
function createInvalidObservableTypeError(input) {
|
|
858
|
-
return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
function getSymbolIterator() {
|
|
862
|
-
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
|
863
|
-
return '@@iterator';
|
|
864
|
-
}
|
|
865
|
-
return Symbol.iterator;
|
|
866
|
-
}
|
|
867
|
-
var iterator = getSymbolIterator();
|
|
868
|
-
|
|
869
|
-
function isIterable(input) {
|
|
870
|
-
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
874
|
-
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
875
|
-
var reader, _a, value, done;
|
|
876
|
-
return __generator(this, function (_b) {
|
|
877
|
-
switch (_b.label) {
|
|
878
|
-
case 0:
|
|
879
|
-
reader = readableStream.getReader();
|
|
880
|
-
_b.label = 1;
|
|
881
|
-
case 1:
|
|
882
|
-
_b.trys.push([1, , 9, 10]);
|
|
883
|
-
_b.label = 2;
|
|
884
|
-
case 2:
|
|
885
|
-
return [4, __await(reader.read())];
|
|
886
|
-
case 3:
|
|
887
|
-
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
888
|
-
if (!done) return [3, 5];
|
|
889
|
-
return [4, __await(void 0)];
|
|
890
|
-
case 4: return [2, _b.sent()];
|
|
891
|
-
case 5: return [4, __await(value)];
|
|
892
|
-
case 6: return [4, _b.sent()];
|
|
893
|
-
case 7:
|
|
894
|
-
_b.sent();
|
|
895
|
-
return [3, 2];
|
|
896
|
-
case 8: return [3, 10];
|
|
897
|
-
case 9:
|
|
898
|
-
reader.releaseLock();
|
|
899
|
-
return [7];
|
|
900
|
-
case 10: return [2];
|
|
901
|
-
}
|
|
902
|
-
});
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
function isReadableStreamLike(obj) {
|
|
906
|
-
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
function innerFrom(input) {
|
|
910
|
-
if (input instanceof Observable) {
|
|
911
|
-
return input;
|
|
912
|
-
}
|
|
913
|
-
if (input != null) {
|
|
914
|
-
if (isInteropObservable(input)) {
|
|
915
|
-
return fromInteropObservable(input);
|
|
916
|
-
}
|
|
917
|
-
if (isArrayLike(input)) {
|
|
918
|
-
return fromArrayLike(input);
|
|
919
|
-
}
|
|
920
|
-
if (isPromise(input)) {
|
|
921
|
-
return fromPromise(input);
|
|
922
|
-
}
|
|
923
|
-
if (isAsyncIterable(input)) {
|
|
924
|
-
return fromAsyncIterable(input);
|
|
925
|
-
}
|
|
926
|
-
if (isIterable(input)) {
|
|
927
|
-
return fromIterable(input);
|
|
928
|
-
}
|
|
929
|
-
if (isReadableStreamLike(input)) {
|
|
930
|
-
return fromReadableStreamLike(input);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
throw createInvalidObservableTypeError(input);
|
|
934
|
-
}
|
|
935
|
-
function fromInteropObservable(obj) {
|
|
936
|
-
return new Observable(function (subscriber) {
|
|
937
|
-
var obs = obj[observable]();
|
|
938
|
-
if (isFunction(obs.subscribe)) {
|
|
939
|
-
return obs.subscribe(subscriber);
|
|
940
|
-
}
|
|
941
|
-
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
function fromArrayLike(array) {
|
|
945
|
-
return new Observable(function (subscriber) {
|
|
946
|
-
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
947
|
-
subscriber.next(array[i]);
|
|
948
|
-
}
|
|
949
|
-
subscriber.complete();
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
function fromPromise(promise) {
|
|
953
|
-
return new Observable(function (subscriber) {
|
|
954
|
-
promise
|
|
955
|
-
.then(function (value) {
|
|
956
|
-
if (!subscriber.closed) {
|
|
957
|
-
subscriber.next(value);
|
|
958
|
-
subscriber.complete();
|
|
959
|
-
}
|
|
960
|
-
}, function (err) { return subscriber.error(err); })
|
|
961
|
-
.then(null, reportUnhandledError);
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
function fromIterable(iterable) {
|
|
965
|
-
return new Observable(function (subscriber) {
|
|
966
|
-
var e_1, _a;
|
|
967
|
-
try {
|
|
968
|
-
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
969
|
-
var value = iterable_1_1.value;
|
|
970
|
-
subscriber.next(value);
|
|
971
|
-
if (subscriber.closed) {
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
977
|
-
finally {
|
|
978
|
-
try {
|
|
979
|
-
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
|
|
980
|
-
}
|
|
981
|
-
finally { if (e_1) throw e_1.error; }
|
|
982
|
-
}
|
|
983
|
-
subscriber.complete();
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
function fromAsyncIterable(asyncIterable) {
|
|
987
|
-
return new Observable(function (subscriber) {
|
|
988
|
-
process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
function fromReadableStreamLike(readableStream) {
|
|
992
|
-
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
993
|
-
}
|
|
994
|
-
function process(asyncIterable, subscriber) {
|
|
995
|
-
var asyncIterable_1, asyncIterable_1_1;
|
|
996
|
-
var e_2, _a;
|
|
997
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
998
|
-
var value, e_2_1;
|
|
999
|
-
return __generator(this, function (_b) {
|
|
1000
|
-
switch (_b.label) {
|
|
1001
|
-
case 0:
|
|
1002
|
-
_b.trys.push([0, 5, 6, 11]);
|
|
1003
|
-
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
1004
|
-
_b.label = 1;
|
|
1005
|
-
case 1: return [4, asyncIterable_1.next()];
|
|
1006
|
-
case 2:
|
|
1007
|
-
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
1008
|
-
value = asyncIterable_1_1.value;
|
|
1009
|
-
subscriber.next(value);
|
|
1010
|
-
if (subscriber.closed) {
|
|
1011
|
-
return [2];
|
|
1012
|
-
}
|
|
1013
|
-
_b.label = 3;
|
|
1014
|
-
case 3: return [3, 1];
|
|
1015
|
-
case 4: return [3, 11];
|
|
1016
|
-
case 5:
|
|
1017
|
-
e_2_1 = _b.sent();
|
|
1018
|
-
e_2 = { error: e_2_1 };
|
|
1019
|
-
return [3, 11];
|
|
1020
|
-
case 6:
|
|
1021
|
-
_b.trys.push([6, , 9, 10]);
|
|
1022
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
|
|
1023
|
-
return [4, _a.call(asyncIterable_1)];
|
|
1024
|
-
case 7:
|
|
1025
|
-
_b.sent();
|
|
1026
|
-
_b.label = 8;
|
|
1027
|
-
case 8: return [3, 10];
|
|
1028
|
-
case 9:
|
|
1029
|
-
if (e_2) throw e_2.error;
|
|
1030
|
-
return [7];
|
|
1031
|
-
case 10: return [7];
|
|
1032
|
-
case 11:
|
|
1033
|
-
subscriber.complete();
|
|
1034
|
-
return [2];
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
1041
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
1042
|
-
}
|
|
1043
|
-
var OperatorSubscriber = (function (_super) {
|
|
1044
|
-
__extends(OperatorSubscriber, _super);
|
|
1045
|
-
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
1046
|
-
var _this = _super.call(this, destination) || this;
|
|
1047
|
-
_this.onFinalize = onFinalize;
|
|
1048
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
1049
|
-
_this._next = onNext
|
|
1050
|
-
? function (value) {
|
|
1051
|
-
try {
|
|
1052
|
-
onNext(value);
|
|
1053
|
-
}
|
|
1054
|
-
catch (err) {
|
|
1055
|
-
destination.error(err);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
: _super.prototype._next;
|
|
1059
|
-
_this._error = onError
|
|
1060
|
-
? function (err) {
|
|
1061
|
-
try {
|
|
1062
|
-
onError(err);
|
|
1063
|
-
}
|
|
1064
|
-
catch (err) {
|
|
1065
|
-
destination.error(err);
|
|
1066
|
-
}
|
|
1067
|
-
finally {
|
|
1068
|
-
this.unsubscribe();
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
: _super.prototype._error;
|
|
1072
|
-
_this._complete = onComplete
|
|
1073
|
-
? function () {
|
|
1074
|
-
try {
|
|
1075
|
-
onComplete();
|
|
1076
|
-
}
|
|
1077
|
-
catch (err) {
|
|
1078
|
-
destination.error(err);
|
|
1079
|
-
}
|
|
1080
|
-
finally {
|
|
1081
|
-
this.unsubscribe();
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
: _super.prototype._complete;
|
|
1085
|
-
return _this;
|
|
1086
|
-
}
|
|
1087
|
-
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
1088
|
-
var _a;
|
|
1089
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
1090
|
-
var closed_1 = this.closed;
|
|
1091
|
-
_super.prototype.unsubscribe.call(this);
|
|
1092
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
return OperatorSubscriber;
|
|
1096
|
-
}(Subscriber));
|
|
1097
|
-
|
|
1098
|
-
var Action = (function (_super) {
|
|
1099
|
-
__extends(Action, _super);
|
|
1100
|
-
function Action(scheduler, work) {
|
|
1101
|
-
return _super.call(this) || this;
|
|
1102
|
-
}
|
|
1103
|
-
Action.prototype.schedule = function (state, delay) {
|
|
1104
|
-
return this;
|
|
1105
|
-
};
|
|
1106
|
-
return Action;
|
|
1107
|
-
}(Subscription));
|
|
1108
|
-
|
|
1109
|
-
var intervalProvider = {
|
|
1110
|
-
setInterval: function (handler, timeout) {
|
|
1111
|
-
var args = [];
|
|
1112
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1113
|
-
args[_i - 2] = arguments[_i];
|
|
1114
|
-
}
|
|
1115
|
-
var delegate = intervalProvider.delegate;
|
|
1116
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
1117
|
-
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
1118
|
-
}
|
|
1119
|
-
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
1120
|
-
},
|
|
1121
|
-
clearInterval: function (handle) {
|
|
1122
|
-
var delegate = intervalProvider.delegate;
|
|
1123
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
|
|
1124
|
-
},
|
|
1125
|
-
delegate: undefined,
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
var AsyncAction = (function (_super) {
|
|
1129
|
-
__extends(AsyncAction, _super);
|
|
1130
|
-
function AsyncAction(scheduler, work) {
|
|
1131
|
-
var _this = _super.call(this, scheduler, work) || this;
|
|
1132
|
-
_this.scheduler = scheduler;
|
|
1133
|
-
_this.work = work;
|
|
1134
|
-
_this.pending = false;
|
|
1135
|
-
return _this;
|
|
1136
|
-
}
|
|
1137
|
-
AsyncAction.prototype.schedule = function (state, delay) {
|
|
1138
|
-
if (delay === void 0) { delay = 0; }
|
|
1139
|
-
if (this.closed) {
|
|
1140
|
-
return this;
|
|
1141
|
-
}
|
|
1142
|
-
this.state = state;
|
|
1143
|
-
var id = this.id;
|
|
1144
|
-
var scheduler = this.scheduler;
|
|
1145
|
-
if (id != null) {
|
|
1146
|
-
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
1147
|
-
}
|
|
1148
|
-
this.pending = true;
|
|
1149
|
-
this.delay = delay;
|
|
1150
|
-
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
|
1151
|
-
return this;
|
|
1152
|
-
};
|
|
1153
|
-
AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
|
|
1154
|
-
if (delay === void 0) { delay = 0; }
|
|
1155
|
-
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
1156
|
-
};
|
|
1157
|
-
AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
|
|
1158
|
-
if (delay === void 0) { delay = 0; }
|
|
1159
|
-
if (delay != null && this.delay === delay && this.pending === false) {
|
|
1160
|
-
return id;
|
|
1161
|
-
}
|
|
1162
|
-
intervalProvider.clearInterval(id);
|
|
1163
|
-
return undefined;
|
|
1164
|
-
};
|
|
1165
|
-
AsyncAction.prototype.execute = function (state, delay) {
|
|
1166
|
-
if (this.closed) {
|
|
1167
|
-
return new Error('executing a cancelled action');
|
|
1168
|
-
}
|
|
1169
|
-
this.pending = false;
|
|
1170
|
-
var error = this._execute(state, delay);
|
|
1171
|
-
if (error) {
|
|
1172
|
-
return error;
|
|
1173
|
-
}
|
|
1174
|
-
else if (this.pending === false && this.id != null) {
|
|
1175
|
-
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
AsyncAction.prototype._execute = function (state, _delay) {
|
|
1179
|
-
var errored = false;
|
|
1180
|
-
var errorValue;
|
|
1181
|
-
try {
|
|
1182
|
-
this.work(state);
|
|
1183
|
-
}
|
|
1184
|
-
catch (e) {
|
|
1185
|
-
errored = true;
|
|
1186
|
-
errorValue = e ? e : new Error('Scheduled action threw falsy error');
|
|
1187
|
-
}
|
|
1188
|
-
if (errored) {
|
|
1189
|
-
this.unsubscribe();
|
|
1190
|
-
return errorValue;
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
|
-
AsyncAction.prototype.unsubscribe = function () {
|
|
1194
|
-
if (!this.closed) {
|
|
1195
|
-
var _a = this, id = _a.id, scheduler = _a.scheduler;
|
|
1196
|
-
var actions = scheduler.actions;
|
|
1197
|
-
this.work = this.state = this.scheduler = null;
|
|
1198
|
-
this.pending = false;
|
|
1199
|
-
arrRemove(actions, this);
|
|
1200
|
-
if (id != null) {
|
|
1201
|
-
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
1202
|
-
}
|
|
1203
|
-
this.delay = null;
|
|
1204
|
-
_super.prototype.unsubscribe.call(this);
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
return AsyncAction;
|
|
1208
|
-
}(Action));
|
|
1209
|
-
|
|
1210
|
-
var dateTimestampProvider = {
|
|
1211
|
-
now: function () {
|
|
1212
|
-
return (dateTimestampProvider.delegate || Date).now();
|
|
1213
|
-
},
|
|
1214
|
-
delegate: undefined,
|
|
1215
|
-
};
|
|
1216
|
-
|
|
1217
|
-
var Scheduler = (function () {
|
|
1218
|
-
function Scheduler(schedulerActionCtor, now) {
|
|
1219
|
-
if (now === void 0) { now = Scheduler.now; }
|
|
1220
|
-
this.schedulerActionCtor = schedulerActionCtor;
|
|
1221
|
-
this.now = now;
|
|
1222
|
-
}
|
|
1223
|
-
Scheduler.prototype.schedule = function (work, delay, state) {
|
|
1224
|
-
if (delay === void 0) { delay = 0; }
|
|
1225
|
-
return new this.schedulerActionCtor(this, work).schedule(state, delay);
|
|
1226
|
-
};
|
|
1227
|
-
Scheduler.now = dateTimestampProvider.now;
|
|
1228
|
-
return Scheduler;
|
|
1229
|
-
}());
|
|
1230
|
-
|
|
1231
|
-
var AsyncScheduler = (function (_super) {
|
|
1232
|
-
__extends(AsyncScheduler, _super);
|
|
1233
|
-
function AsyncScheduler(SchedulerAction, now) {
|
|
1234
|
-
if (now === void 0) { now = Scheduler.now; }
|
|
1235
|
-
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1236
|
-
_this.actions = [];
|
|
1237
|
-
_this._active = false;
|
|
1238
|
-
_this._scheduled = undefined;
|
|
1239
|
-
return _this;
|
|
1240
|
-
}
|
|
1241
|
-
AsyncScheduler.prototype.flush = function (action) {
|
|
1242
|
-
var actions = this.actions;
|
|
1243
|
-
if (this._active) {
|
|
1244
|
-
actions.push(action);
|
|
1245
|
-
return;
|
|
1246
|
-
}
|
|
1247
|
-
var error;
|
|
1248
|
-
this._active = true;
|
|
1249
|
-
do {
|
|
1250
|
-
if ((error = action.execute(action.state, action.delay))) {
|
|
1251
|
-
break;
|
|
1252
|
-
}
|
|
1253
|
-
} while ((action = actions.shift()));
|
|
1254
|
-
this._active = false;
|
|
1255
|
-
if (error) {
|
|
1256
|
-
while ((action = actions.shift())) {
|
|
1257
|
-
action.unsubscribe();
|
|
1258
|
-
}
|
|
1259
|
-
throw error;
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
return AsyncScheduler;
|
|
1263
|
-
}(Scheduler));
|
|
1264
|
-
|
|
1265
|
-
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
1266
|
-
var async = asyncScheduler;
|
|
1267
|
-
|
|
1268
|
-
function isScheduler(value) {
|
|
1269
|
-
return value && isFunction(value.schedule);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
function isValidDate(value) {
|
|
1273
|
-
return value instanceof Date && !isNaN(value);
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1277
|
-
if (dueTime === void 0) { dueTime = 0; }
|
|
1278
|
-
if (scheduler === void 0) { scheduler = async; }
|
|
1279
|
-
var intervalDuration = -1;
|
|
1280
|
-
if (intervalOrScheduler != null) {
|
|
1281
|
-
if (isScheduler(intervalOrScheduler)) {
|
|
1282
|
-
scheduler = intervalOrScheduler;
|
|
1283
|
-
}
|
|
1284
|
-
else {
|
|
1285
|
-
intervalDuration = intervalOrScheduler;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
return new Observable(function (subscriber) {
|
|
1289
|
-
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
1290
|
-
if (due < 0) {
|
|
1291
|
-
due = 0;
|
|
1292
|
-
}
|
|
1293
|
-
var n = 0;
|
|
1294
|
-
return scheduler.schedule(function () {
|
|
1295
|
-
if (!subscriber.closed) {
|
|
1296
|
-
subscriber.next(n++);
|
|
1297
|
-
if (0 <= intervalDuration) {
|
|
1298
|
-
this.schedule(undefined, intervalDuration);
|
|
1299
|
-
}
|
|
1300
|
-
else {
|
|
1301
|
-
subscriber.complete();
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
}, due);
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
function last(arr) {
|
|
1309
|
-
return arr[arr.length - 1];
|
|
1310
|
-
}
|
|
1311
|
-
function popScheduler(args) {
|
|
1312
|
-
return isScheduler(last(args)) ? args.pop() : undefined;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
1316
|
-
if (delay === void 0) { delay = 0; }
|
|
1317
|
-
if (repeat === void 0) { repeat = false; }
|
|
1318
|
-
var scheduleSubscription = scheduler.schedule(function () {
|
|
1319
|
-
work();
|
|
1320
|
-
if (repeat) {
|
|
1321
|
-
parentSubscription.add(this.schedule(null, delay));
|
|
1322
|
-
}
|
|
1323
|
-
else {
|
|
1324
|
-
this.unsubscribe();
|
|
1325
|
-
}
|
|
1326
|
-
}, delay);
|
|
1327
|
-
parentSubscription.add(scheduleSubscription);
|
|
1328
|
-
if (!repeat) {
|
|
1329
|
-
return scheduleSubscription;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
function catchError(selector) {
|
|
1334
|
-
return operate(function (source, subscriber) {
|
|
1335
|
-
var innerSub = null;
|
|
1336
|
-
var syncUnsub = false;
|
|
1337
|
-
var handledResult;
|
|
1338
|
-
innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
|
|
1339
|
-
handledResult = innerFrom(selector(err, catchError(selector)(source)));
|
|
1340
|
-
if (innerSub) {
|
|
1341
|
-
innerSub.unsubscribe();
|
|
1342
|
-
innerSub = null;
|
|
1343
|
-
handledResult.subscribe(subscriber);
|
|
1344
|
-
}
|
|
1345
|
-
else {
|
|
1346
|
-
syncUnsub = true;
|
|
1347
|
-
}
|
|
1348
|
-
}));
|
|
1349
|
-
if (syncUnsub) {
|
|
1350
|
-
innerSub.unsubscribe();
|
|
1351
|
-
innerSub = null;
|
|
1352
|
-
handledResult.subscribe(subscriber);
|
|
1353
|
-
}
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
function observeOn(scheduler, delay) {
|
|
1358
|
-
if (delay === void 0) { delay = 0; }
|
|
1359
|
-
return operate(function (source, subscriber) {
|
|
1360
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
function subscribeOn(scheduler, delay) {
|
|
1365
|
-
if (delay === void 0) { delay = 0; }
|
|
1366
|
-
return operate(function (source, subscriber) {
|
|
1367
|
-
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
function scheduleObservable(input, scheduler) {
|
|
1372
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
function schedulePromise(input, scheduler) {
|
|
1376
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
function scheduleArray(input, scheduler) {
|
|
1380
|
-
return new Observable(function (subscriber) {
|
|
1381
|
-
var i = 0;
|
|
1382
|
-
return scheduler.schedule(function () {
|
|
1383
|
-
if (i === input.length) {
|
|
1384
|
-
subscriber.complete();
|
|
1385
|
-
}
|
|
1386
|
-
else {
|
|
1387
|
-
subscriber.next(input[i++]);
|
|
1388
|
-
if (!subscriber.closed) {
|
|
1389
|
-
this.schedule();
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
});
|
|
1393
|
-
});
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
function scheduleIterable(input, scheduler) {
|
|
1397
|
-
return new Observable(function (subscriber) {
|
|
1398
|
-
var iterator$1;
|
|
1399
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
1400
|
-
iterator$1 = input[iterator]();
|
|
1401
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
1402
|
-
var _a;
|
|
1403
|
-
var value;
|
|
1404
|
-
var done;
|
|
1405
|
-
try {
|
|
1406
|
-
(_a = iterator$1.next(), value = _a.value, done = _a.done);
|
|
1407
|
-
}
|
|
1408
|
-
catch (err) {
|
|
1409
|
-
subscriber.error(err);
|
|
1410
|
-
return;
|
|
1411
|
-
}
|
|
1412
|
-
if (done) {
|
|
1413
|
-
subscriber.complete();
|
|
1414
|
-
}
|
|
1415
|
-
else {
|
|
1416
|
-
subscriber.next(value);
|
|
1417
|
-
}
|
|
1418
|
-
}, 0, true);
|
|
1419
|
-
});
|
|
1420
|
-
return function () { return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
function scheduleAsyncIterable(input, scheduler) {
|
|
1425
|
-
if (!input) {
|
|
1426
|
-
throw new Error('Iterable cannot be null');
|
|
1427
|
-
}
|
|
1428
|
-
return new Observable(function (subscriber) {
|
|
1429
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
1430
|
-
var iterator = input[Symbol.asyncIterator]();
|
|
1431
|
-
executeSchedule(subscriber, scheduler, function () {
|
|
1432
|
-
iterator.next().then(function (result) {
|
|
1433
|
-
if (result.done) {
|
|
1434
|
-
subscriber.complete();
|
|
1435
|
-
}
|
|
1436
|
-
else {
|
|
1437
|
-
subscriber.next(result.value);
|
|
1438
|
-
}
|
|
1439
|
-
});
|
|
1440
|
-
}, 0, true);
|
|
1441
|
-
});
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
function scheduleReadableStreamLike(input, scheduler) {
|
|
1446
|
-
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
function scheduled(input, scheduler) {
|
|
1450
|
-
if (input != null) {
|
|
1451
|
-
if (isInteropObservable(input)) {
|
|
1452
|
-
return scheduleObservable(input, scheduler);
|
|
1453
|
-
}
|
|
1454
|
-
if (isArrayLike(input)) {
|
|
1455
|
-
return scheduleArray(input, scheduler);
|
|
1456
|
-
}
|
|
1457
|
-
if (isPromise(input)) {
|
|
1458
|
-
return schedulePromise(input, scheduler);
|
|
1459
|
-
}
|
|
1460
|
-
if (isAsyncIterable(input)) {
|
|
1461
|
-
return scheduleAsyncIterable(input, scheduler);
|
|
1462
|
-
}
|
|
1463
|
-
if (isIterable(input)) {
|
|
1464
|
-
return scheduleIterable(input, scheduler);
|
|
1465
|
-
}
|
|
1466
|
-
if (isReadableStreamLike(input)) {
|
|
1467
|
-
return scheduleReadableStreamLike(input, scheduler);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
throw createInvalidObservableTypeError(input);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
function from(input, scheduler) {
|
|
1474
|
-
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
function map(project, thisArg) {
|
|
1478
|
-
return operate(function (source, subscriber) {
|
|
1479
|
-
var index = 0;
|
|
1480
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1481
|
-
subscriber.next(project.call(thisArg, value, index++));
|
|
1482
|
-
}));
|
|
1483
|
-
});
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
1487
|
-
var buffer = [];
|
|
1488
|
-
var active = 0;
|
|
1489
|
-
var index = 0;
|
|
1490
|
-
var isComplete = false;
|
|
1491
|
-
var checkComplete = function () {
|
|
1492
|
-
if (isComplete && !buffer.length && !active) {
|
|
1493
|
-
subscriber.complete();
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
|
|
1497
|
-
var doInnerSub = function (value) {
|
|
1498
|
-
expand && subscriber.next(value);
|
|
1499
|
-
active++;
|
|
1500
|
-
var innerComplete = false;
|
|
1501
|
-
innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
|
|
1502
|
-
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
1503
|
-
if (expand) {
|
|
1504
|
-
outerNext(innerValue);
|
|
1505
|
-
}
|
|
1506
|
-
else {
|
|
1507
|
-
subscriber.next(innerValue);
|
|
1508
|
-
}
|
|
1509
|
-
}, function () {
|
|
1510
|
-
innerComplete = true;
|
|
1511
|
-
}, undefined, function () {
|
|
1512
|
-
if (innerComplete) {
|
|
1513
|
-
try {
|
|
1514
|
-
active--;
|
|
1515
|
-
var _loop_1 = function () {
|
|
1516
|
-
var bufferedValue = buffer.shift();
|
|
1517
|
-
if (innerSubScheduler) {
|
|
1518
|
-
executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
doInnerSub(bufferedValue);
|
|
1522
|
-
}
|
|
1523
|
-
};
|
|
1524
|
-
while (buffer.length && active < concurrent) {
|
|
1525
|
-
_loop_1();
|
|
1526
|
-
}
|
|
1527
|
-
checkComplete();
|
|
1528
|
-
}
|
|
1529
|
-
catch (err) {
|
|
1530
|
-
subscriber.error(err);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}));
|
|
1534
|
-
};
|
|
1535
|
-
source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
|
|
1536
|
-
isComplete = true;
|
|
1537
|
-
checkComplete();
|
|
1538
|
-
}));
|
|
1539
|
-
return function () {
|
|
1540
|
-
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
function mergeMap(project, resultSelector, concurrent) {
|
|
1545
|
-
if (concurrent === void 0) { concurrent = Infinity; }
|
|
1546
|
-
if (isFunction(resultSelector)) {
|
|
1547
|
-
return mergeMap(function (a, i) { return map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
|
|
1548
|
-
}
|
|
1549
|
-
else if (typeof resultSelector === 'number') {
|
|
1550
|
-
concurrent = resultSelector;
|
|
1551
|
-
}
|
|
1552
|
-
return operate(function (source, subscriber) { return mergeInternals(source, subscriber, project, concurrent); });
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
function mergeAll(concurrent) {
|
|
1556
|
-
if (concurrent === void 0) { concurrent = Infinity; }
|
|
1557
|
-
return mergeMap(identity, concurrent);
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
function concatAll() {
|
|
1561
|
-
return mergeAll(1);
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
function debounceTime(dueTime, scheduler) {
|
|
1565
|
-
if (scheduler === void 0) { scheduler = asyncScheduler; }
|
|
1566
|
-
return operate(function (source, subscriber) {
|
|
1567
|
-
var activeTask = null;
|
|
1568
|
-
var lastValue = null;
|
|
1569
|
-
var lastTime = null;
|
|
1570
|
-
var emit = function () {
|
|
1571
|
-
if (activeTask) {
|
|
1572
|
-
activeTask.unsubscribe();
|
|
1573
|
-
activeTask = null;
|
|
1574
|
-
var value = lastValue;
|
|
1575
|
-
lastValue = null;
|
|
1576
|
-
subscriber.next(value);
|
|
1577
|
-
}
|
|
1578
|
-
};
|
|
1579
|
-
function emitWhenIdle() {
|
|
1580
|
-
var targetTime = lastTime + dueTime;
|
|
1581
|
-
var now = scheduler.now();
|
|
1582
|
-
if (now < targetTime) {
|
|
1583
|
-
activeTask = this.schedule(undefined, targetTime - now);
|
|
1584
|
-
subscriber.add(activeTask);
|
|
1585
|
-
return;
|
|
1586
|
-
}
|
|
1587
|
-
emit();
|
|
1588
|
-
}
|
|
1589
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1590
|
-
lastValue = value;
|
|
1591
|
-
lastTime = scheduler.now();
|
|
1592
|
-
if (!activeTask) {
|
|
1593
|
-
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1594
|
-
subscriber.add(activeTask);
|
|
1595
|
-
}
|
|
1596
|
-
}, function () {
|
|
1597
|
-
emit();
|
|
1598
|
-
subscriber.complete();
|
|
1599
|
-
}, undefined, function () {
|
|
1600
|
-
lastValue = activeTask = null;
|
|
1601
|
-
}));
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
function concat$1() {
|
|
1606
|
-
var args = [];
|
|
1607
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1608
|
-
args[_i] = arguments[_i];
|
|
1609
|
-
}
|
|
1610
|
-
return concatAll()(from(args, popScheduler(args)));
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
|
|
1614
|
-
|
|
1615
|
-
function take(count) {
|
|
1616
|
-
return count <= 0
|
|
1617
|
-
?
|
|
1618
|
-
function () { return EMPTY; }
|
|
1619
|
-
: operate(function (source, subscriber) {
|
|
1620
|
-
var seen = 0;
|
|
1621
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1622
|
-
if (++seen <= count) {
|
|
1623
|
-
subscriber.next(value);
|
|
1624
|
-
if (count <= seen) {
|
|
1625
|
-
subscriber.complete();
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
}));
|
|
1629
|
-
});
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
function ignoreElements() {
|
|
1633
|
-
return operate(function (source, subscriber) {
|
|
1634
|
-
source.subscribe(createOperatorSubscriber(subscriber, noop));
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
function mapTo(value) {
|
|
1639
|
-
return map(function () { return value; });
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
1643
|
-
if (subscriptionDelay) {
|
|
1644
|
-
return function (source) {
|
|
1645
|
-
return concat$1(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
1646
|
-
};
|
|
1647
|
-
}
|
|
1648
|
-
return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
function delay(due, scheduler) {
|
|
1652
|
-
if (scheduler === void 0) { scheduler = asyncScheduler; }
|
|
1653
|
-
var duration = timer(due, scheduler);
|
|
1654
|
-
return delayWhen(function () { return duration; });
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
function distinctUntilChanged(comparator, keySelector) {
|
|
1658
|
-
if (keySelector === void 0) { keySelector = identity; }
|
|
1659
|
-
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
1660
|
-
return operate(function (source, subscriber) {
|
|
1661
|
-
var previousKey;
|
|
1662
|
-
var first = true;
|
|
1663
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1664
|
-
var currentKey = keySelector(value);
|
|
1665
|
-
if (first || !comparator(previousKey, currentKey)) {
|
|
1666
|
-
first = false;
|
|
1667
|
-
previousKey = currentKey;
|
|
1668
|
-
subscriber.next(value);
|
|
1669
|
-
}
|
|
1670
|
-
}));
|
|
1671
|
-
});
|
|
1672
|
-
}
|
|
1673
|
-
function defaultCompare(a, b) {
|
|
1674
|
-
return a === b;
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
function filter(predicate, thisArg) {
|
|
1678
|
-
return operate(function (source, subscriber) {
|
|
1679
|
-
var index = 0;
|
|
1680
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
|
|
1681
|
-
});
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
function skip(count) {
|
|
1685
|
-
return filter(function (_, index) { return count <= index; });
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
function startWith() {
|
|
1689
|
-
var values = [];
|
|
1690
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1691
|
-
values[_i] = arguments[_i];
|
|
1692
|
-
}
|
|
1693
|
-
var scheduler = popScheduler(values);
|
|
1694
|
-
return operate(function (source, subscriber) {
|
|
1695
|
-
(scheduler ? concat$1(values, source, scheduler) : concat$1(values, source)).subscribe(subscriber);
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
function switchMap(project, resultSelector) {
|
|
1700
|
-
return operate(function (source, subscriber) {
|
|
1701
|
-
var innerSubscriber = null;
|
|
1702
|
-
var index = 0;
|
|
1703
|
-
var isComplete = false;
|
|
1704
|
-
var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
|
|
1705
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1706
|
-
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
1707
|
-
var innerIndex = 0;
|
|
1708
|
-
var outerIndex = index++;
|
|
1709
|
-
innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
|
|
1710
|
-
innerSubscriber = null;
|
|
1711
|
-
checkComplete();
|
|
1712
|
-
})));
|
|
1713
|
-
}, function () {
|
|
1714
|
-
isComplete = true;
|
|
1715
|
-
checkComplete();
|
|
1716
|
-
}));
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
function tap(observerOrNext, error, complete) {
|
|
1721
|
-
var tapObserver = isFunction(observerOrNext) || error || complete
|
|
1722
|
-
?
|
|
1723
|
-
{ next: observerOrNext, error: error, complete: complete }
|
|
1724
|
-
: observerOrNext;
|
|
1725
|
-
return tapObserver
|
|
1726
|
-
? operate(function (source, subscriber) {
|
|
1727
|
-
var _a;
|
|
1728
|
-
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1729
|
-
var isUnsub = true;
|
|
1730
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1731
|
-
var _a;
|
|
1732
|
-
(_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
|
|
1733
|
-
subscriber.next(value);
|
|
1734
|
-
}, function () {
|
|
1735
|
-
var _a;
|
|
1736
|
-
isUnsub = false;
|
|
1737
|
-
(_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1738
|
-
subscriber.complete();
|
|
1739
|
-
}, function (err) {
|
|
1740
|
-
var _a;
|
|
1741
|
-
isUnsub = false;
|
|
1742
|
-
(_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
|
|
1743
|
-
subscriber.error(err);
|
|
1744
|
-
}, function () {
|
|
1745
|
-
var _a, _b;
|
|
1746
|
-
if (isUnsub) {
|
|
1747
|
-
(_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1748
|
-
}
|
|
1749
|
-
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
|
1750
|
-
}));
|
|
1751
|
-
})
|
|
1752
|
-
:
|
|
1753
|
-
identity;
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
var TimeoutError = createErrorClass(function (_super) {
|
|
1757
|
-
return function TimeoutErrorImpl(info) {
|
|
1758
|
-
if (info === void 0) { info = null; }
|
|
1759
|
-
_super(this);
|
|
1760
|
-
this.message = 'Timeout has occurred';
|
|
1761
|
-
this.name = 'TimeoutError';
|
|
1762
|
-
this.info = info;
|
|
1763
|
-
};
|
|
1764
|
-
});
|
|
1765
|
-
function timeout(config, schedulerArg) {
|
|
1766
|
-
var _a = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
|
|
1767
|
-
if (first == null && each == null) {
|
|
1768
|
-
throw new TypeError('No timeout provided.');
|
|
1769
|
-
}
|
|
1770
|
-
return operate(function (source, subscriber) {
|
|
1771
|
-
var originalSourceSubscription;
|
|
1772
|
-
var timerSubscription;
|
|
1773
|
-
var lastValue = null;
|
|
1774
|
-
var seen = 0;
|
|
1775
|
-
var startTimer = function (delay) {
|
|
1776
|
-
timerSubscription = executeSchedule(subscriber, scheduler, function () {
|
|
1777
|
-
try {
|
|
1778
|
-
originalSourceSubscription.unsubscribe();
|
|
1779
|
-
innerFrom(_with({
|
|
1780
|
-
meta: meta,
|
|
1781
|
-
lastValue: lastValue,
|
|
1782
|
-
seen: seen,
|
|
1783
|
-
})).subscribe(subscriber);
|
|
1784
|
-
}
|
|
1785
|
-
catch (err) {
|
|
1786
|
-
subscriber.error(err);
|
|
1787
|
-
}
|
|
1788
|
-
}, delay);
|
|
1789
|
-
};
|
|
1790
|
-
originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1791
|
-
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
1792
|
-
seen++;
|
|
1793
|
-
subscriber.next((lastValue = value));
|
|
1794
|
-
each > 0 && startTimer(each);
|
|
1795
|
-
}, undefined, undefined, function () {
|
|
1796
|
-
if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {
|
|
1797
|
-
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
1798
|
-
}
|
|
1799
|
-
lastValue = null;
|
|
1800
|
-
}));
|
|
1801
|
-
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
|
|
1802
|
-
});
|
|
1803
|
-
}
|
|
1804
|
-
function timeoutErrorFactory(info) {
|
|
1805
|
-
throw new TimeoutError(info);
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
187
|
//const hasSW = 'serviceWorker' in navigator;
|
|
1809
188
|
let hasComplainedAboutSyncEvent = false;
|
|
1810
189
|
function registerSyncEvent(db, purpose) {
|
|
@@ -3776,7 +2155,7 @@
|
|
|
3776
2155
|
// It's no need to have two channels at the same time - even though it wouldnt
|
|
3777
2156
|
// be a problem - this is an optimization.
|
|
3778
2157
|
yield db.cloud.syncState
|
|
3779
|
-
.pipe(filter(({ phase }) => phase === 'in-sync' || phase === 'error'), take(1))
|
|
2158
|
+
.pipe(operators.filter(({ phase }) => phase === 'in-sync' || phase === 'error'), operators.take(1))
|
|
3780
2159
|
.toPromise();
|
|
3781
2160
|
console.debug('processing msg', msg);
|
|
3782
2161
|
const persistedSyncState = db.cloud.persistedSyncState.value;
|
|
@@ -4886,13 +3265,13 @@
|
|
|
4886
3265
|
// for just a short time.
|
|
4887
3266
|
const userIsReallyActive = new rxjs.BehaviorSubject(true);
|
|
4888
3267
|
userIsActive
|
|
4889
|
-
.pipe(switchMap((isActive) => {
|
|
3268
|
+
.pipe(operators.switchMap((isActive) => {
|
|
4890
3269
|
//console.debug('SyncStatus: DUBB: isActive changed to', isActive);
|
|
4891
3270
|
return isActive
|
|
4892
3271
|
? rxjs.of(true)
|
|
4893
|
-
: rxjs.of(false).pipe(delay(INACTIVE_WAIT_TIME))
|
|
3272
|
+
: rxjs.of(false).pipe(operators.delay(INACTIVE_WAIT_TIME))
|
|
4894
3273
|
;
|
|
4895
|
-
}), distinctUntilChanged())
|
|
3274
|
+
}), operators.distinctUntilChanged())
|
|
4896
3275
|
.subscribe(userIsReallyActive);
|
|
4897
3276
|
//
|
|
4898
3277
|
// First create some corner-stone observables to build the flow on
|
|
@@ -4902,9 +3281,9 @@
|
|
|
4902
3281
|
? rxjs.fromEvent(document, 'visibilitychange')
|
|
4903
3282
|
: rxjs.of({});
|
|
4904
3283
|
// document.onvisibilitychange makes document hidden:
|
|
4905
|
-
const documentBecomesHidden = visibilityStateIsChanged.pipe(filter(() => document.visibilityState === 'hidden'));
|
|
3284
|
+
const documentBecomesHidden = visibilityStateIsChanged.pipe(operators.filter(() => document.visibilityState === 'hidden'));
|
|
4906
3285
|
// document.onvisibilitychange makes document visible
|
|
4907
|
-
const documentBecomesVisible = visibilityStateIsChanged.pipe(filter(() => document.visibilityState === 'visible'));
|
|
3286
|
+
const documentBecomesVisible = visibilityStateIsChanged.pipe(operators.filter(() => document.visibilityState === 'visible'));
|
|
4908
3287
|
// Any of various user-activity-related events happen:
|
|
4909
3288
|
const userDoesSomething = typeof window !== 'undefined'
|
|
4910
3289
|
? rxjs.merge(documentBecomesVisible, rxjs.fromEvent(window, 'mousedown'), rxjs.fromEvent(window, 'mousemove'), rxjs.fromEvent(window, 'keydown'), rxjs.fromEvent(window, 'wheel'), rxjs.fromEvent(window, 'touchmove'))
|
|
@@ -4922,9 +3301,9 @@
|
|
|
4922
3301
|
userDoesSomething)
|
|
4923
3302
|
.pipe(
|
|
4924
3303
|
// No matter event source, compute whether user is visible using visibilityState:
|
|
4925
|
-
map(() => document.visibilityState === 'visible'),
|
|
3304
|
+
operators.map(() => document.visibilityState === 'visible'),
|
|
4926
3305
|
// Make sure to emit it
|
|
4927
|
-
tap((isActive) => {
|
|
3306
|
+
operators.tap((isActive) => {
|
|
4928
3307
|
if (userIsActive.value !== isActive) {
|
|
4929
3308
|
// Emit new value unless it already has that value
|
|
4930
3309
|
userIsActive.next(isActive);
|
|
@@ -4932,8 +3311,8 @@
|
|
|
4932
3311
|
}),
|
|
4933
3312
|
// Now, if true was emitted, make sure to set a timeout to emit false
|
|
4934
3313
|
// unless new user activity things happen (in that case, the timeout will be cancelled!)
|
|
4935
|
-
switchMap((isActive) => isActive
|
|
4936
|
-
? rxjs.of(0).pipe(delay(USER_INACTIVITY_TIMEOUT - INACTIVE_WAIT_TIME), tap(() => userIsActive.next(false)))
|
|
3314
|
+
operators.switchMap((isActive) => isActive
|
|
3315
|
+
? rxjs.of(0).pipe(operators.delay(USER_INACTIVITY_TIMEOUT - INACTIVE_WAIT_TIME), operators.tap(() => userIsActive.next(false)))
|
|
4937
3316
|
: rxjs.of(0)))
|
|
4938
3317
|
.subscribe(() => { }); // Unless we subscribe nothing will be propagated to userIsActive observable
|
|
4939
3318
|
}
|
|
@@ -5163,7 +3542,7 @@
|
|
|
5163
3542
|
yield sleep$1(3000);
|
|
5164
3543
|
// Wait til user does something (move mouse, tap, scroll, click etc)
|
|
5165
3544
|
console.debug('waiting for someone to do something');
|
|
5166
|
-
yield userDoesSomething.pipe(take(1)).toPromise();
|
|
3545
|
+
yield userDoesSomething.pipe(operators.take(1)).toPromise();
|
|
5167
3546
|
console.debug('someone did something!');
|
|
5168
3547
|
});
|
|
5169
3548
|
}
|
|
@@ -5172,35 +3551,35 @@
|
|
|
5172
3551
|
if (!((_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl)) {
|
|
5173
3552
|
throw new Error(`No database URL to connect WebSocket to`);
|
|
5174
3553
|
}
|
|
5175
|
-
const messageProducer = db.messageConsumer.readyToServe.pipe(filter((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it
|
|
5176
|
-
switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:
|
|
5177
|
-
filter((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place
|
|
5178
|
-
map((syncState) => ({
|
|
3554
|
+
const messageProducer = db.messageConsumer.readyToServe.pipe(operators.filter((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it
|
|
3555
|
+
operators.switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:
|
|
3556
|
+
operators.filter((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place
|
|
3557
|
+
operators.map((syncState) => ({
|
|
5179
3558
|
// Produce the message to trigger server to send us new messages to consume:
|
|
5180
3559
|
type: 'ready',
|
|
5181
3560
|
rev: syncState.serverRevision,
|
|
5182
3561
|
})));
|
|
5183
3562
|
function createObservable() {
|
|
5184
|
-
return db.cloud.persistedSyncState.pipe(filter((syncState) => syncState === null || syncState === void 0 ? void 0 : syncState.serverRevision), // Don't connect before there's no initial sync performed.
|
|
5185
|
-
take(1), // Don't continue waking up whenever syncState change
|
|
5186
|
-
switchMap((syncState) => db.cloud.currentUser.pipe(map((userLogin) => [userLogin, syncState]))), switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]))), switchMap(([userLogin, syncState]) => {
|
|
3563
|
+
return db.cloud.persistedSyncState.pipe(operators.filter((syncState) => syncState === null || syncState === void 0 ? void 0 : syncState.serverRevision), // Don't connect before there's no initial sync performed.
|
|
3564
|
+
operators.take(1), // Don't continue waking up whenever syncState change
|
|
3565
|
+
operators.switchMap((syncState) => db.cloud.currentUser.pipe(operators.map((userLogin) => [userLogin, syncState]))), operators.switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(operators.map((isActive) => [isActive ? userLogin : null, syncState]))), operators.switchMap(([userLogin, syncState]) => {
|
|
5187
3566
|
if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) && !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
|
|
5188
3567
|
// We're in an in-between state when user is logged in but the user's realms are not yet synced.
|
|
5189
3568
|
// Don't make this change reconnect the websocket just yet. Wait till syncState is updated
|
|
5190
3569
|
// to iclude the user's realm.
|
|
5191
|
-
return db.cloud.persistedSyncState.pipe(filter((syncState) => (syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId)) || false), take(1), map((syncState) => [userLogin, syncState]));
|
|
3570
|
+
return db.cloud.persistedSyncState.pipe(operators.filter((syncState) => (syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId)) || false), operators.take(1), operators.map((syncState) => [userLogin, syncState]));
|
|
5192
3571
|
}
|
|
5193
3572
|
return new rxjs.BehaviorSubject([userLogin, syncState]);
|
|
5194
|
-
}), switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), switchMap(([userLogin, realmSetHash]) =>
|
|
3573
|
+
}), operators.switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), operators.switchMap(([userLogin, realmSetHash]) =>
|
|
5195
3574
|
// Let server end query changes from last entry of same client-ID and forward.
|
|
5196
3575
|
// If no new entries, server won't bother the client. If new entries, server sends only those
|
|
5197
3576
|
// and the baseRev of the last from same client-ID.
|
|
5198
3577
|
userLogin
|
|
5199
3578
|
? new WSObservable(db.cloud.options.databaseUrl, db.cloud.persistedSyncState.value.serverRevision, realmSetHash, db.cloud.persistedSyncState.value.clientIdentity, messageProducer, db.cloud.webSocketStatus, userLogin.accessToken, userLogin.accessTokenExpiration)
|
|
5200
|
-
: rxjs.from([])), catchError((error) => {
|
|
3579
|
+
: rxjs.from([])), operators.catchError((error) => {
|
|
5201
3580
|
if ((error === null || error === void 0 ? void 0 : error.name) === 'TokenExpiredError') {
|
|
5202
3581
|
console.debug('WebSocket observable: Token expired. Refreshing token...');
|
|
5203
|
-
return rxjs.of(true).pipe(switchMap(() => __awaiter(this, void 0, void 0, function* () {
|
|
3582
|
+
return rxjs.of(true).pipe(operators.switchMap(() => __awaiter(this, void 0, void 0, function* () {
|
|
5204
3583
|
// Refresh access token
|
|
5205
3584
|
const user = yield db.getCurrentUser();
|
|
5206
3585
|
const refreshedLogin = yield refreshAccessToken(db.cloud.options.databaseUrl, user);
|
|
@@ -5209,14 +3588,14 @@
|
|
|
5209
3588
|
accessToken: refreshedLogin.accessToken,
|
|
5210
3589
|
accessTokenExpiration: refreshedLogin.accessTokenExpiration,
|
|
5211
3590
|
});
|
|
5212
|
-
})), switchMap(() => createObservable()));
|
|
3591
|
+
})), operators.switchMap(() => createObservable()));
|
|
5213
3592
|
}
|
|
5214
3593
|
else {
|
|
5215
3594
|
return rxjs.throwError(error);
|
|
5216
3595
|
}
|
|
5217
|
-
}), catchError((error) => {
|
|
3596
|
+
}), operators.catchError((error) => {
|
|
5218
3597
|
db.cloud.webSocketStatus.next("error");
|
|
5219
|
-
return rxjs.from(waitAndReconnectWhenUserDoesSomething(error)).pipe(switchMap(() => createObservable()));
|
|
3598
|
+
return rxjs.from(waitAndReconnectWhenUserDoesSomething(error)).pipe(operators.switchMap(() => createObservable()));
|
|
5220
3599
|
}));
|
|
5221
3600
|
}
|
|
5222
3601
|
return createObservable().subscribe((msg) => {
|
|
@@ -5285,7 +3664,7 @@
|
|
|
5285
3664
|
// Someone else took the job.
|
|
5286
3665
|
if (awaitRemoteJob) {
|
|
5287
3666
|
try {
|
|
5288
|
-
const jobDoneObservable = rxjs.from(Dexie.liveQuery(() => jobsTable.get(jobName))).pipe(timeout(GUARDED_JOB_TIMEOUT), filter((job) => !job)); // Wait til job is not there anymore.
|
|
3667
|
+
const jobDoneObservable = rxjs.from(Dexie.liveQuery(() => jobsTable.get(jobName))).pipe(operators.timeout(GUARDED_JOB_TIMEOUT), operators.filter((job) => !job)); // Wait til job is not there anymore.
|
|
5289
3668
|
yield jobDoneObservable.toPromise();
|
|
5290
3669
|
return false;
|
|
5291
3670
|
}
|
|
@@ -5655,7 +4034,7 @@
|
|
|
5655
4034
|
|
|
5656
4035
|
function computeSyncState(db) {
|
|
5657
4036
|
let _prevStatus = db.cloud.webSocketStatus.value;
|
|
5658
|
-
const lazyWebSocketStatus = db.cloud.webSocketStatus.pipe(switchMap((status) => {
|
|
4037
|
+
const lazyWebSocketStatus = db.cloud.webSocketStatus.pipe(operators.switchMap((status) => {
|
|
5659
4038
|
const prevStatus = _prevStatus;
|
|
5660
4039
|
_prevStatus = status;
|
|
5661
4040
|
const rv = rxjs.of(status);
|
|
@@ -5665,22 +4044,22 @@
|
|
|
5665
4044
|
// Only show disconnected if disconnected more than 500ms, or if we can
|
|
5666
4045
|
// see that the user is indeed not active.
|
|
5667
4046
|
case 'disconnected':
|
|
5668
|
-
return userIsActive.value ? rv.pipe(debounceTime(500)) : rv;
|
|
4047
|
+
return userIsActive.value ? rv.pipe(operators.debounceTime(500)) : rv;
|
|
5669
4048
|
// Only show connecting if previous state was 'not-started' or 'error', or if
|
|
5670
4049
|
// the time it takes to connect goes beyond 4 seconds.
|
|
5671
4050
|
case 'connecting':
|
|
5672
4051
|
return prevStatus === 'not-started' || prevStatus === 'error'
|
|
5673
4052
|
? rv
|
|
5674
|
-
: rv.pipe(debounceTime(4000));
|
|
4053
|
+
: rv.pipe(operators.debounceTime(4000));
|
|
5675
4054
|
default:
|
|
5676
4055
|
return rv;
|
|
5677
4056
|
}
|
|
5678
4057
|
}));
|
|
5679
4058
|
return rxjs.combineLatest([
|
|
5680
4059
|
lazyWebSocketStatus,
|
|
5681
|
-
db.syncStateChangedEvent.pipe(startWith({ phase: 'initial' })),
|
|
4060
|
+
db.syncStateChangedEvent.pipe(operators.startWith({ phase: 'initial' })),
|
|
5682
4061
|
userIsReallyActive
|
|
5683
|
-
]).pipe(map(([status, syncState, userIsActive]) => {
|
|
4062
|
+
]).pipe(operators.map(([status, syncState, userIsActive]) => {
|
|
5684
4063
|
let { phase, error, progress } = syncState;
|
|
5685
4064
|
let adjustedStatus = status;
|
|
5686
4065
|
if (phase === 'error') {
|
|
@@ -5774,7 +4153,7 @@
|
|
|
5774
4153
|
const getCurrentUserEmitter = associate((db) => new rxjs.BehaviorSubject(UNAUTHORIZED_USER));
|
|
5775
4154
|
|
|
5776
4155
|
const getInternalAccessControlObservable = associate((db) => {
|
|
5777
|
-
return createSharedValueObservable(getCurrentUserEmitter(db._novip).pipe(switchMap((currentUser) => Dexie.liveQuery(() => db.transaction('r', 'realms', 'members', () => Promise.all([
|
|
4156
|
+
return createSharedValueObservable(getCurrentUserEmitter(db._novip).pipe(operators.switchMap((currentUser) => Dexie.liveQuery(() => db.transaction('r', 'realms', 'members', () => Promise.all([
|
|
5778
4157
|
db.members.where({ userId: currentUser.userId }).toArray(),
|
|
5779
4158
|
db.realms.toArray(),
|
|
5780
4159
|
currentUser.userId,
|
|
@@ -5875,7 +4254,7 @@
|
|
|
5875
4254
|
const o = createSharedValueObservable(rxjs.combineLatest([
|
|
5876
4255
|
getInternalAccessControlObservable(db._novip),
|
|
5877
4256
|
getGlobalRolesObservable(db._novip),
|
|
5878
|
-
]).pipe(map(([{ selfMembers, realms, userId }, globalRoles]) => ({
|
|
4257
|
+
]).pipe(operators.map(([{ selfMembers, realms, userId }, globalRoles]) => ({
|
|
5879
4258
|
selfMembers,
|
|
5880
4259
|
realms,
|
|
5881
4260
|
userId,
|
|
@@ -5989,16 +4368,16 @@
|
|
|
5989
4368
|
return new PermissionChecker({}, tableName, !owner || owner === dexie.cloud.currentUserId);
|
|
5990
4369
|
return new PermissionChecker(realm.permissions, tableName, realmId === dexie.cloud.currentUserId || owner === dexie.cloud.currentUserId);
|
|
5991
4370
|
};
|
|
5992
|
-
const o = source.pipe(map(mapper));
|
|
4371
|
+
const o = source.pipe(operators.map(mapper));
|
|
5993
4372
|
o.getValue = () => mapper(source.getValue());
|
|
5994
4373
|
return o;
|
|
5995
4374
|
}
|
|
5996
4375
|
|
|
5997
4376
|
const getInvitesObservable = associate((db) => {
|
|
5998
|
-
const membersByEmail = getCurrentUserEmitter(db._novip).pipe(switchMap((currentUser) => Dexie.liveQuery(() => db.members.where({ email: currentUser.email || '' }).toArray())));
|
|
4377
|
+
const membersByEmail = getCurrentUserEmitter(db._novip).pipe(operators.switchMap((currentUser) => Dexie.liveQuery(() => db.members.where({ email: currentUser.email || '' }).toArray())));
|
|
5999
4378
|
const permissions = getPermissionsLookupObservable(db._novip);
|
|
6000
4379
|
const accessControl = getInternalAccessControlObservable(db._novip);
|
|
6001
|
-
return createSharedValueObservable(rxjs.combineLatest([membersByEmail, accessControl, permissions]).pipe(map(([membersByEmail, accessControl, realmLookup]) => {
|
|
4380
|
+
return createSharedValueObservable(rxjs.combineLatest([membersByEmail, accessControl, permissions]).pipe(operators.map(([membersByEmail, accessControl, realmLookup]) => {
|
|
6002
4381
|
const reducer = (result, m) => (Object.assign(Object.assign({}, result), { [m.id]: Object.assign(Object.assign({}, m), { realm: realmLookup[m.realmId] }) }));
|
|
6003
4382
|
const emailMembersById = membersByEmail.reduce(reducer, {});
|
|
6004
4383
|
const membersById = accessControl.selfMembers.reduce(reducer, emailMembersById);
|
|
@@ -6055,7 +4434,7 @@
|
|
|
6055
4434
|
});
|
|
6056
4435
|
const syncComplete = new rxjs.Subject();
|
|
6057
4436
|
dexie.cloud = {
|
|
6058
|
-
version: '4.0.1-beta.
|
|
4437
|
+
version: '4.0.1-beta.39',
|
|
6059
4438
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6060
4439
|
schema: null,
|
|
6061
4440
|
get currentUserId() {
|
|
@@ -6101,8 +4480,8 @@
|
|
|
6101
4480
|
triggerSync(db, purpose);
|
|
6102
4481
|
if (wait) {
|
|
6103
4482
|
const newSyncState = yield db.cloud.persistedSyncState
|
|
6104
|
-
.pipe(filter((newSyncState) => (newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.timestamp) != null &&
|
|
6105
|
-
(!syncState || newSyncState.timestamp > syncState.timestamp)), take(1))
|
|
4483
|
+
.pipe(operators.filter((newSyncState) => (newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.timestamp) != null &&
|
|
4484
|
+
(!syncState || newSyncState.timestamp > syncState.timestamp)), operators.take(1))
|
|
6106
4485
|
.toPromise();
|
|
6107
4486
|
if (newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.error) {
|
|
6108
4487
|
throw new Error(`Sync error: ` + newSyncState.error);
|
|
@@ -6122,7 +4501,7 @@
|
|
|
6122
4501
|
throw new Error(`Sync error: ` + newSyncState.error);
|
|
6123
4502
|
return syncNeeded;
|
|
6124
4503
|
})))
|
|
6125
|
-
.pipe(filter((isNeeded) => !isNeeded), take(1))
|
|
4504
|
+
.pipe(operators.filter((isNeeded) => !isNeeded), operators.take(1))
|
|
6126
4505
|
.toPromise();
|
|
6127
4506
|
console.debug('Done waiting for sync completion because we have nothing to push anymore');
|
|
6128
4507
|
}
|
|
@@ -6266,8 +4645,8 @@
|
|
|
6266
4645
|
// This is so that when db.open() completes, user should be safe
|
|
6267
4646
|
// to subscribe to these observables and get actual data.
|
|
6268
4647
|
yield rxjs.combineLatest([
|
|
6269
|
-
currentUserEmitter.pipe(skip(1), take(1)),
|
|
6270
|
-
db.cloud.persistedSyncState.pipe(skip(1), take(1)),
|
|
4648
|
+
currentUserEmitter.pipe(operators.skip(1), operators.take(1)),
|
|
4649
|
+
db.cloud.persistedSyncState.pipe(operators.skip(1), operators.take(1)),
|
|
6271
4650
|
]).toPromise();
|
|
6272
4651
|
}
|
|
6273
4652
|
// HERE: If requireAuth, do athentication now.
|
|
@@ -6316,7 +4695,7 @@
|
|
|
6316
4695
|
});
|
|
6317
4696
|
}
|
|
6318
4697
|
}
|
|
6319
|
-
dexieCloud.version = '4.0.1-beta.
|
|
4698
|
+
dexieCloud.version = '4.0.1-beta.39';
|
|
6320
4699
|
Dexie__default["default"].Cloud = dexieCloud;
|
|
6321
4700
|
|
|
6322
4701
|
// In case the SW lives for a while, let it reuse already opened connections:
|