cgserver 6.1.2 → 6.1.5
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/dist/lib/Database/Decorator/DBCache.js +2 -2
- package/dist/lib/Database/Decorator/Property.js +1 -1
- package/dist/lib/Logic/CacheTool.js +1 -1
- package/dist/lib/SocketServer/ISocketServer.js +1 -1
- package/dist/lib/WebServer/Engine/ControllerManager.js +9 -9
- package/dist/lib/cgserver.js +5 -2
- package/dist/types/Database/Decorator/DBCache.d.ts +3 -1
- package/dist/types/Database/Decorator/Property.d.ts +3 -1
- package/dist/types/Logic/CacheTool.d.ts +3 -1
- package/dist/types/SocketServer/ISocketServer.d.ts +3 -1
- package/dist/types/WebServer/Engine/ControllerManager.d.ts +19 -5
- package/dist/types/cgserver.d.ts +2 -2
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ class VersionModel {
|
|
|
18
18
|
exports.VersionModel = VersionModel;
|
|
19
19
|
exports.GDBCache = null;
|
|
20
20
|
class DBCache {
|
|
21
|
-
_versions =
|
|
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 =
|
|
35
|
+
this._versions = {};
|
|
36
36
|
fs.writeFileSync(this._path, JSON.stringify(this._versions));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -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
|
-
|
|
7
|
-
_ctr_cls =
|
|
6
|
+
_static_ctr = {};
|
|
7
|
+
_ctr_cls = {};
|
|
8
8
|
//module ctrname lower normal
|
|
9
|
-
_cache_action_names =
|
|
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 =
|
|
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.
|
|
65
|
-
this.
|
|
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 =
|
|
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.
|
|
94
|
+
if (!this._static_ctr[module_name]) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
return this.
|
|
97
|
+
return this._static_ctr[module_name][controller_name];
|
|
98
98
|
}
|
|
99
99
|
getClass(module_name, controller_name) {
|
|
100
100
|
if (module_name) {
|
package/dist/lib/cgserver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.GCtrMgr = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseUserController = exports.BaseController = exports.IWebServer = exports.GWechatTool = exports.GWechatOATool = exports.GQQTool = exports.GQiniuTool = exports.GOpenSocial = exports.GEmailTool = exports.GAppleTool = exports.GSmsTool = exports.GAlipayTool = exports.IWebSocket = exports.ISocketServer = void 0;
|
|
3
|
+
exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.MongoCacheModel = exports.GMongoCacheSer = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.GMongoAccountSer = exports.MongoAccountService = exports.GMysqlAccountSer = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.GLog = exports.GHttpTool = exports.GCacheTool = exports.RedisManager = exports.GRedisMgr = exports.GMysqlMgr = exports.MysqlBaseService = exports.GMSSqlMgr = exports.GMongoMgr = exports.MongoBaseModel = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.ServerConfig = exports.GFCfg = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.GTriggerMgr = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.GDBCache = exports.GProtoFactory = void 0;
|
|
4
|
+
exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.GCtrMgr = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseUserController = exports.BaseController = exports.IWebServer = exports.GWechatTool = exports.GWechatOATool = exports.GQQTool = exports.GQiniuTool = exports.GOpenSocial = exports.GEmailTool = exports.GAppleTool = exports.GSmsTool = exports.GAlipayTool = exports.IWebSocket = exports.ISocketServer = exports.IServerWebSocket = exports.IClientWebSocket = void 0;
|
|
5
5
|
var ProtoFactory_1 = require("./SocketServer/ProtoFilter/ProtoFactory");
|
|
6
6
|
Object.defineProperty(exports, "GProtoFactory", { enumerable: true, get: function () { return ProtoFactory_1.GProtoFactory; } });
|
|
7
7
|
var DBCache_1 = require("./Database/Decorator/DBCache");
|
|
@@ -25,8 +25,10 @@ var Config_1 = require("./Config/Config");
|
|
|
25
25
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return Config_1.Config; } });
|
|
26
26
|
var FrameworkConfig_1 = require("./Config/FrameworkConfig");
|
|
27
27
|
Object.defineProperty(exports, "FrameworkConfig", { enumerable: true, get: function () { return FrameworkConfig_1.FrameworkConfig; } });
|
|
28
|
+
Object.defineProperty(exports, "GFCfg", { enumerable: true, get: function () { return FrameworkConfig_1.GFCfg; } });
|
|
28
29
|
var ServerConfig_1 = require("./Config/ServerConfig");
|
|
29
30
|
Object.defineProperty(exports, "ServerConfig", { enumerable: true, get: function () { return ServerConfig_1.ServerConfig; } });
|
|
31
|
+
9;
|
|
30
32
|
var Core_1 = require("./Core/Core");
|
|
31
33
|
Object.defineProperty(exports, "core", { enumerable: true, get: function () { return Core_1.core; } });
|
|
32
34
|
var Timer_1 = require("./Core/Timer");
|
|
@@ -61,6 +63,7 @@ var MysqlManager_1 = require("./Database/MysqlManager");
|
|
|
61
63
|
Object.defineProperty(exports, "GMysqlMgr", { enumerable: true, get: function () { return MysqlManager_1.GMysqlMgr; } });
|
|
62
64
|
var RedisManager_1 = require("./Database/RedisManager");
|
|
63
65
|
Object.defineProperty(exports, "GRedisMgr", { enumerable: true, get: function () { return RedisManager_1.GRedisMgr; } });
|
|
66
|
+
Object.defineProperty(exports, "RedisManager", { enumerable: true, get: function () { return RedisManager_1.RedisManager; } });
|
|
64
67
|
var CacheTool_1 = require("./Logic/CacheTool");
|
|
65
68
|
Object.defineProperty(exports, "GCacheTool", { enumerable: true, get: function () { return CacheTool_1.GCacheTool; } });
|
|
66
69
|
var HttpTool_1 = require("./Logic/HttpTool");
|
|
@@ -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:
|
|
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>;
|
|
@@ -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:
|
|
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,26 @@
|
|
|
1
1
|
import { BaseController } from "../Controller/BaseController";
|
|
2
2
|
export declare let GCtrMgr: ControllerManager;
|
|
3
3
|
declare class ControllerManager {
|
|
4
|
-
protected
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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]: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
protected _cache_action_names: {
|
|
15
|
+
[module: string]: {
|
|
16
|
+
[ctrname: string]: {
|
|
17
|
+
[lower: string]: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
registerController(module_name: string, ctr_name: string, cls: any): void;
|
|
8
22
|
protected _cacheActionName(module_name: string, ctr_name: string, cls: Function): void;
|
|
9
|
-
getActionName(module_name: string, ctr_name: string, action_name: string):
|
|
23
|
+
getActionName(module_name: string, ctr_name: string, action_name: string): string;
|
|
10
24
|
/**
|
|
11
25
|
* 静态ctr,这样,ctr就不会被多次创建
|
|
12
26
|
* @param module_name
|
package/dist/types/cgserver.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { Point } from "./AI/Point";
|
|
|
8
8
|
export { Trigger, GTriggerMgr } from "./AI/TriggerMgr";
|
|
9
9
|
export { FrameworkErrorCode } from "./Config/_error_";
|
|
10
10
|
export { Config } from "./Config/Config";
|
|
11
|
-
export { FrameworkConfig } from "./Config/FrameworkConfig";
|
|
11
|
+
export { FrameworkConfig, GFCfg } from "./Config/FrameworkConfig";
|
|
12
12
|
export { ServerConfig } from "./Config/ServerConfig";
|
|
13
13
|
export { core } from "./Core/Core";
|
|
14
14
|
export { Timer } from "./Core/Timer";
|
|
@@ -26,7 +26,7 @@ export { GMongoMgr } from './Database/MongoManager';
|
|
|
26
26
|
export { GMSSqlMgr } from './Database/MSSqlManager';
|
|
27
27
|
export { BaseService as MysqlBaseService } from './Database/BaseService';
|
|
28
28
|
export { GMysqlMgr } from './Database/MysqlManager';
|
|
29
|
-
export { GRedisMgr } from './Database/RedisManager';
|
|
29
|
+
export { GRedisMgr, RedisManager } from './Database/RedisManager';
|
|
30
30
|
export { GCacheTool } from './Logic/CacheTool';
|
|
31
31
|
export { GHttpTool } from './Logic/HttpTool';
|
|
32
32
|
export { GLog } from './Logic/Log';
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cgserver",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.5",
|
|
4
4
|
"author": "trojan",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "free for all.Websocket or Http",
|
|
7
7
|
"main": "./dist/lib/cgserver.js",
|
|
8
|
-
"types": "./dist/types",
|
|
8
|
+
"types": "./dist/types/cgserver.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|