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