@galeh/chuka 1.1.2 → 1.1.3
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/decorators.d.ts +8 -0
- package/decorators.js +107 -0
- package/index.d.ts +202 -0
- package/index.js +167 -0
- package/middlewares.d.ts +20 -0
- package/middlewares.js +107 -0
- package/package.json +40 -49
- package/validators.d.ts +60 -0
- package/validators.js +105 -0
- package/.github/workflows/webpack.yml +0 -34
- package/config/api-extractor.decorators.json +0 -427
- package/config/api-extractor.index.json +0 -427
- package/config/api-extractor.middlewares.json +0 -427
- package/config/api-extractor.validators.json +0 -427
- package/sample/01-cats-app/package-lock.json +0 -283
- package/sample/01-cats-app/package.json +0 -19
- package/sample/01-cats-app/src/cats/cat-model.ts +0 -9
- package/sample/01-cats-app/src/cats/cats-controller.ts +0 -44
- package/sample/01-cats-app/src/cats/cats-service-interface.ts +0 -7
- package/sample/01-cats-app/src/cats/cats-service.ts +0 -27
- package/sample/01-cats-app/src/cats/create-logger.ts +0 -8
- package/sample/01-cats-app/src/main.ts +0 -30
- package/sample/01-cats-app/tsconfig.json +0 -112
- package/sample/02-socket/package-lock.json +0 -442
- package/sample/02-socket/package.json +0 -20
- package/sample/02-socket/src/controllers/http-controller.ts +0 -14
- package/sample/02-socket/src/controllers/socket-controller.ts +0 -18
- package/sample/02-socket/src/main.ts +0 -46
- package/sample/02-socket/src/middleware/create-session.ts +0 -9
- package/sample/02-socket/tsconfig.json +0 -112
- package/sample/03-authentication/db/create.sql +0 -6
- package/sample/03-authentication/package-lock.json +0 -1832
- package/sample/03-authentication/package.json +0 -23
- package/sample/03-authentication/src/config.ts +0 -21
- package/sample/03-authentication/src/controllers/auth-controller.ts +0 -54
- package/sample/03-authentication/src/enums/injection-tokens.ts +0 -5
- package/sample/03-authentication/src/enums/result-codes.ts +0 -4
- package/sample/03-authentication/src/exceptions/error.ts +0 -7
- package/sample/03-authentication/src/exceptions/password-not-found-exception.ts +0 -9
- package/sample/03-authentication/src/exceptions/unauthorized-exception.ts +0 -9
- package/sample/03-authentication/src/exceptions/user-already-exist.ts +0 -9
- package/sample/03-authentication/src/exceptions/user-not-found.ts +0 -9
- package/sample/03-authentication/src/exceptions/wrong-login-info-exception.ts +0 -8
- package/sample/03-authentication/src/main.ts +0 -42
- package/sample/03-authentication/src/middlewares/auth-handler.ts +0 -17
- package/sample/03-authentication/src/middlewares/global-error-handler.ts +0 -21
- package/sample/03-authentication/src/models/user-model.ts +0 -6
- package/sample/03-authentication/src/services/auth-service.ts +0 -50
- package/sample/03-authentication/src/services/interfaces/auth-service-interface.ts +0 -7
- package/sample/03-authentication/src/services/interfaces/user-service-interface.ts +0 -7
- package/sample/03-authentication/src/services/user-service.ts +0 -75
- package/sample/03-authentication/src/types/connection.ts +0 -3
- package/sample/03-authentication/src/types/token.ts +0 -3
- package/sample/03-authentication/src/utils/crypto.ts +0 -26
- package/sample/03-authentication/tsconfig.json +0 -112
- package/scripts/build.bash +0 -17
- package/scripts/create-package-json.js +0 -15
- package/src/app.ts +0 -197
- package/src/controller.ts +0 -204
- package/src/decorators/index.ts +0 -1
- package/src/index.ts +0 -3
- package/src/middlewares/index.ts +0 -1
- package/src/validators/body-validator.ts +0 -9
- package/src/validators/index.ts +0 -2
- package/src/validators/query-validator.ts +0 -9
- package/src/validators/validators.ts +0 -216
- package/tsconfig.json +0 -112
- package/webpack.config.js +0 -46
package/decorators.d.ts
ADDED
package/decorators.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
+
* or disable the default devtool with "devtool: false".
|
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
+
*/
|
|
9
|
+
/******/ var __webpack_modules__ = ({
|
|
10
|
+
|
|
11
|
+
/***/ "./src/decorators/index.ts":
|
|
12
|
+
/*!*********************************!*\
|
|
13
|
+
!*** ./src/decorators/index.ts ***!
|
|
14
|
+
\*********************************/
|
|
15
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16
|
+
|
|
17
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ inject: () => (/* reexport safe */ inversify__WEBPACK_IMPORTED_MODULE_0__.inject),\n/* harmony export */ injectable: () => (/* reexport safe */ inversify__WEBPACK_IMPORTED_MODULE_0__.injectable)\n/* harmony export */ });\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! inversify */ \"inversify\");\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(inversify__WEBPACK_IMPORTED_MODULE_0__);\n\n\n\n//# sourceURL=webpack://@galeh/chuka/./src/decorators/index.ts?");
|
|
18
|
+
|
|
19
|
+
/***/ }),
|
|
20
|
+
|
|
21
|
+
/***/ "inversify":
|
|
22
|
+
/*!****************************!*\
|
|
23
|
+
!*** external "inversify" ***!
|
|
24
|
+
\****************************/
|
|
25
|
+
/***/ ((module) => {
|
|
26
|
+
|
|
27
|
+
module.exports = require("inversify");
|
|
28
|
+
|
|
29
|
+
/***/ })
|
|
30
|
+
|
|
31
|
+
/******/ });
|
|
32
|
+
/************************************************************************/
|
|
33
|
+
/******/ // The module cache
|
|
34
|
+
/******/ var __webpack_module_cache__ = {};
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // The require function
|
|
37
|
+
/******/ function __webpack_require__(moduleId) {
|
|
38
|
+
/******/ // Check if module is in cache
|
|
39
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
40
|
+
/******/ if (cachedModule !== undefined) {
|
|
41
|
+
/******/ return cachedModule.exports;
|
|
42
|
+
/******/ }
|
|
43
|
+
/******/ // Create a new module (and put it into the cache)
|
|
44
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
45
|
+
/******/ // no module.id needed
|
|
46
|
+
/******/ // no module.loaded needed
|
|
47
|
+
/******/ exports: {}
|
|
48
|
+
/******/ };
|
|
49
|
+
/******/
|
|
50
|
+
/******/ // Execute the module function
|
|
51
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // Return the exports of the module
|
|
54
|
+
/******/ return module.exports;
|
|
55
|
+
/******/ }
|
|
56
|
+
/******/
|
|
57
|
+
/************************************************************************/
|
|
58
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
59
|
+
/******/ (() => {
|
|
60
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
61
|
+
/******/ __webpack_require__.n = (module) => {
|
|
62
|
+
/******/ var getter = module && module.__esModule ?
|
|
63
|
+
/******/ () => (module['default']) :
|
|
64
|
+
/******/ () => (module);
|
|
65
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
66
|
+
/******/ return getter;
|
|
67
|
+
/******/ };
|
|
68
|
+
/******/ })();
|
|
69
|
+
/******/
|
|
70
|
+
/******/ /* webpack/runtime/define property getters */
|
|
71
|
+
/******/ (() => {
|
|
72
|
+
/******/ // define getter functions for harmony exports
|
|
73
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
74
|
+
/******/ for(var key in definition) {
|
|
75
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
76
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
77
|
+
/******/ }
|
|
78
|
+
/******/ }
|
|
79
|
+
/******/ };
|
|
80
|
+
/******/ })();
|
|
81
|
+
/******/
|
|
82
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
83
|
+
/******/ (() => {
|
|
84
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
85
|
+
/******/ })();
|
|
86
|
+
/******/
|
|
87
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
88
|
+
/******/ (() => {
|
|
89
|
+
/******/ // define __esModule on exports
|
|
90
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
91
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
92
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
93
|
+
/******/ }
|
|
94
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
95
|
+
/******/ };
|
|
96
|
+
/******/ })();
|
|
97
|
+
/******/
|
|
98
|
+
/************************************************************************/
|
|
99
|
+
/******/
|
|
100
|
+
/******/ // startup
|
|
101
|
+
/******/ // Load entry module and return exports
|
|
102
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
103
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/decorators/index.ts");
|
|
104
|
+
/******/ var __webpack_export_target__ = exports;
|
|
105
|
+
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
|
106
|
+
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
107
|
+
/******/
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { interfaces } from 'inversify';
|
|
3
|
+
import { NextFunction } from 'express';
|
|
4
|
+
import { Request as Request_2 } from 'express';
|
|
5
|
+
import { Response as Response_2 } from 'express';
|
|
6
|
+
import { WebSocket as WebSocket_2 } from 'ws';
|
|
7
|
+
|
|
8
|
+
declare interface ApplicationConfig {
|
|
9
|
+
routes: Array<Route>;
|
|
10
|
+
dependencies?: Array<Dependency>;
|
|
11
|
+
middlewares?: Array<RequestHandlerParams<any>>;
|
|
12
|
+
on?: EventCallback[];
|
|
13
|
+
set?: Partial<Settings>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare class Controller {
|
|
17
|
+
private router;
|
|
18
|
+
constructor();
|
|
19
|
+
private [setControllerSymbol];
|
|
20
|
+
private [getRouterSymbol];
|
|
21
|
+
protected useWS<M0>(): MiniControllerWS<M0>;
|
|
22
|
+
protected useWS<M0>(middleware0: WSMiddleware<M0>): MiniControllerWS<M0>;
|
|
23
|
+
protected useWS<M0, M1>(middleware0: WSMiddleware<M0>, middleware1: WSMiddleware<M1>): MiniControllerWS<M0 & M1>;
|
|
24
|
+
protected useWS<M0, M1, M2>(middleware0: WSMiddleware<M0>, middleware1: WSMiddleware<M1>, middleware2: WSMiddleware<M2>): MiniControllerWS<M0 & M1 & M2>;
|
|
25
|
+
protected useWS<M0, M1, M2, M3>(middleware0: WSMiddleware<M0>, middleware1: WSMiddleware<M1>, middleware2: WSMiddleware<M2>, middleware3: WSMiddleware<M3>): MiniControllerWS<M0 & M1 & M2 & M3>;
|
|
26
|
+
protected use<M0>(): MiniController<M0>;
|
|
27
|
+
protected use<M0>(middleware0: RequestHandlerParams<M0>): MiniController<M0>;
|
|
28
|
+
protected use<M0, M1>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>): MiniController<M0 & M1>;
|
|
29
|
+
protected use<M0, M1, M2>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>, middleware2: RequestHandlerParams<M2>): MiniController<M0 & M1 & M2>;
|
|
30
|
+
protected use<M0, M1, M2, M3>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>, middleware2: RequestHandlerParams<M2>, middleware3: RequestHandlerParams<M3>): MiniController<M0 & M1 & M2 & M3>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare function createApp(config: ApplicationConfig): express.Application;
|
|
34
|
+
|
|
35
|
+
declare interface Dependency {
|
|
36
|
+
provide: string;
|
|
37
|
+
useClass?: Type<any>;
|
|
38
|
+
useValue?: any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare interface ErrorHandler<T> {
|
|
42
|
+
(err: any, req: MergePartial<Request_2, T>, res: Response_2, next: NextFunction): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare type EventCallback = {
|
|
46
|
+
event: 'connect' | 'connection' | 'close' | 'error' | 'listening' | 'lookup' | 'ready' | 'timeout' | 'mount';
|
|
47
|
+
callback: (parent: express.Application) => void;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
declare type GetRouteParameter<S extends string> = RemoveTail<RemoveTail<RemoveTail<S, `/${string}`>, `-${string}`>, `.${string}`>;
|
|
51
|
+
|
|
52
|
+
declare const getRouterSymbol: unique symbol;
|
|
53
|
+
|
|
54
|
+
export { interfaces }
|
|
55
|
+
|
|
56
|
+
declare type Merge<A, B> = {
|
|
57
|
+
[k in keyof A & keyof B]: (A & B)[k] extends never ? B[k] : 0 extends 1 & (A & B)[k] ? B[k] : (A & B)[k];
|
|
58
|
+
} & Omit<A, keyof B> & Omit<B, keyof A>;
|
|
59
|
+
|
|
60
|
+
declare type MergePartial<A, B> = {
|
|
61
|
+
[k in keyof A & keyof B]: (A & B)[k] extends never ? B[k] : 0 extends 1 & (A & B)[k] ? B[k] : (A & B)[k];
|
|
62
|
+
} & Omit<A, keyof B> & Partial<Omit<B, keyof A>>;
|
|
63
|
+
|
|
64
|
+
export declare interface Middleware<T> {
|
|
65
|
+
(req: MergePartial<Request_2, T>, res: Response_2, next: NextFunction): void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare class MiniController<T> implements MiniControllerInterface<T> {
|
|
69
|
+
private router;
|
|
70
|
+
private middlewares;
|
|
71
|
+
constructor(router: any, middlewares: any[]);
|
|
72
|
+
all: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
73
|
+
get: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
74
|
+
post: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
75
|
+
put: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
76
|
+
delete: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
77
|
+
patch: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
78
|
+
options: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
79
|
+
head: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
80
|
+
checkout: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
81
|
+
connect: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
82
|
+
copy: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
83
|
+
lock: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
84
|
+
merge: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
85
|
+
mkactivity: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
86
|
+
mkcol: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
87
|
+
move: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
88
|
+
'm-search': <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
89
|
+
notify: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
90
|
+
propfind: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
91
|
+
proppatch: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
92
|
+
purge: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
93
|
+
report: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
94
|
+
search: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
95
|
+
subscribe: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
96
|
+
trace: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
97
|
+
unlock: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
98
|
+
unsubscribe: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
99
|
+
link: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
100
|
+
unlink: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
101
|
+
private methodImplementation;
|
|
102
|
+
use<M0>(middleware0: RequestHandlerParams<M0>): MiniController<Merge<T, M0>>;
|
|
103
|
+
use<M0, M1>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>): MiniController<Merge<T, M0 & M1>>;
|
|
104
|
+
use<M0, M1, M2>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>, middleware2: RequestHandlerParams<M2>): MiniController<Merge<T, M0 & M1 & M2>>;
|
|
105
|
+
use<M0, M1, M2, M3>(middleware0: RequestHandlerParams<M0>, middleware1: RequestHandlerParams<M1>, middleware2: RequestHandlerParams<M2>, middleware3: RequestHandlerParams<M3>): MiniController<Merge<T, M0 & M1 & M2 & M3>>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare interface MiniControllerInterface<T> {
|
|
109
|
+
all: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
110
|
+
get: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
111
|
+
post: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
112
|
+
put: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
113
|
+
delete: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
114
|
+
patch: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
115
|
+
options: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
116
|
+
head: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
117
|
+
checkout: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
118
|
+
connect: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
119
|
+
copy: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
120
|
+
lock: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
121
|
+
merge: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
122
|
+
mkactivity: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
123
|
+
mkcol: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
124
|
+
move: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
125
|
+
"m-search": <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
126
|
+
notify: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
127
|
+
propfind: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
128
|
+
proppatch: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
129
|
+
purge: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
130
|
+
report: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
131
|
+
search: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
132
|
+
subscribe: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
133
|
+
trace: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
134
|
+
unlock: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
135
|
+
unsubscribe: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
136
|
+
link: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
137
|
+
unlink: <Path extends string>(path: Path, handler: RequestHandler<T, RouteParameters<Path>>) => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare interface MiniControllerWS<T> {
|
|
141
|
+
(handler: WSHandler<T>): void;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare interface ParamsDictionary {
|
|
145
|
+
[key: string]: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare type PathParams = string | RegExp | Array<string | RegExp>;
|
|
149
|
+
|
|
150
|
+
declare type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
|
|
151
|
+
|
|
152
|
+
declare interface RequestHandler<T, P = ParamsDictionary> {
|
|
153
|
+
(req: Merge<Request_2, T & {
|
|
154
|
+
params: P;
|
|
155
|
+
}>, res: Response_2, next: NextFunction): void;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare type RequestHandlerParams<T> = Middleware<T> | ErrorHandler<T>;
|
|
159
|
+
|
|
160
|
+
declare interface Route {
|
|
161
|
+
path: PathParams;
|
|
162
|
+
controller: Type<Controller>;
|
|
163
|
+
children?: Array<Route>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
declare type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary : Route extends `${string}(${string}` ? ParamsDictionary : Route extends `${string}:${infer Rest}` ? (GetRouteParameter<Rest> extends never ? ParamsDictionary : GetRouteParameter<Rest> extends `${infer ParamName}?` ? {
|
|
167
|
+
[P in ParamName]?: string;
|
|
168
|
+
} : {
|
|
169
|
+
[P in GetRouteParameter<Rest>]: string;
|
|
170
|
+
}) & (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown) : {};
|
|
171
|
+
|
|
172
|
+
declare const setControllerSymbol: unique symbol;
|
|
173
|
+
|
|
174
|
+
declare interface Settings extends Record<SettingsEnumKeys, any> {
|
|
175
|
+
caseSensitiveRouting: boolean;
|
|
176
|
+
env: string;
|
|
177
|
+
etag: any;
|
|
178
|
+
jsonpCallbackName: string;
|
|
179
|
+
jsonEscape: boolean;
|
|
180
|
+
jsonReplacer: any;
|
|
181
|
+
jsonSpaces: any;
|
|
182
|
+
queryParser: any;
|
|
183
|
+
strictRouting: boolean;
|
|
184
|
+
subdomainOffset: number;
|
|
185
|
+
trustProxy: any;
|
|
186
|
+
views: string | string[];
|
|
187
|
+
viewCache: boolean;
|
|
188
|
+
viewEngine: string;
|
|
189
|
+
xPoweredBy: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare type SettingsEnumKeys = 'caseSensitiveRouting' | 'env' | 'etag' | 'jsonpCallbackName' | 'jsonEscape' | 'jsonReplacer' | 'jsonSpaces' | 'queryParser' | 'strictRouting' | 'subdomainOffset' | 'trustProxy' | 'views' | 'viewCache' | 'viewEngine' | 'xPoweredBy';
|
|
193
|
+
|
|
194
|
+
declare interface Type<T> extends Function {
|
|
195
|
+
new (...args: any[]): T;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare type WSHandler<T> = (ws: WebSocket_2, req: Merge<Request_2, T>) => void;
|
|
199
|
+
|
|
200
|
+
export declare type WSMiddleware<T> = (ws: WebSocket_2, req: MergePartial<Request_2, T>, next: NextFunction) => void;
|
|
201
|
+
|
|
202
|
+
export { }
|
package/index.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
+
* or disable the default devtool with "devtool: false".
|
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
+
*/
|
|
9
|
+
/******/ var __webpack_modules__ = ({
|
|
10
|
+
|
|
11
|
+
/***/ "./src/app.ts":
|
|
12
|
+
/*!********************!*\
|
|
13
|
+
!*** ./src/app.ts ***!
|
|
14
|
+
\********************/
|
|
15
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16
|
+
|
|
17
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createApp: () => (/* binding */ createApp)\n/* harmony export */ });\n/* harmony import */ var reflect_metadata__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! reflect-metadata */ \"reflect-metadata\");\n/* harmony import */ var reflect_metadata__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reflect_metadata__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! express */ \"express\");\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(express__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inversify */ \"inversify\");\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(inversify__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _controller__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./controller */ \"./src/controller.ts\");\n/* harmony import */ var express_ws__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! express-ws */ \"express-ws\");\n/* harmony import */ var express_ws__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(express_ws__WEBPACK_IMPORTED_MODULE_3__);\n\n\n\n\n\nfunction createApp(config) {\n const app = express__WEBPACK_IMPORTED_MODULE_1___default()();\n if (config.on) {\n setEventCallbacks(app, config.on);\n }\n if (config.set) {\n applySettings(app, config.set);\n }\n express_ws__WEBPACK_IMPORTED_MODULE_3___default()(app);\n if (config.middlewares) {\n app.use.apply(app, config.middlewares);\n }\n const controllerEmulator = new ControllerEmulator(app);\n const container = new inversify__WEBPACK_IMPORTED_MODULE_2__.Container();\n initAllDependencies(config, container);\n initControllers(config.routes, container, controllerEmulator);\n return app;\n}\nfunction setEventCallbacks(app, settings) {\n for (const setting of settings) {\n app.on(setting.event, setting.callback);\n }\n}\nfunction applySettings(app, settings) {\n for (const [key, value] of Object.entries(settings)) {\n // @ts-ignore\n app.set(SettingsEnum[key], value);\n }\n}\nfunction initAllDependencies(config, container) {\n if (config.dependencies) {\n initDependencies(config.dependencies, container);\n }\n initControllersAsDependency(config.routes, container);\n}\nfunction initDependencies(dependencies, container) {\n for (const dep of dependencies) {\n if (dep.useValue) {\n bindValue(container, dep.provide, dep.useValue);\n continue;\n }\n if (dep.useClass) {\n bindClass(container, dep.provide, dep.useClass);\n continue;\n }\n }\n}\nfunction initControllersAsDependency(routes, container) {\n for (const route of routes) {\n bindClass(container, route.controller, route.controller);\n if (route.children) {\n initControllersAsDependency(route.children, container);\n }\n }\n}\nfunction bindClass(container, token, classtype) {\n if (!container.isBound(token)) {\n container.bind(token).to(classtype);\n }\n}\nfunction bindValue(container, token, value) {\n if (!container.isBound(token)) {\n container.bind(token).toConstantValue(value);\n }\n}\nfunction bindFactory(container, token, factory) {\n if (!container.isBound(token)) {\n container.bind(token).toFactory(factory);\n }\n}\nfunction initControllers(routes, container, app) {\n for (const route of routes) {\n const controller = container.get(route.controller);\n app[_controller__WEBPACK_IMPORTED_MODULE_4__.setControllerSymbol](route.path, controller);\n if (route.children) {\n initControllers(route.children, container, controller);\n }\n }\n}\nclass ControllerEmulator {\n constructor(app) {\n this.app = app;\n }\n [_controller__WEBPACK_IMPORTED_MODULE_4__.setControllerSymbol](path, subrouter) {\n this.app.use(path, subrouter[_controller__WEBPACK_IMPORTED_MODULE_4__.getRouterSymbol]());\n }\n}\nclass SettingsEnum {\n constructor() {\n this.caseSensitiveRouting = 'case sensitive routing';\n this.env = 'env';\n this.etag = 'etag';\n this.jsonpCallbackName = 'jsonp callback name';\n this.jsonEscape = 'json escape';\n this.jsonReplacer = 'json replacer';\n this.jsonSpaces = 'json spaces';\n this.queryParser = 'query parser';\n this.strictRouting = 'strict routing';\n this.subdomainOffset = 'subdomain offset';\n this.trustProxy = 'trust proxy';\n this.views = 'views';\n this.viewCache = 'view cache';\n this.viewEngine = 'view engine';\n this.xPoweredBy = 'x-powered-by';\n }\n}\n\n\n//# sourceURL=webpack://@galeh/chuka/./src/app.ts?");
|
|
18
|
+
|
|
19
|
+
/***/ }),
|
|
20
|
+
|
|
21
|
+
/***/ "./src/controller.ts":
|
|
22
|
+
/*!***************************!*\
|
|
23
|
+
!*** ./src/controller.ts ***!
|
|
24
|
+
\***************************/
|
|
25
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
26
|
+
|
|
27
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Controller: () => (/* binding */ Controller),\n/* harmony export */ getRouterSymbol: () => (/* binding */ getRouterSymbol),\n/* harmony export */ setControllerSymbol: () => (/* binding */ setControllerSymbol)\n/* harmony export */ });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"tslib\");\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tslib__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! express */ \"express\");\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(express__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inversify */ \"inversify\");\n/* harmony import */ var inversify__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(inversify__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\nconst getRouterSymbol = Symbol();\nconst setControllerSymbol = Symbol();\nlet Controller = class Controller {\n constructor() {\n this.router = (0,express__WEBPACK_IMPORTED_MODULE_1__.Router)();\n }\n [setControllerSymbol](path, subrouter) {\n this.router.use(path, subrouter[getRouterSymbol]());\n }\n [getRouterSymbol]() {\n return this.router;\n }\n useWS(...middlewares) {\n return (handler) => {\n this.router.ws.apply(this.router, ['/', ...middlewares, handler]);\n };\n }\n use(...middlewares) {\n return new MiniController(this.router, middlewares);\n }\n};\nController = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([\n (0,inversify__WEBPACK_IMPORTED_MODULE_2__.injectable)()\n], Controller);\n\nclass MiniController {\n constructor(router, middlewares) {\n this.router = router;\n this.middlewares = middlewares;\n this.all = this.methodImplementation('all').bind(this);\n this.get = this.methodImplementation('get').bind(this);\n this.post = this.methodImplementation('post').bind(this);\n this.put = this.methodImplementation('put').bind(this);\n this.delete = this.methodImplementation('delete').bind(this);\n this.patch = this.methodImplementation('patch').bind(this);\n this.options = this.methodImplementation('options').bind(this);\n this.head = this.methodImplementation('head').bind(this);\n this.checkout = this.methodImplementation('checkout').bind(this);\n this.connect = this.methodImplementation('connect').bind(this);\n this.copy = this.methodImplementation('copy').bind(this);\n this.lock = this.methodImplementation('lock').bind(this);\n this.merge = this.methodImplementation('merge').bind(this);\n this.mkactivity = this.methodImplementation('mkactivity').bind(this);\n this.mkcol = this.methodImplementation('mkcol').bind(this);\n this.move = this.methodImplementation('move').bind(this);\n this['m-search'] = this.methodImplementation('m-search').bind(this);\n this.notify = this.methodImplementation('notify').bind(this);\n this.propfind = this.methodImplementation('propfind').bind(this);\n this.proppatch = this.methodImplementation('proppatch').bind(this);\n this.purge = this.methodImplementation('purge').bind(this);\n this.report = this.methodImplementation('report').bind(this);\n this.search = this.methodImplementation('search').bind(this);\n this.subscribe = this.methodImplementation('subscribe').bind(this);\n this.trace = this.methodImplementation('trace').bind(this);\n this.unlock = this.methodImplementation('unlock').bind(this);\n this.unsubscribe = this.methodImplementation('unsubscribe').bind(this);\n this.link = this.methodImplementation('link').bind(this);\n this.unlink = this.methodImplementation('unlink').bind(this);\n }\n methodImplementation(methodName) {\n return (path, handler) => {\n this.router[methodName].apply(this.router, [\n path,\n ...this.middlewares,\n (req, res, next) => {\n handler(req, res, next);\n }\n ]);\n };\n }\n use(...middlewares) {\n return new MiniController(this.router, this.middlewares.concat(middlewares));\n }\n}\n\n\n//# sourceURL=webpack://@galeh/chuka/./src/controller.ts?");
|
|
28
|
+
|
|
29
|
+
/***/ }),
|
|
30
|
+
|
|
31
|
+
/***/ "./src/index.ts":
|
|
32
|
+
/*!**********************!*\
|
|
33
|
+
!*** ./src/index.ts ***!
|
|
34
|
+
\**********************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Controller: () => (/* reexport safe */ _controller__WEBPACK_IMPORTED_MODULE_1__.Controller),\n/* harmony export */ createApp: () => (/* reexport safe */ _app__WEBPACK_IMPORTED_MODULE_0__.createApp)\n/* harmony export */ });\n/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./app */ \"./src/app.ts\");\n/* harmony import */ var _controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./controller */ \"./src/controller.ts\");\n\n\n\n\n//# sourceURL=webpack://@galeh/chuka/./src/index.ts?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "express":
|
|
42
|
+
/*!**************************!*\
|
|
43
|
+
!*** external "express" ***!
|
|
44
|
+
\**************************/
|
|
45
|
+
/***/ ((module) => {
|
|
46
|
+
|
|
47
|
+
module.exports = require("express");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "express-ws":
|
|
52
|
+
/*!*****************************!*\
|
|
53
|
+
!*** external "express-ws" ***!
|
|
54
|
+
\*****************************/
|
|
55
|
+
/***/ ((module) => {
|
|
56
|
+
|
|
57
|
+
module.exports = require("express-ws");
|
|
58
|
+
|
|
59
|
+
/***/ }),
|
|
60
|
+
|
|
61
|
+
/***/ "inversify":
|
|
62
|
+
/*!****************************!*\
|
|
63
|
+
!*** external "inversify" ***!
|
|
64
|
+
\****************************/
|
|
65
|
+
/***/ ((module) => {
|
|
66
|
+
|
|
67
|
+
module.exports = require("inversify");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
71
|
+
/***/ "reflect-metadata":
|
|
72
|
+
/*!***********************************!*\
|
|
73
|
+
!*** external "reflect-metadata" ***!
|
|
74
|
+
\***********************************/
|
|
75
|
+
/***/ ((module) => {
|
|
76
|
+
|
|
77
|
+
module.exports = require("reflect-metadata");
|
|
78
|
+
|
|
79
|
+
/***/ }),
|
|
80
|
+
|
|
81
|
+
/***/ "tslib":
|
|
82
|
+
/*!************************!*\
|
|
83
|
+
!*** external "tslib" ***!
|
|
84
|
+
\************************/
|
|
85
|
+
/***/ ((module) => {
|
|
86
|
+
|
|
87
|
+
module.exports = require("tslib");
|
|
88
|
+
|
|
89
|
+
/***/ })
|
|
90
|
+
|
|
91
|
+
/******/ });
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
/******/ // The module cache
|
|
94
|
+
/******/ var __webpack_module_cache__ = {};
|
|
95
|
+
/******/
|
|
96
|
+
/******/ // The require function
|
|
97
|
+
/******/ function __webpack_require__(moduleId) {
|
|
98
|
+
/******/ // Check if module is in cache
|
|
99
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
100
|
+
/******/ if (cachedModule !== undefined) {
|
|
101
|
+
/******/ return cachedModule.exports;
|
|
102
|
+
/******/ }
|
|
103
|
+
/******/ // Create a new module (and put it into the cache)
|
|
104
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
105
|
+
/******/ // no module.id needed
|
|
106
|
+
/******/ // no module.loaded needed
|
|
107
|
+
/******/ exports: {}
|
|
108
|
+
/******/ };
|
|
109
|
+
/******/
|
|
110
|
+
/******/ // Execute the module function
|
|
111
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
112
|
+
/******/
|
|
113
|
+
/******/ // Return the exports of the module
|
|
114
|
+
/******/ return module.exports;
|
|
115
|
+
/******/ }
|
|
116
|
+
/******/
|
|
117
|
+
/************************************************************************/
|
|
118
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
119
|
+
/******/ (() => {
|
|
120
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
121
|
+
/******/ __webpack_require__.n = (module) => {
|
|
122
|
+
/******/ var getter = module && module.__esModule ?
|
|
123
|
+
/******/ () => (module['default']) :
|
|
124
|
+
/******/ () => (module);
|
|
125
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
126
|
+
/******/ return getter;
|
|
127
|
+
/******/ };
|
|
128
|
+
/******/ })();
|
|
129
|
+
/******/
|
|
130
|
+
/******/ /* webpack/runtime/define property getters */
|
|
131
|
+
/******/ (() => {
|
|
132
|
+
/******/ // define getter functions for harmony exports
|
|
133
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
134
|
+
/******/ for(var key in definition) {
|
|
135
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
136
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
137
|
+
/******/ }
|
|
138
|
+
/******/ }
|
|
139
|
+
/******/ };
|
|
140
|
+
/******/ })();
|
|
141
|
+
/******/
|
|
142
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
143
|
+
/******/ (() => {
|
|
144
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
145
|
+
/******/ })();
|
|
146
|
+
/******/
|
|
147
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
148
|
+
/******/ (() => {
|
|
149
|
+
/******/ // define __esModule on exports
|
|
150
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
151
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
152
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
153
|
+
/******/ }
|
|
154
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
155
|
+
/******/ };
|
|
156
|
+
/******/ })();
|
|
157
|
+
/******/
|
|
158
|
+
/************************************************************************/
|
|
159
|
+
/******/
|
|
160
|
+
/******/ // startup
|
|
161
|
+
/******/ // Load entry module and return exports
|
|
162
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
163
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
|
|
164
|
+
/******/ var __webpack_export_target__ = exports;
|
|
165
|
+
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
|
166
|
+
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
167
|
+
/******/
|
package/middlewares.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { json } from 'express';
|
|
2
|
+
import { query } from 'express';
|
|
3
|
+
import { raw } from 'express';
|
|
4
|
+
import { static } from 'express';
|
|
5
|
+
import { text } from 'express';
|
|
6
|
+
import { urlencoded } from 'express';
|
|
7
|
+
|
|
8
|
+
export { json }
|
|
9
|
+
|
|
10
|
+
export { query }
|
|
11
|
+
|
|
12
|
+
export { raw }
|
|
13
|
+
|
|
14
|
+
export { static }
|
|
15
|
+
|
|
16
|
+
export { text }
|
|
17
|
+
|
|
18
|
+
export { urlencoded }
|
|
19
|
+
|
|
20
|
+
export { }
|
package/middlewares.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
+
* or disable the default devtool with "devtool: false".
|
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
+
*/
|
|
9
|
+
/******/ var __webpack_modules__ = ({
|
|
10
|
+
|
|
11
|
+
/***/ "./src/middlewares/index.ts":
|
|
12
|
+
/*!**********************************!*\
|
|
13
|
+
!*** ./src/middlewares/index.ts ***!
|
|
14
|
+
\**********************************/
|
|
15
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16
|
+
|
|
17
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ json: () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__.json),\n/* harmony export */ query: () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__.query),\n/* harmony export */ raw: () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__.raw),\n/* harmony export */ \"static\": () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__[\"static\"]),\n/* harmony export */ text: () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__.text),\n/* harmony export */ urlencoded: () => (/* reexport safe */ express__WEBPACK_IMPORTED_MODULE_0__.urlencoded)\n/* harmony export */ });\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! express */ \"express\");\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(express__WEBPACK_IMPORTED_MODULE_0__);\n\n\n\n//# sourceURL=webpack://@galeh/chuka/./src/middlewares/index.ts?");
|
|
18
|
+
|
|
19
|
+
/***/ }),
|
|
20
|
+
|
|
21
|
+
/***/ "express":
|
|
22
|
+
/*!**************************!*\
|
|
23
|
+
!*** external "express" ***!
|
|
24
|
+
\**************************/
|
|
25
|
+
/***/ ((module) => {
|
|
26
|
+
|
|
27
|
+
module.exports = require("express");
|
|
28
|
+
|
|
29
|
+
/***/ })
|
|
30
|
+
|
|
31
|
+
/******/ });
|
|
32
|
+
/************************************************************************/
|
|
33
|
+
/******/ // The module cache
|
|
34
|
+
/******/ var __webpack_module_cache__ = {};
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // The require function
|
|
37
|
+
/******/ function __webpack_require__(moduleId) {
|
|
38
|
+
/******/ // Check if module is in cache
|
|
39
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
40
|
+
/******/ if (cachedModule !== undefined) {
|
|
41
|
+
/******/ return cachedModule.exports;
|
|
42
|
+
/******/ }
|
|
43
|
+
/******/ // Create a new module (and put it into the cache)
|
|
44
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
45
|
+
/******/ // no module.id needed
|
|
46
|
+
/******/ // no module.loaded needed
|
|
47
|
+
/******/ exports: {}
|
|
48
|
+
/******/ };
|
|
49
|
+
/******/
|
|
50
|
+
/******/ // Execute the module function
|
|
51
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // Return the exports of the module
|
|
54
|
+
/******/ return module.exports;
|
|
55
|
+
/******/ }
|
|
56
|
+
/******/
|
|
57
|
+
/************************************************************************/
|
|
58
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
59
|
+
/******/ (() => {
|
|
60
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
61
|
+
/******/ __webpack_require__.n = (module) => {
|
|
62
|
+
/******/ var getter = module && module.__esModule ?
|
|
63
|
+
/******/ () => (module['default']) :
|
|
64
|
+
/******/ () => (module);
|
|
65
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
66
|
+
/******/ return getter;
|
|
67
|
+
/******/ };
|
|
68
|
+
/******/ })();
|
|
69
|
+
/******/
|
|
70
|
+
/******/ /* webpack/runtime/define property getters */
|
|
71
|
+
/******/ (() => {
|
|
72
|
+
/******/ // define getter functions for harmony exports
|
|
73
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
74
|
+
/******/ for(var key in definition) {
|
|
75
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
76
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
77
|
+
/******/ }
|
|
78
|
+
/******/ }
|
|
79
|
+
/******/ };
|
|
80
|
+
/******/ })();
|
|
81
|
+
/******/
|
|
82
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
83
|
+
/******/ (() => {
|
|
84
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
85
|
+
/******/ })();
|
|
86
|
+
/******/
|
|
87
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
88
|
+
/******/ (() => {
|
|
89
|
+
/******/ // define __esModule on exports
|
|
90
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
91
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
92
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
93
|
+
/******/ }
|
|
94
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
95
|
+
/******/ };
|
|
96
|
+
/******/ })();
|
|
97
|
+
/******/
|
|
98
|
+
/************************************************************************/
|
|
99
|
+
/******/
|
|
100
|
+
/******/ // startup
|
|
101
|
+
/******/ // Load entry module and return exports
|
|
102
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
103
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/middlewares/index.ts");
|
|
104
|
+
/******/ var __webpack_export_target__ = exports;
|
|
105
|
+
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
|
106
|
+
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
107
|
+
/******/
|