@forklaunch/core 0.1.2 → 0.1.5

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 (55) hide show
  1. package/dist/http/httpStatusCodes.d.ts +74 -0
  2. package/dist/http/httpStatusCodes.js +1050 -0
  3. package/dist/http/httpStatusCodes.js.map +1 -0
  4. package/dist/http/index.d.ts +3 -1
  5. package/dist/http/index.js +3 -1
  6. package/dist/http/index.js.map +1 -1
  7. package/dist/http/middleware/index.js.map +1 -0
  8. package/dist/http/middleware/request.middleware.js.map +1 -0
  9. package/dist/http/middleware/response.middleware.js.map +1 -0
  10. package/dist/http/openApiV3Generator.d.ts +4 -0
  11. package/dist/http/openApiV3Generator.js +137 -0
  12. package/dist/http/openApiV3Generator.js.map +1 -0
  13. package/dist/http/types/forklaunch.types.d.ts +13 -0
  14. package/dist/http/types/forklaunch.types.js +3 -0
  15. package/dist/http/types/forklaunch.types.js.map +1 -0
  16. package/dist/http/types/index.d.ts +1 -0
  17. package/dist/http/types/index.js +1 -0
  18. package/dist/http/types/index.js.map +1 -1
  19. package/dist/jest.config.js +10 -0
  20. package/dist/tests/http.middleware.test.js +1 -1
  21. package/dist/tests/http.middleware.test.js.map +1 -1
  22. package/dist/tests/openApiV3Generator.test.d.ts +1 -0
  23. package/dist/tests/openApiV3Generator.test.js +71 -0
  24. package/dist/tests/openApiV3Generator.test.js.map +1 -0
  25. package/package.json +4 -2
  26. package/.prettierignore +0 -2
  27. package/.prettierrc +0 -6
  28. package/dist/http/middlewares/index.js.map +0 -1
  29. package/dist/http/middlewares/request.middleware.js.map +0 -1
  30. package/dist/http/middlewares/response.middleware.js.map +0 -1
  31. package/entityMapper/index.ts +0 -2
  32. package/entityMapper/interfaces/entityMapper.interface.ts +0 -17
  33. package/entityMapper/models/baseEntityMapper.model.ts +0 -110
  34. package/entityMapper/models/requestEntityMapper.model.ts +0 -111
  35. package/entityMapper/models/responseEntityMapper.model.ts +0 -98
  36. package/entityMapper/types/entityMapper.types.ts +0 -12
  37. package/eslint.config.mjs +0 -12
  38. package/http/index.ts +0 -2
  39. package/http/middlewares/index.ts +0 -2
  40. package/http/middlewares/request.middleware.ts +0 -257
  41. package/http/middlewares/response.middleware.ts +0 -63
  42. package/http/types/api.types.ts +0 -83
  43. package/http/types/index.ts +0 -2
  44. package/http/types/primitive.types.ts +0 -76
  45. package/index.ts +0 -6
  46. package/jest.config.ts +0 -10
  47. package/tests/entityMapper.test.ts +0 -219
  48. package/tests/http.middleware.test.ts +0 -99
  49. package/tests/redisTtlCache.test.ts +0 -62
  50. /package/dist/http/{middlewares → middleware}/index.d.ts +0 -0
  51. /package/dist/http/{middlewares → middleware}/index.js +0 -0
  52. /package/dist/http/{middlewares → middleware}/request.middleware.d.ts +0 -0
  53. /package/dist/http/{middlewares → middleware}/request.middleware.js +0 -0
  54. /package/dist/http/{middlewares → middleware}/response.middleware.d.ts +0 -0
  55. /package/dist/http/{middlewares → middleware}/response.middleware.js +0 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Object-map of the HTTP Status Codes. Maps from the status code, to the
3
+ * textual name. The key is the HTTP Status Code number, and the resulting
4
+ * value will be the textual name for that Status Code.
5
+ *
6
+ * The comments for each item are taken from httpstatuses.com and the RFC-7231
7
+ * document.
8
+ *
9
+ * @see https://httpstatuses.com
10
+ * @see https://datatracker.ietf.org/doc/html/rfc7231
11
+ */
12
+ export declare const HTTPStatuses: Readonly<{
13
+ [key: number]: string;
14
+ }>;
15
+ /**
16
+ * Numerical HTTP status code.
17
+ */
18
+ export type StatusCode = keyof typeof HTTPStatuses;
19
+ /**
20
+ * Checks if the given numerical status code is in the known HTTP status codes
21
+ * list.
22
+ *
23
+ * @param code HTTP Status code
24
+ * @returns True if the code is a valid HTTP status code
25
+ */
26
+ export declare const isValidStatusCode: (code: number) => boolean;
27
+ /**
28
+ * Checks if the given status code is in the informational range (1XX).
29
+ *
30
+ * @param code HTTP Status code
31
+ * @returns True if the code is in the "informational" range.
32
+ */
33
+ export declare const isInformational: (code: StatusCode) => boolean;
34
+ /**
35
+ * Checks if the given status code is in the successful range (2XX).
36
+ *
37
+ * @param code HTTP Status code
38
+ * @returns True if the code is in the "success" range.
39
+ */
40
+ export declare const isSuccessful: (code: StatusCode) => boolean;
41
+ /**
42
+ * Checks if the given status code is in the redirection range (3XX).
43
+ *
44
+ * @param code HTTP Status code
45
+ * @returns True if the code is in the "redirection" range.
46
+ */
47
+ export declare const isRedirection: (code: StatusCode) => boolean;
48
+ /**
49
+ * Checks if the given status code is in the client error range (4XX).
50
+ *
51
+ * @param code HTTP Status code
52
+ * @returns True if the code is in the "client error" range.
53
+ */
54
+ export declare const isClientError: (code: StatusCode) => boolean;
55
+ /**
56
+ * Checks if the given status code is in the server error range (5XX).
57
+ *
58
+ * @param code HTTP Status code
59
+ * @returns True if the code is in the "server error" range.
60
+ */
61
+ export declare const isServerError: (code: StatusCode) => boolean;
62
+ /**
63
+ * Searches the list of HTTP statuses for a matching textual name to the one
64
+ * provided. If a match is found, then the numerical status code is returned,
65
+ * otherwise `null`.
66
+ *
67
+ * Internally, the parameter and the status names are normalized by lower-casing
68
+ * the strings and trimming space.
69
+ *
70
+ * @param status HTTP Status textual name
71
+ * @returns The numerical status code, or null if not found
72
+ */
73
+ export declare const getCodeForStatus: (status: string) => null | StatusCode;
74
+ export default HTTPStatuses;