backendium 0.0.10 → 0.0.11

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/dist/handler.js CHANGED
@@ -1,3 +1,23 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
1
21
  import BackendiumResponse from "./response.js";
2
22
  import parseRequest from "./request.js";
3
23
  export function defaultAuthFailedHandler(request, response, app) {
@@ -6,23 +26,25 @@ export function defaultAuthFailedHandler(request, response, app) {
6
26
  }
7
27
  export function defaultErrorHandler(request, response, data, app, error, message) {
8
28
  response.status(500);
9
- response.end(message ?? "Internal Server Error");
29
+ response.end(message !== null && message !== void 0 ? message : "Internal Server Error");
10
30
  app.logger.requestError(request.url, data, error);
11
31
  }
12
32
  export function defaultValidationErrorHandler(request, response, app, data, error, message) {
13
33
  response.status(400);
14
- response.end(message ?? "Validation failed"); // @TODO
34
+ response.end(message !== null && message !== void 0 ? message : "Validation failed: " + error.message);
15
35
  }
16
- export default function backendiumHandler(handler, { auth, authChecker, authFailed, errorHandler, errorMessage, validationErrorHandler, validationErrorMessage, ...options }) {
17
- return (router) => (app) => (async (request, response, next) => {
36
+ export default function backendiumHandler(handler, _a) {
37
+ var { auth, authChecker, authFailed, errorHandler, errorMessage, validationErrorHandler, validationErrorMessage } = _a, options = __rest(_a, ["auth", "authChecker", "authFailed", "errorHandler", "errorMessage", "validationErrorHandler", "validationErrorMessage"]);
38
+ return (router) => (app) => ((request, response, next) => __awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
18
40
  let body;
19
41
  try {
20
- let req = await parseRequest(request, app, { ...options, auth, authChecker, authFailed, errorHandler, validationErrorHandler, errorMessage, validationErrorMessage });
42
+ let req = yield parseRequest(request, app, Object.assign(Object.assign({}, options), { auth, authChecker, authFailed, errorHandler, validationErrorHandler, errorMessage, validationErrorMessage }));
21
43
  let res = new BackendiumResponse(response, app);
22
44
  if (Array.isArray(req)) {
23
45
  let [data, error] = req;
24
- (validationErrorHandler ?? app.config.validationErrorHandler ?? defaultValidationErrorHandler)(request, res, app, data, error, validationErrorMessage ?? app.config.validationErrorMessage);
25
- if (app.config.logging?.fullRequest)
46
+ ((_a = validationErrorHandler !== null && validationErrorHandler !== void 0 ? validationErrorHandler : app.config.validationErrorHandler) !== null && _a !== void 0 ? _a : defaultValidationErrorHandler)(request, res, app, data, error, validationErrorMessage !== null && validationErrorMessage !== void 0 ? validationErrorMessage : app.config.validationErrorMessage);
47
+ if ((_b = app.config.logging) === null || _b === void 0 ? void 0 : _b.fullRequest)
26
48
  app.logger.requestFull(request.url, res.lastStatus, data, res.lastResponse);
27
49
  else
28
50
  app.logger.request(request.url, res.lastStatus);
@@ -34,9 +56,13 @@ export default function backendiumHandler(handler, { auth, authChecker, authFail
34
56
  if (authChecker) {
35
57
  let ret = authChecker(request, res, app);
36
58
  if (ret instanceof Promise)
37
- ret = await ret;
59
+ ret = yield ret;
38
60
  if (ret === null) {
39
- (authFailed ?? router.authFailed ?? app.authFailed ?? defaultAuthFailedHandler)(request, res, app);
61
+ ((_d = (_c = authFailed !== null && authFailed !== void 0 ? authFailed : router.authFailed) !== null && _c !== void 0 ? _c : app.authFailed) !== null && _d !== void 0 ? _d : defaultAuthFailedHandler)(request, res, app);
62
+ if ((_e = app.config.logging) === null || _e === void 0 ? void 0 : _e.fullRequest)
63
+ app.logger.requestFull(request.url, res.lastStatus, req.body, res.lastResponse);
64
+ else
65
+ app.logger.request(request.url, res.lastStatus);
40
66
  return;
41
67
  }
42
68
  authData = ret;
@@ -46,18 +72,27 @@ export default function backendiumHandler(handler, { auth, authChecker, authFail
46
72
  if (!authChecker && auth && router.authChecker) {
47
73
  let ret = router.authChecker(request, res, app);
48
74
  if (ret instanceof Promise)
49
- ret = await ret;
75
+ ret = yield ret;
50
76
  if (ret === null) {
51
- (authFailed ?? router.authFailed ?? app.authFailed ?? defaultAuthFailedHandler)(request, res, app);
77
+ ((_g = (_f = authFailed !== null && authFailed !== void 0 ? authFailed : router.authFailed) !== null && _f !== void 0 ? _f : app.authFailed) !== null && _g !== void 0 ? _g : defaultAuthFailedHandler)(request, res, app);
78
+ if ((_h = app.config.logging) === null || _h === void 0 ? void 0 : _h.fullRequest)
79
+ app.logger.requestFull(request.url, res.lastStatus, req.body, res.lastResponse);
80
+ else
81
+ app.logger.request(request.url, res.lastStatus);
52
82
  return;
53
83
  }
54
84
  globalAuthData = ret;
55
85
  }
56
- let ret = handler({ ...req, auth: authData, globalAuth: globalAuthData }, res, app, next);
86
+ let ret = handler(Object.assign(Object.assign({}, req), { auth: authData, globalAuth: globalAuthData }), res, app, next);
57
87
  if (ret instanceof Promise)
58
- ret = await ret;
59
- if (!ret)
88
+ ret = yield ret;
89
+ if (!ret) {
90
+ if ((_j = app.config.logging) === null || _j === void 0 ? void 0 : _j.fullRequest)
91
+ app.logger.requestFull(request.url, res.lastStatus, req.body, res.lastResponse);
92
+ else
93
+ app.logger.request(request.url, res.lastStatus);
60
94
  return;
95
+ }
61
96
  let { code = 200, next: isNext = false } = ret;
62
97
  response.status(code);
63
98
  if (isNext) {
@@ -67,16 +102,14 @@ export default function backendiumHandler(handler, { auth, authChecker, authFail
67
102
  try {
68
103
  response.end();
69
104
  }
70
- catch (error) {
71
- return;
72
- }
73
- if (app.config.logging?.fullRequest)
105
+ catch (error) { }
106
+ if ((_k = app.config.logging) === null || _k === void 0 ? void 0 : _k.fullRequest)
74
107
  app.logger.requestFull(request.url, res.lastStatus, req.body, res.lastResponse);
75
108
  else
76
109
  app.logger.request(request.url, res.lastStatus);
77
110
  }
78
111
  catch (error) {
79
- (errorHandler ?? app.config.errorHandler ?? defaultErrorHandler)(request, new BackendiumResponse(response, app), body, app, error, errorMessage ?? app.config.errorMessage);
112
+ ((_l = errorHandler !== null && errorHandler !== void 0 ? errorHandler : app.config.errorHandler) !== null && _l !== void 0 ? _l : defaultErrorHandler)(request, new BackendiumResponse(response, app), body, app, error, errorMessage !== null && errorMessage !== void 0 ? errorMessage : app.config.errorMessage);
80
113
  }
81
- });
114
+ }));
82
115
  }
@@ -0,0 +1,171 @@
1
+ import { BackendiumHandlerType } from "./handler.js";
2
+ import { BackendiumRequestOptionsType } from "./request.js";
3
+ export type MethodType = "use" | "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" | "checkout" | "connect" | "copy" | "lock" | "merge" | "mkactivity" | "mkcol" | "move" | "m-search" | "notify" | "propfind" | "proppatch" | "purge" | "report" | "search" | "subscribe" | "unsubscribe" | "trace" | "unlock" | "link" | "unlink" | "useHTTP";
4
+ export declare abstract class BackendiumHttpRouter<GlobalAuthType = undefined> {
5
+ protected abstract pushHandlers<BodyType, ParamsType, QueryType, AuthType, HeadersType>(method: MethodType, path: string | undefined, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType> | undefined, handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
6
+ protected parseArgs<BodyType, ParamsType, QueryType, AuthType, HeadersType>(args: any[]): [
7
+ string | undefined,
8
+ BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType> | undefined,
9
+ Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>
10
+ ];
11
+ addHandler<BodyType, ParamsType, QueryType, AuthType, HeadersType>(method: MethodType, path: string, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
12
+ addHandler<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(method: MethodType, path: string, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
13
+ addHandler<BodyType, ParamsType, QueryType, AuthType, HeadersType>(method: MethodType, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
14
+ addHandler<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(method: MethodType, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
15
+ addHandler<BodyType, ParamsType, QueryType, AuthType, HeadersType>(method: MethodType, path: string, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
16
+ use<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
17
+ use<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
18
+ use<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
19
+ use<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
20
+ use<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
21
+ all<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
22
+ all<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
23
+ all<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
24
+ all<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
25
+ all<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
26
+ get<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
27
+ get<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
28
+ get<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
29
+ get<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
30
+ get<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
31
+ post<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
32
+ post<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
33
+ post<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
34
+ post<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
35
+ post<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
36
+ put<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
37
+ put<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
38
+ put<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
39
+ put<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
40
+ put<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
41
+ delete<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
42
+ delete<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
43
+ delete<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
44
+ delete<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
45
+ delete<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
46
+ patch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
47
+ patch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
48
+ patch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
49
+ patch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
50
+ patch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
51
+ options<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
52
+ options<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
53
+ options<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
54
+ options<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
55
+ options<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
56
+ head<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
57
+ head<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
58
+ head<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
59
+ head<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
60
+ head<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
61
+ checkout<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
62
+ checkout<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
63
+ checkout<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
64
+ checkout<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
65
+ checkout<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
66
+ connect<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
67
+ connect<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
68
+ connect<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
69
+ connect<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
70
+ connect<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
71
+ copy<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
72
+ copy<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
73
+ copy<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
74
+ copy<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
75
+ copy<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
76
+ lock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
77
+ lock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
78
+ lock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
79
+ lock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
80
+ lock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
81
+ merge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
82
+ merge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
83
+ merge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
84
+ merge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
85
+ merge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
86
+ mkactivity<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
87
+ mkactivity<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
88
+ mkactivity<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
89
+ mkactivity<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
90
+ mkactivity<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
91
+ mkcol<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
92
+ mkcol<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
93
+ mkcol<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
94
+ mkcol<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
95
+ mkcol<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
96
+ move<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
97
+ move<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
98
+ move<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
99
+ move<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
100
+ move<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
101
+ "m-search"<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
102
+ "m-search"<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
103
+ "m-search"<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
104
+ "m-search"<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
105
+ "m-search"<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
106
+ notify<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
107
+ notify<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
108
+ notify<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
109
+ notify<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
110
+ notify<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
111
+ propfind<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
112
+ propfind<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
113
+ propfind<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
114
+ propfind<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
115
+ propfind<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
116
+ proppatch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
117
+ proppatch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
118
+ proppatch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
119
+ proppatch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
120
+ proppatch<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
121
+ purge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
122
+ purge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
123
+ purge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
124
+ purge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
125
+ purge<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
126
+ report<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
127
+ report<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
128
+ report<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
129
+ report<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
130
+ report<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
131
+ search<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
132
+ search<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
133
+ search<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
134
+ search<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
135
+ search<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
136
+ subscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
137
+ subscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
138
+ subscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
139
+ subscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
140
+ subscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
141
+ unsubscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
142
+ unsubscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
143
+ unsubscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
144
+ unsubscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
145
+ unsubscribe<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
146
+ trace<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
147
+ trace<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
148
+ trace<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
149
+ trace<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
150
+ trace<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
151
+ unlock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
152
+ unlock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
153
+ unlock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
154
+ unlock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
155
+ unlock<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
156
+ link<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
157
+ link<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
158
+ link<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
159
+ link<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
160
+ link<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
161
+ unlink<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
162
+ unlink<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
163
+ unlink<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
164
+ unlink<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
165
+ unlink<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
166
+ useHTTP<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
167
+ useHTTP<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
168
+ useHTTP<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
169
+ useHTTP<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>, ...handlers: Array<BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>>): void;
170
+ useHTTP<BodyType = Buffer, ParamsType = {}, QueryType = {}, AuthType = GlobalAuthType, HeadersType = {}>(path: string | RegExp, handler: BackendiumHandlerType<BodyType, ParamsType, QueryType, AuthType, HeadersType, GlobalAuthType>, options: BackendiumRequestOptionsType<BodyType, ParamsType, QueryType, AuthType, HeadersType>): void;
171
+ }
@@ -0,0 +1,125 @@
1
+ export class BackendiumHttpRouter {
2
+ parseArgs(args) {
3
+ let path;
4
+ let options;
5
+ let handlers = [];
6
+ if (args.length === 0) {
7
+ throw new Error("At least one handler is required.");
8
+ }
9
+ // First argument might be a string (path)
10
+ if (typeof args[0] === "string") {
11
+ path = args[0];
12
+ args = args.slice(1);
13
+ }
14
+ // Next argument might be an options object
15
+ if (args.length > 0 && typeof args[0] === "object" && !Array.isArray(args[0]) && args[0] !== null) {
16
+ options = args[0];
17
+ args = args.slice(1);
18
+ }
19
+ // Remaining arguments are handlers
20
+ handlers = args.filter(arg => typeof arg === "function");
21
+ if (handlers.length === 0) {
22
+ throw new Error("At least one handler is required.");
23
+ }
24
+ return [path, options, handlers];
25
+ }
26
+ // Implementation
27
+ addHandler(method, ...args) {
28
+ // const [path, options, handlers] = this.parseArgs(args);
29
+ // this.pushHandlers([method, path, handlers.map((handler) => backendiumHandler(handler, options ?? { auth: false })(this))]);
30
+ this.pushHandlers(method, ...this.parseArgs(args));
31
+ }
32
+ use(...args) {
33
+ this.addHandler("use", ...args);
34
+ }
35
+ all(...args) {
36
+ this.addHandler("all", ...args);
37
+ }
38
+ get(...args) {
39
+ this.addHandler("get", ...args);
40
+ }
41
+ post(...args) {
42
+ this.addHandler("post", ...args);
43
+ }
44
+ put(...args) {
45
+ this.addHandler("put", ...args);
46
+ }
47
+ delete(...args) {
48
+ this.addHandler("delete", ...args);
49
+ }
50
+ patch(...args) {
51
+ this.addHandler("patch", ...args);
52
+ }
53
+ options(...args) {
54
+ this.addHandler("options", ...args);
55
+ }
56
+ head(...args) {
57
+ this.addHandler("head", ...args);
58
+ }
59
+ checkout(...args) {
60
+ this.addHandler("checkout", ...args);
61
+ }
62
+ connect(...args) {
63
+ this.addHandler("connect", ...args);
64
+ }
65
+ copy(...args) {
66
+ this.addHandler("copy", ...args);
67
+ }
68
+ lock(...args) {
69
+ this.addHandler("lock", ...args);
70
+ }
71
+ merge(...args) {
72
+ this.addHandler("merge", ...args);
73
+ }
74
+ mkactivity(...args) {
75
+ this.addHandler("mkactivity", ...args);
76
+ }
77
+ mkcol(...args) {
78
+ this.addHandler("mkcol", ...args);
79
+ }
80
+ move(...args) {
81
+ this.addHandler("move", ...args);
82
+ }
83
+ "m-search"(...args) {
84
+ this.addHandler("m-search", ...args);
85
+ }
86
+ notify(...args) {
87
+ this.addHandler("notify", ...args);
88
+ }
89
+ propfind(...args) {
90
+ this.addHandler("propfind", ...args);
91
+ }
92
+ proppatch(...args) {
93
+ this.addHandler("proppatch", ...args);
94
+ }
95
+ purge(...args) {
96
+ this.addHandler("purge", ...args);
97
+ }
98
+ report(...args) {
99
+ this.addHandler("report", ...args);
100
+ }
101
+ search(...args) {
102
+ this.addHandler("search", ...args);
103
+ }
104
+ subscribe(...args) {
105
+ this.addHandler("subscribe", ...args);
106
+ }
107
+ unsubscribe(...args) {
108
+ this.addHandler("unsubscribe", ...args);
109
+ }
110
+ trace(...args) {
111
+ this.addHandler("trace", ...args);
112
+ }
113
+ unlock(...args) {
114
+ this.addHandler("unlock", ...args);
115
+ }
116
+ link(...args) {
117
+ this.addHandler("link", ...args);
118
+ }
119
+ unlink(...args) {
120
+ this.addHandler("unlink", ...args);
121
+ }
122
+ useHTTP(...args) {
123
+ this.addHandler("useHTTP", ...args);
124
+ }
125
+ }
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { Request, RequestHandler } from "express";
2
2
  import { Server } from "node:http";
3
- import { BackendiumRouter, MethodType } from "./router.js";
3
+ import { BackendiumRouter } from "./router.js";
4
4
  import { EventEmitter, EventKey } from "event-emitter-typescript";
5
5
  import { WebSocketExpress, WSRequestHandler } from "websocket-express";
6
6
  import { BackendiumWebSocket } from "./ws.js";
7
- import Logger from "./logger.js";
7
+ import Logger from "./logger";
8
8
  import BackendiumResponse from "./response";
9
9
  import { ValidationError } from "checkeasy";
10
+ import type { MethodType } from "./httpRouter.js";
10
11
  export type BackendiumConfigType = {
11
12
  port: number;
12
13
  host: string;
@@ -50,5 +51,5 @@ export default class Backendium<GlobalAuthType = any> extends BackendiumRouter<G
50
51
  start(callback?: (server: Server) => void): Server;
51
52
  startAsync(): Promise<Server>;
52
53
  }
53
- export * from "./ws.js";
54
- export * from "./router.js";
54
+ export * from "./ws";
55
+ export * from "./router";
package/dist/index.js CHANGED
@@ -1,22 +1,32 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { BackendiumRouter } from "./router.js";
2
11
  import { EventEmitter } from "event-emitter-typescript";
3
12
  import { WebSocketExpress } from "websocket-express";
4
- import Logger from "./logger.js";
13
+ import Logger from "./logger";
5
14
  export default class Backendium extends BackendiumRouter {
6
- express = new WebSocketExpress;
7
- eventEmitter = new EventEmitter;
8
- logger = new Logger(console.log.bind(console));
9
- config_ = {};
10
15
  constructor(config = {}) {
11
16
  super();
17
+ this.express = new WebSocketExpress;
18
+ this.eventEmitter = new EventEmitter;
19
+ this.logger = new Logger(console.log.bind(console));
20
+ this.config_ = {};
12
21
  this.config = config;
13
22
  }
14
23
  get config() { return this.config_; }
15
24
  set config(config) {
16
- this.config_ = { ...this.config_, ...config, logging: { ...this.config_.logging, ...config.logging } };
17
- if (this.config_.logging?.path)
18
- this.logger.path = this.config_.logging?.path;
19
- if (this.config_.logging?.replaceConsoleLog ?? true) {
25
+ var _a, _b, _c, _d;
26
+ this.config_ = Object.assign(Object.assign(Object.assign({}, this.config_), config), { logging: Object.assign(Object.assign({}, this.config_.logging), config.logging) });
27
+ if ((_a = this.config_.logging) === null || _a === void 0 ? void 0 : _a.path)
28
+ this.logger.path = (_b = this.config_.logging) === null || _b === void 0 ? void 0 : _b.path;
29
+ if ((_d = (_c = this.config_.logging) === null || _c === void 0 ? void 0 : _c.replaceConsoleLog) !== null && _d !== void 0 ? _d : true) {
20
30
  console.log = this.logger.message.bind(this.logger);
21
31
  console.error = this.logger.error.bind(this.logger);
22
32
  }
@@ -43,6 +53,7 @@ export default class Backendium extends BackendiumRouter {
43
53
  }
44
54
  ;
45
55
  start(callback) {
56
+ var _a, _b;
46
57
  this.handlers.forEach(([method, route, handlers]) => {
47
58
  if (method == "ws")
48
59
  this.addWSHandler(route, handlers.map(handler => handler(this)));
@@ -57,19 +68,22 @@ export default class Backendium extends BackendiumRouter {
57
68
  // if (callback) callback(server);
58
69
  // this.eventEmitter.emit("start", [server]);
59
70
  // });
60
- const server = this.express.listen(this.config_.port ?? 8080, this.config_.host ?? "localhost", () => {
61
- this.logger.initMessage(this.config_.name ?? "app", this.config_.version ?? "0.0.0", this.config.port ?? 8080, this.config_.host ?? "localhost");
71
+ const server = this.express.listen((_a = this.config_.port) !== null && _a !== void 0 ? _a : 8080, (_b = this.config_.host) !== null && _b !== void 0 ? _b : "localhost", () => {
72
+ var _a, _b, _c, _d;
73
+ this.logger.initMessage((_a = this.config_.name) !== null && _a !== void 0 ? _a : "app", (_b = this.config_.version) !== null && _b !== void 0 ? _b : "0.0.0", (_c = this.config.port) !== null && _c !== void 0 ? _c : 8080, (_d = this.config_.host) !== null && _d !== void 0 ? _d : "localhost");
62
74
  if (callback)
63
75
  callback(server);
64
76
  this.eventEmitter.emit("start", [server]);
65
77
  });
66
78
  return server;
67
79
  }
68
- async startAsync() {
69
- return new Promise(resolve => {
70
- this.start(resolve);
80
+ startAsync() {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return new Promise(resolve => {
83
+ this.start(resolve);
84
+ });
71
85
  });
72
86
  }
73
87
  }
74
- export * from "./ws.js";
75
- export * from "./router.js";
88
+ export * from "./ws";
89
+ export * from "./router";
package/dist/logger.js CHANGED
@@ -6,12 +6,10 @@ export function getDate() {
6
6
  return `${date.getFullYear()}.${date.getMonth() + 1}.${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
7
7
  }
8
8
  export default class Logger {
9
- log;
10
- path_;
11
- logData = "";
12
9
  constructor(log, path_) {
13
10
  this.log = log;
14
11
  this.path_ = path_;
12
+ this.logData = "";
15
13
  }
16
14
  get path() { return this.path_; }
17
15
  set path(path) {
package/dist/request.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Request } from "express";
2
2
  import Backendium from "./index.js";
3
3
  import { ValidationError, Validator } from "checkeasy";
4
- import BackendiumResponse from "./response.js";
4
+ import BackendiumResponse from "./response";
5
5
  export type ValidatorsType<BodyType, ParamsType, QueryType, HeadersType> = {
6
6
  bodyValidator?: Validator<BodyType>;
7
7
  paramsValidator?: Validator<ParamsType>;