routup 0.8.0 → 0.8.2

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 (220) hide show
  1. package/dist/handler/index.d.ts +0 -1
  2. package/dist/handler/index.d.ts.map +1 -1
  3. package/dist/handler/index.js +0 -1
  4. package/dist/handler/index.js.map +1 -1
  5. package/dist/handler/utils.d.ts +1 -1
  6. package/dist/handler/utils.d.ts.map +1 -1
  7. package/dist/handler/utils.js +3 -3
  8. package/dist/handler/utils.js.map +1 -1
  9. package/dist/index.d.ts +1 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/layer/index.d.ts +1 -0
  14. package/dist/layer/index.d.ts.map +1 -1
  15. package/dist/layer/index.js +1 -0
  16. package/dist/layer/index.js.map +1 -1
  17. package/dist/layer/module.d.ts +4 -3
  18. package/dist/layer/module.d.ts.map +1 -1
  19. package/dist/layer/module.js +5 -10
  20. package/dist/layer/module.js.map +1 -1
  21. package/dist/layer/type.d.ts +7 -0
  22. package/dist/layer/type.d.ts.map +1 -0
  23. package/dist/{config → layer}/type.js +1 -1
  24. package/dist/{handler → layer}/type.js.map +1 -1
  25. package/dist/path/matcher.d.ts.map +1 -1
  26. package/dist/path/matcher.js +1 -0
  27. package/dist/path/matcher.js.map +1 -1
  28. package/dist/route/index.d.ts +1 -0
  29. package/dist/route/index.d.ts.map +1 -1
  30. package/dist/route/index.js +1 -0
  31. package/dist/route/index.js.map +1 -1
  32. package/dist/route/module.d.ts +4 -4
  33. package/dist/route/module.d.ts.map +1 -1
  34. package/dist/route/module.js +31 -23
  35. package/dist/route/module.js.map +1 -1
  36. package/dist/route/type.d.ts +7 -0
  37. package/dist/route/type.d.ts.map +1 -0
  38. package/dist/{helpers/response/send-format.js → route/type.js} +1 -5
  39. package/dist/{config → route}/type.js.map +1 -1
  40. package/dist/router/module.d.ts +35 -8
  41. package/dist/router/module.d.ts.map +1 -1
  42. package/dist/router/module.js +45 -23
  43. package/dist/router/module.js.map +1 -1
  44. package/dist/router/type.d.ts +14 -7
  45. package/dist/router/type.d.ts.map +1 -1
  46. package/dist/router/type.js +0 -6
  47. package/dist/router/type.js.map +1 -1
  48. package/dist/type.d.ts +0 -7
  49. package/dist/type.d.ts.map +1 -1
  50. package/dist/utils/index.d.ts +0 -2
  51. package/dist/utils/index.d.ts.map +1 -1
  52. package/dist/utils/index.js +0 -2
  53. package/dist/utils/index.js.map +1 -1
  54. package/dist/utils/request.d.ts +1 -1
  55. package/dist/utils/request.d.ts.map +1 -1
  56. package/package.json +8 -15
  57. package/dist/config/accessors.d.ts +0 -15
  58. package/dist/config/accessors.d.ts.map +0 -1
  59. package/dist/config/accessors.js +0 -32
  60. package/dist/config/accessors.js.map +0 -1
  61. package/dist/config/index.d.ts +0 -5
  62. package/dist/config/index.d.ts.map +0 -1
  63. package/dist/config/index.js +0 -27
  64. package/dist/config/index.js.map +0 -1
  65. package/dist/config/module.d.ts +0 -23
  66. package/dist/config/module.d.ts.map +0 -1
  67. package/dist/config/module.js +0 -126
  68. package/dist/config/module.js.map +0 -1
  69. package/dist/config/singleton.d.ts +0 -4
  70. package/dist/config/singleton.d.ts.map +0 -1
  71. package/dist/config/singleton.js +0 -50
  72. package/dist/config/singleton.js.map +0 -1
  73. package/dist/config/type.d.ts +0 -78
  74. package/dist/config/type.d.ts.map +0 -1
  75. package/dist/config/utils/etag.d.ts +0 -3
  76. package/dist/config/utils/etag.d.ts.map +0 -1
  77. package/dist/config/utils/etag.js +0 -43
  78. package/dist/config/utils/etag.js.map +0 -1
  79. package/dist/config/utils/index.d.ts +0 -4
  80. package/dist/config/utils/index.d.ts.map +0 -1
  81. package/dist/config/utils/index.js +0 -26
  82. package/dist/config/utils/index.js.map +0 -1
  83. package/dist/config/utils/trust-proxy.d.ts +0 -3
  84. package/dist/config/utils/trust-proxy.d.ts.map +0 -1
  85. package/dist/config/utils/trust-proxy.js +0 -31
  86. package/dist/config/utils/trust-proxy.js.map +0 -1
  87. package/dist/config/utils/validator.d.ts +0 -3
  88. package/dist/config/utils/validator.d.ts.map +0 -1
  89. package/dist/config/utils/validator.js +0 -20
  90. package/dist/config/utils/validator.js.map +0 -1
  91. package/dist/constants.d.ts +0 -30
  92. package/dist/constants.d.ts.map +0 -1
  93. package/dist/constants.js +0 -41
  94. package/dist/constants.js.map +0 -1
  95. package/dist/handler/type.d.ts +0 -4
  96. package/dist/handler/type.d.ts.map +0 -1
  97. package/dist/handler/type.js +0 -3
  98. package/dist/helpers/index.d.ts +0 -3
  99. package/dist/helpers/index.d.ts.map +0 -1
  100. package/dist/helpers/index.js +0 -25
  101. package/dist/helpers/index.js.map +0 -1
  102. package/dist/helpers/request/cache.d.ts +0 -3
  103. package/dist/helpers/request/cache.d.ts.map +0 -1
  104. package/dist/helpers/request/cache.js +0 -21
  105. package/dist/helpers/request/cache.js.map +0 -1
  106. package/dist/helpers/request/env.d.ts +0 -7
  107. package/dist/helpers/request/env.d.ts.map +0 -1
  108. package/dist/helpers/request/env.js +0 -57
  109. package/dist/helpers/request/env.js.map +0 -1
  110. package/dist/helpers/request/header-accept-charset.d.ts +0 -5
  111. package/dist/helpers/request/header-accept-charset.d.ts.map +0 -1
  112. package/dist/helpers/request/header-accept-charset.js +0 -26
  113. package/dist/helpers/request/header-accept-charset.js.map +0 -1
  114. package/dist/helpers/request/header-accept-encoding.d.ts +0 -4
  115. package/dist/helpers/request/header-accept-encoding.d.ts.map +0 -1
  116. package/dist/helpers/request/header-accept-encoding.js +0 -26
  117. package/dist/helpers/request/header-accept-encoding.js.map +0 -1
  118. package/dist/helpers/request/header-accept-language.d.ts +0 -4
  119. package/dist/helpers/request/header-accept-language.d.ts.map +0 -1
  120. package/dist/helpers/request/header-accept-language.js +0 -26
  121. package/dist/helpers/request/header-accept-language.js.map +0 -1
  122. package/dist/helpers/request/header-accept.d.ts +0 -4
  123. package/dist/helpers/request/header-accept.d.ts.map +0 -1
  124. package/dist/helpers/request/header-accept.js +0 -51
  125. package/dist/helpers/request/header-accept.js.map +0 -1
  126. package/dist/helpers/request/header-content-type.d.ts +0 -3
  127. package/dist/helpers/request/header-content-type.d.ts.map +0 -1
  128. package/dist/helpers/request/header-content-type.js +0 -28
  129. package/dist/helpers/request/header-content-type.js.map +0 -1
  130. package/dist/helpers/request/header.d.ts +0 -5
  131. package/dist/helpers/request/header.d.ts.map +0 -1
  132. package/dist/helpers/request/header.js +0 -18
  133. package/dist/helpers/request/header.js.map +0 -1
  134. package/dist/helpers/request/hostname.d.ts +0 -8
  135. package/dist/helpers/request/hostname.d.ts.map +0 -1
  136. package/dist/helpers/request/hostname.js +0 -46
  137. package/dist/helpers/request/hostname.js.map +0 -1
  138. package/dist/helpers/request/index.d.ts +0 -16
  139. package/dist/helpers/request/index.d.ts.map +0 -1
  140. package/dist/helpers/request/index.js +0 -38
  141. package/dist/helpers/request/index.js.map +0 -1
  142. package/dist/helpers/request/ip.d.ts +0 -8
  143. package/dist/helpers/request/ip.d.ts.map +0 -1
  144. package/dist/helpers/request/ip.js +0 -29
  145. package/dist/helpers/request/ip.js.map +0 -1
  146. package/dist/helpers/request/mount-path.d.ts +0 -5
  147. package/dist/helpers/request/mount-path.d.ts.map +0 -1
  148. package/dist/helpers/request/mount-path.js +0 -22
  149. package/dist/helpers/request/mount-path.js.map +0 -1
  150. package/dist/helpers/request/negotiator.d.ts +0 -5
  151. package/dist/helpers/request/negotiator.d.ts.map +0 -1
  152. package/dist/helpers/request/negotiator.js +0 -22
  153. package/dist/helpers/request/negotiator.js.map +0 -1
  154. package/dist/helpers/request/params.d.ts +0 -6
  155. package/dist/helpers/request/params.d.ts.map +0 -1
  156. package/dist/helpers/request/params.js +0 -35
  157. package/dist/helpers/request/params.js.map +0 -1
  158. package/dist/helpers/request/path.d.ts +0 -4
  159. package/dist/helpers/request/path.d.ts.map +0 -1
  160. package/dist/helpers/request/path.js +0 -21
  161. package/dist/helpers/request/path.js.map +0 -1
  162. package/dist/helpers/request/protocol.d.ts +0 -9
  163. package/dist/helpers/request/protocol.d.ts.map +0 -1
  164. package/dist/helpers/request/protocol.js +0 -50
  165. package/dist/helpers/request/protocol.js.map +0 -1
  166. package/dist/helpers/response/cache.d.ts +0 -8
  167. package/dist/helpers/response/cache.d.ts.map +0 -1
  168. package/dist/helpers/response/cache.js +0 -25
  169. package/dist/helpers/response/cache.js.map +0 -1
  170. package/dist/helpers/response/header-attachment.d.ts +0 -4
  171. package/dist/helpers/response/header-attachment.d.ts.map +0 -1
  172. package/dist/helpers/response/header-attachment.js +0 -29
  173. package/dist/helpers/response/header-attachment.js.map +0 -1
  174. package/dist/helpers/response/header-content-type.d.ts +0 -3
  175. package/dist/helpers/response/header-content-type.d.ts.map +0 -1
  176. package/dist/helpers/response/header-content-type.js +0 -25
  177. package/dist/helpers/response/header-content-type.js.map +0 -1
  178. package/dist/helpers/response/header.d.ts +0 -6
  179. package/dist/helpers/response/header.d.ts.map +0 -1
  180. package/dist/helpers/response/header.js +0 -51
  181. package/dist/helpers/response/header.js.map +0 -1
  182. package/dist/helpers/response/index.d.ts +0 -12
  183. package/dist/helpers/response/index.d.ts.map +0 -1
  184. package/dist/helpers/response/index.js +0 -34
  185. package/dist/helpers/response/index.js.map +0 -1
  186. package/dist/helpers/response/send-accepted.d.ts +0 -3
  187. package/dist/helpers/response/send-accepted.d.ts.map +0 -1
  188. package/dist/helpers/response/send-accepted.js +0 -17
  189. package/dist/helpers/response/send-accepted.js.map +0 -1
  190. package/dist/helpers/response/send-created.d.ts +0 -3
  191. package/dist/helpers/response/send-created.d.ts.map +0 -1
  192. package/dist/helpers/response/send-created.js +0 -17
  193. package/dist/helpers/response/send-created.js.map +0 -1
  194. package/dist/helpers/response/send-file.d.ts +0 -5
  195. package/dist/helpers/response/send-file.d.ts.map +0 -1
  196. package/dist/helpers/response/send-file.js +0 -27
  197. package/dist/helpers/response/send-file.js.map +0 -1
  198. package/dist/helpers/response/send-format.d.ts +0 -7
  199. package/dist/helpers/response/send-format.d.ts.map +0 -1
  200. package/dist/helpers/response/send-format.js.map +0 -1
  201. package/dist/helpers/response/send-redirect.d.ts +0 -3
  202. package/dist/helpers/response/send-redirect.d.ts.map +0 -1
  203. package/dist/helpers/response/send-redirect.js +0 -19
  204. package/dist/helpers/response/send-redirect.js.map +0 -1
  205. package/dist/helpers/response/send-stream.d.ts +0 -5
  206. package/dist/helpers/response/send-stream.d.ts.map +0 -1
  207. package/dist/helpers/response/send-stream.js +0 -33
  208. package/dist/helpers/response/send-stream.js.map +0 -1
  209. package/dist/helpers/response/send.d.ts +0 -3
  210. package/dist/helpers/response/send.d.ts.map +0 -1
  211. package/dist/helpers/response/send.js +0 -97
  212. package/dist/helpers/response/send.js.map +0 -1
  213. package/dist/utils/mime.d.ts +0 -2
  214. package/dist/utils/mime.d.ts.map +0 -1
  215. package/dist/utils/mime.js +0 -21
  216. package/dist/utils/mime.js.map +0 -1
  217. package/dist/utils/object.d.ts +0 -2
  218. package/dist/utils/object.d.ts.map +0 -1
  219. package/dist/utils/object.js +0 -16
  220. package/dist/utils/object.js.map +0 -1
@@ -1,50 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useConfig = void 0;
13
- const zod_1 = __importDefault(require("zod"));
14
- const module_1 = require("./module");
15
- const utils_1 = require("./utils");
16
- let instance;
17
- function useConfig() {
18
- if (typeof instance !== 'undefined') {
19
- return instance;
20
- }
21
- instance = new module_1.Config({
22
- defaults: {
23
- env: process.env.NODE_ENV || 'development',
24
- trustProxy: () => false,
25
- subdomainOffset: 2,
26
- etag: (0, utils_1.buildConfigEtagOption)(),
27
- proxyIpHeader: 'X-Forwarded-For',
28
- proxyIpMax: 0,
29
- caseSensitive: true,
30
- requestIdHeader: 'request-id',
31
- },
32
- transformers: {
33
- etag: (value) => (0, utils_1.buildConfigEtagOption)(value),
34
- trustProxy: (value) => (0, utils_1.buildConfigTrustProxyOption)(value),
35
- },
36
- validators: {
37
- env: (value) => zod_1.default.string().safeParse(value),
38
- trustProxy: (value) => zod_1.default.any().safeParse(value),
39
- subdomainOffset: (value) => zod_1.default.number().nonnegative().safeParse(value),
40
- etag: (value) => zod_1.default.any().safeParse(value),
41
- proxyIpHeader: (value) => zod_1.default.string().min(3).safeParse(value),
42
- proxyIpMax: (value) => zod_1.default.number().nonnegative().safeParse(value),
43
- caseSensitive: (value) => zod_1.default.boolean().safeParse(value),
44
- requestIdHeader: (value) => zod_1.default.string().min(3).safeParse(value),
45
- },
46
- });
47
- return instance;
48
- }
49
- exports.useConfig = useConfig;
50
- //# sourceMappingURL=singleton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"singleton.js","sourceRoot":"","sources":["../../src/config/singleton.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,8CAAsB;AACtB,qCAAkC;AAIlC,mCAA6E;AAE7E,IAAI,QAAgE,CAAC;AAErE,SAAgB,SAAS;IACrB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACjC,OAAO,QAAQ,CAAC;KACnB;IAED,QAAQ,GAAG,IAAI,eAAM,CAAoC;QACrD,QAAQ,EAAE;YACN,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;YAC1C,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;YACvB,eAAe,EAAE,CAAC;YAClB,IAAI,EAAE,IAAA,6BAAqB,GAAE;YAC7B,aAAa,EAAE,iBAAiB;YAChC,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,YAAY;SAChC;QACD,YAAY,EAAE;YACV,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,6BAAqB,EAAC,KAAkB,CAAC;YAC1D,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAA2B,EAAC,KAAwB,CAAC;SAC/E;QACD,UAAU,EAAE;YACR,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YAC7C,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YACjD,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YACvE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YAC3C,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;YAC9D,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YAClE,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YACxD,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;SACnE;KACJ,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC;AAjCD,8BAiCC"}
@@ -1,78 +0,0 @@
1
- /// <reference types="node" />
2
- import { Options as EtagBaseOptions } from 'etag';
3
- import { ObjectLiteral } from '../type';
4
- export type EtagOptions = EtagBaseOptions & {
5
- /**
6
- * Threshold of bytes from which an etag is generated.
7
- *
8
- * default: undefined
9
- */
10
- threshold?: number;
11
- };
12
- export type EtagFn = (body: any, encoding?: BufferEncoding, size?: number) => string | undefined;
13
- export type EtagInput = boolean | EtagOptions | EtagFn;
14
- export type TrustProxyFn = (address: string, hop: number) => boolean;
15
- export type TrustProxyInput = boolean | number | string | string[] | TrustProxyFn;
16
- export type ConfigOptions = {
17
- /**
18
- * default: process.NODE_ENV
19
- */
20
- env: string;
21
- /**
22
- * default: () => false
23
- */
24
- trustProxy: TrustProxyFn;
25
- /**
26
- * default: 2
27
- */
28
- subdomainOffset: number;
29
- /**
30
- * default: () => true
31
- */
32
- etag: EtagFn;
33
- /**
34
- * Default: X-Forwarded-For
35
- */
36
- proxyIpHeader: string;
37
- /**
38
- * default: 0
39
- */
40
- proxyIpMax?: number;
41
- /**
42
- * default: true
43
- */
44
- caseSensitive: boolean;
45
- /**
46
- * default: request-id
47
- */
48
- requestIdHeader: string;
49
- };
50
- export type ConfigOptionsInput = {
51
- /**
52
- * default: true
53
- */
54
- etag?: EtagInput;
55
- /**
56
- * default: false
57
- */
58
- trustProxy?: TrustProxyInput;
59
- } & Partial<Omit<ConfigOptions, 'etag' | 'trustProxy'>>;
60
- export type ConfigOptionTransformer<V> = (value: unknown) => V;
61
- export type ConfigOptionsTransformer<T extends ObjectLiteral> = {
62
- [K in keyof T]?: ConfigOptionTransformer<T[K]>;
63
- };
64
- export type ConfigOptionValidatorResult<V> = {
65
- success: boolean;
66
- data: V;
67
- };
68
- export type ConfigOptionValidator<V> = (value: unknown) => unknown;
69
- export type ConfigOptionsValidators<T extends ObjectLiteral> = {
70
- [K in keyof T]?: ConfigOptionValidator<T[K]>;
71
- };
72
- export type ConfigContext<T extends ObjectLiteral> = {
73
- defaults: T;
74
- options?: Partial<T>;
75
- transformers?: ConfigOptionsTransformer<T>;
76
- validators?: ConfigOptionsValidators<T>;
77
- };
78
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/config/type.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IACxC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AACjG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAC;AAElF,MAAM,MAAM,aAAa,GAAG;IACxB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC;AACxD,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAC;AAE/D,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,aAAa,IAAI;KAC3D,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,2BAA2B,CAAC,CAAC,IAAI;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,CAAA;CACV,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAEnE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,aAAa,IAAI;KAC1D,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,aAAa,IAAI;IACjD,QAAQ,EAAE,CAAC,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,YAAY,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAA;CAC1C,CAAC"}
@@ -1,3 +0,0 @@
1
- import { EtagFn, EtagOptions } from '../type';
2
- export declare function buildConfigEtagOption(input?: boolean | EtagOptions | EtagFn): EtagFn;
3
- //# sourceMappingURL=etag.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"etag.d.ts","sourceRoot":"","sources":["../../../src/config/utils/etag.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,GAAI,MAAM,CAkCrF"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.buildConfigEtagOption = void 0;
13
- const etag_1 = __importDefault(require("etag"));
14
- const smob_1 = require("smob");
15
- function buildConfigEtagOption(input) {
16
- if (typeof input === 'function') {
17
- return input;
18
- }
19
- input = input !== null && input !== void 0 ? input : true;
20
- if (input === false) {
21
- return () => undefined;
22
- }
23
- let options = {
24
- weak: true,
25
- };
26
- if ((0, smob_1.isObject)(input)) {
27
- options = (0, smob_1.merge)(input, options);
28
- }
29
- return (body, encoding, size) => {
30
- const buff = Buffer.isBuffer(body) ?
31
- body :
32
- Buffer.from(body, encoding);
33
- if (typeof options.threshold !== 'undefined') {
34
- size = size !== null && size !== void 0 ? size : Buffer.byteLength(buff);
35
- if (size <= options.threshold) {
36
- return undefined;
37
- }
38
- }
39
- return (0, etag_1.default)(buff, options);
40
- };
41
- }
42
- exports.buildConfigEtagOption = buildConfigEtagOption;
43
- //# sourceMappingURL=etag.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"etag.js","sourceRoot":"","sources":["../../../src/config/utils/etag.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,gDAAwB;AACxB,+BAAuC;AAGvC,SAAgB,qBAAqB,CAAC,KAAsC;IACxE,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAC7B,OAAO,KAAK,CAAC;KAChB;IAED,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;IAEtB,IAAI,KAAK,KAAK,KAAK,EAAE;QACjB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;KAC1B;IAED,IAAI,OAAO,GAAiB;QACxB,IAAI,EAAE,IAAI;KACb,CAAC;IAEF,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE;QACjB,OAAO,GAAG,IAAA,YAAK,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACnC;IAED,OAAO,CAAC,IAAS,EAAE,QAAyB,EAAE,IAAa,EAAE,EAAE;QAC3D,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEhC,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,WAAW,EAAE;YAC1C,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEvC,IAAI,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE;gBAC3B,OAAO,SAAS,CAAC;aACpB;SACJ;QAED,OAAO,IAAA,cAAI,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC;AACN,CAAC;AAlCD,sDAkCC"}
@@ -1,4 +0,0 @@
1
- export * from './etag';
2
- export * from './trust-proxy';
3
- export * from './validator';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./etag"), exports);
24
- __exportStar(require("./trust-proxy"), exports);
25
- __exportStar(require("./validator"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,gDAA8B;AAC9B,8CAA4B"}
@@ -1,3 +0,0 @@
1
- import { TrustProxyFn } from '../type';
2
- export declare function buildConfigTrustProxyOption(input?: boolean | number | string | string[] | TrustProxyFn): TrustProxyFn;
3
- //# sourceMappingURL=trust-proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trust-proxy.d.ts","sourceRoot":"","sources":["../../../src/config/utils/trust-proxy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,2BAA2B,CACvC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,GAC3D,YAAY,CAmBf"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.buildConfigTrustProxyOption = void 0;
13
- const proxy_addr_1 = __importDefault(require("proxy-addr"));
14
- function buildConfigTrustProxyOption(input) {
15
- if (typeof input === 'function') {
16
- return input;
17
- }
18
- if (input === true) {
19
- return () => true;
20
- }
21
- if (typeof input === 'number') {
22
- return (address, hop) => hop < input;
23
- }
24
- if (typeof input === 'string') {
25
- input = input.split(',')
26
- .map((value) => value.trim());
27
- }
28
- return proxy_addr_1.default.compile(input || []);
29
- }
30
- exports.buildConfigTrustProxyOption = buildConfigTrustProxyOption;
31
- //# sourceMappingURL=trust-proxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trust-proxy.js","sourceRoot":"","sources":["../../../src/config/utils/trust-proxy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,4DAAmC;AAGnC,SAAgB,2BAA2B,CACvC,KAA2D;IAE3D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAC7B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,KAAK,KAAK,IAAI,EAAE;QAChB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;KACrB;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAI,KAAgB,CAAC;KACpD;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;aACnB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;KACrC;IAED,OAAO,oBAAS,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC;AArBD,kEAqBC"}
@@ -1,3 +0,0 @@
1
- import { ConfigOptionValidatorResult } from '../type';
2
- export declare function isConfigOptionValidatorResult<V>(value: unknown): value is ConfigOptionValidatorResult<V>;
3
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/config/utils/validator.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAI,KAAK,IAAI,2BAA2B,CAAC,CAAC,CAAC,CAQzG"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.isConfigOptionValidatorResult = void 0;
10
- const smob_1 = require("smob");
11
- const utils_1 = require("../../utils");
12
- function isConfigOptionValidatorResult(value) {
13
- return (0, utils_1.isObject)(value) &&
14
- (0, smob_1.hasOwnProperty)(value, 'success') &&
15
- typeof value.success === 'boolean' &&
16
- ((0, smob_1.hasOwnProperty)(value, 'data') ||
17
- (0, smob_1.hasOwnProperty)(value, 'error'));
18
- }
19
- exports.isConfigOptionValidatorResult = isConfigOptionValidatorResult;
20
- //# sourceMappingURL=validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/config/utils/validator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAsC;AACtC,uCAAuC;AAGvC,SAAgB,6BAA6B,CAAI,KAAc;IAC3D,OAAO,IAAA,gBAAQ,EAAC,KAAK,CAAC;QAClB,IAAA,qBAAc,EAAC,KAAK,EAAE,SAAS,CAAC;QAChC,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS;QAClC,CACI,IAAA,qBAAc,EAAC,KAAK,EAAE,MAAM,CAAC;YAC7B,IAAA,qBAAc,EAAC,KAAK,EAAE,OAAO,CAAC,CACjC,CAAC;AACV,CAAC;AARD,sEAQC"}
@@ -1,30 +0,0 @@
1
- export declare enum Method {
2
- GET = "get",
3
- POST = "post",
4
- PUT = "put",
5
- PATCH = "patch",
6
- DELETE = "delete",
7
- OPTIONS = "options",
8
- HEAD = "head"
9
- }
10
- export declare enum HeaderName {
11
- ACCEPT = "accept",
12
- ACCEPT_CHARSET = "accept-charset",
13
- ACCEPT_ENCODING = "accept-encoding",
14
- ACCEPT_LANGUAGE = "accept-language",
15
- ALLOW = "allow",
16
- CACHE_CONTROL = "cache-control",
17
- CONTENT_DISPOSITION = "content-disposition",
18
- CONTENT_ENCODING = "content-encoding",
19
- CONTENT_LENGTH = "content-length",
20
- CONTENT_TYPE = "content-type",
21
- COOKIE = "cookie",
22
- HOST = "host",
23
- LAST_MODIFIED = "last-modified",
24
- LOCATION = "location",
25
- SET_COOKIE = "set-cookie",
26
- X_FORWARDED_HOST = "x-forwarded-host",
27
- X_FORWARDED_FOR = "x-forwarded-for",
28
- X_FORWARDED_PROTO = "x-forwarded-proto"
29
- }
30
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,MAAM;IACd,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;CAChB;AAED,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,KAAK,UAAU;IACf,aAAa,kBAAkB;IAC/B,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;CAC1C"}
package/dist/constants.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.HeaderName = exports.Method = void 0;
10
- var Method;
11
- (function (Method) {
12
- Method["GET"] = "get";
13
- Method["POST"] = "post";
14
- Method["PUT"] = "put";
15
- Method["PATCH"] = "patch";
16
- Method["DELETE"] = "delete";
17
- Method["OPTIONS"] = "options";
18
- Method["HEAD"] = "head";
19
- })(Method = exports.Method || (exports.Method = {}));
20
- var HeaderName;
21
- (function (HeaderName) {
22
- HeaderName["ACCEPT"] = "accept";
23
- HeaderName["ACCEPT_CHARSET"] = "accept-charset";
24
- HeaderName["ACCEPT_ENCODING"] = "accept-encoding";
25
- HeaderName["ACCEPT_LANGUAGE"] = "accept-language";
26
- HeaderName["ALLOW"] = "allow";
27
- HeaderName["CACHE_CONTROL"] = "cache-control";
28
- HeaderName["CONTENT_DISPOSITION"] = "content-disposition";
29
- HeaderName["CONTENT_ENCODING"] = "content-encoding";
30
- HeaderName["CONTENT_LENGTH"] = "content-length";
31
- HeaderName["CONTENT_TYPE"] = "content-type";
32
- HeaderName["COOKIE"] = "cookie";
33
- HeaderName["HOST"] = "host";
34
- HeaderName["LAST_MODIFIED"] = "last-modified";
35
- HeaderName["LOCATION"] = "location";
36
- HeaderName["SET_COOKIE"] = "set-cookie";
37
- HeaderName["X_FORWARDED_HOST"] = "x-forwarded-host";
38
- HeaderName["X_FORWARDED_FOR"] = "x-forwarded-for";
39
- HeaderName["X_FORWARDED_PROTO"] = "x-forwarded-proto";
40
- })(HeaderName = exports.HeaderName || (exports.HeaderName = {}));
41
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,MAQX;AARD,WAAY,MAAM;IACd,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,uBAAa,CAAA;AACjB,CAAC,EARW,MAAM,GAAN,cAAM,KAAN,cAAM,QAQjB;AAED,IAAY,UAmBX;AAnBD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+CAAiC,CAAA;IACjC,iDAAmC,CAAA;IACnC,iDAAmC,CAAA;IACnC,6BAAe,CAAA;IACf,6CAA+B,CAAA;IAC/B,yDAA2C,CAAA;IAC3C,mDAAqC,CAAA;IACrC,+CAAiC,CAAA;IACjC,2CAA6B,CAAA;IAC7B,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,6CAA+B,CAAA;IAC/B,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;IACzB,mDAAqC,CAAA;IACrC,iDAAmC,CAAA;IACnC,qDAAuC,CAAA;AAC3C,CAAC,EAnBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAmBrB"}
@@ -1,4 +0,0 @@
1
- import { Next, Request, Response } from '../type';
2
- export type Handler = (req: Request, res: Response, next: Next) => unknown;
3
- export type ErrorHandler = (err: Error, req: Request, res: Response, next: Next) => unknown;
4
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/handler/type.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,CAClB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC;AAEb,MAAM,MAAM,YAAY,GAAG,CACvB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACT,OAAO,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=type.js.map
@@ -1,3 +0,0 @@
1
- export * from './request';
2
- export * from './response';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAOA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- __exportStar(require("./request"), exports);
24
- __exportStar(require("./response"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,4CAA0B;AAC1B,6CAA2B"}
@@ -1,3 +0,0 @@
1
- import { Request } from '../../type';
2
- export declare function isRequestCacheable(req: Request, modifiedTime: string | Date): boolean;
3
- //# sourceMappingURL=cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/cache.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAI,OAAO,CAWtF"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.isRequestCacheable = void 0;
10
- function isRequestCacheable(req, modifiedTime) {
11
- const modifiedSince = req.headers['if-modified-since'];
12
- if (!modifiedSince) {
13
- return false;
14
- }
15
- modifiedTime = typeof modifiedTime === 'string' ?
16
- new Date(modifiedTime) :
17
- modifiedTime;
18
- return new Date(modifiedSince) >= modifiedTime;
19
- }
20
- exports.isRequestCacheable = isRequestCacheable;
21
- //# sourceMappingURL=cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/helpers/request/cache.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,SAAgB,kBAAkB,CAAC,GAAY,EAAE,YAA2B;IACxE,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE;QAChB,OAAO,KAAK,CAAC;KAChB;IAED,YAAY,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACxB,YAAY,CAAC;IAEjB,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,YAAY,CAAC;AACnD,CAAC;AAXD,gDAWC"}
@@ -1,7 +0,0 @@
1
- import { Request } from '../../type';
2
- export declare function setRequestEnv(req: Request, key: string, value: unknown): void;
3
- export declare function setRequestEnv(req: Request, record: Record<string, any>, append?: boolean): void;
4
- export declare function useRequestEnv(req: Request): Record<string, any>;
5
- export declare function useRequestEnv(req: Request, key: string): unknown | undefined;
6
- export declare function unsetRequestEnv(req: Request, key: string): void;
7
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/env.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAI,IAAI,CAAC;AAChF,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAI,IAAI,CAAC;AA0BlG,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAClE,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,OAAO,GAAG,SAAS,CAAC;AAiB/E,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,QAMxD"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.unsetRequestEnv = exports.useRequestEnv = exports.setRequestEnv = void 0;
10
- const smob_1 = require("smob");
11
- const envSymbol = Symbol.for('ReqEnv');
12
- function setRequestEnv(req, key, value) {
13
- if (envSymbol in req) {
14
- if (typeof key === 'object') {
15
- if (value) {
16
- req[envSymbol] = (0, smob_1.merge)(req[envSymbol], key);
17
- }
18
- else {
19
- req[envSymbol] = key;
20
- }
21
- }
22
- else {
23
- req[envSymbol][key] = value;
24
- }
25
- return;
26
- }
27
- if (typeof key === 'object') {
28
- req[envSymbol] = key;
29
- return;
30
- }
31
- req[envSymbol] = {
32
- [key]: value,
33
- };
34
- }
35
- exports.setRequestEnv = setRequestEnv;
36
- function useRequestEnv(req, key) {
37
- if (envSymbol in req) {
38
- if (typeof key === 'string') {
39
- return req[envSymbol][key];
40
- }
41
- return req[envSymbol];
42
- }
43
- if (typeof key === 'string') {
44
- return undefined;
45
- }
46
- return {};
47
- }
48
- exports.useRequestEnv = useRequestEnv;
49
- function unsetRequestEnv(req, key) {
50
- if (envSymbol in req) {
51
- if ((0, smob_1.hasOwnProperty)(req[envSymbol], key)) {
52
- delete req[envSymbol][key];
53
- }
54
- }
55
- }
56
- exports.unsetRequestEnv = unsetRequestEnv;
57
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/helpers/request/env.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA6C;AAG7C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAIvC,SAAgB,aAAa,CAAC,GAAY,EAAE,GAAiC,EAAE,KAAyB;IACpG,IAAI,SAAS,IAAI,GAAG,EAAE;QAClB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzB,IAAI,KAAK,EAAE;gBACN,GAAW,CAAC,SAAS,CAAC,GAAG,IAAA,YAAK,EAAE,GAAW,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;aACjE;iBAAM;gBACF,GAAW,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;aACjC;SACJ;aAAM;YACF,GAAW,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACxC;QAED,OAAO;KACV;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACxB,GAAW,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;QAC9B,OAAO;KACV;IAEA,GAAW,CAAC,SAAS,CAAC,GAAG;QACtB,CAAC,GAAG,CAAC,EAAE,KAAK;KACf,CAAC;AACN,CAAC;AAvBD,sCAuBC;AAID,SAAgB,aAAa,CAAC,GAAY,EAAE,GAAY;IACpD,IAAI,SAAS,IAAI,GAAG,EAAE;QAClB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzB,OAAQ,GAAW,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;SACvC;QAED,OAAQ,GAAW,CAAC,SAAS,CAAC,CAAC;KAClC;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACzB,OAAO,SAAS,CAAC;KACpB;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAdD,sCAcC;AAED,SAAgB,eAAe,CAAC,GAAY,EAAE,GAAW;IACrD,IAAI,SAAS,IAAI,GAAG,EAAE;QAClB,IAAI,IAAA,qBAAc,EAAE,GAAW,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE;YAC9C,OAAQ,GAAW,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;SACvC;KACJ;AACL,CAAC;AAND,0CAMC"}
@@ -1,5 +0,0 @@
1
- /// <reference types="node" />
2
- import { IncomingMessage } from 'http';
3
- export declare function getRequestAcceptableCharsets(req: IncomingMessage): string[];
4
- export declare function getRequestAcceptableCharset(req: IncomingMessage, input: string | string[]): string | undefined;
5
- //# sourceMappingURL=header-accept-charset.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header-accept-charset.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGvC,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,eAAe,GAAI,MAAM,EAAE,CAI5E;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAW/G"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getRequestAcceptableCharset = exports.getRequestAcceptableCharsets = void 0;
10
- const negotiator_1 = require("./negotiator");
11
- function getRequestAcceptableCharsets(req) {
12
- const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
13
- return negotiator.charsets();
14
- }
15
- exports.getRequestAcceptableCharsets = getRequestAcceptableCharsets;
16
- function getRequestAcceptableCharset(req, input) {
17
- input = input || [];
18
- const items = Array.isArray(input) ? input : [input];
19
- if (items.length === 0) {
20
- return getRequestAcceptableCharsets(req).shift();
21
- }
22
- const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
23
- return negotiator.charsets(items).shift() || undefined;
24
- }
25
- exports.getRequestAcceptableCharset = getRequestAcceptableCharset;
26
- //# sourceMappingURL=header-accept-charset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header-accept-charset.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;AAEpD,SAAgB,4BAA4B,CAAC,GAAoB;IAC7D,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC;AAJD,oEAIC;AAED,SAAgB,2BAA2B,CAAC,GAAoB,EAAE,KAAwB;IACtF,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;IAEpB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAErD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACpD;IAED,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,SAAS,CAAC;AAC3D,CAAC;AAXD,kEAWC"}
@@ -1,4 +0,0 @@
1
- import { Request } from '../../type';
2
- export declare function getRequestAcceptableEncodings(req: Request): string[];
3
- export declare function getRequestAcceptableEncoding(req: Request, input: string | string[]): string | undefined;
4
- //# sourceMappingURL=header-accept-encoding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header-accept-encoding.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-encoding.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAI,MAAM,EAAE,CAGrE;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAWxG"}