memorio 3.0.1 → 3.0.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/README.md +59 -48
- package/docs/README.md +59 -48
- package/docs/markdown/CACHE.md +3 -3
- package/docs/markdown/CHANGELOG.md +63 -154
- package/docs/markdown/DEVTOOLS.md +1 -1
- package/docs/markdown/IDB.md +3 -3
- package/docs/markdown/LOGGER.md +2 -2
- package/docs/markdown/OBSERVER.md +4 -4
- package/docs/markdown/PLATFORM.md +5 -5
- package/docs/markdown/SECURITY.md +16 -4
- package/docs/markdown/SESSION.md +4 -4
- package/docs/markdown/STATE.md +7 -7
- package/docs/markdown/STORE.md +7 -7
- package/docs/markdown/USEOBSERVER.md +1 -1
- package/examples/react-app.tsx +6 -1
- package/index.cjs +106 -98
- package/index.js +106 -96
- package/package.json +1 -1
- package/types/memorio.d.ts +6 -0
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var e = Object.getOwnPropertyNames, t = (t, o) => function() {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
}), m = {},
|
|
64
|
+
}), m = {}, g = t({
|
|
65
65
|
"functions/idb/tools/db.version.ts"() {
|
|
66
66
|
idb.db.version = e => {
|
|
67
67
|
let t = 0;
|
|
@@ -72,7 +72,7 @@ var e = Object.getOwnPropertyNames, t = (t, o) => function() {
|
|
|
72
72
|
return t;
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
}),
|
|
75
|
+
}), h = {}, p = t({
|
|
76
76
|
"functions/idb/tools/db.support.ts"() {
|
|
77
77
|
idb.db.support = () => {
|
|
78
78
|
const e = "indexedDB" in globalThis;
|
|
@@ -194,7 +194,7 @@ var e = Object.getOwnPropertyNames, t = (t, o) => function() {
|
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
|
|
197
|
-
function
|
|
197
|
+
function E() {
|
|
198
198
|
const e = globalThis;
|
|
199
199
|
if (void 0 !== e.crypto && e.crypto.randomUUID) return e.crypto.randomUUID();
|
|
200
200
|
if (void 0 !== e.crypto && e.crypto.getRandomValues) {
|
|
@@ -204,7 +204,12 @@ function x() {
|
|
|
204
204
|
return `session_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
function
|
|
207
|
+
function x() {
|
|
208
|
+
const e = globalThis;
|
|
209
|
+
return e.Deno && e.Deno.version ? "deno" : "undefined" != typeof process && process.versions && process.versions.node ? "node" : "undefined" != typeof globalThis && void 0 !== globalThis.ServiceWorkerGlobalScope ? "edge" : "undefined" != typeof window && "undefined" != typeof document ? "browser" : "unknown";
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function N() {
|
|
208
213
|
try {
|
|
209
214
|
if ("undefined" != typeof sessionStorage) {
|
|
210
215
|
const e = "__memorio_test__";
|
|
@@ -214,7 +219,7 @@ function E() {
|
|
|
214
219
|
return null;
|
|
215
220
|
}
|
|
216
221
|
|
|
217
|
-
function
|
|
222
|
+
function I() {
|
|
218
223
|
try {
|
|
219
224
|
if ("undefined" != typeof localStorage) {
|
|
220
225
|
const e = "__memorio_test__";
|
|
@@ -224,40 +229,37 @@ function N() {
|
|
|
224
229
|
return null;
|
|
225
230
|
}
|
|
226
231
|
|
|
227
|
-
function
|
|
232
|
+
function D() {
|
|
228
233
|
return "undefined" != typeof indexedDB;
|
|
229
234
|
}
|
|
230
235
|
|
|
231
|
-
function
|
|
232
|
-
const e =
|
|
233
|
-
const e = globalThis;
|
|
234
|
-
return e.Deno && e.Deno.version ? "deno" : "undefined" != typeof process && process.versions && process.versions.node ? "node" : "undefined" != typeof globalThis && void 0 !== globalThis.ServiceWorkerGlobalScope ? "edge" : "undefined" != typeof window && "undefined" != typeof document ? "browser" : "unknown";
|
|
235
|
-
}(), t = void 0 !== globalThis.isSecureContext ? globalThis.isSecureContext : "browser" === e;
|
|
236
|
+
function A() {
|
|
237
|
+
const e = x(), t = void 0 !== globalThis.isSecureContext ? globalThis.isSecureContext : "browser" === e;
|
|
236
238
|
return {
|
|
237
239
|
platform: e,
|
|
238
|
-
hasSessionStorage: null !==
|
|
239
|
-
hasLocalStorage: null !==
|
|
240
|
-
hasIndexedDB:
|
|
240
|
+
hasSessionStorage: null !== N(),
|
|
241
|
+
hasLocalStorage: null !== I(),
|
|
242
|
+
hasIndexedDB: D(),
|
|
241
243
|
hasDispatchEvent: "function" == typeof globalThis.dispatchEvent,
|
|
242
244
|
hasNavigator: "undefined" != typeof navigator,
|
|
243
245
|
hasProcess: "undefined" != typeof process,
|
|
244
246
|
isSecureContext: t,
|
|
245
|
-
sessionId:
|
|
247
|
+
sessionId: E()
|
|
246
248
|
};
|
|
247
249
|
}
|
|
248
250
|
|
|
249
|
-
var A = new Map;
|
|
250
|
-
|
|
251
251
|
var z = new Map;
|
|
252
252
|
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
var J = new Map;
|
|
254
|
+
|
|
255
|
+
function B(e) {
|
|
256
|
+
const t = e || `context_${E()}`, o = {
|
|
255
257
|
state: {},
|
|
256
258
|
store: new Map,
|
|
257
259
|
session: new Map,
|
|
258
260
|
cache: new Map
|
|
259
261
|
};
|
|
260
|
-
return
|
|
262
|
+
return J.set(t, o), {
|
|
261
263
|
id: t,
|
|
262
264
|
state: o.state,
|
|
263
265
|
store: {
|
|
@@ -310,13 +312,13 @@ Object.defineProperty(globalThis, "memorio", {
|
|
|
310
312
|
}), Object.defineProperty(memorio, "version", {
|
|
311
313
|
writable: !1,
|
|
312
314
|
enumerable: !1,
|
|
313
|
-
value: "3.0.
|
|
315
|
+
value: "3.0.2"
|
|
314
316
|
});
|
|
315
317
|
|
|
316
|
-
var
|
|
318
|
+
var C = [ "list", "state", "store", "idb", "observer", "useObserver", "remove", "removeAll", "_platform", "_capabilities", "_sessionId" ];
|
|
317
319
|
|
|
318
320
|
!function() {
|
|
319
|
-
const e =
|
|
321
|
+
const e = A(), t = globalThis;
|
|
320
322
|
void 0 !== t.memorio && (t.memorio._platform = e.platform, t.memorio._capabilities = e),
|
|
321
323
|
e.hasDispatchEvent || (t.dispatchEvent = function(e) {
|
|
322
324
|
return !0;
|
|
@@ -327,15 +329,15 @@ var B = [ "list", "state", "store", "idb", "observer", "useObserver", "remove",
|
|
|
327
329
|
this.type = e, this.detail = t;
|
|
328
330
|
}
|
|
329
331
|
})), "function" != typeof t.addEventListener && (t.addEventListener = function(e, t) {
|
|
330
|
-
|
|
332
|
+
z.has(e) || z.set(e, []), z.get(e).push(t);
|
|
331
333
|
}, t.removeEventListener = function(e, t) {
|
|
332
|
-
const o =
|
|
334
|
+
const o = z.get(e);
|
|
333
335
|
if (o) {
|
|
334
336
|
const e = o.indexOf(t);
|
|
335
337
|
e > -1 && o.splice(e, 1);
|
|
336
338
|
}
|
|
337
339
|
}, t.dispatchEvent = function(e) {
|
|
338
|
-
const t =
|
|
340
|
+
const t = z.get(e.type);
|
|
339
341
|
return t && t.forEach(t => {
|
|
340
342
|
try {
|
|
341
343
|
t(e);
|
|
@@ -344,18 +346,26 @@ var B = [ "list", "state", "store", "idb", "observer", "useObserver", "remove",
|
|
|
344
346
|
});
|
|
345
347
|
}();
|
|
346
348
|
|
|
347
|
-
var $ =
|
|
349
|
+
var $ = A();
|
|
348
350
|
|
|
349
351
|
Object.defineProperty(memorio, "_sessionId", {
|
|
350
352
|
writable: !1,
|
|
351
353
|
enumerable: !1,
|
|
352
354
|
value: $.sessionId
|
|
353
|
-
}), memorio.createContext =
|
|
354
|
-
return Array.from(
|
|
355
|
+
}), memorio.createContext = B, memorio.listContexts = function() {
|
|
356
|
+
return Array.from(J.keys());
|
|
355
357
|
}, memorio.deleteContext = function(e) {
|
|
356
|
-
return
|
|
357
|
-
}, memorio.
|
|
358
|
-
return
|
|
358
|
+
return J.delete(e);
|
|
359
|
+
}, memorio.isBrowser = function() {
|
|
360
|
+
return "browser" === x();
|
|
361
|
+
}, memorio.isNode = function() {
|
|
362
|
+
return "node" === x();
|
|
363
|
+
}, memorio.isDeno = function() {
|
|
364
|
+
return "deno" === x();
|
|
365
|
+
}, memorio.isEdge = function() {
|
|
366
|
+
return "edge" === x();
|
|
367
|
+
}, memorio.getCapabilities = A, memorio.isolate = function(e) {
|
|
368
|
+
return B(e);
|
|
359
369
|
}, Object.defineProperty(memorio, "dispatch", {
|
|
360
370
|
writable: !1,
|
|
361
371
|
enumerable: !1,
|
|
@@ -384,7 +394,7 @@ Object.defineProperty(memorio, "_sessionId", {
|
|
|
384
394
|
}), globalThis.memorio._tracking = !1, globalThis.memorio._trackedPaths = new Set,
|
|
385
395
|
globalThis.memorio._locked = !1;
|
|
386
396
|
|
|
387
|
-
var
|
|
397
|
+
var R = (e, t, o = []) => new Proxy(e, {
|
|
388
398
|
get(e, r) {
|
|
389
399
|
if ("__path" === r) return o.length > 0 ? "state." + o.join(".") : "state";
|
|
390
400
|
if ("list" === r) return JSON.parse(JSON.stringify(globalThis.state));
|
|
@@ -405,14 +415,14 @@ var C = (e, t, o = []) => new Proxy(e, {
|
|
|
405
415
|
}
|
|
406
416
|
try {
|
|
407
417
|
const s = Reflect.get(e, r);
|
|
408
|
-
return s && "object" == typeof s && [ "Array", "Object" ].includes(s.constructor.name) ?
|
|
418
|
+
return s && "object" == typeof s && [ "Array", "Object" ].includes(s.constructor.name) ? R(s, t, o.concat(r)) : s;
|
|
409
419
|
} catch (e) {
|
|
410
420
|
return;
|
|
411
421
|
}
|
|
412
422
|
},
|
|
413
423
|
set(e, r, s) {
|
|
414
424
|
if (globalThis.memorio._locked) return !1;
|
|
415
|
-
if (
|
|
425
|
+
if (C.includes(r)) return !1;
|
|
416
426
|
if (e[r] && "object" == typeof e[r] && Object.isFrozen(e[r])) return !1;
|
|
417
427
|
if (e[r] && "object" == typeof e[r] && e[r].__locked) return !1;
|
|
418
428
|
try {
|
|
@@ -487,7 +497,7 @@ var C = (e, t, o = []) => new Proxy(e, {
|
|
|
487
497
|
getOwnPropertyDescriptor: (e, t) => Reflect.getOwnPropertyDescriptor(e, t)
|
|
488
498
|
});
|
|
489
499
|
|
|
490
|
-
globalThis?.state || (globalThis.state =
|
|
500
|
+
globalThis?.state || (globalThis.state = R({}, () => {})), globalThis.state.lock = () => {
|
|
491
501
|
globalThis.memorio._locked = !0;
|
|
492
502
|
}, globalThis.state.unlock = () => {
|
|
493
503
|
globalThis.memorio._locked = !1;
|
|
@@ -578,10 +588,10 @@ globalThis.observer = (e, t = null, o = !0) => {
|
|
|
578
588
|
}
|
|
579
589
|
}, Object.freeze(globalThis.useObserver);
|
|
580
590
|
|
|
581
|
-
var
|
|
591
|
+
var W = I(), M = new Map, q = null !== W, L = "memorio_store_";
|
|
582
592
|
|
|
583
|
-
function
|
|
584
|
-
return e && "string" == typeof e ? e.length > 512 ? "" : /^[a-zA-Z0-9_.-]+$/.test(e) ?
|
|
593
|
+
function U(e) {
|
|
594
|
+
return e && "string" == typeof e ? e.length > 512 ? "" : /^[a-zA-Z0-9_.-]+$/.test(e) ? L + e : "" : "";
|
|
585
595
|
}
|
|
586
596
|
|
|
587
597
|
Object.defineProperty(globalThis, "store", {
|
|
@@ -592,14 +602,14 @@ Object.defineProperty(globalThis, "store", {
|
|
|
592
602
|
get: {
|
|
593
603
|
value: e => {
|
|
594
604
|
if (!e) return;
|
|
595
|
-
const t =
|
|
605
|
+
const t = U(e);
|
|
596
606
|
try {
|
|
597
|
-
if (
|
|
598
|
-
const e =
|
|
607
|
+
if (q) {
|
|
608
|
+
const e = W.getItem(t);
|
|
599
609
|
return e ? JSON.parse(e) : e;
|
|
600
610
|
}
|
|
601
611
|
{
|
|
602
|
-
const e =
|
|
612
|
+
const e = M.get(t);
|
|
603
613
|
return e ? JSON.parse(e) : e;
|
|
604
614
|
}
|
|
605
615
|
} catch (e) {}
|
|
@@ -609,11 +619,11 @@ Object.defineProperty(globalThis, "store", {
|
|
|
609
619
|
set: {
|
|
610
620
|
value: (e, t) => {
|
|
611
621
|
if (!e) return;
|
|
612
|
-
const o =
|
|
622
|
+
const o = U(e);
|
|
613
623
|
try {
|
|
614
|
-
if (
|
|
615
|
-
if (null == t)
|
|
616
|
-
} else if (null == t)
|
|
624
|
+
if (q) {
|
|
625
|
+
if (null == t) W.setItem(o, JSON.stringify(null)); else if ("object" == typeof t || "number" == typeof t || "boolean" == typeof t || "string" == typeof t) W.setItem(o, JSON.stringify(t)); else if ("function" == typeof t) return;
|
|
626
|
+
} else if (null == t) M.set(o, JSON.stringify(null)); else if ("object" == typeof t || "number" == typeof t || "boolean" == typeof t || "string" == typeof t) M.set(o, JSON.stringify(t)); else if ("function" == typeof t) return;
|
|
617
627
|
} catch (e) {}
|
|
618
628
|
return null;
|
|
619
629
|
}
|
|
@@ -621,11 +631,11 @@ Object.defineProperty(globalThis, "store", {
|
|
|
621
631
|
remove: {
|
|
622
632
|
value: e => {
|
|
623
633
|
if (!e) return;
|
|
624
|
-
const t =
|
|
634
|
+
const t = U(e);
|
|
625
635
|
try {
|
|
626
|
-
if (
|
|
627
|
-
if (
|
|
628
|
-
} else if (
|
|
636
|
+
if (q) {
|
|
637
|
+
if (W.getItem(t)) return W.removeItem(t), !0;
|
|
638
|
+
} else if (M.has(t)) return M.delete(t), !0;
|
|
629
639
|
} catch (e) {}
|
|
630
640
|
return !1;
|
|
631
641
|
}
|
|
@@ -635,14 +645,14 @@ Object.defineProperty(globalThis, "store", {
|
|
|
635
645
|
},
|
|
636
646
|
removeAll: {
|
|
637
647
|
value: () => {
|
|
638
|
-
if (
|
|
648
|
+
if (q) {
|
|
639
649
|
const e = [];
|
|
640
|
-
for (let t = 0; t <
|
|
641
|
-
const o =
|
|
642
|
-
o?.startsWith(
|
|
650
|
+
for (let t = 0; t < W.length; t++) {
|
|
651
|
+
const o = W.key(t);
|
|
652
|
+
o?.startsWith(L) && e.push(o);
|
|
643
653
|
}
|
|
644
|
-
e.forEach(e =>
|
|
645
|
-
} else
|
|
654
|
+
e.forEach(e => W.removeItem(e));
|
|
655
|
+
} else M.clear();
|
|
646
656
|
return !0;
|
|
647
657
|
}
|
|
648
658
|
},
|
|
@@ -655,25 +665,25 @@ Object.defineProperty(globalThis, "store", {
|
|
|
655
665
|
size: {
|
|
656
666
|
value: () => {
|
|
657
667
|
let e = 0;
|
|
658
|
-
return
|
|
659
|
-
if (t.startsWith(
|
|
660
|
-
const o =
|
|
668
|
+
return q ? Object.keys(W).forEach(t => {
|
|
669
|
+
if (t.startsWith(L)) {
|
|
670
|
+
const o = W.getItem(t);
|
|
661
671
|
o && (e += o.length);
|
|
662
672
|
}
|
|
663
|
-
}) :
|
|
673
|
+
}) : M.forEach(t => {
|
|
664
674
|
e += t.length;
|
|
665
675
|
}), e;
|
|
666
676
|
}
|
|
667
677
|
},
|
|
668
678
|
isPersistent: {
|
|
669
|
-
get: () =>
|
|
679
|
+
get: () => q
|
|
670
680
|
}
|
|
671
681
|
}), Object.freeze(store);
|
|
672
682
|
|
|
673
|
-
var
|
|
683
|
+
var V = N(), F = new Map, K = null !== V, Z = "memorio_session_";
|
|
674
684
|
|
|
675
|
-
function
|
|
676
|
-
return e && "string" == typeof e ? e.length > 512 ? "" : /^[a-zA-Z0-9_.-]+$/.test(e) ?
|
|
685
|
+
function G(e) {
|
|
686
|
+
return e && "string" == typeof e ? e.length > 512 ? "" : /^[a-zA-Z0-9_.-]+$/.test(e) ? Z + e : "" : "";
|
|
677
687
|
}
|
|
678
688
|
|
|
679
689
|
Object.defineProperty(globalThis, "session", {
|
|
@@ -684,14 +694,14 @@ Object.defineProperty(globalThis, "session", {
|
|
|
684
694
|
get: {
|
|
685
695
|
value: e => {
|
|
686
696
|
if (!e) return;
|
|
687
|
-
const t =
|
|
697
|
+
const t = G(e);
|
|
688
698
|
try {
|
|
689
|
-
if (
|
|
690
|
-
const e =
|
|
699
|
+
if (K) {
|
|
700
|
+
const e = V.getItem(t);
|
|
691
701
|
return e ? JSON.parse(e) : e;
|
|
692
702
|
}
|
|
693
703
|
{
|
|
694
|
-
const e =
|
|
704
|
+
const e = F.get(t);
|
|
695
705
|
return e ? JSON.parse(e) : e;
|
|
696
706
|
}
|
|
697
707
|
} catch (e) {}
|
|
@@ -700,20 +710,20 @@ Object.defineProperty(globalThis, "session", {
|
|
|
700
710
|
set: {
|
|
701
711
|
value: (e, t) => {
|
|
702
712
|
if (!e) return;
|
|
703
|
-
const o =
|
|
713
|
+
const o = G(e);
|
|
704
714
|
try {
|
|
705
|
-
|
|
715
|
+
K ? null == t ? V.setItem(o, JSON.stringify(null)) : "object" != typeof t && "number" != typeof t && "boolean" != typeof t && "string" != typeof t || V.setItem(o, JSON.stringify(t)) : null == t ? F.set(o, JSON.stringify(null)) : "object" != typeof t && "number" != typeof t && "boolean" != typeof t && "string" != typeof t || F.set(o, JSON.stringify(t));
|
|
706
716
|
} catch (e) {}
|
|
707
717
|
}
|
|
708
718
|
},
|
|
709
719
|
remove: {
|
|
710
720
|
value: e => {
|
|
711
721
|
if (!e) return;
|
|
712
|
-
const t =
|
|
722
|
+
const t = G(e);
|
|
713
723
|
try {
|
|
714
|
-
if (
|
|
715
|
-
if (
|
|
716
|
-
} else if (
|
|
724
|
+
if (K) {
|
|
725
|
+
if (V.getItem(t)) return V.removeItem(t), !0;
|
|
726
|
+
} else if (F.has(t)) return F.delete(t), !0;
|
|
717
727
|
} catch (e) {}
|
|
718
728
|
}
|
|
719
729
|
},
|
|
@@ -722,14 +732,14 @@ Object.defineProperty(globalThis, "session", {
|
|
|
722
732
|
},
|
|
723
733
|
removeAll: {
|
|
724
734
|
value: () => {
|
|
725
|
-
if (
|
|
735
|
+
if (K) {
|
|
726
736
|
const e = [];
|
|
727
|
-
for (let t = 0; t <
|
|
728
|
-
const o =
|
|
729
|
-
o?.startsWith(
|
|
737
|
+
for (let t = 0; t < V.length; t++) {
|
|
738
|
+
const o = V.key(t);
|
|
739
|
+
o?.startsWith(Z) && e.push(o);
|
|
730
740
|
}
|
|
731
|
-
e.forEach(e =>
|
|
732
|
-
} else
|
|
741
|
+
e.forEach(e => V.removeItem(e));
|
|
742
|
+
} else F.clear();
|
|
733
743
|
return !0;
|
|
734
744
|
}
|
|
735
745
|
},
|
|
@@ -742,35 +752,35 @@ Object.defineProperty(globalThis, "session", {
|
|
|
742
752
|
size: {
|
|
743
753
|
value: () => {
|
|
744
754
|
let e = 0;
|
|
745
|
-
return
|
|
746
|
-
if (t.startsWith(
|
|
747
|
-
const o =
|
|
755
|
+
return K ? Object.keys(V).forEach(t => {
|
|
756
|
+
if (t.startsWith(Z)) {
|
|
757
|
+
const o = V.getItem(t);
|
|
748
758
|
o && (e += o.length);
|
|
749
759
|
}
|
|
750
|
-
}) :
|
|
760
|
+
}) : F.forEach(t => {
|
|
751
761
|
e += t.length;
|
|
752
762
|
}), e;
|
|
753
763
|
}
|
|
754
764
|
},
|
|
755
765
|
isPersistent: {
|
|
756
|
-
get: () =>
|
|
766
|
+
get: () => K
|
|
757
767
|
}
|
|
758
768
|
}), Object.freeze(session);
|
|
759
769
|
|
|
760
|
-
var
|
|
770
|
+
var H = {};
|
|
761
771
|
|
|
762
772
|
Object.defineProperty(globalThis, "cache", {
|
|
763
773
|
value: new Proxy({}, {
|
|
764
|
-
get: (e, t) => "get" === t ? e =>
|
|
765
|
-
|
|
766
|
-
} : "remove" === t ? e => (delete
|
|
767
|
-
!0) :
|
|
768
|
-
set: (e, t, o) => (
|
|
769
|
-
deleteProperty: (e, t) => (delete
|
|
774
|
+
get: (e, t) => "get" === t ? e => H[e] : "set" === t ? (e, t) => {
|
|
775
|
+
H[e] = t;
|
|
776
|
+
} : "remove" === t ? e => (delete H[e], !0) : "removeAll" === t || "clear" === t ? () => (Object.keys(H).forEach(e => delete H[e]),
|
|
777
|
+
!0) : H[t],
|
|
778
|
+
set: (e, t, o) => (H[t] = o, !0),
|
|
779
|
+
deleteProperty: (e, t) => (delete H[t], !0)
|
|
770
780
|
}),
|
|
771
781
|
enumerable: !1,
|
|
772
782
|
configurable: !0
|
|
773
|
-
}), Object.freeze(cache),
|
|
783
|
+
}), Object.freeze(cache), D() ? (async () => {
|
|
774
784
|
Object.defineProperty(globalThis, "idb", {
|
|
775
785
|
value: {
|
|
776
786
|
db: {},
|
|
@@ -788,8 +798,8 @@ Object.defineProperty(globalThis, "cache", {
|
|
|
788
798
|
}), await Promise.all([ Promise.resolve().then(() => (r(), o)), Promise.resolve().then(() => (n(),
|
|
789
799
|
s)), Promise.resolve().then(() => (l(), i)), Promise.resolve().then(() => (c(),
|
|
790
800
|
a)), Promise.resolve().then(() => (u(), b)), Promise.resolve().then(() => (f(),
|
|
791
|
-
d)), Promise.resolve().then(() => (
|
|
792
|
-
|
|
801
|
+
d)), Promise.resolve().then(() => (g(), m)), Promise.resolve().then(() => (p(),
|
|
802
|
+
h)), Promise.resolve().then(() => (y(), v)), Promise.resolve().then(() => (j(),
|
|
793
803
|
T)), Promise.resolve().then(() => (O(), P)), Promise.resolve().then(() => (S(),
|
|
794
804
|
w)), Promise.resolve().then(() => (k(), _)) ]), Object.preventExtensions(idb), Object.seal(idb),
|
|
795
805
|
Object.freeze(idb);
|
package/package.json
CHANGED
package/types/memorio.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ interface _memorio {
|
|
|
25
25
|
_tracking?: boolean
|
|
26
26
|
_trackedPaths?: Set<string>
|
|
27
27
|
_locked?: boolean
|
|
28
|
+
// Platform detection
|
|
29
|
+
isBrowser: () => boolean
|
|
30
|
+
isNode: () => boolean
|
|
31
|
+
isDeno: () => boolean
|
|
32
|
+
isEdge: () => boolean
|
|
33
|
+
getCapabilities: (...args: unknown[]) => any
|
|
28
34
|
// Platform properties
|
|
29
35
|
_platform?: string
|
|
30
36
|
_capabilities?: any
|