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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShowBindAccountCmdFunc
3
- } from "../chunk-SOLISSTT.js";
4
- import "../chunk-S3ALDDWH.js";
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-32QZ2PSX.js";
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-ER4WMJJ6.js";
16
+ import "../chunk-4N3KY3KE.js";
17
17
  import {
18
18
  common_exports
19
19
  } from "../chunk-RX4VMVAI.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  DeviceInfo,
3
3
  UserInfo
4
- } from "../chunk-32QZ2PSX.js";
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-ER4WMJJ6.js";
8
+ import "../chunk-4N3KY3KE.js";
9
9
  import "../chunk-RX4VMVAI.js";
10
10
  import "../chunk-SHLPPEAY.js";
11
11
  import "../chunk-MLKGABMK.js";
@@ -5,13 +5,13 @@ import {
5
5
  ShowBindAccountCmdFunc,
6
6
  UnbindAccount,
7
7
  UnbindUID
8
- } from "../chunk-SOLISSTT.js";
9
- import "../chunk-S3ALDDWH.js";
10
- import "../chunk-32QZ2PSX.js";
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-ER4WMJJ6.js";
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
- lodash2.forEach(this.modelSchema, (value, key) => {
148
+ this.modelSchema.forEach(({ key, type, Option }) => {
143
149
  if (key !== primaryKey) {
144
- const Value = typeof value.defaultValue === "function" ? value.defaultValue() : value.defaultValue;
145
- result[key] = value.JsonColumn ? JSON.parse(Value) : value.ArrayColumn ? Value.split(",") : Value;
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
- lodash2.forEach(this.modelSchema, (value, key) => {
187
+ this.modelSchema.forEach(({ key, type, Option }) => {
182
188
  if (key !== this.primaryKey) {
183
- const mergeData = common_exports.filterData(data[key], value.defaultValue, this.modelSchemaDefine[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 key in this.modelSchema) {
276
- if (!tableDescription[key]) {
277
- await queryInterface.addColumn(this.modelName, key, this.modelSchema[key]);
278
- if (typeof this.modelSchema[key] === "string") continue;
279
- const defaultValue = this.modelSchema[key].defaultValue;
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({ [key]: defaultValue }, { where: {} });
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
- return {
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
- return {
414
- ArrayColumn: true,
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
- return {
429
- JsonColumn: true,
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
- type: DataTypes2[type],
491
- primaryKey: true,
492
- allowNull: false,
493
- ...option
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 = Object.assign(this.modelSchema, newSchema);
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
- ltuid: Database.PkColumn("STRING"),
580
- type: Database.Column("STRING", "mihoyo" /* cn */),
581
- cookie: Database.Column("TEXT", ""),
582
- stoken: Database.Column("STRING", ""),
583
- deviceMd5: Database.Column("STRING", "")
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
- md5: Database.PkColumn("STRING"),
596
- deviceId: Database.Column("STRING", common_exports.getDeviceGuid),
597
- deviceFp: Database.Column("STRING", ""),
598
- name: Database.Column("STRING", ""),
599
- board: Database.Column("STRING", ""),
600
- model: Database.Column("STRING", ""),
601
- oaid: Database.Column("STRING", ""),
602
- version: Database.Column("INTEGER", 12),
603
- fingerprint: Database.Column("STRING", ""),
604
- product: Database.Column("STRING", "")
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
- userId: Database.PkColumn("STRING"),
617
- ltuids: Database.ArrayColumn("ltuids"),
618
- stuids: Database.ArrayColumn("stuids"),
619
- deviceList: Database.ArrayColumn("deviceList")
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,
@@ -5,7 +5,7 @@ import {
5
5
  MysAccountInfoDB,
6
6
  MysDeviceInfoDB,
7
7
  MysUserInfoDB
8
- } from "./chunk-ER4WMJJ6.js";
8
+ } from "./chunk-4N3KY3KE.js";
9
9
  import {
10
10
  common_exports
11
11
  } from "./chunk-RX4VMVAI.js";
@@ -13,15 +13,15 @@ import { config } from "node-karin";
13
13
  import React from "react";
14
14
  var DefaultLayoutComponent = ({
15
15
  children,
16
- bg,
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: `relative flex ${width} flex-col pb-10 font-hywh text-black ${bg}`,
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, config as config2, existToMkdirSync, karinPathBase } from "node-karin";
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-S3ALDDWH.js";
5
+ } from "./chunk-C2ZR7X67.js";
6
6
  import {
7
7
  MysGame,
8
8
  UserInfo
9
- } from "./chunk-32QZ2PSX.js";
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, { bg: "bg-[#f6f0e6]", width: "w-[600px]" }, /* @__PURE__ */ React.createElement("div", { className: "w-full px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React.createElement(
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
@@ -4,7 +4,7 @@ import {
4
4
  DeviceCfg
5
5
  } from "../chunk-HI6OZTI2.js";
6
6
  import "../chunk-BLE3V6QR.js";
7
- import "../chunk-ER4WMJJ6.js";
7
+ import "../chunk-4N3KY3KE.js";
8
8
  import "../chunk-RX4VMVAI.js";
9
9
  import "../chunk-SHLPPEAY.js";
10
10
  import "../chunk-MLKGABMK.js";
@@ -1,5 +1,5 @@
1
- import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, M as ModelAttributes, d as DatabaseReturn, e as MysDeviceInfoTableType, B as BaseUserInfoTableType, f as BaseGameUIDInfoTableType } from '../../mysUserInfo-CPIjniyl.js';
2
- export { j as BindUidsItemType, g as DatabaseArray, h as MysDeviceInfoDatabaseBaseType, i as MysDeviceInfoDatabaseIdFpType, U as UidPermission } from '../../mysUserInfo-CPIjniyl.js';
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>>) => 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(Schema: ModelAttributes<Model, TableType>, SchemaDefine?: Partial<Record<keyof TableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType, DBType>>>;
65
- addSchem<newTableType extends ExtraTableType>(newSchema: ModelAttributes<Model, newTableType>, SchemaDefine?: Partial<Record<keyof newTableType, any>>): Promise<() => Promise<DatabaseClassInstance<TableType & newTableType, DBType>>>;
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-ER4WMJJ6.js";
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 { h as MysDeviceInfoDatabaseBaseType, i as MysDeviceInfoDatabaseIdFpType, e as MysDeviceInfoTableType, B as BaseUserInfoTableType, d as DatabaseReturn, D as DatabaseType, g as DatabaseArray, U as UidPermission, f as BaseGameUIDInfoTableType } from '../../mysUserInfo-CPIjniyl.js';
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<{
@@ -15,11 +15,11 @@ import {
15
15
  getUserFullInfo,
16
16
  getUserGameRolesByCookie,
17
17
  queryQRcode
18
- } from "../../chunk-32QZ2PSX.js";
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-ER4WMJJ6.js";
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
- bg: string;
8
- width: string;
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>;
@@ -2,7 +2,7 @@ import {
2
2
  DefaultLayoutComponent,
3
3
  React,
4
4
  ReactRender
5
- } from "../../chunk-S3ALDDWH.js";
5
+ } from "../../chunk-C2ZR7X67.js";
6
6
  import "../../chunk-RX4VMVAI.js";
7
7
  import "../../chunk-SHLPPEAY.js";
8
8
  import "../../chunk-MLKGABMK.js";
@@ -16,11 +16,14 @@ declare enum DatabaseType {
16
16
  Db = "db"
17
17
  }
18
18
  type ModelAttributes<M extends Model = Model, TAttributes = any> = {
19
- [name in keyof TAttributes]: ModelAttributeColumnOptions<M> & {
20
- ArrayColumn?: true;
21
- JsonColumn?: true;
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>>): ModelAttributeColumnOptions<Model>;
96
- ArrayColumn<T>(key: string, fn?: (data: DatabaseArray<T>) => T[]): ModelAttributeColumnOptions<Model> & {
97
- ArrayColumn: true;
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 d, type MysDeviceInfoTableType as e, type BaseGameUIDInfoTableType as f, DatabaseArray as g, type MysDeviceInfoDatabaseBaseType as h, type MysDeviceInfoDatabaseIdFpType as i, type BindUidsItemType as j };
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
@@ -3,7 +3,7 @@ import {
3
3
  DeviceCfg
4
4
  } from "./chunk-HI6OZTI2.js";
5
5
  import "./chunk-BLE3V6QR.js";
6
- import "./chunk-ER4WMJJ6.js";
6
+ import "./chunk-4N3KY3KE.js";
7
7
  import "./chunk-RX4VMVAI.js";
8
8
  import {
9
9
  dir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-mys-core",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "author": "babanbang",
5
5
  "type": "module",
6
6
  "description": "karin-plugin-mys-core",
@@ -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
  }