@expressots/adapter-express 1.1.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/lib/CHANGELOG.md +21 -0
- package/lib/cjs/adapter-express/application-express.js +80 -21
- package/lib/cjs/types/adapter-express/application-base.d.ts +0 -1
- package/lib/cjs/types/adapter-express/application-express.d.ts +36 -2
- package/lib/cjs/types/adapter-express/application-express.interface.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/constants.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/index.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -1
- package/lib/cjs/types/adapter-express/express-utils/utils.d.ts +0 -1
- package/lib/cjs/types/adapter-express/index.d.ts +0 -1
- package/lib/cjs/types/index.d.ts +0 -1
- package/lib/package.json +5 -10
- package/package.json +5 -10
- package/lib/cjs/types/adapter-express/application-base.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/application-express.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/application-express.interface.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/constants.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/index.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/express-utils/utils.d.ts.map +0 -1
- package/lib/cjs/types/adapter-express/index.d.ts.map +0 -1
- package/lib/cjs/types/index.d.ts.map +0 -1
- package/lib/esm/adapter-express/application-base.js +0 -36
- package/lib/esm/adapter-express/application-express.interface.js +0 -2
- package/lib/esm/adapter-express/application-express.js +0 -152
- package/lib/esm/adapter-express/express-utils/base-middleware.js +0 -22
- package/lib/esm/adapter-express/express-utils/constants.js +0 -46
- package/lib/esm/adapter-express/express-utils/content/httpContent.js +0 -10
- package/lib/esm/adapter-express/express-utils/decorators.js +0 -110
- package/lib/esm/adapter-express/express-utils/httpResponseMessage.js +0 -33
- package/lib/esm/adapter-express/express-utils/index.js +0 -17
- package/lib/esm/adapter-express/express-utils/interfaces.js +0 -2
- package/lib/esm/adapter-express/express-utils/inversify-express-server.js +0 -293
- package/lib/esm/adapter-express/express-utils/utils.js +0 -58
- package/lib/esm/adapter-express/index.js +0 -21
- package/lib/esm/index.mjs +0 -17
- package/lib/esm/types/adapter-express/application-base.d.ts +0 -55
- package/lib/esm/types/adapter-express/application-base.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/application-express.d.ts +0 -71
- package/lib/esm/types/adapter-express/application-express.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/application-express.interface.d.ts +0 -29
- package/lib/esm/types/adapter-express/application-express.interface.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts +0 -9
- package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/constants.d.ts +0 -39
- package/lib/esm/types/adapter-express/express-utils/constants.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts +0 -8
- package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/decorators.d.ts +0 -24
- package/lib/esm/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -16
- package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/index.d.ts +0 -3
- package/lib/esm/types/adapter-express/express-utils/index.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts +0 -76
- package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -60
- package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/express-utils/utils.d.ts +0 -10
- package/lib/esm/types/adapter-express/express-utils/utils.d.ts.map +0 -1
- package/lib/esm/types/adapter-express/index.d.ts +0 -4
- package/lib/esm/types/adapter-express/index.d.ts.map +0 -1
- package/lib/esm/types/index.d.ts +0 -2
- package/lib/esm/types/index.d.ts.map +0 -1
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.InversifyExpressServer = void 0;
|
|
27
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
28
|
-
const express_1 = __importStar(require("express"));
|
|
29
|
-
const base_middleware_1 = require("./base-middleware");
|
|
30
|
-
const utils_1 = require("./utils");
|
|
31
|
-
const constants_1 = require("./constants");
|
|
32
|
-
const httpResponseMessage_1 = require("./httpResponseMessage");
|
|
33
|
-
class InversifyExpressServer {
|
|
34
|
-
_router;
|
|
35
|
-
_container;
|
|
36
|
-
_app;
|
|
37
|
-
_configFn;
|
|
38
|
-
_errorConfigFn;
|
|
39
|
-
_routingConfig;
|
|
40
|
-
_AuthProvider;
|
|
41
|
-
_forceControllers;
|
|
42
|
-
/**
|
|
43
|
-
* Wrapper for the express server.
|
|
44
|
-
*
|
|
45
|
-
* @param container Container loaded with all controllers and their dependencies.
|
|
46
|
-
* @param customRouter optional express.Router custom router
|
|
47
|
-
* @param routingConfig optional interfaces.RoutingConfig routing config
|
|
48
|
-
* @param customApp optional express.Application custom app
|
|
49
|
-
* @param authProvider optional interfaces.AuthProvider auth provider
|
|
50
|
-
* @param forceControllers optional boolean setting to force controllers (defaults do true)
|
|
51
|
-
*/
|
|
52
|
-
constructor(container, customRouter, routingConfig, customApp, authProvider, forceControllers = true) {
|
|
53
|
-
this._container = container;
|
|
54
|
-
this._forceControllers = forceControllers;
|
|
55
|
-
this._router = customRouter || (0, express_1.Router)();
|
|
56
|
-
this._routingConfig = routingConfig || {
|
|
57
|
-
rootPath: constants_1.DEFAULT_ROUTING_ROOT_PATH,
|
|
58
|
-
};
|
|
59
|
-
this._app = customApp || (0, express_1.default)();
|
|
60
|
-
if (authProvider) {
|
|
61
|
-
this._AuthProvider = authProvider;
|
|
62
|
-
container.bind(constants_1.TYPE.AuthProvider).to(this._AuthProvider);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Sets the configuration function to be applied to the application.
|
|
67
|
-
* Note that the config function is not actually executed until a call to
|
|
68
|
-
* InversifyExpresServer.build().
|
|
69
|
-
*
|
|
70
|
-
* This method is chainable.
|
|
71
|
-
*
|
|
72
|
-
* @param fn Function in which app-level middleware can be registered.
|
|
73
|
-
*/
|
|
74
|
-
setConfig(fn) {
|
|
75
|
-
this._configFn = fn;
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Sets the error handler configuration function to be applied to the application.
|
|
80
|
-
* Note that the error config function is not actually executed until a call to
|
|
81
|
-
* InversifyExpressServer.build().
|
|
82
|
-
*
|
|
83
|
-
* This method is chainable.
|
|
84
|
-
*
|
|
85
|
-
* @param fn Function in which app-level error handlers can be registered.
|
|
86
|
-
*/
|
|
87
|
-
setErrorConfig(fn) {
|
|
88
|
-
this._errorConfigFn = fn;
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Applies all routes and configuration to the server, returning the express application.
|
|
93
|
-
*/
|
|
94
|
-
build() {
|
|
95
|
-
// The very first middleware to be invoked
|
|
96
|
-
// it creates a new httpContext and attaches it to the
|
|
97
|
-
// current request as metadata using Reflect
|
|
98
|
-
this._app.all("*", (req, res, next) => {
|
|
99
|
-
void (async () => {
|
|
100
|
-
const httpContext = await this._createHttpContext(req, res, next);
|
|
101
|
-
Reflect.defineMetadata(constants_1.METADATA_KEY.httpContext, httpContext, req);
|
|
102
|
-
next();
|
|
103
|
-
})();
|
|
104
|
-
});
|
|
105
|
-
// register server-level middleware before anything else
|
|
106
|
-
if (this._configFn) {
|
|
107
|
-
this._configFn.apply(undefined, [this._app]);
|
|
108
|
-
}
|
|
109
|
-
this.registerControllers();
|
|
110
|
-
// register error handlers after controllers
|
|
111
|
-
if (this._errorConfigFn) {
|
|
112
|
-
this._errorConfigFn.apply(undefined, [this._app]);
|
|
113
|
-
}
|
|
114
|
-
return this._app;
|
|
115
|
-
}
|
|
116
|
-
registerControllers() {
|
|
117
|
-
// Fake HttpContext is needed during registration
|
|
118
|
-
this._container.bind(constants_1.TYPE.HttpContext).toConstantValue({});
|
|
119
|
-
const constructors = (0, utils_1.getControllersFromMetadata)();
|
|
120
|
-
constructors.forEach((constructor) => {
|
|
121
|
-
const { name } = constructor;
|
|
122
|
-
if (this._container.isBoundNamed(constants_1.TYPE.Controller, name)) {
|
|
123
|
-
throw new Error((0, constants_1.DUPLICATED_CONTROLLER_NAME)(name));
|
|
124
|
-
}
|
|
125
|
-
this._container
|
|
126
|
-
.bind(constants_1.TYPE.Controller)
|
|
127
|
-
.to(constructor)
|
|
128
|
-
.whenTargetNamed(name);
|
|
129
|
-
});
|
|
130
|
-
const controllers = (0, utils_1.getControllersFromContainer)(this._container, this._forceControllers);
|
|
131
|
-
controllers.forEach((controller) => {
|
|
132
|
-
const controllerMetadata = (0, utils_1.getControllerMetadata)(controller.constructor);
|
|
133
|
-
const methodMetadata = (0, utils_1.getControllerMethodMetadata)(controller.constructor);
|
|
134
|
-
const parameterMetadata = (0, utils_1.getControllerParameterMetadata)(controller.constructor);
|
|
135
|
-
if (controllerMetadata && methodMetadata) {
|
|
136
|
-
const controllerMiddleware = this.resolveMidleware(...controllerMetadata.middleware);
|
|
137
|
-
methodMetadata.forEach((metadata) => {
|
|
138
|
-
let paramList = [];
|
|
139
|
-
if (parameterMetadata) {
|
|
140
|
-
paramList = parameterMetadata[metadata.key] || [];
|
|
141
|
-
}
|
|
142
|
-
const handler = this.handlerFactory(controllerMetadata.target.name, metadata.key, paramList);
|
|
143
|
-
const routeMiddleware = this.resolveMidleware(...metadata.middleware);
|
|
144
|
-
this._router[metadata.method](`${controllerMetadata.path}${metadata.path}`, ...controllerMiddleware, ...routeMiddleware, handler);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
this._app.use(this._routingConfig.rootPath, this._router);
|
|
149
|
-
}
|
|
150
|
-
resolveMidleware(...middleware) {
|
|
151
|
-
return middleware.map((middlewareItem) => {
|
|
152
|
-
if (!this._container.isBound(middlewareItem)) {
|
|
153
|
-
return middlewareItem;
|
|
154
|
-
}
|
|
155
|
-
const middlewareInstance = this._container.get(middlewareItem);
|
|
156
|
-
if (middlewareInstance instanceof base_middleware_1.BaseMiddleware) {
|
|
157
|
-
return (req, res, next) => {
|
|
158
|
-
const mReq = this._container.get(middlewareItem);
|
|
159
|
-
mReq.httpContext = this._getHttpContext(req);
|
|
160
|
-
mReq.handler(req, res, next);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
return middlewareInstance;
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
copyHeadersTo(headers, target) {
|
|
167
|
-
for (const name of Object.keys(headers)) {
|
|
168
|
-
const headerValue = headers[name];
|
|
169
|
-
target.append(name, typeof headerValue === "number" ? headerValue.toString() : headerValue);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
async handleHttpResponseMessage(message, res) {
|
|
173
|
-
this.copyHeadersTo(message.headers, res);
|
|
174
|
-
if (message.content !== undefined) {
|
|
175
|
-
this.copyHeadersTo(message.content.headers, res);
|
|
176
|
-
res
|
|
177
|
-
.status(message.statusCode)
|
|
178
|
-
// If the content is a number, ensure we change it to a string, else our content is
|
|
179
|
-
// treated as a statusCode rather than as the content of the Response
|
|
180
|
-
.send(await message.content.readAsync());
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
res.sendStatus(message.statusCode);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
handlerFactory(controllerName, key, parameterMetadata) {
|
|
187
|
-
return async (req, res, next) => {
|
|
188
|
-
try {
|
|
189
|
-
const args = this.extractParameters(req, res, next, parameterMetadata);
|
|
190
|
-
const httpContext = this._getHttpContext(req);
|
|
191
|
-
httpContext.container.bind(constants_1.TYPE.HttpContext).toConstantValue(httpContext);
|
|
192
|
-
// invoke controller's action
|
|
193
|
-
const value = await httpContext.container.getNamed(constants_1.TYPE.Controller, controllerName)[key](...args);
|
|
194
|
-
if (value instanceof httpResponseMessage_1.HttpResponseMessage) {
|
|
195
|
-
await this.handleHttpResponseMessage(value, res);
|
|
196
|
-
}
|
|
197
|
-
else if ((0, utils_1.instanceOfIHttpActionResult)(value)) {
|
|
198
|
-
const httpResponseMessage = await value.executeAsync();
|
|
199
|
-
await this.handleHttpResponseMessage(httpResponseMessage, res);
|
|
200
|
-
}
|
|
201
|
-
else if (value instanceof Function) {
|
|
202
|
-
value();
|
|
203
|
-
}
|
|
204
|
-
else if (!res.headersSent) {
|
|
205
|
-
if (value === undefined) {
|
|
206
|
-
res.status(204);
|
|
207
|
-
}
|
|
208
|
-
res.send(value);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
catch (err) {
|
|
212
|
-
next(err);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
_getHttpContext(req) {
|
|
217
|
-
return Reflect.getMetadata(constants_1.METADATA_KEY.httpContext, req);
|
|
218
|
-
}
|
|
219
|
-
async _createHttpContext(req, res, next) {
|
|
220
|
-
const principal = await this._getCurrentUser(req, res, next);
|
|
221
|
-
return {
|
|
222
|
-
// We use a childContainer for each request so we can be
|
|
223
|
-
// sure that the binding is unique for each HTTP request
|
|
224
|
-
container: this._container.createChild(),
|
|
225
|
-
request: req,
|
|
226
|
-
response: res,
|
|
227
|
-
user: principal,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
async _getCurrentUser(req, res, next) {
|
|
231
|
-
if (this._AuthProvider !== undefined) {
|
|
232
|
-
const authProvider = this._container.get(constants_1.TYPE.AuthProvider);
|
|
233
|
-
return authProvider.getUser(req, res, next);
|
|
234
|
-
}
|
|
235
|
-
return Promise.resolve({
|
|
236
|
-
details: null,
|
|
237
|
-
isAuthenticated: () => Promise.resolve(false),
|
|
238
|
-
isInRole: (_role) => Promise.resolve(false),
|
|
239
|
-
isResourceOwner: (_resourceId) => Promise.resolve(false),
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
extractParameters(req, res, next, params) {
|
|
243
|
-
const args = [];
|
|
244
|
-
if (!params || !params.length) {
|
|
245
|
-
return [req, res, next];
|
|
246
|
-
}
|
|
247
|
-
params.forEach(({ type, index, parameterName, injectRoot }) => {
|
|
248
|
-
switch (type) {
|
|
249
|
-
case constants_1.PARAMETER_TYPE.REQUEST:
|
|
250
|
-
args[index] = req;
|
|
251
|
-
break;
|
|
252
|
-
case constants_1.PARAMETER_TYPE.NEXT:
|
|
253
|
-
args[index] = next;
|
|
254
|
-
break;
|
|
255
|
-
case constants_1.PARAMETER_TYPE.PARAMS:
|
|
256
|
-
args[index] = this.getParam(req, "params", injectRoot, parameterName);
|
|
257
|
-
break;
|
|
258
|
-
case constants_1.PARAMETER_TYPE.QUERY:
|
|
259
|
-
args[index] = this.getParam(req, "query", injectRoot, parameterName);
|
|
260
|
-
break;
|
|
261
|
-
case constants_1.PARAMETER_TYPE.BODY:
|
|
262
|
-
args[index] = req.body;
|
|
263
|
-
break;
|
|
264
|
-
case constants_1.PARAMETER_TYPE.HEADERS:
|
|
265
|
-
args[index] = this.getParam(req, "headers", injectRoot, parameterName);
|
|
266
|
-
break;
|
|
267
|
-
case constants_1.PARAMETER_TYPE.COOKIES:
|
|
268
|
-
args[index] = this.getParam(req, "cookies", injectRoot, parameterName);
|
|
269
|
-
break;
|
|
270
|
-
case constants_1.PARAMETER_TYPE.PRINCIPAL:
|
|
271
|
-
args[index] = this._getPrincipal(req);
|
|
272
|
-
break;
|
|
273
|
-
default:
|
|
274
|
-
args[index] = res;
|
|
275
|
-
break; // response
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
args.push(req, res, next);
|
|
279
|
-
return args;
|
|
280
|
-
}
|
|
281
|
-
getParam(source, paramType, injectRoot, name) {
|
|
282
|
-
const key = paramType === "headers" ? name?.toLowerCase() : name;
|
|
283
|
-
const param = source[paramType];
|
|
284
|
-
if (injectRoot) {
|
|
285
|
-
return param;
|
|
286
|
-
}
|
|
287
|
-
return param && key ? param[key] : undefined;
|
|
288
|
-
}
|
|
289
|
-
_getPrincipal(req) {
|
|
290
|
-
return this._getHttpContext(req).user;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.InversifyExpressServer = InversifyExpressServer;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.instanceOfIHttpActionResult = exports.cleanUpMetadata = exports.getControllerParameterMetadata = exports.getControllerMethodMetadata = exports.getControllerMetadata = exports.getControllersFromMetadata = exports.getControllersFromContainer = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
function getControllersFromContainer(container, forceControllers) {
|
|
6
|
-
if (container.isBound(constants_1.TYPE.Controller)) {
|
|
7
|
-
return container.getAll(constants_1.TYPE.Controller);
|
|
8
|
-
}
|
|
9
|
-
if (forceControllers) {
|
|
10
|
-
throw new Error(constants_1.NO_CONTROLLERS_FOUND);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.getControllersFromContainer = getControllersFromContainer;
|
|
17
|
-
function getControllersFromMetadata() {
|
|
18
|
-
const arrayOfControllerMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controller, Reflect) || [];
|
|
19
|
-
return arrayOfControllerMetadata.map((metadata) => metadata.target);
|
|
20
|
-
}
|
|
21
|
-
exports.getControllersFromMetadata = getControllersFromMetadata;
|
|
22
|
-
function getControllerMetadata(constructor) {
|
|
23
|
-
const controllerMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controller, constructor);
|
|
24
|
-
return controllerMetadata;
|
|
25
|
-
}
|
|
26
|
-
exports.getControllerMetadata = getControllerMetadata;
|
|
27
|
-
function getControllerMethodMetadata(constructor) {
|
|
28
|
-
const methodMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controllerMethod, constructor);
|
|
29
|
-
const genericMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controllerMethod, Reflect.getPrototypeOf(constructor));
|
|
30
|
-
if (genericMetadata !== undefined && methodMetadata !== undefined) {
|
|
31
|
-
return methodMetadata.concat(genericMetadata);
|
|
32
|
-
}
|
|
33
|
-
if (genericMetadata !== undefined) {
|
|
34
|
-
return genericMetadata;
|
|
35
|
-
}
|
|
36
|
-
return methodMetadata;
|
|
37
|
-
}
|
|
38
|
-
exports.getControllerMethodMetadata = getControllerMethodMetadata;
|
|
39
|
-
function getControllerParameterMetadata(constructor) {
|
|
40
|
-
const parameterMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controllerParameter, constructor);
|
|
41
|
-
const genericMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controllerParameter, Reflect.getPrototypeOf(constructor));
|
|
42
|
-
if (genericMetadata !== undefined && parameterMetadata !== undefined) {
|
|
43
|
-
return { ...parameterMetadata, ...genericMetadata };
|
|
44
|
-
}
|
|
45
|
-
if (genericMetadata !== undefined) {
|
|
46
|
-
return genericMetadata;
|
|
47
|
-
}
|
|
48
|
-
return parameterMetadata;
|
|
49
|
-
}
|
|
50
|
-
exports.getControllerParameterMetadata = getControllerParameterMetadata;
|
|
51
|
-
function cleanUpMetadata() {
|
|
52
|
-
Reflect.defineMetadata(constants_1.METADATA_KEY.controller, [], Reflect);
|
|
53
|
-
}
|
|
54
|
-
exports.cleanUpMetadata = cleanUpMetadata;
|
|
55
|
-
function instanceOfIHttpActionResult(value) {
|
|
56
|
-
return value != null && typeof value.executeAsync === "function";
|
|
57
|
-
}
|
|
58
|
-
exports.instanceOfIHttpActionResult = instanceOfIHttpActionResult;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ServerEnvironment = exports.AppExpress = void 0;
|
|
18
|
-
__exportStar(require("./express-utils"), exports);
|
|
19
|
-
var application_express_1 = require("./application-express");
|
|
20
|
-
Object.defineProperty(exports, "AppExpress", { enumerable: true, get: function () { return application_express_1.AppExpress; } });
|
|
21
|
-
Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return application_express_1.ServerEnvironment; } });
|
package/lib/esm/index.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./adapter-express"), exports);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Abstract class ApplicationBase.
|
|
3
|
-
*
|
|
4
|
-
* ApplicationBase serves as the foundational structure for building
|
|
5
|
-
* server applications. It declares the lifecycle hooks that allow
|
|
6
|
-
* subclasses to configure services, handle post-server initialization,
|
|
7
|
-
* and perform cleanup when the server is shutting down. Extending
|
|
8
|
-
* classes are required to provide implementations for these methods
|
|
9
|
-
* to define specific behaviors for their particular use cases.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* class Application extends ApplicationBase {
|
|
13
|
-
* protected configureServices() { //... }
|
|
14
|
-
* protected postServerInitialization() { //... }
|
|
15
|
-
* protected serverShutdown() { //... }
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* @export
|
|
19
|
-
* @abstract
|
|
20
|
-
*/
|
|
21
|
-
declare abstract class ApplicationBase {
|
|
22
|
-
/**
|
|
23
|
-
* Method to configure services that should be initialized
|
|
24
|
-
* before the server starts. It must be implemented by the
|
|
25
|
-
* extending class to set up necessary services or configurations.
|
|
26
|
-
* Can return a Promise for async configuration.
|
|
27
|
-
*
|
|
28
|
-
* @abstract
|
|
29
|
-
* @returns {void | Promise<void>}
|
|
30
|
-
*/
|
|
31
|
-
protected abstract configureServices(): void | Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Method to configure services or actions that should be executed
|
|
34
|
-
* after the server starts. It allows the extending class to perform
|
|
35
|
-
* any necessary operations once the server is up and running.
|
|
36
|
-
* Can return a Promise for async execution.
|
|
37
|
-
*
|
|
38
|
-
* @abstract
|
|
39
|
-
* @returns {void | Promise<void>}
|
|
40
|
-
*/
|
|
41
|
-
protected abstract postServerInitialization(): void | Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Method to perform any necessary actions or cleanup after the server
|
|
44
|
-
* is shutting down. This might include closing database connections,
|
|
45
|
-
* stopping background tasks, or other cleanup activities. It provides
|
|
46
|
-
* a clean exit point for the server.
|
|
47
|
-
* Can return a Promise for async cleanup.
|
|
48
|
-
*
|
|
49
|
-
* @abstract
|
|
50
|
-
* @returns {void | Promise<void>}
|
|
51
|
-
*/
|
|
52
|
-
protected abstract serverShutdown(): void | Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
export { ApplicationBase };
|
|
55
|
-
//# sourceMappingURL=application-base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-base.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-base.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uBACe,eAAe;IAC5B;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5D;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,wBAAwB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnE;;;;;;;;;OASG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1D;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import express from "express";
|
|
2
|
-
import { Container } from "inversify";
|
|
3
|
-
import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
|
|
4
|
-
import { IApplicationExpress } from "./application-express.interface";
|
|
5
|
-
import { ApplicationBase } from "./application-base";
|
|
6
|
-
/**
|
|
7
|
-
* Enum representing possible server environments.
|
|
8
|
-
*/
|
|
9
|
-
declare enum ServerEnvironment {
|
|
10
|
-
Development = "development",
|
|
11
|
-
Production = "production"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The Application class provides a way to configure and manage an Express application.
|
|
15
|
-
* @provide Application
|
|
16
|
-
*/
|
|
17
|
-
declare class ApplicationExpress extends ApplicationBase implements IApplicationExpress {
|
|
18
|
-
private app;
|
|
19
|
-
private port;
|
|
20
|
-
private environment;
|
|
21
|
-
private container;
|
|
22
|
-
private middlewares;
|
|
23
|
-
protected configureServices(): void | Promise<void>;
|
|
24
|
-
protected postServerInitialization(): void | Promise<void>;
|
|
25
|
-
protected serverShutdown(): void | Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Handles process exit by calling serverShutdown and then exiting the process.
|
|
28
|
-
*/
|
|
29
|
-
private handleExit;
|
|
30
|
-
/**
|
|
31
|
-
* Create and configure the Express application.
|
|
32
|
-
* @param container - The InversifyJS container.
|
|
33
|
-
* @param middlewares - An array of Express middlewares to be applied.
|
|
34
|
-
* @returns The configured Application instance.
|
|
35
|
-
*/
|
|
36
|
-
create(container: Container, middlewares?: Array<express.RequestHandler>): Promise<ApplicationExpress>;
|
|
37
|
-
/**
|
|
38
|
-
* Start listening on the given port and environment.
|
|
39
|
-
* @param port - The port number to listen on.
|
|
40
|
-
* @param environment - The server environment.
|
|
41
|
-
* @param consoleMessage - Optional message to display in the console.
|
|
42
|
-
*/
|
|
43
|
-
listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Configures the application's view engine based on the provided configuration options.
|
|
46
|
-
*
|
|
47
|
-
* @public
|
|
48
|
-
* @method setEngine
|
|
49
|
-
* @template T - A generic type extending from RenderTemplateOptions.
|
|
50
|
-
*
|
|
51
|
-
* @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
|
|
52
|
-
* that provides the configuration options for setting the view engine.
|
|
53
|
-
* This includes the extension name, view path, and the engine function itself.
|
|
54
|
-
*/
|
|
55
|
-
setEngine<T extends RenderTemplateOptions>(options: T): void;
|
|
56
|
-
/**
|
|
57
|
-
* Verifies if the current environment is development.
|
|
58
|
-
*
|
|
59
|
-
* @returns A boolean value indicating whether the current environment is development or not.
|
|
60
|
-
*/
|
|
61
|
-
protected isDevelopment(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Verifies if the current environment is production.
|
|
64
|
-
*
|
|
65
|
-
* @returns A boolean value indicating whether the current environment is production or not.
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
get ExpressApp(): express.Application;
|
|
69
|
-
}
|
|
70
|
-
export { ApplicationExpress as AppExpress, ServerEnvironment };
|
|
71
|
-
//# sourceMappingURL=application-express.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-express.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAEL,4BAA4B,EAK5B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAarD;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,kBAAmB,SAAQ,eAAgB,YAAW,mBAAmB;IAC7E,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,WAAW,CAA6B;IAEhD,SAAS,CAAC,iBAAiB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,SAAS,CAAC,wBAAwB,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1D,SAAS,CAAC,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhD;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACU,MAAM,CACjB,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,OAAO,CAAC,kBAAkB,CAAC;IA0C9B;;;;;OAKG;IACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IASnE;;;;OAIG;IACH,SAAS,CAAC,aAAa,IAAI,OAAO;IAWlC;;;;;OAKG;IACH,IAAW,UAAU,IAAI,OAAO,CAAC,WAAW,CAE3C;CACF;AAED,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
|
|
2
|
-
import { ServerEnvironment } from "./application-express";
|
|
3
|
-
/**
|
|
4
|
-
* Interface representing the Application class for Expressjs
|
|
5
|
-
* @interface IApplicationExpress
|
|
6
|
-
*/
|
|
7
|
-
interface IApplicationExpress {
|
|
8
|
-
/**
|
|
9
|
-
* Start listening on the given port and environment.
|
|
10
|
-
* @param port - The port number to listen on.
|
|
11
|
-
* @param environment - The server environment.
|
|
12
|
-
* @param consoleMessage - Optional message to display in the console.
|
|
13
|
-
*/
|
|
14
|
-
listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void> | void;
|
|
15
|
-
/**
|
|
16
|
-
* Configures the application's view engine based on the provided configuration options.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
* @method setEngine
|
|
20
|
-
* @template T - A generic type extending from RenderTemplateOptions.
|
|
21
|
-
*
|
|
22
|
-
* @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
|
|
23
|
-
* that provides the configuration options for setting the view engine.
|
|
24
|
-
* This includes the extension name, view path, and the engine function itself.
|
|
25
|
-
*/
|
|
26
|
-
setEngine<T extends RenderTemplateOptions>(options: T): void;
|
|
27
|
-
}
|
|
28
|
-
export { IApplicationExpress };
|
|
29
|
-
//# sourceMappingURL=application-express.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-express.interface.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;GAGG;AACH,UAAU,mBAAmB;IAC3B;;;;;OAKG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAExB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CAC9D;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NextFunction, Request, Response } from "express";
|
|
2
|
-
import { interfaces as inversifyInterfaces } from "inversify";
|
|
3
|
-
import type { HttpContext } from "./interfaces";
|
|
4
|
-
export declare abstract class BaseMiddleware implements BaseMiddleware {
|
|
5
|
-
httpContext: HttpContext;
|
|
6
|
-
protected bind<T>(serviceIdentifier: inversifyInterfaces.ServiceIdentifier<T>): inversifyInterfaces.BindingToSyntax<T>;
|
|
7
|
-
abstract handler(req: Request, res: Response, next: NextFunction): void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=base-middleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-middleware.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/base-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAc,UAAU,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,8BACsB,cAAe,YAAW,cAAc;IAGrD,WAAW,EAAG,WAAW,CAAC;IAEjC,SAAS,CAAC,IAAI,CAAC,CAAC,EACd,iBAAiB,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAC1D,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;aAIzB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CAC/E"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export declare const TYPE: {
|
|
2
|
-
AuthProvider: symbol;
|
|
3
|
-
Controller: symbol;
|
|
4
|
-
HttpContext: symbol;
|
|
5
|
-
};
|
|
6
|
-
export declare const METADATA_KEY: {
|
|
7
|
-
controller: string;
|
|
8
|
-
controllerMethod: string;
|
|
9
|
-
controllerParameter: string;
|
|
10
|
-
httpContext: string;
|
|
11
|
-
};
|
|
12
|
-
export declare enum PARAMETER_TYPE {
|
|
13
|
-
REQUEST = 0,
|
|
14
|
-
RESPONSE = 1,
|
|
15
|
-
PARAMS = 2,
|
|
16
|
-
QUERY = 3,
|
|
17
|
-
BODY = 4,
|
|
18
|
-
HEADERS = 5,
|
|
19
|
-
COOKIES = 6,
|
|
20
|
-
NEXT = 7,
|
|
21
|
-
PRINCIPAL = 8
|
|
22
|
-
}
|
|
23
|
-
export declare enum HTTP_VERBS_ENUM {
|
|
24
|
-
all = "ALL",
|
|
25
|
-
connect = "CONNECT",
|
|
26
|
-
delete = "DELETE",
|
|
27
|
-
get = "GET",
|
|
28
|
-
head = "HEAD",
|
|
29
|
-
options = "OPTIONS",
|
|
30
|
-
patch = "PATCH",
|
|
31
|
-
post = "POST",
|
|
32
|
-
propfind = "PROPFIND",
|
|
33
|
-
put = "PUT",
|
|
34
|
-
trace = "TRACE"
|
|
35
|
-
}
|
|
36
|
-
export declare const DUPLICATED_CONTROLLER_NAME: (name: string) => string;
|
|
37
|
-
export declare const NO_CONTROLLERS_FOUND: string;
|
|
38
|
-
export declare const DEFAULT_ROUTING_ROOT_PATH = "/";
|
|
39
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF,oBAAY,cAAc;IACxB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,MACJ,CAAC;AAEvD,eAAO,MAAM,oBAAoB,QAGL,CAAC;AAE7B,eAAO,MAAM,yBAAyB,MAAM,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { OutgoingHttpHeaders } from "node:http";
|
|
3
|
-
export declare abstract class HttpContent {
|
|
4
|
-
private _headers;
|
|
5
|
-
get headers(): OutgoingHttpHeaders;
|
|
6
|
-
abstract readAsync(): Promise<string | Record<string, unknown> | Record<string, unknown>[]>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=httpContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpContent.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter-express/express-utils/content/httpContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,8BAAsB,WAAW;IAC/B,OAAO,CAAC,QAAQ,CAA2B;IAE3C,IAAW,OAAO,IAAI,mBAAmB,CAExC;aAEe,SAAS,IAAI,OAAO,CAElC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAC7D;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { PARAMETER_TYPE, HTTP_VERBS_ENUM } from "./constants";
|
|
3
|
-
import type { Controller, HandlerDecorator, Middleware } from "./interfaces";
|
|
4
|
-
export declare const injectHttpContext: (target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<any>) => void;
|
|
5
|
-
export declare function controller(path: string, ...middleware: Array<Middleware>): (target: NewableFunction) => void;
|
|
6
|
-
export declare function all(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
7
|
-
export declare function Get(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
8
|
-
export declare function Post(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
9
|
-
export declare function Put(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
10
|
-
export declare function Patch(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
11
|
-
export declare function Head(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
12
|
-
export declare function Delete(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
13
|
-
export declare function httpMethod(method: keyof typeof HTTP_VERBS_ENUM, path: string, ...middleware: Array<Middleware>): HandlerDecorator;
|
|
14
|
-
export declare const request: () => ParameterDecorator;
|
|
15
|
-
export declare const response: () => ParameterDecorator;
|
|
16
|
-
export declare const param: (paramName?: string) => ParameterDecorator;
|
|
17
|
-
export declare const query: (queryParamName?: string) => ParameterDecorator;
|
|
18
|
-
export declare const body: () => ParameterDecorator;
|
|
19
|
-
export declare const headers: (headerName?: string) => ParameterDecorator;
|
|
20
|
-
export declare const cookies: (cookieName?: string) => ParameterDecorator;
|
|
21
|
-
export declare const next: () => ParameterDecorator;
|
|
22
|
-
export declare const Principal: () => ParameterDecorator;
|
|
23
|
-
export declare function params(type: PARAMETER_TYPE, parameterName?: string): (target: unknown | Controller, methodName: string | symbol, index: number) => void;
|
|
24
|
-
//# sourceMappingURL=decorators.d.ts.map
|