karin-plugin-mys-core 1.0.20 → 1.0.22
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/lib/apps/MiHoYoLogin.js +4 -4
- package/lib/apps/MysDevice.js +2 -2
- package/lib/apps/UIDManage.js +4 -4
- package/lib/{chunk-ER4WMJJ6.js → chunk-4N3KY3KE.js} +73 -56
- package/lib/{chunk-32QZ2PSX.js → chunk-AFF6YSYO.js} +1 -1
- package/lib/{chunk-S3ALDDWH.js → chunk-C2ZR7X67.js} +4 -12
- package/lib/{chunk-SOLISSTT.js → chunk-SCXP2BGQ.js} +3 -3
- package/lib/core/index.js +1 -1
- package/lib/exports/database/index.d.ts +10 -6
- package/lib/exports/database/index.js +3 -1
- package/lib/exports/mys/index.d.ts +1 -1
- package/lib/exports/mys/index.js +2 -2
- package/lib/exports/render/index.d.ts +4 -5
- package/lib/exports/render/index.js +1 -1
- package/lib/{mysUserInfo-CPIjniyl.d.ts → mysUserInfo-CYNdwJxY.d.ts} +22 -13
- package/lib/web.config.js +1 -1
- package/package.json +1 -1
- package/resources/styles/karin-plugin-mys-core.css +0 -9
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShowBindAccountCmdFunc
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-SCXP2BGQ.js";
|
|
4
|
+
import "../chunk-C2ZR7X67.js";
|
|
5
5
|
import {
|
|
6
6
|
UserInfo,
|
|
7
7
|
fetchQRcode,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
getTokenByGameToken,
|
|
10
10
|
getUserFullInfo,
|
|
11
11
|
queryQRcode
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-AFF6YSYO.js";
|
|
13
13
|
import "../chunk-5LRGHP36.js";
|
|
14
14
|
import "../chunk-HI6OZTI2.js";
|
|
15
15
|
import "../chunk-BLE3V6QR.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-4N3KY3KE.js";
|
|
17
17
|
import {
|
|
18
18
|
common_exports
|
|
19
19
|
} from "../chunk-RX4VMVAI.js";
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeviceInfo,
|
|
3
3
|
UserInfo
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-AFF6YSYO.js";
|
|
5
5
|
import "../chunk-5LRGHP36.js";
|
|
6
6
|
import "../chunk-HI6OZTI2.js";
|
|
7
7
|
import "../chunk-BLE3V6QR.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-4N3KY3KE.js";
|
|
9
9
|
import "../chunk-RX4VMVAI.js";
|
|
10
10
|
import "../chunk-SHLPPEAY.js";
|
|
11
11
|
import "../chunk-MLKGABMK.js";
|
package/lib/apps/UIDManage.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
ShowBindAccountCmdFunc,
|
|
6
6
|
UnbindAccount,
|
|
7
7
|
UnbindUID
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-SCXP2BGQ.js";
|
|
9
|
+
import "../chunk-C2ZR7X67.js";
|
|
10
|
+
import "../chunk-AFF6YSYO.js";
|
|
11
11
|
import "../chunk-5LRGHP36.js";
|
|
12
12
|
import "../chunk-HI6OZTI2.js";
|
|
13
13
|
import "../chunk-BLE3V6QR.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-4N3KY3KE.js";
|
|
15
15
|
import "../chunk-RX4VMVAI.js";
|
|
16
16
|
import "../chunk-SHLPPEAY.js";
|
|
17
17
|
import "../chunk-MLKGABMK.js";
|
|
@@ -35,6 +35,12 @@ var DatabaseType = /* @__PURE__ */ ((DatabaseType3) => {
|
|
|
35
35
|
DatabaseType3["Db"] = "db";
|
|
36
36
|
return DatabaseType3;
|
|
37
37
|
})(DatabaseType || {});
|
|
38
|
+
var ColumnOptionType = /* @__PURE__ */ ((ColumnOptionType2) => {
|
|
39
|
+
ColumnOptionType2["Normal"] = "normal";
|
|
40
|
+
ColumnOptionType2["Array"] = "array";
|
|
41
|
+
ColumnOptionType2["Json"] = "json";
|
|
42
|
+
return ColumnOptionType2;
|
|
43
|
+
})(ColumnOptionType || {});
|
|
38
44
|
var DatabaseArray = class _DatabaseArray extends Array {
|
|
39
45
|
constructor(items) {
|
|
40
46
|
super();
|
|
@@ -139,10 +145,10 @@ var DbBase = class {
|
|
|
139
145
|
const result = {
|
|
140
146
|
[primaryKey]: pk
|
|
141
147
|
};
|
|
142
|
-
|
|
148
|
+
this.modelSchema.forEach(({ key, type, Option }) => {
|
|
143
149
|
if (key !== primaryKey) {
|
|
144
|
-
const Value = typeof
|
|
145
|
-
result[key] =
|
|
150
|
+
const Value = typeof Option.defaultValue === "function" ? Option.defaultValue() : Option.defaultValue;
|
|
151
|
+
result[key] = type === "json" /* Json */ ? JSON.parse(Value) : "array" /* Array */ ? Value.split(",") : Value;
|
|
146
152
|
}
|
|
147
153
|
});
|
|
148
154
|
return result;
|
|
@@ -178,9 +184,9 @@ var DbBase = class {
|
|
|
178
184
|
}
|
|
179
185
|
writeDirSync(pk, data) {
|
|
180
186
|
const path3 = this.userPath(pk);
|
|
181
|
-
|
|
187
|
+
this.modelSchema.forEach(({ key, type, Option }) => {
|
|
182
188
|
if (key !== this.primaryKey) {
|
|
183
|
-
const mergeData = common_exports.filterData(data[key],
|
|
189
|
+
const mergeData = common_exports.filterData(data[key], Option.defaultValue, this.modelSchemaDefine[key]);
|
|
184
190
|
json.writeSync(`${path3}/${key}.json`, {
|
|
185
191
|
key,
|
|
186
192
|
[this.primaryKey]: pk,
|
|
@@ -272,13 +278,15 @@ var Sqlite3 = class extends DbBase {
|
|
|
272
278
|
await this.model.sync();
|
|
273
279
|
const queryInterface = sequelize.getQueryInterface();
|
|
274
280
|
const tableDescription = await queryInterface.describeTable(this.modelName);
|
|
275
|
-
for (const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
281
|
+
for (const Schema of this.modelSchema) {
|
|
282
|
+
const { key, Option } = Schema;
|
|
283
|
+
const _key = key;
|
|
284
|
+
if (!tableDescription[_key]) {
|
|
285
|
+
await queryInterface.addColumn(this.modelName, _key, Option);
|
|
286
|
+
if (typeof Option === "string") continue;
|
|
287
|
+
const defaultValue = Option.defaultValue;
|
|
280
288
|
if (defaultValue !== void 0) {
|
|
281
|
-
await this.model.update({ [
|
|
289
|
+
await this.model.update({ [_key]: defaultValue }, { where: {} });
|
|
282
290
|
}
|
|
283
291
|
}
|
|
284
292
|
}
|
|
@@ -402,16 +410,19 @@ var Sqlite3 = class extends DbBase {
|
|
|
402
410
|
var Sqlite3Static = new class Sqlite3Static2 {
|
|
403
411
|
dialect = dialect;
|
|
404
412
|
description = "\u63D2\u4EF6\u9ED8\u8BA4\u6570\u636E\u5E93";
|
|
405
|
-
Column(type, def, option) {
|
|
406
|
-
|
|
413
|
+
Column = (key, type, def, option) => ({
|
|
414
|
+
key,
|
|
415
|
+
type: "normal" /* Normal */,
|
|
416
|
+
Option: {
|
|
407
417
|
type: DataTypes[type],
|
|
408
418
|
defaultValue: def,
|
|
409
419
|
...option
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
ArrayColumn(key, fn) {
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
ArrayColumn = (key, fn) => ({
|
|
423
|
+
key,
|
|
424
|
+
type: "array" /* Array */,
|
|
425
|
+
Option: {
|
|
415
426
|
type: DataTypes.STRING,
|
|
416
427
|
defaultValue: [].join(","),
|
|
417
428
|
get() {
|
|
@@ -422,11 +433,12 @@ var Sqlite3Static = new class Sqlite3Static2 {
|
|
|
422
433
|
const setData = (fn ? fn(data) : data) || [];
|
|
423
434
|
this.setDataValue(key, setData.join(","));
|
|
424
435
|
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
JsonColumn(key, def) {
|
|
428
|
-
|
|
429
|
-
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
JsonColumn = (key, def) => ({
|
|
439
|
+
key,
|
|
440
|
+
type: "json" /* Json */,
|
|
441
|
+
Option: {
|
|
430
442
|
type: DataTypes.STRING,
|
|
431
443
|
defaultValue: JSON.stringify(def),
|
|
432
444
|
get() {
|
|
@@ -441,8 +453,8 @@ var Sqlite3Static = new class Sqlite3Static2 {
|
|
|
441
453
|
set(data) {
|
|
442
454
|
this.setDataValue(key, JSON.stringify(data));
|
|
443
455
|
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
456
|
+
}
|
|
457
|
+
});
|
|
446
458
|
}();
|
|
447
459
|
|
|
448
460
|
// src/exports/database/database.ts
|
|
@@ -486,11 +498,15 @@ var Database = new class DatabaseClass {
|
|
|
486
498
|
return this.Db.Database();
|
|
487
499
|
}
|
|
488
500
|
get PkColumn() {
|
|
489
|
-
return (type, option) => ({
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
501
|
+
return (key, type, option) => ({
|
|
502
|
+
key,
|
|
503
|
+
type: "normal" /* Normal */,
|
|
504
|
+
Option: {
|
|
505
|
+
type: DataTypes2[type],
|
|
506
|
+
primaryKey: true,
|
|
507
|
+
allowNull: false,
|
|
508
|
+
...option
|
|
509
|
+
}
|
|
494
510
|
});
|
|
495
511
|
}
|
|
496
512
|
get Column() {
|
|
@@ -552,7 +568,7 @@ var Table = class {
|
|
|
552
568
|
return this.#cache();
|
|
553
569
|
}
|
|
554
570
|
async addSchem(newSchema, SchemaDefine = {}) {
|
|
555
|
-
this.modelSchema
|
|
571
|
+
this.modelSchema.push(...newSchema);
|
|
556
572
|
this.modelSchemaDefine = Object.assign(this.modelSchemaDefine, SchemaDefine);
|
|
557
573
|
this.initCache = await this.#Database.init(
|
|
558
574
|
this.#DataDir,
|
|
@@ -575,13 +591,13 @@ var MysAccountInfoTable = createTable(
|
|
|
575
591
|
"db" /* Db */
|
|
576
592
|
);
|
|
577
593
|
var MysAccountInfoDB = await MysAccountInfoTable.init(
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
594
|
+
[
|
|
595
|
+
Database.PkColumn("ltuid", "STRING"),
|
|
596
|
+
Database.Column("type", "STRING", "mihoyo" /* cn */),
|
|
597
|
+
Database.Column("cookie", "TEXT", ""),
|
|
598
|
+
Database.Column("stoken", "STRING", ""),
|
|
599
|
+
Database.Column("deviceMd5", "STRING", "")
|
|
600
|
+
]
|
|
585
601
|
);
|
|
586
602
|
|
|
587
603
|
// src/exports/database/tables/mysDeviceInfo.ts
|
|
@@ -591,18 +607,18 @@ var MysDeviceInfoTable = createTable(
|
|
|
591
607
|
"db" /* Db */
|
|
592
608
|
);
|
|
593
609
|
var MysDeviceInfoDB = await MysDeviceInfoTable.init(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
610
|
+
[
|
|
611
|
+
Database.PkColumn("md5", "STRING"),
|
|
612
|
+
Database.Column("deviceId", "STRING", common_exports.getDeviceGuid),
|
|
613
|
+
Database.Column("deviceFp", "STRING", ""),
|
|
614
|
+
Database.Column("name", "STRING", ""),
|
|
615
|
+
Database.Column("board", "STRING", ""),
|
|
616
|
+
Database.Column("model", "STRING", ""),
|
|
617
|
+
Database.Column("oaid", "STRING", ""),
|
|
618
|
+
Database.Column("version", "INTEGER", 12),
|
|
619
|
+
Database.Column("fingerprint", "STRING", ""),
|
|
620
|
+
Database.Column("product", "STRING", "")
|
|
621
|
+
]
|
|
606
622
|
);
|
|
607
623
|
|
|
608
624
|
// src/exports/database/tables/mysUserInfo.ts
|
|
@@ -612,17 +628,18 @@ var MysUserInfoTable = createTable(
|
|
|
612
628
|
"db" /* Db */
|
|
613
629
|
);
|
|
614
630
|
var MysUserInfoDB = await MysUserInfoTable.init(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
631
|
+
[
|
|
632
|
+
Database.PkColumn("userId", "STRING"),
|
|
633
|
+
Database.ArrayColumn("ltuids"),
|
|
634
|
+
Database.ArrayColumn("stuids"),
|
|
635
|
+
Database.ArrayColumn("deviceList")
|
|
636
|
+
]
|
|
621
637
|
);
|
|
622
638
|
|
|
623
639
|
export {
|
|
624
640
|
Dialect,
|
|
625
641
|
DatabaseType,
|
|
642
|
+
ColumnOptionType,
|
|
626
643
|
DatabaseArray,
|
|
627
644
|
MysAccountType,
|
|
628
645
|
UidPermission,
|
|
@@ -13,15 +13,15 @@ import { config } from "node-karin";
|
|
|
13
13
|
import React from "react";
|
|
14
14
|
var DefaultLayoutComponent = ({
|
|
15
15
|
children,
|
|
16
|
-
|
|
17
|
-
width,
|
|
16
|
+
bgStyle,
|
|
18
17
|
mysPlugin
|
|
19
18
|
}) => {
|
|
20
19
|
const karinVersion = config.pkg().version;
|
|
21
20
|
return /* @__PURE__ */ React.createElement(
|
|
22
21
|
"div",
|
|
23
22
|
{
|
|
24
|
-
className:
|
|
23
|
+
className: "relative flex flex-col pb-10 font-hywh text-black",
|
|
24
|
+
style: bgStyle,
|
|
25
25
|
id: "container"
|
|
26
26
|
},
|
|
27
27
|
children,
|
|
@@ -29,21 +29,18 @@ var DefaultLayoutComponent = ({
|
|
|
29
29
|
"img",
|
|
30
30
|
{
|
|
31
31
|
src: `${mysPlugin.logoPath}`,
|
|
32
|
-
alt: "Mys Plugin Logo",
|
|
33
32
|
className: "h-6 w-6 rounde"
|
|
34
33
|
}
|
|
35
34
|
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-MYS-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, mysPlugin.name), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", mysPlugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
36
35
|
"img",
|
|
37
36
|
{
|
|
38
37
|
src: `${dir.pluginDir}/resources/image/mys-core-logo.webp`,
|
|
39
|
-
alt: "MysCore Logo",
|
|
40
38
|
className: "h-6 w-6 rounded-sm"
|
|
41
39
|
}
|
|
42
40
|
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "MysCore"), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", dir.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
43
41
|
"img",
|
|
44
42
|
{
|
|
45
43
|
src: `${dir.pluginDir}/resources/image/frame-logo.webp`,
|
|
46
|
-
alt: "Karin Logo",
|
|
47
44
|
className: "h-6 w-6 rounded-sm"
|
|
48
45
|
}
|
|
49
46
|
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "IS DRIVEN BY"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-1.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "Karin"), /* @__PURE__ */ React.createElement("strong", { className: "text-[10px] font-bold text-[#f2c06f]" }, "v", karinVersion)))))
|
|
@@ -51,7 +48,7 @@ var DefaultLayoutComponent = ({
|
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
// src/exports/render/render.ts
|
|
54
|
-
import karin, { absPath,
|
|
51
|
+
import karin, { absPath, existToMkdirSync, karinPathBase } from "node-karin";
|
|
55
52
|
import fs from "fs";
|
|
56
53
|
import path from "path";
|
|
57
54
|
import React2 from "react";
|
|
@@ -74,11 +71,6 @@ var ReactRender = class {
|
|
|
74
71
|
}
|
|
75
72
|
};
|
|
76
73
|
}
|
|
77
|
-
get karin() {
|
|
78
|
-
return {
|
|
79
|
-
version: config2.pkg().version
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
74
|
async template(template, component, props, options = {}) {
|
|
83
75
|
const element = React2.createElement(component, props);
|
|
84
76
|
const appHtml = renderToString(element);
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
DefaultLayoutComponent,
|
|
3
3
|
React,
|
|
4
4
|
ReactRender
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C2ZR7X67.js";
|
|
6
6
|
import {
|
|
7
7
|
MysGame,
|
|
8
8
|
UserInfo
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AFF6YSYO.js";
|
|
10
10
|
import {
|
|
11
11
|
dir
|
|
12
12
|
} from "./chunk-SHLPPEAY.js";
|
|
@@ -17,7 +17,7 @@ var ShowBindAccountComponent = ({
|
|
|
17
17
|
AccountList
|
|
18
18
|
}) => {
|
|
19
19
|
const plugin = Render.plugin;
|
|
20
|
-
return /* @__PURE__ */ React.createElement(DefaultLayoutComponent, {
|
|
20
|
+
return /* @__PURE__ */ React.createElement(DefaultLayoutComponent, { bgStyle: { backgroundColor: "#f6f0e6", width: 600 } }, /* @__PURE__ */ React.createElement("div", { className: "w-full px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React.createElement(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
23
|
className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
|
package/lib/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, M as ModelAttributes,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, C as ColumnOption, d as ColumnOptionType, M as ModelAttributes, e as DatabaseReturn, V as ValidateSchema, f as MysDeviceInfoTableType, B as BaseUserInfoTableType, g as BaseGameUIDInfoTableType } from '../../mysUserInfo-CYNdwJxY.js';
|
|
2
|
+
export { k as BindUidsItemType, h as DatabaseArray, i as MysDeviceInfoDatabaseBaseType, j as MysDeviceInfoDatabaseIdFpType, U as UidPermission } from '../../mysUserInfo-CYNdwJxY.js';
|
|
3
3
|
import { DataTypes, ModelAttributeColumnOptions, Model, ModelStatic } from 'sequelize';
|
|
4
4
|
import { a as MysAccountInfoTableType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
5
5
|
export { M as MysAccountType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
@@ -25,7 +25,7 @@ declare const Database: {
|
|
|
25
25
|
}[];
|
|
26
26
|
/** @description 获取当前使用的数据库 */
|
|
27
27
|
get<T extends Record<string, any>, D extends DatabaseType>(): DatabaseClassInstance<T, D>;
|
|
28
|
-
get PkColumn(): (type: keyof typeof DataTypes, option?: Partial<ModelAttributeColumnOptions<Model>>) =>
|
|
28
|
+
get PkColumn(): <K extends string>(key: K, type: keyof typeof DataTypes, option?: Partial<ModelAttributeColumnOptions<Model>>) => ColumnOption<ColumnOptionType.Normal, K>;
|
|
29
29
|
get Column(): DatabaseClassStatic["Column"];
|
|
30
30
|
get ArrayColumn(): DatabaseClassStatic["ArrayColumn"];
|
|
31
31
|
get JsonColumn(): DatabaseClassStatic["JsonColumn"];
|
|
@@ -61,8 +61,12 @@ declare class Table<TableType extends Record<string, any>, ExtraTableType extend
|
|
|
61
61
|
* @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
|
|
62
62
|
*/
|
|
63
63
|
constructor(DataDir: string, tableName: string, type: DBType, primaryKey?: keyof TableType);
|
|
64
|
-
init
|
|
65
|
-
|
|
64
|
+
init<const S extends readonly {
|
|
65
|
+
key: keyof TableType;
|
|
66
|
+
}[]>(Schema: ValidateSchema<TableType, S>, SchemaDefine?: Partial<Record<keyof TableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType, DBType>>>;
|
|
67
|
+
addSchem<newTableType extends ExtraTableType, const S extends readonly {
|
|
68
|
+
key: keyof newTableType;
|
|
69
|
+
}[]>(newSchema: ValidateSchema<newTableType, S>, SchemaDefine?: Partial<Record<keyof newTableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType & newTableType, DBType>>>;
|
|
66
70
|
}
|
|
67
71
|
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>;
|
|
68
72
|
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>;
|
|
@@ -77,4 +81,4 @@ declare const MysDeviceInfoDB: () => Promise<DatabaseClassInstance<MysDeviceInfo
|
|
|
77
81
|
declare const MysUserInfoTable: Table<BaseUserInfoTableType, BaseGameUIDInfoTableType<string>, DatabaseType.Db>;
|
|
78
82
|
declare const MysUserInfoDB: () => Promise<DatabaseClassInstance<BaseUserInfoTableType, DatabaseType.Db>>;
|
|
79
83
|
|
|
80
|
-
export { BaseGameUIDInfoTableType, BaseUserInfoTableType, Database, DatabaseClassInstance, DatabaseClassStatic, type DatabaseFn, DatabaseReturn, DatabaseType, DbBase, Dialect, ModelAttributes, MysAccountInfoDB, MysAccountInfoTable, MysAccountInfoTableType, MysDeviceInfoDB, MysDeviceInfoTable, MysDeviceInfoTableType, MysUserInfoDB, MysUserInfoTable, Table, createTable };
|
|
84
|
+
export { BaseGameUIDInfoTableType, BaseUserInfoTableType, ColumnOption, ColumnOptionType, Database, DatabaseClassInstance, DatabaseClassStatic, type DatabaseFn, DatabaseReturn, DatabaseType, DbBase, Dialect, ModelAttributes, MysAccountInfoDB, MysAccountInfoTable, MysAccountInfoTableType, MysDeviceInfoDB, MysDeviceInfoTable, MysDeviceInfoTableType, MysUserInfoDB, MysUserInfoTable, Table, ValidateSchema, createTable };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ColumnOptionType,
|
|
2
3
|
Database,
|
|
3
4
|
DatabaseArray,
|
|
4
5
|
DatabaseType,
|
|
@@ -14,11 +15,12 @@ import {
|
|
|
14
15
|
Table,
|
|
15
16
|
UidPermission,
|
|
16
17
|
createTable
|
|
17
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-4N3KY3KE.js";
|
|
18
19
|
import "../../chunk-RX4VMVAI.js";
|
|
19
20
|
import "../../chunk-SHLPPEAY.js";
|
|
20
21
|
import "../../chunk-MLKGABMK.js";
|
|
21
22
|
export {
|
|
23
|
+
ColumnOptionType,
|
|
22
24
|
Database,
|
|
23
25
|
DatabaseArray,
|
|
24
26
|
DatabaseType,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { M as MysAccountType, a as MysAccountInfoTableType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
2
2
|
import { SendMessage } from 'node-karin';
|
|
3
3
|
import { AxiosRequestConfig, AxiosResponse } from 'node-karin/axios';
|
|
4
|
-
import {
|
|
4
|
+
import { i as MysDeviceInfoDatabaseBaseType, j as MysDeviceInfoDatabaseIdFpType, f as MysDeviceInfoTableType, B as BaseUserInfoTableType, e as DatabaseReturn, D as DatabaseType, h as DatabaseArray, U as UidPermission, g as BaseGameUIDInfoTableType } from '../../mysUserInfo-CYNdwJxY.js';
|
|
5
5
|
import 'sequelize';
|
|
6
6
|
|
|
7
7
|
declare const MysApp: Readonly<{
|
package/lib/exports/mys/index.js
CHANGED
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
getUserFullInfo,
|
|
16
16
|
getUserGameRolesByCookie,
|
|
17
17
|
queryQRcode
|
|
18
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-AFF6YSYO.js";
|
|
19
19
|
import "../../chunk-5LRGHP36.js";
|
|
20
20
|
import "../../chunk-HI6OZTI2.js";
|
|
21
21
|
import "../../chunk-BLE3V6QR.js";
|
|
22
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-4N3KY3KE.js";
|
|
23
23
|
import "../../chunk-RX4VMVAI.js";
|
|
24
24
|
import "../../chunk-SHLPPEAY.js";
|
|
25
25
|
import "../../chunk-MLKGABMK.js";
|
|
@@ -4,8 +4,10 @@ import { Options } from 'node-karin';
|
|
|
4
4
|
|
|
5
5
|
interface DefaultLayoutProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
bgStyle: React.CSSProperties & {
|
|
8
|
+
backgroundColor: React.CSSProperties['backgroundColor'];
|
|
9
|
+
width: React.CSSProperties['width'];
|
|
10
|
+
};
|
|
9
11
|
mysPlugin?: {
|
|
10
12
|
name: string;
|
|
11
13
|
version: string;
|
|
@@ -38,9 +40,6 @@ declare class ReactRender<P extends Record<string, any>, K extends string> {
|
|
|
38
40
|
#private;
|
|
39
41
|
constructor(cfg: RenderCfg, pluginOptions?: Omit<P, 'name' | 'version' | 'resources'>);
|
|
40
42
|
get plugin(): Omit<P, 'name' | 'version' | 'resources'> & DefaultRenderPluginOptionsType;
|
|
41
|
-
get karin(): {
|
|
42
|
-
version: string;
|
|
43
|
-
};
|
|
44
43
|
template<C extends React.ComponentType<any>>(template: K, component: C, props: React.ComponentProps<C>, options?: {
|
|
45
44
|
type?: 'png' | 'jpeg' | 'webp';
|
|
46
45
|
plugin?: Record<string, any>;
|
|
@@ -16,11 +16,14 @@ declare enum DatabaseType {
|
|
|
16
16
|
Db = "db"
|
|
17
17
|
}
|
|
18
18
|
type ModelAttributes<M extends Model = Model, TAttributes = any> = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
key: keyof TAttributes;
|
|
20
|
+
type: ColumnOptionType;
|
|
21
|
+
Option: ModelAttributeColumnOptions<M>;
|
|
22
|
+
}[];
|
|
23
|
+
type ExtractSchemaKeys<T extends readonly any[]> = T[number]['key'];
|
|
24
|
+
type ValidateSchema<TAttributes, S extends readonly {
|
|
25
|
+
key: any;
|
|
26
|
+
}[]> = keyof TAttributes extends ExtractSchemaKeys<S> ? ExtractSchemaKeys<S> extends keyof TAttributes ? S : `❌ Schema 包含了多余的键:${Exclude<ExtractSchemaKeys<S>, keyof TAttributes>}` : keyof TAttributes extends string ? `❌ Schema 缺少必需的键:${Exclude<keyof TAttributes, ExtractSchemaKeys<S>>}` : never;
|
|
24
27
|
interface DatabaseReturn<T> {
|
|
25
28
|
[DatabaseType.Db]: T & {
|
|
26
29
|
save: (data: Partial<T>) => Promise<DatabaseReturn<T>[DatabaseType.Db]>;
|
|
@@ -87,18 +90,24 @@ type DatabaseClassInstance<T extends Record<string, any>, D extends DatabaseType
|
|
|
87
90
|
/** @description 删除用户数据 */
|
|
88
91
|
destroy(pk: string): Promise<boolean>;
|
|
89
92
|
};
|
|
93
|
+
declare const enum ColumnOptionType {
|
|
94
|
+
Normal = "normal",
|
|
95
|
+
Array = "array",
|
|
96
|
+
Json = "json"
|
|
97
|
+
}
|
|
98
|
+
interface ColumnOption<T extends ColumnOptionType, K extends string> {
|
|
99
|
+
key: K;
|
|
100
|
+
type: T;
|
|
101
|
+
Option: ModelAttributeColumnOptions<Model>;
|
|
102
|
+
}
|
|
90
103
|
interface DatabaseClassStatic {
|
|
91
104
|
/** @description 数据库标识 */
|
|
92
105
|
dialect: Dialect;
|
|
93
106
|
/** @description 数据库说明 */
|
|
94
107
|
description: string;
|
|
95
|
-
Column<T>(type: keyof typeof DataTypes, def: T, option?: Partial<ModelAttributeColumnOptions<Model>>):
|
|
96
|
-
ArrayColumn<T>(key:
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
JsonColumn<T extends Record<string, any>>(key: string, def: T): ModelAttributeColumnOptions<Model> & {
|
|
100
|
-
JsonColumn: true;
|
|
101
|
-
};
|
|
108
|
+
Column<T, K extends string>(key: K, type: keyof typeof DataTypes, def: T, option?: Partial<ModelAttributeColumnOptions<Model>>): ColumnOption<ColumnOptionType.Normal, K>;
|
|
109
|
+
ArrayColumn<T, K extends string>(key: K, fn?: (data: DatabaseArray<T>) => T[]): ColumnOption<ColumnOptionType.Array, K>;
|
|
110
|
+
JsonColumn<T extends Record<string, any>, K extends string>(key: K, def: T): ColumnOption<ColumnOptionType.Json, K>;
|
|
102
111
|
}
|
|
103
112
|
declare class DatabaseArray<T> extends Array<T> {
|
|
104
113
|
constructor(items: T[]);
|
|
@@ -168,4 +177,4 @@ type BaseGameUIDInfoTableType<Game extends string> = {
|
|
|
168
177
|
[P in `${Game}-uids`]: Partial<Record<string, BindUidsItemType>>;
|
|
169
178
|
};
|
|
170
179
|
|
|
171
|
-
export { type BaseUserInfoTableType as B, DatabaseType as D, type ModelAttributes as M, UidPermission as U, type DatabaseClassInstance as a, Dialect as b, type DatabaseClassStatic as c, type DatabaseReturn as
|
|
180
|
+
export { type BaseUserInfoTableType as B, type ColumnOption as C, DatabaseType as D, type ModelAttributes as M, UidPermission as U, type ValidateSchema as V, type DatabaseClassInstance as a, Dialect as b, type DatabaseClassStatic as c, ColumnOptionType as d, type DatabaseReturn as e, type MysDeviceInfoTableType as f, type BaseGameUIDInfoTableType as g, DatabaseArray as h, type MysDeviceInfoDatabaseBaseType as i, type MysDeviceInfoDatabaseIdFpType as j, type BindUidsItemType as k };
|
package/lib/web.config.js
CHANGED
package/package.json
CHANGED
|
@@ -665,10 +665,6 @@ video {
|
|
|
665
665
|
width: 150px;
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
.w-\[600px\] {
|
|
669
|
-
width: 600px;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
668
|
.w-full {
|
|
673
669
|
width: 100%;
|
|
674
670
|
}
|
|
@@ -781,11 +777,6 @@ video {
|
|
|
781
777
|
border-color: rgb(0 0 0 / 0.06);
|
|
782
778
|
}
|
|
783
779
|
|
|
784
|
-
.bg-\[\#f6f0e6\] {
|
|
785
|
-
--tw-bg-opacity: 1;
|
|
786
|
-
background-color: rgb(246 240 230 / var(--tw-bg-opacity, 1));
|
|
787
|
-
}
|
|
788
|
-
|
|
789
780
|
.bg-black\/\[0\.06\] {
|
|
790
781
|
background-color: rgb(0 0 0 / 0.06);
|
|
791
782
|
}
|