@bgord/bun 1.21.11 → 1.22.0

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 (303) hide show
  1. package/dist/alert-channel-composite.adapter.d.ts.map +1 -1
  2. package/dist/alert-channel-composite.adapter.js +1 -0
  3. package/dist/alert-channel-composite.adapter.js.map +1 -1
  4. package/dist/api-version.middleware.d.ts +1 -0
  5. package/dist/api-version.middleware.d.ts.map +1 -1
  6. package/dist/api-version.middleware.js +3 -1
  7. package/dist/api-version.middleware.js.map +1 -1
  8. package/dist/cache-codec-identity.strategy.d.ts +7 -0
  9. package/dist/cache-codec-identity.strategy.d.ts.map +1 -0
  10. package/dist/cache-codec-identity.strategy.js +9 -0
  11. package/dist/cache-codec-identity.strategy.js.map +1 -0
  12. package/dist/cache-codec-sitemap-entries.strategy.d.ts +11 -0
  13. package/dist/cache-codec-sitemap-entries.strategy.d.ts.map +1 -0
  14. package/dist/cache-codec-sitemap-entries.strategy.js +13 -0
  15. package/dist/cache-codec-sitemap-entries.strategy.js.map +1 -0
  16. package/dist/cache-codec.strategy.d.ts +6 -0
  17. package/dist/cache-codec.strategy.d.ts.map +1 -0
  18. package/dist/cache-codec.strategy.js +2 -0
  19. package/dist/cache-codec.strategy.js.map +1 -0
  20. package/dist/cache-repository-node-cache.adapter.d.ts +3 -2
  21. package/dist/cache-repository-node-cache.adapter.d.ts.map +1 -1
  22. package/dist/cache-repository-node-cache.adapter.js +6 -4
  23. package/dist/cache-repository-node-cache.adapter.js.map +1 -1
  24. package/dist/cache-repository-noop.adapter.d.ts +3 -2
  25. package/dist/cache-repository-noop.adapter.d.ts.map +1 -1
  26. package/dist/cache-repository-noop.adapter.js.map +1 -1
  27. package/dist/cache-repository-redis.adapter.d.ts +3 -2
  28. package/dist/cache-repository-redis.adapter.d.ts.map +1 -1
  29. package/dist/cache-repository-redis.adapter.js +8 -5
  30. package/dist/cache-repository-redis.adapter.js.map +1 -1
  31. package/dist/cache-repository.port.d.ts +3 -2
  32. package/dist/cache-repository.port.d.ts.map +1 -1
  33. package/dist/cache-resolver-noop.strategy.d.ts +8 -0
  34. package/dist/cache-resolver-noop.strategy.d.ts.map +1 -0
  35. package/dist/cache-resolver-noop.strategy.js +7 -0
  36. package/dist/cache-resolver-noop.strategy.js.map +1 -0
  37. package/dist/cache-resolver-read-through.strategy.d.ts +15 -0
  38. package/dist/cache-resolver-read-through.strategy.d.ts.map +1 -0
  39. package/dist/cache-resolver-read-through.strategy.js +21 -0
  40. package/dist/cache-resolver-read-through.strategy.js.map +1 -0
  41. package/dist/cache-resolver.strategy.d.ts +2 -9
  42. package/dist/cache-resolver.strategy.d.ts.map +1 -1
  43. package/dist/cache-resolver.strategy.js +1 -5
  44. package/dist/cache-resolver.strategy.js.map +1 -1
  45. package/dist/cache-value.vo.d.ts +6 -0
  46. package/dist/cache-value.vo.d.ts.map +1 -0
  47. package/dist/cache-value.vo.js +2 -0
  48. package/dist/cache-value.vo.js.map +1 -0
  49. package/dist/correlation-id.vo.d.ts.map +1 -1
  50. package/dist/correlation-id.vo.js +1 -0
  51. package/dist/correlation-id.vo.js.map +1 -1
  52. package/dist/cron-scheduler-with-logger.adapter.d.ts +3 -0
  53. package/dist/cron-scheduler-with-logger.adapter.d.ts.map +1 -1
  54. package/dist/cron-scheduler-with-logger.adapter.js +29 -7
  55. package/dist/cron-scheduler-with-logger.adapter.js.map +1 -1
  56. package/dist/cron-task-handler-with-logger.strategy.js +1 -1
  57. package/dist/cron-task-handler-with-logger.strategy.js.map +1 -1
  58. package/dist/crypto-key-provider-with-memo.adapter.d.ts +12 -0
  59. package/dist/crypto-key-provider-with-memo.adapter.d.ts.map +1 -0
  60. package/dist/crypto-key-provider-with-memo.adapter.js +17 -0
  61. package/dist/crypto-key-provider-with-memo.adapter.js.map +1 -0
  62. package/dist/environment-loader-process-safe.adapter.d.ts +3 -1
  63. package/dist/environment-loader-process-safe.adapter.d.ts.map +1 -1
  64. package/dist/environment-loader-process-safe.adapter.js +4 -2
  65. package/dist/environment-loader-process-safe.adapter.js.map +1 -1
  66. package/dist/event-store-with-logger.adapter.d.ts +3 -0
  67. package/dist/event-store-with-logger.adapter.d.ts.map +1 -1
  68. package/dist/event-store-with-logger.adapter.js +88 -27
  69. package/dist/event-store-with-logger.adapter.js.map +1 -1
  70. package/dist/event-stream.vo.d.ts.map +1 -1
  71. package/dist/event-stream.vo.js +3 -1
  72. package/dist/event-stream.vo.js.map +1 -1
  73. package/dist/file-draft-tar-gz.service.d.ts +8 -0
  74. package/dist/file-draft-tar-gz.service.d.ts.map +1 -0
  75. package/dist/file-draft-tar-gz.service.js +19 -0
  76. package/dist/file-draft-tar-gz.service.js.map +1 -0
  77. package/dist/file-reader-json-with-cache.adapter.d.ts +1 -0
  78. package/dist/file-reader-json-with-cache.adapter.d.ts.map +1 -1
  79. package/dist/file-reader-json-with-cache.adapter.js +3 -1
  80. package/dist/file-reader-json-with-cache.adapter.js.map +1 -1
  81. package/dist/file-reader-text-with-cache.adapter.d.ts +1 -0
  82. package/dist/file-reader-text-with-cache.adapter.d.ts.map +1 -1
  83. package/dist/file-reader-text-with-cache.adapter.js +3 -1
  84. package/dist/file-reader-text-with-cache.adapter.js.map +1 -1
  85. package/dist/healthcheck-hono.handler.js +2 -2
  86. package/dist/healthcheck-hono.handler.js.map +1 -1
  87. package/dist/healthcheck.handler.d.ts +1 -0
  88. package/dist/healthcheck.handler.d.ts.map +1 -1
  89. package/dist/healthcheck.handler.js +1 -0
  90. package/dist/healthcheck.handler.js.map +1 -1
  91. package/dist/http-logger-hono.middleware.d.ts.map +1 -1
  92. package/dist/http-logger-hono.middleware.js +0 -3
  93. package/dist/http-logger-hono.middleware.js.map +1 -1
  94. package/dist/http-logger.middleware.d.ts +0 -1
  95. package/dist/http-logger.middleware.d.ts.map +1 -1
  96. package/dist/http-logger.middleware.js +0 -1
  97. package/dist/http-logger.middleware.js.map +1 -1
  98. package/dist/idempotency-store-cache.adapter.d.ts +13 -0
  99. package/dist/idempotency-store-cache.adapter.d.ts.map +1 -0
  100. package/dist/idempotency-store-cache.adapter.js +14 -0
  101. package/dist/idempotency-store-cache.adapter.js.map +1 -0
  102. package/dist/idempotency-store-noop.adapter.d.ts +6 -0
  103. package/dist/idempotency-store-noop.adapter.d.ts.map +1 -0
  104. package/dist/idempotency-store-noop.adapter.js +6 -0
  105. package/dist/idempotency-store-noop.adapter.js.map +1 -0
  106. package/dist/idempotency-store-with-logger.adapter.d.ts +17 -0
  107. package/dist/idempotency-store-with-logger.adapter.d.ts.map +1 -0
  108. package/dist/idempotency-store-with-logger.adapter.js +48 -0
  109. package/dist/idempotency-store-with-logger.adapter.js.map +1 -0
  110. package/dist/idempotency-store.port.d.ts +5 -0
  111. package/dist/idempotency-store.port.d.ts.map +1 -0
  112. package/dist/idempotency-store.port.js +2 -0
  113. package/dist/idempotency-store.port.js.map +1 -0
  114. package/dist/image-generator-web-view.adapter.js +8 -72
  115. package/dist/image-generator-web-view.adapter.js.map +1 -1
  116. package/dist/index.d.ts +19 -6
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +19 -6
  119. package/dist/index.js.map +1 -1
  120. package/dist/job-queue-with-logger.adapter.d.ts +2 -0
  121. package/dist/job-queue-with-logger.adapter.d.ts.map +1 -1
  122. package/dist/job-queue-with-logger.adapter.js +133 -36
  123. package/dist/job-queue-with-logger.adapter.js.map +1 -1
  124. package/dist/logger.port.d.ts +0 -1
  125. package/dist/logger.port.d.ts.map +1 -1
  126. package/dist/mailer-content-html.vo.js +1 -1
  127. package/dist/mailer-content-html.vo.js.map +1 -1
  128. package/dist/message-bus-with-logger.adapter.d.ts +2 -0
  129. package/dist/message-bus-with-logger.adapter.d.ts.map +1 -1
  130. package/dist/message-bus-with-logger.adapter.js +28 -8
  131. package/dist/message-bus-with-logger.adapter.js.map +1 -1
  132. package/dist/modules/preferences/invariants/user-language-has-changed.d.ts +0 -1
  133. package/dist/modules/preferences/invariants/user-language-has-changed.d.ts.map +1 -1
  134. package/dist/modules/preferences/invariants/user-language-has-changed.js +0 -4
  135. package/dist/modules/preferences/invariants/user-language-has-changed.js.map +1 -1
  136. package/dist/modules/system/invariants/feature-flag-enabled.d.ts +0 -1
  137. package/dist/modules/system/invariants/feature-flag-enabled.d.ts.map +1 -1
  138. package/dist/modules/system/invariants/feature-flag-enabled.js +0 -4
  139. package/dist/modules/system/invariants/feature-flag-enabled.js.map +1 -1
  140. package/dist/prerequisite-verifier-sqlite.adapter.js +1 -1
  141. package/dist/prerequisite-verifier-sqlite.adapter.js.map +1 -1
  142. package/dist/prerequisite-verifier-with-cache.adapter.d.ts +2 -0
  143. package/dist/prerequisite-verifier-with-cache.adapter.d.ts.map +1 -1
  144. package/dist/prerequisite-verifier-with-cache.adapter.js +8 -5
  145. package/dist/prerequisite-verifier-with-cache.adapter.js.map +1 -1
  146. package/dist/rate-limiter.service.d.ts +22 -0
  147. package/dist/rate-limiter.service.d.ts.map +1 -0
  148. package/dist/rate-limiter.service.js +31 -0
  149. package/dist/rate-limiter.service.js.map +1 -0
  150. package/dist/reactive-config-with-cache.adapter.d.ts +3 -1
  151. package/dist/reactive-config-with-cache.adapter.d.ts.map +1 -1
  152. package/dist/reactive-config-with-cache.adapter.js +3 -1
  153. package/dist/reactive-config-with-cache.adapter.js.map +1 -1
  154. package/dist/request-context-hono.adapter.d.ts.map +1 -1
  155. package/dist/request-context-hono.adapter.js +4 -1
  156. package/dist/request-context-hono.adapter.js.map +1 -1
  157. package/dist/secure-key-generator-crypto.adapter.js +1 -1
  158. package/dist/secure-key-generator-crypto.adapter.js.map +1 -1
  159. package/dist/security-rule-violation-threshold.strategy.d.ts.map +1 -1
  160. package/dist/security-rule-violation-threshold.strategy.js +5 -3
  161. package/dist/security-rule-violation-threshold.strategy.js.map +1 -1
  162. package/dist/shield-rate-limit-hono.strategy.d.ts +2 -2
  163. package/dist/shield-rate-limit-hono.strategy.d.ts.map +1 -1
  164. package/dist/shield-rate-limit.strategy.d.ts +2 -2
  165. package/dist/shield-rate-limit.strategy.d.ts.map +1 -1
  166. package/dist/shield-rate-limit.strategy.js +8 -2
  167. package/dist/shield-rate-limit.strategy.js.map +1 -1
  168. package/dist/shield-webhook-hono.strategy.d.ts +2 -2
  169. package/dist/shield-webhook-hono.strategy.d.ts.map +1 -1
  170. package/dist/shield-webhook-hono.strategy.js +7 -3
  171. package/dist/shield-webhook-hono.strategy.js.map +1 -1
  172. package/dist/shield-webhook.strategy.d.ts +23 -3
  173. package/dist/shield-webhook.strategy.d.ts.map +1 -1
  174. package/dist/shield-webhook.strategy.js +18 -4
  175. package/dist/shield-webhook.strategy.js.map +1 -1
  176. package/dist/sitemap-entries-provider-with-cache.adapter.d.ts +2 -0
  177. package/dist/sitemap-entries-provider-with-cache.adapter.d.ts.map +1 -1
  178. package/dist/sitemap-entries-provider-with-cache.adapter.js +8 -5
  179. package/dist/sitemap-entries-provider-with-cache.adapter.js.map +1 -1
  180. package/dist/sitemap-entry.vo.d.ts +11 -10
  181. package/dist/sitemap-entry.vo.d.ts.map +1 -1
  182. package/dist/sitemap-entry.vo.js +19 -0
  183. package/dist/sitemap-entry.vo.js.map +1 -1
  184. package/dist/smtp-port.vo.d.ts.map +1 -1
  185. package/dist/smtp-port.vo.js +1 -0
  186. package/dist/smtp-port.vo.js.map +1 -1
  187. package/dist/sse-registry-with-logger.adapter.d.ts +2 -0
  188. package/dist/sse-registry-with-logger.adapter.d.ts.map +1 -1
  189. package/dist/sse-registry-with-logger.adapter.js +80 -22
  190. package/dist/sse-registry-with-logger.adapter.js.map +1 -1
  191. package/dist/translations-provider-with-cache.adapter.d.ts +21 -0
  192. package/dist/translations-provider-with-cache.adapter.d.ts.map +1 -0
  193. package/dist/translations-provider-with-cache.adapter.js +22 -0
  194. package/dist/translations-provider-with-cache.adapter.js.map +1 -0
  195. package/dist/uuid.vo.js +1 -0
  196. package/dist/uuid.vo.js.map +1 -1
  197. package/dist/webhook-id-extractor-header.strategy.d.ts +9 -0
  198. package/dist/webhook-id-extractor-header.strategy.d.ts.map +1 -0
  199. package/dist/webhook-id-extractor-header.strategy.js +13 -0
  200. package/dist/webhook-id-extractor-header.strategy.js.map +1 -0
  201. package/dist/webhook-id-extractor-json-field.strategy.d.ts +9 -0
  202. package/dist/webhook-id-extractor-json-field.strategy.d.ts.map +1 -0
  203. package/dist/webhook-id-extractor-json-field.strategy.js +14 -0
  204. package/dist/webhook-id-extractor-json-field.strategy.js.map +1 -0
  205. package/dist/webhook-id-extractor.strategy.d.ts +6 -0
  206. package/dist/webhook-id-extractor.strategy.d.ts.map +1 -0
  207. package/dist/webhook-id-extractor.strategy.js +2 -0
  208. package/dist/webhook-id-extractor.strategy.js.map +1 -0
  209. package/dist/webhook-id.vo.d.ts +9 -0
  210. package/dist/webhook-id.vo.d.ts.map +1 -0
  211. package/dist/webhook-id.vo.js +10 -0
  212. package/dist/webhook-id.vo.js.map +1 -0
  213. package/dist/{webhook-signature-extractor-header-exact.strategy.d.ts → webhook-signature-extractor-header.strategy.d.ts} +2 -2
  214. package/dist/webhook-signature-extractor-header.strategy.d.ts.map +1 -0
  215. package/dist/{webhook-signature-extractor-header-exact.strategy.js → webhook-signature-extractor-header.strategy.js} +2 -2
  216. package/dist/webhook-signature-extractor-header.strategy.js.map +1 -0
  217. package/package.json +12 -18
  218. package/readme.md +19 -6
  219. package/src/alert-channel-composite.adapter.ts +1 -0
  220. package/src/api-version.middleware.ts +6 -2
  221. package/src/cache-codec-identity.strategy.ts +12 -0
  222. package/src/cache-codec-sitemap-entries.strategy.ts +17 -0
  223. package/src/cache-codec.strategy.ts +6 -0
  224. package/src/cache-repository-node-cache.adapter.ts +9 -5
  225. package/src/cache-repository-noop.adapter.ts +3 -2
  226. package/src/cache-repository-redis.adapter.ts +10 -7
  227. package/src/cache-repository.port.ts +3 -2
  228. package/src/cache-resolver-noop.strategy.ts +11 -0
  229. package/src/cache-resolver-read-through.strategy.ts +27 -0
  230. package/src/cache-resolver.strategy.ts +2 -11
  231. package/src/cache-value.vo.ts +9 -0
  232. package/src/correlation-id.vo.ts +1 -0
  233. package/src/cron-scheduler-with-logger.adapter.ts +35 -9
  234. package/src/cron-task-handler-with-logger.strategy.ts +1 -1
  235. package/src/crypto-key-provider-with-memo.adapter.ts +21 -0
  236. package/src/environment-loader-process-safe.adapter.ts +12 -4
  237. package/src/event-store-with-logger.adapter.ts +97 -27
  238. package/src/event-stream.vo.ts +1 -0
  239. package/src/file-draft-tar-gz.service.ts +23 -0
  240. package/src/file-reader-json-with-cache.adapter.ts +7 -2
  241. package/src/file-reader-text-with-cache.adapter.ts +8 -1
  242. package/src/healthcheck-hono.handler.ts +2 -2
  243. package/src/healthcheck.handler.ts +2 -0
  244. package/src/http-logger-hono.middleware.ts +0 -3
  245. package/src/http-logger.middleware.ts +0 -2
  246. package/src/idempotency-store-cache.adapter.ts +19 -0
  247. package/src/idempotency-store-noop.adapter.ts +8 -0
  248. package/src/idempotency-store-with-logger.adapter.ts +59 -0
  249. package/src/idempotency-store.port.ts +5 -0
  250. package/src/index.ts +19 -6
  251. package/src/job-queue-with-logger.adapter.ts +156 -43
  252. package/src/logger.port.ts +0 -1
  253. package/src/message-bus-with-logger.adapter.ts +37 -10
  254. package/src/modules/preferences/invariants/user-language-has-changed.ts +1 -6
  255. package/src/modules/system/invariants/feature-flag-enabled.ts +1 -6
  256. package/src/prerequisite-verifier-sqlite.adapter.ts +1 -1
  257. package/src/prerequisite-verifier-with-cache.adapter.ts +13 -7
  258. package/src/rate-limiter.service.ts +45 -0
  259. package/src/reactive-config-with-cache.adapter.ts +8 -2
  260. package/src/request-context-hono.adapter.ts +5 -1
  261. package/src/security-rule-violation-threshold.strategy.ts +5 -6
  262. package/src/shield-rate-limit-hono.strategy.ts +2 -2
  263. package/src/shield-rate-limit.strategy.ts +14 -7
  264. package/src/shield-webhook-hono.strategy.ts +11 -3
  265. package/src/shield-webhook.strategy.ts +41 -6
  266. package/src/sitemap-entries-provider-with-cache.adapter.ts +13 -7
  267. package/src/sitemap-entry.vo.ts +23 -11
  268. package/src/smtp-port.vo.ts +1 -0
  269. package/src/sse-registry-with-logger.adapter.ts +94 -25
  270. package/src/translations-provider-with-cache.adapter.ts +38 -0
  271. package/src/uuid.vo.ts +1 -1
  272. package/src/webhook-id-extractor-header.strategy.ts +14 -0
  273. package/src/webhook-id-extractor-json-field.strategy.ts +16 -0
  274. package/src/webhook-id-extractor.strategy.ts +6 -0
  275. package/src/webhook-id.vo.ts +17 -0
  276. package/src/{webhook-signature-extractor-header-exact.strategy.ts → webhook-signature-extractor-header.strategy.ts} +1 -1
  277. package/dist/cache-resolver-simple.strategy.d.ts +0 -18
  278. package/dist/cache-resolver-simple.strategy.d.ts.map +0 -1
  279. package/dist/cache-resolver-simple.strategy.js +0 -23
  280. package/dist/cache-resolver-simple.strategy.js.map +0 -1
  281. package/dist/cache-response-hono.middleware.d.ts +0 -9
  282. package/dist/cache-response-hono.middleware.d.ts.map +0 -1
  283. package/dist/cache-response-hono.middleware.js +0 -34
  284. package/dist/cache-response-hono.middleware.js.map +0 -1
  285. package/dist/cache-response.middleware.d.ts +0 -28
  286. package/dist/cache-response.middleware.d.ts.map +0 -1
  287. package/dist/cache-response.middleware.js +0 -20
  288. package/dist/cache-response.middleware.js.map +0 -1
  289. package/dist/crypto-key-provider-with-cache.adapter.d.ts +0 -19
  290. package/dist/crypto-key-provider-with-cache.adapter.d.ts.map +0 -1
  291. package/dist/crypto-key-provider-with-cache.adapter.js +0 -19
  292. package/dist/crypto-key-provider-with-cache.adapter.js.map +0 -1
  293. package/dist/file-draft-zip.service.d.ts +0 -14
  294. package/dist/file-draft-zip.service.d.ts.map +0 -1
  295. package/dist/file-draft-zip.service.js +0 -41
  296. package/dist/file-draft-zip.service.js.map +0 -1
  297. package/dist/webhook-signature-extractor-header-exact.strategy.d.ts.map +0 -1
  298. package/dist/webhook-signature-extractor-header-exact.strategy.js.map +0 -1
  299. package/src/cache-resolver-simple.strategy.ts +0 -33
  300. package/src/cache-response-hono.middleware.ts +0 -53
  301. package/src/cache-response.middleware.ts +0 -47
  302. package/src/crypto-key-provider-with-cache.adapter.ts +0 -30
  303. package/src/file-draft-zip.service.ts +0 -56
@@ -0,0 +1,21 @@
1
+ import type * as tools from "@bgord/tools";
2
+ import type { CacheResolverStrategy } from "./cache-resolver.strategy";
3
+ import type { HashContentStrategy } from "./hash-content.strategy";
4
+ import type { TranslationsProviderPort, TranslationsType } from "./translations-provider.port";
5
+ type Config = {
6
+ id: string;
7
+ inner: TranslationsProviderPort;
8
+ };
9
+ type Dependencies = {
10
+ CacheResolver: CacheResolverStrategy;
11
+ HashContent: HashContentStrategy;
12
+ };
13
+ export declare class TranslationsProviderWithCacheAdapter implements TranslationsProviderPort {
14
+ private readonly config;
15
+ private readonly deps;
16
+ private readonly codec;
17
+ constructor(config: Config, deps: Dependencies);
18
+ getTranslationsFor(language: tools.LanguageType): Promise<TranslationsType>;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=translations-provider-with-cache.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations-provider-with-cache.adapter.d.ts","sourceRoot":"","sources":["../src/translations-provider-with-cache.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE/F,KAAK,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,CAAC;AAC9D,KAAK,YAAY,GAAG;IAAE,aAAa,EAAE,qBAAqB,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE/F,qBAAa,oCAAqC,YAAW,wBAAwB;IAIjF,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsD;IAE5E,YACmB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EACjC;IAEE,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiBhF;CACF"}
@@ -0,0 +1,22 @@
1
+ import { CacheCodecIdentityStrategy } from "./cache-codec-identity.strategy";
2
+ import { SubjectApplicationResolver } from "./subject-application-resolver.vo";
3
+ import { SubjectSegmentFixedStrategy } from "./subject-segment-fixed.strategy";
4
+ export class TranslationsProviderWithCacheAdapter {
5
+ config;
6
+ deps;
7
+ codec = new CacheCodecIdentityStrategy();
8
+ constructor(config, deps) {
9
+ this.config = config;
10
+ this.deps = deps;
11
+ }
12
+ async getTranslationsFor(language) {
13
+ const resolver = new SubjectApplicationResolver([
14
+ new SubjectSegmentFixedStrategy("translations_provider"),
15
+ new SubjectSegmentFixedStrategy(this.config.id),
16
+ new SubjectSegmentFixedStrategy(language),
17
+ ], this.deps);
18
+ const subject = await resolver.resolve();
19
+ return this.deps.CacheResolver.resolve(subject.hex, async () => this.config.inner.getTranslationsFor(language), this.codec);
20
+ }
21
+ }
22
+ //# sourceMappingURL=translations-provider-with-cache.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations-provider-with-cache.adapter.js","sourceRoot":"","sources":["../src/translations-provider-with-cache.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAG7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAM/E,MAAM,OAAO,oCAAoC;IAI5B,MAAM;IACN,IAAI;IAJN,KAAK,GAAG,IAAI,0BAA0B,EAAoB,CAAC;IAE5E,YACmB,MAAc,EACd,IAAkB;sBADlB,MAAM;oBACN,IAAI;IACpB,CAAC;IAEJ,KAAK,CAAC,kBAAkB,CAAC,QAA4B;QACnD,MAAM,QAAQ,GAAG,IAAI,0BAA0B,CAC7C;YACE,IAAI,2BAA2B,CAAC,uBAAuB,CAAC;YACxD,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/C,IAAI,2BAA2B,CAAC,QAAQ,CAAC;SAC1C,EACD,IAAI,CAAC,IAAI,CACV,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEzC,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CACpC,OAAO,CAAC,GAAG,EACX,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAC1D,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;CACF"}
package/dist/uuid.vo.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as v from "valibot";
2
2
  export const UUIDError = { Type: "uuid.type" };
3
+ // Stryker disable next-line StringLiteral
3
4
  export const UUID = v.pipe(v.string(UUIDError.Type), v.uuid(UUIDError.Type), v.brand("UUID"));
4
5
  //# sourceMappingURL=uuid.vo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uuid.vo.js","sourceRoot":"","sources":["../src/uuid.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,WAAW,EAAW,CAAC;AAExD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"uuid.vo.js","sourceRoot":"","sources":["../src/uuid.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,WAAW,EAAW,CAAC;AACxD,0CAA0C;AAC1C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { HasRequestHeader } from "./request-context.port";
2
+ import { type WebhookIdType } from "./webhook-id.vo";
3
+ import type { WebhookIdExtractorStrategy } from "./webhook-id-extractor.strategy";
4
+ export declare class WebhookIdExtractorHeaderStrategy implements WebhookIdExtractorStrategy {
5
+ private readonly header;
6
+ constructor(header: string);
7
+ extract(context: HasRequestHeader): Promise<WebhookIdType | null>;
8
+ }
9
+ //# sourceMappingURL=webhook-id-extractor-header.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor-header.strategy.d.ts","sourceRoot":"","sources":["../src/webhook-id-extractor-header.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,qBAAa,gCAAiC,YAAW,0BAA0B;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,MAAM,EAAI;IAEzC,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAItE;CACF"}
@@ -0,0 +1,13 @@
1
+ import * as v from "valibot";
2
+ import { WebhookId } from "./webhook-id.vo";
3
+ export class WebhookIdExtractorHeaderStrategy {
4
+ header;
5
+ constructor(header) {
6
+ this.header = header;
7
+ }
8
+ async extract(context) {
9
+ const id = v.safeParse(WebhookId, context.request.header(this.header));
10
+ return id.success ? id.output : null;
11
+ }
12
+ }
13
+ //# sourceMappingURL=webhook-id-extractor-header.strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor-header.strategy.js","sourceRoot":"","sources":["../src/webhook-id-extractor-header.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAGhE,MAAM,OAAO,gCAAgC;IACd,MAAM;IAAnC,YAA6B,MAAc;sBAAd,MAAM;IAAW,CAAC;IAE/C,KAAK,CAAC,OAAO,CAAC,OAAyB;QACrC,MAAM,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEvE,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { HasRequestJson } from "./request-context.port";
2
+ import { type WebhookIdType } from "./webhook-id.vo";
3
+ import type { WebhookIdExtractorStrategy } from "./webhook-id-extractor.strategy";
4
+ export declare class WebhookIdExtractorJsonFieldStrategy implements WebhookIdExtractorStrategy {
5
+ private readonly field;
6
+ constructor(field: string);
7
+ extract(context: HasRequestJson): Promise<WebhookIdType | null>;
8
+ }
9
+ //# sourceMappingURL=webhook-id-extractor-json-field.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor-json-field.strategy.d.ts","sourceRoot":"","sources":["../src/webhook-id-extractor-json-field.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,qBAAa,mCAAoC,YAAW,0BAA0B;IACxE,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,MAAM,EAAI;IAExC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAMpE;CACF"}
@@ -0,0 +1,14 @@
1
+ import * as v from "valibot";
2
+ import { WebhookId } from "./webhook-id.vo";
3
+ export class WebhookIdExtractorJsonFieldStrategy {
4
+ field;
5
+ constructor(field) {
6
+ this.field = field;
7
+ }
8
+ async extract(context) {
9
+ const body = await context.request.json();
10
+ const id = v.safeParse(WebhookId, body[this.field]);
11
+ return id.success ? id.output : null;
12
+ }
13
+ }
14
+ //# sourceMappingURL=webhook-id-extractor-json-field.strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor-json-field.strategy.js","sourceRoot":"","sources":["../src/webhook-id-extractor-json-field.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAGhE,MAAM,OAAO,mCAAmC;IACjB,KAAK;IAAlC,YAA6B,KAAa;qBAAb,KAAK;IAAW,CAAC;IAE9C,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAE1C,MAAM,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAEpD,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import type { HasRequestHeader, HasRequestJson } from "./request-context.port";
2
+ import type { WebhookIdType } from "./webhook-id.vo";
3
+ export interface WebhookIdExtractorStrategy {
4
+ extract(context: HasRequestHeader & HasRequestJson): Promise<WebhookIdType | null>;
5
+ }
6
+ //# sourceMappingURL=webhook-id-extractor.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor.strategy.d.ts","sourceRoot":"","sources":["../src/webhook-id-extractor.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CACpF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=webhook-id-extractor.strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id-extractor.strategy.js","sourceRoot":"","sources":["../src/webhook-id-extractor.strategy.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import * as v from "valibot";
2
+ export declare const WebhookIdError: {
3
+ Type: string;
4
+ Empty: string;
5
+ TooLong: string;
6
+ };
7
+ export declare const WebhookId: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 128, string>, v.BrandAction<string, "WebhookId">]>;
8
+ export type WebhookIdType = v.InferOutput<typeof WebhookId>;
9
+ //# sourceMappingURL=webhook-id.vo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id.vo.d.ts","sourceRoot":"","sources":["../src/webhook-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,cAAc;IACzB,IAAI;IACJ,KAAK;IACL,OAAO;CACR,CAAC;AAEF,eAAO,MAAM,SAAS,uKAMrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as v from "valibot";
2
+ export const WebhookIdError = {
3
+ Type: "webhook.id.type",
4
+ Empty: "webhook.id.empty",
5
+ TooLong: "webhook.id.too.long",
6
+ };
7
+ export const WebhookId = v.pipe(v.string(WebhookIdError.Type), v.minLength(1, WebhookIdError.Empty), v.maxLength(128, WebhookIdError.TooLong),
8
+ // Stryker disable next-line StringLiteral
9
+ v.brand("WebhookId"));
10
+ //# sourceMappingURL=webhook-id.vo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-id.vo.js","sourceRoot":"","sources":["../src/webhook-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAC7B,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAC7B,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,EACpC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,CAAC;AACxC,0CAA0C;AAC1C,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CACrB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { HasRequestHeader } from "./request-context.port";
2
2
  import { type WebhookSignatureType } from "./webhook-signature.vo";
3
3
  import type { WebhookSignatureExtractorStrategy } from "./webhook-signature-extractor.strategy";
4
- export declare class WebhookSignatureExtractorHeaderExactStrategy implements WebhookSignatureExtractorStrategy {
4
+ export declare class WebhookSignatureExtractorHeaderStrategy implements WebhookSignatureExtractorStrategy {
5
5
  private readonly header;
6
6
  constructor(header: string);
7
7
  extract(context: HasRequestHeader): WebhookSignatureType | null;
8
8
  }
9
- //# sourceMappingURL=webhook-signature-extractor-header-exact.strategy.d.ts.map
9
+ //# sourceMappingURL=webhook-signature-extractor-header.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-signature-extractor-header.strategy.d.ts","sourceRoot":"","sources":["../src/webhook-signature-extractor-header.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAEhG,qBAAa,uCAAwC,YAAW,iCAAiC;IACnF,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,MAAM,EAAI;IAE/C,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,IAAI,CAI9D;CACF"}
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { WebhookSignature } from "./webhook-signature.vo";
3
- export class WebhookSignatureExtractorHeaderExactStrategy {
3
+ export class WebhookSignatureExtractorHeaderStrategy {
4
4
  header;
5
5
  constructor(header) {
6
6
  this.header = header;
@@ -10,4 +10,4 @@ export class WebhookSignatureExtractorHeaderExactStrategy {
10
10
  return signature.success ? signature.output : null;
11
11
  }
12
12
  }
13
- //# sourceMappingURL=webhook-signature-extractor-header-exact.strategy.js.map
13
+ //# sourceMappingURL=webhook-signature-extractor-header.strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-signature-extractor-header.strategy.js","sourceRoot":"","sources":["../src/webhook-signature-extractor-header.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAA6B,MAAM,wBAAwB,CAAC;AAGrF,MAAM,OAAO,uCAAuC;IACrB,MAAM;IAAnC,YAA6B,MAAc;sBAAd,MAAM;IAAW,CAAC;IAE/C,OAAO,CAAC,OAAyB;QAC/B,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAErF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/bun",
3
- "version": "1.21.11",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
@@ -20,36 +20,33 @@
20
20
  "build": "bash scripts/package-build.sh"
21
21
  },
22
22
  "devDependencies": {
23
- "@biomejs/biome": "2.5.8",
23
+ "@biomejs/biome": "2.5.10",
24
24
  "@standard-schema/spec": "1.1.0",
25
25
  "@stryker-mutator/core": "10.0.0",
26
26
  "@stryker-mutator/typescript-checker": "10.0.0",
27
- "@types/bun": "1.3.14",
27
+ "@types/bun": "1.4.0",
28
28
  "@types/nodemailer": "8.0.1",
29
- "@types/yazl": "3.3.1",
30
- "better-auth": "1.6.29",
31
- "cspell": "10.0.1",
29
+ "better-auth": "1.7.1",
30
+ "cspell": "10.1.1",
32
31
  "csv": "6.6.3",
33
- "fallow": "3.16.0",
32
+ "fallow": "3.18.0",
34
33
  "lefthook": "2.1.10",
35
34
  "lockfile-lint": "5.0.1",
36
35
  "nodemailer": "9.0.5",
37
- "publint": "0.3.23",
36
+ "publint": "0.3.24",
38
37
  "shellcheck": "4.1.0",
39
- "typescript": "7.0.2",
40
- "yazl": "3.3.1"
38
+ "typescript": "7.0.2"
41
39
  },
42
40
  "dependencies": {
43
- "@bgord/tools": "1.6.8",
41
+ "@bgord/tools": "1.6.10",
44
42
  "emittery": "2.0.0",
45
- "hono": "4.13.2",
43
+ "hono": "4.13.5",
46
44
  "node-cache": "5.1.2"
47
45
  },
48
46
  "peerDependencies": {
49
- "better-auth": "1.6.29",
47
+ "better-auth": "1.7.1",
50
48
  "csv": "6.6.3",
51
- "nodemailer": "9.0.5",
52
- "yazl": "3.3.1"
49
+ "nodemailer": "9.0.5"
53
50
  },
54
51
  "peerDependenciesMeta": {
55
52
  "better-auth": {
@@ -60,9 +57,6 @@
60
57
  },
61
58
  "nodemailer": {
62
59
  "optional": true
63
- },
64
- "yazl": {
65
- "optional": true
66
60
  }
67
61
  }
68
62
  }
package/readme.md CHANGED
@@ -69,15 +69,18 @@ src/
69
69
  ├── binary.vo.ts
70
70
  ├── bots.vo.ts
71
71
  ├── build-info.vo.ts
72
+ ├── cache-codec-identity.strategy.ts
73
+ ├── cache-codec-sitemap-entries.strategy.ts
74
+ ├── cache-codec.strategy.ts
72
75
  ├── cache-file.service.ts
73
76
  ├── cache-repository-node-cache.adapter.ts
74
77
  ├── cache-repository-noop.adapter.ts
75
78
  ├── cache-repository-redis.adapter.ts
76
79
  ├── cache-repository.port.ts
77
- ├── cache-resolver-simple.strategy.ts
80
+ ├── cache-resolver-noop.strategy.ts
81
+ ├── cache-resolver-read-through.strategy.ts
78
82
  ├── cache-resolver.strategy.ts
79
- ├── cache-response-hono.middleware.ts
80
- ├── cache-response.middleware.ts
83
+ ├── cache-value.vo.ts
81
84
  ├── certificate-inspector-noop.adapter.ts
82
85
  ├── certificate-inspector-tls.adapter.ts
83
86
  ├── certificate-inspector.port.ts
@@ -110,7 +113,7 @@ src/
110
113
  ├── crypto-key-provider-file.adapter.ts
111
114
  ├── crypto-key-provider-memory.adapter.ts
112
115
  ├── crypto-key-provider-noop.adapter.ts
113
- ├── crypto-key-provider-with-cache.adapter.ts
116
+ ├── crypto-key-provider-with-memo.adapter.ts
114
117
  ├── crypto-key-provider.port.ts
115
118
  ├── csv-stringifier-noop.adapter.ts
116
119
  ├── csv-stringifier.adapter.ts
@@ -173,7 +176,7 @@ src/
173
176
  ├── file-copier-noop.adapter.ts
174
177
  ├── file-copier.adapter.ts
175
178
  ├── file-copier.port.ts
176
- ├── file-draft-zip.service.ts
179
+ ├── file-draft-tar-gz.service.ts
177
180
  ├── file-draft.service.ts
178
181
  ├── file-inspection-noop.adapter.ts
179
182
  ├── file-inspection.adapter.ts
@@ -233,6 +236,10 @@ src/
233
236
  ├── id-provider-crypto.adapter.ts
234
237
  ├── id-provider-deterministic.adapter.ts
235
238
  ├── id-provider.port.ts
239
+ ├── idempotency-store-cache.adapter.ts
240
+ ├── idempotency-store-noop.adapter.ts
241
+ ├── idempotency-store-with-logger.adapter.ts
242
+ ├── idempotency-store.port.ts
236
243
  ├── image-blur-noop.adapter.ts
237
244
  ├── image-blur-with-semaphore.adapter.ts
238
245
  ├── image-blur.adapter.ts
@@ -453,6 +460,7 @@ src/
453
460
  ├── randomness-math.strategy.ts
454
461
  ├── randomness-noop.strategy.ts
455
462
  ├── randomness.strategy.ts
463
+ ├── rate-limiter.service.ts
456
464
  ├── reactive-config-file-json.adapter.ts
457
465
  ├── reactive-config-noop.adapter.ts
458
466
  ├── reactive-config-with-cache.adapter.ts
@@ -623,6 +631,7 @@ src/
623
631
  ├── translations-hono.handler.ts
624
632
  ├── translations-provider-json.adapter.ts
625
633
  ├── translations-provider-noop.adapter.ts
634
+ ├── translations-provider-with-cache.adapter.ts
626
635
  ├── translations-provider.port.ts
627
636
  ├── translations.handler.ts
628
637
  ├── translator.service.ts
@@ -638,11 +647,15 @@ src/
638
647
  ├── weak-etag-extractor.strategy.ts
639
648
  ├── webhook-body-builder-text.strategy.ts
640
649
  ├── webhook-body-builder.strategy.ts
650
+ ├── webhook-id-extractor-header.strategy.ts
651
+ ├── webhook-id-extractor-json-field.strategy.ts
652
+ ├── webhook-id-extractor.strategy.ts
653
+ ├── webhook-id.vo.ts
641
654
  ├── webhook-secret.vo.ts
642
655
  ├── webhook-signature-creator-noop.strategy.ts
643
656
  ├── webhook-signature-creator-sha256.strategy.ts
644
657
  ├── webhook-signature-creator.strategy.ts
645
- ├── webhook-signature-extractor-header-exact.strategy.ts
658
+ ├── webhook-signature-extractor-header.strategy.ts
646
659
  ├── webhook-signature-extractor.strategy.ts
647
660
  ├── webhook-signature.vo.ts
648
661
  ├── webhook-verifier-noop.strategy.ts
@@ -18,6 +18,7 @@ export class AlertChannelCompositeAdapter implements AlertChannelPort {
18
18
 
19
19
  if (results.some((result) => result.status === "fulfilled")) return;
20
20
 
21
+ // Stryker disable next-line ArrayDeclaration
21
22
  const reasons = results.flatMap((result) => (result.status === "rejected" ? [result.reason] : []));
22
23
 
23
24
  throw new AggregateError(reasons, AlertChannelCompositeError.AllFailed);
@@ -1,5 +1,6 @@
1
1
  import type * as tools from "@bgord/tools";
2
2
  import type { BuildInfoType } from "./build-info.vo";
3
+ import { CacheCodecIdentityStrategy } from "./cache-codec-identity.strategy";
3
4
  import type { CacheResolverStrategy } from "./cache-resolver.strategy";
4
5
  import type { HashContentStrategy } from "./hash-content.strategy";
5
6
  import type { ReactiveConfigPort } from "./reactive-config.port";
@@ -16,6 +17,7 @@ export class ApiVersionMiddleware {
16
17
  static readonly HEADER_NAME = "api-version";
17
18
 
18
19
  private readonly resolver: SubjectApplicationResolver;
20
+ private readonly codec = new CacheCodecIdentityStrategy<BuildInfoType>();
19
21
 
20
22
  constructor(private readonly deps: ApiVersionMiddlewareDependencies) {
21
23
  this.resolver = new SubjectApplicationResolver(
@@ -27,8 +29,10 @@ export class ApiVersionMiddleware {
27
29
  async evaluate(): Promise<tools.PackageVersionSchemaType> {
28
30
  const subject = await this.resolver.resolve();
29
31
 
30
- const build = await this.deps.CacheResolver.resolve(subject.hex, async () =>
31
- this.deps.BuildInfoConfig.get(),
32
+ const build = await this.deps.CacheResolver.resolve<BuildInfoType>(
33
+ subject.hex,
34
+ async () => this.deps.BuildInfoConfig.get(),
35
+ this.codec,
32
36
  );
33
37
 
34
38
  return build.version;
@@ -0,0 +1,12 @@
1
+ import type { CacheCodecStrategy } from "./cache-codec.strategy";
2
+ import type { CacheValueType } from "./cache-value.vo";
3
+
4
+ export class CacheCodecIdentityStrategy<T extends CacheValueType> implements CacheCodecStrategy<T> {
5
+ encode(value: T): CacheValueType {
6
+ return value;
7
+ }
8
+
9
+ decode(raw: CacheValueType): T {
10
+ return raw as T;
11
+ }
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { CacheCodecStrategy } from "./cache-codec.strategy";
2
+ import type { CacheValueType } from "./cache-value.vo";
3
+ import { SitemapEntry } from "./sitemap-entry.vo";
4
+
5
+ export const CacheCodecSitemapEntriesError = { NotAnArray: "cache.codec.sitemap.entries.not.an.array" };
6
+
7
+ export class CacheCodecSitemapEntriesStrategy implements CacheCodecStrategy<ReadonlyArray<SitemapEntry>> {
8
+ encode(value: ReadonlyArray<SitemapEntry>): CacheValueType {
9
+ return value.map((entry) => entry.toJSON());
10
+ }
11
+
12
+ decode(raw: CacheValueType): ReadonlyArray<SitemapEntry> {
13
+ if (!Array.isArray(raw)) throw new Error(CacheCodecSitemapEntriesError.NotAnArray);
14
+
15
+ return raw.map((entry) => SitemapEntry.fromJSON(entry));
16
+ }
17
+ }
@@ -0,0 +1,6 @@
1
+ import type { CacheValueType } from "./cache-value.vo";
2
+
3
+ export interface CacheCodecStrategy<T> {
4
+ encode(value: T): CacheValueType;
5
+ decode(raw: CacheValueType): T;
6
+ }
@@ -1,5 +1,6 @@
1
1
  import NodeCache from "node-cache";
2
2
  import type { CacheRepositoryPort, CacheRepositoryTtlType } from "./cache-repository.port";
3
+ import type { CacheValueType } from "./cache-value.vo";
3
4
  import type { Hash } from "./hash.vo";
4
5
 
5
6
  export class CacheRepositoryNodeCacheAdapter implements CacheRepositoryPort {
@@ -10,17 +11,20 @@ export class CacheRepositoryNodeCacheAdapter implements CacheRepositoryPort {
10
11
  stdTTL: config.type === "finite" ? config.ttl.seconds : 0,
11
12
  deleteOnExpire: true,
12
13
  maxKeys: 100_000,
13
- useClones: false,
14
14
  });
15
15
  }
16
16
 
17
- async get<T>(subject: Hash): Promise<T | null> {
18
- return this.store.get(subject.get()) ?? null;
17
+ async get(subject: Hash): Promise<CacheValueType | null> {
18
+ const value = this.store.get<string>(subject.get());
19
+
20
+ if (value === undefined) return null;
21
+
22
+ return JSON.parse(value);
19
23
  }
20
24
 
21
- async set<T>(subject: Hash, value: T): Promise<void> {
25
+ async set(subject: Hash, value: CacheValueType): Promise<void> {
22
26
  try {
23
- this.store.set(subject.get(), value);
27
+ this.store.set(subject.get(), JSON.stringify(value));
24
28
  } catch {}
25
29
  }
26
30
 
@@ -1,11 +1,12 @@
1
1
  import type { CacheRepositoryPort } from "./cache-repository.port";
2
+ import type { CacheValueType } from "./cache-value.vo";
2
3
  import type { Hash } from "./hash.vo";
3
4
 
4
5
  export class CacheRepositoryNoopAdapter implements CacheRepositoryPort {
5
- async get<T>(_subject: Hash): Promise<T | null> {
6
+ async get(_subject: Hash): Promise<CacheValueType | null> {
6
7
  return null;
7
8
  }
8
- async set<T>(_subject: Hash, _value: T): Promise<void> {}
9
+ async set(_subject: Hash, _value: CacheValueType): Promise<void> {}
9
10
  async delete(_subject: Hash): Promise<void> {}
10
11
  async flush(): Promise<void> {}
11
12
  }
@@ -1,6 +1,7 @@
1
1
  // [BUN DEPENDENCY]
2
2
  // cSpell:ignore setex
3
3
  import type { CacheRepositoryPort, CacheRepositoryTtlType } from "./cache-repository.port";
4
+ import type { CacheValueType } from "./cache-value.vo";
4
5
  import type { Hash } from "./hash.vo";
5
6
 
6
7
  export class CacheRepositoryRedisAdapter implements CacheRepositoryPort {
@@ -9,20 +10,22 @@ export class CacheRepositoryRedisAdapter implements CacheRepositoryPort {
9
10
  private readonly config: CacheRepositoryTtlType,
10
11
  ) {}
11
12
 
12
- async get<T>(subject: Hash): Promise<T | null> {
13
+ async get(subject: Hash): Promise<CacheValueType | null> {
13
14
  const value = await this.client.get(subject.get());
14
15
  if (value === null) return null;
15
16
  return JSON.parse(value);
16
17
  }
17
18
 
18
- async set<T>(subject: Hash, value: T): Promise<void> {
19
+ async set(subject: Hash, value: CacheValueType): Promise<void> {
19
20
  const serialized = JSON.stringify(value);
20
21
 
21
- if (this.config.type === "finite") {
22
- await this.client.setex(subject.get(), this.config.ttl.seconds, serialized);
23
- } else {
24
- await this.client.set(subject.get(), serialized);
25
- }
22
+ try {
23
+ if (this.config.type === "finite") {
24
+ await this.client.setex(subject.get(), this.config.ttl.seconds, serialized);
25
+ } else {
26
+ await this.client.set(subject.get(), serialized);
27
+ }
28
+ } catch {}
26
29
  }
27
30
 
28
31
  async delete(subject: Hash): Promise<void> {
@@ -1,11 +1,12 @@
1
1
  import type * as tools from "@bgord/tools";
2
+ import type { CacheValueType } from "./cache-value.vo";
2
3
  import type { Hash } from "./hash.vo";
3
4
 
4
5
  export type CacheRepositoryTtlType = { type: "finite"; ttl: tools.Duration } | { type: "infinite" };
5
6
 
6
7
  export interface CacheRepositoryPort {
7
- get<T>(subject: Hash): Promise<T | null>;
8
- set<T>(subject: Hash, value: T): Promise<void>;
8
+ get(subject: Hash): Promise<CacheValueType | null>;
9
+ set(subject: Hash, value: CacheValueType): Promise<void>;
9
10
  delete(subject: Hash): Promise<void>;
10
11
  flush(): Promise<void>;
11
12
  }
@@ -0,0 +1,11 @@
1
+ import type { CacheCodecStrategy } from "./cache-codec.strategy";
2
+ import type { CacheResolverStrategy } from "./cache-resolver.strategy";
3
+ import type { Hash } from "./hash.vo";
4
+
5
+ export class CacheResolverNoopStrategy implements CacheResolverStrategy {
6
+ async resolve<T>(_subject: Hash, producer: () => Promise<T>, _codec: CacheCodecStrategy<T>): Promise<T> {
7
+ return producer();
8
+ }
9
+
10
+ async flush(): Promise<void> {}
11
+ }
@@ -0,0 +1,27 @@
1
+ import type { CacheCodecStrategy } from "./cache-codec.strategy";
2
+ import type { CacheRepositoryPort } from "./cache-repository.port";
3
+ import type { CacheResolverStrategy } from "./cache-resolver.strategy";
4
+ import type { Hash } from "./hash.vo";
5
+
6
+ type Dependencies = { CacheRepository: CacheRepositoryPort };
7
+
8
+ export class CacheResolverReadThroughStrategy implements CacheResolverStrategy {
9
+ constructor(private readonly deps: Dependencies) {}
10
+
11
+ async resolve<T>(subject: Hash, producer: () => Promise<T>, codec: CacheCodecStrategy<T>): Promise<T> {
12
+ try {
13
+ const cached = await this.deps.CacheRepository.get(subject);
14
+
15
+ if (cached !== null) return codec.decode(cached);
16
+ } catch {}
17
+
18
+ const value = await producer();
19
+ await this.deps.CacheRepository.set(subject, codec.encode(value));
20
+
21
+ return value;
22
+ }
23
+
24
+ async flush(): Promise<void> {
25
+ await this.deps.CacheRepository.flush();
26
+ }
27
+ }
@@ -1,17 +1,8 @@
1
+ import type { CacheCodecStrategy } from "./cache-codec.strategy";
1
2
  import type { Hash } from "./hash.vo";
2
3
 
3
- export enum CacheSourceEnum {
4
- hit = "hit",
5
- miss = "miss",
6
- }
7
-
8
4
  export interface CacheResolverStrategy {
9
- resolve<T>(subject: Hash, producer: () => Promise<T>): Promise<T>;
10
-
11
- resolveWithContext<T>(
12
- subject: Hash,
13
- producer: () => Promise<T>,
14
- ): Promise<{ value: T; source: CacheSourceEnum }>;
5
+ resolve<T>(subject: Hash, producer: () => Promise<T>, codec: CacheCodecStrategy<T>): Promise<T>;
15
6
 
16
7
  flush(): Promise<void>;
17
8
  }
@@ -0,0 +1,9 @@
1
+ type CacheJsonType =
2
+ | string
3
+ | number
4
+ | boolean
5
+ | null
6
+ | ReadonlyArray<CacheJsonType>
7
+ | { readonly [key: string]: CacheJsonType | undefined };
8
+
9
+ export type CacheValueType = Exclude<CacheJsonType, null>;
@@ -1,6 +1,7 @@
1
1
  import * as v from "valibot";
2
2
  import { UUID } from "./uuid.vo";
3
3
 
4
+ // Stryker disable next-line StringLiteral
4
5
  export const CorrelationId = v.pipe(UUID, v.brand("CorrelationId"));
5
6
 
6
7
  export type CorrelationIdType = v.InferOutput<typeof CorrelationId>;