@nylas/react 1.1.0-canary.3 → 1.1.0-canary.5
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_22.entry-da31fa71.js → add-circle-icon_22.entry-9f634efd.js} +90 -92
- package/dist/add-circle-icon_22.entry-e7ec6c34.cjs +1 -0
- package/dist/{archive-icon_7.entry-bc2418f7.js → archive-icon_7.entry-24bac466.js} +21 -21
- package/dist/{archive-icon_7.entry-7aad8104.cjs → archive-icon_7.entry-6649ed76.cjs} +1 -1
- package/dist/{arrow-icon.entry-6eba68a9.cjs → arrow-icon.entry-1fffd526.cjs} +1 -1
- package/dist/{arrow-icon.entry-9a932082.js → arrow-icon.entry-82e59ce4.js} +4 -4
- package/dist/{bold-icon_3.entry-db17d481.cjs → bold-icon_3.entry-5a01fecf.cjs} +1 -1
- package/dist/{bold-icon_3.entry-5f7e3755.js → bold-icon_3.entry-72e585da.js} +4 -4
- package/dist/{calendar-cancel-icon.entry-a5141f82.cjs → calendar-cancel-icon.entry-0b52bdc9.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-1ff7845a.js → calendar-cancel-icon.entry-247b530c.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-c3add652.cjs → calendar-check-icon_2.entry-d7bb76c7.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-d7421059.js → calendar-check-icon_2.entry-dbb2df49.js} +7 -7
- package/dist/{calendar-icon.entry-445d624a.cjs → calendar-icon.entry-911773c4.cjs} +1 -1
- package/dist/{calendar-icon.entry-4458997f.js → calendar-icon.entry-d64cb3d3.js} +2 -2
- package/dist/{chevron-icon_3.entry-8961e6bb.cjs → chevron-icon_3.entry-b72f4cdb.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-f7f3d487.js → chevron-icon_3.entry-db9f8217.js} +11 -11
- package/dist/close-icon.entry-9d141bb4.js +15 -0
- package/dist/close-icon.entry-da590fa2.cjs +1 -0
- package/dist/{constants-6ee60d6d-6c0540db.cjs → constants-6ee60d6d-09ee73d9.cjs} +1 -1
- package/dist/{constants-6ee60d6d-4cd16450.js → constants-6ee60d6d-d5928e79.js} +1 -1
- package/dist/document-refresh-icon.entry-5e8cc2f0.cjs +1 -0
- package/dist/{document-refresh-icon.entry-bdc323b5.js → document-refresh-icon.entry-ee9632d7.js} +5 -5
- package/dist/elements/index.d.ts +1 -0
- package/dist/{elements-dc5b338e-81a0319c.cjs → elements-dc5b338e-29ef67ec.cjs} +1 -1
- package/dist/{elements-dc5b338e-fb5dbfb5.js → elements-dc5b338e-e87f79b6.js} +1 -1
- package/dist/focus-visible-e8093c16-61d506d2.cjs +1 -0
- package/dist/{focus-visible-e8093c16-28fc08a0.js → focus-visible-e8093c16-e7357f74.js} +5 -3
- package/dist/forward-icon_6.entry-cac8473a.cjs +3 -0
- package/dist/{forward-icon_6.entry-62759373.js → forward-icon_6.entry-f054ad9d.js} +65 -67
- package/dist/{globe-icon.entry-9e082178.js → globe-icon.entry-2fde6ac4.js} +4 -4
- package/dist/{globe-icon.entry-c8302bf5.cjs → globe-icon.entry-bc484551.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-a9848399.cjs +1 -0
- package/dist/google-logo-icon_4.entry-dca87e45.js +349 -0
- package/dist/index-22f7e49c.cjs +37 -0
- package/dist/index-f9ba9aa8.js +3971 -0
- package/dist/{index.es-2578c6a5-71441142.js → index.es-f57e612a-1d17c676.js} +516 -512
- package/dist/{index.es-2578c6a5-098d48d0.cjs → index.es-f57e612a-95ca3e17.cjs} +5 -5
- package/dist/{info-icon_2.entry-73106882.js → info-icon_2.entry-dbf3931a.js} +7 -7
- package/dist/{info-icon_2.entry-ca224a3b.cjs → info-icon_2.entry-e67844eb.cjs} +1 -1
- package/dist/loading-icon.entry-4566cba8.cjs +1 -0
- package/dist/loading-icon.entry-ae4c2d7e.js +15 -0
- package/dist/{mailbox-store-bb21512c-615660ef.js → mailbox-store-47fc8a1a-2365f20f.js} +16 -17
- package/dist/mailbox-store-47fc8a1a-cd3516a7.cjs +1 -0
- package/dist/nylas-additional-participants.entry-7c568149.cjs +1 -0
- package/dist/{nylas-additional-participants.entry-db85836a.js → nylas-additional-participants.entry-e8426256.js} +12 -14
- package/dist/nylas-booked-event-card_10.entry-6a664889.cjs +1 -0
- package/dist/{nylas-booked-event-card_10.entry-b49b2369.js → nylas-booked-event-card_10.entry-ef767733.js} +8 -10
- package/dist/{nylas-form-card.entry-090a4d3b.js → nylas-form-card.entry-d8506b1f.js} +4 -6
- package/dist/nylas-form-card.entry-e44169b6.cjs +1 -0
- package/dist/nylas-if-state.entry-044c49d2.cjs +1 -0
- package/dist/{nylas-if-state.entry-7924dde0.js → nylas-if-state.entry-98a336df.js} +2 -4
- package/dist/nylas-list-folders.entry-509f9be4.cjs +1 -0
- package/dist/{nylas-list-folders.entry-9dd96530.js → nylas-list-folders.entry-55ce3403.js} +6 -8
- package/dist/{nylas-list-threads.entry-b435eaae.js → nylas-list-threads.entry-1f57382a.js} +5 -7
- package/dist/nylas-list-threads.entry-c36e2cf3.cjs +1 -0
- package/dist/nylas-login.entry-66f542b8.cjs +1 -0
- package/dist/{nylas-login.entry-97350c76.js → nylas-login.entry-76358c2f.js} +3 -5
- package/dist/{nylas-mailbox-pagination.entry-ceef8be2.js → nylas-mailbox-pagination.entry-5562257a.js} +7 -9
- package/dist/nylas-mailbox-pagination.entry-89b0dd99.cjs +1 -0
- package/dist/nylas-mailbox-toolbar-button.entry-573e0429.cjs +1 -0
- package/dist/{nylas-mailbox-toolbar-button.entry-e6b3d3a4.js → nylas-mailbox-toolbar-button.entry-6b1b5b15.js} +16 -18
- package/dist/{nylas-mailbox.entry-06d8014a.js → nylas-mailbox.entry-97c503f2.js} +7 -9
- package/dist/nylas-mailbox.entry-e21a2f50.cjs +1 -0
- package/dist/{nylas-provider.entry-8b9c2b69.js → nylas-provider.entry-07e1e26a.js} +10 -12
- package/dist/nylas-provider.entry-61899957.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-60fe38ce.cjs +7 -0
- package/dist/{nylas-scheduler-editor.entry-c3791787.js → nylas-scheduler-editor.entry-e326c9de.js} +333 -239
- package/dist/{nylas-scheduling.entry-6380509a.js → nylas-scheduling.entry-be0cc090.js} +6 -8
- package/dist/nylas-scheduling.entry-d88289db.cjs +1 -0
- package/dist/{nylas-threads-refresh.entry-eaee86fb.js → nylas-threads-refresh.entry-8201f8dd.js} +11 -13
- package/dist/nylas-threads-refresh.entry-c71ee775.cjs +1 -0
- package/dist/nylas-threads-search.entry-912a90a4.cjs +1 -0
- package/dist/{nylas-threads-search.entry-7e12758e.js → nylas-threads-search.entry-fc477e01.js} +18 -20
- package/dist/nylas-view-thread.entry-af418ddb.cjs +1 -0
- package/dist/{nylas-view-thread.entry-b936e76a.js → nylas-view-thread.entry-d2953ea8.js} +7 -9
- package/dist/{people-icon.entry-5c8ee696.js → people-icon.entry-4b598fde.js} +7 -7
- package/dist/{people-icon.entry-bcf848c0.cjs → people-icon.entry-73cfa6f5.cjs} +1 -1
- package/dist/play-icon_2.entry-1a487abb.cjs +1 -0
- package/dist/{play-icon_2.entry-356e63cc.js → play-icon_2.entry-d1c2f823.js} +5 -5
- package/dist/react.cjs +1 -1
- package/dist/react.js +68 -67
- package/dist/{refresh-icon.entry-bec053b6.cjs → refresh-icon.entry-42d543d0.cjs} +1 -1
- package/dist/{refresh-icon.entry-77f0c377.js → refresh-icon.entry-6aedfce6.js} +4 -4
- package/dist/register-component-cf5c8420-d3fb6bf9.cjs +1 -0
- package/dist/{register-component-dc659dc3-0fdb18dc.js → register-component-cf5c8420-dc1bc0a4.js} +37 -33
- package/dist/scheduler-config-store-6222c0ed-000f1a4f.js +18 -0
- package/dist/scheduler-config-store-6222c0ed-758621fb.cjs +1 -0
- package/dist/{scheduler-store-72116723-3ba2480c.js → scheduler-store-39d37291-4e8e9ff9.js} +5 -6
- package/dist/scheduler-store-39d37291-b66c052c.cjs +1 -0
- package/dist/{time-period-selector.entry-decd251b.js → time-period-selector.entry-f1e27a00.js} +6 -8
- package/dist/time-period-selector.entry-fb3d0178.cjs +1 -0
- package/dist/{translate-icon.entry-dd5b707c.cjs → translate-icon.entry-0d44b6cb.cjs} +1 -1
- package/dist/{translate-icon.entry-cac02c46.js → translate-icon.entry-3db947f5.js} +5 -5
- package/dist/{warning-icon.entry-8af8a742.cjs → warning-icon.entry-a20657e4.cjs} +1 -1
- package/dist/{warning-icon.entry-370b9cf0.js → warning-icon.entry-a8ea0fe0.js} +5 -5
- package/package.json +2 -2
- package/dist/_commonjsHelpers-57e89916-4a3ae7d8.cjs +0 -1
- package/dist/_commonjsHelpers-57e89916-af061c86.js +0 -19
- package/dist/add-circle-icon_22.entry-8d0ac489.cjs +0 -1
- package/dist/close-icon.entry-6dd5ff0a.js +0 -15
- package/dist/close-icon.entry-ebc527c5.cjs +0 -1
- package/dist/document-refresh-icon.entry-298b2133.cjs +0 -1
- package/dist/focus-visible-e8093c16-f380b705.cjs +0 -1
- package/dist/forward-icon_6.entry-15208ea9.cjs +0 -3
- package/dist/google-logo-icon_3.entry-0c095209.js +0 -258
- package/dist/google-logo-icon_3.entry-f8433ff9.cjs +0 -1
- package/dist/index-0f3bd8df.js +0 -1824
- package/dist/index-7a55dc33.cjs +0 -30
- package/dist/loading-icon.entry-012644b7.js +0 -15
- package/dist/loading-icon.entry-f9f5e66f.cjs +0 -1
- package/dist/mailbox-store-bb21512c-045c3ea0.cjs +0 -1
- package/dist/nylas-additional-participants.entry-a50ef8e2.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-fccb783c.cjs +0 -1
- package/dist/nylas-form-card.entry-f5230005.cjs +0 -1
- package/dist/nylas-if-state.entry-ff9c9a85.cjs +0 -1
- package/dist/nylas-list-folders.entry-dbfc2cf8.cjs +0 -1
- package/dist/nylas-list-threads.entry-6bcc0328.cjs +0 -1
- package/dist/nylas-login.entry-1623d309.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-1776eb16.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-7d3f79b9.cjs +0 -1
- package/dist/nylas-mailbox.entry-ae8da6ff.cjs +0 -1
- package/dist/nylas-provider.entry-97c9e272.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-f6cf1cd9.cjs +0 -7
- package/dist/nylas-scheduling.entry-08ae840a.cjs +0 -1
- package/dist/nylas-threads-refresh.entry-246e6d77.cjs +0 -1
- package/dist/nylas-threads-search.entry-42a2acb1.cjs +0 -1
- package/dist/nylas-view-thread.entry-78e6927a.cjs +0 -1
- package/dist/play-icon_2.entry-92e78f1b.cjs +0 -1
- package/dist/register-component-dc659dc3-f58bf25b.cjs +0 -1
- package/dist/scheduler-config-store-51ee4f42-ce3a9b0e.cjs +0 -1
- package/dist/scheduler-config-store-51ee4f42-e02895da.js +0 -14
- package/dist/scheduler-store-72116723-db9d91f6.cjs +0 -1
- package/dist/time-period-selector.entry-f25fad77.cjs +0 -1
- package/dist/utils-c00bdc3c-89ab163d.js +0 -2111
- package/dist/utils-c00bdc3c-94b9c3b6.cjs +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as T, u as nr,
|
|
1
|
+
import { d as T, u as nr, k as hn } from "./index-f9ba9aa8.js";
|
|
2
2
|
class rr {
|
|
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) => {
|
|
@@ -26,7 +26,8 @@ class rr {
|
|
|
26
26
|
stateToProps: s.stateToProps,
|
|
27
27
|
authToProp: s.authToProp,
|
|
28
28
|
eventToProps: s.eventToProps,
|
|
29
|
-
connectorToProp: s.connectorToProp
|
|
29
|
+
connectorToProp: s.connectorToProp,
|
|
30
|
+
localPropsToProp: s.localPropsToProp
|
|
30
31
|
};
|
|
31
32
|
this.registerComponent(i);
|
|
32
33
|
});
|
|
@@ -60,37 +61,40 @@ class rr {
|
|
|
60
61
|
T(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
const { stateToProps: r, getStoresToProp: s, eventToProps: i, storeToProps: o, connectorToProp: u,
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
const
|
|
69
|
-
T(`[${this.hostTagName}] Handling "${e.name}" prop "${String(
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
T(`[${this.hostTagName}] Adding event listener for "${
|
|
74
|
-
}), r == null || r.forEach((
|
|
75
|
-
var
|
|
76
|
-
const [
|
|
77
|
-
if (!
|
|
64
|
+
const { stateToProps: r, getStoresToProp: s, eventToProps: i, storeToProps: o, connectorToProp: u, localPropsToProp: a, element: c } = e;
|
|
65
|
+
c.dataset.nylasId = nr(), this.registeredComponents[c.dataset.nylasId] = e;
|
|
66
|
+
const d = this.eventOverrides;
|
|
67
|
+
i == null || i.forEach((l, h) => {
|
|
68
|
+
var y;
|
|
69
|
+
const f = this.nylasConnector, m = async (g) => {
|
|
70
|
+
T(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`, { event: g }), h in d && (T(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`), await d[h](g, f)), g.defaultPrevented || await l(g, f);
|
|
71
|
+
}, p = e.element.dataset.nylasId;
|
|
72
|
+
p && !this.eventListenerRegistrations.has(p) && this.eventListenerRegistrations.set(p, []), p && ((y = this.eventListenerRegistrations.get(p)) == null || y.push([c, h, m])), T(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);
|
|
73
|
+
const v = hn(h.toString());
|
|
74
|
+
T(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`), c.addEventListener(v, m);
|
|
75
|
+
}), r == null || r.forEach((l, h) => {
|
|
76
|
+
var y, g, b, k;
|
|
77
|
+
const [f, m] = h.split("."), v = this.getStore(f).state[m];
|
|
78
|
+
if (!c.dataset.nylasId) {
|
|
78
79
|
T(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`, { component: e });
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
this.propStateRegistrations.has(
|
|
82
|
-
elementId:
|
|
83
|
-
propKey:
|
|
84
|
-
}) : (g = this.propStateRegistrations.get(
|
|
82
|
+
this.propStateRegistrations.has(f) || this.propStateRegistrations.set(f, /* @__PURE__ */ new Map()), (y = this.propStateRegistrations.get(f)) != null && y.has(m) ? (k = (b = this.propStateRegistrations.get(f)) == null ? void 0 : b.get(m)) == null || k.push({
|
|
83
|
+
elementId: c.dataset.nylasId,
|
|
84
|
+
propKey: l
|
|
85
|
+
}) : (g = this.propStateRegistrations.get(f)) == null || g.set(m, [
|
|
85
86
|
{
|
|
86
|
-
elementId:
|
|
87
|
-
propKey:
|
|
87
|
+
elementId: c.dataset.nylasId,
|
|
88
|
+
propKey: l
|
|
88
89
|
}
|
|
89
|
-
]),
|
|
90
|
-
}),
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
}),
|
|
90
|
+
]), c[l.toString()] = v, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`, { stateValue: v });
|
|
91
|
+
}), a == null || a.forEach((l, h) => {
|
|
92
|
+
const f = this.host[h];
|
|
93
|
+
c[l.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`, { value: h, mappedPropValue: f });
|
|
94
|
+
}), s && (c[s == null ? void 0 : s.toString()] = this.getStore, T(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)), o == null || o.forEach((l, h) => {
|
|
95
|
+
const f = this.getStore(h);
|
|
96
|
+
c[l.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`, { store: f });
|
|
97
|
+
}), u && (c[u == null ? void 0 : u.toString()] = this.nylasConnector, T(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`, { connectorToProp: u })), T(`[${this.hostTagName}] Component ${e.name} registered.`);
|
|
94
98
|
}
|
|
95
99
|
unregisterComponent(e) {
|
|
96
100
|
T(`[${this.hostTagName}] Unregistering component ${e.name}.`);
|
|
@@ -105,8 +109,8 @@ class rr {
|
|
|
105
109
|
}
|
|
106
110
|
this.propStateRegistrations.forEach((s, i) => {
|
|
107
111
|
s.forEach((o, u) => {
|
|
108
|
-
var
|
|
109
|
-
const a = (
|
|
112
|
+
var d, l;
|
|
113
|
+
const a = (d = this.propStateRegistrations.get(i)) == null ? void 0 : d.get(u), c = a == null ? void 0 : a.filter((h) => h.elementId !== n);
|
|
110
114
|
c && ((l = this.propStateRegistrations.get(i)) == null || l.set(u, c));
|
|
111
115
|
});
|
|
112
116
|
});
|
|
@@ -141,14 +145,14 @@ class rr {
|
|
|
141
145
|
T(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`, {
|
|
142
146
|
props: a,
|
|
143
147
|
propStateRegistrations: e.propStateRegistrations
|
|
144
|
-
}), a.forEach(({ elementId:
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
147
|
-
T(`[${e.hostTagName}] Component "${
|
|
148
|
+
}), a.forEach(({ elementId: d, propKey: l }) => {
|
|
149
|
+
const h = u[d];
|
|
150
|
+
if (!h) {
|
|
151
|
+
T(`[${e.hostTagName}] Component "${d}" not found. Skipping.`, { component: h });
|
|
148
152
|
return;
|
|
149
153
|
}
|
|
150
154
|
const m = e.getStore(n).state[s];
|
|
151
|
-
|
|
155
|
+
h.element[l.toString()] = m, T(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`, { stateValue: m });
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
});
|
|
@@ -173,9 +177,9 @@ async function dn(t) {
|
|
|
173
177
|
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("");
|
|
174
178
|
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
175
179
|
}
|
|
176
|
-
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : sr,
|
|
180
|
+
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : sr, $ = Object.keys, M = Array.isArray;
|
|
177
181
|
function U(t, e) {
|
|
178
|
-
return typeof e != "object" ||
|
|
182
|
+
return typeof e != "object" || $(e).forEach(function(n) {
|
|
179
183
|
t[n] = e[n];
|
|
180
184
|
}), t;
|
|
181
185
|
}
|
|
@@ -184,18 +188,18 @@ const Be = Object.getPrototypeOf, ur = {}.hasOwnProperty;
|
|
|
184
188
|
function z(t, e) {
|
|
185
189
|
return ur.call(t, e);
|
|
186
190
|
}
|
|
187
|
-
function
|
|
188
|
-
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ?
|
|
191
|
+
function Pe(t, e) {
|
|
192
|
+
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ? $ : Reflect.ownKeys)(e).forEach((n) => {
|
|
189
193
|
ee(t, n, e[n]);
|
|
190
194
|
});
|
|
191
195
|
}
|
|
192
|
-
const
|
|
196
|
+
const Pn = Object.defineProperty;
|
|
193
197
|
function ee(t, e, n, r) {
|
|
194
|
-
|
|
198
|
+
Pn(t, e, U(n && z(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
195
199
|
}
|
|
196
200
|
function ke(t) {
|
|
197
201
|
return { from: function(e) {
|
|
198
|
-
return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend:
|
|
202
|
+
return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend: Pe.bind(null, t.prototype) };
|
|
199
203
|
} };
|
|
200
204
|
}
|
|
201
205
|
const lr = Object.getOwnPropertyDescriptor;
|
|
@@ -207,7 +211,7 @@ const cr = [].slice;
|
|
|
207
211
|
function lt(t, e, n) {
|
|
208
212
|
return cr.call(t, e, n);
|
|
209
213
|
}
|
|
210
|
-
function
|
|
214
|
+
function En(t, e) {
|
|
211
215
|
return e(t);
|
|
212
216
|
}
|
|
213
217
|
function Ie(t) {
|
|
@@ -340,7 +344,7 @@ function Kn(t, e) {
|
|
|
340
344
|
}
|
|
341
345
|
var jn = () => !0;
|
|
342
346
|
const mr = !new Error("").stack;
|
|
343
|
-
function
|
|
347
|
+
function Ee() {
|
|
344
348
|
if (mr)
|
|
345
349
|
try {
|
|
346
350
|
throw new Error();
|
|
@@ -356,19 +360,19 @@ function Ot(t, e) {
|
|
|
356
360
|
`).slice(e).filter(jn).map((r) => `
|
|
357
361
|
` + r).join("")) : "";
|
|
358
362
|
}
|
|
359
|
-
var Rn = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], en = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Rn),
|
|
363
|
+
var Rn = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], en = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Rn), 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" };
|
|
360
364
|
function xe(t, e) {
|
|
361
|
-
this._e =
|
|
365
|
+
this._e = Ee(), this.name = t, this.message = e;
|
|
362
366
|
}
|
|
363
367
|
function Nn(t, e) {
|
|
364
368
|
return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
|
|
365
369
|
`);
|
|
366
370
|
}
|
|
367
371
|
function ct(t, e, n, r) {
|
|
368
|
-
this._e =
|
|
372
|
+
this._e = Ee(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = Nn(t, e);
|
|
369
373
|
}
|
|
370
374
|
function je(t, e) {
|
|
371
|
-
this._e =
|
|
375
|
+
this._e = Ee(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = Nn(t, e);
|
|
372
376
|
}
|
|
373
377
|
ke(xe).from(Error).extend({ stack: { get: function() {
|
|
374
378
|
return this._stack || (this._stack = this.name + ": " + this.message + Ot(this._e, 2));
|
|
@@ -376,14 +380,14 @@ ke(xe).from(Error).extend({ stack: { get: function() {
|
|
|
376
380
|
return this.name + ": " + this.message;
|
|
377
381
|
} }), ke(ct).from(xe), ke(je).from(xe);
|
|
378
382
|
var tn = en.reduce((t, e) => (t[e] = e + "Error", t), {});
|
|
379
|
-
const
|
|
383
|
+
const yr = xe;
|
|
380
384
|
var C = en.reduce((t, e) => {
|
|
381
385
|
var n = e + "Error";
|
|
382
386
|
function r(s, i) {
|
|
383
|
-
this._e =
|
|
384
|
-
` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message =
|
|
387
|
+
this._e = Ee(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
|
|
388
|
+
` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message = gr[e] || n, this.inner = null);
|
|
385
389
|
}
|
|
386
|
-
return ke(r).from(
|
|
390
|
+
return ke(r).from(yr), t[e] = r, t;
|
|
387
391
|
}, {});
|
|
388
392
|
C.Syntax = SyntaxError, C.Type = TypeError, C.Range = RangeError;
|
|
389
393
|
var fn = Rn.reduce((t, e) => (t[e + "Error"] = C[e], t), {}), tt = en.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = C[e]), t), {});
|
|
@@ -449,13 +453,13 @@ function nn(t, e) {
|
|
|
449
453
|
}
|
|
450
454
|
tt.ModifyError = ct, tt.DexieError = xe, tt.BulkError = je;
|
|
451
455
|
var Me = {};
|
|
452
|
-
const
|
|
456
|
+
const $n = 100, [It, ht, Kt] = typeof Promise > "u" ? [] : (() => {
|
|
453
457
|
let t = Promise.resolve();
|
|
454
458
|
if (typeof crypto > "u" || !crypto.subtle)
|
|
455
459
|
return [t, Be(t), t];
|
|
456
460
|
const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
457
461
|
return [e, Be(e), t];
|
|
458
|
-
})(),
|
|
462
|
+
})(), Dn = ht && ht.then, nt = It && It.constructor, rn = !!Kt;
|
|
459
463
|
var jt = !1, xr = Kt ? () => {
|
|
460
464
|
Kt.then(Ye);
|
|
461
465
|
} : K.setImmediate ? setImmediate.bind(null, Ye) : K.MutationObserver ? () => {
|
|
@@ -467,30 +471,30 @@ var jt = !1, xr = Kt ? () => {
|
|
|
467
471
|
setTimeout(Ye, 0);
|
|
468
472
|
}, Re = function(t, e) {
|
|
469
473
|
Ke.push([t, e]), dt && (xr(), dt = !1);
|
|
470
|
-
}, Rt = !0, dt = !0, de = [], rt = [], Nt = null,
|
|
474
|
+
}, Rt = !0, dt = !0, de = [], rt = [], Nt = null, $t = Fe, Se = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: gn, pgp: !1, env: {}, finalize: function() {
|
|
471
475
|
this.unhandleds.forEach((t) => {
|
|
472
476
|
try {
|
|
473
|
-
|
|
477
|
+
gn(t[0], t[1]);
|
|
474
478
|
} catch {
|
|
475
479
|
}
|
|
476
480
|
});
|
|
477
|
-
} },
|
|
481
|
+
} }, E = Se, Ke = [], fe = 0, st = [];
|
|
478
482
|
function S(t) {
|
|
479
483
|
if (typeof this != "object")
|
|
480
484
|
throw new TypeError("Promises must be constructed via new");
|
|
481
485
|
this._listeners = [], this.onuncatched = I, this._lib = !1;
|
|
482
|
-
var e = this._PSD =
|
|
483
|
-
if (G && (this._stackHolder =
|
|
486
|
+
var e = this._PSD = E;
|
|
487
|
+
if (G && (this._stackHolder = Ee(), this._prev = null, this._numPrev = 0), typeof t != "function") {
|
|
484
488
|
if (t !== Me)
|
|
485
489
|
throw new TypeError("Not a function");
|
|
486
490
|
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Bt(this, this._value));
|
|
487
491
|
}
|
|
488
492
|
this._state = null, this._value = null, ++e.ref, Fn(this, t);
|
|
489
493
|
}
|
|
490
|
-
const
|
|
491
|
-
var t =
|
|
494
|
+
const Dt = { get: function() {
|
|
495
|
+
var t = E, e = ft;
|
|
492
496
|
function n(r, s) {
|
|
493
|
-
var i = !t.global && (t !==
|
|
497
|
+
var i = !t.global && (t !== E || e !== ft);
|
|
494
498
|
const o = i && !ne();
|
|
495
499
|
var u = new S((a, c) => {
|
|
496
500
|
sn(this, new Bn(pt(r, t, i, o), pt(s, t, i, o), a, c, t));
|
|
@@ -499,9 +503,9 @@ const $t = { get: function() {
|
|
|
499
503
|
}
|
|
500
504
|
return n.prototype = Me, n;
|
|
501
505
|
}, set: function(t) {
|
|
502
|
-
ee(this, "then", t && t.prototype === Me ?
|
|
506
|
+
ee(this, "then", t && t.prototype === Me ? Dt : { get: function() {
|
|
503
507
|
return t;
|
|
504
|
-
}, set:
|
|
508
|
+
}, set: Dt.set });
|
|
505
509
|
} };
|
|
506
510
|
function Bn(t, e, n, r, s) {
|
|
507
511
|
this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
|
|
@@ -525,7 +529,7 @@ function Fn(t, e) {
|
|
|
525
529
|
function Bt(t, e) {
|
|
526
530
|
if (rt.push(e), t._state === null) {
|
|
527
531
|
var n = t._lib && ze();
|
|
528
|
-
e =
|
|
532
|
+
e = $t(e), t._state = !1, t._value = e, G && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
|
|
529
533
|
try {
|
|
530
534
|
r.apply(null, i);
|
|
531
535
|
} catch (o) {
|
|
@@ -617,9 +621,9 @@ function Ge(t) {
|
|
|
617
621
|
return new S(Me, !1, t);
|
|
618
622
|
}
|
|
619
623
|
function j(t, e) {
|
|
620
|
-
var n =
|
|
624
|
+
var n = E;
|
|
621
625
|
return function() {
|
|
622
|
-
var r = ze(), s =
|
|
626
|
+
var r = ze(), s = E;
|
|
623
627
|
try {
|
|
624
628
|
return ae(n, !0), t.apply(this, arguments);
|
|
625
629
|
} catch (i) {
|
|
@@ -629,8 +633,8 @@ function j(t, e) {
|
|
|
629
633
|
}
|
|
630
634
|
};
|
|
631
635
|
}
|
|
632
|
-
|
|
633
|
-
sn(this, new Bn(null, null, t, e,
|
|
636
|
+
Pe(S.prototype, { then: Dt, _then: function(t, e) {
|
|
637
|
+
sn(this, new Bn(null, null, t, e, E));
|
|
634
638
|
}, catch: function(t) {
|
|
635
639
|
if (arguments.length === 1)
|
|
636
640
|
return this.then(null, t);
|
|
@@ -654,7 +658,7 @@ From previous: `);
|
|
|
654
658
|
var s = setTimeout(() => r(new C.Timeout(e)), t);
|
|
655
659
|
this.then(n, r).finally(clearTimeout.bind(null, s));
|
|
656
660
|
}) : this;
|
|
657
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"), Se.env = Un(),
|
|
661
|
+
} }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"), Se.env = Un(), Pe(S, { all: function() {
|
|
658
662
|
var t = J.apply(null, arguments).map(Xe);
|
|
659
663
|
return new S(function(e, n) {
|
|
660
664
|
t.length === 0 && e([]);
|
|
@@ -677,12 +681,12 @@ From previous: `);
|
|
|
677
681
|
return new S((e, n) => {
|
|
678
682
|
t.map((r) => S.resolve(r).then(e, n));
|
|
679
683
|
});
|
|
680
|
-
}, PSD: { get: () =>
|
|
684
|
+
}, PSD: { get: () => E, set: (t) => E = t }, totalEchoes: { get: () => ft }, newPSD: oe, usePSD: Te, scheduler: { get: () => Re, set: (t) => {
|
|
681
685
|
Re = t;
|
|
682
|
-
} }, rejectionMapper: { get: () =>
|
|
683
|
-
|
|
686
|
+
} }, rejectionMapper: { get: () => $t, set: (t) => {
|
|
687
|
+
$t = t;
|
|
684
688
|
} }, follow: (t, e) => new S((n, r) => oe((s, i) => {
|
|
685
|
-
var o =
|
|
689
|
+
var o = E;
|
|
686
690
|
o.unhandleds = [], o.onunhandled = i, o.finalize = me(function() {
|
|
687
691
|
(function(u) {
|
|
688
692
|
function a() {
|
|
@@ -715,10 +719,10 @@ From previous: `);
|
|
|
715
719
|
});
|
|
716
720
|
}));
|
|
717
721
|
const F = { awaits: 0, echoes: 0, id: 0 };
|
|
718
|
-
var
|
|
722
|
+
var Pr = 0, it = [], wt = 0, ft = 0, Er = 0;
|
|
719
723
|
function oe(t, e, n, r) {
|
|
720
|
-
var s =
|
|
721
|
-
i.parent = s, i.ref = 0, i.global = !1, i.id = ++
|
|
724
|
+
var s = E, i = Object.create(s);
|
|
725
|
+
i.parent = s, i.ref = 0, i.global = !1, i.id = ++Er;
|
|
722
726
|
var o = Se.env;
|
|
723
727
|
i.env = rn ? { 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() {
|
|
724
728
|
--this.parent.ref || this.parent.finalize();
|
|
@@ -727,24 +731,24 @@ function oe(t, e, n, r) {
|
|
|
727
731
|
return i.ref === 0 && i.finalize(), u;
|
|
728
732
|
}
|
|
729
733
|
function Ce() {
|
|
730
|
-
return F.id || (F.id = ++
|
|
734
|
+
return F.id || (F.id = ++Pr), ++F.awaits, F.echoes += $n, F.id;
|
|
731
735
|
}
|
|
732
736
|
function ne() {
|
|
733
|
-
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits *
|
|
737
|
+
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * $n, !0);
|
|
734
738
|
}
|
|
735
739
|
function Xe(t) {
|
|
736
|
-
return F.echoes && t && t.constructor === nt ? (Ce(), t.then((e) => (ne(), e), (e) => (ne(),
|
|
740
|
+
return F.echoes && t && t.constructor === nt ? (Ce(), t.then((e) => (ne(), e), (e) => (ne(), D(e)))) : t;
|
|
737
741
|
}
|
|
738
742
|
function Cr(t) {
|
|
739
|
-
++ft, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(
|
|
743
|
+
++ft, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(E), ae(t, !0);
|
|
740
744
|
}
|
|
741
745
|
function Tr() {
|
|
742
746
|
var t = it[it.length - 1];
|
|
743
747
|
it.pop(), ae(t, !1);
|
|
744
748
|
}
|
|
745
749
|
function ae(t, e) {
|
|
746
|
-
var n =
|
|
747
|
-
if ((e ? !F.echoes || wt++ && t ===
|
|
750
|
+
var n = E;
|
|
751
|
+
if ((e ? !F.echoes || wt++ && t === E : !wt || --wt && t === E) || Vn(e ? Cr.bind(null, t) : Tr), t !== E && (E = t, n === Se && (Se.env = Un()), rn)) {
|
|
748
752
|
var r = Se.env.Promise, s = t.env;
|
|
749
753
|
ht.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(K, "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));
|
|
750
754
|
}
|
|
@@ -754,7 +758,7 @@ function Un() {
|
|
|
754
758
|
return rn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor(K, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: ht.then, gthen: t.prototype.then } : {};
|
|
755
759
|
}
|
|
756
760
|
function Te(t, e, n, r, s) {
|
|
757
|
-
var i =
|
|
761
|
+
var i = E;
|
|
758
762
|
try {
|
|
759
763
|
return ae(t, !0), e(n, r, s);
|
|
760
764
|
} finally {
|
|
@@ -762,11 +766,11 @@ function Te(t, e, n, r, s) {
|
|
|
762
766
|
}
|
|
763
767
|
}
|
|
764
768
|
function Vn(t) {
|
|
765
|
-
|
|
769
|
+
Dn.call(It, t);
|
|
766
770
|
}
|
|
767
771
|
function pt(t, e, n, r) {
|
|
768
772
|
return typeof t != "function" ? t : function() {
|
|
769
|
-
var s =
|
|
773
|
+
var s = E;
|
|
770
774
|
n && Ce(), ae(e, !0);
|
|
771
775
|
try {
|
|
772
776
|
return t.apply(this, arguments);
|
|
@@ -780,9 +784,9 @@ function pn(t, e) {
|
|
|
780
784
|
return t.call(this, pt(n, e), pt(r, e));
|
|
781
785
|
};
|
|
782
786
|
}
|
|
783
|
-
("" +
|
|
787
|
+
("" + Dn).indexOf("[native code]") === -1 && (Ce = ne = I);
|
|
784
788
|
const mn = "unhandledrejection";
|
|
785
|
-
function
|
|
789
|
+
function gn(t, e) {
|
|
786
790
|
var n;
|
|
787
791
|
try {
|
|
788
792
|
n = e.onuncatched(t);
|
|
@@ -800,28 +804,28 @@ function yn(t, e) {
|
|
|
800
804
|
} catch {
|
|
801
805
|
}
|
|
802
806
|
}
|
|
803
|
-
var
|
|
807
|
+
var D = S.reject;
|
|
804
808
|
function Ft(t, e, n, r) {
|
|
805
|
-
if (t.idbdb && (t._state.openComplete ||
|
|
809
|
+
if (t.idbdb && (t._state.openComplete || E.letThrough || t._vip)) {
|
|
806
810
|
var s = t._createTransaction(e, n, t._dbSchema);
|
|
807
811
|
try {
|
|
808
812
|
s.create(), t._state.PR1398_maxLoop = 3;
|
|
809
813
|
} catch (i) {
|
|
810
|
-
return i.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) :
|
|
814
|
+
return i.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) : D(i);
|
|
811
815
|
}
|
|
812
|
-
return s._promise(e, (i, o) => oe(() => (
|
|
816
|
+
return s._promise(e, (i, o) => oe(() => (E.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
|
|
813
817
|
}
|
|
814
818
|
if (t._state.openComplete)
|
|
815
|
-
return
|
|
819
|
+
return D(new C.DatabaseClosed(t._state.dbOpenError));
|
|
816
820
|
if (!t._state.isBeingOpened) {
|
|
817
821
|
if (!t._options.autoOpen)
|
|
818
|
-
return
|
|
822
|
+
return D(new C.DatabaseClosed());
|
|
819
823
|
t.open().catch(I);
|
|
820
824
|
}
|
|
821
825
|
return t._state.dbReadyPromise.then(() => Ft(t, e, n, r));
|
|
822
826
|
}
|
|
823
|
-
const
|
|
824
|
-
function
|
|
827
|
+
const yn = "3.2.4", he = String.fromCharCode(65535), Mt = -1 / 0, X = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Wn = "String expected.", Ne = [], yt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Ar = yt, Or = yt, zn = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), vt = "__dbnames", _t = "readonly", kt = "readwrite";
|
|
828
|
+
function ge(t, e) {
|
|
825
829
|
return t ? e ? function() {
|
|
826
830
|
return t.apply(this, arguments) && e.apply(this, arguments);
|
|
827
831
|
} : t : e;
|
|
@@ -832,15 +836,15 @@ function Qe(t) {
|
|
|
832
836
|
}
|
|
833
837
|
class Ir {
|
|
834
838
|
_trans(e, n, r) {
|
|
835
|
-
const s = this._tx ||
|
|
836
|
-
function o(a, c,
|
|
837
|
-
if (!
|
|
839
|
+
const s = this._tx || E.trans, i = this.name;
|
|
840
|
+
function o(a, c, d) {
|
|
841
|
+
if (!d.schema[i])
|
|
838
842
|
throw new C.NotFound("Table " + i + " not part of transaction");
|
|
839
|
-
return n(
|
|
843
|
+
return n(d.idbtrans, d);
|
|
840
844
|
}
|
|
841
845
|
const u = ze();
|
|
842
846
|
try {
|
|
843
|
-
return s && s.db === this.db ? s ===
|
|
847
|
+
return s && s.db === this.db ? s === E.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: E.transless || E }) : Ft(this.db, e, [this.name], o);
|
|
844
848
|
} finally {
|
|
845
849
|
u && He();
|
|
846
850
|
}
|
|
@@ -853,27 +857,27 @@ class Ir {
|
|
|
853
857
|
return new this.db.WhereClause(this, e);
|
|
854
858
|
if (M(e))
|
|
855
859
|
return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
856
|
-
const n =
|
|
860
|
+
const n = $(e);
|
|
857
861
|
if (n.length === 1)
|
|
858
862
|
return this.where(n[0]).equals(e[n[0]]);
|
|
859
|
-
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((
|
|
863
|
+
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((d) => c.keyPath.indexOf(d) >= 0) && c.keyPath.every((d) => n.indexOf(d) >= 0))[0];
|
|
860
864
|
if (r && this.db._maxKey !== he)
|
|
861
865
|
return this.where(r.name).equals(r.keyPath.map((c) => e[c]));
|
|
862
866
|
!r && G && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);
|
|
863
867
|
const { idxByName: s } = this.schema, i = this.db._deps.indexedDB;
|
|
864
|
-
function o(c,
|
|
868
|
+
function o(c, d) {
|
|
865
869
|
try {
|
|
866
|
-
return i.cmp(c,
|
|
870
|
+
return i.cmp(c, d) === 0;
|
|
867
871
|
} catch {
|
|
868
872
|
return !1;
|
|
869
873
|
}
|
|
870
874
|
}
|
|
871
|
-
const [u, a] = n.reduce(([c,
|
|
872
|
-
const
|
|
873
|
-
return [c ||
|
|
875
|
+
const [u, a] = n.reduce(([c, d], l) => {
|
|
876
|
+
const h = s[l], f = e[l];
|
|
877
|
+
return [c || h, c || !h ? ge(d, h && h.multi ? (m) => {
|
|
874
878
|
const p = te(m, l);
|
|
875
879
|
return M(p) && p.some((v) => o(f, v));
|
|
876
|
-
} : (m) => o(f, te(m, l))) :
|
|
880
|
+
} : (m) => o(f, te(m, l))) : d];
|
|
877
881
|
}, [null, null]);
|
|
878
882
|
return u ? this.where(u.name).equals(e[u.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
|
|
879
883
|
}
|
|
@@ -943,9 +947,9 @@ class Ir {
|
|
|
943
947
|
{
|
|
944
948
|
const r = te(e, this.schema.primKey.keyPath);
|
|
945
949
|
if (r === void 0)
|
|
946
|
-
return
|
|
950
|
+
return D(new C.InvalidArgument("Given object does not contain its primary key"));
|
|
947
951
|
try {
|
|
948
|
-
typeof n != "function" ?
|
|
952
|
+
typeof n != "function" ? $(n).forEach((s) => {
|
|
949
953
|
H(e, s, n[s]);
|
|
950
954
|
}) : n(e, { value: e, primKey: r });
|
|
951
955
|
} catch {
|
|
@@ -983,10 +987,10 @@ class Ir {
|
|
|
983
987
|
if (s && s.length !== e.length)
|
|
984
988
|
throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
985
989
|
const c = e.length;
|
|
986
|
-
let
|
|
987
|
-
return this.core.mutate({ trans: o, type: "add", keys: s, values:
|
|
990
|
+
let d = a && u ? e.map(Qe(a)) : e;
|
|
991
|
+
return this.core.mutate({ trans: o, type: "add", keys: s, values: d, wantResults: i }).then(({ numFailures: l, results: h, lastResult: f, failures: m }) => {
|
|
988
992
|
if (l === 0)
|
|
989
|
-
return i ?
|
|
993
|
+
return i ? h : f;
|
|
990
994
|
throw new je(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`, m);
|
|
991
995
|
});
|
|
992
996
|
});
|
|
@@ -1000,10 +1004,10 @@ class Ir {
|
|
|
1000
1004
|
if (s && s.length !== e.length)
|
|
1001
1005
|
throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1002
1006
|
const c = e.length;
|
|
1003
|
-
let
|
|
1004
|
-
return this.core.mutate({ trans: o, type: "put", keys: s, values:
|
|
1007
|
+
let d = a && u ? e.map(Qe(a)) : e;
|
|
1008
|
+
return this.core.mutate({ trans: o, type: "put", keys: s, values: d, wantResults: i }).then(({ numFailures: l, results: h, lastResult: f, failures: m }) => {
|
|
1005
1009
|
if (l === 0)
|
|
1006
|
-
return i ?
|
|
1010
|
+
return i ? h : f;
|
|
1007
1011
|
throw new je(`${this.name}.bulkPut(): ${l} of ${c} operations failed`, m);
|
|
1008
1012
|
});
|
|
1009
1013
|
});
|
|
@@ -1017,7 +1021,7 @@ class Ir {
|
|
|
1017
1021
|
});
|
|
1018
1022
|
}
|
|
1019
1023
|
}
|
|
1020
|
-
function
|
|
1024
|
+
function $e(t) {
|
|
1021
1025
|
var e = {}, n = function(o, u) {
|
|
1022
1026
|
if (u) {
|
|
1023
1027
|
for (var a = arguments.length, c = new Array(a - 1); --a; )
|
|
@@ -1035,21 +1039,21 @@ function De(t) {
|
|
|
1035
1039
|
if (typeof o != "object") {
|
|
1036
1040
|
var c;
|
|
1037
1041
|
u || (u = kr), a || (a = I);
|
|
1038
|
-
var
|
|
1039
|
-
|
|
1042
|
+
var d = { subscribers: [], fire: a, subscribe: function(l) {
|
|
1043
|
+
d.subscribers.indexOf(l) === -1 && (d.subscribers.push(l), d.fire = u(d.fire, l));
|
|
1040
1044
|
}, unsubscribe: function(l) {
|
|
1041
|
-
|
|
1042
|
-
return
|
|
1043
|
-
}),
|
|
1045
|
+
d.subscribers = d.subscribers.filter(function(h) {
|
|
1046
|
+
return h !== l;
|
|
1047
|
+
}), d.fire = d.subscribers.reduce(u, a);
|
|
1044
1048
|
} };
|
|
1045
|
-
return e[o] = n[o] =
|
|
1049
|
+
return e[o] = n[o] = d, d;
|
|
1046
1050
|
}
|
|
1047
|
-
|
|
1048
|
-
var
|
|
1049
|
-
if (M(
|
|
1051
|
+
$(c = o).forEach(function(l) {
|
|
1052
|
+
var h = c[l];
|
|
1053
|
+
if (M(h))
|
|
1050
1054
|
i(l, c[l][0], c[l][1]);
|
|
1051
1055
|
else {
|
|
1052
|
-
if (
|
|
1056
|
+
if (h !== "asap")
|
|
1053
1057
|
throw new C.InvalidArgument("Invalid event config");
|
|
1054
1058
|
var f = i(l, Fe, function() {
|
|
1055
1059
|
for (var m = arguments.length, p = new Array(m); m--; )
|
|
@@ -1071,11 +1075,11 @@ function be(t, e) {
|
|
|
1071
1075
|
return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
|
|
1072
1076
|
}
|
|
1073
1077
|
function xt(t, e) {
|
|
1074
|
-
t.filter =
|
|
1078
|
+
t.filter = ge(t.filter, e);
|
|
1075
1079
|
}
|
|
1076
1080
|
function St(t, e, n) {
|
|
1077
1081
|
var r = t.replayFilter;
|
|
1078
|
-
t.replayFilter = r ? () =>
|
|
1082
|
+
t.replayFilter = r ? () => ge(r(), e()) : e, t.justLimit = n && !r;
|
|
1079
1083
|
}
|
|
1080
1084
|
function ot(t, e) {
|
|
1081
1085
|
if (t.isPrimKey)
|
|
@@ -1090,17 +1094,17 @@ function vn(t, e, n) {
|
|
|
1090
1094
|
return e.openCursor({ trans: n, values: !t.keysOnly, reverse: t.dir === "prev", unique: !!t.unique, query: { index: r, range: t.range } });
|
|
1091
1095
|
}
|
|
1092
1096
|
function Je(t, e, n, r) {
|
|
1093
|
-
const s = t.replayFilter ?
|
|
1097
|
+
const s = t.replayFilter ? ge(t.filter, t.replayFilter()) : t.filter;
|
|
1094
1098
|
if (t.or) {
|
|
1095
1099
|
const i = {}, o = (u, a, c) => {
|
|
1096
|
-
if (!s || s(a, c, (
|
|
1097
|
-
var
|
|
1098
|
-
l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(
|
|
1100
|
+
if (!s || s(a, c, (h) => a.stop(h), (h) => a.fail(h))) {
|
|
1101
|
+
var d = a.primaryKey, l = "" + d;
|
|
1102
|
+
l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(d)), z(i, l) || (i[l] = !0, e(u, a, c));
|
|
1099
1103
|
}
|
|
1100
1104
|
};
|
|
1101
1105
|
return Promise.all([t.or._iterate(o, n), bn(vn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
|
|
1102
1106
|
}
|
|
1103
|
-
return bn(vn(t, r, n),
|
|
1107
|
+
return bn(vn(t, r, n), ge(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
|
|
1104
1108
|
}
|
|
1105
1109
|
function bn(t, e, n, r) {
|
|
1106
1110
|
var s = j(r ? (i, o, u) => n(r(i), o, u) : n);
|
|
@@ -1138,9 +1142,9 @@ function L(t, e) {
|
|
|
1138
1142
|
return function(s, i) {
|
|
1139
1143
|
const o = s.length, u = i.length, a = o < u ? o : u;
|
|
1140
1144
|
for (let c = 0; c < a; ++c) {
|
|
1141
|
-
const
|
|
1142
|
-
if (
|
|
1143
|
-
return
|
|
1145
|
+
const d = L(s[c], i[c]);
|
|
1146
|
+
if (d !== 0)
|
|
1147
|
+
return d;
|
|
1144
1148
|
}
|
|
1145
1149
|
return o === u ? 0 : o < u ? -1 : 1;
|
|
1146
1150
|
}(t, e);
|
|
@@ -1164,15 +1168,15 @@ function _n(t) {
|
|
|
1164
1168
|
class Kr {
|
|
1165
1169
|
_read(e, n) {
|
|
1166
1170
|
var r = this._ctx;
|
|
1167
|
-
return r.error ? r.table._trans(null,
|
|
1171
|
+
return r.error ? r.table._trans(null, D.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
|
|
1168
1172
|
}
|
|
1169
1173
|
_write(e) {
|
|
1170
1174
|
var n = this._ctx;
|
|
1171
|
-
return n.error ? n.table._trans(null,
|
|
1175
|
+
return n.error ? n.table._trans(null, D.bind(null, n.error)) : n.table._trans("readwrite", e, "locked");
|
|
1172
1176
|
}
|
|
1173
1177
|
_addAlgorithm(e) {
|
|
1174
1178
|
var n = this._ctx;
|
|
1175
|
-
n.algorithm =
|
|
1179
|
+
n.algorithm = ge(n.algorithm, e);
|
|
1176
1180
|
}
|
|
1177
1181
|
_iterate(e, n) {
|
|
1178
1182
|
return Je(this._ctx, e, n, this._ctx.table.core);
|
|
@@ -1199,13 +1203,13 @@ class Kr {
|
|
|
1199
1203
|
}
|
|
1200
1204
|
sortBy(e, n) {
|
|
1201
1205
|
const r = e.split(".").reverse(), s = r[0], i = r.length - 1;
|
|
1202
|
-
function o(c,
|
|
1203
|
-
return
|
|
1206
|
+
function o(c, d) {
|
|
1207
|
+
return d ? o(c[r[d]], d - 1) : c[s];
|
|
1204
1208
|
}
|
|
1205
1209
|
var u = this._ctx.dir === "next" ? 1 : -1;
|
|
1206
|
-
function a(c,
|
|
1207
|
-
var l = o(c, i),
|
|
1208
|
-
return l <
|
|
1210
|
+
function a(c, d) {
|
|
1211
|
+
var l = o(c, i), h = o(d, i);
|
|
1212
|
+
return l < h ? -u : l > h ? u : 0;
|
|
1209
1213
|
}
|
|
1210
1214
|
return this.toArray(function(c) {
|
|
1211
1215
|
return c.sort(a);
|
|
@@ -1261,7 +1265,7 @@ class Kr {
|
|
|
1261
1265
|
var n, r;
|
|
1262
1266
|
return xt(this._ctx, function(s) {
|
|
1263
1267
|
return e(s.value);
|
|
1264
|
-
}), n = this._ctx, r = e, n.isMatch =
|
|
1268
|
+
}), n = this._ctx, r = e, n.isMatch = ge(n.isMatch, r), this;
|
|
1265
1269
|
}
|
|
1266
1270
|
and(e) {
|
|
1267
1271
|
return this.filter(e);
|
|
@@ -1343,43 +1347,43 @@ class Kr {
|
|
|
1343
1347
|
if (typeof e == "function")
|
|
1344
1348
|
s = e;
|
|
1345
1349
|
else {
|
|
1346
|
-
var i =
|
|
1350
|
+
var i = $(e), o = i.length;
|
|
1347
1351
|
s = function(p) {
|
|
1348
|
-
for (var v = !1,
|
|
1349
|
-
var
|
|
1350
|
-
te(p,
|
|
1352
|
+
for (var v = !1, y = 0; y < o; ++y) {
|
|
1353
|
+
var g = i[y], b = e[g];
|
|
1354
|
+
te(p, g) !== b && (H(p, g, b), v = !0);
|
|
1351
1355
|
}
|
|
1352
1356
|
return v;
|
|
1353
1357
|
};
|
|
1354
1358
|
}
|
|
1355
|
-
const u = n.table.core, { outbound: a, extractKey: c } = u.schema.primaryKey,
|
|
1356
|
-
let
|
|
1359
|
+
const u = n.table.core, { outbound: a, extractKey: c } = u.schema.primaryKey, d = this.db._options.modifyChunkSize || 200, l = [];
|
|
1360
|
+
let h = 0;
|
|
1357
1361
|
const f = [], m = (p, v) => {
|
|
1358
|
-
const { failures:
|
|
1359
|
-
|
|
1360
|
-
for (let b of
|
|
1361
|
-
l.push(
|
|
1362
|
+
const { failures: y, numFailures: g } = v;
|
|
1363
|
+
h += p - g;
|
|
1364
|
+
for (let b of $(y))
|
|
1365
|
+
l.push(y[b]);
|
|
1362
1366
|
};
|
|
1363
1367
|
return this.clone().primaryKeys().then((p) => {
|
|
1364
|
-
const v = (
|
|
1365
|
-
const
|
|
1366
|
-
return u.getMany({ trans: r, keys: p.slice(
|
|
1367
|
-
const
|
|
1368
|
-
for (let _ = 0; _ <
|
|
1369
|
-
const R = b[_], O = { value: We(R), primKey: p[
|
|
1370
|
-
s.call(O, O.value, O) !== !1 && (O.value == null ? w.push(p[
|
|
1368
|
+
const v = (y) => {
|
|
1369
|
+
const g = Math.min(d, p.length - y);
|
|
1370
|
+
return u.getMany({ trans: r, keys: p.slice(y, y + g), cache: "immutable" }).then((b) => {
|
|
1371
|
+
const k = [], P = [], x = a ? [] : null, w = [];
|
|
1372
|
+
for (let _ = 0; _ < g; ++_) {
|
|
1373
|
+
const R = b[_], O = { value: We(R), primKey: p[y + _] };
|
|
1374
|
+
s.call(O, O.value, O) !== !1 && (O.value == null ? w.push(p[y + _]) : a || L(c(R), c(O.value)) === 0 ? (P.push(O.value), a && x.push(p[y + _])) : (w.push(p[y + _]), k.push(O.value)));
|
|
1371
1375
|
}
|
|
1372
|
-
const A = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e ===
|
|
1373
|
-
return Promise.resolve(
|
|
1376
|
+
const A = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e === Pt) && { index: n.index, range: n.range };
|
|
1377
|
+
return Promise.resolve(k.length > 0 && u.mutate({ trans: r, type: "add", values: k }).then((_) => {
|
|
1374
1378
|
for (let R in _.failures)
|
|
1375
1379
|
w.splice(parseInt(R), 1);
|
|
1376
|
-
m(
|
|
1377
|
-
})).then(() => (
|
|
1380
|
+
m(k.length, _);
|
|
1381
|
+
})).then(() => (P.length > 0 || A && typeof e == "object") && u.mutate({ trans: r, type: "put", keys: x, values: P, criteria: A, changeSpec: typeof e != "function" && e }).then((_) => m(P.length, _))).then(() => (w.length > 0 || A && e === Pt) && u.mutate({ trans: r, type: "delete", keys: w, criteria: A }).then((_) => m(w.length, _))).then(() => p.length > y + g && v(y + d));
|
|
1378
1382
|
});
|
|
1379
1383
|
};
|
|
1380
1384
|
return v(0).then(() => {
|
|
1381
1385
|
if (l.length > 0)
|
|
1382
|
-
throw new ct("Error modifying one or more objects", l,
|
|
1386
|
+
throw new ct("Error modifying one or more objects", l, h, f);
|
|
1383
1387
|
return p.length;
|
|
1384
1388
|
});
|
|
1385
1389
|
});
|
|
@@ -1389,15 +1393,15 @@ class Kr {
|
|
|
1389
1393
|
var e = this._ctx, n = e.range;
|
|
1390
1394
|
return be(e) && (e.isPrimKey && !Or || n.type === 3) ? this._write((r) => {
|
|
1391
1395
|
const { primaryKey: s } = e.table.core.schema, i = n;
|
|
1392
|
-
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: u, lastResult: a, results: c, numFailures:
|
|
1393
|
-
if (
|
|
1394
|
-
throw new ct("Could not delete some values", Object.keys(u).map((l) => u[l]), o -
|
|
1395
|
-
return o -
|
|
1396
|
+
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: u, lastResult: a, results: c, numFailures: d }) => {
|
|
1397
|
+
if (d)
|
|
1398
|
+
throw new ct("Could not delete some values", Object.keys(u).map((l) => u[l]), o - d);
|
|
1399
|
+
return o - d;
|
|
1396
1400
|
}));
|
|
1397
|
-
}) : this.modify(
|
|
1401
|
+
}) : this.modify(Pt);
|
|
1398
1402
|
}
|
|
1399
1403
|
}
|
|
1400
|
-
const
|
|
1404
|
+
const Pt = (t, e) => e.value = null;
|
|
1401
1405
|
function jr(t, e) {
|
|
1402
1406
|
return t < e ? -1 : t === e ? 0 : 1;
|
|
1403
1407
|
}
|
|
@@ -1421,46 +1425,46 @@ function Nr(t, e, n, r, s, i) {
|
|
|
1421
1425
|
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : u < 0 ? null : t.substr(0, u) + r[u] + n.substr(u + 1);
|
|
1422
1426
|
}
|
|
1423
1427
|
function Ze(t, e, n, r) {
|
|
1424
|
-
var s, i, o, u, a, c,
|
|
1428
|
+
var s, i, o, u, a, c, d, l = n.length;
|
|
1425
1429
|
if (!n.every((p) => typeof p == "string"))
|
|
1426
1430
|
return W(t, Wn);
|
|
1427
|
-
function
|
|
1428
|
-
s = function(
|
|
1429
|
-
return
|
|
1430
|
-
}(p), i = function(
|
|
1431
|
-
return
|
|
1431
|
+
function h(p) {
|
|
1432
|
+
s = function(y) {
|
|
1433
|
+
return y === "next" ? (g) => g.toUpperCase() : (g) => g.toLowerCase();
|
|
1434
|
+
}(p), i = function(y) {
|
|
1435
|
+
return y === "next" ? (g) => g.toLowerCase() : (g) => g.toUpperCase();
|
|
1432
1436
|
}(p), o = p === "next" ? jr : Rr;
|
|
1433
|
-
var v = n.map(function(
|
|
1434
|
-
return { lower: i(
|
|
1435
|
-
}).sort(function(
|
|
1436
|
-
return o(
|
|
1437
|
+
var v = n.map(function(y) {
|
|
1438
|
+
return { lower: i(y), upper: s(y) };
|
|
1439
|
+
}).sort(function(y, g) {
|
|
1440
|
+
return o(y.lower, g.lower);
|
|
1437
1441
|
});
|
|
1438
|
-
u = v.map(function(
|
|
1439
|
-
return
|
|
1440
|
-
}), a = v.map(function(
|
|
1441
|
-
return
|
|
1442
|
-
}), c = p,
|
|
1442
|
+
u = v.map(function(y) {
|
|
1443
|
+
return y.upper;
|
|
1444
|
+
}), a = v.map(function(y) {
|
|
1445
|
+
return y.lower;
|
|
1446
|
+
}), c = p, d = p === "next" ? "" : r;
|
|
1443
1447
|
}
|
|
1444
|
-
|
|
1448
|
+
h("next");
|
|
1445
1449
|
var f = new t.Collection(t, () => re(u[0], a[l - 1] + r));
|
|
1446
1450
|
f._ondirectionchange = function(p) {
|
|
1447
|
-
|
|
1451
|
+
h(p);
|
|
1448
1452
|
};
|
|
1449
1453
|
var m = 0;
|
|
1450
|
-
return f._addAlgorithm(function(p, v,
|
|
1451
|
-
var
|
|
1452
|
-
if (typeof
|
|
1454
|
+
return f._addAlgorithm(function(p, v, y) {
|
|
1455
|
+
var g = p.key;
|
|
1456
|
+
if (typeof g != "string")
|
|
1453
1457
|
return !1;
|
|
1454
|
-
var b = i(
|
|
1458
|
+
var b = i(g);
|
|
1455
1459
|
if (e(b, a, m))
|
|
1456
1460
|
return !0;
|
|
1457
|
-
for (var
|
|
1458
|
-
var
|
|
1459
|
-
|
|
1461
|
+
for (var k = null, P = m; P < l; ++P) {
|
|
1462
|
+
var x = Nr(g, b, u[P], a[P], o, c);
|
|
1463
|
+
x === null && k === null ? m = P + 1 : (k === null || o(k, x) > 0) && (k = x);
|
|
1460
1464
|
}
|
|
1461
|
-
return v(
|
|
1462
|
-
p.continue(
|
|
1463
|
-
} :
|
|
1465
|
+
return v(k !== null ? function() {
|
|
1466
|
+
p.continue(k + d);
|
|
1467
|
+
} : y), !1;
|
|
1464
1468
|
}), f;
|
|
1465
1469
|
}
|
|
1466
1470
|
function re(t, e, n, r) {
|
|
@@ -1557,44 +1561,44 @@ class Gn {
|
|
|
1557
1561
|
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, u = this._max;
|
|
1558
1562
|
if (e.length === 0)
|
|
1559
1563
|
return we(this);
|
|
1560
|
-
if (!e.every((
|
|
1564
|
+
if (!e.every((g) => g[0] !== void 0 && g[1] !== void 0 && s(g[0], g[1]) <= 0))
|
|
1561
1565
|
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", C.InvalidArgument);
|
|
1562
1566
|
const a = !n || n.includeLowers !== !1, c = n && n.includeUppers === !0;
|
|
1563
|
-
let
|
|
1564
|
-
function
|
|
1565
|
-
return l(
|
|
1567
|
+
let d, l = s;
|
|
1568
|
+
function h(g, b) {
|
|
1569
|
+
return l(g[0], b[0]);
|
|
1566
1570
|
}
|
|
1567
1571
|
try {
|
|
1568
|
-
|
|
1569
|
-
let
|
|
1570
|
-
for (;
|
|
1571
|
-
const
|
|
1572
|
-
if (r(b[0],
|
|
1573
|
-
|
|
1572
|
+
d = e.reduce(function(g, b) {
|
|
1573
|
+
let k = 0, P = g.length;
|
|
1574
|
+
for (; k < P; ++k) {
|
|
1575
|
+
const x = g[k];
|
|
1576
|
+
if (r(b[0], x[1]) < 0 && r(b[1], x[0]) > 0) {
|
|
1577
|
+
x[0] = o(x[0], b[0]), x[1] = u(x[1], b[1]);
|
|
1574
1578
|
break;
|
|
1575
1579
|
}
|
|
1576
1580
|
}
|
|
1577
|
-
return
|
|
1578
|
-
}, []),
|
|
1581
|
+
return k === P && g.push(b), g;
|
|
1582
|
+
}, []), d.sort(h);
|
|
1579
1583
|
} catch {
|
|
1580
1584
|
return W(this, X);
|
|
1581
1585
|
}
|
|
1582
1586
|
let f = 0;
|
|
1583
|
-
const m = c ? (
|
|
1587
|
+
const m = c ? (g) => s(g, d[f][1]) > 0 : (g) => s(g, d[f][1]) >= 0, p = a ? (g) => i(g, d[f][0]) > 0 : (g) => i(g, d[f][0]) >= 0;
|
|
1584
1588
|
let v = m;
|
|
1585
|
-
const
|
|
1586
|
-
return
|
|
1587
|
-
|
|
1588
|
-
},
|
|
1589
|
-
for (var
|
|
1590
|
-
if (++f, f ===
|
|
1591
|
-
return b(
|
|
1592
|
-
return !!function(
|
|
1593
|
-
return !m(
|
|
1594
|
-
}(
|
|
1595
|
-
l === s ?
|
|
1589
|
+
const y = new this.Collection(this, () => re(d[0][0], d[d.length - 1][1], !a, !c));
|
|
1590
|
+
return y._ondirectionchange = (g) => {
|
|
1591
|
+
g === "next" ? (v = m, l = s) : (v = p, l = i), d.sort(h);
|
|
1592
|
+
}, y._addAlgorithm((g, b, k) => {
|
|
1593
|
+
for (var P = g.key; v(P); )
|
|
1594
|
+
if (++f, f === d.length)
|
|
1595
|
+
return b(k), !1;
|
|
1596
|
+
return !!function(x) {
|
|
1597
|
+
return !m(x) && !p(x);
|
|
1598
|
+
}(P) || (this._cmp(P, d[f][1]) === 0 || this._cmp(P, d[f][0]) === 0 || b(() => {
|
|
1599
|
+
l === s ? g.continue(d[f][0]) : g.continue(d[f][1]);
|
|
1596
1600
|
}), !1);
|
|
1597
|
-
}),
|
|
1601
|
+
}), y;
|
|
1598
1602
|
}
|
|
1599
1603
|
startsWithAnyOf() {
|
|
1600
1604
|
const e = J.apply(_e, arguments);
|
|
@@ -1609,14 +1613,14 @@ function Y(t) {
|
|
|
1609
1613
|
function qe(t) {
|
|
1610
1614
|
t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
|
|
1611
1615
|
}
|
|
1612
|
-
const Le = "storagemutated", ie = "x-storagemutated-1", ue =
|
|
1613
|
-
class
|
|
1616
|
+
const Le = "storagemutated", ie = "x-storagemutated-1", ue = $e(null, Le);
|
|
1617
|
+
class $r {
|
|
1614
1618
|
_lock() {
|
|
1615
|
-
return Ie(!
|
|
1619
|
+
return Ie(!E.global), ++this._reculock, this._reculock !== 1 || E.global || (E.lockOwnerFor = this), this;
|
|
1616
1620
|
}
|
|
1617
1621
|
_unlock() {
|
|
1618
|
-
if (Ie(!
|
|
1619
|
-
for (
|
|
1622
|
+
if (Ie(!E.global), --this._reculock == 0)
|
|
1623
|
+
for (E.global || (E.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
|
|
1620
1624
|
var e = this._blockedFuncs.shift();
|
|
1621
1625
|
try {
|
|
1622
1626
|
Te(e[1], e[0]);
|
|
@@ -1626,7 +1630,7 @@ class Dr {
|
|
|
1626
1630
|
return this;
|
|
1627
1631
|
}
|
|
1628
1632
|
_locked() {
|
|
1629
|
-
return this._reculock &&
|
|
1633
|
+
return this._reculock && E.lockOwnerFor !== this;
|
|
1630
1634
|
}
|
|
1631
1635
|
create(e) {
|
|
1632
1636
|
if (!this.mode)
|
|
@@ -1653,14 +1657,14 @@ class Dr {
|
|
|
1653
1657
|
}
|
|
1654
1658
|
_promise(e, n, r) {
|
|
1655
1659
|
if (e === "readwrite" && this.mode !== "readwrite")
|
|
1656
|
-
return
|
|
1660
|
+
return D(new C.ReadOnly("Transaction is readonly"));
|
|
1657
1661
|
if (!this.active)
|
|
1658
|
-
return
|
|
1662
|
+
return D(new C.TransactionInactive());
|
|
1659
1663
|
if (this._locked())
|
|
1660
1664
|
return new S((i, o) => {
|
|
1661
1665
|
this._blockedFuncs.push([() => {
|
|
1662
1666
|
this._promise(e, n, r).then(i, o);
|
|
1663
|
-
},
|
|
1667
|
+
}, E]);
|
|
1664
1668
|
});
|
|
1665
1669
|
if (r)
|
|
1666
1670
|
return oe(() => {
|
|
@@ -1740,8 +1744,8 @@ function Lt(t) {
|
|
|
1740
1744
|
function kn(t) {
|
|
1741
1745
|
return [].slice.call(t);
|
|
1742
1746
|
}
|
|
1743
|
-
let
|
|
1744
|
-
function
|
|
1747
|
+
let Dr = 0;
|
|
1748
|
+
function De(t) {
|
|
1745
1749
|
return t == null ? ":id" : typeof t == "string" ? t : `[${t.join("+")}]`;
|
|
1746
1750
|
}
|
|
1747
1751
|
function Br(t, e, n) {
|
|
@@ -1750,78 +1754,78 @@ function Br(t, e, n) {
|
|
|
1750
1754
|
return null;
|
|
1751
1755
|
if (a.type === 4)
|
|
1752
1756
|
throw new Error("Cannot convert never type to IDBKeyRange");
|
|
1753
|
-
const { lower: c, upper:
|
|
1754
|
-
return c === void 0 ?
|
|
1757
|
+
const { lower: c, upper: d, lowerOpen: l, upperOpen: h } = a;
|
|
1758
|
+
return c === void 0 ? d === void 0 ? null : e.upperBound(d, !!h) : d === void 0 ? e.lowerBound(c, !!l) : e.bound(c, d, !!l, !!h);
|
|
1755
1759
|
}
|
|
1756
1760
|
const { schema: s, hasGetAll: i } = function(a, c) {
|
|
1757
|
-
const
|
|
1758
|
-
return { schema: { name: a.name, tables:
|
|
1759
|
-
const { keyPath:
|
|
1760
|
-
const { name: b, unique:
|
|
1761
|
-
return v[
|
|
1762
|
-
}), getIndexByKeyPath: (
|
|
1763
|
-
return v[":id"] =
|
|
1764
|
-
}) }, hasGetAll:
|
|
1761
|
+
const d = kn(a.objectStoreNames);
|
|
1762
|
+
return { schema: { name: a.name, tables: d.map((l) => c.objectStore(l)).map((l) => {
|
|
1763
|
+
const { keyPath: h, autoIncrement: f } = l, m = M(h), p = h == null, v = {}, y = { name: l.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: p, compound: m, keyPath: h, autoIncrement: f, unique: !0, extractKey: Lt(h) }, indexes: kn(l.indexNames).map((g) => l.index(g)).map((g) => {
|
|
1764
|
+
const { name: b, unique: k, multiEntry: P, keyPath: x } = g, w = { name: b, compound: M(x), keyPath: x, unique: k, multiEntry: P, extractKey: Lt(x) };
|
|
1765
|
+
return v[De(x)] = w, w;
|
|
1766
|
+
}), getIndexByKeyPath: (g) => v[De(g)] };
|
|
1767
|
+
return v[":id"] = y.primaryKey, h != null && (v[De(h)] = y.primaryKey), y;
|
|
1768
|
+
}) }, hasGetAll: d.length > 0 && "getAll" in c.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
|
|
1765
1769
|
}(t, n), o = s.tables.map((a) => function(c) {
|
|
1766
|
-
const
|
|
1767
|
-
return { name:
|
|
1768
|
-
return new Promise((v,
|
|
1770
|
+
const d = c.name;
|
|
1771
|
+
return { name: d, schema: c, mutate: function({ trans: l, type: h, keys: f, values: m, range: p }) {
|
|
1772
|
+
return new Promise((v, y) => {
|
|
1769
1773
|
v = j(v);
|
|
1770
|
-
const
|
|
1771
|
-
if (!
|
|
1772
|
-
throw new Error("Invalid operation type: " +
|
|
1773
|
-
const { length:
|
|
1774
|
+
const g = l.objectStore(d), b = g.keyPath == null, k = h === "put" || h === "add";
|
|
1775
|
+
if (!k && h !== "delete" && h !== "deleteRange")
|
|
1776
|
+
throw new Error("Invalid operation type: " + h);
|
|
1777
|
+
const { length: P } = f || m || { length: 1 };
|
|
1774
1778
|
if (f && m && f.length !== m.length)
|
|
1775
1779
|
throw new Error("Given keys array must have same length as given values array.");
|
|
1776
|
-
if (
|
|
1780
|
+
if (P === 0)
|
|
1777
1781
|
return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
1778
|
-
let
|
|
1782
|
+
let x;
|
|
1779
1783
|
const w = [], A = [];
|
|
1780
1784
|
let _ = 0;
|
|
1781
1785
|
const R = (q) => {
|
|
1782
1786
|
++_, qe(q);
|
|
1783
1787
|
};
|
|
1784
|
-
if (
|
|
1788
|
+
if (h === "deleteRange") {
|
|
1785
1789
|
if (p.type === 4)
|
|
1786
1790
|
return v({ numFailures: _, failures: A, results: [], lastResult: void 0 });
|
|
1787
|
-
p.type === 3 ? w.push(
|
|
1791
|
+
p.type === 3 ? w.push(x = g.clear()) : w.push(x = g.delete(r(p)));
|
|
1788
1792
|
} else {
|
|
1789
|
-
const [q, B] =
|
|
1790
|
-
if (
|
|
1791
|
-
for (let N = 0; N <
|
|
1792
|
-
w.push(
|
|
1793
|
+
const [q, B] = k ? b ? [m, f] : [m, null] : [f, null];
|
|
1794
|
+
if (k)
|
|
1795
|
+
for (let N = 0; N < P; ++N)
|
|
1796
|
+
w.push(x = B && B[N] !== void 0 ? g[h](q[N], B[N]) : g[h](q[N])), x.onerror = R;
|
|
1793
1797
|
else
|
|
1794
|
-
for (let N = 0; N <
|
|
1795
|
-
w.push(
|
|
1798
|
+
for (let N = 0; N < P; ++N)
|
|
1799
|
+
w.push(x = g[h](q[N])), x.onerror = R;
|
|
1796
1800
|
}
|
|
1797
1801
|
const O = (q) => {
|
|
1798
1802
|
const B = q.target.result;
|
|
1799
|
-
w.forEach((N,
|
|
1803
|
+
w.forEach((N, ye) => N.error != null && (A[ye] = N.error)), v({ numFailures: _, failures: A, results: h === "delete" ? f : w.map((N) => N.result), lastResult: B });
|
|
1800
1804
|
};
|
|
1801
|
-
|
|
1805
|
+
x.onerror = (q) => {
|
|
1802
1806
|
R(q), O(q);
|
|
1803
|
-
},
|
|
1807
|
+
}, x.onsuccess = O;
|
|
1804
1808
|
});
|
|
1805
|
-
}, getMany: ({ trans: l, keys:
|
|
1809
|
+
}, getMany: ({ trans: l, keys: h }) => new Promise((f, m) => {
|
|
1806
1810
|
f = j(f);
|
|
1807
|
-
const p = l.objectStore(
|
|
1808
|
-
let
|
|
1809
|
-
const
|
|
1811
|
+
const p = l.objectStore(d), v = h.length, y = new Array(v);
|
|
1812
|
+
let g, b = 0, k = 0;
|
|
1813
|
+
const P = (w) => {
|
|
1810
1814
|
const A = w.target;
|
|
1811
|
-
|
|
1812
|
-
},
|
|
1815
|
+
y[A._pos] = A.result, ++k === b && f(y);
|
|
1816
|
+
}, x = Y(m);
|
|
1813
1817
|
for (let w = 0; w < v; ++w)
|
|
1814
|
-
|
|
1815
|
-
b === 0 && f(
|
|
1816
|
-
}), get: ({ trans: l, key:
|
|
1818
|
+
h[w] != null && (g = p.get(h[w]), g._pos = w, g.onsuccess = P, g.onerror = x, ++b);
|
|
1819
|
+
b === 0 && f(y);
|
|
1820
|
+
}), get: ({ trans: l, key: h }) => new Promise((f, m) => {
|
|
1817
1821
|
f = j(f);
|
|
1818
|
-
const p = l.objectStore(
|
|
1822
|
+
const p = l.objectStore(d).get(h);
|
|
1819
1823
|
p.onsuccess = (v) => f(v.target.result), p.onerror = Y(m);
|
|
1820
1824
|
}), query: function(l) {
|
|
1821
|
-
return (
|
|
1825
|
+
return (h) => new Promise((f, m) => {
|
|
1822
1826
|
f = j(f);
|
|
1823
|
-
const { trans: p, values: v, limit:
|
|
1824
|
-
if (
|
|
1827
|
+
const { trans: p, values: v, limit: y, query: g } = h, b = y === 1 / 0 ? void 0 : y, { index: k, range: P } = g, x = p.objectStore(d), w = k.isPrimaryKey ? x : x.index(k.name), A = r(P);
|
|
1828
|
+
if (y === 0)
|
|
1825
1829
|
return f({ result: [] });
|
|
1826
1830
|
if (l) {
|
|
1827
1831
|
const _ = v ? w.getAll(A, b) : w.getAllKeys(A, b);
|
|
@@ -1831,19 +1835,19 @@ function Br(t, e, n) {
|
|
|
1831
1835
|
const R = v || !("openKeyCursor" in w) ? w.openCursor(A) : w.openKeyCursor(A), O = [];
|
|
1832
1836
|
R.onsuccess = (q) => {
|
|
1833
1837
|
const B = R.result;
|
|
1834
|
-
return B ? (O.push(v ? B.value : B.primaryKey), ++_ ===
|
|
1838
|
+
return B ? (O.push(v ? B.value : B.primaryKey), ++_ === y ? f({ result: O }) : void B.continue()) : f({ result: O });
|
|
1835
1839
|
}, R.onerror = Y(m);
|
|
1836
1840
|
}
|
|
1837
1841
|
});
|
|
1838
|
-
}(i), openCursor: function({ trans: l, values:
|
|
1839
|
-
return new Promise((v,
|
|
1842
|
+
}(i), openCursor: function({ trans: l, values: h, query: f, reverse: m, unique: p }) {
|
|
1843
|
+
return new Promise((v, y) => {
|
|
1840
1844
|
v = j(v);
|
|
1841
|
-
const { index:
|
|
1842
|
-
w.onerror = Y(
|
|
1845
|
+
const { index: g, range: b } = f, k = l.objectStore(d), P = g.isPrimaryKey ? k : k.index(g.name), x = m ? p ? "prevunique" : "prev" : p ? "nextunique" : "next", w = h || !("openKeyCursor" in P) ? P.openCursor(r(b), x) : P.openKeyCursor(r(b), x);
|
|
1846
|
+
w.onerror = Y(y), w.onsuccess = j((A) => {
|
|
1843
1847
|
const _ = w.result;
|
|
1844
1848
|
if (!_)
|
|
1845
1849
|
return void v(null);
|
|
1846
|
-
_.___id =
|
|
1850
|
+
_.___id = ++Dr, _.done = !1;
|
|
1847
1851
|
const R = _.continue.bind(_);
|
|
1848
1852
|
let O = _.continuePrimaryKey;
|
|
1849
1853
|
O && (O = O.bind(_));
|
|
@@ -1852,11 +1856,11 @@ function Br(t, e, n) {
|
|
|
1852
1856
|
};
|
|
1853
1857
|
_.trans = l, _.stop = _.continue = _.continuePrimaryKey = _.advance = () => {
|
|
1854
1858
|
throw new Error("Cursor not started");
|
|
1855
|
-
}, _.fail = j(
|
|
1859
|
+
}, _.fail = j(y), _.next = function() {
|
|
1856
1860
|
let N = 1;
|
|
1857
1861
|
return this.start(() => N-- ? this.continue() : this.stop()).then(() => this);
|
|
1858
1862
|
}, _.start = (N) => {
|
|
1859
|
-
const
|
|
1863
|
+
const ye = new Promise((V, le) => {
|
|
1860
1864
|
V = j(V), w.onerror = Y(le), _.fail = le, _.stop = (Ae) => {
|
|
1861
1865
|
_.stop = _.continue = _.continuePrimaryKey = _.advance = B, V(Ae);
|
|
1862
1866
|
};
|
|
@@ -1874,15 +1878,15 @@ function Br(t, e, n) {
|
|
|
1874
1878
|
};
|
|
1875
1879
|
return w.onsuccess = j((V) => {
|
|
1876
1880
|
w.onsuccess = ve, ve();
|
|
1877
|
-
}), _.continue = R, _.continuePrimaryKey = O, _.advance = q, ve(),
|
|
1881
|
+
}), _.continue = R, _.continuePrimaryKey = O, _.advance = q, ve(), ye;
|
|
1878
1882
|
}, v(_);
|
|
1879
|
-
},
|
|
1883
|
+
}, y);
|
|
1880
1884
|
});
|
|
1881
|
-
}, count({ query: l, trans:
|
|
1885
|
+
}, count({ query: l, trans: h }) {
|
|
1882
1886
|
const { index: f, range: m } = l;
|
|
1883
1887
|
return new Promise((p, v) => {
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1888
|
+
const y = h.objectStore(d), g = f.isPrimaryKey ? y : y.index(f.name), b = r(m), k = b ? g.count(b) : g.count();
|
|
1889
|
+
k.onsuccess = j((P) => p(P.target.result)), k.onerror = Y(v);
|
|
1886
1890
|
});
|
|
1887
1891
|
} };
|
|
1888
1892
|
}(a)), u = {};
|
|
@@ -1894,8 +1898,8 @@ function Br(t, e, n) {
|
|
|
1894
1898
|
}
|
|
1895
1899
|
function Ut({ _novip: t }, e) {
|
|
1896
1900
|
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: u }, a) {
|
|
1897
|
-
return { dbcore: function(c,
|
|
1898
|
-
return
|
|
1901
|
+
return { dbcore: function(c, d) {
|
|
1902
|
+
return d.reduce((l, { create: h }) => ({ ...l, ...h(l) }), c);
|
|
1899
1903
|
}(Br(i, o, a), s.dbcore) };
|
|
1900
1904
|
}(t._middlewares, n, t._deps, e);
|
|
1901
1905
|
t.core = r.dbcore, t.tables.forEach((s) => {
|
|
@@ -1911,7 +1915,7 @@ function mt({ _novip: t }, e, n, r) {
|
|
|
1911
1915
|
(!u || "value" in u && u.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? ee(o, s, { get() {
|
|
1912
1916
|
return this.table(s);
|
|
1913
1917
|
}, set(a) {
|
|
1914
|
-
|
|
1918
|
+
Pn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
|
|
1915
1919
|
} }) : o[s] = new t.Table(s, i));
|
|
1916
1920
|
});
|
|
1917
1921
|
});
|
|
@@ -1928,25 +1932,25 @@ function Fr(t, e) {
|
|
|
1928
1932
|
function Mr(t, e, n, r) {
|
|
1929
1933
|
const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
|
|
1930
1934
|
i.create(n), i._completion.catch(r);
|
|
1931
|
-
const o = i._reject.bind(i), u =
|
|
1935
|
+
const o = i._reject.bind(i), u = E.transless || E;
|
|
1932
1936
|
oe(() => {
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
}), Ut(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c,
|
|
1936
|
-
const
|
|
1937
|
+
E.trans = i, E.transless = u, e === 0 ? ($(s).forEach((a) => {
|
|
1938
|
+
Et(n, a, s[a].primKey, s[a].indexes);
|
|
1939
|
+
}), Ut(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c, d, l) {
|
|
1940
|
+
const h = [], f = a._versions;
|
|
1937
1941
|
let m = a._dbSchema = zt(a, a.idbdb, l), p = !1;
|
|
1938
|
-
const v = f.filter((
|
|
1939
|
-
function
|
|
1940
|
-
return
|
|
1942
|
+
const v = f.filter((g) => g._cfg.version >= c);
|
|
1943
|
+
function y() {
|
|
1944
|
+
return h.length ? S.resolve(h.shift()(d.idbtrans)).then(y) : S.resolve();
|
|
1941
1945
|
}
|
|
1942
|
-
return v.forEach((
|
|
1943
|
-
|
|
1944
|
-
const b = m,
|
|
1945
|
-
Ht(a, b, l), Ht(a,
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
}),
|
|
1946
|
+
return v.forEach((g) => {
|
|
1947
|
+
h.push(() => {
|
|
1948
|
+
const b = m, k = g._cfg.dbschema;
|
|
1949
|
+
Ht(a, b, l), Ht(a, k, l), m = a._dbSchema = k;
|
|
1950
|
+
const P = Jn(b, k);
|
|
1951
|
+
P.add.forEach((w) => {
|
|
1952
|
+
Et(l, w[0], w[1].primKey, w[1].indexes);
|
|
1953
|
+
}), P.change.forEach((w) => {
|
|
1950
1954
|
if (w.recreate)
|
|
1951
1955
|
throw new C.Upgrade("Not yet support for changing primary key");
|
|
1952
1956
|
{
|
|
@@ -1956,33 +1960,33 @@ function Mr(t, e, n, r) {
|
|
|
1956
1960
|
}), w.del.forEach((_) => A.deleteIndex(_));
|
|
1957
1961
|
}
|
|
1958
1962
|
});
|
|
1959
|
-
const
|
|
1960
|
-
if (
|
|
1961
|
-
Ut(a, l),
|
|
1962
|
-
let w = An(
|
|
1963
|
-
|
|
1963
|
+
const x = g._cfg.contentUpgrade;
|
|
1964
|
+
if (x && g._cfg.version > c) {
|
|
1965
|
+
Ut(a, l), d._memoizedTables = {}, p = !0;
|
|
1966
|
+
let w = An(k);
|
|
1967
|
+
P.del.forEach((O) => {
|
|
1964
1968
|
w[O] = b[O];
|
|
1965
|
-
}), Vt(a, [a.Transaction.prototype]), mt(a, [a.Transaction.prototype],
|
|
1966
|
-
const A = Zt(
|
|
1969
|
+
}), Vt(a, [a.Transaction.prototype]), mt(a, [a.Transaction.prototype], $(w), w), d.schema = w;
|
|
1970
|
+
const A = Zt(x);
|
|
1967
1971
|
let _;
|
|
1968
1972
|
A && Ce();
|
|
1969
1973
|
const R = S.follow(() => {
|
|
1970
|
-
if (_ =
|
|
1974
|
+
if (_ = x(d), _ && A) {
|
|
1971
1975
|
var O = ne.bind(null, null);
|
|
1972
1976
|
_.then(O, O);
|
|
1973
1977
|
}
|
|
1974
1978
|
});
|
|
1975
1979
|
return _ && typeof _.then == "function" ? S.resolve(_) : R.then(() => _);
|
|
1976
1980
|
}
|
|
1977
|
-
}),
|
|
1978
|
-
(!p || !Ar) && function(
|
|
1979
|
-
[].slice.call(
|
|
1980
|
-
}(
|
|
1981
|
+
}), h.push((b) => {
|
|
1982
|
+
(!p || !Ar) && function(k, P) {
|
|
1983
|
+
[].slice.call(P.db.objectStoreNames).forEach((x) => k[x] == null && P.db.deleteObjectStore(x));
|
|
1984
|
+
}(g._cfg.dbschema, b), Vt(a, [a.Transaction.prototype]), mt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), d.schema = a._dbSchema;
|
|
1981
1985
|
});
|
|
1982
|
-
}),
|
|
1983
|
-
var
|
|
1984
|
-
b = l,
|
|
1985
|
-
b.db.objectStoreNames.contains(
|
|
1986
|
+
}), y().then(() => {
|
|
1987
|
+
var g, b;
|
|
1988
|
+
b = l, $(g = m).forEach((k) => {
|
|
1989
|
+
b.db.objectStoreNames.contains(k) || Et(b, k, g[k].primKey, g[k].indexes);
|
|
1986
1990
|
});
|
|
1987
1991
|
});
|
|
1988
1992
|
}(t, e, i, n).catch(o);
|
|
@@ -1997,7 +2001,7 @@ function Jn(t, e) {
|
|
|
1997
2001
|
const s = t[r], i = e[r];
|
|
1998
2002
|
if (s) {
|
|
1999
2003
|
const o = { name: r, def: i, recreate: !1, del: [], add: [], change: [] };
|
|
2000
|
-
if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !
|
|
2004
|
+
if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !yt)
|
|
2001
2005
|
o.recreate = !0, n.change.push(o);
|
|
2002
2006
|
else {
|
|
2003
2007
|
const u = s.idxByName, a = i.idxByName;
|
|
@@ -2005,8 +2009,8 @@ function Jn(t, e) {
|
|
|
2005
2009
|
for (c in u)
|
|
2006
2010
|
a[c] || o.del.push(c);
|
|
2007
2011
|
for (c in a) {
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2012
|
+
const d = u[c], l = a[c];
|
|
2013
|
+
d ? d.src !== l.src && o.change.push(l) : o.add.push(l);
|
|
2010
2014
|
}
|
|
2011
2015
|
(o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
|
|
2012
2016
|
}
|
|
@@ -2015,7 +2019,7 @@ function Jn(t, e) {
|
|
|
2015
2019
|
}
|
|
2016
2020
|
return n;
|
|
2017
2021
|
}
|
|
2018
|
-
function
|
|
2022
|
+
function Et(t, e, n, r) {
|
|
2019
2023
|
const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
|
|
2020
2024
|
return r.forEach((i) => Wt(s, i)), s;
|
|
2021
2025
|
}
|
|
@@ -2028,8 +2032,8 @@ function zt(t, e, n) {
|
|
|
2028
2032
|
const i = n.objectStore(s);
|
|
2029
2033
|
let o = i.keyPath;
|
|
2030
2034
|
const u = qt(Xn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
|
|
2031
|
-
for (let
|
|
2032
|
-
const l = i.index(i.indexNames[
|
|
2035
|
+
for (let d = 0; d < i.indexNames.length; ++d) {
|
|
2036
|
+
const l = i.index(i.indexNames[d]);
|
|
2033
2037
|
o = l.keyPath;
|
|
2034
2038
|
var c = qt(l.name, o, !!l.unique, !!l.multiEntry, !1, o && typeof o != "string", !1);
|
|
2035
2039
|
a.push(c);
|
|
@@ -2043,10 +2047,10 @@ function Ht({ _novip: t }, e, n) {
|
|
|
2043
2047
|
const i = r[s], o = n.objectStore(i);
|
|
2044
2048
|
t._hasGetAll = "getAll" in o;
|
|
2045
2049
|
for (let u = 0; u < o.indexNames.length; ++u) {
|
|
2046
|
-
const a = o.indexNames[u], c = o.index(a).keyPath,
|
|
2050
|
+
const a = o.indexNames[u], c = o.index(a).keyPath, d = typeof c == "string" ? c : "[" + lt(c).join("+") + "]";
|
|
2047
2051
|
if (e[i]) {
|
|
2048
|
-
const l = e[i].idxByName[
|
|
2049
|
-
l && (l.name = a, delete e[i].idxByName[
|
|
2052
|
+
const l = e[i].idxByName[d];
|
|
2053
|
+
l && (l.name = a, delete e[i].idxByName[d], e[i].idxByName[a] = l);
|
|
2050
2054
|
}
|
|
2051
2055
|
}
|
|
2052
2056
|
}
|
|
@@ -2054,7 +2058,7 @@ function Ht({ _novip: t }, e, n) {
|
|
|
2054
2058
|
}
|
|
2055
2059
|
class qr {
|
|
2056
2060
|
_parseStoresSpec(e, n) {
|
|
2057
|
-
|
|
2061
|
+
$(e).forEach((r) => {
|
|
2058
2062
|
if (e[r] !== null) {
|
|
2059
2063
|
var s = e[r].split(",").map((o, u) => {
|
|
2060
2064
|
const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), c = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
@@ -2078,7 +2082,7 @@ class qr {
|
|
|
2078
2082
|
let i = {};
|
|
2079
2083
|
return r.forEach((o) => {
|
|
2080
2084
|
U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
|
|
2081
|
-
}), n._dbSchema = i, Vt(n, [n._allTables, n, n.Transaction.prototype]), mt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables],
|
|
2085
|
+
}), n._dbSchema = i, Vt(n, [n._allTables, n, n.Transaction.prototype]), mt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], $(i), i), n._storeNames = $(i), this;
|
|
2082
2086
|
}
|
|
2083
2087
|
upgrade(e) {
|
|
2084
2088
|
return this._cfg.contentUpgrade = nn(this._cfg.contentUpgrade || I, e), this;
|
|
@@ -2093,7 +2097,7 @@ function un(t) {
|
|
|
2093
2097
|
}
|
|
2094
2098
|
function Yt(t) {
|
|
2095
2099
|
return oe(function() {
|
|
2096
|
-
return
|
|
2100
|
+
return E.letThrough = !0, t();
|
|
2097
2101
|
});
|
|
2098
2102
|
}
|
|
2099
2103
|
function Lr() {
|
|
@@ -2110,8 +2114,8 @@ function Lr() {
|
|
|
2110
2114
|
function Ur(t) {
|
|
2111
2115
|
const e = t._state, { indexedDB: n } = t._deps;
|
|
2112
2116
|
if (e.isBeingOpened || t.idbdb)
|
|
2113
|
-
return e.dbReadyPromise.then(() => e.dbOpenError ?
|
|
2114
|
-
G && (e.openCanceller._stackHolder =
|
|
2117
|
+
return e.dbReadyPromise.then(() => e.dbOpenError ? D(e.dbOpenError) : t);
|
|
2118
|
+
G && (e.openCanceller._stackHolder = Ee()), e.isBeingOpened = !0, e.dbOpenError = null, e.openComplete = !1;
|
|
2115
2119
|
const r = e.openCanceller;
|
|
2116
2120
|
function s() {
|
|
2117
2121
|
if (e.openCanceller !== r)
|
|
@@ -2121,45 +2125,45 @@ function Ur(t) {
|
|
|
2121
2125
|
return S.race([r, (typeof navigator > "u" ? S.resolve() : Lr()).then(() => new S((a, c) => {
|
|
2122
2126
|
if (s(), !n)
|
|
2123
2127
|
throw new C.MissingAPI();
|
|
2124
|
-
const
|
|
2128
|
+
const d = t.name, l = e.autoSchema ? n.open(d) : n.open(d, Math.round(10 * t.verno));
|
|
2125
2129
|
if (!l)
|
|
2126
2130
|
throw new C.MissingAPI();
|
|
2127
|
-
l.onerror = Y(c), l.onblocked = j(t._fireOnBlocked), l.onupgradeneeded = j((
|
|
2131
|
+
l.onerror = Y(c), l.onblocked = j(t._fireOnBlocked), l.onupgradeneeded = j((h) => {
|
|
2128
2132
|
if (o = l.transaction, e.autoSchema && !t._options.allowEmptyDB) {
|
|
2129
2133
|
l.onerror = qe, o.abort(), l.result.close();
|
|
2130
|
-
const m = n.deleteDatabase(
|
|
2134
|
+
const m = n.deleteDatabase(d);
|
|
2131
2135
|
m.onsuccess = m.onerror = j(() => {
|
|
2132
|
-
c(new C.NoSuchDatabase(`Database ${
|
|
2136
|
+
c(new C.NoSuchDatabase(`Database ${d} doesnt exist`));
|
|
2133
2137
|
});
|
|
2134
2138
|
} else {
|
|
2135
2139
|
o.onerror = Y(c);
|
|
2136
|
-
var f =
|
|
2140
|
+
var f = h.oldVersion > Math.pow(2, 62) ? 0 : h.oldVersion;
|
|
2137
2141
|
u = f < 1, t._novip.idbdb = l.result, Mr(t, f / 10, o, c);
|
|
2138
2142
|
}
|
|
2139
2143
|
}, c), l.onsuccess = j(() => {
|
|
2140
2144
|
o = null;
|
|
2141
|
-
const
|
|
2145
|
+
const h = t._novip.idbdb = l.result, f = lt(h.objectStoreNames);
|
|
2142
2146
|
if (f.length > 0)
|
|
2143
2147
|
try {
|
|
2144
|
-
const p =
|
|
2145
|
-
e.autoSchema ? function({ _novip: v },
|
|
2146
|
-
v.verno =
|
|
2147
|
-
const b = v._dbSchema = zt(0,
|
|
2148
|
-
v._storeNames = lt(
|
|
2149
|
-
}(t,
|
|
2150
|
-
const
|
|
2151
|
-
return !(
|
|
2148
|
+
const p = h.transaction((m = f).length === 1 ? m[0] : m, "readonly");
|
|
2149
|
+
e.autoSchema ? function({ _novip: v }, y, g) {
|
|
2150
|
+
v.verno = y.version / 10;
|
|
2151
|
+
const b = v._dbSchema = zt(0, y, g);
|
|
2152
|
+
v._storeNames = lt(y.objectStoreNames, 0), mt(v, [v._allTables], $(b), b);
|
|
2153
|
+
}(t, h, p) : (Ht(t, t._dbSchema, p), function(v, y) {
|
|
2154
|
+
const g = Jn(zt(0, v.idbdb, y), v._dbSchema);
|
|
2155
|
+
return !(g.add.length || g.change.some((b) => b.add.length || b.change.length));
|
|
2152
2156
|
}(t, p) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Ut(t, p);
|
|
2153
2157
|
} catch {
|
|
2154
2158
|
}
|
|
2155
2159
|
var m;
|
|
2156
|
-
Ne.push(t),
|
|
2160
|
+
Ne.push(t), h.onversionchange = j((p) => {
|
|
2157
2161
|
e.vcFired = !0, t.on("versionchange").fire(p);
|
|
2158
|
-
}),
|
|
2162
|
+
}), h.onclose = j((p) => {
|
|
2159
2163
|
t.on("close").fire(p);
|
|
2160
|
-
}), u && function({ indexedDB: p, IDBKeyRange: v },
|
|
2161
|
-
!un(p) &&
|
|
2162
|
-
}(t._deps,
|
|
2164
|
+
}), u && function({ indexedDB: p, IDBKeyRange: v }, y) {
|
|
2165
|
+
!un(p) && y !== vt && an(p, v).put({ name: y }).catch(I);
|
|
2166
|
+
}(t._deps, d), a();
|
|
2163
2167
|
}, c);
|
|
2164
2168
|
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(Yt(() => t.on.ready.fire(t.vip))).then(function a() {
|
|
2165
2169
|
if (e.onReadyBeingFired.length > 0) {
|
|
@@ -2174,7 +2178,7 @@ function Ur(t) {
|
|
|
2174
2178
|
o && o.abort();
|
|
2175
2179
|
} catch {
|
|
2176
2180
|
}
|
|
2177
|
-
return r === e.openCanceller && t._close(),
|
|
2181
|
+
return r === e.openCanceller && t._close(), D(a);
|
|
2178
2182
|
}).finally(() => {
|
|
2179
2183
|
e.openComplete = !0, i();
|
|
2180
2184
|
});
|
|
@@ -2199,19 +2203,19 @@ function Vr(t, e, n) {
|
|
|
2199
2203
|
}
|
|
2200
2204
|
function Zn(t, e, n, r, s) {
|
|
2201
2205
|
return S.resolve().then(() => {
|
|
2202
|
-
const i =
|
|
2206
|
+
const i = E.transless || E, o = t._createTransaction(e, n, t._dbSchema, r), u = { trans: o, transless: i };
|
|
2203
2207
|
if (r)
|
|
2204
2208
|
o.idbtrans = r.idbtrans;
|
|
2205
2209
|
else
|
|
2206
2210
|
try {
|
|
2207
2211
|
o.create(), t._state.PR1398_maxLoop = 3;
|
|
2208
2212
|
} catch (l) {
|
|
2209
|
-
return l.name === tn.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))) :
|
|
2213
|
+
return l.name === tn.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(l);
|
|
2210
2214
|
}
|
|
2211
2215
|
const a = Zt(s);
|
|
2212
2216
|
let c;
|
|
2213
2217
|
a && Ce();
|
|
2214
|
-
const
|
|
2218
|
+
const d = S.follow(() => {
|
|
2215
2219
|
if (c = s.call(o, o), c)
|
|
2216
2220
|
if (a) {
|
|
2217
2221
|
var l = ne.bind(null, null);
|
|
@@ -2219,7 +2223,7 @@ function Zn(t, e, n, r, s) {
|
|
|
2219
2223
|
} else
|
|
2220
2224
|
typeof c.next == "function" && typeof c.throw == "function" && (c = Gt(c));
|
|
2221
2225
|
}, u);
|
|
2222
|
-
return (c && typeof c.then == "function" ? S.resolve(c).then((l) => o.active ? l :
|
|
2226
|
+
return (c && typeof c.then == "function" ? S.resolve(c).then((l) => o.active ? l : D(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : d.then(() => c)).then((l) => (r && o._resolve(), o._completion.then(() => l))).catch((l) => (o._reject(l), D(l)));
|
|
2223
2227
|
});
|
|
2224
2228
|
}
|
|
2225
2229
|
function et(t, e, n) {
|
|
@@ -2231,39 +2235,39 @@ function et(t, e, n) {
|
|
|
2231
2235
|
const Wr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
|
|
2232
2236
|
return { ...t, table(e) {
|
|
2233
2237
|
const n = t.table(e), { schema: r } = n, s = {}, i = [];
|
|
2234
|
-
function o(c,
|
|
2235
|
-
const
|
|
2236
|
-
return f.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1),
|
|
2238
|
+
function o(c, d, l) {
|
|
2239
|
+
const h = De(c), f = s[h] = s[h] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, p = d > 0, v = { ...l, isVirtual: p, keyTail: d, keyLength: m, extractKey: Lt(c), unique: !p && l.unique };
|
|
2240
|
+
return f.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), d + 1, l), f.sort((y, g) => y.keyTail - g.keyTail), v;
|
|
2237
2241
|
}
|
|
2238
2242
|
const u = o(r.primaryKey.keyPath, 0, r.primaryKey);
|
|
2239
2243
|
s[":id"] = [u];
|
|
2240
2244
|
for (const c of r.indexes)
|
|
2241
2245
|
o(c.keyPath, 0, c);
|
|
2242
2246
|
function a(c) {
|
|
2243
|
-
const
|
|
2244
|
-
return
|
|
2245
|
-
var l,
|
|
2247
|
+
const d = c.query.index;
|
|
2248
|
+
return d.isVirtual ? { ...c, query: { index: d, range: (l = c.query.range, h = d.keyTail, { type: l.type === 1 ? 2 : l.type, lower: et(l.lower, l.lowerOpen ? t.MAX_KEY : t.MIN_KEY, h), lowerOpen: !0, upper: et(l.upper, l.upperOpen ? t.MIN_KEY : t.MAX_KEY, h), upperOpen: !0 }) } } : c;
|
|
2249
|
+
var l, h;
|
|
2246
2250
|
}
|
|
2247
2251
|
return { ...n, schema: { ...r, primaryKey: u, indexes: i, getIndexByKeyPath: function(c) {
|
|
2248
|
-
const
|
|
2249
|
-
return
|
|
2252
|
+
const d = s[De(c)];
|
|
2253
|
+
return d && d[0];
|
|
2250
2254
|
} }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
|
|
2251
|
-
const { keyTail:
|
|
2255
|
+
const { keyTail: d, isVirtual: l, keyLength: h } = c.query.index;
|
|
2252
2256
|
return l ? n.openCursor(a(c)).then((f) => f && function(m) {
|
|
2253
2257
|
return Object.create(m, { continue: { value: function(p) {
|
|
2254
|
-
p != null ? m.continue(et(p, c.reverse ? t.MAX_KEY : t.MIN_KEY,
|
|
2258
|
+
p != null ? m.continue(et(p, c.reverse ? t.MAX_KEY : t.MIN_KEY, d)) : c.unique ? m.continue(m.key.slice(0, h).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, d)) : m.continue();
|
|
2255
2259
|
} }, continuePrimaryKey: { value(p, v) {
|
|
2256
|
-
m.continuePrimaryKey(et(p, t.MAX_KEY,
|
|
2260
|
+
m.continuePrimaryKey(et(p, t.MAX_KEY, d), v);
|
|
2257
2261
|
} }, primaryKey: { get: () => m.primaryKey }, key: { get() {
|
|
2258
2262
|
const p = m.key;
|
|
2259
|
-
return
|
|
2263
|
+
return h === 1 ? p[0] : p.slice(0, h);
|
|
2260
2264
|
} }, value: { get: () => m.value } });
|
|
2261
2265
|
}(f)) : n.openCursor(c);
|
|
2262
2266
|
} };
|
|
2263
2267
|
} };
|
|
2264
2268
|
} };
|
|
2265
2269
|
function ln(t, e, n, r) {
|
|
2266
|
-
return n = n || {}, r = r || "",
|
|
2270
|
+
return n = n || {}, r = r || "", $(t).forEach((s) => {
|
|
2267
2271
|
if (z(e, s)) {
|
|
2268
2272
|
var i = t[s], o = e[s];
|
|
2269
2273
|
if (typeof i == "object" && typeof o == "object" && i && o) {
|
|
@@ -2273,14 +2277,14 @@ function ln(t, e, n, r) {
|
|
|
2273
2277
|
i !== o && (n[r + s] = e[s]);
|
|
2274
2278
|
} else
|
|
2275
2279
|
n[r + s] = void 0;
|
|
2276
|
-
}),
|
|
2280
|
+
}), $(e).forEach((s) => {
|
|
2277
2281
|
z(t, s) || (n[r + s] = e[s]);
|
|
2278
2282
|
}), n;
|
|
2279
2283
|
}
|
|
2280
2284
|
const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
|
|
2281
2285
|
const n = t.table(e), { primaryKey: r } = n.schema;
|
|
2282
2286
|
return { ...n, mutate(s) {
|
|
2283
|
-
const i =
|
|
2287
|
+
const i = E.trans, { deleting: o, creating: u, updating: a } = i.table(e).hook;
|
|
2284
2288
|
switch (s.type) {
|
|
2285
2289
|
case "add":
|
|
2286
2290
|
if (u.fire === I)
|
|
@@ -2298,12 +2302,12 @@ const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) =>
|
|
|
2298
2302
|
if (o.fire === I)
|
|
2299
2303
|
break;
|
|
2300
2304
|
return i._promise("readwrite", () => function(l) {
|
|
2301
|
-
return
|
|
2305
|
+
return d(l.trans, l.range, 1e4);
|
|
2302
2306
|
}(s), !0);
|
|
2303
2307
|
}
|
|
2304
2308
|
return n.mutate(s);
|
|
2305
2309
|
function c(l) {
|
|
2306
|
-
const
|
|
2310
|
+
const h = E.trans, f = l.keys || function(m, p) {
|
|
2307
2311
|
return p.type === "delete" ? p.keys : p.keys || p.values.map(m.extractKey);
|
|
2308
2312
|
}(r, l);
|
|
2309
2313
|
if (!f)
|
|
@@ -2311,35 +2315,35 @@ const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) =>
|
|
|
2311
2315
|
return (l = l.type === "add" || l.type === "put" ? { ...l, keys: f } : { ...l }).type !== "delete" && (l.values = [...l.values]), l.keys && (l.keys = [...l.keys]), function(m, p, v) {
|
|
2312
2316
|
return p.type === "add" ? Promise.resolve([]) : m.getMany({ trans: p.trans, keys: v, cache: "immutable" });
|
|
2313
2317
|
}(n, l, f).then((m) => {
|
|
2314
|
-
const p = f.map((v,
|
|
2315
|
-
const
|
|
2318
|
+
const p = f.map((v, y) => {
|
|
2319
|
+
const g = m[y], b = { onerror: null, onsuccess: null };
|
|
2316
2320
|
if (l.type === "delete")
|
|
2317
|
-
o.fire.call(b, v,
|
|
2318
|
-
else if (l.type === "add" ||
|
|
2319
|
-
const
|
|
2320
|
-
v == null &&
|
|
2321
|
+
o.fire.call(b, v, g, h);
|
|
2322
|
+
else if (l.type === "add" || g === void 0) {
|
|
2323
|
+
const k = u.fire.call(b, v, l.values[y], h);
|
|
2324
|
+
v == null && k != null && (v = k, l.keys[y] = v, r.outbound || H(l.values[y], r.keyPath, v));
|
|
2321
2325
|
} else {
|
|
2322
|
-
const
|
|
2323
|
-
if (
|
|
2324
|
-
const
|
|
2325
|
-
Object.keys(
|
|
2326
|
-
z(
|
|
2326
|
+
const k = ln(g, l.values[y]), P = a.fire.call(b, k, v, g, h);
|
|
2327
|
+
if (P) {
|
|
2328
|
+
const x = l.values[y];
|
|
2329
|
+
Object.keys(P).forEach((w) => {
|
|
2330
|
+
z(x, w) ? x[w] = P[w] : H(x, w, P[w]);
|
|
2327
2331
|
});
|
|
2328
2332
|
}
|
|
2329
2333
|
}
|
|
2330
2334
|
return b;
|
|
2331
2335
|
});
|
|
2332
|
-
return n.mutate(l).then(({ failures: v, results:
|
|
2333
|
-
for (let
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
+
return n.mutate(l).then(({ failures: v, results: y, numFailures: g, lastResult: b }) => {
|
|
2337
|
+
for (let k = 0; k < f.length; ++k) {
|
|
2338
|
+
const P = y ? y[k] : f[k], x = p[k];
|
|
2339
|
+
P == null ? x.onerror && x.onerror(v[k]) : x.onsuccess && x.onsuccess(l.type === "put" && m[k] ? l.values[k] : P);
|
|
2336
2340
|
}
|
|
2337
|
-
return { failures: v, results:
|
|
2338
|
-
}).catch((v) => (p.forEach((
|
|
2341
|
+
return { failures: v, results: y, numFailures: g, lastResult: b };
|
|
2342
|
+
}).catch((v) => (p.forEach((y) => y.onerror && y.onerror(v)), Promise.reject(v)));
|
|
2339
2343
|
});
|
|
2340
2344
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return n.query({ trans: l, values: !1, query: { index: r, range:
|
|
2345
|
+
function d(l, h, f) {
|
|
2346
|
+
return n.query({ trans: l, values: !1, query: { index: r, range: h }, limit: f }).then(({ result: m }) => c({ type: "delete", keys: m, trans: l }).then((p) => p.numFailures > 0 ? Promise.reject(p.failures[0]) : m.length < f ? { failures: [], numFailures: 0, lastResult: void 0 } : d(l, { ...h, lower: m[m.length - 1], lowerOpen: !0 }, f)));
|
|
2343
2347
|
}
|
|
2344
2348
|
} };
|
|
2345
2349
|
} }) };
|
|
@@ -2389,9 +2393,9 @@ function Ve(t, e, n) {
|
|
|
2389
2393
|
return i ? Ve(i, e, n) : t.r = { from: e, to: n, d: 1, l: null, r: null }, xn(t);
|
|
2390
2394
|
L(e, t.from) < 0 && (t.from = e, t.l = null, t.d = i ? i.d + 1 : 1), L(n, t.to) > 0 && (t.to = n, t.r = null, t.d = t.l ? t.l.d + 1 : 1);
|
|
2391
2395
|
const o = !t.r;
|
|
2392
|
-
s && !t.l &&
|
|
2396
|
+
s && !t.l && gt(t, s), i && o && gt(t, i);
|
|
2393
2397
|
}
|
|
2394
|
-
function
|
|
2398
|
+
function gt(t, e) {
|
|
2395
2399
|
cn(e) || function n(r, { from: s, to: i, l: o, r: u }) {
|
|
2396
2400
|
Ve(r, s, i), o && n(r, o), u && n(r, u);
|
|
2397
2401
|
}(t, e);
|
|
@@ -2450,8 +2454,8 @@ function xn(t) {
|
|
|
2450
2454
|
function Sn({ r: t, l: e }) {
|
|
2451
2455
|
return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
|
|
2452
2456
|
}
|
|
2453
|
-
|
|
2454
|
-
return
|
|
2457
|
+
Pe(Q.prototype, { add(t) {
|
|
2458
|
+
return gt(this, t), this;
|
|
2455
2459
|
}, addKey(t) {
|
|
2456
2460
|
return Ve(this, t, t), this;
|
|
2457
2461
|
}, addKeys(t) {
|
|
@@ -2462,73 +2466,73 @@ Ee(Q.prototype, { add(t) {
|
|
|
2462
2466
|
const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
2463
2467
|
const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
|
|
2464
2468
|
return { ...t, table: (r) => {
|
|
2465
|
-
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, c = { ...s, mutate: (
|
|
2466
|
-
const f =
|
|
2467
|
-
const w = `idb://${e}/${r}/${
|
|
2469
|
+
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, c = { ...s, mutate: (h) => {
|
|
2470
|
+
const f = h.trans, m = f.mutatedParts || (f.mutatedParts = {}), p = (x) => {
|
|
2471
|
+
const w = `idb://${e}/${r}/${x}`;
|
|
2468
2472
|
return m[w] || (m[w] = new Q());
|
|
2469
|
-
}, v = p(""),
|
|
2470
|
-
let [b,
|
|
2471
|
-
const
|
|
2472
|
-
return s.mutate(
|
|
2473
|
+
}, v = p(""), y = p(":dels"), { type: g } = h;
|
|
2474
|
+
let [b, k] = h.type === "deleteRange" ? [h.range] : h.type === "delete" ? [h.keys] : h.values.length < 50 ? [[], h.values] : [];
|
|
2475
|
+
const P = h.trans._cache;
|
|
2476
|
+
return s.mutate(h).then((x) => {
|
|
2473
2477
|
if (M(b)) {
|
|
2474
|
-
|
|
2475
|
-
const w = er(b,
|
|
2476
|
-
w ||
|
|
2478
|
+
g !== "delete" && (b = x.results), v.addKeys(b);
|
|
2479
|
+
const w = er(b, P);
|
|
2480
|
+
w || g === "add" || y.addKeys(b), (w || k) && function(A, _, R, O) {
|
|
2477
2481
|
function q(B) {
|
|
2478
2482
|
const N = A(B.name || "");
|
|
2479
|
-
function
|
|
2483
|
+
function ye(V) {
|
|
2480
2484
|
return V != null ? B.extractKey(V) : null;
|
|
2481
2485
|
}
|
|
2482
2486
|
const ve = (V) => B.multiEntry && M(V) ? V.forEach((le) => N.addKey(le)) : N.addKey(V);
|
|
2483
2487
|
(R || O).forEach((V, le) => {
|
|
2484
|
-
const Ae = R &&
|
|
2488
|
+
const Ae = R && ye(R[le]), bt = O && ye(O[le]);
|
|
2485
2489
|
L(Ae, bt) !== 0 && (Ae != null && ve(Ae), bt != null && ve(bt));
|
|
2486
2490
|
});
|
|
2487
2491
|
}
|
|
2488
2492
|
_.indexes.forEach(q);
|
|
2489
|
-
}(p, i, w,
|
|
2493
|
+
}(p, i, w, k);
|
|
2490
2494
|
} else if (b) {
|
|
2491
2495
|
const w = { from: b.lower, to: b.upper };
|
|
2492
|
-
|
|
2496
|
+
y.add(w), v.add(w);
|
|
2493
2497
|
} else
|
|
2494
|
-
v.add(n),
|
|
2495
|
-
return
|
|
2498
|
+
v.add(n), y.add(n), i.indexes.forEach((w) => p(w.name).add(n));
|
|
2499
|
+
return x;
|
|
2496
2500
|
});
|
|
2497
|
-
} },
|
|
2501
|
+
} }, d = ({ query: { index: h, range: f } }) => {
|
|
2498
2502
|
var m, p;
|
|
2499
|
-
return [
|
|
2500
|
-
}, l = { get: (
|
|
2501
|
-
return
|
|
2502
|
-
c[
|
|
2503
|
-
const { subscr: m } =
|
|
2503
|
+
return [h, new Q((m = f.lower) !== null && m !== void 0 ? m : t.MIN_KEY, (p = f.upper) !== null && p !== void 0 ? p : t.MAX_KEY)];
|
|
2504
|
+
}, l = { get: (h) => [o, new Q(h.key)], getMany: (h) => [o, new Q().addKeys(h.keys)], count: d, query: d, openCursor: d };
|
|
2505
|
+
return $(l).forEach((h) => {
|
|
2506
|
+
c[h] = function(f) {
|
|
2507
|
+
const { subscr: m } = E;
|
|
2504
2508
|
if (m) {
|
|
2505
|
-
const p = (
|
|
2506
|
-
const
|
|
2507
|
-
return m[
|
|
2508
|
-
}, v = p(""),
|
|
2509
|
-
if (p(
|
|
2510
|
-
if (
|
|
2511
|
-
const
|
|
2512
|
-
return s[
|
|
2513
|
-
if (
|
|
2509
|
+
const p = (k) => {
|
|
2510
|
+
const P = `idb://${e}/${r}/${k}`;
|
|
2511
|
+
return m[P] || (m[P] = new Q());
|
|
2512
|
+
}, v = p(""), y = p(":dels"), [g, b] = l[h](f);
|
|
2513
|
+
if (p(g.name || "").add(b), !g.isPrimaryKey) {
|
|
2514
|
+
if (h !== "count") {
|
|
2515
|
+
const k = h === "query" && a && f.values && s.query({ ...f, values: !1 });
|
|
2516
|
+
return s[h].apply(this, arguments).then((P) => {
|
|
2517
|
+
if (h === "query") {
|
|
2514
2518
|
if (a && f.values)
|
|
2515
|
-
return
|
|
2516
|
-
const
|
|
2517
|
-
f.values ? v.addKeys(
|
|
2518
|
-
} else if (
|
|
2519
|
-
const
|
|
2520
|
-
return
|
|
2521
|
-
const A =
|
|
2522
|
-
return
|
|
2523
|
-
} }, value: { get: () => (w && v.addKey(
|
|
2519
|
+
return k.then(({ result: w }) => (v.addKeys(w), P));
|
|
2520
|
+
const x = f.values ? P.result.map(u) : P.result;
|
|
2521
|
+
f.values ? v.addKeys(x) : y.addKeys(x);
|
|
2522
|
+
} else if (h === "openCursor") {
|
|
2523
|
+
const x = P, w = f.values;
|
|
2524
|
+
return x && Object.create(x, { key: { get: () => (y.addKey(x.primaryKey), x.key) }, primaryKey: { get() {
|
|
2525
|
+
const A = x.primaryKey;
|
|
2526
|
+
return y.addKey(A), A;
|
|
2527
|
+
} }, value: { get: () => (w && v.addKey(x.primaryKey), x.value) } });
|
|
2524
2528
|
}
|
|
2525
|
-
return
|
|
2529
|
+
return P;
|
|
2526
2530
|
});
|
|
2527
2531
|
}
|
|
2528
|
-
|
|
2532
|
+
y.add(n);
|
|
2529
2533
|
}
|
|
2530
2534
|
}
|
|
2531
|
-
return s[
|
|
2535
|
+
return s[h].apply(this, arguments);
|
|
2532
2536
|
};
|
|
2533
2537
|
}), c;
|
|
2534
2538
|
} };
|
|
@@ -2546,45 +2550,45 @@ class pe {
|
|
|
2546
2550
|
i.dbReadyResolve = u;
|
|
2547
2551
|
}), i.openCanceller = new S((u, a) => {
|
|
2548
2552
|
i.cancelOpen = a;
|
|
2549
|
-
}), this._state = i, this.name = e, this.on =
|
|
2553
|
+
}), this._state = i, this.name = e, this.on = $e(this, "populate", "blocked", "versionchange", "close", { ready: [nn, I] }), this.on.ready.subscribe = En(this.on.ready.subscribe, (u) => (a, c) => {
|
|
2550
2554
|
pe.vip(() => {
|
|
2551
|
-
const
|
|
2552
|
-
if (
|
|
2553
|
-
|
|
2554
|
-
else if (
|
|
2555
|
-
|
|
2555
|
+
const d = this._state;
|
|
2556
|
+
if (d.openComplete)
|
|
2557
|
+
d.dbOpenError || S.resolve().then(a), c && u(a);
|
|
2558
|
+
else if (d.onReadyBeingFired)
|
|
2559
|
+
d.onReadyBeingFired.push(a), c && u(a);
|
|
2556
2560
|
else {
|
|
2557
2561
|
u(a);
|
|
2558
2562
|
const l = this;
|
|
2559
|
-
c || u(function
|
|
2560
|
-
l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(
|
|
2563
|
+
c || u(function h() {
|
|
2564
|
+
l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(h);
|
|
2561
2565
|
});
|
|
2562
2566
|
}
|
|
2563
2567
|
});
|
|
2564
2568
|
}), this.Collection = (o = this, Oe(Kr.prototype, function(u, a) {
|
|
2565
2569
|
this.db = o;
|
|
2566
|
-
let c = Hn,
|
|
2570
|
+
let c = Hn, d = null;
|
|
2567
2571
|
if (a)
|
|
2568
2572
|
try {
|
|
2569
2573
|
c = a();
|
|
2570
2574
|
} catch (m) {
|
|
2571
|
-
|
|
2575
|
+
d = m;
|
|
2572
2576
|
}
|
|
2573
|
-
const l = u._ctx,
|
|
2574
|
-
this._ctx = { table:
|
|
2577
|
+
const l = u._ctx, h = l.table, f = h.hook.reading.fire;
|
|
2578
|
+
this._ctx = { table: h, index: l.index, isPrimKey: !l.index || h.schema.primKey.keyPath && l.index === h.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: d, or: l.or, valueMapper: f !== Fe ? f : null };
|
|
2575
2579
|
})), this.Table = function(u) {
|
|
2576
|
-
return Oe(Ir.prototype, function(a, c,
|
|
2577
|
-
this.db = u, this._tx =
|
|
2580
|
+
return Oe(Ir.prototype, function(a, c, d) {
|
|
2581
|
+
this.db = u, this._tx = d, this.name = a, this.schema = c, this.hook = u._allTables[a] ? u._allTables[a].hook : $e(null, { creating: [br, I], reading: [vr, Fe], updating: [_r, I], deleting: [wr, I] });
|
|
2578
2582
|
});
|
|
2579
2583
|
}(this), this.Transaction = function(u) {
|
|
2580
|
-
return Oe(
|
|
2581
|
-
this.db = u, this.mode = a, this.storeNames = c, this.schema =
|
|
2584
|
+
return Oe($r.prototype, function(a, c, d, l, h) {
|
|
2585
|
+
this.db = u, this.mode = a, this.storeNames = c, this.schema = d, this.chromeTransactionDurability = l, this.idbtrans = null, this.on = $e(this, "complete", "error", "abort"), this.parent = h || 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((f, m) => {
|
|
2582
2586
|
this._resolve = f, this._reject = m;
|
|
2583
2587
|
}), this._completion.then(() => {
|
|
2584
2588
|
this.active = !1, this.on.complete.fire();
|
|
2585
2589
|
}, (f) => {
|
|
2586
2590
|
var m = this.active;
|
|
2587
|
-
return this.active = !1, this.on.error.fire(f), this.parent ? this.parent._reject(f) : m && this.idbtrans && this.idbtrans.abort(),
|
|
2591
|
+
return this.active = !1, this.on.error.fire(f), this.parent ? this.parent._reject(f) : m && this.idbtrans && this.idbtrans.abort(), D(f);
|
|
2588
2592
|
});
|
|
2589
2593
|
});
|
|
2590
2594
|
}(this), this.Version = function(u) {
|
|
@@ -2592,18 +2596,18 @@ class pe {
|
|
|
2592
2596
|
this.db = u, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
2593
2597
|
});
|
|
2594
2598
|
}(this), this.WhereClause = function(u) {
|
|
2595
|
-
return Oe(Gn.prototype, function(a, c,
|
|
2596
|
-
this.db = u, this._ctx = { table: a, index: c === ":id" ? null : c, or:
|
|
2599
|
+
return Oe(Gn.prototype, function(a, c, d) {
|
|
2600
|
+
this.db = u, this._ctx = { table: a, index: c === ":id" ? null : c, or: d };
|
|
2597
2601
|
const l = u._deps.indexedDB;
|
|
2598
2602
|
if (!l)
|
|
2599
2603
|
throw new C.MissingAPI();
|
|
2600
|
-
this._cmp = this._ascending = l.cmp.bind(l), this._descending = (
|
|
2604
|
+
this._cmp = this._ascending = l.cmp.bind(l), this._descending = (h, f) => l.cmp(f, h), this._max = (h, f) => l.cmp(h, f) > 0 ? h : f, this._min = (h, f) => l.cmp(h, f) < 0 ? h : f, this._IDBKeyRange = u._deps.IDBKeyRange;
|
|
2601
2605
|
});
|
|
2602
2606
|
}(this), this.on("versionchange", (u) => {
|
|
2603
2607
|
u.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();
|
|
2604
2608
|
}), this.on("blocked", (u) => {
|
|
2605
2609
|
!u.newVersion || u.newVersion < u.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion / 10}`);
|
|
2606
|
-
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (u, a, c,
|
|
2610
|
+
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (u, a, c, d) => new this.Transaction(u, a, c, this._options.chromeTransactionDurability, d), this._fireOnBlocked = (u) => {
|
|
2607
2611
|
this.on("blocked").fire(u), Ne.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(u));
|
|
2608
2612
|
}, this.use(Wr), this.use(zr), this.use(Gr), this.use(Hr), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((u) => u(this));
|
|
2609
2613
|
}
|
|
@@ -2618,7 +2622,7 @@ class pe {
|
|
|
2618
2622
|
return r || (r = new this.Version(e), n.push(r), n.sort(Fr), r.stores({}), this._state.autoSchema = !1, r);
|
|
2619
2623
|
}
|
|
2620
2624
|
_whenReady(e) {
|
|
2621
|
-
return this.idbdb && (this._state.openComplete ||
|
|
2625
|
+
return this.idbdb && (this._state.openComplete || E.letThrough || this._vip) ? e() : new S((n, r) => {
|
|
2622
2626
|
if (this._state.openComplete)
|
|
2623
2627
|
return r(new C.DatabaseClosed(this._state.dbOpenError));
|
|
2624
2628
|
if (!this._state.isBeingOpened) {
|
|
@@ -2694,24 +2698,24 @@ class pe {
|
|
|
2694
2698
|
return this._state.autoSchema;
|
|
2695
2699
|
}
|
|
2696
2700
|
get tables() {
|
|
2697
|
-
return
|
|
2701
|
+
return $(this._allTables).map((e) => this._allTables[e]);
|
|
2698
2702
|
}
|
|
2699
2703
|
transaction() {
|
|
2700
2704
|
const e = Vr.apply(this, arguments);
|
|
2701
2705
|
return this._transaction.apply(this, e);
|
|
2702
2706
|
}
|
|
2703
2707
|
_transaction(e, n, r) {
|
|
2704
|
-
let s =
|
|
2708
|
+
let s = E.trans;
|
|
2705
2709
|
s && s.db === this && e.indexOf("!") === -1 || (s = null);
|
|
2706
2710
|
const i = e.indexOf("?") !== -1;
|
|
2707
2711
|
let o, u;
|
|
2708
2712
|
e = e.replace("!", "").replace("?", "");
|
|
2709
2713
|
try {
|
|
2710
2714
|
if (u = n.map((c) => {
|
|
2711
|
-
var
|
|
2712
|
-
if (typeof
|
|
2715
|
+
var d = c instanceof this.Table ? c.name : c;
|
|
2716
|
+
if (typeof d != "string")
|
|
2713
2717
|
throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
2714
|
-
return
|
|
2718
|
+
return d;
|
|
2715
2719
|
}), e == "r" || e === _t)
|
|
2716
2720
|
o = _t;
|
|
2717
2721
|
else {
|
|
@@ -2734,12 +2738,12 @@ class pe {
|
|
|
2734
2738
|
}), i && s && !s.active && (s = null);
|
|
2735
2739
|
}
|
|
2736
2740
|
} catch (c) {
|
|
2737
|
-
return s ? s._promise(null, (
|
|
2741
|
+
return s ? s._promise(null, (d, l) => {
|
|
2738
2742
|
l(c);
|
|
2739
|
-
}) :
|
|
2743
|
+
}) : D(c);
|
|
2740
2744
|
}
|
|
2741
2745
|
const a = Zn.bind(null, this, o, u, s, r);
|
|
2742
|
-
return s ? s._promise(o, a, "lock") :
|
|
2746
|
+
return s ? s._promise(o, a, "lock") : E.trans ? Te(E.transless, () => this._whenReady(a)) : this._whenReady(a);
|
|
2743
2747
|
}
|
|
2744
2748
|
table(e) {
|
|
2745
2749
|
if (!z(this._allTables, e))
|
|
@@ -2760,8 +2764,8 @@ class Qr {
|
|
|
2760
2764
|
}
|
|
2761
2765
|
}
|
|
2762
2766
|
function tr(t, e) {
|
|
2763
|
-
return
|
|
2764
|
-
|
|
2767
|
+
return $(e).forEach((n) => {
|
|
2768
|
+
gt(t[n] || (t[n] = new Q()), e[n]);
|
|
2765
2769
|
}), t;
|
|
2766
2770
|
}
|
|
2767
2771
|
function Jr(t) {
|
|
@@ -2775,25 +2779,25 @@ function Jr(t) {
|
|
|
2775
2779
|
o = !0, ue.storagemutated.unsubscribe(f);
|
|
2776
2780
|
} };
|
|
2777
2781
|
s.start && s.start(c);
|
|
2778
|
-
let
|
|
2779
|
-
function
|
|
2780
|
-
return
|
|
2782
|
+
let d = !1, l = !1;
|
|
2783
|
+
function h() {
|
|
2784
|
+
return $(a).some((p) => u[p] && Yr(u[p], a[p]));
|
|
2781
2785
|
}
|
|
2782
2786
|
const f = (p) => {
|
|
2783
|
-
tr(u, p),
|
|
2787
|
+
tr(u, p), h() && m();
|
|
2784
2788
|
}, m = () => {
|
|
2785
|
-
if (
|
|
2789
|
+
if (d || o)
|
|
2786
2790
|
return;
|
|
2787
2791
|
u = {};
|
|
2788
|
-
const p = {}, v = function(
|
|
2792
|
+
const p = {}, v = function(y) {
|
|
2789
2793
|
i && Ce();
|
|
2790
|
-
const
|
|
2794
|
+
const g = () => oe(t, { subscr: y, trans: null }), b = E.trans ? Te(E.transless, g) : g();
|
|
2791
2795
|
return i && b.then(ne, ne), b;
|
|
2792
2796
|
}(p);
|
|
2793
|
-
l || (ue(Le, f), l = !0),
|
|
2794
|
-
n = !0, e =
|
|
2795
|
-
}, (
|
|
2796
|
-
|
|
2797
|
+
l || (ue(Le, f), l = !0), d = !0, Promise.resolve(v).then((y) => {
|
|
2798
|
+
n = !0, e = y, d = !1, o || (h() ? m() : (u = {}, a = p, s.next && s.next(y)));
|
|
2799
|
+
}, (y) => {
|
|
2800
|
+
d = !1, n = !1, s.error && s.error(y), c.unsubscribe();
|
|
2797
2801
|
});
|
|
2798
2802
|
};
|
|
2799
2803
|
return m(), c;
|
|
@@ -2815,23 +2819,23 @@ function at(t) {
|
|
|
2815
2819
|
Z = e;
|
|
2816
2820
|
}
|
|
2817
2821
|
}
|
|
2818
|
-
|
|
2822
|
+
Pe(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) {
|
|
2819
2823
|
try {
|
|
2820
2824
|
return function({ indexedDB: e, IDBKeyRange: n }) {
|
|
2821
2825
|
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== vt)) : an(e, n).toCollection().primaryKeys();
|
|
2822
2826
|
}(ce.dependencies).then(t);
|
|
2823
2827
|
} catch {
|
|
2824
|
-
return
|
|
2828
|
+
return D(new C.MissingAPI());
|
|
2825
2829
|
}
|
|
2826
2830
|
}, defineClass: () => function(t) {
|
|
2827
2831
|
U(this, t);
|
|
2828
|
-
}, ignoreTransaction: (t) =>
|
|
2832
|
+
}, ignoreTransaction: (t) => E.trans ? Te(E.transless, t) : t(), vip: Yt, async: function(t) {
|
|
2829
2833
|
return function() {
|
|
2830
2834
|
try {
|
|
2831
2835
|
var e = Gt(t.apply(this, arguments));
|
|
2832
2836
|
return e && typeof e.then == "function" ? e : S.resolve(e);
|
|
2833
2837
|
} catch (n) {
|
|
2834
|
-
return
|
|
2838
|
+
return D(n);
|
|
2835
2839
|
}
|
|
2836
2840
|
};
|
|
2837
2841
|
}, spawn: function(t, e, n) {
|
|
@@ -2839,21 +2843,21 @@ Ee(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2839
2843
|
var r = Gt(t.apply(n, e || []));
|
|
2840
2844
|
return r && typeof r.then == "function" ? r : S.resolve(r);
|
|
2841
2845
|
} catch (s) {
|
|
2842
|
-
return
|
|
2846
|
+
return D(s);
|
|
2843
2847
|
}
|
|
2844
|
-
}, currentTransaction: { get: () =>
|
|
2848
|
+
}, currentTransaction: { get: () => E.trans || null }, waitFor: function(t, e) {
|
|
2845
2849
|
const n = S.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
|
|
2846
|
-
return
|
|
2850
|
+
return E.trans ? E.trans.waitFor(n) : n;
|
|
2847
2851
|
}, Promise: S, debug: { get: () => G, set: (t) => {
|
|
2848
2852
|
Kn(t, t === "dexie" ? () => !0 : zn);
|
|
2849
|
-
} }, derive: ke, extend: U, props:
|
|
2853
|
+
} }, derive: ke, extend: U, props: Pe, override: En, Events: $e, on: ue, liveQuery: Jr, extendObservabilitySet: tr, getByKeyPath: te, setByKeyPath: H, delByKeyPath: function(t, e) {
|
|
2850
2854
|
typeof e == "string" ? H(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
|
|
2851
2855
|
H(t, n, void 0);
|
|
2852
2856
|
});
|
|
2853
|
-
}, shallowClone: An, deepClone: We, getObjectDiff: ln, cmp: L, asap: Cn, minKey: Mt, addons: [], connections: Ne, errnames: tn, dependencies: Qt, semVer:
|
|
2857
|
+
}, shallowClone: An, deepClone: We, getObjectDiff: ln, cmp: L, asap: Cn, minKey: Mt, addons: [], connections: Ne, errnames: tn, dependencies: Qt, 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" && (ue(Le, (t) => {
|
|
2854
2858
|
if (!Z) {
|
|
2855
2859
|
let e;
|
|
2856
|
-
|
|
2860
|
+
yt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(ie, !0, !0, t)) : e = new CustomEvent(ie, { detail: t }), Z = !0, dispatchEvent(e), Z = !1;
|
|
2857
2861
|
}
|
|
2858
2862
|
}), addEventListener(ie, ({ detail: t }) => {
|
|
2859
2863
|
Z || at(t);
|
|
@@ -2979,9 +2983,9 @@ function is(t) {
|
|
|
2979
2983
|
value: "offline_access"
|
|
2980
2984
|
}
|
|
2981
2985
|
];
|
|
2982
|
-
async function i(o, u, a, c = !0,
|
|
2983
|
-
const
|
|
2984
|
-
m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e),
|
|
2986
|
+
async function i(o, u, a, c = !0, d, l) {
|
|
2987
|
+
const h = await (n == null ? void 0 : n.getTokenInfo()), f = new URL(o, d ?? t.apiUri), m = new Headers();
|
|
2988
|
+
m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e), h && m.append("Authorization", `Bearer ${h.access_token}`);
|
|
2985
2989
|
const p = await fetch(f.toString(), {
|
|
2986
2990
|
method: u || "GET",
|
|
2987
2991
|
headers: m,
|
|
@@ -3002,10 +3006,10 @@ function is(t) {
|
|
|
3002
3006
|
* @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
|
|
3003
3007
|
*/
|
|
3004
3008
|
async getHostedAuthRedirectURL(o = t.defaultScopes, u, a) {
|
|
3005
|
-
const c = await dn(Math.random().toString()),
|
|
3009
|
+
const c = await dn(Math.random().toString()), d = await dn(c);
|
|
3006
3010
|
await (n == null ? void 0 : n.setCodeVerifier(c));
|
|
3007
3011
|
const l = new URL(`${t.apiUri}/v3/connect/auth`);
|
|
3008
|
-
return l.searchParams.set("client_id", t.clientId), l.searchParams.set("response_type", "code"), l.searchParams.set("scope", o.join(" ")), l.searchParams.set("redirect_uri", t.redirectURI), l.searchParams.set("access_type", "offline"), l.searchParams.set("code_challenge",
|
|
3012
|
+
return l.searchParams.set("client_id", t.clientId), l.searchParams.set("response_type", "code"), l.searchParams.set("scope", o.join(" ")), l.searchParams.set("redirect_uri", t.redirectURI), l.searchParams.set("access_type", "offline"), l.searchParams.set("code_challenge", d), l.searchParams.set("code_challenge_method", "S256"), l.searchParams.set("options", "rotate_refresh_token"), a && l.searchParams.set("provider", a), u && l.searchParams.set("login_hint", u), l.toString();
|
|
3009
3013
|
},
|
|
3010
3014
|
/**
|
|
3011
3015
|
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
@@ -3038,8 +3042,8 @@ function is(t) {
|
|
|
3038
3042
|
* This method will make a `application/octet-stream` request to the Nylas API to download a file.
|
|
3039
3043
|
*/
|
|
3040
3044
|
async nylasDownloadFileRequest(o, u = "GET", a) {
|
|
3041
|
-
const c = await (n == null ? void 0 : n.getTokenInfo()),
|
|
3042
|
-
return l.append("Accept", "application/json"), l.append("Content-Type", "application/octet-stream"), l.append("User-Agent", e), c && l.append("Authorization", `Bearer ${c.access_token}`), (await fetch(
|
|
3045
|
+
const c = await (n == null ? void 0 : n.getTokenInfo()), d = new URL(o, t.apiUri), l = new Headers();
|
|
3046
|
+
return l.append("Accept", "application/json"), l.append("Content-Type", "application/octet-stream"), l.append("User-Agent", e), c && l.append("Authorization", `Bearer ${c.access_token}`), (await fetch(d.toString(), {
|
|
3043
3047
|
method: u,
|
|
3044
3048
|
headers: l,
|
|
3045
3049
|
mode: "cors",
|
|
@@ -3105,9 +3109,9 @@ function is(t) {
|
|
|
3105
3109
|
if (!a)
|
|
3106
3110
|
return !1;
|
|
3107
3111
|
const c = a.scope.toLowerCase().split(" ");
|
|
3108
|
-
let
|
|
3112
|
+
let d = [];
|
|
3109
3113
|
const l = Array.isArray(u) ? u : [u];
|
|
3110
|
-
return o === "email" && (
|
|
3114
|
+
return o === "email" && (d = [...s, ...r].filter((h) => l.includes(h.type))), d.every((h) => c.includes(h.value));
|
|
3111
3115
|
},
|
|
3112
3116
|
/**
|
|
3113
3117
|
* A helper method to check if the current access token has a given scope.
|