@grandlinex/kernel 1.1.0-alpha.0 → 1.2.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/actions/ApiAuthTestAction.js +6 -12
- package/dist/cjs/actions/ApiVersionAction.js +14 -18
- package/dist/cjs/actions/GetTokenAction.js +26 -31
- package/dist/cjs/classes/BaseAction.d.ts +3 -7
- package/dist/cjs/classes/BaseAction.js +21 -19
- package/dist/cjs/classes/BaseApiAction.d.ts +2 -1
- package/dist/cjs/classes/RouteApiAction.js +7 -7
- package/dist/cjs/classes/index.d.ts +2 -2
- package/dist/cjs/classes/index.js +2 -3
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/lib/express.d.ts +2 -0
- package/dist/cjs/lib/index.d.ts +0 -1
- package/dist/mjs/actions/ApiAuthTestAction.js +7 -13
- package/dist/mjs/actions/ApiVersionAction.js +16 -20
- package/dist/mjs/actions/GetTokenAction.js +28 -33
- package/dist/mjs/classes/BaseAction.d.ts +3 -7
- package/dist/mjs/classes/BaseAction.js +19 -16
- package/dist/mjs/classes/BaseApiAction.d.ts +2 -1
- package/dist/mjs/classes/RouteApiAction.js +7 -7
- package/dist/mjs/classes/index.d.ts +2 -2
- package/dist/mjs/classes/index.js +2 -2
- package/dist/mjs/index.d.ts +0 -1
- package/dist/mjs/index.js +0 -1
- package/dist/mjs/lib/express.d.ts +2 -0
- package/dist/mjs/lib/index.d.ts +0 -1
- package/package.json +89 -89
- package/dist/cjs/annotation/index.d.ts +0 -13
- package/dist/cjs/annotation/index.js +0 -21
- package/dist/mjs/annotation/index.d.ts +0 -13
- package/dist/mjs/annotation/index.js +0 -16
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
+
import { ErrorType } from '@grandlinex/swagger-mate';
|
|
2
3
|
import { BaseUserAgent, IExtensionInterface, JwtToken } from '../classes/index.js';
|
|
3
4
|
export type XRequest = express.Request & {
|
|
4
5
|
rawBody?: string | null;
|
|
@@ -13,4 +14,5 @@ export type XActionEvent<G = JwtToken | null, B = any> = {
|
|
|
13
14
|
extension: IExtensionInterface;
|
|
14
15
|
agent: BaseUserAgent;
|
|
15
16
|
body: B;
|
|
17
|
+
sendError: (code: number, error: Partial<ErrorType>) => void;
|
|
16
18
|
};
|
package/dist/mjs/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { IAuthProvider, JwtExtend, JwtToken } from '../classes/index.js';
|
|
|
5
5
|
import EntitySchemaExtender from './EntitySchemaExtender.js';
|
|
6
6
|
import { XActionEvent, XRequest } from './express.js';
|
|
7
7
|
export { EntitySchemaExtender };
|
|
8
|
-
export type ActionTypes = 'POST' | 'GET' | 'USE' | 'PATCH' | 'DELETE';
|
|
9
8
|
export interface ICClient<T extends JwtExtend = JwtExtend> extends ICoreCClient {
|
|
10
9
|
setAuthProvider(provider: IAuthProvider<T>): boolean;
|
|
11
10
|
jwtVerifyAccessToken(token: string): Promise<JwtToken<T> | number>;
|
package/package.json
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@grandlinex/kernel",
|
|
3
|
-
"version": "1.
|
|
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
|
-
"
|
|
50
|
-
"@grandlinex/
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@grandlinex/kernel",
|
|
3
|
+
"version": "1.2.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
|
+
"@grandlinex/core": "1.2.0",
|
|
50
|
+
"@grandlinex/swagger-mate": "1.2.0",
|
|
51
|
+
"@types/express": "5.0.3",
|
|
52
|
+
"@types/jsonwebtoken": "9.0.10",
|
|
53
|
+
"@types/ms": "2.1.0",
|
|
54
|
+
"axios": "1.11.0",
|
|
55
|
+
"body-parser": "1.20.3",
|
|
56
|
+
"express": "5.1.0",
|
|
57
|
+
"jsonwebtoken": "9.0.2",
|
|
58
|
+
"reflect-metadata": "0.2.2"
|
|
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
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { ObjectLike } from '@grandlinex/core';
|
|
3
|
-
import { SSchemaEl } from '@grandlinex/swagger-mate';
|
|
4
|
-
import { ActionTypes } from '../lib/index.js';
|
|
5
|
-
import { ActionMode } from '../classes/index.js';
|
|
6
|
-
export type RouteMeta = {
|
|
7
|
-
type: ActionTypes;
|
|
8
|
-
path: string;
|
|
9
|
-
mode?: ActionMode;
|
|
10
|
-
schema?: SSchemaEl;
|
|
11
|
-
};
|
|
12
|
-
export declare const Route: (type: ActionTypes, path: string, mode?: ActionMode, schema?: SSchemaEl) => ClassDecorator;
|
|
13
|
-
export declare function getRouteMeta<T extends ObjectLike>(target: T): RouteMeta | undefined;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Route = void 0;
|
|
4
|
-
exports.getRouteMeta = getRouteMeta;
|
|
5
|
-
require("reflect-metadata");
|
|
6
|
-
const routeKey = Symbol('route');
|
|
7
|
-
const Route = (type, path, mode, schema) => {
|
|
8
|
-
return (target) => {
|
|
9
|
-
const metadata = {
|
|
10
|
-
type,
|
|
11
|
-
path,
|
|
12
|
-
mode,
|
|
13
|
-
schema,
|
|
14
|
-
};
|
|
15
|
-
Reflect.defineMetadata(routeKey, metadata, target.prototype);
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.Route = Route;
|
|
19
|
-
function getRouteMeta(target) {
|
|
20
|
-
return Reflect.getMetadata(routeKey, target.constructor.prototype);
|
|
21
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { ObjectLike } from '@grandlinex/core';
|
|
3
|
-
import { SSchemaEl } from '@grandlinex/swagger-mate';
|
|
4
|
-
import { ActionTypes } from '../lib/index.js';
|
|
5
|
-
import { ActionMode } from '../classes/index.js';
|
|
6
|
-
export type RouteMeta = {
|
|
7
|
-
type: ActionTypes;
|
|
8
|
-
path: string;
|
|
9
|
-
mode?: ActionMode;
|
|
10
|
-
schema?: SSchemaEl;
|
|
11
|
-
};
|
|
12
|
-
export declare const Route: (type: ActionTypes, path: string, mode?: ActionMode, schema?: SSchemaEl) => ClassDecorator;
|
|
13
|
-
export declare function getRouteMeta<T extends ObjectLike>(target: T): RouteMeta | undefined;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
const routeKey = Symbol('route');
|
|
3
|
-
export const Route = (type, path, mode, schema) => {
|
|
4
|
-
return (target) => {
|
|
5
|
-
const metadata = {
|
|
6
|
-
type,
|
|
7
|
-
path,
|
|
8
|
-
mode,
|
|
9
|
-
schema,
|
|
10
|
-
};
|
|
11
|
-
Reflect.defineMetadata(routeKey, metadata, target.prototype);
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export function getRouteMeta(target) {
|
|
15
|
-
return Reflect.getMetadata(routeKey, target.constructor.prototype);
|
|
16
|
-
}
|