@nylas/react 1.3.5 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-circle-icon_2.entry-6e8e4e1e.cjs +1 -0
- package/dist/add-circle-icon_2.entry-dbad9a3b.js +26 -0
- package/dist/archive-icon.entry-21f532af.cjs +1 -0
- package/dist/archive-icon.entry-802f7877.js +16 -0
- package/dist/{arrow-icon.entry-fa9584cf.js → arrow-icon.entry-e3dec626.js} +3 -2
- package/dist/arrow-icon.entry-e9af732a.cjs +1 -0
- package/dist/{bold-icon.entry-ac6a4956.js → bold-icon.entry-0492ff02.js} +3 -2
- package/dist/bold-icon.entry-1a2be28a.cjs +1 -0
- package/dist/button-component_2.entry-f0c7f894.cjs +1 -0
- package/dist/{button-component_2.entry-caf33abf.js → button-component_2.entry-fea9bd3d.js} +10 -9
- package/dist/calendar-agenda-fill-icon_36.entry-70681da2.cjs +6 -0
- package/dist/calendar-agenda-fill-icon_36.entry-c85d6a79.js +4642 -0
- package/dist/calendar-cancel-icon.entry-237b8c9e.cjs +1 -0
- package/dist/{calendar-cancel-icon.entry-02015d74.js → calendar-cancel-icon.entry-e7dd5b8f.js} +6 -5
- package/dist/calendar-check-icon_2.entry-a868e0bc.cjs +1 -0
- package/dist/{calendar-check-icon_2.entry-2f7dc236.js → calendar-check-icon_2.entry-c7f47fc8.js} +10 -9
- package/dist/calendar-icon.entry-071eb30d.cjs +1 -0
- package/dist/{calendar-icon.entry-70ac9bd6.js → calendar-icon.entry-324de624.js} +6 -5
- package/dist/checkbox-component.entry-0f9970cc.js +43 -0
- package/dist/checkbox-component.entry-5bcf4b08.cjs +1 -0
- package/dist/checkmark-icon_15.entry-7776e533.cjs +5 -0
- package/dist/checkmark-icon_15.entry-98377585.js +1337 -0
- package/dist/chevron-icon_3.entry-526b4b85.cjs +1 -0
- package/dist/chevron-icon_3.entry-ec66260c.js +148 -0
- package/dist/{clock-icon_4.entry-af5301d7.js → clock-icon_4.entry-4fa47996.js} +19 -18
- package/dist/clock-icon_4.entry-66d15f7c.cjs +1 -0
- package/dist/{constants-f6e79ab7-24392f9e.js → constants-f5ba52b9-40ab2ded.js} +121 -30
- package/dist/constants-f5ba52b9-a0866d2f.cjs +1 -0
- package/dist/customParseFormat-39eacb44-45ade322.cjs +1 -0
- package/dist/customParseFormat-39eacb44-eeffe2bb.js +135 -0
- package/dist/delete-icon.entry-540aa2bb.cjs +1 -0
- package/dist/{delete-icon.entry-00cb3ee8.js → delete-icon.entry-95d01eb8.js} +7 -6
- package/dist/document-refresh-icon.entry-b82d5da8.js +16 -0
- package/dist/document-refresh-icon.entry-c467f082.cjs +1 -0
- package/dist/elements/index.d.ts +11 -0
- package/dist/{feedbackSync-547e51ee-bcaf691c.js → feedbackSync-47d13bb0-5608d680.js} +1 -1
- package/dist/{feedbackSync-547e51ee-9b572309.cjs → feedbackSync-47d13bb0-9f249f33.cjs} +1 -1
- package/dist/folder-icon.entry-4d48c2ee.cjs +1 -0
- package/dist/{folder-icon.entry-60b3eda5.js → folder-icon.entry-cb0dc63d.js} +5 -4
- package/dist/forward-icon.entry-5aa01f53.js +16 -0
- package/dist/forward-icon.entry-d04aaf6d.cjs +1 -0
- package/dist/globe-icon_2.entry-87e29cdf.cjs +1 -0
- package/dist/globe-icon_2.entry-c7ae78cc.js +200 -0
- package/dist/google-logo-icon_6.entry-80a6bfa3.js +1457 -0
- package/dist/google-logo-icon_6.entry-a8b6efc0.cjs +2 -0
- package/dist/google-meet-icon_5.entry-26d667b6.cjs +1 -0
- package/dist/google-meet-icon_5.entry-4e71c83b.js +56 -0
- package/dist/inbox-icon.entry-60a82bfc.cjs +1 -0
- package/dist/inbox-icon.entry-77e4e17b.js +16 -0
- package/dist/index-04630615.js +17580 -0
- package/dist/index-3d1f13d6.cjs +57 -0
- package/dist/index.d.ts +1 -3
- package/dist/{index.es-2d849a15-2d84f7a5.cjs → index.es-1fdb1e36-830a422f.cjs} +6 -6
- package/dist/{index.es-2d849a15-4eb8e180.js → index.es-1fdb1e36-fbdb04fa.js} +818 -804
- package/dist/info-icon_2.entry-34800b66.cjs +1 -0
- package/dist/info-icon_2.entry-3c483f61.js +35 -0
- package/dist/input-component.entry-ea4016fe.js +84 -0
- package/dist/input-component.entry-f7ccf3d6.cjs +1 -0
- package/dist/input-dropdown_2.entry-c7730cf8.js +231 -0
- package/dist/input-dropdown_2.entry-d4024d2f.cjs +1 -0
- package/dist/italic-icon.entry-6e0805ab.js +16 -0
- package/dist/italic-icon.entry-8127c2ee.cjs +1 -0
- package/dist/multi-select-dropdown_2.entry-49d6f0e7.cjs +1 -0
- package/dist/multi-select-dropdown_2.entry-d749999d.js +187 -0
- package/dist/notebook-store-b61693cd-7a5576e7.js +14 -0
- package/dist/notebook-store-b61693cd-84de36d2.cjs +5 -0
- package/dist/nylas-booked-event-card_12.entry-29337b10.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-3fcfd6f9.js +1418 -0
- package/dist/nylas-call-summary.entry-38aed89a.js +16 -0
- package/dist/nylas-call-summary.entry-e9adcb93.cjs +1 -0
- package/dist/nylas-event-calendar_3.entry-48f656e5.cjs +6 -0
- package/dist/nylas-event-calendar_3.entry-62d1f1f5.js +9693 -0
- package/dist/nylas-form-card.entry-3828ccb1.js +58 -0
- package/dist/nylas-form-card.entry-b900b46e.cjs +1 -0
- package/dist/{nylas-if-state.entry-beef8af6.js → nylas-if-state.entry-2810dcf5.js} +4 -3
- package/dist/nylas-if-state.entry-92af0a51.cjs +1 -0
- package/dist/nylas-key-points.entry-977a6fae.js +29 -0
- package/dist/nylas-key-points.entry-de658637.cjs +1 -0
- package/dist/nylas-login.entry-4a6c11e6.cjs +1 -0
- package/dist/{nylas-login.entry-1661cbd4.js → nylas-login.entry-8101d3d0.js} +4 -3
- package/dist/nylas-provider.entry-b7ac25f5.cjs +1 -0
- package/dist/{nylas-provider.entry-1f140378.js → nylas-provider.entry-c054d68a.js} +6 -5
- package/dist/nylas-scheduler-editor.entry-1538950d.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-f184f72e.js → nylas-scheduler-editor.entry-e35fad5c.js} +530 -272
- package/dist/nylas-scheduling.entry-360b978c.js +439 -0
- package/dist/nylas-scheduling.entry-92351cd2.cjs +1 -0
- package/dist/nylas-transcript.entry-4d973027.cjs +6 -0
- package/dist/nylas-transcript.entry-81e2c821.js +128 -0
- package/dist/nylas-video-player.entry-60268c07.js +39 -0
- package/dist/nylas-video-player.entry-f3c2b073.cjs +1 -0
- package/dist/nylas-video-preview.entry-12e05e4d.cjs +1 -0
- package/dist/nylas-video-preview.entry-320421b6.js +16 -0
- package/dist/{person-icon.entry-f9ca9147.js → person-icon.entry-8533209c.js} +8 -7
- package/dist/person-icon.entry-967ad730.cjs +1 -0
- package/dist/play-icon.entry-15ee8568.js +16 -0
- package/dist/play-icon.entry-7b1fd79d.cjs +1 -0
- package/dist/radio-button-group.entry-24cb342f.cjs +1 -0
- package/dist/radio-button-group.entry-53dcf16c.js +47 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +133 -123
- package/dist/refresh-icon.entry-0486ae54.cjs +1 -0
- package/dist/{refresh-icon.entry-7886041f.js → refresh-icon.entry-f3320971.js} +7 -6
- package/dist/{register-component-677d8d2b-0113766e.js → register-component-504a1cbb-5f986d7f.js} +1 -1
- package/dist/{register-component-677d8d2b-4738af1d.cjs → register-component-504a1cbb-89124fd8.cjs} +1 -1
- package/dist/{reply-all-icon.entry-fdd0058e.js → reply-all-icon.entry-006fd1fb.js} +6 -5
- package/dist/reply-all-icon.entry-2cea1a40.cjs +1 -0
- package/dist/reply-icon.entry-bd252aed.cjs +1 -0
- package/dist/reply-icon.entry-d27166a1.js +16 -0
- package/dist/scheduler-config-store-d6729d8d-4a2defea.cjs +1 -0
- package/dist/{scheduler-config-store-ed4a8dfd-012dcf85.js → scheduler-config-store-d6729d8d-63e34849.js} +4 -1
- package/dist/scheduler-store-baf100ed-5c5d3aa5.cjs +1 -0
- package/dist/scheduler-store-baf100ed-81b183dc.js +533 -0
- package/dist/sent-icon.entry-bf101068.js +16 -0
- package/dist/sent-icon.entry-ee434395.cjs +1 -0
- package/dist/spam-icon.entry-11016b63.cjs +1 -0
- package/dist/spam-icon.entry-5193f9c6.js +16 -0
- package/dist/star-icon.entry-0e269252.cjs +1 -0
- package/dist/{star-icon.entry-501083c1.js → star-icon.entry-9c7449f3.js} +6 -5
- package/dist/stop-icon.entry-2ac11166.js +16 -0
- package/dist/stop-icon.entry-86412c9f.cjs +1 -0
- package/dist/textarea-component.entry-27717409.cjs +1 -0
- package/dist/textarea-component.entry-9df3fa96.js +39 -0
- package/dist/toggle-switch.entry-9623e2b2.cjs +1 -0
- package/dist/toggle-switch.entry-a5ddfad9.js +34 -0
- package/dist/translate-icon.entry-e0617680.cjs +1 -0
- package/dist/{translate-icon.entry-676a4150.js → translate-icon.entry-f22293e6.js} +5 -4
- package/dist/trash-fill-icon.entry-0275f657.cjs +1 -0
- package/dist/trash-fill-icon.entry-2616c5df.js +16 -0
- package/dist/{underline-icon.entry-3513c5ef.js → underline-icon.entry-1110dcb1.js} +5 -4
- package/dist/underline-icon.entry-d54b06ab.cjs +1 -0
- package/dist/warning-icon.entry-6d390ab7.cjs +1 -0
- package/dist/{warning-icon.entry-6e723597.js → warning-icon.entry-9a6e7913.js} +8 -7
- package/package.json +11 -3
- package/dist/add-circle-icon.entry-00c87903.js +0 -15
- package/dist/add-circle-icon.entry-640d2b46.cjs +0 -1
- package/dist/archive-icon.entry-5b209336.cjs +0 -1
- package/dist/archive-icon.entry-e8a39eda.js +0 -15
- package/dist/arrow-icon.entry-a25b7b7e.cjs +0 -1
- package/dist/bold-icon.entry-d837c73d.cjs +0 -1
- package/dist/button-component_2.entry-1471422a.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_53.entry-094bd4b9.cjs +0 -6
- package/dist/calendar-agenda-fill-icon_53.entry-6d7f9c79.js +0 -5757
- package/dist/calendar-cancel-icon.entry-42d3d226.cjs +0 -1
- package/dist/calendar-check-icon_2.entry-45aacd91.cjs +0 -1
- package/dist/calendar-icon.entry-90d67b03.cjs +0 -1
- package/dist/checkbox-component_3.entry-231b2254.cjs +0 -1
- package/dist/checkbox-component_3.entry-7270533c.js +0 -153
- package/dist/chevron-icon_3.entry-3c95cc88.js +0 -147
- package/dist/chevron-icon_3.entry-ead3d4c8.cjs +0 -1
- package/dist/clock-icon_4.entry-b50cce70.cjs +0 -1
- package/dist/close-icon.entry-04008446.cjs +0 -1
- package/dist/close-icon.entry-0a4105c9.js +0 -15
- package/dist/constants-f6e79ab7-23d7236b.cjs +0 -1
- package/dist/copy-icon.entry-312ff230.js +0 -15
- package/dist/copy-icon.entry-74f8ebcd.cjs +0 -1
- package/dist/core-js-38e53e34.cjs +0 -4
- package/dist/core-js-a9d3b6e1.js +0 -3297
- package/dist/delete-icon.entry-b61a6706.cjs +0 -1
- package/dist/document-refresh-icon.entry-1c985b1e.js +0 -15
- package/dist/document-refresh-icon.entry-27ff5cb2.cjs +0 -1
- package/dist/dom-68f08be9.cjs +0 -15
- package/dist/dom-86e17616.js +0 -664
- package/dist/folder-icon.entry-c32a6e15.cjs +0 -1
- package/dist/forward-icon.entry-5f9a7639.js +0 -15
- package/dist/forward-icon.entry-8cd805dc.cjs +0 -1
- package/dist/globe-icon.entry-21a80591.cjs +0 -1
- package/dist/globe-icon.entry-397727e1.js +0 -15
- package/dist/google-logo-icon_4.entry-42e87368.cjs +0 -1
- package/dist/google-logo-icon_4.entry-6ccf8379.js +0 -778
- package/dist/inbox-icon.entry-1e448b4b.js +0 -15
- package/dist/inbox-icon.entry-50605b1d.cjs +0 -1
- package/dist/index-594c8e7b.js +0 -16763
- package/dist/index-cfb93df6.cjs +0 -81
- package/dist/info-icon_2.entry-65e0023f.js +0 -34
- package/dist/info-icon_2.entry-e7b86847.cjs +0 -1
- package/dist/input-color-picker.entry-37d2fb66.js +0 -48
- package/dist/input-color-picker.entry-aabfe638.cjs +0 -1
- package/dist/input-component.entry-51f6da14.cjs +0 -1
- package/dist/input-component.entry-c07d92b1.js +0 -70
- package/dist/input-dropdown_2.entry-20fb0552.cjs +0 -1
- package/dist/input-dropdown_2.entry-90c08f10.js +0 -228
- package/dist/italic-icon.entry-8e5599ff.js +0 -15
- package/dist/italic-icon.entry-ee10a040.cjs +0 -1
- package/dist/multi-select-dropdown.entry-656d2791.cjs +0 -1
- package/dist/multi-select-dropdown.entry-c143becc.js +0 -116
- package/dist/nylas-booked-event-card_12.entry-4974ffe6.js +0 -1332
- package/dist/nylas-booked-event-card_12.entry-669bb872.cjs +0 -1
- package/dist/nylas-form-card.entry-42e718e2.js +0 -57
- package/dist/nylas-form-card.entry-55d3909c.cjs +0 -1
- package/dist/nylas-if-state.entry-4de782b7.cjs +0 -1
- package/dist/nylas-login.entry-d6b80abe.cjs +0 -1
- package/dist/nylas-provider.entry-d5495e1a.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-bebe4e7d.cjs +0 -2
- package/dist/nylas-scheduling.entry-21c04831.cjs +0 -1
- package/dist/nylas-scheduling.entry-c335ad21.js +0 -415
- package/dist/nylas-time-window-picker_2.entry-9e0dd470.js +0 -336
- package/dist/nylas-time-window-picker_2.entry-a2651ee7.cjs +0 -1
- package/dist/person-icon.entry-21946944.cjs +0 -1
- package/dist/play-icon.entry-b27fcb18.cjs +0 -1
- package/dist/play-icon.entry-dbfed5e8.js +0 -15
- package/dist/refresh-icon.entry-9d94a60b.cjs +0 -1
- package/dist/reply-all-icon.entry-f0e0a5c4.cjs +0 -1
- package/dist/reply-icon.entry-0a42fb2c.cjs +0 -1
- package/dist/reply-icon.entry-a8d2b0f8.js +0 -15
- package/dist/scheduler-config-store-ed4a8dfd-a16d5c62.cjs +0 -1
- package/dist/scheduler-store-92eb8804-bc68a43a.js +0 -487
- package/dist/scheduler-store-92eb8804-c3deee73.cjs +0 -1
- package/dist/sent-icon.entry-c3f84a59.cjs +0 -1
- package/dist/sent-icon.entry-e047f087.js +0 -15
- package/dist/spam-icon.entry-55d01416.js +0 -15
- package/dist/spam-icon.entry-671eb165.cjs +0 -1
- package/dist/star-icon.entry-4dcae472.cjs +0 -1
- package/dist/stop-icon.entry-130a28b2.js +0 -15
- package/dist/stop-icon.entry-ed949255.cjs +0 -1
- package/dist/textarea-component.entry-65dd740a.cjs +0 -1
- package/dist/textarea-component.entry-efae9031.js +0 -37
- package/dist/translate-icon.entry-2591baf8.cjs +0 -1
- package/dist/trash-fill-icon.entry-5b373be7.js +0 -15
- package/dist/trash-fill-icon.entry-c411d0e0.cjs +0 -1
- package/dist/underline-icon.entry-6bf14476.cjs +0 -1
- package/dist/warning-icon.entry-719a094d.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as nr, d as T, o as rr, q as bt } from "./index-04630615.js";
|
|
2
2
|
class sr {
|
|
3
3
|
constructor(e, n, r = !0, s) {
|
|
4
4
|
this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
|
|
@@ -59,45 +59,59 @@ class sr {
|
|
|
59
59
|
async registerComponent(e) {
|
|
60
60
|
T(`~[${this.hostTagName}] (registerComponent) Registering component ${e.name}.`);
|
|
61
61
|
const n = e.element.dataset.nylasId;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
n && this.registeredComponents[n] ? (T(`[${this.hostTagName}] (registerComponent) Component ${e.name} already registered. Updating registration.`), this.cleanupComponentRegistration(n, !1)) : e.element.dataset.nylasId = n || rr();
|
|
63
|
+
const s = e.element.dataset.nylasId;
|
|
64
|
+
s && (this.registeredComponents[s] = e), T(`[${this.hostTagName}] (registerComponent) Waiting for "${e.element.localName}" component to be defined`, { component: e });
|
|
65
|
+
try {
|
|
66
|
+
await customElements.whenDefined(e.element.tagName.toLowerCase()), T(`[${this.hostTagName}] (registerComponent) Component "${e.element.localName}" is now defined`);
|
|
67
|
+
} catch (p) {
|
|
68
|
+
T(`[${this.hostTagName}] (registerComponent) Error waiting for component "${e.element.localName}" to be defined:`, p);
|
|
65
69
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var y, g, b, k;
|
|
80
|
-
const [f, m] = h.split("."), v = this.getStore(f).state[m];
|
|
81
|
-
if (!c.dataset.nylasId) {
|
|
70
|
+
const i = this.eventOverrides, { stateToProps: o, getStoresToProp: l, eventToProps: a, storeToProps: c, connectorToProp: h, localPropsToProp: u, element: d } = e;
|
|
71
|
+
a == null || a.forEach((p, m) => {
|
|
72
|
+
var b;
|
|
73
|
+
const f = this.nylasConnector, v = async (w) => {
|
|
74
|
+
T(`[${this.hostTagName}] (registerComponent) Handling "${e.name}" prop "${String(m)}" event.`, { event: w }), m in i && (T(`[${this.hostTagName}] (registerComponent) Found event override for "${String(m)}" event. Calling override.`), await i[m](w, f)), w.defaultPrevented || await p(w, f);
|
|
75
|
+
}, y = e.element.dataset.nylasId;
|
|
76
|
+
y && !this.eventListenerRegistrations.has(y) && this.eventListenerRegistrations.set(y, []), y && ((b = this.eventListenerRegistrations.get(y)) == null || b.push([d, m, v])), T(`[${this.hostTagName}] (registerComponent) Setting "${e.name}" event "${String(m)}" to automcially call NylasConnector method.`);
|
|
77
|
+
const g = bt(m.toString());
|
|
78
|
+
T(`[${this.hostTagName}] (registerComponent) Adding event listener for "${g}" on "${d.tagName}"`), d.addEventListener(g, v);
|
|
79
|
+
}), o == null || o.forEach((p, m) => {
|
|
80
|
+
var b, w, C, k;
|
|
81
|
+
const [f, v] = m.split("."), g = this.getStore(f).state[v];
|
|
82
|
+
if (!d.dataset.nylasId) {
|
|
82
83
|
T(`[${this.hostTagName}] (registerComponent) Component "${e.name}" not registered. Skipping.`, { component: e });
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
this.propStateRegistrations.has(f) || this.propStateRegistrations.set(f, /* @__PURE__ */ new Map()), (
|
|
86
|
-
elementId:
|
|
87
|
-
propKey:
|
|
88
|
-
}) : (
|
|
86
|
+
this.propStateRegistrations.has(f) || this.propStateRegistrations.set(f, /* @__PURE__ */ new Map()), (b = this.propStateRegistrations.get(f)) != null && b.has(v) ? (k = (C = this.propStateRegistrations.get(f)) == null ? void 0 : C.get(v)) == null || k.push({
|
|
87
|
+
elementId: d.dataset.nylasId,
|
|
88
|
+
propKey: p
|
|
89
|
+
}) : (w = this.propStateRegistrations.get(f)) == null || w.set(v, [
|
|
89
90
|
{
|
|
90
|
-
elementId:
|
|
91
|
-
propKey:
|
|
91
|
+
elementId: d.dataset.nylasId,
|
|
92
|
+
propKey: p
|
|
92
93
|
}
|
|
93
|
-
]),
|
|
94
|
-
}),
|
|
95
|
-
const f = this.host[
|
|
96
|
-
|
|
97
|
-
}),
|
|
98
|
-
const f = this.getStore(
|
|
99
|
-
|
|
100
|
-
}),
|
|
94
|
+
]), d[p.toString()] = g, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" value.`, { stateValue: g });
|
|
95
|
+
}), u == null || u.forEach((p, m) => {
|
|
96
|
+
const f = this.host[m];
|
|
97
|
+
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to the value of "${m}" value.`, { value: m, mappedPropValue: f });
|
|
98
|
+
}), l && (d[l == null ? void 0 : l.toString()] = this.getStore, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "getStore" method.`)), c == null || c.forEach((p, m) => {
|
|
99
|
+
const f = this.getStore(m);
|
|
100
|
+
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" store.`, { store: f });
|
|
101
|
+
}), h && (d[h == null ? void 0 : h.toString()] = this.nylasConnector, T(`[${this.hostTagName}] Setting "${e.name}" prop "${h.toString()}" to "nylasConnector" value.`, { connectorToProp: h })), typeof d.registerCallback == "function" && (T(`[${this.hostTagName}] (registerComponent) Calling registerCallback method for "${e.name}".`), await d.registerCallback()), T(`[${this.hostTagName}] (registerComponent) Component ${e.name} registered.`);
|
|
102
|
+
}
|
|
103
|
+
cleanupComponentRegistration(e, n = !0) {
|
|
104
|
+
const r = this.eventListenerRegistrations.get(e);
|
|
105
|
+
r && (r.forEach(([s, i, o]) => {
|
|
106
|
+
const l = bt(i.toString());
|
|
107
|
+
T(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${l}" on "${s.tagName}"`), s.removeEventListener(l, o);
|
|
108
|
+
}), this.eventListenerRegistrations.delete(e)), this.propStateRegistrations.forEach((s, i) => {
|
|
109
|
+
s.forEach((o, l) => {
|
|
110
|
+
var c;
|
|
111
|
+
const a = o.filter((h) => h.elementId !== e);
|
|
112
|
+
a.length !== o.length && ((c = this.propStateRegistrations.get(i)) == null || c.set(l, a));
|
|
113
|
+
});
|
|
114
|
+
}), n && delete this.registeredComponents[e];
|
|
101
115
|
}
|
|
102
116
|
unregisterComponent(e) {
|
|
103
117
|
T(`[${this.hostTagName}] Unregistering component ${e.name}.`);
|
|
@@ -111,16 +125,16 @@ class sr {
|
|
|
111
125
|
return;
|
|
112
126
|
}
|
|
113
127
|
this.propStateRegistrations.forEach((s, i) => {
|
|
114
|
-
s.forEach((o,
|
|
115
|
-
var
|
|
116
|
-
const a = (
|
|
117
|
-
c && ((
|
|
128
|
+
s.forEach((o, l) => {
|
|
129
|
+
var h, u;
|
|
130
|
+
const a = (h = this.propStateRegistrations.get(i)) == null ? void 0 : h.get(l), c = a == null ? void 0 : a.filter((d) => d.elementId !== n);
|
|
131
|
+
c && ((u = this.propStateRegistrations.get(i)) == null || u.set(l, c));
|
|
118
132
|
});
|
|
119
133
|
});
|
|
120
134
|
const r = this.eventListenerRegistrations.get(n);
|
|
121
135
|
r == null || r.forEach(([s, i, o]) => {
|
|
122
|
-
const
|
|
123
|
-
T(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${
|
|
136
|
+
const l = bt(i.toString());
|
|
137
|
+
T(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${l}" on "${s.tagName}"`), s.removeEventListener(l, o);
|
|
124
138
|
}), delete this.registeredComponents[n];
|
|
125
139
|
}
|
|
126
140
|
getStore(e) {
|
|
@@ -139,8 +153,8 @@ class sr {
|
|
|
139
153
|
T(`[${e.hostTagName}] (setupStoreListeners) Store "${n}" state "${s.toString()}" unchanged. Skipping.`);
|
|
140
154
|
return;
|
|
141
155
|
}
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
156
|
+
const l = e.registeredComponents;
|
|
157
|
+
if (!l) {
|
|
144
158
|
T(`[${e.hostTagName}] (setupStoreListeners) No registered components found. Skipping.`);
|
|
145
159
|
return;
|
|
146
160
|
}
|
|
@@ -148,14 +162,14 @@ class sr {
|
|
|
148
162
|
T(`[${e.hostTagName}] (setupStoreListeners) Found ${a.length} prop(s) registered for "${s.toString()}" store.`, {
|
|
149
163
|
props: a,
|
|
150
164
|
propStateRegistrations: e.propStateRegistrations
|
|
151
|
-
}), a.forEach(({ elementId:
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
154
|
-
T(`[${e.hostTagName}] (setupStoreListeners) Component "${
|
|
165
|
+
}), a.forEach(({ elementId: h, propKey: u }) => {
|
|
166
|
+
const d = l[h];
|
|
167
|
+
if (!d) {
|
|
168
|
+
T(`[${e.hostTagName}] (setupStoreListeners) Component "${h}" not found. Skipping.`, { component: d });
|
|
155
169
|
return;
|
|
156
170
|
}
|
|
157
171
|
const m = e.getStore(n).state[s];
|
|
158
|
-
|
|
172
|
+
d.element[u.toString()] = m, T(`[${e.hostTagName}] (setupStoreListeners) Setting "${d.name}" prop "${u.toString()}" to "${s.toString()}" value.`, { stateValue: m });
|
|
159
173
|
});
|
|
160
174
|
}
|
|
161
175
|
});
|
|
@@ -168,25 +182,25 @@ class sr {
|
|
|
168
182
|
}
|
|
169
183
|
class ns extends sr {
|
|
170
184
|
}
|
|
171
|
-
var ir = Object.defineProperty, or = (t, e, n) => e in t ? ir(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n,
|
|
185
|
+
var ir = Object.defineProperty, or = (t, e, n) => e in t ? ir(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Et = (t, e, n) => (or(t, typeof e != "symbol" ? e + "" : e, n), n), ar = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(ar || {});
|
|
172
186
|
const rs = (t) => t !== null && typeof t == "object" && "error" in t;
|
|
173
187
|
async function dn(t) {
|
|
174
188
|
const e = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", e), r = Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
175
189
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
176
190
|
}
|
|
177
|
-
const
|
|
191
|
+
const R = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : nr, j = Object.keys, M = Array.isArray;
|
|
178
192
|
function U(t, e) {
|
|
179
|
-
return typeof e != "object" ||
|
|
193
|
+
return typeof e != "object" || j(e).forEach(function(n) {
|
|
180
194
|
t[n] = e[n];
|
|
181
195
|
}), t;
|
|
182
196
|
}
|
|
183
|
-
typeof Promise > "u" ||
|
|
184
|
-
const Be = Object.getPrototypeOf,
|
|
197
|
+
typeof Promise > "u" || R.Promise || (R.Promise = Promise);
|
|
198
|
+
const Be = Object.getPrototypeOf, lr = {}.hasOwnProperty;
|
|
185
199
|
function z(t, e) {
|
|
186
|
-
return
|
|
200
|
+
return lr.call(t, e);
|
|
187
201
|
}
|
|
188
202
|
function Ce(t, e) {
|
|
189
|
-
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ?
|
|
203
|
+
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ? j : Reflect.ownKeys)(e).forEach((n) => {
|
|
190
204
|
ee(t, n, e[n]);
|
|
191
205
|
});
|
|
192
206
|
}
|
|
@@ -199,13 +213,13 @@ function ke(t) {
|
|
|
199
213
|
return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend: Ce.bind(null, t.prototype) };
|
|
200
214
|
} };
|
|
201
215
|
}
|
|
202
|
-
const
|
|
203
|
-
function
|
|
216
|
+
const ur = Object.getOwnPropertyDescriptor;
|
|
217
|
+
function Zt(t, e) {
|
|
204
218
|
let n;
|
|
205
|
-
return
|
|
219
|
+
return ur(t, e) || (n = Be(t)) && Zt(n, e);
|
|
206
220
|
}
|
|
207
221
|
const cr = [].slice;
|
|
208
|
-
function
|
|
222
|
+
function lt(t, e, n) {
|
|
209
223
|
return cr.call(t, e, n);
|
|
210
224
|
}
|
|
211
225
|
function Pn(t, e) {
|
|
@@ -216,7 +230,7 @@ function Ie(t) {
|
|
|
216
230
|
throw new Error("Assertion Failed");
|
|
217
231
|
}
|
|
218
232
|
function En(t) {
|
|
219
|
-
|
|
233
|
+
R.setImmediate ? setImmediate(t) : setTimeout(t, 0);
|
|
220
234
|
}
|
|
221
235
|
function Tn(t, e) {
|
|
222
236
|
return t.reduce((n, r, s) => {
|
|
@@ -238,8 +252,8 @@ function te(t, e) {
|
|
|
238
252
|
}
|
|
239
253
|
var o = e.indexOf(".");
|
|
240
254
|
if (o !== -1) {
|
|
241
|
-
var
|
|
242
|
-
return
|
|
255
|
+
var l = t[e.substr(0, o)];
|
|
256
|
+
return l === void 0 ? void 0 : te(l, e.substr(o + 1));
|
|
243
257
|
}
|
|
244
258
|
}
|
|
245
259
|
function H(t, e, n) {
|
|
@@ -251,12 +265,12 @@ function H(t, e, n) {
|
|
|
251
265
|
} else {
|
|
252
266
|
var i = e.indexOf(".");
|
|
253
267
|
if (i !== -1) {
|
|
254
|
-
var o = e.substr(0, i),
|
|
255
|
-
if (
|
|
268
|
+
var o = e.substr(0, i), l = e.substr(i + 1);
|
|
269
|
+
if (l === "")
|
|
256
270
|
n === void 0 ? M(t) && !isNaN(parseInt(o)) ? t.splice(o, 1) : delete t[o] : t[o] = n;
|
|
257
271
|
else {
|
|
258
272
|
var a = t[o];
|
|
259
|
-
a && z(t, o) || (a = t[o] = {}), H(a,
|
|
273
|
+
a && z(t, o) || (a = t[o] = {}), H(a, l, n);
|
|
260
274
|
}
|
|
261
275
|
} else
|
|
262
276
|
n === void 0 ? M(t) && !isNaN(parseInt(e)) ? t.splice(e, 1) : delete t[e] : t[e] = n;
|
|
@@ -272,15 +286,15 @@ const hr = [].concat;
|
|
|
272
286
|
function On(t) {
|
|
273
287
|
return hr.apply([], t);
|
|
274
288
|
}
|
|
275
|
-
const In = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) =>
|
|
289
|
+
const In = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) => R[t]), dr = In.map((t) => R[t]);
|
|
276
290
|
Tn(In, (t) => [t, !0]);
|
|
277
291
|
let se = null;
|
|
278
292
|
function We(t) {
|
|
279
293
|
se = typeof WeakMap < "u" && /* @__PURE__ */ new WeakMap();
|
|
280
|
-
const e =
|
|
294
|
+
const e = Tt(t);
|
|
281
295
|
return se = null, e;
|
|
282
296
|
}
|
|
283
|
-
function
|
|
297
|
+
function Tt(t) {
|
|
284
298
|
if (!t || typeof t != "object")
|
|
285
299
|
return t;
|
|
286
300
|
let e = se && se.get(t);
|
|
@@ -289,23 +303,23 @@ function Et(t) {
|
|
|
289
303
|
if (M(t)) {
|
|
290
304
|
e = [], se && se.set(t, e);
|
|
291
305
|
for (var n = 0, r = t.length; n < r; ++n)
|
|
292
|
-
e.push(
|
|
306
|
+
e.push(Tt(t[n]));
|
|
293
307
|
} else if (dr.indexOf(t.constructor) >= 0)
|
|
294
308
|
e = t;
|
|
295
309
|
else {
|
|
296
310
|
const i = Be(t);
|
|
297
311
|
for (var s in e = i === Object.prototype ? {} : Object.create(i), se && se.set(t, e), t)
|
|
298
|
-
z(t, s) && (e[s] =
|
|
312
|
+
z(t, s) && (e[s] = Tt(t[s]));
|
|
299
313
|
}
|
|
300
314
|
return e;
|
|
301
315
|
}
|
|
302
316
|
const { toString: fr } = {};
|
|
303
|
-
function
|
|
317
|
+
function At(t) {
|
|
304
318
|
return fr.call(t).slice(8, -1);
|
|
305
319
|
}
|
|
306
|
-
const
|
|
320
|
+
const Ot = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", pr = typeof Ot == "symbol" ? function(t) {
|
|
307
321
|
var e;
|
|
308
|
-
return t != null && (e = t[
|
|
322
|
+
return t != null && (e = t[Ot]) && e.apply(t);
|
|
309
323
|
} : function() {
|
|
310
324
|
return null;
|
|
311
325
|
}, _e = {};
|
|
@@ -334,12 +348,12 @@ function J(t) {
|
|
|
334
348
|
n[e] = arguments[e];
|
|
335
349
|
return n;
|
|
336
350
|
}
|
|
337
|
-
const
|
|
351
|
+
const en = typeof Symbol < "u" ? (t) => t[Symbol.toStringTag] === "AsyncFunction" : () => !1;
|
|
338
352
|
var G = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
339
|
-
function
|
|
340
|
-
G = t,
|
|
353
|
+
function Rn(t, e) {
|
|
354
|
+
G = t, $n = e;
|
|
341
355
|
}
|
|
342
|
-
var
|
|
356
|
+
var $n = () => !0;
|
|
343
357
|
const mr = !new Error("").stack;
|
|
344
358
|
function Pe() {
|
|
345
359
|
if (mr)
|
|
@@ -350,35 +364,35 @@ function Pe() {
|
|
|
350
364
|
}
|
|
351
365
|
return new Error();
|
|
352
366
|
}
|
|
353
|
-
function
|
|
367
|
+
function It(t, e) {
|
|
354
368
|
var n = t.stack;
|
|
355
369
|
return n ? (e = e || 0, n.indexOf(t.name) === 0 && (e += (t.name + t.message).split(`
|
|
356
370
|
`).length), n.split(`
|
|
357
|
-
`).slice(e).filter(
|
|
371
|
+
`).slice(e).filter($n).map((r) => `
|
|
358
372
|
` + r).join("")) : "";
|
|
359
373
|
}
|
|
360
|
-
var
|
|
374
|
+
var Nn = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], tn = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Nn), gr = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
|
|
361
375
|
function xe(t, e) {
|
|
362
376
|
this._e = Pe(), this.name = t, this.message = e;
|
|
363
377
|
}
|
|
364
|
-
function
|
|
378
|
+
function Kn(t, e) {
|
|
365
379
|
return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
|
|
366
380
|
`);
|
|
367
381
|
}
|
|
368
|
-
function
|
|
369
|
-
this._e = Pe(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message =
|
|
382
|
+
function ut(t, e, n, r) {
|
|
383
|
+
this._e = Pe(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = Kn(t, e);
|
|
370
384
|
}
|
|
371
|
-
function
|
|
372
|
-
this._e = Pe(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message =
|
|
385
|
+
function $e(t, e) {
|
|
386
|
+
this._e = Pe(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = Kn(t, e);
|
|
373
387
|
}
|
|
374
388
|
ke(xe).from(Error).extend({ stack: { get: function() {
|
|
375
|
-
return this._stack || (this._stack = this.name + ": " + this.message +
|
|
389
|
+
return this._stack || (this._stack = this.name + ": " + this.message + It(this._e, 2));
|
|
376
390
|
} }, toString: function() {
|
|
377
391
|
return this.name + ": " + this.message;
|
|
378
|
-
} }), ke(
|
|
379
|
-
var
|
|
392
|
+
} }), ke(ut).from(xe), ke($e).from(xe);
|
|
393
|
+
var nn = tn.reduce((t, e) => (t[e] = e + "Error", t), {});
|
|
380
394
|
const yr = xe;
|
|
381
|
-
var E =
|
|
395
|
+
var E = tn.reduce((t, e) => {
|
|
382
396
|
var n = e + "Error";
|
|
383
397
|
function r(s, i) {
|
|
384
398
|
this._e = Pe(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
|
|
@@ -387,7 +401,7 @@ var E = en.reduce((t, e) => {
|
|
|
387
401
|
return ke(r).from(yr), t[e] = r, t;
|
|
388
402
|
}, {});
|
|
389
403
|
E.Syntax = SyntaxError, E.Type = TypeError, E.Range = RangeError;
|
|
390
|
-
var fn =
|
|
404
|
+
var fn = Nn.reduce((t, e) => (t[e + "Error"] = E[e], t), {}), tt = tn.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = E[e]), t), {});
|
|
391
405
|
function I() {
|
|
392
406
|
}
|
|
393
407
|
function Fe(t) {
|
|
@@ -435,7 +449,7 @@ function kr(t, e) {
|
|
|
435
449
|
return e.apply(this, arguments) !== !1 && t.apply(this, arguments);
|
|
436
450
|
};
|
|
437
451
|
}
|
|
438
|
-
function
|
|
452
|
+
function rn(t, e) {
|
|
439
453
|
return t === I ? e : function() {
|
|
440
454
|
var n = t.apply(this, arguments);
|
|
441
455
|
if (n && typeof n.then == "function") {
|
|
@@ -448,34 +462,34 @@ function nn(t, e) {
|
|
|
448
462
|
return e.apply(this, arguments);
|
|
449
463
|
};
|
|
450
464
|
}
|
|
451
|
-
tt.ModifyError =
|
|
465
|
+
tt.ModifyError = ut, tt.DexieError = xe, tt.BulkError = $e;
|
|
452
466
|
var Me = {};
|
|
453
|
-
const
|
|
467
|
+
const jn = 100, [Rt, ct, $t] = typeof Promise > "u" ? [] : (() => {
|
|
454
468
|
let t = Promise.resolve();
|
|
455
469
|
if (typeof crypto > "u" || !crypto.subtle)
|
|
456
470
|
return [t, Be(t), t];
|
|
457
471
|
const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
458
472
|
return [e, Be(e), t];
|
|
459
|
-
})(), Dn = ct && ct.then, nt =
|
|
460
|
-
var
|
|
461
|
-
|
|
462
|
-
} :
|
|
473
|
+
})(), Dn = ct && ct.then, nt = Rt && Rt.constructor, sn = !!$t;
|
|
474
|
+
var Nt = !1, xr = $t ? () => {
|
|
475
|
+
$t.then(Ye);
|
|
476
|
+
} : R.setImmediate ? setImmediate.bind(null, Ye) : R.MutationObserver ? () => {
|
|
463
477
|
var t = document.createElement("div");
|
|
464
478
|
new MutationObserver(() => {
|
|
465
479
|
Ye(), t = null;
|
|
466
480
|
}).observe(t, { attributes: !0 }), t.setAttribute("i", "1");
|
|
467
481
|
} : () => {
|
|
468
482
|
setTimeout(Ye, 0);
|
|
469
|
-
},
|
|
470
|
-
|
|
471
|
-
},
|
|
483
|
+
}, Ne = function(t, e) {
|
|
484
|
+
Re.push([t, e]), ht && (xr(), ht = !1);
|
|
485
|
+
}, Kt = !0, ht = !0, de = [], rt = [], jt = null, Dt = Fe, Se = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: gn, pgp: !1, env: {}, finalize: function() {
|
|
472
486
|
this.unhandleds.forEach((t) => {
|
|
473
487
|
try {
|
|
474
488
|
gn(t[0], t[1]);
|
|
475
489
|
} catch {
|
|
476
490
|
}
|
|
477
491
|
});
|
|
478
|
-
} }, P = Se,
|
|
492
|
+
} }, P = Se, Re = [], fe = 0, st = [];
|
|
479
493
|
function S(t) {
|
|
480
494
|
if (typeof this != "object")
|
|
481
495
|
throw new TypeError("Promises must be constructed via new");
|
|
@@ -484,25 +498,25 @@ function S(t) {
|
|
|
484
498
|
if (G && (this._stackHolder = Pe(), this._prev = null, this._numPrev = 0), typeof t != "function") {
|
|
485
499
|
if (t !== Me)
|
|
486
500
|
throw new TypeError("Not a function");
|
|
487
|
-
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 &&
|
|
501
|
+
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Ft(this, this._value));
|
|
488
502
|
}
|
|
489
503
|
this._state = null, this._value = null, ++e.ref, Fn(this, t);
|
|
490
504
|
}
|
|
491
|
-
const
|
|
505
|
+
const Bt = { get: function() {
|
|
492
506
|
var t = P, e = dt;
|
|
493
507
|
function n(r, s) {
|
|
494
508
|
var i = !t.global && (t !== P || e !== dt);
|
|
495
509
|
const o = i && !ne();
|
|
496
|
-
var
|
|
497
|
-
|
|
510
|
+
var l = new S((a, c) => {
|
|
511
|
+
on(this, new Bn(ft(r, t, i, o), ft(s, t, i, o), a, c, t));
|
|
498
512
|
});
|
|
499
|
-
return G && Ln(
|
|
513
|
+
return G && Ln(l, this), l;
|
|
500
514
|
}
|
|
501
515
|
return n.prototype = Me, n;
|
|
502
516
|
}, set: function(t) {
|
|
503
|
-
ee(this, "then", t && t.prototype === Me ?
|
|
517
|
+
ee(this, "then", t && t.prototype === Me ? Bt : { get: function() {
|
|
504
518
|
return t;
|
|
505
|
-
}, set:
|
|
519
|
+
}, set: Bt.set });
|
|
506
520
|
} };
|
|
507
521
|
function Bn(t, e, n, r, s) {
|
|
508
522
|
this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
|
|
@@ -518,23 +532,23 @@ function Fn(t, e) {
|
|
|
518
532
|
n instanceof S ? n._then(s, i) : n.then(s, i);
|
|
519
533
|
}) : (t._state = !0, t._value = n, Mn(t)), r && He();
|
|
520
534
|
}
|
|
521
|
-
},
|
|
535
|
+
}, Ft.bind(null, t));
|
|
522
536
|
} catch (n) {
|
|
523
|
-
|
|
537
|
+
Ft(t, n);
|
|
524
538
|
}
|
|
525
539
|
}
|
|
526
|
-
function
|
|
540
|
+
function Ft(t, e) {
|
|
527
541
|
if (rt.push(e), t._state === null) {
|
|
528
542
|
var n = t._lib && ze();
|
|
529
|
-
e =
|
|
543
|
+
e = Dt(e), t._state = !1, t._value = e, G && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
|
|
530
544
|
try {
|
|
531
545
|
r.apply(null, i);
|
|
532
546
|
} catch (o) {
|
|
533
547
|
s && s(o);
|
|
534
548
|
}
|
|
535
549
|
}(() => {
|
|
536
|
-
var r =
|
|
537
|
-
e._promise = t, ee(e, "stack", { get: () =>
|
|
550
|
+
var r = Zt(e, "stack");
|
|
551
|
+
e._promise = t, ee(e, "stack", { get: () => Nt ? r && (r.get ? r.get.apply(e) : r.value) : t.stack });
|
|
538
552
|
}), function(r) {
|
|
539
553
|
de.some((s) => s._value === r._value) || de.push(r);
|
|
540
554
|
}(t), Mn(t), n && He();
|
|
@@ -544,24 +558,24 @@ function Mn(t) {
|
|
|
544
558
|
var e = t._listeners;
|
|
545
559
|
t._listeners = [];
|
|
546
560
|
for (var n = 0, r = e.length; n < r; ++n)
|
|
547
|
-
|
|
561
|
+
on(t, e[n]);
|
|
548
562
|
var s = t._PSD;
|
|
549
|
-
--s.ref || s.finalize(), fe === 0 && (++fe,
|
|
550
|
-
--fe == 0 &&
|
|
563
|
+
--s.ref || s.finalize(), fe === 0 && (++fe, Ne(() => {
|
|
564
|
+
--fe == 0 && an();
|
|
551
565
|
}, []));
|
|
552
566
|
}
|
|
553
|
-
function
|
|
567
|
+
function on(t, e) {
|
|
554
568
|
if (t._state !== null) {
|
|
555
569
|
var n = t._state ? e.onFulfilled : e.onRejected;
|
|
556
570
|
if (n === null)
|
|
557
571
|
return (t._state ? e.resolve : e.reject)(t._value);
|
|
558
|
-
++e.psd.ref, ++fe,
|
|
572
|
+
++e.psd.ref, ++fe, Ne(Sr, [n, t, e]);
|
|
559
573
|
} else
|
|
560
574
|
t._listeners.push(e);
|
|
561
575
|
}
|
|
562
576
|
function Sr(t, e, n) {
|
|
563
577
|
try {
|
|
564
|
-
|
|
578
|
+
jt = e;
|
|
565
579
|
var r, s = e._value;
|
|
566
580
|
e._state ? r = t(s) : (rt.length && (rt = []), r = t(s), rt.indexOf(s) === -1 && function(i) {
|
|
567
581
|
for (var o = de.length; o; )
|
|
@@ -571,7 +585,7 @@ function Sr(t, e, n) {
|
|
|
571
585
|
} catch (i) {
|
|
572
586
|
n.reject(i);
|
|
573
587
|
} finally {
|
|
574
|
-
|
|
588
|
+
jt = null, --fe == 0 && an(), --n.psd.ref || n.psd.finalize();
|
|
575
589
|
}
|
|
576
590
|
}
|
|
577
591
|
function qn(t, e, n) {
|
|
@@ -580,9 +594,9 @@ function qn(t, e, n) {
|
|
|
580
594
|
var r = "";
|
|
581
595
|
if (t._state === !1) {
|
|
582
596
|
var s, i, o = t._value;
|
|
583
|
-
o != null ? (s = o.name || "Error", i = o.message || o, r =
|
|
597
|
+
o != null ? (s = o.name || "Error", i = o.message || o, r = It(o, 0)) : (s = o, i = ""), e.push(s + (i ? ": " + i : "") + r);
|
|
584
598
|
}
|
|
585
|
-
return G && ((r =
|
|
599
|
+
return G && ((r = It(t._stackHolder, 2)) && e.indexOf(r) === -1 && e.push(r), t._prev && qn(t._prev, e, n)), e;
|
|
586
600
|
}
|
|
587
601
|
function Ln(t, e) {
|
|
588
602
|
var n = e ? e._numPrev + 1 : 0;
|
|
@@ -592,21 +606,21 @@ function Ye() {
|
|
|
592
606
|
ze() && He();
|
|
593
607
|
}
|
|
594
608
|
function ze() {
|
|
595
|
-
var t =
|
|
596
|
-
return
|
|
609
|
+
var t = Kt;
|
|
610
|
+
return Kt = !1, ht = !1, t;
|
|
597
611
|
}
|
|
598
612
|
function He() {
|
|
599
613
|
var t, e, n;
|
|
600
614
|
do
|
|
601
|
-
for (;
|
|
602
|
-
for (t =
|
|
615
|
+
for (; Re.length > 0; )
|
|
616
|
+
for (t = Re, Re = [], n = t.length, e = 0; e < n; ++e) {
|
|
603
617
|
var r = t[e];
|
|
604
618
|
r[0].apply(null, r[1]);
|
|
605
619
|
}
|
|
606
|
-
while (
|
|
607
|
-
|
|
620
|
+
while (Re.length > 0);
|
|
621
|
+
Kt = !0, ht = !0;
|
|
608
622
|
}
|
|
609
|
-
function
|
|
623
|
+
function an() {
|
|
610
624
|
var t = de;
|
|
611
625
|
de = [], t.forEach((r) => {
|
|
612
626
|
r._PSD.onunhandled.call(null, r._value, r);
|
|
@@ -617,7 +631,7 @@ function on() {
|
|
|
617
631
|
function Ge(t) {
|
|
618
632
|
return new S(Me, !1, t);
|
|
619
633
|
}
|
|
620
|
-
function
|
|
634
|
+
function $(t, e) {
|
|
621
635
|
var n = P;
|
|
622
636
|
return function() {
|
|
623
637
|
var r = ze(), s = P;
|
|
@@ -630,8 +644,8 @@ function j(t, e) {
|
|
|
630
644
|
}
|
|
631
645
|
};
|
|
632
646
|
}
|
|
633
|
-
Ce(S.prototype, { then:
|
|
634
|
-
|
|
647
|
+
Ce(S.prototype, { then: Bt, _then: function(t, e) {
|
|
648
|
+
on(this, new Bn(null, null, t, e, P));
|
|
635
649
|
}, catch: function(t) {
|
|
636
650
|
if (arguments.length === 1)
|
|
637
651
|
return this.then(null, t);
|
|
@@ -643,12 +657,12 @@ Ce(S.prototype, { then: Dt, _then: function(t, e) {
|
|
|
643
657
|
if (this._stack)
|
|
644
658
|
return this._stack;
|
|
645
659
|
try {
|
|
646
|
-
|
|
660
|
+
Nt = !0;
|
|
647
661
|
var t = qn(this, [], 20).join(`
|
|
648
662
|
From previous: `);
|
|
649
663
|
return this._state !== null && (this._stack = t), t;
|
|
650
664
|
} finally {
|
|
651
|
-
|
|
665
|
+
Nt = !1;
|
|
652
666
|
}
|
|
653
667
|
} }, timeout: function(t, e) {
|
|
654
668
|
return t < 1 / 0 ? new S((n, r) => {
|
|
@@ -672,25 +686,25 @@ From previous: `);
|
|
|
672
686
|
t.then(n, r);
|
|
673
687
|
});
|
|
674
688
|
var e = new S(Me, !0, t);
|
|
675
|
-
return Ln(e,
|
|
689
|
+
return Ln(e, jt), e;
|
|
676
690
|
}, reject: Ge, race: function() {
|
|
677
691
|
var t = J.apply(null, arguments).map(Xe);
|
|
678
692
|
return new S((e, n) => {
|
|
679
693
|
t.map((r) => S.resolve(r).then(e, n));
|
|
680
694
|
});
|
|
681
|
-
}, PSD: { get: () => P, set: (t) => P = t }, totalEchoes: { get: () => dt }, newPSD: oe, usePSD: Te, scheduler: { get: () =>
|
|
682
|
-
|
|
683
|
-
} }, rejectionMapper: { get: () =>
|
|
684
|
-
|
|
695
|
+
}, PSD: { get: () => P, set: (t) => P = t }, totalEchoes: { get: () => dt }, newPSD: oe, usePSD: Te, scheduler: { get: () => Ne, set: (t) => {
|
|
696
|
+
Ne = t;
|
|
697
|
+
} }, rejectionMapper: { get: () => Dt, set: (t) => {
|
|
698
|
+
Dt = t;
|
|
685
699
|
} }, follow: (t, e) => new S((n, r) => oe((s, i) => {
|
|
686
700
|
var o = P;
|
|
687
701
|
o.unhandleds = [], o.onunhandled = i, o.finalize = me(function() {
|
|
688
|
-
(function(
|
|
702
|
+
(function(l) {
|
|
689
703
|
function a() {
|
|
690
|
-
|
|
704
|
+
l(), st.splice(st.indexOf(a), 1);
|
|
691
705
|
}
|
|
692
|
-
st.push(a), ++fe,
|
|
693
|
-
--fe == 0 &&
|
|
706
|
+
st.push(a), ++fe, Ne(() => {
|
|
707
|
+
--fe == 0 && an();
|
|
694
708
|
}, []);
|
|
695
709
|
})(() => {
|
|
696
710
|
this.unhandleds.length === 0 ? s() : i(this.unhandleds[0]);
|
|
@@ -710,28 +724,28 @@ From previous: `);
|
|
|
710
724
|
t.length === 0 && n(new AggregateError([]));
|
|
711
725
|
let r = t.length;
|
|
712
726
|
const s = new Array(r);
|
|
713
|
-
t.forEach((i, o) => S.resolve(i).then((
|
|
714
|
-
s[o] =
|
|
727
|
+
t.forEach((i, o) => S.resolve(i).then((l) => e(l), (l) => {
|
|
728
|
+
s[o] = l, --r || n(new AggregateError(s));
|
|
715
729
|
}));
|
|
716
730
|
});
|
|
717
731
|
}));
|
|
718
732
|
const F = { awaits: 0, echoes: 0, id: 0 };
|
|
719
|
-
var Cr = 0, it = [],
|
|
733
|
+
var Cr = 0, it = [], wt = 0, dt = 0, Pr = 0;
|
|
720
734
|
function oe(t, e, n, r) {
|
|
721
735
|
var s = P, i = Object.create(s);
|
|
722
736
|
i.parent = s, i.ref = 0, i.global = !1, i.id = ++Pr;
|
|
723
737
|
var o = Se.env;
|
|
724
|
-
i.env =
|
|
738
|
+
i.env = sn ? { Promise: S, PromiseProp: { value: S, configurable: !0, writable: !0 }, all: S.all, race: S.race, allSettled: S.allSettled, any: S.any, resolve: S.resolve, reject: S.reject, nthen: pn(o.nthen, i), gthen: pn(o.gthen, i) } : {}, e && U(i, e), ++s.ref, i.finalize = function() {
|
|
725
739
|
--this.parent.ref || this.parent.finalize();
|
|
726
740
|
};
|
|
727
|
-
var
|
|
728
|
-
return i.ref === 0 && i.finalize(),
|
|
741
|
+
var l = Te(i, t, n, r);
|
|
742
|
+
return i.ref === 0 && i.finalize(), l;
|
|
729
743
|
}
|
|
730
744
|
function Ee() {
|
|
731
|
-
return F.id || (F.id = ++Cr), ++F.awaits, F.echoes +=
|
|
745
|
+
return F.id || (F.id = ++Cr), ++F.awaits, F.echoes += jn, F.id;
|
|
732
746
|
}
|
|
733
747
|
function ne() {
|
|
734
|
-
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits *
|
|
748
|
+
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * jn, !0);
|
|
735
749
|
}
|
|
736
750
|
function Xe(t) {
|
|
737
751
|
return F.echoes && t && t.constructor === nt ? (Ee(), t.then((e) => (ne(), e), (e) => (ne(), D(e)))) : t;
|
|
@@ -745,14 +759,14 @@ function Tr() {
|
|
|
745
759
|
}
|
|
746
760
|
function ae(t, e) {
|
|
747
761
|
var n = P;
|
|
748
|
-
if ((e ? !F.echoes ||
|
|
762
|
+
if ((e ? !F.echoes || wt++ && t === P : !wt || --wt && t === P) || Vn(e ? Er.bind(null, t) : Tr), t !== P && (P = t, n === Se && (Se.env = Un()), sn)) {
|
|
749
763
|
var r = Se.env.Promise, s = t.env;
|
|
750
|
-
ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(
|
|
764
|
+
ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(R, "Promise", s.PromiseProp), r.all = s.all, r.race = s.race, r.resolve = s.resolve, r.reject = s.reject, s.allSettled && (r.allSettled = s.allSettled), s.any && (r.any = s.any));
|
|
751
765
|
}
|
|
752
766
|
}
|
|
753
767
|
function Un() {
|
|
754
|
-
var t =
|
|
755
|
-
return
|
|
768
|
+
var t = R.Promise;
|
|
769
|
+
return sn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor(R, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: ct.then, gthen: t.prototype.then } : {};
|
|
756
770
|
}
|
|
757
771
|
function Te(t, e, n, r, s) {
|
|
758
772
|
var i = P;
|
|
@@ -763,7 +777,7 @@ function Te(t, e, n, r, s) {
|
|
|
763
777
|
}
|
|
764
778
|
}
|
|
765
779
|
function Vn(t) {
|
|
766
|
-
Dn.call(
|
|
780
|
+
Dn.call(Rt, t);
|
|
767
781
|
}
|
|
768
782
|
function ft(t, e, n, r) {
|
|
769
783
|
return typeof t != "function" ? t : function() {
|
|
@@ -792,9 +806,9 @@ function gn(t, e) {
|
|
|
792
806
|
if (n !== !1)
|
|
793
807
|
try {
|
|
794
808
|
var r, s = { promise: e, reason: t };
|
|
795
|
-
if (
|
|
809
|
+
if (R.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent(mn, !0, !0), U(r, s)) : R.CustomEvent && U(r = new CustomEvent(mn, { detail: s }), s), r && R.dispatchEvent && (dispatchEvent(r), !R.PromiseRejectionEvent && R.onunhandledrejection))
|
|
796
810
|
try {
|
|
797
|
-
|
|
811
|
+
R.onunhandledrejection(r);
|
|
798
812
|
} catch {
|
|
799
813
|
}
|
|
800
814
|
G && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);
|
|
@@ -802,13 +816,13 @@ function gn(t, e) {
|
|
|
802
816
|
}
|
|
803
817
|
}
|
|
804
818
|
var D = S.reject;
|
|
805
|
-
function
|
|
819
|
+
function Mt(t, e, n, r) {
|
|
806
820
|
if (t.idbdb && (t._state.openComplete || P.letThrough || t._vip)) {
|
|
807
821
|
var s = t._createTransaction(e, n, t._dbSchema);
|
|
808
822
|
try {
|
|
809
823
|
s.create(), t._state.PR1398_maxLoop = 3;
|
|
810
824
|
} catch (i) {
|
|
811
|
-
return i.name ===
|
|
825
|
+
return i.name === nn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Mt(t, e, n, r))) : D(i);
|
|
812
826
|
}
|
|
813
827
|
return s._promise(e, (i, o) => oe(() => (P.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
|
|
814
828
|
}
|
|
@@ -819,9 +833,9 @@ function Ft(t, e, n, r) {
|
|
|
819
833
|
return D(new E.DatabaseClosed());
|
|
820
834
|
t.open().catch(I);
|
|
821
835
|
}
|
|
822
|
-
return t._state.dbReadyPromise.then(() =>
|
|
836
|
+
return t._state.dbReadyPromise.then(() => Mt(t, e, n, r));
|
|
823
837
|
}
|
|
824
|
-
const yn = "3.2.4", he = String.fromCharCode(65535),
|
|
838
|
+
const yn = "3.2.4", he = String.fromCharCode(65535), qt = -1 / 0, X = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Wn = "String expected.", Ke = [], gt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Ar = gt, Or = gt, zn = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), yt = "__dbnames", _t = "readonly", kt = "readwrite";
|
|
825
839
|
function ge(t, e) {
|
|
826
840
|
return t ? e ? function() {
|
|
827
841
|
return t.apply(this, arguments) && e.apply(this, arguments);
|
|
@@ -834,16 +848,16 @@ function Qe(t) {
|
|
|
834
848
|
class Ir {
|
|
835
849
|
_trans(e, n, r) {
|
|
836
850
|
const s = this._tx || P.trans, i = this.name;
|
|
837
|
-
function o(a, c,
|
|
838
|
-
if (!
|
|
851
|
+
function o(a, c, h) {
|
|
852
|
+
if (!h.schema[i])
|
|
839
853
|
throw new E.NotFound("Table " + i + " not part of transaction");
|
|
840
|
-
return n(
|
|
854
|
+
return n(h.idbtrans, h);
|
|
841
855
|
}
|
|
842
|
-
const
|
|
856
|
+
const l = ze();
|
|
843
857
|
try {
|
|
844
|
-
return s && s.db === this.db ? s === P.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: P.transless || P }) :
|
|
858
|
+
return s && s.db === this.db ? s === P.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: P.transless || P }) : Mt(this.db, e, [this.name], o);
|
|
845
859
|
} finally {
|
|
846
|
-
|
|
860
|
+
l && He();
|
|
847
861
|
}
|
|
848
862
|
}
|
|
849
863
|
get(e, n) {
|
|
@@ -854,29 +868,29 @@ class Ir {
|
|
|
854
868
|
return new this.db.WhereClause(this, e);
|
|
855
869
|
if (M(e))
|
|
856
870
|
return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
857
|
-
const n =
|
|
871
|
+
const n = j(e);
|
|
858
872
|
if (n.length === 1)
|
|
859
873
|
return this.where(n[0]).equals(e[n[0]]);
|
|
860
|
-
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((
|
|
874
|
+
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((h) => c.keyPath.indexOf(h) >= 0) && c.keyPath.every((h) => n.indexOf(h) >= 0))[0];
|
|
861
875
|
if (r && this.db._maxKey !== he)
|
|
862
876
|
return this.where(r.name).equals(r.keyPath.map((c) => e[c]));
|
|
863
877
|
!r && G && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);
|
|
864
878
|
const { idxByName: s } = this.schema, i = this.db._deps.indexedDB;
|
|
865
|
-
function o(c,
|
|
879
|
+
function o(c, h) {
|
|
866
880
|
try {
|
|
867
|
-
return i.cmp(c,
|
|
881
|
+
return i.cmp(c, h) === 0;
|
|
868
882
|
} catch {
|
|
869
883
|
return !1;
|
|
870
884
|
}
|
|
871
885
|
}
|
|
872
|
-
const [
|
|
873
|
-
const
|
|
874
|
-
return [c ||
|
|
875
|
-
const
|
|
876
|
-
return M(
|
|
877
|
-
} : (m) => o(
|
|
886
|
+
const [l, a] = n.reduce(([c, h], u) => {
|
|
887
|
+
const d = s[u], p = e[u];
|
|
888
|
+
return [c || d, c || !d ? ge(h, d && d.multi ? (m) => {
|
|
889
|
+
const f = te(m, u);
|
|
890
|
+
return M(f) && f.some((v) => o(p, v));
|
|
891
|
+
} : (m) => o(p, te(m, u))) : h];
|
|
878
892
|
}, [null, null]);
|
|
879
|
-
return
|
|
893
|
+
return l ? this.where(l.name).equals(e[l.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
|
|
880
894
|
}
|
|
881
895
|
filter(e) {
|
|
882
896
|
return this.toCollection().and(e);
|
|
@@ -946,7 +960,7 @@ class Ir {
|
|
|
946
960
|
if (r === void 0)
|
|
947
961
|
return D(new E.InvalidArgument("Given object does not contain its primary key"));
|
|
948
962
|
try {
|
|
949
|
-
typeof n != "function" ?
|
|
963
|
+
typeof n != "function" ? j(n).forEach((s) => {
|
|
950
964
|
H(e, s, n[s]);
|
|
951
965
|
}) : n(e, { value: e, primKey: r });
|
|
952
966
|
} catch {
|
|
@@ -978,34 +992,34 @@ class Ir {
|
|
|
978
992
|
bulkAdd(e, n, r) {
|
|
979
993
|
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
980
994
|
return this._trans("readwrite", (o) => {
|
|
981
|
-
const { auto:
|
|
995
|
+
const { auto: l, keyPath: a } = this.schema.primKey;
|
|
982
996
|
if (a && s)
|
|
983
997
|
throw new E.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
984
998
|
if (s && s.length !== e.length)
|
|
985
999
|
throw new E.InvalidArgument("Arguments objects and keys must have the same length");
|
|
986
1000
|
const c = e.length;
|
|
987
|
-
let
|
|
988
|
-
return this.core.mutate({ trans: o, type: "add", keys: s, values:
|
|
989
|
-
if (
|
|
990
|
-
return i ?
|
|
991
|
-
throw new
|
|
1001
|
+
let h = a && l ? e.map(Qe(a)) : e;
|
|
1002
|
+
return this.core.mutate({ trans: o, type: "add", keys: s, values: h, wantResults: i }).then(({ numFailures: u, results: d, lastResult: p, failures: m }) => {
|
|
1003
|
+
if (u === 0)
|
|
1004
|
+
return i ? d : p;
|
|
1005
|
+
throw new $e(`${this.name}.bulkAdd(): ${u} of ${c} operations failed`, m);
|
|
992
1006
|
});
|
|
993
1007
|
});
|
|
994
1008
|
}
|
|
995
1009
|
bulkPut(e, n, r) {
|
|
996
1010
|
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
997
1011
|
return this._trans("readwrite", (o) => {
|
|
998
|
-
const { auto:
|
|
1012
|
+
const { auto: l, keyPath: a } = this.schema.primKey;
|
|
999
1013
|
if (a && s)
|
|
1000
1014
|
throw new E.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1001
1015
|
if (s && s.length !== e.length)
|
|
1002
1016
|
throw new E.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1003
1017
|
const c = e.length;
|
|
1004
|
-
let
|
|
1005
|
-
return this.core.mutate({ trans: o, type: "put", keys: s, values:
|
|
1006
|
-
if (
|
|
1007
|
-
return i ?
|
|
1008
|
-
throw new
|
|
1018
|
+
let h = a && l ? e.map(Qe(a)) : e;
|
|
1019
|
+
return this.core.mutate({ trans: o, type: "put", keys: s, values: h, wantResults: i }).then(({ numFailures: u, results: d, lastResult: p, failures: m }) => {
|
|
1020
|
+
if (u === 0)
|
|
1021
|
+
return i ? d : p;
|
|
1022
|
+
throw new $e(`${this.name}.bulkPut(): ${u} of ${c} operations failed`, m);
|
|
1009
1023
|
});
|
|
1010
1024
|
});
|
|
1011
1025
|
}
|
|
@@ -1014,13 +1028,13 @@ class Ir {
|
|
|
1014
1028
|
return this._trans("readwrite", (r) => this.core.mutate({ trans: r, type: "delete", keys: e })).then(({ numFailures: r, lastResult: s, failures: i }) => {
|
|
1015
1029
|
if (r === 0)
|
|
1016
1030
|
return s;
|
|
1017
|
-
throw new
|
|
1031
|
+
throw new $e(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
|
|
1018
1032
|
});
|
|
1019
1033
|
}
|
|
1020
1034
|
}
|
|
1021
|
-
function
|
|
1022
|
-
var e = {}, n = function(o,
|
|
1023
|
-
if (
|
|
1035
|
+
function je(t) {
|
|
1036
|
+
var e = {}, n = function(o, l) {
|
|
1037
|
+
if (l) {
|
|
1024
1038
|
for (var a = arguments.length, c = new Array(a - 1); --a; )
|
|
1025
1039
|
c[a - 1] = arguments[a];
|
|
1026
1040
|
return e[o].subscribe.apply(null, c), t;
|
|
@@ -1032,32 +1046,32 @@ function Ne(t) {
|
|
|
1032
1046
|
for (var r = 1, s = arguments.length; r < s; ++r)
|
|
1033
1047
|
i(arguments[r]);
|
|
1034
1048
|
return n;
|
|
1035
|
-
function i(o,
|
|
1049
|
+
function i(o, l, a) {
|
|
1036
1050
|
if (typeof o != "object") {
|
|
1037
1051
|
var c;
|
|
1038
|
-
|
|
1039
|
-
var
|
|
1040
|
-
|
|
1041
|
-
}, unsubscribe: function(
|
|
1042
|
-
|
|
1043
|
-
return
|
|
1044
|
-
}),
|
|
1052
|
+
l || (l = kr), a || (a = I);
|
|
1053
|
+
var h = { subscribers: [], fire: a, subscribe: function(u) {
|
|
1054
|
+
h.subscribers.indexOf(u) === -1 && (h.subscribers.push(u), h.fire = l(h.fire, u));
|
|
1055
|
+
}, unsubscribe: function(u) {
|
|
1056
|
+
h.subscribers = h.subscribers.filter(function(d) {
|
|
1057
|
+
return d !== u;
|
|
1058
|
+
}), h.fire = h.subscribers.reduce(l, a);
|
|
1045
1059
|
} };
|
|
1046
|
-
return e[o] = n[o] =
|
|
1060
|
+
return e[o] = n[o] = h, h;
|
|
1047
1061
|
}
|
|
1048
|
-
|
|
1049
|
-
var
|
|
1050
|
-
if (M(
|
|
1051
|
-
i(
|
|
1062
|
+
j(c = o).forEach(function(u) {
|
|
1063
|
+
var d = c[u];
|
|
1064
|
+
if (M(d))
|
|
1065
|
+
i(u, c[u][0], c[u][1]);
|
|
1052
1066
|
else {
|
|
1053
|
-
if (
|
|
1067
|
+
if (d !== "asap")
|
|
1054
1068
|
throw new E.InvalidArgument("Invalid event config");
|
|
1055
|
-
var
|
|
1056
|
-
for (var m = arguments.length,
|
|
1057
|
-
|
|
1058
|
-
|
|
1069
|
+
var p = i(u, Fe, function() {
|
|
1070
|
+
for (var m = arguments.length, f = new Array(m); m--; )
|
|
1071
|
+
f[m] = arguments[m];
|
|
1072
|
+
p.subscribers.forEach(function(v) {
|
|
1059
1073
|
En(function() {
|
|
1060
|
-
v.apply(null,
|
|
1074
|
+
v.apply(null, f);
|
|
1061
1075
|
});
|
|
1062
1076
|
});
|
|
1063
1077
|
});
|
|
@@ -1071,10 +1085,10 @@ function Oe(t, e) {
|
|
|
1071
1085
|
function be(t, e) {
|
|
1072
1086
|
return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
|
|
1073
1087
|
}
|
|
1074
|
-
function
|
|
1088
|
+
function xt(t, e) {
|
|
1075
1089
|
t.filter = ge(t.filter, e);
|
|
1076
1090
|
}
|
|
1077
|
-
function
|
|
1091
|
+
function St(t, e, n) {
|
|
1078
1092
|
var r = t.replayFilter;
|
|
1079
1093
|
t.replayFilter = r ? () => ge(r(), e()) : e, t.justLimit = n && !r;
|
|
1080
1094
|
}
|
|
@@ -1093,10 +1107,10 @@ function vn(t, e, n) {
|
|
|
1093
1107
|
function Je(t, e, n, r) {
|
|
1094
1108
|
const s = t.replayFilter ? ge(t.filter, t.replayFilter()) : t.filter;
|
|
1095
1109
|
if (t.or) {
|
|
1096
|
-
const i = {}, o = (
|
|
1097
|
-
if (!s || s(a, c, (
|
|
1098
|
-
var
|
|
1099
|
-
|
|
1110
|
+
const i = {}, o = (l, a, c) => {
|
|
1111
|
+
if (!s || s(a, c, (d) => a.stop(d), (d) => a.fail(d))) {
|
|
1112
|
+
var h = a.primaryKey, u = "" + h;
|
|
1113
|
+
u === "[object ArrayBuffer]" && (u = "" + new Uint8Array(h)), z(i, u) || (i[u] = !0, e(l, a, c));
|
|
1100
1114
|
}
|
|
1101
1115
|
};
|
|
1102
1116
|
return Promise.all([t.or._iterate(o, n), bn(vn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
|
|
@@ -1104,16 +1118,16 @@ function Je(t, e, n, r) {
|
|
|
1104
1118
|
return bn(vn(t, r, n), ge(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
|
|
1105
1119
|
}
|
|
1106
1120
|
function bn(t, e, n, r) {
|
|
1107
|
-
var s =
|
|
1121
|
+
var s = $(r ? (i, o, l) => n(r(i), o, l) : n);
|
|
1108
1122
|
return t.then((i) => {
|
|
1109
1123
|
if (i)
|
|
1110
1124
|
return i.start(() => {
|
|
1111
1125
|
var o = () => i.continue();
|
|
1112
|
-
e && !e(i, (
|
|
1113
|
-
i.stop(
|
|
1114
|
-
}, (
|
|
1115
|
-
i.fail(
|
|
1116
|
-
}) || s(i.value, i, (
|
|
1126
|
+
e && !e(i, (l) => o = l, (l) => {
|
|
1127
|
+
i.stop(l), o = I;
|
|
1128
|
+
}, (l) => {
|
|
1129
|
+
i.fail(l), o = I;
|
|
1130
|
+
}) || s(i.value, i, (l) => o = l), o();
|
|
1117
1131
|
});
|
|
1118
1132
|
});
|
|
1119
1133
|
}
|
|
@@ -1129,21 +1143,21 @@ function L(t, e) {
|
|
|
1129
1143
|
return t > e ? 1 : t < e ? -1 : 0;
|
|
1130
1144
|
case "binary":
|
|
1131
1145
|
return function(s, i) {
|
|
1132
|
-
const o = s.length,
|
|
1146
|
+
const o = s.length, l = i.length, a = o < l ? o : l;
|
|
1133
1147
|
for (let c = 0; c < a; ++c)
|
|
1134
1148
|
if (s[c] !== i[c])
|
|
1135
1149
|
return s[c] < i[c] ? -1 : 1;
|
|
1136
|
-
return o ===
|
|
1150
|
+
return o === l ? 0 : o < l ? -1 : 1;
|
|
1137
1151
|
}(_n(t), _n(e));
|
|
1138
1152
|
case "Array":
|
|
1139
1153
|
return function(s, i) {
|
|
1140
|
-
const o = s.length,
|
|
1154
|
+
const o = s.length, l = i.length, a = o < l ? o : l;
|
|
1141
1155
|
for (let c = 0; c < a; ++c) {
|
|
1142
|
-
const
|
|
1143
|
-
if (
|
|
1144
|
-
return
|
|
1156
|
+
const h = L(s[c], i[c]);
|
|
1157
|
+
if (h !== 0)
|
|
1158
|
+
return h;
|
|
1145
1159
|
}
|
|
1146
|
-
return o ===
|
|
1160
|
+
return o === l ? 0 : o < l ? -1 : 1;
|
|
1147
1161
|
}(t, e);
|
|
1148
1162
|
}
|
|
1149
1163
|
} catch {
|
|
@@ -1156,13 +1170,13 @@ function wn(t) {
|
|
|
1156
1170
|
return e;
|
|
1157
1171
|
if (ArrayBuffer.isView(t))
|
|
1158
1172
|
return "binary";
|
|
1159
|
-
const n =
|
|
1173
|
+
const n = At(t);
|
|
1160
1174
|
return n === "ArrayBuffer" ? "binary" : n;
|
|
1161
1175
|
}
|
|
1162
1176
|
function _n(t) {
|
|
1163
1177
|
return t instanceof Uint8Array ? t : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t);
|
|
1164
1178
|
}
|
|
1165
|
-
class
|
|
1179
|
+
class Rr {
|
|
1166
1180
|
_read(e, n) {
|
|
1167
1181
|
var r = this._ctx;
|
|
1168
1182
|
return r.error ? r.table._trans(null, D.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
|
|
@@ -1200,13 +1214,13 @@ class Kr {
|
|
|
1200
1214
|
}
|
|
1201
1215
|
sortBy(e, n) {
|
|
1202
1216
|
const r = e.split(".").reverse(), s = r[0], i = r.length - 1;
|
|
1203
|
-
function o(c,
|
|
1204
|
-
return
|
|
1217
|
+
function o(c, h) {
|
|
1218
|
+
return h ? o(c[r[h]], h - 1) : c[s];
|
|
1205
1219
|
}
|
|
1206
|
-
var
|
|
1207
|
-
function a(c,
|
|
1208
|
-
var
|
|
1209
|
-
return
|
|
1220
|
+
var l = this._ctx.dir === "next" ? 1 : -1;
|
|
1221
|
+
function a(c, h) {
|
|
1222
|
+
var u = o(c, i), d = o(h, i);
|
|
1223
|
+
return u < d ? -l : u > d ? l : 0;
|
|
1210
1224
|
}
|
|
1211
1225
|
return this.toArray(function(c) {
|
|
1212
1226
|
return c.sort(a);
|
|
@@ -1227,18 +1241,18 @@ class Kr {
|
|
|
1227
1241
|
}
|
|
1228
1242
|
offset(e) {
|
|
1229
1243
|
var n = this._ctx;
|
|
1230
|
-
return e <= 0 || (n.offset += e, be(n) ?
|
|
1244
|
+
return e <= 0 || (n.offset += e, be(n) ? St(n, () => {
|
|
1231
1245
|
var r = e;
|
|
1232
1246
|
return (s, i) => r === 0 || (r === 1 ? (--r, !1) : (i(() => {
|
|
1233
1247
|
s.advance(r), r = 0;
|
|
1234
1248
|
}), !1));
|
|
1235
|
-
}) :
|
|
1249
|
+
}) : St(n, () => {
|
|
1236
1250
|
var r = e;
|
|
1237
1251
|
return () => --r < 0;
|
|
1238
1252
|
})), this;
|
|
1239
1253
|
}
|
|
1240
1254
|
limit(e) {
|
|
1241
|
-
return this._ctx.limit = Math.min(this._ctx.limit, e),
|
|
1255
|
+
return this._ctx.limit = Math.min(this._ctx.limit, e), St(this._ctx, () => {
|
|
1242
1256
|
var n = e;
|
|
1243
1257
|
return function(r, s, i) {
|
|
1244
1258
|
return --n <= 0 && s(i), n >= 0;
|
|
@@ -1246,7 +1260,7 @@ class Kr {
|
|
|
1246
1260
|
}, !0), this;
|
|
1247
1261
|
}
|
|
1248
1262
|
until(e, n) {
|
|
1249
|
-
return
|
|
1263
|
+
return xt(this._ctx, function(r, s, i) {
|
|
1250
1264
|
return !e(r.value) || (s(i), n);
|
|
1251
1265
|
}), this;
|
|
1252
1266
|
}
|
|
@@ -1260,7 +1274,7 @@ class Kr {
|
|
|
1260
1274
|
}
|
|
1261
1275
|
filter(e) {
|
|
1262
1276
|
var n, r;
|
|
1263
|
-
return
|
|
1277
|
+
return xt(this._ctx, function(s) {
|
|
1264
1278
|
return e(s.value);
|
|
1265
1279
|
}), n = this._ctx, r = e, n.isMatch = ge(n.isMatch, r), this;
|
|
1266
1280
|
}
|
|
@@ -1332,7 +1346,7 @@ class Kr {
|
|
|
1332
1346
|
if (!n || !n.multi)
|
|
1333
1347
|
return this;
|
|
1334
1348
|
var r = {};
|
|
1335
|
-
return
|
|
1349
|
+
return xt(this._ctx, function(s) {
|
|
1336
1350
|
var i = s.primaryKey.toString(), o = z(r, i);
|
|
1337
1351
|
return r[i] = !0, !o;
|
|
1338
1352
|
}), this;
|
|
@@ -1344,44 +1358,44 @@ class Kr {
|
|
|
1344
1358
|
if (typeof e == "function")
|
|
1345
1359
|
s = e;
|
|
1346
1360
|
else {
|
|
1347
|
-
var i =
|
|
1348
|
-
s = function(
|
|
1361
|
+
var i = j(e), o = i.length;
|
|
1362
|
+
s = function(f) {
|
|
1349
1363
|
for (var v = !1, y = 0; y < o; ++y) {
|
|
1350
1364
|
var g = i[y], b = e[g];
|
|
1351
|
-
te(
|
|
1365
|
+
te(f, g) !== b && (H(f, g, b), v = !0);
|
|
1352
1366
|
}
|
|
1353
1367
|
return v;
|
|
1354
1368
|
};
|
|
1355
1369
|
}
|
|
1356
|
-
const
|
|
1357
|
-
let
|
|
1358
|
-
const
|
|
1370
|
+
const l = n.table.core, { outbound: a, extractKey: c } = l.schema.primaryKey, h = this.db._options.modifyChunkSize || 200, u = [];
|
|
1371
|
+
let d = 0;
|
|
1372
|
+
const p = [], m = (f, v) => {
|
|
1359
1373
|
const { failures: y, numFailures: g } = v;
|
|
1360
|
-
|
|
1361
|
-
for (let b of
|
|
1362
|
-
|
|
1374
|
+
d += f - g;
|
|
1375
|
+
for (let b of j(y))
|
|
1376
|
+
u.push(y[b]);
|
|
1363
1377
|
};
|
|
1364
|
-
return this.clone().primaryKeys().then((
|
|
1378
|
+
return this.clone().primaryKeys().then((f) => {
|
|
1365
1379
|
const v = (y) => {
|
|
1366
|
-
const g = Math.min(
|
|
1367
|
-
return
|
|
1368
|
-
const
|
|
1369
|
-
for (let
|
|
1370
|
-
const
|
|
1371
|
-
s.call(O, O.value, O) !== !1 && (O.value == null ?
|
|
1380
|
+
const g = Math.min(h, f.length - y);
|
|
1381
|
+
return l.getMany({ trans: r, keys: f.slice(y, y + g), cache: "immutable" }).then((b) => {
|
|
1382
|
+
const w = [], C = [], k = a ? [] : null, _ = [];
|
|
1383
|
+
for (let x = 0; x < g; ++x) {
|
|
1384
|
+
const N = b[x], O = { value: We(N), primKey: f[y + x] };
|
|
1385
|
+
s.call(O, O.value, O) !== !1 && (O.value == null ? _.push(f[y + x]) : a || L(c(N), c(O.value)) === 0 ? (C.push(O.value), a && k.push(f[y + x])) : (_.push(f[y + x]), w.push(O.value)));
|
|
1372
1386
|
}
|
|
1373
|
-
const A = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e ===
|
|
1374
|
-
return Promise.resolve(
|
|
1375
|
-
for (let
|
|
1376
|
-
|
|
1377
|
-
m(
|
|
1378
|
-
})).then(() => (C.length > 0 || A && typeof e == "object") &&
|
|
1387
|
+
const A = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e === Ct) && { index: n.index, range: n.range };
|
|
1388
|
+
return Promise.resolve(w.length > 0 && l.mutate({ trans: r, type: "add", values: w }).then((x) => {
|
|
1389
|
+
for (let N in x.failures)
|
|
1390
|
+
_.splice(parseInt(N), 1);
|
|
1391
|
+
m(w.length, x);
|
|
1392
|
+
})).then(() => (C.length > 0 || A && typeof e == "object") && l.mutate({ trans: r, type: "put", keys: k, values: C, criteria: A, changeSpec: typeof e != "function" && e }).then((x) => m(C.length, x))).then(() => (_.length > 0 || A && e === Ct) && l.mutate({ trans: r, type: "delete", keys: _, criteria: A }).then((x) => m(_.length, x))).then(() => f.length > y + g && v(y + h));
|
|
1379
1393
|
});
|
|
1380
1394
|
};
|
|
1381
1395
|
return v(0).then(() => {
|
|
1382
|
-
if (
|
|
1383
|
-
throw new
|
|
1384
|
-
return
|
|
1396
|
+
if (u.length > 0)
|
|
1397
|
+
throw new ut("Error modifying one or more objects", u, d, p);
|
|
1398
|
+
return f.length;
|
|
1385
1399
|
});
|
|
1386
1400
|
});
|
|
1387
1401
|
});
|
|
@@ -1390,19 +1404,19 @@ class Kr {
|
|
|
1390
1404
|
var e = this._ctx, n = e.range;
|
|
1391
1405
|
return be(e) && (e.isPrimKey && !Or || n.type === 3) ? this._write((r) => {
|
|
1392
1406
|
const { primaryKey: s } = e.table.core.schema, i = n;
|
|
1393
|
-
return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures:
|
|
1394
|
-
if (
|
|
1395
|
-
throw new
|
|
1396
|
-
return o -
|
|
1407
|
+
return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures: l, lastResult: a, results: c, numFailures: h }) => {
|
|
1408
|
+
if (h)
|
|
1409
|
+
throw new ut("Could not delete some values", Object.keys(l).map((u) => l[u]), o - h);
|
|
1410
|
+
return o - h;
|
|
1397
1411
|
}));
|
|
1398
|
-
}) : this.modify(
|
|
1412
|
+
}) : this.modify(Ct);
|
|
1399
1413
|
}
|
|
1400
1414
|
}
|
|
1401
|
-
const
|
|
1402
|
-
function
|
|
1415
|
+
const Ct = (t, e) => e.value = null;
|
|
1416
|
+
function $r(t, e) {
|
|
1403
1417
|
return t < e ? -1 : t === e ? 0 : 1;
|
|
1404
1418
|
}
|
|
1405
|
-
function
|
|
1419
|
+
function Nr(t, e) {
|
|
1406
1420
|
return t > e ? -1 : t === e ? 0 : 1;
|
|
1407
1421
|
}
|
|
1408
1422
|
function W(t, e, n) {
|
|
@@ -1412,57 +1426,57 @@ function W(t, e, n) {
|
|
|
1412
1426
|
function we(t) {
|
|
1413
1427
|
return new t.Collection(t, () => Yn("")).limit(0);
|
|
1414
1428
|
}
|
|
1415
|
-
function
|
|
1416
|
-
for (var o = Math.min(t.length, r.length),
|
|
1429
|
+
function Kr(t, e, n, r, s, i) {
|
|
1430
|
+
for (var o = Math.min(t.length, r.length), l = -1, a = 0; a < o; ++a) {
|
|
1417
1431
|
var c = e[a];
|
|
1418
1432
|
if (c !== r[a])
|
|
1419
|
-
return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) :
|
|
1420
|
-
s(t[a], c) < 0 && (
|
|
1433
|
+
return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) : l >= 0 ? t.substr(0, l) + e[l] + n.substr(l + 1) : null;
|
|
1434
|
+
s(t[a], c) < 0 && (l = a);
|
|
1421
1435
|
}
|
|
1422
|
-
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) :
|
|
1436
|
+
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : l < 0 ? null : t.substr(0, l) + r[l] + n.substr(l + 1);
|
|
1423
1437
|
}
|
|
1424
1438
|
function Ze(t, e, n, r) {
|
|
1425
|
-
var s, i, o,
|
|
1426
|
-
if (!n.every((
|
|
1439
|
+
var s, i, o, l, a, c, h, u = n.length;
|
|
1440
|
+
if (!n.every((f) => typeof f == "string"))
|
|
1427
1441
|
return W(t, Wn);
|
|
1428
|
-
function
|
|
1442
|
+
function d(f) {
|
|
1429
1443
|
s = function(y) {
|
|
1430
1444
|
return y === "next" ? (g) => g.toUpperCase() : (g) => g.toLowerCase();
|
|
1431
|
-
}(
|
|
1445
|
+
}(f), i = function(y) {
|
|
1432
1446
|
return y === "next" ? (g) => g.toLowerCase() : (g) => g.toUpperCase();
|
|
1433
|
-
}(
|
|
1447
|
+
}(f), o = f === "next" ? $r : Nr;
|
|
1434
1448
|
var v = n.map(function(y) {
|
|
1435
1449
|
return { lower: i(y), upper: s(y) };
|
|
1436
1450
|
}).sort(function(y, g) {
|
|
1437
1451
|
return o(y.lower, g.lower);
|
|
1438
1452
|
});
|
|
1439
|
-
|
|
1453
|
+
l = v.map(function(y) {
|
|
1440
1454
|
return y.upper;
|
|
1441
1455
|
}), a = v.map(function(y) {
|
|
1442
1456
|
return y.lower;
|
|
1443
|
-
}), c =
|
|
1457
|
+
}), c = f, h = f === "next" ? "" : r;
|
|
1444
1458
|
}
|
|
1445
|
-
|
|
1446
|
-
var
|
|
1447
|
-
|
|
1448
|
-
|
|
1459
|
+
d("next");
|
|
1460
|
+
var p = new t.Collection(t, () => re(l[0], a[u - 1] + r));
|
|
1461
|
+
p._ondirectionchange = function(f) {
|
|
1462
|
+
d(f);
|
|
1449
1463
|
};
|
|
1450
1464
|
var m = 0;
|
|
1451
|
-
return
|
|
1452
|
-
var g =
|
|
1465
|
+
return p._addAlgorithm(function(f, v, y) {
|
|
1466
|
+
var g = f.key;
|
|
1453
1467
|
if (typeof g != "string")
|
|
1454
1468
|
return !1;
|
|
1455
1469
|
var b = i(g);
|
|
1456
1470
|
if (e(b, a, m))
|
|
1457
1471
|
return !0;
|
|
1458
|
-
for (var
|
|
1459
|
-
var
|
|
1460
|
-
|
|
1472
|
+
for (var w = null, C = m; C < u; ++C) {
|
|
1473
|
+
var k = Kr(g, b, l[C], a[C], o, c);
|
|
1474
|
+
k === null && w === null ? m = C + 1 : (w === null || o(w, k) > 0) && (w = k);
|
|
1461
1475
|
}
|
|
1462
|
-
return v(
|
|
1463
|
-
|
|
1476
|
+
return v(w !== null ? function() {
|
|
1477
|
+
f.continue(w + h);
|
|
1464
1478
|
} : y), !1;
|
|
1465
|
-
}),
|
|
1479
|
+
}), p;
|
|
1466
1480
|
}
|
|
1467
1481
|
function re(t, e, n, r) {
|
|
1468
1482
|
return { type: 2, lower: t, upper: e, lowerOpen: n, upperOpen: r };
|
|
@@ -1529,18 +1543,18 @@ class Gn {
|
|
|
1529
1543
|
n = i === "next" ? this._ascending : this._descending, e.sort(n);
|
|
1530
1544
|
};
|
|
1531
1545
|
let s = 0;
|
|
1532
|
-
return r._addAlgorithm((i, o,
|
|
1546
|
+
return r._addAlgorithm((i, o, l) => {
|
|
1533
1547
|
const a = i.key;
|
|
1534
1548
|
for (; n(a, e[s]) > 0; )
|
|
1535
1549
|
if (++s, s === e.length)
|
|
1536
|
-
return o(
|
|
1550
|
+
return o(l), !1;
|
|
1537
1551
|
return n(a, e[s]) === 0 || (o(() => {
|
|
1538
1552
|
i.continue(e[s]);
|
|
1539
1553
|
}), !1);
|
|
1540
1554
|
}), r;
|
|
1541
1555
|
}
|
|
1542
1556
|
notEqual(e) {
|
|
1543
|
-
return this.inAnyRange([[
|
|
1557
|
+
return this.inAnyRange([[qt, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
|
|
1544
1558
|
}
|
|
1545
1559
|
noneOf() {
|
|
1546
1560
|
const e = J.apply(_e, arguments);
|
|
@@ -1551,49 +1565,49 @@ class Gn {
|
|
|
1551
1565
|
} catch {
|
|
1552
1566
|
return W(this, X);
|
|
1553
1567
|
}
|
|
1554
|
-
const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[
|
|
1568
|
+
const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[qt, s]], null);
|
|
1555
1569
|
return n.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(n, { includeLowers: !1, includeUppers: !1 });
|
|
1556
1570
|
}
|
|
1557
1571
|
inAnyRange(e, n) {
|
|
1558
|
-
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min,
|
|
1572
|
+
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, l = this._max;
|
|
1559
1573
|
if (e.length === 0)
|
|
1560
1574
|
return we(this);
|
|
1561
1575
|
if (!e.every((g) => g[0] !== void 0 && g[1] !== void 0 && s(g[0], g[1]) <= 0))
|
|
1562
1576
|
return W(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", E.InvalidArgument);
|
|
1563
1577
|
const a = !n || n.includeLowers !== !1, c = n && n.includeUppers === !0;
|
|
1564
|
-
let
|
|
1565
|
-
function
|
|
1566
|
-
return
|
|
1578
|
+
let h, u = s;
|
|
1579
|
+
function d(g, b) {
|
|
1580
|
+
return u(g[0], b[0]);
|
|
1567
1581
|
}
|
|
1568
1582
|
try {
|
|
1569
|
-
|
|
1570
|
-
let
|
|
1571
|
-
for (;
|
|
1572
|
-
const
|
|
1573
|
-
if (r(b[0],
|
|
1574
|
-
|
|
1583
|
+
h = e.reduce(function(g, b) {
|
|
1584
|
+
let w = 0, C = g.length;
|
|
1585
|
+
for (; w < C; ++w) {
|
|
1586
|
+
const k = g[w];
|
|
1587
|
+
if (r(b[0], k[1]) < 0 && r(b[1], k[0]) > 0) {
|
|
1588
|
+
k[0] = o(k[0], b[0]), k[1] = l(k[1], b[1]);
|
|
1575
1589
|
break;
|
|
1576
1590
|
}
|
|
1577
1591
|
}
|
|
1578
|
-
return
|
|
1579
|
-
}, []),
|
|
1592
|
+
return w === C && g.push(b), g;
|
|
1593
|
+
}, []), h.sort(d);
|
|
1580
1594
|
} catch {
|
|
1581
1595
|
return W(this, X);
|
|
1582
1596
|
}
|
|
1583
|
-
let
|
|
1584
|
-
const m = c ? (g) => s(g,
|
|
1597
|
+
let p = 0;
|
|
1598
|
+
const m = c ? (g) => s(g, h[p][1]) > 0 : (g) => s(g, h[p][1]) >= 0, f = a ? (g) => i(g, h[p][0]) > 0 : (g) => i(g, h[p][0]) >= 0;
|
|
1585
1599
|
let v = m;
|
|
1586
|
-
const y = new this.Collection(this, () => re(
|
|
1600
|
+
const y = new this.Collection(this, () => re(h[0][0], h[h.length - 1][1], !a, !c));
|
|
1587
1601
|
return y._ondirectionchange = (g) => {
|
|
1588
|
-
g === "next" ? (v = m,
|
|
1589
|
-
}, y._addAlgorithm((g, b,
|
|
1602
|
+
g === "next" ? (v = m, u = s) : (v = f, u = i), h.sort(d);
|
|
1603
|
+
}, y._addAlgorithm((g, b, w) => {
|
|
1590
1604
|
for (var C = g.key; v(C); )
|
|
1591
|
-
if (++
|
|
1592
|
-
return b(
|
|
1593
|
-
return !!function(
|
|
1594
|
-
return !m(
|
|
1595
|
-
}(C) || (this._cmp(C,
|
|
1596
|
-
|
|
1605
|
+
if (++p, p === h.length)
|
|
1606
|
+
return b(w), !1;
|
|
1607
|
+
return !!function(k) {
|
|
1608
|
+
return !m(k) && !f(k);
|
|
1609
|
+
}(C) || (this._cmp(C, h[p][1]) === 0 || this._cmp(C, h[p][0]) === 0 || b(() => {
|
|
1610
|
+
u === s ? g.continue(h[p][0]) : g.continue(h[p][1]);
|
|
1597
1611
|
}), !1);
|
|
1598
1612
|
}), y;
|
|
1599
1613
|
}
|
|
@@ -1603,15 +1617,15 @@ class Gn {
|
|
|
1603
1617
|
}
|
|
1604
1618
|
}
|
|
1605
1619
|
function Y(t) {
|
|
1606
|
-
return
|
|
1620
|
+
return $(function(e) {
|
|
1607
1621
|
return qe(e), t(e.target.error), !1;
|
|
1608
1622
|
});
|
|
1609
1623
|
}
|
|
1610
1624
|
function qe(t) {
|
|
1611
1625
|
t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
|
|
1612
1626
|
}
|
|
1613
|
-
const Le = "storagemutated", ie = "x-storagemutated-1",
|
|
1614
|
-
class
|
|
1627
|
+
const Le = "storagemutated", ie = "x-storagemutated-1", le = je(null, Le);
|
|
1628
|
+
class jr {
|
|
1615
1629
|
_lock() {
|
|
1616
1630
|
return Ie(!P.global), ++this._reculock, this._reculock !== 1 || P.global || (P.lockOwnerFor = this), this;
|
|
1617
1631
|
}
|
|
@@ -1644,12 +1658,12 @@ class Nr {
|
|
|
1644
1658
|
}
|
|
1645
1659
|
if (!this.active)
|
|
1646
1660
|
throw new E.TransactionInactive();
|
|
1647
|
-
return Ie(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror =
|
|
1661
|
+
return Ie(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = $((s) => {
|
|
1648
1662
|
qe(s), this._reject(e.error);
|
|
1649
|
-
}), e.onabort =
|
|
1663
|
+
}), e.onabort = $((s) => {
|
|
1650
1664
|
qe(s), this.active && this._reject(new E.Abort(e.error)), this.active = !1, this.on("abort").fire(s);
|
|
1651
|
-
}), e.oncomplete =
|
|
1652
|
-
this.active = !1, this._resolve(), "mutatedParts" in e &&
|
|
1665
|
+
}), e.oncomplete = $(() => {
|
|
1666
|
+
this.active = !1, this._resolve(), "mutatedParts" in e && le.storagemutated.fire(e.mutatedParts);
|
|
1653
1667
|
}), this;
|
|
1654
1668
|
}
|
|
1655
1669
|
_promise(e, n, r) {
|
|
@@ -1665,16 +1679,16 @@ class Nr {
|
|
|
1665
1679
|
});
|
|
1666
1680
|
if (r)
|
|
1667
1681
|
return oe(() => {
|
|
1668
|
-
var i = new S((o,
|
|
1682
|
+
var i = new S((o, l) => {
|
|
1669
1683
|
this._lock();
|
|
1670
|
-
const a = n(o,
|
|
1671
|
-
a && a.then && a.then(o,
|
|
1684
|
+
const a = n(o, l, this);
|
|
1685
|
+
a && a.then && a.then(o, l);
|
|
1672
1686
|
});
|
|
1673
1687
|
return i.finally(() => this._unlock()), i._lib = !0, i;
|
|
1674
1688
|
});
|
|
1675
1689
|
var s = new S((i, o) => {
|
|
1676
|
-
var
|
|
1677
|
-
|
|
1690
|
+
var l = n(i, o, this);
|
|
1691
|
+
l && l.then && l.then(i, o);
|
|
1678
1692
|
});
|
|
1679
1693
|
return s._lib = !0, s;
|
|
1680
1694
|
}
|
|
@@ -1696,8 +1710,8 @@ class Nr {
|
|
|
1696
1710
|
})();
|
|
1697
1711
|
}
|
|
1698
1712
|
var i = n._waitingFor;
|
|
1699
|
-
return new S((o,
|
|
1700
|
-
r.then((a) => n._waitingQueue.push(
|
|
1713
|
+
return new S((o, l) => {
|
|
1714
|
+
r.then((a) => n._waitingQueue.push($(o.bind(null, a))), (a) => n._waitingQueue.push($(l.bind(null, a)))).finally(() => {
|
|
1701
1715
|
n._waitingFor === i && (n._waitingFor = null);
|
|
1702
1716
|
});
|
|
1703
1717
|
});
|
|
@@ -1716,7 +1730,7 @@ class Nr {
|
|
|
1716
1730
|
return s.core = this.db.core.table(e), n[e] = s, s;
|
|
1717
1731
|
}
|
|
1718
1732
|
}
|
|
1719
|
-
function
|
|
1733
|
+
function Lt(t, e, n, r, s, i, o) {
|
|
1720
1734
|
return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") + Xn(e) };
|
|
1721
1735
|
}
|
|
1722
1736
|
function Xn(t) {
|
|
@@ -1732,7 +1746,7 @@ let Ue = (t) => {
|
|
|
1732
1746
|
return Ue = () => he, he;
|
|
1733
1747
|
}
|
|
1734
1748
|
};
|
|
1735
|
-
function
|
|
1749
|
+
function Ut(t) {
|
|
1736
1750
|
return t == null ? () => {
|
|
1737
1751
|
} : typeof t == "string" ? function(e) {
|
|
1738
1752
|
return e.split(".").length === 1 ? (n) => n[e] : (n) => te(n, e);
|
|
@@ -1751,152 +1765,152 @@ function Br(t, e, n) {
|
|
|
1751
1765
|
return null;
|
|
1752
1766
|
if (a.type === 4)
|
|
1753
1767
|
throw new Error("Cannot convert never type to IDBKeyRange");
|
|
1754
|
-
const { lower: c, upper:
|
|
1755
|
-
return c === void 0 ?
|
|
1768
|
+
const { lower: c, upper: h, lowerOpen: u, upperOpen: d } = a;
|
|
1769
|
+
return c === void 0 ? h === void 0 ? null : e.upperBound(h, !!d) : h === void 0 ? e.lowerBound(c, !!u) : e.bound(c, h, !!u, !!d);
|
|
1756
1770
|
}
|
|
1757
1771
|
const { schema: s, hasGetAll: i } = function(a, c) {
|
|
1758
|
-
const
|
|
1759
|
-
return { schema: { name: a.name, tables:
|
|
1760
|
-
const { keyPath:
|
|
1761
|
-
const { name: b, unique:
|
|
1762
|
-
return v[De(
|
|
1772
|
+
const h = kn(a.objectStoreNames);
|
|
1773
|
+
return { schema: { name: a.name, tables: h.map((u) => c.objectStore(u)).map((u) => {
|
|
1774
|
+
const { keyPath: d, autoIncrement: p } = u, m = M(d), f = d == null, v = {}, y = { name: u.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: f, compound: m, keyPath: d, autoIncrement: p, unique: !0, extractKey: Ut(d) }, indexes: kn(u.indexNames).map((g) => u.index(g)).map((g) => {
|
|
1775
|
+
const { name: b, unique: w, multiEntry: C, keyPath: k } = g, _ = { name: b, compound: M(k), keyPath: k, unique: w, multiEntry: C, extractKey: Ut(k) };
|
|
1776
|
+
return v[De(k)] = _, _;
|
|
1763
1777
|
}), getIndexByKeyPath: (g) => v[De(g)] };
|
|
1764
|
-
return v[":id"] = y.primaryKey,
|
|
1765
|
-
}) }, hasGetAll:
|
|
1778
|
+
return v[":id"] = y.primaryKey, d != null && (v[De(d)] = y.primaryKey), y;
|
|
1779
|
+
}) }, hasGetAll: h.length > 0 && "getAll" in c.objectStore(h[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
|
|
1766
1780
|
}(t, n), o = s.tables.map((a) => function(c) {
|
|
1767
|
-
const
|
|
1768
|
-
return { name:
|
|
1781
|
+
const h = c.name;
|
|
1782
|
+
return { name: h, schema: c, mutate: function({ trans: u, type: d, keys: p, values: m, range: f }) {
|
|
1769
1783
|
return new Promise((v, y) => {
|
|
1770
|
-
v =
|
|
1771
|
-
const g =
|
|
1772
|
-
if (!
|
|
1773
|
-
throw new Error("Invalid operation type: " +
|
|
1774
|
-
const { length: C } =
|
|
1775
|
-
if (
|
|
1784
|
+
v = $(v);
|
|
1785
|
+
const g = u.objectStore(h), b = g.keyPath == null, w = d === "put" || d === "add";
|
|
1786
|
+
if (!w && d !== "delete" && d !== "deleteRange")
|
|
1787
|
+
throw new Error("Invalid operation type: " + d);
|
|
1788
|
+
const { length: C } = p || m || { length: 1 };
|
|
1789
|
+
if (p && m && p.length !== m.length)
|
|
1776
1790
|
throw new Error("Given keys array must have same length as given values array.");
|
|
1777
1791
|
if (C === 0)
|
|
1778
1792
|
return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
1779
|
-
let
|
|
1780
|
-
const
|
|
1781
|
-
let
|
|
1782
|
-
const
|
|
1783
|
-
++
|
|
1793
|
+
let k;
|
|
1794
|
+
const _ = [], A = [];
|
|
1795
|
+
let x = 0;
|
|
1796
|
+
const N = (q) => {
|
|
1797
|
+
++x, qe(q);
|
|
1784
1798
|
};
|
|
1785
|
-
if (
|
|
1786
|
-
if (
|
|
1787
|
-
return v({ numFailures:
|
|
1788
|
-
|
|
1799
|
+
if (d === "deleteRange") {
|
|
1800
|
+
if (f.type === 4)
|
|
1801
|
+
return v({ numFailures: x, failures: A, results: [], lastResult: void 0 });
|
|
1802
|
+
f.type === 3 ? _.push(k = g.clear()) : _.push(k = g.delete(r(f)));
|
|
1789
1803
|
} else {
|
|
1790
|
-
const [q, B] =
|
|
1791
|
-
if (
|
|
1792
|
-
for (let
|
|
1793
|
-
|
|
1804
|
+
const [q, B] = w ? b ? [m, p] : [m, null] : [p, null];
|
|
1805
|
+
if (w)
|
|
1806
|
+
for (let K = 0; K < C; ++K)
|
|
1807
|
+
_.push(k = B && B[K] !== void 0 ? g[d](q[K], B[K]) : g[d](q[K])), k.onerror = N;
|
|
1794
1808
|
else
|
|
1795
|
-
for (let
|
|
1796
|
-
|
|
1809
|
+
for (let K = 0; K < C; ++K)
|
|
1810
|
+
_.push(k = g[d](q[K])), k.onerror = N;
|
|
1797
1811
|
}
|
|
1798
1812
|
const O = (q) => {
|
|
1799
1813
|
const B = q.target.result;
|
|
1800
|
-
|
|
1814
|
+
_.forEach((K, ye) => K.error != null && (A[ye] = K.error)), v({ numFailures: x, failures: A, results: d === "delete" ? p : _.map((K) => K.result), lastResult: B });
|
|
1801
1815
|
};
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
},
|
|
1816
|
+
k.onerror = (q) => {
|
|
1817
|
+
N(q), O(q);
|
|
1818
|
+
}, k.onsuccess = O;
|
|
1805
1819
|
});
|
|
1806
|
-
}, getMany: ({ trans:
|
|
1807
|
-
|
|
1808
|
-
const
|
|
1809
|
-
let g, b = 0,
|
|
1810
|
-
const C = (
|
|
1811
|
-
const A =
|
|
1812
|
-
y[A._pos] = A.result, ++
|
|
1813
|
-
},
|
|
1814
|
-
for (let
|
|
1815
|
-
|
|
1816
|
-
b === 0 &&
|
|
1817
|
-
}), get: ({ trans:
|
|
1818
|
-
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
}), query: function(
|
|
1822
|
-
return (
|
|
1823
|
-
|
|
1824
|
-
const { trans:
|
|
1820
|
+
}, getMany: ({ trans: u, keys: d }) => new Promise((p, m) => {
|
|
1821
|
+
p = $(p);
|
|
1822
|
+
const f = u.objectStore(h), v = d.length, y = new Array(v);
|
|
1823
|
+
let g, b = 0, w = 0;
|
|
1824
|
+
const C = (_) => {
|
|
1825
|
+
const A = _.target;
|
|
1826
|
+
y[A._pos] = A.result, ++w === b && p(y);
|
|
1827
|
+
}, k = Y(m);
|
|
1828
|
+
for (let _ = 0; _ < v; ++_)
|
|
1829
|
+
d[_] != null && (g = f.get(d[_]), g._pos = _, g.onsuccess = C, g.onerror = k, ++b);
|
|
1830
|
+
b === 0 && p(y);
|
|
1831
|
+
}), get: ({ trans: u, key: d }) => new Promise((p, m) => {
|
|
1832
|
+
p = $(p);
|
|
1833
|
+
const f = u.objectStore(h).get(d);
|
|
1834
|
+
f.onsuccess = (v) => p(v.target.result), f.onerror = Y(m);
|
|
1835
|
+
}), query: function(u) {
|
|
1836
|
+
return (d) => new Promise((p, m) => {
|
|
1837
|
+
p = $(p);
|
|
1838
|
+
const { trans: f, values: v, limit: y, query: g } = d, b = y === 1 / 0 ? void 0 : y, { index: w, range: C } = g, k = f.objectStore(h), _ = w.isPrimaryKey ? k : k.index(w.name), A = r(C);
|
|
1825
1839
|
if (y === 0)
|
|
1826
|
-
return
|
|
1827
|
-
if (
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1840
|
+
return p({ result: [] });
|
|
1841
|
+
if (u) {
|
|
1842
|
+
const x = v ? _.getAll(A, b) : _.getAllKeys(A, b);
|
|
1843
|
+
x.onsuccess = (N) => p({ result: N.target.result }), x.onerror = Y(m);
|
|
1830
1844
|
} else {
|
|
1831
|
-
let
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
const B =
|
|
1835
|
-
return B ? (O.push(v ? B.value : B.primaryKey), ++
|
|
1836
|
-
},
|
|
1845
|
+
let x = 0;
|
|
1846
|
+
const N = v || !("openKeyCursor" in _) ? _.openCursor(A) : _.openKeyCursor(A), O = [];
|
|
1847
|
+
N.onsuccess = (q) => {
|
|
1848
|
+
const B = N.result;
|
|
1849
|
+
return B ? (O.push(v ? B.value : B.primaryKey), ++x === y ? p({ result: O }) : void B.continue()) : p({ result: O });
|
|
1850
|
+
}, N.onerror = Y(m);
|
|
1837
1851
|
}
|
|
1838
1852
|
});
|
|
1839
|
-
}(i), openCursor: function({ trans:
|
|
1853
|
+
}(i), openCursor: function({ trans: u, values: d, query: p, reverse: m, unique: f }) {
|
|
1840
1854
|
return new Promise((v, y) => {
|
|
1841
|
-
v =
|
|
1842
|
-
const { index: g, range: b } =
|
|
1843
|
-
|
|
1844
|
-
const
|
|
1845
|
-
if (!
|
|
1855
|
+
v = $(v);
|
|
1856
|
+
const { index: g, range: b } = p, w = u.objectStore(h), C = g.isPrimaryKey ? w : w.index(g.name), k = m ? f ? "prevunique" : "prev" : f ? "nextunique" : "next", _ = d || !("openKeyCursor" in C) ? C.openCursor(r(b), k) : C.openKeyCursor(r(b), k);
|
|
1857
|
+
_.onerror = Y(y), _.onsuccess = $((A) => {
|
|
1858
|
+
const x = _.result;
|
|
1859
|
+
if (!x)
|
|
1846
1860
|
return void v(null);
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
let O =
|
|
1850
|
-
O && (O = O.bind(
|
|
1851
|
-
const q =
|
|
1861
|
+
x.___id = ++Dr, x.done = !1;
|
|
1862
|
+
const N = x.continue.bind(x);
|
|
1863
|
+
let O = x.continuePrimaryKey;
|
|
1864
|
+
O && (O = O.bind(x));
|
|
1865
|
+
const q = x.advance.bind(x), B = () => {
|
|
1852
1866
|
throw new Error("Cursor not stopped");
|
|
1853
1867
|
};
|
|
1854
|
-
|
|
1868
|
+
x.trans = u, x.stop = x.continue = x.continuePrimaryKey = x.advance = () => {
|
|
1855
1869
|
throw new Error("Cursor not started");
|
|
1856
|
-
},
|
|
1857
|
-
let
|
|
1858
|
-
return this.start(() =>
|
|
1859
|
-
},
|
|
1860
|
-
const ye = new Promise((V,
|
|
1861
|
-
V =
|
|
1862
|
-
|
|
1870
|
+
}, x.fail = $(y), x.next = function() {
|
|
1871
|
+
let K = 1;
|
|
1872
|
+
return this.start(() => K-- ? this.continue() : this.stop()).then(() => this);
|
|
1873
|
+
}, x.start = (K) => {
|
|
1874
|
+
const ye = new Promise((V, ue) => {
|
|
1875
|
+
V = $(V), _.onerror = Y(ue), x.fail = ue, x.stop = (Ae) => {
|
|
1876
|
+
x.stop = x.continue = x.continuePrimaryKey = x.advance = B, V(Ae);
|
|
1863
1877
|
};
|
|
1864
1878
|
}), ve = () => {
|
|
1865
|
-
if (
|
|
1879
|
+
if (_.result)
|
|
1866
1880
|
try {
|
|
1867
|
-
|
|
1881
|
+
K();
|
|
1868
1882
|
} catch (V) {
|
|
1869
|
-
|
|
1883
|
+
x.fail(V);
|
|
1870
1884
|
}
|
|
1871
1885
|
else
|
|
1872
|
-
|
|
1886
|
+
x.done = !0, x.start = () => {
|
|
1873
1887
|
throw new Error("Cursor behind last entry");
|
|
1874
|
-
},
|
|
1888
|
+
}, x.stop();
|
|
1875
1889
|
};
|
|
1876
|
-
return
|
|
1877
|
-
|
|
1878
|
-
}),
|
|
1879
|
-
}, v(
|
|
1890
|
+
return _.onsuccess = $((V) => {
|
|
1891
|
+
_.onsuccess = ve, ve();
|
|
1892
|
+
}), x.continue = N, x.continuePrimaryKey = O, x.advance = q, ve(), ye;
|
|
1893
|
+
}, v(x);
|
|
1880
1894
|
}, y);
|
|
1881
1895
|
});
|
|
1882
|
-
}, count({ query:
|
|
1883
|
-
const { index:
|
|
1884
|
-
return new Promise((
|
|
1885
|
-
const y =
|
|
1886
|
-
|
|
1896
|
+
}, count({ query: u, trans: d }) {
|
|
1897
|
+
const { index: p, range: m } = u;
|
|
1898
|
+
return new Promise((f, v) => {
|
|
1899
|
+
const y = d.objectStore(h), g = p.isPrimaryKey ? y : y.index(p.name), b = r(m), w = b ? g.count(b) : g.count();
|
|
1900
|
+
w.onsuccess = $((C) => f(C.target.result)), w.onerror = Y(v);
|
|
1887
1901
|
});
|
|
1888
1902
|
} };
|
|
1889
|
-
}(a)),
|
|
1890
|
-
return o.forEach((a) =>
|
|
1891
|
-
if (!
|
|
1903
|
+
}(a)), l = {};
|
|
1904
|
+
return o.forEach((a) => l[a.name] = a), { stack: "dbcore", transaction: t.transaction.bind(t), table(a) {
|
|
1905
|
+
if (!l[a])
|
|
1892
1906
|
throw new Error(`Table '${a}' not found`);
|
|
1893
|
-
return
|
|
1907
|
+
return l[a];
|
|
1894
1908
|
}, MIN_KEY: -1 / 0, MAX_KEY: Ue(e), schema: s };
|
|
1895
1909
|
}
|
|
1896
|
-
function
|
|
1897
|
-
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB:
|
|
1898
|
-
return { dbcore: function(c,
|
|
1899
|
-
return
|
|
1910
|
+
function Vt({ _novip: t }, e) {
|
|
1911
|
+
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: l }, a) {
|
|
1912
|
+
return { dbcore: function(c, h) {
|
|
1913
|
+
return h.reduce((u, { create: d }) => ({ ...u, ...d(u) }), c);
|
|
1900
1914
|
}(Br(i, o, a), s.dbcore) };
|
|
1901
1915
|
}(t._middlewares, n, t._deps, e);
|
|
1902
1916
|
t.core = r.dbcore, t.tables.forEach((s) => {
|
|
@@ -1908,8 +1922,8 @@ function pt({ _novip: t }, e, n, r) {
|
|
|
1908
1922
|
n.forEach((s) => {
|
|
1909
1923
|
const i = r[s];
|
|
1910
1924
|
e.forEach((o) => {
|
|
1911
|
-
const
|
|
1912
|
-
(!
|
|
1925
|
+
const l = Zt(o, s);
|
|
1926
|
+
(!l || "value" in l && l.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? ee(o, s, { get() {
|
|
1913
1927
|
return this.table(s);
|
|
1914
1928
|
}, set(a) {
|
|
1915
1929
|
Cn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
|
|
@@ -1917,7 +1931,7 @@ function pt({ _novip: t }, e, n, r) {
|
|
|
1917
1931
|
});
|
|
1918
1932
|
});
|
|
1919
1933
|
}
|
|
1920
|
-
function
|
|
1934
|
+
function Wt({ _novip: t }, e) {
|
|
1921
1935
|
e.forEach((n) => {
|
|
1922
1936
|
for (let r in n)
|
|
1923
1937
|
n[r] instanceof t.Table && delete n[r];
|
|
@@ -1929,61 +1943,61 @@ function Fr(t, e) {
|
|
|
1929
1943
|
function Mr(t, e, n, r) {
|
|
1930
1944
|
const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
|
|
1931
1945
|
i.create(n), i._completion.catch(r);
|
|
1932
|
-
const o = i._reject.bind(i),
|
|
1946
|
+
const o = i._reject.bind(i), l = P.transless || P;
|
|
1933
1947
|
oe(() => {
|
|
1934
|
-
P.trans = i, P.transless =
|
|
1935
|
-
|
|
1936
|
-
}),
|
|
1937
|
-
const
|
|
1938
|
-
let m = a._dbSchema =
|
|
1939
|
-
const v =
|
|
1948
|
+
P.trans = i, P.transless = l, e === 0 ? (j(s).forEach((a) => {
|
|
1949
|
+
Pt(n, a, s[a].primKey, s[a].indexes);
|
|
1950
|
+
}), Vt(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c, h, u) {
|
|
1951
|
+
const d = [], p = a._versions;
|
|
1952
|
+
let m = a._dbSchema = Ht(a, a.idbdb, u), f = !1;
|
|
1953
|
+
const v = p.filter((g) => g._cfg.version >= c);
|
|
1940
1954
|
function y() {
|
|
1941
|
-
return
|
|
1955
|
+
return d.length ? S.resolve(d.shift()(h.idbtrans)).then(y) : S.resolve();
|
|
1942
1956
|
}
|
|
1943
1957
|
return v.forEach((g) => {
|
|
1944
|
-
|
|
1945
|
-
const b = m,
|
|
1946
|
-
|
|
1947
|
-
const C = Jn(b,
|
|
1948
|
-
C.add.forEach((
|
|
1949
|
-
|
|
1950
|
-
}), C.change.forEach((
|
|
1951
|
-
if (
|
|
1958
|
+
d.push(() => {
|
|
1959
|
+
const b = m, w = g._cfg.dbschema;
|
|
1960
|
+
Yt(a, b, u), Yt(a, w, u), m = a._dbSchema = w;
|
|
1961
|
+
const C = Jn(b, w);
|
|
1962
|
+
C.add.forEach((_) => {
|
|
1963
|
+
Pt(u, _[0], _[1].primKey, _[1].indexes);
|
|
1964
|
+
}), C.change.forEach((_) => {
|
|
1965
|
+
if (_.recreate)
|
|
1952
1966
|
throw new E.Upgrade("Not yet support for changing primary key");
|
|
1953
1967
|
{
|
|
1954
|
-
const A =
|
|
1955
|
-
|
|
1956
|
-
A.deleteIndex(
|
|
1957
|
-
}),
|
|
1968
|
+
const A = u.objectStore(_.name);
|
|
1969
|
+
_.add.forEach((x) => zt(A, x)), _.change.forEach((x) => {
|
|
1970
|
+
A.deleteIndex(x.name), zt(A, x);
|
|
1971
|
+
}), _.del.forEach((x) => A.deleteIndex(x));
|
|
1958
1972
|
}
|
|
1959
1973
|
});
|
|
1960
|
-
const
|
|
1961
|
-
if (
|
|
1962
|
-
|
|
1963
|
-
let
|
|
1974
|
+
const k = g._cfg.contentUpgrade;
|
|
1975
|
+
if (k && g._cfg.version > c) {
|
|
1976
|
+
Vt(a, u), h._memoizedTables = {}, f = !0;
|
|
1977
|
+
let _ = An(w);
|
|
1964
1978
|
C.del.forEach((O) => {
|
|
1965
|
-
|
|
1966
|
-
}),
|
|
1967
|
-
const A =
|
|
1968
|
-
let
|
|
1979
|
+
_[O] = b[O];
|
|
1980
|
+
}), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], j(_), _), h.schema = _;
|
|
1981
|
+
const A = en(k);
|
|
1982
|
+
let x;
|
|
1969
1983
|
A && Ee();
|
|
1970
|
-
const
|
|
1971
|
-
if (
|
|
1984
|
+
const N = S.follow(() => {
|
|
1985
|
+
if (x = k(h), x && A) {
|
|
1972
1986
|
var O = ne.bind(null, null);
|
|
1973
|
-
|
|
1987
|
+
x.then(O, O);
|
|
1974
1988
|
}
|
|
1975
1989
|
});
|
|
1976
|
-
return
|
|
1990
|
+
return x && typeof x.then == "function" ? S.resolve(x) : N.then(() => x);
|
|
1977
1991
|
}
|
|
1978
|
-
}),
|
|
1979
|
-
(!
|
|
1980
|
-
[].slice.call(C.db.objectStoreNames).forEach((
|
|
1981
|
-
}(g._cfg.dbschema, b),
|
|
1992
|
+
}), d.push((b) => {
|
|
1993
|
+
(!f || !Ar) && function(w, C) {
|
|
1994
|
+
[].slice.call(C.db.objectStoreNames).forEach((k) => w[k] == null && C.db.deleteObjectStore(k));
|
|
1995
|
+
}(g._cfg.dbschema, b), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), h.schema = a._dbSchema;
|
|
1982
1996
|
});
|
|
1983
1997
|
}), y().then(() => {
|
|
1984
1998
|
var g, b;
|
|
1985
|
-
b =
|
|
1986
|
-
b.db.objectStoreNames.contains(
|
|
1999
|
+
b = u, j(g = m).forEach((w) => {
|
|
2000
|
+
b.db.objectStoreNames.contains(w) || Pt(b, w, g[w].primKey, g[w].indexes);
|
|
1987
2001
|
});
|
|
1988
2002
|
});
|
|
1989
2003
|
}(t, e, i, n).catch(o);
|
|
@@ -2001,13 +2015,13 @@ function Jn(t, e) {
|
|
|
2001
2015
|
if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !gt)
|
|
2002
2016
|
o.recreate = !0, n.change.push(o);
|
|
2003
2017
|
else {
|
|
2004
|
-
const
|
|
2018
|
+
const l = s.idxByName, a = i.idxByName;
|
|
2005
2019
|
let c;
|
|
2006
|
-
for (c in
|
|
2020
|
+
for (c in l)
|
|
2007
2021
|
a[c] || o.del.push(c);
|
|
2008
2022
|
for (c in a) {
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2023
|
+
const h = l[c], u = a[c];
|
|
2024
|
+
h ? h.src !== u.src && o.change.push(u) : o.add.push(u);
|
|
2011
2025
|
}
|
|
2012
2026
|
(o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
|
|
2013
2027
|
}
|
|
@@ -2016,50 +2030,50 @@ function Jn(t, e) {
|
|
|
2016
2030
|
}
|
|
2017
2031
|
return n;
|
|
2018
2032
|
}
|
|
2019
|
-
function
|
|
2033
|
+
function Pt(t, e, n, r) {
|
|
2020
2034
|
const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
|
|
2021
|
-
return r.forEach((i) =>
|
|
2035
|
+
return r.forEach((i) => zt(s, i)), s;
|
|
2022
2036
|
}
|
|
2023
|
-
function
|
|
2037
|
+
function zt(t, e) {
|
|
2024
2038
|
t.createIndex(e.name, e.keyPath, { unique: e.unique, multiEntry: e.multi });
|
|
2025
2039
|
}
|
|
2026
|
-
function
|
|
2040
|
+
function Ht(t, e, n) {
|
|
2027
2041
|
const r = {};
|
|
2028
|
-
return
|
|
2042
|
+
return lt(e.objectStoreNames, 0).forEach((s) => {
|
|
2029
2043
|
const i = n.objectStore(s);
|
|
2030
2044
|
let o = i.keyPath;
|
|
2031
|
-
const
|
|
2032
|
-
for (let
|
|
2033
|
-
const
|
|
2034
|
-
o =
|
|
2035
|
-
var c =
|
|
2045
|
+
const l = Lt(Xn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
|
|
2046
|
+
for (let h = 0; h < i.indexNames.length; ++h) {
|
|
2047
|
+
const u = i.index(i.indexNames[h]);
|
|
2048
|
+
o = u.keyPath;
|
|
2049
|
+
var c = Lt(u.name, o, !!u.unique, !!u.multiEntry, !1, o && typeof o != "string", !1);
|
|
2036
2050
|
a.push(c);
|
|
2037
2051
|
}
|
|
2038
|
-
r[s] = Qn(s,
|
|
2052
|
+
r[s] = Qn(s, l, a);
|
|
2039
2053
|
}), r;
|
|
2040
2054
|
}
|
|
2041
|
-
function
|
|
2055
|
+
function Yt({ _novip: t }, e, n) {
|
|
2042
2056
|
const r = n.db.objectStoreNames;
|
|
2043
2057
|
for (let s = 0; s < r.length; ++s) {
|
|
2044
2058
|
const i = r[s], o = n.objectStore(i);
|
|
2045
2059
|
t._hasGetAll = "getAll" in o;
|
|
2046
|
-
for (let
|
|
2047
|
-
const a = o.indexNames[
|
|
2060
|
+
for (let l = 0; l < o.indexNames.length; ++l) {
|
|
2061
|
+
const a = o.indexNames[l], c = o.index(a).keyPath, h = typeof c == "string" ? c : "[" + lt(c).join("+") + "]";
|
|
2048
2062
|
if (e[i]) {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2063
|
+
const u = e[i].idxByName[h];
|
|
2064
|
+
u && (u.name = a, delete e[i].idxByName[h], e[i].idxByName[a] = u);
|
|
2051
2065
|
}
|
|
2052
2066
|
}
|
|
2053
2067
|
}
|
|
2054
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
2068
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && R.WorkerGlobalScope && R instanceof R.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t._hasGetAll = !1);
|
|
2055
2069
|
}
|
|
2056
2070
|
class qr {
|
|
2057
2071
|
_parseStoresSpec(e, n) {
|
|
2058
|
-
|
|
2072
|
+
j(e).forEach((r) => {
|
|
2059
2073
|
if (e[r] !== null) {
|
|
2060
|
-
var s = e[r].split(",").map((o,
|
|
2074
|
+
var s = e[r].split(",").map((o, l) => {
|
|
2061
2075
|
const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), c = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2062
|
-
return
|
|
2076
|
+
return Lt(a, c || null, /\&/.test(o), /\*/.test(o), /\+\+/.test(o), M(c), l === 0);
|
|
2063
2077
|
}), i = s.shift();
|
|
2064
2078
|
if (i.multi)
|
|
2065
2079
|
throw new E.Schema("Primary key cannot be multi-valued");
|
|
@@ -2079,20 +2093,20 @@ class qr {
|
|
|
2079
2093
|
let i = {};
|
|
2080
2094
|
return r.forEach((o) => {
|
|
2081
2095
|
U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
|
|
2082
|
-
}), n._dbSchema = i,
|
|
2096
|
+
}), n._dbSchema = i, Wt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], j(i), i), n._storeNames = j(i), this;
|
|
2083
2097
|
}
|
|
2084
2098
|
upgrade(e) {
|
|
2085
|
-
return this._cfg.contentUpgrade =
|
|
2099
|
+
return this._cfg.contentUpgrade = rn(this._cfg.contentUpgrade || I, e), this;
|
|
2086
2100
|
}
|
|
2087
2101
|
}
|
|
2088
|
-
function
|
|
2102
|
+
function ln(t, e) {
|
|
2089
2103
|
let n = t._dbNamesDB;
|
|
2090
2104
|
return n || (n = t._dbNamesDB = new pe(yt, { addons: [], indexedDB: t, IDBKeyRange: e }), n.version(1).stores({ dbnames: "name" })), n.table("dbnames");
|
|
2091
2105
|
}
|
|
2092
2106
|
function un(t) {
|
|
2093
2107
|
return t && typeof t.databases == "function";
|
|
2094
2108
|
}
|
|
2095
|
-
function
|
|
2109
|
+
function Gt(t) {
|
|
2096
2110
|
return oe(function() {
|
|
2097
2111
|
return P.letThrough = !0, t();
|
|
2098
2112
|
});
|
|
@@ -2118,54 +2132,54 @@ function Ur(t) {
|
|
|
2118
2132
|
if (e.openCanceller !== r)
|
|
2119
2133
|
throw new E.DatabaseClosed("db.open() was cancelled");
|
|
2120
2134
|
}
|
|
2121
|
-
let i = e.dbReadyResolve, o = null,
|
|
2135
|
+
let i = e.dbReadyResolve, o = null, l = !1;
|
|
2122
2136
|
return S.race([r, (typeof navigator > "u" ? S.resolve() : Lr()).then(() => new S((a, c) => {
|
|
2123
2137
|
if (s(), !n)
|
|
2124
2138
|
throw new E.MissingAPI();
|
|
2125
|
-
const
|
|
2126
|
-
if (!
|
|
2139
|
+
const h = t.name, u = e.autoSchema ? n.open(h) : n.open(h, Math.round(10 * t.verno));
|
|
2140
|
+
if (!u)
|
|
2127
2141
|
throw new E.MissingAPI();
|
|
2128
|
-
|
|
2129
|
-
if (o =
|
|
2130
|
-
|
|
2131
|
-
const m = n.deleteDatabase(
|
|
2132
|
-
m.onsuccess = m.onerror =
|
|
2133
|
-
c(new E.NoSuchDatabase(`Database ${
|
|
2142
|
+
u.onerror = Y(c), u.onblocked = $(t._fireOnBlocked), u.onupgradeneeded = $((d) => {
|
|
2143
|
+
if (o = u.transaction, e.autoSchema && !t._options.allowEmptyDB) {
|
|
2144
|
+
u.onerror = qe, o.abort(), u.result.close();
|
|
2145
|
+
const m = n.deleteDatabase(h);
|
|
2146
|
+
m.onsuccess = m.onerror = $(() => {
|
|
2147
|
+
c(new E.NoSuchDatabase(`Database ${h} doesnt exist`));
|
|
2134
2148
|
});
|
|
2135
2149
|
} else {
|
|
2136
2150
|
o.onerror = Y(c);
|
|
2137
|
-
var
|
|
2138
|
-
|
|
2151
|
+
var p = d.oldVersion > Math.pow(2, 62) ? 0 : d.oldVersion;
|
|
2152
|
+
l = p < 1, t._novip.idbdb = u.result, Mr(t, p / 10, o, c);
|
|
2139
2153
|
}
|
|
2140
|
-
}, c),
|
|
2154
|
+
}, c), u.onsuccess = $(() => {
|
|
2141
2155
|
o = null;
|
|
2142
|
-
const
|
|
2143
|
-
if (
|
|
2156
|
+
const d = t._novip.idbdb = u.result, p = lt(d.objectStoreNames);
|
|
2157
|
+
if (p.length > 0)
|
|
2144
2158
|
try {
|
|
2145
|
-
const
|
|
2159
|
+
const f = d.transaction((m = p).length === 1 ? m[0] : m, "readonly");
|
|
2146
2160
|
e.autoSchema ? function({ _novip: v }, y, g) {
|
|
2147
2161
|
v.verno = y.version / 10;
|
|
2148
|
-
const b = v._dbSchema =
|
|
2149
|
-
v._storeNames =
|
|
2150
|
-
}(t,
|
|
2151
|
-
const g = Jn(
|
|
2162
|
+
const b = v._dbSchema = Ht(0, y, g);
|
|
2163
|
+
v._storeNames = lt(y.objectStoreNames, 0), pt(v, [v._allTables], j(b), b);
|
|
2164
|
+
}(t, d, f) : (Yt(t, t._dbSchema, f), function(v, y) {
|
|
2165
|
+
const g = Jn(Ht(0, v.idbdb, y), v._dbSchema);
|
|
2152
2166
|
return !(g.add.length || g.change.some((b) => b.add.length || b.change.length));
|
|
2153
|
-
}(t,
|
|
2167
|
+
}(t, f) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Vt(t, f);
|
|
2154
2168
|
} catch {
|
|
2155
2169
|
}
|
|
2156
2170
|
var m;
|
|
2157
|
-
|
|
2158
|
-
e.vcFired = !0, t.on("versionchange").fire(
|
|
2159
|
-
}),
|
|
2160
|
-
t.on("close").fire(
|
|
2161
|
-
}),
|
|
2162
|
-
!un(
|
|
2163
|
-
}(t._deps,
|
|
2171
|
+
Ke.push(t), d.onversionchange = $((f) => {
|
|
2172
|
+
e.vcFired = !0, t.on("versionchange").fire(f);
|
|
2173
|
+
}), d.onclose = $((f) => {
|
|
2174
|
+
t.on("close").fire(f);
|
|
2175
|
+
}), l && function({ indexedDB: f, IDBKeyRange: v }, y) {
|
|
2176
|
+
!un(f) && y !== yt && ln(f, v).put({ name: y }).catch(I);
|
|
2177
|
+
}(t._deps, h), a();
|
|
2164
2178
|
}, c);
|
|
2165
|
-
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(
|
|
2179
|
+
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(Gt(() => t.on.ready.fire(t.vip))).then(function a() {
|
|
2166
2180
|
if (e.onReadyBeingFired.length > 0) {
|
|
2167
|
-
let c = e.onReadyBeingFired.reduce(
|
|
2168
|
-
return e.onReadyBeingFired = [], S.resolve(
|
|
2181
|
+
let c = e.onReadyBeingFired.reduce(rn, I);
|
|
2182
|
+
return e.onReadyBeingFired = [], S.resolve(Gt(() => c(t.vip))).then(a);
|
|
2169
2183
|
}
|
|
2170
2184
|
}))).finally(() => {
|
|
2171
2185
|
e.onReadyBeingFired = null, e.isBeingOpened = !1;
|
|
@@ -2180,12 +2194,12 @@ function Ur(t) {
|
|
|
2180
2194
|
e.openComplete = !0, i();
|
|
2181
2195
|
});
|
|
2182
2196
|
}
|
|
2183
|
-
function
|
|
2197
|
+
function Xt(t) {
|
|
2184
2198
|
var e = (i) => t.next(i), n = s(e), r = s((i) => t.throw(i));
|
|
2185
2199
|
function s(i) {
|
|
2186
2200
|
return (o) => {
|
|
2187
|
-
var
|
|
2188
|
-
return
|
|
2201
|
+
var l = i(o), a = l.value;
|
|
2202
|
+
return l.done ? a : a && typeof a.then == "function" ? a.then(n, r) : M(a) ? Promise.all(a).then(n, r) : n(a);
|
|
2189
2203
|
};
|
|
2190
2204
|
}
|
|
2191
2205
|
return s(e)();
|
|
@@ -2200,27 +2214,27 @@ function Vr(t, e, n) {
|
|
|
2200
2214
|
}
|
|
2201
2215
|
function Zn(t, e, n, r, s) {
|
|
2202
2216
|
return S.resolve().then(() => {
|
|
2203
|
-
const i = P.transless || P, o = t._createTransaction(e, n, t._dbSchema, r),
|
|
2217
|
+
const i = P.transless || P, o = t._createTransaction(e, n, t._dbSchema, r), l = { trans: o, transless: i };
|
|
2204
2218
|
if (r)
|
|
2205
2219
|
o.idbtrans = r.idbtrans;
|
|
2206
2220
|
else
|
|
2207
2221
|
try {
|
|
2208
2222
|
o.create(), t._state.PR1398_maxLoop = 3;
|
|
2209
|
-
} catch (
|
|
2210
|
-
return
|
|
2223
|
+
} catch (u) {
|
|
2224
|
+
return u.name === nn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Zn(t, e, n, null, s))) : D(u);
|
|
2211
2225
|
}
|
|
2212
|
-
const a =
|
|
2226
|
+
const a = en(s);
|
|
2213
2227
|
let c;
|
|
2214
2228
|
a && Ee();
|
|
2215
|
-
const
|
|
2229
|
+
const h = S.follow(() => {
|
|
2216
2230
|
if (c = s.call(o, o), c)
|
|
2217
2231
|
if (a) {
|
|
2218
|
-
var
|
|
2219
|
-
c.then(
|
|
2232
|
+
var u = ne.bind(null, null);
|
|
2233
|
+
c.then(u, u);
|
|
2220
2234
|
} else
|
|
2221
|
-
typeof c.next == "function" && typeof c.throw == "function" && (c =
|
|
2222
|
-
},
|
|
2223
|
-
return (c && typeof c.then == "function" ? S.resolve(c).then((
|
|
2235
|
+
typeof c.next == "function" && typeof c.throw == "function" && (c = Xt(c));
|
|
2236
|
+
}, l);
|
|
2237
|
+
return (c && typeof c.then == "function" ? S.resolve(c).then((u) => o.active ? u : D(new E.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : h.then(() => c)).then((u) => (r && o._resolve(), o._completion.then(() => u))).catch((u) => (o._reject(u), D(u)));
|
|
2224
2238
|
});
|
|
2225
2239
|
}
|
|
2226
2240
|
function et(t, e, n) {
|
|
@@ -2232,63 +2246,63 @@ function et(t, e, n) {
|
|
|
2232
2246
|
const Wr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
|
|
2233
2247
|
return { ...t, table(e) {
|
|
2234
2248
|
const n = t.table(e), { schema: r } = n, s = {}, i = [];
|
|
2235
|
-
function o(c,
|
|
2236
|
-
const
|
|
2237
|
-
return
|
|
2249
|
+
function o(c, h, u) {
|
|
2250
|
+
const d = De(c), p = s[d] = s[d] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, f = h > 0, v = { ...u, isVirtual: f, keyTail: h, keyLength: m, extractKey: Ut(c), unique: !f && u.unique };
|
|
2251
|
+
return p.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), h + 1, u), p.sort((y, g) => y.keyTail - g.keyTail), v;
|
|
2238
2252
|
}
|
|
2239
|
-
const
|
|
2240
|
-
s[":id"] = [
|
|
2253
|
+
const l = o(r.primaryKey.keyPath, 0, r.primaryKey);
|
|
2254
|
+
s[":id"] = [l];
|
|
2241
2255
|
for (const c of r.indexes)
|
|
2242
2256
|
o(c.keyPath, 0, c);
|
|
2243
2257
|
function a(c) {
|
|
2244
|
-
const
|
|
2245
|
-
return
|
|
2246
|
-
var
|
|
2258
|
+
const h = c.query.index;
|
|
2259
|
+
return h.isVirtual ? { ...c, query: { index: h, range: (u = c.query.range, d = h.keyTail, { type: u.type === 1 ? 2 : u.type, lower: et(u.lower, u.lowerOpen ? t.MAX_KEY : t.MIN_KEY, d), lowerOpen: !0, upper: et(u.upper, u.upperOpen ? t.MIN_KEY : t.MAX_KEY, d), upperOpen: !0 }) } } : c;
|
|
2260
|
+
var u, d;
|
|
2247
2261
|
}
|
|
2248
|
-
return { ...n, schema: { ...r, primaryKey:
|
|
2249
|
-
const
|
|
2250
|
-
return
|
|
2262
|
+
return { ...n, schema: { ...r, primaryKey: l, indexes: i, getIndexByKeyPath: function(c) {
|
|
2263
|
+
const h = s[De(c)];
|
|
2264
|
+
return h && h[0];
|
|
2251
2265
|
} }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
|
|
2252
|
-
const { keyTail:
|
|
2253
|
-
return
|
|
2254
|
-
return Object.create(m, { continue: { value: function(
|
|
2255
|
-
|
|
2256
|
-
} }, continuePrimaryKey: { value(
|
|
2257
|
-
m.continuePrimaryKey(et(
|
|
2266
|
+
const { keyTail: h, isVirtual: u, keyLength: d } = c.query.index;
|
|
2267
|
+
return u ? n.openCursor(a(c)).then((p) => p && function(m) {
|
|
2268
|
+
return Object.create(m, { continue: { value: function(f) {
|
|
2269
|
+
f != null ? m.continue(et(f, c.reverse ? t.MAX_KEY : t.MIN_KEY, h)) : c.unique ? m.continue(m.key.slice(0, d).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, h)) : m.continue();
|
|
2270
|
+
} }, continuePrimaryKey: { value(f, v) {
|
|
2271
|
+
m.continuePrimaryKey(et(f, t.MAX_KEY, h), v);
|
|
2258
2272
|
} }, primaryKey: { get: () => m.primaryKey }, key: { get() {
|
|
2259
|
-
const
|
|
2260
|
-
return
|
|
2273
|
+
const f = m.key;
|
|
2274
|
+
return d === 1 ? f[0] : f.slice(0, d);
|
|
2261
2275
|
} }, value: { get: () => m.value } });
|
|
2262
|
-
}(
|
|
2276
|
+
}(p)) : n.openCursor(c);
|
|
2263
2277
|
} };
|
|
2264
2278
|
} };
|
|
2265
2279
|
} };
|
|
2266
|
-
function
|
|
2267
|
-
return n = n || {}, r = r || "",
|
|
2280
|
+
function cn(t, e, n, r) {
|
|
2281
|
+
return n = n || {}, r = r || "", j(t).forEach((s) => {
|
|
2268
2282
|
if (z(e, s)) {
|
|
2269
2283
|
var i = t[s], o = e[s];
|
|
2270
2284
|
if (typeof i == "object" && typeof o == "object" && i && o) {
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2285
|
+
const l = At(i);
|
|
2286
|
+
l !== At(o) ? n[r + s] = e[s] : l === "Object" ? cn(i, o, n, r + s + ".") : i !== o && (n[r + s] = e[s]);
|
|
2273
2287
|
} else
|
|
2274
2288
|
i !== o && (n[r + s] = e[s]);
|
|
2275
2289
|
} else
|
|
2276
2290
|
n[r + s] = void 0;
|
|
2277
|
-
}),
|
|
2291
|
+
}), j(e).forEach((s) => {
|
|
2278
2292
|
z(t, s) || (n[r + s] = e[s]);
|
|
2279
2293
|
}), n;
|
|
2280
2294
|
}
|
|
2281
2295
|
const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
|
|
2282
2296
|
const n = t.table(e), { primaryKey: r } = n.schema;
|
|
2283
2297
|
return { ...n, mutate(s) {
|
|
2284
|
-
const i = P.trans, { deleting: o, creating:
|
|
2298
|
+
const i = P.trans, { deleting: o, creating: l, updating: a } = i.table(e).hook;
|
|
2285
2299
|
switch (s.type) {
|
|
2286
2300
|
case "add":
|
|
2287
|
-
if (
|
|
2301
|
+
if (l.fire === I)
|
|
2288
2302
|
break;
|
|
2289
2303
|
return i._promise("readwrite", () => c(s), !0);
|
|
2290
2304
|
case "put":
|
|
2291
|
-
if (
|
|
2305
|
+
if (l.fire === I && a.fire === I)
|
|
2292
2306
|
break;
|
|
2293
2307
|
return i._promise("readwrite", () => c(s), !0);
|
|
2294
2308
|
case "delete":
|
|
@@ -2298,49 +2312,49 @@ const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) =>
|
|
|
2298
2312
|
case "deleteRange":
|
|
2299
2313
|
if (o.fire === I)
|
|
2300
2314
|
break;
|
|
2301
|
-
return i._promise("readwrite", () => function(
|
|
2302
|
-
return
|
|
2315
|
+
return i._promise("readwrite", () => function(u) {
|
|
2316
|
+
return h(u.trans, u.range, 1e4);
|
|
2303
2317
|
}(s), !0);
|
|
2304
2318
|
}
|
|
2305
2319
|
return n.mutate(s);
|
|
2306
|
-
function c(
|
|
2307
|
-
const
|
|
2308
|
-
return
|
|
2309
|
-
}(r,
|
|
2310
|
-
if (!
|
|
2320
|
+
function c(u) {
|
|
2321
|
+
const d = P.trans, p = u.keys || function(m, f) {
|
|
2322
|
+
return f.type === "delete" ? f.keys : f.keys || f.values.map(m.extractKey);
|
|
2323
|
+
}(r, u);
|
|
2324
|
+
if (!p)
|
|
2311
2325
|
throw new Error("Keys missing");
|
|
2312
|
-
return (
|
|
2313
|
-
return
|
|
2314
|
-
}(n,
|
|
2315
|
-
const
|
|
2326
|
+
return (u = u.type === "add" || u.type === "put" ? { ...u, keys: p } : { ...u }).type !== "delete" && (u.values = [...u.values]), u.keys && (u.keys = [...u.keys]), function(m, f, v) {
|
|
2327
|
+
return f.type === "add" ? Promise.resolve([]) : m.getMany({ trans: f.trans, keys: v, cache: "immutable" });
|
|
2328
|
+
}(n, u, p).then((m) => {
|
|
2329
|
+
const f = p.map((v, y) => {
|
|
2316
2330
|
const g = m[y], b = { onerror: null, onsuccess: null };
|
|
2317
|
-
if (
|
|
2318
|
-
o.fire.call(b, v, g,
|
|
2319
|
-
else if (
|
|
2320
|
-
const
|
|
2321
|
-
v == null &&
|
|
2331
|
+
if (u.type === "delete")
|
|
2332
|
+
o.fire.call(b, v, g, d);
|
|
2333
|
+
else if (u.type === "add" || g === void 0) {
|
|
2334
|
+
const w = l.fire.call(b, v, u.values[y], d);
|
|
2335
|
+
v == null && w != null && (v = w, u.keys[y] = v, r.outbound || H(u.values[y], r.keyPath, v));
|
|
2322
2336
|
} else {
|
|
2323
|
-
const
|
|
2337
|
+
const w = cn(g, u.values[y]), C = a.fire.call(b, w, v, g, d);
|
|
2324
2338
|
if (C) {
|
|
2325
|
-
const
|
|
2326
|
-
Object.keys(C).forEach((
|
|
2327
|
-
z(
|
|
2339
|
+
const k = u.values[y];
|
|
2340
|
+
Object.keys(C).forEach((_) => {
|
|
2341
|
+
z(k, _) ? k[_] = C[_] : H(k, _, C[_]);
|
|
2328
2342
|
});
|
|
2329
2343
|
}
|
|
2330
2344
|
}
|
|
2331
2345
|
return b;
|
|
2332
2346
|
});
|
|
2333
|
-
return n.mutate(
|
|
2334
|
-
for (let
|
|
2335
|
-
const C = y ? y[
|
|
2336
|
-
C == null ?
|
|
2347
|
+
return n.mutate(u).then(({ failures: v, results: y, numFailures: g, lastResult: b }) => {
|
|
2348
|
+
for (let w = 0; w < p.length; ++w) {
|
|
2349
|
+
const C = y ? y[w] : p[w], k = f[w];
|
|
2350
|
+
C == null ? k.onerror && k.onerror(v[w]) : k.onsuccess && k.onsuccess(u.type === "put" && m[w] ? u.values[w] : C);
|
|
2337
2351
|
}
|
|
2338
2352
|
return { failures: v, results: y, numFailures: g, lastResult: b };
|
|
2339
|
-
}).catch((v) => (
|
|
2353
|
+
}).catch((v) => (f.forEach((y) => y.onerror && y.onerror(v)), Promise.reject(v)));
|
|
2340
2354
|
});
|
|
2341
2355
|
}
|
|
2342
|
-
function
|
|
2343
|
-
return n.query({ trans:
|
|
2356
|
+
function h(u, d, p) {
|
|
2357
|
+
return n.query({ trans: u, values: !1, query: { index: r, range: d }, limit: p }).then(({ result: m }) => c({ type: "delete", keys: m, trans: u }).then((f) => f.numFailures > 0 ? Promise.reject(f.failures[0]) : m.length < p ? { failures: [], numFailures: 0, lastResult: void 0 } : h(u, { ...d, lower: m[m.length - 1], lowerOpen: !0 }, p)));
|
|
2344
2358
|
}
|
|
2345
2359
|
} };
|
|
2346
2360
|
} }) };
|
|
@@ -2365,7 +2379,7 @@ const Hr = { stack: "dbcore", level: -1, create: (t) => ({ table: (e) => {
|
|
|
2365
2379
|
return s ? S.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? We(i) : i }, i));
|
|
2366
2380
|
}, mutate: (r) => (r.type !== "add" && (r.trans._cache = null), n.mutate(r)) };
|
|
2367
2381
|
} }) };
|
|
2368
|
-
function
|
|
2382
|
+
function hn(t) {
|
|
2369
2383
|
return !("from" in t);
|
|
2370
2384
|
}
|
|
2371
2385
|
const Q = function(t, e) {
|
|
@@ -2381,7 +2395,7 @@ function Ve(t, e, n) {
|
|
|
2381
2395
|
return;
|
|
2382
2396
|
if (r > 0)
|
|
2383
2397
|
throw RangeError();
|
|
2384
|
-
if (
|
|
2398
|
+
if (hn(t))
|
|
2385
2399
|
return U(t, { from: e, to: n, d: 1 });
|
|
2386
2400
|
const s = t.l, i = t.r;
|
|
2387
2401
|
if (L(n, t.from) < 0)
|
|
@@ -2393,27 +2407,27 @@ function Ve(t, e, n) {
|
|
|
2393
2407
|
s && !t.l && mt(t, s), i && o && mt(t, i);
|
|
2394
2408
|
}
|
|
2395
2409
|
function mt(t, e) {
|
|
2396
|
-
|
|
2397
|
-
Ve(r, s, i), o && n(r, o),
|
|
2410
|
+
hn(e) || function n(r, { from: s, to: i, l: o, r: l }) {
|
|
2411
|
+
Ve(r, s, i), o && n(r, o), l && n(r, l);
|
|
2398
2412
|
}(t, e);
|
|
2399
2413
|
}
|
|
2400
2414
|
function Yr(t, e) {
|
|
2401
|
-
const n =
|
|
2415
|
+
const n = Qt(e);
|
|
2402
2416
|
let r = n.next();
|
|
2403
2417
|
if (r.done)
|
|
2404
2418
|
return !1;
|
|
2405
2419
|
let s = r.value;
|
|
2406
|
-
const i =
|
|
2407
|
-
let o = i.next(s.from),
|
|
2420
|
+
const i = Qt(t);
|
|
2421
|
+
let o = i.next(s.from), l = o.value;
|
|
2408
2422
|
for (; !r.done && !o.done; ) {
|
|
2409
|
-
if (L(
|
|
2423
|
+
if (L(l.from, s.to) <= 0 && L(l.to, s.from) >= 0)
|
|
2410
2424
|
return !0;
|
|
2411
|
-
L(s.from,
|
|
2425
|
+
L(s.from, l.from) < 0 ? s = (r = n.next(l.from)).value : l = (o = i.next(s.from)).value;
|
|
2412
2426
|
}
|
|
2413
2427
|
return !1;
|
|
2414
2428
|
}
|
|
2415
|
-
function
|
|
2416
|
-
let e =
|
|
2429
|
+
function Qt(t) {
|
|
2430
|
+
let e = hn(t) ? null : { s: 0, n: t };
|
|
2417
2431
|
return { next(n) {
|
|
2418
2432
|
const r = arguments.length > 0;
|
|
2419
2433
|
for (; e; )
|
|
@@ -2443,8 +2457,8 @@ function xn(t) {
|
|
|
2443
2457
|
var e, n;
|
|
2444
2458
|
const r = (((e = t.r) === null || e === void 0 ? void 0 : e.d) || 0) - (((n = t.l) === null || n === void 0 ? void 0 : n.d) || 0), s = r > 1 ? "r" : r < -1 ? "l" : "";
|
|
2445
2459
|
if (s) {
|
|
2446
|
-
const i = s === "r" ? "l" : "r", o = { ...t },
|
|
2447
|
-
t.from =
|
|
2460
|
+
const i = s === "r" ? "l" : "r", o = { ...t }, l = t[s];
|
|
2461
|
+
t.from = l.from, t.to = l.to, t[s] = l[s], o[s] = l[i], t[i] = o, o.d = Sn(o);
|
|
2448
2462
|
}
|
|
2449
2463
|
t.d = Sn(t);
|
|
2450
2464
|
}
|
|
@@ -2457,71 +2471,71 @@ Ce(Q.prototype, { add(t) {
|
|
|
2457
2471
|
return Ve(this, t, t), this;
|
|
2458
2472
|
}, addKeys(t) {
|
|
2459
2473
|
return t.forEach((e) => Ve(this, e, e)), this;
|
|
2460
|
-
}, [
|
|
2461
|
-
return
|
|
2474
|
+
}, [Ot]() {
|
|
2475
|
+
return Qt(this);
|
|
2462
2476
|
} });
|
|
2463
2477
|
const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
2464
2478
|
const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
|
|
2465
2479
|
return { ...t, table: (r) => {
|
|
2466
|
-
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey:
|
|
2467
|
-
const
|
|
2468
|
-
const
|
|
2469
|
-
return m[
|
|
2470
|
-
}, v =
|
|
2471
|
-
let [b,
|
|
2472
|
-
const C =
|
|
2473
|
-
return s.mutate(
|
|
2480
|
+
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: l, outbound: a } = o, c = { ...s, mutate: (d) => {
|
|
2481
|
+
const p = d.trans, m = p.mutatedParts || (p.mutatedParts = {}), f = (k) => {
|
|
2482
|
+
const _ = `idb://${e}/${r}/${k}`;
|
|
2483
|
+
return m[_] || (m[_] = new Q());
|
|
2484
|
+
}, v = f(""), y = f(":dels"), { type: g } = d;
|
|
2485
|
+
let [b, w] = d.type === "deleteRange" ? [d.range] : d.type === "delete" ? [d.keys] : d.values.length < 50 ? [[], d.values] : [];
|
|
2486
|
+
const C = d.trans._cache;
|
|
2487
|
+
return s.mutate(d).then((k) => {
|
|
2474
2488
|
if (M(b)) {
|
|
2475
|
-
g !== "delete" && (b =
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2489
|
+
g !== "delete" && (b = k.results), v.addKeys(b);
|
|
2490
|
+
const _ = er(b, C);
|
|
2491
|
+
_ || g === "add" || y.addKeys(b), (_ || w) && function(A, x, N, O) {
|
|
2478
2492
|
function q(B) {
|
|
2479
|
-
const
|
|
2493
|
+
const K = A(B.name || "");
|
|
2480
2494
|
function ye(V) {
|
|
2481
2495
|
return V != null ? B.extractKey(V) : null;
|
|
2482
2496
|
}
|
|
2483
|
-
const ve = (V) => B.multiEntry && M(V) ? V.forEach((
|
|
2484
|
-
(
|
|
2485
|
-
const Ae =
|
|
2497
|
+
const ve = (V) => B.multiEntry && M(V) ? V.forEach((ue) => K.addKey(ue)) : K.addKey(V);
|
|
2498
|
+
(N || O).forEach((V, ue) => {
|
|
2499
|
+
const Ae = N && ye(N[ue]), vt = O && ye(O[ue]);
|
|
2486
2500
|
L(Ae, vt) !== 0 && (Ae != null && ve(Ae), vt != null && ve(vt));
|
|
2487
2501
|
});
|
|
2488
2502
|
}
|
|
2489
|
-
|
|
2490
|
-
}(
|
|
2503
|
+
x.indexes.forEach(q);
|
|
2504
|
+
}(f, i, _, w);
|
|
2491
2505
|
} else if (b) {
|
|
2492
|
-
const
|
|
2493
|
-
y.add(
|
|
2506
|
+
const _ = { from: b.lower, to: b.upper };
|
|
2507
|
+
y.add(_), v.add(_);
|
|
2494
2508
|
} else
|
|
2495
|
-
v.add(n), y.add(n), i.indexes.forEach((
|
|
2496
|
-
return
|
|
2509
|
+
v.add(n), y.add(n), i.indexes.forEach((_) => f(_.name).add(n));
|
|
2510
|
+
return k;
|
|
2497
2511
|
});
|
|
2498
|
-
} },
|
|
2499
|
-
var m,
|
|
2500
|
-
return [
|
|
2501
|
-
},
|
|
2502
|
-
return
|
|
2503
|
-
c[
|
|
2512
|
+
} }, h = ({ query: { index: d, range: p } }) => {
|
|
2513
|
+
var m, f;
|
|
2514
|
+
return [d, new Q((m = p.lower) !== null && m !== void 0 ? m : t.MIN_KEY, (f = p.upper) !== null && f !== void 0 ? f : t.MAX_KEY)];
|
|
2515
|
+
}, u = { get: (d) => [o, new Q(d.key)], getMany: (d) => [o, new Q().addKeys(d.keys)], count: h, query: h, openCursor: h };
|
|
2516
|
+
return j(u).forEach((d) => {
|
|
2517
|
+
c[d] = function(p) {
|
|
2504
2518
|
const { subscr: m } = P;
|
|
2505
2519
|
if (m) {
|
|
2506
|
-
const
|
|
2507
|
-
const C = `idb://${e}/${r}/${
|
|
2520
|
+
const f = (w) => {
|
|
2521
|
+
const C = `idb://${e}/${r}/${w}`;
|
|
2508
2522
|
return m[C] || (m[C] = new Q());
|
|
2509
|
-
}, v =
|
|
2510
|
-
if (
|
|
2511
|
-
if (
|
|
2512
|
-
const
|
|
2513
|
-
return s[
|
|
2514
|
-
if (
|
|
2515
|
-
if (a &&
|
|
2516
|
-
return
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
} else if (
|
|
2520
|
-
const
|
|
2521
|
-
return
|
|
2522
|
-
const A =
|
|
2523
|
+
}, v = f(""), y = f(":dels"), [g, b] = u[d](p);
|
|
2524
|
+
if (f(g.name || "").add(b), !g.isPrimaryKey) {
|
|
2525
|
+
if (d !== "count") {
|
|
2526
|
+
const w = d === "query" && a && p.values && s.query({ ...p, values: !1 });
|
|
2527
|
+
return s[d].apply(this, arguments).then((C) => {
|
|
2528
|
+
if (d === "query") {
|
|
2529
|
+
if (a && p.values)
|
|
2530
|
+
return w.then(({ result: _ }) => (v.addKeys(_), C));
|
|
2531
|
+
const k = p.values ? C.result.map(l) : C.result;
|
|
2532
|
+
p.values ? v.addKeys(k) : y.addKeys(k);
|
|
2533
|
+
} else if (d === "openCursor") {
|
|
2534
|
+
const k = C, _ = p.values;
|
|
2535
|
+
return k && Object.create(k, { key: { get: () => (y.addKey(k.primaryKey), k.key) }, primaryKey: { get() {
|
|
2536
|
+
const A = k.primaryKey;
|
|
2523
2537
|
return y.addKey(A), A;
|
|
2524
|
-
} }, value: { get: () => (
|
|
2538
|
+
} }, value: { get: () => (_ && v.addKey(k.primaryKey), k.value) } });
|
|
2525
2539
|
}
|
|
2526
2540
|
return C;
|
|
2527
2541
|
});
|
|
@@ -2529,7 +2543,7 @@ const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
|
2529
2543
|
y.add(n);
|
|
2530
2544
|
}
|
|
2531
2545
|
}
|
|
2532
|
-
return s[
|
|
2546
|
+
return s[d].apply(this, arguments);
|
|
2533
2547
|
};
|
|
2534
2548
|
}), c;
|
|
2535
2549
|
} };
|
|
@@ -2543,70 +2557,70 @@ class pe {
|
|
|
2543
2557
|
this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
2544
2558
|
const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: I, dbReadyPromise: null, cancelOpen: I, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3 };
|
|
2545
2559
|
var o;
|
|
2546
|
-
i.dbReadyPromise = new S((
|
|
2547
|
-
i.dbReadyResolve =
|
|
2548
|
-
}), i.openCanceller = new S((
|
|
2560
|
+
i.dbReadyPromise = new S((l) => {
|
|
2561
|
+
i.dbReadyResolve = l;
|
|
2562
|
+
}), i.openCanceller = new S((l, a) => {
|
|
2549
2563
|
i.cancelOpen = a;
|
|
2550
|
-
}), this._state = i, this.name = e, this.on =
|
|
2564
|
+
}), this._state = i, this.name = e, this.on = je(this, "populate", "blocked", "versionchange", "close", { ready: [rn, I] }), this.on.ready.subscribe = Pn(this.on.ready.subscribe, (l) => (a, c) => {
|
|
2551
2565
|
pe.vip(() => {
|
|
2552
|
-
const
|
|
2553
|
-
if (
|
|
2554
|
-
|
|
2555
|
-
else if (
|
|
2556
|
-
|
|
2566
|
+
const h = this._state;
|
|
2567
|
+
if (h.openComplete)
|
|
2568
|
+
h.dbOpenError || S.resolve().then(a), c && l(a);
|
|
2569
|
+
else if (h.onReadyBeingFired)
|
|
2570
|
+
h.onReadyBeingFired.push(a), c && l(a);
|
|
2557
2571
|
else {
|
|
2558
|
-
|
|
2559
|
-
const
|
|
2560
|
-
c ||
|
|
2561
|
-
|
|
2572
|
+
l(a);
|
|
2573
|
+
const u = this;
|
|
2574
|
+
c || l(function d() {
|
|
2575
|
+
u.on.ready.unsubscribe(a), u.on.ready.unsubscribe(d);
|
|
2562
2576
|
});
|
|
2563
2577
|
}
|
|
2564
2578
|
});
|
|
2565
|
-
}), this.Collection = (o = this, Oe(
|
|
2579
|
+
}), this.Collection = (o = this, Oe(Rr.prototype, function(l, a) {
|
|
2566
2580
|
this.db = o;
|
|
2567
|
-
let c = Hn,
|
|
2581
|
+
let c = Hn, h = null;
|
|
2568
2582
|
if (a)
|
|
2569
2583
|
try {
|
|
2570
2584
|
c = a();
|
|
2571
2585
|
} catch (m) {
|
|
2572
|
-
|
|
2586
|
+
h = m;
|
|
2573
2587
|
}
|
|
2574
|
-
const
|
|
2575
|
-
this._ctx = { table:
|
|
2576
|
-
})), this.Table = function(
|
|
2577
|
-
return Oe(Ir.prototype, function(a, c,
|
|
2578
|
-
this.db =
|
|
2588
|
+
const u = l._ctx, d = u.table, p = d.hook.reading.fire;
|
|
2589
|
+
this._ctx = { table: d, index: u.index, isPrimKey: !u.index || d.schema.primKey.keyPath && u.index === d.schema.primKey.name, range: c, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: h, or: u.or, valueMapper: p !== Fe ? p : null };
|
|
2590
|
+
})), this.Table = function(l) {
|
|
2591
|
+
return Oe(Ir.prototype, function(a, c, h) {
|
|
2592
|
+
this.db = l, this._tx = h, this.name = a, this.schema = c, this.hook = l._allTables[a] ? l._allTables[a].hook : je(null, { creating: [br, I], reading: [vr, Fe], updating: [_r, I], deleting: [wr, I] });
|
|
2579
2593
|
});
|
|
2580
|
-
}(this), this.Transaction = function(
|
|
2581
|
-
return Oe(
|
|
2582
|
-
this.db =
|
|
2583
|
-
this._resolve =
|
|
2594
|
+
}(this), this.Transaction = function(l) {
|
|
2595
|
+
return Oe(jr.prototype, function(a, c, h, u, d) {
|
|
2596
|
+
this.db = l, this.mode = a, this.storeNames = c, this.schema = h, this.chromeTransactionDurability = u, this.idbtrans = null, this.on = je(this, "complete", "error", "abort"), this.parent = d || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new S((p, m) => {
|
|
2597
|
+
this._resolve = p, this._reject = m;
|
|
2584
2598
|
}), this._completion.then(() => {
|
|
2585
2599
|
this.active = !1, this.on.complete.fire();
|
|
2586
|
-
}, (
|
|
2600
|
+
}, (p) => {
|
|
2587
2601
|
var m = this.active;
|
|
2588
|
-
return this.active = !1, this.on.error.fire(
|
|
2602
|
+
return this.active = !1, this.on.error.fire(p), this.parent ? this.parent._reject(p) : m && this.idbtrans && this.idbtrans.abort(), D(p);
|
|
2589
2603
|
});
|
|
2590
2604
|
});
|
|
2591
|
-
}(this), this.Version = function(
|
|
2605
|
+
}(this), this.Version = function(l) {
|
|
2592
2606
|
return Oe(qr.prototype, function(a) {
|
|
2593
|
-
this.db =
|
|
2607
|
+
this.db = l, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
2594
2608
|
});
|
|
2595
|
-
}(this), this.WhereClause = function(
|
|
2596
|
-
return Oe(Gn.prototype, function(a, c,
|
|
2597
|
-
this.db =
|
|
2598
|
-
const
|
|
2599
|
-
if (!
|
|
2609
|
+
}(this), this.WhereClause = function(l) {
|
|
2610
|
+
return Oe(Gn.prototype, function(a, c, h) {
|
|
2611
|
+
this.db = l, this._ctx = { table: a, index: c === ":id" ? null : c, or: h };
|
|
2612
|
+
const u = l._deps.indexedDB;
|
|
2613
|
+
if (!u)
|
|
2600
2614
|
throw new E.MissingAPI();
|
|
2601
|
-
this._cmp = this._ascending =
|
|
2615
|
+
this._cmp = this._ascending = u.cmp.bind(u), this._descending = (d, p) => u.cmp(p, d), this._max = (d, p) => u.cmp(d, p) > 0 ? d : p, this._min = (d, p) => u.cmp(d, p) < 0 ? d : p, this._IDBKeyRange = l._deps.IDBKeyRange;
|
|
2602
2616
|
});
|
|
2603
|
-
}(this), this.on("versionchange", (
|
|
2604
|
-
|
|
2605
|
-
}), this.on("blocked", (
|
|
2606
|
-
!
|
|
2607
|
-
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (
|
|
2608
|
-
this.on("blocked").fire(
|
|
2609
|
-
}, this.use(Wr), this.use(zr), this.use(Gr), this.use(Hr), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((
|
|
2617
|
+
}(this), this.on("versionchange", (l) => {
|
|
2618
|
+
l.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
|
|
2619
|
+
}), this.on("blocked", (l) => {
|
|
2620
|
+
!l.newVersion || l.newVersion < l.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${l.oldVersion / 10}`);
|
|
2621
|
+
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (l, a, c, h) => new this.Transaction(l, a, c, this._options.chromeTransactionDurability, h), this._fireOnBlocked = (l) => {
|
|
2622
|
+
this.on("blocked").fire(l), Ke.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(l));
|
|
2623
|
+
}, this.use(Wr), this.use(zr), this.use(Gr), this.use(Hr), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((l) => l(this));
|
|
2610
2624
|
}
|
|
2611
2625
|
version(e) {
|
|
2612
2626
|
if (isNaN(e) || e < 0.1)
|
|
@@ -2633,7 +2647,7 @@ class pe {
|
|
|
2633
2647
|
use({ stack: e, create: n, level: r, name: s }) {
|
|
2634
2648
|
s && this.unuse({ stack: e, name: s });
|
|
2635
2649
|
const i = this._middlewares[e] || (this._middlewares[e] = []);
|
|
2636
|
-
return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o,
|
|
2650
|
+
return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o, l) => o.level - l.level), this;
|
|
2637
2651
|
}
|
|
2638
2652
|
unuse({ stack: e, name: n, create: r }) {
|
|
2639
2653
|
return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((s) => r ? s.create !== r : !!n && s.name !== n)), this;
|
|
@@ -2642,8 +2656,8 @@ class pe {
|
|
|
2642
2656
|
return Ur(this);
|
|
2643
2657
|
}
|
|
2644
2658
|
_close() {
|
|
2645
|
-
const e = this._state, n =
|
|
2646
|
-
if (n >= 0 &&
|
|
2659
|
+
const e = this._state, n = Ke.indexOf(this);
|
|
2660
|
+
if (n >= 0 && Ke.splice(n, 1), this.idbdb) {
|
|
2647
2661
|
try {
|
|
2648
2662
|
this.idbdb.close();
|
|
2649
2663
|
} catch {
|
|
@@ -2667,9 +2681,9 @@ class pe {
|
|
|
2667
2681
|
const i = () => {
|
|
2668
2682
|
this.close();
|
|
2669
2683
|
var o = this._deps.indexedDB.deleteDatabase(this.name);
|
|
2670
|
-
o.onsuccess =
|
|
2671
|
-
(function({ indexedDB:
|
|
2672
|
-
!un(
|
|
2684
|
+
o.onsuccess = $(() => {
|
|
2685
|
+
(function({ indexedDB: l, IDBKeyRange: a }, c) {
|
|
2686
|
+
!un(l) && c !== yt && ln(l, a).delete(c).catch(I);
|
|
2673
2687
|
})(this._deps, this.name), r();
|
|
2674
2688
|
}), o.onerror = Y(s), o.onblocked = this._fireOnBlocked;
|
|
2675
2689
|
};
|
|
@@ -2695,7 +2709,7 @@ class pe {
|
|
|
2695
2709
|
return this._state.autoSchema;
|
|
2696
2710
|
}
|
|
2697
2711
|
get tables() {
|
|
2698
|
-
return
|
|
2712
|
+
return j(this._allTables).map((e) => this._allTables[e]);
|
|
2699
2713
|
}
|
|
2700
2714
|
transaction() {
|
|
2701
2715
|
const e = Vr.apply(this, arguments);
|
|
@@ -2705,28 +2719,28 @@ class pe {
|
|
|
2705
2719
|
let s = P.trans;
|
|
2706
2720
|
s && s.db === this && e.indexOf("!") === -1 || (s = null);
|
|
2707
2721
|
const i = e.indexOf("?") !== -1;
|
|
2708
|
-
let o,
|
|
2722
|
+
let o, l;
|
|
2709
2723
|
e = e.replace("!", "").replace("?", "");
|
|
2710
2724
|
try {
|
|
2711
|
-
if (
|
|
2712
|
-
var
|
|
2713
|
-
if (typeof
|
|
2725
|
+
if (l = n.map((c) => {
|
|
2726
|
+
var h = c instanceof this.Table ? c.name : c;
|
|
2727
|
+
if (typeof h != "string")
|
|
2714
2728
|
throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
2715
|
-
return
|
|
2716
|
-
}), e == "r" || e ===
|
|
2717
|
-
o =
|
|
2729
|
+
return h;
|
|
2730
|
+
}), e == "r" || e === _t)
|
|
2731
|
+
o = _t;
|
|
2718
2732
|
else {
|
|
2719
|
-
if (e != "rw" && e !=
|
|
2733
|
+
if (e != "rw" && e != kt)
|
|
2720
2734
|
throw new E.InvalidArgument("Invalid transaction mode: " + e);
|
|
2721
|
-
o =
|
|
2735
|
+
o = kt;
|
|
2722
2736
|
}
|
|
2723
2737
|
if (s) {
|
|
2724
|
-
if (s.mode ===
|
|
2738
|
+
if (s.mode === _t && o === kt) {
|
|
2725
2739
|
if (!i)
|
|
2726
2740
|
throw new E.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
2727
2741
|
s = null;
|
|
2728
2742
|
}
|
|
2729
|
-
s &&
|
|
2743
|
+
s && l.forEach((c) => {
|
|
2730
2744
|
if (s && s.storeNames.indexOf(c) === -1) {
|
|
2731
2745
|
if (!i)
|
|
2732
2746
|
throw new E.SubTransaction("Table " + c + " not included in parent transaction.");
|
|
@@ -2735,11 +2749,11 @@ class pe {
|
|
|
2735
2749
|
}), i && s && !s.active && (s = null);
|
|
2736
2750
|
}
|
|
2737
2751
|
} catch (c) {
|
|
2738
|
-
return s ? s._promise(null, (
|
|
2739
|
-
|
|
2752
|
+
return s ? s._promise(null, (h, u) => {
|
|
2753
|
+
u(c);
|
|
2740
2754
|
}) : D(c);
|
|
2741
2755
|
}
|
|
2742
|
-
const a = Zn.bind(null, this, o,
|
|
2756
|
+
const a = Zn.bind(null, this, o, l, s, r);
|
|
2743
2757
|
return s ? s._promise(o, a, "lock") : P.trans ? Te(P.transless, () => this._whenReady(a)) : this._whenReady(a);
|
|
2744
2758
|
}
|
|
2745
2759
|
table(e) {
|
|
@@ -2761,57 +2775,57 @@ class Qr {
|
|
|
2761
2775
|
}
|
|
2762
2776
|
}
|
|
2763
2777
|
function tr(t, e) {
|
|
2764
|
-
return
|
|
2778
|
+
return j(e).forEach((n) => {
|
|
2765
2779
|
mt(t[n] || (t[n] = new Q()), e[n]);
|
|
2766
2780
|
}), t;
|
|
2767
2781
|
}
|
|
2768
2782
|
function Jr(t) {
|
|
2769
2783
|
let e, n = !1;
|
|
2770
2784
|
const r = new Qr((s) => {
|
|
2771
|
-
const i =
|
|
2772
|
-
let o = !1,
|
|
2785
|
+
const i = en(t);
|
|
2786
|
+
let o = !1, l = {}, a = {};
|
|
2773
2787
|
const c = { get closed() {
|
|
2774
2788
|
return o;
|
|
2775
2789
|
}, unsubscribe: () => {
|
|
2776
|
-
o = !0,
|
|
2790
|
+
o = !0, le.storagemutated.unsubscribe(p);
|
|
2777
2791
|
} };
|
|
2778
2792
|
s.start && s.start(c);
|
|
2779
|
-
let
|
|
2780
|
-
function
|
|
2781
|
-
return
|
|
2793
|
+
let h = !1, u = !1;
|
|
2794
|
+
function d() {
|
|
2795
|
+
return j(a).some((f) => l[f] && Yr(l[f], a[f]));
|
|
2782
2796
|
}
|
|
2783
|
-
const
|
|
2784
|
-
tr(
|
|
2797
|
+
const p = (f) => {
|
|
2798
|
+
tr(l, f), d() && m();
|
|
2785
2799
|
}, m = () => {
|
|
2786
|
-
if (
|
|
2800
|
+
if (h || o)
|
|
2787
2801
|
return;
|
|
2788
|
-
|
|
2789
|
-
const
|
|
2802
|
+
l = {};
|
|
2803
|
+
const f = {}, v = function(y) {
|
|
2790
2804
|
i && Ee();
|
|
2791
2805
|
const g = () => oe(t, { subscr: y, trans: null }), b = P.trans ? Te(P.transless, g) : g();
|
|
2792
2806
|
return i && b.then(ne, ne), b;
|
|
2793
|
-
}(
|
|
2794
|
-
|
|
2795
|
-
n = !0, e = y,
|
|
2807
|
+
}(f);
|
|
2808
|
+
u || (le(Le, p), u = !0), h = !0, Promise.resolve(v).then((y) => {
|
|
2809
|
+
n = !0, e = y, h = !1, o || (d() ? m() : (l = {}, a = f, s.next && s.next(y)));
|
|
2796
2810
|
}, (y) => {
|
|
2797
|
-
|
|
2811
|
+
h = !1, n = !1, s.error && s.error(y), c.unsubscribe();
|
|
2798
2812
|
});
|
|
2799
2813
|
};
|
|
2800
2814
|
return m(), c;
|
|
2801
2815
|
});
|
|
2802
2816
|
return r.hasValue = () => n, r.getValue = () => e, r;
|
|
2803
2817
|
}
|
|
2804
|
-
let
|
|
2818
|
+
let Jt;
|
|
2805
2819
|
try {
|
|
2806
|
-
|
|
2820
|
+
Jt = { indexedDB: R.indexedDB || R.mozIndexedDB || R.webkitIndexedDB || R.msIndexedDB, IDBKeyRange: R.IDBKeyRange || R.webkitIDBKeyRange };
|
|
2807
2821
|
} catch {
|
|
2808
|
-
|
|
2822
|
+
Jt = { indexedDB: null, IDBKeyRange: null };
|
|
2809
2823
|
}
|
|
2810
2824
|
const ce = pe;
|
|
2811
2825
|
function at(t) {
|
|
2812
2826
|
let e = Z;
|
|
2813
2827
|
try {
|
|
2814
|
-
Z = !0,
|
|
2828
|
+
Z = !0, le.storagemutated.fire(t);
|
|
2815
2829
|
} finally {
|
|
2816
2830
|
Z = e;
|
|
2817
2831
|
}
|
|
@@ -2819,17 +2833,17 @@ function at(t) {
|
|
|
2819
2833
|
Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) => new ce(t, { addons: [] }).open().then((e) => (e.close(), !0)).catch("NoSuchDatabaseError", () => !1), getDatabaseNames(t) {
|
|
2820
2834
|
try {
|
|
2821
2835
|
return function({ indexedDB: e, IDBKeyRange: n }) {
|
|
2822
|
-
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) :
|
|
2836
|
+
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) : ln(e, n).toCollection().primaryKeys();
|
|
2823
2837
|
}(ce.dependencies).then(t);
|
|
2824
2838
|
} catch {
|
|
2825
2839
|
return D(new E.MissingAPI());
|
|
2826
2840
|
}
|
|
2827
2841
|
}, defineClass: () => function(t) {
|
|
2828
2842
|
U(this, t);
|
|
2829
|
-
}, ignoreTransaction: (t) => P.trans ? Te(P.transless, t) : t(), vip:
|
|
2843
|
+
}, ignoreTransaction: (t) => P.trans ? Te(P.transless, t) : t(), vip: Gt, async: function(t) {
|
|
2830
2844
|
return function() {
|
|
2831
2845
|
try {
|
|
2832
|
-
var e =
|
|
2846
|
+
var e = Xt(t.apply(this, arguments));
|
|
2833
2847
|
return e && typeof e.then == "function" ? e : S.resolve(e);
|
|
2834
2848
|
} catch (n) {
|
|
2835
2849
|
return D(n);
|
|
@@ -2837,7 +2851,7 @@ Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2837
2851
|
};
|
|
2838
2852
|
}, spawn: function(t, e, n) {
|
|
2839
2853
|
try {
|
|
2840
|
-
var r =
|
|
2854
|
+
var r = Xt(t.apply(n, e || []));
|
|
2841
2855
|
return r && typeof r.then == "function" ? r : S.resolve(r);
|
|
2842
2856
|
} catch (s) {
|
|
2843
2857
|
return D(s);
|
|
@@ -2846,12 +2860,12 @@ Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2846
2860
|
const n = S.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
|
|
2847
2861
|
return P.trans ? P.trans.waitFor(n) : n;
|
|
2848
2862
|
}, Promise: S, debug: { get: () => G, set: (t) => {
|
|
2849
|
-
|
|
2850
|
-
} }, derive: ke, extend: U, props: Ce, override: Pn, Events:
|
|
2863
|
+
Rn(t, t === "dexie" ? () => !0 : zn);
|
|
2864
|
+
} }, derive: ke, extend: U, props: Ce, override: Pn, Events: je, on: le, liveQuery: Jr, extendObservabilitySet: tr, getByKeyPath: te, setByKeyPath: H, delByKeyPath: function(t, e) {
|
|
2851
2865
|
typeof e == "string" ? H(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
|
|
2852
2866
|
H(t, n, void 0);
|
|
2853
2867
|
});
|
|
2854
|
-
}, shallowClone: An, deepClone: We, getObjectDiff:
|
|
2868
|
+
}, shallowClone: An, deepClone: We, getObjectDiff: cn, cmp: L, asap: En, minKey: qt, addons: [], connections: Ke, errnames: nn, dependencies: Jt, semVer: yn, version: yn.split(".").map((t) => parseInt(t)).reduce((t, e, n) => t + e / Math.pow(10, 2 * n)) }), ce.maxKey = Ue(ce.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (le(Le, (t) => {
|
|
2855
2869
|
if (!Z) {
|
|
2856
2870
|
let e;
|
|
2857
2871
|
gt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(ie, !0, !0, t)) : e = new CustomEvent(ie, { detail: t }), Z = !0, dispatchEvent(e), Z = !1;
|
|
@@ -2862,13 +2876,13 @@ Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2862
2876
|
let Z = !1;
|
|
2863
2877
|
if (typeof BroadcastChannel < "u") {
|
|
2864
2878
|
const t = new BroadcastChannel(ie);
|
|
2865
|
-
typeof t.unref == "function" && t.unref(),
|
|
2879
|
+
typeof t.unref == "function" && t.unref(), le(Le, (e) => {
|
|
2866
2880
|
Z || t.postMessage(e);
|
|
2867
2881
|
}), t.onmessage = (e) => {
|
|
2868
2882
|
e.data && at(e.data);
|
|
2869
2883
|
};
|
|
2870
2884
|
} else if (typeof self < "u" && typeof navigator < "u") {
|
|
2871
|
-
|
|
2885
|
+
le(Le, (e) => {
|
|
2872
2886
|
try {
|
|
2873
2887
|
Z || (typeof localStorage < "u" && localStorage.setItem(ie, JSON.stringify({ trig: Math.random(), changedParts: e })), typeof self.clients == "object" && [...self.clients.matchAll({ includeUncontrolled: !0 })].forEach((n) => n.postMessage({ type: ie, changedParts: e })));
|
|
2874
2888
|
} catch {
|
|
@@ -2891,10 +2905,10 @@ S.rejectionMapper = function(t, e) {
|
|
|
2891
2905
|
return "stack" in t && ee(n, "stack", { get: function() {
|
|
2892
2906
|
return this.inner.stack;
|
|
2893
2907
|
} }), n;
|
|
2894
|
-
},
|
|
2908
|
+
}, Rn(G, zn);
|
|
2895
2909
|
class Zr extends pe {
|
|
2896
2910
|
constructor() {
|
|
2897
|
-
super("NylasAuthDatabase"),
|
|
2911
|
+
super("NylasAuthDatabase"), Et(this, "grant"), Et(this, "pkce"), this.version(1).stores({
|
|
2898
2912
|
grant: "++id,token",
|
|
2899
2913
|
pkce: "++id,codeVerifier"
|
|
2900
2914
|
}), this.grant = this.table("grant"), this.pkce = this.table("pkce");
|
|
@@ -2902,7 +2916,7 @@ class Zr extends pe {
|
|
|
2902
2916
|
}
|
|
2903
2917
|
class es {
|
|
2904
2918
|
constructor() {
|
|
2905
|
-
|
|
2919
|
+
Et(this, "theDB"), this.theDB = new Zr();
|
|
2906
2920
|
}
|
|
2907
2921
|
async setCodeVerifier(e) {
|
|
2908
2922
|
await this.theDB.pkce.put({ id: 1, codeVerifier: e }, 1);
|
|
@@ -2980,18 +2994,18 @@ function ss(t) {
|
|
|
2980
2994
|
value: "offline_access"
|
|
2981
2995
|
}
|
|
2982
2996
|
];
|
|
2983
|
-
async function i(o,
|
|
2984
|
-
const
|
|
2985
|
-
m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e),
|
|
2986
|
-
const
|
|
2987
|
-
method:
|
|
2997
|
+
async function i(o, l, a, c = !0, h, u) {
|
|
2998
|
+
const d = await (n == null ? void 0 : n.getTokenInfo()), p = new URL(o, h ?? t.apiUri), m = new Headers();
|
|
2999
|
+
m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e), d && m.append("Authorization", `Bearer ${d.access_token}`);
|
|
3000
|
+
const f = await fetch(p.toString(), {
|
|
3001
|
+
method: l || "GET",
|
|
2988
3002
|
headers: m,
|
|
2989
3003
|
mode: "cors",
|
|
2990
3004
|
referrer: location.origin,
|
|
2991
3005
|
body: a ? JSON.stringify(a) : void 0,
|
|
2992
|
-
...
|
|
3006
|
+
...u || {}
|
|
2993
3007
|
});
|
|
2994
|
-
return c ? await
|
|
3008
|
+
return c ? await f.json() : f.body;
|
|
2995
3009
|
}
|
|
2996
3010
|
return {
|
|
2997
3011
|
config: t,
|
|
@@ -3002,11 +3016,11 @@ function ss(t) {
|
|
|
3002
3016
|
* @param provider The provider that was used to generate the authorization code
|
|
3003
3017
|
* @returns A promise that resolves to a URL string that can be used to redirect the user to the Nylas API to complete the authorization flow
|
|
3004
3018
|
*/
|
|
3005
|
-
async getHostedAuthRedirectURL(o = t.defaultScopes,
|
|
3006
|
-
const c = await dn(Math.random().toString()),
|
|
3019
|
+
async getHostedAuthRedirectURL(o = t.defaultScopes, l, a) {
|
|
3020
|
+
const c = await dn(Math.random().toString()), h = await dn(c);
|
|
3007
3021
|
await (n == null ? void 0 : n.setCodeVerifier(c));
|
|
3008
|
-
const
|
|
3009
|
-
return
|
|
3022
|
+
const u = new URL(`${t.apiUri}/v3/connect/auth`);
|
|
3023
|
+
return u.searchParams.set("client_id", t.clientId), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", o.join(" ")), u.searchParams.set("redirect_uri", t.redirectURI), u.searchParams.set("access_type", "offline"), u.searchParams.set("code_challenge", h), u.searchParams.set("code_challenge_method", "S256"), u.searchParams.set("options", "rotate_refresh_token"), a && u.searchParams.set("provider", a), l && u.searchParams.set("login_hint", l), u.toString();
|
|
3010
3024
|
},
|
|
3011
3025
|
/**
|
|
3012
3026
|
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
@@ -3026,23 +3040,23 @@ function ss(t) {
|
|
|
3026
3040
|
async exchangeAuthCodeForTokenInfo(o) {
|
|
3027
3041
|
if (!o)
|
|
3028
3042
|
return null;
|
|
3029
|
-
const
|
|
3043
|
+
const l = await (n == null ? void 0 : n.getCodeVerifier()), a = await this.nylasAPIRequest("/v3/connect/token", "POST", {
|
|
3030
3044
|
code: o,
|
|
3031
3045
|
client_id: t.clientId,
|
|
3032
3046
|
grant_type: "authorization_code",
|
|
3033
3047
|
redirect_uri: t.redirectURI,
|
|
3034
|
-
code_verifier:
|
|
3048
|
+
code_verifier: l
|
|
3035
3049
|
});
|
|
3036
3050
|
return "error" in a || await (n == null ? void 0 : n.setTokenInfo(a)), a;
|
|
3037
3051
|
},
|
|
3038
3052
|
/**
|
|
3039
3053
|
* This method will make a `application/octet-stream` request to the Nylas API to download a file.
|
|
3040
3054
|
*/
|
|
3041
|
-
async nylasDownloadFileRequest(o,
|
|
3042
|
-
const c = await (n == null ? void 0 : n.getTokenInfo()),
|
|
3043
|
-
return
|
|
3044
|
-
method:
|
|
3045
|
-
headers:
|
|
3055
|
+
async nylasDownloadFileRequest(o, l = "GET", a) {
|
|
3056
|
+
const c = await (n == null ? void 0 : n.getTokenInfo()), h = new URL(o, t.apiUri), u = new Headers();
|
|
3057
|
+
return u.append("Accept", "application/json"), u.append("Content-Type", "application/octet-stream"), u.append("User-Agent", e), c && u.append("Authorization", `Bearer ${c.access_token}`), (await fetch(h.toString(), {
|
|
3058
|
+
method: l,
|
|
3059
|
+
headers: u,
|
|
3046
3060
|
mode: "cors",
|
|
3047
3061
|
referrer: location.origin,
|
|
3048
3062
|
body: a ? JSON.stringify(a) : void 0
|
|
@@ -3070,7 +3084,7 @@ function ss(t) {
|
|
|
3070
3084
|
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3071
3085
|
if (!o)
|
|
3072
3086
|
return null;
|
|
3073
|
-
const { access_token:
|
|
3087
|
+
const { access_token: l, ...a } = o;
|
|
3074
3088
|
return a;
|
|
3075
3089
|
},
|
|
3076
3090
|
/**
|
|
@@ -3089,26 +3103,26 @@ function ss(t) {
|
|
|
3089
3103
|
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3090
3104
|
if (!o)
|
|
3091
3105
|
return null;
|
|
3092
|
-
const
|
|
3106
|
+
const l = await this.nylasAPIRequest("/v3/connect/token", "POST", {
|
|
3093
3107
|
client_id: t.clientId,
|
|
3094
3108
|
grant_type: "refresh_token",
|
|
3095
3109
|
refresh_token: o.refresh_token
|
|
3096
3110
|
});
|
|
3097
|
-
return "error" in
|
|
3111
|
+
return "error" in l || await (n == null ? void 0 : n.setTokenInfo(l)), l;
|
|
3098
3112
|
},
|
|
3099
3113
|
/**
|
|
3100
3114
|
* This method will return true if the current access token has the given scope
|
|
3101
3115
|
* based on the type of scope (e.g. 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing')
|
|
3102
3116
|
* @param type Either 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing'
|
|
3103
3117
|
*/
|
|
3104
|
-
async hasScopeByType(o = "email",
|
|
3118
|
+
async hasScopeByType(o = "email", l) {
|
|
3105
3119
|
const a = await (n == null ? void 0 : n.getTokenInfo());
|
|
3106
3120
|
if (!a)
|
|
3107
3121
|
return !1;
|
|
3108
3122
|
const c = a.scope.toLowerCase().split(" ");
|
|
3109
|
-
let
|
|
3110
|
-
const
|
|
3111
|
-
return o === "email" && (
|
|
3123
|
+
let h = [];
|
|
3124
|
+
const u = Array.isArray(l) ? l : [l];
|
|
3125
|
+
return o === "email" && (h = [...s, ...r].filter((d) => u.includes(d.type))), h.every((d) => c.includes(d.value));
|
|
3112
3126
|
},
|
|
3113
3127
|
/**
|
|
3114
3128
|
* A helper method to check if the current access token has a given scope.
|
|
@@ -3116,10 +3130,10 @@ function ss(t) {
|
|
|
3116
3130
|
* @returns boolean indicating whether the current access token has the given scope
|
|
3117
3131
|
*/
|
|
3118
3132
|
async hasScope(o) {
|
|
3119
|
-
const
|
|
3120
|
-
if (!
|
|
3133
|
+
const l = await (n == null ? void 0 : n.getTokenInfo());
|
|
3134
|
+
if (!l)
|
|
3121
3135
|
return !1;
|
|
3122
|
-
const a =
|
|
3136
|
+
const a = l.scope.toLowerCase().split(" ");
|
|
3123
3137
|
return (Array.isArray(o) ? o : [o]).some((c) => a.includes(c.toLowerCase()));
|
|
3124
3138
|
}
|
|
3125
3139
|
};
|