memorio 4.6.6 ā 4.6.8
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/package.json +3 -2
- package/types/cache.d.ts +1 -1
- package/types/idb.d.ts +1 -1
- package/types/observer.d.ts +1 -1
- package/types/useObserver.d.ts +1 -1
- package/COPYRIGHT.md +0 -6
- package/SECURITY.md +0 -48
- package/SUMMARY.md +0 -28
- package/examples/basic.ts +0 -115
- package/examples/browser-vanilla.html +0 -358
- package/examples/cache.ts +0 -72
- package/examples/idb.ts +0 -109
- package/examples/node-server.ts +0 -308
- package/examples/observer.ts +0 -60
- package/examples/platform.ts +0 -115
- package/examples/react-app.tsx +0 -362
- package/examples/session-advanced.ts +0 -91
- package/examples/state-advanced.ts +0 -89
- package/examples/store-advanced.ts +0 -117
- package/examples/useObserver.tsx +0 -141
- package/index.cjs +0 -1371
- package/index.d.ts +0 -18
- package/index.js +0 -1346
- package/llms.txt +0 -405
- package/markdown/CACHE.md +0 -90
- package/markdown/CHANGELOG.md +0 -161
- package/markdown/DEVTOOLS.md +0 -122
- package/markdown/DISPATCH.md +0 -168
- package/markdown/IDB.md +0 -169
- package/markdown/IMPORT.md +0 -139
- package/markdown/LOGGER.md +0 -147
- package/markdown/OBSERVER.md +0 -200
- package/markdown/PLATFORM.md +0 -265
- package/markdown/SECURITY.md +0 -323
- package/markdown/SESSION.md +0 -154
- package/markdown/STATE.md +0 -153
- package/markdown/STORE.md +0 -164
- package/markdown/USEOBSERVER.md +0 -259
package/index.js
DELETED
|
@@ -1,1346 +0,0 @@
|
|
|
1
|
-
var e, t, o, r, s, n, i, a, l = Object.getOwnPropertyNames, c = (e, t) => function() {
|
|
2
|
-
return e && (t = (0, e[l(e)[0]])(e = 0)), t;
|
|
3
|
-
}, u = c({
|
|
4
|
-
"core/internal.ts"() {
|
|
5
|
-
e = {
|
|
6
|
-
debug: !1,
|
|
7
|
-
tracking: !1,
|
|
8
|
-
trackedPaths: new Set,
|
|
9
|
-
locked: !1,
|
|
10
|
-
lastAccessedPath: "",
|
|
11
|
-
stateVersion: 0,
|
|
12
|
-
currentContext: null
|
|
13
|
-
}, t = [ "list", "state", "store", "idb", "observer", "useObserver", "remove", "removeAll", "_platform", "_capabilities", "_sessionId" ],
|
|
14
|
-
o = (e, t) => String(void 0 !== t ? t : e).replace("() => ", ""), r = {
|
|
15
|
-
get debug() {
|
|
16
|
-
return e.debug;
|
|
17
|
-
},
|
|
18
|
-
set debug(t) {
|
|
19
|
-
e.debug = t;
|
|
20
|
-
},
|
|
21
|
-
get tracking() {
|
|
22
|
-
return e.tracking;
|
|
23
|
-
},
|
|
24
|
-
set tracking(t) {
|
|
25
|
-
e.tracking = t;
|
|
26
|
-
},
|
|
27
|
-
get trackedPaths() {
|
|
28
|
-
return e.trackedPaths;
|
|
29
|
-
},
|
|
30
|
-
clearTrackedPaths() {
|
|
31
|
-
e.trackedPaths.clear();
|
|
32
|
-
},
|
|
33
|
-
get locked() {
|
|
34
|
-
return e.locked;
|
|
35
|
-
},
|
|
36
|
-
set locked(t) {
|
|
37
|
-
e.locked = t;
|
|
38
|
-
},
|
|
39
|
-
get lastAccessedPath() {
|
|
40
|
-
return e.lastAccessedPath;
|
|
41
|
-
},
|
|
42
|
-
set lastAccessedPath(t) {
|
|
43
|
-
e.lastAccessedPath = t;
|
|
44
|
-
},
|
|
45
|
-
get stateVersion() {
|
|
46
|
-
return e.stateVersion;
|
|
47
|
-
},
|
|
48
|
-
bumpStateVersion: () => (e.stateVersion = (e.stateVersion || 0) + 1, e.stateVersion),
|
|
49
|
-
get currentContext() {
|
|
50
|
-
return e.currentContext;
|
|
51
|
-
},
|
|
52
|
-
set currentContext(t) {
|
|
53
|
-
e.currentContext = t;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}), d = c({
|
|
58
|
-
"functions/message/index.ts"() {
|
|
59
|
-
u(), n = s = (...e) => {
|
|
60
|
-
!0 === r.debug && console.debug(...e);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
function b() {
|
|
66
|
-
const e = globalThis;
|
|
67
|
-
if (void 0 !== e.crypto && e.crypto.randomUUID) return e.crypto.randomUUID();
|
|
68
|
-
if (void 0 !== e.crypto && e.crypto.getRandomValues) {
|
|
69
|
-
const t = new Uint8Array(16);
|
|
70
|
-
return e.crypto.getRandomValues(t), Array.from(t, e => e.toString(16).padStart(2, "0")).join("");
|
|
71
|
-
}
|
|
72
|
-
return `session_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function f() {
|
|
76
|
-
const e = globalThis;
|
|
77
|
-
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";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function m() {
|
|
81
|
-
return "browser" === f();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function g() {
|
|
85
|
-
return "node" === f();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function h() {
|
|
89
|
-
return "deno" === f();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function p() {
|
|
93
|
-
return "edge" === f();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function v() {
|
|
97
|
-
try {
|
|
98
|
-
if ("undefined" != typeof sessionStorage) {
|
|
99
|
-
const e = "__memorio_test__";
|
|
100
|
-
return sessionStorage.setItem(e, "1"), sessionStorage.removeItem(e), sessionStorage;
|
|
101
|
-
}
|
|
102
|
-
} catch (e) {}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function y() {
|
|
107
|
-
try {
|
|
108
|
-
if ("undefined" != typeof localStorage) {
|
|
109
|
-
const e = "__memorio_test__";
|
|
110
|
-
return localStorage.setItem(e, "1"), localStorage.removeItem(e), localStorage;
|
|
111
|
-
}
|
|
112
|
-
} catch (e) {}
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function w() {
|
|
117
|
-
return "undefined" != typeof indexedDB;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function T() {
|
|
121
|
-
const e = f(), t = void 0 !== globalThis.isSecureContext ? globalThis.isSecureContext : "browser" === e;
|
|
122
|
-
return {
|
|
123
|
-
platform: e,
|
|
124
|
-
hasSessionStorage: null !== v(),
|
|
125
|
-
hasLocalStorage: null !== y(),
|
|
126
|
-
hasIndexedDB: w(),
|
|
127
|
-
hasDispatchEvent: "function" == typeof globalThis.dispatchEvent,
|
|
128
|
-
hasNavigator: "undefined" != typeof navigator,
|
|
129
|
-
hasProcess: "undefined" != typeof process,
|
|
130
|
-
isSecureContext: t,
|
|
131
|
-
sessionId: b()
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function O(e) {
|
|
136
|
-
const t = e || `context_${b()}`;
|
|
137
|
-
k(t);
|
|
138
|
-
const o = {
|
|
139
|
-
state: {},
|
|
140
|
-
store: new Map,
|
|
141
|
-
session: new Map,
|
|
142
|
-
cache: new Map
|
|
143
|
-
};
|
|
144
|
-
return a.set(t, o), {
|
|
145
|
-
id: t,
|
|
146
|
-
state: o.state,
|
|
147
|
-
store: {
|
|
148
|
-
get: e => {
|
|
149
|
-
const t = o.store.get(e);
|
|
150
|
-
return t ? JSON.parse(t) : null;
|
|
151
|
-
},
|
|
152
|
-
set: (e, t) => {
|
|
153
|
-
o.store.set(e, JSON.stringify(t));
|
|
154
|
-
},
|
|
155
|
-
remove: e => o.store.delete(e),
|
|
156
|
-
removeAll: () => o.store.clear(),
|
|
157
|
-
clearAll: () => o.store.clear(),
|
|
158
|
-
size: () => o.store.size,
|
|
159
|
-
isPersistent: !1
|
|
160
|
-
},
|
|
161
|
-
session: {
|
|
162
|
-
get: e => {
|
|
163
|
-
const t = o.session.get(e);
|
|
164
|
-
return t ? JSON.parse(t) : null;
|
|
165
|
-
},
|
|
166
|
-
set: (e, t) => {
|
|
167
|
-
o.session.set(e, JSON.stringify(t));
|
|
168
|
-
},
|
|
169
|
-
remove: e => o.session.delete(e),
|
|
170
|
-
removeAll: () => o.session.clear(),
|
|
171
|
-
clearAll: () => o.session.clear(),
|
|
172
|
-
size: () => o.session.size,
|
|
173
|
-
isPersistent: !1
|
|
174
|
-
},
|
|
175
|
-
cache: {
|
|
176
|
-
get: e => o.cache.get(e),
|
|
177
|
-
set: (e, t) => o.cache.set(e, t),
|
|
178
|
-
remove: e => o.cache.delete(e),
|
|
179
|
-
removeAll: () => o.cache.clear(),
|
|
180
|
-
clear: () => o.cache.clear()
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function P() {
|
|
186
|
-
return Array.from(a.keys());
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function j(e) {
|
|
190
|
-
return a.delete(e);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function k(e) {
|
|
194
|
-
r.currentContext = e;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var S, $, E = c({
|
|
198
|
-
"core/platform.ts"() {
|
|
199
|
-
u(), i = new Map, a = new Map;
|
|
200
|
-
}
|
|
201
|
-
}), x = {}, D = c({
|
|
202
|
-
"functions/idb/tools/db.create.ts"() {
|
|
203
|
-
te(), d(), $.db.create = (e, t = 1) => new Promise((o, r) => {
|
|
204
|
-
if (!$.db.support()) return r(new Error("IndexedDB not supported"));
|
|
205
|
-
const s = globalThis.indexedDB.open(e, t);
|
|
206
|
-
s.onerror = () => {
|
|
207
|
-
n(`IndexedDB error: ${s.error?.message}`), r(s.error);
|
|
208
|
-
}, s.onsuccess = () => {
|
|
209
|
-
n(`Database ${e} connected successfully`), o(s.result);
|
|
210
|
-
}, s.onupgradeneeded = () => {
|
|
211
|
-
n(`Database ${e} upgrade/creation initiated`);
|
|
212
|
-
};
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}), A = {}, C = c({
|
|
216
|
-
"functions/idb/tools/db.list.ts"() {
|
|
217
|
-
te(), $.db.list = async () => {
|
|
218
|
-
if (!("indexedDB" in globalThis) || !indexedDB.databases) return [];
|
|
219
|
-
try {
|
|
220
|
-
const e = await indexedDB.databases();
|
|
221
|
-
return globalThis.idbases = e || [], await $.db.size(), globalThis.idbases;
|
|
222
|
-
} catch (e) {
|
|
223
|
-
return console.error("Error listing databases:", e), [];
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}), I = {}, _ = c({
|
|
228
|
-
"functions/idb/tools/db.exist.ts"() {
|
|
229
|
-
te(), $.db.exist = e => idbases?.some(t => t.name === e);
|
|
230
|
-
}
|
|
231
|
-
}), N = {}, M = c({
|
|
232
|
-
"functions/idb/tools/db.quota.ts"() {
|
|
233
|
-
te(), $.db.quota = () => navigator.storage.estimate();
|
|
234
|
-
}
|
|
235
|
-
}), B = {}, z = c({
|
|
236
|
-
"functions/idb/tools/db.delete.ts"() {
|
|
237
|
-
te(), d(), $.db.delete = e => new Promise((t, o) => {
|
|
238
|
-
n(`Removing database ${e}...`);
|
|
239
|
-
(() => {
|
|
240
|
-
const r = indexedDB.deleteDatabase(e);
|
|
241
|
-
r.onsuccess = () => {
|
|
242
|
-
n(`${e} database removed successfully`), $.db.list(), t();
|
|
243
|
-
}, r.onerror = () => {
|
|
244
|
-
console.error(`Error removing ${e}:`, r.error), o(r.error);
|
|
245
|
-
}, r.onblocked = () => {
|
|
246
|
-
console.warn(`Deletion of ${e} is blocked. Please close other tabs.`);
|
|
247
|
-
};
|
|
248
|
-
})();
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}), J = {}, W = c({
|
|
252
|
-
"functions/idb/tools/db.size.ts"() {
|
|
253
|
-
te(), d(), $.db.size = async () => {
|
|
254
|
-
if (idbases && 0 !== idbases.length) for (let e = 0; e < idbases.length; e++) {
|
|
255
|
-
const t = idbases[e];
|
|
256
|
-
try {
|
|
257
|
-
const e = await $.db.create(t.name, t.version), o = Array.from(e.objectStoreNames);
|
|
258
|
-
let r = 0;
|
|
259
|
-
for (const t of o) {
|
|
260
|
-
r += await $.table.size(e, t);
|
|
261
|
-
}
|
|
262
|
-
t.size = r, e.close();
|
|
263
|
-
} catch (e) {
|
|
264
|
-
n(`Could not calculate size for ${t.name}:${e}`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
}), R = {}, V = c({
|
|
270
|
-
"functions/idb/tools/db.version.ts"() {
|
|
271
|
-
te(), $.db.version = e => {
|
|
272
|
-
let t = 0;
|
|
273
|
-
for (const o of idbases) {
|
|
274
|
-
o.name === e && (t = o.version);
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
return t;
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
}), U = {}, q = c({
|
|
281
|
-
"functions/idb/tools/db.support.ts"() {
|
|
282
|
-
te(), d(), $.db.support = () => {
|
|
283
|
-
const e = "indexedDB" in globalThis;
|
|
284
|
-
return e || n("Your environment doesn't support IndexedDB"), e;
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}), F = {}, L = c({
|
|
288
|
-
"functions/idb/tools/table.create.ts"() {
|
|
289
|
-
te(), d(), $.table.create = (e, t) => new Promise((o, r) => {
|
|
290
|
-
try {
|
|
291
|
-
const s = (Number($.db.version(e)) || 0) + 1, i = indexedDB.open(e, s);
|
|
292
|
-
i.onupgradeneeded = o => {
|
|
293
|
-
const r = o.target.result;
|
|
294
|
-
if (!r.objectStoreNames.contains(t)) {
|
|
295
|
-
const o = r.createObjectStore(t, {
|
|
296
|
-
keyPath: "id",
|
|
297
|
-
autoIncrement: !0
|
|
298
|
-
});
|
|
299
|
-
o.createIndex("id", "id", {
|
|
300
|
-
unique: !0
|
|
301
|
-
}), o.createIndex("data", "data", {
|
|
302
|
-
unique: !1
|
|
303
|
-
}), n(`Table ${t} created in ${e}`);
|
|
304
|
-
}
|
|
305
|
-
}, i.onsuccess = () => {
|
|
306
|
-
i.result.close(), $.db.list(), o();
|
|
307
|
-
}, i.onerror = () => {
|
|
308
|
-
console.error(`Error creating table ${t}:`, i.error), r(i.error);
|
|
309
|
-
};
|
|
310
|
-
} catch (e) {
|
|
311
|
-
console.error("Critical error in table.create:", e), r(e);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}), K = {}, H = c({
|
|
316
|
-
"functions/idb/tools/table.size.ts"() {
|
|
317
|
-
te(), d(), $.table.size = (e, t) => new Promise((o, r) => {
|
|
318
|
-
if (!e) return r(new Error("Database instance is required"));
|
|
319
|
-
if (!e.objectStoreNames.contains(t)) return o(0);
|
|
320
|
-
let s = 0, i = 0;
|
|
321
|
-
const a = e.transaction([ t ], "readonly").objectStore(t).openCursor();
|
|
322
|
-
a.onsuccess = async e => {
|
|
323
|
-
const t = e.target.result;
|
|
324
|
-
if (t) {
|
|
325
|
-
try {
|
|
326
|
-
const e = t.value;
|
|
327
|
-
s += JSON.stringify(e).length;
|
|
328
|
-
} catch (e) {
|
|
329
|
-
n(`Error stringifying IDB value tracking size:${e}`);
|
|
330
|
-
}
|
|
331
|
-
i++, i % 200 == 0 && await new Promise(e => setTimeout(e, 0)), t.continue();
|
|
332
|
-
} else o(s);
|
|
333
|
-
}, a.onerror = () => {
|
|
334
|
-
r(a.error);
|
|
335
|
-
};
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}), Y = {}, G = c({
|
|
339
|
-
"functions/idb/crud/data.delete.ts"() {
|
|
340
|
-
te(), d(), $.data.delete = (e, t, o) => new Promise((r, s) => {
|
|
341
|
-
const i = indexedDB.open(e);
|
|
342
|
-
i.onsuccess = () => {
|
|
343
|
-
const e = i.result;
|
|
344
|
-
if (!e.objectStoreNames.contains(t)) return e.close(), s(new Error(`Table ${t} not found`));
|
|
345
|
-
const a = e.transaction(t, "readwrite").objectStore(t).delete(o);
|
|
346
|
-
a.onsuccess = () => {
|
|
347
|
-
e.close(), n(`Record ${o} deleted from ${t}`), r();
|
|
348
|
-
}, a.onerror = () => {
|
|
349
|
-
e.close(), s(a.error);
|
|
350
|
-
};
|
|
351
|
-
}, i.onerror = () => s(i.error);
|
|
352
|
-
}), $.data.delete.all = (e, t) => new Promise((o, r) => {
|
|
353
|
-
const s = indexedDB.open(e);
|
|
354
|
-
s.onsuccess = e => {
|
|
355
|
-
const s = e.target.result;
|
|
356
|
-
if (!s.objectStoreNames.contains(t)) return s.close(), r(new Error(`Table ${t} not found`));
|
|
357
|
-
const i = s.transaction(t, "readwrite").objectStore(t).clear();
|
|
358
|
-
i.onsuccess = () => {
|
|
359
|
-
s.close(), n(`All data cleared from ${t}`), o();
|
|
360
|
-
}, i.onerror = () => {
|
|
361
|
-
s.close(), r(i.error);
|
|
362
|
-
};
|
|
363
|
-
}, s.onerror = () => r(s.error);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
}), Q = {}, X = c({
|
|
367
|
-
"functions/idb/crud/data.set.ts"() {
|
|
368
|
-
te(), d(), $.data.set = (e, t, o) => new Promise((r, s) => {
|
|
369
|
-
const i = indexedDB.open(e);
|
|
370
|
-
i.onsuccess = () => {
|
|
371
|
-
const a = i.result;
|
|
372
|
-
if (!a.objectStoreNames.contains(t)) return a.close(), s(new Error(`Table ${t} does not exist in ${e}`));
|
|
373
|
-
const l = a.transaction(t, "readwrite").objectStore(t).put(o);
|
|
374
|
-
l.onsuccess = () => {
|
|
375
|
-
a.close(), n(`Data saved in ${e}.${t}`), r(l.result);
|
|
376
|
-
}, l.onerror = e => {
|
|
377
|
-
a.close(), n(`Database insert error: ${l.error?.message}`), s(l.error);
|
|
378
|
-
};
|
|
379
|
-
}, i.onerror = () => {
|
|
380
|
-
s(i.error);
|
|
381
|
-
};
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
}), Z = {}, ee = c({
|
|
385
|
-
"functions/idb/crud/data.get.ts"() {
|
|
386
|
-
te(), $.data.get = (e, t, o) => new Promise((r, s) => {
|
|
387
|
-
const n = indexedDB.open(e);
|
|
388
|
-
n.onsuccess = n => {
|
|
389
|
-
const i = n.target.result;
|
|
390
|
-
if (!i.objectStoreNames.contains(t)) return i.close(), s(new Error(`Table ${t} not found in ${e}`));
|
|
391
|
-
const a = i.transaction(t, "readonly").objectStore(t).get(o);
|
|
392
|
-
a.onsuccess = () => {
|
|
393
|
-
i.close(), r(a.result);
|
|
394
|
-
}, a.onerror = () => {
|
|
395
|
-
i.close(), s(a.error);
|
|
396
|
-
};
|
|
397
|
-
}, n.onerror = () => {
|
|
398
|
-
s(n.error);
|
|
399
|
-
};
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}), te = c({
|
|
403
|
-
"functions/idb/index.ts"() {
|
|
404
|
-
E(), S = w(), $ = {
|
|
405
|
-
db: {},
|
|
406
|
-
table: {},
|
|
407
|
-
data: {}
|
|
408
|
-
}, S ? (async () => {
|
|
409
|
-
Object.defineProperty($, "db", {
|
|
410
|
-
value: {},
|
|
411
|
-
writable: !0,
|
|
412
|
-
configurable: !0
|
|
413
|
-
}), Object.defineProperty($, "table", {
|
|
414
|
-
value: {},
|
|
415
|
-
writable: !0,
|
|
416
|
-
configurable: !0
|
|
417
|
-
}), Object.defineProperty($, "data", {
|
|
418
|
-
value: {},
|
|
419
|
-
writable: !0,
|
|
420
|
-
configurable: !0
|
|
421
|
-
}), Object.defineProperty(globalThis, "idbases", {
|
|
422
|
-
value: [],
|
|
423
|
-
writable: !0,
|
|
424
|
-
configurable: !0,
|
|
425
|
-
enumerable: !1
|
|
426
|
-
}), await Promise.all([ Promise.resolve().then(() => (D(), x)), Promise.resolve().then(() => (C(),
|
|
427
|
-
A)), Promise.resolve().then(() => (_(), I)), Promise.resolve().then(() => (M(),
|
|
428
|
-
N)), Promise.resolve().then(() => (z(), B)), Promise.resolve().then(() => (W(),
|
|
429
|
-
J)), Promise.resolve().then(() => (V(), R)), Promise.resolve().then(() => (q(),
|
|
430
|
-
U)), Promise.resolve().then(() => (L(), F)), Promise.resolve().then(() => (H(),
|
|
431
|
-
K)), Promise.resolve().then(() => (G(), Y)), Promise.resolve().then(() => (X(),
|
|
432
|
-
Q)), Promise.resolve().then(() => (ee(), Z)) ]), Object.preventExtensions($), Object.seal($),
|
|
433
|
-
Object.freeze($);
|
|
434
|
-
})() : ($._disabled = !0, $._warning = "IndexedDB is not available in this environment (Node.js/Deno). Use store or session for persistence.",
|
|
435
|
-
console.warn("Memorio IDB: IndexedDB is not available in this environment. Use store or session for data persistence."));
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
u(), d();
|
|
440
|
-
|
|
441
|
-
var oe = {
|
|
442
|
-
set: (e, t = {}) => {
|
|
443
|
-
globalThis.dispatchEvent(new CustomEvent(String(e), t));
|
|
444
|
-
},
|
|
445
|
-
listen: (e, t = null, o) => {
|
|
446
|
-
if (globalThis.events?.[e]) return;
|
|
447
|
-
const r = t ? e => {
|
|
448
|
-
const o = e;
|
|
449
|
-
return globalThis.queueMicrotask ? globalThis.queueMicrotask(() => t(o)) : Promise.resolve().then(() => t(o));
|
|
450
|
-
} : void 0;
|
|
451
|
-
r && globalThis.addEventListener(e, r), r && (globalThis.events[e] = r);
|
|
452
|
-
},
|
|
453
|
-
remove: e => {
|
|
454
|
-
const t = globalThis.events?.[e];
|
|
455
|
-
t && (globalThis.removeEventListener(e, t), delete globalThis.events[e]);
|
|
456
|
-
}
|
|
457
|
-
}, re = Symbol("memorio.target"), se = new WeakMap, ne = (e, t = null) => {
|
|
458
|
-
if (null === e || "object" != typeof e) return e;
|
|
459
|
-
if (void 0 !== e[re]) return ne(e[re], t);
|
|
460
|
-
if (t) {
|
|
461
|
-
if (t.has(e)) return e;
|
|
462
|
-
t.add(e);
|
|
463
|
-
}
|
|
464
|
-
const o = e.constructor?.name;
|
|
465
|
-
if ("Object" !== o && "Array" !== o) return e;
|
|
466
|
-
const r = Array.isArray(e) ? [] : {};
|
|
467
|
-
for (const o of Reflect.ownKeys(e)) r[o] = ne(e[o], t);
|
|
468
|
-
return r;
|
|
469
|
-
}, ie = (e, t, o = ".") => t.concat(e).join(o), ae = (e, o, s = []) => new Proxy(e, {
|
|
470
|
-
get(e, t) {
|
|
471
|
-
if ("__path" === t) return s.length > 0 ? "state." + s.join(".") : "state";
|
|
472
|
-
if (t === re) return e;
|
|
473
|
-
if (void 0 !== e[re]) return e;
|
|
474
|
-
if ("list" === t) return n('Some state could be hidden when you use "state.list". Use "state" to see the complete list '),
|
|
475
|
-
JSON.parse(JSON.stringify(e));
|
|
476
|
-
if ("string" == typeof t) {
|
|
477
|
-
const e = s.length > 0 ? "state." + s.concat(t).join(".") : "state." + t;
|
|
478
|
-
r.lastAccessedPath = e, r.tracking && r.trackedPaths.add(e);
|
|
479
|
-
}
|
|
480
|
-
if ("_lastPath" === t) return r.lastAccessedPath;
|
|
481
|
-
if ("remove" === t) return t => (delete e[t], !0);
|
|
482
|
-
if ("removeAll" === t) return () => {
|
|
483
|
-
try {
|
|
484
|
-
for (const t in e) "function" == typeof e[t] || [ "list", "remove", "removeAll", "lock", "unlock" ].includes(t) || delete e[t];
|
|
485
|
-
} catch (e) {
|
|
486
|
-
console.error(e);
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
if (Object.isFrozen(e[t])) return e[t];
|
|
490
|
-
if ("lock" === t || "unlock" === t) {
|
|
491
|
-
const o = Reflect.get(e, t);
|
|
492
|
-
if (o) return o;
|
|
493
|
-
}
|
|
494
|
-
try {
|
|
495
|
-
const r = Reflect.get(e, t);
|
|
496
|
-
if (r && "object" == typeof r && [ "Array", "Object" ].includes(r.constructor.name)) {
|
|
497
|
-
let e = se.get(r);
|
|
498
|
-
return e || (e = ae(r, o, s.concat(t)), se.set(r, e)), e;
|
|
499
|
-
}
|
|
500
|
-
return r;
|
|
501
|
-
} catch (e) {
|
|
502
|
-
return void console.error("Error: ", e);
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
set(e, i, a) {
|
|
506
|
-
if (r.locked) return console.error("Error: state is locked. Use state.unlock() to enable modifications."),
|
|
507
|
-
!1;
|
|
508
|
-
if (t.includes(i)) return console.error("key " + i + " is protected"), !1;
|
|
509
|
-
if (e[i] && "object" == typeof e[i] && Object.isFrozen(e[i])) return console.error(`Error: state '${i}' is locked`),
|
|
510
|
-
!1;
|
|
511
|
-
if (e[i] && "object" == typeof e[i] && e[i].__locked) return console.error(`Error: state '${i}' is locked. Use state.${i}.unlock() to enable modifications.`),
|
|
512
|
-
!1;
|
|
513
|
-
try {
|
|
514
|
-
const t = ie(i, s), l = ne(a);
|
|
515
|
-
if (o({
|
|
516
|
-
action: "set",
|
|
517
|
-
path: t,
|
|
518
|
-
target: e,
|
|
519
|
-
newValue: l,
|
|
520
|
-
previousValue: Reflect.get(e, i)
|
|
521
|
-
}), (e => {
|
|
522
|
-
try {
|
|
523
|
-
oe.set(e, {
|
|
524
|
-
detail: {
|
|
525
|
-
name: e
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
} catch (e) {}
|
|
529
|
-
})("state." + t), Reflect.set(e, i, l), r.bumpStateVersion(), e[i] && "object" == typeof e[i]) {
|
|
530
|
-
const t = e[i];
|
|
531
|
-
if (t && "object" == typeof t) try {
|
|
532
|
-
Object.defineProperty(t, "__locked", {
|
|
533
|
-
writable: !0,
|
|
534
|
-
enumerable: !1,
|
|
535
|
-
configurable: !1,
|
|
536
|
-
value: !1
|
|
537
|
-
}), Object.defineProperty(t, "lock", {
|
|
538
|
-
writable: !1,
|
|
539
|
-
enumerable: !1,
|
|
540
|
-
configurable: !1,
|
|
541
|
-
value: () => {
|
|
542
|
-
Object.defineProperty(t, "__locked", {
|
|
543
|
-
writable: !0,
|
|
544
|
-
enumerable: !1,
|
|
545
|
-
configurable: !1,
|
|
546
|
-
value: !0
|
|
547
|
-
}), n(`State '${i}' is now locked.`);
|
|
548
|
-
}
|
|
549
|
-
}), Object.defineProperty(t, "unlock", {
|
|
550
|
-
writable: !1,
|
|
551
|
-
enumerable: !1,
|
|
552
|
-
configurable: !1,
|
|
553
|
-
value: () => {
|
|
554
|
-
Object.defineProperty(t, "__locked", {
|
|
555
|
-
writable: !0,
|
|
556
|
-
enumerable: !1,
|
|
557
|
-
configurable: !1,
|
|
558
|
-
value: !1
|
|
559
|
-
}), n(`State '${i}' is now unlocked.`);
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
} catch (e) {}
|
|
563
|
-
}
|
|
564
|
-
return !0;
|
|
565
|
-
} catch (e) {
|
|
566
|
-
return console.error("Error in set trap:", e), !1;
|
|
567
|
-
}
|
|
568
|
-
},
|
|
569
|
-
deleteProperty(e, t) {
|
|
570
|
-
try {
|
|
571
|
-
const r = ie(t, s);
|
|
572
|
-
return o({
|
|
573
|
-
action: "delete",
|
|
574
|
-
path: r,
|
|
575
|
-
target: e
|
|
576
|
-
}), Reflect.deleteProperty(e, t);
|
|
577
|
-
} catch (e) {
|
|
578
|
-
return console.error("Error in deleteProperty trap:", e), !1;
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
ownKeys: e => Reflect.ownKeys(e),
|
|
582
|
-
getOwnPropertyDescriptor: (e, t) => Reflect.getOwnPropertyDescriptor(e, t)
|
|
583
|
-
}), le = ae({}, () => {});
|
|
584
|
-
|
|
585
|
-
le.lock = () => {
|
|
586
|
-
r.locked = !0, n("State is now locked. All modifications are blocked.");
|
|
587
|
-
}, le.unlock = () => {
|
|
588
|
-
r.locked = !1, n("State is now unlocked. Modifications are allowed.");
|
|
589
|
-
}, E(), u(), d();
|
|
590
|
-
|
|
591
|
-
var ce = y(), ue = new Map;
|
|
592
|
-
|
|
593
|
-
function de() {
|
|
594
|
-
const e = r.currentContext || "" || "default";
|
|
595
|
-
return ue.has(e) || ue.set(e, new Map), ue.get(e);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
var be = null !== ce;
|
|
599
|
-
|
|
600
|
-
function fe() {
|
|
601
|
-
const e = r.currentContext || "";
|
|
602
|
-
return e ? `${e}-` : "memorio_store_";
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
function me(e) {
|
|
606
|
-
return e && "string" == typeof e ? e.length > 512 ? (console.warn(`[memorio store] key "${e}" exceeds 512 chars ā operation aborted`),
|
|
607
|
-
"") : fe() + e : (console.warn("[memorio store] key is empty or not a string ā operation aborted"),
|
|
608
|
-
"");
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
var ge = new Proxy({}, {});
|
|
612
|
-
|
|
613
|
-
Object.defineProperty(globalThis, "store", {
|
|
614
|
-
value: ge,
|
|
615
|
-
enumerable: !1,
|
|
616
|
-
configurable: !0
|
|
617
|
-
}), Object.defineProperties(ge, {
|
|
618
|
-
get: {
|
|
619
|
-
value: e => {
|
|
620
|
-
if (!e) return console.warn("[memorio store] store.get() called with empty or null key ā returning null"),
|
|
621
|
-
null;
|
|
622
|
-
try {
|
|
623
|
-
return function(e) {
|
|
624
|
-
const t = be ? ce.getItem(e) : de().get(e);
|
|
625
|
-
return t ? JSON.parse(t) : t;
|
|
626
|
-
}(me(e));
|
|
627
|
-
} catch (t) {
|
|
628
|
-
s(`Error parsing store item '${e}': ${t}`);
|
|
629
|
-
}
|
|
630
|
-
return null;
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
getMultiple: {
|
|
634
|
-
value: e => {
|
|
635
|
-
const t = {};
|
|
636
|
-
for (const o of e) try {
|
|
637
|
-
const e = ge.get(o);
|
|
638
|
-
e && (t[o] = e);
|
|
639
|
-
} catch (e) {
|
|
640
|
-
console.debug(`[memorio store] getMultiple error for key "${o}":`, e);
|
|
641
|
-
}
|
|
642
|
-
return t;
|
|
643
|
-
}
|
|
644
|
-
},
|
|
645
|
-
set: {
|
|
646
|
-
value: (e, t) => {
|
|
647
|
-
if (!e) return console.warn("[memorio store] store.set() called with empty or null key ā write aborted"),
|
|
648
|
-
!1;
|
|
649
|
-
const o = me(e);
|
|
650
|
-
if (!o) return !1;
|
|
651
|
-
if ("function" == typeof t) return console.warn("[memorio store] functions are not storable ā write aborted for key: " + e),
|
|
652
|
-
s("Storing functions is not secure and is blocked for safety."), !1;
|
|
653
|
-
try {
|
|
654
|
-
!function(e, t) {
|
|
655
|
-
const o = JSON.stringify(t);
|
|
656
|
-
be ? ce.setItem(e, o) : de().set(e, o);
|
|
657
|
-
}(o, t);
|
|
658
|
-
} catch (t) {
|
|
659
|
-
return s(`Error setting store item '${e}': ${t}`), !1;
|
|
660
|
-
}
|
|
661
|
-
return !0;
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
remove: {
|
|
665
|
-
value: e => {
|
|
666
|
-
if (!e) return console.debug("[memorio store] store.remove() called with empty or null key ā returning false"),
|
|
667
|
-
!1;
|
|
668
|
-
const t = me(e);
|
|
669
|
-
if (!t) return !1;
|
|
670
|
-
try {
|
|
671
|
-
return function(e) {
|
|
672
|
-
if (be) {
|
|
673
|
-
if (ce.getItem(e)) return ce.removeItem(e), !0;
|
|
674
|
-
} else if (de().has(e)) return de().delete(e), !0;
|
|
675
|
-
return !1;
|
|
676
|
-
}(t);
|
|
677
|
-
} catch (t) {
|
|
678
|
-
s(`Error removing store item '${e}': ${t}`);
|
|
679
|
-
}
|
|
680
|
-
return !1;
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
delete: {
|
|
684
|
-
value: e => ge.remove(e)
|
|
685
|
-
},
|
|
686
|
-
removeAll: {
|
|
687
|
-
value: () => {
|
|
688
|
-
if (be) {
|
|
689
|
-
const e = [];
|
|
690
|
-
for (let t = 0; t < ce.length; t++) {
|
|
691
|
-
const o = ce.key(t);
|
|
692
|
-
o?.startsWith(fe()) && e.push(o);
|
|
693
|
-
}
|
|
694
|
-
e.forEach(e => ce.removeItem(e));
|
|
695
|
-
} else de().clear();
|
|
696
|
-
return !0;
|
|
697
|
-
}
|
|
698
|
-
},
|
|
699
|
-
clearAll: {
|
|
700
|
-
value: () => (ge.removeAll(), !0)
|
|
701
|
-
},
|
|
702
|
-
quota: {
|
|
703
|
-
value: async () => [ 0, 0 ]
|
|
704
|
-
},
|
|
705
|
-
size: {
|
|
706
|
-
value: () => {
|
|
707
|
-
let e = 0;
|
|
708
|
-
return be ? Object.keys(ce).forEach(t => {
|
|
709
|
-
if (t.startsWith(fe())) {
|
|
710
|
-
const o = ce.getItem(t);
|
|
711
|
-
o && (e += o.length);
|
|
712
|
-
}
|
|
713
|
-
}) : de().forEach(t => {
|
|
714
|
-
e += t.length;
|
|
715
|
-
}), e;
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
isPersistent: {
|
|
719
|
-
get: () => be
|
|
720
|
-
},
|
|
721
|
-
list: {
|
|
722
|
-
value: () => {
|
|
723
|
-
const e = {};
|
|
724
|
-
try {
|
|
725
|
-
if (be) for (let t = 0; t < ce.length; t++) {
|
|
726
|
-
const o = ce.key(t);
|
|
727
|
-
if (o?.startsWith(fe())) {
|
|
728
|
-
const t = o.replace(fe(), ""), r = ce.getItem(o);
|
|
729
|
-
if (null !== r) try {
|
|
730
|
-
e[t] = JSON.parse(r);
|
|
731
|
-
} catch {
|
|
732
|
-
e[t] = r;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
} else de().forEach((t, o) => {
|
|
736
|
-
if (o.startsWith(fe())) {
|
|
737
|
-
const r = o.replace(fe(), "");
|
|
738
|
-
try {
|
|
739
|
-
e[r] = JSON.parse(t);
|
|
740
|
-
} catch {
|
|
741
|
-
e[r] = t;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
} catch (e) {
|
|
746
|
-
s(`Error listing store items: ${e}`);
|
|
747
|
-
}
|
|
748
|
-
return e;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}), Object.freeze(ge), E(), u(), d();
|
|
752
|
-
|
|
753
|
-
var he = v(), pe = new Map;
|
|
754
|
-
|
|
755
|
-
function ve() {
|
|
756
|
-
const e = r.currentContext || "" || "default";
|
|
757
|
-
return pe.has(e) || pe.set(e, new Map), pe.get(e);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
var ye = null !== he;
|
|
761
|
-
|
|
762
|
-
function we() {
|
|
763
|
-
const e = r.currentContext || "";
|
|
764
|
-
return e ? `${e}-` : "memorio_session_";
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
function Te(e) {
|
|
768
|
-
return e && "string" == typeof e ? e.length > 512 ? (console.warn(`[memorio session] key "${e}" exceeds 512 chars ā operation aborted`),
|
|
769
|
-
"") : we() + e : (console.warn("[memorio session] key is empty or not a string ā operation aborted"),
|
|
770
|
-
"");
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
var Oe = new Proxy({}, {});
|
|
774
|
-
|
|
775
|
-
Object.defineProperty(globalThis, "session", {
|
|
776
|
-
value: Oe,
|
|
777
|
-
enumerable: !1,
|
|
778
|
-
configurable: !0
|
|
779
|
-
}), Object.defineProperties(Oe, {
|
|
780
|
-
get: {
|
|
781
|
-
value: e => {
|
|
782
|
-
if (!e) return console.warn("[memorio session] session.get() called with empty or null key ā returning null"),
|
|
783
|
-
null;
|
|
784
|
-
try {
|
|
785
|
-
return function(e) {
|
|
786
|
-
const t = ye ? he.getItem(e) : ve().get(e);
|
|
787
|
-
return t ? JSON.parse(t) : t;
|
|
788
|
-
}(Te(e));
|
|
789
|
-
} catch (t) {
|
|
790
|
-
s(`Error parsing session item '${e}':${t}`);
|
|
791
|
-
}
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
|
-
set: {
|
|
796
|
-
value: (e, t) => {
|
|
797
|
-
if (!e) return console.warn("[memorio session] session.set() called with empty or null key ā write aborted"),
|
|
798
|
-
!1;
|
|
799
|
-
const o = Te(e);
|
|
800
|
-
if (!o) return !1;
|
|
801
|
-
if ("function" == typeof t) return console.warn("[memorio session] functions are not storable ā write aborted for key: " + e),
|
|
802
|
-
s("It's not secure to session functions."), !1;
|
|
803
|
-
try {
|
|
804
|
-
!function(e, t) {
|
|
805
|
-
const o = JSON.stringify(t);
|
|
806
|
-
ye ? he.setItem(e, o) : ve().set(e, o);
|
|
807
|
-
}(o, t);
|
|
808
|
-
} catch (t) {
|
|
809
|
-
return s(`Error setting session item '${e}': ${t}`), !1;
|
|
810
|
-
}
|
|
811
|
-
return !0;
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
remove: {
|
|
815
|
-
value: e => {
|
|
816
|
-
if (!e) return console.warn("[memorio session] session.remove() called with empty or null key ā returning false"),
|
|
817
|
-
!1;
|
|
818
|
-
const t = Te(e);
|
|
819
|
-
if (!t) return !1;
|
|
820
|
-
try {
|
|
821
|
-
return function(e) {
|
|
822
|
-
if (ye) {
|
|
823
|
-
if (he.getItem(e)) return he.removeItem(e), !0;
|
|
824
|
-
} else if (ve().has(e)) return ve().delete(e), !0;
|
|
825
|
-
return !1;
|
|
826
|
-
}(t);
|
|
827
|
-
} catch (t) {
|
|
828
|
-
s(`Error removing session item '${e}': ${t}`);
|
|
829
|
-
}
|
|
830
|
-
return !1;
|
|
831
|
-
}
|
|
832
|
-
},
|
|
833
|
-
delete: {
|
|
834
|
-
value: e => Oe.remove(e)
|
|
835
|
-
},
|
|
836
|
-
removeAll: {
|
|
837
|
-
value: () => {
|
|
838
|
-
if (ye) {
|
|
839
|
-
const e = [];
|
|
840
|
-
for (let t = 0; t < he.length; t++) {
|
|
841
|
-
const o = he.key(t);
|
|
842
|
-
o?.startsWith(we()) && e.push(o);
|
|
843
|
-
}
|
|
844
|
-
e.forEach(e => he.removeItem(e));
|
|
845
|
-
} else ve().clear();
|
|
846
|
-
return !0;
|
|
847
|
-
}
|
|
848
|
-
},
|
|
849
|
-
clearAll: {
|
|
850
|
-
value: () => (Oe.removeAll(), !0)
|
|
851
|
-
},
|
|
852
|
-
quota: {
|
|
853
|
-
value: async () => [ 0, 0 ]
|
|
854
|
-
},
|
|
855
|
-
size: {
|
|
856
|
-
value: () => {
|
|
857
|
-
let e = 0;
|
|
858
|
-
return ye ? Object.keys(he).forEach(t => {
|
|
859
|
-
if (t.startsWith(we())) {
|
|
860
|
-
const o = he.getItem(t);
|
|
861
|
-
o && (e += o.length);
|
|
862
|
-
}
|
|
863
|
-
}) : ve().forEach(t => {
|
|
864
|
-
e += t.length;
|
|
865
|
-
}), e;
|
|
866
|
-
}
|
|
867
|
-
},
|
|
868
|
-
isPersistent: {
|
|
869
|
-
get: () => ye
|
|
870
|
-
},
|
|
871
|
-
list: {
|
|
872
|
-
value: () => {
|
|
873
|
-
const e = {};
|
|
874
|
-
try {
|
|
875
|
-
if (ye) for (let t = 0; t < he.length; t++) {
|
|
876
|
-
const o = he.key(t);
|
|
877
|
-
if (o?.startsWith(we())) {
|
|
878
|
-
const t = o.replace(we(), ""), r = he.getItem(o);
|
|
879
|
-
if (null !== r) try {
|
|
880
|
-
e[t] = JSON.parse(r);
|
|
881
|
-
} catch {
|
|
882
|
-
e[t] = r;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
} else ve().forEach((t, o) => {
|
|
886
|
-
if (o.startsWith(we())) {
|
|
887
|
-
const r = o.replace(we(), "");
|
|
888
|
-
try {
|
|
889
|
-
e[r] = JSON.parse(t);
|
|
890
|
-
} catch {
|
|
891
|
-
e[r] = t;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
});
|
|
895
|
-
} catch (e) {
|
|
896
|
-
s(`Error listing session items: ${e}`);
|
|
897
|
-
}
|
|
898
|
-
return e;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}), Object.freeze(Oe);
|
|
902
|
-
|
|
903
|
-
var Pe = {}, je = new Proxy({}, {
|
|
904
|
-
get: (e, t) => "get" === t ? e => Pe[e] : "set" === t ? (e, t) => {
|
|
905
|
-
Pe[e] = t;
|
|
906
|
-
} : "remove" === t ? e => (delete Pe[e], !0) : "removeAll" === t || "clear" === t ? () => (Object.keys(Pe).forEach(e => delete Pe[e]),
|
|
907
|
-
!0) : "list" === t ? () => ({
|
|
908
|
-
...Pe
|
|
909
|
-
}) : Pe[t],
|
|
910
|
-
set: (e, t, o) => (Pe[t] = o, !0),
|
|
911
|
-
deleteProperty: (e, t) => (delete Pe[t], !0)
|
|
912
|
-
});
|
|
913
|
-
|
|
914
|
-
Object.freeze(je), te(), d();
|
|
915
|
-
|
|
916
|
-
var ke = !1, Se = (e, t = null, o = !0) => {
|
|
917
|
-
ke || (console.warn('DEPRECATED: "observer" is deprecated and will be removed in future versions. Please use "useObserver" instead.'),
|
|
918
|
-
ke = !0);
|
|
919
|
-
const r = e => "string" == typeof e ? e : e && "object" == typeof e && e.__path ? e.__path : null, s = r(e);
|
|
920
|
-
if (e || t) if (e || !t) {
|
|
921
|
-
if (s) {
|
|
922
|
-
const e = s.split(".");
|
|
923
|
-
if ("state" !== e[0] && "store" !== e[0]) return void console.error(`Observer Error: You need to declare 'state.' or 'store.'. The '${s}' string is incorrect!`);
|
|
924
|
-
}
|
|
925
|
-
if (e && !t) {
|
|
926
|
-
const t = r(e);
|
|
927
|
-
if (!t) return;
|
|
928
|
-
const o = globalThis.observer;
|
|
929
|
-
return o?.list?.[t] && oe.remove(t), void n(`called: ${t}`);
|
|
930
|
-
}
|
|
931
|
-
if (e && t) {
|
|
932
|
-
const s = r(e);
|
|
933
|
-
if (!s) return;
|
|
934
|
-
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");
|
|
935
|
-
const n = Array.isArray(t) ? t : [ t ], i = globalThis.observer;
|
|
936
|
-
return i?.list?.[s] && oe.remove(s), void n.forEach(e => {
|
|
937
|
-
"function" == typeof e && oe.listen(s, e, o);
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
} 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!");
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
Object.defineProperties(Se, {
|
|
944
|
-
list: {
|
|
945
|
-
get: () => globalThis.events
|
|
946
|
-
},
|
|
947
|
-
remove: {
|
|
948
|
-
value: e => {
|
|
949
|
-
e && (oe.remove(e), delete globalThis.events[e]);
|
|
950
|
-
}
|
|
951
|
-
},
|
|
952
|
-
removeAll: {
|
|
953
|
-
get: () => {
|
|
954
|
-
const e = globalThis.observer, t = e?.list;
|
|
955
|
-
return t && Object.keys(t).forEach(t => {
|
|
956
|
-
e?.remove?.(t);
|
|
957
|
-
}), !0;
|
|
958
|
-
}
|
|
959
|
-
},
|
|
960
|
-
has: {
|
|
961
|
-
value: e => {
|
|
962
|
-
const t = globalThis.observer;
|
|
963
|
-
return !!t?.list?.[e];
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
}), d(), u(), globalThis.useObserver || (globalThis.useObserver = null), Object.defineProperty(globalThis, "useObserver", {
|
|
967
|
-
value: null,
|
|
968
|
-
writable: !0,
|
|
969
|
-
enumerable: !1,
|
|
970
|
-
configurable: !0
|
|
971
|
-
});
|
|
972
|
-
|
|
973
|
-
var $e = (e, t = []) => {
|
|
974
|
-
if (!t || "function" != typeof e) return () => {};
|
|
975
|
-
const s = [], i = Array.isArray(t) && !t.__path ? t : [ t ];
|
|
976
|
-
try {
|
|
977
|
-
return i.forEach(t => {
|
|
978
|
-
let i = "";
|
|
979
|
-
if ("function" == typeof t) {
|
|
980
|
-
const e = o(t);
|
|
981
|
-
e && (i = e);
|
|
982
|
-
} else "object" == typeof t && null !== t && (i = t.__path || ("function" == typeof t.toString && "[object Object]" !== t.toString() ? t.toString() : ""));
|
|
983
|
-
if (i) {
|
|
984
|
-
i = i.replace(/^(\(\)\s*=>\s*)/, "").replace(/^globalThis\./, "").replace(/^state\./, "");
|
|
985
|
-
const t = i.startsWith("store.") || i.startsWith("state.") ? i : "state." + i;
|
|
986
|
-
oe.listen(t, () => e()), s.push(t);
|
|
987
|
-
} else {
|
|
988
|
-
r.clearTrackedPaths(), r.tracking = !0;
|
|
989
|
-
try {
|
|
990
|
-
e();
|
|
991
|
-
} catch (e) {}
|
|
992
|
-
r.tracking = !1, r.trackedPaths.forEach(t => {
|
|
993
|
-
s.includes(t) || (n(`useObserver: [Auto-Discovery] -> "${t}"`), oe.listen(t, () => e()),
|
|
994
|
-
s.push(t));
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
|
-
}), s.length > 0 ? n(`useObserver: Monitoring ${s.length} paths.`) : console.warn("useObserver: No paths resolved for monitoring. Check your dependencies!"),
|
|
998
|
-
() => {
|
|
999
|
-
s.forEach(e => {
|
|
1000
|
-
"function" == typeof oe.remove && (oe.remove(e), n(`useObserver: Stopped monitoring "${e}"`));
|
|
1001
|
-
});
|
|
1002
|
-
};
|
|
1003
|
-
} catch (e) {
|
|
1004
|
-
return n(`useObserver Error: ${e}`), () => {};
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
function Ee() {
|
|
1009
|
-
if (!globalThis.store) return {};
|
|
1010
|
-
const e = {}, t = globalThis.store;
|
|
1011
|
-
if ("function" == typeof t.list) try {
|
|
1012
|
-
return t.list();
|
|
1013
|
-
} catch {}
|
|
1014
|
-
if ("function" == typeof t.get) for (const o of Object.keys(t)) if (![ "get", "set", "remove", "delete", "removeAll", "clearAll", "size", "isPersistent", "list" ].includes(o)) try {
|
|
1015
|
-
const r = t.get(o);
|
|
1016
|
-
null != r && (e[o] = r);
|
|
1017
|
-
} catch {}
|
|
1018
|
-
return e;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
function xe() {
|
|
1022
|
-
if (!globalThis.session) return {};
|
|
1023
|
-
const e = {}, t = globalThis.session;
|
|
1024
|
-
if ("function" == typeof t.list) try {
|
|
1025
|
-
return t.list();
|
|
1026
|
-
} catch {}
|
|
1027
|
-
if ("function" == typeof t.get) for (const o of Object.keys(t)) if (![ "get", "set", "remove", "delete", "removeAll", "clearAll", "size", "isPersistent", "list" ].includes(o)) try {
|
|
1028
|
-
const r = t.get(o);
|
|
1029
|
-
null != r && (e[o] = r);
|
|
1030
|
-
} catch {}
|
|
1031
|
-
return e;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
globalThis.useObserver = $e, Object.freeze(globalThis.useObserver), d(), u();
|
|
1035
|
-
|
|
1036
|
-
var De = e => {
|
|
1037
|
-
globalThis[e] && "function" == typeof globalThis[e].clear ? globalThis[e].clear() : console.error(`Module ${e} not found or does not support clear()`);
|
|
1038
|
-
}, Ae = {
|
|
1039
|
-
inspect: () => {
|
|
1040
|
-
if (!0 === r.debug) {
|
|
1041
|
-
if (globalThis.state) {
|
|
1042
|
-
const e = globalThis.state.list;
|
|
1043
|
-
let t;
|
|
1044
|
-
t = "function" == typeof e ? e() : "object" == typeof e && null !== e ? e : globalThis.state,
|
|
1045
|
-
console.table(t);
|
|
1046
|
-
}
|
|
1047
|
-
if (globalThis.store && console.table(Ee()), globalThis.session && console.table(xe()),
|
|
1048
|
-
globalThis.cache) {
|
|
1049
|
-
const e = globalThis.cache.list;
|
|
1050
|
-
let t;
|
|
1051
|
-
t = "function" == typeof e ? e() : "object" == typeof e && null !== e ? e : globalThis.cache,
|
|
1052
|
-
console.table(t);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
stats: () => {
|
|
1057
|
-
const e = e => {
|
|
1058
|
-
if (!e) return 0;
|
|
1059
|
-
if ("function" == typeof e.list) try {
|
|
1060
|
-
const t = e.list();
|
|
1061
|
-
return Object.keys(t).length;
|
|
1062
|
-
} catch {}
|
|
1063
|
-
return Object.keys(e).length;
|
|
1064
|
-
};
|
|
1065
|
-
return {
|
|
1066
|
-
stateKeys: e(globalThis.state),
|
|
1067
|
-
storeKeys: e(globalThis.store),
|
|
1068
|
-
sessionKeys: e(globalThis.session),
|
|
1069
|
-
cacheKeys: e(globalThis.cache),
|
|
1070
|
-
idbDatabases: 0,
|
|
1071
|
-
lastUpdate: (new Date).toISOString()
|
|
1072
|
-
};
|
|
1073
|
-
},
|
|
1074
|
-
clear: De,
|
|
1075
|
-
clearAll: () => {
|
|
1076
|
-
De("state"), De("store"), De("session"), De("cache");
|
|
1077
|
-
},
|
|
1078
|
-
exportData: () => {
|
|
1079
|
-
const e = {
|
|
1080
|
-
state: (() => {
|
|
1081
|
-
if (globalThis.state) try {
|
|
1082
|
-
return "function" == typeof globalThis.state.list ? globalThis.state.list() : globalThis.state;
|
|
1083
|
-
} catch {
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
})(),
|
|
1087
|
-
store: Ee(),
|
|
1088
|
-
session: xe(),
|
|
1089
|
-
cache: (() => {
|
|
1090
|
-
if (globalThis.cache) try {
|
|
1091
|
-
return "function" == typeof globalThis.cache.list ? globalThis.cache.list() : globalThis.cache;
|
|
1092
|
-
} catch {
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
1095
|
-
})(),
|
|
1096
|
-
exportedAt: (new Date).toISOString()
|
|
1097
|
-
};
|
|
1098
|
-
return JSON.stringify(e, null, 2);
|
|
1099
|
-
},
|
|
1100
|
-
importData: e => {
|
|
1101
|
-
try {
|
|
1102
|
-
const t = JSON.parse(e);
|
|
1103
|
-
t.state && Object.entries(t.state).forEach(([e, t]) => {
|
|
1104
|
-
globalThis.state && "list" !== e && "remove" !== e && "removeAll" !== e && (globalThis.state[e] = t);
|
|
1105
|
-
}), t.store && globalThis.store && "function" == typeof globalThis.store.set && Object.entries(t.store).forEach(([e, t]) => {
|
|
1106
|
-
globalThis.store.set(e, t);
|
|
1107
|
-
}), t.session && globalThis.session && "function" == typeof globalThis.session.set && Object.entries(t.session).forEach(([e, t]) => {
|
|
1108
|
-
globalThis.session.set(e, t);
|
|
1109
|
-
}), t.cache && globalThis.cache && Object.entries(t.cache).forEach(([e, t]) => {
|
|
1110
|
-
globalThis.cache && "get" !== e && "set" !== e && "remove" !== e && "clear" !== e && (globalThis.cache[e] = t);
|
|
1111
|
-
});
|
|
1112
|
-
} catch (e) {
|
|
1113
|
-
console.error("%cā Import failed:", "color: #F44336", e);
|
|
1114
|
-
}
|
|
1115
|
-
},
|
|
1116
|
-
watch: (e, t) => {
|
|
1117
|
-
if (!globalThis[e]) return void console.error(`Module ${e} not found`);
|
|
1118
|
-
const o = globalThis[e], r = o[t];
|
|
1119
|
-
if (console.debug(`š Watching ${e}.${t} (initial: ${JSON.stringify(r)})`), "state" === e && globalThis.memorio?.dispatch) {
|
|
1120
|
-
const r = o => {
|
|
1121
|
-
const r = o.detail;
|
|
1122
|
-
r?.name?.includes(t) && console.debug(`š Change: ${e}.${t} =`, o.detail.value);
|
|
1123
|
-
};
|
|
1124
|
-
o.addEventListener?.("memorio-change", r);
|
|
1125
|
-
}
|
|
1126
|
-
},
|
|
1127
|
-
help: () => {
|
|
1128
|
-
console.debug("\nš§ Memorio DevTools Help\n\nAvailable commands:\n memorio.devtools.inspect() - Inspect all state modules\n memorio.devtools.stats() - Show statistics\n memorio.devtools.clear('module') - Clear specific module\n memorio.devtools.clearAll() - Clear all modules\n memorio.devtools.exportData() - Export all data as JSON\n memorio.devtools.importData(json) - Import data from JSON\n memorio.devtools.watch(module, path) - Watch a path for changes\n memorio.devtools.help() - Show this help\n\nShortcuts:\n state - globalThis.state\n store - globalThis.store\n session - globalThis.session\n cache - globalThis.cache\n");
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
|
-
u(), d();
|
|
1133
|
-
|
|
1134
|
-
var Ce = {
|
|
1135
|
-
enabled: !0,
|
|
1136
|
-
logToConsole: !0,
|
|
1137
|
-
modules: [ "state", "store", "session", "cache", "idb" ],
|
|
1138
|
-
maxEntries: 1e3
|
|
1139
|
-
}, Ie = [], _e = e => Ce.enabled && Ce.modules.includes(e), Ne = e => ({
|
|
1140
|
-
state: "#4CAF50",
|
|
1141
|
-
store: "#2196F3",
|
|
1142
|
-
session: "#FF9800",
|
|
1143
|
-
cache: "#9C27B0",
|
|
1144
|
-
idb: "#F44336"
|
|
1145
|
-
}[e] || "#888888"), Me = {
|
|
1146
|
-
configure: e => {
|
|
1147
|
-
Ce = {
|
|
1148
|
-
...Ce,
|
|
1149
|
-
...e
|
|
1150
|
-
};
|
|
1151
|
-
},
|
|
1152
|
-
enable: () => {
|
|
1153
|
-
Ce.enabled = !0;
|
|
1154
|
-
},
|
|
1155
|
-
disable: () => {
|
|
1156
|
-
Ce.enabled = !1;
|
|
1157
|
-
},
|
|
1158
|
-
isEnabled: _e,
|
|
1159
|
-
log: (e, t, o, s, i) => {
|
|
1160
|
-
if (!_e(e)) return;
|
|
1161
|
-
const a = {
|
|
1162
|
-
timestamp: (new Date).toISOString(),
|
|
1163
|
-
module: e,
|
|
1164
|
-
action: t,
|
|
1165
|
-
path: o,
|
|
1166
|
-
value: s,
|
|
1167
|
-
previousValue: i
|
|
1168
|
-
};
|
|
1169
|
-
if (Ie.push(a), Ie.length > Ce.maxEntries && Ie.shift(), Ce.logToConsole && !0 === r.debug) {
|
|
1170
|
-
const r = `[Memorio:${e.toUpperCase()}]`, a = Ne(e);
|
|
1171
|
-
n(`%c${r}%c ${t} ${o},\n color: ${a}; font-weight: bold,\n color: inherit`),
|
|
1172
|
-
void 0 !== s && n(` ā value:${s}`), void 0 !== i && n(` ā previous:${i}`);
|
|
1173
|
-
}
|
|
1174
|
-
Ce.customHandler && Ce.customHandler(a);
|
|
1175
|
-
},
|
|
1176
|
-
getHistory: () => [ ...Ie ],
|
|
1177
|
-
clearHistory: () => {
|
|
1178
|
-
Ie.length = 0;
|
|
1179
|
-
},
|
|
1180
|
-
getStats: () => {
|
|
1181
|
-
const e = {
|
|
1182
|
-
total: Ie.length,
|
|
1183
|
-
state: 0,
|
|
1184
|
-
store: 0,
|
|
1185
|
-
session: 0,
|
|
1186
|
-
cache: 0,
|
|
1187
|
-
idb: 0,
|
|
1188
|
-
set: 0,
|
|
1189
|
-
get: 0,
|
|
1190
|
-
delete: 0,
|
|
1191
|
-
clear: 0
|
|
1192
|
-
};
|
|
1193
|
-
for (const t of Ie) if (t) {
|
|
1194
|
-
const o = t.module, r = t.action;
|
|
1195
|
-
o && "number" == typeof e[o] && e[o]++, r && "number" == typeof e[r] && e[r]++;
|
|
1196
|
-
}
|
|
1197
|
-
return e;
|
|
1198
|
-
},
|
|
1199
|
-
exportLogs: () => JSON.stringify(Ie, null, 2)
|
|
1200
|
-
};
|
|
1201
|
-
|
|
1202
|
-
u(), E(), E(), u();
|
|
1203
|
-
|
|
1204
|
-
var Be = "4.6.6";
|
|
1205
|
-
|
|
1206
|
-
te(), d(), Object.defineProperty(globalThis, "memorio", {
|
|
1207
|
-
value: {
|
|
1208
|
-
setProps: () => {},
|
|
1209
|
-
obj: {},
|
|
1210
|
-
array: [],
|
|
1211
|
-
dispatch: oe,
|
|
1212
|
-
message: s,
|
|
1213
|
-
devtools: Ae,
|
|
1214
|
-
logger: Me,
|
|
1215
|
-
setDescription: () => {}
|
|
1216
|
-
},
|
|
1217
|
-
writable: !1,
|
|
1218
|
-
configurable: !0,
|
|
1219
|
-
enumerable: !1
|
|
1220
|
-
}), Object.defineProperty(globalThis, "events", {
|
|
1221
|
-
value: {},
|
|
1222
|
-
writable: !0,
|
|
1223
|
-
enumerable: !1
|
|
1224
|
-
}), Object.defineProperty(memorio, "version", {
|
|
1225
|
-
writable: !1,
|
|
1226
|
-
enumerable: !1,
|
|
1227
|
-
value: Be
|
|
1228
|
-
}), Object.defineProperty(memorio, "debug", {
|
|
1229
|
-
get: () => r.debug,
|
|
1230
|
-
set: e => {
|
|
1231
|
-
r.debug = e;
|
|
1232
|
-
},
|
|
1233
|
-
enumerable: !1
|
|
1234
|
-
});
|
|
1235
|
-
|
|
1236
|
-
var ze = T();
|
|
1237
|
-
|
|
1238
|
-
Object.defineProperty(memorio, "_platform", {
|
|
1239
|
-
writable: !1,
|
|
1240
|
-
enumerable: !1,
|
|
1241
|
-
value: ze.platform
|
|
1242
|
-
}), Object.defineProperty(memorio, "_capabilities", {
|
|
1243
|
-
writable: !1,
|
|
1244
|
-
enumerable: !1,
|
|
1245
|
-
value: ze
|
|
1246
|
-
}), Object.defineProperty(memorio, "_sessionId", {
|
|
1247
|
-
writable: !1,
|
|
1248
|
-
enumerable: !1,
|
|
1249
|
-
value: b()
|
|
1250
|
-
}), function() {
|
|
1251
|
-
const e = T(), t = globalThis;
|
|
1252
|
-
e.hasDispatchEvent || (t.dispatchEvent = function(e) {
|
|
1253
|
-
return !0;
|
|
1254
|
-
}, "undefined" == typeof CustomEvent && (t.CustomEvent = class {
|
|
1255
|
-
type;
|
|
1256
|
-
detail;
|
|
1257
|
-
constructor(e, t = {}) {
|
|
1258
|
-
this.type = e, this.detail = t;
|
|
1259
|
-
}
|
|
1260
|
-
})), "function" != typeof t.addEventListener && (t.addEventListener = function(e, t) {
|
|
1261
|
-
i.has(e) || i.set(e, []), i.get(e).push(t);
|
|
1262
|
-
}, t.removeEventListener = function(e, t) {
|
|
1263
|
-
const o = i.get(e);
|
|
1264
|
-
if (o) {
|
|
1265
|
-
const e = o.indexOf(t);
|
|
1266
|
-
e > -1 && o.splice(e, 1);
|
|
1267
|
-
}
|
|
1268
|
-
}, t.dispatchEvent = function(e) {
|
|
1269
|
-
const t = i.get(e.type);
|
|
1270
|
-
return t && t.forEach(t => {
|
|
1271
|
-
try {
|
|
1272
|
-
t(e);
|
|
1273
|
-
} catch (e) {
|
|
1274
|
-
console.error("Event listener error:", e);
|
|
1275
|
-
}
|
|
1276
|
-
}), !0;
|
|
1277
|
-
});
|
|
1278
|
-
}(), memorio.isBrowser = m, memorio.isNode = g, memorio.isDeno = h, memorio.isEdge = p,
|
|
1279
|
-
memorio.getCapabilities = T, memorio.createContext = O, memorio.listContexts = P,
|
|
1280
|
-
memorio.deleteContext = j, memorio.isolate = e => O(e), Object.defineProperty(globalThis, "state", {
|
|
1281
|
-
value: le,
|
|
1282
|
-
writable: !0,
|
|
1283
|
-
enumerable: !1,
|
|
1284
|
-
configurable: !0
|
|
1285
|
-
}), Object.defineProperty(globalThis, "store", {
|
|
1286
|
-
value: ge,
|
|
1287
|
-
writable: !0,
|
|
1288
|
-
enumerable: !1,
|
|
1289
|
-
configurable: !0
|
|
1290
|
-
}), Object.defineProperty(globalThis, "session", {
|
|
1291
|
-
value: Oe,
|
|
1292
|
-
writable: !0,
|
|
1293
|
-
enumerable: !1,
|
|
1294
|
-
configurable: !0
|
|
1295
|
-
}), Object.defineProperty(globalThis, "cache", {
|
|
1296
|
-
value: je,
|
|
1297
|
-
writable: !0,
|
|
1298
|
-
enumerable: !1,
|
|
1299
|
-
configurable: !0
|
|
1300
|
-
}), Object.defineProperty(globalThis, "idb", {
|
|
1301
|
-
value: $,
|
|
1302
|
-
writable: !0,
|
|
1303
|
-
enumerable: !1,
|
|
1304
|
-
configurable: !0
|
|
1305
|
-
}), Object.defineProperty(globalThis, "observer", {
|
|
1306
|
-
value: Se,
|
|
1307
|
-
writable: !0,
|
|
1308
|
-
enumerable: !1,
|
|
1309
|
-
configurable: !0
|
|
1310
|
-
}), Object.defineProperty(globalThis, "useObserver", {
|
|
1311
|
-
value: $e,
|
|
1312
|
-
writable: !0,
|
|
1313
|
-
enumerable: !1,
|
|
1314
|
-
configurable: !0
|
|
1315
|
-
}), Object.defineProperty(memorio, "dispatch", {
|
|
1316
|
-
value: oe,
|
|
1317
|
-
writable: !0,
|
|
1318
|
-
enumerable: !1,
|
|
1319
|
-
configurable: !0
|
|
1320
|
-
}), Object.defineProperty(memorio, "setContext", {
|
|
1321
|
-
writable: !1,
|
|
1322
|
-
enumerable: !1,
|
|
1323
|
-
value: e => k(e)
|
|
1324
|
-
}), Object.defineProperty(memorio, "getContext", {
|
|
1325
|
-
writable: !1,
|
|
1326
|
-
enumerable: !1,
|
|
1327
|
-
value: () => r.currentContext
|
|
1328
|
-
}), Object.defineProperty(globalThis, "$state", {
|
|
1329
|
-
get: () => globalThis.state,
|
|
1330
|
-
configurable: !0
|
|
1331
|
-
}), Object.defineProperty(globalThis, "$store", {
|
|
1332
|
-
get: () => globalThis.store,
|
|
1333
|
-
configurable: !0
|
|
1334
|
-
}), Object.defineProperty(globalThis, "$session", {
|
|
1335
|
-
get: () => globalThis.session,
|
|
1336
|
-
configurable: !0
|
|
1337
|
-
}), Object.defineProperty(globalThis, "$cache", {
|
|
1338
|
-
get: () => globalThis.cache,
|
|
1339
|
-
configurable: !0
|
|
1340
|
-
}), memorio.help = function() {
|
|
1341
|
-
console.debug(`\nš§ Memorio ${Be} - 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`);
|
|
1342
|
-
};
|
|
1343
|
-
|
|
1344
|
-
var Je = globalThis.memorio, We = globalThis.events, Re = e => O(e), Ve = globalThis.memorio?.help, Ue = e => r.currentContext = e, qe = () => r.currentContext, Fe = Je;
|
|
1345
|
-
|
|
1346
|
-
export { je as cache, O as createContext, Fe as default, j as deleteContext, Ae as devtools, oe as dispatch, We as events, T as getCapabilities, qe as getContext, Ve as help, $ as idb, r as internal, m as isBrowser, h as isDeno, p as isEdge, g as isNode, Re as isolate, P as listContexts, Me as logger, Je as memorio, s as message, Se as observer, o as propertyName, Oe as session, Ue as setContext, le as state, ge as store, $e as useObserver };
|