@pisell/pisellos 0.0.220 → 0.0.221

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 (190) hide show
  1. package/README.md +180 -180
  2. package/dist/core/index.js +4 -4
  3. package/dist/index.js +3 -3
  4. package/dist/modules/Account/types.js +6 -6
  5. package/dist/modules/AccountList/index.js +14 -14
  6. package/dist/modules/AccountList/types.js +14 -14
  7. package/dist/modules/AccountList/utils.js +5 -5
  8. package/dist/modules/Cart/index.js +35 -35
  9. package/dist/modules/Cart/types.js +14 -14
  10. package/dist/modules/Cart/utils/cartAccount.js +8 -8
  11. package/dist/modules/Cart/utils/cartDate.js +12 -12
  12. package/dist/modules/Cart/utils/cartDiscount.js +8 -8
  13. package/dist/modules/Cart/utils/cartNote.js +8 -8
  14. package/dist/modules/Cart/utils/cartProduct.js +39 -39
  15. package/dist/modules/Cart/utils/cartRelationForms.js +8 -8
  16. package/dist/modules/Cart/utils/cartResource.js +8 -8
  17. package/dist/modules/Cart/utils/index.js +4 -4
  18. package/dist/modules/Customer/index.js +67 -67
  19. package/dist/modules/Customer/types.js +18 -18
  20. package/dist/modules/Date/types.js +6 -6
  21. package/dist/modules/Date/utils.js +25 -25
  22. package/dist/modules/Guests/types.js +8 -8
  23. package/dist/modules/Order/types.js +4 -4
  24. package/dist/modules/Order/utils.js +8 -8
  25. package/dist/modules/Payment/cash.js +2 -2
  26. package/dist/modules/Payment/eftpos.js +2 -2
  27. package/dist/modules/Payment/index.js +135 -135
  28. package/dist/modules/Payment/types.js +50 -50
  29. package/dist/modules/Payment/wallet.js +2 -2
  30. package/dist/modules/Product/index.js +22 -22
  31. package/dist/modules/Product/utils.js +12 -12
  32. package/dist/modules/ProductList/index.js +4 -4
  33. package/dist/modules/Resource/types.js +8 -8
  34. package/dist/modules/Resource/utils.js +14 -14
  35. package/dist/modules/Schedule/index.js +4 -4
  36. package/dist/modules/Schedule/utils.js +73 -73
  37. package/dist/modules/Step/index.js +18 -18
  38. package/dist/modules/Summary/index.js +4 -4
  39. package/dist/modules/Summary/utils.js +15 -15
  40. package/dist/plugins/app-types/app/app.d.ts +83 -83
  41. package/dist/plugins/app-types/app/const.d.ts +4 -4
  42. package/dist/plugins/app-types/app/index.d.ts +14 -14
  43. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -50
  44. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -13
  45. package/dist/plugins/app-types/config.d.ts +3 -3
  46. package/dist/plugins/app-types/cookie/index.d.ts +13 -13
  47. package/dist/plugins/app-types/data/index.d.ts +8 -8
  48. package/dist/plugins/app-types/history/config.d.ts +24 -24
  49. package/dist/plugins/app-types/history/index.d.ts +20 -20
  50. package/dist/plugins/app-types/history/type.d.ts +2 -2
  51. package/dist/plugins/app-types/hooks/index.d.ts +12 -12
  52. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
  53. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
  54. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
  55. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -6
  56. package/dist/plugins/app-types/index.d.ts +6 -6
  57. package/dist/plugins/app-types/indexDB/index.d.ts +178 -178
  58. package/dist/plugins/app-types/locales/en.d.ts +3 -3
  59. package/dist/plugins/app-types/locales/index.d.ts +37 -37
  60. package/dist/plugins/app-types/locales/original.d.ts +3 -3
  61. package/dist/plugins/app-types/locales/type.d.ts +19 -19
  62. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -3
  63. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -3
  64. package/dist/plugins/app-types/logger/feishu.d.ts +11 -11
  65. package/dist/plugins/app-types/logger/index.d.ts +122 -122
  66. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -17
  67. package/dist/plugins/app-types/menuManager/index.d.ts +28 -28
  68. package/dist/plugins/app-types/models/global.d.ts +32 -32
  69. package/dist/plugins/app-types/models/index.d.ts +45 -45
  70. package/dist/plugins/app-types/models/type.d.ts +2 -2
  71. package/dist/plugins/app-types/package.json +14 -14
  72. package/dist/plugins/app-types/pubsub/example.d.ts +5 -5
  73. package/dist/plugins/app-types/pubsub/index.d.ts +63 -63
  74. package/dist/plugins/app-types/request/cache.d.ts +46 -46
  75. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -38
  76. package/dist/plugins/app-types/request/config.d.ts +3 -3
  77. package/dist/plugins/app-types/request/constants.d.ts +2 -2
  78. package/dist/plugins/app-types/request/index.d.ts +24 -24
  79. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -6
  80. package/dist/plugins/app-types/request/type.d.ts +41 -41
  81. package/dist/plugins/app-types/request/utils.d.ts +46 -46
  82. package/dist/plugins/app-types/routes/config.d.ts +7 -7
  83. package/dist/plugins/app-types/routes/index.d.ts +28 -28
  84. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
  85. package/dist/plugins/app-types/socket/components/index.d.ts +2 -2
  86. package/dist/plugins/app-types/socket/constants.d.ts +33 -33
  87. package/dist/plugins/app-types/socket/events.d.ts +31 -31
  88. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -66
  89. package/dist/plugins/app-types/socket/index.d.ts +61 -61
  90. package/dist/plugins/app-types/socket/monitor.d.ts +169 -169
  91. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -61
  92. package/dist/plugins/app-types/socket/socket.d.ts +129 -129
  93. package/dist/plugins/app-types/socket/types.d.ts +85 -85
  94. package/dist/plugins/app-types/storage/index.d.ts +17 -17
  95. package/dist/plugins/app-types/tasks/index.d.ts +77 -77
  96. package/dist/plugins/app-types/tasks/type.d.ts +62 -62
  97. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -5
  98. package/dist/plugins/app-types/type.d.ts +2 -2
  99. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
  100. package/dist/plugins/app-types/variables/config.d.ts +3 -3
  101. package/dist/plugins/app-types/variables/index.d.ts +6 -6
  102. package/dist/plugins/app-types/variables/type.d.ts +2 -2
  103. package/dist/plugins/app-types/website/index.d.ts +6 -6
  104. package/dist/plugins/request.js +33 -33
  105. package/dist/plugins/window.js +16 -16
  106. package/dist/solution/BookingByStep/index.js +126 -126
  107. package/dist/solution/BookingByStep/utils/capacity.js +30 -30
  108. package/dist/solution/BookingByStep/utils/products.js +4 -4
  109. package/dist/solution/BookingByStep/utils/resources.js +146 -146
  110. package/dist/solution/BookingByStep/utils/timeslots.js +20 -20
  111. package/dist/solution/BookingTicket/index.d.ts +1 -1
  112. package/dist/solution/BookingTicket/index.js +82 -86
  113. package/dist/solution/BookingTicket/types.js +8 -8
  114. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -6
  115. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -4
  116. package/dist/solution/BookingTicket/utils/scan/handleScan.js +20 -28
  117. package/dist/solution/BookingTicket/utils/scan/index.js +19 -19
  118. package/dist/solution/BookingTicket/utils/scan/scanCache.js +52 -52
  119. package/dist/solution/BuyTickets/types.js +4 -4
  120. package/dist/utils/task.js +11 -11
  121. package/dist/utils/watch.js +59 -59
  122. package/lib/plugins/app-types/app/app.d.ts +83 -83
  123. package/lib/plugins/app-types/app/const.d.ts +4 -4
  124. package/lib/plugins/app-types/app/index.d.ts +14 -14
  125. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -50
  126. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -13
  127. package/lib/plugins/app-types/config.d.ts +3 -3
  128. package/lib/plugins/app-types/cookie/index.d.ts +13 -13
  129. package/lib/plugins/app-types/data/index.d.ts +8 -8
  130. package/lib/plugins/app-types/history/config.d.ts +24 -24
  131. package/lib/plugins/app-types/history/index.d.ts +20 -20
  132. package/lib/plugins/app-types/history/type.d.ts +2 -2
  133. package/lib/plugins/app-types/hooks/index.d.ts +12 -12
  134. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
  135. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
  136. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
  137. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -6
  138. package/lib/plugins/app-types/index.d.ts +6 -6
  139. package/lib/plugins/app-types/indexDB/index.d.ts +178 -178
  140. package/lib/plugins/app-types/locales/en.d.ts +3 -3
  141. package/lib/plugins/app-types/locales/index.d.ts +37 -37
  142. package/lib/plugins/app-types/locales/original.d.ts +3 -3
  143. package/lib/plugins/app-types/locales/type.d.ts +19 -19
  144. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -3
  145. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -3
  146. package/lib/plugins/app-types/logger/feishu.d.ts +11 -11
  147. package/lib/plugins/app-types/logger/index.d.ts +122 -122
  148. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -17
  149. package/lib/plugins/app-types/menuManager/index.d.ts +28 -28
  150. package/lib/plugins/app-types/models/global.d.ts +32 -32
  151. package/lib/plugins/app-types/models/index.d.ts +45 -45
  152. package/lib/plugins/app-types/models/type.d.ts +2 -2
  153. package/lib/plugins/app-types/package.json +14 -14
  154. package/lib/plugins/app-types/pubsub/example.d.ts +5 -5
  155. package/lib/plugins/app-types/pubsub/index.d.ts +63 -63
  156. package/lib/plugins/app-types/request/cache.d.ts +46 -46
  157. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -38
  158. package/lib/plugins/app-types/request/config.d.ts +3 -3
  159. package/lib/plugins/app-types/request/constants.d.ts +2 -2
  160. package/lib/plugins/app-types/request/index.d.ts +24 -24
  161. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -6
  162. package/lib/plugins/app-types/request/type.d.ts +41 -41
  163. package/lib/plugins/app-types/request/utils.d.ts +46 -46
  164. package/lib/plugins/app-types/routes/config.d.ts +7 -7
  165. package/lib/plugins/app-types/routes/index.d.ts +28 -28
  166. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
  167. package/lib/plugins/app-types/socket/components/index.d.ts +2 -2
  168. package/lib/plugins/app-types/socket/constants.d.ts +33 -33
  169. package/lib/plugins/app-types/socket/events.d.ts +31 -31
  170. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -66
  171. package/lib/plugins/app-types/socket/index.d.ts +61 -61
  172. package/lib/plugins/app-types/socket/monitor.d.ts +169 -169
  173. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -61
  174. package/lib/plugins/app-types/socket/socket.d.ts +129 -129
  175. package/lib/plugins/app-types/socket/types.d.ts +85 -85
  176. package/lib/plugins/app-types/storage/index.d.ts +17 -17
  177. package/lib/plugins/app-types/tasks/index.d.ts +77 -77
  178. package/lib/plugins/app-types/tasks/type.d.ts +62 -62
  179. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -5
  180. package/lib/plugins/app-types/type.d.ts +2 -2
  181. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
  182. package/lib/plugins/app-types/variables/config.d.ts +3 -3
  183. package/lib/plugins/app-types/variables/index.d.ts +6 -6
  184. package/lib/plugins/app-types/variables/type.d.ts +2 -2
  185. package/lib/plugins/app-types/website/index.d.ts +6 -6
  186. package/lib/solution/BookingTicket/index.d.ts +1 -1
  187. package/lib/solution/BookingTicket/index.js +1 -2
  188. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -4
  189. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -14
  190. package/package.json +1 -1
@@ -1,178 +1,178 @@
1
- import App from "../app";
2
- /**
3
- * IndexDB 管理器模块
4
- *
5
- * 这个模块提供了对浏览器 IndexedDB 的简单封装,并在不支持 IndexedDB 的环境中
6
- * 自动降级使用 localStorage 作为备选存储方案。
7
- */
8
- /**
9
- * 数据库配置选项接口
10
- * @interface DBOptions
11
- * @property {string} dbName - 数据库名称
12
- * @property {number} version - 数据库版本号
13
- * @property {Array} stores - 存储对象配置数组
14
- * @property {string} stores[].name - 存储对象名称
15
- * @property {string} stores[].keyPath - 主键路径
16
- * @property {Array} [stores[].indexes] - 索引配置数组(可选)
17
- * @property {string} stores[].indexes[].name - 索引名称
18
- * @property {string} stores[].indexes[].keyPath - 索引键路径
19
- * @property {IDBIndexParameters} [stores[].indexes[].options] - 索引选项(可选)
20
- */
21
- export interface DBOptions {
22
- dbName: string;
23
- version: number;
24
- stores: {
25
- name: string;
26
- keyPath: string;
27
- indexes?: {
28
- name: string;
29
- keyPath: string;
30
- options?: IDBIndexParameters;
31
- }[];
32
- }[];
33
- }
34
- /**
35
- * IndexDB 管理器类
36
- * 提供对 IndexedDB 的简单封装,支持自动降级到 localStorage
37
- * @class IndexDBManager
38
- */
39
- declare class IndexDBManager {
40
- /**
41
- * 检查环境是否支持 IndexedDB
42
- * @returns {boolean} 是否支持 IndexedDB
43
- * @private
44
- */
45
- private static isSupported;
46
- private db;
47
- private dbName;
48
- private version;
49
- private stores;
50
- private useIndexDB;
51
- private app;
52
- /**
53
- * 创建 IndexDBManager 实例
54
- * @param {DBOptions} options - 数据库配置选项
55
- */
56
- constructor(app: App, options: DBOptions);
57
- /**
58
- * 初始化数据库连接
59
- * 如果环境不支持 IndexedDB,将自动使用 localStorage
60
- * @returns {Promise<boolean>} 连接是否成功
61
- */
62
- connect(): Promise<boolean>;
63
- /**
64
- * 生成用于 localStorage 的存储键
65
- * @param {string} storeName - 存储对象名称
66
- * @param {string|number} [key] - 可选的键值
67
- * @returns {string} 格式化的存储键
68
- * @private
69
- */
70
- private getStorageKey;
71
- /**
72
- * 添加数据到指定的存储对象
73
- * @param {string} storeName - 存储对象名称
74
- * @param {T} data - 要添加的数据
75
- * @returns {Promise<T>} 添加的数据
76
- * @template T
77
- */
78
- add<T>(storeName: string, data: T): Promise<T>;
79
- /**
80
- * 获取指定存储对象中的数据
81
- * @param {string} storeName - 存储对象名称
82
- * @param {string|number} key - 数据主键
83
- * @returns {Promise<T|null>} 获取的数据,不存在则返回 null
84
- * @template T
85
- */
86
- get<T>(storeName: string, key: string | number): Promise<T | null>;
87
- /**
88
- * 更新指定存储对象中的数据
89
- * @param {string} storeName - 存储对象名称
90
- * @param {T} data - 要更新的数据
91
- * @returns {Promise<T>} 更新后的数据
92
- * @template T
93
- */
94
- update<T>(storeName: string, data: T): Promise<T>;
95
- /**
96
- * 删除指定存储对象中的数据
97
- * @param {string} storeName - 存储对象名称
98
- * @param {string|number} key - 数据主键
99
- * @returns {Promise<boolean>} 删除是否成功
100
- */
101
- delete(storeName: string, key: string | number): Promise<boolean>;
102
- /**
103
- * 获取指定存储对象中的所有数据
104
- * @param {string} storeName - 存储对象名称
105
- * @returns {Promise<T[]>} 数据数组
106
- * @template T
107
- */
108
- getAll<T>(storeName: string): Promise<T[]>;
109
- /**
110
- * 清空指定存储对象中的所有数据
111
- * @param {string} storeName - 存储对象名称
112
- * @returns {Promise<boolean>} 清空是否成功
113
- */
114
- clear(storeName: string): Promise<boolean>;
115
- /**
116
- * 关闭数据库连接
117
- * 在不再需要使用数据库时调用,释放资源
118
- */
119
- close(): void;
120
- /**
121
- * 获取当前使用的存储方式
122
- * @returns {'indexDB'|'localStorage'} 当前使用的存储方式
123
- */
124
- getCurrentStorage(): 'indexDB' | 'localStorage';
125
- }
126
- /**
127
- * 使用示例:
128
- *
129
- * // 1. 创建数据库配置
130
- * const dbOptions: DBOptions = {
131
- * dbName: 'myApp',
132
- * version: 1,
133
- * stores: [
134
- * {
135
- * name: 'users',
136
- * keyPath: 'id',
137
- * indexes: [
138
- * { name: 'email', keyPath: 'email', options: { unique: true } }
139
- * ]
140
- * },
141
- * {
142
- * name: 'products',
143
- * keyPath: 'id'
144
- * }
145
- * ]
146
- * };
147
- *
148
- * // 2. 创建并连接数据库
149
- * const db = new IndexDBManager(dbOptions);
150
- * await db.connect();
151
- *
152
- * // 3. 添加数据
153
- * const user = { id: '1', name: '张三', email: 'zhangsan@example.com' };
154
- * await db.add('users', user);
155
- *
156
- * // 4. 获取数据
157
- * const retrievedUser = await db.get('users', '1');
158
- *
159
- * // 5. 更新数据
160
- * user.name = '张三 (已更新)';
161
- * await db.update('users', user);
162
- *
163
- * // 6. 获取所有数据
164
- * const allUsers = await db.getAll('users');
165
- *
166
- * // 7. 删除数据
167
- * await db.delete('users', '1');
168
- *
169
- * // 8. 清空存储对象
170
- * await db.clear('users');
171
- *
172
- * // 9. 关闭数据库连接
173
- * db.close();
174
- *
175
- * // 10. 检查当前使用的存储方式
176
- * const storageType = db.getCurrentStorage(); // 'indexDB' 或 'localStorage'
177
- */
178
- export default IndexDBManager;
1
+ import App from "../app";
2
+ /**
3
+ * IndexDB 管理器模块
4
+ *
5
+ * 这个模块提供了对浏览器 IndexedDB 的简单封装,并在不支持 IndexedDB 的环境中
6
+ * 自动降级使用 localStorage 作为备选存储方案。
7
+ */
8
+ /**
9
+ * 数据库配置选项接口
10
+ * @interface DBOptions
11
+ * @property {string} dbName - 数据库名称
12
+ * @property {number} version - 数据库版本号
13
+ * @property {Array} stores - 存储对象配置数组
14
+ * @property {string} stores[].name - 存储对象名称
15
+ * @property {string} stores[].keyPath - 主键路径
16
+ * @property {Array} [stores[].indexes] - 索引配置数组(可选)
17
+ * @property {string} stores[].indexes[].name - 索引名称
18
+ * @property {string} stores[].indexes[].keyPath - 索引键路径
19
+ * @property {IDBIndexParameters} [stores[].indexes[].options] - 索引选项(可选)
20
+ */
21
+ export interface DBOptions {
22
+ dbName: string;
23
+ version: number;
24
+ stores: {
25
+ name: string;
26
+ keyPath: string;
27
+ indexes?: {
28
+ name: string;
29
+ keyPath: string;
30
+ options?: IDBIndexParameters;
31
+ }[];
32
+ }[];
33
+ }
34
+ /**
35
+ * IndexDB 管理器类
36
+ * 提供对 IndexedDB 的简单封装,支持自动降级到 localStorage
37
+ * @class IndexDBManager
38
+ */
39
+ declare class IndexDBManager {
40
+ /**
41
+ * 检查环境是否支持 IndexedDB
42
+ * @returns {boolean} 是否支持 IndexedDB
43
+ * @private
44
+ */
45
+ private static isSupported;
46
+ private db;
47
+ private dbName;
48
+ private version;
49
+ private stores;
50
+ private useIndexDB;
51
+ private app;
52
+ /**
53
+ * 创建 IndexDBManager 实例
54
+ * @param {DBOptions} options - 数据库配置选项
55
+ */
56
+ constructor(app: App, options: DBOptions);
57
+ /**
58
+ * 初始化数据库连接
59
+ * 如果环境不支持 IndexedDB,将自动使用 localStorage
60
+ * @returns {Promise<boolean>} 连接是否成功
61
+ */
62
+ connect(): Promise<boolean>;
63
+ /**
64
+ * 生成用于 localStorage 的存储键
65
+ * @param {string} storeName - 存储对象名称
66
+ * @param {string|number} [key] - 可选的键值
67
+ * @returns {string} 格式化的存储键
68
+ * @private
69
+ */
70
+ private getStorageKey;
71
+ /**
72
+ * 添加数据到指定的存储对象
73
+ * @param {string} storeName - 存储对象名称
74
+ * @param {T} data - 要添加的数据
75
+ * @returns {Promise<T>} 添加的数据
76
+ * @template T
77
+ */
78
+ add<T>(storeName: string, data: T): Promise<T>;
79
+ /**
80
+ * 获取指定存储对象中的数据
81
+ * @param {string} storeName - 存储对象名称
82
+ * @param {string|number} key - 数据主键
83
+ * @returns {Promise<T|null>} 获取的数据,不存在则返回 null
84
+ * @template T
85
+ */
86
+ get<T>(storeName: string, key: string | number): Promise<T | null>;
87
+ /**
88
+ * 更新指定存储对象中的数据
89
+ * @param {string} storeName - 存储对象名称
90
+ * @param {T} data - 要更新的数据
91
+ * @returns {Promise<T>} 更新后的数据
92
+ * @template T
93
+ */
94
+ update<T>(storeName: string, data: T): Promise<T>;
95
+ /**
96
+ * 删除指定存储对象中的数据
97
+ * @param {string} storeName - 存储对象名称
98
+ * @param {string|number} key - 数据主键
99
+ * @returns {Promise<boolean>} 删除是否成功
100
+ */
101
+ delete(storeName: string, key: string | number): Promise<boolean>;
102
+ /**
103
+ * 获取指定存储对象中的所有数据
104
+ * @param {string} storeName - 存储对象名称
105
+ * @returns {Promise<T[]>} 数据数组
106
+ * @template T
107
+ */
108
+ getAll<T>(storeName: string): Promise<T[]>;
109
+ /**
110
+ * 清空指定存储对象中的所有数据
111
+ * @param {string} storeName - 存储对象名称
112
+ * @returns {Promise<boolean>} 清空是否成功
113
+ */
114
+ clear(storeName: string): Promise<boolean>;
115
+ /**
116
+ * 关闭数据库连接
117
+ * 在不再需要使用数据库时调用,释放资源
118
+ */
119
+ close(): void;
120
+ /**
121
+ * 获取当前使用的存储方式
122
+ * @returns {'indexDB'|'localStorage'} 当前使用的存储方式
123
+ */
124
+ getCurrentStorage(): 'indexDB' | 'localStorage';
125
+ }
126
+ /**
127
+ * 使用示例:
128
+ *
129
+ * // 1. 创建数据库配置
130
+ * const dbOptions: DBOptions = {
131
+ * dbName: 'myApp',
132
+ * version: 1,
133
+ * stores: [
134
+ * {
135
+ * name: 'users',
136
+ * keyPath: 'id',
137
+ * indexes: [
138
+ * { name: 'email', keyPath: 'email', options: { unique: true } }
139
+ * ]
140
+ * },
141
+ * {
142
+ * name: 'products',
143
+ * keyPath: 'id'
144
+ * }
145
+ * ]
146
+ * };
147
+ *
148
+ * // 2. 创建并连接数据库
149
+ * const db = new IndexDBManager(dbOptions);
150
+ * await db.connect();
151
+ *
152
+ * // 3. 添加数据
153
+ * const user = { id: '1', name: '张三', email: 'zhangsan@example.com' };
154
+ * await db.add('users', user);
155
+ *
156
+ * // 4. 获取数据
157
+ * const retrievedUser = await db.get('users', '1');
158
+ *
159
+ * // 5. 更新数据
160
+ * user.name = '张三 (已更新)';
161
+ * await db.update('users', user);
162
+ *
163
+ * // 6. 获取所有数据
164
+ * const allUsers = await db.getAll('users');
165
+ *
166
+ * // 7. 删除数据
167
+ * await db.delete('users', '1');
168
+ *
169
+ * // 8. 清空存储对象
170
+ * await db.clear('users');
171
+ *
172
+ * // 9. 关闭数据库连接
173
+ * db.close();
174
+ *
175
+ * // 10. 检查当前使用的存储方式
176
+ * const storageType = db.getCurrentStorage(); // 'indexDB' 或 'localStorage'
177
+ */
178
+ export default IndexDBManager;
@@ -1,3 +1,3 @@
1
- import { LibraryItem } from './type';
2
- declare const _default: LibraryItem;
3
- export default _default;
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -1,37 +1,37 @@
1
- import { Locale, LibraryItem, LoadLibraryByUrlParams } from "./type";
2
- import App from "../app";
3
- export interface LocalesOptions {
4
- locale?: Locale;
5
- library?: {
6
- [key in Locale]: LibraryItem;
7
- };
8
- }
9
- export declare class Locales {
10
- private app;
11
- locale: string;
12
- library: {
13
- [key in Locale]: LibraryItem;
14
- };
15
- constructor(app: App, options?: LocalesOptions);
16
- getLocale: () => string;
17
- getCurrentTexts: (locale?: Locale) => {
18
- [key: string]: string;
19
- };
20
- setLocale: (locale: Locale, reload?: boolean) => void;
21
- getText: (id: string, locale?: Locale) => string;
22
- isCN: () => boolean;
23
- loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{
24
- [x: string]: LibraryItem;
25
- }>;
26
- loadLibraryByItems(libraryList: LibraryItem[]): void;
27
- loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{
28
- [x: string]: LibraryItem;
29
- }>;
30
- translation: (text: string | {
31
- [key: Locale]: string;
32
- }, locale?: Locale) => string | number;
33
- getLibraryByData: (data: LibraryItem[]) => LibraryItem;
34
- createTextsByLibrary: (id: string, library?: { [key in Locale]: LibraryItem; }) => {
35
- [x: string]: string;
36
- };
37
- }
1
+ import { Locale, LibraryItem, LoadLibraryByUrlParams } from "./type";
2
+ import App from "../app";
3
+ export interface LocalesOptions {
4
+ locale?: Locale;
5
+ library?: {
6
+ [key in Locale]: LibraryItem;
7
+ };
8
+ }
9
+ export declare class Locales {
10
+ private app;
11
+ locale: string;
12
+ library: {
13
+ [key in Locale]: LibraryItem;
14
+ };
15
+ constructor(app: App, options?: LocalesOptions);
16
+ getLocale: () => string;
17
+ getCurrentTexts: (locale?: Locale) => {
18
+ [key: string]: string;
19
+ };
20
+ setLocale: (locale: Locale, reload?: boolean) => void;
21
+ getText: (id: string, locale?: Locale) => string;
22
+ isCN: () => boolean;
23
+ loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{
24
+ [x: string]: LibraryItem;
25
+ }>;
26
+ loadLibraryByItems(libraryList: LibraryItem[]): void;
27
+ loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{
28
+ [x: string]: LibraryItem;
29
+ }>;
30
+ translation: (text: string | {
31
+ [key: Locale]: string;
32
+ }, locale?: Locale) => string | number;
33
+ getLibraryByData: (data: LibraryItem[]) => LibraryItem;
34
+ createTextsByLibrary: (id: string, library?: { [key in Locale]: LibraryItem; }) => {
35
+ [x: string]: string;
36
+ };
37
+ }
@@ -1,3 +1,3 @@
1
- import { LibraryItem } from './type';
2
- declare const _default: LibraryItem;
3
- export default _default;
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -1,19 +1,19 @@
1
- export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
2
- export type MultiLanguage = {
3
- [key in Locale]: string;
4
- };
5
- export interface LibraryItem {
6
- locale: Locale;
7
- name: string;
8
- translations: {
9
- [key: string]: string;
10
- };
11
- [key: string]: any;
12
- }
13
- export interface LocaleConfig {
14
- locale: Locale;
15
- library: {
16
- [key in Locale]: LibraryItem;
17
- };
18
- }
19
- export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
1
+ export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
2
+ export type MultiLanguage = {
3
+ [key in Locale]: string;
4
+ };
5
+ export interface LibraryItem {
6
+ locale: Locale;
7
+ name: string;
8
+ translations: {
9
+ [key: string]: string;
10
+ };
11
+ [key: string]: any;
12
+ }
13
+ export interface LocaleConfig {
14
+ locale: Locale;
15
+ library: {
16
+ [key in Locale]: LibraryItem;
17
+ };
18
+ }
19
+ export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
@@ -1,3 +1,3 @@
1
- import { LibraryItem } from './type';
2
- declare const _default: LibraryItem;
3
- export default _default;
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -1,3 +1,3 @@
1
- import { LibraryItem } from './type';
2
- declare const _default: LibraryItem;
3
- export default _default;
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -1,11 +1,11 @@
1
- interface contentItem {
2
- key: string;
3
- value: string;
4
- }
5
- interface sendWebhookProps {
6
- title: string;
7
- content: contentItem[];
8
- webhook: string;
9
- }
10
- export declare const sendWarningLog: ({ title, content, webhook }: sendWebhookProps) => Promise<any>;
11
- export {};
1
+ interface contentItem {
2
+ key: string;
3
+ value: string;
4
+ }
5
+ interface sendWebhookProps {
6
+ title: string;
7
+ content: contentItem[];
8
+ webhook: string;
9
+ }
10
+ export declare const sendWarningLog: ({ title, content, webhook }: sendWebhookProps) => Promise<any>;
11
+ export {};