@alwatr/session-storage 2.0.1 → 9.1.0
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/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/type.d.ts.map +1 -1
- package/package.json +23 -22
- package/src/type.ts +0 -2
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 📦 @alwatr/session-storage
|
|
2
|
-
import{createLogger as B}from"@alwatr/logger";class z{static version="
|
|
1
|
+
/* 📦 @alwatr/session-storage v9.1.0 */
|
|
2
|
+
import{createLogger as B}from"@alwatr/logger";class z{static version="9.1.0";key__;logger_;constructor(x){this.key__=x.name,this.logger_=B(`session-storage-provider: ${this.key__}`),this.logger_.logMethodArgs?.("constructor",x)}static has(x){return sessionStorage.getItem(x)!==null}has(){return sessionStorage.getItem(this.key__)!==null}read(){let x=null;try{x=sessionStorage.getItem(this.key__)}catch(b){this.logger_.error("read","read_session_storage_error",{err:b})}if(!x)return this.logger_.logMethod?.("read//no_value"),null;try{let b=JSON.parse(x);return this.logger_.logMethodFull?.("read//value",void 0,{parsed:b}),b}catch(b){return this.logger_.error("read","read_parse_error",{err:b}),null}}write(x){this.logger_.logMethodArgs?.("write",{value:x});let b;try{b=JSON.stringify(x)}catch(j){throw this.logger_.error("write","write_stringify_error",{err:j}),Error("write_stringify_error")}try{sessionStorage.setItem(this.key__,b)}catch(j){this.logger_.error("write","write_session_storage_error",{err:j})}}remove(){this.logger_.logMethod?.("remove"),sessionStorage.removeItem(this.key__)}}function I(x){return new z(x)}export{I as createSessionStorageProvider,z as SessionStorageProvider};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=9B39F4D5F4B80FE564756E2164756E21
|
|
5
5
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { SessionStorageProvider } from './session-storage.provider.js';\n\nimport type { SessionStorageProviderConfig } from './type.js';\n\n/**\n * Factory function to create a new SessionStorageProvider.\n *\n * @param config - The provider configuration.\n * @returns An instance of SessionStorageProvider.\n *\n * @example\n * ```typescript\n * const formData = createSessionStorageProvider({ name: 'multi-step-form' });\n *\n * // Write new data\n * formData.write({ step: 2, answers: { q1: 'yes' } });\n *\n * // Read the current data\n * const current = formData.read();\n * console.log(current); // { step: 2, answers: { q1: 'yes' } }\n * ```\n */\nexport function createSessionStorageProvider<T extends JsonValue>(config: SessionStorageProviderConfig): SessionStorageProvider<T> {\n return new SessionStorageProvider<T>(config);\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";AAAA,uBAAS,uBAyBF,MAAM,CAA4C,OAChC,SAAU,QAEhB,MACE,QAEnB,WAAW,CAAC,EAAsC,CAChD,KAAK,MAAQ,EAAO,KACpB,KAAK,QAAU,EAAa,6BAA6B,KAAK,OAAO,EACrE,KAAK,QAAQ,gBAAgB,cAAe,CAAM,QAetC,IAAG,CAAC,EAAsB,CACtC,OAAO,eAAe,QAAQ,CAAG,IAAM,KAgBlC,GAAG,EAAY,CACpB,OAAO,eAAe,QAAQ,KAAK,KAAK,IAAM,KAiBzC,IAAI,EAAa,CACtB,IAAI,EAAqB,KAEzB,GAAI,CACF,EAAM,eAAe,QAAQ,KAAK,KAAK,EAEzC,MAAO,EAAK,CACV,KAAK,QAAQ,MAAM,OAAQ,6BAA8B,CAAE,KAAI,CAAC,EAGlE,GAAI,CAAC,EAEH,OADA,KAAK,QAAQ,YAAY,gBAAgB,EAClC,KAGT,GAAI,CACF,IAAM,EAAS,KAAK,MAAM,CAAG,EAE7B,OADA,KAAK,QAAQ,gBAAgB,cAAe,OAAW,CAAE,QAAO,CAAC,EAC1D,EAET,MAAO,EAAK,CAEV,OADA,KAAK,QAAQ,MAAM,OAAQ,mBAAoB,CAAE,KAAI,CAAC,EAC/C,MAeJ,KAAK,CAAC,EAAgB,CAC3B,KAAK,QAAQ,gBAAgB,QAAS,CAAE,OAAM,CAAC,EAE/C,IAAI,EACJ,GAAI,CACF,EAAW,KAAK,UAAU,CAAK,EAEjC,MAAO,EAAK,CAEV,MADA,KAAK,QAAQ,MAAM,QAAS,wBAAyB,CAAE,KAAI,CAAC,EAClD,MAAM,uBAAuB,EAGzC,GAAI,CACF,eAAe,QAAQ,KAAK,MAAO,CAAQ,EAE7C,MAAO,EAAK,CACV,KAAK,QAAQ,MAAM,QAAS,8BAA+B,CAAE,KAAI,CAAC,GAY/D,MAAM,EAAS,CACpB,KAAK,QAAQ,YAAY,QAAQ,EACjC,eAAe,WAAW,KAAK,KAAK,EAExC,CCnIO,SAAS,CAAiD,CAAC,EAAiE,CACjI,OAAO,IAAI,EAA0B,CAAM",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "9B39F4D5F4B80FE564756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/package.json
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/session-storage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "A modern, simple, and robust solution for managing versioned JSON objects in the browser's `sessionStorage`. This package provides a clean, class-based API with a factory function to ensure your application's data persistence is safe, maintainable, and future-proof within a single tab.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
|
+
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
|
-
"directory": "packages/session-storage",
|
|
10
9
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/Alwatr/
|
|
10
|
+
"url": "https://github.com/Alwatr/alwatr",
|
|
11
|
+
"directory": "pkg/nanolib/session-storage"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/Alwatr/
|
|
14
|
-
"bugs": "https://github.com/Alwatr/
|
|
13
|
+
"homepage": "https://github.com/Alwatr/alwatr/tree/main/pkg/nanolib/session-storage#readme",
|
|
14
|
+
"bugs": "https://github.com/Alwatr/alwatr/issues",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./dist/main.d.ts",
|
|
18
|
+
"import": "./dist/main.js",
|
|
18
19
|
"default": "./dist/main.js"
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"sideEffects": false,
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@alwatr/logger": "
|
|
24
|
+
"@alwatr/logger": "9.1.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@alwatr/nano-build": "
|
|
27
|
-
"@alwatr/
|
|
28
|
-
"@alwatr/
|
|
29
|
-
"
|
|
30
|
-
"typescript": "^5.9.3"
|
|
27
|
+
"@alwatr/nano-build": "9.1.0",
|
|
28
|
+
"@alwatr/tsconfig-base": "9.1.0",
|
|
29
|
+
"@alwatr/type-helper": "9.1.0",
|
|
30
|
+
"typescript": "^6.0.2"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"b": "bun run build",
|
|
34
34
|
"build": "bun run build:ts && bun run build:es",
|
|
35
35
|
"build:es": "nano-build --preset=module src/main.ts",
|
|
36
36
|
"build:ts": "tsc --build",
|
|
37
|
-
"
|
|
38
|
-
"cb": "bun run clean && bun run build",
|
|
37
|
+
"cl": "bun run clean",
|
|
39
38
|
"clean": "rm -rfv dist *.tsbuildinfo",
|
|
40
|
-
"
|
|
39
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
40
|
+
"lint": "eslint src/ --ext .ts",
|
|
41
|
+
"t": "bun run test",
|
|
42
|
+
"test": "ALWATR_DEBUG=0 bun test",
|
|
41
43
|
"w": "bun run watch",
|
|
42
44
|
"watch": "bun run watch:ts & bun run watch:es",
|
|
43
45
|
"watch:es": "bun run build:es --watch",
|
|
44
46
|
"watch:ts": "bun run build:ts --watch --preserveWatchOutput"
|
|
45
47
|
},
|
|
46
48
|
"files": [
|
|
47
|
-
"
|
|
49
|
+
"dist",
|
|
50
|
+
"src/**/*.ts",
|
|
51
|
+
"!src/**/*.test.ts",
|
|
48
52
|
"README.md",
|
|
49
|
-
"LICENSE"
|
|
50
|
-
"!demo/**/*",
|
|
51
|
-
"!**/*.test.js"
|
|
53
|
+
"LICENSE"
|
|
52
54
|
],
|
|
53
55
|
"publishConfig": {
|
|
54
56
|
"access": "public"
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
"browser storage",
|
|
60
62
|
"cross-platform",
|
|
61
63
|
"data persistence",
|
|
62
|
-
"
|
|
64
|
+
"esm",
|
|
63
65
|
"facade factory",
|
|
64
66
|
"JavaScript",
|
|
65
67
|
"JSON storage",
|
|
@@ -71,6 +73,5 @@
|
|
|
71
73
|
"utility",
|
|
72
74
|
"versioning"
|
|
73
75
|
],
|
|
74
|
-
"
|
|
75
|
-
"gitHead": "f843742e94d6ebed3921d57b624d9deb35c2c102"
|
|
76
|
+
"gitHead": "4a25cd3e0499cf61dd761e87d3711abf9b0cd208"
|
|
76
77
|
}
|