memorio 4.6.5 → 4.6.6
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/index.cjs +269 -236
- package/index.js +314 -283
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
Object.defineProperty(exports, "__esModule", {
|
|
2
4
|
value: !0
|
|
3
5
|
});
|
|
@@ -98,15 +100,15 @@ function f() {
|
|
|
98
100
|
return "node" === d();
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
function
|
|
103
|
+
function m() {
|
|
102
104
|
return "deno" === d();
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
function
|
|
107
|
+
function p() {
|
|
106
108
|
return "edge" === d();
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
function
|
|
111
|
+
function g() {
|
|
110
112
|
try {
|
|
111
113
|
if ("undefined" != typeof sessionStorage) {
|
|
112
114
|
const e = "__memorio_test__";
|
|
@@ -134,7 +136,7 @@ function y() {
|
|
|
134
136
|
const e = d(), t = void 0 !== globalThis.isSecureContext ? globalThis.isSecureContext : "browser" === e;
|
|
135
137
|
return {
|
|
136
138
|
platform: e,
|
|
137
|
-
hasSessionStorage: null !==
|
|
139
|
+
hasSessionStorage: null !== g(),
|
|
138
140
|
hasLocalStorage: null !== h(),
|
|
139
141
|
hasIndexedDB: v(),
|
|
140
142
|
hasDispatchEvent: "function" == typeof globalThis.dispatchEvent,
|
|
@@ -147,7 +149,7 @@ function y() {
|
|
|
147
149
|
|
|
148
150
|
function x(e) {
|
|
149
151
|
const t = e || `context_${u()}`;
|
|
150
|
-
|
|
152
|
+
O(t);
|
|
151
153
|
const r = {
|
|
152
154
|
state: {},
|
|
153
155
|
store: new Map,
|
|
@@ -195,15 +197,15 @@ function x(e) {
|
|
|
195
197
|
};
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
function
|
|
200
|
+
function w() {
|
|
199
201
|
return Array.from(l.keys());
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
function
|
|
204
|
+
function T(e) {
|
|
203
205
|
return l.delete(e);
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
function
|
|
208
|
+
function O(e) {
|
|
207
209
|
exports.internal.currentContext = e;
|
|
208
210
|
}
|
|
209
211
|
|
|
@@ -211,9 +213,9 @@ var P, j = s({
|
|
|
211
213
|
"core/platform.ts"() {
|
|
212
214
|
i(), a = new Map, l = new Map;
|
|
213
215
|
}
|
|
214
|
-
}),
|
|
216
|
+
}), k = {}, S = s({
|
|
215
217
|
"functions/idb/tools/db.create.ts"() {
|
|
216
|
-
|
|
218
|
+
X(), c(), exports.idb.db.create = (e, t = 1) => new Promise((r, o) => {
|
|
217
219
|
if (!exports.idb.db.support()) return o(new Error("IndexedDB not supported"));
|
|
218
220
|
const s = globalThis.indexedDB.open(e, t);
|
|
219
221
|
s.onerror = () => {
|
|
@@ -225,9 +227,9 @@ var P, j = s({
|
|
|
225
227
|
};
|
|
226
228
|
});
|
|
227
229
|
}
|
|
228
|
-
}),
|
|
230
|
+
}), E = {}, $ = s({
|
|
229
231
|
"functions/idb/tools/db.list.ts"() {
|
|
230
|
-
|
|
232
|
+
X(), exports.idb.db.list = async () => {
|
|
231
233
|
if (!("indexedDB" in globalThis) || !indexedDB.databases) return [];
|
|
232
234
|
try {
|
|
233
235
|
const e = await indexedDB.databases();
|
|
@@ -239,15 +241,15 @@ var P, j = s({
|
|
|
239
241
|
}
|
|
240
242
|
}), D = {}, C = s({
|
|
241
243
|
"functions/idb/tools/db.exist.ts"() {
|
|
242
|
-
|
|
244
|
+
X(), exports.idb.db.exist = e => idbases?.some(t => t.name === e);
|
|
243
245
|
}
|
|
244
246
|
}), A = {}, _ = s({
|
|
245
247
|
"functions/idb/tools/db.quota.ts"() {
|
|
246
|
-
|
|
248
|
+
X(), exports.idb.db.quota = () => navigator.storage.estimate();
|
|
247
249
|
}
|
|
248
250
|
}), I = {}, N = s({
|
|
249
251
|
"functions/idb/tools/db.delete.ts"() {
|
|
250
|
-
|
|
252
|
+
X(), c(), exports.idb.db.delete = e => new Promise((t, r) => {
|
|
251
253
|
n(`Removing database ${e}...`);
|
|
252
254
|
(() => {
|
|
253
255
|
const o = indexedDB.deleteDatabase(e);
|
|
@@ -261,9 +263,9 @@ var P, j = s({
|
|
|
261
263
|
})();
|
|
262
264
|
});
|
|
263
265
|
}
|
|
264
|
-
}),
|
|
266
|
+
}), M = {}, B = s({
|
|
265
267
|
"functions/idb/tools/db.size.ts"() {
|
|
266
|
-
|
|
268
|
+
X(), c(), exports.idb.db.size = async () => {
|
|
267
269
|
if (idbases && 0 !== idbases.length) for (let e = 0; e < idbases.length; e++) {
|
|
268
270
|
const t = idbases[e];
|
|
269
271
|
try {
|
|
@@ -279,9 +281,9 @@ var P, j = s({
|
|
|
279
281
|
}
|
|
280
282
|
};
|
|
281
283
|
}
|
|
282
|
-
}),
|
|
284
|
+
}), z = {}, J = s({
|
|
283
285
|
"functions/idb/tools/db.version.ts"() {
|
|
284
|
-
|
|
286
|
+
X(), exports.idb.db.version = e => {
|
|
285
287
|
let t = 0;
|
|
286
288
|
for (const r of idbases) {
|
|
287
289
|
r.name === e && (t = r.version);
|
|
@@ -292,14 +294,14 @@ var P, j = s({
|
|
|
292
294
|
}
|
|
293
295
|
}), W = {}, R = s({
|
|
294
296
|
"functions/idb/tools/db.support.ts"() {
|
|
295
|
-
|
|
297
|
+
X(), c(), exports.idb.db.support = () => {
|
|
296
298
|
const e = "indexedDB" in globalThis;
|
|
297
299
|
return e || n("Your environment doesn't support IndexedDB"), e;
|
|
298
300
|
};
|
|
299
301
|
}
|
|
300
302
|
}), V = {}, U = s({
|
|
301
303
|
"functions/idb/tools/table.create.ts"() {
|
|
302
|
-
|
|
304
|
+
X(), c(), exports.idb.table.create = (e, t) => new Promise((r, o) => {
|
|
303
305
|
try {
|
|
304
306
|
const s = (Number(exports.idb.db.version(e)) || 0) + 1, i = indexedDB.open(e, s);
|
|
305
307
|
i.onupgradeneeded = r => {
|
|
@@ -325,9 +327,9 @@ var P, j = s({
|
|
|
325
327
|
}
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
|
-
}),
|
|
330
|
+
}), q = {}, F = s({
|
|
329
331
|
"functions/idb/tools/table.size.ts"() {
|
|
330
|
-
|
|
332
|
+
X(), c(), exports.idb.table.size = (e, t) => new Promise((r, o) => {
|
|
331
333
|
if (!e) return o(new Error("Database instance is required"));
|
|
332
334
|
if (!e.objectStoreNames.contains(t)) return r(0);
|
|
333
335
|
let s = 0, i = 0;
|
|
@@ -348,9 +350,9 @@ var P, j = s({
|
|
|
348
350
|
};
|
|
349
351
|
});
|
|
350
352
|
}
|
|
351
|
-
}),
|
|
353
|
+
}), L = {}, K = s({
|
|
352
354
|
"functions/idb/crud/data.delete.ts"() {
|
|
353
|
-
|
|
355
|
+
X(), c(), exports.idb.data.delete = (e, t, r) => new Promise((o, s) => {
|
|
354
356
|
const i = indexedDB.open(e);
|
|
355
357
|
i.onsuccess = () => {
|
|
356
358
|
const e = i.result;
|
|
@@ -378,7 +380,7 @@ var P, j = s({
|
|
|
378
380
|
}
|
|
379
381
|
}), H = {}, Y = s({
|
|
380
382
|
"functions/idb/crud/data.set.ts"() {
|
|
381
|
-
|
|
383
|
+
X(), c(), exports.idb.data.set = (e, t, r) => new Promise((o, s) => {
|
|
382
384
|
const i = indexedDB.open(e);
|
|
383
385
|
i.onsuccess = () => {
|
|
384
386
|
const a = i.result;
|
|
@@ -394,9 +396,9 @@ var P, j = s({
|
|
|
394
396
|
};
|
|
395
397
|
});
|
|
396
398
|
}
|
|
397
|
-
}),
|
|
399
|
+
}), G = {}, Q = s({
|
|
398
400
|
"functions/idb/crud/data.get.ts"() {
|
|
399
|
-
|
|
401
|
+
X(), exports.idb.data.get = (e, t, r) => new Promise((o, s) => {
|
|
400
402
|
const n = indexedDB.open(e);
|
|
401
403
|
n.onsuccess = n => {
|
|
402
404
|
const i = n.target.result;
|
|
@@ -416,7 +418,7 @@ var P, j = s({
|
|
|
416
418
|
|
|
417
419
|
exports.idb = void 0;
|
|
418
420
|
|
|
419
|
-
var
|
|
421
|
+
var X = s({
|
|
420
422
|
"functions/idb/index.ts"() {
|
|
421
423
|
j(), P = v(), exports.idb = {
|
|
422
424
|
db: {},
|
|
@@ -440,13 +442,13 @@ var Q = s({
|
|
|
440
442
|
writable: !0,
|
|
441
443
|
configurable: !0,
|
|
442
444
|
enumerable: !1
|
|
443
|
-
}), await Promise.all([ Promise.resolve().then(() => (
|
|
444
|
-
|
|
445
|
+
}), await Promise.all([ Promise.resolve().then(() => (S(), k)), Promise.resolve().then(() => ($(),
|
|
446
|
+
E)), Promise.resolve().then(() => (C(), D)), Promise.resolve().then(() => (_(),
|
|
445
447
|
A)), Promise.resolve().then(() => (N(), I)), Promise.resolve().then(() => (B(),
|
|
446
|
-
|
|
447
|
-
W)), Promise.resolve().then(() => (U(), V)), Promise.resolve().then(() => (
|
|
448
|
-
|
|
449
|
-
H)), Promise.resolve().then(() => (
|
|
448
|
+
M)), Promise.resolve().then(() => (J(), z)), Promise.resolve().then(() => (R(),
|
|
449
|
+
W)), Promise.resolve().then(() => (U(), V)), Promise.resolve().then(() => (F(),
|
|
450
|
+
q)), Promise.resolve().then(() => (K(), L)), Promise.resolve().then(() => (Y(),
|
|
451
|
+
H)), Promise.resolve().then(() => (Q(), G)) ]), Object.preventExtensions(exports.idb),
|
|
450
452
|
Object.seal(exports.idb), Object.freeze(exports.idb);
|
|
451
453
|
})() : (exports.idb._disabled = !0, exports.idb._warning = "IndexedDB is not available in this environment (Node.js/Deno). Use store or session for persistence.",
|
|
452
454
|
console.warn("Memorio IDB: IndexedDB is not available in this environment. Use store or session for data persistence."));
|
|
@@ -455,7 +457,7 @@ var Q = s({
|
|
|
455
457
|
|
|
456
458
|
i(), c();
|
|
457
459
|
|
|
458
|
-
var
|
|
460
|
+
var Z = {
|
|
459
461
|
set: (e, t = {}) => {
|
|
460
462
|
globalThis.dispatchEvent(new CustomEvent(String(e), t));
|
|
461
463
|
},
|
|
@@ -471,9 +473,23 @@ var X = {
|
|
|
471
473
|
const t = globalThis.events?.[e];
|
|
472
474
|
t && (globalThis.removeEventListener(e, t), delete globalThis.events[e]);
|
|
473
475
|
}
|
|
474
|
-
}, ee = (
|
|
476
|
+
}, ee = Symbol("memorio.target"), te = new WeakMap, re = (e, t = null) => {
|
|
477
|
+
if (null === e || "object" != typeof e) return e;
|
|
478
|
+
if (void 0 !== e[ee]) return re(e[ee], t);
|
|
479
|
+
if (t) {
|
|
480
|
+
if (t.has(e)) return e;
|
|
481
|
+
t.add(e);
|
|
482
|
+
}
|
|
483
|
+
const r = e.constructor?.name;
|
|
484
|
+
if ("Object" !== r && "Array" !== r) return e;
|
|
485
|
+
const o = Array.isArray(e) ? [] : {};
|
|
486
|
+
for (const r of Reflect.ownKeys(e)) o[r] = re(e[r], t);
|
|
487
|
+
return o;
|
|
488
|
+
}, oe = (e, t, r = ".") => t.concat(e).join(r), se = (e, t, o = []) => new Proxy(e, {
|
|
475
489
|
get(e, r) {
|
|
476
490
|
if ("__path" === r) return o.length > 0 ? "state." + o.join(".") : "state";
|
|
491
|
+
if (r === ee) return e;
|
|
492
|
+
if (void 0 !== e[ee]) return e;
|
|
477
493
|
if ("list" === r) return n('Some state could be hidden when you use "state.list". Use "state" to see the complete list '),
|
|
478
494
|
JSON.parse(JSON.stringify(e));
|
|
479
495
|
if ("string" == typeof r) {
|
|
@@ -496,7 +512,11 @@ var X = {
|
|
|
496
512
|
}
|
|
497
513
|
try {
|
|
498
514
|
const s = Reflect.get(e, r);
|
|
499
|
-
|
|
515
|
+
if (s && "object" == typeof s && [ "Array", "Object" ].includes(s.constructor.name)) {
|
|
516
|
+
let e = te.get(s);
|
|
517
|
+
return e || (e = se(s, t, o.concat(r)), te.set(s, e)), e;
|
|
518
|
+
}
|
|
519
|
+
return s;
|
|
500
520
|
} catch (e) {
|
|
501
521
|
return void console.error("Error: ", e);
|
|
502
522
|
}
|
|
@@ -510,22 +530,22 @@ var X = {
|
|
|
510
530
|
if (e[s] && "object" == typeof e[s] && e[s].__locked) return console.error(`Error: state '${s}' is locked. Use state.${s}.unlock() to enable modifications.`),
|
|
511
531
|
!1;
|
|
512
532
|
try {
|
|
513
|
-
const r =
|
|
533
|
+
const r = oe(s, o), a = re(i);
|
|
514
534
|
if (t({
|
|
515
535
|
action: "set",
|
|
516
536
|
path: r,
|
|
517
537
|
target: e,
|
|
518
|
-
newValue:
|
|
538
|
+
newValue: a,
|
|
519
539
|
previousValue: Reflect.get(e, s)
|
|
520
540
|
}), (e => {
|
|
521
541
|
try {
|
|
522
|
-
|
|
542
|
+
Z.set(e, {
|
|
523
543
|
detail: {
|
|
524
544
|
name: e
|
|
525
545
|
}
|
|
526
546
|
});
|
|
527
547
|
} catch (e) {}
|
|
528
|
-
})("state." + r), Reflect.set(e, s,
|
|
548
|
+
})("state." + r), Reflect.set(e, s, a), exports.internal.bumpStateVersion(), e[s] && "object" == typeof e[s]) {
|
|
529
549
|
const t = e[s];
|
|
530
550
|
if (t && "object" == typeof t) try {
|
|
531
551
|
Object.defineProperty(t, "__locked", {
|
|
@@ -567,7 +587,7 @@ var X = {
|
|
|
567
587
|
},
|
|
568
588
|
deleteProperty(e, r) {
|
|
569
589
|
try {
|
|
570
|
-
const s =
|
|
590
|
+
const s = oe(r, o);
|
|
571
591
|
return t({
|
|
572
592
|
action: "delete",
|
|
573
593
|
path: s,
|
|
@@ -579,96 +599,98 @@ var X = {
|
|
|
579
599
|
},
|
|
580
600
|
ownKeys: e => Reflect.ownKeys(e),
|
|
581
601
|
getOwnPropertyDescriptor: (e, t) => Reflect.getOwnPropertyDescriptor(e, t)
|
|
582
|
-
}),
|
|
602
|
+
}), ne = se({}, () => {});
|
|
583
603
|
|
|
584
|
-
|
|
604
|
+
ne.lock = () => {
|
|
585
605
|
exports.internal.locked = !0, n("State is now locked. All modifications are blocked.");
|
|
586
|
-
},
|
|
606
|
+
}, ne.unlock = () => {
|
|
587
607
|
exports.internal.locked = !1, n("State is now unlocked. Modifications are allowed.");
|
|
588
608
|
}, j(), i(), c();
|
|
589
609
|
|
|
590
|
-
var
|
|
610
|
+
var ie = h(), ae = new Map;
|
|
591
611
|
|
|
592
|
-
function
|
|
612
|
+
function le() {
|
|
593
613
|
const e = exports.internal.currentContext || "" || "default";
|
|
594
|
-
return
|
|
614
|
+
return ae.has(e) || ae.set(e, new Map), ae.get(e);
|
|
595
615
|
}
|
|
596
616
|
|
|
597
|
-
var
|
|
617
|
+
var ce = null !== ie;
|
|
598
618
|
|
|
599
|
-
function
|
|
619
|
+
function ue() {
|
|
600
620
|
const e = exports.internal.currentContext || "";
|
|
601
621
|
return e ? `${e}-` : "memorio_store_";
|
|
602
622
|
}
|
|
603
623
|
|
|
604
|
-
function
|
|
605
|
-
return e && "string" == typeof e ? e.length > 512 ? (
|
|
606
|
-
"") :
|
|
607
|
-
"")
|
|
624
|
+
function de(e) {
|
|
625
|
+
return e && "string" == typeof e ? e.length > 512 ? (console.warn(`[memorio store] key "${e}" exceeds 512 chars — operation aborted`),
|
|
626
|
+
"") : ue() + e : (console.warn("[memorio store] key is empty or not a string — operation aborted"),
|
|
627
|
+
"");
|
|
608
628
|
}
|
|
609
629
|
|
|
610
|
-
var
|
|
630
|
+
var be = new Proxy({}, {});
|
|
611
631
|
|
|
612
632
|
Object.defineProperty(globalThis, "store", {
|
|
613
|
-
value:
|
|
633
|
+
value: be,
|
|
614
634
|
enumerable: !1,
|
|
615
635
|
configurable: !0
|
|
616
|
-
}), Object.defineProperties(
|
|
636
|
+
}), Object.defineProperties(be, {
|
|
617
637
|
get: {
|
|
618
638
|
value: e => {
|
|
619
|
-
if (e)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
return null;
|
|
639
|
+
if (!e) return console.warn("[memorio store] store.get() called with empty or null key — returning null"),
|
|
640
|
+
null;
|
|
641
|
+
try {
|
|
642
|
+
return function(e) {
|
|
643
|
+
const t = ce ? ie.getItem(e) : le().get(e);
|
|
644
|
+
return t ? JSON.parse(t) : t;
|
|
645
|
+
}(de(e));
|
|
646
|
+
} catch (t) {
|
|
647
|
+
exports.message(`Error parsing store item '${e}': ${t}`);
|
|
629
648
|
}
|
|
649
|
+
return null;
|
|
630
650
|
}
|
|
631
651
|
},
|
|
632
652
|
getMultiple: {
|
|
633
653
|
value: e => {
|
|
634
654
|
const t = {};
|
|
635
655
|
for (const r of e) try {
|
|
636
|
-
const e =
|
|
656
|
+
const e = be.get(r);
|
|
637
657
|
e && (t[r] = e);
|
|
638
|
-
} catch {
|
|
658
|
+
} catch (e) {
|
|
659
|
+
console.debug(`[memorio store] getMultiple error for key "${r}":`, e);
|
|
660
|
+
}
|
|
639
661
|
return t;
|
|
640
662
|
}
|
|
641
663
|
},
|
|
642
664
|
set: {
|
|
643
665
|
value: (e, t) => {
|
|
644
|
-
if (!e) return
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
exports.message("Storing functions is not secure and is blocked for safety.");
|
|
666
|
+
if (!e) return console.warn("[memorio store] store.set() called with empty or null key — write aborted"),
|
|
667
|
+
!1;
|
|
668
|
+
const r = de(e);
|
|
669
|
+
if (!r) return !1;
|
|
670
|
+
if ("function" == typeof t) return console.warn("[memorio store] functions are not storable — write aborted for key: " + e),
|
|
671
|
+
exports.message("Storing functions is not secure and is blocked for safety."), !1;
|
|
672
|
+
try {
|
|
673
|
+
!function(e, t) {
|
|
674
|
+
const r = JSON.stringify(t);
|
|
675
|
+
ce ? ie.setItem(e, r) : le().set(e, r);
|
|
676
|
+
}(r, t);
|
|
677
|
+
} catch (t) {
|
|
678
|
+
return exports.message(`Error setting store item '${e}': ${t}`), !1;
|
|
659
679
|
}
|
|
680
|
+
return !0;
|
|
660
681
|
}
|
|
661
682
|
},
|
|
662
683
|
remove: {
|
|
663
684
|
value: e => {
|
|
664
|
-
if (!e) return
|
|
665
|
-
|
|
685
|
+
if (!e) return console.debug("[memorio store] store.remove() called with empty or null key — returning false"),
|
|
686
|
+
!1;
|
|
687
|
+
const t = de(e);
|
|
666
688
|
if (!t) return !1;
|
|
667
689
|
try {
|
|
668
690
|
return function(e) {
|
|
669
|
-
if (
|
|
670
|
-
if (
|
|
671
|
-
} else if (
|
|
691
|
+
if (ce) {
|
|
692
|
+
if (ie.getItem(e)) return ie.removeItem(e), !0;
|
|
693
|
+
} else if (le().has(e)) return le().delete(e), !0;
|
|
672
694
|
return !1;
|
|
673
695
|
}(t);
|
|
674
696
|
} catch (t) {
|
|
@@ -678,23 +700,23 @@ Object.defineProperty(globalThis, "store", {
|
|
|
678
700
|
}
|
|
679
701
|
},
|
|
680
702
|
delete: {
|
|
681
|
-
value: e =>
|
|
703
|
+
value: e => be.remove(e)
|
|
682
704
|
},
|
|
683
705
|
removeAll: {
|
|
684
706
|
value: () => {
|
|
685
|
-
if (
|
|
707
|
+
if (ce) {
|
|
686
708
|
const e = [];
|
|
687
|
-
for (let t = 0; t <
|
|
688
|
-
const r =
|
|
689
|
-
r?.startsWith(
|
|
709
|
+
for (let t = 0; t < ie.length; t++) {
|
|
710
|
+
const r = ie.key(t);
|
|
711
|
+
r?.startsWith(ue()) && e.push(r);
|
|
690
712
|
}
|
|
691
|
-
e.forEach(e =>
|
|
692
|
-
} else
|
|
713
|
+
e.forEach(e => ie.removeItem(e));
|
|
714
|
+
} else le().clear();
|
|
693
715
|
return !0;
|
|
694
716
|
}
|
|
695
717
|
},
|
|
696
718
|
clearAll: {
|
|
697
|
-
value: () => (
|
|
719
|
+
value: () => (be.removeAll(), !0)
|
|
698
720
|
},
|
|
699
721
|
quota: {
|
|
700
722
|
value: async () => [ 0, 0 ]
|
|
@@ -702,36 +724,36 @@ Object.defineProperty(globalThis, "store", {
|
|
|
702
724
|
size: {
|
|
703
725
|
value: () => {
|
|
704
726
|
let e = 0;
|
|
705
|
-
return
|
|
706
|
-
if (t.startsWith(
|
|
707
|
-
const r =
|
|
727
|
+
return ce ? Object.keys(ie).forEach(t => {
|
|
728
|
+
if (t.startsWith(ue())) {
|
|
729
|
+
const r = ie.getItem(t);
|
|
708
730
|
r && (e += r.length);
|
|
709
731
|
}
|
|
710
|
-
}) :
|
|
732
|
+
}) : le().forEach(t => {
|
|
711
733
|
e += t.length;
|
|
712
734
|
}), e;
|
|
713
735
|
}
|
|
714
736
|
},
|
|
715
737
|
isPersistent: {
|
|
716
|
-
get: () =>
|
|
738
|
+
get: () => ce
|
|
717
739
|
},
|
|
718
740
|
list: {
|
|
719
741
|
value: () => {
|
|
720
742
|
const e = {};
|
|
721
743
|
try {
|
|
722
|
-
if (
|
|
723
|
-
const r =
|
|
724
|
-
if (r?.startsWith(
|
|
725
|
-
const t = r.replace(
|
|
744
|
+
if (ce) for (let t = 0; t < ie.length; t++) {
|
|
745
|
+
const r = ie.key(t);
|
|
746
|
+
if (r?.startsWith(ue())) {
|
|
747
|
+
const t = r.replace(ue(), ""), o = ie.getItem(r);
|
|
726
748
|
if (null !== o) try {
|
|
727
749
|
e[t] = JSON.parse(o);
|
|
728
750
|
} catch {
|
|
729
751
|
e[t] = o;
|
|
730
752
|
}
|
|
731
753
|
}
|
|
732
|
-
} else
|
|
733
|
-
if (r.startsWith(
|
|
734
|
-
const o = r.replace(
|
|
754
|
+
} else le().forEach((t, r) => {
|
|
755
|
+
if (r.startsWith(ue())) {
|
|
756
|
+
const o = r.replace(ue(), "");
|
|
735
757
|
try {
|
|
736
758
|
e[o] = JSON.parse(t);
|
|
737
759
|
} catch {
|
|
@@ -745,95 +767,106 @@ Object.defineProperty(globalThis, "store", {
|
|
|
745
767
|
return e;
|
|
746
768
|
}
|
|
747
769
|
}
|
|
748
|
-
}), Object.freeze(
|
|
770
|
+
}), Object.freeze(be), j(), i(), c();
|
|
749
771
|
|
|
750
|
-
var
|
|
772
|
+
var fe = g(), me = new Map;
|
|
751
773
|
|
|
752
|
-
function
|
|
774
|
+
function pe() {
|
|
753
775
|
const e = exports.internal.currentContext || "" || "default";
|
|
754
|
-
return
|
|
776
|
+
return me.has(e) || me.set(e, new Map), me.get(e);
|
|
755
777
|
}
|
|
756
778
|
|
|
757
|
-
var
|
|
779
|
+
var ge = null !== fe;
|
|
758
780
|
|
|
759
|
-
function
|
|
781
|
+
function he() {
|
|
760
782
|
const e = exports.internal.currentContext || "";
|
|
761
783
|
return e ? `${e}-` : "memorio_session_";
|
|
762
784
|
}
|
|
763
785
|
|
|
764
|
-
function
|
|
765
|
-
return e && "string" == typeof e ? e.length > 512 ? (
|
|
766
|
-
"") :
|
|
767
|
-
"")
|
|
786
|
+
function ve(e) {
|
|
787
|
+
return e && "string" == typeof e ? e.length > 512 ? (console.warn(`[memorio session] key "${e}" exceeds 512 chars — operation aborted`),
|
|
788
|
+
"") : he() + e : (console.warn("[memorio session] key is empty or not a string — operation aborted"),
|
|
789
|
+
"");
|
|
768
790
|
}
|
|
769
791
|
|
|
770
|
-
var
|
|
792
|
+
var ye = new Proxy({}, {});
|
|
771
793
|
|
|
772
794
|
Object.defineProperty(globalThis, "session", {
|
|
773
|
-
value:
|
|
795
|
+
value: ye,
|
|
774
796
|
enumerable: !1,
|
|
775
797
|
configurable: !0
|
|
776
|
-
}), Object.defineProperties(
|
|
798
|
+
}), Object.defineProperties(ye, {
|
|
777
799
|
get: {
|
|
778
800
|
value: e => {
|
|
779
|
-
if (e)
|
|
801
|
+
if (!e) return console.warn("[memorio session] session.get() called with empty or null key — returning null"),
|
|
802
|
+
null;
|
|
803
|
+
try {
|
|
780
804
|
return function(e) {
|
|
781
|
-
const t =
|
|
805
|
+
const t = ge ? fe.getItem(e) : pe().get(e);
|
|
782
806
|
return t ? JSON.parse(t) : t;
|
|
783
|
-
}(
|
|
807
|
+
}(ve(e));
|
|
784
808
|
} catch (t) {
|
|
785
809
|
exports.message(`Error parsing session item '${e}':${t}`);
|
|
786
810
|
}
|
|
811
|
+
return null;
|
|
787
812
|
}
|
|
788
813
|
},
|
|
789
814
|
set: {
|
|
790
815
|
value: (e, t) => {
|
|
791
|
-
if (!e) return
|
|
792
|
-
|
|
793
|
-
|
|
816
|
+
if (!e) return console.warn("[memorio session] session.set() called with empty or null key — write aborted"),
|
|
817
|
+
!1;
|
|
818
|
+
const r = ve(e);
|
|
819
|
+
if (!r) return !1;
|
|
820
|
+
if ("function" == typeof t) return console.warn("[memorio session] functions are not storable — write aborted for key: " + e),
|
|
821
|
+
exports.message("It's not secure to session functions."), !1;
|
|
822
|
+
try {
|
|
794
823
|
!function(e, t) {
|
|
795
824
|
const r = JSON.stringify(t);
|
|
796
|
-
|
|
825
|
+
ge ? fe.setItem(e, r) : pe().set(e, r);
|
|
797
826
|
}(r, t);
|
|
798
827
|
} catch (t) {
|
|
799
|
-
exports.message(`Error setting session item '${e}': ${t}`);
|
|
800
|
-
}
|
|
828
|
+
return exports.message(`Error setting session item '${e}': ${t}`), !1;
|
|
829
|
+
}
|
|
830
|
+
return !0;
|
|
801
831
|
}
|
|
802
832
|
},
|
|
803
833
|
remove: {
|
|
804
834
|
value: e => {
|
|
805
|
-
if (!e) return
|
|
806
|
-
|
|
807
|
-
|
|
835
|
+
if (!e) return console.warn("[memorio session] session.remove() called with empty or null key — returning false"),
|
|
836
|
+
!1;
|
|
837
|
+
const t = ve(e);
|
|
838
|
+
if (!t) return !1;
|
|
839
|
+
try {
|
|
808
840
|
return function(e) {
|
|
809
|
-
if (
|
|
810
|
-
if (
|
|
811
|
-
} else if (
|
|
841
|
+
if (ge) {
|
|
842
|
+
if (fe.getItem(e)) return fe.removeItem(e), !0;
|
|
843
|
+
} else if (pe().has(e)) return pe().delete(e), !0;
|
|
812
844
|
return !1;
|
|
813
845
|
}(t);
|
|
814
846
|
} catch (t) {
|
|
815
847
|
exports.message(`Error removing session item '${e}': ${t}`);
|
|
816
848
|
}
|
|
849
|
+
return !1;
|
|
817
850
|
}
|
|
818
851
|
},
|
|
819
852
|
delete: {
|
|
820
|
-
value: e =>
|
|
853
|
+
value: e => ye.remove(e)
|
|
821
854
|
},
|
|
822
855
|
removeAll: {
|
|
823
856
|
value: () => {
|
|
824
|
-
if (
|
|
857
|
+
if (ge) {
|
|
825
858
|
const e = [];
|
|
826
|
-
for (let t = 0; t <
|
|
827
|
-
const r =
|
|
828
|
-
r?.startsWith(
|
|
859
|
+
for (let t = 0; t < fe.length; t++) {
|
|
860
|
+
const r = fe.key(t);
|
|
861
|
+
r?.startsWith(he()) && e.push(r);
|
|
829
862
|
}
|
|
830
|
-
e.forEach(e =>
|
|
831
|
-
} else
|
|
863
|
+
e.forEach(e => fe.removeItem(e));
|
|
864
|
+
} else pe().clear();
|
|
832
865
|
return !0;
|
|
833
866
|
}
|
|
834
867
|
},
|
|
835
868
|
clearAll: {
|
|
836
|
-
value: () => (
|
|
869
|
+
value: () => (ye.removeAll(), !0)
|
|
837
870
|
},
|
|
838
871
|
quota: {
|
|
839
872
|
value: async () => [ 0, 0 ]
|
|
@@ -841,36 +874,36 @@ Object.defineProperty(globalThis, "session", {
|
|
|
841
874
|
size: {
|
|
842
875
|
value: () => {
|
|
843
876
|
let e = 0;
|
|
844
|
-
return
|
|
845
|
-
if (t.startsWith(
|
|
846
|
-
const r =
|
|
877
|
+
return ge ? Object.keys(fe).forEach(t => {
|
|
878
|
+
if (t.startsWith(he())) {
|
|
879
|
+
const r = fe.getItem(t);
|
|
847
880
|
r && (e += r.length);
|
|
848
881
|
}
|
|
849
|
-
}) :
|
|
882
|
+
}) : pe().forEach(t => {
|
|
850
883
|
e += t.length;
|
|
851
884
|
}), e;
|
|
852
885
|
}
|
|
853
886
|
},
|
|
854
887
|
isPersistent: {
|
|
855
|
-
get: () =>
|
|
888
|
+
get: () => ge
|
|
856
889
|
},
|
|
857
890
|
list: {
|
|
858
891
|
value: () => {
|
|
859
892
|
const e = {};
|
|
860
893
|
try {
|
|
861
|
-
if (
|
|
862
|
-
const r =
|
|
863
|
-
if (r?.startsWith(
|
|
864
|
-
const t = r.replace(
|
|
894
|
+
if (ge) for (let t = 0; t < fe.length; t++) {
|
|
895
|
+
const r = fe.key(t);
|
|
896
|
+
if (r?.startsWith(he())) {
|
|
897
|
+
const t = r.replace(he(), ""), o = fe.getItem(r);
|
|
865
898
|
if (null !== o) try {
|
|
866
899
|
e[t] = JSON.parse(o);
|
|
867
900
|
} catch {
|
|
868
901
|
e[t] = o;
|
|
869
902
|
}
|
|
870
903
|
}
|
|
871
|
-
} else
|
|
872
|
-
if (r.startsWith(
|
|
873
|
-
const o = r.replace(
|
|
904
|
+
} else pe().forEach((t, r) => {
|
|
905
|
+
if (r.startsWith(he())) {
|
|
906
|
+
const o = r.replace(he(), "");
|
|
874
907
|
try {
|
|
875
908
|
e[o] = JSON.parse(t);
|
|
876
909
|
} catch {
|
|
@@ -884,24 +917,24 @@ Object.defineProperty(globalThis, "session", {
|
|
|
884
917
|
return e;
|
|
885
918
|
}
|
|
886
919
|
}
|
|
887
|
-
}), Object.freeze(
|
|
920
|
+
}), Object.freeze(ye);
|
|
888
921
|
|
|
889
|
-
var
|
|
890
|
-
get: (e, t) => "get" === t ? e =>
|
|
891
|
-
|
|
892
|
-
} : "remove" === t ? e => (delete
|
|
922
|
+
var xe = {}, we = new Proxy({}, {
|
|
923
|
+
get: (e, t) => "get" === t ? e => xe[e] : "set" === t ? (e, t) => {
|
|
924
|
+
xe[e] = t;
|
|
925
|
+
} : "remove" === t ? e => (delete xe[e], !0) : "removeAll" === t || "clear" === t ? () => (Object.keys(xe).forEach(e => delete xe[e]),
|
|
893
926
|
!0) : "list" === t ? () => ({
|
|
894
|
-
...
|
|
895
|
-
}) :
|
|
896
|
-
set: (e, t, r) => (
|
|
897
|
-
deleteProperty: (e, t) => (delete
|
|
927
|
+
...xe
|
|
928
|
+
}) : xe[t],
|
|
929
|
+
set: (e, t, r) => (xe[t] = r, !0),
|
|
930
|
+
deleteProperty: (e, t) => (delete xe[t], !0)
|
|
898
931
|
});
|
|
899
932
|
|
|
900
|
-
Object.freeze(
|
|
933
|
+
Object.freeze(we), X(), c();
|
|
901
934
|
|
|
902
|
-
var
|
|
903
|
-
|
|
904
|
-
|
|
935
|
+
var Te = !1, Oe = (e, t = null, r = !0) => {
|
|
936
|
+
Te || (console.warn('DEPRECATED: "observer" is deprecated and will be removed in future versions. Please use "useObserver" instead.'),
|
|
937
|
+
Te = !0);
|
|
905
938
|
const o = e => "string" == typeof e ? e : e && "object" == typeof e && e.__path ? e.__path : null, s = o(e);
|
|
906
939
|
if (e || t) if (e || !t) {
|
|
907
940
|
if (s) {
|
|
@@ -912,27 +945,27 @@ var ye = !1, xe = (e, t = null, r = !0) => {
|
|
|
912
945
|
const t = o(e);
|
|
913
946
|
if (!t) return;
|
|
914
947
|
const r = globalThis.observer;
|
|
915
|
-
return r?.list?.[t] &&
|
|
948
|
+
return r?.list?.[t] && Z.remove(t), void n(`called: ${t}`);
|
|
916
949
|
}
|
|
917
950
|
if (e && t) {
|
|
918
951
|
const s = o(e);
|
|
919
952
|
if (!s) return;
|
|
920
953
|
if ("string" != typeof e && (!e || "object" != typeof e)) return void console.error("Observer Error: name of state need to be a 'string' like 'state.test' or a direct state value");
|
|
921
954
|
const n = Array.isArray(t) ? t : [ t ], i = globalThis.observer;
|
|
922
|
-
return i?.list?.[s] &&
|
|
923
|
-
"function" == typeof e &&
|
|
955
|
+
return i?.list?.[s] && Z.remove(s), void n.forEach(e => {
|
|
956
|
+
"function" == typeof e && Z.listen(s, e, r);
|
|
924
957
|
});
|
|
925
958
|
}
|
|
926
959
|
} else console.error("Observer Error: You need to declare what state need to be monitored as string like 'state.test'."); else console.error("Observer Error: You need to setup observer correctly, Some parameters are missed!");
|
|
927
960
|
};
|
|
928
961
|
|
|
929
|
-
Object.defineProperties(
|
|
962
|
+
Object.defineProperties(Oe, {
|
|
930
963
|
list: {
|
|
931
964
|
get: () => globalThis.events
|
|
932
965
|
},
|
|
933
966
|
remove: {
|
|
934
967
|
value: e => {
|
|
935
|
-
e && (
|
|
968
|
+
e && (Z.remove(e), delete globalThis.events[e]);
|
|
936
969
|
}
|
|
937
970
|
},
|
|
938
971
|
removeAll: {
|
|
@@ -956,7 +989,7 @@ Object.defineProperties(xe, {
|
|
|
956
989
|
configurable: !0
|
|
957
990
|
});
|
|
958
991
|
|
|
959
|
-
var
|
|
992
|
+
var Pe = (e, t = []) => {
|
|
960
993
|
if (!t || "function" != typeof e) return () => {};
|
|
961
994
|
const r = [], o = Array.isArray(t) && !t.__path ? t : [ t ];
|
|
962
995
|
try {
|
|
@@ -969,21 +1002,21 @@ var Te = (e, t = []) => {
|
|
|
969
1002
|
if (o) {
|
|
970
1003
|
o = o.replace(/^(\(\)\s*=>\s*)/, "").replace(/^globalThis\./, "").replace(/^state\./, "");
|
|
971
1004
|
const t = o.startsWith("store.") || o.startsWith("state.") ? o : "state." + o;
|
|
972
|
-
|
|
1005
|
+
Z.listen(t, () => e()), r.push(t);
|
|
973
1006
|
} else {
|
|
974
1007
|
exports.internal.clearTrackedPaths(), exports.internal.tracking = !0;
|
|
975
1008
|
try {
|
|
976
1009
|
e();
|
|
977
1010
|
} catch (e) {}
|
|
978
1011
|
exports.internal.tracking = !1, exports.internal.trackedPaths.forEach(t => {
|
|
979
|
-
r.includes(t) || (n(`useObserver: [Auto-Discovery] -> "${t}"`),
|
|
1012
|
+
r.includes(t) || (n(`useObserver: [Auto-Discovery] -> "${t}"`), Z.listen(t, () => e()),
|
|
980
1013
|
r.push(t));
|
|
981
1014
|
});
|
|
982
1015
|
}
|
|
983
1016
|
}), r.length > 0 ? n(`useObserver: Monitoring ${r.length} paths.`) : console.warn("useObserver: No paths resolved for monitoring. Check your dependencies!"),
|
|
984
1017
|
() => {
|
|
985
1018
|
r.forEach(e => {
|
|
986
|
-
"function" == typeof
|
|
1019
|
+
"function" == typeof Z.remove && (Z.remove(e), n(`useObserver: Stopped monitoring "${e}"`));
|
|
987
1020
|
});
|
|
988
1021
|
};
|
|
989
1022
|
} catch (e) {
|
|
@@ -991,7 +1024,7 @@ var Te = (e, t = []) => {
|
|
|
991
1024
|
}
|
|
992
1025
|
};
|
|
993
1026
|
|
|
994
|
-
function
|
|
1027
|
+
function je() {
|
|
995
1028
|
if (!globalThis.store) return {};
|
|
996
1029
|
const e = {}, t = globalThis.store;
|
|
997
1030
|
if ("function" == typeof t.list) try {
|
|
@@ -1004,7 +1037,7 @@ function Oe() {
|
|
|
1004
1037
|
return e;
|
|
1005
1038
|
}
|
|
1006
1039
|
|
|
1007
|
-
function
|
|
1040
|
+
function ke() {
|
|
1008
1041
|
if (!globalThis.session) return {};
|
|
1009
1042
|
const e = {}, t = globalThis.session;
|
|
1010
1043
|
if ("function" == typeof t.list) try {
|
|
@@ -1017,11 +1050,11 @@ function we() {
|
|
|
1017
1050
|
return e;
|
|
1018
1051
|
}
|
|
1019
1052
|
|
|
1020
|
-
globalThis.useObserver =
|
|
1053
|
+
globalThis.useObserver = Pe, Object.freeze(globalThis.useObserver), c(), i();
|
|
1021
1054
|
|
|
1022
|
-
var
|
|
1055
|
+
var Se = e => {
|
|
1023
1056
|
globalThis[e] && "function" == typeof globalThis[e].clear ? globalThis[e].clear() : console.error(`Module ${e} not found or does not support clear()`);
|
|
1024
|
-
},
|
|
1057
|
+
}, Ee = {
|
|
1025
1058
|
inspect: () => {
|
|
1026
1059
|
if (!0 === exports.internal.debug) {
|
|
1027
1060
|
if (globalThis.state) {
|
|
@@ -1030,7 +1063,7 @@ var Pe = e => {
|
|
|
1030
1063
|
t = "function" == typeof e ? e() : "object" == typeof e && null !== e ? e : globalThis.state,
|
|
1031
1064
|
console.table(t);
|
|
1032
1065
|
}
|
|
1033
|
-
if (globalThis.store && console.table(
|
|
1066
|
+
if (globalThis.store && console.table(je()), globalThis.session && console.table(ke()),
|
|
1034
1067
|
globalThis.cache) {
|
|
1035
1068
|
const e = globalThis.cache.list;
|
|
1036
1069
|
let t;
|
|
@@ -1057,9 +1090,9 @@ var Pe = e => {
|
|
|
1057
1090
|
lastUpdate: (new Date).toISOString()
|
|
1058
1091
|
};
|
|
1059
1092
|
},
|
|
1060
|
-
clear:
|
|
1093
|
+
clear: Se,
|
|
1061
1094
|
clearAll: () => {
|
|
1062
|
-
|
|
1095
|
+
Se("state"), Se("store"), Se("session"), Se("cache");
|
|
1063
1096
|
},
|
|
1064
1097
|
exportData: () => {
|
|
1065
1098
|
const e = {
|
|
@@ -1070,8 +1103,8 @@ var Pe = e => {
|
|
|
1070
1103
|
return;
|
|
1071
1104
|
}
|
|
1072
1105
|
})(),
|
|
1073
|
-
store:
|
|
1074
|
-
session:
|
|
1106
|
+
store: je(),
|
|
1107
|
+
session: ke(),
|
|
1075
1108
|
cache: (() => {
|
|
1076
1109
|
if (globalThis.cache) try {
|
|
1077
1110
|
return "function" == typeof globalThis.cache.list ? globalThis.cache.list() : globalThis.cache;
|
|
@@ -1117,33 +1150,33 @@ var Pe = e => {
|
|
|
1117
1150
|
|
|
1118
1151
|
i(), c();
|
|
1119
1152
|
|
|
1120
|
-
var
|
|
1153
|
+
var $e = {
|
|
1121
1154
|
enabled: !0,
|
|
1122
1155
|
logToConsole: !0,
|
|
1123
1156
|
modules: [ "state", "store", "session", "cache", "idb" ],
|
|
1124
1157
|
maxEntries: 1e3
|
|
1125
|
-
},
|
|
1158
|
+
}, De = [], Ce = e => $e.enabled && $e.modules.includes(e), Ae = e => ({
|
|
1126
1159
|
state: "#4CAF50",
|
|
1127
1160
|
store: "#2196F3",
|
|
1128
1161
|
session: "#FF9800",
|
|
1129
1162
|
cache: "#9C27B0",
|
|
1130
1163
|
idb: "#F44336"
|
|
1131
|
-
}[e] || "#888888"),
|
|
1164
|
+
}[e] || "#888888"), _e = {
|
|
1132
1165
|
configure: e => {
|
|
1133
|
-
|
|
1134
|
-
|
|
1166
|
+
$e = {
|
|
1167
|
+
...$e,
|
|
1135
1168
|
...e
|
|
1136
1169
|
};
|
|
1137
1170
|
},
|
|
1138
1171
|
enable: () => {
|
|
1139
|
-
|
|
1172
|
+
$e.enabled = !0;
|
|
1140
1173
|
},
|
|
1141
1174
|
disable: () => {
|
|
1142
|
-
|
|
1175
|
+
$e.enabled = !1;
|
|
1143
1176
|
},
|
|
1144
|
-
isEnabled:
|
|
1177
|
+
isEnabled: Ce,
|
|
1145
1178
|
log: (e, t, r, o, s) => {
|
|
1146
|
-
if (
|
|
1179
|
+
if (!Ce(e)) return;
|
|
1147
1180
|
const i = {
|
|
1148
1181
|
timestamp: (new Date).toISOString(),
|
|
1149
1182
|
module: e,
|
|
@@ -1152,20 +1185,20 @@ var Se = {
|
|
|
1152
1185
|
value: o,
|
|
1153
1186
|
previousValue: s
|
|
1154
1187
|
};
|
|
1155
|
-
if (
|
|
1156
|
-
const i = `[Memorio:${e.toUpperCase()}]`, a =
|
|
1188
|
+
if (De.push(i), De.length > $e.maxEntries && De.shift(), $e.logToConsole && !0 === exports.internal.debug) {
|
|
1189
|
+
const i = `[Memorio:${e.toUpperCase()}]`, a = Ae(e);
|
|
1157
1190
|
n(`%c${i}%c ${t} ${r},\n color: ${a}; font-weight: bold,\n color: inherit`),
|
|
1158
1191
|
void 0 !== o && n(` → value:${o}`), void 0 !== s && n(` ← previous:${s}`);
|
|
1159
1192
|
}
|
|
1160
|
-
|
|
1193
|
+
$e.customHandler && $e.customHandler(i);
|
|
1161
1194
|
},
|
|
1162
|
-
getHistory: () => [ ...
|
|
1195
|
+
getHistory: () => [ ...De ],
|
|
1163
1196
|
clearHistory: () => {
|
|
1164
|
-
|
|
1197
|
+
De.length = 0;
|
|
1165
1198
|
},
|
|
1166
1199
|
getStats: () => {
|
|
1167
1200
|
const e = {
|
|
1168
|
-
total:
|
|
1201
|
+
total: De.length,
|
|
1169
1202
|
state: 0,
|
|
1170
1203
|
store: 0,
|
|
1171
1204
|
session: 0,
|
|
@@ -1176,28 +1209,28 @@ var Se = {
|
|
|
1176
1209
|
delete: 0,
|
|
1177
1210
|
clear: 0
|
|
1178
1211
|
};
|
|
1179
|
-
for (const t of
|
|
1212
|
+
for (const t of De) if (t) {
|
|
1180
1213
|
const r = t.module, o = t.action;
|
|
1181
1214
|
r && "number" == typeof e[r] && e[r]++, o && "number" == typeof e[o] && e[o]++;
|
|
1182
1215
|
}
|
|
1183
1216
|
return e;
|
|
1184
1217
|
},
|
|
1185
|
-
exportLogs: () => JSON.stringify(
|
|
1218
|
+
exportLogs: () => JSON.stringify(De, null, 2)
|
|
1186
1219
|
};
|
|
1187
1220
|
|
|
1188
1221
|
i(), j(), j(), i();
|
|
1189
1222
|
|
|
1190
|
-
var
|
|
1223
|
+
var Ie = "4.6.6";
|
|
1191
1224
|
|
|
1192
|
-
|
|
1225
|
+
X(), c(), Object.defineProperty(globalThis, "memorio", {
|
|
1193
1226
|
value: {
|
|
1194
1227
|
setProps: () => {},
|
|
1195
1228
|
obj: {},
|
|
1196
1229
|
array: [],
|
|
1197
|
-
dispatch:
|
|
1230
|
+
dispatch: Z,
|
|
1198
1231
|
message: exports.message,
|
|
1199
|
-
devtools:
|
|
1200
|
-
logger:
|
|
1232
|
+
devtools: Ee,
|
|
1233
|
+
logger: _e,
|
|
1201
1234
|
setDescription: () => {}
|
|
1202
1235
|
},
|
|
1203
1236
|
writable: !1,
|
|
@@ -1210,7 +1243,7 @@ Q(), c(), Object.defineProperty(globalThis, "memorio", {
|
|
|
1210
1243
|
}), Object.defineProperty(memorio, "version", {
|
|
1211
1244
|
writable: !1,
|
|
1212
1245
|
enumerable: !1,
|
|
1213
|
-
value:
|
|
1246
|
+
value: Ie
|
|
1214
1247
|
}), Object.defineProperty(memorio, "debug", {
|
|
1215
1248
|
get: () => exports.internal.debug,
|
|
1216
1249
|
set: e => {
|
|
@@ -1219,16 +1252,16 @@ Q(), c(), Object.defineProperty(globalThis, "memorio", {
|
|
|
1219
1252
|
enumerable: !1
|
|
1220
1253
|
});
|
|
1221
1254
|
|
|
1222
|
-
var
|
|
1255
|
+
var Ne = y();
|
|
1223
1256
|
|
|
1224
1257
|
Object.defineProperty(memorio, "_platform", {
|
|
1225
1258
|
writable: !1,
|
|
1226
1259
|
enumerable: !1,
|
|
1227
|
-
value:
|
|
1260
|
+
value: Ne.platform
|
|
1228
1261
|
}), Object.defineProperty(memorio, "_capabilities", {
|
|
1229
1262
|
writable: !1,
|
|
1230
1263
|
enumerable: !1,
|
|
1231
|
-
value:
|
|
1264
|
+
value: Ne
|
|
1232
1265
|
}), Object.defineProperty(memorio, "_sessionId", {
|
|
1233
1266
|
writable: !1,
|
|
1234
1267
|
enumerable: !1,
|
|
@@ -1261,25 +1294,25 @@ Object.defineProperty(memorio, "_platform", {
|
|
|
1261
1294
|
}
|
|
1262
1295
|
}), !0;
|
|
1263
1296
|
});
|
|
1264
|
-
}(), memorio.isBrowser = b, memorio.isNode = f, memorio.isDeno =
|
|
1265
|
-
memorio.getCapabilities = y, memorio.createContext = x, memorio.listContexts =
|
|
1266
|
-
memorio.deleteContext =
|
|
1267
|
-
value:
|
|
1297
|
+
}(), memorio.isBrowser = b, memorio.isNode = f, memorio.isDeno = m, memorio.isEdge = p,
|
|
1298
|
+
memorio.getCapabilities = y, memorio.createContext = x, memorio.listContexts = w,
|
|
1299
|
+
memorio.deleteContext = T, memorio.isolate = e => x(e), Object.defineProperty(globalThis, "state", {
|
|
1300
|
+
value: ne,
|
|
1268
1301
|
writable: !0,
|
|
1269
1302
|
enumerable: !1,
|
|
1270
1303
|
configurable: !0
|
|
1271
1304
|
}), Object.defineProperty(globalThis, "store", {
|
|
1272
|
-
value:
|
|
1305
|
+
value: be,
|
|
1273
1306
|
writable: !0,
|
|
1274
1307
|
enumerable: !1,
|
|
1275
1308
|
configurable: !0
|
|
1276
1309
|
}), Object.defineProperty(globalThis, "session", {
|
|
1277
|
-
value:
|
|
1310
|
+
value: ye,
|
|
1278
1311
|
writable: !0,
|
|
1279
1312
|
enumerable: !1,
|
|
1280
1313
|
configurable: !0
|
|
1281
1314
|
}), Object.defineProperty(globalThis, "cache", {
|
|
1282
|
-
value:
|
|
1315
|
+
value: we,
|
|
1283
1316
|
writable: !0,
|
|
1284
1317
|
enumerable: !1,
|
|
1285
1318
|
configurable: !0
|
|
@@ -1289,24 +1322,24 @@ memorio.deleteContext = O, memorio.isolate = e => x(e), Object.defineProperty(gl
|
|
|
1289
1322
|
enumerable: !1,
|
|
1290
1323
|
configurable: !0
|
|
1291
1324
|
}), Object.defineProperty(globalThis, "observer", {
|
|
1292
|
-
value:
|
|
1325
|
+
value: Oe,
|
|
1293
1326
|
writable: !0,
|
|
1294
1327
|
enumerable: !1,
|
|
1295
1328
|
configurable: !0
|
|
1296
1329
|
}), Object.defineProperty(globalThis, "useObserver", {
|
|
1297
|
-
value:
|
|
1330
|
+
value: Pe,
|
|
1298
1331
|
writable: !0,
|
|
1299
1332
|
enumerable: !1,
|
|
1300
1333
|
configurable: !0
|
|
1301
1334
|
}), Object.defineProperty(memorio, "dispatch", {
|
|
1302
|
-
value:
|
|
1335
|
+
value: Z,
|
|
1303
1336
|
writable: !0,
|
|
1304
1337
|
enumerable: !1,
|
|
1305
1338
|
configurable: !0
|
|
1306
1339
|
}), Object.defineProperty(memorio, "setContext", {
|
|
1307
1340
|
writable: !1,
|
|
1308
1341
|
enumerable: !1,
|
|
1309
|
-
value: e =>
|
|
1342
|
+
value: e => O(e)
|
|
1310
1343
|
}), Object.defineProperty(memorio, "getContext", {
|
|
1311
1344
|
writable: !1,
|
|
1312
1345
|
enumerable: !1,
|
|
@@ -1324,15 +1357,15 @@ memorio.deleteContext = O, memorio.isolate = e => x(e), Object.defineProperty(gl
|
|
|
1324
1357
|
get: () => globalThis.cache,
|
|
1325
1358
|
configurable: !0
|
|
1326
1359
|
}), memorio.help = function() {
|
|
1327
|
-
console.debug(`\n🧠 Memorio ${
|
|
1360
|
+
console.debug(`\n🧠 Memorio ${Ie} - Help\n\nCore Modules:\n state - Reactive state management\n store - Persistent storage (localStorage/Map)\n session - Session storage (sessionStorage/Map)\n cache - In-memory cache\n idb - IndexedDB (browser only)\n\nContext Management:\n memorio.isolate(name) - Create isolated context\n memorio.listContexts() - List all contexts\n memorio.deleteContext(id) - Delete a context\n\nPlatform Detection:\n memorio.isBrowser() - Browser environment\n memorio.isNode() - Node.js environment\n memorio.isDeno() - Deno environment\n memorio.isEdge() - Edge/Worker environment\n memorio.getCapabilities() - Full capabilities object\n\nDevTools:\n memorio.devtools.inspect() - Inspect all modules\n memorio.devtools.stats() - Show statistics\n memorio.devtools.watch() - Watch a path\n memorio.devtools.exportData() - Export as JSON\n memorio.devtools.importData() - Import from JSON\n memorio.devtools.clear() - Clear specific module\n memorio.devtools.clearAll() - Clear all modules\n\nShortcuts:\n state, store, session, cache, idb - direct access to modules\n`);
|
|
1328
1361
|
};
|
|
1329
1362
|
|
|
1330
|
-
var
|
|
1363
|
+
var Me = globalThis.memorio, Be = globalThis.events, ze = globalThis.memorio?.help, Je = Me;
|
|
1331
1364
|
|
|
1332
|
-
exports.cache =
|
|
1333
|
-
exports.devtools =
|
|
1334
|
-
exports.getContext = () => exports.internal.currentContext, exports.help =
|
|
1335
|
-
exports.isDeno =
|
|
1336
|
-
exports.listContexts =
|
|
1337
|
-
exports.session =
|
|
1338
|
-
exports.state =
|
|
1365
|
+
exports.cache = we, exports.createContext = x, exports.default = Je, exports.deleteContext = T,
|
|
1366
|
+
exports.devtools = Ee, exports.dispatch = Z, exports.events = Be, exports.getCapabilities = y,
|
|
1367
|
+
exports.getContext = () => exports.internal.currentContext, exports.help = ze, exports.isBrowser = b,
|
|
1368
|
+
exports.isDeno = m, exports.isEdge = p, exports.isNode = f, exports.isolate = e => x(e),
|
|
1369
|
+
exports.listContexts = w, exports.logger = _e, exports.memorio = Me, exports.observer = Oe,
|
|
1370
|
+
exports.session = ye, exports.setContext = e => exports.internal.currentContext = e,
|
|
1371
|
+
exports.state = ne, exports.store = be, exports.useObserver = Pe;
|