@lytjs/plugin-storage 6.9.2 → 6.9.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/dist/index.d.cts +39 -0
- package/dist/index.d.ts +39 -0
- package/package.json +4 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as _lytjs_core from '@lytjs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @lytjs/plugin-storage - 类型定义
|
|
5
|
+
*/
|
|
6
|
+
type StorageType = 'local' | 'session';
|
|
7
|
+
interface StorageItem<T = unknown> {
|
|
8
|
+
/** 数据 */
|
|
9
|
+
value: T;
|
|
10
|
+
/** 过期时间戳 */
|
|
11
|
+
expires?: number;
|
|
12
|
+
}
|
|
13
|
+
interface StorageOptions {
|
|
14
|
+
/** 默认存储类型 */
|
|
15
|
+
defaultType?: StorageType;
|
|
16
|
+
/** 命名空间前缀 */
|
|
17
|
+
prefix?: string;
|
|
18
|
+
}
|
|
19
|
+
interface StorageInstance {
|
|
20
|
+
/** 设置值 */
|
|
21
|
+
set: <T>(key: string, value: T, expires?: number) => void;
|
|
22
|
+
/** 获取值 */
|
|
23
|
+
get: <T>(key: string, defaultValue?: T) => T | null;
|
|
24
|
+
/** 删除值 */
|
|
25
|
+
remove: (key: string) => void;
|
|
26
|
+
/** 清空所有值 */
|
|
27
|
+
clear: () => void;
|
|
28
|
+
/** 检查是否存在 */
|
|
29
|
+
has: (key: string) => boolean;
|
|
30
|
+
/** 获取所有 keys */
|
|
31
|
+
keys: () => string[];
|
|
32
|
+
/** 移除过期项 */
|
|
33
|
+
clearExpired: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function createStorage(options?: StorageOptions): StorageInstance;
|
|
37
|
+
declare const pluginStorage: _lytjs_core.PluginDefinition<unknown>;
|
|
38
|
+
|
|
39
|
+
export { type StorageInstance, type StorageItem, type StorageOptions, type StorageType, createStorage, pluginStorage as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as _lytjs_core from '@lytjs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @lytjs/plugin-storage - 类型定义
|
|
5
|
+
*/
|
|
6
|
+
type StorageType = 'local' | 'session';
|
|
7
|
+
interface StorageItem<T = unknown> {
|
|
8
|
+
/** 数据 */
|
|
9
|
+
value: T;
|
|
10
|
+
/** 过期时间戳 */
|
|
11
|
+
expires?: number;
|
|
12
|
+
}
|
|
13
|
+
interface StorageOptions {
|
|
14
|
+
/** 默认存储类型 */
|
|
15
|
+
defaultType?: StorageType;
|
|
16
|
+
/** 命名空间前缀 */
|
|
17
|
+
prefix?: string;
|
|
18
|
+
}
|
|
19
|
+
interface StorageInstance {
|
|
20
|
+
/** 设置值 */
|
|
21
|
+
set: <T>(key: string, value: T, expires?: number) => void;
|
|
22
|
+
/** 获取值 */
|
|
23
|
+
get: <T>(key: string, defaultValue?: T) => T | null;
|
|
24
|
+
/** 删除值 */
|
|
25
|
+
remove: (key: string) => void;
|
|
26
|
+
/** 清空所有值 */
|
|
27
|
+
clear: () => void;
|
|
28
|
+
/** 检查是否存在 */
|
|
29
|
+
has: (key: string) => boolean;
|
|
30
|
+
/** 获取所有 keys */
|
|
31
|
+
keys: () => string[];
|
|
32
|
+
/** 移除过期项 */
|
|
33
|
+
clearExpired: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function createStorage(options?: StorageOptions): StorageInstance;
|
|
37
|
+
declare const pluginStorage: _lytjs_core.PluginDefinition<unknown>;
|
|
38
|
+
|
|
39
|
+
export { type StorageInstance, type StorageItem, type StorageOptions, type StorageType, createStorage, pluginStorage as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytjs/plugin-storage",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.4",
|
|
4
4
|
"description": "LytJS official storage plugin with localStorage and sessionStorage support, plus JSON serialization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"clean": "rm -rf dist"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@lytjs/core": "
|
|
33
|
-
"@lytjs/reactivity": "
|
|
34
|
-
"@lytjs/common-is": "
|
|
32
|
+
"@lytjs/core": "^6.9.4",
|
|
33
|
+
"@lytjs/reactivity": "^6.9.4",
|
|
34
|
+
"@lytjs/common-is": "^6.9.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"tsup": "^8.0.0",
|