@ngx-pwa/local-storage 13.0.1 → 13.0.4
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 +1 -1
- package/README.md +1 -247
- package/esm2020/lib/databases/indexeddb-database.mjs +3 -3
- package/esm2020/lib/databases/local-database.mjs +3 -3
- package/esm2020/lib/databases/localstorage-database.mjs +3 -3
- package/esm2020/lib/databases/memory-database.mjs +3 -3
- package/esm2020/lib/storage.module.mjs +4 -4
- package/esm2020/lib/storages/local-storage.service.mjs +3 -3
- package/esm2020/lib/storages/storage-map.service.mjs +3 -3
- package/esm2020/lib/validation/json-validator.mjs +3 -3
- package/fesm2015/ngx-pwa-local-storage.mjs +26 -25
- package/fesm2015/ngx-pwa-local-storage.mjs.map +1 -1
- package/fesm2020/ngx-pwa-local-storage.mjs +26 -25
- package/fesm2020/ngx-pwa-local-storage.mjs.map +1 -1
- package/package.json +4 -4
- package/schematics/ng-add/index.js +5 -5
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,249 +1,3 @@
|
|
|
1
1
|
# Async local storage for Angular
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- **simplicity**: simple API like native `localStorage`,
|
|
5
|
-
- **perfomance**: internally stored via the asynchronous `indexedDB` API,
|
|
6
|
-
- **Angular-like**: wrapped in RxJS `Observable`s,
|
|
7
|
-
- **security**: validate data with a JSON Schema,
|
|
8
|
-
- **compatibility**: works around some browsers issues and heavily tested via GitHub Actions,
|
|
9
|
-
- **documentation**: API fully explained, and a changelog!
|
|
10
|
-
|
|
11
|
-
## Sponsorship
|
|
12
|
-
|
|
13
|
-
This library is downloaded more than **15 000 times each week**
|
|
14
|
-
[on npm](https://www.npmjs.com/package/@ngx-pwa/local-storage),
|
|
15
|
-
and my other major open source project, the [Angular schematics extension for VS Code](https://marketplace.visualstudio.com/items?itemName=cyrilletuzi.angular-schematics),
|
|
16
|
-
is **used by 500 000 users**. It represents *months* of full time *unpaid* work.
|
|
17
|
-
|
|
18
|
-
So **please consider to [sponsor](https://github.com/sponsors/cyrilletuzi)** (or ask your company to do so). In addition to support open source, it will grant you access to the **[Schematics Pro](https://www.schematicspro.dev/)** sponsorware, which helps you build optimized and architectured Angular projects in no time.
|
|
19
|
-
|
|
20
|
-
## Why this module?
|
|
21
|
-
|
|
22
|
-
For now, Angular does not provide a client-side storage module, and almost every app needs some client-side storage.
|
|
23
|
-
There are 2 native JavaScript APIs available:
|
|
24
|
-
- [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage)
|
|
25
|
-
- [indexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
|
|
26
|
-
|
|
27
|
-
The `localStorage` API is simple to use but synchronous, so if you use it too often,
|
|
28
|
-
your app will soon begin to freeze.
|
|
29
|
-
|
|
30
|
-
The `indexedDB` API is asynchronous and efficient, but it's a mess to use:
|
|
31
|
-
you'll soon be caught by the callback hell, as it does not support `Promise`s yet.
|
|
32
|
-
|
|
33
|
-
Mozilla has done a very great job with the [`localForage` library](http://localforage.github.io/localForage/):
|
|
34
|
-
a simple API based on native `localStorage`,
|
|
35
|
-
but internally stored via the asynchronous `indexedDB` for performance.
|
|
36
|
-
But it's built in ES5 old school way and then it's a mess to include into Angular.
|
|
37
|
-
|
|
38
|
-
This module is based on the same idea as `localForage`, but built in ES6+
|
|
39
|
-
and additionally wrapped into [RxJS `Observable`s](http://reactivex.io/rxjs/)
|
|
40
|
-
to be homogeneous with other Angular modules.
|
|
41
|
-
|
|
42
|
-
## Getting started
|
|
43
|
-
|
|
44
|
-
Install the package, according to your Angular version:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# For Angular LTS (Angular >= 10):
|
|
48
|
-
ng add @ngx-pwa/local-storage
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
*Done!*
|
|
52
|
-
|
|
53
|
-
You should **stick to these commands**. If for any reason `ng add` does not work,
|
|
54
|
-
be sure to follow the [manual installation guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/MANUAL_INSTALLATION.md),
|
|
55
|
-
as there are additionnal steps to do in addition to the package installation for some versions.
|
|
56
|
-
|
|
57
|
-
If you have multiple applications in the same project, as usual, you need to choose the project:
|
|
58
|
-
```bash
|
|
59
|
-
ng add @ngx-pwa/local-storage --project yourprojectname
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Upgrading
|
|
63
|
-
|
|
64
|
-
To update to new versions, see the **[migration guides](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/MIGRATION.md).**
|
|
65
|
-
|
|
66
|
-
## API
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
import { StorageMap } from '@ngx-pwa/local-storage';
|
|
70
|
-
|
|
71
|
-
@Injectable()
|
|
72
|
-
export class YourService {
|
|
73
|
-
constructor(private storage: StorageMap) {}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
This service API follows the
|
|
78
|
-
new standard [`kv-storage` API](https://wicg.github.io/kv-storage/),
|
|
79
|
-
which is similar to the standard [`Map` API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), and close to the
|
|
80
|
-
standard [`localStorage` API](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage),
|
|
81
|
-
except it's based on [RxJS `Observable`s](https://rxjs.dev/) instead of `Promise`s:
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
class StorageMap {
|
|
85
|
-
// Write
|
|
86
|
-
set(index: string, value: any): Observable<undefined> {}
|
|
87
|
-
delete(index: string): Observable<undefined> {}
|
|
88
|
-
clear(): Observable<undefined> {}
|
|
89
|
-
|
|
90
|
-
// Read (one-time)
|
|
91
|
-
get(index: string): Observable<unknown> {}
|
|
92
|
-
get<T>(index: string, schema: JSONSchema): Observable<T> {}
|
|
93
|
-
|
|
94
|
-
// Observe
|
|
95
|
-
watch(index: string): Observable<unknown> {}
|
|
96
|
-
watch<T>(index: string, schema: JSONSchema): Observable<T> {}
|
|
97
|
-
|
|
98
|
-
// Advanced
|
|
99
|
-
size: Observable<number>;
|
|
100
|
-
has(index: string): Observable<boolean> {}
|
|
101
|
-
keys(): Observable<string> {}
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Note: there is also a `LocalStorage` service available,
|
|
106
|
-
but only for compatibility with old versions of this lib.
|
|
107
|
-
|
|
108
|
-
## How to
|
|
109
|
-
|
|
110
|
-
### Writing data
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
let user: User = { firstName: 'Henri', lastName: 'Bergson' };
|
|
114
|
-
|
|
115
|
-
this.storage.set('user', user).subscribe(() => {});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
You can store any value, without worrying about serializing. But note that:
|
|
119
|
-
- storing `null` or `undefined` makes no sense and can cause issues in some browsers, so the item will be removed instead,
|
|
120
|
-
- you should stick to JSON data, ie. primitive types, arrays and *literal* objects.
|
|
121
|
-
`Date`, `Map`, `Set`, `Blob` and other special structures can cause issues in some scenarios.
|
|
122
|
-
See the [serialization guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/SERIALIZATION.md) for more details.
|
|
123
|
-
|
|
124
|
-
### Deleting data
|
|
125
|
-
|
|
126
|
-
To delete one item:
|
|
127
|
-
```typescript
|
|
128
|
-
this.storage.delete('user').subscribe(() => {});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
To delete all items:
|
|
132
|
-
```typescript
|
|
133
|
-
this.storage.clear().subscribe(() => {});
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Reading data
|
|
137
|
-
|
|
138
|
-
To get the *current* value:
|
|
139
|
-
```typescript
|
|
140
|
-
this.storage.get('user').subscribe((user) => {
|
|
141
|
-
console.log(user);
|
|
142
|
-
});
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Not finding an item is not an error, it succeeds but returns `undefined`:
|
|
146
|
-
```typescript
|
|
147
|
-
this.storage.get('notexisting').subscribe((data) => {
|
|
148
|
-
data; // undefined
|
|
149
|
-
});
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Note you will only get *one* value**: the `Observable` is here for asynchrony but
|
|
153
|
-
**is *not* meant to emit again when the stored data is changed**.
|
|
154
|
-
If you need to watch the value, see the [watching guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/WATCHING.md).
|
|
155
|
-
|
|
156
|
-
### Checking data
|
|
157
|
-
|
|
158
|
-
Don't forget it's client-side storage: **always check the data**, as it could have been forged.
|
|
159
|
-
|
|
160
|
-
You can use a [JSON Schema](http://json-schema.org/) to validate the data.
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
this.storage.get('test', { type: 'string' }).subscribe({
|
|
164
|
-
next: (user) => { /* Called if data is valid or `undefined` */ },
|
|
165
|
-
error: (error) => { /* Called if data is invalid */ },
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**See the [full validation guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/VALIDATION.md) to see how to validate all common scenarios.**
|
|
170
|
-
|
|
171
|
-
### Subscription
|
|
172
|
-
|
|
173
|
-
You *DO NOT* need to unsubscribe: the `Observable` autocompletes (like in the Angular `HttpClient` service).
|
|
174
|
-
|
|
175
|
-
But **you *DO* need to subscribe**, even if you don't have something specific to do after writing in storage
|
|
176
|
-
(because it's how RxJS `Observable`s work).
|
|
177
|
-
|
|
178
|
-
### Errors
|
|
179
|
-
|
|
180
|
-
As usual, it's better to catch any potential error:
|
|
181
|
-
```typescript
|
|
182
|
-
this.storage.set('color', 'red').subscribe({
|
|
183
|
-
next: () => {},
|
|
184
|
-
error: (error) => {},
|
|
185
|
-
});
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
For read operations, you can also manage errors by providing a default value:
|
|
189
|
-
```typescript
|
|
190
|
-
import { of } from 'rxjs';
|
|
191
|
-
import { catchError } from 'rxjs/operators';
|
|
192
|
-
|
|
193
|
-
this.storage.get('color').pipe(
|
|
194
|
-
catchError(() => of('red')),
|
|
195
|
-
).subscribe((result) => {});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
See the [errors guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/ERRORS.md) for some details about what errors can happen.
|
|
199
|
-
|
|
200
|
-
### Expiration
|
|
201
|
-
|
|
202
|
-
This lib, as native `localStorage` and `indexedDb`, is about *persistent* storage.
|
|
203
|
-
|
|
204
|
-
Wanting *temporary* storage (like `sessionStorage`) is a very common misconception:
|
|
205
|
-
an application doesn't need that. [More details here](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/EXPIRATION.md).
|
|
206
|
-
|
|
207
|
-
### `Map`-like operations
|
|
208
|
-
|
|
209
|
-
In addition to the classic `localStorage`-like API,
|
|
210
|
-
this lib also provides a `Map`-like API for advanced operations:
|
|
211
|
-
- `.keys()`
|
|
212
|
-
- `.has(key)`
|
|
213
|
-
- `.size`
|
|
214
|
-
|
|
215
|
-
See the [documentation](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/MAP_OPERATIONS.md) for more info and some recipes.
|
|
216
|
-
For example, it allows to implement a multiple databases scenario.
|
|
217
|
-
|
|
218
|
-
## Support
|
|
219
|
-
|
|
220
|
-
### Angular support
|
|
221
|
-
|
|
222
|
-
We follow [Angular LTS support](https://angular.io/guide/releases).
|
|
223
|
-
|
|
224
|
-
This module supports [Universal server-side rendering](https://github.com/angular/universal)
|
|
225
|
-
via a mock storage.
|
|
226
|
-
|
|
227
|
-
### Browser support
|
|
228
|
-
|
|
229
|
-
This lib supports [the same browsers as Angular](https://angular.io/guide/browser-support).
|
|
230
|
-
See [the browsers support guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/BROWSERS_SUPPORT.md) for more details and special cases (like private browsing).
|
|
231
|
-
|
|
232
|
-
### Collision
|
|
233
|
-
|
|
234
|
-
If you have multiple apps on the same *sub*domain *and* you don't want to share data between them,
|
|
235
|
-
see the [prefix guide](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/COLLISION.md).
|
|
236
|
-
|
|
237
|
-
### Interoperability
|
|
238
|
-
|
|
239
|
-
For interoperability when mixing this lib with direct usage of native APIs or other libs like `localForage`
|
|
240
|
-
(which doesn't make sense in most cases),
|
|
241
|
-
see the [interoperability documentation](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/INTEROPERABILITY.md).
|
|
242
|
-
|
|
243
|
-
### Changelog
|
|
244
|
-
|
|
245
|
-
[Changelog available here](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/CHANGELOG.md), and [migration guides here](https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/MIGRATION.md).
|
|
246
|
-
|
|
247
|
-
## License
|
|
248
|
-
|
|
249
|
-
MIT
|
|
3
|
+
[The documentation is available on GitHub.](https://github.com/cyrilletuzi/angular-async-local-storage)
|
|
@@ -303,9 +303,9 @@ export class IndexedDBDatabase {
|
|
|
303
303
|
return race([complete$, error$]);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
307
|
-
IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
308
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
306
|
+
IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, deps: [{ token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
307
|
+
IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, providedIn: 'root' });
|
|
308
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, decorators: [{
|
|
309
309
|
type: Injectable,
|
|
310
310
|
args: [{
|
|
311
311
|
providedIn: 'root'
|
|
@@ -58,9 +58,9 @@ export function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreNa
|
|
|
58
58
|
}
|
|
59
59
|
export class LocalDatabase {
|
|
60
60
|
}
|
|
61
|
-
LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
62
|
-
LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
61
|
+
LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
62
|
+
LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, providedIn: 'root', useFactory: localDatabaseFactory, deps: [{ token: PLATFORM_ID }, { token: LS_PREFIX }, { token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }] });
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, decorators: [{
|
|
64
64
|
type: Injectable,
|
|
65
65
|
args: [{
|
|
66
66
|
providedIn: 'root',
|
|
@@ -149,9 +149,9 @@ export class LocalStorageDatabase {
|
|
|
149
149
|
return `${this.prefix}${key}`;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
153
|
-
LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
152
|
+
LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, deps: [{ token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
153
|
+
LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, providedIn: 'root' });
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, decorators: [{
|
|
155
155
|
type: Injectable,
|
|
156
156
|
args: [{
|
|
157
157
|
providedIn: 'root'
|
|
@@ -72,9 +72,9 @@ export class MemoryDatabase {
|
|
|
72
72
|
return of(this.memoryStorage.has(key));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
76
|
-
MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
75
|
+
MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
76
|
+
MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, providedIn: 'root' });
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, decorators: [{
|
|
78
78
|
type: Injectable,
|
|
79
79
|
args: [{
|
|
80
80
|
providedIn: 'root'
|
|
@@ -30,10 +30,10 @@ export class StorageModule {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
34
|
-
StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
35
|
-
StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
36
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
33
|
+
StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
34
|
+
StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
|
|
35
|
+
StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, decorators: [{
|
|
37
37
|
type: NgModule
|
|
38
38
|
}] });
|
|
39
39
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmFnZS5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcHdhL2xvY2FsLXN0b3JhZ2Uvc3JjL2xpYi9zdG9yYWdlLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUF1QixNQUFNLGVBQWUsQ0FBQztBQUU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4gICAqL1xuICBzdGF0aWMgZm9yUm9vdChjb25maWc6IFN0b3JhZ2VDb25maWcpOiBNb2R1bGVXaXRoUHJvdmlkZXJzPFN0b3JhZ2VNb2R1bGU+IHtcbiAgICByZXR1cm4ge1xuICAgICAgbmdNb2R1bGU6IFN0b3JhZ2VNb2R1bGUsXG4gICAgICBwcm92aWRlcnM6IFtcbiAgICAgICAgY29uZmlnLkxTUHJlZml4ID8geyBwcm92aWRlOiBMU19QUkVGSVgsIHVzZVZhbHVlOiBjb25maWcuTFNQcmVmaXggfSA6IFtdLFxuICAgICAgICBjb25maWcuSURCREJOYW1lID8geyBwcm92aWRlOiBJREJfREJfTkFNRSwgdXNlVmFsdWU6IGNvbmZpZy5JREJEQk5hbWUgfSA6IFtdLFxuICAgICAgICBjb25maWcuSURCU3RvcmVOYW1lID8geyBwcm92aWRlOiBJREJfU1RPUkVfTkFNRSwgdXNlVmFsdWU6IGNvbmZpZy5JREJTdG9yZU5hbWUgfSA6IFtdLFxuICAgICAgICBjb25maWcuSURCREJWZXJzaW9uID8geyBwcm92aWRlOiBJREJfREJfVkVSU0lPTiwgdXNlVmFsdWU6IGNvbmZpZy5JREJEQlZlcnNpb24gfSA6IFtdLFxuICAgICAgICAoY29uZmlnLklEQk5vV3JhcCA9PT0gZmFsc2UpID8geyBwcm92aWRlOiBJREJfTk9fV1JBUCwgdXNlVmFsdWU6IGNvbmZpZy5JREJOb1dyYXAgfSA6IFtdLFxuICAgICAgXSxcbiAgICB9O1xuICB9XG5cbn1cbiJdfQ==
|
|
@@ -72,9 +72,9 @@ export class LocalStorage {
|
|
|
72
72
|
mapTo(true));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
76
|
-
LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
75
|
+
LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, deps: [{ token: i1.StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
76
|
+
LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, providedIn: 'root' });
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, decorators: [{
|
|
78
78
|
type: Injectable,
|
|
79
79
|
args: [{
|
|
80
80
|
providedIn: 'root'
|
|
@@ -282,9 +282,9 @@ export class StorageMap {
|
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
286
|
-
StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
287
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
285
|
+
StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, deps: [{ token: i1.LocalDatabase }, { token: i2.JSONValidator }, { token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
286
|
+
StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, providedIn: 'root' });
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, decorators: [{
|
|
288
288
|
type: Injectable,
|
|
289
289
|
args: [{
|
|
290
290
|
providedIn: 'root'
|
|
@@ -232,9 +232,9 @@ export class JSONValidator {
|
|
|
232
232
|
return (schema.enum.includes(data));
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
236
|
-
JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
237
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
235
|
+
JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
236
|
+
JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, providedIn: 'root' });
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, decorators: [{
|
|
238
238
|
type: Injectable,
|
|
239
239
|
args: [{
|
|
240
240
|
providedIn: 'root'
|
|
@@ -236,9 +236,9 @@ class JSONValidator {
|
|
|
236
236
|
return (schema.enum.includes(data));
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
240
|
-
JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
239
|
+
JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
240
|
+
JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, providedIn: 'root' });
|
|
241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, decorators: [{
|
|
242
242
|
type: Injectable,
|
|
243
243
|
args: [{
|
|
244
244
|
providedIn: 'root'
|
|
@@ -630,9 +630,9 @@ class IndexedDBDatabase {
|
|
|
630
630
|
return race([complete$, error$]);
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
634
|
-
IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
633
|
+
IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, deps: [{ token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
634
|
+
IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, providedIn: 'root' });
|
|
635
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, decorators: [{
|
|
636
636
|
type: Injectable,
|
|
637
637
|
args: [{
|
|
638
638
|
providedIn: 'root'
|
|
@@ -798,9 +798,9 @@ class LocalStorageDatabase {
|
|
|
798
798
|
return `${this.prefix}${key}`;
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
|
-
LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
802
|
-
LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
803
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
801
|
+
LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, deps: [{ token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
802
|
+
LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, providedIn: 'root' });
|
|
803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, decorators: [{
|
|
804
804
|
type: Injectable,
|
|
805
805
|
args: [{
|
|
806
806
|
providedIn: 'root'
|
|
@@ -883,9 +883,9 @@ class MemoryDatabase {
|
|
|
883
883
|
return of(this.memoryStorage.has(key));
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
887
|
-
MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
888
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
886
|
+
MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
887
|
+
MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, providedIn: 'root' });
|
|
888
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, decorators: [{
|
|
889
889
|
type: Injectable,
|
|
890
890
|
args: [{
|
|
891
891
|
providedIn: 'root'
|
|
@@ -945,9 +945,9 @@ function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDB
|
|
|
945
945
|
}
|
|
946
946
|
class LocalDatabase {
|
|
947
947
|
}
|
|
948
|
-
LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
949
|
-
LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
950
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
948
|
+
LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
949
|
+
LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, providedIn: 'root', useFactory: localDatabaseFactory, deps: [{ token: PLATFORM_ID }, { token: LS_PREFIX }, { token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }] });
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, decorators: [{
|
|
951
951
|
type: Injectable,
|
|
952
952
|
args: [{
|
|
953
953
|
providedIn: 'root',
|
|
@@ -1249,9 +1249,9 @@ class StorageMap {
|
|
|
1249
1249
|
});
|
|
1250
1250
|
}
|
|
1251
1251
|
}
|
|
1252
|
-
StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
1253
|
-
StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
1254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
1252
|
+
StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, deps: [{ token: LocalDatabase }, { token: JSONValidator }, { token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1253
|
+
StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, providedIn: 'root' });
|
|
1254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, decorators: [{
|
|
1255
1255
|
type: Injectable,
|
|
1256
1256
|
args: [{
|
|
1257
1257
|
providedIn: 'root'
|
|
@@ -1333,9 +1333,9 @@ class LocalStorage {
|
|
|
1333
1333
|
mapTo(true));
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
|
-
LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
1337
|
-
LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
1338
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
1336
|
+
LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, deps: [{ token: StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1337
|
+
LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, providedIn: 'root' });
|
|
1338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, decorators: [{
|
|
1339
1339
|
type: Injectable,
|
|
1340
1340
|
args: [{
|
|
1341
1341
|
providedIn: 'root'
|
|
@@ -1371,10 +1371,10 @@ class StorageModule {
|
|
|
1371
1371
|
};
|
|
1372
1372
|
}
|
|
1373
1373
|
}
|
|
1374
|
-
StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
1375
|
-
StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
1376
|
-
StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
1374
|
+
StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1375
|
+
StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
|
|
1376
|
+
StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
|
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, decorators: [{
|
|
1378
1378
|
type: NgModule
|
|
1379
1379
|
}] });
|
|
1380
1380
|
|
|
@@ -1387,3 +1387,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1387
1387
|
*/
|
|
1388
1388
|
|
|
1389
1389
|
export { JSONValidator, LocalDatabase, LocalStorage, SERIALIZATION_ERROR, SerializationError, StorageMap, StorageModule, VALIDATION_ERROR, ValidationError };
|
|
1390
|
+
//# sourceMappingURL=ngx-pwa-local-storage.mjs.map
|