karin-plugin-mys-core 1.0.11 → 1.0.13

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 (156) hide show
  1. package/README.md +1 -1
  2. package/lib/apps/MiHoYoLogin.js +7 -38
  3. package/lib/apps/MysDevice.js +6 -37
  4. package/lib/apps/UIDManage.js +7 -38
  5. package/lib/{chunk-4BTKE3LO.js → chunk-567NAKP4.js} +300 -189
  6. package/lib/{chunk-BBJ4U2IY.js → chunk-A5FZEOIN.js} +75 -4
  7. package/lib/{chunk-AFLOM3CG.js → chunk-G564WWA7.js} +6 -10
  8. package/lib/chunk-HKSHKXRI.js +21 -0
  9. package/lib/chunk-IASM5MM5.js +639 -0
  10. package/lib/{chunk-5DXIT7UB.js → chunk-RX4VMVAI.js} +0 -5
  11. package/lib/chunk-UIPRZFST.js +184 -0
  12. package/lib/core/index.d.ts +20 -0
  13. package/lib/core/index.js +10 -0
  14. package/lib/exports/config/index.d.ts +56 -1
  15. package/lib/exports/config/index.js +3 -9
  16. package/lib/exports/database/index.d.ts +78 -12
  17. package/lib/exports/database/index.js +12 -40
  18. package/lib/exports/mys/index.d.ts +379 -14
  19. package/lib/exports/mys/index.js +10 -43
  20. package/lib/exports/render/index.d.ts +36 -3
  21. package/lib/exports/render/index.js +3 -8
  22. package/lib/exports/utils/index.d.ts +45 -2
  23. package/lib/exports/utils/index.js +1 -4
  24. package/lib/{exports/database/types/dbs/base.d.ts → mysUserInfo-BsyEENbc.d.ts} +60 -1
  25. package/package.json +6 -1
  26. package/resources/image/frame-logo.webp +0 -0
  27. package/resources/image/launcher-icon//345/216/237/347/245/236.webp +0 -0
  28. package/resources/image/launcher-icon//345/264/251/345/235/2173.webp +0 -0
  29. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.webp +0 -0
  30. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.webp +0 -0
  31. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.webp +0 -0
  32. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.webp +0 -0
  33. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.webp +0 -0
  34. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.webp +0 -0
  35. package/resources/image/mys-core-logo.webp +0 -0
  36. package/resources/image/mys-logo.webp +0 -0
  37. package/lib/chunk-2BVJS5VE.js +0 -49
  38. package/lib/chunk-3ERB3ILC.js +0 -0
  39. package/lib/chunk-3JN5WYUN.js +0 -135
  40. package/lib/chunk-7KEG6SDX.js +0 -0
  41. package/lib/chunk-7VAWV6ZE.js +0 -0
  42. package/lib/chunk-ARLTXJFJ.js +0 -0
  43. package/lib/chunk-CFS2WFOO.js +0 -0
  44. package/lib/chunk-DMJ5OQR6.js +0 -73
  45. package/lib/chunk-EDNBKOMS.js +0 -30
  46. package/lib/chunk-FBWSEBAW.js +0 -0
  47. package/lib/chunk-FOAQZIZ2.js +0 -0
  48. package/lib/chunk-G5W5WAY5.js +0 -64
  49. package/lib/chunk-G7TMVDGP.js +0 -68
  50. package/lib/chunk-HJ6HX5HB.js +0 -29
  51. package/lib/chunk-I7XZONDN.js +0 -13
  52. package/lib/chunk-JRH4JC43.js +0 -0
  53. package/lib/chunk-JVJQKRJ4.js +0 -89
  54. package/lib/chunk-K5U2O3HH.js +0 -0
  55. package/lib/chunk-KQVWWGRH.js +0 -31
  56. package/lib/chunk-LBLGKL3W.js +0 -77
  57. package/lib/chunk-LJSDSOY6.js +0 -0
  58. package/lib/chunk-LYTNREAI.js +0 -0
  59. package/lib/chunk-MPZP23EX.js +0 -219
  60. package/lib/chunk-MWYDWDR4.js +0 -0
  61. package/lib/chunk-PMFOX5HA.js +0 -80
  62. package/lib/chunk-PYTECG57.js +0 -0
  63. package/lib/chunk-SEWEEPJN.js +0 -0
  64. package/lib/chunk-SHW6FHIB.js +0 -10
  65. package/lib/chunk-T7W4DXRM.js +0 -0
  66. package/lib/chunk-TTN7NFCA.js +0 -109
  67. package/lib/chunk-W4DBT7AD.js +0 -0
  68. package/lib/chunk-WCX7WZAQ.js +0 -0
  69. package/lib/chunk-Z5I6A73Y.js +0 -0
  70. package/lib/chunk-ZTOR2DXG.js +0 -38
  71. package/lib/common-BlI5Gsw_.d.ts +0 -35
  72. package/lib/define-B9r20dK6.d.ts +0 -130
  73. package/lib/exports/config/array.d.ts +0 -1
  74. package/lib/exports/config/array.js +0 -7
  75. package/lib/exports/config/config.d.ts +0 -56
  76. package/lib/exports/config/config.js +0 -12
  77. package/lib/exports/database/database.d.ts +0 -30
  78. package/lib/exports/database/database.js +0 -22
  79. package/lib/exports/database/dbs/base.d.ts +0 -25
  80. package/lib/exports/database/dbs/base.js +0 -19
  81. package/lib/exports/database/dbs/index.d.ts +0 -4
  82. package/lib/exports/database/dbs/index.js +0 -29
  83. package/lib/exports/database/dbs/sqlite3.d.ts +0 -27
  84. package/lib/exports/database/dbs/sqlite3.js +0 -23
  85. package/lib/exports/database/dbs/table.d.ts +0 -20
  86. package/lib/exports/database/dbs/table.js +0 -25
  87. package/lib/exports/database/tables/index.d.ts +0 -9
  88. package/lib/exports/database/tables/index.js +0 -40
  89. package/lib/exports/database/tables/mysAccountInfo.d.ts +0 -9
  90. package/lib/exports/database/tables/mysAccountInfo.js +0 -27
  91. package/lib/exports/database/tables/mysDeviceInfo.d.ts +0 -9
  92. package/lib/exports/database/tables/mysDeviceInfo.js +0 -27
  93. package/lib/exports/database/tables/mysUserInfo.d.ts +0 -9
  94. package/lib/exports/database/tables/mysUserInfo.js +0 -27
  95. package/lib/exports/database/types/database.d.ts +0 -6
  96. package/lib/exports/database/types/database.js +0 -1
  97. package/lib/exports/database/types/dbs/base.js +0 -11
  98. package/lib/exports/database/types/dbs/index.d.ts +0 -2
  99. package/lib/exports/database/types/dbs/index.js +0 -12
  100. package/lib/exports/database/types/index.d.ts +0 -6
  101. package/lib/exports/database/types/index.js +0 -24
  102. package/lib/exports/database/types/tables/index.d.ts +0 -5
  103. package/lib/exports/database/types/tables/index.js +0 -13
  104. package/lib/exports/database/types/tables/mysAccountInfo.d.ts +0 -14
  105. package/lib/exports/database/types/tables/mysAccountInfo.js +0 -7
  106. package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +0 -19
  107. package/lib/exports/database/types/tables/mysDeviceInfo.js +0 -1
  108. package/lib/exports/database/types/tables/mysUserInfo.d.ts +0 -32
  109. package/lib/exports/database/types/tables/mysUserInfo.js +0 -7
  110. package/lib/exports/mys/api/apis.d.ts +0 -82
  111. package/lib/exports/mys/api/apis.js +0 -56
  112. package/lib/exports/mys/api/app.d.ts +0 -60
  113. package/lib/exports/mys/api/app.js +0 -32
  114. package/lib/exports/mys/api/define.d.ts +0 -6
  115. package/lib/exports/mys/api/define.js +0 -42
  116. package/lib/exports/mys/api/index.d.ts +0 -11
  117. package/lib/exports/mys/api/index.js +0 -63
  118. package/lib/exports/mys/types/api/define.d.ts +0 -6
  119. package/lib/exports/mys/types/api/define.js +0 -1
  120. package/lib/exports/mys/types/api/index.d.ts +0 -6
  121. package/lib/exports/mys/types/api/index.js +0 -2
  122. package/lib/exports/mys/types/index.d.ts +0 -12
  123. package/lib/exports/mys/types/index.js +0 -6
  124. package/lib/exports/mys/types/user/game.d.ts +0 -23
  125. package/lib/exports/mys/types/user/game.js +0 -1
  126. package/lib/exports/mys/types/user/index.d.ts +0 -12
  127. package/lib/exports/mys/types/user/index.js +0 -3
  128. package/lib/exports/mys/types/user/userInfo.d.ts +0 -43
  129. package/lib/exports/mys/types/user/userInfo.js +0 -1
  130. package/lib/exports/mys/user/deviceInfo.d.ts +0 -11
  131. package/lib/exports/mys/user/deviceInfo.js +0 -30
  132. package/lib/exports/mys/user/game.d.ts +0 -40
  133. package/lib/exports/mys/user/game.js +0 -9
  134. package/lib/exports/mys/user/index.d.ts +0 -14
  135. package/lib/exports/mys/user/index.js +0 -52
  136. package/lib/exports/mys/user/userInfo.d.ts +0 -53
  137. package/lib/exports/mys/user/userInfo.js +0 -44
  138. package/lib/exports/render/render.d.ts +0 -38
  139. package/lib/exports/render/render.js +0 -12
  140. package/lib/exports/utils/common.d.ts +0 -1
  141. package/lib/exports/utils/common.js +0 -15
  142. package/lib/exports/utils/types/common.d.ts +0 -11
  143. package/lib/exports/utils/types/common.js +0 -1
  144. package/lib/exports/utils/types/index.d.ts +0 -1
  145. package/lib/exports/utils/types/index.js +0 -2
  146. package/resources/image/frame-logo.png +0 -0
  147. package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
  148. package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
  149. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
  150. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.png +0 -0
  151. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.png +0 -0
  152. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
  153. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
  154. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
  155. package/resources/image/mys-core-logo.png +0 -0
  156. package/resources/image/mys-logo.png +0 -0
@@ -0,0 +1,184 @@
1
+ import {
2
+ common_exports
3
+ } from "./chunk-RX4VMVAI.js";
4
+
5
+ // src/exports/config/array.ts
6
+ import { logger } from "node-karin";
7
+ import lodash from "node-karin/lodash";
8
+ var EnhancedArray = class _EnhancedArray extends Array {
9
+ #keyPath;
10
+ #cfg;
11
+ constructor(cfg, items, path2) {
12
+ super();
13
+ Object.setPrototypeOf(this, _EnhancedArray.prototype);
14
+ if (Array.isArray(items)) {
15
+ this.push(...items);
16
+ }
17
+ this.#cfg = cfg;
18
+ this.#keyPath = path2;
19
+ }
20
+ /**
21
+ * @param element - string | number
22
+ * @returns
23
+ */
24
+ has(element) {
25
+ return new Set(this).has(element);
26
+ }
27
+ /**
28
+ * @param isEqual 是否不添加重复元素
29
+ * @param save 是否立即保存
30
+ */
31
+ add(element, isEqual, save) {
32
+ if (isEqual) {
33
+ const existingSet = new Set(this.map((item) => JSON.stringify(item)));
34
+ if (existingSet.has(JSON.stringify(element))) return this;
35
+ }
36
+ this.push(element);
37
+ this.#cfg.set(this.#keyPath, this.slice(), save);
38
+ return this;
39
+ }
40
+ /**
41
+ * @param isEqual 是否不添加重复元素
42
+ * @param save 是否立即保存
43
+ */
44
+ addSome(elements, isEqual, save) {
45
+ if (isEqual) {
46
+ const existingSet = new Set(this.map((item) => JSON.stringify(item)));
47
+ elements = elements.filter((element) => !existingSet.has(JSON.stringify(element)));
48
+ if (elements.length === 0) return this;
49
+ }
50
+ this.push(...elements);
51
+ this.#cfg.set(this.#keyPath, this.slice(), save);
52
+ return this;
53
+ }
54
+ /** @description 删除指定索引 */
55
+ pullAt(idx, save) {
56
+ if (idx < 0 || idx >= this.length) {
57
+ logger.error(`\u7D22\u5F15 ${idx} \u8D85\u51FA\u8303\u56F4 [0, ${this.length - 1}]`);
58
+ return this;
59
+ }
60
+ lodash.pullAt(this, idx);
61
+ this.#cfg.set(this.#keyPath, this.slice(), save);
62
+ return this;
63
+ }
64
+ /** @description 删除指定元素 */
65
+ pullAll(elements, save) {
66
+ lodash.pullAll(this, elements);
67
+ this.#cfg.set(this.#keyPath, this.slice(), save);
68
+ return this;
69
+ }
70
+ /** @description 使用条件函数删除元素 */
71
+ remove(predicate, save) {
72
+ lodash.remove(this, predicate);
73
+ this.#cfg.set(this.#keyPath, this.slice(), save);
74
+ return this;
75
+ }
76
+ clear() {
77
+ this.length = 0;
78
+ return this;
79
+ }
80
+ };
81
+
82
+ // src/exports/config/config.ts
83
+ import { existsSync, existToMkdirSync, logger as logger2, requireFileSync, watch, writeJsonSync } from "node-karin";
84
+ import lodash2 from "node-karin/lodash";
85
+ import path from "path";
86
+ var Config = class {
87
+ #cfgName;
88
+ /**
89
+ * @description 配置缓存
90
+ */
91
+ #ConfigCache = null;
92
+ /**
93
+ * @description 默认配置
94
+ */
95
+ #DefaultConfig;
96
+ #DefineConfig;
97
+ /**
98
+ * @description 配置保存路径
99
+ */
100
+ #ConfigPath;
101
+ /**
102
+ * @param name 插件名称:配置名称
103
+ */
104
+ constructor(name, ConfigDir, DefaultConfig, DefineConfig) {
105
+ this.#cfgName = name;
106
+ const splitName = name.split(":");
107
+ if (!splitName[1]) {
108
+ throw new Error("\u914D\u7F6E\u540D\u79F0\u683C\u5F0F\u9519\u8BEF\uFF0C\u5E94\u4E3A \u63D2\u4EF6\u540D\u79F0:\u914D\u7F6E\u540D\u79F0");
109
+ }
110
+ this.#ConfigPath = path.join(ConfigDir, `${splitName[1]}.json`);
111
+ this.#DefaultConfig = DefaultConfig;
112
+ this.#DefineConfig = DefineConfig;
113
+ existToMkdirSync(ConfigDir);
114
+ !existsSync(this.#ConfigPath) && writeJsonSync(this.#ConfigPath, DefaultConfig, true);
115
+ this.loadConfig();
116
+ }
117
+ loadConfig() {
118
+ const config = requireFileSync(this.#ConfigPath);
119
+ const mergedConfig = this.mergeWithDefaults(config, this.#DefaultConfig, this.#DefineConfig);
120
+ this.#ConfigCache = mergedConfig;
121
+ return mergedConfig;
122
+ }
123
+ mergeWithDefaults(userConfig, defaultConfig, DefineConfig) {
124
+ const filteredUserConfig = common_exports.filterData(userConfig, defaultConfig, DefineConfig);
125
+ const result = lodash2.merge({}, defaultConfig, filteredUserConfig);
126
+ if (!lodash2.isEqual(result, userConfig)) {
127
+ try {
128
+ writeJsonSync(this.#ConfigPath, result);
129
+ } catch (err) {
130
+ logger2.error(err);
131
+ }
132
+ }
133
+ return result;
134
+ }
135
+ /**
136
+ * @description 获取配置路径对应的默认配置
137
+ */
138
+ getDef(path2) {
139
+ const defConfig = JSON.parse(JSON.stringify(this.#DefaultConfig));
140
+ return lodash2.get(defConfig, path2);
141
+ }
142
+ get(path2, isArray = false, def) {
143
+ const conf = JSON.parse(JSON.stringify(this.#ConfigCache));
144
+ const result = path2 ? lodash2.get(conf, path2, def) : conf;
145
+ if (isArray) {
146
+ if (!Array.isArray(result)) {
147
+ logger2.error(`\u914D\u7F6E\u8DEF\u5F84 ${path2} \u4E0D\u662F\u6570\u7EC4\u7C7B\u578B`);
148
+ return new EnhancedArray(this, [], path2);
149
+ }
150
+ return new EnhancedArray(this, result, path2);
151
+ }
152
+ return result;
153
+ }
154
+ /**
155
+ * @param save 是否立即保存
156
+ */
157
+ set(path2, value, save) {
158
+ lodash2.set(this.#ConfigCache, path2, value);
159
+ save && this.save();
160
+ }
161
+ /**
162
+ * @description 立即保存配置
163
+ */
164
+ save() {
165
+ try {
166
+ logger2.debug(`[${this.#cfgName}] \u4FDD\u5B58\u914D\u7F6E`, this.#ConfigCache);
167
+ writeJsonSync(this.#ConfigPath, this.#ConfigCache);
168
+ } catch (err) {
169
+ logger2.error(err);
170
+ }
171
+ }
172
+ watch(fnc) {
173
+ watch(this.#ConfigPath, async (oldData, newData) => {
174
+ fnc && await fnc(this, oldData, newData);
175
+ this.loadConfig();
176
+ });
177
+ return this;
178
+ }
179
+ };
180
+
181
+ export {
182
+ EnhancedArray,
183
+ Config
184
+ };
@@ -0,0 +1,20 @@
1
+ import { Config } from '../exports/config/index.js';
2
+
3
+ interface DefaultCoreConfigType {
4
+ githubProxyUrl: string;
5
+ }
6
+ interface DefaultCoreConfigDefineType {
7
+ }
8
+
9
+ interface DeviceConfigType {
10
+ version: number;
11
+ name: string;
12
+ board: string;
13
+ model: string;
14
+ product: string;
15
+ fingerprint: string;
16
+ }
17
+
18
+ declare const DeviceCfg: Config<DeviceConfigType>;
19
+
20
+ export { type DefaultCoreConfigDefineType, type DefaultCoreConfigType, DeviceCfg, type DeviceConfigType };
@@ -0,0 +1,10 @@
1
+ import {
2
+ DeviceCfg
3
+ } from "../chunk-HKSHKXRI.js";
4
+ import "../chunk-SHLPPEAY.js";
5
+ import "../chunk-UIPRZFST.js";
6
+ import "../chunk-RX4VMVAI.js";
7
+ import "../chunk-MLKGABMK.js";
8
+ export {
9
+ DeviceCfg
10
+ };
@@ -1 +1,56 @@
1
- export { Config, E as EnhancedArray } from './config.js';
1
+ declare class Config<C extends Record<string, any>> {
2
+ #private;
3
+ /**
4
+ * @param name 插件名称:配置名称
5
+ */
6
+ constructor(name: `${string}:${string}`, ConfigDir: string, DefaultConfig: C, DefineConfig: Record<string, any>);
7
+ loadConfig(): C;
8
+ mergeWithDefaults(userConfig: C, defaultConfig: C, DefineConfig: Record<string, any>): C;
9
+ /**
10
+ * @description 获取配置路径对应的默认配置
11
+ */
12
+ getDef<T>(path: string): T;
13
+ /**
14
+ * @description 获取配置路径对应的配置
15
+ */
16
+ get<T>(path: string, isArray?: false, def?: T): T;
17
+ get<T>(path: string, isArray: true, def?: T[]): EnhancedArray<T>;
18
+ /**
19
+ * @param save 是否立即保存
20
+ */
21
+ set<T>(path: string, value: T, save: boolean): void;
22
+ /**
23
+ * @description 立即保存配置
24
+ */
25
+ save(): void;
26
+ watch(fnc?: (self: Config<C>, oldData: C, newData: C) => Promise<void> | void): this;
27
+ }
28
+
29
+ declare class EnhancedArray<T> extends Array<T> {
30
+ #private;
31
+ constructor(cfg: Config<any>, items: T[], path: string);
32
+ /**
33
+ * @param element - string | number
34
+ * @returns
35
+ */
36
+ has(element: T & (string | number)): boolean;
37
+ /**
38
+ * @param isEqual 是否不添加重复元素
39
+ * @param save 是否立即保存
40
+ */
41
+ add(element: T, isEqual: boolean, save: boolean): this;
42
+ /**
43
+ * @param isEqual 是否不添加重复元素
44
+ * @param save 是否立即保存
45
+ */
46
+ addSome(elements: T[], isEqual: boolean, save: boolean): this;
47
+ /** @description 删除指定索引 */
48
+ pullAt(idx: number, save: boolean): this;
49
+ /** @description 删除指定元素 */
50
+ pullAll(elements: T[], save: boolean): this;
51
+ /** @description 使用条件函数删除元素 */
52
+ remove(predicate: (item: T) => boolean, save: boolean): this;
53
+ clear(): this;
54
+ }
55
+
56
+ export { Config, EnhancedArray };
@@ -1,14 +1,8 @@
1
- import "../../chunk-3ERB3ILC.js";
2
- import {
3
- Config
4
- } from "../../chunk-TTN7NFCA.js";
5
- import "../../chunk-ARLTXJFJ.js";
6
- import "../../chunk-PYTECG57.js";
7
- import "../../chunk-T7W4DXRM.js";
8
- import "../../chunk-5DXIT7UB.js";
9
1
  import {
2
+ Config,
10
3
  EnhancedArray
11
- } from "../../chunk-PMFOX5HA.js";
4
+ } from "../../chunk-UIPRZFST.js";
5
+ import "../../chunk-RX4VMVAI.js";
12
6
  import "../../chunk-MLKGABMK.js";
13
7
  export {
14
8
  Config,
@@ -1,12 +1,78 @@
1
- export { Database } from './database.js';
2
- export { DbBase } from './dbs/base.js';
3
- export { Table, createTable } from './dbs/table.js';
4
- export { MysAccountInfoDB, MysAccountInfoTable } from './tables/mysAccountInfo.js';
5
- export { MysDeviceInfoDB, MysDeviceInfoTable } from './tables/mysDeviceInfo.js';
6
- export { MysUserInfoDB, MysUserInfoTable } from './tables/mysUserInfo.js';
7
- export { DatabaseFn } from './types/database.js';
8
- export { DatabaseArray, DatabaseClassInstance, DatabaseClassStatic, DatabaseReturn, DatabaseType, Dialect, ModelAttributes } from './types/dbs/base.js';
9
- export { MysAccountInfoTableType, MysAccountType } from './types/tables/mysAccountInfo.js';
10
- export { MysDeviceInfoDatabaseBaseType, MysDeviceInfoDatabaseIdFpType, MysDeviceInfoTableType } from './types/tables/mysDeviceInfo.js';
11
- export { BaseGameUIDInfoTableType, BaseUserInfoTableType, BindUidsItemType, UidPermission } from './types/tables/mysUserInfo.js';
12
- import 'sequelize';
1
+ import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, M as ModelAttributes, d as DatabaseReturn, e as MysAccountInfoTableType, f as MysDeviceInfoTableType, B as BaseUserInfoTableType, g as BaseGameUIDInfoTableType } from '../../mysUserInfo-BsyEENbc.js';
2
+ export { l as BindUidsItemType, h as DatabaseArray, i as MysAccountType, j as MysDeviceInfoDatabaseBaseType, k as MysDeviceInfoDatabaseIdFpType, U as UidPermission } from '../../mysUserInfo-BsyEENbc.js';
3
+ import { DataTypes, ModelAttributeColumnOptions, Model, ModelStatic } from 'sequelize';
4
+
5
+ type DatabaseFn = <T extends Record<string, any>, D extends DatabaseType>() => DatabaseClassInstance<T, D>;
6
+
7
+ declare const Database: {
8
+ "__#private@#defaultDialect": Dialect;
9
+ "__#private@#DatabaseMap": Map<Dialect, {
10
+ Database: DatabaseFn;
11
+ Static: DatabaseClassStatic;
12
+ }>;
13
+ default(dialect: Dialect): void;
14
+ /** @description 添加数据库 */
15
+ Add(Db: DatabaseFn, Static: DatabaseClassStatic): Promise<void>;
16
+ get Db(): {
17
+ Database: DatabaseFn;
18
+ Static: DatabaseClassStatic;
19
+ };
20
+ get details(): {
21
+ dialect: Dialect;
22
+ desc: string;
23
+ }[];
24
+ /** @description 获取当前使用的数据库 */
25
+ get<T extends Record<string, any>, D extends DatabaseType>(): DatabaseClassInstance<T, D>;
26
+ get PkColumn(): (type: keyof typeof DataTypes, option?: Partial<ModelAttributeColumnOptions<Model>>) => ModelAttributeColumnOptions<Model>;
27
+ get Column(): DatabaseClassStatic["Column"];
28
+ get ArrayColumn(): DatabaseClassStatic["ArrayColumn"];
29
+ get JsonColumn(): DatabaseClassStatic["JsonColumn"];
30
+ };
31
+
32
+ declare class DbBase<T extends Record<string, any>, D extends DatabaseType> {
33
+ primaryKey: keyof T | undefined;
34
+ model: ModelStatic<Model> | undefined;
35
+ databasePath: string;
36
+ databaseType: D;
37
+ modelName: string;
38
+ modelSchema: ModelAttributes<Model, T>;
39
+ modelSchemaDefine: Partial<Record<keyof T, any>>;
40
+ initBase(DataDir: string, modelName: string, modelSchema: ModelAttributes<Model, T>, modelSchemaDefine: Partial<Record<keyof T, any>>, type: D, primaryKey?: keyof T): void;
41
+ schemaToJSON(pk: string): T;
42
+ userPath(pk: string): string;
43
+ readSync(path: string, pk: string): DatabaseReturn<T>[DatabaseType.File];
44
+ readDirSync(pk: string): DatabaseReturn<T>[DatabaseType.Dir];
45
+ writeDirSync(pk: string, data: Record<string, any>): boolean;
46
+ saveFile(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.File]>;
47
+ saveDir(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.Dir]>;
48
+ destroyPath(pk: string): Promise<boolean>;
49
+ saveSql(model: Model<any, any>, pk: string): (data: Partial<T>) => Promise<DatabaseReturn<T>[DatabaseType.Db]>;
50
+ destroySql(pk: string): Promise<boolean>;
51
+ }
52
+
53
+ declare class Table<TableType extends Record<string, any>, ExtraTableType extends Record<string, any> = {}, DBType extends DatabaseType = DatabaseType> {
54
+ #private;
55
+ initCache: DatabaseClassInstance<TableType, DBType>;
56
+ modelSchema: ModelAttributes<Model, TableType>;
57
+ modelSchemaDefine: Partial<Record<keyof TableType, any>>;
58
+ /**
59
+ * @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
60
+ */
61
+ constructor(DataDir: string, tableName: string, type: DBType, primaryKey?: keyof TableType);
62
+ init(Schema: ModelAttributes<Model, TableType>, SchemaDefine?: Partial<Record<keyof TableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType, DBType>>>;
63
+ addSchem<newTableType extends ExtraTableType>(newSchema: ModelAttributes<Model, newTableType>, SchemaDefine?: Partial<Record<keyof newTableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType & newTableType, DBType>>>;
64
+ }
65
+ declare function createTable<TableType extends Record<string, any>, ExtraTableType extends Record<string, any> = {}>(DataDir: string, tableName: string, type: DatabaseType.File, primaryKey: keyof TableType): Table<TableType, ExtraTableType, DatabaseType.File>;
66
+ declare function createTable<TableType extends Record<string, any>, ExtraTableType extends Record<string, any> = {}>(DataDir: string, tableName: string, type: DatabaseType.Dir, primaryKey: keyof TableType): Table<TableType, ExtraTableType, DatabaseType.Dir>;
67
+ declare function createTable<TableType extends Record<string, any>, ExtraTableType extends Record<string, any> = {}>(DataDir: string, tableName: string, type: DatabaseType.Db, primaryKey?: keyof TableType): Table<TableType, ExtraTableType, DatabaseType.Db>;
68
+
69
+ declare const MysAccountInfoTable: Table<MysAccountInfoTableType, {}, DatabaseType.Db>;
70
+ declare const MysAccountInfoDB: () => Promise<DatabaseClassInstance<MysAccountInfoTableType, DatabaseType.Db>>;
71
+
72
+ declare const MysDeviceInfoTable: Table<MysDeviceInfoTableType, {}, DatabaseType.Db>;
73
+ declare const MysDeviceInfoDB: () => Promise<DatabaseClassInstance<MysDeviceInfoTableType, DatabaseType.Db>>;
74
+
75
+ declare const MysUserInfoTable: Table<BaseUserInfoTableType, BaseGameUIDInfoTableType<string>, DatabaseType.Db>;
76
+ declare const MysUserInfoDB: () => Promise<DatabaseClassInstance<BaseUserInfoTableType, DatabaseType.Db>>;
77
+
78
+ export { BaseGameUIDInfoTableType, BaseUserInfoTableType, Database, DatabaseClassInstance, DatabaseClassStatic, type DatabaseFn, DatabaseReturn, DatabaseType, DbBase, Dialect, ModelAttributes, MysAccountInfoDB, MysAccountInfoTable, MysAccountInfoTableType, MysDeviceInfoDB, MysDeviceInfoTable, MysDeviceInfoTableType, MysUserInfoDB, MysUserInfoTable, Table, createTable };
@@ -1,50 +1,22 @@
1
- import "../../chunk-W4DBT7AD.js";
2
- import "../../chunk-Z5I6A73Y.js";
3
1
  import {
2
+ Database,
3
+ DatabaseArray,
4
+ DatabaseType,
5
+ DbBase,
6
+ Dialect,
4
7
  MysAccountInfoDB,
5
- MysAccountInfoTable
6
- } from "../../chunk-EDNBKOMS.js";
7
- import {
8
+ MysAccountInfoTable,
9
+ MysAccountType,
8
10
  MysDeviceInfoDB,
9
- MysDeviceInfoTable
10
- } from "../../chunk-ZTOR2DXG.js";
11
- import {
11
+ MysDeviceInfoTable,
12
12
  MysUserInfoDB,
13
- MysUserInfoTable
14
- } from "../../chunk-HJ6HX5HB.js";
15
- import "../../chunk-SEWEEPJN.js";
16
- import {
13
+ MysUserInfoTable,
17
14
  Table,
15
+ UidPermission,
18
16
  createTable
19
- } from "../../chunk-G7TMVDGP.js";
20
- import {
21
- Database
22
- } from "../../chunk-DMJ5OQR6.js";
23
- import "../../chunk-MPZP23EX.js";
24
- import {
25
- DbBase
26
- } from "../../chunk-3JN5WYUN.js";
27
- import "../../chunk-7KEG6SDX.js";
28
- import "../../chunk-FBWSEBAW.js";
29
- import {
30
- DatabaseArray,
31
- DatabaseType,
32
- Dialect
33
- } from "../../chunk-JVJQKRJ4.js";
34
- import "../../chunk-LYTNREAI.js";
35
- import {
36
- MysAccountType
37
- } from "../../chunk-SHW6FHIB.js";
38
- import "../../chunk-K5U2O3HH.js";
39
- import {
40
- UidPermission
41
- } from "../../chunk-I7XZONDN.js";
42
- import "../../chunk-JRH4JC43.js";
17
+ } from "../../chunk-IASM5MM5.js";
43
18
  import "../../chunk-SHLPPEAY.js";
44
- import "../../chunk-ARLTXJFJ.js";
45
- import "../../chunk-PYTECG57.js";
46
- import "../../chunk-T7W4DXRM.js";
47
- import "../../chunk-5DXIT7UB.js";
19
+ import "../../chunk-RX4VMVAI.js";
48
20
  import "../../chunk-MLKGABMK.js";
49
21
  export {
50
22
  Database,