@avleon/core 0.0.44 → 0.0.46
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/License +21 -21
- package/README.md +667 -681
- package/dist/application.test.js +15 -0
- package/dist/controller.test.js +0 -14
- package/dist/core/application.d.ts +74 -0
- package/dist/core/application.js +424 -0
- package/dist/core/router.d.ts +44 -0
- package/dist/core/router.js +520 -0
- package/dist/core/testing.d.ts +21 -0
- package/dist/core/testing.js +104 -0
- package/dist/core/types.d.ts +67 -0
- package/dist/core/types.js +2 -0
- package/dist/event-dispatcher.d.ts +0 -1
- package/dist/event-dispatcher.js +4 -7
- package/dist/file-storage.test.js +15 -2
- package/dist/helpers.d.ts +9 -42
- package/dist/helpers.js +19 -411
- package/dist/index.d.ts +17 -15
- package/dist/index.js +18 -22
- package/dist/interfaces/avleon-application.d.ts +74 -26
- package/dist/interfaces/avleon-application.js +1 -0
- package/dist/middleware.d.ts +11 -4
- package/dist/middleware.js +9 -0
- package/dist/multipart.d.ts +2 -2
- package/dist/openapi.d.ts +70 -3
- package/dist/openapi.js +32 -0
- package/dist/params.js +1 -6
- package/dist/params.test.js +8 -8
- package/dist/queue.d.ts +27 -36
- package/dist/queue.js +67 -99
- package/dist/route-methods.js +16 -5
- package/dist/swagger-schema.d.ts +11 -17
- package/dist/swagger-schema.js +84 -82
- package/dist/swagger-schema.test.js +32 -12
- package/dist/utils/common-utils.d.ts +17 -0
- package/dist/utils/common-utils.js +108 -0
- package/dist/utils/di-utils.d.ts +1 -0
- package/dist/utils/di-utils.js +22 -0
- package/dist/utils/hash.d.ts +0 -2
- package/dist/utils/hash.js +1 -5
- package/dist/utils/object-utils.d.ts +11 -0
- package/dist/utils/object-utils.js +198 -0
- package/dist/utils/validation-utils.d.ts +13 -0
- package/dist/utils/validation-utils.js +119 -0
- package/dist/validation.js +1 -4
- package/dist/websocket.d.ts +3 -0
- package/dist/websocket.js +2 -1
- package/package.json +53 -39
- package/dist/application.d.ts +0 -47
- package/dist/application.js +0 -50
- package/dist/icore.d.ts +0 -226
- package/dist/icore.js +0 -968
- package/dist/icore.test.js +0 -14
- package/dist/queue.test.d.ts +0 -1
- package/dist/queue.test.js +0 -79
- package/dist/testing.d.ts +0 -55
- package/dist/testing.js +0 -196
- /package/dist/{icore.test.d.ts → application.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avleon/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
|
+
"description": "TypeScript-first web framework built on Fastify",
|
|
5
|
+
"author": "Tareq Hossain",
|
|
6
|
+
"license": "ISC",
|
|
4
7
|
"main": "./dist/index.js",
|
|
5
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
6
14
|
"keywords": [
|
|
7
15
|
"restapi",
|
|
8
16
|
"avleon",
|
|
9
17
|
"backend",
|
|
10
|
-
"fastify"
|
|
11
|
-
|
|
12
|
-
"author": "Tareq Hossain",
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"description": "avleon core",
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/avleonjs/avleon-core"
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist"
|
|
18
|
+
"fastify",
|
|
19
|
+
"typescript"
|
|
21
20
|
],
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "npm run clean && tsc",
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"watch": "tsc-watch",
|
|
26
|
+
"lint": "eslint .",
|
|
27
|
+
"lint:fix": "eslint . --fix",
|
|
28
|
+
"format": "prettier --write .",
|
|
29
|
+
"test": "jest",
|
|
30
|
+
"test:watch": "jest --watch",
|
|
31
|
+
"husky:init": "husky install"
|
|
24
32
|
},
|
|
25
33
|
"dependencies": {
|
|
26
34
|
"class-transformer": "^0.5.1",
|
|
27
35
|
"class-validator": "^0.14.2",
|
|
28
36
|
"fastify": "^5.1.0",
|
|
29
|
-
"mime": "^
|
|
30
|
-
"pino": "^9.10.0",
|
|
31
|
-
"pino-pretty": "^13.1.1",
|
|
37
|
+
"mime": "^3.0.0",
|
|
32
38
|
"reflect-metadata": "^0.2.2",
|
|
33
39
|
"typedi": "^0.10.0"
|
|
34
40
|
},
|
|
@@ -41,23 +47,23 @@
|
|
|
41
47
|
"@fastify/view": "^11.0.0",
|
|
42
48
|
"@scalar/fastify-api-reference": "*",
|
|
43
49
|
"bcryptjs": "3.0.2",
|
|
50
|
+
"bull": "^4.16.5",
|
|
44
51
|
"dotenv": "*",
|
|
45
52
|
"fastify-socket.io": "^4.0.0",
|
|
46
53
|
"highlight.js": "*",
|
|
47
54
|
"ioredis": "*",
|
|
48
55
|
"knex": "*",
|
|
49
|
-
"mssql": "
|
|
56
|
+
"mssql": ">=9.0.0",
|
|
50
57
|
"mysql2": "*",
|
|
51
58
|
"pg": "*",
|
|
59
|
+
"pino": "^9.0.0",
|
|
60
|
+
"pino-pretty": "^13.0.0",
|
|
52
61
|
"sharp": "*",
|
|
53
62
|
"socket.io": "*",
|
|
54
63
|
"sqlite3": "*",
|
|
55
64
|
"typeorm": "*"
|
|
56
65
|
},
|
|
57
66
|
"peerDependenciesMeta": {
|
|
58
|
-
"bcryptjs": {
|
|
59
|
-
"optional": true
|
|
60
|
-
},
|
|
61
67
|
"@fastify/cors": {
|
|
62
68
|
"optional": true
|
|
63
69
|
},
|
|
@@ -79,13 +85,22 @@
|
|
|
79
85
|
"@scalar/fastify-api-reference": {
|
|
80
86
|
"optional": true
|
|
81
87
|
},
|
|
82
|
-
"
|
|
88
|
+
"bcryptjs": {
|
|
83
89
|
"optional": true
|
|
84
90
|
},
|
|
85
|
-
"
|
|
91
|
+
"bull": {
|
|
86
92
|
"optional": true
|
|
87
93
|
},
|
|
88
|
-
"
|
|
94
|
+
"dotenv": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"fastify-socket.io": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"highlight.js": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"ioredis": {
|
|
89
104
|
"optional": true
|
|
90
105
|
},
|
|
91
106
|
"knex": {
|
|
@@ -100,19 +115,22 @@
|
|
|
100
115
|
"pg": {
|
|
101
116
|
"optional": true
|
|
102
117
|
},
|
|
103
|
-
"
|
|
118
|
+
"pino": {
|
|
104
119
|
"optional": true
|
|
105
120
|
},
|
|
106
|
-
"
|
|
121
|
+
"pino-pretty": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"sharp": {
|
|
107
125
|
"optional": true
|
|
108
126
|
},
|
|
109
127
|
"socket.io": {
|
|
110
128
|
"optional": true
|
|
111
129
|
},
|
|
112
|
-
"
|
|
130
|
+
"sqlite3": {
|
|
113
131
|
"optional": true
|
|
114
132
|
},
|
|
115
|
-
"
|
|
133
|
+
"typeorm": {
|
|
116
134
|
"optional": true
|
|
117
135
|
}
|
|
118
136
|
},
|
|
@@ -140,15 +158,11 @@
|
|
|
140
158
|
"cross-env CI=true jest --bail --findRelatedTests --passWithNoTests --config=jest.config.js"
|
|
141
159
|
]
|
|
142
160
|
},
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
"format": "prettier --write .",
|
|
150
|
-
"test": "jest",
|
|
151
|
-
"test:watch": "jest --watch",
|
|
152
|
-
"husky:init": "husky install"
|
|
161
|
+
"repository": {
|
|
162
|
+
"type": "git",
|
|
163
|
+
"url": "git+https://github.com/avleonjs/avleon-core"
|
|
164
|
+
},
|
|
165
|
+
"publishConfig": {
|
|
166
|
+
"access": "public"
|
|
153
167
|
}
|
|
154
|
-
}
|
|
168
|
+
}
|
package/dist/application.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "./helpers";
|
|
2
|
-
import { RouteShorthandMethod } from "fastify";
|
|
3
|
-
export interface AvleonApplication {
|
|
4
|
-
useCors: () => void;
|
|
5
|
-
useOpenApi: () => void;
|
|
6
|
-
useView: () => void;
|
|
7
|
-
useAuth: () => void;
|
|
8
|
-
useMultipart: () => void;
|
|
9
|
-
useDataSource: () => void;
|
|
10
|
-
useMiddlewares: () => void;
|
|
11
|
-
useControllers: () => void;
|
|
12
|
-
useAutoControllers: () => void;
|
|
13
|
-
useStaticFiles: () => void;
|
|
14
|
-
useCustomErrorHandler: () => void;
|
|
15
|
-
mapGroup: () => any;
|
|
16
|
-
mapGet: () => any;
|
|
17
|
-
mapPost: () => any;
|
|
18
|
-
mapPut: () => any;
|
|
19
|
-
mapPatch: () => any;
|
|
20
|
-
mapDelete: () => any;
|
|
21
|
-
mapView: () => any;
|
|
22
|
-
run: (port: number) => void;
|
|
23
|
-
}
|
|
24
|
-
export interface InlineRoutes {
|
|
25
|
-
get: RouteShorthandMethod;
|
|
26
|
-
post: RouteShorthandMethod;
|
|
27
|
-
put: RouteShorthandMethod;
|
|
28
|
-
patch: RouteShorthandMethod;
|
|
29
|
-
delete: RouteShorthandMethod;
|
|
30
|
-
}
|
|
31
|
-
export interface Application {
|
|
32
|
-
inlineRoutes: () => InlineRoutes;
|
|
33
|
-
mapGroup: (path?: string | RegExp) => InlineRoutes;
|
|
34
|
-
/**
|
|
35
|
-
* Start the application
|
|
36
|
-
* @param port
|
|
37
|
-
* @returns void
|
|
38
|
-
*/
|
|
39
|
-
start: (port?: number) => void;
|
|
40
|
-
}
|
|
41
|
-
export interface TestApplication {
|
|
42
|
-
getController: <T>(controller: Constructor<T>) => T;
|
|
43
|
-
}
|
|
44
|
-
export declare class Builder {
|
|
45
|
-
static createApplication(): Application;
|
|
46
|
-
static createTestApplication(app?: Application): TestApplication;
|
|
47
|
-
}
|
package/dist/application.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Builder = void 0;
|
|
7
|
-
const typedi_1 = __importDefault(require("typedi"));
|
|
8
|
-
const fastify_1 = __importDefault(require("fastify"));
|
|
9
|
-
class IqraTestApplication {
|
|
10
|
-
getController(controller) {
|
|
11
|
-
const con = typedi_1.default.get(controller);
|
|
12
|
-
return con;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class IqraApplication {
|
|
16
|
-
constructor() {
|
|
17
|
-
if (!this.app) {
|
|
18
|
-
this.app = fastify_1.default.prototype;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
inlineRoutes() {
|
|
22
|
-
return {
|
|
23
|
-
get: this.app.get,
|
|
24
|
-
post: this.app.post,
|
|
25
|
-
put: this.app.put,
|
|
26
|
-
patch: this.app.patch,
|
|
27
|
-
delete: this.app.delete,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
mapGroup(path) {
|
|
31
|
-
return this.inlineRoutes();
|
|
32
|
-
}
|
|
33
|
-
start(port) {
|
|
34
|
-
const p = port ? port : 4000;
|
|
35
|
-
this.app.listen({ port: p });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
class Builder {
|
|
39
|
-
static createApplication() {
|
|
40
|
-
const app = new IqraApplication();
|
|
41
|
-
return app;
|
|
42
|
-
}
|
|
43
|
-
static createTestApplication(app) {
|
|
44
|
-
const testApp = new IqraTestApplication();
|
|
45
|
-
return testApp;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.Builder = Builder;
|
|
49
|
-
const app = Builder.createApplication();
|
|
50
|
-
const route = app.inlineRoutes();
|
package/dist/icore.d.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright 2024
|
|
3
|
-
* @author Tareq Hossain
|
|
4
|
-
* @email xtrinsic96@gmail.com
|
|
5
|
-
* @url https://github.com/xtareq
|
|
6
|
-
*/
|
|
7
|
-
import { FastifyReply, FastifyRequest, HookHandlerDoneFunction, InjectOptions, LightMyRequestResponse, FastifyLoggerOptions } from "fastify";
|
|
8
|
-
import { Constructable } from "typedi";
|
|
9
|
-
import { Constructor } from "./helpers";
|
|
10
|
-
import { PathLike } from "fs";
|
|
11
|
-
import { DataSource, DataSourceOptions } from "typeorm";
|
|
12
|
-
import { AvleonMiddleware } from "./middleware";
|
|
13
|
-
import { OpenApiOptions, OpenApiUiOptions } from "./openapi";
|
|
14
|
-
import { IConfig } from "./config";
|
|
15
|
-
import { FastifyCorsOptions } from "@fastify/cors";
|
|
16
|
-
import { FastifyMultipartOptions } from "@fastify/multipart";
|
|
17
|
-
import { MultipartFile } from "./multipart";
|
|
18
|
-
import { ServerOptions } from "socket.io";
|
|
19
|
-
import { Knex } from "knex";
|
|
20
|
-
export type FuncRoute = {
|
|
21
|
-
handler: any;
|
|
22
|
-
middlewares?: any[];
|
|
23
|
-
schema?: {};
|
|
24
|
-
};
|
|
25
|
-
export interface IRequest extends FastifyRequest {
|
|
26
|
-
params: any;
|
|
27
|
-
query: any;
|
|
28
|
-
body: any;
|
|
29
|
-
headers: any;
|
|
30
|
-
user?: any;
|
|
31
|
-
}
|
|
32
|
-
export interface DoneFunction extends HookHandlerDoneFunction {
|
|
33
|
-
}
|
|
34
|
-
export interface IResponse extends FastifyReply {
|
|
35
|
-
}
|
|
36
|
-
export type TestResponseType = LightMyRequestResponse;
|
|
37
|
-
export type TestResponse = TestResponseType | Promise<TestResponseType>;
|
|
38
|
-
export interface TestApplication {
|
|
39
|
-
get: (url: string, options?: InjectOptions) => TestResponse;
|
|
40
|
-
post: (url: string, options?: InjectOptions) => TestResponse;
|
|
41
|
-
put: (url: string, options?: InjectOptions) => TestResponse;
|
|
42
|
-
patch: (url: string, options?: InjectOptions) => TestResponse;
|
|
43
|
-
delete: (url: string, options?: InjectOptions) => TestResponse;
|
|
44
|
-
options: (url: string, options?: InjectOptions) => TestResponse;
|
|
45
|
-
getController?: <T>(controller: Constructor<T>) => T;
|
|
46
|
-
}
|
|
47
|
-
export interface ParamMetaOptions {
|
|
48
|
-
index: number;
|
|
49
|
-
key: string;
|
|
50
|
-
name: string;
|
|
51
|
-
required: boolean;
|
|
52
|
-
validate: boolean;
|
|
53
|
-
dataType: any;
|
|
54
|
-
validatorClass: boolean;
|
|
55
|
-
schema?: any;
|
|
56
|
-
type: "route:param" | "route:query" | "route:body" | "route:header" | "route:user" | "route:file" | "route:files";
|
|
57
|
-
}
|
|
58
|
-
export interface ParamMetaFilesOptions {
|
|
59
|
-
index: number;
|
|
60
|
-
type: "route:files";
|
|
61
|
-
files: MultipartFile[];
|
|
62
|
-
fieldName: string;
|
|
63
|
-
}
|
|
64
|
-
export interface MethodParamMeta {
|
|
65
|
-
request: any[];
|
|
66
|
-
params: ParamMetaOptions[];
|
|
67
|
-
query: ParamMetaOptions[];
|
|
68
|
-
body: ParamMetaOptions[];
|
|
69
|
-
headers: ParamMetaOptions[];
|
|
70
|
-
currentUser: ParamMetaOptions[];
|
|
71
|
-
swagger?: OpenApiUiOptions;
|
|
72
|
-
file?: any[];
|
|
73
|
-
files?: ParamMetaFilesOptions[];
|
|
74
|
-
}
|
|
75
|
-
type StaticFileOptions = {
|
|
76
|
-
path?: PathLike;
|
|
77
|
-
prefix?: string;
|
|
78
|
-
};
|
|
79
|
-
type MultipartOptions = {
|
|
80
|
-
destination: PathLike;
|
|
81
|
-
} & FastifyMultipartOptions;
|
|
82
|
-
export type TestAppOptions = {
|
|
83
|
-
controllers: Constructor[];
|
|
84
|
-
dataSource?: DataSource;
|
|
85
|
-
};
|
|
86
|
-
export interface AvleonTestAppliction {
|
|
87
|
-
addDataSource: (dataSourceOptions: DataSourceOptions) => void;
|
|
88
|
-
getApp: (options?: TestAppOptions) => any;
|
|
89
|
-
getController: <T>(controller: Constructor<T>, deps: any[]) => T;
|
|
90
|
-
}
|
|
91
|
-
export type AutoControllerOptions = {
|
|
92
|
-
auto: true;
|
|
93
|
-
path?: string;
|
|
94
|
-
};
|
|
95
|
-
export interface IAvleonApplication {
|
|
96
|
-
isDevelopment(): boolean;
|
|
97
|
-
useCors(corsOptions?: FastifyCorsOptions): void;
|
|
98
|
-
useDataSource<T extends IConfig<R>, R = ReturnType<InstanceType<Constructable<T>>["config"]>>(ConfigClass: Constructable<T>, modifyConfig?: (config: R) => R): void;
|
|
99
|
-
useOpenApi<T extends IConfig<R>, R = ReturnType<InstanceType<Constructable<T>>["config"]>>(ConfigClass: Constructable<T>, modifyConfig?: (config: R) => R): void;
|
|
100
|
-
useMultipart(options: MultipartOptions): void;
|
|
101
|
-
useCache(options: any): void;
|
|
102
|
-
useMiddlewares<T extends AvleonMiddleware>(mclasses: Constructor<T>[]): void;
|
|
103
|
-
useAuthoriztion<T extends any>(middleware: Constructor<T>): void;
|
|
104
|
-
mapRoute<T extends (...args: any[]) => any>(method: "get" | "post" | "put" | "delete", path: string, fn: T): Promise<void>;
|
|
105
|
-
mapGet<T extends (...args: any[]) => any>(path: string, fn: T): any;
|
|
106
|
-
mapPost<T extends (...args: any[]) => any>(path: string, fn: T): any;
|
|
107
|
-
mapPut<T extends (...args: any[]) => any>(path: string, fn: T): any;
|
|
108
|
-
mapDelete<T extends (...args: any[]) => any>(path: string, fn: T): any;
|
|
109
|
-
useControllers(controllers: any[]): any;
|
|
110
|
-
useControllers(controllersOptions: AutoControllerOptions): any;
|
|
111
|
-
useControllers(controllersOrOptions: any[] | AutoControllerOptions): any;
|
|
112
|
-
useStaticFiles(options?: StaticFileOptions): void;
|
|
113
|
-
run(port?: number): Promise<void>;
|
|
114
|
-
getTestApp(): TestApplication;
|
|
115
|
-
}
|
|
116
|
-
type OpenApiConfigClass<T = any> = Constructable<IConfig<T>>;
|
|
117
|
-
type OpenApiConfigInput<T = any> = OpenApiConfigClass<T> | T;
|
|
118
|
-
type ConfigClass<T = any> = Constructable<IConfig<T>>;
|
|
119
|
-
type ConfigInput<T = any> = ConfigClass<T> | T;
|
|
120
|
-
export declare class AvleonApplication {
|
|
121
|
-
private static instance;
|
|
122
|
-
private static buildOptions;
|
|
123
|
-
private app;
|
|
124
|
-
private routeSet;
|
|
125
|
-
private alreadyRun;
|
|
126
|
-
private routes;
|
|
127
|
-
private middlewares;
|
|
128
|
-
private rMap;
|
|
129
|
-
private hasSwagger;
|
|
130
|
-
private _hasWebsocket;
|
|
131
|
-
private globalSwaggerOptions;
|
|
132
|
-
private dataSourceOptions?;
|
|
133
|
-
private controllers;
|
|
134
|
-
private authorizeMiddleware?;
|
|
135
|
-
private appConfig;
|
|
136
|
-
private dataSource?;
|
|
137
|
-
private isMapFeatures;
|
|
138
|
-
private registerControllerAuto;
|
|
139
|
-
private registerControllerPath;
|
|
140
|
-
private metaCache;
|
|
141
|
-
private multipartOptions;
|
|
142
|
-
private constructor();
|
|
143
|
-
static getApp(): AvleonApplication;
|
|
144
|
-
static getInternalApp(buildOptions: any): AvleonApplication;
|
|
145
|
-
useLogger<T = FastifyLoggerOptions>(corsOptions?: ConfigInput<T>): void;
|
|
146
|
-
isDevelopment(): boolean;
|
|
147
|
-
private initSwagger;
|
|
148
|
-
private _isConfigClass;
|
|
149
|
-
useCors<T = FastifyCorsOptions>(corsOptions?: ConfigInput<T>): void;
|
|
150
|
-
useWebSocket<T = Partial<ServerOptions>>(socketOptions: ConfigInput<T>): void;
|
|
151
|
-
useSocketIO<T = Partial<ServerOptions>>(socketOptions: ConfigInput<T>): void;
|
|
152
|
-
private _initWebSocket;
|
|
153
|
-
useOpenApi<T = OpenApiUiOptions>(configOrClass: OpenApiConfigInput<T>): void;
|
|
154
|
-
useMultipart<T extends MultipartOptions>(options: ConfigInput<T>): void;
|
|
155
|
-
useDataSource<T extends DataSourceOptions>(options: ConfigInput<T>): void;
|
|
156
|
-
useKnex<T extends Knex.Config>(options: ConfigInput<T>): void;
|
|
157
|
-
private _useCache;
|
|
158
|
-
useMiddlewares<T extends AvleonMiddleware>(mclasses: Constructor<T>[]): void;
|
|
159
|
-
useAuthoriztion<T extends any>(middleware: Constructor<T>): void;
|
|
160
|
-
useStaticFiles(options?: StaticFileOptions): void;
|
|
161
|
-
private handleMiddlewares;
|
|
162
|
-
private executeMiddlewares;
|
|
163
|
-
/**
|
|
164
|
-
* build controller
|
|
165
|
-
* @param controller
|
|
166
|
-
* @returns void
|
|
167
|
-
*/
|
|
168
|
-
private buildController;
|
|
169
|
-
/**
|
|
170
|
-
* Maps request data to controller method arguments based on decorators
|
|
171
|
-
* @param req - The incoming request object
|
|
172
|
-
* @param meta - Metadata about method parameters
|
|
173
|
-
* @returns Array of arguments to pass to the controller method
|
|
174
|
-
*/
|
|
175
|
-
private _mapArgs;
|
|
176
|
-
/**
|
|
177
|
-
* Process Meta for controlelr class methods
|
|
178
|
-
* @param prototype
|
|
179
|
-
* @param method
|
|
180
|
-
* @returns
|
|
181
|
-
*/
|
|
182
|
-
private _processMeta;
|
|
183
|
-
private _resolveControllerDir;
|
|
184
|
-
private autoControllers;
|
|
185
|
-
useControllers(controllers: Constructor[] | AutoControllerOptions): void;
|
|
186
|
-
private _mapControllers;
|
|
187
|
-
private mapFn;
|
|
188
|
-
private _handleError;
|
|
189
|
-
mapRoute<T extends (...args: any[]) => any>(method: "get" | "post" | "put" | "delete", path: string | undefined, fn: T): Promise<void>;
|
|
190
|
-
private _routeHandler;
|
|
191
|
-
mapGet<T extends (...args: any[]) => any>(path: string | undefined, fn: T): {
|
|
192
|
-
useMiddleware: <M extends AvleonMiddleware>(middlewares: Constructor<AvleonMiddleware>[]) => /*elided*/ any;
|
|
193
|
-
useOpenApi: (options: OpenApiOptions) => /*elided*/ any;
|
|
194
|
-
};
|
|
195
|
-
mapPost<T extends (...args: any[]) => any>(path: string | undefined, fn: T): {
|
|
196
|
-
useMiddleware: <M extends AvleonMiddleware>(middlewares: Constructor<AvleonMiddleware>[]) => /*elided*/ any;
|
|
197
|
-
useOpenApi: (options: OpenApiOptions) => /*elided*/ any;
|
|
198
|
-
};
|
|
199
|
-
mapPut<T extends (...args: any[]) => any>(path: string | undefined, fn: T): {
|
|
200
|
-
useMiddleware: <M extends AvleonMiddleware>(middlewares: Constructor<AvleonMiddleware>[]) => /*elided*/ any;
|
|
201
|
-
useOpenApi: (options: OpenApiOptions) => /*elided*/ any;
|
|
202
|
-
};
|
|
203
|
-
mapDelete<T extends (...args: any[]) => any>(path: string | undefined, fn: T): {
|
|
204
|
-
useMiddleware: <M extends AvleonMiddleware>(middlewares: Constructor<AvleonMiddleware>[]) => /*elided*/ any;
|
|
205
|
-
useOpenApi: (options: OpenApiOptions) => /*elided*/ any;
|
|
206
|
-
};
|
|
207
|
-
private _mapFeatures;
|
|
208
|
-
initializeDatabase(): Promise<void>;
|
|
209
|
-
handleSocket(socket: any): void;
|
|
210
|
-
run(port?: number, fn?: CallableFunction): Promise<void>;
|
|
211
|
-
getTestApp(buildOptions?: any): TestApplication;
|
|
212
|
-
}
|
|
213
|
-
export type Application = typeof AvleonApplication;
|
|
214
|
-
export declare class AvleonTest {
|
|
215
|
-
private constructor();
|
|
216
|
-
static getController<T>(controller: Constructor<T>, deps?: any[]): T;
|
|
217
|
-
static getProvider<T>(service: Constructor<T>, deps?: any[]): T;
|
|
218
|
-
static createTestApplication(options: TestAppOptions): TestApplication;
|
|
219
|
-
static from(app: AvleonApplication): TestApplication;
|
|
220
|
-
static clean(): void;
|
|
221
|
-
}
|
|
222
|
-
export declare class Avleon {
|
|
223
|
-
static createApplication(): AvleonApplication;
|
|
224
|
-
static createTestApplication(options: TestAppOptions): TestApplication;
|
|
225
|
-
}
|
|
226
|
-
export {};
|