@digitaldefiance/suite-core-lib 1.1.26 → 1.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -326,6 +326,14 @@ MIT © [Digital Defiance](https://github.com/digitaldefiance)
|
|
|
326
326
|
|
|
327
327
|
## ChangeLog
|
|
328
328
|
|
|
329
|
+
## v1.1.28: Add local storage manager
|
|
330
|
+
|
|
331
|
+
- Add local storage manager
|
|
332
|
+
|
|
333
|
+
## v1.1.27: Update libs
|
|
334
|
+
|
|
335
|
+
- Update ecies libs
|
|
336
|
+
|
|
329
337
|
## v1.1.26: Add npmignore
|
|
330
338
|
|
|
331
339
|
- Add npmignore
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for managing localStorage with type safety
|
|
3
|
+
*/
|
|
4
|
+
export declare class LocalStorageManager {
|
|
5
|
+
/**
|
|
6
|
+
* Get a value from localStorage with a default fallback
|
|
7
|
+
*/
|
|
8
|
+
static getValue<T>(key: string, defaultValue: T): T;
|
|
9
|
+
/**
|
|
10
|
+
* Set a value in localStorage
|
|
11
|
+
*/
|
|
12
|
+
static setValue<T>(key: string, value: T): void;
|
|
13
|
+
/**
|
|
14
|
+
* Remove a value from localStorage
|
|
15
|
+
*/
|
|
16
|
+
static removeValue(key: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Check if localStorage is available
|
|
19
|
+
*/
|
|
20
|
+
static isAvailable(): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=local-storage-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage-manager.d.ts","sourceRoot":"","sources":["../src/local-storage-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;IAqBnD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAY/C;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQrC;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;CAU9B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for managing localStorage with type safety
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LocalStorageManager = void 0;
|
|
7
|
+
class LocalStorageManager {
|
|
8
|
+
/**
|
|
9
|
+
* Get a value from localStorage with a default fallback
|
|
10
|
+
*/
|
|
11
|
+
static getValue(key, defaultValue) {
|
|
12
|
+
try {
|
|
13
|
+
const stored = localStorage.getItem(key);
|
|
14
|
+
if (stored === null)
|
|
15
|
+
return defaultValue;
|
|
16
|
+
// For primitive types, parse appropriately
|
|
17
|
+
if (typeof defaultValue === 'number') {
|
|
18
|
+
const parsed = parseInt(stored, 10);
|
|
19
|
+
return (isNaN(parsed) ? defaultValue : parsed);
|
|
20
|
+
}
|
|
21
|
+
if (typeof defaultValue === 'string') {
|
|
22
|
+
return stored;
|
|
23
|
+
}
|
|
24
|
+
// For objects, parse JSON
|
|
25
|
+
return JSON.parse(stored);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return defaultValue;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Set a value in localStorage
|
|
33
|
+
*/
|
|
34
|
+
static setValue(key, value) {
|
|
35
|
+
try {
|
|
36
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
37
|
+
localStorage.setItem(key, value.toString());
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.warn(`Failed to save to localStorage (${key}):`, error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Remove a value from localStorage
|
|
49
|
+
*/
|
|
50
|
+
static removeValue(key) {
|
|
51
|
+
try {
|
|
52
|
+
localStorage.removeItem(key);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.warn(`Failed to remove from localStorage (${key}):`, error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if localStorage is available
|
|
60
|
+
*/
|
|
61
|
+
static isAvailable() {
|
|
62
|
+
try {
|
|
63
|
+
const test = '__localStorage_test__';
|
|
64
|
+
localStorage.setItem(test, test);
|
|
65
|
+
localStorage.removeItem(test);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.LocalStorageManager = LocalStorageManager;
|
|
74
|
+
//# sourceMappingURL=local-storage-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage-manager.js","sourceRoot":"","sources":["../src/local-storage-manager.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAa,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAI,GAAW,EAAE,YAAe;QAC7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO,YAAY,CAAC;YAEzC,2CAA2C;YAC3C,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACpC,OAAO,CAA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,CAAC;YACjC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAhED,kDAgEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/suite-core-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.28",
|
|
4
4
|
"description": "Generic user system and document system common core for applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"publish:public": "npm publish --access public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@digitaldefiance/ecies-lib": "1.1.
|
|
19
|
+
"@digitaldefiance/ecies-lib": "1.1.16",
|
|
20
20
|
"@digitaldefiance/i18n-lib": "1.3.5",
|
|
21
|
-
"@digitaldefiance/node-ecies-lib": "1.1.
|
|
21
|
+
"@digitaldefiance/node-ecies-lib": "1.1.13"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/core": "^7.28.4",
|