karin-plugin-mys-core 1.0.1 → 1.0.2

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 (168) hide show
  1. package/LICENSE +674 -0
  2. package/lib/apps/MiHoYoLogin.d.ts +3 -1
  3. package/lib/apps/MiHoYoLogin.js +177 -109
  4. package/lib/apps/MysDevice.d.ts +2 -2
  5. package/lib/apps/MysDevice.js +65 -23
  6. package/lib/apps/UIDManage.d.ts +10 -0
  7. package/lib/apps/UIDManage.js +52 -0
  8. package/lib/array-CZDr9qst.d.ts +62 -0
  9. package/lib/chunk-2DHTKQ34.js +0 -0
  10. package/lib/chunk-3BIQN6QA.js +27 -0
  11. package/lib/chunk-3CNBOOKY.js +31 -0
  12. package/lib/chunk-5NA7ZPDS.js +54 -0
  13. package/lib/chunk-6PIXUPZ6.js +82 -0
  14. package/lib/chunk-7KEG6SDX.js +0 -0
  15. package/lib/chunk-7SZX3RBZ.js +0 -0
  16. package/lib/chunk-7VAWV6ZE.js +0 -0
  17. package/lib/chunk-7WESXE4X.js +29 -0
  18. package/lib/chunk-7YZHHLS5.js +130 -0
  19. package/lib/chunk-ARLTXJFJ.js +0 -0
  20. package/lib/chunk-CFS2WFOO.js +0 -0
  21. package/lib/chunk-EMAUATE3.js +217 -0
  22. package/lib/chunk-FBWSEBAW.js +0 -0
  23. package/lib/chunk-FOAQZIZ2.js +0 -0
  24. package/lib/chunk-G547WVGV.js +73 -0
  25. package/lib/chunk-G5W5WAY5.js +64 -0
  26. package/lib/chunk-HVYNK5BN.js +45 -0
  27. package/lib/chunk-I7XZONDN.js +13 -0
  28. package/lib/chunk-IVZICDGW.js +19 -0
  29. package/lib/chunk-JBGXPVO2.js +179 -0
  30. package/lib/chunk-JRH4JC43.js +0 -0
  31. package/lib/chunk-JVJQKRJ4.js +89 -0
  32. package/lib/chunk-K5U2O3HH.js +0 -0
  33. package/lib/chunk-KN5SHBVI.js +30 -0
  34. package/lib/chunk-LG34FPBI.js +50 -0
  35. package/lib/chunk-LJSDSOY6.js +0 -0
  36. package/lib/chunk-LYTNREAI.js +0 -0
  37. package/lib/chunk-MWYDWDR4.js +0 -0
  38. package/lib/chunk-QMSYS77M.js +38 -0
  39. package/lib/chunk-SEWEEPJN.js +0 -0
  40. package/lib/{chunk-JML6VYXN.js → chunk-SHLPPEAY.js} +13 -17
  41. package/lib/chunk-SHW6FHIB.js +10 -0
  42. package/lib/chunk-W4DBT7AD.js +0 -0
  43. package/lib/chunk-X75DW4KI.js +510 -0
  44. package/lib/chunk-XQWTJIT4.js +0 -0
  45. package/lib/chunk-Y3J3J5B2.js +124 -0
  46. package/lib/chunk-Z5I6A73Y.js +0 -0
  47. package/lib/common-Dw5l6Uud.d.ts +33 -0
  48. package/lib/define-BWuQ7acM.d.ts +131 -0
  49. package/lib/dir.d.ts +11 -13
  50. package/lib/dir.js +1 -1
  51. package/lib/exports/config/array.d.ts +1 -0
  52. package/lib/exports/config/array.js +7 -0
  53. package/lib/exports/config/config.d.ts +1 -0
  54. package/lib/exports/config/config.js +8 -0
  55. package/lib/exports/config/index.d.ts +2 -0
  56. package/lib/exports/config/index.js +14 -0
  57. package/lib/exports/config/types/config.d.ts +12 -0
  58. package/lib/exports/config/types/config.js +1 -0
  59. package/lib/exports/config/types/index.d.ts +1 -0
  60. package/lib/exports/config/types/index.js +2 -0
  61. package/lib/exports/database/database.d.ts +30 -0
  62. package/lib/exports/database/database.js +18 -0
  63. package/lib/exports/database/dbs/base.d.ts +23 -0
  64. package/lib/exports/database/dbs/base.js +15 -0
  65. package/lib/exports/database/dbs/index.d.ts +4 -0
  66. package/lib/exports/database/dbs/index.js +23 -0
  67. package/lib/exports/database/dbs/sqlite3.d.ts +23 -0
  68. package/lib/exports/database/dbs/sqlite3.js +19 -0
  69. package/lib/exports/database/dbs/table.d.ts +13 -0
  70. package/lib/exports/database/dbs/table.js +19 -0
  71. package/lib/exports/database/index.d.ts +12 -0
  72. package/lib/exports/database/index.js +62 -0
  73. package/lib/exports/database/tables/index.d.ts +9 -0
  74. package/lib/exports/database/tables/index.js +39 -0
  75. package/lib/exports/database/tables/mysAccountInfo.d.ts +9 -0
  76. package/lib/exports/database/tables/mysAccountInfo.js +23 -0
  77. package/lib/exports/database/tables/mysDeviceInfo.d.ts +9 -0
  78. package/lib/exports/database/tables/mysDeviceInfo.js +26 -0
  79. package/lib/exports/database/tables/mysUserInfo.d.ts +9 -0
  80. package/lib/exports/database/tables/mysUserInfo.js +23 -0
  81. package/lib/exports/database/types/database.d.ts +6 -0
  82. package/lib/exports/database/types/database.js +1 -0
  83. package/lib/exports/database/types/dbs/base.d.ts +114 -0
  84. package/lib/exports/database/types/dbs/base.js +11 -0
  85. package/lib/exports/database/types/dbs/index.d.ts +2 -0
  86. package/lib/exports/database/types/dbs/index.js +12 -0
  87. package/lib/exports/database/types/index.d.ts +6 -0
  88. package/lib/exports/database/types/index.js +24 -0
  89. package/lib/exports/database/types/tables/index.d.ts +5 -0
  90. package/lib/exports/database/types/tables/index.js +13 -0
  91. package/lib/exports/database/types/tables/mysAccountInfo.d.ts +14 -0
  92. package/lib/exports/database/types/tables/mysAccountInfo.js +7 -0
  93. package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +19 -0
  94. package/lib/exports/database/types/tables/mysDeviceInfo.js +1 -0
  95. package/lib/exports/database/types/tables/mysUserInfo.d.ts +31 -0
  96. package/lib/exports/database/types/tables/mysUserInfo.js +7 -0
  97. package/lib/exports/mys/api/apis.d.ts +82 -0
  98. package/lib/exports/mys/api/apis.js +57 -0
  99. package/lib/exports/mys/api/app.d.ts +60 -0
  100. package/lib/exports/mys/api/app.js +31 -0
  101. package/lib/exports/mys/api/define.d.ts +6 -0
  102. package/lib/exports/mys/api/define.js +43 -0
  103. package/lib/exports/mys/api/index.d.ts +11 -0
  104. package/lib/exports/mys/api/index.js +64 -0
  105. package/lib/exports/mys/index.d.ts +13 -0
  106. package/lib/exports/mys/index.js +77 -0
  107. package/lib/exports/mys/types/api/define.d.ts +6 -0
  108. package/lib/exports/mys/types/api/define.js +1 -0
  109. package/lib/exports/mys/types/api/index.d.ts +6 -0
  110. package/lib/exports/mys/types/api/index.js +2 -0
  111. package/lib/exports/mys/types/index.d.ts +10 -0
  112. package/lib/exports/mys/types/index.js +12 -0
  113. package/lib/exports/mys/types/user/game.d.ts +10 -0
  114. package/lib/exports/mys/types/user/game.js +1 -0
  115. package/lib/exports/mys/types/user/index.d.ts +10 -0
  116. package/lib/exports/mys/types/user/index.js +9 -0
  117. package/lib/exports/mys/types/user/userInfo.d.ts +10 -0
  118. package/lib/exports/mys/types/user/userInfo.js +7 -0
  119. package/lib/exports/mys/user/deviceInfo.d.ts +11 -0
  120. package/lib/exports/mys/user/deviceInfo.js +29 -0
  121. package/lib/exports/mys/user/game.d.ts +20 -0
  122. package/lib/exports/mys/user/game.js +7 -0
  123. package/lib/exports/mys/user/index.d.ts +12 -0
  124. package/lib/exports/mys/user/index.js +51 -0
  125. package/lib/exports/mys/user/userInfo.d.ts +10 -0
  126. package/lib/exports/mys/user/userInfo.js +45 -0
  127. package/lib/exports/utils/common.d.ts +1 -0
  128. package/lib/exports/utils/common.js +13 -0
  129. package/lib/exports/utils/index.d.ts +2 -0
  130. package/lib/exports/utils/index.js +12 -0
  131. package/lib/exports/utils/render.d.ts +21 -0
  132. package/lib/exports/utils/render.js +7 -0
  133. package/lib/index-DEEWbZ0V.d.ts +102 -0
  134. package/lib/index.js +1 -1
  135. package/package.json +29 -15
  136. package/resources/fonts/HYWenHei-55W.ttf +0 -0
  137. package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
  138. package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
  139. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
  140. 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
  141. 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
  142. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
  143. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
  144. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
  145. package/resources/image/mys-logo.png +0 -0
  146. package/resources/template/ShowBindAccount/index.css +1 -0
  147. package/resources/template/ShowBindAccount/index.html +65 -0
  148. package/resources/template/ShowBindDevice/index.html +20 -0
  149. package/resources/template/ShowBindDevice/inex.css +1 -0
  150. package/resources/template/layout/default.css +1 -0
  151. package/resources/template/layout/default.html +27 -0
  152. package/lib/app.d.ts +0 -2
  153. package/lib/base-BJv9XnQP.d.ts +0 -120
  154. package/lib/chunk-CQNW7LJI.js +0 -38
  155. package/lib/chunk-MV2UE7C7.js +0 -410
  156. package/lib/chunk-NHUNEZXM.js +0 -371
  157. package/lib/chunk-WYRIRWT5.js +0 -213
  158. package/lib/database-byVXw91u.d.ts +0 -5
  159. package/lib/define-pa_pWNWT.d.ts +0 -182
  160. package/lib/exports/core.d.ts +0 -249
  161. package/lib/exports/core.js +0 -45
  162. package/lib/exports/database.d.ts +0 -48
  163. package/lib/exports/database.js +0 -20
  164. package/lib/exports/types.d.ts +0 -5
  165. package/lib/exports/types.js +0 -13
  166. package/lib/index.d.ts +0 -2
  167. package/lib/web.config.d.ts +0 -5
  168. package/lib/web.config.js +0 -55
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-mys-core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "babanbang",
5
5
  "type": "module",
6
6
  "description": "karin-plugin-mys-core",
@@ -19,20 +19,25 @@
19
19
  "pub": "npm publish --access public"
20
20
  },
21
21
  "exports": {
22
- "./types": {
23
- "types": "./lib/exports/types.d.ts",
24
- "development": "./src/exports/types.ts",
25
- "default": "./lib/exports/types.js"
22
+ "./config": {
23
+ "types": "./lib/exports/config/index.d.ts",
24
+ "development": "./src/exports/config/index.ts",
25
+ "default": "./lib/exports/config/index.js"
26
26
  },
27
27
  "./database": {
28
- "types": "./lib/exports/database.d.ts",
29
- "development": "./src/exports/database.ts",
30
- "default": "./lib/exports/database.js"
28
+ "types": "./lib/exports/database/index.d.ts",
29
+ "development": "./src/exports/database/index.ts",
30
+ "default": "./lib/exports/database/index.js"
31
31
  },
32
- "./core": {
33
- "types": "./lib/exports/core.d.ts",
34
- "development": "./src/exports/core.ts",
35
- "default": "./lib/exports/core.js"
32
+ "./mys": {
33
+ "types": "./lib/exports/mys/index.d.ts",
34
+ "development": "./src/exports/mys/index.ts",
35
+ "default": "./lib/exports/mys/index.js"
36
+ },
37
+ "./utils": {
38
+ "types": "./lib/exports/utils/index.d.ts",
39
+ "development": "./src/exports/utils/index.ts",
40
+ "default": "./lib/exports/utils/index.js"
36
41
  }
37
42
  },
38
43
  "main": "lib/index.js",
@@ -51,16 +56,25 @@
51
56
  ],
52
57
  "web": "./lib/web.config.js",
53
58
  "ts-web": "./src/web.config.ts",
54
- "static": [],
59
+ "static": [
60
+ "resources"
61
+ ],
55
62
  "files": [
56
63
  "config",
57
- "data"
64
+ "data",
65
+ "resources"
58
66
  ]
59
67
  },
60
68
  "files": [
69
+ "LICENSE",
61
70
  "/lib/**/*.js",
62
71
  "/lib/**/*.d.ts",
63
- "!lib/app.js"
72
+ "resources",
73
+ "!resources/**/*.css.map",
74
+ "!resources/**/*.scss",
75
+ "!lib/app.js",
76
+ "!lib/app.d.ts",
77
+ "!lib/index.d.ts"
64
78
  ],
65
79
  "publishConfig": {
66
80
  "access": "public",
Binary file
Binary file
@@ -0,0 +1 @@
1
+ #container.container{background-color:#f6f0e6;padding:20px 18px 36px 18px}#container.container .mys-logo-bg{position:absolute;top:-10px;right:0;width:150px;height:72px;background-image:url("../../image/mys-logo.png");background-size:contain;background-repeat:no-repeat;background-position:center;opacity:.5;z-index:5}#container.container .no-accounts{text-align:center;color:#6b6b6b;padding:20px;margin:12px 0;font-weight:600}#container.container .user{display:flex;align-items:center;gap:10px;margin-bottom:12px}#container.container .user .avatar{width:40px;height:40px;border-radius:50%;-o-object-fit:cover;object-fit:cover;flex:0 0 auto}#container.container .user .nickname{color:#222;font-size:14px;min-width:0;white-space:normal;overflow-wrap:anywhere;word-break:break-word}#container.container .bind-account{display:flex;flex-direction:column;gap:6px;background:#fff;border:1px solid rgba(0,0,0,.06);padding:12px;margin-bottom:12px;border-radius:8px;box-shadow:0 2px 6px rgba(0,0,0,.04)}#container.container .bind-account .title{position:relative;display:flex;align-items:center;justify-content:space-between;gap:8px}#container.container .bind-account .title .ltuid{display:flex;color:#3f7dd1;font-size:14px;font-weight:600}#container.container .bind-account .title .perm{display:flex;gap:8px;align-items:center}#container.container .bind-account .title .perm .cookie,#container.container .bind-account .title .perm .stoken{display:inline-block;padding:4px 8px;font-size:12px;border-radius:12px;color:#fff;font-weight:600}#container.container .bind-account .title .perm .cookie{background:linear-gradient(180deg, rgb(52.5469767442, 193.0530232558, 85.6744186047), #2ea94b);box-shadow:0 1px 0 rgba(0,0,0,.06) inset}#container.container .bind-account .title .perm .stoken{background:linear-gradient(180deg, #f6d86a, #f1c40f);color:rgba(0,0,0,.85)}#container.container .bind-account .bind-uid{display:flex;align-items:center;gap:12px;padding:6px 4px;border-radius:6px}#container.container .bind-account .bind-uid .game{border-radius:10px;width:40px;display:flex;align-items:center;justify-content:center}#container.container .bind-account .bind-uid .uids{flex:1 1 auto;display:grid;grid-template-columns:repeat(3, minmax(0, 1fr));gap:8px}#container.container .bind-account .bind-uid .uids .uid-item{display:flex;align-items:center;justify-content:center;padding:6px 8px;border-radius:8px;background:rgba(0,0,0,.06);color:#111;font-weight:600;font-size:13px;position:relative;overflow:visible;word-break:break-all}#container.container .bind-account .bind-uid .uids .uid-item[class~="4"]{color:rgba(0,0,0,.6)}#container.container .bind-account .bind-uid .uids .uid-item[class~="4"]::after{content:"";position:absolute;left:8%;right:8%;top:50%;height:1px;background:#d32f2f;transform:translateY(-50%);border-radius:2px}#container.container .bind-account .bind-uid+.bind-uid{padding-top:8px;position:relative}#container.container .bind-account .bind-uid+.bind-uid::before{content:"";position:absolute;width:90%;left:5%;right:0;top:0;height:1px;background:#3f7dd1;border-radius:1px}/*# sourceMappingURL=index.css.map */
@@ -0,0 +1,65 @@
1
+ <!-- default layout -->
2
+ {{extend plugin.defaultLayout}}
3
+
4
+ <!-- 页面样式资源 -->
5
+ {{block 'css'}}
6
+ <link rel="stylesheet" type="text/css" href="{{plugin.resources.default}}/template/{{plugin.template}}/index.css" />
7
+
8
+ {{/block}}
9
+
10
+ <!-- 页面布局内容 -->
11
+ {{block 'container'}}
12
+ <!-- 右上角装饰 logo -->
13
+ <div class="mys-logo-bg"></div>
14
+
15
+ <div class="user">
16
+ <img class="avatar" src="{{User.avatar}}" />
17
+ <span class="nickname">{{@User.nickname}} ({{User.userId}})</span>
18
+ </div>
19
+
20
+ {{if AccountList && AccountList.length > 0}}
21
+ {{each AccountList account idx}}
22
+ <div class="bind-account">
23
+
24
+ <div class="title">
25
+ <span class="ltuid">MYS UID ({{idx + 1}}):{{account.ltuid}}</span>
26
+
27
+ <div class="perm">
28
+ {{if account.permission >= 1}}
29
+ <span class="cookie">cookie</span>
30
+ {{/if}}
31
+
32
+ {{if account.permission >= 2}}
33
+ <span class="stoken">stoken</span>
34
+ {{/if}}
35
+ </div>
36
+
37
+ </div>
38
+
39
+ {{each account.bindUids bindUid}}
40
+ <div class="bind-uid">
41
+ <img class="game" src="{{plugin.resources.default}}/image/launcher-icon/{{bindUid.gameName}}.png" />
42
+
43
+ <div class="uids">
44
+ {{each bindUid.uids info}}
45
+ <span class="uid-item {{info.perm}}">{{info.uid}}</span>
46
+ {{/each}}
47
+ </div>
48
+
49
+ </div>
50
+ {{/each}}
51
+
52
+ </div>
53
+ {{/each}}
54
+ {{else}}
55
+ <div class="no-accounts">暂未绑定账号</div>
56
+ {{/if}}
57
+
58
+ {{/block}}
59
+
60
+ <!-- 页面脚本资源 -->
61
+ {{block 'script'}}
62
+ <script>
63
+
64
+ </script>
65
+ {{/block}}
@@ -0,0 +1,20 @@
1
+ <!-- default layout -->
2
+ {{extend plugin.defaultLayout}}
3
+
4
+ <!-- 页面样式资源 -->
5
+ {{block 'css'}}
6
+ <link rel="stylesheet" type="text/css" href="{{plugin.resources.default}}/template/{{plugin.template}}/index.css" />
7
+
8
+ {{/block}}
9
+
10
+ <!-- 页面布局内容 -->
11
+ {{block 'container'}}
12
+
13
+ {{/block}}
14
+
15
+ <!-- 页面脚本资源 -->
16
+ {{block 'script'}}
17
+ <script>
18
+
19
+ </script>
20
+ {{/block}}
@@ -0,0 +1 @@
1
+ /*# sourceMappingURL=inex.css.map */
@@ -0,0 +1 @@
1
+ @font-face{font-family:"HYWenHei-55W";src:url("../../fonts//HYWenHei-55W.ttf")}:root{--width: 600px }*{margin:0;padding:0;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none}body{background:rgba(0,0,0,0);color:#fff;width:var(--width)}.container{font-family:"HYWenHei-55W";padding-bottom:40px;position:relative;display:flex;flex-direction:column;width:100%}.copyright{left:0;bottom:0;display:flex;width:100%;font-size:16px;position:absolute;align-items:center;justify-content:center;padding:10px 0 10px 0;background-color:#000}.copyright strong{padding-top:5px;font-weight:bold;font-size:10px;color:#f2c06f}/*# sourceMappingURL=default.css.map */
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta http-equiv="content-type" content="text/html;charset=utf-8" />
6
+ <link rel="stylesheet" type="text/css" href="{{plugin.resources.default}}/template/layout/default.css" />
7
+
8
+ {{block 'css'}}{{/block}}
9
+
10
+ </head>
11
+
12
+ <body>
13
+ <div class="container" id="container">
14
+
15
+ {{block 'container'}}{{/block}}
16
+
17
+ <div class="copyright">
18
+ Created&nbsp;by&nbsp;Karin<strong>v{{karin.version}}</strong>&nbsp;&&nbsp;{{plugin.name}}<strong>v{{plugin.version}}</strong>
19
+ </div>
20
+
21
+ </div>
22
+
23
+ {{block 'script'}}{{/block}}
24
+
25
+ </body>
26
+
27
+ </html>
package/lib/app.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,120 +0,0 @@
1
- import { ModelStatic, Model, ModelAttributeColumnOptions, DataTypes } from 'sequelize';
2
-
3
- interface MysAccountInfoType {
4
- ltuid: string;
5
- type: MysAccountType;
6
- cookie: string;
7
- stoken: string;
8
- /** 绑定的设备md5 */
9
- deviceMd5: string;
10
- }
11
- declare const enum MysAccountType {
12
- cn = "mihoyo",
13
- os = "hoyolab"
14
- }
15
-
16
- interface MysDeviceInfoItem {
17
- deviceId: string;
18
- deviceFp: string;
19
- name: string;
20
- board: string;
21
- model: string;
22
- oaid: string;
23
- androidVersion: string;
24
- fingerprint: string;
25
- product: string;
26
- }
27
- interface MysDeviceInfoType extends MysDeviceInfoItem {
28
- md5: string;
29
- }
30
-
31
- interface BaseUserInfoType {
32
- userId: string;
33
- ltuids: string[];
34
- stuids: string[];
35
- deviceList: string[];
36
- }
37
-
38
- declare const enum Dialect {
39
- Sqlite = "sqlite",
40
- MySQL = "mysql",
41
- MariaDB = "mariadb",
42
- PostgreSQL = "postgres",
43
- MSSQL = "mssql",
44
- Oracle = "oracle",
45
- DB2 = "db2",
46
- Snowflake = "snowflake"
47
- }
48
- declare enum DatabaseType {
49
- File = "file",
50
- Dir = "dir",
51
- Db = "db"
52
- }
53
- type ModelAttributes<M extends Model = Model, TAttributes = any> = {
54
- [name in keyof TAttributes]: ModelAttributeColumnOptions<M>;
55
- };
56
- interface DatabaseReturn<T> {
57
- [DatabaseType.Db]: T & {
58
- save: (data: Partial<T>) => Promise<DatabaseReturn<T>[DatabaseType.Db]>;
59
- };
60
- [DatabaseType.File]: T & {
61
- save: (data: T) => Promise<DatabaseReturn<T>[DatabaseType.File]>;
62
- };
63
- [DatabaseType.Dir]: T & {
64
- save: (data: T) => Promise<DatabaseReturn<T>[DatabaseType.Dir]>;
65
- };
66
- }
67
- type DatabaseClassInstance<T extends Record<string, any>, D extends DatabaseType> = {
68
- /** 数据库标识 */
69
- dialect: Dialect;
70
- model: ModelStatic<Model>;
71
- databasePath: string;
72
- databaseType: D;
73
- /** 表名 */
74
- modelName: string;
75
- /** 表定义 */
76
- modelSchema: ModelAttributes<Model>;
77
- /** 检查数据库是否可用 */
78
- check(): Promise<boolean>;
79
- /**
80
- * 初始化表
81
- * @param DataDir 插件数据目录
82
- * @param modelName 表名
83
- * @param modelSchema 表定义
84
- * @param type 数据库类型
85
- */
86
- init(DataDir: string, modelName: string, modelSchema: Record<keyof T, ModelAttributeColumnOptions<Model>>, type: D): Promise<DatabaseClassInstance<T, D>>;
87
- /** 将表定义转换为 JSON 对象 */
88
- schemaToJSON(pk: string): T;
89
- /** 获取用户数据文件路径 */
90
- userPath(pk: string): string;
91
- /** 根据主键读取用户数据文件 */
92
- readSync(path: string, pk: string): DatabaseReturn<T>[DatabaseType.File];
93
- /** 根据主键读取用户数据目录 */
94
- readDirSync(pk: string): DatabaseReturn<T>[DatabaseType.Dir];
95
- /** 写入用户数据目录 */
96
- writeDirSync(pk: string, data: Record<string, any>): boolean;
97
- /** 保存用户数据到文件 */
98
- saveFile(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.File]>;
99
- /** 保存用户数据到目录 */
100
- saveDir(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.Dir]>;
101
- /** 保存用户数据到 SQL 数据库 */
102
- saveSql(model: Model<any, any>, pk: string): (data: Partial<T>) => Promise<DatabaseReturn<T>[DatabaseType.Db]>;
103
- /** 根据主键查找或创建用户数据 */
104
- findByPk(pk: string, create: true): Promise<DatabaseReturn<T>[D]>;
105
- /** 根据主键查找用户数据 */
106
- findByPk(pk: string, create?: boolean): Promise<DatabaseReturn<T>[D] | undefined>;
107
- /** 根据主键数组查找用户数据 */
108
- findAllByPks(pks: string[]): Promise<DatabaseReturn<T>[D][]>;
109
- /** 删除用户数据 */
110
- destroy(pk: string): Promise<boolean>;
111
- };
112
- interface DatabaseClassStatic {
113
- Column(type: keyof typeof DataTypes, def: any, option?: Partial<ModelAttributeColumnOptions<Model>>): ModelAttributeColumnOptions<Model>;
114
- ArrayColumn(key: string, fn?: (data: string[]) => string[]): ModelAttributeColumnOptions<Model>;
115
- JsonColumn(key: string, def: {
116
- [key in string]: any;
117
- }): ModelAttributeColumnOptions<Model>;
118
- }
119
-
120
- export { type BaseUserInfoType as B, Dialect as D, type ModelAttributes as M, DatabaseType as a, type DatabaseReturn as b, type DatabaseClassInstance as c, type DatabaseClassStatic as d, type MysAccountInfoType as e, MysAccountType as f, type MysDeviceInfoItem as g, type MysDeviceInfoType as h };
@@ -1,38 +0,0 @@
1
- // src/types/app/command.ts
2
- var CoreCommand = /* @__PURE__ */ ((CoreCommand2) => {
3
- CoreCommand2["BingMysDevice"] = "BingMysDevice";
4
- return CoreCommand2;
5
- })(CoreCommand || {});
6
-
7
- // src/types/database/dbs/base.ts
8
- var Dialect = /* @__PURE__ */ ((Dialect2) => {
9
- Dialect2["Sqlite"] = "sqlite";
10
- Dialect2["MySQL"] = "mysql";
11
- Dialect2["MariaDB"] = "mariadb";
12
- Dialect2["PostgreSQL"] = "postgres";
13
- Dialect2["MSSQL"] = "mssql";
14
- Dialect2["Oracle"] = "oracle";
15
- Dialect2["DB2"] = "db2";
16
- Dialect2["Snowflake"] = "snowflake";
17
- return Dialect2;
18
- })(Dialect || {});
19
- var DatabaseType = /* @__PURE__ */ ((DatabaseType2) => {
20
- DatabaseType2["File"] = "file";
21
- DatabaseType2["Dir"] = "dir";
22
- DatabaseType2["Db"] = "db";
23
- return DatabaseType2;
24
- })(DatabaseType || {});
25
-
26
- // src/types/database/tables/mysAccountInfo.ts
27
- var MysAccountType = /* @__PURE__ */ ((MysAccountType2) => {
28
- MysAccountType2["cn"] = "mihoyo";
29
- MysAccountType2["os"] = "hoyolab";
30
- return MysAccountType2;
31
- })(MysAccountType || {});
32
-
33
- export {
34
- CoreCommand,
35
- Dialect,
36
- DatabaseType,
37
- MysAccountType
38
- };