@grandlinex/kernel 1.0.2 → 1.1.0-alpha.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 +117 -117
- package/LICENSE +29 -29
- package/README.md +30 -30
- package/dist/cjs/KernelModule.js +1 -1
- package/dist/cjs/actions/ApiAuthTestAction.d.ts +2 -4
- package/dist/cjs/actions/ApiAuthTestAction.js +3 -9
- package/dist/cjs/actions/ApiVersionAction.d.ts +2 -4
- package/dist/cjs/actions/ApiVersionAction.js +3 -10
- package/dist/cjs/actions/GetTokenAction.d.ts +8 -9
- package/dist/cjs/actions/GetTokenAction.js +18 -36
- package/dist/cjs/annotation/index.d.ts +13 -0
- package/dist/cjs/annotation/index.js +21 -0
- package/dist/cjs/classes/BaseAction.d.ts +4 -0
- package/dist/cjs/classes/BaseAction.js +131 -1
- package/dist/cjs/classes/BaseApiAction.js +1 -1
- package/dist/cjs/classes/RouteApiAction.d.ts +6 -0
- package/dist/cjs/classes/RouteApiAction.js +25 -0
- package/dist/cjs/classes/index.d.ts +2 -1
- package/dist/cjs/classes/index.js +3 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/lib/express.d.ts +2 -1
- package/dist/cjs/modules/crypto/CryptoClient.d.ts +3 -2
- package/dist/cjs/modules/crypto/CryptoClient.js +2 -1
- package/dist/mjs/KernelModule.js +2 -2
- package/dist/mjs/actions/ApiAuthTestAction.d.ts +2 -4
- package/dist/mjs/actions/ApiAuthTestAction.js +4 -10
- package/dist/mjs/actions/ApiVersionAction.d.ts +2 -4
- package/dist/mjs/actions/ApiVersionAction.js +4 -11
- package/dist/mjs/actions/GetTokenAction.d.ts +8 -9
- package/dist/mjs/actions/GetTokenAction.js +19 -37
- package/dist/mjs/annotation/index.d.ts +13 -0
- package/dist/mjs/annotation/index.js +16 -0
- package/dist/mjs/classes/BaseAction.d.ts +4 -0
- package/dist/mjs/classes/BaseAction.js +131 -1
- package/dist/mjs/classes/BaseApiAction.js +1 -1
- package/dist/mjs/classes/RouteApiAction.d.ts +6 -0
- package/dist/mjs/classes/RouteApiAction.js +19 -0
- package/dist/mjs/classes/index.d.ts +2 -1
- package/dist/mjs/classes/index.js +2 -1
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.js +1 -0
- package/dist/mjs/lib/express.d.ts +2 -1
- package/dist/mjs/modules/crypto/CryptoClient.d.ts +3 -2
- package/dist/mjs/modules/crypto/CryptoClient.js +2 -1
- package/package.json +89 -88
- package/tsconfig-cjs.json +0 -92
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CoreAction } from '@grandlinex/core';
|
|
2
|
+
import { isErrorType, isSwaggerRef, } from '@grandlinex/swagger-mate';
|
|
2
3
|
import { ExpressServerTiming } from './timing/index.js';
|
|
3
4
|
import { BaseUserAgent } from './BaseUserAgent.js';
|
|
4
5
|
export var ActionMode;
|
|
@@ -13,6 +14,96 @@ export default class BaseAction extends CoreAction {
|
|
|
13
14
|
this.secureHandler = this.secureHandler.bind(this);
|
|
14
15
|
this.mode = ActionMode.DEFAULT;
|
|
15
16
|
this.forceDebug = false;
|
|
17
|
+
this.schema = null;
|
|
18
|
+
}
|
|
19
|
+
static validateSchema(error, schema, key, field, required = true) {
|
|
20
|
+
if (isSwaggerRef(schema)) {
|
|
21
|
+
error.field?.push({
|
|
22
|
+
key,
|
|
23
|
+
message: `Ref schema body validation is not supported yet`,
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!required && (field === undefined || field === null)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
switch (schema?.type) {
|
|
31
|
+
case 'boolean':
|
|
32
|
+
if (typeof field !== 'boolean') {
|
|
33
|
+
error.field?.push({
|
|
34
|
+
key,
|
|
35
|
+
message: `must be a boolean`,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
case 'integer':
|
|
40
|
+
case 'number':
|
|
41
|
+
if (typeof field !== 'number') {
|
|
42
|
+
error.field?.push({
|
|
43
|
+
key,
|
|
44
|
+
message: `must be a number`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case 'string':
|
|
49
|
+
if (typeof field !== 'string') {
|
|
50
|
+
error.field?.push({
|
|
51
|
+
key,
|
|
52
|
+
message: `must be a string`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
case 'array':
|
|
57
|
+
if (!Array.isArray(field)) {
|
|
58
|
+
error.field?.push({
|
|
59
|
+
key,
|
|
60
|
+
message: `must be a array`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (schema.items) {
|
|
64
|
+
field.forEach((it, id) => {
|
|
65
|
+
this.validateSchema(error, schema.items, `${key}[${id}]`, it);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
case 'object':
|
|
70
|
+
if (typeof field !== 'object') {
|
|
71
|
+
error.field?.push({
|
|
72
|
+
key,
|
|
73
|
+
message: `must be a object`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (schema.properties) {
|
|
77
|
+
Object.entries(schema.properties).forEach(([k, s]) => {
|
|
78
|
+
this.validateSchema(error, s, `${key}.${k}`, field[k], schema.required ? schema.required.includes(k) : false);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case undefined:
|
|
83
|
+
default:
|
|
84
|
+
error.field?.push({
|
|
85
|
+
key,
|
|
86
|
+
message: `Schema type is not defined or not supported`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
bodyValidation(req) {
|
|
91
|
+
if (!this.schema) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (!req.body) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const error = {
|
|
98
|
+
type: 'error',
|
|
99
|
+
global: [],
|
|
100
|
+
field: [],
|
|
101
|
+
};
|
|
102
|
+
BaseAction.validateSchema(error, this.schema, 'body', req.body);
|
|
103
|
+
if (error.field.length > 0 || error.global.length > 0) {
|
|
104
|
+
return error;
|
|
105
|
+
}
|
|
106
|
+
return req.body;
|
|
16
107
|
}
|
|
17
108
|
async secureHandler(req, res, next) {
|
|
18
109
|
const extension = this.initExtension(res);
|
|
@@ -31,6 +122,18 @@ export default class BaseAction extends CoreAction {
|
|
|
31
122
|
if (this.mode === ActionMode.DMZ) {
|
|
32
123
|
auth.stop();
|
|
33
124
|
try {
|
|
125
|
+
let body = null;
|
|
126
|
+
if (this.schema) {
|
|
127
|
+
body = this.bodyValidation(req);
|
|
128
|
+
}
|
|
129
|
+
if (isErrorType(body)) {
|
|
130
|
+
res.status(400).send(body);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (this.schema && body === null) {
|
|
134
|
+
res.sendStatus(400);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
34
137
|
await this.handler({
|
|
35
138
|
res,
|
|
36
139
|
req,
|
|
@@ -38,6 +141,7 @@ export default class BaseAction extends CoreAction {
|
|
|
38
141
|
data: null,
|
|
39
142
|
extension,
|
|
40
143
|
agent: new BaseUserAgent(req),
|
|
144
|
+
body,
|
|
41
145
|
});
|
|
42
146
|
}
|
|
43
147
|
catch (e) {
|
|
@@ -53,6 +157,18 @@ export default class BaseAction extends CoreAction {
|
|
|
53
157
|
auth.stop();
|
|
54
158
|
if (dat && typeof dat !== 'number') {
|
|
55
159
|
try {
|
|
160
|
+
let body = null;
|
|
161
|
+
if (this.schema) {
|
|
162
|
+
body = this.bodyValidation(req);
|
|
163
|
+
}
|
|
164
|
+
if (isErrorType(body)) {
|
|
165
|
+
res.status(400).send(body);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this.schema && body === null) {
|
|
169
|
+
res.sendStatus(400);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
56
172
|
await this.handler({
|
|
57
173
|
res,
|
|
58
174
|
req,
|
|
@@ -60,6 +176,7 @@ export default class BaseAction extends CoreAction {
|
|
|
60
176
|
data: dat,
|
|
61
177
|
extension,
|
|
62
178
|
agent: new BaseUserAgent(req),
|
|
179
|
+
body,
|
|
63
180
|
});
|
|
64
181
|
}
|
|
65
182
|
catch (e) {
|
|
@@ -72,6 +189,18 @@ export default class BaseAction extends CoreAction {
|
|
|
72
189
|
}
|
|
73
190
|
else if (this.mode === ActionMode.DMZ_WITH_USER) {
|
|
74
191
|
try {
|
|
192
|
+
let body = null;
|
|
193
|
+
if (this.schema) {
|
|
194
|
+
body = this.bodyValidation(req);
|
|
195
|
+
}
|
|
196
|
+
if (isErrorType(body)) {
|
|
197
|
+
res.status(400).send(body);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (this.schema && body === null) {
|
|
201
|
+
res.sendStatus(400);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
75
204
|
await this.handler({
|
|
76
205
|
res,
|
|
77
206
|
req,
|
|
@@ -79,6 +208,7 @@ export default class BaseAction extends CoreAction {
|
|
|
79
208
|
data: null,
|
|
80
209
|
extension,
|
|
81
210
|
agent: new BaseUserAgent(req),
|
|
211
|
+
body,
|
|
82
212
|
});
|
|
83
213
|
}
|
|
84
214
|
catch (e) {
|
|
@@ -93,7 +223,7 @@ export default class BaseAction extends CoreAction {
|
|
|
93
223
|
res.sendStatus(dat);
|
|
94
224
|
}
|
|
95
225
|
else {
|
|
96
|
-
res.
|
|
226
|
+
res.sendStatus(401);
|
|
97
227
|
}
|
|
98
228
|
}
|
|
99
229
|
setMode(mode) {
|
|
@@ -11,7 +11,7 @@ export default class BaseApiAction extends BaseAction {
|
|
|
11
11
|
endpoint = this.exmod.getPresenter();
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
endpoint = this.getModule().getPresenter();
|
|
14
|
+
endpoint = this.getKernel().getModule().getPresenter();
|
|
15
15
|
}
|
|
16
16
|
if (endpoint) {
|
|
17
17
|
this.debug(`register ${this.type} ${this.getName()}`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IDataBase } from '@grandlinex/core';
|
|
2
|
+
import { IBaseAction, IBaseCache, IBaseClient, IBaseKernelModule, IBasePresenter, IKernel } from '../lib/index.js';
|
|
3
|
+
import BaseApiAction from './BaseApiAction.js';
|
|
4
|
+
export default abstract class RouteApiAction<K extends IKernel = IKernel, T extends IDataBase<any, any> | null = any, P extends IBaseClient | null = any, C extends IBaseCache | null = any, E extends IBasePresenter | null = any> extends BaseApiAction<K, T, P, C, E> implements IBaseAction<K, T, P, C, E> {
|
|
5
|
+
constructor(module: IBaseKernelModule<K, T, P, C, E>, extMod?: IBaseKernelModule<K>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getRouteMeta } from '../annotation/index.js';
|
|
2
|
+
import BaseApiAction from './BaseApiAction.js';
|
|
3
|
+
export default class RouteApiAction extends BaseApiAction {
|
|
4
|
+
constructor(module, extMod) {
|
|
5
|
+
super('GET', 'action', module, extMod);
|
|
6
|
+
this.exmod = extMod;
|
|
7
|
+
const meta = getRouteMeta(this);
|
|
8
|
+
if (!meta) {
|
|
9
|
+
throw this.lError('No route meta found for action');
|
|
10
|
+
}
|
|
11
|
+
const { type, path, mode, schema } = meta;
|
|
12
|
+
this.type = type;
|
|
13
|
+
this.channel = path;
|
|
14
|
+
if (mode) {
|
|
15
|
+
this.setMode(mode);
|
|
16
|
+
}
|
|
17
|
+
this.schema = schema ?? null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -3,9 +3,10 @@ import BaseAction, { ActionMode } from './BaseAction.js';
|
|
|
3
3
|
import BaseEndpoint, { keepRawBody } from './BaseEndpoint.js';
|
|
4
4
|
import BaseKernelModule from './BaseKernelModule.js';
|
|
5
5
|
import BaseApiAction from './BaseApiAction.js';
|
|
6
|
+
import RouteApiAction from './RouteApiAction.js';
|
|
6
7
|
import BaseAuthProvider from './BaseAuthProvider.js';
|
|
7
8
|
export * from './BaseAction.js';
|
|
8
9
|
export * from './BaseUserAgent.js';
|
|
9
10
|
export * from './BaseAuthProvider.js';
|
|
10
11
|
export * from './timing/index.js';
|
|
11
|
-
export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, BaseCache, BaseAction, BaseClient, BaseBridge, keepRawBody, ActionMode, };
|
|
12
|
+
export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, RouteApiAction, BaseCache, BaseAction, BaseClient, BaseBridge, keepRawBody, ActionMode, };
|
|
@@ -3,9 +3,10 @@ import BaseAction, { ActionMode } from './BaseAction.js';
|
|
|
3
3
|
import BaseEndpoint, { keepRawBody } from './BaseEndpoint.js';
|
|
4
4
|
import BaseKernelModule from './BaseKernelModule.js';
|
|
5
5
|
import BaseApiAction from './BaseApiAction.js';
|
|
6
|
+
import RouteApiAction from './RouteApiAction.js';
|
|
6
7
|
import BaseAuthProvider from './BaseAuthProvider.js';
|
|
7
8
|
export * from './BaseAction.js';
|
|
8
9
|
export * from './BaseUserAgent.js';
|
|
9
10
|
export * from './BaseAuthProvider.js';
|
|
10
11
|
export * from './timing/index.js';
|
|
11
|
-
export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, BaseCache, BaseAction, BaseClient, BaseBridge, keepRawBody, ActionMode, };
|
|
12
|
+
export { BaseLoopService, BaseAuthProvider, BaseKernelModule, BaseService, BaseApiAction, BaseEndpoint, BaseElement, RouteApiAction, BaseCache, BaseAction, BaseClient, BaseBridge, keepRawBody, ActionMode, };
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import Kernel from './Kernel.js';
|
|
|
6
6
|
import KernelModule from './KernelModule.js';
|
|
7
7
|
export * from './actions/index.js';
|
|
8
8
|
export * from './api/index.js';
|
|
9
|
+
export * from './annotation/index.js';
|
|
9
10
|
export * from './classes/index.js';
|
|
10
11
|
export * from './modules/crypto/index.js';
|
|
11
12
|
export * from './lib/index.js';
|
package/dist/mjs/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import Kernel from './Kernel.js';
|
|
|
6
6
|
import KernelModule from './KernelModule.js';
|
|
7
7
|
export * from './actions/index.js';
|
|
8
8
|
export * from './api/index.js';
|
|
9
|
+
export * from './annotation/index.js';
|
|
9
10
|
export * from './classes/index.js';
|
|
10
11
|
export * from './modules/crypto/index.js';
|
|
11
12
|
export * from './lib/index.js';
|
|
@@ -5,11 +5,12 @@ export type XRequest = express.Request & {
|
|
|
5
5
|
};
|
|
6
6
|
export type XResponse = express.Response;
|
|
7
7
|
export type XNextFc = express.NextFunction;
|
|
8
|
-
export type XActionEvent<G = JwtToken | null> = {
|
|
8
|
+
export type XActionEvent<G = JwtToken | null, B = any> = {
|
|
9
9
|
req: XRequest;
|
|
10
10
|
res: XResponse;
|
|
11
11
|
next: XNextFc;
|
|
12
12
|
data: G;
|
|
13
13
|
extension: IExtensionInterface;
|
|
14
14
|
agent: BaseUserAgent;
|
|
15
|
+
body: B;
|
|
15
16
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { CoreCryptoClient } from '@grandlinex/core';
|
|
2
|
+
import { type StringValue } from 'ms';
|
|
2
3
|
import { ICClient, IKernel } from '../../lib/index.js';
|
|
3
4
|
import { IAuthProvider, JwtExtend, JwtToken } from '../../classes/index.js';
|
|
4
5
|
import { XRequest } from '../../lib/express.js';
|
|
5
6
|
export default class CryptoClient<T extends JwtExtend = JwtExtend> extends CoreCryptoClient implements ICClient<T> {
|
|
6
7
|
protected authProvider: IAuthProvider<T> | null;
|
|
7
8
|
protected kernel: IKernel;
|
|
8
|
-
protected expiresIn:
|
|
9
|
+
protected expiresIn: StringValue;
|
|
9
10
|
constructor(key: string, kernel: IKernel);
|
|
10
11
|
setAuthProvider(provider: IAuthProvider<T>): boolean;
|
|
11
12
|
jwtVerifyAccessToken(token: string): Promise<JwtToken<T> | number>;
|
|
12
13
|
jwtDecodeAccessToken(token: string): JwtToken<T> | null;
|
|
13
|
-
jwtGenerateAccessToken(data: JwtToken<T>, extend?: Record<string, any>, expire?:
|
|
14
|
+
jwtGenerateAccessToken(data: JwtToken<T>, extend?: Record<string, any>, expire?: StringValue | number): Promise<string>;
|
|
14
15
|
apiTokenValidation(username: string, token: string, requestType: string): Promise<{
|
|
15
16
|
valid: boolean;
|
|
16
17
|
userId: string | null;
|
|
@@ -5,7 +5,8 @@ export default class CryptoClient extends CoreCryptoClient {
|
|
|
5
5
|
super(kernel, key);
|
|
6
6
|
this.kernel = kernel;
|
|
7
7
|
this.authProvider = null;
|
|
8
|
-
this.expiresIn = kernel.getConfigStore().get('JWT_EXPIRE') ||
|
|
8
|
+
this.expiresIn = (kernel.getConfigStore().get('JWT_EXPIRE') ||
|
|
9
|
+
'1 days');
|
|
9
10
|
}
|
|
10
11
|
setAuthProvider(provider) {
|
|
11
12
|
if (this.authProvider) {
|
package/package.json
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@grandlinex/kernel",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "GrandLineX is an out-of-the-box server framework on top of ExpressJs.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"import": {
|
|
9
|
-
"types": "./dist/mjs/index.d.ts",
|
|
10
|
-
"default": "./dist/mjs/index.js"
|
|
11
|
-
},
|
|
12
|
-
"require": {
|
|
13
|
-
"types": "./dist/cjs/index.d.ts",
|
|
14
|
-
"default": "./dist/cjs/index.js"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"types": "dist/cjs/index.d.ts",
|
|
19
|
-
"main": "dist/cjs/index.js",
|
|
20
|
-
"module": "dist/mjs/index.js",
|
|
21
|
-
"scripts": {
|
|
22
|
-
"buildprep": "npm run build-mjs && npm run build-cjs && npm run build-fix",
|
|
23
|
-
"build-mjs": "tsc",
|
|
24
|
-
"build-cjs": "tsc -p tsconfig-cjs.json",
|
|
25
|
-
"build-fix": "node ./node_modules/@grandlinex/core/fix.js",
|
|
26
|
-
"lint": "eslint src",
|
|
27
|
-
"test": "jest --runInBand ",
|
|
28
|
-
"run": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/tests/run.ts",
|
|
29
|
-
"pack-dev": "npm version -no-git-tag-version prerelease && npm run buildprep && npm pack",
|
|
30
|
-
"test-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./coverage\" --reporters=default --reporters=jest-junit",
|
|
31
|
-
"doc-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./docs/coverage\" --reporters=default --reporters=jest-junit",
|
|
32
|
-
"makeDocs": "typedoc",
|
|
33
|
-
"openDocs": "npm run makeDocs",
|
|
34
|
-
"makeSpec": "
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
"typescript",
|
|
38
|
-
"framework",
|
|
39
|
-
"express",
|
|
40
|
-
"orm",
|
|
41
|
-
"server",
|
|
42
|
-
"backend"
|
|
43
|
-
],
|
|
44
|
-
"author": {
|
|
45
|
-
"name": "Elschnagoo"
|
|
46
|
-
},
|
|
47
|
-
"license": "BSD-3-Clause",
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"@grandlinex/
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"@types/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"eslint": "
|
|
65
|
-
"eslint
|
|
66
|
-
"eslint-config-airbnb
|
|
67
|
-
"eslint-config-
|
|
68
|
-
"eslint-
|
|
69
|
-
"eslint-plugin-
|
|
70
|
-
"eslint-plugin-
|
|
71
|
-
"eslint-plugin-
|
|
72
|
-
"
|
|
73
|
-
"jest
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"ts-
|
|
77
|
-
"ts-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@grandlinex/kernel",
|
|
3
|
+
"version": "1.1.0-alpha.0",
|
|
4
|
+
"description": "GrandLineX is an out-of-the-box server framework on top of ExpressJs.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": {
|
|
9
|
+
"types": "./dist/mjs/index.d.ts",
|
|
10
|
+
"default": "./dist/mjs/index.js"
|
|
11
|
+
},
|
|
12
|
+
"require": {
|
|
13
|
+
"types": "./dist/cjs/index.d.ts",
|
|
14
|
+
"default": "./dist/cjs/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"types": "dist/cjs/index.d.ts",
|
|
19
|
+
"main": "dist/cjs/index.js",
|
|
20
|
+
"module": "dist/mjs/index.js",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"buildprep": "npm run build-mjs && npm run build-cjs && npm run build-fix",
|
|
23
|
+
"build-mjs": "tsc",
|
|
24
|
+
"build-cjs": "tsc -p tsconfig-cjs.json",
|
|
25
|
+
"build-fix": "node ./node_modules/@grandlinex/core/fix.js",
|
|
26
|
+
"lint": "eslint src",
|
|
27
|
+
"test": "jest --runInBand ",
|
|
28
|
+
"run": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/tests/run.ts",
|
|
29
|
+
"pack-dev": "npm version -no-git-tag-version prerelease && npm run buildprep && npm pack",
|
|
30
|
+
"test-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./coverage\" --reporters=default --reporters=jest-junit",
|
|
31
|
+
"doc-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./docs/coverage\" --reporters=default --reporters=jest-junit",
|
|
32
|
+
"makeDocs": "typedoc",
|
|
33
|
+
"openDocs": "npm run makeDocs",
|
|
34
|
+
"makeSpec": "swagger-mate"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"typescript",
|
|
38
|
+
"framework",
|
|
39
|
+
"express",
|
|
40
|
+
"orm",
|
|
41
|
+
"server",
|
|
42
|
+
"backend"
|
|
43
|
+
],
|
|
44
|
+
"author": {
|
|
45
|
+
"name": "Elschnagoo"
|
|
46
|
+
},
|
|
47
|
+
"license": "BSD-3-Clause",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"reflect-metadata": "0.2.2",
|
|
50
|
+
"@grandlinex/core": "1.1.0-alpha.0",
|
|
51
|
+
"@grandlinex/swagger-mate": "1.0.2",
|
|
52
|
+
"axios": "1.11.0",
|
|
53
|
+
"body-parser": "1.20.3",
|
|
54
|
+
"express": "5.1.0",
|
|
55
|
+
"jsonwebtoken": "9.0.2",
|
|
56
|
+
"@types/express": "5.0.3",
|
|
57
|
+
"@types/jsonwebtoken": "9.0.10",
|
|
58
|
+
"@types/ms": "2.1.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/jest": "29.5.14",
|
|
62
|
+
"@types/node": "22.15.20",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
64
|
+
"@typescript-eslint/parser": "7.18.0",
|
|
65
|
+
"eslint": "8.57.1",
|
|
66
|
+
"eslint-config-airbnb": "19.0.4",
|
|
67
|
+
"eslint-config-airbnb-typescript": "18.0.0",
|
|
68
|
+
"eslint-config-prettier": "9.1.0",
|
|
69
|
+
"eslint-plugin-import": "2.29.1",
|
|
70
|
+
"eslint-plugin-jest": "28.6.0",
|
|
71
|
+
"eslint-plugin-jsx-a11y": "6.9.0",
|
|
72
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
73
|
+
"jest": "29.7.0",
|
|
74
|
+
"jest-junit": "16.0.0",
|
|
75
|
+
"prettier": "3.5.3",
|
|
76
|
+
"ts-jest": "29.3.4",
|
|
77
|
+
"ts-loader": "9.5.2",
|
|
78
|
+
"ts-node": "10.9.2",
|
|
79
|
+
"typedoc": "0.28.10",
|
|
80
|
+
"typescript": "5.9.2"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=22.0.0"
|
|
84
|
+
},
|
|
85
|
+
"repository": {
|
|
86
|
+
"type": "git",
|
|
87
|
+
"url": "https://github.com/GrandlineX/kernel.git"
|
|
88
|
+
}
|
|
89
|
+
}
|
package/tsconfig-cjs.json
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "react",
|
|
4
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
5
|
-
"baseUrl": "./src",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
/* Basic Options */
|
|
8
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
9
|
-
"target": "ES2020",
|
|
10
|
-
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
11
|
-
"module": "commonjs",
|
|
12
|
-
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
13
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
14
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
15
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
16
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
|
17
|
-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
18
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
19
|
-
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
20
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
21
|
-
"outDir": "./dist/cjs", /* Redirect output structure to the directory. */
|
|
22
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
23
|
-
// "composite": true, /* Enable project compilation */
|
|
24
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
25
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
26
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
27
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
28
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
29
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
30
|
-
|
|
31
|
-
/* Strict Type-Checking Options */
|
|
32
|
-
"strict": true,
|
|
33
|
-
/* Enable all strict type-checking options. */
|
|
34
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
35
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
36
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
37
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
38
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
39
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
40
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
41
|
-
|
|
42
|
-
/* Additional Checks */
|
|
43
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
44
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
45
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
46
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
47
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
48
|
-
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
49
|
-
|
|
50
|
-
/* Module Resolution Options */
|
|
51
|
-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
52
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
53
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
54
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
55
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
56
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
57
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
58
|
-
"esModuleInterop": true,
|
|
59
|
-
/* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
60
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
61
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
62
|
-
|
|
63
|
-
/* Source Map Options */
|
|
64
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
65
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
67
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
68
|
-
|
|
69
|
-
/* Experimental Options */
|
|
70
|
-
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
71
|
-
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
72
|
-
|
|
73
|
-
/* Advanced Options */
|
|
74
|
-
"skipLibCheck": true,
|
|
75
|
-
/* Skip type checking of declaration files. */
|
|
76
|
-
"forceConsistentCasingInFileNames": true
|
|
77
|
-
/* Disallow inconsistently-cased references to the same file. */
|
|
78
|
-
},
|
|
79
|
-
"exclude": [
|
|
80
|
-
"node_modules",
|
|
81
|
-
"dist",
|
|
82
|
-
"data",
|
|
83
|
-
"src/tests"
|
|
84
|
-
],
|
|
85
|
-
"typedocOptions": {
|
|
86
|
-
"entryPoints": [
|
|
87
|
-
"./src"
|
|
88
|
-
],
|
|
89
|
-
"out": "docs",
|
|
90
|
-
"exclude": "node_modules"
|
|
91
|
-
}
|
|
92
|
-
}
|