karin-plugin-mys-core 1.0.0 → 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 +181 -125
  4. package/lib/apps/MysDevice.d.ts +5 -0
  5. package/lib/apps/MysDevice.js +101 -0
  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 -16
  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/config/config.json +0 -3
  153. package/lib/app.d.ts +0 -2
  154. package/lib/base-B1BvQ4ol.d.ts +0 -99
  155. package/lib/chunk-4JTLXC2G.js +0 -519
  156. package/lib/chunk-7QISGXVH.js +0 -347
  157. package/lib/chunk-JIO4GOQA.js +0 -31
  158. package/lib/database-BDHrI6Vm.d.ts +0 -5
  159. package/lib/define-CrfHwHnK.d.ts +0 -163
  160. package/lib/exports/core.d.ts +0 -228
  161. package/lib/exports/core.js +0 -39
  162. package/lib/exports/database.d.ts +0 -47
  163. package/lib/exports/database.js +0 -17
  164. package/lib/exports/types.d.ts +0 -10
  165. package/lib/exports/types.js +0 -11
  166. package/lib/index.d.ts +0 -2
  167. package/lib/web.config.d.ts +0 -5
  168. package/lib/web.config.js +0 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-mys-core",
3
- "version": "1.0.0",
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,17 +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
- "/config/*.json",
64
- "!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"
65
78
  ],
66
79
  "publishConfig": {
67
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>
@@ -1,3 +0,0 @@
1
- {
2
- "yiyanApi": "https://api.yujn.cn/api/sjyy.php"
3
- }
package/lib/app.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,99 +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
- /** 绑定的设备ID */
9
- deviceId: string;
10
- }
11
- declare const enum MysAccountType {
12
- cn = "mihoyo",
13
- os = "hoyolab"
14
- }
15
-
16
- interface BaseUserInfoType {
17
- userId: string;
18
- ltuids: string[];
19
- stuids: string[];
20
- deviceList: string[];
21
- }
22
-
23
- declare const enum Dialect {
24
- Sqlite = "sqlite",
25
- MySQL = "mysql",
26
- MariaDB = "mariadb",
27
- PostgreSQL = "postgres",
28
- MSSQL = "mssql",
29
- Oracle = "oracle",
30
- DB2 = "db2",
31
- Snowflake = "snowflake"
32
- }
33
- declare enum DatabaseType {
34
- File = "file",
35
- Dir = "dir",
36
- Db = "db"
37
- }
38
- type ModelAttributes<M extends Model = Model, TAttributes = any> = {
39
- [name in keyof TAttributes]: ModelAttributeColumnOptions<M>;
40
- };
41
- type DatabaseReturn<T> = T & {
42
- _save: (data: T) => Promise<void>;
43
- };
44
- type DatabaseClassInstance<T extends Record<string, any>> = {
45
- /** 数据库标识 */
46
- dialect: Dialect;
47
- model: ModelStatic<Model>;
48
- databasePath: string;
49
- databaseType: DatabaseType;
50
- /** 表名 */
51
- modelName: string;
52
- /** 表定义 */
53
- modelSchema: ModelAttributes<Model>;
54
- /** 检查数据库是否可用 */
55
- check(): Promise<boolean>;
56
- /**
57
- * 初始化表
58
- * @param DataDir 插件数据目录
59
- * @param modelName 表名
60
- * @param modelSchema 表定义
61
- * @param type 数据库类型
62
- */
63
- init(DataDir: string, modelName: string, modelSchema: ModelAttributes<Model>, type: DatabaseType): Promise<DatabaseClassInstance<T>>;
64
- /** 将表定义转换为 JSON 对象 */
65
- schemaToJSON(pk: string): T;
66
- /** 获取用户数据文件路径 */
67
- userPath(pk: string): string;
68
- /** 根据主键读取用户数据文件 */
69
- readSync(path: string, pk: string): DatabaseReturn<T>;
70
- /** 根据主键读取用户数据目录 */
71
- readDirSync(pk: string): DatabaseReturn<T>;
72
- /** 写入用户数据文件 */
73
- writeFileSync(pk: string, data: Record<string, any>): boolean;
74
- /** 写入用户数据目录 */
75
- writeDirSync(pk: string, data: Record<string, any>): boolean;
76
- /** 保存用户数据到文件 */
77
- saveFile(pk: string): (data: T) => Promise<void>;
78
- /** 保存用户数据到目录 */
79
- saveDir(pk: string): (data: T) => Promise<void>;
80
- /** 保存用户数据到 SQL 数据库 */
81
- saveSql(model: Model<any, any>, pk: string): (data: T) => Promise<void>;
82
- /** 根据主键查找或创建用户数据 */
83
- findByPk(pk: string, create: true): Promise<DatabaseReturn<T>>;
84
- /** 根据主键查找用户数据 */
85
- findByPk(pk: string, create: boolean): Promise<DatabaseReturn<T> | undefined>;
86
- /** 根据主键数组查找用户数据 */
87
- findAllByPks(pks: string[]): Promise<DatabaseReturn<T>[]>;
88
- /** 删除用户数据 */
89
- destroy(pk: string): Promise<boolean>;
90
- };
91
- interface DatabaseClassStatic {
92
- Column(type: keyof typeof DataTypes, def: any, option?: Partial<ModelAttributeColumnOptions<Model>>): ModelAttributeColumnOptions<Model>;
93
- ArrayColumn(key: string, fn?: (data: string[]) => string[]): ModelAttributeColumnOptions<Model>;
94
- JsonColumn(key: string, def: {
95
- [key in string]: any;
96
- }): ModelAttributeColumnOptions<Model>;
97
- }
98
-
99
- 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 };