ng-http-caching 15.2.4 → 16.0.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.
Files changed (28) hide show
  1. package/esm2022/lib/ng-http-caching-interceptor.service.mjs +72 -0
  2. package/esm2022/lib/ng-http-caching.module.mjs +43 -0
  3. package/esm2022/lib/ng-http-caching.service.mjs +330 -0
  4. package/{esm2020 → esm2022}/lib/storage/ng-http-caching-browser-storage.mjs +122 -122
  5. package/{esm2020 → esm2022}/lib/storage/ng-http-caching-local-storage.mjs +6 -6
  6. package/{esm2020 → esm2022}/lib/storage/ng-http-caching-memory-storage.mjs +26 -26
  7. package/{esm2020 → esm2022}/lib/storage/ng-http-caching-session-storage.mjs +6 -6
  8. package/{esm2020 → esm2022}/lib/storage/ng-http-caching-storage.interface.mjs +1 -1
  9. package/{esm2020 → esm2022}/ng-http-caching.mjs +4 -4
  10. package/{esm2020 → esm2022}/public-api.mjs +11 -11
  11. package/{fesm2020 → fesm2022}/ng-http-caching.mjs +578 -578
  12. package/{fesm2020 → fesm2022}/ng-http-caching.mjs.map +1 -1
  13. package/index.d.ts +5 -5
  14. package/lib/ng-http-caching-interceptor.service.d.ts +15 -15
  15. package/lib/ng-http-caching.module.d.ts +9 -9
  16. package/lib/ng-http-caching.service.d.ts +213 -213
  17. package/lib/storage/ng-http-caching-browser-storage.d.ts +18 -18
  18. package/lib/storage/ng-http-caching-local-storage.d.ts +4 -4
  19. package/lib/storage/ng-http-caching-memory-storage.d.ts +12 -12
  20. package/lib/storage/ng-http-caching-session-storage.d.ts +4 -4
  21. package/lib/storage/ng-http-caching-storage.interface.d.ts +31 -31
  22. package/package.json +7 -13
  23. package/public-api.d.ts +8 -8
  24. package/esm2020/lib/ng-http-caching-interceptor.service.mjs +0 -71
  25. package/esm2020/lib/ng-http-caching.module.mjs +0 -42
  26. package/esm2020/lib/ng-http-caching.service.mjs +0 -329
  27. package/fesm2015/ng-http-caching.mjs +0 -606
  28. package/fesm2015/ng-http-caching.mjs.map +0 -1
@@ -1,213 +1,213 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { HttpRequest, HttpResponse, HttpEvent } from '@angular/common/http';
3
- import { Observable } from 'rxjs/internal/Observable';
4
- import { NgHttpCachingStorageInterface } from './storage/ng-http-caching-storage.interface';
5
- import * as i0 from "@angular/core";
6
- export interface NgHttpCachingEntry<K = any, T = any> {
7
- /**
8
- * URL
9
- */
10
- url: string;
11
- /**
12
- * HttpResponse
13
- */
14
- response: HttpResponse<T>;
15
- /**
16
- * HttpRequest
17
- */
18
- request: HttpRequest<K>;
19
- /**
20
- * Timestam of add to cache time
21
- */
22
- addedTime: number;
23
- /**
24
- * Cache version
25
- */
26
- version: string;
27
- }
28
- export declare const NG_HTTP_CACHING_CONFIG: InjectionToken<NgHttpCachingConfig>;
29
- export declare enum NgHttpCachingStrategy {
30
- /**
31
- * All request are cacheable if HTTP method is into `allowedMethod`
32
- */
33
- ALLOW_ALL = "ALLOW_ALL",
34
- /**
35
- * Only the request with `X-NG-HTTP-CACHING-ALLOW-CACHE` header are cacheable if HTTP method is into `allowedMethod`
36
- */
37
- DISALLOW_ALL = "DISALLOW_ALL"
38
- }
39
- export declare enum NgHttpCachingHeaders {
40
- /**
41
- * Request is cacheable if HTTP method is into `allowedMethod`
42
- */
43
- ALLOW_CACHE = "X-NG-HTTP-CACHING-ALLOW-CACHE",
44
- /**
45
- * Request isn't cacheable
46
- */
47
- DISALLOW_CACHE = "X-NG-HTTP-CACHING-DISALLOW-CACHE",
48
- /**
49
- * Specific cache lifetime for the request
50
- */
51
- LIFETIME = "X-NG-HTTP-CACHING-LIFETIME",
52
- /**
53
- * You can tag multiple request by adding this header with the same tag and
54
- * using `NgHttpCachingService.clearCacheByTag(tag: string)` for delete all the tagged request
55
- */
56
- TAG = "X-NG-HTTP-CACHING-TAG"
57
- }
58
- export declare const NgHttpCachingHeadersList: NgHttpCachingHeaders[];
59
- export declare const NG_HTTP_CACHING_SECOND_IN_MS = 1000;
60
- export declare const NG_HTTP_CACHING_MINUTE_IN_MS: number;
61
- export declare const NG_HTTP_CACHING_HOUR_IN_MS: number;
62
- export declare const NG_HTTP_CACHING_DAY_IN_MS: number;
63
- export declare const NG_HTTP_CACHING_WEEK_IN_MS: number;
64
- export declare const NG_HTTP_CACHING_MONTH_IN_MS: number;
65
- export declare const NG_HTTP_CACHING_YEAR_IN_MS: number;
66
- export interface NgHttpCachingConfig {
67
- /**
68
- * Set the cache store. You can implement your custom store by implement the `NgHttpCachingStorageInterface` interface, eg.:
69
- */
70
- store?: NgHttpCachingStorageInterface;
71
- /**
72
- * Number of millisecond that a response is stored in the cache.
73
- * You can set specific "lifetime" for each request by add the header `X-NG-HTTP-CACHING-LIFETIME` (see example below).
74
- */
75
- lifetime?: number;
76
- /**
77
- * Array of allowed HTTP methods to cache.
78
- * You can allow multiple methods, eg.: `['GET', 'POST', 'PUT', 'DELETE', 'HEAD']` or
79
- * allow all methods by: `['ALL']`. If `allowedMethod` is an empty array (`[]`), no response are cached.
80
- * *Warning!* `NgHttpCaching` use the full url (url with query parameters) as unique key for the cached response,
81
- * this is correct for the `GET` request but is _potentially_ wrong for other type of request (eg. `POST`, `PUT`).
82
- * You can set a different "key" by customizing the `getKey` config method (see `getKey` section).
83
- */
84
- allowedMethod?: string[];
85
- /**
86
- * Set the cache strategy, possible strategies are:
87
- * - `NgHttpCachingStrategy.ALLOW_ALL`: All request are cacheable if HTTP method is into `allowedMethod`;
88
- * - `NgHttpCachingStrategy.DISALLOW_ALL`: Only the request with `X-NG-HTTP-CACHING-ALLOW-CACHE` header are cacheable if HTTP method is into `allowedMethod`;
89
- */
90
- cacheStrategy?: NgHttpCachingStrategy;
91
- /**
92
- * Cache version. When you have a breaking change, change the version, and it'll delete the current cache automatically.
93
- * The default value is Angular major version (eg. 13), in this way, the cache is invalitaded on every Angular upgrade.
94
- */
95
- version?: string;
96
- /**
97
- * If this function return `true` the request is expired and a new request is send to backend, if return `false` isn't expired.
98
- * If the result is `undefined`, the normal behaviour is provided.
99
- */
100
- isExpired?: <K, T>(entry: NgHttpCachingEntry<K, T>) => boolean | undefined;
101
- /**
102
- * If this function return `true` the request is cacheable, if return `false` isn't cacheable.
103
- * If the result is `undefined`, the normal behaviour is provided.
104
- */
105
- isCacheable?: <K>(req: HttpRequest<K>) => boolean | undefined;
106
- /**
107
- * This function return the unique key (`string`) for store the response into the cache.
108
- * If the result is `undefined`, the normal behaviour is provided.
109
- */
110
- getKey?: <K>(req: HttpRequest<K>) => string | undefined;
111
- /**
112
- * If this function return `true` the cache entry is valid and can be strored, if return `false` isn't valid.
113
- * If the result is `undefined`, the normal behaviour is provided.
114
- */
115
- isValid?: <K, T>(entry: NgHttpCachingEntry<K, T>) => boolean | undefined;
116
- }
117
- export interface NgHttpCachingDefaultConfig extends NgHttpCachingConfig {
118
- store: NgHttpCachingStorageInterface;
119
- lifetime: number;
120
- allowedMethod: string[];
121
- cacheStrategy: NgHttpCachingStrategy;
122
- version: string;
123
- }
124
- export declare const NgHttpCachingConfigDefault: Readonly<NgHttpCachingDefaultConfig>;
125
- export declare class NgHttpCachingService {
126
- private readonly queue;
127
- private readonly config;
128
- private gcLock;
129
- private devMode;
130
- constructor(config: Readonly<NgHttpCachingConfig>);
131
- /**
132
- * Return the config
133
- */
134
- getConfig(): Readonly<NgHttpCachingConfig>;
135
- /**
136
- * Return the queue map
137
- */
138
- getQueue(): Readonly<Map<string, Observable<HttpEvent<any>>>>;
139
- /**
140
- * Return the cache store
141
- */
142
- getStore(): Readonly<NgHttpCachingStorageInterface>;
143
- /**
144
- * Return response from cache
145
- */
146
- getFromCache<K, T>(req: HttpRequest<K>): Readonly<HttpResponse<T>> | undefined;
147
- /**
148
- * Add response to cache
149
- */
150
- addToCache<K, T>(req: HttpRequest<K>, res: HttpResponse<T>): boolean;
151
- /**
152
- * Delete response from cache
153
- */
154
- deleteFromCache<K>(req: HttpRequest<K>): boolean;
155
- /**
156
- * Clear the cache
157
- */
158
- clearCache(): void;
159
- /**
160
- * Clear the cache by key
161
- */
162
- clearCacheByKey(key: string): boolean;
163
- /**
164
- * Clear the cache by regex
165
- */
166
- clearCacheByRegex<K, T>(regex: RegExp): void;
167
- /**
168
- * Clear the cache by TAG
169
- */
170
- clearCacheByTag<K, T>(tag: string): void;
171
- /**
172
- * Run garbage collector (delete expired cache entry)
173
- */
174
- runGc<K, T>(): boolean;
175
- /**
176
- * Return true if cache entry is expired
177
- */
178
- isExpired<K, T>(entry: NgHttpCachingEntry<K, T>): boolean;
179
- /**
180
- * Return true if cache entry is valid for store in the cache
181
- */
182
- isValid<K, T>(entry: NgHttpCachingEntry<K, T>): boolean;
183
- /**
184
- * Return true if the request is cacheable
185
- */
186
- isCacheable<K>(req: HttpRequest<K>): boolean;
187
- /**
188
- * Return the cache key.
189
- * Default key is http method plus url with query parameters, eg.:
190
- * `GET@https://github.com/nigrosimone/ng-http-caching`
191
- */
192
- getKey<K>(req: HttpRequest<K>): string;
193
- /**
194
- * Return observable from cache
195
- */
196
- getFromQueue<K, T>(req: HttpRequest<K>): Observable<HttpEvent<T>> | undefined;
197
- /**
198
- * Add observable to cache
199
- */
200
- addToQueue<K, T>(req: HttpRequest<K>, obs: Observable<HttpEvent<T>>): void;
201
- /**
202
- * Delete observable from cache
203
- */
204
- deleteFromQueue<K>(req: HttpRequest<K>): boolean;
205
- /**
206
- * Recursively Object.freeze simple Javascript structures consisting of plain objects, arrays, and primitives.
207
- * Make the data immutable.
208
- * @returns immutable object
209
- */
210
- private deepFreeze;
211
- static ɵfac: i0.ɵɵFactoryDeclaration<NgHttpCachingService, [{ optional: true; }]>;
212
- static ɵprov: i0.ɵɵInjectableDeclaration<NgHttpCachingService>;
213
- }
1
+ import { InjectionToken } from '@angular/core';
2
+ import { HttpRequest, HttpResponse, HttpEvent } from '@angular/common/http';
3
+ import { Observable } from 'rxjs/internal/Observable';
4
+ import { NgHttpCachingStorageInterface } from './storage/ng-http-caching-storage.interface';
5
+ import * as i0 from "@angular/core";
6
+ export interface NgHttpCachingEntry<K = any, T = any> {
7
+ /**
8
+ * URL
9
+ */
10
+ url: string;
11
+ /**
12
+ * HttpResponse
13
+ */
14
+ response: HttpResponse<T>;
15
+ /**
16
+ * HttpRequest
17
+ */
18
+ request: HttpRequest<K>;
19
+ /**
20
+ * Timestam of add to cache time
21
+ */
22
+ addedTime: number;
23
+ /**
24
+ * Cache version
25
+ */
26
+ version: string;
27
+ }
28
+ export declare const NG_HTTP_CACHING_CONFIG: InjectionToken<NgHttpCachingConfig>;
29
+ export declare enum NgHttpCachingStrategy {
30
+ /**
31
+ * All request are cacheable if HTTP method is into `allowedMethod`
32
+ */
33
+ ALLOW_ALL = "ALLOW_ALL",
34
+ /**
35
+ * Only the request with `X-NG-HTTP-CACHING-ALLOW-CACHE` header are cacheable if HTTP method is into `allowedMethod`
36
+ */
37
+ DISALLOW_ALL = "DISALLOW_ALL"
38
+ }
39
+ export declare enum NgHttpCachingHeaders {
40
+ /**
41
+ * Request is cacheable if HTTP method is into `allowedMethod`
42
+ */
43
+ ALLOW_CACHE = "X-NG-HTTP-CACHING-ALLOW-CACHE",
44
+ /**
45
+ * Request isn't cacheable
46
+ */
47
+ DISALLOW_CACHE = "X-NG-HTTP-CACHING-DISALLOW-CACHE",
48
+ /**
49
+ * Specific cache lifetime for the request
50
+ */
51
+ LIFETIME = "X-NG-HTTP-CACHING-LIFETIME",
52
+ /**
53
+ * You can tag multiple request by adding this header with the same tag and
54
+ * using `NgHttpCachingService.clearCacheByTag(tag: string)` for delete all the tagged request
55
+ */
56
+ TAG = "X-NG-HTTP-CACHING-TAG"
57
+ }
58
+ export declare const NgHttpCachingHeadersList: NgHttpCachingHeaders[];
59
+ export declare const NG_HTTP_CACHING_SECOND_IN_MS = 1000;
60
+ export declare const NG_HTTP_CACHING_MINUTE_IN_MS: number;
61
+ export declare const NG_HTTP_CACHING_HOUR_IN_MS: number;
62
+ export declare const NG_HTTP_CACHING_DAY_IN_MS: number;
63
+ export declare const NG_HTTP_CACHING_WEEK_IN_MS: number;
64
+ export declare const NG_HTTP_CACHING_MONTH_IN_MS: number;
65
+ export declare const NG_HTTP_CACHING_YEAR_IN_MS: number;
66
+ export interface NgHttpCachingConfig {
67
+ /**
68
+ * Set the cache store. You can implement your custom store by implement the `NgHttpCachingStorageInterface` interface, eg.:
69
+ */
70
+ store?: NgHttpCachingStorageInterface;
71
+ /**
72
+ * Number of millisecond that a response is stored in the cache.
73
+ * You can set specific "lifetime" for each request by add the header `X-NG-HTTP-CACHING-LIFETIME` (see example below).
74
+ */
75
+ lifetime?: number;
76
+ /**
77
+ * Array of allowed HTTP methods to cache.
78
+ * You can allow multiple methods, eg.: `['GET', 'POST', 'PUT', 'DELETE', 'HEAD']` or
79
+ * allow all methods by: `['ALL']`. If `allowedMethod` is an empty array (`[]`), no response are cached.
80
+ * *Warning!* `NgHttpCaching` use the full url (url with query parameters) as unique key for the cached response,
81
+ * this is correct for the `GET` request but is _potentially_ wrong for other type of request (eg. `POST`, `PUT`).
82
+ * You can set a different "key" by customizing the `getKey` config method (see `getKey` section).
83
+ */
84
+ allowedMethod?: string[];
85
+ /**
86
+ * Set the cache strategy, possible strategies are:
87
+ * - `NgHttpCachingStrategy.ALLOW_ALL`: All request are cacheable if HTTP method is into `allowedMethod`;
88
+ * - `NgHttpCachingStrategy.DISALLOW_ALL`: Only the request with `X-NG-HTTP-CACHING-ALLOW-CACHE` header are cacheable if HTTP method is into `allowedMethod`;
89
+ */
90
+ cacheStrategy?: NgHttpCachingStrategy;
91
+ /**
92
+ * Cache version. When you have a breaking change, change the version, and it'll delete the current cache automatically.
93
+ * The default value is Angular major version (eg. 13), in this way, the cache is invalitaded on every Angular upgrade.
94
+ */
95
+ version?: string;
96
+ /**
97
+ * If this function return `true` the request is expired and a new request is send to backend, if return `false` isn't expired.
98
+ * If the result is `undefined`, the normal behaviour is provided.
99
+ */
100
+ isExpired?: <K, T>(entry: NgHttpCachingEntry<K, T>) => boolean | undefined;
101
+ /**
102
+ * If this function return `true` the request is cacheable, if return `false` isn't cacheable.
103
+ * If the result is `undefined`, the normal behaviour is provided.
104
+ */
105
+ isCacheable?: <K>(req: HttpRequest<K>) => boolean | undefined;
106
+ /**
107
+ * This function return the unique key (`string`) for store the response into the cache.
108
+ * If the result is `undefined`, the normal behaviour is provided.
109
+ */
110
+ getKey?: <K>(req: HttpRequest<K>) => string | undefined;
111
+ /**
112
+ * If this function return `true` the cache entry is valid and can be strored, if return `false` isn't valid.
113
+ * If the result is `undefined`, the normal behaviour is provided.
114
+ */
115
+ isValid?: <K, T>(entry: NgHttpCachingEntry<K, T>) => boolean | undefined;
116
+ }
117
+ export interface NgHttpCachingDefaultConfig extends NgHttpCachingConfig {
118
+ store: NgHttpCachingStorageInterface;
119
+ lifetime: number;
120
+ allowedMethod: string[];
121
+ cacheStrategy: NgHttpCachingStrategy;
122
+ version: string;
123
+ }
124
+ export declare const NgHttpCachingConfigDefault: Readonly<NgHttpCachingDefaultConfig>;
125
+ export declare class NgHttpCachingService {
126
+ private readonly queue;
127
+ private readonly config;
128
+ private gcLock;
129
+ private devMode;
130
+ constructor(config: Readonly<NgHttpCachingConfig>);
131
+ /**
132
+ * Return the config
133
+ */
134
+ getConfig(): Readonly<NgHttpCachingConfig>;
135
+ /**
136
+ * Return the queue map
137
+ */
138
+ getQueue(): Readonly<Map<string, Observable<HttpEvent<any>>>>;
139
+ /**
140
+ * Return the cache store
141
+ */
142
+ getStore(): Readonly<NgHttpCachingStorageInterface>;
143
+ /**
144
+ * Return response from cache
145
+ */
146
+ getFromCache<K, T>(req: HttpRequest<K>): Readonly<HttpResponse<T>> | undefined;
147
+ /**
148
+ * Add response to cache
149
+ */
150
+ addToCache<K, T>(req: HttpRequest<K>, res: HttpResponse<T>): boolean;
151
+ /**
152
+ * Delete response from cache
153
+ */
154
+ deleteFromCache<K>(req: HttpRequest<K>): boolean;
155
+ /**
156
+ * Clear the cache
157
+ */
158
+ clearCache(): void;
159
+ /**
160
+ * Clear the cache by key
161
+ */
162
+ clearCacheByKey(key: string): boolean;
163
+ /**
164
+ * Clear the cache by regex
165
+ */
166
+ clearCacheByRegex<K, T>(regex: RegExp): void;
167
+ /**
168
+ * Clear the cache by TAG
169
+ */
170
+ clearCacheByTag<K, T>(tag: string): void;
171
+ /**
172
+ * Run garbage collector (delete expired cache entry)
173
+ */
174
+ runGc<K, T>(): boolean;
175
+ /**
176
+ * Return true if cache entry is expired
177
+ */
178
+ isExpired<K, T>(entry: NgHttpCachingEntry<K, T>): boolean;
179
+ /**
180
+ * Return true if cache entry is valid for store in the cache
181
+ */
182
+ isValid<K, T>(entry: NgHttpCachingEntry<K, T>): boolean;
183
+ /**
184
+ * Return true if the request is cacheable
185
+ */
186
+ isCacheable<K>(req: HttpRequest<K>): boolean;
187
+ /**
188
+ * Return the cache key.
189
+ * Default key is http method plus url with query parameters, eg.:
190
+ * `GET@https://github.com/nigrosimone/ng-http-caching`
191
+ */
192
+ getKey<K>(req: HttpRequest<K>): string;
193
+ /**
194
+ * Return observable from cache
195
+ */
196
+ getFromQueue<K, T>(req: HttpRequest<K>): Observable<HttpEvent<T>> | undefined;
197
+ /**
198
+ * Add observable to cache
199
+ */
200
+ addToQueue<K, T>(req: HttpRequest<K>, obs: Observable<HttpEvent<T>>): void;
201
+ /**
202
+ * Delete observable from cache
203
+ */
204
+ deleteFromQueue<K>(req: HttpRequest<K>): boolean;
205
+ /**
206
+ * Recursively Object.freeze simple Javascript structures consisting of plain objects, arrays, and primitives.
207
+ * Make the data immutable.
208
+ * @returns immutable object
209
+ */
210
+ private deepFreeze;
211
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgHttpCachingService, [{ optional: true; }]>;
212
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgHttpCachingService>;
213
+ }
@@ -1,18 +1,18 @@
1
- import { NgHttpCachingStorageInterface } from './ng-http-caching-storage.interface';
2
- import { NgHttpCachingEntry } from '../ng-http-caching.service';
3
- import { HttpRequest, HttpResponse } from '@angular/common/http';
4
- export declare const serializeRequest: (req: HttpRequest<any>) => string;
5
- export declare const serializeResponse: (res: HttpResponse<any>) => string;
6
- export declare const deserializeRequest: <T = any>(req: string) => HttpRequest<T>;
7
- export declare const deserializeResponse: <T = any>(res: string) => HttpResponse<T>;
8
- export declare class NgHttpCachingBrowserStorage implements NgHttpCachingStorageInterface {
9
- private storage;
10
- constructor(storage: Storage);
11
- get size(): number;
12
- clear(): void;
13
- delete(key: string): boolean;
14
- forEach(callbackfn: (value: NgHttpCachingEntry, key: string) => void): void;
15
- get(key: string): Readonly<NgHttpCachingEntry> | undefined;
16
- has(key: string): boolean;
17
- set(key: string, value: NgHttpCachingEntry): void;
18
- }
1
+ import { NgHttpCachingStorageInterface } from './ng-http-caching-storage.interface';
2
+ import { NgHttpCachingEntry } from '../ng-http-caching.service';
3
+ import { HttpRequest, HttpResponse } from '@angular/common/http';
4
+ export declare const serializeRequest: (req: HttpRequest<any>) => string;
5
+ export declare const serializeResponse: (res: HttpResponse<any>) => string;
6
+ export declare const deserializeRequest: <T = any>(req: string) => HttpRequest<T>;
7
+ export declare const deserializeResponse: <T = any>(res: string) => HttpResponse<T>;
8
+ export declare class NgHttpCachingBrowserStorage implements NgHttpCachingStorageInterface {
9
+ private storage;
10
+ constructor(storage: Storage);
11
+ get size(): number;
12
+ clear(): void;
13
+ delete(key: string): boolean;
14
+ forEach(callbackfn: (value: NgHttpCachingEntry, key: string) => void): void;
15
+ get(key: string): Readonly<NgHttpCachingEntry> | undefined;
16
+ has(key: string): boolean;
17
+ set(key: string, value: NgHttpCachingEntry): void;
18
+ }
@@ -1,4 +1,4 @@
1
- import { NgHttpCachingBrowserStorage } from './ng-http-caching-browser-storage';
2
- export declare class NgHttpCachingLocalStorage extends NgHttpCachingBrowserStorage {
3
- constructor();
4
- }
1
+ import { NgHttpCachingBrowserStorage } from './ng-http-caching-browser-storage';
2
+ export declare class NgHttpCachingLocalStorage extends NgHttpCachingBrowserStorage {
3
+ constructor();
4
+ }
@@ -1,12 +1,12 @@
1
- import { NgHttpCachingStorageInterface } from './ng-http-caching-storage.interface';
2
- import { NgHttpCachingEntry } from '../ng-http-caching.service';
3
- export declare class NgHttpCachingMemoryStorage implements NgHttpCachingStorageInterface {
4
- get size(): number;
5
- private store;
6
- clear(): void;
7
- delete(key: string): boolean;
8
- forEach<K, T>(callbackfn: (value: NgHttpCachingEntry<K, T>, key: string) => void): void;
9
- get<K, T>(key: string): Readonly<NgHttpCachingEntry<K, T>> | undefined;
10
- has(key: string): boolean;
11
- set<K, T>(key: string, value: NgHttpCachingEntry<K, T>): void;
12
- }
1
+ import { NgHttpCachingStorageInterface } from './ng-http-caching-storage.interface';
2
+ import { NgHttpCachingEntry } from '../ng-http-caching.service';
3
+ export declare class NgHttpCachingMemoryStorage implements NgHttpCachingStorageInterface {
4
+ get size(): number;
5
+ private store;
6
+ clear(): void;
7
+ delete(key: string): boolean;
8
+ forEach<K, T>(callbackfn: (value: NgHttpCachingEntry<K, T>, key: string) => void): void;
9
+ get<K, T>(key: string): Readonly<NgHttpCachingEntry<K, T>> | undefined;
10
+ has(key: string): boolean;
11
+ set<K, T>(key: string, value: NgHttpCachingEntry<K, T>): void;
12
+ }
@@ -1,4 +1,4 @@
1
- import { NgHttpCachingBrowserStorage } from './ng-http-caching-browser-storage';
2
- export declare class NgHttpCachingSessionStorage extends NgHttpCachingBrowserStorage {
3
- constructor();
4
- }
1
+ import { NgHttpCachingBrowserStorage } from './ng-http-caching-browser-storage';
2
+ export declare class NgHttpCachingSessionStorage extends NgHttpCachingBrowserStorage {
3
+ constructor();
4
+ }
@@ -1,31 +1,31 @@
1
- import { NgHttpCachingEntry } from '../ng-http-caching.service';
2
- export interface NgHttpCachingStorageInterface {
3
- /**
4
- * The number of cached entries.
5
- */
6
- readonly size: number;
7
- /**
8
- * Clear the cache.
9
- */
10
- clear(): void;
11
- /**
12
- * Delete the chache entry for the provided key.
13
- */
14
- delete(key: string): boolean;
15
- /**
16
- * The forEach() method executes a provided function once for each chache entry.
17
- */
18
- forEach<K = any, T = any>(callbackfn: (value: NgHttpCachingEntry<K, T>, key: string) => void): void;
19
- /**
20
- * Return the chache entry for the provided key.
21
- */
22
- get<K = any, T = any>(key: string): Readonly<NgHttpCachingEntry<K, T>> | undefined;
23
- /**
24
- * Return true if the cache entry exists the provided key.
25
- */
26
- has(key: string): boolean;
27
- /**
28
- * Set the chache entry for the provided key.
29
- */
30
- set<K = any, T = any>(key: string, value: NgHttpCachingEntry<K, T>): void;
31
- }
1
+ import { NgHttpCachingEntry } from '../ng-http-caching.service';
2
+ export interface NgHttpCachingStorageInterface {
3
+ /**
4
+ * The number of cached entries.
5
+ */
6
+ readonly size: number;
7
+ /**
8
+ * Clear the cache.
9
+ */
10
+ clear(): void;
11
+ /**
12
+ * Delete the chache entry for the provided key.
13
+ */
14
+ delete(key: string): boolean;
15
+ /**
16
+ * The forEach() method executes a provided function once for each chache entry.
17
+ */
18
+ forEach<K = any, T = any>(callbackfn: (value: NgHttpCachingEntry<K, T>, key: string) => void): void;
19
+ /**
20
+ * Return the chache entry for the provided key.
21
+ */
22
+ get<K = any, T = any>(key: string): Readonly<NgHttpCachingEntry<K, T>> | undefined;
23
+ /**
24
+ * Return true if the cache entry exists the provided key.
25
+ */
26
+ has(key: string): boolean;
27
+ /**
28
+ * Set the chache entry for the provided key.
29
+ */
30
+ set<K = any, T = any>(key: string, value: NgHttpCachingEntry<K, T>): void;
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-http-caching",
3
- "version": "15.2.4",
3
+ "version": "16.0.1",
4
4
  "description": "Cache for HTTP requests in Angular application.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,17 +26,13 @@
26
26
  },
27
27
  "homepage": "https://github.com/nigrosimone/ng-http-caching",
28
28
  "peerDependencies": {
29
- "@angular/common": "^15.0.0",
30
- "@angular/core": "^15.0.0"
29
+ "@angular/common": ">15.0.0",
30
+ "@angular/core": ">15.0.0"
31
31
  },
32
32
  "dependencies": {
33
33
  "tslib": "^2.3.0"
34
34
  },
35
- "module": "fesm2015/ng-http-caching.mjs",
36
- "es2020": "fesm2020/ng-http-caching.mjs",
37
- "esm2020": "esm2020/ng-http-caching.mjs",
38
- "fesm2020": "fesm2020/ng-http-caching.mjs",
39
- "fesm2015": "fesm2015/ng-http-caching.mjs",
35
+ "module": "fesm2022/ng-http-caching.mjs",
40
36
  "typings": "index.d.ts",
41
37
  "exports": {
42
38
  "./package.json": {
@@ -44,11 +40,9 @@
44
40
  },
45
41
  ".": {
46
42
  "types": "./index.d.ts",
47
- "esm2020": "./esm2020/ng-http-caching.mjs",
48
- "es2020": "./fesm2020/ng-http-caching.mjs",
49
- "es2015": "./fesm2015/ng-http-caching.mjs",
50
- "node": "./fesm2015/ng-http-caching.mjs",
51
- "default": "./fesm2020/ng-http-caching.mjs"
43
+ "esm2022": "./esm2022/ng-http-caching.mjs",
44
+ "esm": "./esm2022/ng-http-caching.mjs",
45
+ "default": "./fesm2022/ng-http-caching.mjs"
52
46
  }
53
47
  },
54
48
  "sideEffects": false
package/public-api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './lib/ng-http-caching-interceptor.service';
2
- export * from './lib/ng-http-caching.service';
3
- export * from './lib/ng-http-caching.module';
4
- export * from './lib/storage/ng-http-caching-storage.interface';
5
- export * from './lib/storage/ng-http-caching-memory-storage';
6
- export * from './lib/storage/ng-http-caching-local-storage';
7
- export * from './lib/storage/ng-http-caching-session-storage';
8
- export * from './lib/storage/ng-http-caching-browser-storage';
1
+ export * from './lib/ng-http-caching-interceptor.service';
2
+ export * from './lib/ng-http-caching.service';
3
+ export * from './lib/ng-http-caching.module';
4
+ export * from './lib/storage/ng-http-caching-storage.interface';
5
+ export * from './lib/storage/ng-http-caching-memory-storage';
6
+ export * from './lib/storage/ng-http-caching-local-storage';
7
+ export * from './lib/storage/ng-http-caching-session-storage';
8
+ export * from './lib/storage/ng-http-caching-browser-storage';