@venizia/ignis-helpers 0.4.6 → 0.4.7-1

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 (300) hide show
  1. package/LICENSE.md +1 -3
  2. package/README.md +4 -5
  3. package/dist/esm/common/redact.d.ts +25 -17
  4. package/dist/esm/common/redact.d.ts.map +1 -1
  5. package/dist/esm/common/redact.js +50 -46
  6. package/dist/esm/common/redact.js.map +1 -1
  7. package/dist/esm/common/resolvers.d.ts +7 -5
  8. package/dist/esm/common/resolvers.d.ts.map +1 -1
  9. package/dist/esm/common/resolvers.js +11 -9
  10. package/dist/esm/common/resolvers.js.map +1 -1
  11. package/dist/esm/core.d.ts +6 -3
  12. package/dist/esm/core.d.ts.map +1 -1
  13. package/dist/esm/core.js +6 -3
  14. package/dist/esm/core.js.map +1 -1
  15. package/dist/esm/modules/base.js +4 -4
  16. package/dist/esm/modules/base.js.map +1 -1
  17. package/dist/esm/modules/cron/helper.js +4 -4
  18. package/dist/esm/modules/cron/helper.js.map +1 -1
  19. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js +3 -3
  20. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js.map +1 -1
  21. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js +5 -5
  22. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js.map +1 -1
  23. package/dist/esm/modules/crypto/algorithms/base.algorithm.js +3 -3
  24. package/dist/esm/modules/crypto/algorithms/base.algorithm.js.map +1 -1
  25. package/dist/esm/modules/env/app-env.d.ts.map +1 -1
  26. package/dist/esm/modules/env/app-env.js +2 -2
  27. package/dist/esm/modules/env/app-env.js.map +1 -1
  28. package/dist/esm/modules/logger/common/constants.d.ts +23 -21
  29. package/dist/esm/modules/logger/common/constants.d.ts.map +1 -1
  30. package/dist/esm/modules/logger/common/constants.js +45 -42
  31. package/dist/esm/modules/logger/common/constants.js.map +1 -1
  32. package/dist/esm/modules/logger/factory.d.ts +5 -3
  33. package/dist/esm/modules/logger/factory.d.ts.map +1 -1
  34. package/dist/esm/modules/logger/factory.js +5 -3
  35. package/dist/esm/modules/logger/factory.js.map +1 -1
  36. package/dist/esm/modules/logger/formatting/deep-splat.d.ts +10 -6
  37. package/dist/esm/modules/logger/formatting/deep-splat.d.ts.map +1 -1
  38. package/dist/esm/modules/logger/formatting/deep-splat.js +73 -62
  39. package/dist/esm/modules/logger/formatting/deep-splat.js.map +1 -1
  40. package/dist/esm/modules/logger/formatting/error-prettier.d.ts.map +1 -1
  41. package/dist/esm/modules/logger/formatting/error-prettier.js +8 -6
  42. package/dist/esm/modules/logger/formatting/error-prettier.js.map +1 -1
  43. package/dist/esm/modules/logger/hf/logger.d.ts.map +1 -1
  44. package/dist/esm/modules/logger/hf/logger.js +2 -2
  45. package/dist/esm/modules/logger/hf/logger.js.map +1 -1
  46. package/dist/esm/modules/logger/pino/backing.d.ts +0 -9
  47. package/dist/esm/modules/logger/pino/backing.d.ts.map +1 -1
  48. package/dist/esm/modules/logger/pino/backing.js +3 -8
  49. package/dist/esm/modules/logger/pino/backing.js.map +1 -1
  50. package/dist/esm/modules/logger/pino/destination.d.ts +6 -9
  51. package/dist/esm/modules/logger/pino/destination.d.ts.map +1 -1
  52. package/dist/esm/modules/logger/pino/destination.js +12 -13
  53. package/dist/esm/modules/logger/pino/destination.js.map +1 -1
  54. package/dist/esm/modules/logger/pino/logger.js +2 -2
  55. package/dist/esm/modules/logger/pino/logger.js.map +1 -1
  56. package/dist/esm/modules/logger/resolver.js +2 -2
  57. package/dist/esm/modules/logger/resolver.js.map +1 -1
  58. package/dist/esm/modules/logger/slot.d.ts +39 -18
  59. package/dist/esm/modules/logger/slot.d.ts.map +1 -1
  60. package/dist/esm/modules/logger/slot.js +117 -110
  61. package/dist/esm/modules/logger/slot.js.map +1 -1
  62. package/dist/esm/modules/logger/winston/common/constants.d.ts.map +1 -1
  63. package/dist/esm/modules/logger/winston/common/constants.js +7 -6
  64. package/dist/esm/modules/logger/winston/common/constants.js.map +1 -1
  65. package/dist/esm/modules/logger/winston/define.d.ts +0 -7
  66. package/dist/esm/modules/logger/winston/define.d.ts.map +1 -1
  67. package/dist/esm/modules/logger/winston/define.js +0 -5
  68. package/dist/esm/modules/logger/winston/define.js.map +1 -1
  69. package/dist/esm/modules/logger/winston/formats.d.ts +2 -0
  70. package/dist/esm/modules/logger/winston/formats.d.ts.map +1 -1
  71. package/dist/esm/modules/logger/winston/formats.js +17 -4
  72. package/dist/esm/modules/logger/winston/formats.js.map +1 -1
  73. package/dist/esm/modules/logger/winston/index.d.ts +3 -2
  74. package/dist/esm/modules/logger/winston/index.d.ts.map +1 -1
  75. package/dist/esm/modules/logger/winston/index.js +3 -2
  76. package/dist/esm/modules/logger/winston/index.js.map +1 -1
  77. package/dist/esm/modules/logger/winston/logger-factory.js +4 -4
  78. package/dist/esm/modules/logger/winston/logger-factory.js.map +1 -1
  79. package/dist/esm/modules/network/http-request/base-network-request.helper.js +2 -2
  80. package/dist/esm/modules/network/http-request/base-network-request.helper.js.map +1 -1
  81. package/dist/esm/modules/network/http-request/common/index.d.ts +0 -1
  82. package/dist/esm/modules/network/http-request/common/index.d.ts.map +1 -1
  83. package/dist/esm/modules/network/http-request/common/index.js +0 -1
  84. package/dist/esm/modules/network/http-request/common/index.js.map +1 -1
  85. package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.d.ts.map +1 -1
  86. package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.js +4 -2
  87. package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.js.map +1 -1
  88. package/dist/esm/modules/network/http-request/fetcher/node-fetcher.d.ts.map +1 -1
  89. package/dist/esm/modules/network/http-request/fetcher/node-fetcher.js +6 -4
  90. package/dist/esm/modules/network/http-request/fetcher/node-fetcher.js.map +1 -1
  91. package/dist/esm/modules/network/tcp-socket/base-tcp-client.helper.js +4 -4
  92. package/dist/esm/modules/network/tcp-socket/base-tcp-client.helper.js.map +1 -1
  93. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js +4 -4
  94. package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js.map +1 -1
  95. package/dist/esm/modules/network/udp-socket/network-udp-client.helper.js +2 -2
  96. package/dist/esm/modules/network/udp-socket/network-udp-client.helper.js.map +1 -1
  97. package/dist/esm/modules/network/utilities/query-string.d.ts +22 -20
  98. package/dist/esm/modules/network/utilities/query-string.d.ts.map +1 -1
  99. package/dist/esm/modules/network/utilities/query-string.js +48 -46
  100. package/dist/esm/modules/network/utilities/query-string.js.map +1 -1
  101. package/dist/esm/modules/network/utilities/url-safety/common/errors.d.ts +0 -10
  102. package/dist/esm/modules/network/utilities/url-safety/common/errors.d.ts.map +1 -1
  103. package/dist/esm/modules/network/utilities/url-safety/common/errors.js +0 -11
  104. package/dist/esm/modules/network/utilities/url-safety/common/errors.js.map +1 -1
  105. package/dist/esm/modules/network/utilities/url-safety/ingest.d.ts.map +1 -1
  106. package/dist/esm/modules/network/utilities/url-safety/ingest.js +2 -1
  107. package/dist/esm/modules/network/utilities/url-safety/ingest.js.map +1 -1
  108. package/dist/esm/modules/network/utilities/url-safety/policy.d.ts +10 -0
  109. package/dist/esm/modules/network/utilities/url-safety/policy.d.ts.map +1 -1
  110. package/dist/esm/modules/network/utilities/url-safety/policy.js +11 -0
  111. package/dist/esm/modules/network/utilities/url-safety/policy.js.map +1 -1
  112. package/dist/esm/modules/pool/abstract.d.ts.map +1 -1
  113. package/dist/esm/modules/pool/abstract.js +4 -2
  114. package/dist/esm/modules/pool/abstract.js.map +1 -1
  115. package/dist/esm/modules/queue/bullmq/helper.d.ts.map +1 -1
  116. package/dist/esm/modules/queue/bullmq/helper.js +6 -6
  117. package/dist/esm/modules/queue/bullmq/helper.js.map +1 -1
  118. package/dist/esm/modules/queue/common/hook.d.ts +14 -12
  119. package/dist/esm/modules/queue/common/hook.d.ts.map +1 -1
  120. package/dist/esm/modules/queue/common/hook.js +21 -19
  121. package/dist/esm/modules/queue/common/hook.js.map +1 -1
  122. package/dist/esm/modules/queue/common/index.d.ts +0 -1
  123. package/dist/esm/modules/queue/common/index.d.ts.map +1 -1
  124. package/dist/esm/modules/queue/common/index.js +0 -1
  125. package/dist/esm/modules/queue/common/index.js.map +1 -1
  126. package/dist/esm/modules/queue/internal/sequential/helper.js +8 -8
  127. package/dist/esm/modules/queue/internal/sequential/helper.js.map +1 -1
  128. package/dist/esm/modules/queue/kafka/base.js +3 -3
  129. package/dist/esm/modules/queue/kafka/base.js.map +1 -1
  130. package/dist/esm/modules/queue/kafka/bundler/index.d.ts +0 -2
  131. package/dist/esm/modules/queue/kafka/bundler/index.d.ts.map +1 -1
  132. package/dist/esm/modules/queue/kafka/bundler/index.js +0 -2
  133. package/dist/esm/modules/queue/kafka/bundler/index.js.map +1 -1
  134. package/dist/esm/modules/queue/kafka/bundler/plugins.d.ts +8 -2
  135. package/dist/esm/modules/queue/kafka/bundler/plugins.d.ts.map +1 -1
  136. package/dist/esm/modules/queue/kafka/bundler/plugins.js +64 -7
  137. package/dist/esm/modules/queue/kafka/bundler/plugins.js.map +1 -1
  138. package/dist/esm/modules/queue/kafka/consumer.d.ts.map +1 -1
  139. package/dist/esm/modules/queue/kafka/consumer.js +26 -24
  140. package/dist/esm/modules/queue/kafka/consumer.js.map +1 -1
  141. package/dist/esm/modules/queue/mqtt/helper.js +10 -10
  142. package/dist/esm/modules/queue/mqtt/helper.js.map +1 -1
  143. package/dist/esm/modules/redis/base/abstract.helper.js +8 -8
  144. package/dist/esm/modules/redis/base/abstract.helper.js.map +1 -1
  145. package/dist/esm/modules/redis/cluster/cluster.helper.js +2 -2
  146. package/dist/esm/modules/redis/cluster/cluster.helper.js.map +1 -1
  147. package/dist/esm/modules/redis/factory.d.ts +13 -9
  148. package/dist/esm/modules/redis/factory.d.ts.map +1 -1
  149. package/dist/esm/modules/redis/factory.js +15 -13
  150. package/dist/esm/modules/redis/factory.js.map +1 -1
  151. package/dist/esm/modules/redis/sentinel/sentinel.helper.js +2 -2
  152. package/dist/esm/modules/redis/sentinel/sentinel.helper.js.map +1 -1
  153. package/dist/esm/modules/redis/single/single.helper.js +2 -2
  154. package/dist/esm/modules/redis/single/single.helper.js.map +1 -1
  155. package/dist/esm/modules/redis/utility.d.ts +13 -11
  156. package/dist/esm/modules/redis/utility.d.ts.map +1 -1
  157. package/dist/esm/modules/redis/utility.js +46 -44
  158. package/dist/esm/modules/redis/utility.js.map +1 -1
  159. package/dist/esm/modules/retry/helper.d.ts.map +1 -1
  160. package/dist/esm/modules/retry/helper.js +6 -4
  161. package/dist/esm/modules/retry/helper.js.map +1 -1
  162. package/dist/esm/modules/secrets/factory.d.ts +5 -3
  163. package/dist/esm/modules/secrets/factory.d.ts.map +1 -1
  164. package/dist/esm/modules/secrets/factory.js +36 -34
  165. package/dist/esm/modules/secrets/factory.js.map +1 -1
  166. package/dist/esm/modules/secrets/hashicorp/hashicorp.helper.d.ts.map +1 -1
  167. package/dist/esm/modules/secrets/hashicorp/hashicorp.helper.js +4 -2
  168. package/dist/esm/modules/secrets/hashicorp/hashicorp.helper.js.map +1 -1
  169. package/dist/esm/modules/socket/socket-io/server/helper.d.ts.map +1 -1
  170. package/dist/esm/modules/socket/socket-io/server/helper.js +11 -11
  171. package/dist/esm/modules/socket/socket-io/server/helper.js.map +1 -1
  172. package/dist/esm/modules/socket/websocket/emitter/helper.d.ts.map +1 -1
  173. package/dist/esm/modules/socket/websocket/emitter/helper.js +3 -3
  174. package/dist/esm/modules/socket/websocket/emitter/helper.js.map +1 -1
  175. package/dist/esm/modules/socket/websocket/server/delivery.d.ts.map +1 -1
  176. package/dist/esm/modules/socket/websocket/server/delivery.js +5 -6
  177. package/dist/esm/modules/socket/websocket/server/delivery.js.map +1 -1
  178. package/dist/esm/modules/socket/websocket/server/helper.d.ts.map +1 -1
  179. package/dist/esm/modules/socket/websocket/server/helper.js +7 -7
  180. package/dist/esm/modules/socket/websocket/server/helper.js.map +1 -1
  181. package/dist/esm/modules/storage/base.d.ts.map +1 -1
  182. package/dist/esm/modules/storage/base.js +9 -8
  183. package/dist/esm/modules/storage/base.js.map +1 -1
  184. package/dist/esm/modules/storage/bun-s3/helper.d.ts.map +1 -1
  185. package/dist/esm/modules/storage/bun-s3/helper.js +25 -18
  186. package/dist/esm/modules/storage/bun-s3/helper.js.map +1 -1
  187. package/dist/esm/modules/storage/bun-s3/utility.d.ts +95 -77
  188. package/dist/esm/modules/storage/bun-s3/utility.d.ts.map +1 -1
  189. package/dist/esm/modules/storage/bun-s3/utility.js +261 -244
  190. package/dist/esm/modules/storage/bun-s3/utility.js.map +1 -1
  191. package/dist/esm/modules/storage/common/errors.d.ts +0 -4
  192. package/dist/esm/modules/storage/common/errors.d.ts.map +1 -1
  193. package/dist/esm/modules/storage/common/errors.js +0 -10
  194. package/dist/esm/modules/storage/common/errors.js.map +1 -1
  195. package/dist/esm/modules/storage/common/utility.d.ts +11 -5
  196. package/dist/esm/modules/storage/common/utility.d.ts.map +1 -1
  197. package/dist/esm/modules/storage/common/utility.js +30 -17
  198. package/dist/esm/modules/storage/common/utility.js.map +1 -1
  199. package/dist/esm/modules/storage/disk/helper.d.ts.map +1 -1
  200. package/dist/esm/modules/storage/disk/helper.js +18 -9
  201. package/dist/esm/modules/storage/disk/helper.js.map +1 -1
  202. package/dist/esm/modules/tree/builder.d.ts.map +1 -1
  203. package/dist/esm/modules/tree/builder.js +2 -1
  204. package/dist/esm/modules/tree/builder.js.map +1 -1
  205. package/dist/esm/modules/uid/opaque.d.ts.map +1 -1
  206. package/dist/esm/modules/uid/opaque.js +4 -2
  207. package/dist/esm/modules/uid/opaque.js.map +1 -1
  208. package/dist/esm/modules/uid/uuid/helper.d.ts +1 -1
  209. package/dist/esm/modules/uid/uuid/helper.d.ts.map +1 -1
  210. package/dist/esm/modules/uid/uuid/helper.js +7 -7
  211. package/dist/esm/modules/uid/uuid/helper.js.map +1 -1
  212. package/dist/esm/modules/uid/uuid/v4.d.ts +11 -8
  213. package/dist/esm/modules/uid/uuid/v4.d.ts.map +1 -1
  214. package/dist/esm/modules/uid/uuid/v4.js +51 -46
  215. package/dist/esm/modules/uid/uuid/v4.js.map +1 -1
  216. package/dist/esm/modules/uid/uuid/v5.d.ts +17 -14
  217. package/dist/esm/modules/uid/uuid/v5.d.ts.map +1 -1
  218. package/dist/esm/modules/uid/uuid/v5.js +83 -78
  219. package/dist/esm/modules/uid/uuid/v5.js.map +1 -1
  220. package/dist/esm/modules/uid/uuid/v7.d.ts +15 -10
  221. package/dist/esm/modules/uid/uuid/v7.d.ts.map +1 -1
  222. package/dist/esm/modules/uid/uuid/v7.js +88 -79
  223. package/dist/esm/modules/uid/uuid/v7.js.map +1 -1
  224. package/dist/esm/modules/worker-thread/bus/base.js +2 -2
  225. package/dist/esm/modules/worker-thread/bus/base.js.map +1 -1
  226. package/dist/esm/modules/worker-thread/worker/base.d.ts.map +1 -1
  227. package/dist/esm/modules/worker-thread/worker/base.js +4 -3
  228. package/dist/esm/modules/worker-thread/worker/base.js.map +1 -1
  229. package/dist/esm/utilities/error.utility.d.ts +7 -0
  230. package/dist/esm/utilities/error.utility.d.ts.map +1 -0
  231. package/dist/esm/utilities/error.utility.js +9 -0
  232. package/dist/esm/utilities/error.utility.js.map +1 -0
  233. package/dist/esm/utilities/form-body.utility.d.ts +12 -10
  234. package/dist/esm/utilities/form-body.utility.d.ts.map +1 -1
  235. package/dist/esm/utilities/form-body.utility.js +19 -16
  236. package/dist/esm/utilities/form-body.utility.js.map +1 -1
  237. package/dist/esm/utilities/hr-time.utility.d.ts +7 -5
  238. package/dist/esm/utilities/hr-time.utility.d.ts.map +1 -1
  239. package/dist/esm/utilities/hr-time.utility.js +11 -9
  240. package/dist/esm/utilities/hr-time.utility.js.map +1 -1
  241. package/dist/esm/utilities/index.d.ts +2 -2
  242. package/dist/esm/utilities/index.d.ts.map +1 -1
  243. package/dist/esm/utilities/index.js +2 -2
  244. package/dist/esm/utilities/index.js.map +1 -1
  245. package/dist/esm/utilities/module.utility.d.ts.map +1 -1
  246. package/dist/esm/utilities/module.utility.js +4 -2
  247. package/dist/esm/utilities/module.utility.js.map +1 -1
  248. package/dist/esm/utilities/parse.utility.d.ts +89 -43
  249. package/dist/esm/utilities/parse.utility.d.ts.map +1 -1
  250. package/dist/esm/utilities/parse.utility.js +173 -141
  251. package/dist/esm/utilities/parse.utility.js.map +1 -1
  252. package/dist/esm/utilities/performance.utility.d.ts +15 -13
  253. package/dist/esm/utilities/performance.utility.d.ts.map +1 -1
  254. package/dist/esm/utilities/performance.utility.js +34 -29
  255. package/dist/esm/utilities/performance.utility.js.map +1 -1
  256. package/dist/esm/utilities/promise.utility.d.ts +20 -18
  257. package/dist/esm/utilities/promise.utility.d.ts.map +1 -1
  258. package/dist/esm/utilities/promise.utility.js +41 -51
  259. package/dist/esm/utilities/promise.utility.js.map +1 -1
  260. package/dist/esm/utilities/request.utility.d.ts +35 -29
  261. package/dist/esm/utilities/request.utility.d.ts.map +1 -1
  262. package/dist/esm/utilities/request.utility.js +117 -115
  263. package/dist/esm/utilities/request.utility.js.map +1 -1
  264. package/package.json +4 -15
  265. package/dist/esm/modules/logger/winston/formatters/deep-splat.d.ts +0 -4
  266. package/dist/esm/modules/logger/winston/formatters/deep-splat.d.ts.map +0 -1
  267. package/dist/esm/modules/logger/winston/formatters/deep-splat.js +0 -14
  268. package/dist/esm/modules/logger/winston/formatters/deep-splat.js.map +0 -1
  269. package/dist/esm/modules/logger/winston/formatters/index.d.ts +0 -2
  270. package/dist/esm/modules/logger/winston/formatters/index.d.ts.map +0 -1
  271. package/dist/esm/modules/logger/winston/formatters/index.js +0 -2
  272. package/dist/esm/modules/logger/winston/formatters/index.js.map +0 -1
  273. package/dist/esm/modules/network/http-request/common/types.d.ts +0 -2
  274. package/dist/esm/modules/network/http-request/common/types.d.ts.map +0 -1
  275. package/dist/esm/modules/network/http-request/common/types.js +0 -2
  276. package/dist/esm/modules/network/http-request/common/types.js.map +0 -1
  277. package/dist/esm/modules/queue/common/types.d.ts +0 -2
  278. package/dist/esm/modules/queue/common/types.d.ts.map +0 -1
  279. package/dist/esm/modules/queue/common/types.js +0 -2
  280. package/dist/esm/modules/queue/common/types.js.map +0 -1
  281. package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.d.ts +0 -4
  282. package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.d.ts.map +0 -1
  283. package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.js +0 -28
  284. package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.js.map +0 -1
  285. package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.d.ts +0 -4
  286. package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.d.ts.map +0 -1
  287. package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.js +0 -26
  288. package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.js.map +0 -1
  289. package/dist/esm/modules/storage/minio/helper.d.ts +0 -55
  290. package/dist/esm/modules/storage/minio/helper.d.ts.map +0 -1
  291. package/dist/esm/modules/storage/minio/helper.js +0 -176
  292. package/dist/esm/modules/storage/minio/helper.js.map +0 -1
  293. package/dist/esm/modules/storage/minio/index.d.ts +0 -2
  294. package/dist/esm/modules/storage/minio/index.d.ts.map +0 -1
  295. package/dist/esm/modules/storage/minio/index.js +0 -2
  296. package/dist/esm/modules/storage/minio/index.js.map +0 -1
  297. package/dist/esm/utilities/sleep.utility.d.ts +0 -2
  298. package/dist/esm/utilities/sleep.utility.d.ts.map +0 -1
  299. package/dist/esm/utilities/sleep.utility.js +0 -4
  300. package/dist/esm/utilities/sleep.utility.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,MAAM,CAAC;AAE3F,MAAM,CAAC,MAAM,qBAAqB,GAChC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,IAAI,IAAI,CAAC;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAC/B,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,MAAM,CAAC;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAChC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,IAAI,IAAI,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GACnC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,IAAI,aAAa,CAAC","sourcesContent":["import { blankToUndefined } from '@/utilities/parse.utility';\nimport { Defaults } from '@/common/constants';\n\n/** Not re-exported from `common/index.ts` - keeps these off the `/winston` sub-path surface. */\nexport const LOGGER_PREFIX = Defaults.APPLICATION_NAME;\nexport const LOGGER_FORMAT = blankToUndefined(process.env.APP_ENV_LOGGER_FORMAT) ?? 'text';\n\nexport const LOGGER_FILE_FREQUENCY =\n blankToUndefined(process.env.APP_ENV_LOGGER_FILE_FREQUENCY) ?? '1h';\nexport const LOGGER_FILE_MAX_SIZE =\n blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_SIZE) ?? '100m';\nexport const LOGGER_FILE_MAX_FILES =\n blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_FILES) ?? '5d';\nexport const LOGGER_FILE_DATE_PATTERN =\n blankToUndefined(process.env.APP_ENV_LOGGER_FILE_DATE_PATTERN) ?? 'YYYYMMDD_HH';\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,aAAa,GACxB,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,IAAI,MAAM,CAAC;AAExF,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,IAAI,CAAC;AAC9F,MAAM,CAAC,MAAM,oBAAoB,GAC/B,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,CAAC,IAAI,MAAM,CAAC;AAC/F,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,IAAI,CAAC;AAC9F,MAAM,CAAC,MAAM,wBAAwB,GACnC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC;IACtF,aAAa,CAAC","sourcesContent":["import { ParseUtility } from '@/utilities/parse.utility';\nimport { Defaults } from '@/common/constants';\n\n/** Not re-exported from `common/index.ts` - keeps these off the `/winston` sub-path surface. */\nexport const LOGGER_PREFIX = Defaults.APPLICATION_NAME;\nexport const LOGGER_FORMAT =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FORMAT }) ?? 'text';\n\nexport const LOGGER_FILE_FREQUENCY =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_FREQUENCY }) ?? '1h';\nexport const LOGGER_FILE_MAX_SIZE =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_SIZE }) ?? '100m';\nexport const LOGGER_FILE_MAX_FILES =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_FILES }) ?? '5d';\nexport const LOGGER_FILE_DATE_PATTERN =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_DATE_PATTERN }) ??\n 'YYYYMMDD_HH';\n"]}
@@ -1,12 +1,5 @@
1
1
  import type winston from 'winston';
2
- import { WinstonFormatFactory } from './formats.js';
3
- import { WinstonLoggerFactory } from './logger-factory.js';
4
2
  export declare const applicationLogFormatter: winston.Logform.Format;
5
- export declare const defineCustomLogger: typeof WinstonLoggerFactory.defineCustomLogger;
6
- export declare const defineJsonLoggerFormatter: typeof WinstonFormatFactory.json;
7
- export declare const defineLogFormatter: typeof WinstonFormatFactory.log;
8
- export declare const definePrettyLoggerFormatter: typeof WinstonFormatFactory.pretty;
9
- export declare const resolveDefaultTransportOptions: typeof WinstonLoggerFactory.resolveDefaultTransportOptions;
10
3
  /** Module-internal only - NOT re-exported from `winston/index.ts`; the default winston backing WinstonLogger falls back to. */
11
4
  export declare const defaultWinstonLogger: winston.Logger;
12
5
  //# sourceMappingURL=define.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,MACR,CAAC;AAC/C,eAAO,MAAM,kBAAkB,gDAA0C,CAAC;AAC1E,eAAO,MAAM,yBAAyB,kCAA4B,CAAC;AACnE,eAAO,MAAM,kBAAkB,iCAA2B,CAAC;AAC3D,eAAO,MAAM,2BAA2B,oCAA8B,CAAC;AACvE,eAAO,MAAM,8BAA8B,4DAAsD,CAAC;AAElG,+HAA+H;AAC/H,eAAO,MAAM,oBAAoB,gBAAuC,CAAC"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,MACR,CAAC;AAE/C,+HAA+H;AAC/H,eAAO,MAAM,oBAAoB,gBAAuC,CAAC"}
@@ -1,11 +1,6 @@
1
1
  import { WinstonFormatFactory } from './formats.js';
2
2
  import { WinstonLoggerFactory } from './logger-factory.js';
3
3
  export const applicationLogFormatter = WinstonFormatFactory.applicationLogFormatter;
4
- export const defineCustomLogger = WinstonLoggerFactory.defineCustomLogger;
5
- export const defineJsonLoggerFormatter = WinstonFormatFactory.json;
6
- export const defineLogFormatter = WinstonFormatFactory.log;
7
- export const definePrettyLoggerFormatter = WinstonFormatFactory.pretty;
8
- export const resolveDefaultTransportOptions = WinstonLoggerFactory.resolveDefaultTransportOptions;
9
4
  /** Module-internal only - NOT re-exported from `winston/index.ts`; the default winston backing WinstonLogger falls back to. */
10
5
  export const defaultWinstonLogger = WinstonLoggerFactory.defaultLogger();
11
6
  //# sourceMappingURL=define.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/define.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAClC,oBAAoB,CAAC,uBAAuB,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;AAC1E,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,IAAI,CAAC;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAG,oBAAoB,CAAC,MAAM,CAAC;AACvE,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAAoB,CAAC,8BAA8B,CAAC;AAElG,+HAA+H;AAC/H,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["import type winston from 'winston';\nimport { WinstonFormatFactory } from './formats';\nimport { WinstonLoggerFactory } from './logger-factory';\n\nexport const applicationLogFormatter: winston.Logform.Format =\n WinstonFormatFactory.applicationLogFormatter;\nexport const defineCustomLogger = WinstonLoggerFactory.defineCustomLogger;\nexport const defineJsonLoggerFormatter = WinstonFormatFactory.json;\nexport const defineLogFormatter = WinstonFormatFactory.log;\nexport const definePrettyLoggerFormatter = WinstonFormatFactory.pretty;\nexport const resolveDefaultTransportOptions = WinstonLoggerFactory.resolveDefaultTransportOptions;\n\n/** Module-internal only - NOT re-exported from `winston/index.ts`; the default winston backing WinstonLogger falls back to. */\nexport const defaultWinstonLogger = WinstonLoggerFactory.defaultLogger();\n"]}
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/define.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAClC,oBAAoB,CAAC,uBAAuB,CAAC;AAE/C,+HAA+H;AAC/H,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["import type winston from 'winston';\nimport { WinstonFormatFactory } from './formats';\nimport { WinstonLoggerFactory } from './logger-factory';\n\nexport const applicationLogFormatter: winston.Logform.Format =\n WinstonFormatFactory.applicationLogFormatter;\n\n/** Module-internal only - NOT re-exported from `winston/index.ts`; the default winston backing WinstonLogger falls back to. */\nexport const defaultWinstonLogger = WinstonLoggerFactory.defaultLogger();\n"]}
@@ -9,6 +9,8 @@ export declare class WinstonFormatFactory {
9
9
  static prep(opts: {
10
10
  label: string;
11
11
  }): winston.Logform.Format;
12
+ /** Drop-in replacement for `winston.format.splat()` that formats through {@link LogFormatUtility.formatMessage}; every transport reads `info.message`, so widening it here widens console, file and dgram at once. */
13
+ static deepSplat(): winston.Logform.Format;
12
14
  static textLine(): winston.Logform.Format;
13
15
  static json(opts: {
14
16
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/formats.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAwC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAIrF;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,yKAAyK;IACzK,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IASnC,MAAM,CAAC,QAAQ;IAMf,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAInC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAoBzD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,aAAa,CAAA;KAAE;IAkB1D,oJAAoJ;IACpJ,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE;;;;IAqBlE,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAE5D;CACJ"}
1
+ {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/formats.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAQnF;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,yKAAyK;IACzK,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IASnC,sNAAsN;IACtN,MAAM,CAAC,SAAS;IAahB,MAAM,CAAC,QAAQ;IAMf,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAInC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAoBzD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,aAAa,CAAA;KAAE;IAkB1D,oJAAoJ;IACpJ,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE;;;;IAqBlE,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAE5D;CACJ"}
@@ -1,9 +1,11 @@
1
1
  import { getError } from '@venizia/ignis-inversion';
2
2
  import winston from 'winston';
3
- import { deepSplat } from './formatters/index.js';
4
3
  import { LOGGER_FORMAT, LOGGER_PREFIX } from './common/constants.js';
5
- import { LoggerFormats, resolveLoggerColorize } from '../common/index.js';
4
+ import { LoggerFormats, LoggerConfigUtility } from '../common/index.js';
5
+ import { LogFormatUtility } from '../formatting/index.js';
6
6
  const f = winston.format;
7
+ /** Winston stashes the extra arguments of `logger.error(msg, ...args)` under this well-known key. */
8
+ const SPLAT = Symbol.for('splat');
7
9
  /**
8
10
  * Static methods never reach a sibling through `this` - the exported names in `define.ts` are
9
11
  * unbound aliases (`WinstonFormatFactory.method`), so `this` would be `undefined` there.
@@ -11,7 +13,18 @@ const f = winston.format;
11
13
  export class WinstonFormatFactory {
12
14
  /** Per-line prep: label, timestamp, error normalization, deep splat. Final-string assembly is per-transport, so console can colorize while files/UDP get plain lines. */
13
15
  static prep(opts) {
14
- return f.combine(f.label({ label: opts.label }), f.timestamp(), f.errors({ stack: true }), deepSplat());
16
+ return f.combine(f.label({ label: opts.label }), f.timestamp(), f.errors({ stack: true }), WinstonFormatFactory.deepSplat());
17
+ }
18
+ /** Drop-in replacement for `winston.format.splat()` that formats through {@link LogFormatUtility.formatMessage}; every transport reads `info.message`, so widening it here widens console, file and dgram at once. */
19
+ static deepSplat() {
20
+ return f((info) => {
21
+ const args = info[SPLAT];
22
+ if (!args?.length || typeof info.message !== 'string') {
23
+ return info;
24
+ }
25
+ info.message = LogFormatUtility.formatMessage({ message: info.message, args });
26
+ return info;
27
+ })();
15
28
  }
16
29
  static textLine() {
17
30
  return f.printf(({ level, message, label, timestamp }) => {
@@ -23,7 +36,7 @@ export class WinstonFormatFactory {
23
36
  }
24
37
  static pretty(opts) {
25
38
  // winston has no terminal detection of its own, so "no opinion" keeps the historical default.
26
- const { label, colorize = resolveLoggerColorize() ?? true } = opts;
39
+ const { label, colorize = LoggerConfigUtility.resolveColorize() ?? true } = opts;
27
40
  if (colorize) {
28
41
  return f.combine(WinstonFormatFactory.prep({ label }), f.align(), f.colorize(), WinstonFormatFactory.textLine());
29
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/formats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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AE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YAC/C,CAAC;YACD,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;gBACxB,OAAO;oBACL,OAAO,EAAE,IAAI,CAAC,QAAQ;wBACpB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;wBACrE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;oBACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;iBAC5D,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,QAAQ,CAAC;oBACb,OAAO,EAAE,wDAAwD,IAAI,CAAC,MAAM,cAAc,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAAE;iBAC1H,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;aAEe,4BAAuB,GAA2B,oBAAoB,CAAC,GAAG,CAAC;QACzF,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-inversion';\nimport winston from 'winston';\nimport { deepSplat } from './formatters';\nimport { LOGGER_FORMAT, LOGGER_PREFIX } from './common/constants';\nimport { LoggerFormats, resolveLoggerColorize, type TLoggerFormat } from '../common';\n\nconst f = winston.format;\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonFormatFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonFormatFactory {\n /** Per-line prep: label, timestamp, error normalization, deep splat. Final-string assembly is per-transport, so console can colorize while files/UDP get plain lines. */\n static prep(opts: { label: string }) {\n return f.combine(\n f.label({ label: opts.label }),\n f.timestamp(),\n f.errors({ stack: true }),\n deepSplat(),\n );\n }\n\n static textLine() {\n return f.printf(({ level, message, label, timestamp }) => {\n return `${timestamp} [${label}] ${level}: ${message}`;\n });\n }\n\n static json(opts: { label: string }) {\n return f.combine(WinstonFormatFactory.prep({ label: opts.label }), f.json());\n }\n\n static pretty(opts: { label: string; colorize?: boolean }) {\n // winston has no terminal detection of its own, so \"no opinion\" keeps the historical default.\n const { label, colorize = resolveLoggerColorize() ?? true } = opts;\n\n if (colorize) {\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n f.colorize(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n static log(opts: { label: string; format?: TLoggerFormat }) {\n const format = opts.format ?? (LOGGER_FORMAT as TLoggerFormat);\n\n switch (format) {\n case LoggerFormats.JSON: {\n return WinstonFormatFactory.json({ label: opts.label });\n }\n case LoggerFormats.TEXT: {\n return WinstonFormatFactory.pretty({ label: opts.label });\n }\n default: {\n throw getError({\n message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n /** Per-transport assembly formats: console may colorize, a file never does - ANSI bytes in a rotated log file are noise every grep has to strip. */\n static assembly(opts: { format: TLoggerFormat; colorize: boolean }) {\n switch (opts.format) {\n case LoggerFormats.JSON: {\n return { console: f.json(), file: f.json() };\n }\n case LoggerFormats.TEXT: {\n return {\n console: opts.colorize\n ? f.combine(f.align(), f.colorize(), WinstonFormatFactory.textLine())\n : f.combine(f.align(), WinstonFormatFactory.textLine()),\n file: f.combine(f.align(), WinstonFormatFactory.textLine()),\n };\n }\n default: {\n throw getError({\n message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n static readonly applicationLogFormatter: winston.Logform.Format = WinstonFormatFactory.log({\n label: LOG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AAC,CAAC,CAAC;gBACR,MAAM,QAAQ,CAAC;oBACb,OAAO,EAAE,wDAAwD,IAAI,CAAC,MAAM,cAAc,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAAE;iBAC1H,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;aAEe,4BAAuB,GAA2B,oBAAoB,CAAC,GAAG,CAAC;QACzF,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-inversion';\nimport winston from 'winston';\nimport { type AnyType } from '@/common/types';\nimport { LOGGER_FORMAT, LOGGER_PREFIX } from './common/constants';\nimport { LoggerFormats, LoggerConfigUtility, type TLoggerFormat } from '../common';\nimport { LogFormatUtility } from '../formatting';\n\nconst f = winston.format;\n\n/** Winston stashes the extra arguments of `logger.error(msg, ...args)` under this well-known key. */\nconst SPLAT = Symbol.for('splat');\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonFormatFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonFormatFactory {\n /** Per-line prep: label, timestamp, error normalization, deep splat. Final-string assembly is per-transport, so console can colorize while files/UDP get plain lines. */\n static prep(opts: { label: string }) {\n return f.combine(\n f.label({ label: opts.label }),\n f.timestamp(),\n f.errors({ stack: true }),\n WinstonFormatFactory.deepSplat(),\n );\n }\n\n /** Drop-in replacement for `winston.format.splat()` that formats through {@link LogFormatUtility.formatMessage}; every transport reads `info.message`, so widening it here widens console, file and dgram at once. */\n static deepSplat() {\n return f((info) => {\n const args = (info as AnyType)[SPLAT] as Array<unknown> | undefined;\n\n if (!args?.length || typeof info.message !== 'string') {\n return info;\n }\n\n info.message = LogFormatUtility.formatMessage({ message: info.message, args });\n return info;\n })();\n }\n\n static textLine() {\n return f.printf(({ level, message, label, timestamp }) => {\n return `${timestamp} [${label}] ${level}: ${message}`;\n });\n }\n\n static json(opts: { label: string }) {\n return f.combine(WinstonFormatFactory.prep({ label: opts.label }), f.json());\n }\n\n static pretty(opts: { label: string; colorize?: boolean }) {\n // winston has no terminal detection of its own, so \"no opinion\" keeps the historical default.\n const { label, colorize = LoggerConfigUtility.resolveColorize() ?? true } = opts;\n\n if (colorize) {\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n f.colorize(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n static log(opts: { label: string; format?: TLoggerFormat }) {\n const format = opts.format ?? (LOGGER_FORMAT as TLoggerFormat);\n\n switch (format) {\n case LoggerFormats.JSON: {\n return WinstonFormatFactory.json({ label: opts.label });\n }\n case LoggerFormats.TEXT: {\n return WinstonFormatFactory.pretty({ label: opts.label });\n }\n default: {\n throw getError({\n message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n /** Per-transport assembly formats: console may colorize, a file never does - ANSI bytes in a rotated log file are noise every grep has to strip. */\n static assembly(opts: { format: TLoggerFormat; colorize: boolean }) {\n switch (opts.format) {\n case LoggerFormats.JSON: {\n return { console: f.json(), file: f.json() };\n }\n case LoggerFormats.TEXT: {\n return {\n console: opts.colorize\n ? f.combine(f.align(), f.colorize(), WinstonFormatFactory.textLine())\n : f.combine(f.align(), WinstonFormatFactory.textLine()),\n file: f.combine(f.align(), WinstonFormatFactory.textLine()),\n };\n }\n default: {\n throw getError({\n message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n static readonly applicationLogFormatter: winston.Logform.Format = WinstonFormatFactory.log({\n label: LOGGER_PREFIX,\n });\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  export * from './common/index.js';
2
- export { applicationLogFormatter, defineCustomLogger, defineJsonLoggerFormatter, defineLogFormatter, definePrettyLoggerFormatter, resolveDefaultTransportOptions, } from './define.js';
3
- export * from './formatters/index.js';
2
+ export { applicationLogFormatter, } from './define.js';
3
+ export { WinstonFormatFactory } from './formats.js';
4
+ export { WinstonLoggerFactory } from './logger-factory.js';
4
5
  export * from './transports/index.js';
5
6
  export * from './logger.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,2BAA2B,EAC3B,8BAA8B,GAE/B,MAAM,UAAU,CAAC;AAClB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,uBAAuB,GAExB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
@@ -1,8 +1,9 @@
1
1
  export * from './common/index.js';
2
- export { applicationLogFormatter, defineCustomLogger, defineJsonLoggerFormatter, defineLogFormatter, definePrettyLoggerFormatter, resolveDefaultTransportOptions,
2
+ export { applicationLogFormatter,
3
3
  // `defaultWinstonLogger` is module-internal - deliberately NOT re-exported.
4
4
  } from './define.js';
5
- export * from './formatters/index.js';
5
+ export { WinstonFormatFactory } from './formats.js';
6
+ export { WinstonLoggerFactory } from './logger-factory.js';
6
7
  export * from './transports/index.js';
7
8
  export * from './logger.js';
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,2BAA2B,EAC3B,8BAA8B;AAC9B,4EAA4E;EAC7E,MAAM,UAAU,CAAC;AAClB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC","sourcesContent":["export * from './common';\nexport {\n applicationLogFormatter,\n defineCustomLogger,\n defineJsonLoggerFormatter,\n defineLogFormatter,\n definePrettyLoggerFormatter,\n resolveDefaultTransportOptions,\n // `defaultWinstonLogger` is module-internal - deliberately NOT re-exported.\n} from './define';\nexport * from './formatters';\nexport * from './transports';\nexport * from './logger';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,uBAAuB;AACvB,4EAA4E;EAC7E,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC","sourcesContent":["export * from './common';\nexport {\n applicationLogFormatter,\n // `defaultWinstonLogger` is module-internal - deliberately NOT re-exported.\n} from './define';\nexport { WinstonFormatFactory } from './formats';\nexport { WinstonLoggerFactory } from './logger-factory';\nexport * from './transports';\nexport * from './logger';\n"]}
@@ -1,10 +1,10 @@
1
- import { int } from '../../../utilities/parse.utility.js';
1
+ import { ParseUtility } from '../../../utilities/parse.utility.js';
2
2
  import path from 'node:path';
3
3
  import winston from 'winston';
4
4
  import 'winston-daily-rotate-file';
5
5
  import { DgramTransport } from './transports/index.js';
6
6
  import { LOGGER_FILE_DATE_PATTERN, LOGGER_FILE_FREQUENCY, LOGGER_FILE_MAX_FILES, LOGGER_FILE_MAX_SIZE, LOGGER_FORMAT, LOGGER_PREFIX, } from './common/constants.js';
7
- import { resolveLoggerColorize, resolveLoggerLevel } from '../common/index.js';
7
+ import { LoggerConfigUtility } from '../common/index.js';
8
8
  import { WinstonFormatFactory } from './formats.js';
9
9
  /**
10
10
  * Static methods never reach a sibling through `this` - the exported names in `define.ts` are
@@ -24,7 +24,7 @@ export class WinstonLoggerFactory {
24
24
  warn: 'yellow',
25
25
  info: 'green',
26
26
  debug: 'blue',
27
- }, formatter, format = LOGGER_FORMAT, level = resolveLoggerLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }), colorize = resolveLoggerColorize() ?? true, transports: { info: infoTransportOptions, error: errorTransportOptions }, } = opts;
27
+ }, formatter, format = LOGGER_FORMAT, level = LoggerConfigUtility.resolveLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }), colorize = LoggerConfigUtility.resolveColorize() ?? true, transports: { info: infoTransportOptions, error: errorTransportOptions }, } = opts;
28
28
  const assemblyFormats = formatter ? null : WinstonFormatFactory.assembly({ format, colorize });
29
29
  const loggerFormat = formatter ?? WinstonFormatFactory.prep({ label: LOGGER_PREFIX });
30
30
  const consoleLogTransport = new winston.transports.Console({
@@ -93,7 +93,7 @@ export class WinstonLoggerFactory {
93
93
  const dgramOptions = {
94
94
  socketOptions: { type: 'udp4' },
95
95
  host: process.env.APP_ENV_LOGGER_DGRAM_HOST,
96
- port: int(process.env.APP_ENV_LOGGER_DGRAM_PORT),
96
+ port: ParseUtility.toInt({ input: process.env.APP_ENV_LOGGER_DGRAM_PORT }),
97
97
  label: process.env.APP_ENV_LOGGER_DGRAM_LABEL,
98
98
  levels: process.env.APP_ENV_LOGGER_DGRAM_LEVELS?.split(',').map((el) => el.trim()) ?? [],
99
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"logger-factory.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/logger-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,C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C,GAAG,CAAC,0BAA0B,CAAC;QAC1D,MAAM,WAAW,GACf,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE;YACpC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE;YAC/C,CAAC,CAAC,SAAS,CAAC;QAEhB,MAAM,YAAY,GAAoC;YACpD,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YAC/B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;YAC3C,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;YAChD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B;YAC7C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE;SACzF,CAAC;QAEF,OAAO;YACL,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE;YAChD,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE;SAClD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,CAAC,oBAAoB,CAAC,cAAc,KAAK,oBAAoB,CAAC,kBAAkB,CAAC;YACtF,UAAU,EAAE,oBAAoB,CAAC,8BAA8B,EAAE;SAClE,CAAC,CAAC,CAAC;IACN,CAAC;CACF","sourcesContent":["import { int } from '@/utilities/parse.utility';\nimport path from 'node:path';\nimport winston from 'winston';\nimport 'winston-daily-rotate-file';\nimport { DgramTransport } from './transports';\nimport { type ICustomLoggerOptions, type IDgramTransportOptions } from './common';\nimport {\n LOGGER_FILE_DATE_PATTERN,\n LOGGER_FILE_FREQUENCY,\n LOGGER_FILE_MAX_FILES,\n LOGGER_FILE_MAX_SIZE,\n LOGGER_FORMAT,\n LOGGER_PREFIX,\n} from './common/constants';\nimport { resolveLoggerColorize, resolveLoggerLevel, type TLoggerFormat } from '../common';\nimport { WinstonFormatFactory } from './formats';\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonLoggerFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonLoggerFactory {\n private static _defaultLogger?: winston.Logger;\n\n static defineCustomLogger(opts: ICustomLoggerOptions) {\n const {\n levels = {\n error: 0,\n emerg: 0,\n warn: 1,\n info: 2,\n debug: 3,\n },\n colors = {\n error: 'red',\n emerg: 'red',\n warn: 'yellow',\n info: 'green',\n debug: 'blue',\n },\n formatter,\n format = LOGGER_FORMAT as TLoggerFormat,\n level = resolveLoggerLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }),\n colorize = resolveLoggerColorize() ?? true,\n transports: { info: infoTransportOptions, error: errorTransportOptions },\n } = opts;\n\n const assemblyFormats = formatter ? null : WinstonFormatFactory.assembly({ format, colorize });\n const loggerFormat = formatter ?? WinstonFormatFactory.prep({ label: LOGGER_PREFIX });\n\n const consoleLogTransport = new winston.transports.Console({\n format: assemblyFormats?.console,\n });\n const transports: {\n general: Array<winston.transport>;\n exception: Array<winston.transport>;\n } = {\n general: [consoleLogTransport],\n exception: [consoleLogTransport],\n };\n\n if (infoTransportOptions.file) {\n const fileOpts = infoTransportOptions.file;\n const transport = new winston.transports.DailyRotateFile({\n frequency: fileOpts.frequency ?? LOGGER_FILE_FREQUENCY,\n maxSize: fileOpts.maxSize ?? LOGGER_FILE_MAX_SIZE,\n maxFiles: fileOpts.maxFiles ?? LOGGER_FILE_MAX_FILES,\n datePattern: fileOpts.datePattern ?? LOGGER_FILE_DATE_PATTERN,\n filename: path.join(fileOpts.folder, `/${fileOpts.prefix}-info-%DATE%.log`),\n level: 'info',\n format: assemblyFormats?.file,\n });\n\n transports.general.push(transport);\n }\n\n if (errorTransportOptions.file) {\n const fileOpts = errorTransportOptions.file;\n const transport = new winston.transports.DailyRotateFile({\n frequency: fileOpts.frequency ?? LOGGER_FILE_FREQUENCY,\n maxSize: fileOpts.maxSize ?? LOGGER_FILE_MAX_SIZE,\n maxFiles: fileOpts.maxFiles ?? LOGGER_FILE_MAX_FILES,\n datePattern: fileOpts.datePattern ?? LOGGER_FILE_DATE_PATTERN,\n filename: path.join(fileOpts.folder, `/${fileOpts.prefix}-error-%DATE%.log`),\n level: 'error',\n format: assemblyFormats?.file,\n });\n\n transports.general.push(transport);\n transports.exception.push(transport);\n }\n\n if (infoTransportOptions.dgram) {\n const transport = DgramTransport.fromPartial(infoTransportOptions.dgram);\n if (transport) {\n transports.general.push(transport);\n }\n }\n\n // Deliberate asymmetry with the file pair: error.dgram registers ONLY as an exception handler - ordinary error-level lines already ship over info.dgram's transport, and adding it to general would double-send every error line.\n if (errorTransportOptions.dgram) {\n const transport = DgramTransport.fromPartial(errorTransportOptions.dgram);\n if (transport) {\n transports.exception.push(transport);\n }\n }\n\n winston.addColors(colors);\n\n return winston.createLogger({\n levels,\n level,\n format: loggerFormat,\n exitOnError: false,\n transports: transports.general,\n exceptionHandlers: transports.exception,\n });\n }\n\n /** Default transports from `APP_ENV_LOGGER_*`, resolved at CALL time. File logging is opt-in - without `APP_ENV_LOGGER_FOLDER_PATH` no rotating file is created. */\n static resolveDefaultTransportOptions(): ICustomLoggerOptions['transports'] {\n const folderPath = process.env.APP_ENV_LOGGER_FOLDER_PATH;\n const fileOptions =\n folderPath && folderPath.trim() !== ''\n ? { folder: folderPath, prefix: LOGGER_PREFIX }\n : undefined;\n\n const dgramOptions: Partial<IDgramTransportOptions> = {\n socketOptions: { type: 'udp4' },\n host: process.env.APP_ENV_LOGGER_DGRAM_HOST,\n port: int(process.env.APP_ENV_LOGGER_DGRAM_PORT),\n label: process.env.APP_ENV_LOGGER_DGRAM_LABEL,\n levels: process.env.APP_ENV_LOGGER_DGRAM_LEVELS?.split(',').map((el) => el.trim()) ?? [],\n };\n\n return {\n info: { file: fileOptions, dgram: dgramOptions },\n error: { file: fileOptions, dgram: dgramOptions },\n };\n }\n\n /**\n * Lazy and cached - a plain module-level eager instance would build a winston logger (and read\n * env vars) at import time for every consumer of the barrel, even one that never logs through\n * the default.\n */\n static defaultLogger(): winston.Logger {\n return (WinstonLoggerFactory._defaultLogger ??= WinstonLoggerFactory.defineCustomLogger({\n transports: WinstonLoggerFactory.resolveDefaultTransportOptions(),\n }));\n }\n}\n"]}
1
+ {"version":3,"file":"logger-factory.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/logger-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAsB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAG/B,MAAM,CAAC,kBAAkB,CAAC,IAA0B;QAClD,MAAM,EACJ,MAAM,GAAG;YACP,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;SACT,EACD,MAAM,GAAG;YACP,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,MAAM;SACd,EACD,SAAS,EACT,MAAM,GAAG,aAA8B,EACvC,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IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE;SAClD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,CAAC,oBAAoB,CAAC,cAAc,KAAK,oBAAoB,CAAC,kBAAkB,CAAC;YACtF,UAAU,EAAE,oBAAoB,CAAC,8BAA8B,EAAE;SAClE,CAAC,CAAC,CAAC;IACN,CAAC;CACF","sourcesContent":["import { ParseUtility } from '@/utilities/parse.utility';\nimport path from 'node:path';\nimport winston from 'winston';\nimport 'winston-daily-rotate-file';\nimport { DgramTransport } from './transports';\nimport { type ICustomLoggerOptions, type IDgramTransportOptions } from './common';\nimport {\n LOGGER_FILE_DATE_PATTERN,\n LOGGER_FILE_FREQUENCY,\n LOGGER_FILE_MAX_FILES,\n LOGGER_FILE_MAX_SIZE,\n LOGGER_FORMAT,\n LOGGER_PREFIX,\n} from './common/constants';\nimport { LoggerConfigUtility, type TLoggerFormat } from '../common';\nimport { WinstonFormatFactory } from './formats';\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonLoggerFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonLoggerFactory {\n private static _defaultLogger?: winston.Logger;\n\n static defineCustomLogger(opts: ICustomLoggerOptions) {\n const {\n levels = {\n error: 0,\n emerg: 0,\n warn: 1,\n info: 2,\n debug: 3,\n },\n colors = {\n error: 'red',\n emerg: 'red',\n warn: 'yellow',\n info: 'green',\n debug: 'blue',\n },\n formatter,\n format = LOGGER_FORMAT as TLoggerFormat,\n level = LoggerConfigUtility.resolveLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }),\n colorize = LoggerConfigUtility.resolveColorize() ?? true,\n transports: { info: infoTransportOptions, error: errorTransportOptions },\n } = opts;\n\n const assemblyFormats = formatter ? null : WinstonFormatFactory.assembly({ format, colorize });\n const loggerFormat = formatter ?? WinstonFormatFactory.prep({ label: LOGGER_PREFIX });\n\n const consoleLogTransport = new winston.transports.Console({\n format: assemblyFormats?.console,\n });\n const transports: {\n general: Array<winston.transport>;\n exception: Array<winston.transport>;\n } = {\n general: [consoleLogTransport],\n exception: [consoleLogTransport],\n };\n\n if (infoTransportOptions.file) {\n const fileOpts = infoTransportOptions.file;\n const transport = new winston.transports.DailyRotateFile({\n frequency: fileOpts.frequency ?? LOGGER_FILE_FREQUENCY,\n maxSize: fileOpts.maxSize ?? LOGGER_FILE_MAX_SIZE,\n maxFiles: fileOpts.maxFiles ?? LOGGER_FILE_MAX_FILES,\n datePattern: fileOpts.datePattern ?? LOGGER_FILE_DATE_PATTERN,\n filename: path.join(fileOpts.folder, `/${fileOpts.prefix}-info-%DATE%.log`),\n level: 'info',\n format: assemblyFormats?.file,\n });\n\n transports.general.push(transport);\n }\n\n if (errorTransportOptions.file) {\n const fileOpts = errorTransportOptions.file;\n const transport = new winston.transports.DailyRotateFile({\n frequency: fileOpts.frequency ?? LOGGER_FILE_FREQUENCY,\n maxSize: fileOpts.maxSize ?? LOGGER_FILE_MAX_SIZE,\n maxFiles: fileOpts.maxFiles ?? LOGGER_FILE_MAX_FILES,\n datePattern: fileOpts.datePattern ?? LOGGER_FILE_DATE_PATTERN,\n filename: path.join(fileOpts.folder, `/${fileOpts.prefix}-error-%DATE%.log`),\n level: 'error',\n format: assemblyFormats?.file,\n });\n\n transports.general.push(transport);\n transports.exception.push(transport);\n }\n\n if (infoTransportOptions.dgram) {\n const transport = DgramTransport.fromPartial(infoTransportOptions.dgram);\n if (transport) {\n transports.general.push(transport);\n }\n }\n\n // Deliberate asymmetry with the file pair: error.dgram registers ONLY as an exception handler - ordinary error-level lines already ship over info.dgram's transport, and adding it to general would double-send every error line.\n if (errorTransportOptions.dgram) {\n const transport = DgramTransport.fromPartial(errorTransportOptions.dgram);\n if (transport) {\n transports.exception.push(transport);\n }\n }\n\n winston.addColors(colors);\n\n return winston.createLogger({\n levels,\n level,\n format: loggerFormat,\n exitOnError: false,\n transports: transports.general,\n exceptionHandlers: transports.exception,\n });\n }\n\n /** Default transports from `APP_ENV_LOGGER_*`, resolved at CALL time. File logging is opt-in - without `APP_ENV_LOGGER_FOLDER_PATH` no rotating file is created. */\n static resolveDefaultTransportOptions(): ICustomLoggerOptions['transports'] {\n const folderPath = process.env.APP_ENV_LOGGER_FOLDER_PATH;\n const fileOptions =\n folderPath && folderPath.trim() !== ''\n ? { folder: folderPath, prefix: LOGGER_PREFIX }\n : undefined;\n\n const dgramOptions: Partial<IDgramTransportOptions> = {\n socketOptions: { type: 'udp4' },\n host: process.env.APP_ENV_LOGGER_DGRAM_HOST,\n port: ParseUtility.toInt({ input: process.env.APP_ENV_LOGGER_DGRAM_PORT }),\n label: process.env.APP_ENV_LOGGER_DGRAM_LABEL,\n levels: process.env.APP_ENV_LOGGER_DGRAM_LEVELS?.split(',').map((el) => el.trim()) ?? [],\n };\n\n return {\n info: { file: fileOptions, dgram: dgramOptions },\n error: { file: fileOptions, dgram: dgramOptions },\n };\n }\n\n /**\n * Lazy and cached - a plain module-level eager instance would build a winston logger (and read\n * env vars) at import time for every consumer of the barrel, even one that never logs through\n * the default.\n */\n static defaultLogger(): winston.Logger {\n return (WinstonLoggerFactory._defaultLogger ??= WinstonLoggerFactory.defineCustomLogger({\n transports: WinstonLoggerFactory.resolveDefaultTransportOptions(),\n }));\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { HTTP } from '../../../common/constants/http.js';
2
- import { isEmpty } from '@venizia/ignis-inversion';
2
+ import { ObjectUtility } from '@venizia/ignis-inversion';
3
3
  import { BaseHelper } from '../../base.js';
4
4
  import { getError } from '../../error/index.js';
5
5
  export class BaseNetworkRequest extends BaseHelper {
@@ -23,7 +23,7 @@ export class BaseNetworkRequest extends BaseHelper {
23
23
  getRequestUrl(opts) {
24
24
  let baseUrl = opts?.baseUrl ?? this.baseUrl ?? '';
25
25
  const paths = opts?.paths ?? [];
26
- if (!baseUrl || isEmpty({ value: baseUrl })) {
26
+ if (!baseUrl || ObjectUtility.isEmpty({ value: baseUrl })) {
27
27
  throw getError({
28
28
  statusCode: HTTP.ResultCodes.RS_5.InternalServerError,
29
29
  message: '[getRequestUrl] Invalid configuration for third party request base url!',
@@ -1 +1 @@
1
- {"version":3,"file":"base-network-request.helper.js","sourceRoot":"","sources":["../../../../../src/modules/network/http-request/base-network-request.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C,MAAM,OAAO,kBAA8C,SAAQ,UAAU;IAI3E,YAAY,IAIX;QACC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,cAAc,CAAC,IAA8B;QAC3C,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QAEhC,MAAM,EAAE,GAAG,KAAK;aACb,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,aAAa,CAAC,IAAgD;QAC5D,IAAI,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QAEhC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC5C,MAAM,QAAQ,CAAC;gBACb,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB;gBACrD,OAAO,EAAE,yEAAyE;aACnF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9C,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC;IAC/C,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { HTTP } from '@/common/constants/http';\nimport { isEmpty } from '@venizia/ignis-inversion';\nimport { BaseHelper } from '@/modules/base';\nimport { getError } from '@/modules/error';\nimport { type TFetcherVariant } from './common';\nimport { type IFetchable, type IRequestOptions } from './fetcher/base-fetcher';\nimport { type TFetcherResponse, type TFetcherWorker } from './fetcher/common';\n\nexport class BaseNetworkRequest<T extends TFetcherVariant> extends BaseHelper {\n protected baseUrl: string;\n protected fetcher: IFetchable<T, IRequestOptions, TFetcherResponse<T>, TFetcherWorker<T>>;\n\n constructor(opts: {\n name: string;\n baseUrl?: string;\n fetcher: IFetchable<T, IRequestOptions, TFetcherResponse<T>, TFetcherWorker<T>>;\n }) {\n super({ scope: opts.name, identifier: opts.name });\n this.baseUrl = opts.baseUrl ?? '';\n this.fetcher = opts.fetcher;\n }\n\n getRequestPath(opts: { paths: Array<string> }) {\n const paths = opts?.paths ?? [];\n\n const rs = paths\n .map((path: string) => {\n if (!path.startsWith('/')) {\n path = `/${path}`;\n }\n\n return path;\n })\n .join('');\n\n return rs;\n }\n\n getRequestUrl(opts: { baseUrl?: string; paths: Array<string> }) {\n let baseUrl = opts?.baseUrl ?? this.baseUrl ?? '';\n const paths = opts?.paths ?? [];\n\n if (!baseUrl || isEmpty({ value: baseUrl })) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: '[getRequestUrl] Invalid configuration for third party request base url!',\n });\n }\n\n if (baseUrl.endsWith('/')) {\n baseUrl = baseUrl.slice(0, -1);\n }\n\n const joined = this.getRequestPath({ paths });\n return `${baseUrl ?? this.baseUrl}${joined}`;\n }\n\n getNetworkService() {\n return this.fetcher;\n }\n\n getWorker(): TFetcherWorker<T> {\n return this.fetcher.getWorker();\n }\n}\n"]}
1
+ {"version":3,"file":"base-network-request.helper.js","sourceRoot":"","sources":["../../../../../src/modules/network/http-request/base-network-request.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C,MAAM,OAAO,kBAA8C,SAAQ,UAAU;IAI3E,YAAY,IAIX;QACC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,cAAc,CAAC,IA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AClC,CAAC;CACF","sourcesContent":["import { HTTP } from '@/common/constants/http';\nimport { ObjectUtility } from '@venizia/ignis-inversion';\nimport { BaseHelper } from '@/modules/base';\nimport { getError } from '@/modules/error';\nimport { type TFetcherVariant } from './common';\nimport { type IFetchable, type IRequestOptions } from './fetcher/base-fetcher';\nimport { type TFetcherResponse, type TFetcherWorker } from './fetcher/common';\n\nexport class BaseNetworkRequest<T extends TFetcherVariant> extends BaseHelper {\n protected baseUrl: string;\n protected fetcher: IFetchable<T, IRequestOptions, TFetcherResponse<T>, TFetcherWorker<T>>;\n\n constructor(opts: {\n name: string;\n baseUrl?: string;\n fetcher: IFetchable<T, IRequestOptions, TFetcherResponse<T>, TFetcherWorker<T>>;\n }) {\n super({ scope: opts.name, identifier: opts.name });\n this.baseUrl = opts.baseUrl ?? '';\n this.fetcher = opts.fetcher;\n }\n\n getRequestPath(opts: { paths: Array<string> }) {\n const paths = opts?.paths ?? [];\n\n const rs = paths\n .map((path: string) => {\n if (!path.startsWith('/')) {\n path = `/${path}`;\n }\n\n return path;\n })\n .join('');\n\n return rs;\n }\n\n getRequestUrl(opts: { baseUrl?: string; paths: Array<string> }) {\n let baseUrl = opts?.baseUrl ?? this.baseUrl ?? '';\n const paths = opts?.paths ?? [];\n\n if (!baseUrl || ObjectUtility.isEmpty({ value: baseUrl })) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: '[getRequestUrl] Invalid configuration for third party request base url!',\n });\n }\n\n if (baseUrl.endsWith('/')) {\n baseUrl = baseUrl.slice(0, -1);\n }\n\n const joined = this.getRequestPath({ paths });\n return `${baseUrl ?? this.baseUrl}${joined}`;\n }\n\n getNetworkService() {\n return this.fetcher;\n }\n\n getWorker(): TFetcherWorker<T> {\n return this.fetcher.getWorker();\n }\n}\n"]}
@@ -1,3 +1,2 @@
1
1
  export * from './constants.js';
2
- export * from './types.js';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from './constants.js';
2
- export * from './types.js';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC","sourcesContent":["export * from './constants';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"axios-fetcher.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/axios-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAElE,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtF,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB,EAAE,eAAe;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,YAAa,SAAQ,8BAA8B,CAC9D,OAAO,EACP,oBAAoB,EAGpB,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAC/B,aAAa,CACd;IACC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;gBAE7B,IAAI,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,kBAAkB,CAAC;QACnC,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;WAIG;QACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;IAaQ,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,OAAO;CA2BpE;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QACpD,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,qBAAa,mBAAoB,SAAQ,kBAAkB,CAAC,OAAO,CAAC;gBACtD,IAAI,EAAE,2BAA2B;CAwB9C"}
1
+ {"version":3,"file":"axios-fetcher.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/axios-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAElE,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtF,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB,EAAE,eAAe;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,YAAa,SAAQ,8BAA8B,CAC9D,OAAO,EACP,oBAAoB,EAGpB,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAC/B,aAAa,CACd;IACC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;gBAE7B,IAAI,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,kBAAkB,CAAC;QACnC,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;WAIG;QACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B;IAaQ,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,OAAO;CA6BpE;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QACpD,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,qBAAa,mBAAoB,SAAQ,kBAAkB,CAAC,OAAO,CAAC;gBACtD,IAAI,EAAE,2BAA2B;CAwB9C"}
@@ -1,5 +1,5 @@
1
1
  import { HTTP } from '../../../../common/index.js';
2
- import { redactSecrets } from '../../../../common/redact.js';
2
+ import { RedactUtility } from '../../../../common/redact.js';
3
3
  import axios from 'axios';
4
4
  import https from 'node:https';
5
5
  import { stringify } from 'node:querystring';
@@ -38,7 +38,9 @@ export class AxiosFetcher extends AbstractNetworkFetchableHelper {
38
38
  ? this.httpsAgent
39
39
  : new https.Agent({ keepAlive: true, rejectUnauthorized: opts.rejectUnauthorized }));
40
40
  }
41
- logger?.for(this.send.name).info('URL: %s | Props: %s', url, redactSecrets(props));
41
+ logger
42
+ ?.for(this.send.name)
43
+ .info('URL: %s | Props: %s', url, RedactUtility.redactSecrets({ value: props }));
42
44
  return this.worker.request(props);
43
45
  }
44
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"axios-fetcher.js","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/axios-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAoB,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAA0E,MAAM,OAAO,CAAC;AAC/F,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,8BAA8B,EAAwB,MAAM,gBAAgB,CAAC;AAgBtF,MAAM,OAAO,YAAa,SAAQ,8BAOjC;IASC,YAAY,IAUX;QACC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAChC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,wDAAwD,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAExF,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;YAChC,SAAS,EAAE,IAAI;YACf,kBAAkB,EAAE,IAAI,CAAC,k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AAC,OAAO,CAAI,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AASD,MAAM,OAAO,mBAAoB,SAAQ,kBAA2B;IAClE,YAAY,IAAiC;QAC3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,CAAC;QAE9D,MAAM,aAAa,GAAc;YAC/B,CAAC,cAAc,CAAC,EAAE,iCAAiC;YACnD,GAAG,OAAO;SACX,CAAC;QAEF,MAAM,cAAc,GAAuB;YACzC,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,GAAG,GAAG;YAChD,OAAO,EAAE,OAAO,IAAI,EAAE,GAAG,IAAI;YAC7B,GAAG,IAAI;YACP,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,KAAK,CAAC;YACJ,IAAI;YACJ,OAAO;YACP,OAAO,EAAE,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { type AnyObject, HTTP, type THttpMethod } from '@/common';\nimport { redactSecrets } from '@/common/redact';\nimport axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from 'axios';\nimport https from 'node:https';\nimport { stringify } from 'node:querystring';\nimport { BaseNetworkRequest } from '../base-network-request.helper';\nimport type { ILogger } from '@/modules/logger/common/types';\nimport { AbstractNetworkFetchableHelper, type IRequestOptions } from './base-fetcher';\n\nexport interface IAxiosRequestOptions extends AxiosRequestConfig, IRequestOptions {\n url: string;\n method?: THttpMethod;\n params?: AnyObject;\n body?: AnyObject;\n headers?: AnyObject;\n /**\n * Declared so the opt-out is TYPED. It used to reach the agent only through the\n * `[extra: string]: any` index signature on {@link IRequestOptions}, which meant nothing told a\n * caller the option existed, and nothing stopped a typo from silently doing nothing.\n */\n rejectUnauthorized?: boolean;\n}\n\nexport class AxiosFetcher extends AbstractNetworkFetchableHelper<\n 'axios',\n IAxiosRequestOptions,\n // The named type, not the `axios.` NAMESPACE: the namespace form resolves only under node16\n // module resolution, and this package also emits an ESM build under `bundler` resolution.\n AxiosResponse<any, any>['data'],\n AxiosInstance\n> {\n /**\n * One agent for the instance, not one per request. Built here so TLS verification is decided\n * ONCE, at construction, rather than per call - and so connections are actually reused: a fresh\n * agent per request forces a new TCP and TLS handshake every time (measured: 10 handshakes for 10\n * requests, versus 1).\n */\n private readonly httpsAgent: https.Agent;\n\n constructor(opts: {\n name: string;\n defaultConfigs: AxiosRequestConfig;\n logger?: ILogger;\n /**\n * Turns OFF certificate verification for this instance. Node's own default is `true` and so is\n * this one; the previous code defaulted it to `false`, which silently accepted any certificate\n * on every HTTPS request the framework made.\n */\n rejectUnauthorized?: boolean;\n }) {\n super({ name: opts.name, variant: 'axios' });\n const { defaultConfigs } = opts;\n opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);\n\n this.httpsAgent = new https.Agent({\n keepAlive: true,\n rejectUnauthorized: opts.rejectUnauthorized ?? true,\n });\n\n this.worker = axios.create({ ...defaultConfigs });\n }\n\n override send<T = any>(opts: IAxiosRequestOptions, logger?: ILogger) {\n const { url, method = HTTP.Methods.GET, params = {}, body: data, headers, ...rest } = opts;\n const props: AxiosRequestConfig = {\n url,\n method: method.toUpperCase(),\n params,\n data,\n headers,\n paramsSerializer: { serialize: (p) => stringify(p) },\n ...rest,\n };\n\n const protocol = this.getProtocol(url);\n if (protocol === HTTP.Protocols.HTTPS) {\n // A caller's own agent WINS. The previous code assigned after the `...rest` spread, so a\n // hardened agent - custom CA, pinning, mTLS - was overwritten and the secure path was\n // unreachable through the public seam.\n props.httpsAgent =\n rest.httpsAgent ??\n (opts.rejectUnauthorized === undefined\n ? this.httpsAgent\n : new https.Agent({ keepAlive: true, rejectUnauthorized: opts.rejectUnauthorized }));\n }\n\n logger?.for(this.send.name).info('URL: %s | Props: %s', url, redactSecrets(props));\n return this.worker.request<T>(props);\n }\n}\n\nexport interface IAxiosNetworkRequestOptions {\n name: string;\n networkOptions: Omit<AxiosRequestConfig, 'baseURL'> & {\n baseUrl?: string;\n };\n}\n\nexport class AxiosNetworkRequest extends BaseNetworkRequest<'axios'> {\n constructor(opts: IAxiosNetworkRequestOptions) {\n const { name, networkOptions } = opts;\n const { headers, baseUrl, timeout, ...rest } = networkOptions;\n\n const mergedHeaders: AnyObject = {\n ['content-type']: 'application/json; charset=utf-8',\n ...headers,\n };\n\n const defaultConfigs: AxiosRequestConfig = {\n withCredentials: true,\n validateStatus: (status: number) => status < 500,\n timeout: timeout ?? 60 * 1000,\n ...rest,\n baseURL: baseUrl,\n headers: mergedHeaders,\n };\n\n super({\n name,\n baseUrl,\n fetcher: new AxiosFetcher({ name, defaultConfigs }),\n });\n }\n}\n"]}
1
+ {"version":3,"file":"axios-fetcher.js","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/axios-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAoB,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAA0E,MAAM,OAAO,CAAC;AAC/F,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,8BAA8B,EAAwB,MAAM,gBAAgB,CAAC;AAgBtF,MAAM,OAAO,YAAa,SAAQ,8BAOjC;IASC,YAAY,IAUX;QACC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAChC,IAAI,EAAE,MAAM,EAAE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ED,MAAM;YACJ,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;aACpB,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAI,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AASD,MAAM,OAAO,mBAAoB,SAAQ,kBAA2B;IAClE,YAAY,IAAiC;QAC3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,CAAC;QAE9D,MAAM,aAAa,GAAc;YAC/B,CAAC,cAAc,CAAC,EAAE,iCAAiC;YACnD,GAAG,OAAO;SACX,CAAC;QAEF,MAAM,cAAc,GAAuB;YACzC,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,GAAG,GAAG;YAChD,OAAO,EAAE,OAAO,IAAI,EAAE,GAAG,IAAI;YAC7B,GAAG,IAAI;YACP,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,KAAK,CAAC;YACJ,IAAI;YACJ,OAAO;YACP,OAAO,EAAE,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { type AnyObject, HTTP, type THttpMethod } from '@/common';\nimport { RedactUtility } from '@/common/redact';\nimport axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from 'axios';\nimport https from 'node:https';\nimport { stringify } from 'node:querystring';\nimport { BaseNetworkRequest } from '../base-network-request.helper';\nimport type { ILogger } from '@/modules/logger/common/types';\nimport { AbstractNetworkFetchableHelper, type IRequestOptions } from './base-fetcher';\n\nexport interface IAxiosRequestOptions extends AxiosRequestConfig, IRequestOptions {\n url: string;\n method?: THttpMethod;\n params?: AnyObject;\n body?: AnyObject;\n headers?: AnyObject;\n /**\n * Declared so the opt-out is TYPED. It used to reach the agent only through the\n * `[extra: string]: any` index signature on {@link IRequestOptions}, which meant nothing told a\n * caller the option existed, and nothing stopped a typo from silently doing nothing.\n */\n rejectUnauthorized?: boolean;\n}\n\nexport class AxiosFetcher extends AbstractNetworkFetchableHelper<\n 'axios',\n IAxiosRequestOptions,\n // The named type, not the `axios.` NAMESPACE: the namespace form resolves only under node16\n // module resolution, and this package also emits an ESM build under `bundler` resolution.\n AxiosResponse<any, any>['data'],\n AxiosInstance\n> {\n /**\n * One agent for the instance, not one per request. Built here so TLS verification is decided\n * ONCE, at construction, rather than per call - and so connections are actually reused: a fresh\n * agent per request forces a new TCP and TLS handshake every time (measured: 10 handshakes for 10\n * requests, versus 1).\n */\n private readonly httpsAgent: https.Agent;\n\n constructor(opts: {\n name: string;\n defaultConfigs: AxiosRequestConfig;\n logger?: ILogger;\n /**\n * Turns OFF certificate verification for this instance. Node's own default is `true` and so is\n * this one; the previous code defaulted it to `false`, which silently accepted any certificate\n * on every HTTPS request the framework made.\n */\n rejectUnauthorized?: boolean;\n }) {\n super({ name: opts.name, variant: 'axios' });\n const { defaultConfigs } = opts;\n opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);\n\n this.httpsAgent = new https.Agent({\n keepAlive: true,\n rejectUnauthorized: opts.rejectUnauthorized ?? true,\n });\n\n this.worker = axios.create({ ...defaultConfigs });\n }\n\n override send<T = any>(opts: IAxiosRequestOptions, logger?: ILogger) {\n const { url, method = HTTP.Methods.GET, params = {}, body: data, headers, ...rest } = opts;\n const props: AxiosRequestConfig = {\n url,\n method: method.toUpperCase(),\n params,\n data,\n headers,\n paramsSerializer: { serialize: (p) => stringify(p) },\n ...rest,\n };\n\n const protocol = this.getProtocol(url);\n if (protocol === HTTP.Protocols.HTTPS) {\n // A caller's own agent WINS. The previous code assigned after the `...rest` spread, so a\n // hardened agent - custom CA, pinning, mTLS - was overwritten and the secure path was\n // unreachable through the public seam.\n props.httpsAgent =\n rest.httpsAgent ??\n (opts.rejectUnauthorized === undefined\n ? this.httpsAgent\n : new https.Agent({ keepAlive: true, rejectUnauthorized: opts.rejectUnauthorized }));\n }\n\n logger\n ?.for(this.send.name)\n .info('URL: %s | Props: %s', url, RedactUtility.redactSecrets({ value: props }));\n return this.worker.request<T>(props);\n }\n}\n\nexport interface IAxiosNetworkRequestOptions {\n name: string;\n networkOptions: Omit<AxiosRequestConfig, 'baseURL'> & {\n baseUrl?: string;\n };\n}\n\nexport class AxiosNetworkRequest extends BaseNetworkRequest<'axios'> {\n constructor(opts: IAxiosNetworkRequestOptions) {\n const { name, networkOptions } = opts;\n const { headers, baseUrl, timeout, ...rest } = networkOptions;\n\n const mergedHeaders: AnyObject = {\n ['content-type']: 'application/json; charset=utf-8',\n ...headers,\n };\n\n const defaultConfigs: AxiosRequestConfig = {\n withCredentials: true,\n validateStatus: (status: number) => status < 500,\n timeout: timeout ?? 60 * 1000,\n ...rest,\n baseURL: baseUrl,\n headers: mergedHeaders,\n };\n\n super({\n name,\n baseUrl,\n fetcher: new AxiosFetcher({ name, defaultConfigs }),\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-fetcher.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/node-fetcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,8BAA8B,EAC9B,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAyB,SAAQ,WAAW,EAAE,eAAe;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAcD,qBAAa,WAAY,SAAQ,8BAA8B,CAC7D,YAAY,EACZ,wBAAwB,EACxB,OAAO,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,EACjC,OAAO,KAAK,CACb;IACC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,WAAW,CAAsB;gBAE7B,IAAI,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,WAAW,CAAC;QAC5B,oFAAoF;QACpF,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAClC,MAAM,CAAC,EAAE,cAAc,CAAC;KACzB;IAUD,oGAAoG;IACpG,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS;IAUlE,IAAI,CAAC,IAAI,EAAE,wBAAwB,EAAE,MAAM,CAAC,EAAE,cAAc;CA6E5E;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,WAAW,GAAG;QAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,mGAAmG;QACnG,WAAW,CAAC,EAAE,mBAAmB,CAAC;KACnC,CAAC;CACH;AAED,qBAAa,uBAAwB,SAAQ,kBAAkB,CAAC,YAAY,CAAC;gBAC/D,IAAI,EAAE,+BAA+B;CAsBlD"}
1
+ {"version":3,"file":"node-fetcher.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/node-fetcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,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,+BAA+B;CAsBlD"}
@@ -1,6 +1,6 @@
1
- import { redactSecrets } from '../../../../common/redact.js';
1
+ import { RedactUtility } from '../../../../common/redact.js';
2
2
  import { HTTP } from '../../../../common/constants/http.js';
3
- import { QueryStringSeparators, toQueryString, } from '../../utilities/query-string.js';
3
+ import { QueryStringSeparators, QueryStringUtility, } from '../../utilities/query-string.js';
4
4
  import { BaseNetworkRequest } from '../base-network-request.helper.js';
5
5
  import { AbstractNetworkFetchableHelper, } from './base-fetcher.js';
6
6
  /** What `fetch` takes as a body as it is: encoding any of these again would change the bytes sent. A constructor is looked up on `globalThis` so a runtime without one (no `FormData`) just never matches it. */
@@ -55,7 +55,9 @@ export class NodeFetcher extends AbstractNetworkFetchableHelper {
55
55
  signal: effectiveSignal,
56
56
  };
57
57
  // `?` only when the url carries no query string of its own - a second `?` is not a separator, so the server would read the previous parameter's value as `1?extra=2`.
58
- const serializedParams = params ? toQueryString({ params, ...this.queryString }) : '';
58
+ const serializedParams = params
59
+ ? QueryStringUtility.toQueryString({ params, ...this.queryString })
60
+ : '';
59
61
  const requestUrl = serializedParams
60
62
  ? `${url}${url.includes(QueryStringSeparators.START) ? QueryStringSeparators.PAIR : QueryStringSeparators.START}${serializedParams}`
61
63
  : url;
@@ -73,7 +75,7 @@ export class NodeFetcher extends AbstractNetworkFetchableHelper {
73
75
  headers: requestConfigs.headers,
74
76
  };
75
77
  // Straight on the logger it was handed, never `logger.for(...)`: a host logger may carry only `debug` and `info`. With none handed, nothing is logged - no default logger is built, so a browser never reaches the node-only provider.
76
- logger?.debug('[%s] URL: %s | Props: %s | Timeout: %s', this.send.name, url, redactSecrets(loggableConfigs), timeout);
78
+ logger?.debug('[%s] URL: %s | Props: %s | Timeout: %s', this.send.name, url, RedactUtility.redactSecrets({ value: loggableConfigs }), timeout);
77
79
  try {
78
80
  const rs = await fetch(requestUrl, requestConfigs);
79
81
  return rs;
@@ -1 +1 @@
1
- {"version":3,"file":"node-fetcher.js","sourceRoot":"","sources":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C;YACT,IAAI,SAAS,EAAE,CAAC;gBACd,YAAY,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAWD,MAAM,OAAO,uBAAwB,SAAQ,kBAAgC;IAC3E,YAAY,IAAqC;QAC/C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,CAAC;QAElE,MAAM,WAAW,GACf,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/E,MAAM,aAAa,GAAc;YAC/B,CAAC,cAAc,CAAC,EAAE,iCAAiC;YACnD,GAAG,WAAW;SACf,CAAC;QAEF,MAAM,cAAc,GAAyB;YAC3C,GAAG,IAAI;YACP,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,KAAK,CAAC;YACJ,IAAI;YACJ,OAAO;YACP,OAAO,EAAE,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;SAChE,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { redactSecrets } from '@/common/redact';\nimport { HTTP, type THttpMethod } from '@/common/constants/http';\nimport { type AnyObject } from '@/common/types';\nimport {\n type IQueryStringOptions,\n QueryStringSeparators,\n toQueryString,\n} from '../../utilities/query-string';\n\nimport { BaseNetworkRequest } from '../base-network-request.helper';\nimport {\n AbstractNetworkFetchableHelper,\n type IRequestOptions,\n type TFetcherLogger,\n} from './base-fetcher';\n\nexport interface INodeFetchRequestOptions extends RequestInit, IRequestOptions {\n url: string;\n method?: THttpMethod;\n params?: AnyObject;\n}\n\n/** What `fetch` takes as a body as it is: encoding any of these again would change the bytes sent. A constructor is looked up on `globalThis` so a runtime without one (no `FormData`) just never matches it. */\nconst isRawBody = (body: unknown): boolean => {\n if (typeof body === 'string' || ArrayBuffer.isView(body) || body instanceof ArrayBuffer) {\n return true;\n }\n\n return ['Blob', 'FormData', 'URLSearchParams', 'ReadableStream'].some((name) => {\n const ctor = Reflect.get(globalThis, name);\n return typeof ctor === 'function' && body instanceof ctor;\n });\n};\n\nexport class NodeFetcher extends AbstractNetworkFetchableHelper<\n 'node-fetch',\n INodeFetchRequestOptions,\n Awaited<ReturnType<typeof fetch>>,\n typeof fetch\n> {\n private defaultConfigs: RequestInit;\n private queryString: IQueryStringOptions;\n\n constructor(opts: {\n name: string;\n defaultConfigs: RequestInit;\n /** How `params` are written into the url; the defaults are `node:querystring`'s. */\n queryString?: IQueryStringOptions;\n logger?: TFetcherLogger;\n }) {\n super({ name: opts.name, variant: 'node-fetch', worker: fetch });\n const { name, defaultConfigs } = opts;\n this.name = name;\n opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);\n\n this.defaultConfigs = defaultConfigs;\n this.queryString = opts.queryString ?? {};\n }\n\n /** A raw body passes through; a plain object or an array is JSON-encoded; no body stays no body. */\n protected serializeBody(opts: { body: unknown }): RequestInit['body'] | undefined {\n const { body } = opts;\n\n if (body === undefined || body === null) {\n return undefined;\n }\n\n return isRawBody(body) ? (body as RequestInit['body']) : JSON.stringify(body);\n }\n\n override async send(opts: INodeFetchRequestOptions, logger?: TFetcherLogger) {\n const {\n url,\n method = HTTP.Methods.GET,\n params,\n body,\n headers,\n timeout,\n signal,\n ...rest\n } = opts;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let timeoutController: AbortController | undefined;\n let effectiveSignal = signal;\n\n if (timeout) {\n timeoutController = new AbortController();\n timeoutId = setTimeout(() => {\n timeoutController?.abort();\n }, timeout);\n\n // Composed, never substituted: a timeout must not silently swallow the caller's own signal, or the caller would believe it cancelled a request that is in fact still running. Either source - and a signal already aborted before the call - aborts the request.\n effectiveSignal = signal\n ? AbortSignal.any([signal, timeoutController.signal])\n : timeoutController.signal;\n }\n\n const requestConfigs: RequestInit = {\n ...this.defaultConfigs,\n ...rest,\n method: method.toUpperCase(),\n body: this.serializeBody({ body }),\n // The call's headers REPLACE the defaults (a caller that sends a multipart body leaves the content type out so `fetch` can write the boundary); a call with none keeps them. Spreading an absent `headers` over the config used to erase the defaults.\n headers: headers ?? this.defaultConfigs.headers,\n signal: effectiveSignal,\n };\n\n // `?` only when the url carries no query string of its own - a second `?` is not a separator, so the server would read the previous parameter's value as `1?extra=2`.\n const serializedParams = params ? toQueryString({ params, ...this.queryString }) : '';\n const requestUrl = serializedParams\n ? `${url}${url.includes(QueryStringSeparators.START) ? QueryStringSeparators.PAIR : QueryStringSeparators.START}${serializedParams}`\n : url;\n\n // The body is NEVER logged, only its size. `fetch` bodies are strings, and `redactSecrets` walks\n // object keys - so a JSON credential payload passed straight through as a string was printed in\n // full, with no key for the redactor to match on. Headers are normalised through `Headers` first\n // because the `string[][]` form is a list of tuples, which key matching cannot see either.\n const loggableConfigs = {\n ...requestConfigs,\n body:\n typeof requestConfigs.body === 'string'\n ? `[body ${requestConfigs.body.length} chars]`\n : requestConfigs.body\n ? '[body]'\n : undefined,\n headers: requestConfigs.headers,\n };\n\n // Straight on the logger it was handed, never `logger.for(...)`: a host logger may carry only `debug` and `info`. With none handed, nothing is logged - no default logger is built, so a browser never reaches the node-only provider.\n logger?.debug(\n '[%s] URL: %s | Props: %s | Timeout: %s',\n this.send.name,\n url,\n redactSecrets(loggableConfigs),\n timeout,\n );\n\n try {\n const rs = await fetch(requestUrl, requestConfigs);\n return rs;\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n }\n}\n\nexport interface INodeFetchNetworkRequestOptions {\n name: string;\n networkOptions: RequestInit & {\n baseUrl?: string;\n /** How `params` are written into every url this request sends; see {@link IQueryStringOptions}. */\n queryString?: IQueryStringOptions;\n };\n}\n\nexport class NodeFetchNetworkRequest extends BaseNetworkRequest<'node-fetch'> {\n constructor(opts: INodeFetchNetworkRequestOptions) {\n const { name, networkOptions } = opts;\n const { headers, baseUrl, queryString, ...rest } = networkOptions;\n\n const userHeaders =\n headers instanceof Headers ? Object.fromEntries(headers.entries()) : headers;\n const mergedHeaders: AnyObject = {\n ['content-type']: 'application/json; charset=utf-8',\n ...userHeaders,\n };\n\n const defaultConfigs: Partial<RequestInit> = {\n ...rest,\n headers: mergedHeaders,\n };\n\n super({\n name,\n baseUrl,\n fetcher: new NodeFetcher({ name, defaultConfigs, queryString }),\n });\n }\n}\n"]}
1
+ {"version":3,"file":"node-fetcher.js","sourceRoot":"","sources":["../../../../../../src/modules/network/http-request/fetcher/node-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAoB,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,8BAA8B,GAG/B,MAAM,gBAAgB,CAAC;AAQxB,iNAAiN;AACjN,MAAM,SAAS,GAAG,CAAC,IAAa,EAAW,EAAE;IAC3C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC3C,OAAO,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,YAAY,IAAI,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,OAAO,WAAY,SAAQ,8B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nimport { HTTP, type THttpMethod } from '@/common/constants/http';\nimport { type AnyObject } from '@/common/types';\nimport {\n type IQueryStringOptions,\n QueryStringSeparators,\n QueryStringUtility,\n} from '../../utilities/query-string';\n\nimport { BaseNetworkRequest } from '../base-network-request.helper';\nimport {\n AbstractNetworkFetchableHelper,\n type IRequestOptions,\n type TFetcherLogger,\n} from './base-fetcher';\n\nexport interface INodeFetchRequestOptions extends RequestInit, IRequestOptions {\n url: string;\n method?: THttpMethod;\n params?: AnyObject;\n}\n\n/** What `fetch` takes as a body as it is: encoding any of these again would change the bytes sent. A constructor is looked up on `globalThis` so a runtime without one (no `FormData`) just never matches it. */\nconst isRawBody = (body: unknown): boolean => {\n if (typeof body === 'string' || ArrayBuffer.isView(body) || body instanceof ArrayBuffer) {\n return true;\n }\n\n return ['Blob', 'FormData', 'URLSearchParams', 'ReadableStream'].some((name) => {\n const ctor = Reflect.get(globalThis, name);\n return typeof ctor === 'function' && body instanceof ctor;\n });\n};\n\nexport class NodeFetcher extends AbstractNetworkFetchableHelper<\n 'node-fetch',\n INodeFetchRequestOptions,\n Awaited<ReturnType<typeof fetch>>,\n typeof fetch\n> {\n private defaultConfigs: RequestInit;\n private queryString: IQueryStringOptions;\n\n constructor(opts: {\n name: string;\n defaultConfigs: RequestInit;\n /** How `params` are written into the url; the defaults are `node:querystring`'s. */\n queryString?: IQueryStringOptions;\n logger?: TFetcherLogger;\n }) {\n super({ name: opts.name, variant: 'node-fetch', worker: fetch });\n const { name, defaultConfigs } = opts;\n this.name = name;\n opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);\n\n this.defaultConfigs = defaultConfigs;\n this.queryString = opts.queryString ?? {};\n }\n\n /** A raw body passes through; a plain object or an array is JSON-encoded; no body stays no body. */\n protected serializeBody(opts: { body: unknown }): RequestInit['body'] | undefined {\n const { body } = opts;\n\n if (body === undefined || body === null) {\n return undefined;\n }\n\n return isRawBody(body) ? (body as RequestInit['body']) : JSON.stringify(body);\n }\n\n override async send(opts: INodeFetchRequestOptions, logger?: TFetcherLogger) {\n const {\n url,\n method = HTTP.Methods.GET,\n params,\n body,\n headers,\n timeout,\n signal,\n ...rest\n } = opts;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let timeoutController: AbortController | undefined;\n let effectiveSignal = signal;\n\n if (timeout) {\n timeoutController = new AbortController();\n timeoutId = setTimeout(() => {\n timeoutController?.abort();\n }, timeout);\n\n // Composed, never substituted: a timeout must not silently swallow the caller's own signal, or the caller would believe it cancelled a request that is in fact still running. Either source - and a signal already aborted before the call - aborts the request.\n effectiveSignal = signal\n ? AbortSignal.any([signal, timeoutController.signal])\n : timeoutController.signal;\n }\n\n const requestConfigs: RequestInit = {\n ...this.defaultConfigs,\n ...rest,\n method: method.toUpperCase(),\n body: this.serializeBody({ body }),\n // The call's headers REPLACE the defaults (a caller that sends a multipart body leaves the content type out so `fetch` can write the boundary); a call with none keeps them. Spreading an absent `headers` over the config used to erase the defaults.\n headers: headers ?? this.defaultConfigs.headers,\n signal: effectiveSignal,\n };\n\n // `?` only when the url carries no query string of its own - a second `?` is not a separator, so the server would read the previous parameter's value as `1?extra=2`.\n const serializedParams = params\n ? QueryStringUtility.toQueryString({ params, ...this.queryString })\n : '';\n const requestUrl = serializedParams\n ? `${url}${url.includes(QueryStringSeparators.START) ? QueryStringSeparators.PAIR : QueryStringSeparators.START}${serializedParams}`\n : url;\n\n // The body is NEVER logged, only its size. `fetch` bodies are strings, and `redactSecrets` walks\n // object keys - so a JSON credential payload passed straight through as a string was printed in\n // full, with no key for the redactor to match on. Headers are normalised through `Headers` first\n // because the `string[][]` form is a list of tuples, which key matching cannot see either.\n const loggableConfigs = {\n ...requestConfigs,\n body:\n typeof requestConfigs.body === 'string'\n ? `[body ${requestConfigs.body.length} chars]`\n : requestConfigs.body\n ? '[body]'\n : undefined,\n headers: requestConfigs.headers,\n };\n\n // Straight on the logger it was handed, never `logger.for(...)`: a host logger may carry only `debug` and `info`. With none handed, nothing is logged - no default logger is built, so a browser never reaches the node-only provider.\n logger?.debug(\n '[%s] URL: %s | Props: %s | Timeout: %s',\n this.send.name,\n url,\n RedactUtility.redactSecrets({ value: loggableConfigs }),\n timeout,\n );\n\n try {\n const rs = await fetch(requestUrl, requestConfigs);\n return rs;\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n }\n}\n\nexport interface INodeFetchNetworkRequestOptions {\n name: string;\n networkOptions: RequestInit & {\n baseUrl?: string;\n /** How `params` are written into every url this request sends; see {@link IQueryStringOptions}. */\n queryString?: IQueryStringOptions;\n };\n}\n\nexport class NodeFetchNetworkRequest extends BaseNetworkRequest<'node-fetch'> {\n constructor(opts: INodeFetchNetworkRequestOptions) {\n const { name, networkOptions } = opts;\n const { headers, baseUrl, queryString, ...rest } = networkOptions;\n\n const userHeaders =\n headers instanceof Headers ? Object.fromEntries(headers.entries()) : headers;\n const mergedHeaders: AnyObject = {\n ['content-type']: 'application/json; charset=utf-8',\n ...userHeaders,\n };\n\n const defaultConfigs: Partial<RequestInit> = {\n ...rest,\n headers: mergedHeaders,\n };\n\n super({\n name,\n baseUrl,\n fetcher: new NodeFetcher({ name, defaultConfigs, queryString }),\n });\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { isEmpty } from '@venizia/ignis-inversion';
2
- import { redactSecrets } from '../../../common/redact.js';
1
+ import { ObjectUtility } from '@venizia/ignis-inversion';
2
+ import { RedactUtility } from '../../../common/redact.js';
3
3
  import { BaseHelper } from '../../base.js';
4
4
  const DEFAULT_MAX_RETRY = 5;
5
5
  export class BaseNetworkTcpClient extends BaseHelper {
@@ -30,7 +30,7 @@ export class BaseNetworkTcpClient extends BaseHelper {
30
30
  }
31
31
  /** Redacts before logging - a TLS client's options ARE its private key (`key`/`cert`/`passphrase`). */
32
32
  getLoggableOptions() {
33
- return redactSecrets(this.options);
33
+ return RedactUtility.redactSecrets({ value: this.options });
34
34
  }
35
35
  handleConnected() {
36
36
  this.logger
@@ -75,7 +75,7 @@ export class BaseNetworkTcpClient extends BaseHelper {
75
75
  .info('[%s] NetworkTcpClient is already initialized!', this.identifier);
76
76
  return;
77
77
  }
78
- if (isEmpty({ value: this.options })) {
78
+ if (ObjectUtility.isEmpty({ value: this.options })) {
79
79
  this.logger
80
80
  .for(this.connect.name)
81
81
  .info('[%s] Cannot init TCP Client with null options', this.identifier);