@xiaoguomeiyitian/core 1.3.7 → 1.3.8

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/README.md CHANGED
@@ -164,10 +164,14 @@ export declare class Global {
164
164
  getPropType(type: string, prop: string): any;
165
165
  /**获取某类实体属性的默认值 */
166
166
  getPropDefault(type: string, prop: string): any;
167
+ /** 解析实体数据,没有默认值添加默认值 */
168
+ parseEntity(type: string, data: any, keys?: string[]): any;
167
169
  /**从redis读取数据 */
168
- loadByRedis(type: string, id: string): Promise<any>;
169
- /**数据写入到redis */
170
- setToRedis(type: string, id: string, data: any): Promise<void>;
170
+ loadByRedis(type: string, id: string, redis?: any): Promise<any>;
171
+ /**数据写入到redis del 是否删除重新完整保存 默认 false */
172
+ setToRedis(type: string, id: string, data: any, del?: boolean, redis?: any): Promise<void>;
173
+ /**从redis删除*/
174
+ delByReids(type: string, id: string, redis?: any): Promise<void>;
171
175
  /**根据条件从mongo中查询单条实体数据*/
172
176
  findOne(type: string, filter: any, keys?: string[]): Promise<any>;
173
177
  /**根据条件从mongo中查询多条实体数据*/
@@ -186,6 +190,8 @@ export declare class Global {
186
190
  loadfile(filePath: string, reChain?: boolean, reload?: boolean): Promise<void>;
187
191
  /**保存之前没有保存的dump数据*/
188
192
  flushDumpData(): Promise<void>;
193
+ /** 执行临时补丁脚本 */
194
+ runPatch(patchName: string, ...args: any[]): Promise<any>;
189
195
  /** 获取V8 CPU调用统计信息,默认统计10秒钟 cwd/profile.cpuprofile*/
190
196
  profiler(time?: number): void;
191
197
  /** 获取V8 GC统计信息,默认统计10秒钟 */
@@ -223,21 +229,25 @@ export declare class Entity {
223
229
  flush(): Promise<void>;
224
230
  /**销毁 */
225
231
  destroy(): Promise<void>;
226
- /**添加定时器 */
232
+ /**添加定时器 time ms 毫秒 */
227
233
  addOneLoop(funcName: Function, time: number): number;
228
234
  /**清除定时器 */
229
235
  clearOneLoop(timeId: number): void;
230
- /**添加循环 */
236
+ /**添加循环 time ms 毫秒 */
231
237
  addLoop(funcName: Function, time: number): number;
232
238
  /**清除循环 */
233
239
  clearLoop(timeId: number): void;
234
240
  /**清除所有定时器 */
235
241
  clearAllLoop(): void;
242
+ /** 当实体创建(热更新实体不会调用这个函数) */
236
243
  onCreate(): void;
244
+ /** 当实体属性发生变化(该函数中不能直接更新实体属性,只能通过异步方式更新) */
237
245
  onPropChange(prop: string, value: any): void;
246
+ /** 当实体销毁 */
238
247
  onDestroy(): void;
239
248
  }
240
249
  export declare class GenEntityDefs {
250
+ ts: any;
241
251
  gen(filePath: string): void;
242
252
  }
243
253
  export declare class GenServiceFunc {
package/dist/cli.js CHANGED
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const index_1 = require("./index");
5
5
  // 获取当前工作目录
6
6
  const cmd = process.argv[2];
7
- //调试
8
- if (cmd == "dbg") {
9
- process.argv = [process.argv[0], process.argv[1], process.argv[2], "-autoDeBug", "1", "-serviceType", process.argv[3], "-rpcPort", process.argv[4]];
10
- global.G = new index_1.Global();
11
- }
12
7
  //生成EntityDefs
13
8
  if (cmd == "defs") {
14
9
  new index_1.GenEntityDefs().gen("./src/shared/protocols/entityDefs.ts");
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaoguomeiyitian/core",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "types/lib.d.ts",
6
6
  "bin": {
@@ -23,12 +23,12 @@
23
23
  "bundleDependencies": [],
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.14.1",
26
- "typescript": "^5.7.2"
26
+ "typescript": "^5.9.2"
27
27
  },
28
28
  "dependencies": {
29
- "@xiaoguomeiyitian/utils": "^0.1.2",
29
+ "@xiaoguomeiyitian/utils": "^0.1.3",
30
30
  "bytenode": "^1.5.7",
31
- "classic-level": "^2.0.0",
32
- "tsrpc": "^3.4.17"
31
+ "classic-level": "^3.0.0",
32
+ "tsrpc": "^3.4.19"
33
33
  }
34
34
  }
package/types/lib.d.ts CHANGED
@@ -13,6 +13,8 @@ export declare class Global {
13
13
  getPropType(type: string, prop: string): any;
14
14
  /**获取某类实体属性的默认值 */
15
15
  getPropDefault(type: string, prop: string): any;
16
+ /** 解析实体数据,没有默认值添加默认值 */
17
+ parseEntity(type: string, data: any, keys?: string[]): any;
16
18
  /**从redis读取数据 */
17
19
  loadByRedis(type: string, id: string, redis?: any): Promise<any>;
18
20
  /**数据写入到redis del 是否删除重新完整保存 默认 false */
@@ -88,7 +90,7 @@ export declare class Entity {
88
90
  clearAllLoop(): void;
89
91
  /** 当实体创建(热更新实体不会调用这个函数) */
90
92
  onCreate(): void;
91
- /** 当实体属性发生变化 */
93
+ /** 当实体属性发生变化(该函数中不能直接更新实体属性,只能通过异步方式更新) */
92
94
  onPropChange(prop: string, value: any): void;
93
95
  /** 当实体销毁 */
94
96
  onDestroy(): void;