@dooboostore/simple-boot-http-server 1.0.14

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.
Files changed (74) hide show
  1. package/README.MD +269 -0
  2. package/SimpleBootHttpServer.d.ts +16 -0
  3. package/SimpleBootHttpServer.js +313 -0
  4. package/codes/HttpHeaders.d.ts +42 -0
  5. package/codes/HttpHeaders.js +43 -0
  6. package/codes/HttpMethod.d.ts +12 -0
  7. package/codes/HttpMethod.js +13 -0
  8. package/codes/HttpStatus.d.ts +20 -0
  9. package/codes/HttpStatus.js +21 -0
  10. package/codes/Mimes.d.ts +28 -0
  11. package/codes/Mimes.js +29 -0
  12. package/decorators/MethodMapping.d.ts +74 -0
  13. package/decorators/MethodMapping.js +198 -0
  14. package/endpoints/CrossDomainHeaderEndPoint.d.ts +16 -0
  15. package/endpoints/CrossDomainHeaderEndPoint.js +37 -0
  16. package/endpoints/EndPoint.d.ts +7 -0
  17. package/endpoints/EndPoint.js +2 -0
  18. package/endpoints/HeaderEndPoint.d.ts +12 -0
  19. package/endpoints/HeaderEndPoint.js +26 -0
  20. package/errors/BadRequestError.d.ts +8 -0
  21. package/errors/BadRequestError.js +8 -0
  22. package/errors/ForbiddenError.d.ts +8 -0
  23. package/errors/ForbiddenError.js +8 -0
  24. package/errors/HttpError.d.ts +12 -0
  25. package/errors/HttpError.js +8 -0
  26. package/errors/InternalServerError.d.ts +8 -0
  27. package/errors/InternalServerError.js +8 -0
  28. package/errors/NotFoundError.d.ts +8 -0
  29. package/errors/NotFoundError.js +8 -0
  30. package/errors/UnauthorizedError.d.ts +8 -0
  31. package/errors/UnauthorizedError.js +8 -0
  32. package/filters/CacheFilter.d.ts +45 -0
  33. package/filters/CacheFilter.js +145 -0
  34. package/filters/Filter.d.ts +17 -0
  35. package/filters/Filter.js +2 -0
  36. package/filters/HttpStatusFilter.d.ts +20 -0
  37. package/filters/HttpStatusFilter.js +31 -0
  38. package/filters/OpenApi3Filter.d.ts +142 -0
  39. package/filters/OpenApi3Filter.js +57 -0
  40. package/filters/ResourceFilter.d.ts +24 -0
  41. package/filters/ResourceFilter.js +72 -0
  42. package/filters/ThrowFilter.d.ts +19 -0
  43. package/filters/ThrowFilter.js +34 -0
  44. package/inject/InjectSituationType.d.ts +4 -0
  45. package/inject/InjectSituationType.js +5 -0
  46. package/lifecycle/OnInit.d.ts +5 -0
  47. package/lifecycle/OnInit.js +2 -0
  48. package/models/RequestResponse.d.ts +107 -0
  49. package/models/RequestResponse.js +467 -0
  50. package/models/datas/HeaderData.d.ts +10 -0
  51. package/models/datas/HeaderData.js +7 -0
  52. package/models/datas/MultipartData.d.ts +14 -0
  53. package/models/datas/MultipartData.js +2 -0
  54. package/models/datas/ReqHeader.d.ts +69 -0
  55. package/models/datas/ReqHeader.js +3 -0
  56. package/models/datas/Resource.d.ts +11 -0
  57. package/models/datas/Resource.js +55 -0
  58. package/models/datas/body/ReqFormUrlBody.d.ts +4 -0
  59. package/models/datas/body/ReqFormUrlBody.js +3 -0
  60. package/models/datas/body/ReqJsonBody.d.ts +4 -0
  61. package/models/datas/body/ReqJsonBody.js +3 -0
  62. package/models/datas/body/ReqMultipartFormBody.d.ts +6 -0
  63. package/models/datas/body/ReqMultipartFormBody.js +6 -0
  64. package/models/method/patch/PatchJson.d.ts +8 -0
  65. package/models/method/patch/PatchJson.js +11 -0
  66. package/option/HttpServerOption.d.ts +85 -0
  67. package/option/HttpServerOption.js +35 -0
  68. package/package.json +83 -0
  69. package/resolvers/Resolver.d.ts +5 -0
  70. package/resolvers/Resolver.js +2 -0
  71. package/resolvers/ResourceResorver.d.ts +6 -0
  72. package/resolvers/ResourceResorver.js +18 -0
  73. package/session/SessionManager.d.ts +57 -0
  74. package/session/SessionManager.js +108 -0
@@ -0,0 +1,43 @@
1
+ export var HttpHeaders;
2
+ (function (HttpHeaders) {
3
+ HttpHeaders["ContentLength"] = "Content-Length";
4
+ HttpHeaders["ContentType"] = "Content-Type";
5
+ HttpHeaders["ContentEncoding"] = "Content-Encoding";
6
+ HttpHeaders["Accept"] = "Accept";
7
+ HttpHeaders["Authorization"] = "Authorization";
8
+ HttpHeaders["CacheControl"] = "Cache-Control";
9
+ HttpHeaders["Connection"] = "Connection";
10
+ HttpHeaders["Date"] = "Date";
11
+ HttpHeaders["Host"] = "Host";
12
+ HttpHeaders["Pragma"] = "Pragma";
13
+ HttpHeaders["Trailer"] = "Trailer";
14
+ HttpHeaders["TransferEncoding"] = "Transfer-Encoding";
15
+ HttpHeaders["Upgrade"] = "Upgrade";
16
+ HttpHeaders["Via"] = "Via";
17
+ HttpHeaders["Warning"] = "Warning";
18
+ HttpHeaders["AcceptCharset"] = "Accept-Charset";
19
+ HttpHeaders["AcceptEncoding"] = "Accept-Encoding";
20
+ HttpHeaders["AcceptLanguage"] = "Accept-Language";
21
+ HttpHeaders["AccessControlAllowOrigin"] = "Access-Control-Allow-Origin";
22
+ HttpHeaders["AccessControlAllowMethods"] = "Access-Control-Allow-Methods";
23
+ HttpHeaders["AccessControlAllowHeaders"] = "Access-Control-Allow-Headers";
24
+ HttpHeaders["AccessControlExposeHeaders"] = "Access-Control-Expose-Headers";
25
+ HttpHeaders["Expect"] = "Expect";
26
+ HttpHeaders["From"] = "From";
27
+ HttpHeaders["MaxForwards"] = "Max-Forwards";
28
+ HttpHeaders["Referer"] = "Referer";
29
+ HttpHeaders["UserAgent"] = "User-Agent";
30
+ HttpHeaders["Cookie"] = "Cookie";
31
+ HttpHeaders["SetCookie"] = "Set-Cookie";
32
+ HttpHeaders["Cookie2"] = "Cookie2";
33
+ HttpHeaders["SetCookie2"] = "Set-Cookie2";
34
+ HttpHeaders["Location"] = "Location";
35
+ HttpHeaders["IfModifiedSince"] = "If-Modified-Since";
36
+ HttpHeaders["IfUnmodifiedSince"] = "If-Unmodified-Since";
37
+ HttpHeaders["IfMatch"] = "If-Match";
38
+ HttpHeaders["IfNoneMatch"] = "If-None-Match";
39
+ HttpHeaders["IfRange"] = "If-Range";
40
+ HttpHeaders["Allow"] = "Allow";
41
+ HttpHeaders["Server"] = "Server";
42
+ })(HttpHeaders || (HttpHeaders = {}));
43
+ //# sourceMappingURL=HttpHeaders.js.map
@@ -0,0 +1,12 @@
1
+ export declare enum HttpMethod {
2
+ GET = "GET",
3
+ POST = "POST",
4
+ PUT = "PUT",
5
+ DELETE = "DELETE",
6
+ PATCH = "PATCH",
7
+ HEAD = "HEAD",
8
+ OPTIONS = "OPTIONS",
9
+ TRACE = "TRACE",
10
+ CONNECT = "CONNECT"
11
+ }
12
+ //# sourceMappingURL=HttpMethod.d.ts.map
@@ -0,0 +1,13 @@
1
+ export var HttpMethod;
2
+ (function (HttpMethod) {
3
+ HttpMethod["GET"] = "GET";
4
+ HttpMethod["POST"] = "POST";
5
+ HttpMethod["PUT"] = "PUT";
6
+ HttpMethod["DELETE"] = "DELETE";
7
+ HttpMethod["PATCH"] = "PATCH";
8
+ HttpMethod["HEAD"] = "HEAD";
9
+ HttpMethod["OPTIONS"] = "OPTIONS";
10
+ HttpMethod["TRACE"] = "TRACE";
11
+ HttpMethod["CONNECT"] = "CONNECT";
12
+ })(HttpMethod || (HttpMethod = {}));
13
+ //# sourceMappingURL=HttpMethod.js.map
@@ -0,0 +1,20 @@
1
+ export declare enum HttpStatus {
2
+ Ok = 200,
3
+ MovedPermanently = 301,
4
+ Found = 302,
5
+ SeeOther = 303,
6
+ NotModified = 304,
7
+ TemporaryRedirect = 307,
8
+ PermanentRedirect = 308,
9
+ BadRequest = 400,
10
+ Unauthorized = 401,
11
+ Forbidden = 403,
12
+ NotFound = 404,
13
+ InternalServerError = 500,
14
+ NotImplemented = 501,
15
+ BadGateway = 502,
16
+ ServiceUnavailable = 503,
17
+ GatewayTimeout = 504,
18
+ HttpVersionNotSupported = 505
19
+ }
20
+ //# sourceMappingURL=HttpStatus.d.ts.map
@@ -0,0 +1,21 @@
1
+ export var HttpStatus;
2
+ (function (HttpStatus) {
3
+ HttpStatus[HttpStatus["Ok"] = 200] = "Ok";
4
+ HttpStatus[HttpStatus["MovedPermanently"] = 301] = "MovedPermanently";
5
+ HttpStatus[HttpStatus["Found"] = 302] = "Found";
6
+ HttpStatus[HttpStatus["SeeOther"] = 303] = "SeeOther";
7
+ HttpStatus[HttpStatus["NotModified"] = 304] = "NotModified";
8
+ HttpStatus[HttpStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
9
+ HttpStatus[HttpStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
10
+ HttpStatus[HttpStatus["BadRequest"] = 400] = "BadRequest";
11
+ HttpStatus[HttpStatus["Unauthorized"] = 401] = "Unauthorized";
12
+ HttpStatus[HttpStatus["Forbidden"] = 403] = "Forbidden";
13
+ HttpStatus[HttpStatus["NotFound"] = 404] = "NotFound";
14
+ HttpStatus[HttpStatus["InternalServerError"] = 500] = "InternalServerError";
15
+ HttpStatus[HttpStatus["NotImplemented"] = 501] = "NotImplemented";
16
+ HttpStatus[HttpStatus["BadGateway"] = 502] = "BadGateway";
17
+ HttpStatus[HttpStatus["ServiceUnavailable"] = 503] = "ServiceUnavailable";
18
+ HttpStatus[HttpStatus["GatewayTimeout"] = 504] = "GatewayTimeout";
19
+ HttpStatus[HttpStatus["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
20
+ })(HttpStatus || (HttpStatus = {}));
21
+ //# sourceMappingURL=HttpStatus.js.map
@@ -0,0 +1,28 @@
1
+ export declare enum Mimes {
2
+ ApplicationJson = "application/json",
3
+ ApplicationOctetStream = "application/octet-stream",
4
+ ApplicationXml = "application/xml",
5
+ ApplicationJsonPatch = "application/json-patch+json",
6
+ ApplicationXWwwFormUrlencoded = "application/x-www-form-urlencoded",
7
+ TextPlain = "text/plain",
8
+ TextHtml = "text/html",
9
+ All = "*/*",
10
+ TextCss = "text/css",
11
+ TextJavascript = "text/javascript",
12
+ TextXml = "text/xml",
13
+ TextXslt = "text/xslt",
14
+ TextXmlDtd = "text/xml-dtd",
15
+ TextPlainUtf8 = "text/plain; charset=utf-8",
16
+ ImagePng = "image/png",
17
+ ImageGif = "image/gif",
18
+ ImageJpeg = "image/jpeg",
19
+ ImageSvg = "image/svg+xml",
20
+ ImageBmp = "image/bmp",
21
+ ImageTiff = "image/tiff",
22
+ ImagePdf = "application/pdf",
23
+ ImageXBmp = "image/x-bmp",
24
+ ImageXpixmap = "image/x-xpixmap",
25
+ ImageXxbm = "image/x-xbm",
26
+ MultipartFormData = "multipart/form-data"
27
+ }
28
+ //# sourceMappingURL=Mimes.d.ts.map
package/codes/Mimes.js ADDED
@@ -0,0 +1,29 @@
1
+ export var Mimes;
2
+ (function (Mimes) {
3
+ Mimes["ApplicationJson"] = "application/json";
4
+ Mimes["ApplicationOctetStream"] = "application/octet-stream";
5
+ Mimes["ApplicationXml"] = "application/xml";
6
+ Mimes["ApplicationJsonPatch"] = "application/json-patch+json";
7
+ Mimes["ApplicationXWwwFormUrlencoded"] = "application/x-www-form-urlencoded";
8
+ Mimes["TextPlain"] = "text/plain";
9
+ Mimes["TextHtml"] = "text/html";
10
+ Mimes["All"] = "*/*";
11
+ Mimes["TextCss"] = "text/css";
12
+ Mimes["TextJavascript"] = "text/javascript";
13
+ Mimes["TextXml"] = "text/xml";
14
+ Mimes["TextXslt"] = "text/xslt";
15
+ Mimes["TextXmlDtd"] = "text/xml-dtd";
16
+ Mimes["TextPlainUtf8"] = "text/plain; charset=utf-8";
17
+ Mimes["ImagePng"] = "image/png";
18
+ Mimes["ImageGif"] = "image/gif";
19
+ Mimes["ImageJpeg"] = "image/jpeg";
20
+ Mimes["ImageSvg"] = "image/svg+xml";
21
+ Mimes["ImageBmp"] = "image/bmp";
22
+ Mimes["ImageTiff"] = "image/tiff";
23
+ Mimes["ImagePdf"] = "application/pdf";
24
+ Mimes["ImageXBmp"] = "image/x-bmp";
25
+ Mimes["ImageXpixmap"] = "image/x-xpixmap";
26
+ Mimes["ImageXxbm"] = "image/x-xbm";
27
+ Mimes["MultipartFormData"] = "multipart/form-data";
28
+ })(Mimes || (Mimes = {}));
29
+ //# sourceMappingURL=Mimes.js.map
@@ -0,0 +1,74 @@
1
+ import 'reflect-metadata';
2
+ import { ConstructorType } from '@dooboostore/core/types';
3
+ import { ReflectMethod } from '@dooboostore/simple-boot/types/Types';
4
+ import { Resolver } from '../resolvers/Resolver';
5
+ import { Mimes } from '../codes/Mimes';
6
+ import { HttpMethod } from '../codes/HttpMethod';
7
+ export declare enum UrlMappingSituationType {
8
+ REQ_JSON_BODY = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY",
9
+ REQ_FORM_URL_BODY = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY"
10
+ }
11
+ export type MappingConfig = {
12
+ method: HttpMethod | string;
13
+ description?: {
14
+ name?: string;
15
+ detail?: string;
16
+ };
17
+ req?: {
18
+ contentType?: (Mimes | string)[];
19
+ accept?: (Mimes | string)[];
20
+ };
21
+ res?: {
22
+ status?: number;
23
+ header?: {
24
+ [key: string]: string;
25
+ };
26
+ contentType?: Mimes | string;
27
+ };
28
+ resolver?: Resolver | ConstructorType<Resolver>;
29
+ };
30
+ export type SaveMappingConfig = {
31
+ propertyKey: string | symbol;
32
+ config: MappingConfig;
33
+ };
34
+ export declare function UrlMapping(config: MappingConfig): ReflectMethod;
35
+ export declare function UrlMapping(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
36
+ export declare const getUrlMapping: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
37
+ export declare const getUrlMappings: (target: any) => SaveMappingConfig[];
38
+ export declare function GET(config: Omit<MappingConfig, 'method'>): ReflectMethod;
39
+ export declare function GET(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
40
+ export declare const getGET: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
41
+ export declare const getGETS: (target: any) => SaveMappingConfig[];
42
+ export declare function POST(config: Omit<MappingConfig, 'method'>): ReflectMethod;
43
+ export declare function POST(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
44
+ export declare const getPOST: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
45
+ export declare const getPOSTS: (target: any) => SaveMappingConfig[];
46
+ export declare function DELETE(config: Omit<MappingConfig, 'method'>): ReflectMethod;
47
+ export declare function DELETE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
48
+ export declare const getDELETE: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
49
+ export declare const getDELETES: (target: any) => SaveMappingConfig[];
50
+ export declare function PUT(config: Omit<MappingConfig, 'method'>): ReflectMethod;
51
+ export declare function PUT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
52
+ export declare const getPUT: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
53
+ export declare const getPUTS: (target: any) => SaveMappingConfig[];
54
+ export declare function PATCH(config: Omit<MappingConfig, 'method'>): ReflectMethod;
55
+ export declare function PATCH(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
56
+ export declare const getPATCH: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
57
+ export declare const getPATCHS: (target: any) => SaveMappingConfig[];
58
+ export declare function OPTIONS(config: Omit<MappingConfig, 'method'>): ReflectMethod;
59
+ export declare function OPTIONS(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
60
+ export declare const getOPTIONS: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
61
+ export declare const getOPTIONSS: (target: any) => SaveMappingConfig[];
62
+ export declare function HEAD(config: Omit<MappingConfig, 'method'>): ReflectMethod;
63
+ export declare function HEAD(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
64
+ export declare const getHEAD: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
65
+ export declare const getHEADS: (target: any) => SaveMappingConfig[];
66
+ export declare function TRACE(config: Omit<MappingConfig, 'method'>): ReflectMethod;
67
+ export declare function TRACE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
68
+ export declare const getTRACE: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
69
+ export declare const getTRACES: (target: any) => SaveMappingConfig[];
70
+ export declare function CONNECT(config: Omit<MappingConfig, 'method'>): ReflectMethod;
71
+ export declare function CONNECT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
72
+ export declare const getCONNECT: (target: any, propertyKey: string | symbol) => MappingConfig | undefined;
73
+ export declare const getCONNECTS: (target: any) => SaveMappingConfig[];
74
+ //# sourceMappingURL=MethodMapping.d.ts.map
@@ -0,0 +1,198 @@
1
+ import 'reflect-metadata';
2
+ import { ReflectUtils } from '@dooboostore/simple-boot/utils/reflect/ReflectUtils';
3
+ import { HttpMethod } from '../codes/HttpMethod';
4
+ export var UrlMappingSituationType;
5
+ (function (UrlMappingSituationType) {
6
+ UrlMappingSituationType["REQ_JSON_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY";
7
+ UrlMappingSituationType["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
8
+ })(UrlMappingSituationType || (UrlMappingSituationType = {}));
9
+ const MappingMetadataKey = Symbol('MappingMetadataKey');
10
+ const process = (config, target, propertyKey, descriptor) => {
11
+ var _a;
12
+ const saveMappingConfigs = ((_a = ReflectUtils.getMetadata(MappingMetadataKey, target.constructor)) !== null && _a !== void 0 ? _a : []);
13
+ saveMappingConfigs.push({ propertyKey, config });
14
+ ReflectUtils.defineMetadata(MappingMetadataKey, saveMappingConfigs, target.constructor);
15
+ ReflectUtils.defineMetadata(MappingMetadataKey, config, target, propertyKey);
16
+ };
17
+ export function UrlMapping(configOrtarget, propertyKey, descriptor) {
18
+ if (propertyKey && descriptor) {
19
+ process({ method: HttpMethod.GET }, configOrtarget, propertyKey, descriptor);
20
+ }
21
+ else {
22
+ return (target, propertyKey, descriptor) => {
23
+ process(configOrtarget, target, propertyKey, descriptor);
24
+ };
25
+ }
26
+ }
27
+ export const getUrlMapping = (target, propertyKey) => {
28
+ return ReflectUtils.getMetadata(MappingMetadataKey, target, propertyKey);
29
+ };
30
+ export const getUrlMappings = (target) => {
31
+ if (target !== null && undefined !== target && typeof target === 'object') {
32
+ target = target.constructor;
33
+ }
34
+ return ReflectUtils.getMetadata(MappingMetadataKey, target);
35
+ };
36
+ export function GET(configOrTarget, propertyKey, descriptor) {
37
+ if (propertyKey && descriptor) {
38
+ process({ method: HttpMethod.GET }, configOrTarget, propertyKey, descriptor);
39
+ }
40
+ else {
41
+ return (target, propertyKey, descriptor) => {
42
+ configOrTarget.method = HttpMethod.GET;
43
+ process(configOrTarget, target, propertyKey, descriptor);
44
+ };
45
+ }
46
+ }
47
+ export const getGET = (target, propertyKey) => {
48
+ return getUrlMapping(target, propertyKey);
49
+ };
50
+ export const getGETS = (target) => {
51
+ var _a;
52
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.GET; });
53
+ };
54
+ export function POST(configOrTarget, propertyKey, descriptor) {
55
+ if (propertyKey && descriptor) {
56
+ process({ method: HttpMethod.POST }, configOrTarget, propertyKey, descriptor);
57
+ }
58
+ else {
59
+ return (target, propertyKey, descriptor) => {
60
+ configOrTarget.method = HttpMethod.POST;
61
+ process(configOrTarget, target, propertyKey, descriptor);
62
+ };
63
+ }
64
+ }
65
+ export const getPOST = (target, propertyKey) => {
66
+ return getUrlMapping(target, propertyKey);
67
+ };
68
+ export const getPOSTS = (target) => {
69
+ var _a;
70
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.POST; });
71
+ };
72
+ export function DELETE(configOrTarget, propertyKey, descriptor) {
73
+ if (propertyKey && descriptor) {
74
+ process({ method: HttpMethod.DELETE }, configOrTarget, propertyKey, descriptor);
75
+ }
76
+ else {
77
+ return (target, propertyKey, descriptor) => {
78
+ configOrTarget.method = HttpMethod.DELETE;
79
+ process(configOrTarget, target, propertyKey, descriptor);
80
+ };
81
+ }
82
+ }
83
+ export const getDELETE = (target, propertyKey) => {
84
+ return getUrlMapping(target, propertyKey);
85
+ };
86
+ export const getDELETES = (target) => {
87
+ var _a;
88
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.DELETE; });
89
+ };
90
+ export function PUT(configOrTarget, propertyKey, descriptor) {
91
+ if (propertyKey && descriptor) {
92
+ process({ method: HttpMethod.PUT }, configOrTarget, propertyKey, descriptor);
93
+ }
94
+ else {
95
+ return (target, propertyKey, descriptor) => {
96
+ configOrTarget.method = HttpMethod.PUT;
97
+ process(configOrTarget, target, propertyKey, descriptor);
98
+ };
99
+ }
100
+ }
101
+ export const getPUT = (target, propertyKey) => {
102
+ return getUrlMapping(target, propertyKey);
103
+ };
104
+ export const getPUTS = (target) => {
105
+ var _a;
106
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.PUT; });
107
+ };
108
+ export function PATCH(configOrTarget, propertyKey, descriptor) {
109
+ if (propertyKey && descriptor) {
110
+ process({ method: HttpMethod.PATCH }, configOrTarget, propertyKey, descriptor);
111
+ }
112
+ else {
113
+ return (target, propertyKey, descriptor) => {
114
+ configOrTarget.method = HttpMethod.PATCH;
115
+ process(configOrTarget, target, propertyKey, descriptor);
116
+ };
117
+ }
118
+ }
119
+ export const getPATCH = (target, propertyKey) => {
120
+ return getUrlMapping(target, propertyKey);
121
+ };
122
+ export const getPATCHS = (target) => {
123
+ var _a;
124
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.GET; });
125
+ };
126
+ export function OPTIONS(configOrTarget, propertyKey, descriptor) {
127
+ if (propertyKey && descriptor) {
128
+ process({ method: HttpMethod.OPTIONS }, configOrTarget, propertyKey, descriptor);
129
+ }
130
+ else {
131
+ return (target, propertyKey, descriptor) => {
132
+ configOrTarget.method = HttpMethod.OPTIONS;
133
+ process(configOrTarget, target, propertyKey, descriptor);
134
+ };
135
+ }
136
+ }
137
+ export const getOPTIONS = (target, propertyKey) => {
138
+ return getUrlMapping(target, propertyKey);
139
+ };
140
+ export const getOPTIONSS = (target) => {
141
+ var _a;
142
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.OPTIONS; });
143
+ };
144
+ export function HEAD(configOrTarget, propertyKey, descriptor) {
145
+ if (propertyKey && descriptor) {
146
+ process({ method: HttpMethod.HEAD }, configOrTarget, propertyKey, descriptor);
147
+ }
148
+ else {
149
+ return (target, propertyKey, descriptor) => {
150
+ configOrTarget.method = HttpMethod.HEAD;
151
+ process(configOrTarget, target, propertyKey, descriptor);
152
+ };
153
+ }
154
+ }
155
+ export const getHEAD = (target, propertyKey) => {
156
+ return getUrlMapping(target, propertyKey);
157
+ };
158
+ export const getHEADS = (target) => {
159
+ var _a;
160
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.GET; });
161
+ };
162
+ export function TRACE(configOrTarget, propertyKey, descriptor) {
163
+ if (propertyKey && descriptor) {
164
+ process({ method: HttpMethod.TRACE }, configOrTarget, propertyKey, descriptor);
165
+ }
166
+ else {
167
+ return (target, propertyKey, descriptor) => {
168
+ configOrTarget.method = HttpMethod.TRACE;
169
+ process(configOrTarget, target, propertyKey, descriptor);
170
+ };
171
+ }
172
+ }
173
+ export const getTRACE = (target, propertyKey) => {
174
+ return getUrlMapping(target, propertyKey);
175
+ };
176
+ export const getTRACES = (target) => {
177
+ var _a;
178
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.TRACE; });
179
+ };
180
+ export function CONNECT(configOrTarget, propertyKey, descriptor) {
181
+ if (propertyKey && descriptor) {
182
+ process({ method: HttpMethod.CONNECT }, configOrTarget, propertyKey, descriptor);
183
+ }
184
+ else {
185
+ return (target, propertyKey, descriptor) => {
186
+ configOrTarget.method = HttpMethod.CONNECT;
187
+ process(configOrTarget, target, propertyKey, descriptor);
188
+ };
189
+ }
190
+ }
191
+ export const getCONNECT = (target, propertyKey) => {
192
+ return getUrlMapping(target, propertyKey);
193
+ };
194
+ export const getCONNECTS = (target) => {
195
+ var _a;
196
+ return (_a = getUrlMappings(target)) === null || _a === void 0 ? void 0 : _a.filter(it => { var _a; return ((_a = it.config) === null || _a === void 0 ? void 0 : _a.method.toUpperCase()) === HttpMethod.CONNECT; });
197
+ };
198
+ //# sourceMappingURL=MethodMapping.js.map
@@ -0,0 +1,16 @@
1
+ import { EndPoint } from './EndPoint';
2
+ import { SimpleBootHttpServer } from '../SimpleBootHttpServer';
3
+ import { RequestResponse } from '../models/RequestResponse';
4
+ export type CrossDomainHeaderEndPointConfig = {
5
+ accessControlAllowOrigin?: string | string[];
6
+ accessControlAllowMethods?: string | string[];
7
+ accessControlAllowHeaders?: string | string[];
8
+ accessControlExposeHeaders?: string | string[];
9
+ };
10
+ export declare class CrossDomainHeaderEndPoint implements EndPoint {
11
+ private config?;
12
+ constructor(config?: CrossDomainHeaderEndPointConfig);
13
+ endPoint(rr: RequestResponse, app: SimpleBootHttpServer): Promise<void>;
14
+ onInit(app: SimpleBootHttpServer): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=CrossDomainHeaderEndPoint.d.ts.map
@@ -0,0 +1,37 @@
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
+ import { HttpHeaders } from '../codes/HttpHeaders';
11
+ export class CrossDomainHeaderEndPoint {
12
+ constructor(config) {
13
+ this.config = config;
14
+ }
15
+ endPoint(rr, app) {
16
+ var _a, _b, _c, _d;
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.accessControlAllowOrigin) {
19
+ rr.resSetHeader(HttpHeaders.AccessControlAllowOrigin, Array.isArray(this.config.accessControlAllowOrigin) ? this.config.accessControlAllowOrigin.join(', ') : this.config.accessControlAllowOrigin);
20
+ }
21
+ if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.accessControlAllowMethods) {
22
+ rr.resSetHeader(HttpHeaders.AccessControlAllowMethods, Array.isArray(this.config.accessControlAllowMethods) ? this.config.accessControlAllowMethods.join(', ') : this.config.accessControlAllowMethods);
23
+ }
24
+ if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.accessControlAllowHeaders) {
25
+ rr.resSetHeader(HttpHeaders.AccessControlAllowHeaders, Array.isArray(this.config.accessControlAllowHeaders) ? this.config.accessControlAllowHeaders.join(', ') : this.config.accessControlAllowHeaders);
26
+ }
27
+ if ((_d = this.config) === null || _d === void 0 ? void 0 : _d.accessControlExposeHeaders) {
28
+ rr.resSetHeader(HttpHeaders.AccessControlExposeHeaders, Array.isArray(this.config.accessControlExposeHeaders) ? this.config.accessControlExposeHeaders.join(', ') : this.config.accessControlExposeHeaders);
29
+ }
30
+ });
31
+ }
32
+ onInit(app) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ });
35
+ }
36
+ }
37
+ //# sourceMappingURL=CrossDomainHeaderEndPoint.js.map
@@ -0,0 +1,7 @@
1
+ import { RequestResponse } from '../models/RequestResponse';
2
+ import { SimpleBootHttpServer } from '../SimpleBootHttpServer';
3
+ import { OnInit } from '../lifecycle/OnInit';
4
+ export interface EndPoint extends OnInit {
5
+ endPoint(rr: RequestResponse, app: SimpleBootHttpServer): Promise<any>;
6
+ }
7
+ //# sourceMappingURL=EndPoint.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EndPoint.js.map
@@ -0,0 +1,12 @@
1
+ import { EndPoint } from './EndPoint';
2
+ import { SimpleBootHttpServer } from '../SimpleBootHttpServer';
3
+ import { RequestResponse } from '../models/RequestResponse';
4
+ export declare class HeaderEndPoint implements EndPoint {
5
+ private headers?;
6
+ constructor(headers?: {
7
+ [key: string]: string | string[];
8
+ });
9
+ endPoint(rr: RequestResponse, app: SimpleBootHttpServer): Promise<void>;
10
+ onInit(app: SimpleBootHttpServer): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=HeaderEndPoint.d.ts.map
@@ -0,0 +1,26 @@
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
+ export class HeaderEndPoint {
11
+ constructor(headers) {
12
+ this.headers = headers;
13
+ }
14
+ endPoint(rr, app) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ if (this.headers) {
17
+ rr.resSetHeaders(this.headers);
18
+ }
19
+ });
20
+ }
21
+ onInit(app) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ });
24
+ }
25
+ }
26
+ //# sourceMappingURL=HeaderEndPoint.js.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ export declare class BadRequestError extends HttpError {
3
+ constructor({ status, message }?: {
4
+ status?: number;
5
+ message?: string;
6
+ });
7
+ }
8
+ //# sourceMappingURL=BadRequestError.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ import { HttpStatus } from '../codes/HttpStatus';
3
+ export class BadRequestError extends HttpError {
4
+ constructor({ status = HttpStatus.BadRequest, message = 'Bad Request' } = {}) {
5
+ super({ status, message });
6
+ }
7
+ }
8
+ //# sourceMappingURL=BadRequestError.js.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ export declare class ForbiddenError extends HttpError {
3
+ constructor({ status, message }?: {
4
+ status?: number;
5
+ message?: string;
6
+ });
7
+ }
8
+ //# sourceMappingURL=ForbiddenError.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ import { HttpStatus } from '../codes/HttpStatus';
3
+ export class ForbiddenError extends HttpError {
4
+ constructor({ status = HttpStatus.Forbidden, message = 'Forbidden' } = {}) {
5
+ super({ status, message });
6
+ }
7
+ }
8
+ //# sourceMappingURL=ForbiddenError.js.map
@@ -0,0 +1,12 @@
1
+ export declare class HttpError {
2
+ name: string;
3
+ message: string;
4
+ stack?: string;
5
+ data?: any;
6
+ status: number;
7
+ constructor({ status, message }: {
8
+ status: number;
9
+ message?: string;
10
+ });
11
+ }
12
+ //# sourceMappingURL=HttpError.d.ts.map
@@ -0,0 +1,8 @@
1
+ export class HttpError {
2
+ constructor({ status, message = 'HttpError' }) {
3
+ this.name = 'Error';
4
+ this.message = message;
5
+ this.status = status;
6
+ }
7
+ }
8
+ //# sourceMappingURL=HttpError.js.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ export declare class InternalServerError extends HttpError {
3
+ constructor({ status, message }?: {
4
+ status?: number;
5
+ message?: string;
6
+ });
7
+ }
8
+ //# sourceMappingURL=InternalServerError.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ import { HttpStatus } from '../codes/HttpStatus';
3
+ export class InternalServerError extends HttpError {
4
+ constructor({ status = HttpStatus.InternalServerError, message = 'Internal Server Error' } = {}) {
5
+ super({ status, message });
6
+ }
7
+ }
8
+ //# sourceMappingURL=InternalServerError.js.map
@@ -0,0 +1,8 @@
1
+ import { HttpError } from './HttpError';
2
+ export declare class NotFoundError extends HttpError {
3
+ constructor({ status, message }?: {
4
+ status?: number;
5
+ message?: string;
6
+ });
7
+ }
8
+ //# sourceMappingURL=NotFoundError.d.ts.map