dexie-cloud-addon 4.0.1-beta.47 → 4.0.1-beta.49
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/{types → modern}/TSON.d.ts +1 -1
- package/dist/modern/dexie-cloud-addon.d.ts +3 -0
- package/dist/modern/dexie-cloud-addon.js +21 -58
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +2 -2
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/dexie-cloud-client.d.ts +22 -0
- package/dist/modern/service-worker.js +1568 -19
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +2 -2
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
- package/dist/umd/DXCWebSocketStatus.d.ts +1 -0
- package/dist/umd/DexieCloudAPI.d.ts +72 -0
- package/dist/umd/DexieCloudOptions.d.ts +22 -0
- package/dist/umd/DexieCloudSyncOptions.d.ts +4 -0
- package/dist/umd/DexieCloudTable.d.ts +18 -0
- package/dist/umd/InvalidLicenseError.d.ts +5 -0
- package/dist/umd/Invite.d.ts +8 -0
- package/dist/umd/PermissionChecker.d.ts +15 -0
- package/dist/umd/TSON.d.ts +17 -0
- package/dist/umd/WSObservable.d.ts +68 -0
- package/dist/umd/associate.d.ts +1 -0
- package/dist/umd/authentication/AuthPersistedContext.d.ts +9 -0
- package/dist/umd/authentication/TokenErrorResponseError.d.ts +10 -0
- package/dist/umd/authentication/TokenExpiredError.d.ts +3 -0
- package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +2 -0
- package/dist/umd/authentication/authenticate.d.ts +20 -0
- package/dist/umd/authentication/currentUserObservable.d.ts +1 -0
- package/dist/umd/authentication/interactWithUser.d.ts +21 -0
- package/dist/umd/authentication/login.d.ts +6 -0
- package/dist/umd/authentication/logout.d.ts +5 -0
- package/dist/umd/authentication/otpFetchTokenCallback.d.ts +3 -0
- package/dist/umd/authentication/setCurrentUser.d.ts +14 -0
- package/dist/umd/authentication/waitUntil.d.ts +3 -0
- package/dist/umd/computeSyncState.d.ts +4 -0
- package/dist/umd/createSharedValueObservable.d.ts +3 -0
- package/dist/umd/currentUserEmitter.d.ts +3 -0
- package/dist/umd/db/DexieCloudDB.d.ts +59 -0
- package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +5 -0
- package/dist/umd/db/entities/EntityCommon.d.ts +5 -0
- package/dist/umd/db/entities/GuardedJob.d.ts +5 -0
- package/dist/umd/db/entities/Member.d.ts +19 -0
- package/dist/umd/db/entities/PersistedSyncState.d.ts +14 -0
- package/dist/umd/db/entities/Realm.d.ts +16 -0
- package/dist/umd/db/entities/Role.d.ts +11 -0
- package/dist/umd/db/entities/UserLogin.d.ts +22 -0
- package/dist/umd/default-ui/Dialog.d.ts +5 -0
- package/dist/umd/default-ui/LoginDialog.d.ts +3 -0
- package/dist/umd/default-ui/Styles.d.ts +3 -0
- package/dist/umd/default-ui/index.d.ts +24 -0
- package/dist/umd/dexie-cloud-addon.d.ts +3 -0
- package/dist/umd/dexie-cloud-addon.js +41 -81
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-client.d.ts +22 -0
- package/dist/umd/errors/HttpError.d.ts +5 -0
- package/dist/umd/extend-dexie-interface.d.ts +23 -0
- package/dist/umd/getGlobalRolesObservable.d.ts +5 -0
- package/dist/umd/getInternalAccessControlObservable.d.ts +12 -0
- package/dist/umd/getInvitesObservable.d.ts +23 -0
- package/dist/umd/getPermissionsLookupObservable.d.ts +16 -0
- package/dist/umd/getTiedRealmId.d.ts +2 -0
- package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
- package/dist/umd/helpers/CancelToken.d.ts +4 -0
- package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +1 -0
- package/dist/umd/helpers/SWBroadcastChannel.d.ts +12 -0
- package/dist/umd/helpers/allSettled.d.ts +1 -0
- package/dist/umd/helpers/bulkUpdate.d.ts +4 -0
- package/dist/umd/helpers/computeRealmSetHash.d.ts +2 -0
- package/dist/umd/helpers/date-constants.d.ts +5 -0
- package/dist/umd/helpers/dbOnClosed.d.ts +2 -0
- package/dist/umd/helpers/flatten.d.ts +1 -0
- package/dist/umd/helpers/getMutationTable.d.ts +1 -0
- package/dist/umd/helpers/getSyncableTables.d.ts +4 -0
- package/dist/umd/helpers/getTableFromMutationTable.d.ts +1 -0
- package/dist/umd/helpers/makeArray.d.ts +1 -0
- package/dist/umd/helpers/randomString.d.ts +1 -0
- package/dist/umd/helpers/resolveText.d.ts +16 -0
- package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +1 -0
- package/dist/umd/helpers/visibilityState.d.ts +1 -0
- package/dist/umd/isEagerSyncDisabled.d.ts +2 -0
- package/dist/umd/isFirefox.d.ts +1 -0
- package/dist/umd/isSafari.d.ts +2 -0
- package/dist/umd/mapValueObservable.d.ts +5 -0
- package/dist/umd/mergePermissions.d.ts +2 -0
- package/dist/umd/middleware-helpers/guardedTable.d.ts +11 -0
- package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +18 -0
- package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +3 -0
- package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
- package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
- package/dist/umd/middlewares/outstandingTransaction.d.ts +4 -0
- package/dist/umd/overrideParseStoresSpec.d.ts +4 -0
- package/dist/umd/performInitialSync.d.ts +4 -0
- package/dist/umd/permissions.d.ts +9 -0
- package/dist/umd/prodLog.d.ts +9 -0
- package/dist/umd/service-worker.d.ts +1 -0
- package/dist/umd/service-worker.js +1624 -78
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/sync/LocalSyncWorker.d.ts +7 -0
- package/dist/umd/sync/SyncRequiredError.d.ts +3 -0
- package/dist/umd/sync/applyServerChanges.d.ts +3 -0
- package/dist/umd/sync/connectWebSocket.d.ts +2 -0
- package/dist/umd/sync/encodeIdsForServer.d.ts +4 -0
- package/dist/umd/sync/extractRealm.d.ts +2 -0
- package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +6 -0
- package/dist/umd/sync/getTablesToSyncify.d.ts +3 -0
- package/dist/umd/sync/isOnline.d.ts +1 -0
- package/dist/umd/sync/isSyncNeeded.d.ts +2 -0
- package/dist/umd/sync/listClientChanges.d.ts +9 -0
- package/dist/umd/sync/listSyncifiedChanges.d.ts +5 -0
- package/dist/umd/sync/messageConsumerIsReady.d.ts +2 -0
- package/dist/umd/sync/messagesFromServerQueue.d.ts +8 -0
- package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
- package/dist/umd/sync/myId.d.ts +1 -0
- package/dist/umd/sync/numUnsyncedMutations.d.ts +2 -0
- package/dist/umd/sync/old_startSyncingClientChanges.d.ts +39 -0
- package/dist/umd/sync/performGuardedJob.d.ts +2 -0
- package/dist/umd/sync/ratelimit.d.ts +3 -0
- package/dist/umd/sync/registerSyncEvent.d.ts +3 -0
- package/dist/umd/sync/sync.d.ts +15 -0
- package/dist/umd/sync/syncIfPossible.d.ts +5 -0
- package/dist/umd/sync/syncWithServer.d.ts +6 -0
- package/dist/umd/sync/triggerSync.d.ts +2 -0
- package/dist/umd/sync/updateBaseRevs.d.ts +5 -0
- package/dist/umd/types/DXCAlert.d.ts +25 -0
- package/dist/umd/types/DXCInputField.d.ts +11 -0
- package/dist/umd/types/DXCUserInteraction.d.ts +93 -0
- package/dist/umd/types/NewIdOptions.d.ts +3 -0
- package/dist/umd/types/SWMessageEvent.d.ts +3 -0
- package/dist/umd/types/SWSyncEvent.d.ts +4 -0
- package/dist/umd/types/SyncState.d.ts +9 -0
- package/dist/umd/types/TXExpandos.d.ts +11 -0
- package/dist/umd/updateSchemaFromOptions.d.ts +3 -0
- package/dist/umd/userIsActive.d.ts +7 -0
- package/dist/umd/verifyConfig.d.ts +2 -0
- package/dist/umd/verifySchema.d.ts +2 -0
- package/package.json +12 -47
- package/copydts.sh +0 -5
- package/dist/types/dexie-cloud-client.d.ts +0 -13
- package/dist/umd/dexie-cloud-addon.min.js +0 -2
- package/dist/umd/dexie-cloud-addon.min.js.map +0 -1
- package/dist/umd/service-worker.min.js +0 -2
- package/dist/umd/service-worker.min.js.map +0 -1
- /package/dist/{types → modern}/DISABLE_SERVICEWORKER_STRATEGY.d.ts +0 -0
- /package/dist/{types → modern}/DXCWebSocketStatus.d.ts +0 -0
- /package/dist/{types → modern}/DexieCloudAPI.d.ts +0 -0
- /package/dist/{types → modern}/DexieCloudOptions.d.ts +0 -0
- /package/dist/{types → modern}/DexieCloudSyncOptions.d.ts +0 -0
- /package/dist/{types → modern}/DexieCloudTable.d.ts +0 -0
- /package/dist/{types → modern}/InvalidLicenseError.d.ts +0 -0
- /package/dist/{types → modern}/Invite.d.ts +0 -0
- /package/dist/{types → modern}/PermissionChecker.d.ts +0 -0
- /package/dist/{types → modern}/WSObservable.d.ts +0 -0
- /package/dist/{types → modern}/associate.d.ts +0 -0
- /package/dist/{types → modern}/authentication/AuthPersistedContext.d.ts +0 -0
- /package/dist/{types → modern}/authentication/TokenErrorResponseError.d.ts +0 -0
- /package/dist/{types → modern}/authentication/TokenExpiredError.d.ts +0 -0
- /package/dist/{types → modern}/authentication/UNAUTHORIZED_USER.d.ts +0 -0
- /package/dist/{types → modern}/authentication/authenticate.d.ts +0 -0
- /package/dist/{types → modern}/authentication/currentUserObservable.d.ts +0 -0
- /package/dist/{types → modern}/authentication/interactWithUser.d.ts +0 -0
- /package/dist/{types → modern}/authentication/login.d.ts +0 -0
- /package/dist/{types → modern}/authentication/logout.d.ts +0 -0
- /package/dist/{types → modern}/authentication/otpFetchTokenCallback.d.ts +0 -0
- /package/dist/{types → modern}/authentication/setCurrentUser.d.ts +0 -0
- /package/dist/{types → modern}/authentication/waitUntil.d.ts +0 -0
- /package/dist/{types → modern}/computeSyncState.d.ts +0 -0
- /package/dist/{types → modern}/createSharedValueObservable.d.ts +0 -0
- /package/dist/{types → modern}/currentUserEmitter.d.ts +0 -0
- /package/dist/{types → modern}/db/DexieCloudDB.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/BaseRevisionMapEntry.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/EntityCommon.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/GuardedJob.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/Member.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/PersistedSyncState.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/Realm.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/Role.d.ts +0 -0
- /package/dist/{types → modern}/db/entities/UserLogin.d.ts +0 -0
- /package/dist/{types → modern}/default-ui/Dialog.d.ts +0 -0
- /package/dist/{types → modern}/default-ui/LoginDialog.d.ts +0 -0
- /package/dist/{types → modern}/default-ui/Styles.d.ts +0 -0
- /package/dist/{types → modern}/default-ui/index.d.ts +0 -0
- /package/dist/{types → modern}/errors/HttpError.d.ts +0 -0
- /package/dist/{types → modern}/extend-dexie-interface.d.ts +0 -0
- /package/dist/{types → modern}/getGlobalRolesObservable.d.ts +0 -0
- /package/dist/{types → modern}/getInternalAccessControlObservable.d.ts +0 -0
- /package/dist/{types → modern}/getInvitesObservable.d.ts +0 -0
- /package/dist/{types → modern}/getPermissionsLookupObservable.d.ts +0 -0
- /package/dist/{types → modern}/getTiedRealmId.d.ts +0 -0
- /package/dist/{types → modern}/helpers/BroadcastedAndLocalEvent.d.ts +0 -0
- /package/dist/{types → modern}/helpers/CancelToken.d.ts +0 -0
- /package/dist/{types → modern}/helpers/IS_SERVICE_WORKER.d.ts +0 -0
- /package/dist/{types → modern}/helpers/SWBroadcastChannel.d.ts +0 -0
- /package/dist/{types → modern}/helpers/allSettled.d.ts +0 -0
- /package/dist/{types → modern}/helpers/bulkUpdate.d.ts +0 -0
- /package/dist/{types → modern}/helpers/computeRealmSetHash.d.ts +0 -0
- /package/dist/{types → modern}/helpers/date-constants.d.ts +0 -0
- /package/dist/{types → modern}/helpers/dbOnClosed.d.ts +0 -0
- /package/dist/{types → modern}/helpers/flatten.d.ts +0 -0
- /package/dist/{types → modern}/helpers/getMutationTable.d.ts +0 -0
- /package/dist/{types → modern}/helpers/getSyncableTables.d.ts +0 -0
- /package/dist/{types → modern}/helpers/getTableFromMutationTable.d.ts +0 -0
- /package/dist/{types → modern}/helpers/makeArray.d.ts +0 -0
- /package/dist/{types → modern}/helpers/randomString.d.ts +0 -0
- /package/dist/{types → modern}/helpers/resolveText.d.ts +0 -0
- /package/dist/{types → modern}/helpers/throwVersionIncrementNeeded.d.ts +0 -0
- /package/dist/{types → modern}/helpers/visibilityState.d.ts +0 -0
- /package/dist/{types → modern}/isEagerSyncDisabled.d.ts +0 -0
- /package/dist/{types → modern}/isFirefox.d.ts +0 -0
- /package/dist/{types → modern}/isSafari.d.ts +0 -0
- /package/dist/{types → modern}/mapValueObservable.d.ts +0 -0
- /package/dist/{types → modern}/mergePermissions.d.ts +0 -0
- /package/dist/{types → modern}/middleware-helpers/guardedTable.d.ts +0 -0
- /package/dist/{types → modern}/middleware-helpers/idGenerationHelpers.d.ts +0 -0
- /package/dist/{types → modern}/middlewares/createIdGenerationMiddleware.d.ts +0 -0
- /package/dist/{types → modern}/middlewares/createImplicitPropSetterMiddleware.d.ts +0 -0
- /package/dist/{types → modern}/middlewares/createMutationTrackingMiddleware.d.ts +0 -0
- /package/dist/{types → modern}/middlewares/outstandingTransaction.d.ts +0 -0
- /package/dist/{types → modern}/overrideParseStoresSpec.d.ts +0 -0
- /package/dist/{types → modern}/performInitialSync.d.ts +0 -0
- /package/dist/{types → modern}/permissions.d.ts +0 -0
- /package/dist/{types → modern}/prodLog.d.ts +0 -0
- /package/dist/{types → modern}/service-worker.d.ts +0 -0
- /package/dist/{types → modern}/sync/LocalSyncWorker.d.ts +0 -0
- /package/dist/{types → modern}/sync/SyncRequiredError.d.ts +0 -0
- /package/dist/{types → modern}/sync/applyServerChanges.d.ts +0 -0
- /package/dist/{types → modern}/sync/connectWebSocket.d.ts +0 -0
- /package/dist/{types → modern}/sync/encodeIdsForServer.d.ts +0 -0
- /package/dist/{types → modern}/sync/extractRealm.d.ts +0 -0
- /package/dist/{types → modern}/sync/getLatestRevisionsPerTable.d.ts +0 -0
- /package/dist/{types → modern}/sync/getTablesToSyncify.d.ts +0 -0
- /package/dist/{types → modern}/sync/isOnline.d.ts +0 -0
- /package/dist/{types → modern}/sync/isSyncNeeded.d.ts +0 -0
- /package/dist/{types → modern}/sync/listClientChanges.d.ts +0 -0
- /package/dist/{types → modern}/sync/listSyncifiedChanges.d.ts +0 -0
- /package/dist/{types → modern}/sync/messageConsumerIsReady.d.ts +0 -0
- /package/dist/{types → modern}/sync/messagesFromServerQueue.d.ts +0 -0
- /package/dist/{types → modern}/sync/modifyLocalObjectsWithNewUserId.d.ts +0 -0
- /package/dist/{types → modern}/sync/myId.d.ts +0 -0
- /package/dist/{types → modern}/sync/numUnsyncedMutations.d.ts +0 -0
- /package/dist/{types → modern}/sync/old_startSyncingClientChanges.d.ts +0 -0
- /package/dist/{types → modern}/sync/performGuardedJob.d.ts +0 -0
- /package/dist/{types → modern}/sync/ratelimit.d.ts +0 -0
- /package/dist/{types → modern}/sync/registerSyncEvent.d.ts +0 -0
- /package/dist/{types → modern}/sync/sync.d.ts +0 -0
- /package/dist/{types → modern}/sync/syncIfPossible.d.ts +0 -0
- /package/dist/{types → modern}/sync/syncWithServer.d.ts +0 -0
- /package/dist/{types → modern}/sync/triggerSync.d.ts +0 -0
- /package/dist/{types → modern}/sync/updateBaseRevs.d.ts +0 -0
- /package/dist/{types → modern}/types/DXCAlert.d.ts +0 -0
- /package/dist/{types → modern}/types/DXCInputField.d.ts +0 -0
- /package/dist/{types → modern}/types/DXCUserInteraction.d.ts +0 -0
- /package/dist/{types → modern}/types/NewIdOptions.d.ts +0 -0
- /package/dist/{types → modern}/types/SWMessageEvent.d.ts +0 -0
- /package/dist/{types → modern}/types/SWSyncEvent.d.ts +0 -0
- /package/dist/{types → modern}/types/SyncState.d.ts +0 -0
- /package/dist/{types → modern}/types/TXExpandos.d.ts +0 -0
- /package/dist/{types → modern}/updateSchemaFromOptions.d.ts +0 -0
- /package/dist/{types → modern}/userIsActive.d.ts +0 -0
- /package/dist/{types → modern}/verifyConfig.d.ts +0 -0
- /package/dist/{types → modern}/verifySchema.d.ts +0 -0
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
* dexie-cloud-addom.js
|
|
3
|
+
* ==========================================================================
|
|
4
|
+
*
|
|
5
|
+
* Dexie addon that syncs IndexedDB with Dexie Cloud.
|
|
6
|
+
*
|
|
7
|
+
* By David Fahlander, david@dexie.org
|
|
8
|
+
*
|
|
9
|
+
* ==========================================================================
|
|
10
|
+
*
|
|
11
|
+
* Version 4.0.1-beta.49, Sat Oct 28 2023
|
|
12
|
+
*
|
|
13
|
+
* https://dexie.org
|
|
14
|
+
*
|
|
15
|
+
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
1
19
|
import Dexie, { cmp, liveQuery } from 'dexie';
|
|
2
|
-
import { Observable, BehaviorSubject, Subject, firstValueFrom, from, filter as filter$1,
|
|
3
|
-
import { filter, take, switchMap, delay, distinctUntilChanged, map, tap, catchError, debounceTime, startWith, skip } from 'rxjs/operators';
|
|
20
|
+
import { Observable as Observable$1, BehaviorSubject, Subject, firstValueFrom, from as from$1, filter as filter$1, fromEvent, of, merge, Subscription as Subscription$1, throwError, combineLatest, map as map$1, share, timer as timer$1 } from 'rxjs';
|
|
4
21
|
|
|
5
22
|
/******************************************************************************
|
|
6
23
|
Copyright (c) Microsoft Corporation.
|
|
@@ -16,6 +33,22 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
16
33
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
34
|
PERFORMANCE OF THIS SOFTWARE.
|
|
18
35
|
***************************************************************************** */
|
|
36
|
+
/* global Reflect, Promise */
|
|
37
|
+
|
|
38
|
+
var extendStatics = function(d, b) {
|
|
39
|
+
extendStatics = Object.setPrototypeOf ||
|
|
40
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
41
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
42
|
+
return extendStatics(d, b);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function __extends(d, b) {
|
|
46
|
+
if (typeof b !== "function" && b !== null)
|
|
47
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
48
|
+
extendStatics(d, b);
|
|
49
|
+
function __() { this.constructor = d; }
|
|
50
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51
|
+
}
|
|
19
52
|
|
|
20
53
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
21
54
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -25,6 +58,97 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
25
58
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
59
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
60
|
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function __generator(thisArg, body) {
|
|
64
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
65
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
66
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
67
|
+
function step(op) {
|
|
68
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
69
|
+
while (_) try {
|
|
70
|
+
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;
|
|
71
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
72
|
+
switch (op[0]) {
|
|
73
|
+
case 0: case 1: t = op; break;
|
|
74
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
75
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
76
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
77
|
+
default:
|
|
78
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
79
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
80
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
81
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
82
|
+
if (t[2]) _.ops.pop();
|
|
83
|
+
_.trys.pop(); continue;
|
|
84
|
+
}
|
|
85
|
+
op = body.call(thisArg, _);
|
|
86
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
87
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function __values(o) {
|
|
92
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
93
|
+
if (m) return m.call(o);
|
|
94
|
+
if (o && typeof o.length === "number") return {
|
|
95
|
+
next: function () {
|
|
96
|
+
if (o && i >= o.length) o = void 0;
|
|
97
|
+
return { value: o && o[i++], done: !o };
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function __read(o, n) {
|
|
104
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
105
|
+
if (!m) return o;
|
|
106
|
+
var i = m.call(o), r, ar = [], e;
|
|
107
|
+
try {
|
|
108
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
109
|
+
}
|
|
110
|
+
catch (error) { e = { error: error }; }
|
|
111
|
+
finally {
|
|
112
|
+
try {
|
|
113
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
114
|
+
}
|
|
115
|
+
finally { if (e) throw e.error; }
|
|
116
|
+
}
|
|
117
|
+
return ar;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function __spreadArray(to, from, pack) {
|
|
121
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
122
|
+
if (ar || !(i in from)) {
|
|
123
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
124
|
+
ar[i] = from[i];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function __await(v) {
|
|
131
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
135
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
136
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
137
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
138
|
+
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); }); }; }
|
|
139
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
140
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
141
|
+
function fulfill(value) { resume("next", value); }
|
|
142
|
+
function reject(value) { resume("throw", value); }
|
|
143
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function __asyncValues(o) {
|
|
147
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
148
|
+
var m = o[Symbol.asyncIterator], i;
|
|
149
|
+
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);
|
|
150
|
+
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); }); }; }
|
|
151
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
28
152
|
}
|
|
29
153
|
|
|
30
154
|
const UNAUTHORIZED_USER = {
|
|
@@ -127,7 +251,7 @@ function dispatch(ev) {
|
|
|
127
251
|
});
|
|
128
252
|
}
|
|
129
253
|
}
|
|
130
|
-
class BroadcastedAndLocalEvent extends Observable {
|
|
254
|
+
class BroadcastedAndLocalEvent extends Observable$1 {
|
|
131
255
|
constructor(name) {
|
|
132
256
|
const bc = typeof BroadcastChannel === "undefined"
|
|
133
257
|
? new SWBroadcastChannel(name) : new BroadcastChannel(name);
|
|
@@ -178,6 +302,1424 @@ class BroadcastedAndLocalEvent extends Observable {
|
|
|
178
302
|
}
|
|
179
303
|
}
|
|
180
304
|
|
|
305
|
+
function isFunction(value) {
|
|
306
|
+
return typeof value === 'function';
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function hasLift(source) {
|
|
310
|
+
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
311
|
+
}
|
|
312
|
+
function operate(init) {
|
|
313
|
+
return function (source) {
|
|
314
|
+
if (hasLift(source)) {
|
|
315
|
+
return source.lift(function (liftedSource) {
|
|
316
|
+
try {
|
|
317
|
+
return init(liftedSource, this);
|
|
318
|
+
}
|
|
319
|
+
catch (err) {
|
|
320
|
+
this.error(err);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
throw new TypeError('Unable to lift unknown Observable type');
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
329
|
+
|
|
330
|
+
function isPromise(value) {
|
|
331
|
+
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function createErrorClass(createImpl) {
|
|
335
|
+
var _super = function (instance) {
|
|
336
|
+
Error.call(instance);
|
|
337
|
+
instance.stack = new Error().stack;
|
|
338
|
+
};
|
|
339
|
+
var ctorFunc = createImpl(_super);
|
|
340
|
+
ctorFunc.prototype = Object.create(Error.prototype);
|
|
341
|
+
ctorFunc.prototype.constructor = ctorFunc;
|
|
342
|
+
return ctorFunc;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
346
|
+
return function UnsubscriptionErrorImpl(errors) {
|
|
347
|
+
_super(this);
|
|
348
|
+
this.message = errors
|
|
349
|
+
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
350
|
+
: '';
|
|
351
|
+
this.name = 'UnsubscriptionError';
|
|
352
|
+
this.errors = errors;
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
function arrRemove(arr, item) {
|
|
357
|
+
if (arr) {
|
|
358
|
+
var index = arr.indexOf(item);
|
|
359
|
+
0 <= index && arr.splice(index, 1);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
var Subscription = (function () {
|
|
364
|
+
function Subscription(initialTeardown) {
|
|
365
|
+
this.initialTeardown = initialTeardown;
|
|
366
|
+
this.closed = false;
|
|
367
|
+
this._parentage = null;
|
|
368
|
+
this._finalizers = null;
|
|
369
|
+
}
|
|
370
|
+
Subscription.prototype.unsubscribe = function () {
|
|
371
|
+
var e_1, _a, e_2, _b;
|
|
372
|
+
var errors;
|
|
373
|
+
if (!this.closed) {
|
|
374
|
+
this.closed = true;
|
|
375
|
+
var _parentage = this._parentage;
|
|
376
|
+
if (_parentage) {
|
|
377
|
+
this._parentage = null;
|
|
378
|
+
if (Array.isArray(_parentage)) {
|
|
379
|
+
try {
|
|
380
|
+
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
381
|
+
var parent_1 = _parentage_1_1.value;
|
|
382
|
+
parent_1.remove(this);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
386
|
+
finally {
|
|
387
|
+
try {
|
|
388
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
389
|
+
}
|
|
390
|
+
finally { if (e_1) throw e_1.error; }
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
_parentage.remove(this);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
var initialFinalizer = this.initialTeardown;
|
|
398
|
+
if (isFunction(initialFinalizer)) {
|
|
399
|
+
try {
|
|
400
|
+
initialFinalizer();
|
|
401
|
+
}
|
|
402
|
+
catch (e) {
|
|
403
|
+
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
var _finalizers = this._finalizers;
|
|
407
|
+
if (_finalizers) {
|
|
408
|
+
this._finalizers = null;
|
|
409
|
+
try {
|
|
410
|
+
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
411
|
+
var finalizer = _finalizers_1_1.value;
|
|
412
|
+
try {
|
|
413
|
+
execFinalizer(finalizer);
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
417
|
+
if (err instanceof UnsubscriptionError) {
|
|
418
|
+
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
errors.push(err);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
427
|
+
finally {
|
|
428
|
+
try {
|
|
429
|
+
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
430
|
+
}
|
|
431
|
+
finally { if (e_2) throw e_2.error; }
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (errors) {
|
|
435
|
+
throw new UnsubscriptionError(errors);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
Subscription.prototype.add = function (teardown) {
|
|
440
|
+
var _a;
|
|
441
|
+
if (teardown && teardown !== this) {
|
|
442
|
+
if (this.closed) {
|
|
443
|
+
execFinalizer(teardown);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
if (teardown instanceof Subscription) {
|
|
447
|
+
if (teardown.closed || teardown._hasParent(this)) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
teardown._addParent(this);
|
|
451
|
+
}
|
|
452
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
Subscription.prototype._hasParent = function (parent) {
|
|
457
|
+
var _parentage = this._parentage;
|
|
458
|
+
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
459
|
+
};
|
|
460
|
+
Subscription.prototype._addParent = function (parent) {
|
|
461
|
+
var _parentage = this._parentage;
|
|
462
|
+
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
463
|
+
};
|
|
464
|
+
Subscription.prototype._removeParent = function (parent) {
|
|
465
|
+
var _parentage = this._parentage;
|
|
466
|
+
if (_parentage === parent) {
|
|
467
|
+
this._parentage = null;
|
|
468
|
+
}
|
|
469
|
+
else if (Array.isArray(_parentage)) {
|
|
470
|
+
arrRemove(_parentage, parent);
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
Subscription.prototype.remove = function (teardown) {
|
|
474
|
+
var _finalizers = this._finalizers;
|
|
475
|
+
_finalizers && arrRemove(_finalizers, teardown);
|
|
476
|
+
if (teardown instanceof Subscription) {
|
|
477
|
+
teardown._removeParent(this);
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
Subscription.EMPTY = (function () {
|
|
481
|
+
var empty = new Subscription();
|
|
482
|
+
empty.closed = true;
|
|
483
|
+
return empty;
|
|
484
|
+
})();
|
|
485
|
+
return Subscription;
|
|
486
|
+
}());
|
|
487
|
+
Subscription.EMPTY;
|
|
488
|
+
function isSubscription(value) {
|
|
489
|
+
return (value instanceof Subscription ||
|
|
490
|
+
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
491
|
+
}
|
|
492
|
+
function execFinalizer(finalizer) {
|
|
493
|
+
if (isFunction(finalizer)) {
|
|
494
|
+
finalizer();
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
finalizer.unsubscribe();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
var config = {
|
|
502
|
+
onUnhandledError: null,
|
|
503
|
+
onStoppedNotification: null,
|
|
504
|
+
Promise: undefined,
|
|
505
|
+
useDeprecatedSynchronousErrorHandling: false,
|
|
506
|
+
useDeprecatedNextContext: false,
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
var timeoutProvider = {
|
|
510
|
+
setTimeout: function (handler, timeout) {
|
|
511
|
+
var args = [];
|
|
512
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
513
|
+
args[_i - 2] = arguments[_i];
|
|
514
|
+
}
|
|
515
|
+
var delegate = timeoutProvider.delegate;
|
|
516
|
+
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
517
|
+
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
518
|
+
}
|
|
519
|
+
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
520
|
+
},
|
|
521
|
+
clearTimeout: function (handle) {
|
|
522
|
+
var delegate = timeoutProvider.delegate;
|
|
523
|
+
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
524
|
+
},
|
|
525
|
+
delegate: undefined,
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
function reportUnhandledError(err) {
|
|
529
|
+
timeoutProvider.setTimeout(function () {
|
|
530
|
+
{
|
|
531
|
+
throw err;
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function noop() { }
|
|
537
|
+
|
|
538
|
+
function errorContext(cb) {
|
|
539
|
+
{
|
|
540
|
+
cb();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
var Subscriber = (function (_super) {
|
|
545
|
+
__extends(Subscriber, _super);
|
|
546
|
+
function Subscriber(destination) {
|
|
547
|
+
var _this = _super.call(this) || this;
|
|
548
|
+
_this.isStopped = false;
|
|
549
|
+
if (destination) {
|
|
550
|
+
_this.destination = destination;
|
|
551
|
+
if (isSubscription(destination)) {
|
|
552
|
+
destination.add(_this);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
_this.destination = EMPTY_OBSERVER;
|
|
557
|
+
}
|
|
558
|
+
return _this;
|
|
559
|
+
}
|
|
560
|
+
Subscriber.create = function (next, error, complete) {
|
|
561
|
+
return new SafeSubscriber(next, error, complete);
|
|
562
|
+
};
|
|
563
|
+
Subscriber.prototype.next = function (value) {
|
|
564
|
+
if (this.isStopped) ;
|
|
565
|
+
else {
|
|
566
|
+
this._next(value);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
Subscriber.prototype.error = function (err) {
|
|
570
|
+
if (this.isStopped) ;
|
|
571
|
+
else {
|
|
572
|
+
this.isStopped = true;
|
|
573
|
+
this._error(err);
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
Subscriber.prototype.complete = function () {
|
|
577
|
+
if (this.isStopped) ;
|
|
578
|
+
else {
|
|
579
|
+
this.isStopped = true;
|
|
580
|
+
this._complete();
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
Subscriber.prototype.unsubscribe = function () {
|
|
584
|
+
if (!this.closed) {
|
|
585
|
+
this.isStopped = true;
|
|
586
|
+
_super.prototype.unsubscribe.call(this);
|
|
587
|
+
this.destination = null;
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
Subscriber.prototype._next = function (value) {
|
|
591
|
+
this.destination.next(value);
|
|
592
|
+
};
|
|
593
|
+
Subscriber.prototype._error = function (err) {
|
|
594
|
+
try {
|
|
595
|
+
this.destination.error(err);
|
|
596
|
+
}
|
|
597
|
+
finally {
|
|
598
|
+
this.unsubscribe();
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
Subscriber.prototype._complete = function () {
|
|
602
|
+
try {
|
|
603
|
+
this.destination.complete();
|
|
604
|
+
}
|
|
605
|
+
finally {
|
|
606
|
+
this.unsubscribe();
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
return Subscriber;
|
|
610
|
+
}(Subscription));
|
|
611
|
+
var _bind = Function.prototype.bind;
|
|
612
|
+
function bind(fn, thisArg) {
|
|
613
|
+
return _bind.call(fn, thisArg);
|
|
614
|
+
}
|
|
615
|
+
var ConsumerObserver = (function () {
|
|
616
|
+
function ConsumerObserver(partialObserver) {
|
|
617
|
+
this.partialObserver = partialObserver;
|
|
618
|
+
}
|
|
619
|
+
ConsumerObserver.prototype.next = function (value) {
|
|
620
|
+
var partialObserver = this.partialObserver;
|
|
621
|
+
if (partialObserver.next) {
|
|
622
|
+
try {
|
|
623
|
+
partialObserver.next(value);
|
|
624
|
+
}
|
|
625
|
+
catch (error) {
|
|
626
|
+
handleUnhandledError(error);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
ConsumerObserver.prototype.error = function (err) {
|
|
631
|
+
var partialObserver = this.partialObserver;
|
|
632
|
+
if (partialObserver.error) {
|
|
633
|
+
try {
|
|
634
|
+
partialObserver.error(err);
|
|
635
|
+
}
|
|
636
|
+
catch (error) {
|
|
637
|
+
handleUnhandledError(error);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
handleUnhandledError(err);
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
ConsumerObserver.prototype.complete = function () {
|
|
645
|
+
var partialObserver = this.partialObserver;
|
|
646
|
+
if (partialObserver.complete) {
|
|
647
|
+
try {
|
|
648
|
+
partialObserver.complete();
|
|
649
|
+
}
|
|
650
|
+
catch (error) {
|
|
651
|
+
handleUnhandledError(error);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
return ConsumerObserver;
|
|
656
|
+
}());
|
|
657
|
+
var SafeSubscriber = (function (_super) {
|
|
658
|
+
__extends(SafeSubscriber, _super);
|
|
659
|
+
function SafeSubscriber(observerOrNext, error, complete) {
|
|
660
|
+
var _this = _super.call(this) || this;
|
|
661
|
+
var partialObserver;
|
|
662
|
+
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
663
|
+
partialObserver = {
|
|
664
|
+
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
665
|
+
error: error !== null && error !== void 0 ? error : undefined,
|
|
666
|
+
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
var context_1;
|
|
671
|
+
if (_this && config.useDeprecatedNextContext) {
|
|
672
|
+
context_1 = Object.create(observerOrNext);
|
|
673
|
+
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
674
|
+
partialObserver = {
|
|
675
|
+
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
676
|
+
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
677
|
+
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
partialObserver = observerOrNext;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
_this.destination = new ConsumerObserver(partialObserver);
|
|
685
|
+
return _this;
|
|
686
|
+
}
|
|
687
|
+
return SafeSubscriber;
|
|
688
|
+
}(Subscriber));
|
|
689
|
+
function handleUnhandledError(error) {
|
|
690
|
+
{
|
|
691
|
+
reportUnhandledError(error);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
function defaultErrorHandler(err) {
|
|
695
|
+
throw err;
|
|
696
|
+
}
|
|
697
|
+
var EMPTY_OBSERVER = {
|
|
698
|
+
closed: true,
|
|
699
|
+
next: noop,
|
|
700
|
+
error: defaultErrorHandler,
|
|
701
|
+
complete: noop,
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
705
|
+
|
|
706
|
+
function identity(x) {
|
|
707
|
+
return x;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
function pipeFromArray(fns) {
|
|
711
|
+
if (fns.length === 0) {
|
|
712
|
+
return identity;
|
|
713
|
+
}
|
|
714
|
+
if (fns.length === 1) {
|
|
715
|
+
return fns[0];
|
|
716
|
+
}
|
|
717
|
+
return function piped(input) {
|
|
718
|
+
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
var Observable = (function () {
|
|
723
|
+
function Observable(subscribe) {
|
|
724
|
+
if (subscribe) {
|
|
725
|
+
this._subscribe = subscribe;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
Observable.prototype.lift = function (operator) {
|
|
729
|
+
var observable = new Observable();
|
|
730
|
+
observable.source = this;
|
|
731
|
+
observable.operator = operator;
|
|
732
|
+
return observable;
|
|
733
|
+
};
|
|
734
|
+
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
735
|
+
var _this = this;
|
|
736
|
+
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
737
|
+
errorContext(function () {
|
|
738
|
+
var _a = _this, operator = _a.operator, source = _a.source;
|
|
739
|
+
subscriber.add(operator
|
|
740
|
+
?
|
|
741
|
+
operator.call(subscriber, source)
|
|
742
|
+
: source
|
|
743
|
+
?
|
|
744
|
+
_this._subscribe(subscriber)
|
|
745
|
+
:
|
|
746
|
+
_this._trySubscribe(subscriber));
|
|
747
|
+
});
|
|
748
|
+
return subscriber;
|
|
749
|
+
};
|
|
750
|
+
Observable.prototype._trySubscribe = function (sink) {
|
|
751
|
+
try {
|
|
752
|
+
return this._subscribe(sink);
|
|
753
|
+
}
|
|
754
|
+
catch (err) {
|
|
755
|
+
sink.error(err);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
759
|
+
var _this = this;
|
|
760
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
761
|
+
return new promiseCtor(function (resolve, reject) {
|
|
762
|
+
var subscriber = new SafeSubscriber({
|
|
763
|
+
next: function (value) {
|
|
764
|
+
try {
|
|
765
|
+
next(value);
|
|
766
|
+
}
|
|
767
|
+
catch (err) {
|
|
768
|
+
reject(err);
|
|
769
|
+
subscriber.unsubscribe();
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
error: reject,
|
|
773
|
+
complete: resolve,
|
|
774
|
+
});
|
|
775
|
+
_this.subscribe(subscriber);
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
Observable.prototype._subscribe = function (subscriber) {
|
|
779
|
+
var _a;
|
|
780
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
781
|
+
};
|
|
782
|
+
Observable.prototype[observable] = function () {
|
|
783
|
+
return this;
|
|
784
|
+
};
|
|
785
|
+
Observable.prototype.pipe = function () {
|
|
786
|
+
var operations = [];
|
|
787
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
788
|
+
operations[_i] = arguments[_i];
|
|
789
|
+
}
|
|
790
|
+
return pipeFromArray(operations)(this);
|
|
791
|
+
};
|
|
792
|
+
Observable.prototype.toPromise = function (promiseCtor) {
|
|
793
|
+
var _this = this;
|
|
794
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
795
|
+
return new promiseCtor(function (resolve, reject) {
|
|
796
|
+
var value;
|
|
797
|
+
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
798
|
+
});
|
|
799
|
+
};
|
|
800
|
+
Observable.create = function (subscribe) {
|
|
801
|
+
return new Observable(subscribe);
|
|
802
|
+
};
|
|
803
|
+
return Observable;
|
|
804
|
+
}());
|
|
805
|
+
function getPromiseCtor(promiseCtor) {
|
|
806
|
+
var _a;
|
|
807
|
+
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
808
|
+
}
|
|
809
|
+
function isObserver(value) {
|
|
810
|
+
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
811
|
+
}
|
|
812
|
+
function isSubscriber(value) {
|
|
813
|
+
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function isInteropObservable(input) {
|
|
817
|
+
return isFunction(input[observable]);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function isAsyncIterable(obj) {
|
|
821
|
+
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function createInvalidObservableTypeError(input) {
|
|
825
|
+
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.");
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function getSymbolIterator() {
|
|
829
|
+
if (typeof Symbol !== 'function' || !Symbol.iterator) {
|
|
830
|
+
return '@@iterator';
|
|
831
|
+
}
|
|
832
|
+
return Symbol.iterator;
|
|
833
|
+
}
|
|
834
|
+
var iterator = getSymbolIterator();
|
|
835
|
+
|
|
836
|
+
function isIterable(input) {
|
|
837
|
+
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
841
|
+
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
842
|
+
var reader, _a, value, done;
|
|
843
|
+
return __generator(this, function (_b) {
|
|
844
|
+
switch (_b.label) {
|
|
845
|
+
case 0:
|
|
846
|
+
reader = readableStream.getReader();
|
|
847
|
+
_b.label = 1;
|
|
848
|
+
case 1:
|
|
849
|
+
_b.trys.push([1, , 9, 10]);
|
|
850
|
+
_b.label = 2;
|
|
851
|
+
case 2:
|
|
852
|
+
return [4, __await(reader.read())];
|
|
853
|
+
case 3:
|
|
854
|
+
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
855
|
+
if (!done) return [3, 5];
|
|
856
|
+
return [4, __await(void 0)];
|
|
857
|
+
case 4: return [2, _b.sent()];
|
|
858
|
+
case 5: return [4, __await(value)];
|
|
859
|
+
case 6: return [4, _b.sent()];
|
|
860
|
+
case 7:
|
|
861
|
+
_b.sent();
|
|
862
|
+
return [3, 2];
|
|
863
|
+
case 8: return [3, 10];
|
|
864
|
+
case 9:
|
|
865
|
+
reader.releaseLock();
|
|
866
|
+
return [7];
|
|
867
|
+
case 10: return [2];
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
function isReadableStreamLike(obj) {
|
|
873
|
+
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function innerFrom(input) {
|
|
877
|
+
if (input instanceof Observable) {
|
|
878
|
+
return input;
|
|
879
|
+
}
|
|
880
|
+
if (input != null) {
|
|
881
|
+
if (isInteropObservable(input)) {
|
|
882
|
+
return fromInteropObservable(input);
|
|
883
|
+
}
|
|
884
|
+
if (isArrayLike(input)) {
|
|
885
|
+
return fromArrayLike(input);
|
|
886
|
+
}
|
|
887
|
+
if (isPromise(input)) {
|
|
888
|
+
return fromPromise(input);
|
|
889
|
+
}
|
|
890
|
+
if (isAsyncIterable(input)) {
|
|
891
|
+
return fromAsyncIterable(input);
|
|
892
|
+
}
|
|
893
|
+
if (isIterable(input)) {
|
|
894
|
+
return fromIterable(input);
|
|
895
|
+
}
|
|
896
|
+
if (isReadableStreamLike(input)) {
|
|
897
|
+
return fromReadableStreamLike(input);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
throw createInvalidObservableTypeError(input);
|
|
901
|
+
}
|
|
902
|
+
function fromInteropObservable(obj) {
|
|
903
|
+
return new Observable(function (subscriber) {
|
|
904
|
+
var obs = obj[observable]();
|
|
905
|
+
if (isFunction(obs.subscribe)) {
|
|
906
|
+
return obs.subscribe(subscriber);
|
|
907
|
+
}
|
|
908
|
+
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
function fromArrayLike(array) {
|
|
912
|
+
return new Observable(function (subscriber) {
|
|
913
|
+
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
914
|
+
subscriber.next(array[i]);
|
|
915
|
+
}
|
|
916
|
+
subscriber.complete();
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
function fromPromise(promise) {
|
|
920
|
+
return new Observable(function (subscriber) {
|
|
921
|
+
promise
|
|
922
|
+
.then(function (value) {
|
|
923
|
+
if (!subscriber.closed) {
|
|
924
|
+
subscriber.next(value);
|
|
925
|
+
subscriber.complete();
|
|
926
|
+
}
|
|
927
|
+
}, function (err) { return subscriber.error(err); })
|
|
928
|
+
.then(null, reportUnhandledError);
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
function fromIterable(iterable) {
|
|
932
|
+
return new Observable(function (subscriber) {
|
|
933
|
+
var e_1, _a;
|
|
934
|
+
try {
|
|
935
|
+
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
936
|
+
var value = iterable_1_1.value;
|
|
937
|
+
subscriber.next(value);
|
|
938
|
+
if (subscriber.closed) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
944
|
+
finally {
|
|
945
|
+
try {
|
|
946
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
|
|
947
|
+
}
|
|
948
|
+
finally { if (e_1) throw e_1.error; }
|
|
949
|
+
}
|
|
950
|
+
subscriber.complete();
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function fromAsyncIterable(asyncIterable) {
|
|
954
|
+
return new Observable(function (subscriber) {
|
|
955
|
+
process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function fromReadableStreamLike(readableStream) {
|
|
959
|
+
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
960
|
+
}
|
|
961
|
+
function process(asyncIterable, subscriber) {
|
|
962
|
+
var asyncIterable_1, asyncIterable_1_1;
|
|
963
|
+
var e_2, _a;
|
|
964
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
965
|
+
var value, e_2_1;
|
|
966
|
+
return __generator(this, function (_b) {
|
|
967
|
+
switch (_b.label) {
|
|
968
|
+
case 0:
|
|
969
|
+
_b.trys.push([0, 5, 6, 11]);
|
|
970
|
+
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
971
|
+
_b.label = 1;
|
|
972
|
+
case 1: return [4, asyncIterable_1.next()];
|
|
973
|
+
case 2:
|
|
974
|
+
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
975
|
+
value = asyncIterable_1_1.value;
|
|
976
|
+
subscriber.next(value);
|
|
977
|
+
if (subscriber.closed) {
|
|
978
|
+
return [2];
|
|
979
|
+
}
|
|
980
|
+
_b.label = 3;
|
|
981
|
+
case 3: return [3, 1];
|
|
982
|
+
case 4: return [3, 11];
|
|
983
|
+
case 5:
|
|
984
|
+
e_2_1 = _b.sent();
|
|
985
|
+
e_2 = { error: e_2_1 };
|
|
986
|
+
return [3, 11];
|
|
987
|
+
case 6:
|
|
988
|
+
_b.trys.push([6, , 9, 10]);
|
|
989
|
+
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
|
|
990
|
+
return [4, _a.call(asyncIterable_1)];
|
|
991
|
+
case 7:
|
|
992
|
+
_b.sent();
|
|
993
|
+
_b.label = 8;
|
|
994
|
+
case 8: return [3, 10];
|
|
995
|
+
case 9:
|
|
996
|
+
if (e_2) throw e_2.error;
|
|
997
|
+
return [7];
|
|
998
|
+
case 10: return [7];
|
|
999
|
+
case 11:
|
|
1000
|
+
subscriber.complete();
|
|
1001
|
+
return [2];
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
1008
|
+
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
1009
|
+
}
|
|
1010
|
+
var OperatorSubscriber = (function (_super) {
|
|
1011
|
+
__extends(OperatorSubscriber, _super);
|
|
1012
|
+
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
1013
|
+
var _this = _super.call(this, destination) || this;
|
|
1014
|
+
_this.onFinalize = onFinalize;
|
|
1015
|
+
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
1016
|
+
_this._next = onNext
|
|
1017
|
+
? function (value) {
|
|
1018
|
+
try {
|
|
1019
|
+
onNext(value);
|
|
1020
|
+
}
|
|
1021
|
+
catch (err) {
|
|
1022
|
+
destination.error(err);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
: _super.prototype._next;
|
|
1026
|
+
_this._error = onError
|
|
1027
|
+
? function (err) {
|
|
1028
|
+
try {
|
|
1029
|
+
onError(err);
|
|
1030
|
+
}
|
|
1031
|
+
catch (err) {
|
|
1032
|
+
destination.error(err);
|
|
1033
|
+
}
|
|
1034
|
+
finally {
|
|
1035
|
+
this.unsubscribe();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
: _super.prototype._error;
|
|
1039
|
+
_this._complete = onComplete
|
|
1040
|
+
? function () {
|
|
1041
|
+
try {
|
|
1042
|
+
onComplete();
|
|
1043
|
+
}
|
|
1044
|
+
catch (err) {
|
|
1045
|
+
destination.error(err);
|
|
1046
|
+
}
|
|
1047
|
+
finally {
|
|
1048
|
+
this.unsubscribe();
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
: _super.prototype._complete;
|
|
1052
|
+
return _this;
|
|
1053
|
+
}
|
|
1054
|
+
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
1055
|
+
var _a;
|
|
1056
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
1057
|
+
var closed_1 = this.closed;
|
|
1058
|
+
_super.prototype.unsubscribe.call(this);
|
|
1059
|
+
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
return OperatorSubscriber;
|
|
1063
|
+
}(Subscriber));
|
|
1064
|
+
|
|
1065
|
+
var Action = (function (_super) {
|
|
1066
|
+
__extends(Action, _super);
|
|
1067
|
+
function Action(scheduler, work) {
|
|
1068
|
+
return _super.call(this) || this;
|
|
1069
|
+
}
|
|
1070
|
+
Action.prototype.schedule = function (state, delay) {
|
|
1071
|
+
return this;
|
|
1072
|
+
};
|
|
1073
|
+
return Action;
|
|
1074
|
+
}(Subscription));
|
|
1075
|
+
|
|
1076
|
+
var intervalProvider = {
|
|
1077
|
+
setInterval: function (handler, timeout) {
|
|
1078
|
+
var args = [];
|
|
1079
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1080
|
+
args[_i - 2] = arguments[_i];
|
|
1081
|
+
}
|
|
1082
|
+
var delegate = intervalProvider.delegate;
|
|
1083
|
+
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
1084
|
+
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
1085
|
+
}
|
|
1086
|
+
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
1087
|
+
},
|
|
1088
|
+
clearInterval: function (handle) {
|
|
1089
|
+
var delegate = intervalProvider.delegate;
|
|
1090
|
+
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
|
|
1091
|
+
},
|
|
1092
|
+
delegate: undefined,
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
var AsyncAction = (function (_super) {
|
|
1096
|
+
__extends(AsyncAction, _super);
|
|
1097
|
+
function AsyncAction(scheduler, work) {
|
|
1098
|
+
var _this = _super.call(this, scheduler, work) || this;
|
|
1099
|
+
_this.scheduler = scheduler;
|
|
1100
|
+
_this.work = work;
|
|
1101
|
+
_this.pending = false;
|
|
1102
|
+
return _this;
|
|
1103
|
+
}
|
|
1104
|
+
AsyncAction.prototype.schedule = function (state, delay) {
|
|
1105
|
+
if (delay === void 0) { delay = 0; }
|
|
1106
|
+
if (this.closed) {
|
|
1107
|
+
return this;
|
|
1108
|
+
}
|
|
1109
|
+
this.state = state;
|
|
1110
|
+
var id = this.id;
|
|
1111
|
+
var scheduler = this.scheduler;
|
|
1112
|
+
if (id != null) {
|
|
1113
|
+
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
1114
|
+
}
|
|
1115
|
+
this.pending = true;
|
|
1116
|
+
this.delay = delay;
|
|
1117
|
+
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
|
1118
|
+
return this;
|
|
1119
|
+
};
|
|
1120
|
+
AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
|
|
1121
|
+
if (delay === void 0) { delay = 0; }
|
|
1122
|
+
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
1123
|
+
};
|
|
1124
|
+
AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
|
|
1125
|
+
if (delay === void 0) { delay = 0; }
|
|
1126
|
+
if (delay != null && this.delay === delay && this.pending === false) {
|
|
1127
|
+
return id;
|
|
1128
|
+
}
|
|
1129
|
+
intervalProvider.clearInterval(id);
|
|
1130
|
+
return undefined;
|
|
1131
|
+
};
|
|
1132
|
+
AsyncAction.prototype.execute = function (state, delay) {
|
|
1133
|
+
if (this.closed) {
|
|
1134
|
+
return new Error('executing a cancelled action');
|
|
1135
|
+
}
|
|
1136
|
+
this.pending = false;
|
|
1137
|
+
var error = this._execute(state, delay);
|
|
1138
|
+
if (error) {
|
|
1139
|
+
return error;
|
|
1140
|
+
}
|
|
1141
|
+
else if (this.pending === false && this.id != null) {
|
|
1142
|
+
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
AsyncAction.prototype._execute = function (state, _delay) {
|
|
1146
|
+
var errored = false;
|
|
1147
|
+
var errorValue;
|
|
1148
|
+
try {
|
|
1149
|
+
this.work(state);
|
|
1150
|
+
}
|
|
1151
|
+
catch (e) {
|
|
1152
|
+
errored = true;
|
|
1153
|
+
errorValue = e ? e : new Error('Scheduled action threw falsy error');
|
|
1154
|
+
}
|
|
1155
|
+
if (errored) {
|
|
1156
|
+
this.unsubscribe();
|
|
1157
|
+
return errorValue;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
AsyncAction.prototype.unsubscribe = function () {
|
|
1161
|
+
if (!this.closed) {
|
|
1162
|
+
var _a = this, id = _a.id, scheduler = _a.scheduler;
|
|
1163
|
+
var actions = scheduler.actions;
|
|
1164
|
+
this.work = this.state = this.scheduler = null;
|
|
1165
|
+
this.pending = false;
|
|
1166
|
+
arrRemove(actions, this);
|
|
1167
|
+
if (id != null) {
|
|
1168
|
+
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
1169
|
+
}
|
|
1170
|
+
this.delay = null;
|
|
1171
|
+
_super.prototype.unsubscribe.call(this);
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
return AsyncAction;
|
|
1175
|
+
}(Action));
|
|
1176
|
+
|
|
1177
|
+
var dateTimestampProvider = {
|
|
1178
|
+
now: function () {
|
|
1179
|
+
return (dateTimestampProvider.delegate || Date).now();
|
|
1180
|
+
},
|
|
1181
|
+
delegate: undefined,
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
var Scheduler = (function () {
|
|
1185
|
+
function Scheduler(schedulerActionCtor, now) {
|
|
1186
|
+
if (now === void 0) { now = Scheduler.now; }
|
|
1187
|
+
this.schedulerActionCtor = schedulerActionCtor;
|
|
1188
|
+
this.now = now;
|
|
1189
|
+
}
|
|
1190
|
+
Scheduler.prototype.schedule = function (work, delay, state) {
|
|
1191
|
+
if (delay === void 0) { delay = 0; }
|
|
1192
|
+
return new this.schedulerActionCtor(this, work).schedule(state, delay);
|
|
1193
|
+
};
|
|
1194
|
+
Scheduler.now = dateTimestampProvider.now;
|
|
1195
|
+
return Scheduler;
|
|
1196
|
+
}());
|
|
1197
|
+
|
|
1198
|
+
var AsyncScheduler = (function (_super) {
|
|
1199
|
+
__extends(AsyncScheduler, _super);
|
|
1200
|
+
function AsyncScheduler(SchedulerAction, now) {
|
|
1201
|
+
if (now === void 0) { now = Scheduler.now; }
|
|
1202
|
+
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1203
|
+
_this.actions = [];
|
|
1204
|
+
_this._active = false;
|
|
1205
|
+
_this._scheduled = undefined;
|
|
1206
|
+
return _this;
|
|
1207
|
+
}
|
|
1208
|
+
AsyncScheduler.prototype.flush = function (action) {
|
|
1209
|
+
var actions = this.actions;
|
|
1210
|
+
if (this._active) {
|
|
1211
|
+
actions.push(action);
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
var error;
|
|
1215
|
+
this._active = true;
|
|
1216
|
+
do {
|
|
1217
|
+
if ((error = action.execute(action.state, action.delay))) {
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
} while ((action = actions.shift()));
|
|
1221
|
+
this._active = false;
|
|
1222
|
+
if (error) {
|
|
1223
|
+
while ((action = actions.shift())) {
|
|
1224
|
+
action.unsubscribe();
|
|
1225
|
+
}
|
|
1226
|
+
throw error;
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
return AsyncScheduler;
|
|
1230
|
+
}(Scheduler));
|
|
1231
|
+
|
|
1232
|
+
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
1233
|
+
var async = asyncScheduler;
|
|
1234
|
+
|
|
1235
|
+
function isScheduler(value) {
|
|
1236
|
+
return value && isFunction(value.schedule);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
function isValidDate(value) {
|
|
1240
|
+
return value instanceof Date && !isNaN(value);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1244
|
+
if (dueTime === void 0) { dueTime = 0; }
|
|
1245
|
+
if (scheduler === void 0) { scheduler = async; }
|
|
1246
|
+
var intervalDuration = -1;
|
|
1247
|
+
if (intervalOrScheduler != null) {
|
|
1248
|
+
if (isScheduler(intervalOrScheduler)) {
|
|
1249
|
+
scheduler = intervalOrScheduler;
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
intervalDuration = intervalOrScheduler;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
return new Observable(function (subscriber) {
|
|
1256
|
+
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
1257
|
+
if (due < 0) {
|
|
1258
|
+
due = 0;
|
|
1259
|
+
}
|
|
1260
|
+
var n = 0;
|
|
1261
|
+
return scheduler.schedule(function () {
|
|
1262
|
+
if (!subscriber.closed) {
|
|
1263
|
+
subscriber.next(n++);
|
|
1264
|
+
if (0 <= intervalDuration) {
|
|
1265
|
+
this.schedule(undefined, intervalDuration);
|
|
1266
|
+
}
|
|
1267
|
+
else {
|
|
1268
|
+
subscriber.complete();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
}, due);
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
function last(arr) {
|
|
1276
|
+
return arr[arr.length - 1];
|
|
1277
|
+
}
|
|
1278
|
+
function popScheduler(args) {
|
|
1279
|
+
return isScheduler(last(args)) ? args.pop() : undefined;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
1283
|
+
if (delay === void 0) { delay = 0; }
|
|
1284
|
+
if (repeat === void 0) { repeat = false; }
|
|
1285
|
+
var scheduleSubscription = scheduler.schedule(function () {
|
|
1286
|
+
work();
|
|
1287
|
+
if (repeat) {
|
|
1288
|
+
parentSubscription.add(this.schedule(null, delay));
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
this.unsubscribe();
|
|
1292
|
+
}
|
|
1293
|
+
}, delay);
|
|
1294
|
+
parentSubscription.add(scheduleSubscription);
|
|
1295
|
+
if (!repeat) {
|
|
1296
|
+
return scheduleSubscription;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
function catchError(selector) {
|
|
1301
|
+
return operate(function (source, subscriber) {
|
|
1302
|
+
var innerSub = null;
|
|
1303
|
+
var syncUnsub = false;
|
|
1304
|
+
var handledResult;
|
|
1305
|
+
innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
|
|
1306
|
+
handledResult = innerFrom(selector(err, catchError(selector)(source)));
|
|
1307
|
+
if (innerSub) {
|
|
1308
|
+
innerSub.unsubscribe();
|
|
1309
|
+
innerSub = null;
|
|
1310
|
+
handledResult.subscribe(subscriber);
|
|
1311
|
+
}
|
|
1312
|
+
else {
|
|
1313
|
+
syncUnsub = true;
|
|
1314
|
+
}
|
|
1315
|
+
}));
|
|
1316
|
+
if (syncUnsub) {
|
|
1317
|
+
innerSub.unsubscribe();
|
|
1318
|
+
innerSub = null;
|
|
1319
|
+
handledResult.subscribe(subscriber);
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
function observeOn(scheduler, delay) {
|
|
1325
|
+
if (delay === void 0) { delay = 0; }
|
|
1326
|
+
return operate(function (source, subscriber) {
|
|
1327
|
+
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); }));
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
function subscribeOn(scheduler, delay) {
|
|
1332
|
+
if (delay === void 0) { delay = 0; }
|
|
1333
|
+
return operate(function (source, subscriber) {
|
|
1334
|
+
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
function scheduleObservable(input, scheduler) {
|
|
1339
|
+
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
function schedulePromise(input, scheduler) {
|
|
1343
|
+
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
function scheduleArray(input, scheduler) {
|
|
1347
|
+
return new Observable(function (subscriber) {
|
|
1348
|
+
var i = 0;
|
|
1349
|
+
return scheduler.schedule(function () {
|
|
1350
|
+
if (i === input.length) {
|
|
1351
|
+
subscriber.complete();
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
subscriber.next(input[i++]);
|
|
1355
|
+
if (!subscriber.closed) {
|
|
1356
|
+
this.schedule();
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
function scheduleIterable(input, scheduler) {
|
|
1364
|
+
return new Observable(function (subscriber) {
|
|
1365
|
+
var iterator$1;
|
|
1366
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
1367
|
+
iterator$1 = input[iterator]();
|
|
1368
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
1369
|
+
var _a;
|
|
1370
|
+
var value;
|
|
1371
|
+
var done;
|
|
1372
|
+
try {
|
|
1373
|
+
(_a = iterator$1.next(), value = _a.value, done = _a.done);
|
|
1374
|
+
}
|
|
1375
|
+
catch (err) {
|
|
1376
|
+
subscriber.error(err);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
if (done) {
|
|
1380
|
+
subscriber.complete();
|
|
1381
|
+
}
|
|
1382
|
+
else {
|
|
1383
|
+
subscriber.next(value);
|
|
1384
|
+
}
|
|
1385
|
+
}, 0, true);
|
|
1386
|
+
});
|
|
1387
|
+
return function () { return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
function scheduleAsyncIterable(input, scheduler) {
|
|
1392
|
+
if (!input) {
|
|
1393
|
+
throw new Error('Iterable cannot be null');
|
|
1394
|
+
}
|
|
1395
|
+
return new Observable(function (subscriber) {
|
|
1396
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
1397
|
+
var iterator = input[Symbol.asyncIterator]();
|
|
1398
|
+
executeSchedule(subscriber, scheduler, function () {
|
|
1399
|
+
iterator.next().then(function (result) {
|
|
1400
|
+
if (result.done) {
|
|
1401
|
+
subscriber.complete();
|
|
1402
|
+
}
|
|
1403
|
+
else {
|
|
1404
|
+
subscriber.next(result.value);
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
}, 0, true);
|
|
1408
|
+
});
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
function scheduleReadableStreamLike(input, scheduler) {
|
|
1413
|
+
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
function scheduled(input, scheduler) {
|
|
1417
|
+
if (input != null) {
|
|
1418
|
+
if (isInteropObservable(input)) {
|
|
1419
|
+
return scheduleObservable(input, scheduler);
|
|
1420
|
+
}
|
|
1421
|
+
if (isArrayLike(input)) {
|
|
1422
|
+
return scheduleArray(input, scheduler);
|
|
1423
|
+
}
|
|
1424
|
+
if (isPromise(input)) {
|
|
1425
|
+
return schedulePromise(input, scheduler);
|
|
1426
|
+
}
|
|
1427
|
+
if (isAsyncIterable(input)) {
|
|
1428
|
+
return scheduleAsyncIterable(input, scheduler);
|
|
1429
|
+
}
|
|
1430
|
+
if (isIterable(input)) {
|
|
1431
|
+
return scheduleIterable(input, scheduler);
|
|
1432
|
+
}
|
|
1433
|
+
if (isReadableStreamLike(input)) {
|
|
1434
|
+
return scheduleReadableStreamLike(input, scheduler);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
throw createInvalidObservableTypeError(input);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
function from(input, scheduler) {
|
|
1441
|
+
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function map(project, thisArg) {
|
|
1445
|
+
return operate(function (source, subscriber) {
|
|
1446
|
+
var index = 0;
|
|
1447
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1448
|
+
subscriber.next(project.call(thisArg, value, index++));
|
|
1449
|
+
}));
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
1454
|
+
var buffer = [];
|
|
1455
|
+
var active = 0;
|
|
1456
|
+
var index = 0;
|
|
1457
|
+
var isComplete = false;
|
|
1458
|
+
var checkComplete = function () {
|
|
1459
|
+
if (isComplete && !buffer.length && !active) {
|
|
1460
|
+
subscriber.complete();
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
|
|
1464
|
+
var doInnerSub = function (value) {
|
|
1465
|
+
expand && subscriber.next(value);
|
|
1466
|
+
active++;
|
|
1467
|
+
var innerComplete = false;
|
|
1468
|
+
innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
|
|
1469
|
+
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
1470
|
+
if (expand) {
|
|
1471
|
+
outerNext(innerValue);
|
|
1472
|
+
}
|
|
1473
|
+
else {
|
|
1474
|
+
subscriber.next(innerValue);
|
|
1475
|
+
}
|
|
1476
|
+
}, function () {
|
|
1477
|
+
innerComplete = true;
|
|
1478
|
+
}, undefined, function () {
|
|
1479
|
+
if (innerComplete) {
|
|
1480
|
+
try {
|
|
1481
|
+
active--;
|
|
1482
|
+
var _loop_1 = function () {
|
|
1483
|
+
var bufferedValue = buffer.shift();
|
|
1484
|
+
if (innerSubScheduler) {
|
|
1485
|
+
executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
doInnerSub(bufferedValue);
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
while (buffer.length && active < concurrent) {
|
|
1492
|
+
_loop_1();
|
|
1493
|
+
}
|
|
1494
|
+
checkComplete();
|
|
1495
|
+
}
|
|
1496
|
+
catch (err) {
|
|
1497
|
+
subscriber.error(err);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}));
|
|
1501
|
+
};
|
|
1502
|
+
source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
|
|
1503
|
+
isComplete = true;
|
|
1504
|
+
checkComplete();
|
|
1505
|
+
}));
|
|
1506
|
+
return function () {
|
|
1507
|
+
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
function mergeMap(project, resultSelector, concurrent) {
|
|
1512
|
+
if (concurrent === void 0) { concurrent = Infinity; }
|
|
1513
|
+
if (isFunction(resultSelector)) {
|
|
1514
|
+
return mergeMap(function (a, i) { return map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
|
|
1515
|
+
}
|
|
1516
|
+
else if (typeof resultSelector === 'number') {
|
|
1517
|
+
concurrent = resultSelector;
|
|
1518
|
+
}
|
|
1519
|
+
return operate(function (source, subscriber) { return mergeInternals(source, subscriber, project, concurrent); });
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
function mergeAll(concurrent) {
|
|
1523
|
+
if (concurrent === void 0) { concurrent = Infinity; }
|
|
1524
|
+
return mergeMap(identity, concurrent);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
function concatAll() {
|
|
1528
|
+
return mergeAll(1);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
function debounceTime(dueTime, scheduler) {
|
|
1532
|
+
if (scheduler === void 0) { scheduler = asyncScheduler; }
|
|
1533
|
+
return operate(function (source, subscriber) {
|
|
1534
|
+
var activeTask = null;
|
|
1535
|
+
var lastValue = null;
|
|
1536
|
+
var lastTime = null;
|
|
1537
|
+
var emit = function () {
|
|
1538
|
+
if (activeTask) {
|
|
1539
|
+
activeTask.unsubscribe();
|
|
1540
|
+
activeTask = null;
|
|
1541
|
+
var value = lastValue;
|
|
1542
|
+
lastValue = null;
|
|
1543
|
+
subscriber.next(value);
|
|
1544
|
+
}
|
|
1545
|
+
};
|
|
1546
|
+
function emitWhenIdle() {
|
|
1547
|
+
var targetTime = lastTime + dueTime;
|
|
1548
|
+
var now = scheduler.now();
|
|
1549
|
+
if (now < targetTime) {
|
|
1550
|
+
activeTask = this.schedule(undefined, targetTime - now);
|
|
1551
|
+
subscriber.add(activeTask);
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
emit();
|
|
1555
|
+
}
|
|
1556
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1557
|
+
lastValue = value;
|
|
1558
|
+
lastTime = scheduler.now();
|
|
1559
|
+
if (!activeTask) {
|
|
1560
|
+
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1561
|
+
subscriber.add(activeTask);
|
|
1562
|
+
}
|
|
1563
|
+
}, function () {
|
|
1564
|
+
emit();
|
|
1565
|
+
subscriber.complete();
|
|
1566
|
+
}, undefined, function () {
|
|
1567
|
+
lastValue = activeTask = null;
|
|
1568
|
+
}));
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
function concat$1() {
|
|
1573
|
+
var args = [];
|
|
1574
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1575
|
+
args[_i] = arguments[_i];
|
|
1576
|
+
}
|
|
1577
|
+
return concatAll()(from(args, popScheduler(args)));
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
|
|
1581
|
+
|
|
1582
|
+
function take(count) {
|
|
1583
|
+
return count <= 0
|
|
1584
|
+
?
|
|
1585
|
+
function () { return EMPTY; }
|
|
1586
|
+
: operate(function (source, subscriber) {
|
|
1587
|
+
var seen = 0;
|
|
1588
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1589
|
+
if (++seen <= count) {
|
|
1590
|
+
subscriber.next(value);
|
|
1591
|
+
if (count <= seen) {
|
|
1592
|
+
subscriber.complete();
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}));
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function ignoreElements() {
|
|
1600
|
+
return operate(function (source, subscriber) {
|
|
1601
|
+
source.subscribe(createOperatorSubscriber(subscriber, noop));
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
function mapTo(value) {
|
|
1606
|
+
return map(function () { return value; });
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
1610
|
+
if (subscriptionDelay) {
|
|
1611
|
+
return function (source) {
|
|
1612
|
+
return concat$1(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
function delay(due, scheduler) {
|
|
1619
|
+
if (scheduler === void 0) { scheduler = asyncScheduler; }
|
|
1620
|
+
var duration = timer(due, scheduler);
|
|
1621
|
+
return delayWhen(function () { return duration; });
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
function distinctUntilChanged(comparator, keySelector) {
|
|
1625
|
+
if (keySelector === void 0) { keySelector = identity; }
|
|
1626
|
+
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
1627
|
+
return operate(function (source, subscriber) {
|
|
1628
|
+
var previousKey;
|
|
1629
|
+
var first = true;
|
|
1630
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1631
|
+
var currentKey = keySelector(value);
|
|
1632
|
+
if (first || !comparator(previousKey, currentKey)) {
|
|
1633
|
+
first = false;
|
|
1634
|
+
previousKey = currentKey;
|
|
1635
|
+
subscriber.next(value);
|
|
1636
|
+
}
|
|
1637
|
+
}));
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
function defaultCompare(a, b) {
|
|
1641
|
+
return a === b;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
function filter(predicate, thisArg) {
|
|
1645
|
+
return operate(function (source, subscriber) {
|
|
1646
|
+
var index = 0;
|
|
1647
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
function skip(count) {
|
|
1652
|
+
return filter(function (_, index) { return count <= index; });
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
function startWith() {
|
|
1656
|
+
var values = [];
|
|
1657
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1658
|
+
values[_i] = arguments[_i];
|
|
1659
|
+
}
|
|
1660
|
+
var scheduler = popScheduler(values);
|
|
1661
|
+
return operate(function (source, subscriber) {
|
|
1662
|
+
(scheduler ? concat$1(values, source, scheduler) : concat$1(values, source)).subscribe(subscriber);
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
function switchMap(project, resultSelector) {
|
|
1667
|
+
return operate(function (source, subscriber) {
|
|
1668
|
+
var innerSubscriber = null;
|
|
1669
|
+
var index = 0;
|
|
1670
|
+
var isComplete = false;
|
|
1671
|
+
var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
|
|
1672
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1673
|
+
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
1674
|
+
var innerIndex = 0;
|
|
1675
|
+
var outerIndex = index++;
|
|
1676
|
+
innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
|
|
1677
|
+
innerSubscriber = null;
|
|
1678
|
+
checkComplete();
|
|
1679
|
+
})));
|
|
1680
|
+
}, function () {
|
|
1681
|
+
isComplete = true;
|
|
1682
|
+
checkComplete();
|
|
1683
|
+
}));
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
function tap(observerOrNext, error, complete) {
|
|
1688
|
+
var tapObserver = isFunction(observerOrNext) || error || complete
|
|
1689
|
+
?
|
|
1690
|
+
{ next: observerOrNext, error: error, complete: complete }
|
|
1691
|
+
: observerOrNext;
|
|
1692
|
+
return tapObserver
|
|
1693
|
+
? operate(function (source, subscriber) {
|
|
1694
|
+
var _a;
|
|
1695
|
+
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1696
|
+
var isUnsub = true;
|
|
1697
|
+
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
1698
|
+
var _a;
|
|
1699
|
+
(_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
|
|
1700
|
+
subscriber.next(value);
|
|
1701
|
+
}, function () {
|
|
1702
|
+
var _a;
|
|
1703
|
+
isUnsub = false;
|
|
1704
|
+
(_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1705
|
+
subscriber.complete();
|
|
1706
|
+
}, function (err) {
|
|
1707
|
+
var _a;
|
|
1708
|
+
isUnsub = false;
|
|
1709
|
+
(_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
|
|
1710
|
+
subscriber.error(err);
|
|
1711
|
+
}, function () {
|
|
1712
|
+
var _a, _b;
|
|
1713
|
+
if (isUnsub) {
|
|
1714
|
+
(_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
1715
|
+
}
|
|
1716
|
+
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
|
1717
|
+
}));
|
|
1718
|
+
})
|
|
1719
|
+
:
|
|
1720
|
+
identity;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
181
1723
|
//const hasSW = 'serviceWorker' in navigator;
|
|
182
1724
|
let hasComplainedAboutSyncEvent = false;
|
|
183
1725
|
function registerSyncEvent(db, purpose) {
|
|
@@ -267,7 +1809,14 @@ const b64encode = typeof Buffer !== "undefined"
|
|
|
267
1809
|
}
|
|
268
1810
|
}
|
|
269
1811
|
: (b) => {
|
|
270
|
-
|
|
1812
|
+
const u8a = ArrayBuffer.isView(b) ? b : new Uint8Array(b);
|
|
1813
|
+
const CHUNK_SIZE = 0x1000;
|
|
1814
|
+
const strs = [];
|
|
1815
|
+
for (let i = 0, l = u8a.length; i < l; i += CHUNK_SIZE) {
|
|
1816
|
+
const chunk = u8a.subarray(i, i + CHUNK_SIZE);
|
|
1817
|
+
strs.push(String.fromCharCode.apply(null, chunk));
|
|
1818
|
+
}
|
|
1819
|
+
return btoa(strs.join(""));
|
|
271
1820
|
};
|
|
272
1821
|
|
|
273
1822
|
function computeRealmSetHash({ realms, inviteRealms, }) {
|
|
@@ -1277,13 +2826,13 @@ var MapDef = {
|
|
|
1277
2826
|
},
|
|
1278
2827
|
};
|
|
1279
2828
|
|
|
1280
|
-
const _global = typeof globalThis !== "undefined"
|
|
2829
|
+
const _global = typeof globalThis !== "undefined" // All modern environments (node, bun, deno, browser, workers, webview etc)
|
|
1281
2830
|
? globalThis
|
|
1282
|
-
: typeof self !== "undefined"
|
|
2831
|
+
: typeof self !== "undefined" // Older browsers, workers, webview, window etc
|
|
1283
2832
|
? self
|
|
1284
|
-
: typeof global
|
|
2833
|
+
: typeof global !== "undefined" // Older versions of node
|
|
1285
2834
|
? global
|
|
1286
|
-
: undefined;
|
|
2835
|
+
: undefined; // Unsupported environment. No idea to return 'this' since we are in a module or a function scope anyway.
|
|
1287
2836
|
|
|
1288
2837
|
var TypedArraysDefs = [
|
|
1289
2838
|
"Int8Array",
|
|
@@ -2600,7 +4149,7 @@ class AuthPersistedContext {
|
|
|
2600
4149
|
|
|
2601
4150
|
function waitUntil(o, // Works with Dexie's liveQuery observables if we'd need that
|
|
2602
4151
|
predicate) {
|
|
2603
|
-
return firstValueFrom(from(o).pipe(filter$1(predicate)));
|
|
4152
|
+
return firstValueFrom(from$1(o).pipe(filter$1(predicate)));
|
|
2604
4153
|
}
|
|
2605
4154
|
|
|
2606
4155
|
function logout(db) {
|
|
@@ -3547,13 +5096,13 @@ class TokenExpiredError extends Error {
|
|
|
3547
5096
|
const SERVER_PING_TIMEOUT = 20000;
|
|
3548
5097
|
const CLIENT_PING_INTERVAL = 30000;
|
|
3549
5098
|
const FAIL_RETRY_WAIT_TIME = 60000;
|
|
3550
|
-
class WSObservable extends Observable {
|
|
5099
|
+
class WSObservable extends Observable$1 {
|
|
3551
5100
|
constructor(databaseUrl, rev, realmSetHash, clientIdentity, messageProducer, webSocketStatus, token, tokenExpiration) {
|
|
3552
5101
|
super((subscriber) => new WSConnection(databaseUrl, rev, realmSetHash, clientIdentity, token, tokenExpiration, subscriber, messageProducer, webSocketStatus));
|
|
3553
5102
|
}
|
|
3554
5103
|
}
|
|
3555
5104
|
let counter = 0;
|
|
3556
|
-
class WSConnection extends Subscription {
|
|
5105
|
+
class WSConnection extends Subscription$1 {
|
|
3557
5106
|
constructor(databaseUrl, rev, realmSetHash, clientIdentity, token, tokenExpiration, subscriber, messageProducer, webSocketStatus) {
|
|
3558
5107
|
super(() => this.teardown());
|
|
3559
5108
|
this.id = ++counter;
|
|
@@ -3820,7 +5369,7 @@ function connectWebSocket(db) {
|
|
|
3820
5369
|
return 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);
|
|
3821
5370
|
}
|
|
3822
5371
|
else {
|
|
3823
|
-
return from([]);
|
|
5372
|
+
return from$1([]);
|
|
3824
5373
|
}
|
|
3825
5374
|
}), catchError((error) => {
|
|
3826
5375
|
if ((error === null || error === void 0 ? void 0 : error.name) === 'TokenExpiredError') {
|
|
@@ -3847,7 +5396,7 @@ function connectWebSocket(db) {
|
|
|
3847
5396
|
// Don't retry. Just throw and don't try connect again.
|
|
3848
5397
|
return throwError(() => error);
|
|
3849
5398
|
}
|
|
3850
|
-
return from(waitAndReconnectWhenUserDoesSomething(error)).pipe(switchMap(() => createObservable()));
|
|
5399
|
+
return from$1(waitAndReconnectWhenUserDoesSomething(error)).pipe(switchMap(() => createObservable()));
|
|
3851
5400
|
}));
|
|
3852
5401
|
}
|
|
3853
5402
|
return createObservable().subscribe({
|
|
@@ -4204,7 +5753,7 @@ class LoginGui extends d$1 {
|
|
|
4204
5753
|
this.state = { userInteraction: undefined };
|
|
4205
5754
|
}
|
|
4206
5755
|
componentDidMount() {
|
|
4207
|
-
this.subscription = from(this.props.db.cloud.userInteraction).subscribe(this.observer);
|
|
5756
|
+
this.subscription = from$1(this.props.db.cloud.userInteraction).subscribe(this.observer);
|
|
4208
5757
|
}
|
|
4209
5758
|
componentWillUnmount() {
|
|
4210
5759
|
if (this.subscription) {
|
|
@@ -4339,8 +5888,8 @@ function computeSyncState(db) {
|
|
|
4339
5888
|
|
|
4340
5889
|
function createSharedValueObservable(o, defaultValue) {
|
|
4341
5890
|
let currentValue = defaultValue;
|
|
4342
|
-
let shared = from(o).pipe(map$1((x) => (currentValue = x)), share({ resetOnRefCountZero: () => timer(1000) }));
|
|
4343
|
-
const rv = new Observable((observer) => {
|
|
5891
|
+
let shared = from$1(o).pipe(map$1((x) => (currentValue = x)), share({ resetOnRefCountZero: () => timer$1(1000) }));
|
|
5892
|
+
const rv = new Observable$1((observer) => {
|
|
4344
5893
|
let didEmit = false;
|
|
4345
5894
|
const subscription = shared.subscribe({
|
|
4346
5895
|
next(value) {
|
|
@@ -4660,7 +6209,7 @@ function dexieCloud(dexie) {
|
|
|
4660
6209
|
});
|
|
4661
6210
|
const syncComplete = new Subject();
|
|
4662
6211
|
dexie.cloud = {
|
|
4663
|
-
version: '
|
|
6212
|
+
version: '{version}',
|
|
4664
6213
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
4665
6214
|
schema: null,
|
|
4666
6215
|
get currentUserId() {
|
|
@@ -4732,7 +6281,7 @@ function dexieCloud(dexie) {
|
|
|
4732
6281
|
triggerSync(db, purpose);
|
|
4733
6282
|
if (wait) {
|
|
4734
6283
|
console.debug('db.cloud.login() is waiting for sync completion...');
|
|
4735
|
-
yield from(liveQuery(() => __awaiter(this, void 0, void 0, function* () {
|
|
6284
|
+
yield from$1(liveQuery(() => __awaiter(this, void 0, void 0, function* () {
|
|
4736
6285
|
const syncNeeded = yield isSyncNeeded(db);
|
|
4737
6286
|
const newSyncState = yield db.getPersistedSyncState();
|
|
4738
6287
|
if ((newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.timestamp) !== (syncState === null || syncState === void 0 ? void 0 : syncState.timestamp) &&
|
|
@@ -4936,7 +6485,7 @@ function dexieCloud(dexie) {
|
|
|
4936
6485
|
});
|
|
4937
6486
|
}
|
|
4938
6487
|
}
|
|
4939
|
-
dexieCloud.version = '
|
|
6488
|
+
dexieCloud.version = '{version}';
|
|
4940
6489
|
Dexie.Cloud = dexieCloud;
|
|
4941
6490
|
|
|
4942
6491
|
// In case the SW lives for a while, let it reuse already opened connections:
|