@mahameru/diatrema 0.0.1 → 0.0.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/diatrema-Bk12jngx.d.ts +93 -0
- package/diatrema-CyKJKZv_.d.cts +93 -0
- package/diatrema.cjs +70 -52
- package/diatrema.cjs.map +1 -1
- package/diatrema.d.cts +6 -72
- package/diatrema.d.ts +4 -71
- package/diatrema.js +70 -52
- package/diatrema.js.map +1 -1
- package/helpers.cjs +2 -18
- package/helpers.cjs.map +1 -1
- package/helpers.d.cts +1 -6
- package/helpers.d.ts +1 -6
- package/helpers.js +1 -16
- package/helpers.js.map +1 -1
- package/index.cjs +4 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +4 -13
- package/index.d.ts +4 -13
- package/index.js +2 -9
- package/index.js.map +1 -1
- package/logger.cjs +10 -5
- package/logger.cjs.map +1 -1
- package/logger.d.cts +1 -1
- package/logger.d.ts +1 -1
- package/logger.js +10 -5
- package/logger.js.map +1 -1
- package/mahameru-plugin.cjs +109 -0
- package/mahameru-plugin.cjs.map +1 -0
- package/mahameru-plugin.d.cts +4 -0
- package/mahameru-plugin.d.ts +4 -0
- package/mahameru-plugin.js +85 -0
- package/mahameru-plugin.js.map +1 -0
- package/package.json +4 -3
- package/scripts/preinstall.cjs +10 -0
- package/scripts/preinstall.cjs.map +1 -0
- package/scripts/preinstall.d.cts +2 -0
- package/scripts/preinstall.d.ts +2 -0
- package/scripts/preinstall.js +9 -9
- package/scripts/preinstall.js.map +1 -0
- package/types.cjs +0 -23
- package/types.cjs.map +1 -1
- package/types.d.cts +5 -3
- package/types.d.ts +5 -3
- package/types.js +0 -15
- package/types.js.map +1 -1
- package/container-error.cjs +0 -45
- package/container-error.cjs.map +0 -1
- package/container-error.d.cts +0 -7
- package/container-error.d.ts +0 -7
- package/container-error.js +0 -22
- package/container-error.js.map +0 -1
- package/container.cjs +0 -318
- package/container.cjs.map +0 -1
- package/container.d.cts +0 -60
- package/container.d.ts +0 -60
- package/container.js +0 -285
- package/container.js.map +0 -1
- package/http-server-error.cjs +0 -44
- package/http-server-error.cjs.map +0 -1
- package/http-server-error.d.cts +0 -7
- package/http-server-error.d.ts +0 -7
- package/http-server-error.js +0 -21
- package/http-server-error.js.map +0 -1
- package/http-server.cjs +0 -382
- package/http-server.cjs.map +0 -1
- package/http-server.d.cts +0 -81
- package/http-server.d.ts +0 -81
- package/http-server.js +0 -359
- package/http-server.js.map +0 -1
- package/mahameru-request.cjs +0 -79
- package/mahameru-request.cjs.map +0 -1
- package/mahameru-request.d.cts +0 -3
- package/mahameru-request.d.ts +0 -3
- package/mahameru-request.js +0 -56
- package/mahameru-request.js.map +0 -1
- package/mahameru-response.cjs +0 -71
- package/mahameru-response.cjs.map +0 -1
- package/mahameru-response.d.cts +0 -17
- package/mahameru-response.d.ts +0 -17
- package/mahameru-response.js +0 -48
- package/mahameru-response.js.map +0 -1
- package/mahameru-server-error.cjs +0 -54
- package/mahameru-server-error.cjs.map +0 -1
- package/mahameru-server-error.d.cts +0 -19
- package/mahameru-server-error.d.ts +0 -19
- package/mahameru-server-error.js +0 -31
- package/mahameru-server-error.js.map +0 -1
- package/module-error.cjs +0 -46
- package/module-error.cjs.map +0 -1
- package/module-error.d.cts +0 -12
- package/module-error.d.ts +0 -12
- package/module-error.js +0 -23
- package/module-error.js.map +0 -1
- package/route.cjs +0 -128
- package/route.cjs.map +0 -1
- package/route.d.cts +0 -46
- package/route.d.ts +0 -46
- package/route.js +0 -105
- package/route.js.map +0 -1
- package/types-BmFqDpSs.d.ts +0 -113
- package/types-Cd6Gkoxx.d.cts +0 -113
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mahameru-response.ts"],"sourcesContent":["export class MahameruResponse {\r\n public body: unknown;\r\n public status: number;\r\n public headers: Headers;\r\n\r\n constructor(body: unknown, init?: { status?: number; headers?: Headers | Record<string, string> }) {\r\n this.body = body;\r\n this.status = init?.status || 200;\r\n\r\n if (init?.headers instanceof Headers) {\r\n this.headers = init.headers;\r\n } else if (typeof init?.headers === 'object' && init.headers !== null && !Array.isArray(init.headers)) {\r\n init.headers = {\r\n 'Content-Type': 'application/json',\r\n ...init.headers\r\n }\r\n\r\n this.headers = new Headers(init.headers);\r\n } else {\r\n this.headers = new Headers({\r\n 'Content-Type': 'application/json'\r\n });\r\n }\r\n }\r\n\r\n static json(body: unknown, init?: { status?: number; headers?: Record<string, string> }) {\r\n return new MahameruResponse(body, init);\r\n }\r\n\r\n public setHeader(key: string, value: string) {\r\n this.headers.set(key, value);\r\n }\r\n\r\n public setHeaders(headers: Headers | Record<string, string>) {\r\n if (headers instanceof Headers) {\r\n headers.forEach((value, key) => {\r\n this.headers.set(key, value);\r\n });\r\n } else if (typeof headers === 'object' && headers !== null && !Array.isArray(headers)) {\r\n for (const [key, value] of Object.entries(headers)) {\r\n this.headers.set(key, value);\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,iBAAiB;AAAA,EAA9B,OAA8B;AAAA;AAAA;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EAEP,YAAY,MAAe,MAAwE;AAC/F,SAAK,OAAO;AACZ,SAAK,SAAS,MAAM,UAAU;AAE9B,QAAI,MAAM,mBAAmB,SAAS;AAClC,WAAK,UAAU,KAAK;AAAA,IACxB,WAAW,OAAO,MAAM,YAAY,YAAY,KAAK,YAAY,QAAQ,CAAC,MAAM,QAAQ,KAAK,OAAO,GAAG;AACnG,WAAK,UAAU;AAAA,QACX,gBAAgB;AAAA,QAChB,GAAG,KAAK;AAAA,MACZ;AAEA,WAAK,UAAU,IAAI,QAAQ,KAAK,OAAO;AAAA,IAC3C,OAAO;AACH,WAAK,UAAU,IAAI,QAAQ;AAAA,QACvB,gBAAgB;AAAA,MACpB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEA,OAAO,KAAK,MAAe,MAA8D;AACrF,WAAO,IAAI,iBAAiB,MAAM,IAAI;AAAA,EAC1C;AAAA,EAEO,UAAU,KAAa,OAAe;AACzC,SAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,EAC/B;AAAA,EAEO,WAAW,SAA2C;AACzD,QAAI,mBAAmB,SAAS;AAC5B,cAAQ,QAAQ,CAAC,OAAO,QAAQ;AAC5B,aAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,MAC/B,CAAC;AAAA,IACL,WAAW,OAAO,YAAY,YAAY,YAAY,QAAQ,CAAC,MAAM,QAAQ,OAAO,GAAG;AACnF,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAChD,aAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,MAC/B;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
|
package/mahameru-response.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare class MahameruResponse {
|
|
2
|
-
body: unknown;
|
|
3
|
-
status: number;
|
|
4
|
-
headers: Headers;
|
|
5
|
-
constructor(body: unknown, init?: {
|
|
6
|
-
status?: number;
|
|
7
|
-
headers?: Headers | Record<string, string>;
|
|
8
|
-
});
|
|
9
|
-
static json(body: unknown, init?: {
|
|
10
|
-
status?: number;
|
|
11
|
-
headers?: Record<string, string>;
|
|
12
|
-
}): MahameruResponse;
|
|
13
|
-
setHeader(key: string, value: string): void;
|
|
14
|
-
setHeaders(headers: Headers | Record<string, string>): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { MahameruResponse };
|
package/mahameru-response.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare class MahameruResponse {
|
|
2
|
-
body: unknown;
|
|
3
|
-
status: number;
|
|
4
|
-
headers: Headers;
|
|
5
|
-
constructor(body: unknown, init?: {
|
|
6
|
-
status?: number;
|
|
7
|
-
headers?: Headers | Record<string, string>;
|
|
8
|
-
});
|
|
9
|
-
static json(body: unknown, init?: {
|
|
10
|
-
status?: number;
|
|
11
|
-
headers?: Record<string, string>;
|
|
12
|
-
}): MahameruResponse;
|
|
13
|
-
setHeader(key: string, value: string): void;
|
|
14
|
-
setHeaders(headers: Headers | Record<string, string>): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { MahameruResponse };
|
package/mahameru-response.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
class MahameruResponse {
|
|
4
|
-
static {
|
|
5
|
-
__name(this, "MahameruResponse");
|
|
6
|
-
}
|
|
7
|
-
body;
|
|
8
|
-
status;
|
|
9
|
-
headers;
|
|
10
|
-
constructor(body, init) {
|
|
11
|
-
this.body = body;
|
|
12
|
-
this.status = init?.status || 200;
|
|
13
|
-
if (init?.headers instanceof Headers) {
|
|
14
|
-
this.headers = init.headers;
|
|
15
|
-
} else if (typeof init?.headers === "object" && init.headers !== null && !Array.isArray(init.headers)) {
|
|
16
|
-
init.headers = {
|
|
17
|
-
"Content-Type": "application/json",
|
|
18
|
-
...init.headers
|
|
19
|
-
};
|
|
20
|
-
this.headers = new Headers(init.headers);
|
|
21
|
-
} else {
|
|
22
|
-
this.headers = new Headers({
|
|
23
|
-
"Content-Type": "application/json"
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
static json(body, init) {
|
|
28
|
-
return new MahameruResponse(body, init);
|
|
29
|
-
}
|
|
30
|
-
setHeader(key, value) {
|
|
31
|
-
this.headers.set(key, value);
|
|
32
|
-
}
|
|
33
|
-
setHeaders(headers) {
|
|
34
|
-
if (headers instanceof Headers) {
|
|
35
|
-
headers.forEach((value, key) => {
|
|
36
|
-
this.headers.set(key, value);
|
|
37
|
-
});
|
|
38
|
-
} else if (typeof headers === "object" && headers !== null && !Array.isArray(headers)) {
|
|
39
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
40
|
-
this.headers.set(key, value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
MahameruResponse
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=mahameru-response.js.map
|
package/mahameru-response.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mahameru-response.ts"],"sourcesContent":["export class MahameruResponse {\r\n public body: unknown;\r\n public status: number;\r\n public headers: Headers;\r\n\r\n constructor(body: unknown, init?: { status?: number; headers?: Headers | Record<string, string> }) {\r\n this.body = body;\r\n this.status = init?.status || 200;\r\n\r\n if (init?.headers instanceof Headers) {\r\n this.headers = init.headers;\r\n } else if (typeof init?.headers === 'object' && init.headers !== null && !Array.isArray(init.headers)) {\r\n init.headers = {\r\n 'Content-Type': 'application/json',\r\n ...init.headers\r\n }\r\n\r\n this.headers = new Headers(init.headers);\r\n } else {\r\n this.headers = new Headers({\r\n 'Content-Type': 'application/json'\r\n });\r\n }\r\n }\r\n\r\n static json(body: unknown, init?: { status?: number; headers?: Record<string, string> }) {\r\n return new MahameruResponse(body, init);\r\n }\r\n\r\n public setHeader(key: string, value: string) {\r\n this.headers.set(key, value);\r\n }\r\n\r\n public setHeaders(headers: Headers | Record<string, string>) {\r\n if (headers instanceof Headers) {\r\n headers.forEach((value, key) => {\r\n this.headers.set(key, value);\r\n });\r\n } else if (typeof headers === 'object' && headers !== null && !Array.isArray(headers)) {\r\n for (const [key, value] of Object.entries(headers)) {\r\n this.headers.set(key, value);\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;AAAO,MAAM,iBAAiB;AAAA,EAA9B,OAA8B;AAAA;AAAA;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EAEP,YAAY,MAAe,MAAwE;AAC/F,SAAK,OAAO;AACZ,SAAK,SAAS,MAAM,UAAU;AAE9B,QAAI,MAAM,mBAAmB,SAAS;AAClC,WAAK,UAAU,KAAK;AAAA,IACxB,WAAW,OAAO,MAAM,YAAY,YAAY,KAAK,YAAY,QAAQ,CAAC,MAAM,QAAQ,KAAK,OAAO,GAAG;AACnG,WAAK,UAAU;AAAA,QACX,gBAAgB;AAAA,QAChB,GAAG,KAAK;AAAA,MACZ;AAEA,WAAK,UAAU,IAAI,QAAQ,KAAK,OAAO;AAAA,IAC3C,OAAO;AACH,WAAK,UAAU,IAAI,QAAQ;AAAA,QACvB,gBAAgB;AAAA,MACpB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEA,OAAO,KAAK,MAAe,MAA8D;AACrF,WAAO,IAAI,iBAAiB,MAAM,IAAI;AAAA,EAC1C;AAAA,EAEO,UAAU,KAAa,OAAe;AACzC,SAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,EAC/B;AAAA,EAEO,WAAW,SAA2C;AACzD,QAAI,mBAAmB,SAAS;AAC5B,cAAQ,QAAQ,CAAC,OAAO,QAAQ;AAC5B,aAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,MAC/B,CAAC;AAAA,IACL,WAAW,OAAO,YAAY,YAAY,YAAY,QAAQ,CAAC,MAAM,QAAQ,OAAO,GAAG;AACnF,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAChD,aAAK,QAAQ,IAAI,KAAK,KAAK;AAAA,MAC/B;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var mahameru_server_error_exports = {};
|
|
21
|
-
__export(mahameru_server_error_exports, {
|
|
22
|
-
MahameruServerError: () => MahameruServerError
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(mahameru_server_error_exports);
|
|
25
|
-
class MahameruServerError {
|
|
26
|
-
constructor(message, details) {
|
|
27
|
-
this.message = message;
|
|
28
|
-
this.message = message;
|
|
29
|
-
this.details = details;
|
|
30
|
-
}
|
|
31
|
-
message;
|
|
32
|
-
static {
|
|
33
|
-
__name(this, "MahameruServerError");
|
|
34
|
-
}
|
|
35
|
-
name = "MahameruServerError";
|
|
36
|
-
details;
|
|
37
|
-
toString() {
|
|
38
|
-
if (this.details)
|
|
39
|
-
return `${this.name}: ${this.message} (${this.details.code}) [${this.details.address}:${this.details.port}]`;
|
|
40
|
-
return `${this.name}: ${this.message}`;
|
|
41
|
-
}
|
|
42
|
-
toJSON() {
|
|
43
|
-
return {
|
|
44
|
-
name: this.name,
|
|
45
|
-
message: this.message,
|
|
46
|
-
details: this.details
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
MahameruServerError
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=mahameru-server-error.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mahameru-server-error.ts"],"sourcesContent":["interface ErrorDetails {\r\n code: string\r\n address: string\r\n port: number\r\n}\r\n\r\nexport class MahameruServerError {\r\n public readonly name = 'MahameruServerError';\r\n public readonly details?: ErrorDetails\r\n\r\n constructor(public readonly message: string, details?: ErrorDetails) {\r\n this.message = message;\r\n this.details = details;\r\n }\r\n\r\n toString() {\r\n if (this.details)\r\n return `${this.name}: ${this.message} (${this.details.code}) [${this.details.address}:${this.details.port}]`;\r\n\r\n return `${this.name}: ${this.message}`;\r\n }\r\n\r\n toJSON() {\r\n return {\r\n name: this.name,\r\n message: this.message,\r\n details: this.details\r\n };\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,oBAAoB;AAAA,EAI7B,YAA4B,SAAiB,SAAwB;AAAzC;AACxB,SAAK,UAAU;AACf,SAAK,UAAU;AAAA,EACnB;AAAA,EAH4B;AAAA,EAVhC,OAMiC;AAAA;AAAA;AAAA,EACb,OAAO;AAAA,EACP;AAAA,EAOhB,WAAW;AACP,QAAI,KAAK;AACL,aAAO,GAAG,KAAK,IAAI,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,OAAO,IAAI,KAAK,QAAQ,IAAI;AAE7G,WAAO,GAAG,KAAK,IAAI,KAAK,KAAK,OAAO;AAAA,EACxC;AAAA,EAEA,SAAS;AACL,WAAO;AAAA,MACH,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,SAAS,KAAK;AAAA,IAClB;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface ErrorDetails {
|
|
2
|
-
code: string;
|
|
3
|
-
address: string;
|
|
4
|
-
port: number;
|
|
5
|
-
}
|
|
6
|
-
declare class MahameruServerError {
|
|
7
|
-
readonly message: string;
|
|
8
|
-
readonly name = "MahameruServerError";
|
|
9
|
-
readonly details?: ErrorDetails;
|
|
10
|
-
constructor(message: string, details?: ErrorDetails);
|
|
11
|
-
toString(): string;
|
|
12
|
-
toJSON(): {
|
|
13
|
-
name: string;
|
|
14
|
-
message: string;
|
|
15
|
-
details: ErrorDetails | undefined;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { MahameruServerError };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface ErrorDetails {
|
|
2
|
-
code: string;
|
|
3
|
-
address: string;
|
|
4
|
-
port: number;
|
|
5
|
-
}
|
|
6
|
-
declare class MahameruServerError {
|
|
7
|
-
readonly message: string;
|
|
8
|
-
readonly name = "MahameruServerError";
|
|
9
|
-
readonly details?: ErrorDetails;
|
|
10
|
-
constructor(message: string, details?: ErrorDetails);
|
|
11
|
-
toString(): string;
|
|
12
|
-
toJSON(): {
|
|
13
|
-
name: string;
|
|
14
|
-
message: string;
|
|
15
|
-
details: ErrorDetails | undefined;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { MahameruServerError };
|
package/mahameru-server-error.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
class MahameruServerError {
|
|
4
|
-
constructor(message, details) {
|
|
5
|
-
this.message = message;
|
|
6
|
-
this.message = message;
|
|
7
|
-
this.details = details;
|
|
8
|
-
}
|
|
9
|
-
message;
|
|
10
|
-
static {
|
|
11
|
-
__name(this, "MahameruServerError");
|
|
12
|
-
}
|
|
13
|
-
name = "MahameruServerError";
|
|
14
|
-
details;
|
|
15
|
-
toString() {
|
|
16
|
-
if (this.details)
|
|
17
|
-
return `${this.name}: ${this.message} (${this.details.code}) [${this.details.address}:${this.details.port}]`;
|
|
18
|
-
return `${this.name}: ${this.message}`;
|
|
19
|
-
}
|
|
20
|
-
toJSON() {
|
|
21
|
-
return {
|
|
22
|
-
name: this.name,
|
|
23
|
-
message: this.message,
|
|
24
|
-
details: this.details
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
MahameruServerError
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=mahameru-server-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mahameru-server-error.ts"],"sourcesContent":["interface ErrorDetails {\r\n code: string\r\n address: string\r\n port: number\r\n}\r\n\r\nexport class MahameruServerError {\r\n public readonly name = 'MahameruServerError';\r\n public readonly details?: ErrorDetails\r\n\r\n constructor(public readonly message: string, details?: ErrorDetails) {\r\n this.message = message;\r\n this.details = details;\r\n }\r\n\r\n toString() {\r\n if (this.details)\r\n return `${this.name}: ${this.message} (${this.details.code}) [${this.details.address}:${this.details.port}]`;\r\n\r\n return `${this.name}: ${this.message}`;\r\n }\r\n\r\n toJSON() {\r\n return {\r\n name: this.name,\r\n message: this.message,\r\n details: this.details\r\n };\r\n }\r\n}\r\n"],"mappings":";;AAMO,MAAM,oBAAoB;AAAA,EAI7B,YAA4B,SAAiB,SAAwB;AAAzC;AACxB,SAAK,UAAU;AACf,SAAK,UAAU;AAAA,EACnB;AAAA,EAH4B;AAAA,EAVhC,OAMiC;AAAA;AAAA;AAAA,EACb,OAAO;AAAA,EACP;AAAA,EAOhB,WAAW;AACP,QAAI,KAAK;AACL,aAAO,GAAG,KAAK,IAAI,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,OAAO,IAAI,KAAK,QAAQ,IAAI;AAE7G,WAAO,GAAG,KAAK,IAAI,KAAK,KAAK,OAAO;AAAA,EACxC;AAAA,EAEA,SAAS;AACL,WAAO;AAAA,MACH,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,SAAS,KAAK;AAAA,IAClB;AAAA,EACJ;AACJ;","names":[]}
|
package/module-error.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var module_error_exports = {};
|
|
21
|
-
__export(module_error_exports, {
|
|
22
|
-
ModuleError: () => ModuleError
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(module_error_exports);
|
|
25
|
-
class ModuleError extends Error {
|
|
26
|
-
static {
|
|
27
|
-
__name(this, "ModuleError");
|
|
28
|
-
}
|
|
29
|
-
detail;
|
|
30
|
-
constructor(message, detail) {
|
|
31
|
-
super(message);
|
|
32
|
-
if (detail) {
|
|
33
|
-
this.detail = {
|
|
34
|
-
path: detail.path,
|
|
35
|
-
moduleName: detail.moduleName || "UNKNOWN"
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
Object.setPrototypeOf(this, ModuleError.prototype);
|
|
39
|
-
delete this.stack;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
ModuleError
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=module-error.cjs.map
|
package/module-error.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/module-error.ts"],"sourcesContent":["export class ModuleError extends Error {\r\n public readonly detail?: {\r\n path: string;\r\n moduleName: string;\r\n };\r\n\r\n constructor(message: string, detail?: { path: string; moduleName: string }) {\r\n super(message);\r\n\r\n if (detail) {\r\n this.detail = {\r\n path: detail.path,\r\n moduleName: detail.moduleName || 'UNKNOWN'\r\n };\r\n }\r\n\r\n Object.setPrototypeOf(this, ModuleError.prototype);\r\n\r\n delete this.stack;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,oBAAoB,MAAM;AAAA,EAAvC,OAAuC;AAAA;AAAA;AAAA,EACnB;AAAA,EAKhB,YAAY,SAAiB,QAA+C;AACxE,UAAM,OAAO;AAEb,QAAI,QAAQ;AACR,WAAK,SAAS;AAAA,QACV,MAAM,OAAO;AAAA,QACb,YAAY,OAAO,cAAc;AAAA,MACrC;AAAA,IACJ;AAEA,WAAO,eAAe,MAAM,YAAY,SAAS;AAEjD,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
|
package/module-error.d.cts
DELETED
package/module-error.d.ts
DELETED
package/module-error.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
class ModuleError extends Error {
|
|
4
|
-
static {
|
|
5
|
-
__name(this, "ModuleError");
|
|
6
|
-
}
|
|
7
|
-
detail;
|
|
8
|
-
constructor(message, detail) {
|
|
9
|
-
super(message);
|
|
10
|
-
if (detail) {
|
|
11
|
-
this.detail = {
|
|
12
|
-
path: detail.path,
|
|
13
|
-
moduleName: detail.moduleName || "UNKNOWN"
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
Object.setPrototypeOf(this, ModuleError.prototype);
|
|
17
|
-
delete this.stack;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
ModuleError
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=module-error.js.map
|
package/module-error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/module-error.ts"],"sourcesContent":["export class ModuleError extends Error {\r\n public readonly detail?: {\r\n path: string;\r\n moduleName: string;\r\n };\r\n\r\n constructor(message: string, detail?: { path: string; moduleName: string }) {\r\n super(message);\r\n\r\n if (detail) {\r\n this.detail = {\r\n path: detail.path,\r\n moduleName: detail.moduleName || 'UNKNOWN'\r\n };\r\n }\r\n\r\n Object.setPrototypeOf(this, ModuleError.prototype);\r\n\r\n delete this.stack;\r\n }\r\n}\r\n"],"mappings":";;AAAO,MAAM,oBAAoB,MAAM;AAAA,EAAvC,OAAuC;AAAA;AAAA;AAAA,EACnB;AAAA,EAKhB,YAAY,SAAiB,QAA+C;AACxE,UAAM,OAAO;AAEb,QAAI,QAAQ;AACR,WAAK,SAAS;AAAA,QACV,MAAM,OAAO;AAAA,QACb,YAAY,OAAO,cAAc;AAAA,MACrC;AAAA,IACJ;AAEA,WAAO,eAAe,MAAM,YAAY,SAAS;AAEjD,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
|
package/route.cjs
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var route_exports = {};
|
|
21
|
-
__export(route_exports, {
|
|
22
|
-
Route: () => Route
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(route_exports);
|
|
25
|
-
var import_node_path = require("node:path");
|
|
26
|
-
class Route {
|
|
27
|
-
static {
|
|
28
|
-
__name(this, "Route");
|
|
29
|
-
}
|
|
30
|
-
options = {
|
|
31
|
-
dev: false,
|
|
32
|
-
routesPath: (0, import_node_path.join)(process.cwd(), ".mahameru", "routes")
|
|
33
|
-
};
|
|
34
|
-
dependencies;
|
|
35
|
-
constructor(arg1, arg2) {
|
|
36
|
-
if (typeof arg2 !== "undefined")
|
|
37
|
-
this.options = { ...this.options, ...arg1 };
|
|
38
|
-
if (typeof arg2 !== "undefined") {
|
|
39
|
-
this.dependencies = arg2;
|
|
40
|
-
} else {
|
|
41
|
-
this.dependencies = arg1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
normalizePathForMatching(path) {
|
|
45
|
-
if (path.length > 1 && path.endsWith("/")) {
|
|
46
|
-
return path.slice(0, -1);
|
|
47
|
-
}
|
|
48
|
-
return path;
|
|
49
|
-
}
|
|
50
|
-
findMatchedRoute(matchUrl) {
|
|
51
|
-
let matchedRoute = null;
|
|
52
|
-
let matchResult = null;
|
|
53
|
-
for (const route of this.dependencies.container.getRouteItems()) {
|
|
54
|
-
const result = route.regex.exec(matchUrl);
|
|
55
|
-
if (result) {
|
|
56
|
-
matchedRoute = route;
|
|
57
|
-
matchResult = result;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return { matchedRoute, matchResult };
|
|
62
|
-
}
|
|
63
|
-
async runNotFoundHandler(request, method) {
|
|
64
|
-
if (!this.dependencies.container.notFoundHandler)
|
|
65
|
-
return void 0;
|
|
66
|
-
const handler = this.dependencies.container.notFoundHandler[method];
|
|
67
|
-
if (typeof handler !== "function") {
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
70
|
-
const response = await handler(request, this.dependencies.container, { params: {} });
|
|
71
|
-
return this.normalizeMahameruResponse(
|
|
72
|
-
response,
|
|
73
|
-
`Not found handler for method '${method}' must return a MahameruResponse instance.`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
async resolveRoute(request) {
|
|
77
|
-
const rawReqPath = request.url.split("?")[0] || "/";
|
|
78
|
-
const rawReqUrl = rawReqPath.replace(/\/+/g, "/");
|
|
79
|
-
const matchUrl = this.normalizePathForMatching(rawReqUrl);
|
|
80
|
-
let { matchedRoute, matchResult } = this.findMatchedRoute(matchUrl);
|
|
81
|
-
if (!matchedRoute || !matchResult)
|
|
82
|
-
return {
|
|
83
|
-
matchedRoute: null,
|
|
84
|
-
matchResult: null,
|
|
85
|
-
notFoundResponse: await this.runNotFoundHandler(request, request.method) || this.dependencies.MahameruResponse.json(
|
|
86
|
-
{ error: "Not Found" },
|
|
87
|
-
{ status: 404 }
|
|
88
|
-
)
|
|
89
|
-
};
|
|
90
|
-
return { matchedRoute, matchResult };
|
|
91
|
-
}
|
|
92
|
-
isMahameruResponseLike(value) {
|
|
93
|
-
if (!value || typeof value !== "object") {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
if (!("status" in value) || typeof value.status !== "number") {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
if (!("body" in value)) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (!("headers" in value) || value.headers === void 0) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
if (value.headers instanceof Headers) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
return typeof value.headers === "object" && value.headers !== null && !Array.isArray(value.headers);
|
|
109
|
-
}
|
|
110
|
-
normalizeMahameruResponse(value, errorMessage) {
|
|
111
|
-
if (value instanceof this.dependencies.MahameruResponse) {
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
114
|
-
if (!this.isMahameruResponseLike(value)) {
|
|
115
|
-
throw new this.dependencies.HttpServerError(errorMessage);
|
|
116
|
-
}
|
|
117
|
-
const normalizedHeaders = value.headers instanceof Headers ? Object.fromEntries(value.headers.entries()) : value.headers;
|
|
118
|
-
return new this.dependencies.MahameruResponse(value.body, {
|
|
119
|
-
status: value.status,
|
|
120
|
-
headers: normalizedHeaders
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
-
0 && (module.exports = {
|
|
126
|
-
Route
|
|
127
|
-
});
|
|
128
|
-
//# sourceMappingURL=route.cjs.map
|
package/route.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/route.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport type { MahameruRequest } from './mahameru-request';\nimport type { MahameruResponse } from './mahameru-response';\nimport type { Container } from './container';\nimport type { HttpServerError } from './http-server-error';\nimport type { HTTPMethod, RouteHandlerContext, RouteItem } from './types';\n\nexport type RouteOptions = {\n dev: boolean;\n routesPath: string;\n};\n\nexport type RouteDependencies = {\n container: Container;\n HttpServerError: typeof HttpServerError;\n MahameruResponse: typeof MahameruResponse;\n};\n\nexport class Route {\n public readonly options: RouteOptions = {\n dev: false,\n routesPath: join(process.cwd(), '.mahameru', 'routes')\n }\n protected dependencies: RouteDependencies;\n\n constructor(\n dependencies: RouteDependencies\n )\n constructor(\n options: Partial<RouteOptions>,\n dependencies: RouteDependencies\n )\n constructor(\n arg1: Partial<RouteOptions> | RouteDependencies,\n arg2?: RouteDependencies\n ) {\n if (typeof arg2 !== 'undefined')\n this.options = { ...this.options, ...arg1 as Partial<RouteOptions> };\n\n if (typeof arg2 !== 'undefined') {\n this.dependencies = arg2;\n } else {\n this.dependencies = arg1 as RouteDependencies;\n }\n }\n\n normalizePathForMatching(path: string): string {\n if (path.length > 1 && path.endsWith('/')) {\n return path.slice(0, -1);\n }\n\n return path;\n }\n\n findMatchedRoute(matchUrl: string) {\n let matchedRoute: RouteItem | null = null;\n let matchResult: RegExpExecArray | null = null;\n\n for (const route of this.dependencies.container.getRouteItems()) {\n const result = route.regex.exec(matchUrl);\n\n if (result) {\n matchedRoute = route;\n matchResult = result;\n\n break;\n }\n }\n\n return { matchedRoute, matchResult };\n }\n\n async runNotFoundHandler(request: MahameruRequest, method: HTTPMethod): Promise<MahameruResponse | undefined> {\n if (!this.dependencies.container.notFoundHandler)\n return undefined;\n\n const handler = this.dependencies.container.notFoundHandler[method];\n\n if (typeof handler !== 'function') {\n return undefined;\n }\n\n const response = await handler(request, this.dependencies.container, { params: {} } satisfies RouteHandlerContext);\n\n return this.normalizeMahameruResponse(\n response,\n `Not found handler for method '${method}' must return a MahameruResponse instance.`\n );\n }\n\n async resolveRoute(request: MahameruRequest) {\n const rawReqPath = request.url.split('?')[0] || '/';\n const rawReqUrl = rawReqPath.replace(/\\/+/g, '/');\n const matchUrl = this.normalizePathForMatching(rawReqUrl);\n\n let { matchedRoute, matchResult } = this.findMatchedRoute(matchUrl);\n\n if (!matchedRoute || !matchResult)\n return {\n matchedRoute: null,\n matchResult: null,\n notFoundResponse: await this.runNotFoundHandler(request, request.method) || this.dependencies.MahameruResponse.json(\n { error: 'Not Found' },\n { status: 404 }\n )\n };\n\n return { matchedRoute, matchResult };\n }\n\n protected isMahameruResponseLike(value: unknown): value is { body: unknown; status: number; headers?: Headers | Record<string, string> } {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n if (!('status' in value) || typeof value.status !== 'number') {\n return false;\n }\n\n if (!('body' in value)) {\n return false;\n }\n\n if (!('headers' in value) || value.headers === undefined) {\n return true;\n }\n\n if (value.headers instanceof Headers) {\n return true;\n }\n\n return typeof value.headers === 'object' && value.headers !== null && !Array.isArray(value.headers);\n }\n\n protected normalizeMahameruResponse(value: unknown, errorMessage: string): MahameruResponse {\n if (value instanceof this.dependencies.MahameruResponse) {\n return value;\n }\n\n if (!this.isMahameruResponseLike(value)) {\n throw new this.dependencies.HttpServerError(errorMessage);\n }\n\n const normalizedHeaders = value.headers instanceof Headers\n ? Object.fromEntries(value.headers.entries())\n : value.headers;\n\n return new this.dependencies.MahameruResponse(value.body, {\n status: value.status,\n headers: normalizedHeaders\n });\n }\n}\n"],"mappings":"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","names":[]}
|
package/route.d.cts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { p as RouteItem, j as MahameruRequest, H as HTTPMethod } from './types-Cd6Gkoxx.cjs';
|
|
2
|
-
import { MahameruResponse } from './mahameru-response.cjs';
|
|
3
|
-
import { Container } from './container.cjs';
|
|
4
|
-
import { HttpServerError } from './http-server-error.cjs';
|
|
5
|
-
import 'node:http';
|
|
6
|
-
import './container-error.cjs';
|
|
7
|
-
import './module-error.cjs';
|
|
8
|
-
|
|
9
|
-
type RouteOptions = {
|
|
10
|
-
dev: boolean;
|
|
11
|
-
routesPath: string;
|
|
12
|
-
};
|
|
13
|
-
type RouteDependencies = {
|
|
14
|
-
container: Container;
|
|
15
|
-
HttpServerError: typeof HttpServerError;
|
|
16
|
-
MahameruResponse: typeof MahameruResponse;
|
|
17
|
-
};
|
|
18
|
-
declare class Route {
|
|
19
|
-
readonly options: RouteOptions;
|
|
20
|
-
protected dependencies: RouteDependencies;
|
|
21
|
-
constructor(dependencies: RouteDependencies);
|
|
22
|
-
constructor(options: Partial<RouteOptions>, dependencies: RouteDependencies);
|
|
23
|
-
normalizePathForMatching(path: string): string;
|
|
24
|
-
findMatchedRoute(matchUrl: string): {
|
|
25
|
-
matchedRoute: RouteItem | null;
|
|
26
|
-
matchResult: RegExpExecArray | null;
|
|
27
|
-
};
|
|
28
|
-
runNotFoundHandler(request: MahameruRequest, method: HTTPMethod): Promise<MahameruResponse | undefined>;
|
|
29
|
-
resolveRoute(request: MahameruRequest): Promise<{
|
|
30
|
-
matchedRoute: null;
|
|
31
|
-
matchResult: null;
|
|
32
|
-
notFoundResponse: MahameruResponse;
|
|
33
|
-
} | {
|
|
34
|
-
matchedRoute: RouteItem;
|
|
35
|
-
matchResult: RegExpExecArray;
|
|
36
|
-
notFoundResponse?: undefined;
|
|
37
|
-
}>;
|
|
38
|
-
protected isMahameruResponseLike(value: unknown): value is {
|
|
39
|
-
body: unknown;
|
|
40
|
-
status: number;
|
|
41
|
-
headers?: Headers | Record<string, string>;
|
|
42
|
-
};
|
|
43
|
-
protected normalizeMahameruResponse(value: unknown, errorMessage: string): MahameruResponse;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { Route, type RouteDependencies, type RouteOptions };
|
package/route.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { p as RouteItem, j as MahameruRequest, H as HTTPMethod } from './types-BmFqDpSs.js';
|
|
2
|
-
import { MahameruResponse } from './mahameru-response.js';
|
|
3
|
-
import { Container } from './container.js';
|
|
4
|
-
import { HttpServerError } from './http-server-error.js';
|
|
5
|
-
import 'node:http';
|
|
6
|
-
import './container-error.js';
|
|
7
|
-
import './module-error.js';
|
|
8
|
-
|
|
9
|
-
type RouteOptions = {
|
|
10
|
-
dev: boolean;
|
|
11
|
-
routesPath: string;
|
|
12
|
-
};
|
|
13
|
-
type RouteDependencies = {
|
|
14
|
-
container: Container;
|
|
15
|
-
HttpServerError: typeof HttpServerError;
|
|
16
|
-
MahameruResponse: typeof MahameruResponse;
|
|
17
|
-
};
|
|
18
|
-
declare class Route {
|
|
19
|
-
readonly options: RouteOptions;
|
|
20
|
-
protected dependencies: RouteDependencies;
|
|
21
|
-
constructor(dependencies: RouteDependencies);
|
|
22
|
-
constructor(options: Partial<RouteOptions>, dependencies: RouteDependencies);
|
|
23
|
-
normalizePathForMatching(path: string): string;
|
|
24
|
-
findMatchedRoute(matchUrl: string): {
|
|
25
|
-
matchedRoute: RouteItem | null;
|
|
26
|
-
matchResult: RegExpExecArray | null;
|
|
27
|
-
};
|
|
28
|
-
runNotFoundHandler(request: MahameruRequest, method: HTTPMethod): Promise<MahameruResponse | undefined>;
|
|
29
|
-
resolveRoute(request: MahameruRequest): Promise<{
|
|
30
|
-
matchedRoute: null;
|
|
31
|
-
matchResult: null;
|
|
32
|
-
notFoundResponse: MahameruResponse;
|
|
33
|
-
} | {
|
|
34
|
-
matchedRoute: RouteItem;
|
|
35
|
-
matchResult: RegExpExecArray;
|
|
36
|
-
notFoundResponse?: undefined;
|
|
37
|
-
}>;
|
|
38
|
-
protected isMahameruResponseLike(value: unknown): value is {
|
|
39
|
-
body: unknown;
|
|
40
|
-
status: number;
|
|
41
|
-
headers?: Headers | Record<string, string>;
|
|
42
|
-
};
|
|
43
|
-
protected normalizeMahameruResponse(value: unknown, errorMessage: string): MahameruResponse;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { Route, type RouteDependencies, type RouteOptions };
|