@arkyn/server 3.0.1-beta.99 → 3.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.
Files changed (265) hide show
  1. package/LICENSE.txt +184 -1
  2. package/README.md +277 -224
  3. package/dist/http/api/_deleteRequest.d.ts +17 -0
  4. package/dist/http/api/_deleteRequest.d.ts.map +1 -0
  5. package/dist/http/api/_getRequest.d.ts +16 -0
  6. package/dist/http/api/_getRequest.d.ts.map +1 -0
  7. package/dist/http/api/_logMapperService.d.ts +86 -0
  8. package/dist/http/api/_logMapperService.d.ts.map +1 -0
  9. package/dist/{api/arkynLogRequest.d.ts → http/api/_logRequest.d.ts} +22 -19
  10. package/dist/{api/arkynLogRequest.d.ts.map → http/api/_logRequest.d.ts.map} +1 -1
  11. package/dist/http/api/_makeRequest.d.ts +61 -0
  12. package/dist/http/api/_makeRequest.d.ts.map +1 -0
  13. package/dist/http/api/_patchRequest.d.ts +17 -0
  14. package/dist/http/api/_patchRequest.d.ts.map +1 -0
  15. package/dist/http/api/_postRequest.d.ts +17 -0
  16. package/dist/http/api/_postRequest.d.ts.map +1 -0
  17. package/dist/http/api/_putRequest.d.ts +17 -0
  18. package/dist/http/api/_putRequest.d.ts.map +1 -0
  19. package/dist/http/badResponses/_badResponse.d.ts +21 -7
  20. package/dist/http/badResponses/_badResponse.d.ts.map +1 -1
  21. package/dist/http/badResponses/badGateway.d.ts +12 -23
  22. package/dist/http/badResponses/badGateway.d.ts.map +1 -1
  23. package/dist/http/badResponses/badRequest.d.ts +10 -23
  24. package/dist/http/badResponses/badRequest.d.ts.map +1 -1
  25. package/dist/http/badResponses/conflict.d.ts +10 -23
  26. package/dist/http/badResponses/conflict.d.ts.map +1 -1
  27. package/dist/http/badResponses/forbidden.d.ts +10 -23
  28. package/dist/http/badResponses/forbidden.d.ts.map +1 -1
  29. package/dist/http/badResponses/notFound.d.ts +10 -23
  30. package/dist/http/badResponses/notFound.d.ts.map +1 -1
  31. package/dist/http/badResponses/notImplemented.d.ts +10 -23
  32. package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
  33. package/dist/http/badResponses/serverError.d.ts +10 -23
  34. package/dist/http/badResponses/serverError.d.ts.map +1 -1
  35. package/dist/http/badResponses/unauthorized.d.ts +10 -23
  36. package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
  37. package/dist/http/badResponses/unprocessableEntity.d.ts +23 -33
  38. package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
  39. package/dist/http/successResponses/_successResponse.d.ts +21 -7
  40. package/dist/http/successResponses/_successResponse.d.ts.map +1 -1
  41. package/dist/http/successResponses/created.d.ts +11 -29
  42. package/dist/http/successResponses/created.d.ts.map +1 -1
  43. package/dist/http/successResponses/found.d.ts +11 -32
  44. package/dist/http/successResponses/found.d.ts.map +1 -1
  45. package/dist/http/successResponses/noContent.d.ts +10 -16
  46. package/dist/http/successResponses/noContent.d.ts.map +1 -1
  47. package/dist/http/successResponses/success.d.ts +11 -29
  48. package/dist/http/successResponses/success.d.ts.map +1 -1
  49. package/dist/http/successResponses/updated.d.ts +12 -29
  50. package/dist/http/successResponses/updated.d.ts.map +1 -1
  51. package/dist/index.d.ts +9 -10
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1069 -38
  54. package/dist/index.js.map +1 -0
  55. package/dist/modules/http/api/_deleteRequest.js +15 -0
  56. package/dist/modules/http/api/_deleteRequest.js.map +1 -0
  57. package/dist/modules/http/api/_getRequest.js +14 -0
  58. package/dist/modules/http/api/_getRequest.js.map +1 -0
  59. package/dist/modules/http/api/_logMapperService.js +33 -0
  60. package/dist/modules/http/api/_logMapperService.js.map +1 -0
  61. package/dist/modules/http/api/_logRequest.js +58 -0
  62. package/dist/modules/http/api/_logRequest.js.map +1 -0
  63. package/dist/modules/http/api/_makeRequest.js +72 -0
  64. package/dist/modules/http/api/_makeRequest.js.map +1 -0
  65. package/dist/modules/http/api/_patchRequest.js +15 -0
  66. package/dist/modules/http/api/_patchRequest.js.map +1 -0
  67. package/dist/modules/http/api/_postRequest.js +15 -0
  68. package/dist/modules/http/api/_postRequest.js.map +1 -0
  69. package/dist/modules/http/api/_putRequest.js +15 -0
  70. package/dist/modules/http/api/_putRequest.js.map +1 -0
  71. package/dist/modules/http/badResponses/_badResponse.js +65 -0
  72. package/dist/modules/http/badResponses/_badResponse.js.map +1 -0
  73. package/dist/modules/http/badResponses/badGateway.js +26 -0
  74. package/dist/modules/http/badResponses/badGateway.js.map +1 -0
  75. package/dist/modules/http/badResponses/badRequest.js +26 -0
  76. package/dist/modules/http/badResponses/badRequest.js.map +1 -0
  77. package/dist/modules/http/badResponses/conflict.js +26 -0
  78. package/dist/modules/http/badResponses/conflict.js.map +1 -0
  79. package/dist/modules/http/badResponses/forbidden.js +26 -0
  80. package/dist/modules/http/badResponses/forbidden.js.map +1 -0
  81. package/dist/modules/http/badResponses/notFound.js +26 -0
  82. package/dist/modules/http/badResponses/notFound.js.map +1 -0
  83. package/dist/modules/http/badResponses/notImplemented.js +26 -0
  84. package/dist/modules/http/badResponses/notImplemented.js.map +1 -0
  85. package/dist/modules/http/badResponses/serverError.js +26 -0
  86. package/dist/modules/http/badResponses/serverError.js.map +1 -0
  87. package/dist/modules/http/badResponses/unauthorized.js +26 -0
  88. package/dist/modules/http/badResponses/unauthorized.js.map +1 -0
  89. package/dist/modules/http/badResponses/unprocessableEntity.js +30 -0
  90. package/dist/modules/http/badResponses/unprocessableEntity.js.map +1 -0
  91. package/dist/modules/http/successResponses/_successResponse.js +64 -0
  92. package/dist/modules/http/successResponses/_successResponse.js.map +1 -0
  93. package/dist/modules/http/successResponses/created.js +26 -0
  94. package/dist/modules/http/successResponses/created.js.map +1 -0
  95. package/dist/modules/http/successResponses/found.js +26 -0
  96. package/dist/modules/http/successResponses/found.js.map +1 -0
  97. package/dist/modules/http/successResponses/noContent.js +19 -0
  98. package/dist/modules/http/successResponses/noContent.js.map +1 -0
  99. package/dist/modules/http/successResponses/success.js +26 -0
  100. package/dist/modules/http/successResponses/success.js.map +1 -0
  101. package/dist/modules/http/successResponses/updated.js +26 -0
  102. package/dist/modules/http/successResponses/updated.js.map +1 -0
  103. package/dist/modules/services/apiService.js +111 -0
  104. package/dist/modules/services/apiService.js.map +1 -0
  105. package/dist/modules/services/debugService.js +38 -0
  106. package/dist/modules/services/debugService.js.map +1 -0
  107. package/dist/modules/services/logService.js +23 -0
  108. package/dist/modules/services/logService.js.map +1 -0
  109. package/dist/modules/utilities/decodeRequestBody.js +22 -0
  110. package/dist/modules/utilities/decodeRequestBody.js.map +1 -0
  111. package/dist/modules/utilities/decodeRequestErrorMessage.js +8 -0
  112. package/dist/modules/utilities/decodeRequestErrorMessage.js.map +1 -0
  113. package/dist/modules/utilities/errorHandler.js +41 -0
  114. package/dist/modules/utilities/errorHandler.js.map +1 -0
  115. package/dist/modules/utilities/flushDebugLogs.js +18 -0
  116. package/dist/modules/utilities/flushDebugLogs.js.map +1 -0
  117. package/dist/modules/utilities/formAsyncParse.js +16 -0
  118. package/dist/modules/utilities/formAsyncParse.js.map +1 -0
  119. package/dist/modules/utilities/formParse.js +16 -0
  120. package/dist/modules/utilities/formParse.js.map +1 -0
  121. package/dist/modules/utilities/getScopedParams.js +11 -0
  122. package/dist/modules/utilities/getScopedParams.js.map +1 -0
  123. package/dist/modules/utilities/schemaValidator.js +57 -0
  124. package/dist/modules/utilities/schemaValidator.js.map +1 -0
  125. package/dist/modules/validations/validateCep.js +11 -0
  126. package/dist/modules/validations/validateCep.js.map +1 -0
  127. package/dist/modules/validations/validateCnpj.js +56 -0
  128. package/dist/modules/validations/validateCnpj.js.map +1 -0
  129. package/dist/modules/validations/validateCpf.js +29 -0
  130. package/dist/modules/validations/validateCpf.js.map +1 -0
  131. package/dist/modules/validations/validateDate.js +28 -0
  132. package/dist/modules/validations/validateDate.js.map +1 -0
  133. package/dist/modules/validations/validateEmail.js +56 -0
  134. package/dist/modules/validations/validateEmail.js.map +1 -0
  135. package/dist/modules/validations/validatePassword.js +14 -0
  136. package/dist/modules/validations/validatePassword.js.map +1 -0
  137. package/dist/modules/validations/validatePhone.js +12 -0
  138. package/dist/modules/validations/validatePhone.js.map +1 -0
  139. package/dist/modules/validations/validateRg.js +10 -0
  140. package/dist/modules/validations/validateRg.js.map +1 -0
  141. package/dist/services/apiService.d.ts +25 -26
  142. package/dist/services/apiService.d.ts.map +1 -1
  143. package/dist/services/debugService.d.ts +15 -32
  144. package/dist/services/debugService.d.ts.map +1 -1
  145. package/dist/services/logService.d.ts +33 -0
  146. package/dist/services/logService.d.ts.map +1 -0
  147. package/dist/utilities/decodeRequestBody.d.ts +18 -0
  148. package/dist/utilities/decodeRequestBody.d.ts.map +1 -0
  149. package/dist/utilities/decodeRequestErrorMessage.d.ts +19 -0
  150. package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -0
  151. package/dist/utilities/errorHandler.d.ts +25 -0
  152. package/dist/utilities/errorHandler.d.ts.map +1 -0
  153. package/dist/utilities/flushDebugLogs.d.ts +24 -0
  154. package/dist/utilities/flushDebugLogs.d.ts.map +1 -0
  155. package/dist/utilities/formAsyncParse.d.ts +38 -0
  156. package/dist/utilities/formAsyncParse.d.ts.map +1 -0
  157. package/dist/utilities/formParse.d.ts +38 -0
  158. package/dist/utilities/formParse.d.ts.map +1 -0
  159. package/dist/utilities/getScopedParams.d.ts +19 -0
  160. package/dist/utilities/getScopedParams.d.ts.map +1 -0
  161. package/dist/utilities/schemaValidator.d.ts +75 -0
  162. package/dist/utilities/schemaValidator.d.ts.map +1 -0
  163. package/dist/validations/validateCep.d.ts +6 -11
  164. package/dist/validations/validateCep.d.ts.map +1 -1
  165. package/dist/validations/validateCnpj.d.ts +2 -3
  166. package/dist/validations/validateCnpj.d.ts.map +1 -1
  167. package/dist/validations/validateCpf.d.ts +4 -12
  168. package/dist/validations/validateCpf.d.ts.map +1 -1
  169. package/dist/validations/validateDate.d.ts +13 -24
  170. package/dist/validations/validateDate.d.ts.map +1 -1
  171. package/dist/validations/validateEmail.d.ts +3 -4
  172. package/dist/validations/validateEmail.d.ts.map +1 -1
  173. package/dist/validations/validatePassword.d.ts +3 -4
  174. package/dist/validations/validatePassword.d.ts.map +1 -1
  175. package/dist/validations/validatePhone.d.ts +7 -20
  176. package/dist/validations/validatePhone.d.ts.map +1 -1
  177. package/dist/validations/validateRg.d.ts +1 -2
  178. package/dist/validations/validateRg.d.ts.map +1 -1
  179. package/package.json +317 -15
  180. package/dist/api/arkynLogRequest.js +0 -88
  181. package/dist/api/deleteRequest.d.ts +0 -13
  182. package/dist/api/deleteRequest.d.ts.map +0 -1
  183. package/dist/api/deleteRequest.js +0 -14
  184. package/dist/api/getRequest.d.ts +0 -12
  185. package/dist/api/getRequest.d.ts.map +0 -1
  186. package/dist/api/getRequest.js +0 -13
  187. package/dist/api/makeRequest.d.ts +0 -38
  188. package/dist/api/makeRequest.d.ts.map +0 -1
  189. package/dist/api/makeRequest.js +0 -107
  190. package/dist/api/patchRequest.d.ts +0 -13
  191. package/dist/api/patchRequest.d.ts.map +0 -1
  192. package/dist/api/patchRequest.js +0 -14
  193. package/dist/api/postRequest.d.ts +0 -13
  194. package/dist/api/postRequest.d.ts.map +0 -1
  195. package/dist/api/postRequest.js +0 -14
  196. package/dist/api/putRequest.d.ts +0 -13
  197. package/dist/api/putRequest.d.ts.map +0 -1
  198. package/dist/api/putRequest.js +0 -14
  199. package/dist/bundle.js +0 -1507
  200. package/dist/bundle.umd.cjs +0 -10
  201. package/dist/http/badResponses/_badResponse.js +0 -20
  202. package/dist/http/badResponses/badGateway.js +0 -58
  203. package/dist/http/badResponses/badRequest.js +0 -58
  204. package/dist/http/badResponses/conflict.js +0 -58
  205. package/dist/http/badResponses/forbidden.js +0 -58
  206. package/dist/http/badResponses/notFound.js +0 -58
  207. package/dist/http/badResponses/notImplemented.js +0 -58
  208. package/dist/http/badResponses/serverError.js +0 -58
  209. package/dist/http/badResponses/unauthorized.js +0 -58
  210. package/dist/http/badResponses/unprocessableEntity.js +0 -65
  211. package/dist/http/successResponses/_successResponse.js +0 -37
  212. package/dist/http/successResponses/created.js +0 -57
  213. package/dist/http/successResponses/found.js +0 -60
  214. package/dist/http/successResponses/noContent.js +0 -38
  215. package/dist/http/successResponses/success.js +0 -57
  216. package/dist/http/successResponses/updated.js +0 -57
  217. package/dist/mapper/arkynLogRequestMapper.d.ts +0 -30
  218. package/dist/mapper/arkynLogRequestMapper.d.ts.map +0 -1
  219. package/dist/mapper/arkynLogRequestMapper.js +0 -44
  220. package/dist/services/apiService.js +0 -133
  221. package/dist/services/arkynLogService.d.ts +0 -44
  222. package/dist/services/arkynLogService.d.ts.map +0 -1
  223. package/dist/services/arkynLogService.js +0 -46
  224. package/dist/services/debugService.js +0 -57
  225. package/dist/services/decodeErrorMessageFromRequest.d.ts +0 -17
  226. package/dist/services/decodeErrorMessageFromRequest.d.ts.map +0 -1
  227. package/dist/services/decodeErrorMessageFromRequest.js +0 -30
  228. package/dist/services/decodeRequestBody.d.ts +0 -17
  229. package/dist/services/decodeRequestBody.d.ts.map +0 -1
  230. package/dist/services/decodeRequestBody.js +0 -38
  231. package/dist/services/errorHandler.d.ts +0 -44
  232. package/dist/services/errorHandler.d.ts.map +0 -1
  233. package/dist/services/errorHandler.js +0 -93
  234. package/dist/services/flushDebugLogs.d.ts +0 -8
  235. package/dist/services/flushDebugLogs.d.ts.map +0 -1
  236. package/dist/services/flushDebugLogs.js +0 -20
  237. package/dist/services/formAsyncParse.d.ts +0 -59
  238. package/dist/services/formAsyncParse.d.ts.map +0 -1
  239. package/dist/services/formAsyncParse.js +0 -58
  240. package/dist/services/formParse.d.ts +0 -59
  241. package/dist/services/formParse.d.ts.map +0 -1
  242. package/dist/services/formParse.js +0 -58
  243. package/dist/services/getCaller.d.ts +0 -17
  244. package/dist/services/getCaller.d.ts.map +0 -1
  245. package/dist/services/getCaller.js +0 -60
  246. package/dist/services/getScopedParams.d.ts +0 -28
  247. package/dist/services/getScopedParams.d.ts.map +0 -1
  248. package/dist/services/getScopedParams.js +0 -34
  249. package/dist/services/measureRouteExecution.d.ts +0 -3
  250. package/dist/services/measureRouteExecution.d.ts.map +0 -1
  251. package/dist/services/measureRouteExecution.js +0 -24
  252. package/dist/services/schemaValidator.d.ts +0 -158
  253. package/dist/services/schemaValidator.d.ts.map +0 -1
  254. package/dist/services/schemaValidator.js +0 -207
  255. package/dist/types/ApiResponseDTO.d.ts +0 -17
  256. package/dist/types/ApiResponseDTO.d.ts.map +0 -1
  257. package/dist/types/ApiResponseDTO.js +0 -1
  258. package/dist/validations/validateCep.js +0 -33
  259. package/dist/validations/validateCnpj.js +0 -52
  260. package/dist/validations/validateCpf.js +0 -54
  261. package/dist/validations/validateDate.js +0 -73
  262. package/dist/validations/validateEmail.js +0 -123
  263. package/dist/validations/validatePassword.js +0 -34
  264. package/dist/validations/validatePhone.js +0 -44
  265. package/dist/validations/validateRg.js +0 -31
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@arkyn/server",
3
- "version": "3.0.1-beta.99",
3
+ "version": "3.0.3",
4
4
  "author": "Arkyn | Lucas Gonçalves",
5
- "main": "./dist/bundle.js",
6
- "module": "./dist/bundle.js",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
7
  "type": "module",
8
8
  "types": "./dist/index.d.ts",
9
9
  "license": "Apache-2.0",
@@ -19,27 +19,329 @@
19
19
  "typescript",
20
20
  "zod"
21
21
  ],
22
- "homepage": "https://docs.arkyn.dev/en/server/introduction",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "engines": {
26
+ "node": ">=18.0.0",
27
+ "bun": ">=1.0.0"
28
+ },
29
+ "homepage": "https://docs.arkyn.dev/docs/server/introduction",
23
30
  "repository": {
24
31
  "type": "git",
25
- "url": "git+https://github.com/Lucas-Eduardo-Goncalves/arkyn.git",
32
+ "url": "git+https://github.com/Lucas-Eduardo-Goncalves/arkyn-library.git",
26
33
  "directory": "packages/server"
27
34
  },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE.txt"
39
+ ],
40
+ "sideEffects": false,
41
+ "dependencies": {
42
+ "@arkyn/shared": ">=3.0.2",
43
+ "@arkyn/templates": ">=3.0.2"
44
+ },
28
45
  "scripts": {
29
- "clean": "rm -rf dist",
30
- "build": "bunx vite build && tsc",
31
- "test": "vitest --config vitest.config.ts",
46
+ "audit": "bun audit --workspace packages/server",
47
+ "build": "bunx vite build && bunx tsc --project tsconfig.json --emitDeclarationOnly && bun ./generate-exports.ts && rm -f dist/modules/index.js dist/modules/style.css",
48
+ "prebuild": "rm -rf dist",
49
+ "publish:beta": "npm publish --tag beta",
50
+ "publish:latest": "npm publish --tag latest",
51
+ "release:beta": "bun ./generate-version.ts beta",
52
+ "release:patch": "bun ./generate-version.ts patch",
53
+ "release:minor": "bun ./generate-version.ts minor",
54
+ "release:major": "bun ./generate-version.ts major",
55
+ "test": "bunx vitest --config vitest.config.ts --run",
56
+ "test:watch": "bunx vitest --config vitest.config.ts --watch",
32
57
  "typecheck": "bunx tsc --project tsconfig.json --noEmit"
33
58
  },
34
59
  "peerDependencies": {
35
- "@arkyn/shared": "*",
36
- "@arkyn/templates": "*",
37
- "zod": ">=4.0.17"
60
+ "libphonenumber-js": ">=1.13.7",
61
+ "zod": ">=4.4.3"
38
62
  },
39
63
  "devDependencies": {
40
- "bun-types": "latest",
41
- "vitest": "^3.2.4",
42
- "typescript": "^5.9.2",
43
- "vite": "^5.4.19"
64
+ "@types/bun": "catalog:",
65
+ "@types/node": "catalog:",
66
+ "libphonenumber-js": "catalog:",
67
+ "typescript": "catalog:",
68
+ "vite": "catalog:",
69
+ "vitest": "catalog:",
70
+ "zod": "catalog:"
71
+ },
72
+ "exports": {
73
+ ".": {
74
+ "import": "./dist/index.js",
75
+ "types": "./dist/index.d.ts",
76
+ "default": "./dist/index.js"
77
+ },
78
+ "./apiService": {
79
+ "import": "./dist/modules/services/apiService.js",
80
+ "types": "./dist/services/apiService.d.ts",
81
+ "default": "./dist/modules/services/apiService.js"
82
+ },
83
+ "./badGateway": {
84
+ "import": "./dist/modules/http/badResponses/badGateway.js",
85
+ "types": "./dist/http/badResponses/badGateway.d.ts",
86
+ "default": "./dist/modules/http/badResponses/badGateway.js"
87
+ },
88
+ "./badRequest": {
89
+ "import": "./dist/modules/http/badResponses/badRequest.js",
90
+ "types": "./dist/http/badResponses/badRequest.d.ts",
91
+ "default": "./dist/modules/http/badResponses/badRequest.js"
92
+ },
93
+ "./conflict": {
94
+ "import": "./dist/modules/http/badResponses/conflict.js",
95
+ "types": "./dist/http/badResponses/conflict.d.ts",
96
+ "default": "./dist/modules/http/badResponses/conflict.js"
97
+ },
98
+ "./created": {
99
+ "import": "./dist/modules/http/successResponses/created.js",
100
+ "types": "./dist/http/successResponses/created.d.ts",
101
+ "default": "./dist/modules/http/successResponses/created.js"
102
+ },
103
+ "./debugService": {
104
+ "import": "./dist/modules/services/debugService.js",
105
+ "types": "./dist/services/debugService.d.ts",
106
+ "default": "./dist/modules/services/debugService.js"
107
+ },
108
+ "./decodeRequestBody": {
109
+ "import": "./dist/modules/utilities/decodeRequestBody.js",
110
+ "types": "./dist/utilities/decodeRequestBody.d.ts",
111
+ "default": "./dist/modules/utilities/decodeRequestBody.js"
112
+ },
113
+ "./decodeRequestErrorMessage": {
114
+ "import": "./dist/modules/utilities/decodeRequestErrorMessage.js",
115
+ "types": "./dist/utilities/decodeRequestErrorMessage.d.ts",
116
+ "default": "./dist/modules/utilities/decodeRequestErrorMessage.js"
117
+ },
118
+ "./errorHandler": {
119
+ "import": "./dist/modules/utilities/errorHandler.js",
120
+ "types": "./dist/utilities/errorHandler.d.ts",
121
+ "default": "./dist/modules/utilities/errorHandler.js"
122
+ },
123
+ "./flushDebugLogs": {
124
+ "import": "./dist/modules/utilities/flushDebugLogs.js",
125
+ "types": "./dist/utilities/flushDebugLogs.d.ts",
126
+ "default": "./dist/modules/utilities/flushDebugLogs.js"
127
+ },
128
+ "./forbidden": {
129
+ "import": "./dist/modules/http/badResponses/forbidden.js",
130
+ "types": "./dist/http/badResponses/forbidden.d.ts",
131
+ "default": "./dist/modules/http/badResponses/forbidden.js"
132
+ },
133
+ "./formAsyncParse": {
134
+ "import": "./dist/modules/utilities/formAsyncParse.js",
135
+ "types": "./dist/utilities/formAsyncParse.d.ts",
136
+ "default": "./dist/modules/utilities/formAsyncParse.js"
137
+ },
138
+ "./formParse": {
139
+ "import": "./dist/modules/utilities/formParse.js",
140
+ "types": "./dist/utilities/formParse.d.ts",
141
+ "default": "./dist/modules/utilities/formParse.js"
142
+ },
143
+ "./found": {
144
+ "import": "./dist/modules/http/successResponses/found.js",
145
+ "types": "./dist/http/successResponses/found.d.ts",
146
+ "default": "./dist/modules/http/successResponses/found.js"
147
+ },
148
+ "./getScopedParams": {
149
+ "import": "./dist/modules/utilities/getScopedParams.js",
150
+ "types": "./dist/utilities/getScopedParams.d.ts",
151
+ "default": "./dist/modules/utilities/getScopedParams.js"
152
+ },
153
+ "./logService": {
154
+ "import": "./dist/modules/services/logService.js",
155
+ "types": "./dist/services/logService.d.ts",
156
+ "default": "./dist/modules/services/logService.js"
157
+ },
158
+ "./noContent": {
159
+ "import": "./dist/modules/http/successResponses/noContent.js",
160
+ "types": "./dist/http/successResponses/noContent.d.ts",
161
+ "default": "./dist/modules/http/successResponses/noContent.js"
162
+ },
163
+ "./notFound": {
164
+ "import": "./dist/modules/http/badResponses/notFound.js",
165
+ "types": "./dist/http/badResponses/notFound.d.ts",
166
+ "default": "./dist/modules/http/badResponses/notFound.js"
167
+ },
168
+ "./notImplemented": {
169
+ "import": "./dist/modules/http/badResponses/notImplemented.js",
170
+ "types": "./dist/http/badResponses/notImplemented.d.ts",
171
+ "default": "./dist/modules/http/badResponses/notImplemented.js"
172
+ },
173
+ "./schemaValidator": {
174
+ "import": "./dist/modules/utilities/schemaValidator.js",
175
+ "types": "./dist/utilities/schemaValidator.d.ts",
176
+ "default": "./dist/modules/utilities/schemaValidator.js"
177
+ },
178
+ "./serverError": {
179
+ "import": "./dist/modules/http/badResponses/serverError.js",
180
+ "types": "./dist/http/badResponses/serverError.d.ts",
181
+ "default": "./dist/modules/http/badResponses/serverError.js"
182
+ },
183
+ "./success": {
184
+ "import": "./dist/modules/http/successResponses/success.js",
185
+ "types": "./dist/http/successResponses/success.d.ts",
186
+ "default": "./dist/modules/http/successResponses/success.js"
187
+ },
188
+ "./unauthorized": {
189
+ "import": "./dist/modules/http/badResponses/unauthorized.js",
190
+ "types": "./dist/http/badResponses/unauthorized.d.ts",
191
+ "default": "./dist/modules/http/badResponses/unauthorized.js"
192
+ },
193
+ "./unprocessableEntity": {
194
+ "import": "./dist/modules/http/badResponses/unprocessableEntity.js",
195
+ "types": "./dist/http/badResponses/unprocessableEntity.d.ts",
196
+ "default": "./dist/modules/http/badResponses/unprocessableEntity.js"
197
+ },
198
+ "./updated": {
199
+ "import": "./dist/modules/http/successResponses/updated.js",
200
+ "types": "./dist/http/successResponses/updated.d.ts",
201
+ "default": "./dist/modules/http/successResponses/updated.js"
202
+ },
203
+ "./validateCep": {
204
+ "import": "./dist/modules/validations/validateCep.js",
205
+ "types": "./dist/validations/validateCep.d.ts",
206
+ "default": "./dist/modules/validations/validateCep.js"
207
+ },
208
+ "./validateCnpj": {
209
+ "import": "./dist/modules/validations/validateCnpj.js",
210
+ "types": "./dist/validations/validateCnpj.d.ts",
211
+ "default": "./dist/modules/validations/validateCnpj.js"
212
+ },
213
+ "./validateCpf": {
214
+ "import": "./dist/modules/validations/validateCpf.js",
215
+ "types": "./dist/validations/validateCpf.d.ts",
216
+ "default": "./dist/modules/validations/validateCpf.js"
217
+ },
218
+ "./validateDate": {
219
+ "import": "./dist/modules/validations/validateDate.js",
220
+ "types": "./dist/validations/validateDate.d.ts",
221
+ "default": "./dist/modules/validations/validateDate.js"
222
+ },
223
+ "./validateEmail": {
224
+ "import": "./dist/modules/validations/validateEmail.js",
225
+ "types": "./dist/validations/validateEmail.d.ts",
226
+ "default": "./dist/modules/validations/validateEmail.js"
227
+ },
228
+ "./validatePassword": {
229
+ "import": "./dist/modules/validations/validatePassword.js",
230
+ "types": "./dist/validations/validatePassword.d.ts",
231
+ "default": "./dist/modules/validations/validatePassword.js"
232
+ },
233
+ "./validatePhone": {
234
+ "import": "./dist/modules/validations/validatePhone.js",
235
+ "types": "./dist/validations/validatePhone.d.ts",
236
+ "default": "./dist/modules/validations/validatePhone.js"
237
+ },
238
+ "./validateRg": {
239
+ "import": "./dist/modules/validations/validateRg.js",
240
+ "types": "./dist/validations/validateRg.d.ts",
241
+ "default": "./dist/modules/validations/validateRg.js"
242
+ }
243
+ },
244
+ "typesVersions": {
245
+ "*": {
246
+ "apiService": [
247
+ "./dist/services/apiService.d.ts"
248
+ ],
249
+ "badGateway": [
250
+ "./dist/http/badResponses/badGateway.d.ts"
251
+ ],
252
+ "badRequest": [
253
+ "./dist/http/badResponses/badRequest.d.ts"
254
+ ],
255
+ "conflict": [
256
+ "./dist/http/badResponses/conflict.d.ts"
257
+ ],
258
+ "created": [
259
+ "./dist/http/successResponses/created.d.ts"
260
+ ],
261
+ "debugService": [
262
+ "./dist/services/debugService.d.ts"
263
+ ],
264
+ "decodeRequestBody": [
265
+ "./dist/utilities/decodeRequestBody.d.ts"
266
+ ],
267
+ "decodeRequestErrorMessage": [
268
+ "./dist/utilities/decodeRequestErrorMessage.d.ts"
269
+ ],
270
+ "errorHandler": [
271
+ "./dist/utilities/errorHandler.d.ts"
272
+ ],
273
+ "flushDebugLogs": [
274
+ "./dist/utilities/flushDebugLogs.d.ts"
275
+ ],
276
+ "forbidden": [
277
+ "./dist/http/badResponses/forbidden.d.ts"
278
+ ],
279
+ "formAsyncParse": [
280
+ "./dist/utilities/formAsyncParse.d.ts"
281
+ ],
282
+ "formParse": [
283
+ "./dist/utilities/formParse.d.ts"
284
+ ],
285
+ "found": [
286
+ "./dist/http/successResponses/found.d.ts"
287
+ ],
288
+ "getScopedParams": [
289
+ "./dist/utilities/getScopedParams.d.ts"
290
+ ],
291
+ "logService": [
292
+ "./dist/services/logService.d.ts"
293
+ ],
294
+ "noContent": [
295
+ "./dist/http/successResponses/noContent.d.ts"
296
+ ],
297
+ "notFound": [
298
+ "./dist/http/badResponses/notFound.d.ts"
299
+ ],
300
+ "notImplemented": [
301
+ "./dist/http/badResponses/notImplemented.d.ts"
302
+ ],
303
+ "schemaValidator": [
304
+ "./dist/utilities/schemaValidator.d.ts"
305
+ ],
306
+ "serverError": [
307
+ "./dist/http/badResponses/serverError.d.ts"
308
+ ],
309
+ "success": [
310
+ "./dist/http/successResponses/success.d.ts"
311
+ ],
312
+ "unauthorized": [
313
+ "./dist/http/badResponses/unauthorized.d.ts"
314
+ ],
315
+ "unprocessableEntity": [
316
+ "./dist/http/badResponses/unprocessableEntity.d.ts"
317
+ ],
318
+ "updated": [
319
+ "./dist/http/successResponses/updated.d.ts"
320
+ ],
321
+ "validateCep": [
322
+ "./dist/validations/validateCep.d.ts"
323
+ ],
324
+ "validateCnpj": [
325
+ "./dist/validations/validateCnpj.d.ts"
326
+ ],
327
+ "validateCpf": [
328
+ "./dist/validations/validateCpf.d.ts"
329
+ ],
330
+ "validateDate": [
331
+ "./dist/validations/validateDate.d.ts"
332
+ ],
333
+ "validateEmail": [
334
+ "./dist/validations/validateEmail.d.ts"
335
+ ],
336
+ "validatePassword": [
337
+ "./dist/validations/validatePassword.d.ts"
338
+ ],
339
+ "validatePhone": [
340
+ "./dist/validations/validatePhone.d.ts"
341
+ ],
342
+ "validateRg": [
343
+ "./dist/validations/validateRg.d.ts"
344
+ ]
345
+ }
44
346
  }
45
347
  }
@@ -1,88 +0,0 @@
1
- import { ArkynLogService } from "../services/arkynLogService";
2
- import { flushDebugLogs } from "../services/flushDebugLogs";
3
- /**
4
- * Sends a request to the inbox flow API with the provided configuration.
5
- *
6
- * @param config - The configuration object for the request.
7
- * @param config.rawUrl - The raw URL of the request.
8
- * @param config.status - The HTTP status code associated with the request.
9
- * @param config.method - The HTTP method used for the request. Can be "POST", "GET", "PUT", "DELETE", or "PATCH".
10
- * @param config.token - The authentication token for the request.
11
- * @param config.elapsedTime - The elapsed time for the request in milliseconds.
12
- * @param config.requestHeaders - The headers sent with the request.
13
- * @param config.requestBody - The body of the request, if applicable.
14
- * @param config.queryParams - The query parameters for the request.
15
- * @param config.responseHeaders - The headers received in the response.
16
- * @param config.responseBody - The body of the response received.
17
- *
18
- * @remarks
19
- * - This function retrieves the inbox flow configuration using `InboxFlowService.getInboxConfig()`.
20
- * - If the configuration is not available, the function will return early without performing any action.
21
- * - In a development environment (`NODE_ENV === "development"`), the function will also return early.
22
- * - The request is sent as a POST request to the inbox API URL with the provided configuration details.
23
- * - If an error occurs during the request, it will be logged using the `httpDebug` service.
24
- *
25
- * @example
26
- * ```typescript
27
- * const config = {
28
- * rawUrl: "https://example.com/api/data",
29
- * status: 200,
30
- * method: "GET",
31
- * token: "auth-token-123",
32
- * elapsedTime: "150ms",
33
- * requestHeaders: { "Accept": "application/json", "Authorization": "Bearer token123" },
34
- * requestBody: {},
35
- * queryParams: { "page": "1", "limit": "10" },
36
- * responseHeaders: { "Content-Type": "application/json" },
37
- * responseBody: { "data": "example response" }
38
- * };
39
- *
40
- * await arkynLogRequest(config);
41
- * ```
42
- */
43
- async function arkynLogRequest(config) {
44
- const arkynService = ArkynLogService.getArkynConfig();
45
- if (!arkynService)
46
- return;
47
- const { userToken, apiUrl, trafficSourceId } = arkynService;
48
- const { elapsedTime, method, queryParams, requestBody, requestHeaders, responseBody, responseHeaders, status, token, rawUrl, } = config;
49
- if (process.env.NODE_ENV === "development")
50
- return;
51
- try {
52
- const url = new URL(rawUrl);
53
- let protocol = "https";
54
- if (url.protocol === "http:")
55
- protocol = "http";
56
- const body = JSON.stringify({
57
- domainUrl: url.protocol + "//" + url.host,
58
- pathnameUrl: url.pathname,
59
- trafficSourceId: trafficSourceId,
60
- status,
61
- protocol,
62
- method: method.toLowerCase(),
63
- trafficUserId: null,
64
- elapsedTime,
65
- requestHeaders: JSON.stringify(requestHeaders),
66
- requestBody: JSON.stringify(requestBody),
67
- queryParams: JSON.stringify(queryParams),
68
- responseHeaders: JSON.stringify(responseHeaders),
69
- responseBody: JSON.stringify(responseBody),
70
- });
71
- await fetch(apiUrl, {
72
- method: "POST",
73
- body,
74
- headers: {
75
- "Content-Type": "application/json",
76
- Authorization: `Bearer ${userToken}`,
77
- },
78
- });
79
- }
80
- catch (err) {
81
- flushDebugLogs({
82
- debugs: [`Error sending request: ${err}`],
83
- name: "ARKYN_LOG_ERROR",
84
- scheme: "red",
85
- });
86
- }
87
- }
88
- export { arkynLogRequest };
@@ -1,13 +0,0 @@
1
- import type { ApiResponseDTO } from "../types/ApiResponseDTO";
2
- /**
3
- * Sends a DELETE request to the specified URL with optional headers and body.
4
- *
5
- * @template T - The expected type of the response data.
6
- * @param {string} url - The URL to send the DELETE request to.
7
- * @param {HeadersInit} [headers={}] - Optional headers to include in the request.
8
- * @param {any} [body] - Optional body to include in the request.
9
- * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
10
- */
11
- declare function deleteRequest<T = any>(url: string, headers?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
12
- export { deleteRequest };
13
- //# sourceMappingURL=deleteRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteRequest.d.ts","sourceRoot":"","sources":["../../src/api/deleteRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AAEH,iBAAe,aAAa,CAAC,CAAC,GAAG,GAAG,EAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,14 +0,0 @@
1
- import { makeRequest } from "./makeRequest";
2
- /**
3
- * Sends a DELETE request to the specified URL with optional headers and body.
4
- *
5
- * @template T - The expected type of the response data.
6
- * @param {string} url - The URL to send the DELETE request to.
7
- * @param {HeadersInit} [headers={}] - Optional headers to include in the request.
8
- * @param {any} [body] - Optional body to include in the request.
9
- * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
10
- */
11
- async function deleteRequest(url, headers = {}, body) {
12
- return makeRequest("DELETE", url, headers, body);
13
- }
14
- export { deleteRequest };
@@ -1,12 +0,0 @@
1
- import type { ApiResponseDTO } from "../types/ApiResponseDTO";
2
- /**
3
- * Sends a GET request to the specified URL with optional headers.
4
- *
5
- * @template T - The expected type of the response data.
6
- * @param {string} url - The URL to send the GET request to.
7
- * @param {HeadersInit} [headers={}] - Optional headers to include in the request.
8
- * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
9
- */
10
- declare function getRequest<T = any>(url: string, headers?: HeadersInit): Promise<ApiResponseDTO<T>>;
11
- export { getRequest };
12
- //# sourceMappingURL=getRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRequest.d.ts","sourceRoot":"","sources":["../../src/api/getRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;GAOG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,13 +0,0 @@
1
- import { makeRequest } from "./makeRequest";
2
- /**
3
- * Sends a GET request to the specified URL with optional headers.
4
- *
5
- * @template T - The expected type of the response data.
6
- * @param {string} url - The URL to send the GET request to.
7
- * @param {HeadersInit} [headers={}] - Optional headers to include in the request.
8
- * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
9
- */
10
- async function getRequest(url, headers = {}) {
11
- return makeRequest("GET", url, headers);
12
- }
13
- export { getRequest };
@@ -1,38 +0,0 @@
1
- import type { ApiResponseDTO } from "../types/ApiResponseDTO";
2
- /**
3
- * Makes an HTTP request using the Fetch API and returns a standardized response.
4
- *
5
- * @template T - The expected type of the response data.
6
- * @param method - The HTTP method to use for the request. Supported methods are:
7
- * - "POST": Create a new resource.
8
- * - "PUT": Update an existing resource.
9
- * - "DELETE": Remove a resource.
10
- * - "PATCH": Partially update a resource.
11
- * - "GET": Retrieve a resource.
12
- * @param url - The URL to which the request is sent.
13
- * @param headers - Optional headers to include in the request. Defaults to an empty object.
14
- * @param body - Optional body to include in the request. Should be serializable to JSON.
15
- * @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
16
- * - `success`: A boolean indicating whether the request was successful.
17
- * - `status`: The HTTP status code of the response.
18
- * - `message`: A message describing the result of the request.
19
- * - `response`: The parsed JSON response data, or `null` if parsing fails.
20
- * - `cause`: Additional error information, if applicable.
21
- *
22
- * @example
23
- * ```typescript
24
- * import { makeRequest } from "./makeRequest";
25
- *
26
- * async function fetchData() {
27
- * const response = await makeRequest("GET", "https://api.example.com/data");
28
- * if (response.success) {
29
- * console.log("Data:", response.response);
30
- * } else {
31
- * console.error("Error:", response.message);
32
- * }
33
- * }
34
- * ```
35
- */
36
- declare function makeRequest<T = any>(method: "POST" | "PUT" | "DELETE" | "PATCH" | "GET", url: string, rawHeaders?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
37
- export { makeRequest };
38
- //# sourceMappingURL=makeRequest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeRequest.d.ts","sourceRoot":"","sources":["../../src/api/makeRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,EACnD,GAAG,EAAE,MAAM,EACX,UAAU,GAAE,WAAgB,EAC5B,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CA2E5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,107 +0,0 @@
1
- import { ArkynLogRequestMapper } from "../mapper/arkynLogRequestMapper";
2
- import { flushDebugLogs } from "../services/flushDebugLogs";
3
- import { arkynLogRequest } from "./arkynLogRequest";
4
- /**
5
- * Makes an HTTP request using the Fetch API and returns a standardized response.
6
- *
7
- * @template T - The expected type of the response data.
8
- * @param method - The HTTP method to use for the request. Supported methods are:
9
- * - "POST": Create a new resource.
10
- * - "PUT": Update an existing resource.
11
- * - "DELETE": Remove a resource.
12
- * - "PATCH": Partially update a resource.
13
- * - "GET": Retrieve a resource.
14
- * @param url - The URL to which the request is sent.
15
- * @param headers - Optional headers to include in the request. Defaults to an empty object.
16
- * @param body - Optional body to include in the request. Should be serializable to JSON.
17
- * @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
18
- * - `success`: A boolean indicating whether the request was successful.
19
- * - `status`: The HTTP status code of the response.
20
- * - `message`: A message describing the result of the request.
21
- * - `response`: The parsed JSON response data, or `null` if parsing fails.
22
- * - `cause`: Additional error information, if applicable.
23
- *
24
- * @example
25
- * ```typescript
26
- * import { makeRequest } from "./makeRequest";
27
- *
28
- * async function fetchData() {
29
- * const response = await makeRequest("GET", "https://api.example.com/data");
30
- * if (response.success) {
31
- * console.log("Data:", response.response);
32
- * } else {
33
- * console.error("Error:", response.message);
34
- * }
35
- * }
36
- * ```
37
- */
38
- async function makeRequest(method, url, rawHeaders = {}, body) {
39
- const successMessage = {
40
- POST: "Resource created successfully",
41
- PUT: "Resource updated successfully",
42
- DELETE: "Resource deleted successfully",
43
- PATCH: "Resource patched successfully",
44
- GET: "Request successful",
45
- };
46
- try {
47
- const startTime = performance.now();
48
- const headers = { ...rawHeaders, "Content-Type": "application/json" };
49
- const response = await fetch(url, {
50
- method,
51
- headers,
52
- body: body ? JSON.stringify(body) : undefined,
53
- });
54
- const elapsedTime = performance.now() - startTime;
55
- const status = response.status;
56
- let data = null;
57
- try {
58
- data = await response.json();
59
- }
60
- catch {
61
- data = null;
62
- }
63
- const logData = ArkynLogRequestMapper.handle({
64
- elapsedTime,
65
- method,
66
- queryParams: new URL(url).searchParams,
67
- requestHeaders: headers,
68
- requestBody: body,
69
- responseBody: data,
70
- responseHeaders: response.headers,
71
- status,
72
- url,
73
- });
74
- arkynLogRequest(logData);
75
- if (!response.ok) {
76
- return {
77
- success: false,
78
- status,
79
- message: data?.message || response.statusText || "Request failed",
80
- response: data,
81
- cause: null,
82
- };
83
- }
84
- return {
85
- success: true,
86
- status,
87
- message: data?.message || successMessage[method],
88
- response: data,
89
- cause: null,
90
- };
91
- }
92
- catch (err) {
93
- flushDebugLogs({
94
- debugs: [`Network error or request failed: ${err}`],
95
- name: "ARKYN_MAKE_REQUEST_ERROR",
96
- scheme: "red",
97
- });
98
- return {
99
- success: false,
100
- status: 0,
101
- message: "Network error or request failed",
102
- response: null,
103
- cause: err instanceof Error ? err.message : String(err),
104
- };
105
- }
106
- }
107
- export { makeRequest };