@efficimo/storage 0.2.0 → 0.3.1
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/LICENSE +21 -0
- package/README.md +40 -6
- package/dist/cjs/BaseStorage.d.ts +2 -2
- package/dist/cjs/BaseStorage.d.ts.map +1 -1
- package/dist/cjs/BaseStorage.js +2 -2
- package/dist/cjs/BaseStorage.js.map +1 -1
- package/dist/cjs/CookieStorage.d.ts +3 -3
- package/dist/cjs/CookieStorage.d.ts.map +1 -1
- package/dist/cjs/CookieStorage.js +4 -4
- package/dist/cjs/CookieStorage.js.map +1 -1
- package/dist/cjs/CookieStorageAdapter.d.ts +1 -1
- package/dist/cjs/CookieStorageAdapter.d.ts.map +1 -1
- package/dist/cjs/CookieStorageAdapter.js.map +1 -1
- package/dist/cjs/LocalStorage.d.ts +2 -2
- package/dist/cjs/LocalStorage.d.ts.map +1 -1
- package/dist/cjs/LocalStorage.js +4 -4
- package/dist/cjs/LocalStorage.js.map +1 -1
- package/dist/cjs/NativeStorageAdapter.d.ts +1 -1
- package/dist/cjs/NativeStorageAdapter.d.ts.map +1 -1
- package/dist/cjs/NativeStorageAdapter.js.map +1 -1
- package/dist/cjs/SessionStorage.d.ts +2 -2
- package/dist/cjs/SessionStorage.d.ts.map +1 -1
- package/dist/cjs/SessionStorage.js +4 -4
- package/dist/cjs/SessionStorage.js.map +1 -1
- package/dist/cjs/StorageObservable.d.ts +1 -1
- package/dist/cjs/StorageObservable.d.ts.map +1 -1
- package/dist/cjs/StorageObservable.js.map +1 -1
- package/dist/cjs/index.d.ts +11 -11
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +11 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/BaseStorage.d.ts +2 -2
- package/dist/esm/BaseStorage.d.ts.map +1 -1
- package/dist/esm/BaseStorage.js +1 -1
- package/dist/esm/BaseStorage.js.map +1 -1
- package/dist/esm/CookieStorage.d.ts +3 -3
- package/dist/esm/CookieStorage.d.ts.map +1 -1
- package/dist/esm/CookieStorage.js +2 -2
- package/dist/esm/CookieStorage.js.map +1 -1
- package/dist/esm/CookieStorageAdapter.d.ts +1 -1
- package/dist/esm/CookieStorageAdapter.d.ts.map +1 -1
- package/dist/esm/CookieStorageAdapter.js.map +1 -1
- package/dist/esm/LocalStorage.d.ts +2 -2
- package/dist/esm/LocalStorage.d.ts.map +1 -1
- package/dist/esm/LocalStorage.js +2 -2
- package/dist/esm/LocalStorage.js.map +1 -1
- package/dist/esm/NativeStorageAdapter.d.ts +1 -1
- package/dist/esm/NativeStorageAdapter.d.ts.map +1 -1
- package/dist/esm/SessionStorage.d.ts +2 -2
- package/dist/esm/SessionStorage.d.ts.map +1 -1
- package/dist/esm/SessionStorage.js +2 -2
- package/dist/esm/SessionStorage.js.map +1 -1
- package/dist/esm/StorageObservable.d.ts +1 -1
- package/dist/esm/StorageObservable.d.ts.map +1 -1
- package/dist/esm/index.d.ts +11 -11
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/esm/index.js.map +1 -1
- package/package.json +12 -7
- package/src/BaseStorage.ts +92 -0
- package/src/CookieStorage.ts +19 -0
- package/src/CookieStorageAdapter.ts +108 -0
- package/src/DefaultCookieStorageKeys.ts +2 -0
- package/src/DefaultLocalStorageKeys.ts +2 -0
- package/src/DefaultSessionStorageKeys.ts +2 -0
- package/src/LocalStorage.ts +17 -0
- package/src/NativeStorageAdapter.ts +42 -0
- package/src/SessionStorage.ts +17 -0
- package/src/StorageObservable.ts +48 -0
- package/src/Store.ts +9 -0
- package/src/index.ts +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 efficimo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -18,21 +18,24 @@ Built on [`@efficimo/observable`](https://www.npmjs.com/package/@efficimo/observ
|
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
|
+
`@efficimo/observable` is a **peer dependency** — it must resolve to a single instance shared
|
|
22
|
+
with the rest of your app, so install it explicitly:
|
|
23
|
+
|
|
21
24
|
```bash
|
|
22
25
|
# core only
|
|
23
|
-
npm install @efficimo/storage
|
|
26
|
+
npm install @efficimo/storage @efficimo/observable
|
|
24
27
|
|
|
25
28
|
# with React hook
|
|
26
|
-
npm install @efficimo/storage @efficimo/storage-react
|
|
29
|
+
npm install @efficimo/storage @efficimo/storage-react @efficimo/observable
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
## Quick start
|
|
30
33
|
|
|
31
34
|
```typescript
|
|
32
|
-
import { BaseStorage } from '@efficimo/storage';
|
|
35
|
+
import { BaseStorage, NativeStorageAdapter } from '@efficimo/storage';
|
|
33
36
|
|
|
34
37
|
type Keys = 'auth.token' | 'user.theme';
|
|
35
|
-
const store = new BaseStorage<Keys>(localStorage);
|
|
38
|
+
const store = new BaseStorage<Keys>(new NativeStorageAdapter(localStorage));
|
|
36
39
|
|
|
37
40
|
// reactive subscription
|
|
38
41
|
store.getObservable('auth.token').subscribe(token => {
|
|
@@ -90,10 +93,41 @@ const prefs = LocalStorage.getSerializedObservable('user.prefs', schema, { theme
|
|
|
90
93
|
|
|
91
94
|
prefs.subscribe(v => console.log(v)); // { theme: 'light', lang: 'en' }
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
prefs.next({ theme: 'dark', lang: 'fr' });
|
|
94
97
|
// localStorage now holds '{"theme":"dark","lang":"fr"}'
|
|
95
98
|
```
|
|
96
99
|
|
|
100
|
+
## Cookies
|
|
101
|
+
|
|
102
|
+
`CookieStorage` is a singleton backed by `CookieStorageAdapter`, which uses the
|
|
103
|
+
[Cookie Store API](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore).
|
|
104
|
+
Keys are typed through the `DefaultCookieStorageKeys` interface, like the other singletons:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { CookieStorage } from '@efficimo/storage';
|
|
108
|
+
|
|
109
|
+
declare module '@efficimo/storage' {
|
|
110
|
+
interface DefaultCookieStorageKeys {
|
|
111
|
+
'consent.analytics': true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
CookieStorage.getObservable('consent.analytics').subscribe(v => console.log(v));
|
|
116
|
+
CookieStorage.set('consent.analytics', 'granted');
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Use `CookieStorageAdapter` directly to set cookie attributes (`path`, `domain`, `maxAge`, `sameSite`):
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { BaseStorage, CookieStorageAdapter } from '@efficimo/storage';
|
|
123
|
+
|
|
124
|
+
const cookies = new BaseStorage(
|
|
125
|
+
new CookieStorageAdapter({ path: '/', sameSite: 'lax', maxAge: 60 * 60 * 24 * 365 }),
|
|
126
|
+
);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
External cookie changes are picked up through `cookieStore.onchange` when the browser supports it.
|
|
130
|
+
|
|
97
131
|
## Cross-tab sync
|
|
98
132
|
|
|
99
133
|
`BaseStorage` listens to the browser `storage` event automatically. Any change made in another tab propagates to all active observables in the current tab — no extra setup required.
|
|
@@ -120,7 +154,7 @@ Implements `ObservableValueInterface<string | null>` from `@efficimo/observable`
|
|
|
120
154
|
|---|---|
|
|
121
155
|
| `getValue()` | Returns the current storage value. |
|
|
122
156
|
| `subscribe(fn)` | Registers subscriber and immediately calls it with the current value. |
|
|
123
|
-
| `next(value \| setter)` | Updates the value. Supports
|
|
157
|
+
| `next(value \| setter)` | Updates the value. Supports a setter function `(prev) => newValue`. No-op if unchanged. |
|
|
124
158
|
|
|
125
159
|
---
|
|
126
160
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonSerializeObservableValue, type SafeParseSchema } from "@efficimo/observable";
|
|
2
|
-
import { StorageObservable } from "./StorageObservable";
|
|
3
|
-
import type { Store } from "./Store";
|
|
2
|
+
import { StorageObservable } from "./StorageObservable.ts";
|
|
3
|
+
import type { Store } from "./Store.ts";
|
|
4
4
|
export declare class BaseStorage<StorageKey extends string, Options = never> {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(storage: Store<StorageKey, Options>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStorage.d.ts","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BaseStorage.d.ts","sourceRoot":"","sources":["../../src/BaseStorage.ts"],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esModule", { value: true });
|
|
15
15
|
exports.BaseStorage = void 0;
|
|
16
16
|
const observable_1 = require("@efficimo/observable");
|
|
17
|
-
const
|
|
17
|
+
const StorageObservable_ts_1 = require("./StorageObservable.js");
|
|
18
18
|
const createObservable = (storage, key, initialValue) => {
|
|
19
|
-
const obs = new
|
|
19
|
+
const obs = new StorageObservable_ts_1.StorageObservable(key, storage);
|
|
20
20
|
if (obs.getValue() === null && initialValue != null) {
|
|
21
21
|
obs.next(initialValue);
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStorage.js","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAA0F;AAC1F,
|
|
1
|
+
{"version":3,"file":"BaseStorage.js","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAA0F;AAC1F,iEAA2D;AAG3D,MAAM,gBAAgB,GAAG,CACvB,OAAmC,EACnC,GAAe,EACf,YAA4B,EACG,EAAE;IACjC,MAAM,GAAG,GAAG,IAAI,wCAAiB,CAAa,GAAG,EAAE,OAAO,CAAC,CAAC;IAE5D,IAAI,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,IAAI,YAAY,IAAI,IAAI,EAAE,CAAC;QACpD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;IAME,YAAmB,OAAmC;QALtD,uCAAqC;QACrC,2CAEE;QAGA,uBAAA,IAAI,4BAAgB,EAAE,MAAA,CAAC;QACvB,uBAAA,IAAI,wBAAY,OAAO,MAAA,CAAC;QAExB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;gBACjB,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAA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AA2B;QACxE,OAAO,uBAAA,IAAI,4BAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM,CAAqC,UAA2B;QAC3E,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK;QACV,uBAAA,IAAI,4BAAS,CAAC,KAAK,EAAE,CAAC;QACtB,uBAAA,IAAI,4BAAgB,EAAE,MAAA,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import { type CookieOptions } from "./CookieStorageAdapter";
|
|
3
|
-
import type { DefaultCookieStorageKeys } from "./DefaultCookieStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import { type CookieOptions } from "./CookieStorageAdapter.ts";
|
|
3
|
+
import type { DefaultCookieStorageKeys } from "./DefaultCookieStorageKeys.ts";
|
|
4
4
|
export type { CookieOptions };
|
|
5
5
|
declare class _CookieStorage extends BaseStorage<keyof DefaultCookieStorageKeys & string, CookieOptions> {
|
|
6
6
|
static _instance: _CookieStorage | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorage.d.ts","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CookieStorage.d.ts","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,cAAM,cAAe,SAAQ,WAAW,CAAC,MAAM,wBAAwB,GAAG,MAAM,EAAE,aAAa,CAAC;IAC9F,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAQ;IAE/C,MAAM,CAAC,WAAW,IAAI,cAAc,CAMnC;CACF;AAED,eAAO,MAAM,aAAa,gBAA+B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CookieStorage = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class _CookieStorage extends
|
|
4
|
+
const BaseStorage_ts_1 = require("./BaseStorage.js");
|
|
5
|
+
const CookieStorageAdapter_ts_1 = require("./CookieStorageAdapter.js");
|
|
6
|
+
class _CookieStorage extends BaseStorage_ts_1.BaseStorage {
|
|
7
7
|
static getInstance() {
|
|
8
8
|
if (_CookieStorage._instance == null) {
|
|
9
|
-
_CookieStorage._instance = new _CookieStorage(new
|
|
9
|
+
_CookieStorage._instance = new _CookieStorage(new CookieStorageAdapter_ts_1.CookieStorageAdapter());
|
|
10
10
|
}
|
|
11
11
|
return _CookieStorage._instance;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorage.js","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"CookieStorage.js","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":";;;AAAA,qDAA+C;AAC/C,uEAAqF;AAKrF,MAAM,cAAe,SAAQ,4BAAmE;IAG9F,MAAM,CAAC,WAAW;QAChB,IAAI,cAAc,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACrC,cAAc,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,8CAAoB,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;CACF;AATQ,wBAAS,GAA0B,IAAI,CAAC;AAWpC,QAAA,aAAa,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CookieStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,qBAAa,oBAAqB,YAAW,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC;;IAIvE,YAAY,OAAO,GAAE,aAAkB,EAEtC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAElC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAMjE;IAED,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAO5B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED,KAAK,IAAI,IAAI,CAoBZ;IAED,IAAI,IAAI,IAAI,CAUX;IAED,gBAAgB,YAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAAG,IAAI,CAEpF;CA6BH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorageAdapter.js","sourceRoot":"","sources":["../../src/CookieStorageAdapter.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IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACnE,OAAO,QAAQ,CAAC,MAAM;SACnB,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import type { DefaultLocalStorageKeys } from "./DefaultLocalStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultLocalStorageKeys } from "./DefaultLocalStorageKeys.ts";
|
|
3
3
|
declare class _LocalStorage extends BaseStorage<keyof DefaultLocalStorageKeys & string> {
|
|
4
4
|
static _instance: _LocalStorage | null;
|
|
5
5
|
static getInstance(): _LocalStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5E,cAAM,aAAc,SAAQ,WAAW,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC7E,MAAM,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAQ;IAE9C,MAAM,CAAC,WAAW,IAAI,aAAa,CAMlC;CACF;AAED,eAAO,MAAM,YAAY,eAA8B,CAAC"}
|
package/dist/cjs/LocalStorage.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalStorage = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class _LocalStorage extends
|
|
4
|
+
const BaseStorage_ts_1 = require("./BaseStorage.js");
|
|
5
|
+
const NativeStorageAdapter_ts_1 = require("./NativeStorageAdapter.js");
|
|
6
|
+
class _LocalStorage extends BaseStorage_ts_1.BaseStorage {
|
|
7
7
|
static getInstance() {
|
|
8
8
|
if (_LocalStorage._instance == null) {
|
|
9
|
-
_LocalStorage._instance = new _LocalStorage(new
|
|
9
|
+
_LocalStorage._instance = new _LocalStorage(new NativeStorageAdapter_ts_1.NativeStorageAdapter(localStorage));
|
|
10
10
|
}
|
|
11
11
|
return _LocalStorage._instance;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.js","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"LocalStorage.js","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":";;;AAAA,qDAA+C;AAE/C,uEAAiE;AAEjE,MAAM,aAAc,SAAQ,4BAAmD;IAG7E,MAAM,CAAC,WAAW;QAChB,IAAI,aAAa,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACpC,aAAa,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,IAAI,8CAAoB,CAAC,YAAY,CAAC,CAAC,CAAC;QACtF,CAAC;QAED,OAAO,aAAa,CAAC,SAAS,CAAC;IACjC,CAAC;CACF;AATQ,uBAAS,GAAyB,IAAI,CAAC;AAWnC,QAAA,YAAY,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"NativeStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,oBAAqB,YAAW,KAAK;;IAIhD,YAAY,OAAO,EAAE,OAAO,EAE3B;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAElC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAExC;IAED,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,IAAI,IAAI,IAAI,CAMX;IAED,gBAAgB,YAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAAG,IAAI,CAEpF;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeStorageAdapter.js","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA
|
|
1
|
+
{"version":3,"file":"NativeStorageAdapter.js","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA;IAIE,YAAY,OAAgB;QAHnB,gDAAkB;QAC3B,wDAAwF,IAAI,EAAC;QAkC7F,qBAAgB,GAAG,CAAC,OAA2D,EAAQ,EAAE;YACvF,uBAAA,IAAI,iDAA4B,OAAO,MAAA,CAAC;QAC1C,CAAC,CAAC;QAjCA,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,GAAW;QACjB,OAAO,uBAAA,IAAI,qCAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,KAAa;QAChC,uBAAA,IAAI,qCAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,UAAU,CAAC,GAAW;QACpB,uBAAA,IAAI,qCAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,uBAAA,IAAI,qCAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IAC7C,CAAC;IAED,KAAK;QACH,uBAAA,IAAI,qCAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED,IAAI;QACF,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3C,IAAI,KAAK,CAAC,WAAW,KAAK,uBAAA,IAAI,qCAAS;gBAAE,OAAO;YAChD,uBAAA,IAAI,qDAAyB,EAAE,KAA/B,IAAI,EAA4B,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;CAKF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import type { DefaultSessionStorageKeys } from "./DefaultSessionStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultSessionStorageKeys } from "./DefaultSessionStorageKeys.ts";
|
|
3
3
|
declare class _SessionStorage extends BaseStorage<keyof DefaultSessionStorageKeys & string> {
|
|
4
4
|
static _instance: _SessionStorage | null;
|
|
5
5
|
static getInstance(): _SessionStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAGhF,cAAM,eAAgB,SAAQ,WAAW,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IACjF,MAAM,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAAQ;IAEhD,MAAM,CAAC,WAAW,IAAI,eAAe,CAMpC;CACF;AAED,eAAO,MAAM,cAAc,iBAAgC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SessionStorage = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class _SessionStorage extends
|
|
4
|
+
const BaseStorage_ts_1 = require("./BaseStorage.js");
|
|
5
|
+
const NativeStorageAdapter_ts_1 = require("./NativeStorageAdapter.js");
|
|
6
|
+
class _SessionStorage extends BaseStorage_ts_1.BaseStorage {
|
|
7
7
|
static getInstance() {
|
|
8
8
|
if (_SessionStorage._instance == null) {
|
|
9
|
-
_SessionStorage._instance = new _SessionStorage(new
|
|
9
|
+
_SessionStorage._instance = new _SessionStorage(new NativeStorageAdapter_ts_1.NativeStorageAdapter(sessionStorage));
|
|
10
10
|
}
|
|
11
11
|
return _SessionStorage._instance;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.js","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"SessionStorage.js","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":";;;AAAA,qDAA+C;AAE/C,uEAAiE;AAEjE,MAAM,eAAgB,SAAQ,4BAAqD;IAGjF,MAAM,CAAC,WAAW;QAChB,IAAI,eAAe,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACtC,eAAe,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,IAAI,8CAAoB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC5F,CAAC;QAED,OAAO,eAAe,CAAC,SAAS,CAAC;IACnC,CAAC;CACF;AATQ,yBAAS,GAA2B,IAAI,CAAC;AAWrC,QAAA,cAAc,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, type ObservableValueInterface, type SetFunction, type Subscriber } from "@efficimo/observable";
|
|
2
|
-
import type { Store } from "./Store";
|
|
2
|
+
import type { Store } from "./Store.ts";
|
|
3
3
|
export declare class StorageObservable<StorageKey extends string> extends Observable<string | null> implements ObservableValueInterface<string | null> {
|
|
4
4
|
private key;
|
|
5
5
|
private storage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageObservable.d.ts","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"StorageObservable.d.ts","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,iBAAiB,CAAC,UAAU,SAAS,MAAM,CACtD,SAAQ,UAAU,CAAC,MAAM,GAAG,IAAI,CAChC,YAAW,wBAAwB,CAAC,MAAM,GAAG,IAAI,CAAC;IAElD,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,OAAO,CAA6B;IAE5C,YAAY,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,EAI/D;IAED,SAAS,eAAgB,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,0DAGhD;IAEF,IAAI,UAAW,MAAM,GAAG,IAAI,GAAG,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,KAAG,IAAI,CAe9D;IAEF,QAAQ,sBAEN;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageObservable.js","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":";;;AAAA,qDAM8B;AAG9B,
|
|
1
|
+
{"version":3,"file":"StorageObservable.js","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":";;;AAAA,qDAM8B;AAG9B,uBACE,SAAQ,uBAAyB;IAMjC,YAAY,GAAe,EAAE,OAAmC;QAC9D,KAAK,EAAE,CAAC;QAKV,cAAS,GAAG,CAAC,UAAqC,EAAE,EAAE;YACpD,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3C,OAAO,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF,SAAI,GAAG,CAAC,KAAiD,EAAQ,EAAE;YACjE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAEjE,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAC3B,OAAO;YACT,CAAC;YAED,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC3C,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC,CAAC;QAEF,aAAQ,GAAG,GAAG,EAAE;YACd,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC,CAAC;QA5BA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CA2BF"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./BaseStorage";
|
|
2
|
-
export * from "./CookieStorage";
|
|
3
|
-
export * from "./CookieStorageAdapter";
|
|
4
|
-
export * from "./DefaultCookieStorageKeys";
|
|
5
|
-
export * from "./DefaultLocalStorageKeys";
|
|
6
|
-
export * from "./DefaultSessionStorageKeys";
|
|
7
|
-
export * from "./LocalStorage";
|
|
8
|
-
export * from "./NativeStorageAdapter";
|
|
9
|
-
export * from "./SessionStorage";
|
|
10
|
-
export * from "./StorageObservable";
|
|
11
|
-
export * from "./Store";
|
|
1
|
+
export * from "./BaseStorage.ts";
|
|
2
|
+
export * from "./CookieStorage.ts";
|
|
3
|
+
export * from "./CookieStorageAdapter.ts";
|
|
4
|
+
export * from "./DefaultCookieStorageKeys.ts";
|
|
5
|
+
export * from "./DefaultLocalStorageKeys.ts";
|
|
6
|
+
export * from "./DefaultSessionStorageKeys.ts";
|
|
7
|
+
export * from "./LocalStorage.ts";
|
|
8
|
+
export * from "./NativeStorageAdapter.ts";
|
|
9
|
+
export * from "./SessionStorage.ts";
|
|
10
|
+
export * from "./StorageObservable.ts";
|
|
11
|
+
export * from "./Store.ts";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,15 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BaseStorage"), exports);
|
|
18
|
-
__exportStar(require("./CookieStorage"), exports);
|
|
19
|
-
__exportStar(require("./CookieStorageAdapter"), exports);
|
|
20
|
-
__exportStar(require("./DefaultCookieStorageKeys"), exports);
|
|
21
|
-
__exportStar(require("./DefaultLocalStorageKeys"), exports);
|
|
22
|
-
__exportStar(require("./DefaultSessionStorageKeys"), exports);
|
|
23
|
-
__exportStar(require("./LocalStorage"), exports);
|
|
24
|
-
__exportStar(require("./NativeStorageAdapter"), exports);
|
|
25
|
-
__exportStar(require("./SessionStorage"), exports);
|
|
26
|
-
__exportStar(require("./StorageObservable"), exports);
|
|
27
|
-
__exportStar(require("./Store"), exports);
|
|
17
|
+
__exportStar(require("./BaseStorage.js"), exports);
|
|
18
|
+
__exportStar(require("./CookieStorage.js"), exports);
|
|
19
|
+
__exportStar(require("./CookieStorageAdapter.js"), exports);
|
|
20
|
+
__exportStar(require("./DefaultCookieStorageKeys.js"), exports);
|
|
21
|
+
__exportStar(require("./DefaultLocalStorageKeys.js"), exports);
|
|
22
|
+
__exportStar(require("./DefaultSessionStorageKeys.js"), exports);
|
|
23
|
+
__exportStar(require("./LocalStorage.js"), exports);
|
|
24
|
+
__exportStar(require("./NativeStorageAdapter.js"), exports);
|
|
25
|
+
__exportStar(require("./SessionStorage.js"), exports);
|
|
26
|
+
__exportStar(require("./StorageObservable.js"), exports);
|
|
27
|
+
__exportStar(require("./Store.js"), exports);
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,qDAAmC;AACnC,4DAA0C;AAC1C,gEAA8C;AAC9C,+DAA6C;AAC7C,iEAA+C;AAC/C,oDAAkC;AAClC,4DAA0C;AAC1C,sDAAoC;AACpC,yDAAuC;AACvC,6CAA2B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonSerializeObservableValue, type SafeParseSchema } from "@efficimo/observable";
|
|
2
|
-
import { StorageObservable } from "./StorageObservable";
|
|
3
|
-
import type { Store } from "./Store";
|
|
2
|
+
import { StorageObservable } from "./StorageObservable.ts";
|
|
3
|
+
import type { Store } from "./Store.ts";
|
|
4
4
|
export declare class BaseStorage<StorageKey extends string, Options = never> {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(storage: Store<StorageKey, Options>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStorage.d.ts","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BaseStorage.d.ts","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAgBxC,qBAAa,WAAW,CAAC,UAAU,SAAS,MAAM,EAAE,OAAO,GAAG,KAAK;;IAMjE,YAAmB,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,EAgBrD;IAEM,aAAa,CAAC,eAAe,SAAS,UAAU,EACrD,UAAU,EAAE,eAAe,EAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,iBAAiB,CAAC,UAAU,CAAC,CAM/B;IAEM,uBAAuB,CAAC,eAAe,SAAS,UAAU,EAAE,KAAK,EACtE,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAC9B,YAAY,CAAC,EAAE,KAAK,GACnB,4BAA4B,CAAC,KAAK,CAAC,CAMrC;IAEM,GAAG,CAAC,eAAe,SAAS,UAAU,EAC3C,UAAU,EAAE,eAAe,EAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,GAAG,IAAI,CAEf;IAEM,GAAG,CAAC,eAAe,SAAS,UAAU,EAC3C,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,IAAI,CAEN;IAEM,GAAG,CAAC,eAAe,SAAS,UAAU,EAAE,UAAU,EAAE,eAAe,GAAG,OAAO,CAEnF;IAEM,MAAM,CAAC,eAAe,SAAS,UAAU,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI,CAEnF;IAEM,KAAK,IAAI,IAAI,CAGnB;CACF"}
|
package/dist/esm/BaseStorage.js
CHANGED
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _BaseStorage_storage, _BaseStorage_observables;
|
|
13
13
|
import { JsonSerializeObservableValue } from "@efficimo/observable";
|
|
14
|
-
import { StorageObservable } from "./StorageObservable";
|
|
14
|
+
import { StorageObservable } from "./StorageObservable.js";
|
|
15
15
|
const createObservable = (storage, key, initialValue) => {
|
|
16
16
|
const obs = new StorageObservable(key, storage);
|
|
17
17
|
if (obs.getValue() === null && initialValue != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStorage.js","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,4BAA4B,EAAwB,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BaseStorage.js","sourceRoot":"","sources":["../../src/BaseStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,4BAA4B,EAAwB,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,gBAAgB,GAAG,CACvB,OAAmC,EACnC,GAAe,EACf,Y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Aa,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAEM,uBAAuB,CAC5B,UAA2B,EAC3B,MAA8B,EAC9B,YAAoB;QAEpB,OAAO,IAAI,4BAA4B,CACrC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,EAC1F,MAAM,EACN,YAAY,CACb,CAAC;IACJ,CAAC;IAEM,GAAG,CACR,UAA2B,EAC3B,YAA4B;QAE5B,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IACjE,CAAC;IAEM,GAAG,CACR,UAA2B,EAC3B,IAAmB;QAEnB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,GAAG,CAAqC,UAA2B;QACxE,OAAO,uBAAA,IAAI,4BAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM,CAAqC,UAA2B;QAC3E,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK;QACV,uBAAA,IAAI,4BAAS,CAAC,KAAK,EAAE,CAAC;QACtB,uBAAA,IAAI,4BAAgB,EAAE,MAAA,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import { type CookieOptions } from "./CookieStorageAdapter";
|
|
3
|
-
import type { DefaultCookieStorageKeys } from "./DefaultCookieStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import { type CookieOptions } from "./CookieStorageAdapter.ts";
|
|
3
|
+
import type { DefaultCookieStorageKeys } from "./DefaultCookieStorageKeys.ts";
|
|
4
4
|
export type { CookieOptions };
|
|
5
5
|
declare class _CookieStorage extends BaseStorage<keyof DefaultCookieStorageKeys & string, CookieOptions> {
|
|
6
6
|
static _instance: _CookieStorage | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorage.d.ts","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CookieStorage.d.ts","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,cAAM,cAAe,SAAQ,WAAW,CAAC,MAAM,wBAAwB,GAAG,MAAM,EAAE,aAAa,CAAC;IAC9F,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAQ;IAE/C,MAAM,CAAC,WAAW,IAAI,cAAc,CAMnC;CACF;AAED,eAAO,MAAM,aAAa,gBAA+B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import { CookieStorageAdapter } from "./CookieStorageAdapter";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.js";
|
|
2
|
+
import { CookieStorageAdapter } from "./CookieStorageAdapter.js";
|
|
3
3
|
class _CookieStorage extends BaseStorage {
|
|
4
4
|
static getInstance() {
|
|
5
5
|
if (_CookieStorage._instance == null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorage.js","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CookieStorage.js","sourceRoot":"","sources":["../../src/CookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAsB,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKrF,MAAM,cAAe,SAAQ,WAAmE;IAG9F,MAAM,CAAC,WAAW;QAChB,IAAI,cAAc,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACrC,cAAc,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;CACF;AATQ,wBAAS,GAA0B,IAAI,CAAC;AAWjD,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CookieStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,qBAAa,oBAAqB,YAAW,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC;;IAIvE,YAAY,OAAO,GAAE,aAAkB,EAEtC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAElC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAMjE;IAED,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAO5B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED,KAAK,IAAI,IAAI,CAoBZ;IAED,IAAI,IAAI,IAAI,CAUX;IAED,gBAAgB,YAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAAG,IAAI,CAEpF;CA6BH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieStorageAdapter.js","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AASA,MAAM,OAAO,oBAAoB;IAI/B,YAAY,
|
|
1
|
+
{"version":3,"file":"CookieStorageAdapter.js","sourceRoot":"","sources":["../../src/CookieStorageAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AASA,MAAM,OAAO,oBAAoB;IAI/B,YAAY,OAAO,GAAkB,EAAE;;QAH9B,gDAAwB;QACjC,wDAAwF,IAAI,EAAC;QAiE7F,qBAAgB,GAAG,CAAC,OAA2D,EAAQ,EAAE;YACvF,uBAAA,IAAI,iDAA4B,OAAO,MAAA,CAAC;QAC1C,CAAC,CAAC;QAhEA,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,GAAW;QACjB,OAAO,uBAAA,IAAI,sEAAS,MAAb,IAAI,CAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,OAAuB;QACzD,uBAAA,IAAI,oEAAO,MAAX,IAAI,CAAS;aACV,GAAG,CAA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,CAAC;IACzC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IAC7C,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI;QAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI;QAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACxE,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI;QAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;IAGC,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACnE,OAAO,QAAQ,CAAC,MAAM;SACnB,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import type { DefaultLocalStorageKeys } from "./DefaultLocalStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultLocalStorageKeys } from "./DefaultLocalStorageKeys.ts";
|
|
3
3
|
declare class _LocalStorage extends BaseStorage<keyof DefaultLocalStorageKeys & string> {
|
|
4
4
|
static _instance: _LocalStorage | null;
|
|
5
5
|
static getInstance(): _LocalStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5E,cAAM,aAAc,SAAQ,WAAW,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC7E,MAAM,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAQ;IAE9C,MAAM,CAAC,WAAW,IAAI,aAAa,CAMlC;CACF;AAED,eAAO,MAAM,YAAY,eAA8B,CAAC"}
|
package/dist/esm/LocalStorage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import { NativeStorageAdapter } from "./NativeStorageAdapter";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.js";
|
|
2
|
+
import { NativeStorageAdapter } from "./NativeStorageAdapter.js";
|
|
3
3
|
class _LocalStorage extends BaseStorage {
|
|
4
4
|
static getInstance() {
|
|
5
5
|
if (_LocalStorage._instance == null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.js","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"LocalStorage.js","sourceRoot":"","sources":["../../src/LocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,aAAc,SAAQ,WAAmD;IAG7E,MAAM,CAAC,WAAW;QAChB,IAAI,aAAa,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACpC,aAAa,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,IAAI,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC;QACtF,CAAC;QAED,OAAO,aAAa,CAAC,SAAS,CAAC;IACjC,CAAC;CACF;AATQ,uBAAS,GAAyB,IAAI,CAAC;AAWhD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"NativeStorageAdapter.d.ts","sourceRoot":"","sources":["../../src/NativeStorageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,oBAAqB,YAAW,KAAK;;IAIhD,YAAY,OAAO,EAAE,OAAO,EAE3B;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAElC;IAED,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAExC;IAED,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,IAAI,IAAI,IAAI,CAMX;IAED,gBAAgB,YAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAAG,IAAI,CAEpF;CACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import type { DefaultSessionStorageKeys } from "./DefaultSessionStorageKeys";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultSessionStorageKeys } from "./DefaultSessionStorageKeys.ts";
|
|
3
3
|
declare class _SessionStorage extends BaseStorage<keyof DefaultSessionStorageKeys & string> {
|
|
4
4
|
static _instance: _SessionStorage | null;
|
|
5
5
|
static getInstance(): _SessionStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAGhF,cAAM,eAAgB,SAAQ,WAAW,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IACjF,MAAM,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAAQ;IAEhD,MAAM,CAAC,WAAW,IAAI,eAAe,CAMpC;CACF;AAED,eAAO,MAAM,cAAc,iBAAgC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseStorage } from "./BaseStorage";
|
|
2
|
-
import { NativeStorageAdapter } from "./NativeStorageAdapter";
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.js";
|
|
2
|
+
import { NativeStorageAdapter } from "./NativeStorageAdapter.js";
|
|
3
3
|
class _SessionStorage extends BaseStorage {
|
|
4
4
|
static getInstance() {
|
|
5
5
|
if (_SessionStorage._instance == null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.js","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionStorage.js","sourceRoot":"","sources":["../../src/SessionStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,eAAgB,SAAQ,WAAqD;IAGjF,MAAM,CAAC,WAAW;QAChB,IAAI,eAAe,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACtC,eAAe,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,IAAI,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC5F,CAAC;QAED,OAAO,eAAe,CAAC,SAAS,CAAC;IACnC,CAAC;CACF;AATQ,yBAAS,GAA2B,IAAI,CAAC;AAWlD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, type ObservableValueInterface, type SetFunction, type Subscriber } from "@efficimo/observable";
|
|
2
|
-
import type { Store } from "./Store";
|
|
2
|
+
import type { Store } from "./Store.ts";
|
|
3
3
|
export declare class StorageObservable<StorageKey extends string> extends Observable<string | null> implements ObservableValueInterface<string | null> {
|
|
4
4
|
private key;
|
|
5
5
|
private storage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageObservable.d.ts","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"StorageObservable.d.ts","sourceRoot":"","sources":["../../src/StorageObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,iBAAiB,CAAC,UAAU,SAAS,MAAM,CACtD,SAAQ,UAAU,CAAC,MAAM,GAAG,IAAI,CAChC,YAAW,wBAAwB,CAAC,MAAM,GAAG,IAAI,CAAC;IAElD,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,OAAO,CAA6B;IAE5C,YAAY,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,EAI/D;IAED,SAAS,eAAgB,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,0DAGhD;IAEF,IAAI,UAAW,MAAM,GAAG,IAAI,GAAG,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,KAAG,IAAI,CAe9D;IAEF,QAAQ,sBAEN;CACH"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./BaseStorage";
|
|
2
|
-
export * from "./CookieStorage";
|
|
3
|
-
export * from "./CookieStorageAdapter";
|
|
4
|
-
export * from "./DefaultCookieStorageKeys";
|
|
5
|
-
export * from "./DefaultLocalStorageKeys";
|
|
6
|
-
export * from "./DefaultSessionStorageKeys";
|
|
7
|
-
export * from "./LocalStorage";
|
|
8
|
-
export * from "./NativeStorageAdapter";
|
|
9
|
-
export * from "./SessionStorage";
|
|
10
|
-
export * from "./StorageObservable";
|
|
11
|
-
export * from "./Store";
|
|
1
|
+
export * from "./BaseStorage.ts";
|
|
2
|
+
export * from "./CookieStorage.ts";
|
|
3
|
+
export * from "./CookieStorageAdapter.ts";
|
|
4
|
+
export * from "./DefaultCookieStorageKeys.ts";
|
|
5
|
+
export * from "./DefaultLocalStorageKeys.ts";
|
|
6
|
+
export * from "./DefaultSessionStorageKeys.ts";
|
|
7
|
+
export * from "./LocalStorage.ts";
|
|
8
|
+
export * from "./NativeStorageAdapter.ts";
|
|
9
|
+
export * from "./SessionStorage.ts";
|
|
10
|
+
export * from "./StorageObservable.ts";
|
|
11
|
+
export * from "./Store.ts";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./BaseStorage";
|
|
2
|
-
export * from "./CookieStorage";
|
|
3
|
-
export * from "./CookieStorageAdapter";
|
|
4
|
-
export * from "./DefaultCookieStorageKeys";
|
|
5
|
-
export * from "./DefaultLocalStorageKeys";
|
|
6
|
-
export * from "./DefaultSessionStorageKeys";
|
|
7
|
-
export * from "./LocalStorage";
|
|
8
|
-
export * from "./NativeStorageAdapter";
|
|
9
|
-
export * from "./SessionStorage";
|
|
10
|
-
export * from "./StorageObservable";
|
|
11
|
-
export * from "./Store";
|
|
1
|
+
export * from "./BaseStorage.js";
|
|
2
|
+
export * from "./CookieStorage.js";
|
|
3
|
+
export * from "./CookieStorageAdapter.js";
|
|
4
|
+
export * from "./DefaultCookieStorageKeys.js";
|
|
5
|
+
export * from "./DefaultLocalStorageKeys.js";
|
|
6
|
+
export * from "./DefaultSessionStorageKeys.js";
|
|
7
|
+
export * from "./LocalStorage.js";
|
|
8
|
+
export * from "./NativeStorageAdapter.js";
|
|
9
|
+
export * from "./SessionStorage.js";
|
|
10
|
+
export * from "./StorageObservable.js";
|
|
11
|
+
export * from "./Store.js";
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efficimo/storage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Subscribe to browser storage. Typed keys, reactive updates, cross-tab sync — no boilerplate.",
|
|
5
5
|
"author": "efficimo",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"storage",
|
|
9
9
|
"localstorage",
|
|
10
10
|
"sessionstorage",
|
|
11
|
+
"cookies",
|
|
11
12
|
"observable",
|
|
12
13
|
"reactive",
|
|
13
14
|
"typescript",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
],
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/efficimo/storage.git"
|
|
19
|
+
"url": "git+https://github.com/efficimo/storage.git"
|
|
19
20
|
},
|
|
20
21
|
"bugs": {
|
|
21
22
|
"url": "https://github.com/efficimo/storage/issues"
|
|
@@ -24,6 +25,8 @@
|
|
|
24
25
|
"engines": {
|
|
25
26
|
"node": ">=18"
|
|
26
27
|
},
|
|
28
|
+
"type": "commonjs",
|
|
29
|
+
"sideEffects": false,
|
|
27
30
|
"main": "./dist/cjs/index.js",
|
|
28
31
|
"module": "./dist/esm/index.js",
|
|
29
32
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
}
|
|
41
44
|
},
|
|
42
45
|
"files": [
|
|
43
|
-
"dist"
|
|
46
|
+
"dist",
|
|
47
|
+
"src"
|
|
44
48
|
],
|
|
45
49
|
"publishConfig": {
|
|
46
50
|
"registry": "https://registry.npmjs.org",
|
|
@@ -52,11 +56,12 @@
|
|
|
52
56
|
"test": "tsc -p tsconfig.test.json && node --test .test-out/test/*.test.js",
|
|
53
57
|
"prepublishOnly": "npm run build && npm run typecheck"
|
|
54
58
|
},
|
|
55
|
-
"
|
|
56
|
-
"@efficimo/observable": "
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@efficimo/observable": ">=0.5.0"
|
|
57
61
|
},
|
|
58
62
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
63
|
+
"@efficimo/observable": "^0.5.1",
|
|
64
|
+
"@types/node": "^25.9.7",
|
|
65
|
+
"typescript": "^7.0.2"
|
|
61
66
|
}
|
|
62
67
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { JsonSerializeObservableValue, type SafeParseSchema } from "@efficimo/observable";
|
|
2
|
+
import { StorageObservable } from "./StorageObservable.ts";
|
|
3
|
+
import type { Store } from "./Store.ts";
|
|
4
|
+
|
|
5
|
+
const createObservable = <StorageKey extends string, Options>(
|
|
6
|
+
storage: Store<StorageKey, Options>,
|
|
7
|
+
key: StorageKey,
|
|
8
|
+
initialValue?: string | null,
|
|
9
|
+
): StorageObservable<StorageKey> => {
|
|
10
|
+
const obs = new StorageObservable<StorageKey>(key, storage);
|
|
11
|
+
|
|
12
|
+
if (obs.getValue() === null && initialValue != null) {
|
|
13
|
+
obs.next(initialValue);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return obs;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class BaseStorage<StorageKey extends string, Options = never> {
|
|
20
|
+
#storage: Store<StorageKey, Options>;
|
|
21
|
+
#observables: {
|
|
22
|
+
[key in StorageKey]?: StorageObservable<StorageKey>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
public constructor(storage: Store<StorageKey, Options>) {
|
|
26
|
+
this.#observables = {};
|
|
27
|
+
this.#storage = storage;
|
|
28
|
+
|
|
29
|
+
storage.onExternalChange?.((key, value) => {
|
|
30
|
+
if (key === null) {
|
|
31
|
+
for (const observable of Object.values(this.#observables)) {
|
|
32
|
+
(observable as StorageObservable<StorageKey>).next(null);
|
|
33
|
+
}
|
|
34
|
+
this.#observables = {};
|
|
35
|
+
} else {
|
|
36
|
+
this.#observables[key as StorageKey]?.next(value);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
storage.init();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public getObservable<StorageKeyParam extends StorageKey>(
|
|
44
|
+
storageKey: StorageKeyParam,
|
|
45
|
+
defaultValue?: string | null,
|
|
46
|
+
): StorageObservable<StorageKey> {
|
|
47
|
+
if (this.#observables[storageKey] == null) {
|
|
48
|
+
this.#observables[storageKey] = createObservable(this.#storage, storageKey, defaultValue);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this.#observables[storageKey];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public getSerializedObservable<StorageKeyParam extends StorageKey, Value>(
|
|
55
|
+
storageKey: StorageKeyParam,
|
|
56
|
+
schema: SafeParseSchema<Value>,
|
|
57
|
+
defaultValue?: Value,
|
|
58
|
+
): JsonSerializeObservableValue<Value> {
|
|
59
|
+
return new JsonSerializeObservableValue(
|
|
60
|
+
this.getObservable(storageKey, defaultValue == null ? null : JSON.stringify(defaultValue)),
|
|
61
|
+
schema,
|
|
62
|
+
defaultValue,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public get<StorageKeyParam extends StorageKey>(
|
|
67
|
+
storageKey: StorageKeyParam,
|
|
68
|
+
defaultValue?: string | null,
|
|
69
|
+
): string | null {
|
|
70
|
+
return this.getObservable(storageKey, defaultValue).getValue();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public set<StorageKeyParam extends StorageKey>(
|
|
74
|
+
storageKey: StorageKeyParam,
|
|
75
|
+
data: string | null,
|
|
76
|
+
): void {
|
|
77
|
+
this.getObservable(storageKey).next(data);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public has<StorageKeyParam extends StorageKey>(storageKey: StorageKeyParam): boolean {
|
|
81
|
+
return this.#storage.has(storageKey);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public remove<StorageKeyParam extends StorageKey>(storageKey: StorageKeyParam): void {
|
|
85
|
+
this.getObservable(storageKey).next(null);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public clear(): void {
|
|
89
|
+
this.#storage.clear();
|
|
90
|
+
this.#observables = {};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import { type CookieOptions, CookieStorageAdapter } from "./CookieStorageAdapter.ts";
|
|
3
|
+
import type { DefaultCookieStorageKeys } from "./DefaultCookieStorageKeys.ts";
|
|
4
|
+
|
|
5
|
+
export type { CookieOptions };
|
|
6
|
+
|
|
7
|
+
class _CookieStorage extends BaseStorage<keyof DefaultCookieStorageKeys & string, CookieOptions> {
|
|
8
|
+
static _instance: _CookieStorage | null = null;
|
|
9
|
+
|
|
10
|
+
static getInstance(): _CookieStorage {
|
|
11
|
+
if (_CookieStorage._instance == null) {
|
|
12
|
+
_CookieStorage._instance = new _CookieStorage(new CookieStorageAdapter());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return _CookieStorage._instance;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const CookieStorage = _CookieStorage.getInstance();
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Store } from "./Store.ts";
|
|
2
|
+
|
|
3
|
+
export interface CookieOptions {
|
|
4
|
+
path?: string;
|
|
5
|
+
domain?: string;
|
|
6
|
+
maxAge?: number;
|
|
7
|
+
sameSite?: CookieSameSite;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class CookieStorageAdapter implements Store<string, CookieOptions> {
|
|
11
|
+
readonly #options: CookieOptions;
|
|
12
|
+
#onExternalChangeHandler: ((key: string | null, value: string | null) => void) | null = null;
|
|
13
|
+
|
|
14
|
+
constructor(options: CookieOptions = {}) {
|
|
15
|
+
this.#options = options;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getItem(key: string): string | null {
|
|
19
|
+
return this.#entries().find(([k]) => k === key)?.[1] ?? null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setItem(key: string, value: string, options?: CookieOptions): void {
|
|
23
|
+
this.#store()
|
|
24
|
+
.set(this.#buildInit(key, value, options))
|
|
25
|
+
.catch((err: unknown) => {
|
|
26
|
+
throw new Error(`Failed to set cookie "${key}": ${err}`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
removeItem(key: string): void {
|
|
31
|
+
const opts = this.#options;
|
|
32
|
+
this.#store()
|
|
33
|
+
.delete({ name: key, domain: opts.domain ?? null, path: opts.path })
|
|
34
|
+
.catch((err: unknown) => {
|
|
35
|
+
throw new Error(`Failed to delete cookie "${key}": ${err}`);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
has(key: string): boolean {
|
|
40
|
+
return this.getItem(key) !== null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
clear(): void {
|
|
44
|
+
this.#store()
|
|
45
|
+
.getAll()
|
|
46
|
+
.then((cookies) => {
|
|
47
|
+
for (const cookie of cookies) {
|
|
48
|
+
if (cookie.name == null) continue;
|
|
49
|
+
this.#store()
|
|
50
|
+
.delete({
|
|
51
|
+
name: cookie.name,
|
|
52
|
+
domain: this.#options.domain ?? null,
|
|
53
|
+
path: this.#options.path,
|
|
54
|
+
})
|
|
55
|
+
.catch((err: unknown) => {
|
|
56
|
+
throw new Error(`Failed to delete cookie "${cookie.name}": ${err}`);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.catch((err: unknown) => {
|
|
61
|
+
throw new Error(`Failed to clear cookies: ${err}`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
init(): void {
|
|
66
|
+
if (typeof window === "undefined" || !window.cookieStore) return;
|
|
67
|
+
window.cookieStore.onchange = (event) => {
|
|
68
|
+
for (const cookie of event.changed) {
|
|
69
|
+
this.#onExternalChangeHandler?.(cookie.name ?? null, cookie.value ?? null);
|
|
70
|
+
}
|
|
71
|
+
for (const cookie of event.deleted) {
|
|
72
|
+
this.#onExternalChangeHandler?.(cookie.name ?? null, null);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onExternalChange = (handler: (key: string | null, value: string | null) => void): void => {
|
|
78
|
+
this.#onExternalChangeHandler = handler;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
#store(): CookieStore {
|
|
82
|
+
if (typeof window === "undefined" || !window.cookieStore) {
|
|
83
|
+
throw new Error("cookieStore is not available in this environment");
|
|
84
|
+
}
|
|
85
|
+
return window.cookieStore;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#buildInit(name: string, value: string, options?: CookieOptions): CookieInit {
|
|
89
|
+
const opts = { ...this.#options, ...options };
|
|
90
|
+
const init: CookieInit = { name, value };
|
|
91
|
+
if (opts.path != null) init.path = opts.path;
|
|
92
|
+
if (opts.domain != null) init.domain = opts.domain;
|
|
93
|
+
if (opts.maxAge != null) init.expires = Date.now() + opts.maxAge * 1000;
|
|
94
|
+
if (opts.sameSite != null) init.sameSite = opts.sameSite;
|
|
95
|
+
return init;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#entries(): [string, string][] {
|
|
99
|
+
if (typeof document === "undefined" || !document.cookie) return [];
|
|
100
|
+
return document.cookie
|
|
101
|
+
.split("; ")
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.map((c) => {
|
|
104
|
+
const eq = c.indexOf("=");
|
|
105
|
+
return [decodeURIComponent(c.slice(0, eq)), decodeURIComponent(c.slice(eq + 1))];
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultLocalStorageKeys } from "./DefaultLocalStorageKeys.ts";
|
|
3
|
+
import { NativeStorageAdapter } from "./NativeStorageAdapter.ts";
|
|
4
|
+
|
|
5
|
+
class _LocalStorage extends BaseStorage<keyof DefaultLocalStorageKeys & string> {
|
|
6
|
+
static _instance: _LocalStorage | null = null;
|
|
7
|
+
|
|
8
|
+
static getInstance(): _LocalStorage {
|
|
9
|
+
if (_LocalStorage._instance == null) {
|
|
10
|
+
_LocalStorage._instance = new _LocalStorage(new NativeStorageAdapter(localStorage));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return _LocalStorage._instance;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const LocalStorage = _LocalStorage.getInstance();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Store } from "./Store.ts";
|
|
2
|
+
|
|
3
|
+
export class NativeStorageAdapter implements Store {
|
|
4
|
+
readonly #storage: Storage;
|
|
5
|
+
#onExternalChangeHandler: ((key: string | null, value: string | null) => void) | null = null;
|
|
6
|
+
|
|
7
|
+
constructor(storage: Storage) {
|
|
8
|
+
this.#storage = storage;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getItem(key: string): string | null {
|
|
12
|
+
return this.#storage.getItem(key);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setItem(key: string, value: string): void {
|
|
16
|
+
this.#storage.setItem(key, value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
removeItem(key: string): void {
|
|
20
|
+
this.#storage.removeItem(key);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
has(key: string): boolean {
|
|
24
|
+
return this.#storage.getItem(key) !== null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
clear(): void {
|
|
28
|
+
this.#storage.clear();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
init(): void {
|
|
32
|
+
if (typeof window === "undefined") return;
|
|
33
|
+
window.addEventListener("storage", (event) => {
|
|
34
|
+
if (event.storageArea !== this.#storage) return;
|
|
35
|
+
this.#onExternalChangeHandler?.(event.key, event.newValue);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onExternalChange = (handler: (key: string | null, value: string | null) => void): void => {
|
|
40
|
+
this.#onExternalChangeHandler = handler;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseStorage } from "./BaseStorage.ts";
|
|
2
|
+
import type { DefaultSessionStorageKeys } from "./DefaultSessionStorageKeys.ts";
|
|
3
|
+
import { NativeStorageAdapter } from "./NativeStorageAdapter.ts";
|
|
4
|
+
|
|
5
|
+
class _SessionStorage extends BaseStorage<keyof DefaultSessionStorageKeys & string> {
|
|
6
|
+
static _instance: _SessionStorage | null = null;
|
|
7
|
+
|
|
8
|
+
static getInstance(): _SessionStorage {
|
|
9
|
+
if (_SessionStorage._instance == null) {
|
|
10
|
+
_SessionStorage._instance = new _SessionStorage(new NativeStorageAdapter(sessionStorage));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return _SessionStorage._instance;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SessionStorage = _SessionStorage.getInstance();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isSetFunction,
|
|
3
|
+
Observable,
|
|
4
|
+
type ObservableValueInterface,
|
|
5
|
+
type SetFunction,
|
|
6
|
+
type Subscriber,
|
|
7
|
+
} from "@efficimo/observable";
|
|
8
|
+
import type { Store } from "./Store.ts";
|
|
9
|
+
|
|
10
|
+
export class StorageObservable<StorageKey extends string>
|
|
11
|
+
extends Observable<string | null>
|
|
12
|
+
implements ObservableValueInterface<string | null>
|
|
13
|
+
{
|
|
14
|
+
private key: StorageKey;
|
|
15
|
+
private storage: Store<StorageKey, unknown>;
|
|
16
|
+
|
|
17
|
+
constructor(key: StorageKey, storage: Store<StorageKey, unknown>) {
|
|
18
|
+
super();
|
|
19
|
+
this.key = key;
|
|
20
|
+
this.storage = storage;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
subscribe = (subscriber: Subscriber<string | null>) => {
|
|
24
|
+
subscriber(this.storage.getItem(this.key));
|
|
25
|
+
return super.subscribe(subscriber);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
next = (value: string | null | SetFunction<string | null>): void => {
|
|
29
|
+
const prevValue = this.storage.getItem(this.key);
|
|
30
|
+
const newValue = isSetFunction(value) ? value(prevValue) : value;
|
|
31
|
+
|
|
32
|
+
if (prevValue === newValue) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (newValue == null) {
|
|
37
|
+
this.storage.removeItem(this.key);
|
|
38
|
+
} else {
|
|
39
|
+
this.storage.setItem(this.key, newValue);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
super.next(newValue);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
getValue = () => {
|
|
46
|
+
return this.storage.getItem(this.key);
|
|
47
|
+
};
|
|
48
|
+
}
|
package/src/Store.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Store<StorageKey extends string = string, Options = void> {
|
|
2
|
+
getItem(key: StorageKey, options?: Options): string | null;
|
|
3
|
+
setItem(key: StorageKey, value: string, options?: Options): void;
|
|
4
|
+
removeItem(key: StorageKey): void;
|
|
5
|
+
has(key: StorageKey): boolean;
|
|
6
|
+
clear(): void;
|
|
7
|
+
init(): void;
|
|
8
|
+
onExternalChange?: (handler: (key: string | null, value: string | null) => void) => void;
|
|
9
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./BaseStorage.ts";
|
|
2
|
+
export * from "./CookieStorage.ts";
|
|
3
|
+
export * from "./CookieStorageAdapter.ts";
|
|
4
|
+
export * from "./DefaultCookieStorageKeys.ts";
|
|
5
|
+
export * from "./DefaultLocalStorageKeys.ts";
|
|
6
|
+
export * from "./DefaultSessionStorageKeys.ts";
|
|
7
|
+
export * from "./LocalStorage.ts";
|
|
8
|
+
export * from "./NativeStorageAdapter.ts";
|
|
9
|
+
export * from "./SessionStorage.ts";
|
|
10
|
+
export * from "./StorageObservable.ts";
|
|
11
|
+
export * from "./Store.ts";
|