@rxap/ngx-memory 16.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +621 -0
- package/LICENSE.md +621 -0
- package/README.md +21 -0
- package/esm2022/index.mjs +13 -0
- package/esm2022/lib/decorators/local-storage.mjs +13 -0
- package/esm2022/lib/decorators/session-storage.mjs +13 -0
- package/esm2022/lib/decorators/web-storage.mjs +53 -0
- package/esm2022/lib/ephemeral-storage.service.mjs +16 -0
- package/esm2022/lib/local-storage.service.mjs +16 -0
- package/esm2022/lib/session-storage.service.mjs +16 -0
- package/esm2022/lib/storage-utility.mjs +110 -0
- package/esm2022/lib/storage.service.mjs +48 -0
- package/esm2022/rxap-ngx-memory.mjs +5 -0
- package/fesm2022/rxap-ngx-memory.mjs +277 -0
- package/fesm2022/rxap-ngx-memory.mjs.map +1 -0
- package/index.d.ts +8 -0
- package/lib/decorators/local-storage.d.ts +9 -0
- package/lib/decorators/session-storage.d.ts +9 -0
- package/lib/decorators/web-storage.d.ts +9 -0
- package/lib/ephemeral-storage.service.d.ts +7 -0
- package/lib/local-storage.service.d.ts +7 -0
- package/lib/session-storage.service.d.ts +7 -0
- package/lib/storage-utility.d.ts +33 -0
- package/lib/storage.service.d.ts +19 -0
- package/package.json +52 -0
- package/theme.css +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExpiredUnit } from '../storage-utility';
|
|
2
|
+
/**
|
|
3
|
+
* `localStorage` Decorator
|
|
4
|
+
*
|
|
5
|
+
* @param [key] Storage key
|
|
6
|
+
* @param [expiredAt=0] Expiration time, 0 means forever
|
|
7
|
+
* @param [expiredUnit='t'] Expiration time unit (default: custom [unit: ms])
|
|
8
|
+
*/
|
|
9
|
+
export declare function LocalStorage(key?: string, expiredAt?: number, expiredUnit?: ExpiredUnit): (target: any, propertyName: string) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExpiredUnit } from '../storage-utility';
|
|
2
|
+
/**
|
|
3
|
+
* `sessionStorage` Decorator
|
|
4
|
+
*
|
|
5
|
+
* @param [key] Storage key
|
|
6
|
+
* @param [expiredAt=0] Expiration time, 0 means forever
|
|
7
|
+
* @param [expiredUnit='t'] Expiration time unit (default: custom [unit: ms])
|
|
8
|
+
*/
|
|
9
|
+
export declare function SessionStorage(key?: string, expiredAt?: number, expiredUnit?: ExpiredUnit): (target: any, propertyName: string) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExpiredUnit } from '../storage-utility';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* @param storage
|
|
5
|
+
* @param key
|
|
6
|
+
* @param expiredAt
|
|
7
|
+
* @param expiredUnit
|
|
8
|
+
*/
|
|
9
|
+
export declare function WebStorage(storage: Storage | null, key?: string, expiredAt?: number, expiredUnit?: ExpiredUnit): (target: any, propertyName: string) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StorageService } from './storage.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class EphemeralStorageService extends StorageService {
|
|
4
|
+
constructor();
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EphemeralStorageService, never>;
|
|
6
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EphemeralStorageService>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StorageService } from './storage.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class LocalStorageService extends StorageService {
|
|
4
|
+
constructor();
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
|
|
6
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StorageService } from './storage.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SessionStorageService extends StorageService {
|
|
4
|
+
constructor();
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
|
|
6
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expiration time unit
|
|
3
|
+
* s: seconds
|
|
4
|
+
* m: minute
|
|
5
|
+
* h: hour
|
|
6
|
+
* d: day
|
|
7
|
+
* w: week
|
|
8
|
+
* y: year
|
|
9
|
+
* t: Custom (millisecond)
|
|
10
|
+
*/
|
|
11
|
+
export type ExpiredUnit = 's' | 'm' | 'h' | 'd' | 'w' | 'y' | 't';
|
|
12
|
+
/**
|
|
13
|
+
* Determining if an Angular application is rendered in the browser
|
|
14
|
+
* The Angular `PLATFORM_ID` identifier cannot be used directly by the `decorator`.
|
|
15
|
+
* The advantage of this is that it also works well when the server populates the Document itself.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isBrowser: boolean;
|
|
18
|
+
export declare function StorageGet(storage: Storage | null, key: string): unknown;
|
|
19
|
+
export declare function StorageHas(storage: Storage | null, key: string): boolean;
|
|
20
|
+
export declare function StorageSet(storage: Storage | null, key: string, value: any, expiredAt?: number, expiredUnit?: ExpiredUnit): void;
|
|
21
|
+
export declare function StorageRemove(storage: Storage | null, key: string): void;
|
|
22
|
+
export declare function StorageKey(storage: Storage | null, index: number): string | null;
|
|
23
|
+
export declare function getExpired(val: number, unit: ExpiredUnit): number;
|
|
24
|
+
export declare function stringify(value: any): string;
|
|
25
|
+
export declare class MockStorage implements Storage {
|
|
26
|
+
cache: Record<string, string>;
|
|
27
|
+
get length(): number;
|
|
28
|
+
getItem(key: string): string | null;
|
|
29
|
+
key(index: number): string | null;
|
|
30
|
+
removeItem(key: string): void;
|
|
31
|
+
setItem(key: string, value: string): void;
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExpiredUnit } from './storage-utility';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare abstract class StorageService {
|
|
4
|
+
private storage;
|
|
5
|
+
protected constructor(storage: Storage | null);
|
|
6
|
+
has(key: string): boolean;
|
|
7
|
+
get(key: string): any;
|
|
8
|
+
set(key: string, value: any, expiredAt?: number, expiredUnit?: ExpiredUnit): void;
|
|
9
|
+
/**
|
|
10
|
+
* Removes the specified key, e.g.:
|
|
11
|
+
* - `remove('key')` Remove `key` key
|
|
12
|
+
* - `remove(/BMap_\w+/)` Bulk delete all keys starting with BMap_
|
|
13
|
+
* @param key key name or regular expression
|
|
14
|
+
*/
|
|
15
|
+
remove(key: string | RegExp): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StorageService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StorageService>;
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "16.1.0-dev.0",
|
|
3
|
+
"name": "@rxap/ngx-memory",
|
|
4
|
+
"license": "GPL-3.0-or-later",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"tslib": "^2.3.0"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@angular/core": "^16.1.4"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Merzough Münker",
|
|
13
|
+
"email": "mmuenker@digitaix.com"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
17
|
+
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https:/gitlab.com/rxap/packages/packages/angular/memory",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"angular",
|
|
22
|
+
"angular-memory",
|
|
23
|
+
"ngx",
|
|
24
|
+
"packages",
|
|
25
|
+
"rxap"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"directory": "../../../dist/packages/angular/memory"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://gitlab.com/rxap/packages.git",
|
|
34
|
+
"directory": "packages/angular/memory"
|
|
35
|
+
},
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"gitHead": "7a4325374c1fae4c0b0064220d17e0052917370a",
|
|
38
|
+
"module": "fesm2022/rxap-ngx-memory.mjs",
|
|
39
|
+
"typings": "index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
"./package.json": {
|
|
42
|
+
"default": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./index.d.ts",
|
|
46
|
+
"esm2022": "./esm2022/rxap-ngx-memory.mjs",
|
|
47
|
+
"esm": "./esm2022/rxap-ngx-memory.mjs",
|
|
48
|
+
"default": "./fesm2022/rxap-ngx-memory.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./theme": "./theme.css"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/theme.css
ADDED
|
File without changes
|