@grandlinex/kernel 0.17.0 → 0.20.0
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/CHANGELOG.md +4 -0
- package/dist/KernelModule.d.ts +0 -3
- package/dist/KernelModule.js +7 -75
- package/dist/classes/BaseApiAction.js +7 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/KernelModule.d.ts
CHANGED
package/dist/KernelModule.js
CHANGED
|
@@ -14,25 +14,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -78,7 +59,7 @@ var core_1 = require("@grandlinex/core");
|
|
|
78
59
|
var bundle_sqlight_1 = __importDefault(require("@grandlinex/bundle-sqlight"));
|
|
79
60
|
var bundle_postgresql_1 = __importDefault(require("@grandlinex/bundle-postgresql"));
|
|
80
61
|
var BaseKernelModule_1 = __importDefault(require("./classes/BaseKernelModule"));
|
|
81
|
-
var KernelDB_1 =
|
|
62
|
+
var KernelDB_1 = __importDefault(require("./database/KernelDB"));
|
|
82
63
|
var KernelEndpoint_1 = __importDefault(require("./api/KernelEndpoint"));
|
|
83
64
|
var ApiVersionAction_1 = __importDefault(require("./actions/ApiVersionAction"));
|
|
84
65
|
var GetTokenAction_1 = __importDefault(require("./actions/GetTokenAction"));
|
|
@@ -89,56 +70,28 @@ var KernelModule = /** @class */ (function (_super) {
|
|
|
89
70
|
function KernelModule(kernel) {
|
|
90
71
|
var _this = _super.call(this, 'kernel', kernel) || this;
|
|
91
72
|
_this.useLightDB = false;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
new ApiAuthTestAction_1.default(_this),
|
|
95
|
-
new GetTokenAction_1.default(_this),
|
|
96
|
-
].forEach(function (action) {
|
|
97
|
-
_this.addAction(action);
|
|
98
|
-
});
|
|
99
|
-
[new core_1.OfflineService(_this)].forEach(function (service) {
|
|
100
|
-
_this.addService(service);
|
|
101
|
-
});
|
|
73
|
+
_this.addAction(new ApiVersionAction_1.default(_this), new ApiAuthTestAction_1.default(_this), new GetTokenAction_1.default(_this));
|
|
74
|
+
_this.addService(new core_1.OfflineService(_this));
|
|
102
75
|
return _this;
|
|
103
76
|
}
|
|
104
77
|
KernelModule.prototype.initModule = function () {
|
|
105
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
var db,
|
|
79
|
+
var db, endpoint;
|
|
107
80
|
return __generator(this, function (_a) {
|
|
108
81
|
switch (_a.label) {
|
|
109
82
|
case 0:
|
|
110
83
|
this.setCache(new core_1.InMemCache(this, 480000));
|
|
111
84
|
if (this.useLightDB) {
|
|
112
|
-
|
|
113
|
-
__extends(Db, _super);
|
|
114
|
-
function Db(mod) {
|
|
115
|
-
return _super.call(this, mod, KernelDB_1.KERNEL_DB_VERSION) || this;
|
|
116
|
-
}
|
|
117
|
-
Db.prototype.initNewDB = function () {
|
|
118
|
-
return Promise.resolve(undefined);
|
|
119
|
-
};
|
|
120
|
-
return Db;
|
|
121
|
-
}(bundle_sqlight_1.default));
|
|
122
|
-
db = new KernelDB_1.default(new Db(this));
|
|
85
|
+
db = new KernelDB_1.default(new bundle_sqlight_1.default(this, '0'));
|
|
123
86
|
}
|
|
124
87
|
else {
|
|
125
|
-
|
|
126
|
-
__extends(Db, _super);
|
|
127
|
-
function Db(mod) {
|
|
128
|
-
return _super.call(this, mod, KernelDB_1.KERNEL_DB_VERSION) || this;
|
|
129
|
-
}
|
|
130
|
-
Db.prototype.initNewDB = function () {
|
|
131
|
-
return Promise.resolve(undefined);
|
|
132
|
-
};
|
|
133
|
-
return Db;
|
|
134
|
-
}(bundle_postgresql_1.default));
|
|
135
|
-
db = new KernelDB_1.default(new Db(this));
|
|
88
|
+
db = new KernelDB_1.default(new bundle_postgresql_1.default(this, '0'));
|
|
136
89
|
}
|
|
137
90
|
db.setEntityCache(true);
|
|
138
91
|
db.registerEntity(new GKey_1.default());
|
|
139
92
|
this.setDb(db);
|
|
140
93
|
endpoint = new KernelEndpoint_1.default('api', this, this.getKernel().getAppServerPort());
|
|
141
|
-
this.
|
|
94
|
+
this.setPresenter(endpoint);
|
|
142
95
|
return [4 /*yield*/, this.getKernel().triggerFunction('load')];
|
|
143
96
|
case 1:
|
|
144
97
|
_a.sent();
|
|
@@ -147,27 +100,6 @@ var KernelModule = /** @class */ (function (_super) {
|
|
|
147
100
|
});
|
|
148
101
|
});
|
|
149
102
|
};
|
|
150
|
-
KernelModule.prototype.startup = function () {
|
|
151
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
-
return __generator(this, function (_a) {
|
|
153
|
-
return [2 /*return*/, Promise.resolve()];
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
KernelModule.prototype.beforeServiceStart = function () {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
return __generator(this, function (_a) {
|
|
160
|
-
return [2 /*return*/, Promise.resolve()];
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
KernelModule.prototype.final = function () {
|
|
165
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
-
return __generator(this, function (_a) {
|
|
167
|
-
return [2 /*return*/, Promise.resolve()];
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
103
|
return KernelModule;
|
|
172
104
|
}(BaseKernelModule_1.default));
|
|
173
105
|
exports.default = KernelModule;
|
|
@@ -30,29 +30,29 @@ var BaseApiAction = /** @class */ (function (_super) {
|
|
|
30
30
|
BaseApiAction.prototype.register = function () {
|
|
31
31
|
var endpoint;
|
|
32
32
|
if (this.exmod) {
|
|
33
|
-
endpoint = this.exmod.
|
|
33
|
+
endpoint = this.exmod.getPresenter();
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
endpoint = this.getModule().
|
|
36
|
+
endpoint = this.getModule().getPresenter();
|
|
37
37
|
}
|
|
38
38
|
if (endpoint) {
|
|
39
|
-
this.log("register ".concat(this.
|
|
39
|
+
this.log("register ".concat(this.getName()));
|
|
40
40
|
var app = endpoint.getApp();
|
|
41
41
|
switch (this.type) {
|
|
42
42
|
case 'POST':
|
|
43
|
-
app.post(this.
|
|
43
|
+
app.post(this.getName(), this.secureHandler);
|
|
44
44
|
break;
|
|
45
45
|
case 'USE':
|
|
46
|
-
app.use(this.
|
|
46
|
+
app.use(this.getName(), this.secureHandler);
|
|
47
47
|
break;
|
|
48
48
|
case 'GET':
|
|
49
49
|
default:
|
|
50
|
-
app.get(this.
|
|
50
|
+
app.get(this.getName(), this.secureHandler);
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
this.error("on register -> ".concat(this.
|
|
55
|
+
this.error("on register -> ".concat(this.getName()));
|
|
56
56
|
this.error("No Endpoint found");
|
|
57
57
|
}
|
|
58
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grandlinex/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "GrandLineX is an out-of-the-box server framework on top of ExpressJs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "BSD-3-Clause",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@grandlinex/bundle-elogger": "^0.
|
|
31
|
-
"@grandlinex/bundle-postgresql": "^0.
|
|
32
|
-
"@grandlinex/bundle-sqlight": "^0.
|
|
33
|
-
"@grandlinex/core": "0.
|
|
30
|
+
"@grandlinex/bundle-elogger": "^0.20.0",
|
|
31
|
+
"@grandlinex/bundle-postgresql": "^0.20.0",
|
|
32
|
+
"@grandlinex/bundle-sqlight": "^0.20.0",
|
|
33
|
+
"@grandlinex/core": "^0.20.0",
|
|
34
34
|
"axios": "^0.24.0",
|
|
35
35
|
"body-parser": "^1.19.1",
|
|
36
36
|
"express": "^4.17.2",
|