@flarehr/apollo-super-selection 3.52.60060 → 3.55.61713
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/lib/apollo-super-selection/apollo-super-selection.css +1 -0
- package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -1
- package/dist/lib/apollo-super-selection/apollo-super-selection.js +1 -1
- package/dist/lib/apollo-super-selection/assets/icon-check.svg +3 -0
- package/dist/lib/apollo-super-selection/assets/icon-exclamation.svg +3 -0
- package/dist/lib/apollo-super-selection/assets/icon-information-circle.svg +3 -0
- package/dist/lib/apollo-super-selection/p-0d3b8084.system.entry.js +1 -0
- package/dist/lib/apollo-super-selection/p-0ef73515.entry.js +1 -0
- package/dist/lib/apollo-super-selection/p-0f723eb4.system.js +1 -0
- package/dist/lib/apollo-super-selection/{p-01a9f4a4.entry.js → p-12d77532.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-14885f78.system.js +15 -0
- package/dist/lib/apollo-super-selection/{p-381262c1.system.js → p-15f0e5eb.system.js} +1 -1
- package/dist/lib/apollo-super-selection/p-29c11183.js +15 -0
- package/dist/lib/apollo-super-selection/{p-20136efe.entry.js → p-375401a0.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-285da037.system.entry.js → p-3ce021a5.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-61734b66.js → p-40e504c4.js} +1 -1
- package/dist/lib/apollo-super-selection/p-67b71067.entry.js +1 -0
- package/dist/lib/apollo-super-selection/{p-082669d9.js → p-683b6e23.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-38ee2795.system.js → p-6cdec249.system.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-cd49a6b7.system.entry.js → p-76eee25a.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-86e3e03f.js +1 -0
- package/dist/lib/apollo-super-selection/{p-8cbfc343.system.entry.js → p-918a740c.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-93f7a547.entry.js +14 -0
- package/dist/lib/apollo-super-selection/p-c249f6ed.system.js +1 -0
- package/dist/lib/apollo-super-selection/p-c2b9cfa5.system.entry.js +69 -0
- package/dist/lib/apollo-super-selection/{p-a98c2760.entry.js → p-cb6b386e.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-f15bf700.system.entry.js → p-e9a34be2.system.entry.js} +1 -1
- package/dist/lib/cjs/{active-router-e92fd784.js → active-router-71d965f4.js} +1 -1
- package/dist/lib/cjs/apollo-super-selection.cjs.js +4 -5
- package/dist/lib/cjs/{app-globals-45007120.js → app-globals-b1125d8c.js} +1 -1
- package/dist/lib/cjs/context-consumer.cjs.entry.js +1 -1
- package/dist/lib/cjs/{datorama-akita-7f4b082a.js → datorama-akita-6c9cb8fb.js} +1005 -68
- package/dist/lib/cjs/{index-942e6faa.js → index-f746d8f0.js} +2 -0
- package/dist/lib/cjs/loader.cjs.js +4 -5
- package/dist/lib/cjs/{fl-button_31.cjs.entry.js → sss-button_28.cjs.entry.js} +2138 -2177
- package/dist/lib/cjs/stencil-async-content.cjs.entry.js +1 -1
- package/dist/lib/cjs/stencil-route-title.cjs.entry.js +2 -2
- package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +2 -2
- package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +2 -2
- package/dist/lib/collection/apollo-super-selection.css +1 -0
- package/dist/lib/collection/collection-manifest.json +16 -28
- package/dist/lib/collection/components/app-host/loading-page.js +3 -3
- package/dist/lib/collection/components/app-host/super-selection-app-host.css +0 -4
- package/dist/lib/collection/components/app-host/super-selection-app-host.js +7 -19
- package/dist/lib/collection/components/super-selection-app/api/super-selection.api.dto.js +69 -1
- package/dist/lib/collection/components/super-selection-app/api/super-selection.api.js +9 -3
- package/dist/lib/collection/components/super-selection-app/app-state-pages/success.js +16 -21
- package/dist/lib/collection/components/super-selection-app/assets/icon-check.svg +3 -0
- package/dist/lib/collection/components/super-selection-app/assets/icon-exclamation.svg +3 -0
- package/dist/lib/collection/components/super-selection-app/assets/icon-information-circle.svg +3 -0
- package/dist/lib/collection/components/super-selection-app/consent/consent.js +57 -0
- package/dist/lib/collection/components/super-selection-app/existing-choice/existing-choice.js +136 -0
- package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.js +6 -18
- package/dist/lib/collection/components/super-selection-app/funds/constants.js +50 -0
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.js +32 -16
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.store.js +10 -14
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/default-fund/default-fund.js +36 -45
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +40 -19
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.js +45 -40
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.js +104 -58
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.js +53 -49
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.js +6 -16
- package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-join-page.js +1 -1
- package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund.store.js +1 -4
- package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/services/promoted-fund-join-iframe-builder.js +10 -4
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/services/slate-iframe-builder.js +13 -4
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-join-page.js +2 -3
- package/dist/lib/collection/components/super-selection-app/header-section/header-section.js +45 -0
- package/dist/lib/collection/components/super-selection-app/misc/button.js +146 -0
- package/dist/lib/collection/components/super-selection-app/misc/dropdown-async.css +7 -0
- package/dist/lib/collection/components/super-selection-app/misc/dropdown-async.js +359 -0
- package/dist/lib/collection/components/super-selection-app/misc/loading-indicator.js +52 -0
- package/dist/lib/collection/components/super-selection-app/services/australian-fund-lookup.service.js +8 -4
- package/dist/lib/collection/components/super-selection-app/services/event-tracking.service.js +20 -0
- package/dist/lib/collection/components/super-selection-app/services/existing-super-choice-info.service.js +95 -0
- package/dist/lib/collection/components/super-selection-app/services/feature-flag.service.js +11 -0
- package/dist/lib/collection/components/super-selection-app/services/navigation.service.js +8 -0
- package/dist/lib/collection/components/super-selection-app/services/super-selection-app.routes.js +6 -4
- package/dist/lib/collection/components/super-selection-app/standard-choice/standard-choice-form.js +69 -34
- package/dist/lib/collection/components/super-selection-app/standard-choice/standard-choice-form.store.js +10 -0
- package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-bottom.js +94 -0
- package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-top.js +90 -0
- package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.js +85 -92
- package/dist/lib/collection/components/super-selection-app/super-selection-app.css +16 -4
- package/dist/lib/collection/components/super-selection-app/super-selection-app.js +59 -11
- package/dist/lib/esm/{active-router-4c80d3d2.js → active-router-2056f552.js} +1 -1
- package/dist/lib/esm/apollo-super-selection.js +4 -5
- package/dist/lib/esm/{app-globals-7ac1ffba.js → app-globals-c1f89805.js} +1 -1
- package/dist/lib/esm/context-consumer.entry.js +1 -1
- package/dist/lib/esm/{datorama-akita-79ce4385.js → datorama-akita-127aea91.js} +960 -28
- package/dist/lib/esm/{index-0496d1af.js → index-e1e930c8.js} +2 -1
- package/dist/lib/esm/loader.js +4 -5
- package/dist/lib/esm/{fl-button_31.entry.js → sss-button_28.entry.js} +2124 -2160
- package/dist/lib/esm/stencil-async-content.entry.js +1 -1
- package/dist/lib/esm/stencil-route-title.entry.js +2 -2
- package/dist/lib/esm/stencil-router-prompt.entry.js +2 -2
- package/dist/lib/esm/stencil-router-redirect.entry.js +2 -2
- package/dist/lib/esm-es5/{active-router-4c80d3d2.js → active-router-2056f552.js} +1 -1
- package/dist/lib/esm-es5/apollo-super-selection.js +1 -1
- package/dist/lib/esm-es5/{app-globals-7ac1ffba.js → app-globals-c1f89805.js} +1 -1
- package/dist/lib/esm-es5/context-consumer.entry.js +1 -1
- package/dist/lib/esm-es5/datorama-akita-127aea91.js +15 -0
- package/dist/lib/esm-es5/{index-0496d1af.js → index-e1e930c8.js} +1 -1
- package/dist/lib/esm-es5/loader.js +1 -1
- package/dist/lib/esm-es5/sss-button_28.entry.js +69 -0
- package/dist/lib/esm-es5/stencil-async-content.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-route-title.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-router-prompt.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-router-redirect.entry.js +1 -1
- package/dist/lib/types/components/app-host/super-selection-app-host.d.ts +0 -3
- package/dist/lib/types/components/super-selection-app/api/super-selection-events.model.d.ts +30 -0
- package/dist/lib/types/components/super-selection-app/api/super-selection.api.d.ts +2 -1
- package/dist/lib/types/components/super-selection-app/api/super-selection.api.dto.d.ts +19 -4
- package/dist/lib/types/components/super-selection-app/consent/consent.d.ts +9 -0
- package/dist/lib/types/components/super-selection-app/existing-choice/existing-choice.d.ts +12 -0
- package/dist/lib/types/components/super-selection-app/footer-section/footer-section.d.ts +0 -1
- package/dist/lib/types/components/super-selection-app/funds/constants.d.ts +3 -0
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.d.ts +1 -1
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.store.d.ts +4 -6
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/default-fund/default-fund.d.ts +0 -2
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.d.ts +2 -1
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.d.ts +1 -0
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.d.ts +7 -0
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.d.ts +1 -0
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.d.ts +0 -1
- package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund.store.d.ts +0 -3
- package/dist/lib/types/components/super-selection-app/header-section/header-section.d.ts +4 -0
- package/dist/lib/types/components/super-selection-app/misc/button.d.ts +11 -0
- package/dist/lib/types/components/super-selection-app/misc/dropdown-async.d.ts +44 -0
- package/dist/lib/types/components/super-selection-app/misc/loading-indicator.d.ts +5 -0
- package/dist/lib/types/components/super-selection-app/services/australian-fund-lookup.service.d.ts +1 -0
- package/dist/lib/types/components/super-selection-app/services/event-tracking.service.d.ts +4 -0
- package/dist/lib/types/components/super-selection-app/services/existing-super-choice-info.service.d.ts +51 -0
- package/dist/lib/types/components/super-selection-app/services/feature-flag.service.d.ts +3 -0
- package/dist/lib/types/components/super-selection-app/services/navigation.service.d.ts +6 -0
- package/dist/lib/types/components/super-selection-app/services/super-selection-app.routes.d.ts +3 -2
- package/dist/lib/types/components/super-selection-app/standard-choice/standard-choice-form.d.ts +6 -3
- package/dist/lib/types/components/super-selection-app/standard-choice/standard-choice-form.store.d.ts +8 -0
- package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-bottom.d.ts +9 -0
- package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-top.d.ts +7 -0
- package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-page.d.ts +1 -4
- package/dist/lib/types/components/super-selection-app/super-selection-app.d.ts +2 -1
- package/dist/lib/types/components.d.ts +148 -97
- package/package.json +12 -7
- package/dist/lib/apollo-super-selection/assets/logo-qsuper-square.png +0 -0
- package/dist/lib/apollo-super-selection/assets/logo-qsuper.png +0 -0
- package/dist/lib/apollo-super-selection/p-0623b20a.system.entry.js +0 -69
- package/dist/lib/apollo-super-selection/p-13573238.system.js +0 -15
- package/dist/lib/apollo-super-selection/p-342cee5a.js +0 -1
- package/dist/lib/apollo-super-selection/p-38f24f69.js +0 -1
- package/dist/lib/apollo-super-selection/p-642db1f7.system.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-64ebe17d.system.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-7dbe5a2f.system.js +0 -1
- package/dist/lib/apollo-super-selection/p-abedb220.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-ae4f5e0b.system.js +0 -1
- package/dist/lib/apollo-super-selection/p-c5e41889.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-d82b00ed.system.js +0 -1
- package/dist/lib/apollo-super-selection/p-df9ce4b7.js +0 -15
- package/dist/lib/apollo-super-selection/p-f7a45412.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-fbe8c6d1.entry.js +0 -14
- package/dist/lib/cjs/delay-81aff2f1.js +0 -955
- package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -90
- package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.css +0 -11
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.css +0 -23
- package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.js +0 -62
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-fund.store.js +0 -10
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-standard-choice-page.js +0 -67
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.css +0 -0
- package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.js +0 -19
- package/dist/lib/collection/components/super-selection-app/notifications-section/notifications-section.js +0 -25
- package/dist/lib/collection/components/super-selection-app/services/notifications.service.js +0 -37
- package/dist/lib/collection/components/super-selection-app/services/notifications.store.js +0 -3
- package/dist/lib/collection/components/super-selection-app/services/selected-super-choice-info.service.js +0 -50
- package/dist/lib/collection/components/super-selection-app/standard-choice/api/standard-choice.model.js +0 -1
- package/dist/lib/collection/components/super-selection-app/super-choice-page/assets/logo-qsuper-square.png +0 -0
- package/dist/lib/collection/components/super-selection-app/super-choice-page/assets/logo-qsuper.png +0 -0
- package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.css +0 -18
- package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.js +0 -53
- package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item.js +0 -296
- package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.css +0 -70
- package/dist/lib/esm/delay-c0555599.js +0 -935
- package/dist/lib/esm/fl-style-guide.entry.js +0 -86
- package/dist/lib/esm-es5/datorama-akita-79ce4385.js +0 -15
- package/dist/lib/esm-es5/delay-c0555599.js +0 -1
- package/dist/lib/esm-es5/fl-button_31.entry.js +0 -69
- package/dist/lib/esm-es5/fl-style-guide.entry.js +0 -1
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
- package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.d.ts +0 -8
- package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-fund.store.d.ts +0 -7
- package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-standard-choice-page.d.ts +0 -8
- package/dist/lib/types/components/super-selection-app/funds/slate-super/slatesuper-header.d.ts +0 -3
- package/dist/lib/types/components/super-selection-app/notifications-section/notifications-section.d.ts +0 -5
- package/dist/lib/types/components/super-selection-app/services/notifications.service.d.ts +0 -15
- package/dist/lib/types/components/super-selection-app/services/notifications.store.d.ts +0 -14
- package/dist/lib/types/components/super-selection-app/services/selected-super-choice-info.service.d.ts +0 -18
- package/dist/lib/types/components/super-selection-app/standard-choice/api/standard-choice.model.d.ts +0 -3
- package/dist/lib/types/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.d.ts +0 -5
- package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item.d.ts +0 -22
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { S as Subscription, O as Observable, r as rxSubscriber, a as Subscriber, A as AsyncAction, b as AsyncScheduler, N as Notification, h as hostReportError, o as observable, s as subscribeToArray, i as isObject$1, c as scheduleArray, e as empty, d as of, f as delay } from './delay-c0555599.js';
|
|
2
|
-
|
|
3
1
|
/*! *****************************************************************************
|
|
4
2
|
Copyright (c) Microsoft Corporation.
|
|
5
3
|
|
|
@@ -38,6 +36,571 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
38
36
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
39
37
|
}
|
|
40
38
|
|
|
39
|
+
function isFunction(x) {
|
|
40
|
+
return typeof x === 'function';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let _enable_super_gross_mode_that_will_cause_bad_things = false;
|
|
44
|
+
const config = {
|
|
45
|
+
Promise: undefined,
|
|
46
|
+
set useDeprecatedSynchronousErrorHandling(value) {
|
|
47
|
+
if (value) {
|
|
48
|
+
const error = new Error();
|
|
49
|
+
console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
|
|
50
|
+
}
|
|
51
|
+
else if (_enable_super_gross_mode_that_will_cause_bad_things) {
|
|
52
|
+
console.log('RxJS: Back to a better error behavior. Thank you. <3');
|
|
53
|
+
}
|
|
54
|
+
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
55
|
+
},
|
|
56
|
+
get useDeprecatedSynchronousErrorHandling() {
|
|
57
|
+
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
function hostReportError(err) {
|
|
62
|
+
setTimeout(() => { throw err; }, 0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const empty = {
|
|
66
|
+
closed: true,
|
|
67
|
+
next(value) { },
|
|
68
|
+
error(err) {
|
|
69
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
hostReportError(err);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
complete() { }
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isArray = (() => Array.isArray || ((x) => x && typeof x.length === 'number'))();
|
|
80
|
+
|
|
81
|
+
function isObject(x) {
|
|
82
|
+
return x !== null && typeof x === 'object';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const UnsubscriptionErrorImpl = (() => {
|
|
86
|
+
function UnsubscriptionErrorImpl(errors) {
|
|
87
|
+
Error.call(this);
|
|
88
|
+
this.message = errors ?
|
|
89
|
+
`${errors.length} errors occurred during unsubscription:
|
|
90
|
+
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
|
|
91
|
+
this.name = 'UnsubscriptionError';
|
|
92
|
+
this.errors = errors;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
|
|
96
|
+
return UnsubscriptionErrorImpl;
|
|
97
|
+
})();
|
|
98
|
+
const UnsubscriptionError = UnsubscriptionErrorImpl;
|
|
99
|
+
|
|
100
|
+
class Subscription {
|
|
101
|
+
constructor(unsubscribe) {
|
|
102
|
+
this.closed = false;
|
|
103
|
+
this._parentOrParents = null;
|
|
104
|
+
this._subscriptions = null;
|
|
105
|
+
if (unsubscribe) {
|
|
106
|
+
this._ctorUnsubscribe = true;
|
|
107
|
+
this._unsubscribe = unsubscribe;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
unsubscribe() {
|
|
111
|
+
let errors;
|
|
112
|
+
if (this.closed) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let { _parentOrParents, _ctorUnsubscribe, _unsubscribe, _subscriptions } = this;
|
|
116
|
+
this.closed = true;
|
|
117
|
+
this._parentOrParents = null;
|
|
118
|
+
this._subscriptions = null;
|
|
119
|
+
if (_parentOrParents instanceof Subscription) {
|
|
120
|
+
_parentOrParents.remove(this);
|
|
121
|
+
}
|
|
122
|
+
else if (_parentOrParents !== null) {
|
|
123
|
+
for (let index = 0; index < _parentOrParents.length; ++index) {
|
|
124
|
+
const parent = _parentOrParents[index];
|
|
125
|
+
parent.remove(this);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (isFunction(_unsubscribe)) {
|
|
129
|
+
if (_ctorUnsubscribe) {
|
|
130
|
+
this._unsubscribe = undefined;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
_unsubscribe.call(this);
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (isArray(_subscriptions)) {
|
|
140
|
+
let index = -1;
|
|
141
|
+
let len = _subscriptions.length;
|
|
142
|
+
while (++index < len) {
|
|
143
|
+
const sub = _subscriptions[index];
|
|
144
|
+
if (isObject(sub)) {
|
|
145
|
+
try {
|
|
146
|
+
sub.unsubscribe();
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
errors = errors || [];
|
|
150
|
+
if (e instanceof UnsubscriptionError) {
|
|
151
|
+
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
errors.push(e);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (errors) {
|
|
161
|
+
throw new UnsubscriptionError(errors);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
add(teardown) {
|
|
165
|
+
let subscription = teardown;
|
|
166
|
+
if (!teardown) {
|
|
167
|
+
return Subscription.EMPTY;
|
|
168
|
+
}
|
|
169
|
+
switch (typeof teardown) {
|
|
170
|
+
case 'function':
|
|
171
|
+
subscription = new Subscription(teardown);
|
|
172
|
+
case 'object':
|
|
173
|
+
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
|
|
174
|
+
return subscription;
|
|
175
|
+
}
|
|
176
|
+
else if (this.closed) {
|
|
177
|
+
subscription.unsubscribe();
|
|
178
|
+
return subscription;
|
|
179
|
+
}
|
|
180
|
+
else if (!(subscription instanceof Subscription)) {
|
|
181
|
+
const tmp = subscription;
|
|
182
|
+
subscription = new Subscription();
|
|
183
|
+
subscription._subscriptions = [tmp];
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
default: {
|
|
187
|
+
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
let { _parentOrParents } = subscription;
|
|
191
|
+
if (_parentOrParents === null) {
|
|
192
|
+
subscription._parentOrParents = this;
|
|
193
|
+
}
|
|
194
|
+
else if (_parentOrParents instanceof Subscription) {
|
|
195
|
+
if (_parentOrParents === this) {
|
|
196
|
+
return subscription;
|
|
197
|
+
}
|
|
198
|
+
subscription._parentOrParents = [_parentOrParents, this];
|
|
199
|
+
}
|
|
200
|
+
else if (_parentOrParents.indexOf(this) === -1) {
|
|
201
|
+
_parentOrParents.push(this);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return subscription;
|
|
205
|
+
}
|
|
206
|
+
const subscriptions = this._subscriptions;
|
|
207
|
+
if (subscriptions === null) {
|
|
208
|
+
this._subscriptions = [subscription];
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
subscriptions.push(subscription);
|
|
212
|
+
}
|
|
213
|
+
return subscription;
|
|
214
|
+
}
|
|
215
|
+
remove(subscription) {
|
|
216
|
+
const subscriptions = this._subscriptions;
|
|
217
|
+
if (subscriptions) {
|
|
218
|
+
const subscriptionIndex = subscriptions.indexOf(subscription);
|
|
219
|
+
if (subscriptionIndex !== -1) {
|
|
220
|
+
subscriptions.splice(subscriptionIndex, 1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
Subscription.EMPTY = (function (empty) {
|
|
226
|
+
empty.closed = true;
|
|
227
|
+
return empty;
|
|
228
|
+
}(new Subscription()));
|
|
229
|
+
function flattenUnsubscriptionErrors(errors) {
|
|
230
|
+
return errors.reduce((errs, err) => errs.concat((err instanceof UnsubscriptionError) ? err.errors : err), []);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const rxSubscriber = (() => typeof Symbol === 'function'
|
|
234
|
+
? Symbol('rxSubscriber')
|
|
235
|
+
: '@@rxSubscriber_' + Math.random())();
|
|
236
|
+
|
|
237
|
+
class Subscriber extends Subscription {
|
|
238
|
+
constructor(destinationOrNext, error, complete) {
|
|
239
|
+
super();
|
|
240
|
+
this.syncErrorValue = null;
|
|
241
|
+
this.syncErrorThrown = false;
|
|
242
|
+
this.syncErrorThrowable = false;
|
|
243
|
+
this.isStopped = false;
|
|
244
|
+
switch (arguments.length) {
|
|
245
|
+
case 0:
|
|
246
|
+
this.destination = empty;
|
|
247
|
+
break;
|
|
248
|
+
case 1:
|
|
249
|
+
if (!destinationOrNext) {
|
|
250
|
+
this.destination = empty;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (typeof destinationOrNext === 'object') {
|
|
254
|
+
if (destinationOrNext instanceof Subscriber) {
|
|
255
|
+
this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
|
|
256
|
+
this.destination = destinationOrNext;
|
|
257
|
+
destinationOrNext.add(this);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.syncErrorThrowable = true;
|
|
261
|
+
this.destination = new SafeSubscriber(this, destinationOrNext);
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
default:
|
|
266
|
+
this.syncErrorThrowable = true;
|
|
267
|
+
this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
[rxSubscriber]() { return this; }
|
|
272
|
+
static create(next, error, complete) {
|
|
273
|
+
const subscriber = new Subscriber(next, error, complete);
|
|
274
|
+
subscriber.syncErrorThrowable = false;
|
|
275
|
+
return subscriber;
|
|
276
|
+
}
|
|
277
|
+
next(value) {
|
|
278
|
+
if (!this.isStopped) {
|
|
279
|
+
this._next(value);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
error(err) {
|
|
283
|
+
if (!this.isStopped) {
|
|
284
|
+
this.isStopped = true;
|
|
285
|
+
this._error(err);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
complete() {
|
|
289
|
+
if (!this.isStopped) {
|
|
290
|
+
this.isStopped = true;
|
|
291
|
+
this._complete();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
unsubscribe() {
|
|
295
|
+
if (this.closed) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
this.isStopped = true;
|
|
299
|
+
super.unsubscribe();
|
|
300
|
+
}
|
|
301
|
+
_next(value) {
|
|
302
|
+
this.destination.next(value);
|
|
303
|
+
}
|
|
304
|
+
_error(err) {
|
|
305
|
+
this.destination.error(err);
|
|
306
|
+
this.unsubscribe();
|
|
307
|
+
}
|
|
308
|
+
_complete() {
|
|
309
|
+
this.destination.complete();
|
|
310
|
+
this.unsubscribe();
|
|
311
|
+
}
|
|
312
|
+
_unsubscribeAndRecycle() {
|
|
313
|
+
const { _parentOrParents } = this;
|
|
314
|
+
this._parentOrParents = null;
|
|
315
|
+
this.unsubscribe();
|
|
316
|
+
this.closed = false;
|
|
317
|
+
this.isStopped = false;
|
|
318
|
+
this._parentOrParents = _parentOrParents;
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
class SafeSubscriber extends Subscriber {
|
|
323
|
+
constructor(_parentSubscriber, observerOrNext, error, complete) {
|
|
324
|
+
super();
|
|
325
|
+
this._parentSubscriber = _parentSubscriber;
|
|
326
|
+
let next;
|
|
327
|
+
let context = this;
|
|
328
|
+
if (isFunction(observerOrNext)) {
|
|
329
|
+
next = observerOrNext;
|
|
330
|
+
}
|
|
331
|
+
else if (observerOrNext) {
|
|
332
|
+
next = observerOrNext.next;
|
|
333
|
+
error = observerOrNext.error;
|
|
334
|
+
complete = observerOrNext.complete;
|
|
335
|
+
if (observerOrNext !== empty) {
|
|
336
|
+
context = Object.create(observerOrNext);
|
|
337
|
+
if (isFunction(context.unsubscribe)) {
|
|
338
|
+
this.add(context.unsubscribe.bind(context));
|
|
339
|
+
}
|
|
340
|
+
context.unsubscribe = this.unsubscribe.bind(this);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
this._context = context;
|
|
344
|
+
this._next = next;
|
|
345
|
+
this._error = error;
|
|
346
|
+
this._complete = complete;
|
|
347
|
+
}
|
|
348
|
+
next(value) {
|
|
349
|
+
if (!this.isStopped && this._next) {
|
|
350
|
+
const { _parentSubscriber } = this;
|
|
351
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
352
|
+
this.__tryOrUnsub(this._next, value);
|
|
353
|
+
}
|
|
354
|
+
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
|
|
355
|
+
this.unsubscribe();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
error(err) {
|
|
360
|
+
if (!this.isStopped) {
|
|
361
|
+
const { _parentSubscriber } = this;
|
|
362
|
+
const { useDeprecatedSynchronousErrorHandling } = config;
|
|
363
|
+
if (this._error) {
|
|
364
|
+
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
365
|
+
this.__tryOrUnsub(this._error, err);
|
|
366
|
+
this.unsubscribe();
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
370
|
+
this.unsubscribe();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
374
|
+
this.unsubscribe();
|
|
375
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
376
|
+
throw err;
|
|
377
|
+
}
|
|
378
|
+
hostReportError(err);
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
382
|
+
_parentSubscriber.syncErrorValue = err;
|
|
383
|
+
_parentSubscriber.syncErrorThrown = true;
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
hostReportError(err);
|
|
387
|
+
}
|
|
388
|
+
this.unsubscribe();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
complete() {
|
|
393
|
+
if (!this.isStopped) {
|
|
394
|
+
const { _parentSubscriber } = this;
|
|
395
|
+
if (this._complete) {
|
|
396
|
+
const wrappedComplete = () => this._complete.call(this._context);
|
|
397
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
398
|
+
this.__tryOrUnsub(wrappedComplete);
|
|
399
|
+
this.unsubscribe();
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
403
|
+
this.unsubscribe();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
this.unsubscribe();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
__tryOrUnsub(fn, value) {
|
|
412
|
+
try {
|
|
413
|
+
fn.call(this._context, value);
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
this.unsubscribe();
|
|
417
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
418
|
+
throw err;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
hostReportError(err);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
__tryOrSetError(parent, fn, value) {
|
|
426
|
+
if (!config.useDeprecatedSynchronousErrorHandling) {
|
|
427
|
+
throw new Error('bad call');
|
|
428
|
+
}
|
|
429
|
+
try {
|
|
430
|
+
fn.call(this._context, value);
|
|
431
|
+
}
|
|
432
|
+
catch (err) {
|
|
433
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
434
|
+
parent.syncErrorValue = err;
|
|
435
|
+
parent.syncErrorThrown = true;
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
hostReportError(err);
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
_unsubscribe() {
|
|
446
|
+
const { _parentSubscriber } = this;
|
|
447
|
+
this._context = null;
|
|
448
|
+
this._parentSubscriber = null;
|
|
449
|
+
_parentSubscriber.unsubscribe();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function canReportError(observer) {
|
|
454
|
+
while (observer) {
|
|
455
|
+
const { closed, destination, isStopped } = observer;
|
|
456
|
+
if (closed || isStopped) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
else if (destination && destination instanceof Subscriber) {
|
|
460
|
+
observer = destination;
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
observer = null;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function toSubscriber(nextOrObserver, error, complete) {
|
|
470
|
+
if (nextOrObserver) {
|
|
471
|
+
if (nextOrObserver instanceof Subscriber) {
|
|
472
|
+
return nextOrObserver;
|
|
473
|
+
}
|
|
474
|
+
if (nextOrObserver[rxSubscriber]) {
|
|
475
|
+
return nextOrObserver[rxSubscriber]();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (!nextOrObserver && !error && !complete) {
|
|
479
|
+
return new Subscriber(empty);
|
|
480
|
+
}
|
|
481
|
+
return new Subscriber(nextOrObserver, error, complete);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
|
|
485
|
+
|
|
486
|
+
function identity(x) {
|
|
487
|
+
return x;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function pipeFromArray(fns) {
|
|
491
|
+
if (fns.length === 0) {
|
|
492
|
+
return identity;
|
|
493
|
+
}
|
|
494
|
+
if (fns.length === 1) {
|
|
495
|
+
return fns[0];
|
|
496
|
+
}
|
|
497
|
+
return function piped(input) {
|
|
498
|
+
return fns.reduce((prev, fn) => fn(prev), input);
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
class Observable {
|
|
503
|
+
constructor(subscribe) {
|
|
504
|
+
this._isScalar = false;
|
|
505
|
+
if (subscribe) {
|
|
506
|
+
this._subscribe = subscribe;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
lift(operator) {
|
|
510
|
+
const observable = new Observable();
|
|
511
|
+
observable.source = this;
|
|
512
|
+
observable.operator = operator;
|
|
513
|
+
return observable;
|
|
514
|
+
}
|
|
515
|
+
subscribe(observerOrNext, error, complete) {
|
|
516
|
+
const { operator } = this;
|
|
517
|
+
const sink = toSubscriber(observerOrNext, error, complete);
|
|
518
|
+
if (operator) {
|
|
519
|
+
sink.add(operator.call(sink, this.source));
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
|
|
523
|
+
this._subscribe(sink) :
|
|
524
|
+
this._trySubscribe(sink));
|
|
525
|
+
}
|
|
526
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
527
|
+
if (sink.syncErrorThrowable) {
|
|
528
|
+
sink.syncErrorThrowable = false;
|
|
529
|
+
if (sink.syncErrorThrown) {
|
|
530
|
+
throw sink.syncErrorValue;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return sink;
|
|
535
|
+
}
|
|
536
|
+
_trySubscribe(sink) {
|
|
537
|
+
try {
|
|
538
|
+
return this._subscribe(sink);
|
|
539
|
+
}
|
|
540
|
+
catch (err) {
|
|
541
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
542
|
+
sink.syncErrorThrown = true;
|
|
543
|
+
sink.syncErrorValue = err;
|
|
544
|
+
}
|
|
545
|
+
if (canReportError(sink)) {
|
|
546
|
+
sink.error(err);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
console.warn(err);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
forEach(next, promiseCtor) {
|
|
554
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
555
|
+
return new promiseCtor((resolve, reject) => {
|
|
556
|
+
let subscription;
|
|
557
|
+
subscription = this.subscribe((value) => {
|
|
558
|
+
try {
|
|
559
|
+
next(value);
|
|
560
|
+
}
|
|
561
|
+
catch (err) {
|
|
562
|
+
reject(err);
|
|
563
|
+
if (subscription) {
|
|
564
|
+
subscription.unsubscribe();
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}, reject, resolve);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
_subscribe(subscriber) {
|
|
571
|
+
const { source } = this;
|
|
572
|
+
return source && source.subscribe(subscriber);
|
|
573
|
+
}
|
|
574
|
+
[observable]() {
|
|
575
|
+
return this;
|
|
576
|
+
}
|
|
577
|
+
pipe(...operations) {
|
|
578
|
+
if (operations.length === 0) {
|
|
579
|
+
return this;
|
|
580
|
+
}
|
|
581
|
+
return pipeFromArray(operations)(this);
|
|
582
|
+
}
|
|
583
|
+
toPromise(promiseCtor) {
|
|
584
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
585
|
+
return new promiseCtor((resolve, reject) => {
|
|
586
|
+
let value;
|
|
587
|
+
this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value));
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
Observable.create = (subscribe) => {
|
|
592
|
+
return new Observable(subscribe);
|
|
593
|
+
};
|
|
594
|
+
function getPromiseCtor(promiseCtor) {
|
|
595
|
+
if (!promiseCtor) {
|
|
596
|
+
promiseCtor = Promise;
|
|
597
|
+
}
|
|
598
|
+
if (!promiseCtor) {
|
|
599
|
+
throw new Error('no Promise impl found');
|
|
600
|
+
}
|
|
601
|
+
return promiseCtor;
|
|
602
|
+
}
|
|
603
|
+
|
|
41
604
|
const ObjectUnsubscribedErrorImpl = (() => {
|
|
42
605
|
function ObjectUnsubscribedErrorImpl() {
|
|
43
606
|
Error.call(this);
|
|
@@ -244,6 +807,94 @@ class BehaviorSubject extends Subject {
|
|
|
244
807
|
}
|
|
245
808
|
}
|
|
246
809
|
|
|
810
|
+
class Action extends Subscription {
|
|
811
|
+
constructor(scheduler, work) {
|
|
812
|
+
super();
|
|
813
|
+
}
|
|
814
|
+
schedule(state, delay = 0) {
|
|
815
|
+
return this;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
class AsyncAction extends Action {
|
|
820
|
+
constructor(scheduler, work) {
|
|
821
|
+
super(scheduler, work);
|
|
822
|
+
this.scheduler = scheduler;
|
|
823
|
+
this.work = work;
|
|
824
|
+
this.pending = false;
|
|
825
|
+
}
|
|
826
|
+
schedule(state, delay = 0) {
|
|
827
|
+
if (this.closed) {
|
|
828
|
+
return this;
|
|
829
|
+
}
|
|
830
|
+
this.state = state;
|
|
831
|
+
const id = this.id;
|
|
832
|
+
const scheduler = this.scheduler;
|
|
833
|
+
if (id != null) {
|
|
834
|
+
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
835
|
+
}
|
|
836
|
+
this.pending = true;
|
|
837
|
+
this.delay = delay;
|
|
838
|
+
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
|
839
|
+
return this;
|
|
840
|
+
}
|
|
841
|
+
requestAsyncId(scheduler, id, delay = 0) {
|
|
842
|
+
return setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
843
|
+
}
|
|
844
|
+
recycleAsyncId(scheduler, id, delay = 0) {
|
|
845
|
+
if (delay !== null && this.delay === delay && this.pending === false) {
|
|
846
|
+
return id;
|
|
847
|
+
}
|
|
848
|
+
clearInterval(id);
|
|
849
|
+
return undefined;
|
|
850
|
+
}
|
|
851
|
+
execute(state, delay) {
|
|
852
|
+
if (this.closed) {
|
|
853
|
+
return new Error('executing a cancelled action');
|
|
854
|
+
}
|
|
855
|
+
this.pending = false;
|
|
856
|
+
const error = this._execute(state, delay);
|
|
857
|
+
if (error) {
|
|
858
|
+
return error;
|
|
859
|
+
}
|
|
860
|
+
else if (this.pending === false && this.id != null) {
|
|
861
|
+
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
_execute(state, delay) {
|
|
865
|
+
let errored = false;
|
|
866
|
+
let errorValue = undefined;
|
|
867
|
+
try {
|
|
868
|
+
this.work(state);
|
|
869
|
+
}
|
|
870
|
+
catch (e) {
|
|
871
|
+
errored = true;
|
|
872
|
+
errorValue = !!e && e || new Error(e);
|
|
873
|
+
}
|
|
874
|
+
if (errored) {
|
|
875
|
+
this.unsubscribe();
|
|
876
|
+
return errorValue;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
_unsubscribe() {
|
|
880
|
+
const id = this.id;
|
|
881
|
+
const scheduler = this.scheduler;
|
|
882
|
+
const actions = scheduler.actions;
|
|
883
|
+
const index = actions.indexOf(this);
|
|
884
|
+
this.work = null;
|
|
885
|
+
this.state = null;
|
|
886
|
+
this.pending = false;
|
|
887
|
+
this.scheduler = null;
|
|
888
|
+
if (index !== -1) {
|
|
889
|
+
actions.splice(index, 1);
|
|
890
|
+
}
|
|
891
|
+
if (id != null) {
|
|
892
|
+
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
893
|
+
}
|
|
894
|
+
this.delay = null;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
247
898
|
class QueueAction extends AsyncAction {
|
|
248
899
|
constructor(scheduler, work) {
|
|
249
900
|
super(scheduler, work);
|
|
@@ -272,12 +923,207 @@ class QueueAction extends AsyncAction {
|
|
|
272
923
|
}
|
|
273
924
|
}
|
|
274
925
|
|
|
926
|
+
class Scheduler {
|
|
927
|
+
constructor(SchedulerAction, now = Scheduler.now) {
|
|
928
|
+
this.SchedulerAction = SchedulerAction;
|
|
929
|
+
this.now = now;
|
|
930
|
+
}
|
|
931
|
+
schedule(work, delay = 0, state) {
|
|
932
|
+
return new this.SchedulerAction(this, work).schedule(state, delay);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
Scheduler.now = () => Date.now();
|
|
936
|
+
|
|
937
|
+
class AsyncScheduler extends Scheduler {
|
|
938
|
+
constructor(SchedulerAction, now = Scheduler.now) {
|
|
939
|
+
super(SchedulerAction, () => {
|
|
940
|
+
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
|
|
941
|
+
return AsyncScheduler.delegate.now();
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
return now();
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
this.actions = [];
|
|
948
|
+
this.active = false;
|
|
949
|
+
this.scheduled = undefined;
|
|
950
|
+
}
|
|
951
|
+
schedule(work, delay = 0, state) {
|
|
952
|
+
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
|
|
953
|
+
return AsyncScheduler.delegate.schedule(work, delay, state);
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
return super.schedule(work, delay, state);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
flush(action) {
|
|
960
|
+
const { actions } = this;
|
|
961
|
+
if (this.active) {
|
|
962
|
+
actions.push(action);
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
let error;
|
|
966
|
+
this.active = true;
|
|
967
|
+
do {
|
|
968
|
+
if (error = action.execute(action.state, action.delay)) {
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
} while (action = actions.shift());
|
|
972
|
+
this.active = false;
|
|
973
|
+
if (error) {
|
|
974
|
+
while (action = actions.shift()) {
|
|
975
|
+
action.unsubscribe();
|
|
976
|
+
}
|
|
977
|
+
throw error;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
275
982
|
class QueueScheduler extends AsyncScheduler {
|
|
276
983
|
}
|
|
277
984
|
|
|
278
985
|
const queueScheduler = new QueueScheduler(QueueAction);
|
|
279
986
|
const queue = queueScheduler;
|
|
280
987
|
|
|
988
|
+
const EMPTY = new Observable(subscriber => subscriber.complete());
|
|
989
|
+
function empty$1(scheduler) {
|
|
990
|
+
return scheduler ? emptyScheduled(scheduler) : EMPTY;
|
|
991
|
+
}
|
|
992
|
+
function emptyScheduled(scheduler) {
|
|
993
|
+
return new Observable(subscriber => scheduler.schedule(() => subscriber.complete()));
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
function isScheduler(value) {
|
|
997
|
+
return value && typeof value.schedule === 'function';
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
const subscribeToArray = (array) => (subscriber) => {
|
|
1001
|
+
for (let i = 0, len = array.length; i < len && !subscriber.closed; i++) {
|
|
1002
|
+
subscriber.next(array[i]);
|
|
1003
|
+
}
|
|
1004
|
+
subscriber.complete();
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
function scheduleArray(input, scheduler) {
|
|
1008
|
+
return new Observable(subscriber => {
|
|
1009
|
+
const sub = new Subscription();
|
|
1010
|
+
let i = 0;
|
|
1011
|
+
sub.add(scheduler.schedule(function () {
|
|
1012
|
+
if (i === input.length) {
|
|
1013
|
+
subscriber.complete();
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
subscriber.next(input[i++]);
|
|
1017
|
+
if (!subscriber.closed) {
|
|
1018
|
+
sub.add(this.schedule());
|
|
1019
|
+
}
|
|
1020
|
+
}));
|
|
1021
|
+
return sub;
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function fromArray(input, scheduler) {
|
|
1026
|
+
if (!scheduler) {
|
|
1027
|
+
return new Observable(subscribeToArray(input));
|
|
1028
|
+
}
|
|
1029
|
+
else {
|
|
1030
|
+
return scheduleArray(input, scheduler);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
function of(...args) {
|
|
1035
|
+
let scheduler = args[args.length - 1];
|
|
1036
|
+
if (isScheduler(scheduler)) {
|
|
1037
|
+
args.pop();
|
|
1038
|
+
return scheduleArray(args, scheduler);
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
return fromArray(args);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function throwError(error, scheduler) {
|
|
1046
|
+
if (!scheduler) {
|
|
1047
|
+
return new Observable(subscriber => subscriber.error(error));
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
return new Observable(subscriber => scheduler.schedule(dispatch, 0, { error, subscriber }));
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
function dispatch({ error, subscriber }) {
|
|
1054
|
+
subscriber.error(error);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
var NotificationKind;
|
|
1058
|
+
(function (NotificationKind) {
|
|
1059
|
+
NotificationKind["NEXT"] = "N";
|
|
1060
|
+
NotificationKind["ERROR"] = "E";
|
|
1061
|
+
NotificationKind["COMPLETE"] = "C";
|
|
1062
|
+
})(NotificationKind || (NotificationKind = {}));
|
|
1063
|
+
class Notification {
|
|
1064
|
+
constructor(kind, value, error) {
|
|
1065
|
+
this.kind = kind;
|
|
1066
|
+
this.value = value;
|
|
1067
|
+
this.error = error;
|
|
1068
|
+
this.hasValue = kind === 'N';
|
|
1069
|
+
}
|
|
1070
|
+
observe(observer) {
|
|
1071
|
+
switch (this.kind) {
|
|
1072
|
+
case 'N':
|
|
1073
|
+
return observer.next && observer.next(this.value);
|
|
1074
|
+
case 'E':
|
|
1075
|
+
return observer.error && observer.error(this.error);
|
|
1076
|
+
case 'C':
|
|
1077
|
+
return observer.complete && observer.complete();
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
do(next, error, complete) {
|
|
1081
|
+
const kind = this.kind;
|
|
1082
|
+
switch (kind) {
|
|
1083
|
+
case 'N':
|
|
1084
|
+
return next && next(this.value);
|
|
1085
|
+
case 'E':
|
|
1086
|
+
return error && error(this.error);
|
|
1087
|
+
case 'C':
|
|
1088
|
+
return complete && complete();
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
accept(nextOrObserver, error, complete) {
|
|
1092
|
+
if (nextOrObserver && typeof nextOrObserver.next === 'function') {
|
|
1093
|
+
return this.observe(nextOrObserver);
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
return this.do(nextOrObserver, error, complete);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
toObservable() {
|
|
1100
|
+
const kind = this.kind;
|
|
1101
|
+
switch (kind) {
|
|
1102
|
+
case 'N':
|
|
1103
|
+
return of(this.value);
|
|
1104
|
+
case 'E':
|
|
1105
|
+
return throwError(this.error);
|
|
1106
|
+
case 'C':
|
|
1107
|
+
return empty$1();
|
|
1108
|
+
}
|
|
1109
|
+
throw new Error('unexpected notification kind value');
|
|
1110
|
+
}
|
|
1111
|
+
static createNext(value) {
|
|
1112
|
+
if (typeof value !== 'undefined') {
|
|
1113
|
+
return new Notification('N', value);
|
|
1114
|
+
}
|
|
1115
|
+
return Notification.undefinedValueNotification;
|
|
1116
|
+
}
|
|
1117
|
+
static createError(err) {
|
|
1118
|
+
return new Notification('E', undefined, err);
|
|
1119
|
+
}
|
|
1120
|
+
static createComplete() {
|
|
1121
|
+
return Notification.completeNotification;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
Notification.completeNotification = new Notification('C');
|
|
1125
|
+
Notification.undefinedValueNotification = new Notification('N', undefined);
|
|
1126
|
+
|
|
281
1127
|
class ObserveOnSubscriber extends Subscriber {
|
|
282
1128
|
constructor(destination, scheduler, delay = 0) {
|
|
283
1129
|
super(destination);
|
|
@@ -414,6 +1260,9 @@ class ReplayEvent {
|
|
|
414
1260
|
}
|
|
415
1261
|
}
|
|
416
1262
|
|
|
1263
|
+
const asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
1264
|
+
const async = asyncScheduler;
|
|
1265
|
+
|
|
417
1266
|
function isObservable(obj) {
|
|
418
1267
|
return !!obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
|
|
419
1268
|
}
|
|
@@ -546,7 +1395,7 @@ const subscribeTo = (result) => {
|
|
|
546
1395
|
return subscribeToIterable(result);
|
|
547
1396
|
}
|
|
548
1397
|
else {
|
|
549
|
-
const value = isObject
|
|
1398
|
+
const value = isObject(result) ? 'an invalid object' : `'${result}'`;
|
|
550
1399
|
const msg = `You provided ${value} where a stream was expected.`
|
|
551
1400
|
+ ' You can provide an Observable, Promise, Array, or Iterable.';
|
|
552
1401
|
throw new TypeError(msg);
|
|
@@ -737,6 +1586,89 @@ class FilterSubscriber extends Subscriber {
|
|
|
737
1586
|
}
|
|
738
1587
|
}
|
|
739
1588
|
|
|
1589
|
+
function isDate(value) {
|
|
1590
|
+
return value instanceof Date && !isNaN(+value);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function delay(delay, scheduler = async) {
|
|
1594
|
+
const absoluteDelay = isDate(delay);
|
|
1595
|
+
const delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
|
|
1596
|
+
return (source) => source.lift(new DelayOperator(delayFor, scheduler));
|
|
1597
|
+
}
|
|
1598
|
+
class DelayOperator {
|
|
1599
|
+
constructor(delay, scheduler) {
|
|
1600
|
+
this.delay = delay;
|
|
1601
|
+
this.scheduler = scheduler;
|
|
1602
|
+
}
|
|
1603
|
+
call(subscriber, source) {
|
|
1604
|
+
return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
class DelaySubscriber extends Subscriber {
|
|
1608
|
+
constructor(destination, delay, scheduler) {
|
|
1609
|
+
super(destination);
|
|
1610
|
+
this.delay = delay;
|
|
1611
|
+
this.scheduler = scheduler;
|
|
1612
|
+
this.queue = [];
|
|
1613
|
+
this.active = false;
|
|
1614
|
+
this.errored = false;
|
|
1615
|
+
}
|
|
1616
|
+
static dispatch(state) {
|
|
1617
|
+
const source = state.source;
|
|
1618
|
+
const queue = source.queue;
|
|
1619
|
+
const scheduler = state.scheduler;
|
|
1620
|
+
const destination = state.destination;
|
|
1621
|
+
while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
|
|
1622
|
+
queue.shift().notification.observe(destination);
|
|
1623
|
+
}
|
|
1624
|
+
if (queue.length > 0) {
|
|
1625
|
+
const delay = Math.max(0, queue[0].time - scheduler.now());
|
|
1626
|
+
this.schedule(state, delay);
|
|
1627
|
+
}
|
|
1628
|
+
else {
|
|
1629
|
+
this.unsubscribe();
|
|
1630
|
+
source.active = false;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
_schedule(scheduler) {
|
|
1634
|
+
this.active = true;
|
|
1635
|
+
const destination = this.destination;
|
|
1636
|
+
destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
|
|
1637
|
+
source: this, destination: this.destination, scheduler: scheduler
|
|
1638
|
+
}));
|
|
1639
|
+
}
|
|
1640
|
+
scheduleNotification(notification) {
|
|
1641
|
+
if (this.errored === true) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
const scheduler = this.scheduler;
|
|
1645
|
+
const message = new DelayMessage(scheduler.now() + this.delay, notification);
|
|
1646
|
+
this.queue.push(message);
|
|
1647
|
+
if (this.active === false) {
|
|
1648
|
+
this._schedule(scheduler);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
_next(value) {
|
|
1652
|
+
this.scheduleNotification(Notification.createNext(value));
|
|
1653
|
+
}
|
|
1654
|
+
_error(err) {
|
|
1655
|
+
this.errored = true;
|
|
1656
|
+
this.queue = [];
|
|
1657
|
+
this.destination.error(err);
|
|
1658
|
+
this.unsubscribe();
|
|
1659
|
+
}
|
|
1660
|
+
_complete() {
|
|
1661
|
+
this.scheduleNotification(Notification.createComplete());
|
|
1662
|
+
this.unsubscribe();
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
class DelayMessage {
|
|
1666
|
+
constructor(time, notification) {
|
|
1667
|
+
this.time = time;
|
|
1668
|
+
this.notification = notification;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
740
1672
|
function distinctUntilChanged(compare, keySelector) {
|
|
741
1673
|
return (source) => source.lift(new DistinctUntilChangedOperator(compare, keySelector));
|
|
742
1674
|
}
|
|
@@ -793,7 +1725,7 @@ class DistinctUntilChangedSubscriber extends Subscriber {
|
|
|
793
1725
|
function take(count) {
|
|
794
1726
|
return (source) => {
|
|
795
1727
|
if (count === 0) {
|
|
796
|
-
return empty();
|
|
1728
|
+
return empty$1();
|
|
797
1729
|
}
|
|
798
1730
|
else {
|
|
799
1731
|
return source.lift(new TakeOperator(count));
|
|
@@ -997,24 +1929,24 @@ function isDev() {
|
|
|
997
1929
|
}
|
|
998
1930
|
|
|
999
1931
|
// @internal
|
|
1000
|
-
function isObject(value) {
|
|
1932
|
+
function isObject$1(value) {
|
|
1001
1933
|
const type = typeof value;
|
|
1002
1934
|
return value != null && (type == 'object' || type == 'function');
|
|
1003
1935
|
}
|
|
1004
1936
|
|
|
1005
1937
|
// @internal
|
|
1006
|
-
function isArray(value) {
|
|
1938
|
+
function isArray$1(value) {
|
|
1007
1939
|
return Array.isArray(value);
|
|
1008
1940
|
}
|
|
1009
1941
|
|
|
1010
1942
|
// @internal
|
|
1011
1943
|
function getActiveEntities(idOrOptions, ids, currentActive) {
|
|
1012
1944
|
let result;
|
|
1013
|
-
if (isArray(idOrOptions)) {
|
|
1945
|
+
if (isArray$1(idOrOptions)) {
|
|
1014
1946
|
result = idOrOptions;
|
|
1015
1947
|
}
|
|
1016
1948
|
else {
|
|
1017
|
-
if (isObject(idOrOptions)) {
|
|
1949
|
+
if (isObject$1(idOrOptions)) {
|
|
1018
1950
|
if (isNil(currentActive))
|
|
1019
1951
|
return;
|
|
1020
1952
|
idOrOptions = Object.assign({ wrap: true }, idOrOptions);
|
|
@@ -1056,14 +1988,14 @@ function isDefined(val) {
|
|
|
1056
1988
|
|
|
1057
1989
|
// @internal
|
|
1058
1990
|
function isEmpty(arr) {
|
|
1059
|
-
if (isArray(arr)) {
|
|
1991
|
+
if (isArray$1(arr)) {
|
|
1060
1992
|
return arr.length === 0;
|
|
1061
1993
|
}
|
|
1062
1994
|
return false;
|
|
1063
1995
|
}
|
|
1064
1996
|
|
|
1065
1997
|
// @internal
|
|
1066
|
-
function isFunction(value) {
|
|
1998
|
+
function isFunction$1(value) {
|
|
1067
1999
|
return typeof value === 'function';
|
|
1068
2000
|
}
|
|
1069
2001
|
|
|
@@ -1078,7 +2010,7 @@ function hasActiveState(state) {
|
|
|
1078
2010
|
}
|
|
1079
2011
|
// @internal
|
|
1080
2012
|
function isMultiActiveState(active) {
|
|
1081
|
-
return isArray(active);
|
|
2013
|
+
return isArray$1(active);
|
|
1082
2014
|
}
|
|
1083
2015
|
// @internal
|
|
1084
2016
|
function resolveActiveEntity({ active, ids, entities }) {
|
|
@@ -1153,7 +2085,7 @@ function applyMiddleware(entities, preAddEntity) {
|
|
|
1153
2085
|
function setEntities({ state, entities, idKey, preAddEntity, isNativePreAdd }) {
|
|
1154
2086
|
let newEntities;
|
|
1155
2087
|
let newIds;
|
|
1156
|
-
if (isArray(entities)) {
|
|
2088
|
+
if (isArray$1(entities)) {
|
|
1157
2089
|
const resolve = toEntitiesObject(entities, idKey, preAddEntity);
|
|
1158
2090
|
newEntities = resolve.entities;
|
|
1159
2091
|
newIds = resolve.ids;
|
|
@@ -1483,7 +2415,7 @@ class Store {
|
|
|
1483
2415
|
}
|
|
1484
2416
|
// @internal
|
|
1485
2417
|
_setState(newState, _dispatchAction = true) {
|
|
1486
|
-
if (isFunction(newState)) {
|
|
2418
|
+
if (isFunction$1(newState)) {
|
|
1487
2419
|
const _newState = newState(this._value());
|
|
1488
2420
|
this.storeValue = __DEV__ ? this.deepFreeze(_newState) : _newState;
|
|
1489
2421
|
}
|
|
@@ -1530,8 +2462,8 @@ class Store {
|
|
|
1530
2462
|
isDev() && setAction('Update');
|
|
1531
2463
|
let newState;
|
|
1532
2464
|
const currentState = this._value();
|
|
1533
|
-
if (isFunction(stateOrCallback)) {
|
|
1534
|
-
newState = isFunction(this._producerFn) ? this._producerFn(currentState, stateOrCallback) : stateOrCallback(currentState);
|
|
2465
|
+
if (isFunction$1(stateOrCallback)) {
|
|
2466
|
+
newState = isFunction$1(this._producerFn) ? this._producerFn(currentState, stateOrCallback) : stateOrCallback(currentState);
|
|
1535
2467
|
}
|
|
1536
2468
|
else {
|
|
1537
2469
|
newState = stateOrCallback;
|
|
@@ -1621,8 +2553,8 @@ function updateEntities({ state, ids, idKey, newStateOrFn, preUpdateEntity, prod
|
|
|
1621
2553
|
}
|
|
1622
2554
|
const oldEntity = state.entities[id];
|
|
1623
2555
|
let newState;
|
|
1624
|
-
if (isFunction(newStateOrFn)) {
|
|
1625
|
-
newState = isFunction(producerFn) ? producerFn(oldEntity, newStateOrFn) : newStateOrFn(oldEntity);
|
|
2556
|
+
if (isFunction$1(newStateOrFn)) {
|
|
2557
|
+
newState = isFunction$1(producerFn) ? producerFn(oldEntity, newStateOrFn) : newStateOrFn(oldEntity);
|
|
1626
2558
|
}
|
|
1627
2559
|
else {
|
|
1628
2560
|
newState = newStateOrFn;
|
|
@@ -1780,7 +2712,7 @@ class EntityStore extends Store {
|
|
|
1780
2712
|
return;
|
|
1781
2713
|
}
|
|
1782
2714
|
let ids = [];
|
|
1783
|
-
if (isFunction(idsOrFnOrState)) {
|
|
2715
|
+
if (isFunction$1(idsOrFnOrState)) {
|
|
1784
2716
|
// We need to filter according the predicate function
|
|
1785
2717
|
ids = this.ids.filter((id) => idsOrFnOrState(this.entities[id]));
|
|
1786
2718
|
}
|
|
@@ -1812,12 +2744,12 @@ class EntityStore extends Store {
|
|
|
1812
2744
|
upsert(ids, newState, onCreate, options = {}) {
|
|
1813
2745
|
const toArray = coerceArray(ids);
|
|
1814
2746
|
const predicate = (isUpdate) => (id) => hasEntity(this.entities, id) === isUpdate;
|
|
1815
|
-
const baseClass = isFunction(onCreate) ? options.baseClass : onCreate ? onCreate.baseClass : undefined;
|
|
1816
|
-
const isClassBased = isFunction(baseClass);
|
|
2747
|
+
const baseClass = isFunction$1(onCreate) ? options.baseClass : onCreate ? onCreate.baseClass : undefined;
|
|
2748
|
+
const isClassBased = isFunction$1(baseClass);
|
|
1817
2749
|
const updateIds = toArray.filter(predicate(true));
|
|
1818
2750
|
const newEntities = toArray.filter(predicate(false)).map((id) => {
|
|
1819
2751
|
const newStateObj = typeof newState === 'function' ? newState({}) : newState;
|
|
1820
|
-
const entity = isFunction(onCreate) ? onCreate(id, newStateObj) : newStateObj;
|
|
2752
|
+
const entity = isFunction$1(onCreate) ? onCreate(id, newStateObj) : newStateObj;
|
|
1821
2753
|
const withId = Object.assign({}, entity, { [this.idKey]: id });
|
|
1822
2754
|
if (isClassBased) {
|
|
1823
2755
|
return new baseClass(withId);
|
|
@@ -1919,7 +2851,7 @@ class EntityStore extends Store {
|
|
|
1919
2851
|
const idPassed = isDefined(idsOrFn);
|
|
1920
2852
|
// null means remove all
|
|
1921
2853
|
let ids = [];
|
|
1922
|
-
if (isFunction(idsOrFn)) {
|
|
2854
|
+
if (isFunction$1(idsOrFn)) {
|
|
1923
2855
|
ids = this.ids.filter((entityId) => idsOrFn(this.entities[entityId]));
|
|
1924
2856
|
}
|
|
1925
2857
|
else {
|
|
@@ -2087,7 +3019,7 @@ class EntityStore extends Store {
|
|
|
2087
3019
|
}
|
|
2088
3020
|
handleUICreation(add = false) {
|
|
2089
3021
|
const ids = this.ids;
|
|
2090
|
-
const isFunc = isFunction(this.ui._akitaCreateEntityFn);
|
|
3022
|
+
const isFunc = isFunction$1(this.ui._akitaCreateEntityFn);
|
|
2091
3023
|
let uiEntities;
|
|
2092
3024
|
const createFn = (id) => {
|
|
2093
3025
|
const current = this.entities[id];
|
|
@@ -2165,7 +3097,7 @@ const queryConfigKey = 'akitaQueryConfig';
|
|
|
2165
3097
|
|
|
2166
3098
|
function compareKeys(keysOrFuncs) {
|
|
2167
3099
|
return function (prevState, currState) {
|
|
2168
|
-
const isFns = isFunction(keysOrFuncs[0]);
|
|
3100
|
+
const isFns = isFunction$1(keysOrFuncs[0]);
|
|
2169
3101
|
// Return when they are NOT changed
|
|
2170
3102
|
return keysOrFuncs.some(keyOrFunc => {
|
|
2171
3103
|
if (isFns) {
|
|
@@ -2187,7 +3119,7 @@ class Query {
|
|
|
2187
3119
|
}
|
|
2188
3120
|
select(project) {
|
|
2189
3121
|
let mapFn;
|
|
2190
|
-
if (isFunction(project)) {
|
|
3122
|
+
if (isFunction$1(project)) {
|
|
2191
3123
|
mapFn = project;
|
|
2192
3124
|
}
|
|
2193
3125
|
else if (isString(project)) {
|
|
@@ -2197,7 +3129,7 @@ class Query {
|
|
|
2197
3129
|
return this.store
|
|
2198
3130
|
._select(state => state)
|
|
2199
3131
|
.pipe(distinctUntilChanged(compareKeys(project)), map(state => {
|
|
2200
|
-
if (isFunction(project[0])) {
|
|
3132
|
+
if (isFunction$1(project[0])) {
|
|
2201
3133
|
return project.map(func => func(state));
|
|
2202
3134
|
}
|
|
2203
3135
|
return project.reduce((acc, k) => {
|
|
@@ -2319,7 +3251,7 @@ function setValue(obj, prop, val) {
|
|
|
2319
3251
|
acc[part] = Object.assign({}, acc[part]);
|
|
2320
3252
|
return acc && acc[part];
|
|
2321
3253
|
}
|
|
2322
|
-
acc[part] = Array.isArray(acc[part]) || !isObject(acc[part]) ? val : Object.assign({}, acc[part], val);
|
|
3254
|
+
acc[part] = Array.isArray(acc[part]) || !isObject$1(acc[part]) ? val : Object.assign({}, acc[part], val);
|
|
2323
3255
|
return acc && acc[part];
|
|
2324
3256
|
}, obj);
|
|
2325
3257
|
return obj;
|
|
@@ -2689,4 +3621,4 @@ var EntityStoreAction;
|
|
|
2689
3621
|
EntityStoreAction["UpsertManyEntities"] = "UPSERT_MANY_ENTITIES";
|
|
2690
3622
|
})(EntityStoreAction || (EntityStoreAction = {}));
|
|
2691
3623
|
|
|
2692
|
-
export { Query as Q, SimpleOuterSubscriber as S, SimpleInnerSubscriber as a,
|
|
3624
|
+
export { Observable as O, Query as Q, SimpleOuterSubscriber as S, SimpleInnerSubscriber as a, isArray as b, isFunction as c, async as d, enableAkitaProdMode as e, from as f, Subscriber as g, distinctUntilChanged as h, innerSubscribe as i, filter as j, StoreConfig as k, Store as l, map as m };
|