buzzcasting-storage 3.12.0 → 3.12.2
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/buzzcasting-storage.d.ts +2 -2
- package/dist/buzzcasting-storage.esm.js +262 -253
- package/package.json +1 -1
|
@@ -44,8 +44,8 @@ export declare class BuzzcastingStorageManager {
|
|
|
44
44
|
getDashboards: (query: IQuery) => Promise<IResponse | undefined>;
|
|
45
45
|
setDashboard: (query: IQuery) => Promise<IResponse | undefined>;
|
|
46
46
|
loadImages: (folder: string) => Promise<IResponse | undefined>;
|
|
47
|
-
storeImage: (imageFile: FormData) => Promise<IResponse | number>;
|
|
48
|
-
deleteImage: (imageName: string) => Promise<IResponse | number>;
|
|
47
|
+
storeImage: (folderName: string, imageFile: FormData) => Promise<IResponse | number>;
|
|
48
|
+
deleteImage: (folderName: string, imageName: string) => Promise<IResponse | number>;
|
|
49
49
|
getImages: (query: IQuery) => Promise<IResponse | undefined>;
|
|
50
50
|
setImage: (query: IQuery) => Promise<IResponse | undefined>;
|
|
51
51
|
}
|
|
@@ -26,8 +26,8 @@ function Oe(h, t) {
|
|
|
26
26
|
}
|
|
27
27
|
function Na(h, t, o) {
|
|
28
28
|
return Object.keys(t).sort().reduce(l, h);
|
|
29
|
-
function l(g,
|
|
30
|
-
return jr(g, t[
|
|
29
|
+
function l(g, b) {
|
|
30
|
+
return jr(g, t[b], b, o);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function jr(h, t, o, l) {
|
|
@@ -40,13 +40,13 @@ function jr(h, t, o, l) {
|
|
|
40
40
|
if (l.includes(t))
|
|
41
41
|
return Oe(g, `[Circular]${o}`);
|
|
42
42
|
l.push(t);
|
|
43
|
-
const
|
|
43
|
+
const b = Na(g, t, l);
|
|
44
44
|
if (!("valueOf" in t) || typeof t.valueOf != "function")
|
|
45
|
-
return
|
|
45
|
+
return b;
|
|
46
46
|
try {
|
|
47
|
-
return Oe(
|
|
47
|
+
return Oe(b, String(t.valueOf()));
|
|
48
48
|
} catch (k) {
|
|
49
|
-
return Oe(
|
|
49
|
+
return Oe(b, `[valueOf exception]${k.stack || k.message}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return Oe(g, t.toString());
|
|
@@ -117,10 +117,10 @@ function Ta(h) {
|
|
|
117
117
|
}
|
|
118
118
|
function Ot(h, t) {
|
|
119
119
|
var o;
|
|
120
|
-
let l, g,
|
|
120
|
+
let l, g, b, k, K;
|
|
121
121
|
switch (h.moderation) {
|
|
122
122
|
case en.BEFORE:
|
|
123
|
-
l = /* @__PURE__ */ new Date(), g = (o = h.beforeTime) == null ? void 0 : o.split(":"),
|
|
123
|
+
l = /* @__PURE__ */ new Date(), g = (o = h.beforeTime) == null ? void 0 : o.split(":"), b = Number.parseInt(g ? g[0] : "00"), k = Number.parseInt(g ? g[1] : "00"), K = Number.parseInt(g ? g[2] : "00"), t.before = l.setHours(b, k, K, 0) / 1e3, t.period || (t.period = l.getDay() === 1 ? 72 : 24);
|
|
124
124
|
break;
|
|
125
125
|
case en.DELAYED:
|
|
126
126
|
h.delay && h.delay > 0 && (t.delay = `${h.delay}`);
|
|
@@ -133,7 +133,7 @@ function Ot(h, t) {
|
|
|
133
133
|
}
|
|
134
134
|
return t;
|
|
135
135
|
}
|
|
136
|
-
const xa = "3.
|
|
136
|
+
const xa = "3.12.1";
|
|
137
137
|
class ka {
|
|
138
138
|
options;
|
|
139
139
|
url;
|
|
@@ -173,7 +173,7 @@ class ka {
|
|
|
173
173
|
async get(t) {
|
|
174
174
|
const { version: o } = this.options, l = this.headers(), g = Object.assign({}, t);
|
|
175
175
|
delete g.type, delete g.hash, delete g.order, g.topics = `${g.dashboard}-${g.widget}`, delete g.presentation;
|
|
176
|
-
const
|
|
176
|
+
const b = Object.keys(g).length > 0 ? `?${new URLSearchParams(g).toString()}` : "";
|
|
177
177
|
let k = "";
|
|
178
178
|
switch (t.type) {
|
|
179
179
|
case _.MESSAGES:
|
|
@@ -195,7 +195,7 @@ class ka {
|
|
|
195
195
|
k,
|
|
196
196
|
t.widget
|
|
197
197
|
]), G(4, [t.type, g]), await fetch(
|
|
198
|
-
[this.url, "api", o, t.type].join("/") +
|
|
198
|
+
[this.url, "api", o, t.type].join("/") + b,
|
|
199
199
|
{ ...l, method: "get" }
|
|
200
200
|
).then(async (K) => {
|
|
201
201
|
if (!K.ok)
|
|
@@ -216,15 +216,15 @@ class ka {
|
|
|
216
216
|
), await fetch(
|
|
217
217
|
[this.url, "api", o, "messages", t.id].join("/") + g,
|
|
218
218
|
{ ...l, method: "put" }
|
|
219
|
-
).then((
|
|
220
|
-
if (!
|
|
221
|
-
throw new Error(
|
|
222
|
-
return
|
|
223
|
-
}).then((
|
|
219
|
+
).then((b) => {
|
|
220
|
+
if (!b.ok)
|
|
221
|
+
throw new Error(b.statusText);
|
|
222
|
+
return b;
|
|
223
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
224
224
|
}
|
|
225
225
|
async hideLabels(t) {
|
|
226
|
-
const { version: o } = this.options, l = this.formHeaders(), g = new URLSearchParams(),
|
|
227
|
-
for (const [k, K] of
|
|
226
|
+
const { version: o } = this.options, l = this.formHeaders(), g = new URLSearchParams(), b = t.labels || [];
|
|
227
|
+
for (const [k, K] of b.entries())
|
|
228
228
|
g.append(`custom_filters[${k}]`, K);
|
|
229
229
|
return console.info(
|
|
230
230
|
"%capi%c %cput",
|
|
@@ -233,7 +233,7 @@ class ka {
|
|
|
233
233
|
c.GET_DATA,
|
|
234
234
|
X.HIDE_LABELS,
|
|
235
235
|
t.widget,
|
|
236
|
-
|
|
236
|
+
b
|
|
237
237
|
), await fetch(
|
|
238
238
|
[this.url, "api", o, t.type, t.widget].join("/"),
|
|
239
239
|
{ ...l, body: g, method: "put" }
|
|
@@ -248,11 +248,11 @@ class ka {
|
|
|
248
248
|
return delete g.type, delete g.hash, G(3, ["%capi%c %cloadSlide", c.API, c.NONE, c.SLIDE, t.id]), await fetch(
|
|
249
249
|
[this.url, "api", o, "slides", t.id].join("/"),
|
|
250
250
|
{ ...l, method: "get" }
|
|
251
|
-
).then(async (
|
|
252
|
-
if (!
|
|
253
|
-
throw new Error(`${
|
|
254
|
-
return
|
|
255
|
-
}).then((
|
|
251
|
+
).then(async (b) => {
|
|
252
|
+
if (!b.ok)
|
|
253
|
+
throw new Error(`${b.status}`);
|
|
254
|
+
return b;
|
|
255
|
+
}).then((b) => b.json()).then((b) => (b.query = t, b.data && b.data.json && (b.data.json = JSON.parse(b.data.json)), b)).catch((b) => ({ success: !1, message: `${b}`, data: null }));
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
258
|
* Store slide definition
|
|
@@ -277,11 +277,11 @@ class ka {
|
|
|
277
277
|
]), await fetch(
|
|
278
278
|
[this.url, "api", o, "slides", t.id].join("/"),
|
|
279
279
|
{ ...l, body: g, method: "put" }
|
|
280
|
-
).then((
|
|
281
|
-
if (!
|
|
282
|
-
throw new Error(
|
|
283
|
-
return
|
|
284
|
-
}).then((
|
|
280
|
+
).then((b) => {
|
|
281
|
+
if (!b.ok)
|
|
282
|
+
throw new Error(b.statusText);
|
|
283
|
+
return b;
|
|
284
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
285
285
|
}
|
|
286
286
|
async loadPresentation(t) {
|
|
287
287
|
const { version: o } = this.options, l = this.headers();
|
|
@@ -316,11 +316,11 @@ class ka {
|
|
|
316
316
|
return G(2, ["%capi%c %cput", c.API, c.NONE, c.PRESENTATION, t.name]), await fetch(
|
|
317
317
|
[this.url, "api", o, _.PRESENTATIONS, t.id].join("/"),
|
|
318
318
|
{ ...l, body: g, method: "put" }
|
|
319
|
-
).then((
|
|
320
|
-
if (!
|
|
321
|
-
throw new Error(
|
|
322
|
-
return
|
|
323
|
-
}).then((
|
|
319
|
+
).then((b) => {
|
|
320
|
+
if (!b.ok)
|
|
321
|
+
throw new Error(b.statusText);
|
|
322
|
+
return b;
|
|
323
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
324
324
|
}
|
|
325
325
|
async loadPreference(t) {
|
|
326
326
|
const { version: o } = this.options, l = this.headers();
|
|
@@ -352,11 +352,11 @@ class ka {
|
|
|
352
352
|
), await fetch(
|
|
353
353
|
[this.url, "api", o, _.PREFERENCES, t.id].join("/"),
|
|
354
354
|
{ ...l, body: g, method: "put" }
|
|
355
|
-
).then((
|
|
356
|
-
if (!
|
|
357
|
-
throw new Error(
|
|
358
|
-
return
|
|
359
|
-
}).then((
|
|
355
|
+
).then((b) => {
|
|
356
|
+
if (!b.ok)
|
|
357
|
+
throw new Error(b.statusText);
|
|
358
|
+
return b;
|
|
359
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
360
360
|
}
|
|
361
361
|
/*public async loadDashboardWidgets(query: IQuery): Promise<any> {
|
|
362
362
|
if (query?.dashboard === undefined)
|
|
@@ -416,7 +416,9 @@ class ka {
|
|
|
416
416
|
async loadImages(t) {
|
|
417
417
|
const { version: o } = this.options, l = this.headers();
|
|
418
418
|
return console.info("%capi%c %cloadImage", c.API, c.NONE, c.WIDGET), await fetch(
|
|
419
|
-
[this.url, "api", o, _.IMAGES
|
|
419
|
+
`${[this.url, "api", o, _.IMAGES].join(
|
|
420
|
+
"/"
|
|
421
|
+
)}?folder=${t}`,
|
|
420
422
|
{
|
|
421
423
|
...l,
|
|
422
424
|
method: "get"
|
|
@@ -439,32 +441,39 @@ class ka {
|
|
|
439
441
|
c.NONE,
|
|
440
442
|
c.WIDGET,
|
|
441
443
|
t.get("name")
|
|
442
|
-
), await fetch(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
444
|
+
), await fetch(
|
|
445
|
+
`${[this.url, "api", o, _.IMAGES].join(
|
|
446
|
+
"/"
|
|
447
|
+
)}?folder=${t.get("folder")}`,
|
|
448
|
+
{
|
|
449
|
+
...l,
|
|
450
|
+
body: g,
|
|
451
|
+
method: "post"
|
|
452
|
+
}
|
|
453
|
+
).then((b) => {
|
|
454
|
+
if (!b.ok)
|
|
455
|
+
throw new Error(b.statusText);
|
|
456
|
+
return b;
|
|
457
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
451
458
|
}
|
|
452
|
-
async deleteImage(t) {
|
|
453
|
-
const { version:
|
|
459
|
+
async deleteImage(t, o) {
|
|
460
|
+
const { version: l } = this.options, g = this.formHeaders();
|
|
454
461
|
return console.info(
|
|
455
462
|
"%capi%c %cdeleteImage",
|
|
456
463
|
c.API,
|
|
457
464
|
c.NONE,
|
|
458
465
|
c.WIDGET,
|
|
459
|
-
|
|
466
|
+
o
|
|
460
467
|
), await fetch(
|
|
461
|
-
[this.url, "api",
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
+
`${[this.url, "api", l, _.IMAGES, o].join(
|
|
469
|
+
"/"
|
|
470
|
+
)}?folder=${t}`,
|
|
471
|
+
{ ...g, method: "delete" }
|
|
472
|
+
).then((b) => {
|
|
473
|
+
if (!b.ok)
|
|
474
|
+
throw new Error(b.statusText);
|
|
475
|
+
return b;
|
|
476
|
+
}).then((b) => b.json()).catch((b) => ({ succes: !1, message: b, data: [] }));
|
|
468
477
|
}
|
|
469
478
|
}
|
|
470
479
|
var Ca = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
@@ -493,13 +502,13 @@ function Ma() {
|
|
|
493
502
|
for (var a, s = 0, i = n.length; s < i; s++) !a && s in n || ((a = a || Array.prototype.slice.call(n, 0, s))[s] = n[s]);
|
|
494
503
|
return e.concat(a || Array.prototype.slice.call(n));
|
|
495
504
|
}
|
|
496
|
-
var
|
|
505
|
+
var b = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ca, k = Object.keys, K = Array.isArray;
|
|
497
506
|
function te(e, n) {
|
|
498
507
|
return typeof n != "object" || k(n).forEach(function(r) {
|
|
499
508
|
e[r] = n[r];
|
|
500
509
|
}), e;
|
|
501
510
|
}
|
|
502
|
-
typeof Promise > "u" ||
|
|
511
|
+
typeof Promise > "u" || b.Promise || (b.Promise = Promise);
|
|
503
512
|
var ge = Object.getPrototypeOf, Ce = {}.hasOwnProperty;
|
|
504
513
|
function ie(e, n) {
|
|
505
514
|
return Ce.call(e, n);
|
|
@@ -529,7 +538,7 @@ function Ma() {
|
|
|
529
538
|
if (!e) throw new Error("Assertion Failed");
|
|
530
539
|
}
|
|
531
540
|
function Yn(e) {
|
|
532
|
-
|
|
541
|
+
b.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
533
542
|
}
|
|
534
543
|
function ve(e, n) {
|
|
535
544
|
if (typeof n == "string" && ie(e, n)) return e[n];
|
|
@@ -570,9 +579,9 @@ function Ma() {
|
|
|
570
579
|
return n + e + "Array";
|
|
571
580
|
});
|
|
572
581
|
}))).filter(function(e) {
|
|
573
|
-
return
|
|
582
|
+
return b[e];
|
|
574
583
|
}), Jn = new Set(Ge.map(function(e) {
|
|
575
|
-
return
|
|
584
|
+
return b[e];
|
|
576
585
|
})), it = null;
|
|
577
586
|
function $e(e) {
|
|
578
587
|
return it = /* @__PURE__ */ new WeakMap(), e = function n(r) {
|
|
@@ -990,11 +999,11 @@ function Ma() {
|
|
|
990
999
|
var r, a = B;
|
|
991
1000
|
(n ? !ne.echoes || kt++ && e === B : !kt || --kt && e === B) || queueMicrotask(n ? function(s) {
|
|
992
1001
|
++Ct, ne.echoes && --ne.echoes != 0 || (ne.echoes = ne.awaits = ne.id = 0), xt.push(B), Ne(s, !0);
|
|
993
|
-
}.bind(null, e) : sa), e !== B && (B = e, a === Pe && (Pe.env = ar()), cn && (r = Pe.env.Promise, n = e.env, (a.global || e.global) && (Object.defineProperty(
|
|
1002
|
+
}.bind(null, e) : sa), e !== B && (B = e, a === Pe && (Pe.env = ar()), cn && (r = Pe.env.Promise, n = e.env, (a.global || e.global) && (Object.defineProperty(b, "Promise", n.PromiseProp), r.all = n.all, r.race = n.race, r.resolve = n.resolve, r.reject = n.reject, n.allSettled && (r.allSettled = n.allSettled), n.any && (r.any = n.any))));
|
|
994
1003
|
}
|
|
995
1004
|
function ar() {
|
|
996
|
-
var e =
|
|
997
|
-
return cn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(
|
|
1005
|
+
var e = b.Promise;
|
|
1006
|
+
return cn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(b, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
998
1007
|
}
|
|
999
1008
|
function We(e, n, r, a, s) {
|
|
1000
1009
|
var i = B;
|
|
@@ -1090,9 +1099,9 @@ function Ma() {
|
|
|
1090
1099
|
return y(w, f, O, m);
|
|
1091
1100
|
})) : q(S);
|
|
1092
1101
|
}
|
|
1093
|
-
return E._promise(f, function(S,
|
|
1102
|
+
return E._promise(f, function(S, v) {
|
|
1094
1103
|
return De(function() {
|
|
1095
|
-
return B.trans = E, m(S,
|
|
1104
|
+
return B.trans = E, m(S, v, E);
|
|
1096
1105
|
});
|
|
1097
1106
|
}).then(function(S) {
|
|
1098
1107
|
if (f === "readwrite") try {
|
|
@@ -1304,8 +1313,8 @@ function Ma() {
|
|
|
1304
1313
|
e.forEach(function(f, O) {
|
|
1305
1314
|
var m = f.key, E = f.changes, S = d[O];
|
|
1306
1315
|
if (S) {
|
|
1307
|
-
for (var
|
|
1308
|
-
var P = A[
|
|
1316
|
+
for (var v = 0, A = Object.keys(E); v < A.length; v++) {
|
|
1317
|
+
var P = A[v], D = E[P];
|
|
1309
1318
|
if (P === n.schema.primKey.keyPath) {
|
|
1310
1319
|
if (H(D, m) !== 0) throw new L.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1311
1320
|
} else ue(S, P, D);
|
|
@@ -1318,8 +1327,8 @@ function Ma() {
|
|
|
1318
1327
|
var O = f.numFailures, m = f.failures;
|
|
1319
1328
|
if (O === 0) return w;
|
|
1320
1329
|
for (var E = 0, S = Object.keys(m); E < S.length; E++) {
|
|
1321
|
-
var
|
|
1322
|
-
P != null && (
|
|
1330
|
+
var v, A = S[E], P = i[Number(A)];
|
|
1331
|
+
P != null && (v = m[A], delete m[A], m[P] = v);
|
|
1323
1332
|
}
|
|
1324
1333
|
throw new Je("".concat(n.name, ".bulkUpdate(): ").concat(O, " of ").concat(w, " operations failed"), m);
|
|
1325
1334
|
});
|
|
@@ -1369,9 +1378,9 @@ function Ma() {
|
|
|
1369
1378
|
if (O !== "asap") throw new L.InvalidArgument("Invalid event config");
|
|
1370
1379
|
var m = i(f, ct, function() {
|
|
1371
1380
|
for (var E = arguments.length, S = new Array(E); E--; ) S[E] = arguments[E];
|
|
1372
|
-
m.subscribers.forEach(function(
|
|
1381
|
+
m.subscribers.forEach(function(v) {
|
|
1373
1382
|
Yn(function() {
|
|
1374
|
-
|
|
1383
|
+
v.apply(null, S);
|
|
1375
1384
|
});
|
|
1376
1385
|
});
|
|
1377
1386
|
});
|
|
@@ -1636,31 +1645,31 @@ function Ma() {
|
|
|
1636
1645
|
var n = this, r = this._ctx;
|
|
1637
1646
|
return this._write(function(a) {
|
|
1638
1647
|
var s, i, u;
|
|
1639
|
-
u = typeof e == "function" ? e : (s = k(e), i = s.length, function(
|
|
1648
|
+
u = typeof e == "function" ? e : (s = k(e), i = s.length, function(v) {
|
|
1640
1649
|
for (var A = !1, P = 0; P < i; ++P) {
|
|
1641
|
-
var D = s[P], I = e[D], N = ve(
|
|
1642
|
-
I instanceof pt ? (ue(
|
|
1650
|
+
var D = s[P], I = e[D], N = ve(v, D);
|
|
1651
|
+
I instanceof pt ? (ue(v, D, I.execute(N)), A = !0) : N !== I && (ue(v, D, I), A = !0);
|
|
1643
1652
|
}
|
|
1644
1653
|
return A;
|
|
1645
1654
|
});
|
|
1646
1655
|
var d = r.table.core, f = d.schema.primaryKey, p = f.outbound, y = f.extractKey, w = 200, f = n.db._options.modifyChunkSize;
|
|
1647
1656
|
f && (w = typeof f == "object" ? f[d.name] || f["*"] || 200 : f);
|
|
1648
|
-
function O(
|
|
1657
|
+
function O(v, D) {
|
|
1649
1658
|
var P = D.failures, D = D.numFailures;
|
|
1650
|
-
E +=
|
|
1659
|
+
E += v - D;
|
|
1651
1660
|
for (var I = 0, N = k(P); I < N.length; I++) {
|
|
1652
1661
|
var C = N[I];
|
|
1653
1662
|
m.push(P[C]);
|
|
1654
1663
|
}
|
|
1655
1664
|
}
|
|
1656
1665
|
var m = [], E = 0, S = [];
|
|
1657
|
-
return n.clone().primaryKeys().then(function(
|
|
1666
|
+
return n.clone().primaryKeys().then(function(v) {
|
|
1658
1667
|
function A(D) {
|
|
1659
|
-
var I = Math.min(w,
|
|
1660
|
-
return d.getMany({ trans: a, keys:
|
|
1668
|
+
var I = Math.min(w, v.length - D);
|
|
1669
|
+
return d.getMany({ trans: a, keys: v.slice(D, D + I), cache: "immutable" }).then(function(N) {
|
|
1661
1670
|
for (var C = [], R = [], T = p ? [] : null, $ = [], x = 0; x < I; ++x) {
|
|
1662
|
-
var M = N[x], F = { value: $e(M), primKey:
|
|
1663
|
-
u.call(F, F.value, F) !== !1 && (F.value == null ? $.push(
|
|
1671
|
+
var M = N[x], F = { value: $e(M), primKey: v[D + x] };
|
|
1672
|
+
u.call(F, F.value, F) !== !1 && (F.value == null ? $.push(v[D + x]) : p || H(y(M), y(F.value)) === 0 ? (R.push(F.value), p && T.push(v[D + x])) : ($.push(v[D + x]), C.push(F.value)));
|
|
1664
1673
|
}
|
|
1665
1674
|
return Promise.resolve(0 < C.length && d.mutate({ trans: a, type: "add", values: C }).then(function(U) {
|
|
1666
1675
|
for (var z in U.failures) $.splice(parseInt(z), 1);
|
|
@@ -1674,14 +1683,14 @@ function Ma() {
|
|
|
1674
1683
|
return O($.length, U);
|
|
1675
1684
|
});
|
|
1676
1685
|
}).then(function() {
|
|
1677
|
-
return
|
|
1686
|
+
return v.length > D + I && A(D + w);
|
|
1678
1687
|
});
|
|
1679
1688
|
});
|
|
1680
1689
|
}
|
|
1681
1690
|
var P = nt(r) && r.limit === 1 / 0 && (typeof e != "function" || e === En) && { index: r.index, range: r.range };
|
|
1682
1691
|
return A(0).then(function() {
|
|
1683
1692
|
if (0 < m.length) throw new Pt("Error modifying one or more objects", m, E, S);
|
|
1684
|
-
return
|
|
1693
|
+
return v.length;
|
|
1685
1694
|
});
|
|
1686
1695
|
});
|
|
1687
1696
|
});
|
|
@@ -1725,24 +1734,24 @@ function Ma() {
|
|
|
1725
1734
|
return typeof E == "string";
|
|
1726
1735
|
})) return le(e, or);
|
|
1727
1736
|
function O(E) {
|
|
1728
|
-
s = E === "next" ? function(
|
|
1729
|
-
return
|
|
1730
|
-
} : function(
|
|
1731
|
-
return
|
|
1732
|
-
}, i = E === "next" ? function(
|
|
1733
|
-
return
|
|
1734
|
-
} : function(
|
|
1735
|
-
return
|
|
1737
|
+
s = E === "next" ? function(v) {
|
|
1738
|
+
return v.toUpperCase();
|
|
1739
|
+
} : function(v) {
|
|
1740
|
+
return v.toLowerCase();
|
|
1741
|
+
}, i = E === "next" ? function(v) {
|
|
1742
|
+
return v.toLowerCase();
|
|
1743
|
+
} : function(v) {
|
|
1744
|
+
return v.toUpperCase();
|
|
1736
1745
|
}, u = E === "next" ? ia : ca;
|
|
1737
|
-
var S = r.map(function(
|
|
1738
|
-
return { lower: i(
|
|
1739
|
-
}).sort(function(
|
|
1740
|
-
return u(
|
|
1746
|
+
var S = r.map(function(v) {
|
|
1747
|
+
return { lower: i(v), upper: s(v) };
|
|
1748
|
+
}).sort(function(v, A) {
|
|
1749
|
+
return u(v.lower, A.lower);
|
|
1741
1750
|
});
|
|
1742
|
-
d = S.map(function(
|
|
1743
|
-
return
|
|
1744
|
-
}), p = S.map(function(
|
|
1745
|
-
return
|
|
1751
|
+
d = S.map(function(v) {
|
|
1752
|
+
return v.upper;
|
|
1753
|
+
}), p = S.map(function(v) {
|
|
1754
|
+
return v.lower;
|
|
1746
1755
|
}), w = (y = E) === "next" ? "" : a;
|
|
1747
1756
|
}
|
|
1748
1757
|
O("next"), e = new e.Collection(e, function() {
|
|
@@ -1751,7 +1760,7 @@ function Ma() {
|
|
|
1751
1760
|
O(E);
|
|
1752
1761
|
};
|
|
1753
1762
|
var m = 0;
|
|
1754
|
-
return e._addAlgorithm(function(E, S,
|
|
1763
|
+
return e._addAlgorithm(function(E, S, v) {
|
|
1755
1764
|
var A = E.key;
|
|
1756
1765
|
if (typeof A != "string") return !1;
|
|
1757
1766
|
var P = i(A);
|
|
@@ -1769,7 +1778,7 @@ function Ma() {
|
|
|
1769
1778
|
}
|
|
1770
1779
|
return S(D !== null ? function() {
|
|
1771
1780
|
E.continue(D + w);
|
|
1772
|
-
} :
|
|
1781
|
+
} : v), !1;
|
|
1773
1782
|
}), e;
|
|
1774
1783
|
}
|
|
1775
1784
|
function Re(e, n, r, a) {
|
|
@@ -1898,13 +1907,13 @@ function Ma() {
|
|
|
1898
1907
|
return 0 < i(P, w[m][0]);
|
|
1899
1908
|
} : function(P) {
|
|
1900
1909
|
return 0 <= i(P, w[m][0]);
|
|
1901
|
-
},
|
|
1910
|
+
}, v = E, A = new this.Collection(this, function() {
|
|
1902
1911
|
return Re(w[0][0], w[w.length - 1][1], !p, !y);
|
|
1903
1912
|
});
|
|
1904
1913
|
return A._ondirectionchange = function(P) {
|
|
1905
|
-
f = P === "next" ? (
|
|
1914
|
+
f = P === "next" ? (v = E, s) : (v = S, i), w.sort(O);
|
|
1906
1915
|
}, A._addAlgorithm(function(P, D, I) {
|
|
1907
|
-
for (var N, C = P.key;
|
|
1916
|
+
for (var N, C = P.key; v(C); ) if (++m === w.length) return D(I), !1;
|
|
1908
1917
|
return !E(N = C) && !S(N) || (r._cmp(C, w[m][1]) === 0 || r._cmp(C, w[m][0]) === 0 || D(function() {
|
|
1909
1918
|
f === s ? P.continue(w[m][0]) : P.continue(w[m][1]);
|
|
1910
1919
|
}), !1);
|
|
@@ -2059,19 +2068,19 @@ function Ma() {
|
|
|
2059
2068
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
2060
2069
|
}
|
|
2061
2070
|
function da(e, n, p) {
|
|
2062
|
-
function a(
|
|
2063
|
-
if (
|
|
2064
|
-
if (
|
|
2065
|
-
var m =
|
|
2066
|
-
return m === void 0 ? E === void 0 ? null : n.upperBound(E, !!
|
|
2071
|
+
function a(v) {
|
|
2072
|
+
if (v.type === 3) return null;
|
|
2073
|
+
if (v.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
2074
|
+
var m = v.lower, E = v.upper, S = v.lowerOpen, v = v.upperOpen;
|
|
2075
|
+
return m === void 0 ? E === void 0 ? null : n.upperBound(E, !!v) : E === void 0 ? n.lowerBound(m, !!S) : n.bound(m, E, !!S, !!v);
|
|
2067
2076
|
}
|
|
2068
2077
|
function s(O) {
|
|
2069
2078
|
var m, E = O.name;
|
|
2070
2079
|
return { name: E, schema: O, mutate: function(S) {
|
|
2071
|
-
var
|
|
2080
|
+
var v = S.trans, A = S.type, P = S.keys, D = S.values, I = S.range;
|
|
2072
2081
|
return new Promise(function(N, C) {
|
|
2073
2082
|
N = Z(N);
|
|
2074
|
-
var R =
|
|
2083
|
+
var R = v.objectStore(E), T = R.keyPath == null, $ = A === "put" || A === "add";
|
|
2075
2084
|
if (!$ && A !== "delete" && A !== "deleteRange") throw new Error("Invalid operation type: " + A);
|
|
2076
2085
|
var x, M = (P || D || { length: 1 }).length;
|
|
2077
2086
|
if (P && D && P.length !== D.length) throw new Error("Given keys array must have same length as given values array.");
|
|
@@ -2100,45 +2109,45 @@ function Ma() {
|
|
|
2100
2109
|
}, x.onsuccess = qt;
|
|
2101
2110
|
});
|
|
2102
2111
|
}, getMany: function(S) {
|
|
2103
|
-
var
|
|
2112
|
+
var v = S.trans, A = S.keys;
|
|
2104
2113
|
return new Promise(function(P, D) {
|
|
2105
2114
|
P = Z(P);
|
|
2106
|
-
for (var I, N =
|
|
2115
|
+
for (var I, N = v.objectStore(E), C = A.length, R = new Array(C), T = 0, $ = 0, x = function(U) {
|
|
2107
2116
|
U = U.target, R[U._pos] = U.result, ++$ === T && P(R);
|
|
2108
2117
|
}, M = me(D), F = 0; F < C; ++F) A[F] != null && ((I = N.get(A[F]))._pos = F, I.onsuccess = x, I.onerror = M, ++T);
|
|
2109
2118
|
T === 0 && P(R);
|
|
2110
2119
|
});
|
|
2111
2120
|
}, get: function(S) {
|
|
2112
|
-
var
|
|
2121
|
+
var v = S.trans, A = S.key;
|
|
2113
2122
|
return new Promise(function(P, D) {
|
|
2114
2123
|
P = Z(P);
|
|
2115
|
-
var I =
|
|
2124
|
+
var I = v.objectStore(E).get(A);
|
|
2116
2125
|
I.onsuccess = function(N) {
|
|
2117
2126
|
return P(N.target.result);
|
|
2118
2127
|
}, I.onerror = me(D);
|
|
2119
2128
|
});
|
|
2120
2129
|
}, query: (m = y, function(S) {
|
|
2121
|
-
return new Promise(function(
|
|
2122
|
-
|
|
2130
|
+
return new Promise(function(v, A) {
|
|
2131
|
+
v = Z(v);
|
|
2123
2132
|
var P, D, I, T = S.trans, N = S.values, C = S.limit, x = S.query, R = C === 1 / 0 ? void 0 : C, $ = x.index, x = x.range, T = T.objectStore(E), $ = $.isPrimaryKey ? T : T.index($.name), x = a(x);
|
|
2124
|
-
if (C === 0) return
|
|
2133
|
+
if (C === 0) return v({ result: [] });
|
|
2125
2134
|
m ? ((R = N ? $.getAll(x, R) : $.getAllKeys(x, R)).onsuccess = function(M) {
|
|
2126
|
-
return
|
|
2135
|
+
return v({ result: M.target.result });
|
|
2127
2136
|
}, R.onerror = me(A)) : (P = 0, D = !N && "openKeyCursor" in $ ? $.openKeyCursor(x) : $.openCursor(x), I = [], D.onsuccess = function(M) {
|
|
2128
2137
|
var F = D.result;
|
|
2129
|
-
return F ? (I.push(N ? F.value : F.primaryKey), ++P === C ?
|
|
2138
|
+
return F ? (I.push(N ? F.value : F.primaryKey), ++P === C ? v({ result: I }) : void F.continue()) : v({ result: I });
|
|
2130
2139
|
}, D.onerror = me(A));
|
|
2131
2140
|
});
|
|
2132
2141
|
}), openCursor: function(S) {
|
|
2133
|
-
var
|
|
2142
|
+
var v = S.trans, A = S.values, P = S.query, D = S.reverse, I = S.unique;
|
|
2134
2143
|
return new Promise(function(N, C) {
|
|
2135
2144
|
N = Z(N);
|
|
2136
|
-
var $ = P.index, R = P.range, T =
|
|
2145
|
+
var $ = P.index, R = P.range, T = v.objectStore(E), T = $.isPrimaryKey ? T : T.index($.name), $ = D ? I ? "prevunique" : "prev" : I ? "nextunique" : "next", x = !A && "openKeyCursor" in T ? T.openKeyCursor(a(R), $) : T.openCursor(a(R), $);
|
|
2137
2146
|
x.onerror = me(C), x.onsuccess = Z(function(M) {
|
|
2138
2147
|
var F, U, z, de, W = x.result;
|
|
2139
2148
|
W ? (W.___id = ++la, W.done = !1, F = W.continue.bind(W), U = (U = W.continuePrimaryKey) && U.bind(W), z = W.advance.bind(W), de = function() {
|
|
2140
2149
|
throw new Error("Cursor not stopped");
|
|
2141
|
-
}, W.trans =
|
|
2150
|
+
}, W.trans = v, W.stop = W.continue = W.continuePrimaryKey = W.advance = function() {
|
|
2142
2151
|
throw new Error("Cursor not started");
|
|
2143
2152
|
}, W.fail = Z(C), W.next = function() {
|
|
2144
2153
|
var se = this, oe = 1;
|
|
@@ -2170,7 +2179,7 @@ function Ma() {
|
|
|
2170
2179
|
}, C);
|
|
2171
2180
|
});
|
|
2172
2181
|
}, count: function(S) {
|
|
2173
|
-
var
|
|
2182
|
+
var v = S.query, A = S.trans, P = v.index, D = v.range;
|
|
2174
2183
|
return new Promise(function(I, N) {
|
|
2175
2184
|
var C = A.objectStore(E), R = P.isPrimaryKey ? C : C.index(P.name), C = a(D), R = C ? R.count(C) : R.count();
|
|
2176
2185
|
R.onsuccess = Z(function(T) {
|
|
@@ -2182,7 +2191,7 @@ function Ma() {
|
|
|
2182
2191
|
var i, u, d, w = (u = p, d = br((i = e).objectStoreNames), { schema: { name: i.name, tables: d.map(function(O) {
|
|
2183
2192
|
return u.objectStore(O);
|
|
2184
2193
|
}).map(function(O) {
|
|
2185
|
-
var m = O.keyPath,
|
|
2194
|
+
var m = O.keyPath, v = O.autoIncrement, E = K(m), S = {}, v = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: m == null, compound: E, keyPath: m, autoIncrement: v, unique: !0, extractKey: _n(m) }, indexes: br(O.indexNames).map(function(A) {
|
|
2186
2195
|
return O.index(A);
|
|
2187
2196
|
}).map(function(I) {
|
|
2188
2197
|
var P = I.name, D = I.unique, N = I.multiEntry, I = I.keyPath, N = { name: P, compound: K(I), keyPath: I, unique: D, multiEntry: N, extractKey: _n(I) };
|
|
@@ -2190,7 +2199,7 @@ function Ma() {
|
|
|
2190
2199
|
}), getIndexByKeyPath: function(A) {
|
|
2191
2200
|
return S[vt(A)];
|
|
2192
2201
|
} };
|
|
2193
|
-
return S[":id"] =
|
|
2202
|
+
return S[":id"] = v.primaryKey, m != null && (S[vt(m)] = v.primaryKey), v;
|
|
2194
2203
|
}) }, hasGetAll: 0 < d.length && "getAll" in u.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), p = w.schema, y = w.hasGetAll, w = p.tables.map(s), f = {};
|
|
2195
2204
|
return w.forEach(function(O) {
|
|
2196
2205
|
return f[O.name] = O;
|
|
@@ -2247,12 +2256,12 @@ function Ma() {
|
|
|
2247
2256
|
return B.trans = i, B.transless = d, n !== 0 ? (Lt(e, r), y = n, ((p = i).storeNames.includes("$meta") ? p.table("$meta").get("version").then(function(w) {
|
|
2248
2257
|
return w ?? y;
|
|
2249
2258
|
}) : j.resolve(y)).then(function(w) {
|
|
2250
|
-
return O = w, m = i, E = r, S = [], w = (f = e)._versions,
|
|
2259
|
+
return O = w, m = i, E = r, S = [], w = (f = e)._versions, v = f._dbSchema = Ut(0, f.idbdb, E), (w = w.filter(function(A) {
|
|
2251
2260
|
return A._cfg.version >= O;
|
|
2252
2261
|
})).length !== 0 ? (w.forEach(function(A) {
|
|
2253
2262
|
S.push(function() {
|
|
2254
|
-
var P =
|
|
2255
|
-
zt(f, P, E), zt(f, D, E),
|
|
2263
|
+
var P = v, D = A._cfg.dbschema;
|
|
2264
|
+
zt(f, P, E), zt(f, D, E), v = f._dbSchema = D;
|
|
2256
2265
|
var I = Pn(P, D);
|
|
2257
2266
|
I.add.forEach(function($) {
|
|
2258
2267
|
Dn(E, $[0], $[1].primKey, $[1].indexes);
|
|
@@ -2295,9 +2304,9 @@ function Ma() {
|
|
|
2295
2304
|
}), function A() {
|
|
2296
2305
|
return S.length ? j.resolve(S.shift()(m.idbtrans)).then(A) : j.resolve();
|
|
2297
2306
|
}().then(function() {
|
|
2298
|
-
vr(
|
|
2307
|
+
vr(v, E);
|
|
2299
2308
|
})) : j.resolve();
|
|
2300
|
-
var f, O, m, E, S,
|
|
2309
|
+
var f, O, m, E, S, v;
|
|
2301
2310
|
}).catch(u)) : (k(s).forEach(function(w) {
|
|
2302
2311
|
Dn(r, w, s[w].primKey, s[w].indexes);
|
|
2303
2312
|
}), Lt(e, r), void j.follow(function() {
|
|
@@ -2375,7 +2384,7 @@ function Ma() {
|
|
|
2375
2384
|
!n[i] || (y = n[i].idxByName[w]) && (y.name = p, delete n[i].idxByName[w], n[i].idxByName[p] = y);
|
|
2376
2385
|
}
|
|
2377
2386
|
}
|
|
2378
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
2387
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && b.WorkerGlobalScope && b instanceof b.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2379
2388
|
}
|
|
2380
2389
|
function Er(e) {
|
|
2381
2390
|
return e.split(",").map(function(n, r) {
|
|
@@ -2533,8 +2542,8 @@ function Ma() {
|
|
|
2533
2542
|
for (var s = [], i = 0, u = Object.entries(e.queries.query); i < u.length; i++) {
|
|
2534
2543
|
for (var d = u[i], p = d[0], y = [], w = 0, f = d[1]; w < f.length; w++) {
|
|
2535
2544
|
var O = f[w];
|
|
2536
|
-
xn(n, O.obsSet) ? O.subscribers.forEach(function(
|
|
2537
|
-
return r.add(
|
|
2545
|
+
xn(n, O.obsSet) ? O.subscribers.forEach(function(v) {
|
|
2546
|
+
return r.add(v);
|
|
2538
2547
|
}) : a && y.push(O);
|
|
2539
2548
|
}
|
|
2540
2549
|
a && s.push([p, y]);
|
|
@@ -2559,17 +2568,17 @@ function Ma() {
|
|
|
2559
2568
|
if (u(), !r) throw new L.MissingAPI();
|
|
2560
2569
|
var E = e.name, S = n.autoSchema || !s ? r.open(E) : r.open(E, s);
|
|
2561
2570
|
if (!S) throw new L.MissingAPI();
|
|
2562
|
-
S.onerror = me(m), S.onblocked = Z(e._fireOnBlocked), S.onupgradeneeded = Z(function(
|
|
2571
|
+
S.onerror = me(m), S.onblocked = Z(e._fireOnBlocked), S.onupgradeneeded = Z(function(v) {
|
|
2563
2572
|
var A;
|
|
2564
2573
|
w = S.transaction, n.autoSchema && !e._options.allowEmptyDB ? (S.onerror = mt, w.abort(), S.result.close(), (A = r.deleteDatabase(E)).onsuccess = A.onerror = Z(function() {
|
|
2565
2574
|
m(new L.NoSuchDatabase("Database ".concat(E, " doesnt exist")));
|
|
2566
|
-
})) : (w.onerror = me(m),
|
|
2575
|
+
})) : (w.onerror = me(m), v = v.oldVersion > Math.pow(2, 62) ? 0 : v.oldVersion, f = v < 1, e.idbdb = S.result, i && pa(e, w), ga(e, v / 10, w, m));
|
|
2567
2576
|
}, m), S.onsuccess = Z(function() {
|
|
2568
2577
|
w = null;
|
|
2569
|
-
var
|
|
2578
|
+
var v, A, P, D, I, N = e.idbdb = S.result, C = At(N.objectStoreNames);
|
|
2570
2579
|
if (0 < C.length) try {
|
|
2571
2580
|
var R = N.transaction((D = C).length === 1 ? D[0] : D, "readonly");
|
|
2572
|
-
if (n.autoSchema) A = N, P = R, (
|
|
2581
|
+
if (n.autoSchema) A = N, P = R, (v = e).verno = A.version / 10, P = v._dbSchema = Ut(0, A, P), v._storeNames = At(A.objectStoreNames, 0), Wt(v, [v._allTables], k(P), P);
|
|
2573
2582
|
else if (zt(e, e._dbSchema, R), ((I = Pn(Ut(0, (I = e).idbdb, R), I._dbSchema)).add.length || I.change.some(function(T) {
|
|
2574
2583
|
return T.add.length || T.change.length;
|
|
2575
2584
|
})) && !i) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), N.close(), s = N.version + 1, i = !0, O(d());
|
|
@@ -2655,8 +2664,8 @@ function Ma() {
|
|
|
2655
2664
|
return l(l({}, e), { table: function(n) {
|
|
2656
2665
|
var r = e.table(n), a = r.schema, s = {}, i = [];
|
|
2657
2666
|
function u(f, O, m) {
|
|
2658
|
-
var E = vt(f), S = s[E] = s[E] || [],
|
|
2659
|
-
return S.push(A), A.isPrimaryKey || i.push(A), 1 <
|
|
2667
|
+
var E = vt(f), S = s[E] = s[E] || [], v = f == null ? 0 : typeof f == "string" ? 1 : f.length, A = 0 < O, A = l(l({}, m), { name: A ? "".concat(E, "(virtual-from:").concat(m.name, ")") : m.name, lowLevelIndex: m, isVirtual: A, keyTail: O, keyLength: v, extractKey: _n(f), unique: !A && m.unique });
|
|
2668
|
+
return S.push(A), A.isPrimaryKey || i.push(A), 1 < v && u(v === 2 ? f[0] : f.slice(0, v - 1), O + 1, m), S.sort(function(P, D) {
|
|
2660
2669
|
return P.keyTail - D.keyTail;
|
|
2661
2670
|
}), A;
|
|
2662
2671
|
}
|
|
@@ -2678,9 +2687,9 @@ function Ma() {
|
|
|
2678
2687
|
}, openCursor: function(f) {
|
|
2679
2688
|
var O = f.query.index, m = O.keyTail, E = O.isVirtual, S = O.keyLength;
|
|
2680
2689
|
return E ? r.openCursor(w(f)).then(function(A) {
|
|
2681
|
-
return A &&
|
|
2690
|
+
return A && v(A);
|
|
2682
2691
|
}) : r.openCursor(f);
|
|
2683
|
-
function
|
|
2692
|
+
function v(A) {
|
|
2684
2693
|
return Object.create(A, { continue: { value: function(P) {
|
|
2685
2694
|
P != null ? A.continue(Xt(P, f.reverse ? e.MAX_KEY : e.MIN_KEY, m)) : f.unique ? A.continue(A.key.slice(0, S).concat(f.reverse ? e.MIN_KEY : e.MAX_KEY, m)) : A.continue();
|
|
2686
2695
|
} }, continuePrimaryKey: { value: function(P, D) {
|
|
@@ -2734,9 +2743,9 @@ function Ma() {
|
|
|
2734
2743
|
return i._promise("readwrite", function() {
|
|
2735
2744
|
return function f(O, m, E) {
|
|
2736
2745
|
return r.query({ trans: O, values: !1, query: { index: a, range: m }, limit: E }).then(function(S) {
|
|
2737
|
-
var
|
|
2738
|
-
return w({ type: "delete", keys:
|
|
2739
|
-
return 0 < A.numFailures ? Promise.reject(A.failures[0]) :
|
|
2746
|
+
var v = S.result;
|
|
2747
|
+
return w({ type: "delete", keys: v, trans: O }).then(function(A) {
|
|
2748
|
+
return 0 < A.numFailures ? Promise.reject(A.failures[0]) : v.length < E ? { failures: [], numFailures: 0, lastResult: void 0 } : f(O, l(l({}, m), { lower: v[v.length - 1], lowerOpen: !0 }), E);
|
|
2740
2749
|
});
|
|
2741
2750
|
});
|
|
2742
2751
|
}(s.trans, s.range, 1e4);
|
|
@@ -2744,18 +2753,18 @@ function Ma() {
|
|
|
2744
2753
|
}
|
|
2745
2754
|
return r.mutate(s);
|
|
2746
2755
|
function w(f) {
|
|
2747
|
-
var O, m, E, S = B.trans,
|
|
2748
|
-
if (!
|
|
2749
|
-
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys:
|
|
2750
|
-
var P =
|
|
2756
|
+
var O, m, E, S = B.trans, v = f.keys || Gn(a, f);
|
|
2757
|
+
if (!v) throw new Error("Keys missing");
|
|
2758
|
+
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys: v }) : l({}, f)).type !== "delete" && (f.values = g([], f.values)), f.keys && (f.keys = g([], f.keys)), O = r, E = v, ((m = f).type === "add" ? Promise.resolve([]) : O.getMany({ trans: m.trans, keys: E, cache: "immutable" })).then(function(A) {
|
|
2759
|
+
var P = v.map(function(D, I) {
|
|
2751
2760
|
var N, C, R, T = A[I], $ = { onerror: null, onsuccess: null };
|
|
2752
2761
|
return f.type === "delete" ? d.fire.call($, D, T, S) : f.type === "add" || T === void 0 ? (N = p.fire.call($, D, f.values[I], S), D == null && N != null && (f.keys[I] = D = N, a.outbound || ue(f.values[I], a.keyPath, D))) : (N = Mn(T, f.values[I]), (C = y.fire.call($, N, D, T, S)) && (R = f.values[I], Object.keys(C).forEach(function(x) {
|
|
2753
2762
|
ie(R, x) ? R[x] = C[x] : ue(R, x, C[x]);
|
|
2754
2763
|
}))), $;
|
|
2755
2764
|
});
|
|
2756
2765
|
return r.mutate(f).then(function(D) {
|
|
2757
|
-
for (var I = D.failures, N = D.results, C = D.numFailures, D = D.lastResult, R = 0; R <
|
|
2758
|
-
var T = (N ||
|
|
2766
|
+
for (var I = D.failures, N = D.results, C = D.numFailures, D = D.lastResult, R = 0; R < v.length; ++R) {
|
|
2767
|
+
var T = (N || v)[R], $ = P[R];
|
|
2759
2768
|
T == null ? $.onerror && $.onerror(I[R]) : $.onsuccess && $.onsuccess(f.type === "put" && A[R] ? f.values[R] : T);
|
|
2760
2769
|
}
|
|
2761
2770
|
return { failures: I, results: N, numFailures: C, lastResult: D };
|
|
@@ -2818,10 +2827,10 @@ function Ma() {
|
|
|
2818
2827
|
function E(x) {
|
|
2819
2828
|
return x = "idb://".concat(n, "/").concat(a, "/").concat(x), D[x] || (D[x] = new ae());
|
|
2820
2829
|
}
|
|
2821
|
-
var S,
|
|
2830
|
+
var S, v, A, P = m.trans, D = m.mutatedParts || (m.mutatedParts = {}), I = E(""), N = E(":dels"), C = m.type, $ = m.type === "deleteRange" ? [m.range] : m.type === "delete" ? [m.keys] : m.values.length < 50 ? [Gn(u, m).filter(function(x) {
|
|
2822
2831
|
return x;
|
|
2823
2832
|
}), m.values] : [], R = $[0], T = $[1], $ = m.trans._cache;
|
|
2824
|
-
return K(R) ? (I.addKeys(R), ($ = C === "delete" || R.length === T.length ? Ar(R, $) : null) || N.addKeys(R), ($ || T) && (S = E,
|
|
2833
|
+
return K(R) ? (I.addKeys(R), ($ = C === "delete" || R.length === T.length ? Ar(R, $) : null) || N.addKeys(R), ($ || T) && (S = E, v = $, A = T, i.indexes.forEach(function(x) {
|
|
2825
2834
|
var M = S(x.name || "");
|
|
2826
2835
|
function F(z) {
|
|
2827
2836
|
return z != null ? x.extractKey(z) : null;
|
|
@@ -2831,8 +2840,8 @@ function Ma() {
|
|
|
2831
2840
|
return M.addKey(de);
|
|
2832
2841
|
}) : M.addKey(z);
|
|
2833
2842
|
}
|
|
2834
|
-
(
|
|
2835
|
-
var W =
|
|
2843
|
+
(v || A).forEach(function(z, se) {
|
|
2844
|
+
var W = v && F(v[se]), se = A && F(A[se]);
|
|
2836
2845
|
H(W, se) !== 0 && (W != null && U(W), se != null && U(se));
|
|
2837
2846
|
});
|
|
2838
2847
|
}))) : R ? (T = { from: (T = R.lower) !== null && T !== void 0 ? T : e.MIN_KEY, to: (T = R.upper) !== null && T !== void 0 ? T : e.MAX_KEY }, N.add(T), I.add(T)) : (I.add(r), N.add(r), i.indexes.forEach(function(x) {
|
|
@@ -2857,12 +2866,12 @@ function Ma() {
|
|
|
2857
2866
|
}, count: f, query: f, openCursor: f };
|
|
2858
2867
|
return k(O).forEach(function(m) {
|
|
2859
2868
|
w[m] = function(E) {
|
|
2860
|
-
var S = B.subscr,
|
|
2861
|
-
if (
|
|
2869
|
+
var S = B.subscr, v = !!S, A = Pr(B, s) && Dr(m, E) ? E.obsSet = {} : S;
|
|
2870
|
+
if (v) {
|
|
2862
2871
|
var P = function(T) {
|
|
2863
2872
|
return T = "idb://".concat(n, "/").concat(a, "/").concat(T), A[T] || (A[T] = new ae());
|
|
2864
|
-
}, D = P(""), I = P(":dels"), S = O[m](E),
|
|
2865
|
-
if ((m === "query" &&
|
|
2873
|
+
}, D = P(""), I = P(":dels"), S = O[m](E), v = S[0], S = S[1];
|
|
2874
|
+
if ((m === "query" && v.isPrimaryKey && !E.values ? I : P(v.name || "")).add(S), !v.isPrimaryKey) {
|
|
2866
2875
|
if (m !== "count") {
|
|
2867
2876
|
var N = m === "query" && p && E.values && s.query(l(l({}, E), { values: !1 }));
|
|
2868
2877
|
return s[m].apply(this, arguments).then(function(T) {
|
|
@@ -2911,20 +2920,20 @@ function Ma() {
|
|
|
2911
2920
|
function Nr(e, n, O, a, s, i) {
|
|
2912
2921
|
if (!O || O.length === 0) return e;
|
|
2913
2922
|
var u = n.query.index, d = u.multiEntry, p = n.query.range, y = a.schema.primaryKey.extractKey, w = u.extractKey, f = (u.lowLevelIndex || u).extractKey, O = O.reduce(function(m, E) {
|
|
2914
|
-
var S = m,
|
|
2923
|
+
var S = m, v = [];
|
|
2915
2924
|
if (E.type === "add" || E.type === "put") for (var A = new ae(), P = E.values.length - 1; 0 <= P; --P) {
|
|
2916
2925
|
var D, I = E.values[P], N = y(I);
|
|
2917
2926
|
A.hasKey(N) || (D = w(I), (d && K(D) ? D.some(function(x) {
|
|
2918
2927
|
return Kn(x, p);
|
|
2919
|
-
}) : Kn(D, p)) && (A.addKey(N),
|
|
2928
|
+
}) : Kn(D, p)) && (A.addKey(N), v.push(I)));
|
|
2920
2929
|
}
|
|
2921
2930
|
switch (E.type) {
|
|
2922
2931
|
case "add":
|
|
2923
2932
|
var C = new ae().addKeys(n.values ? m.map(function(M) {
|
|
2924
2933
|
return y(M);
|
|
2925
|
-
}) : m), S = m.concat(n.values ?
|
|
2934
|
+
}) : m), S = m.concat(n.values ? v.filter(function(M) {
|
|
2926
2935
|
return M = y(M), !C.hasKey(M) && (C.addKey(M), !0);
|
|
2927
|
-
}) :
|
|
2936
|
+
}) : v.map(function(M) {
|
|
2928
2937
|
return y(M);
|
|
2929
2938
|
}).filter(function(M) {
|
|
2930
2939
|
return !C.hasKey(M) && (C.addKey(M), !0);
|
|
@@ -2936,7 +2945,7 @@ function Ma() {
|
|
|
2936
2945
|
}));
|
|
2937
2946
|
S = m.filter(function(M) {
|
|
2938
2947
|
return !R.hasKey(n.values ? y(M) : M);
|
|
2939
|
-
}).concat(n.values ?
|
|
2948
|
+
}).concat(n.values ? v : v.map(function(M) {
|
|
2940
2949
|
return y(M);
|
|
2941
2950
|
}));
|
|
2942
2951
|
break;
|
|
@@ -3003,7 +3012,7 @@ function Ma() {
|
|
|
3003
3012
|
var E = e.table(O), S = m.optimisticOps.filter(function(M) {
|
|
3004
3013
|
return M.trans === d;
|
|
3005
3014
|
});
|
|
3006
|
-
if (d._explicit && p && d.mutatedParts) for (var
|
|
3015
|
+
if (d._explicit && p && d.mutatedParts) for (var v = 0, A = Object.values(m.queries.query); v < A.length; v++) for (var P = 0, D = (C = A[v]).slice(); P < D.length; P++) xn((R = D[P]).obsSet, d.mutatedParts) && (je(C, R), R.subscribers.forEach(function(M) {
|
|
3007
3016
|
return y.add(M);
|
|
3008
3017
|
}));
|
|
3009
3018
|
else if (0 < S.length) {
|
|
@@ -3047,13 +3056,13 @@ function Ma() {
|
|
|
3047
3056
|
}), u) : a.mutate(i);
|
|
3048
3057
|
}, query: function(i) {
|
|
3049
3058
|
if (!Pr(B, a) || !Dr("query", i)) return a.query(i);
|
|
3050
|
-
var u = ((y = B.trans) === null || y === void 0 ? void 0 : y.db._options.cache) === "immutable", f = B, d = f.requery, p = f.signal, y = function(E, S,
|
|
3059
|
+
var u = ((y = B.trans) === null || y === void 0 ? void 0 : y.db._options.cache) === "immutable", f = B, d = f.requery, p = f.signal, y = function(E, S, v, A) {
|
|
3051
3060
|
var P = ze["idb://".concat(E, "/").concat(S)];
|
|
3052
3061
|
if (!P) return [];
|
|
3053
|
-
if (!(S = P.queries[
|
|
3062
|
+
if (!(S = P.queries[v])) return [null, !1, P, null];
|
|
3054
3063
|
var D = S[(A.query ? A.query.index.name : null) || ""];
|
|
3055
3064
|
if (!D) return [null, !1, P, null];
|
|
3056
|
-
switch (
|
|
3065
|
+
switch (v) {
|
|
3057
3066
|
case "query":
|
|
3058
3067
|
var I = D.find(function(N) {
|
|
3059
3068
|
return N.req.limit === A.limit && N.req.values === A.values && Rr(N.req.query.range, A.query.range);
|
|
@@ -3070,7 +3079,7 @@ function Ma() {
|
|
|
3070
3079
|
return w && f ? w.obsSet = i.obsSet : (f = a.query(i).then(function(E) {
|
|
3071
3080
|
var S = E.result;
|
|
3072
3081
|
if (w && (w.res = S), u) {
|
|
3073
|
-
for (var
|
|
3082
|
+
for (var v = 0, A = S.length; v < A; ++v) Object.freeze(S[v]);
|
|
3074
3083
|
Object.freeze(S);
|
|
3075
3084
|
} else E.result = $e(S);
|
|
3076
3085
|
return E;
|
|
@@ -3210,10 +3219,10 @@ function Ma() {
|
|
|
3210
3219
|
}
|
|
3211
3220
|
var p = function y(w, f, O, m, E) {
|
|
3212
3221
|
return j.resolve().then(function() {
|
|
3213
|
-
var S = B.transless || B,
|
|
3214
|
-
if (
|
|
3222
|
+
var S = B.transless || B, v = w._createTransaction(f, O, w._dbSchema, m);
|
|
3223
|
+
if (v.explicit = !0, S = { trans: v, transless: S }, m) v.idbtrans = m.idbtrans;
|
|
3215
3224
|
else try {
|
|
3216
|
-
|
|
3225
|
+
v.create(), v.idbtrans._explicit = !0, w._state.PR1398_maxLoop = 3;
|
|
3217
3226
|
} catch (D) {
|
|
3218
3227
|
return D.name === sn.InvalidState && w.isOpen() && 0 < --w._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), w.close({ disableAutoOpen: !1 }), w.open().then(function() {
|
|
3219
3228
|
return y(w, f, O, null, E);
|
|
@@ -3222,17 +3231,17 @@ function Ma() {
|
|
|
3222
3231
|
var A, P = an(E);
|
|
3223
3232
|
return P && et(), S = j.follow(function() {
|
|
3224
3233
|
var D;
|
|
3225
|
-
(A = E.call(
|
|
3234
|
+
(A = E.call(v, v)) && (P ? (D = Ie.bind(null, null), A.then(D, D)) : typeof A.next == "function" && typeof A.throw == "function" && (A = jn(A)));
|
|
3226
3235
|
}, S), (A && typeof A.then == "function" ? j.resolve(A).then(function(D) {
|
|
3227
|
-
return
|
|
3236
|
+
return v.active ? D : q(new L.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3228
3237
|
}) : S.then(function() {
|
|
3229
3238
|
return A;
|
|
3230
3239
|
})).then(function(D) {
|
|
3231
|
-
return m &&
|
|
3240
|
+
return m && v._resolve(), v._completion.then(function() {
|
|
3232
3241
|
return D;
|
|
3233
3242
|
});
|
|
3234
3243
|
}).catch(function(D) {
|
|
3235
|
-
return
|
|
3244
|
+
return v._reject(D), q(D);
|
|
3236
3245
|
});
|
|
3237
3246
|
});
|
|
3238
3247
|
}.bind(null, this, i, u, s, r);
|
|
@@ -3257,32 +3266,32 @@ function Ma() {
|
|
|
3257
3266
|
return function(O, m) {
|
|
3258
3267
|
ee.vip(function() {
|
|
3259
3268
|
var E, S = r._state;
|
|
3260
|
-
S.openComplete ? (S.dbOpenError || j.resolve().then(O), m && f(O)) : S.onReadyBeingFired ? (S.onReadyBeingFired.push(O), m && f(O)) : (f(O), E = r, m || f(function
|
|
3261
|
-
E.on.ready.unsubscribe(O), E.on.ready.unsubscribe(
|
|
3269
|
+
S.openComplete ? (S.dbOpenError || j.resolve().then(O), m && f(O)) : S.onReadyBeingFired ? (S.onReadyBeingFired.push(O), m && f(O)) : (f(O), E = r, m || f(function v() {
|
|
3270
|
+
E.on.ready.unsubscribe(O), E.on.ready.unsubscribe(v);
|
|
3262
3271
|
}));
|
|
3263
3272
|
});
|
|
3264
3273
|
};
|
|
3265
|
-
}), this.Collection = (s = this, gt(oa.prototype, function(A,
|
|
3274
|
+
}), this.Collection = (s = this, gt(oa.prototype, function(A, v) {
|
|
3266
3275
|
this.db = s;
|
|
3267
3276
|
var m = ir, E = null;
|
|
3268
|
-
if (
|
|
3269
|
-
m =
|
|
3277
|
+
if (v) try {
|
|
3278
|
+
m = v();
|
|
3270
3279
|
} catch (P) {
|
|
3271
3280
|
E = P;
|
|
3272
3281
|
}
|
|
3273
|
-
var S = A._ctx,
|
|
3274
|
-
this._ctx = { table:
|
|
3282
|
+
var S = A._ctx, v = S.table, A = v.hook.reading.fire;
|
|
3283
|
+
this._ctx = { table: v, index: S.index, isPrimKey: !S.index || v.schema.primKey.keyPath && S.index === v.schema.primKey.name, range: m, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: E, or: S.or, valueMapper: A !== ct ? A : null };
|
|
3275
3284
|
})), this.Table = (i = this, gt(dr.prototype, function(f, O, m) {
|
|
3276
3285
|
this.db = i, this._tx = m, this.name = f, this.schema = O, this.hook = i._allTables[f] ? i._allTables[f].hook : ht(null, { creating: [Jr, Q], reading: [Xr, ct], updating: [qr, Q], deleting: [Zr, Q] });
|
|
3277
3286
|
})), this.Transaction = (u = this, gt(ua.prototype, function(f, O, m, E, S) {
|
|
3278
|
-
var
|
|
3287
|
+
var v = this;
|
|
3279
3288
|
this.db = u, this.mode = f, this.storeNames = O, this.schema = m, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = ht(this, "complete", "error", "abort"), this.parent = S || 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 j(function(A, P) {
|
|
3280
|
-
|
|
3289
|
+
v._resolve = A, v._reject = P;
|
|
3281
3290
|
}), this._completion.then(function() {
|
|
3282
|
-
|
|
3291
|
+
v.active = !1, v.on.complete.fire();
|
|
3283
3292
|
}, function(A) {
|
|
3284
|
-
var P =
|
|
3285
|
-
return
|
|
3293
|
+
var P = v.active;
|
|
3294
|
+
return v.active = !1, v.on.error.fire(A), v.parent ? v.parent._reject(A) : P && v.idbtrans && v.idbtrans.abort(), q(A);
|
|
3286
3295
|
});
|
|
3287
3296
|
})), this.Version = (d = this, gt(ma.prototype, function(f) {
|
|
3288
3297
|
this.db = d, this._cfg = { version: f, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
@@ -3332,7 +3341,7 @@ function Ma() {
|
|
|
3332
3341
|
this._subscribe = e;
|
|
3333
3342
|
}
|
|
3334
3343
|
try {
|
|
3335
|
-
Zt = { indexedDB:
|
|
3344
|
+
Zt = { indexedDB: b.indexedDB || b.mozIndexedDB || b.webkitIndexedDB || b.msIndexedDB, IDBKeyRange: b.IDBKeyRange || b.webkitIDBKeyRange };
|
|
3336
3345
|
} catch {
|
|
3337
3346
|
Zt = { indexedDB: null, IDBKeyRange: null };
|
|
3338
3347
|
}
|
|
@@ -3349,7 +3358,7 @@ function Ma() {
|
|
|
3349
3358
|
}, m = function(S) {
|
|
3350
3359
|
Yt(p, S), xn(y, p) && O();
|
|
3351
3360
|
}, E = function() {
|
|
3352
|
-
var S,
|
|
3361
|
+
var S, v, A;
|
|
3353
3362
|
!d && Zt.indexedDB && (p = {}, S = {}, u && u.abort(), u = new AbortController(), A = function(P) {
|
|
3354
3363
|
var D = Ze();
|
|
3355
3364
|
try {
|
|
@@ -3359,8 +3368,8 @@ function Ma() {
|
|
|
3359
3368
|
} finally {
|
|
3360
3369
|
D && qe();
|
|
3361
3370
|
}
|
|
3362
|
-
}(
|
|
3363
|
-
r = !0, n = P, d ||
|
|
3371
|
+
}(v = { subscr: S, signal: u.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(P) {
|
|
3372
|
+
r = !0, n = P, d || v.signal.aborted || (p = {}, function(D) {
|
|
3364
3373
|
for (var I in D) if (ie(D, I)) return;
|
|
3365
3374
|
return 1;
|
|
3366
3375
|
}(y = S) || f || (Te(yt, m), f = !0), pn(function() {
|
|
@@ -3594,7 +3603,7 @@ class Mr {
|
|
|
3594
3603
|
} : (o.message = `Dashboard ${t.id} retrieved from storage`, o.success = !0, o);
|
|
3595
3604
|
};
|
|
3596
3605
|
getDashboards = async (t) => {
|
|
3597
|
-
const o = (
|
|
3606
|
+
const o = (b) => t?.id === b.id, l = (b) => t?.name ? b.name.includes(t?.name) : !1, g = await this.db.table(_.DASHBOARD).toArray().then((b) => t?.id ? b.filter(o) : b).then((b) => t?.name ? b.filter(l) : b).catch(() => {
|
|
3598
3607
|
G(2, ["%cstorage", c.STORAGE, X.DASHBOARD_LOAD, t]);
|
|
3599
3608
|
});
|
|
3600
3609
|
return g !== void 0 && G(3, [
|
|
@@ -3636,21 +3645,21 @@ class Mr {
|
|
|
3636
3645
|
* Wipe Message data after expires timestamp
|
|
3637
3646
|
*/
|
|
3638
3647
|
cleanMessages = async () => {
|
|
3639
|
-
const t = Date.now() / 1e3, o = (
|
|
3640
|
-
return await this.db.table(_.TOPICS).orderBy("expires").filter(o).delete().catch((
|
|
3648
|
+
const t = Date.now() / 1e3, o = (b) => b.expires < t, l = (b) => b.expires < t;
|
|
3649
|
+
return await this.db.table(_.TOPICS).orderBy("expires").filter(o).delete().catch((b) => (console.error(
|
|
3641
3650
|
"%cstorage%c %cclean",
|
|
3642
3651
|
c.STORAGE,
|
|
3643
3652
|
c.NONE,
|
|
3644
3653
|
c.MESSAGES,
|
|
3645
|
-
|
|
3646
|
-
), 0)), await this.db.table(_.MESSAGES).orderBy("expires").filter(l).delete().catch((
|
|
3654
|
+
b.message
|
|
3655
|
+
), 0)), await this.db.table(_.MESSAGES).orderBy("expires").filter(l).delete().catch((b) => (console.error(
|
|
3647
3656
|
"%clean%c %cstorage%c %cmessages",
|
|
3648
3657
|
c.OK,
|
|
3649
3658
|
c.NONE,
|
|
3650
3659
|
c.STORAGE,
|
|
3651
3660
|
c.NONE,
|
|
3652
3661
|
c.MESSAGES,
|
|
3653
|
-
|
|
3662
|
+
b.message
|
|
3654
3663
|
), 0));
|
|
3655
3664
|
};
|
|
3656
3665
|
/**
|
|
@@ -3676,9 +3685,9 @@ class Mr {
|
|
|
3676
3685
|
};
|
|
3677
3686
|
const o = t?.order ?? "utc", l = Math.floor(Date.now() / 1e3);
|
|
3678
3687
|
o !== "utc" && (t.since = l - 60 * 60 * 24 * 30), this.options.delay != 0 ? t.before = l - (this.options.delay || 0) : t.before = l;
|
|
3679
|
-
const g = (K) => K.utc > (t?.since || 0),
|
|
3688
|
+
const g = (K) => K.utc > (t?.since || 0), b = (K) => K.utc < (t?.before || l), k = (K) => K?.visible !== 0;
|
|
3680
3689
|
try {
|
|
3681
|
-
const te = await this.db.table(_.TOPICS).where("widget_id").equals(t.widget).filter(k).filter(g).filter(
|
|
3690
|
+
const te = await this.db.table(_.TOPICS).where("widget_id").equals(t.widget).filter(k).filter(g).filter(b).reverse().limit(t?.limit ?? 25).sortBy(o);
|
|
3682
3691
|
if (te.length === 0)
|
|
3683
3692
|
return {
|
|
3684
3693
|
data: null,
|
|
@@ -3741,18 +3750,18 @@ class Mr {
|
|
|
3741
3750
|
return 400;
|
|
3742
3751
|
const l = o.data.title;
|
|
3743
3752
|
let g = 0;
|
|
3744
|
-
return await o.data.messages.forEach(async (
|
|
3745
|
-
|
|
3746
|
-
message_id:
|
|
3747
|
-
engagement:
|
|
3748
|
-
impressions:
|
|
3749
|
-
reach:
|
|
3750
|
-
sentiment:
|
|
3753
|
+
return await o.data.messages.forEach(async (b) => {
|
|
3754
|
+
b.id !== null && (b.topics[0] = {
|
|
3755
|
+
message_id: b.id,
|
|
3756
|
+
engagement: b.topics[0]?.engagement || b.dynamics?.engagement || 0,
|
|
3757
|
+
impressions: b.topics[0]?.impressions || b.dynamics?.semrush_visits || 0,
|
|
3758
|
+
reach: b.topics[0]?.reach || b.dynamics?.potential_reach || 0,
|
|
3759
|
+
sentiment: b.topics[0]?.sentiment || 0
|
|
3751
3760
|
}, await this.db.table(_.MESSAGES).put({
|
|
3752
|
-
id:
|
|
3753
|
-
utc:
|
|
3754
|
-
data:
|
|
3755
|
-
expires:
|
|
3761
|
+
id: b.id,
|
|
3762
|
+
utc: b.utc,
|
|
3763
|
+
data: b,
|
|
3764
|
+
expires: b.expires
|
|
3756
3765
|
}).catch((k) => {
|
|
3757
3766
|
g++, G(4, [
|
|
3758
3767
|
"%cset%c %cstorage",
|
|
@@ -3761,20 +3770,20 @@ class Mr {
|
|
|
3761
3770
|
c.STORAGE,
|
|
3762
3771
|
"set message",
|
|
3763
3772
|
`title: ${l}`,
|
|
3764
|
-
|
|
3773
|
+
b,
|
|
3765
3774
|
k.message
|
|
3766
3775
|
]);
|
|
3767
3776
|
}), await this.db.table(_.TOPICS).put({
|
|
3768
3777
|
title: l,
|
|
3769
3778
|
widget_id: t.widget,
|
|
3770
|
-
message_id:
|
|
3779
|
+
message_id: b.id,
|
|
3771
3780
|
dashboard_id: t.dashboard,
|
|
3772
|
-
engagement:
|
|
3773
|
-
impressions:
|
|
3774
|
-
reach:
|
|
3775
|
-
sentiment:
|
|
3776
|
-
utc:
|
|
3777
|
-
expires:
|
|
3781
|
+
engagement: b.topics[0]?.engagement || b.dynamics?.engagement || 0,
|
|
3782
|
+
impressions: b.topics[0]?.impressions || b.dynamics?.semrush_visits || 0,
|
|
3783
|
+
reach: b.topics[0]?.reach || b.dynamics?.potential_reach || 0,
|
|
3784
|
+
sentiment: b.topics[0]?.sentiment || 0,
|
|
3785
|
+
utc: b.utc,
|
|
3786
|
+
expires: b.expires
|
|
3778
3787
|
}).catch((k) => {
|
|
3779
3788
|
g++, G(4, [
|
|
3780
3789
|
"%cset%c %cstorage",
|
|
@@ -3783,7 +3792,7 @@ class Mr {
|
|
|
3783
3792
|
c.STORAGE,
|
|
3784
3793
|
"set topic",
|
|
3785
3794
|
`title: ${l}`,
|
|
3786
|
-
|
|
3795
|
+
b,
|
|
3787
3796
|
k.message
|
|
3788
3797
|
]);
|
|
3789
3798
|
}), await o.data.topics.forEach(async (k) => {
|
|
@@ -3907,10 +3916,10 @@ class Mr {
|
|
|
3907
3916
|
* @returns IResponse
|
|
3908
3917
|
*/
|
|
3909
3918
|
getWidgets = async (t) => {
|
|
3910
|
-
const o = (k) => t?.dashboard === k.dashboard_id, l = (k) => t?.type === k.type, g = (k) => t?.name ? k.name.includes(t?.name) : !1,
|
|
3919
|
+
const o = (k) => t?.dashboard === k.dashboard_id, l = (k) => t?.type === k.type, g = (k) => t?.name ? k.name.includes(t?.name) : !1, b = await this.db.table(_.WIDGET).toArray().then((k) => t?.dashboard ? k.filter(o) : k).then((k) => t?.type ? k.filter(l) : k).then((k) => t?.name ? k.filter(g) : k).catch(() => {
|
|
3911
3920
|
G(2, ["%cstorage", c.STORAGE, X.WIDGET_LOAD, t]);
|
|
3912
3921
|
});
|
|
3913
|
-
return
|
|
3922
|
+
return b !== void 0 && G(3, [
|
|
3914
3923
|
"%cstorage%c %cwidgets",
|
|
3915
3924
|
c.STORAGE,
|
|
3916
3925
|
c.NONE,
|
|
@@ -3918,9 +3927,9 @@ class Mr {
|
|
|
3918
3927
|
t
|
|
3919
3928
|
]), {
|
|
3920
3929
|
// @ts-ignore
|
|
3921
|
-
data:
|
|
3922
|
-
message:
|
|
3923
|
-
success:
|
|
3930
|
+
data: b !== void 0 ? { data: b, query: t } : null,
|
|
3931
|
+
message: b !== void 0 ? "Widgets loaded from storage" : "Widgets load error",
|
|
3932
|
+
success: b !== void 0
|
|
3924
3933
|
};
|
|
3925
3934
|
};
|
|
3926
3935
|
/**
|
|
@@ -3997,12 +4006,12 @@ class Mr {
|
|
|
3997
4006
|
* @returns IResponse
|
|
3998
4007
|
*/
|
|
3999
4008
|
getSlides = async (t) => {
|
|
4000
|
-
const o = (k) => t?.id ? t.id = k.id : !1, l = (k) => t?.name ? k.name.includes(t?.name) : !1,
|
|
4001
|
-
return
|
|
4009
|
+
const o = (k) => t?.id ? t.id = k.id : !1, l = (k) => t?.name ? k.name.includes(t?.name) : !1, b = await this.db.table(_.SLIDE).toArray().then((k) => t?.id ? k.filter(o) : k).then((k) => t?.name ? k.filter(l) : k);
|
|
4010
|
+
return b !== void 0 && G(3, ["%cstorage%c %cslides", c.STORAGE, c.NONE, c.SLIDE, t]), {
|
|
4002
4011
|
// @ts-ignore
|
|
4003
|
-
data:
|
|
4004
|
-
message:
|
|
4005
|
-
success:
|
|
4012
|
+
data: b !== void 0 ? { slides: b, query: t } : null,
|
|
4013
|
+
message: b !== void 0 ? "Slides loaded from storage" : "Slides load error",
|
|
4014
|
+
success: b !== void 0
|
|
4006
4015
|
};
|
|
4007
4016
|
};
|
|
4008
4017
|
/**
|
|
@@ -4059,7 +4068,7 @@ class Mr {
|
|
|
4059
4068
|
* @returns IResponse
|
|
4060
4069
|
*/
|
|
4061
4070
|
getPresentations = async (t) => {
|
|
4062
|
-
const o = (
|
|
4071
|
+
const o = (b) => t?.name ? b.name.includes(t?.name) : !1, g = await this.db.table(_.PRESENTATION).toArray().then((b) => t?.name ? b.filter(o) : b);
|
|
4063
4072
|
return g !== void 0 && G(3, [
|
|
4064
4073
|
"%cstorage%c %cpresentations",
|
|
4065
4074
|
c.STORAGE,
|
|
@@ -4127,7 +4136,7 @@ class Mr {
|
|
|
4127
4136
|
* @returns IResponse
|
|
4128
4137
|
*/
|
|
4129
4138
|
getPreferences = async (t) => {
|
|
4130
|
-
const o = (
|
|
4139
|
+
const o = (b) => t?.id ? t.id = b.id : !1, g = await this.db.table(_.SLIDE).toArray().then((b) => t?.id ? b.filter(o) : b);
|
|
4131
4140
|
return g !== void 0 && G(3, [
|
|
4132
4141
|
"%cstorage%c %cpreferences",
|
|
4133
4142
|
c.STORAGE,
|
|
@@ -4170,7 +4179,7 @@ class Mr {
|
|
|
4170
4179
|
* @returns IResponse
|
|
4171
4180
|
*/
|
|
4172
4181
|
getImages = async (t) => {
|
|
4173
|
-
const o = (
|
|
4182
|
+
const o = (b) => t?.id ? b.includes(t.id) : !1, g = await this.db.table(_.IMAGES).toArray().then((b) => t?.id ? b.filter(o) : b);
|
|
4174
4183
|
return g !== void 0 && G(3, [
|
|
4175
4184
|
"%cstorage%c %cimages",
|
|
4176
4185
|
c.STORAGE,
|
|
@@ -4223,12 +4232,12 @@ function Ka(h, t) {
|
|
|
4223
4232
|
if (o)
|
|
4224
4233
|
return o;
|
|
4225
4234
|
const g = indexedDB.open(h);
|
|
4226
|
-
return g.onupgradeneeded = () => g.result.createObjectStore(t), o = Hn(g), o.then((
|
|
4227
|
-
|
|
4235
|
+
return g.onupgradeneeded = () => g.result.createObjectStore(t), o = Hn(g), o.then((b) => {
|
|
4236
|
+
b.onclose = () => o = void 0;
|
|
4228
4237
|
}, () => {
|
|
4229
4238
|
}), o;
|
|
4230
4239
|
};
|
|
4231
|
-
return (g,
|
|
4240
|
+
return (g, b) => l().then((k) => b(k.transaction(t, g).objectStore(t)));
|
|
4232
4241
|
}
|
|
4233
4242
|
let Un;
|
|
4234
4243
|
function Gr() {
|
|
@@ -5597,13 +5606,13 @@ class Ja {
|
|
|
5597
5606
|
let o, l = 400;
|
|
5598
5607
|
if (t.success === !0) {
|
|
5599
5608
|
const g = this.subscribers[t.query.widget];
|
|
5600
|
-
let
|
|
5609
|
+
let b = "";
|
|
5601
5610
|
switch (t.query.type) {
|
|
5602
5611
|
case _.MESSAGES:
|
|
5603
5612
|
let k;
|
|
5604
5613
|
k = t.data.messages.filter(
|
|
5605
5614
|
(K) => K.id !== null
|
|
5606
|
-
), t.data.messages = k,
|
|
5615
|
+
), t.data.messages = k, b = t.data.messages.length > 0 ? Fn(t.data.messages[0].utc) : "none", g?.hash && g.hash === b ? (G(3, [
|
|
5607
5616
|
"%cload%c %cmessages%c %cno updates",
|
|
5608
5617
|
c.OK,
|
|
5609
5618
|
c.NONE,
|
|
@@ -5611,10 +5620,10 @@ class Ja {
|
|
|
5611
5620
|
c.NONE,
|
|
5612
5621
|
c.NO_UPDATES,
|
|
5613
5622
|
t.query.widget
|
|
5614
|
-
]), G(4, ["%cmessages", c.MESSAGES, t]), l = 204) : (o = t, g.hash =
|
|
5623
|
+
]), G(4, ["%cmessages", c.MESSAGES, t]), l = 204) : (o = t, g.hash = b, l = await this.sm?.setMessages(t.query, t).then(async (K) => (K = 201, this.broadcastUpdate(K, t))));
|
|
5615
5624
|
break;
|
|
5616
5625
|
case _.CLOUD:
|
|
5617
|
-
|
|
5626
|
+
b = Fn(t.data.cloud), g?.hash && g.hash === b ? (G(3, [
|
|
5618
5627
|
"%cload%c %ccloud%c %cno updates",
|
|
5619
5628
|
c.OK,
|
|
5620
5629
|
c.NONE,
|
|
@@ -5622,7 +5631,7 @@ class Ja {
|
|
|
5622
5631
|
c.NONE,
|
|
5623
5632
|
c.NO_UPDATES,
|
|
5624
5633
|
t.query.widget
|
|
5625
|
-
]), G(4, ["%ccloud", c.CLOUD, t.query]), l = 204) : (g.hash =
|
|
5634
|
+
]), G(4, ["%ccloud", c.CLOUD, t.query]), l = 204) : (g.hash = b, o = {
|
|
5626
5635
|
data: {
|
|
5627
5636
|
cloud: t.data
|
|
5628
5637
|
},
|
|
@@ -5632,7 +5641,7 @@ class Ja {
|
|
|
5632
5641
|
}, l = await this.sm?.setCloud(t.query, o.data).then((K) => this.broadcastUpdate(K, t)));
|
|
5633
5642
|
break;
|
|
5634
5643
|
case _.SERIES:
|
|
5635
|
-
|
|
5644
|
+
b = Fn(t.data.series), g?.hash && g.hash === b ? (G(3, [
|
|
5636
5645
|
"%cload%c %cseries%c %cno updates",
|
|
5637
5646
|
c.OK,
|
|
5638
5647
|
c.NONE,
|
|
@@ -5640,7 +5649,7 @@ class Ja {
|
|
|
5640
5649
|
c.NONE,
|
|
5641
5650
|
c.NO_UPDATES,
|
|
5642
5651
|
t.query.widget
|
|
5643
|
-
]), G(4, ["%cseries", c.SERIES, t]), l = 204) : (g.hash =
|
|
5652
|
+
]), G(4, ["%cseries", c.SERIES, t]), l = 204) : (g.hash = b, o = {
|
|
5644
5653
|
data: t.data,
|
|
5645
5654
|
message: t.message,
|
|
5646
5655
|
success: t.success,
|
|
@@ -5809,8 +5818,8 @@ class Ja {
|
|
|
5809
5818
|
getDashboards = async (t) => await this.sm?.getDashboards();
|
|
5810
5819
|
setDashboard = async (t) => await this.sm?.setDashboard(t);
|
|
5811
5820
|
loadImages = async (t) => await this.api.loadImages(t);
|
|
5812
|
-
storeImage = async (t) => await this.api.storeImage(
|
|
5813
|
-
deleteImage = async (t) => await this.api.deleteImage(t);
|
|
5821
|
+
storeImage = async (t, o) => await this.api.storeImage(o);
|
|
5822
|
+
deleteImage = async (t, o) => await this.api.deleteImage(t, o);
|
|
5814
5823
|
getImages = async (t) => await this.sm?.getImages(t);
|
|
5815
5824
|
setImage = async (t) => await this.sm?.setImage(t);
|
|
5816
5825
|
}
|
|
@@ -5913,8 +5922,8 @@ class Za {
|
|
|
5913
5922
|
this.element = t, this.callbacks = o, l = typeof l < "u" ? l : "buzzcasting-app";
|
|
5914
5923
|
let g;
|
|
5915
5924
|
g = { ...t.dataset }, delete g.hmr, g.presentation = window.BuzzCasting.getOptions()?.presentation ?? `${l} not found`, this.query = g, Da(t);
|
|
5916
|
-
const
|
|
5917
|
-
this.storageReader = new Ba(
|
|
5925
|
+
const b = window.BuzzCasting.getOptions();
|
|
5926
|
+
this.storageReader = new Ba(b), this.broadcastChannel = new BroadcastChannel(g.presentation), this.broadcastListener();
|
|
5918
5927
|
}
|
|
5919
5928
|
addCallbackListener(t) {
|
|
5920
5929
|
this.callbacks.push(t);
|
|
@@ -5940,8 +5949,8 @@ class Za {
|
|
|
5940
5949
|
c.NONE,
|
|
5941
5950
|
c.WIDGET,
|
|
5942
5951
|
this.query
|
|
5943
|
-
]), this.callbacks.forEach(async (
|
|
5944
|
-
|
|
5952
|
+
]), this.callbacks.forEach(async (b) => {
|
|
5953
|
+
b(g);
|
|
5945
5954
|
}));
|
|
5946
5955
|
}
|
|
5947
5956
|
} catch {
|