karin-plugin-mys-core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/lib/apps/MiHoYoLogin.d.ts +3 -1
- package/lib/apps/MiHoYoLogin.js +177 -109
- package/lib/apps/MysDevice.d.ts +2 -2
- package/lib/apps/MysDevice.js +65 -23
- package/lib/apps/UIDManage.d.ts +10 -0
- package/lib/apps/UIDManage.js +52 -0
- package/lib/array-DuqoS2wx.d.ts +62 -0
- package/lib/chunk-2DHTKQ34.js +0 -0
- package/lib/chunk-3BIQN6QA.js +27 -0
- package/lib/chunk-5NA7ZPDS.js +54 -0
- package/lib/chunk-6PIXUPZ6.js +82 -0
- package/lib/chunk-7KEG6SDX.js +0 -0
- package/lib/chunk-7SZX3RBZ.js +0 -0
- package/lib/chunk-7VAWV6ZE.js +0 -0
- package/lib/chunk-7WESXE4X.js +29 -0
- package/lib/chunk-ARLTXJFJ.js +0 -0
- package/lib/chunk-CFS2WFOO.js +0 -0
- package/lib/chunk-COKAJ7V6.js +31 -0
- package/lib/chunk-EMAUATE3.js +217 -0
- package/lib/chunk-FBWSEBAW.js +0 -0
- package/lib/chunk-FOAQZIZ2.js +0 -0
- package/lib/chunk-G547WVGV.js +73 -0
- package/lib/chunk-G5W5WAY5.js +64 -0
- package/lib/chunk-HNODD2IL.js +179 -0
- package/lib/chunk-HVYNK5BN.js +45 -0
- package/lib/chunk-I7XZONDN.js +13 -0
- package/lib/chunk-IVZICDGW.js +19 -0
- package/lib/chunk-JKZ5NRPX.js +130 -0
- package/lib/chunk-JRH4JC43.js +0 -0
- package/lib/chunk-JVJQKRJ4.js +89 -0
- package/lib/chunk-K5U2O3HH.js +0 -0
- package/lib/chunk-KN5SHBVI.js +30 -0
- package/lib/chunk-LG34FPBI.js +50 -0
- package/lib/chunk-LJSDSOY6.js +0 -0
- package/lib/chunk-LYTNREAI.js +0 -0
- package/lib/chunk-MWYDWDR4.js +0 -0
- package/lib/chunk-RWBRS7SA.js +510 -0
- package/lib/chunk-SEWEEPJN.js +0 -0
- package/lib/{chunk-JML6VYXN.js → chunk-SHLPPEAY.js} +13 -17
- package/lib/chunk-SHW6FHIB.js +10 -0
- package/lib/chunk-UVMX6WUC.js +38 -0
- package/lib/chunk-W4DBT7AD.js +0 -0
- package/lib/chunk-XQWTJIT4.js +0 -0
- package/lib/chunk-Y3J3J5B2.js +124 -0
- package/lib/chunk-Z5I6A73Y.js +0 -0
- package/lib/common-Dw5l6Uud.d.ts +33 -0
- package/lib/define-BWuQ7acM.d.ts +131 -0
- package/lib/dir.d.ts +11 -13
- package/lib/dir.js +1 -1
- package/lib/exports/config/array.d.ts +1 -0
- package/lib/exports/config/array.js +7 -0
- package/lib/exports/config/config.d.ts +1 -0
- package/lib/exports/config/config.js +8 -0
- package/lib/exports/config/index.d.ts +2 -0
- package/lib/exports/config/index.js +14 -0
- package/lib/exports/config/types/config.d.ts +12 -0
- package/lib/exports/config/types/config.js +1 -0
- package/lib/exports/config/types/index.d.ts +1 -0
- package/lib/exports/config/types/index.js +2 -0
- package/lib/exports/database/database.d.ts +30 -0
- package/lib/exports/database/database.js +18 -0
- package/lib/exports/database/dbs/base.d.ts +23 -0
- package/lib/exports/database/dbs/base.js +15 -0
- package/lib/exports/database/dbs/index.d.ts +4 -0
- package/lib/exports/database/dbs/index.js +23 -0
- package/lib/exports/database/dbs/sqlite3.d.ts +23 -0
- package/lib/exports/database/dbs/sqlite3.js +19 -0
- package/lib/exports/database/dbs/table.d.ts +13 -0
- package/lib/exports/database/dbs/table.js +19 -0
- package/lib/exports/database/index.d.ts +12 -0
- package/lib/exports/database/index.js +62 -0
- package/lib/exports/database/tables/index.d.ts +9 -0
- package/lib/exports/database/tables/index.js +39 -0
- package/lib/exports/database/tables/mysAccountInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysAccountInfo.js +23 -0
- package/lib/exports/database/tables/mysDeviceInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysDeviceInfo.js +26 -0
- package/lib/exports/database/tables/mysUserInfo.d.ts +9 -0
- package/lib/exports/database/tables/mysUserInfo.js +23 -0
- package/lib/exports/database/types/database.d.ts +6 -0
- package/lib/exports/database/types/database.js +1 -0
- package/lib/exports/database/types/dbs/base.d.ts +114 -0
- package/lib/exports/database/types/dbs/base.js +11 -0
- package/lib/exports/database/types/dbs/index.d.ts +2 -0
- package/lib/exports/database/types/dbs/index.js +12 -0
- package/lib/exports/database/types/index.d.ts +6 -0
- package/lib/exports/database/types/index.js +24 -0
- package/lib/exports/database/types/tables/index.d.ts +5 -0
- package/lib/exports/database/types/tables/index.js +13 -0
- package/lib/exports/database/types/tables/mysAccountInfo.d.ts +14 -0
- package/lib/exports/database/types/tables/mysAccountInfo.js +7 -0
- package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +19 -0
- package/lib/exports/database/types/tables/mysDeviceInfo.js +1 -0
- package/lib/exports/database/types/tables/mysUserInfo.d.ts +31 -0
- package/lib/exports/database/types/tables/mysUserInfo.js +7 -0
- package/lib/exports/mys/api/apis.d.ts +82 -0
- package/lib/exports/mys/api/apis.js +57 -0
- package/lib/exports/mys/api/app.d.ts +60 -0
- package/lib/exports/mys/api/app.js +31 -0
- package/lib/exports/mys/api/define.d.ts +6 -0
- package/lib/exports/mys/api/define.js +43 -0
- package/lib/exports/mys/api/index.d.ts +11 -0
- package/lib/exports/mys/api/index.js +64 -0
- package/lib/exports/mys/index.d.ts +13 -0
- package/lib/exports/mys/index.js +77 -0
- package/lib/exports/mys/types/api/define.d.ts +6 -0
- package/lib/exports/mys/types/api/define.js +1 -0
- package/lib/exports/mys/types/api/index.d.ts +6 -0
- package/lib/exports/mys/types/api/index.js +2 -0
- package/lib/exports/mys/types/index.d.ts +10 -0
- package/lib/exports/mys/types/index.js +12 -0
- package/lib/exports/mys/types/user/game.d.ts +10 -0
- package/lib/exports/mys/types/user/game.js +1 -0
- package/lib/exports/mys/types/user/index.d.ts +10 -0
- package/lib/exports/mys/types/user/index.js +9 -0
- package/lib/exports/mys/types/user/userInfo.d.ts +10 -0
- package/lib/exports/mys/types/user/userInfo.js +7 -0
- package/lib/exports/mys/user/deviceInfo.d.ts +11 -0
- package/lib/exports/mys/user/deviceInfo.js +29 -0
- package/lib/exports/mys/user/game.d.ts +20 -0
- package/lib/exports/mys/user/game.js +7 -0
- package/lib/exports/mys/user/index.d.ts +12 -0
- package/lib/exports/mys/user/index.js +51 -0
- package/lib/exports/mys/user/userInfo.d.ts +10 -0
- package/lib/exports/mys/user/userInfo.js +45 -0
- package/lib/exports/utils/common.d.ts +1 -0
- package/lib/exports/utils/common.js +13 -0
- package/lib/exports/utils/index.d.ts +2 -0
- package/lib/exports/utils/index.js +12 -0
- package/lib/exports/utils/render.d.ts +21 -0
- package/lib/exports/utils/render.js +7 -0
- package/lib/index-DEEWbZ0V.d.ts +102 -0
- package/lib/index.js +1 -1
- package/package.json +29 -15
- package/resources/fonts/HYWenHei-55W.ttf +0 -0
- package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
- 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
- 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
- package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
- package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
- package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
- package/resources/image/mys-logo.png +0 -0
- package/resources/template/ShowBindAccount/index.css +1 -0
- package/resources/template/ShowBindAccount/index.html +65 -0
- package/resources/template/ShowBindDevice/index.html +20 -0
- package/resources/template/ShowBindDevice/inex.css +1 -0
- package/resources/template/layout/default.css +1 -0
- package/resources/template/layout/default.html +27 -0
- package/lib/app.d.ts +0 -2
- package/lib/base-BJv9XnQP.d.ts +0 -120
- package/lib/chunk-CQNW7LJI.js +0 -38
- package/lib/chunk-MV2UE7C7.js +0 -410
- package/lib/chunk-NHUNEZXM.js +0 -371
- package/lib/chunk-WYRIRWT5.js +0 -213
- package/lib/database-byVXw91u.d.ts +0 -5
- package/lib/define-pa_pWNWT.d.ts +0 -182
- package/lib/exports/core.d.ts +0 -249
- package/lib/exports/core.js +0 -45
- package/lib/exports/database.d.ts +0 -48
- package/lib/exports/database.js +0 -20
- package/lib/exports/types.d.ts +0 -5
- package/lib/exports/types.js +0 -13
- package/lib/index.d.ts +0 -2
- package/lib/web.config.d.ts +0 -5
- package/lib/web.config.js +0 -55
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// src/exports/database/dbs/base.ts
|
|
2
|
+
import { existToMkdirSync, json, logger, rmSync } from "node-karin";
|
|
3
|
+
import lodash from "node-karin/lodash";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
var DbBase = class {
|
|
7
|
+
initBase(DataDir, modelName, modelSchema, type) {
|
|
8
|
+
this.databaseType = type;
|
|
9
|
+
this.databasePath = path.join(DataDir, modelName);
|
|
10
|
+
if (type !== "db" /* Db */) {
|
|
11
|
+
existToMkdirSync(this.databasePath);
|
|
12
|
+
}
|
|
13
|
+
this.modelName = modelName;
|
|
14
|
+
this.modelSchema = modelSchema;
|
|
15
|
+
}
|
|
16
|
+
schemaToJSON(pk) {
|
|
17
|
+
const result = {
|
|
18
|
+
[this.model.primaryKeyAttribute]: pk
|
|
19
|
+
};
|
|
20
|
+
lodash.forEach(this.modelSchema, (value, key) => {
|
|
21
|
+
if (key !== this.model.primaryKeyAttribute) {
|
|
22
|
+
result[key] = typeof value.defaultValue === "function" ? value.defaultValue() : value.defaultValue;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
userPath(pk) {
|
|
28
|
+
if (this.databaseType === "dir" /* Dir */) {
|
|
29
|
+
return path.join(this.databasePath, pk);
|
|
30
|
+
}
|
|
31
|
+
return path.join(this.databasePath, `${pk}.json`);
|
|
32
|
+
}
|
|
33
|
+
readSync(path2, pk) {
|
|
34
|
+
const result = json.readSync(path2);
|
|
35
|
+
result.save = this.saveFile(pk);
|
|
36
|
+
result.destroy = () => this.destroyPath(pk);
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
readDirSync(pk) {
|
|
40
|
+
const path2 = this.userPath(pk);
|
|
41
|
+
const files = fs.readdirSync(path2);
|
|
42
|
+
const result = {
|
|
43
|
+
save: this.saveDir(pk),
|
|
44
|
+
destroy: () => this.destroyPath(pk),
|
|
45
|
+
[this.model.primaryKeyAttribute]: pk
|
|
46
|
+
};
|
|
47
|
+
const filePromises = files.map(async (file) => {
|
|
48
|
+
const data = await json.read(`${path2}/${file}`);
|
|
49
|
+
result[data.key] = data.data;
|
|
50
|
+
});
|
|
51
|
+
Promise.all(filePromises).then().catch((err) => {
|
|
52
|
+
logger.error(err);
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
writeDirSync(pk, data) {
|
|
57
|
+
const path2 = this.userPath(pk);
|
|
58
|
+
lodash.forEach(this.modelSchema, (value, key) => {
|
|
59
|
+
if (key !== this.model.primaryKeyAttribute) {
|
|
60
|
+
const result = {
|
|
61
|
+
key,
|
|
62
|
+
[this.model.primaryKeyAttribute]: pk,
|
|
63
|
+
data: data[key] || value.defaultValue
|
|
64
|
+
};
|
|
65
|
+
json.writeSync(`${path2}/${key}.json`, result);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
saveFile(pk) {
|
|
71
|
+
return async (data) => {
|
|
72
|
+
delete data[this.model.primaryKeyAttribute];
|
|
73
|
+
const defData = this.schemaToJSON(pk);
|
|
74
|
+
const userPath = this.userPath(pk);
|
|
75
|
+
json.writeSync(userPath, lodash.merge({}, defData, data));
|
|
76
|
+
return this.readSync(userPath, pk);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
saveDir(pk) {
|
|
80
|
+
return async (data) => {
|
|
81
|
+
delete data[this.model.primaryKeyAttribute];
|
|
82
|
+
this.writeDirSync(pk, data);
|
|
83
|
+
return this.readDirSync(pk);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
destroyPath(pk) {
|
|
87
|
+
return new Promise((resolve) => {
|
|
88
|
+
const userPath = this.userPath(pk);
|
|
89
|
+
try {
|
|
90
|
+
rmSync(userPath, { recursive: true });
|
|
91
|
+
resolve(true);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
logger.error(err);
|
|
94
|
+
resolve(false);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
saveSql(model, pk) {
|
|
99
|
+
return async (data) => {
|
|
100
|
+
delete data[this.model.primaryKeyAttribute];
|
|
101
|
+
for (const key in data) {
|
|
102
|
+
if (data[key] === void 0) {
|
|
103
|
+
delete data[key];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const result = await model.update(data);
|
|
107
|
+
return {
|
|
108
|
+
...result.toJSON(),
|
|
109
|
+
save: this.saveSql(result, pk),
|
|
110
|
+
destroy: () => this.destroySql(pk)
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
destroySql(pk) {
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
const result = this.model.destroy({ where: { [this.model.primaryKeyAttribute]: pk } }).then((count) => count > 0).catch(() => false);
|
|
117
|
+
resolve(result);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
DbBase
|
|
124
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 生成随机字符串
|
|
3
|
+
* @param length - 字符串长度
|
|
4
|
+
*/
|
|
5
|
+
declare const randomString: (length: number, type: "Lower" | "Upper" | "All") => string;
|
|
6
|
+
/**
|
|
7
|
+
* @description 生成设备guid
|
|
8
|
+
*/
|
|
9
|
+
declare const getDeviceGuid: () => string;
|
|
10
|
+
/**
|
|
11
|
+
* @description 将字符串解析为key-value键值对
|
|
12
|
+
* @param Str - 字符串
|
|
13
|
+
* @param sep - 分隔符
|
|
14
|
+
*/
|
|
15
|
+
declare const StrToObj: <D extends {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
}>(Str: string, sep: string | RegExp) => Partial<D>;
|
|
18
|
+
/**
|
|
19
|
+
* @description 将key-value键值对解析为字符串
|
|
20
|
+
* @param obj - key-value键值对
|
|
21
|
+
* @param sep - 分隔符
|
|
22
|
+
*/
|
|
23
|
+
declare const ObjToStr: (obj: Record<string, string | number>, sep: string) => string;
|
|
24
|
+
|
|
25
|
+
declare const common_ObjToStr: typeof ObjToStr;
|
|
26
|
+
declare const common_StrToObj: typeof StrToObj;
|
|
27
|
+
declare const common_getDeviceGuid: typeof getDeviceGuid;
|
|
28
|
+
declare const common_randomString: typeof randomString;
|
|
29
|
+
declare namespace common {
|
|
30
|
+
export { common_ObjToStr as ObjToStr, common_StrToObj as StrToObj, common_getDeviceGuid as getDeviceGuid, common_randomString as randomString };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ObjToStr as O, StrToObj as S, common as c, getDeviceGuid as g, randomString as r };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { MysAccountType } from './exports/database/types/tables/mysAccountInfo.js';
|
|
2
|
+
import { SendMessage } from 'node-karin';
|
|
3
|
+
import { AxiosRequestConfig, AxiosResponse } from 'node-karin/axios';
|
|
4
|
+
import { MysDeviceInfoDatabaseBaseType, MysDeviceInfoDatabaseIdFpType } from './exports/database/types/tables/mysDeviceInfo.js';
|
|
5
|
+
import { MysApp } from './exports/mys/api/app.js';
|
|
6
|
+
|
|
7
|
+
declare class DefineApi<R extends BaseMysRes & Record<string, any> | null = null, D extends Record<string, any> | null = null, U extends Record<string, any> | null = null> {
|
|
8
|
+
#private;
|
|
9
|
+
UserInfo: U;
|
|
10
|
+
DeviceInfo: MysDeviceInfoDatabaseBaseType & MysDeviceInfoDatabaseIdFpType & {
|
|
11
|
+
/** @description 重要参数 */
|
|
12
|
+
brand: string;
|
|
13
|
+
display: string;
|
|
14
|
+
};
|
|
15
|
+
constructor(apiInfo: ApiInfoFn<R, D, U>);
|
|
16
|
+
get isHoyolab(): boolean;
|
|
17
|
+
init(userInfo: U): {
|
|
18
|
+
request: (data: D) => Promise<RequestResult<R>>;
|
|
19
|
+
requestCache: (key: string, seconds: number, data: D) => Promise<RequestResult<R>>;
|
|
20
|
+
};
|
|
21
|
+
/** @description 使用CookieHeaders等需要device进行请求时使用 */
|
|
22
|
+
initDevice(userInfo: U, deviceFp?: boolean): Promise<{
|
|
23
|
+
request: (data: D) => Promise<RequestResult<R>>;
|
|
24
|
+
requestCache: (key: string, seconds: number, data: D) => Promise<RequestResult<R>>;
|
|
25
|
+
}>;
|
|
26
|
+
getDS1(saltKey: keyof typeof MysApp.salt, query?: string, body?: string): string;
|
|
27
|
+
getDS2(saltKey: keyof typeof MysApp.salt, query?: string, body?: string): string;
|
|
28
|
+
NoHeaders: (options?: {
|
|
29
|
+
query?: string;
|
|
30
|
+
body?: any;
|
|
31
|
+
}) => {};
|
|
32
|
+
BaseCnHeaders: () => {
|
|
33
|
+
'x-rpc-app_version': string;
|
|
34
|
+
'x-rpc-client_type': string;
|
|
35
|
+
'x-rpc-device_id': string;
|
|
36
|
+
'User-Agent': string;
|
|
37
|
+
Referer: string;
|
|
38
|
+
};
|
|
39
|
+
BaseOsHeaders: () => {
|
|
40
|
+
'x-rpc-app_version': string;
|
|
41
|
+
'x-rpc-client_type': string;
|
|
42
|
+
'x-rpc-language': string;
|
|
43
|
+
};
|
|
44
|
+
PassportHeaders: (options?: {
|
|
45
|
+
query?: string;
|
|
46
|
+
body?: any;
|
|
47
|
+
}) => {
|
|
48
|
+
'x-rpc-app_version': string;
|
|
49
|
+
'x-rpc-game_biz': string;
|
|
50
|
+
'x-rpc-client_type': string;
|
|
51
|
+
'User-Agent': string;
|
|
52
|
+
'x-rpc-app_id': string;
|
|
53
|
+
DS: string;
|
|
54
|
+
};
|
|
55
|
+
CookieHeaders: (options?: {
|
|
56
|
+
query?: string;
|
|
57
|
+
body?: any;
|
|
58
|
+
}) => {
|
|
59
|
+
'x-rpc-app_version': string;
|
|
60
|
+
'x-rpc-client_type': string;
|
|
61
|
+
'x-rpc-language': string;
|
|
62
|
+
Cookie: any;
|
|
63
|
+
} | {
|
|
64
|
+
'x-rpc-app_version': string;
|
|
65
|
+
'x-rpc-client_type': string;
|
|
66
|
+
'x-rpc-device_id': string;
|
|
67
|
+
'User-Agent': string;
|
|
68
|
+
Referer: string;
|
|
69
|
+
Cookie: any;
|
|
70
|
+
};
|
|
71
|
+
OkHttpHeaders: (options?: {
|
|
72
|
+
query?: string;
|
|
73
|
+
body?: any;
|
|
74
|
+
}) => {
|
|
75
|
+
'User-Agent': string;
|
|
76
|
+
Connection: string;
|
|
77
|
+
'Accept-Encoding': string;
|
|
78
|
+
'Content-Type': string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type RequestResult<R> = {
|
|
83
|
+
data: R;
|
|
84
|
+
check: () => Promise<RequestResult<R>>;
|
|
85
|
+
error: SendMessage[];
|
|
86
|
+
};
|
|
87
|
+
interface BaseMysRes {
|
|
88
|
+
retcode: number;
|
|
89
|
+
message: string;
|
|
90
|
+
}
|
|
91
|
+
type ApiInfoFn<
|
|
92
|
+
/** @description 请求参数 */
|
|
93
|
+
R extends BaseMysRes & Record<string, any> | null = null,
|
|
94
|
+
/** @description 响应数据 */
|
|
95
|
+
D extends Record<string, any> | null = null, U extends Record<string, any> | null = null> = (self: DefineApi<R, D, U>, data: D) => {
|
|
96
|
+
Url: URL;
|
|
97
|
+
Body?: any;
|
|
98
|
+
Method: 'GET' | 'POST';
|
|
99
|
+
Options?: Omit<AxiosRequestConfig, 'url' | 'method' | 'data' | 'headers'>;
|
|
100
|
+
HeaderFn: () => Record<string, string> | Promise<Record<string, string>>;
|
|
101
|
+
/** @description 对响应数据进行处理 */
|
|
102
|
+
Result?: (response: AxiosResponse) => Promise<{
|
|
103
|
+
data: R;
|
|
104
|
+
row: any;
|
|
105
|
+
}>;
|
|
106
|
+
};
|
|
107
|
+
interface BaseltuidInfo {
|
|
108
|
+
ltuid: string;
|
|
109
|
+
type: MysAccountType;
|
|
110
|
+
/** @description 未绑定则使用deviceList中首个设备 */
|
|
111
|
+
deviceMd5: string;
|
|
112
|
+
}
|
|
113
|
+
interface UidInfo extends BaseltuidInfo {
|
|
114
|
+
uid: string;
|
|
115
|
+
cookie: string;
|
|
116
|
+
stoken: string;
|
|
117
|
+
userId: string;
|
|
118
|
+
owner: boolean;
|
|
119
|
+
}
|
|
120
|
+
interface DeviceInfoType {
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
board: string;
|
|
124
|
+
model: string;
|
|
125
|
+
oaid: string;
|
|
126
|
+
androidVersion: string;
|
|
127
|
+
fingerprint: string;
|
|
128
|
+
product: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { type ApiInfoFn as A, type BaseMysRes as B, type DeviceInfoType as D, type RequestResult as R, type UidInfo as U, type BaseltuidInfo as a, DefineApi as b };
|
package/lib/dir.d.ts
CHANGED
|
@@ -2,26 +2,24 @@
|
|
|
2
2
|
* 插件目录信息
|
|
3
3
|
*/
|
|
4
4
|
declare const dir: {
|
|
5
|
-
/** 根目录绝对路径 */
|
|
5
|
+
/** @description 根目录绝对路径 */
|
|
6
6
|
pluginDir: string;
|
|
7
|
-
/** 插件目录名称 */
|
|
7
|
+
/** @description 插件目录名称 */
|
|
8
8
|
pluginName: string;
|
|
9
|
-
/** package.json */
|
|
9
|
+
/** @description package.json */
|
|
10
10
|
pkg: any;
|
|
11
|
-
/** 插件版本 package.json 的 version */
|
|
11
|
+
/** @description 插件版本 package.json 的 version */
|
|
12
12
|
readonly version: any;
|
|
13
|
-
/** 插件名称 package.json 的 name */
|
|
13
|
+
/** @description 插件名称 package.json 的 name */
|
|
14
14
|
readonly name: any;
|
|
15
|
-
/**
|
|
16
|
-
readonly defConfigDir: string;
|
|
17
|
-
/** 在`@karinjs`中的绝对路径 */
|
|
15
|
+
/** @description 在`@karinjs`中的绝对路径 */
|
|
18
16
|
readonly karinPath: string;
|
|
19
|
-
/**
|
|
20
|
-
readonly ConfigDir: string;
|
|
21
|
-
/** 插件数据目录 `@karinjs/karin-plugin-xxx/data` */
|
|
17
|
+
/** @description 插件数据目录 `@karinjs/karin-plugin-xxx/data` */
|
|
22
18
|
readonly DataDir: string;
|
|
23
|
-
/**
|
|
24
|
-
readonly
|
|
19
|
+
/** @description 插件配置目录 `@karinjs/karin-plugin-xxx/config` */
|
|
20
|
+
readonly ConfigDir: string;
|
|
21
|
+
/** @description 插件资源目录 `@karinjs/karin-plugin-xxx/resources` */
|
|
22
|
+
readonly ResourcesDir: string;
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
export { dir };
|
package/lib/dir.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { E as EnhancedArray } from '../../array-DuqoS2wx.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { C as Config } from '../../array-DuqoS2wx.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-XQWTJIT4.js";
|
|
2
|
+
import "../../chunk-7SZX3RBZ.js";
|
|
3
|
+
import "../../chunk-2DHTKQ34.js";
|
|
4
|
+
import {
|
|
5
|
+
Config
|
|
6
|
+
} from "../../chunk-JKZ5NRPX.js";
|
|
7
|
+
import {
|
|
8
|
+
EnhancedArray
|
|
9
|
+
} from "../../chunk-6PIXUPZ6.js";
|
|
10
|
+
import "../../chunk-MLKGABMK.js";
|
|
11
|
+
export {
|
|
12
|
+
Config,
|
|
13
|
+
EnhancedArray
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ConfigDefine<T> {
|
|
2
|
+
defaultConfig: T;
|
|
3
|
+
}
|
|
4
|
+
interface ConfigDefineArray<T> {
|
|
5
|
+
defaultConfig: T[];
|
|
6
|
+
defaultConfigItem: {
|
|
7
|
+
defaultConfig: T;
|
|
8
|
+
required?: T extends Record<string, any> ? (keyof T)[] : never;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type { ConfigDefine, ConfigDefineArray };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../chunk-2DHTKQ34.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConfigDefine, ConfigDefineArray } from './config.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DatabaseFn } from './types/database.js';
|
|
2
|
+
import { Dialect, DatabaseClassStatic, DatabaseType, DatabaseClassInstance } from './types/dbs/base.js';
|
|
3
|
+
import { DataTypes, ModelAttributeColumnOptions, Model } from 'sequelize';
|
|
4
|
+
|
|
5
|
+
declare const Database: {
|
|
6
|
+
"__#private@#defaultDialect": Dialect;
|
|
7
|
+
"__#private@#DatabaseMap": Map<Dialect, {
|
|
8
|
+
Database: DatabaseFn;
|
|
9
|
+
Static: DatabaseClassStatic;
|
|
10
|
+
}>;
|
|
11
|
+
default(dialect: Dialect): void;
|
|
12
|
+
/** @description 添加数据库 */
|
|
13
|
+
Add(Db: DatabaseFn, Static: DatabaseClassStatic): Promise<void>;
|
|
14
|
+
get Db(): {
|
|
15
|
+
Database: DatabaseFn;
|
|
16
|
+
Static: DatabaseClassStatic;
|
|
17
|
+
};
|
|
18
|
+
get details(): {
|
|
19
|
+
dialect: Dialect;
|
|
20
|
+
desc: string;
|
|
21
|
+
}[];
|
|
22
|
+
/** @description 获取当前使用的数据库 */
|
|
23
|
+
get<T extends Record<string, any>, D extends DatabaseType>(): DatabaseClassInstance<T, D>;
|
|
24
|
+
get PkColumn(): (type: keyof typeof DataTypes, option?: Partial<ModelAttributeColumnOptions<Model>>) => ModelAttributeColumnOptions<Model>;
|
|
25
|
+
get Column(): DatabaseClassStatic["Column"];
|
|
26
|
+
get ArrayColumn(): DatabaseClassStatic["ArrayColumn"];
|
|
27
|
+
get JsonColumn(): DatabaseClassStatic["JsonColumn"];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { Database };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Database
|
|
3
|
+
} from "../../chunk-G547WVGV.js";
|
|
4
|
+
import "../../chunk-EMAUATE3.js";
|
|
5
|
+
import "../../chunk-Y3J3J5B2.js";
|
|
6
|
+
import "../../chunk-7KEG6SDX.js";
|
|
7
|
+
import "../../chunk-FBWSEBAW.js";
|
|
8
|
+
import "../../chunk-JVJQKRJ4.js";
|
|
9
|
+
import "../../chunk-LYTNREAI.js";
|
|
10
|
+
import "../../chunk-K5U2O3HH.js";
|
|
11
|
+
import "../../chunk-I7XZONDN.js";
|
|
12
|
+
import "../../chunk-SHW6FHIB.js";
|
|
13
|
+
import "../../chunk-JRH4JC43.js";
|
|
14
|
+
import "../../chunk-SHLPPEAY.js";
|
|
15
|
+
import "../../chunk-MLKGABMK.js";
|
|
16
|
+
export {
|
|
17
|
+
Database
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ModelStatic, Model } from 'sequelize';
|
|
2
|
+
import { DatabaseType, ModelAttributes, DatabaseReturn } from '../types/dbs/base.js';
|
|
3
|
+
|
|
4
|
+
declare class DbBase<T extends Record<string, any>, D extends DatabaseType> {
|
|
5
|
+
model: ModelStatic<Model>;
|
|
6
|
+
databasePath: string;
|
|
7
|
+
databaseType: D;
|
|
8
|
+
modelName: string;
|
|
9
|
+
modelSchema: ModelAttributes<Model>;
|
|
10
|
+
initBase(DataDir: string, modelName: string, modelSchema: ModelAttributes<Model>, type: D): void;
|
|
11
|
+
schemaToJSON(pk: string): T;
|
|
12
|
+
userPath(pk: string): string;
|
|
13
|
+
readSync(path: string, pk: string): DatabaseReturn<T>[DatabaseType.File];
|
|
14
|
+
readDirSync(pk: string): DatabaseReturn<T>[DatabaseType.Dir];
|
|
15
|
+
writeDirSync(pk: string, data: Record<string, any>): boolean;
|
|
16
|
+
saveFile(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.File]>;
|
|
17
|
+
saveDir(pk: string): (data: T) => Promise<DatabaseReturn<T>[DatabaseType.Dir]>;
|
|
18
|
+
destroyPath(pk: string): Promise<boolean>;
|
|
19
|
+
saveSql(model: Model<any, any>, pk: string): (data: Partial<T>) => Promise<DatabaseReturn<T>[DatabaseType.Db]>;
|
|
20
|
+
destroySql(pk: string): Promise<boolean>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { DbBase };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DbBase
|
|
3
|
+
} from "../../../chunk-Y3J3J5B2.js";
|
|
4
|
+
import "../../../chunk-7KEG6SDX.js";
|
|
5
|
+
import "../../../chunk-FBWSEBAW.js";
|
|
6
|
+
import "../../../chunk-JVJQKRJ4.js";
|
|
7
|
+
import "../../../chunk-LYTNREAI.js";
|
|
8
|
+
import "../../../chunk-K5U2O3HH.js";
|
|
9
|
+
import "../../../chunk-I7XZONDN.js";
|
|
10
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
11
|
+
import "../../../chunk-JRH4JC43.js";
|
|
12
|
+
import "../../../chunk-MLKGABMK.js";
|
|
13
|
+
export {
|
|
14
|
+
DbBase
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "../../../chunk-SEWEEPJN.js";
|
|
2
|
+
import {
|
|
3
|
+
Table
|
|
4
|
+
} from "../../../chunk-5NA7ZPDS.js";
|
|
5
|
+
import "../../../chunk-G547WVGV.js";
|
|
6
|
+
import "../../../chunk-EMAUATE3.js";
|
|
7
|
+
import {
|
|
8
|
+
DbBase
|
|
9
|
+
} from "../../../chunk-Y3J3J5B2.js";
|
|
10
|
+
import "../../../chunk-7KEG6SDX.js";
|
|
11
|
+
import "../../../chunk-FBWSEBAW.js";
|
|
12
|
+
import "../../../chunk-JVJQKRJ4.js";
|
|
13
|
+
import "../../../chunk-LYTNREAI.js";
|
|
14
|
+
import "../../../chunk-K5U2O3HH.js";
|
|
15
|
+
import "../../../chunk-I7XZONDN.js";
|
|
16
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
17
|
+
import "../../../chunk-JRH4JC43.js";
|
|
18
|
+
import "../../../chunk-SHLPPEAY.js";
|
|
19
|
+
import "../../../chunk-MLKGABMK.js";
|
|
20
|
+
export {
|
|
21
|
+
DbBase,
|
|
22
|
+
Table
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Model, DataTypes, ModelAttributeColumnOptions } from 'sequelize';
|
|
2
|
+
import { DatabaseType, DatabaseClassInstance, Dialect, ModelAttributes, DatabaseReturn, DatabaseArray } from '../types/dbs/base.js';
|
|
3
|
+
import { DbBase } from './base.js';
|
|
4
|
+
|
|
5
|
+
declare class Sqlite3<T extends Record<string, any>, D extends DatabaseType> extends DbBase<T, D> implements DatabaseClassInstance<T, D> {
|
|
6
|
+
dialect: Dialect;
|
|
7
|
+
check(): Promise<boolean>;
|
|
8
|
+
init(DataDir: string, modelName: string, modelSchema: ModelAttributes<Model>, type: D): Promise<DatabaseClassInstance<T, D>>;
|
|
9
|
+
findByPk(pk: string, create: true): Promise<DatabaseReturn<T>[D]>;
|
|
10
|
+
findByPk(pk: string, create?: false): Promise<DatabaseReturn<T>[D] | undefined>;
|
|
11
|
+
findAllByPks(pks: string[]): Promise<DatabaseReturn<T>[D][]>;
|
|
12
|
+
findAll(excludePks?: string[]): Promise<DatabaseReturn<T>[D][]>;
|
|
13
|
+
destroy(pk: string): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
declare const Sqlite3Static: {
|
|
16
|
+
dialect: Dialect;
|
|
17
|
+
description: string;
|
|
18
|
+
Column<T>(type: keyof typeof DataTypes, def: T, option?: Partial<ModelAttributeColumnOptions<Model>>): ModelAttributeColumnOptions<Model>;
|
|
19
|
+
ArrayColumn<T>(key: string, fn?: (data: DatabaseArray<T>) => T[]): ModelAttributeColumnOptions<Model>;
|
|
20
|
+
JsonColumn<T>(key: string, def: T): ModelAttributeColumnOptions<Model>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Sqlite3, Sqlite3Static };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Sqlite3,
|
|
3
|
+
Sqlite3Static
|
|
4
|
+
} from "../../../chunk-EMAUATE3.js";
|
|
5
|
+
import "../../../chunk-Y3J3J5B2.js";
|
|
6
|
+
import "../../../chunk-7KEG6SDX.js";
|
|
7
|
+
import "../../../chunk-FBWSEBAW.js";
|
|
8
|
+
import "../../../chunk-JVJQKRJ4.js";
|
|
9
|
+
import "../../../chunk-LYTNREAI.js";
|
|
10
|
+
import "../../../chunk-K5U2O3HH.js";
|
|
11
|
+
import "../../../chunk-I7XZONDN.js";
|
|
12
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
13
|
+
import "../../../chunk-JRH4JC43.js";
|
|
14
|
+
import "../../../chunk-SHLPPEAY.js";
|
|
15
|
+
import "../../../chunk-MLKGABMK.js";
|
|
16
|
+
export {
|
|
17
|
+
Sqlite3,
|
|
18
|
+
Sqlite3Static
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModelAttributeColumnOptions, Model } from 'sequelize';
|
|
2
|
+
import { DatabaseType, DatabaseClassInstance } from '../types/dbs/base.js';
|
|
3
|
+
|
|
4
|
+
declare class Table<TableType extends Record<string, any>, DBType extends DatabaseType, ExtraTableType extends Record<string, any>> {
|
|
5
|
+
#private;
|
|
6
|
+
initCache: DatabaseClassInstance<TableType, DBType>;
|
|
7
|
+
modelSchema: Record<keyof TableType, ModelAttributeColumnOptions<Model>>;
|
|
8
|
+
constructor(DataDir: string, tableName: string, type: DBType);
|
|
9
|
+
init(Schema: Record<keyof TableType, ModelAttributeColumnOptions<Model>>): Promise<() => Promise<DatabaseClassInstance<TableType, DBType>>>;
|
|
10
|
+
addSchem<newTableType extends ExtraTableType>(newSchema: Record<keyof newTableType, ModelAttributeColumnOptions<Model>>): Promise<() => Promise<DatabaseClassInstance<TableType & newTableType, DBType>>>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Table };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table
|
|
3
|
+
} from "../../../chunk-5NA7ZPDS.js";
|
|
4
|
+
import "../../../chunk-G547WVGV.js";
|
|
5
|
+
import "../../../chunk-EMAUATE3.js";
|
|
6
|
+
import "../../../chunk-Y3J3J5B2.js";
|
|
7
|
+
import "../../../chunk-7KEG6SDX.js";
|
|
8
|
+
import "../../../chunk-FBWSEBAW.js";
|
|
9
|
+
import "../../../chunk-JVJQKRJ4.js";
|
|
10
|
+
import "../../../chunk-LYTNREAI.js";
|
|
11
|
+
import "../../../chunk-K5U2O3HH.js";
|
|
12
|
+
import "../../../chunk-I7XZONDN.js";
|
|
13
|
+
import "../../../chunk-SHW6FHIB.js";
|
|
14
|
+
import "../../../chunk-JRH4JC43.js";
|
|
15
|
+
import "../../../chunk-SHLPPEAY.js";
|
|
16
|
+
import "../../../chunk-MLKGABMK.js";
|
|
17
|
+
export {
|
|
18
|
+
Table
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Database } from './database.js';
|
|
2
|
+
export { DbBase } from './dbs/base.js';
|
|
3
|
+
export { Table } 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, UidPermission } from './types/tables/mysUserInfo.js';
|
|
12
|
+
import 'sequelize';
|