cgserver 6.1.3 → 6.1.4

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.
@@ -18,7 +18,7 @@ class VersionModel {
18
18
  exports.VersionModel = VersionModel;
19
19
  exports.GDBCache = null;
20
20
  class DBCache {
21
- _versions = new Map();
21
+ _versions = {};
22
22
  _path = __dirname + "/tmp_table_version.json";
23
23
  async init() {
24
24
  if (fs.existsSync(this._path)) {
@@ -32,7 +32,7 @@ class DBCache {
32
32
  }
33
33
  }
34
34
  else {
35
- this._versions = new Map();
35
+ this._versions = {};
36
36
  fs.writeFileSync(this._path, JSON.stringify(this._versions));
37
37
  }
38
38
  }
@@ -56,6 +56,6 @@ class TableProperty {
56
56
  auto_increment = null;
57
57
  charset = "utf8mb4";
58
58
  comment = null;
59
- items = new Map();
59
+ items = {};
60
60
  }
61
61
  exports.TableProperty = TableProperty;
@@ -10,7 +10,7 @@ class CacheItem {
10
10
  expire_time = -1;
11
11
  }
12
12
  class CacheTool {
13
- _items = new Map();
13
+ _items = {};
14
14
  constructor() {
15
15
  //一个小时清除一次过期缓存
16
16
  setInterval(this._refresh.bind(this), 60 * 60 * 1000);
@@ -37,7 +37,7 @@ class ISocketServer {
37
37
  return this._web_socket;
38
38
  }
39
39
  //来自于用户的链接
40
- _ws_clients = new Map();
40
+ _ws_clients = {};
41
41
  _listen_port = 0;
42
42
  get listenPort() {
43
43
  return this._listen_port;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GCtrMgr = void 0;
4
4
  exports.GCtrMgr = null;
5
5
  class ControllerManager {
6
- _ctrs = new Map();
7
- _ctr_cls = new Map();
6
+ _static_ctr = {};
7
+ _ctr_cls = {};
8
8
  //module ctrname lower normal
9
- _cache_action_names = new Map();
9
+ _cache_action_names = {};
10
10
  registerController(module_name, ctr_name, cls) {
11
11
  module_name = module_name.toLowerCase();
12
12
  ctr_name = ctr_name.toLowerCase();
@@ -22,7 +22,7 @@ class ControllerManager {
22
22
  ctr_name = ctr_name.toLowerCase();
23
23
  //不能通过cls.name来获取ctr名称,因为混淆之后类名会变化
24
24
  let prototype = cls.prototype;
25
- let map_names = new Map();
25
+ let map_names = {};
26
26
  while (prototype && prototype.constructor.name != "BaseController") {
27
27
  let names = Object.getOwnPropertyNames(prototype);
28
28
  for (let action_name of names) {
@@ -61,15 +61,15 @@ class ControllerManager {
61
61
  registerStaticController(module_name, ctr_name, obj) {
62
62
  module_name = module_name.toLowerCase();
63
63
  ctr_name = ctr_name.toLowerCase();
64
- this._ctrs[module_name] = this._ctrs[module_name] || {};
65
- this._ctrs[module_name][ctr_name] = obj;
64
+ this._static_ctr[module_name] = this._static_ctr[module_name] || {};
65
+ this._static_ctr[module_name][ctr_name] = obj;
66
66
  this._cacheActionNameForStatic(module_name, ctr_name, obj);
67
67
  }
68
68
  _cacheActionNameForStatic(module_name, ctr_name, obj) {
69
69
  module_name = module_name.toLowerCase();
70
70
  ctr_name = ctr_name.toLowerCase();
71
71
  let prototype = Object.getPrototypeOf(obj);
72
- let map_names = new Map();
72
+ let map_names = {};
73
73
  while (prototype && prototype.constructor.name != "BaseController") {
74
74
  let names = Object.getOwnPropertyNames(prototype);
75
75
  for (let func_name of names) {
@@ -91,10 +91,10 @@ class ControllerManager {
91
91
  if (controller_name) {
92
92
  controller_name = controller_name.toLowerCase();
93
93
  }
94
- if (!this._ctrs[module_name]) {
94
+ if (!this._static_ctr[module_name]) {
95
95
  return;
96
96
  }
97
- return this._ctrs[module_name][controller_name];
97
+ return this._static_ctr[module_name][controller_name];
98
98
  }
99
99
  getClass(module_name, controller_name) {
100
100
  if (module_name) {
@@ -12,7 +12,9 @@ export declare class VersionModel {
12
12
  }
13
13
  export declare let GDBCache: DBCache;
14
14
  declare class DBCache {
15
- protected _versions: Map<String, VersionModel>;
15
+ protected _versions: {
16
+ [table_name: string]: VersionModel;
17
+ };
16
18
  protected _path: string;
17
19
  init(): Promise<void>;
18
20
  setVersion(table: string, version: number): Promise<void>;
@@ -51,5 +51,7 @@ export declare class TableProperty {
51
51
  auto_increment: number;
52
52
  charset: string;
53
53
  comment: string;
54
- items: Map<string, Property>;
54
+ items: {
55
+ [name: string]: Property;
56
+ };
55
57
  }
@@ -6,7 +6,9 @@ declare class CacheItem {
6
6
  expire_time: number;
7
7
  }
8
8
  declare class CacheTool {
9
- protected _items: Map<string, CacheItem>;
9
+ protected _items: {
10
+ [key: string]: CacheItem;
11
+ };
10
12
  constructor();
11
13
  /**
12
14
  * 定时清除缓存
@@ -11,7 +11,9 @@ export declare class ISocketServer {
11
11
  get fullServerName(): string;
12
12
  private _web_socket;
13
13
  get serverWebSocket(): ws.server;
14
- protected _ws_clients: Map<number, IServerWebSocket>;
14
+ protected _ws_clients: {
15
+ [socketid: number]: IServerWebSocket;
16
+ };
15
17
  private _listen_port;
16
18
  get listenPort(): number;
17
19
  set listenPort(value: number);
@@ -1,12 +1,30 @@
1
1
  import { BaseController } from "../Controller/BaseController";
2
2
  export declare let GCtrMgr: ControllerManager;
3
3
  declare class ControllerManager {
4
- protected _ctrs: Map<string, Map<string, BaseController>>;
5
- protected _ctr_cls: Map<string, Map<string, any>>;
6
- protected _cache_action_names: Map<string, Map<string, Map<string, string>>>;
7
- registerController(module_name: string, ctr_name: string, cls: Function): void;
4
+ protected _static_ctr: {
5
+ [module_name: string]: {
6
+ [ctrname: string]: BaseController;
7
+ };
8
+ };
9
+ protected _ctr_cls: {
10
+ [module_name: string]: {
11
+ [ctrname: string]: {
12
+ new (): BaseController;
13
+ };
14
+ };
15
+ };
16
+ protected _cache_action_names: {
17
+ [module: string]: {
18
+ [ctrname: string]: {
19
+ [lower: string]: string;
20
+ };
21
+ };
22
+ };
23
+ registerController(module_name: string, ctr_name: string, cls: {
24
+ new (): BaseController;
25
+ }): void;
8
26
  protected _cacheActionName(module_name: string, ctr_name: string, cls: Function): void;
9
- getActionName(module_name: string, ctr_name: string, action_name: string): any;
27
+ getActionName(module_name: string, ctr_name: string, action_name: string): string;
10
28
  /**
11
29
  * 静态ctr,这样,ctr就不会被多次创建
12
30
  * @param module_name
@@ -16,6 +34,6 @@ declare class ControllerManager {
16
34
  registerStaticController(module_name: string, ctr_name: string, obj: BaseController): void;
17
35
  protected _cacheActionNameForStatic(module_name: string, ctr_name: string, obj: BaseController): void;
18
36
  getStaticCtr(module_name: string, controller_name: string): BaseController;
19
- getClass(module_name: string, controller_name: string): any;
37
+ getClass(module_name: string, controller_name: string): new () => BaseController;
20
38
  }
21
39
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "6.1.3",
3
+ "version": "6.1.4",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",