@kuckit/infrastructure 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/apply-decorators-CW23qWy7.d.ts +23 -0
  2. package/dist/apply-decorators-CaHIAL5X.js +29 -0
  3. package/dist/apply-decorators-CaHIAL5X.js.map +1 -0
  4. package/dist/cache/in-memory-cache-store.d.ts +2 -0
  5. package/dist/cache/in-memory-cache-store.js +3 -0
  6. package/dist/cache/index.d.ts +3 -0
  7. package/dist/cache/index.js +4 -0
  8. package/dist/cache-BjdZ-Ye4.js +1 -0
  9. package/dist/core.module-B1TdC0yX.d.ts +17 -0
  10. package/dist/core.module-DMtIkTcz.js +48 -0
  11. package/dist/core.module-DMtIkTcz.js.map +1 -0
  12. package/dist/db/drizzle/db.d.ts +2 -0
  13. package/dist/db/drizzle/db.js +3 -0
  14. package/dist/db/drizzle/repositories/index.d.ts +3 -0
  15. package/dist/db/drizzle/repositories/index.js +4 -0
  16. package/dist/db/drizzle/repositories/user.drizzle.d.ts +2 -0
  17. package/dist/db/drizzle/repositories/user.drizzle.js +3 -0
  18. package/dist/db/transaction.d.ts +2 -0
  19. package/dist/db/transaction.js +4 -0
  20. package/dist/db-C4IcCT04.js +25 -0
  21. package/dist/db-C4IcCT04.js.map +1 -0
  22. package/dist/db-tAPHBDyL.d.ts +17 -0
  23. package/dist/decorators/apply-decorators.d.ts +2 -0
  24. package/dist/decorators/apply-decorators.js +5 -0
  25. package/dist/decorators/index.d.ts +8 -0
  26. package/dist/decorators/index.js +9 -0
  27. package/dist/decorators/use-case-decorator.d.ts +3 -0
  28. package/dist/decorators/use-case-decorator.js +4 -0
  29. package/dist/decorators/with-caching.d.ts +2 -0
  30. package/dist/decorators/with-caching.js +3 -0
  31. package/dist/decorators/with-rate-limit.d.ts +2 -0
  32. package/dist/decorators/with-rate-limit.js +3 -0
  33. package/dist/decorators/with-retry.d.ts +2 -0
  34. package/dist/decorators/with-retry.js +3 -0
  35. package/dist/decorators-CqyPE9AQ.js +1 -0
  36. package/dist/error-handler-BDid7SIZ.d.ts +47 -0
  37. package/dist/error-handler-D4s_TTI1.js +80 -0
  38. package/dist/error-handler-D4s_TTI1.js.map +1 -0
  39. package/dist/errors/error-handler.d.ts +3 -0
  40. package/dist/errors/error-handler.js +4 -0
  41. package/dist/errors/index.d.ts +4 -0
  42. package/dist/errors/index.js +5 -0
  43. package/dist/errors-BB_jeye8.js +43 -0
  44. package/dist/errors-BB_jeye8.js.map +1 -0
  45. package/dist/errors-DfkerzdO.js +1 -0
  46. package/dist/event-publisher-adapter-B02oKEmP.js +46 -0
  47. package/dist/event-publisher-adapter-B02oKEmP.js.map +1 -0
  48. package/dist/event-publisher-adapter-CpxK0OJ3.d.ts +12 -0
  49. package/dist/events/event-publisher-adapter.d.ts +2 -0
  50. package/dist/events/event-publisher-adapter.js +3 -0
  51. package/dist/events/in-memory-event-bus.d.ts +2 -0
  52. package/dist/events/in-memory-event-bus.js +3 -0
  53. package/dist/events/in-memory-event-publisher.d.ts +2 -0
  54. package/dist/events/in-memory-event-publisher.js +3 -0
  55. package/dist/events/index.d.ts +5 -0
  56. package/dist/events/index.js +6 -0
  57. package/dist/events-Dqynhuj2.js +1 -0
  58. package/dist/in-memory-cache-store-BaRxM--K.d.ts +31 -0
  59. package/dist/in-memory-cache-store-oClww-8m.js +72 -0
  60. package/dist/in-memory-cache-store-oClww-8m.js.map +1 -0
  61. package/dist/in-memory-event-bus-BCyPrNAE.js +60 -0
  62. package/dist/in-memory-event-bus-BCyPrNAE.js.map +1 -0
  63. package/dist/in-memory-event-bus-CqIBLRze.d.ts +21 -0
  64. package/dist/in-memory-event-publisher-BdOlxfkx.js +28 -0
  65. package/dist/in-memory-event-publisher-BdOlxfkx.js.map +1 -0
  66. package/dist/in-memory-event-publisher-CxOQ-hnq.d.ts +12 -0
  67. package/dist/in-memory-rate-limiter-BDSHZXxf.js +72 -0
  68. package/dist/in-memory-rate-limiter-BDSHZXxf.js.map +1 -0
  69. package/dist/in-memory-rate-limiter-DJsxdZZR.d.ts +34 -0
  70. package/dist/index-B5F3AfVc.d.ts +1 -0
  71. package/dist/index-B7z6dpFd.d.ts +1 -0
  72. package/dist/index-BH67NKRs.d.ts +2 -0
  73. package/dist/index-C0yeuOwC.d.ts +1 -0
  74. package/dist/index-C6nYd7xV.d.ts +2 -0
  75. package/dist/index-DVGDAddE.d.ts +1 -0
  76. package/dist/index-DXJbbtWQ.d.ts +1 -0
  77. package/dist/index-LKrIp3Oo.d.ts +1 -0
  78. package/dist/index.d.ts +29 -506
  79. package/dist/index.js +27 -969
  80. package/dist/logger-Bl10drB8.d.ts +23 -0
  81. package/dist/logging/index.d.ts +5 -0
  82. package/dist/logging/index.js +5 -0
  83. package/dist/logging/request-logger.d.ts +2 -0
  84. package/dist/logging/request-logger.js +3 -0
  85. package/dist/logging/structured-logger.d.ts +3 -0
  86. package/dist/logging/structured-logger.js +3 -0
  87. package/dist/logging-4mLSrMc6.js +1 -0
  88. package/dist/modules/core.module.d.ts +10 -0
  89. package/dist/modules/core.module.js +13 -0
  90. package/dist/modules/index.d.ts +12 -0
  91. package/dist/modules/index.js +16 -0
  92. package/dist/modules/types.d.ts +9 -0
  93. package/dist/modules/types.js +6 -0
  94. package/dist/modules/user.module.d.ts +10 -0
  95. package/dist/modules/user.module.js +4 -0
  96. package/dist/modules-C_2SF3he.js +1 -0
  97. package/dist/rate-limiter/in-memory-rate-limiter.d.ts +2 -0
  98. package/dist/rate-limiter/in-memory-rate-limiter.js +3 -0
  99. package/dist/rate-limiter/index.d.ts +3 -0
  100. package/dist/rate-limiter/index.js +4 -0
  101. package/dist/rate-limiter-BnvPGJOK.js +1 -0
  102. package/dist/repositories-nTfSJyvW.js +1 -0
  103. package/dist/request-logger-CK3SOnoz.d.ts +23 -0
  104. package/dist/request-logger-Cw1XQWTV.js +49 -0
  105. package/dist/request-logger-Cw1XQWTV.js.map +1 -0
  106. package/dist/structured-logger-BsxDI9zX.js +119 -0
  107. package/dist/structured-logger-BsxDI9zX.js.map +1 -0
  108. package/dist/structured-logger-Dz06Uz-u.d.ts +47 -0
  109. package/dist/transaction-akuz5Fch.d.ts +22 -0
  110. package/dist/transaction-r4Sy3eC-.js +35 -0
  111. package/dist/transaction-r4Sy3eC-.js.map +1 -0
  112. package/dist/types-65aFqB5L.d.ts +62 -0
  113. package/dist/use-case-decorator-DzPSPSv5.d.ts +52 -0
  114. package/dist/use-case-decorator-GmDeYViz.js +118 -0
  115. package/dist/use-case-decorator-GmDeYViz.js.map +1 -0
  116. package/dist/user.drizzle-9kkstnkV.d.ts +12 -0
  117. package/dist/user.drizzle-CgKIqqb3.js +57 -0
  118. package/dist/user.drizzle-CgKIqqb3.js.map +1 -0
  119. package/dist/user.module-BEpCbKsU.js +17 -0
  120. package/dist/user.module-BEpCbKsU.js.map +1 -0
  121. package/dist/user.module-D3lVJ98T.d.ts +15 -0
  122. package/dist/with-caching-BniS1aZd.d.ts +39 -0
  123. package/dist/with-caching-NmBxu7vJ.js +37 -0
  124. package/dist/with-caching-NmBxu7vJ.js.map +1 -0
  125. package/dist/with-rate-limit-Cp2V1RHn.js +48 -0
  126. package/dist/with-rate-limit-Cp2V1RHn.js.map +1 -0
  127. package/dist/with-rate-limit-DK4ZF-Qg.d.ts +45 -0
  128. package/dist/with-retry-B9-hUj7I.d.ts +40 -0
  129. package/dist/with-retry-coyYPiX1.js +49 -0
  130. package/dist/with-retry-coyYPiX1.js.map +1 -0
  131. package/package.json +10 -24
  132. package/src/index.ts +0 -26
@@ -0,0 +1,23 @@
1
+ //#region ../domain/src/ports/logger.d.ts
2
+ /**
3
+ * Logger port - structured logging for Loki/Prometheus
4
+ * Loki-compatible: labels and structured fields in meta
5
+ */
6
+ interface Logger {
7
+ debug: (message: string, meta?: LogContext) => void;
8
+ info: (message: string, meta?: LogContext) => void;
9
+ warn: (message: string, meta?: LogContext) => void;
10
+ error: (message: string, meta?: LogContext | Error) => void;
11
+ }
12
+ /**
13
+ * Structured log context (Loki labels)
14
+ */
15
+ interface LogContext {
16
+ requestId?: string;
17
+ userId?: string;
18
+ feature?: string;
19
+ [key: string]: any;
20
+ }
21
+ //#endregion
22
+ export { Logger as n, LogContext as t };
23
+ //# sourceMappingURL=logger-Bl10drB8.d.ts.map
@@ -0,0 +1,5 @@
1
+ import "../logger-Bl10drB8.js";
2
+ import { n as makeStructuredLogger, t as StructuredLogger } from "../structured-logger-Dz06Uz-u.js";
3
+ import { n as makeRequestLogger, t as RequestLoggerOptions } from "../request-logger-CK3SOnoz.js";
4
+ import "../index-DVGDAddE.js";
5
+ export { RequestLoggerOptions, StructuredLogger, makeRequestLogger, makeStructuredLogger };
@@ -0,0 +1,5 @@
1
+ import { n as makeStructuredLogger, t as StructuredLogger } from "../structured-logger-BsxDI9zX.js";
2
+ import { t as makeRequestLogger } from "../request-logger-Cw1XQWTV.js";
3
+ import "../logging-4mLSrMc6.js";
4
+
5
+ export { StructuredLogger, makeRequestLogger, makeStructuredLogger };
@@ -0,0 +1,2 @@
1
+ import { n as makeRequestLogger, t as RequestLoggerOptions } from "../request-logger-CK3SOnoz.js";
2
+ export { RequestLoggerOptions, makeRequestLogger };
@@ -0,0 +1,3 @@
1
+ import { t as makeRequestLogger } from "../request-logger-Cw1XQWTV.js";
2
+
3
+ export { makeRequestLogger };
@@ -0,0 +1,3 @@
1
+ import "../logger-Bl10drB8.js";
2
+ import { n as makeStructuredLogger, t as StructuredLogger } from "../structured-logger-Dz06Uz-u.js";
3
+ export { StructuredLogger, makeStructuredLogger };
@@ -0,0 +1,3 @@
1
+ import { n as makeStructuredLogger, t as StructuredLogger } from "../structured-logger-BsxDI9zX.js";
2
+
3
+ export { StructuredLogger, makeStructuredLogger };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,10 @@
1
+ import "../db-tAPHBDyL.js";
2
+ import "../logger-Bl10drB8.js";
3
+ import "../error-handler-BDid7SIZ.js";
4
+ import "../index-LKrIp3Oo.js";
5
+ import "../structured-logger-Dz06Uz-u.js";
6
+ import "../request-logger-CK3SOnoz.js";
7
+ import "../index-DVGDAddE.js";
8
+ import "../types-65aFqB5L.js";
9
+ import { t as registerCoreModule } from "../core.module-B1TdC0yX.js";
10
+ export { registerCoreModule };
@@ -0,0 +1,13 @@
1
+ import "../db-C4IcCT04.js";
2
+ import "../structured-logger-BsxDI9zX.js";
3
+ import "../request-logger-Cw1XQWTV.js";
4
+ import "../logging-4mLSrMc6.js";
5
+ import "../errors-BB_jeye8.js";
6
+ import "../error-handler-D4s_TTI1.js";
7
+ import "../errors-DfkerzdO.js";
8
+ import "../in-memory-event-bus-BCyPrNAE.js";
9
+ import "../in-memory-cache-store-oClww-8m.js";
10
+ import "../in-memory-rate-limiter-BDSHZXxf.js";
11
+ import { t as registerCoreModule } from "../core.module-DMtIkTcz.js";
12
+
13
+ export { registerCoreModule };
@@ -0,0 +1,12 @@
1
+ import "../db-tAPHBDyL.js";
2
+ import "../logger-Bl10drB8.js";
3
+ import "../error-handler-BDid7SIZ.js";
4
+ import "../index-LKrIp3Oo.js";
5
+ import "../structured-logger-Dz06Uz-u.js";
6
+ import "../request-logger-CK3SOnoz.js";
7
+ import "../index-DVGDAddE.js";
8
+ import { n as Cradle, t as Config } from "../types-65aFqB5L.js";
9
+ import { t as registerCoreModule } from "../core.module-B1TdC0yX.js";
10
+ import { t as registerUserModule } from "../user.module-D3lVJ98T.js";
11
+ import "../index-B7z6dpFd.js";
12
+ export { Config, Cradle, registerCoreModule, registerUserModule };
@@ -0,0 +1,16 @@
1
+ import "../db-C4IcCT04.js";
2
+ import "../user.drizzle-CgKIqqb3.js";
3
+ import "../structured-logger-BsxDI9zX.js";
4
+ import "../request-logger-Cw1XQWTV.js";
5
+ import "../logging-4mLSrMc6.js";
6
+ import "../errors-BB_jeye8.js";
7
+ import "../error-handler-D4s_TTI1.js";
8
+ import "../errors-DfkerzdO.js";
9
+ import "../in-memory-event-bus-BCyPrNAE.js";
10
+ import "../in-memory-cache-store-oClww-8m.js";
11
+ import "../in-memory-rate-limiter-BDSHZXxf.js";
12
+ import { t as registerCoreModule } from "../core.module-DMtIkTcz.js";
13
+ import { t as registerUserModule } from "../user.module-BEpCbKsU.js";
14
+ import "../modules-C_2SF3he.js";
15
+
16
+ export { registerCoreModule, registerUserModule };
@@ -0,0 +1,9 @@
1
+ import "../db-tAPHBDyL.js";
2
+ import "../logger-Bl10drB8.js";
3
+ import "../error-handler-BDid7SIZ.js";
4
+ import "../index-LKrIp3Oo.js";
5
+ import "../structured-logger-Dz06Uz-u.js";
6
+ import "../request-logger-CK3SOnoz.js";
7
+ import "../index-DVGDAddE.js";
8
+ import { n as Cradle, t as Config } from "../types-65aFqB5L.js";
9
+ export { Config, Cradle };
@@ -0,0 +1,6 @@
1
+ import "../db-C4IcCT04.js";
2
+ import { Pool } from "pg";
3
+ import { google } from "@ai-sdk/google";
4
+ import { auth } from "@kuckit/auth";
5
+
6
+ export { };
@@ -0,0 +1,10 @@
1
+ import "../db-tAPHBDyL.js";
2
+ import "../logger-Bl10drB8.js";
3
+ import "../error-handler-BDid7SIZ.js";
4
+ import "../index-LKrIp3Oo.js";
5
+ import "../structured-logger-Dz06Uz-u.js";
6
+ import "../request-logger-CK3SOnoz.js";
7
+ import "../index-DVGDAddE.js";
8
+ import "../types-65aFqB5L.js";
9
+ import { t as registerUserModule } from "../user.module-D3lVJ98T.js";
10
+ export { registerUserModule };
@@ -0,0 +1,4 @@
1
+ import "../user.drizzle-CgKIqqb3.js";
2
+ import { t as registerUserModule } from "../user.module-BEpCbKsU.js";
3
+
4
+ export { registerUserModule };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import { t as InMemoryRateLimiterStore } from "../in-memory-rate-limiter-DJsxdZZR.js";
2
+ export { InMemoryRateLimiterStore };
@@ -0,0 +1,3 @@
1
+ import { t as InMemoryRateLimiterStore } from "../in-memory-rate-limiter-BDSHZXxf.js";
2
+
3
+ export { InMemoryRateLimiterStore };
@@ -0,0 +1,3 @@
1
+ import { t as InMemoryRateLimiterStore } from "../in-memory-rate-limiter-DJsxdZZR.js";
2
+ import { t as RateLimiterStore } from "../index-BH67NKRs.js";
3
+ export { InMemoryRateLimiterStore, RateLimiterStore };
@@ -0,0 +1,4 @@
1
+ import { t as InMemoryRateLimiterStore } from "../in-memory-rate-limiter-BDSHZXxf.js";
2
+ import "../rate-limiter-BnvPGJOK.js";
3
+
4
+ export { InMemoryRateLimiterStore };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,23 @@
1
+ import { Logger } from "@kuckit/domain/ports/logger";
2
+
3
+ //#region src/logging/request-logger.d.ts
4
+
5
+ /**
6
+ * Options for creating a request-scoped logger
7
+ */
8
+ interface RequestLoggerOptions {
9
+ requestId: string;
10
+ userId?: string;
11
+ baseLogger: Logger;
12
+ }
13
+ /**
14
+ * Create a request-scoped logger that automatically includes
15
+ * requestId and userId in all log entries.
16
+ *
17
+ * This wraps the base singleton logger and enriches all log
18
+ * calls with request context for Loki-compatible structured logging.
19
+ */
20
+ declare const makeRequestLogger: (options: RequestLoggerOptions) => Logger;
21
+ //#endregion
22
+ export { makeRequestLogger as n, RequestLoggerOptions as t };
23
+ //# sourceMappingURL=request-logger-CK3SOnoz.d.ts.map
@@ -0,0 +1,49 @@
1
+ //#region src/logging/request-logger.ts
2
+ /**
3
+ * Create a request-scoped logger that automatically includes
4
+ * requestId and userId in all log entries.
5
+ *
6
+ * This wraps the base singleton logger and enriches all log
7
+ * calls with request context for Loki-compatible structured logging.
8
+ */
9
+ const makeRequestLogger = (options) => {
10
+ const context = {
11
+ requestId: options.requestId,
12
+ ...options.userId && { userId: options.userId }
13
+ };
14
+ return {
15
+ debug: (message, meta) => {
16
+ options.baseLogger.debug(message, {
17
+ ...context,
18
+ ...meta
19
+ });
20
+ },
21
+ info: (message, meta) => {
22
+ options.baseLogger.info(message, {
23
+ ...context,
24
+ ...meta
25
+ });
26
+ },
27
+ warn: (message, meta) => {
28
+ options.baseLogger.warn(message, {
29
+ ...context,
30
+ ...meta
31
+ });
32
+ },
33
+ error: (message, meta) => {
34
+ if (meta instanceof Error) options.baseLogger.error(message, {
35
+ ...context,
36
+ error: meta.message,
37
+ stack: meta.stack
38
+ });
39
+ else options.baseLogger.error(message, {
40
+ ...context,
41
+ ...meta
42
+ });
43
+ }
44
+ };
45
+ };
46
+
47
+ //#endregion
48
+ export { makeRequestLogger as t };
49
+ //# sourceMappingURL=request-logger-Cw1XQWTV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-logger-Cw1XQWTV.js","names":["context: LogContext"],"sources":["../src/logging/request-logger.ts"],"sourcesContent":["import type { Logger, LogContext } from '@kuckit/domain/ports/logger'\n\n/**\n * Options for creating a request-scoped logger\n */\nexport interface RequestLoggerOptions {\n\trequestId: string\n\tuserId?: string\n\tbaseLogger: Logger\n}\n\n/**\n * Create a request-scoped logger that automatically includes\n * requestId and userId in all log entries.\n *\n * This wraps the base singleton logger and enriches all log\n * calls with request context for Loki-compatible structured logging.\n */\nexport const makeRequestLogger = (options: RequestLoggerOptions): Logger => {\n\tconst context: LogContext = {\n\t\trequestId: options.requestId,\n\t\t...(options.userId && { userId: options.userId }),\n\t}\n\n\treturn {\n\t\tdebug: (message: string, meta?: LogContext) => {\n\t\t\toptions.baseLogger.debug(message, { ...context, ...meta })\n\t\t},\n\n\t\tinfo: (message: string, meta?: LogContext) => {\n\t\t\toptions.baseLogger.info(message, { ...context, ...meta })\n\t\t},\n\n\t\twarn: (message: string, meta?: LogContext) => {\n\t\t\toptions.baseLogger.warn(message, { ...context, ...meta })\n\t\t},\n\n\t\terror: (message: string, meta?: LogContext | Error) => {\n\t\t\tif (meta instanceof Error) {\n\t\t\t\toptions.baseLogger.error(message, {\n\t\t\t\t\t...context,\n\t\t\t\t\terror: meta.message,\n\t\t\t\t\tstack: meta.stack,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\toptions.baseLogger.error(message, { ...context, ...meta })\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;AAkBA,MAAa,qBAAqB,YAA0C;CAC3E,MAAMA,UAAsB;EAC3B,WAAW,QAAQ;EACnB,GAAI,QAAQ,UAAU,EAAE,QAAQ,QAAQ,QAAQ;EAChD;AAED,QAAO;EACN,QAAQ,SAAiB,SAAsB;AAC9C,WAAQ,WAAW,MAAM,SAAS;IAAE,GAAG;IAAS,GAAG;IAAM,CAAC;;EAG3D,OAAO,SAAiB,SAAsB;AAC7C,WAAQ,WAAW,KAAK,SAAS;IAAE,GAAG;IAAS,GAAG;IAAM,CAAC;;EAG1D,OAAO,SAAiB,SAAsB;AAC7C,WAAQ,WAAW,KAAK,SAAS;IAAE,GAAG;IAAS,GAAG;IAAM,CAAC;;EAG1D,QAAQ,SAAiB,SAA8B;AACtD,OAAI,gBAAgB,MACnB,SAAQ,WAAW,MAAM,SAAS;IACjC,GAAG;IACH,OAAO,KAAK;IACZ,OAAO,KAAK;IACZ,CAAC;OAEF,SAAQ,WAAW,MAAM,SAAS;IAAE,GAAG;IAAS,GAAG;IAAM,CAAC;;EAG5D"}
@@ -0,0 +1,119 @@
1
+ import { createWriteStream, existsSync, mkdirSync } from "fs";
2
+ import path from "path";
3
+
4
+ //#region src/logging/structured-logger.ts
5
+ /**
6
+ * Structured logger implementation
7
+ * - JSON logs compatible with Loki
8
+ * - File + stdout support
9
+ * - Prometheus metrics collection
10
+ */
11
+ var StructuredLogger = class {
12
+ fileStream = null;
13
+ metrics;
14
+ constructor(options = {}) {
15
+ this.options = options;
16
+ this.metrics = new MetricsCollector();
17
+ if (options.enableFile && options.logDir) this.initFileStream(options.logDir);
18
+ }
19
+ initFileStream(logDir) {
20
+ if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
21
+ this.fileStream = createWriteStream(path.join(logDir, `app-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.log`), { flags: "a" });
22
+ }
23
+ debug(message, meta) {
24
+ this.log("DEBUG", message, meta);
25
+ }
26
+ info(message, meta) {
27
+ this.log("INFO", message, meta);
28
+ }
29
+ warn(message, meta) {
30
+ this.log("WARN", message, meta);
31
+ }
32
+ error(message, meta) {
33
+ const context = meta instanceof Error ? {
34
+ error: meta.message,
35
+ stack: meta.stack
36
+ } : meta;
37
+ this.log("ERROR", message, context);
38
+ }
39
+ log(level, message, meta) {
40
+ if (this.shouldSkip(level)) return;
41
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
42
+ const logEntry = this.formatLog(level, message, meta, timestamp);
43
+ console.log(logEntry);
44
+ if (this.fileStream) this.fileStream.write(logEntry + "\n");
45
+ this.metrics.recordLog(level, meta?.feature);
46
+ }
47
+ shouldSkip(level) {
48
+ const levels = [
49
+ "DEBUG",
50
+ "INFO",
51
+ "WARN",
52
+ "ERROR"
53
+ ];
54
+ const minLevel = this.options.minLevel || "DEBUG";
55
+ return levels.indexOf(level) < levels.indexOf(minLevel);
56
+ }
57
+ formatLog(level, message, meta, timestamp) {
58
+ const logObject = {
59
+ timestamp,
60
+ level,
61
+ message,
62
+ ...meta
63
+ };
64
+ if (meta?.requestId) logObject.requestId = meta.requestId;
65
+ if (meta?.userId) logObject.userId = meta.userId;
66
+ if (meta?.feature) logObject.feature = meta.feature;
67
+ return JSON.stringify(logObject);
68
+ }
69
+ /**
70
+ * Get metrics in Prometheus text format
71
+ */
72
+ getMetrics() {
73
+ return this.metrics.toPrometheusFormat();
74
+ }
75
+ /**
76
+ * Cleanup resources
77
+ */
78
+ async dispose() {
79
+ return new Promise((resolve) => {
80
+ if (this.fileStream) this.fileStream.end(() => resolve());
81
+ else resolve();
82
+ });
83
+ }
84
+ };
85
+ /**
86
+ * Prometheus metrics collector
87
+ */
88
+ var MetricsCollector = class {
89
+ logCount = new Map([
90
+ ["DEBUG", 0],
91
+ ["INFO", 0],
92
+ ["WARN", 0],
93
+ ["ERROR", 0]
94
+ ]);
95
+ featureCount = /* @__PURE__ */ new Map();
96
+ recordLog(level, feature) {
97
+ this.logCount.set(level, (this.logCount.get(level) || 0) + 1);
98
+ if (feature) this.featureCount.set(feature, (this.featureCount.get(feature) || 0) + 1);
99
+ }
100
+ toPrometheusFormat() {
101
+ const lines = ["# HELP app_logs_total Total number of logs by level", "# TYPE app_logs_total counter"];
102
+ for (const [level, count] of this.logCount) lines.push(`app_logs_total{level="${level}"} ${count}`);
103
+ lines.push("");
104
+ lines.push("# HELP app_feature_logs_total Total logs by feature");
105
+ lines.push("# TYPE app_feature_logs_total counter");
106
+ for (const [feature, count] of this.featureCount) lines.push(`app_feature_logs_total{feature="${feature}"} ${count}`);
107
+ return lines.join("\n");
108
+ }
109
+ };
110
+ /**
111
+ * Create logger instance
112
+ */
113
+ const makeStructuredLogger = (options) => {
114
+ return new StructuredLogger(options);
115
+ };
116
+
117
+ //#endregion
118
+ export { makeStructuredLogger as n, StructuredLogger as t };
119
+ //# sourceMappingURL=structured-logger-BsxDI9zX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-logger-BsxDI9zX.js","names":["options: {\n\t\t\tlogDir?: string\n\t\t\tenableFile?: boolean\n\t\t\tminLevel?: LogLevel\n\t\t}","levels: LogLevel[]","logObject: Record<string, any>","lines: string[]"],"sources":["../src/logging/structured-logger.ts"],"sourcesContent":["import { createWriteStream, existsSync, mkdirSync } from 'fs'\nimport path from 'path'\nimport type { Logger, LogContext } from '../../../domain/src/ports/logger'\n\ntype LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'\n\n/**\n * Structured logger implementation\n * - JSON logs compatible with Loki\n * - File + stdout support\n * - Prometheus metrics collection\n */\nexport class StructuredLogger implements Logger {\n\tprivate fileStream: ReturnType<typeof createWriteStream> | null = null\n\tprivate metrics: MetricsCollector\n\n\tconstructor(\n\t\tprivate options: {\n\t\t\tlogDir?: string\n\t\t\tenableFile?: boolean\n\t\t\tminLevel?: LogLevel\n\t\t} = {}\n\t) {\n\t\tthis.metrics = new MetricsCollector()\n\n\t\tif (options.enableFile && options.logDir) {\n\t\t\tthis.initFileStream(options.logDir)\n\t\t}\n\t}\n\n\tprivate initFileStream(logDir: string): void {\n\t\tif (!existsSync(logDir)) {\n\t\t\tmkdirSync(logDir, { recursive: true })\n\t\t}\n\n\t\tconst logFile = path.join(logDir, `app-${new Date().toISOString().split('T')[0]}.log`)\n\t\tthis.fileStream = createWriteStream(logFile, { flags: 'a' })\n\t}\n\n\tdebug(message: string, meta?: LogContext): void {\n\t\tthis.log('DEBUG', message, meta)\n\t}\n\n\tinfo(message: string, meta?: LogContext): void {\n\t\tthis.log('INFO', message, meta)\n\t}\n\n\twarn(message: string, meta?: LogContext): void {\n\t\tthis.log('WARN', message, meta)\n\t}\n\n\terror(message: string, meta?: LogContext | Error): void {\n\t\tconst context = meta instanceof Error ? { error: meta.message, stack: meta.stack } : meta\n\t\tthis.log('ERROR', message, context)\n\t}\n\n\tprivate log(level: LogLevel, message: string, meta?: any): void {\n\t\tif (this.shouldSkip(level)) return\n\n\t\tconst timestamp = new Date().toISOString()\n\t\tconst logEntry = this.formatLog(level, message, meta, timestamp)\n\n\t\t// stdout\n\t\tconsole.log(logEntry)\n\n\t\t// file\n\t\tif (this.fileStream) {\n\t\t\tthis.fileStream.write(logEntry + '\\n')\n\t\t}\n\n\t\t// metrics\n\t\tthis.metrics.recordLog(level, meta?.feature)\n\t}\n\n\tprivate shouldSkip(level: LogLevel): boolean {\n\t\tconst levels: LogLevel[] = ['DEBUG', 'INFO', 'WARN', 'ERROR']\n\t\tconst minLevel = this.options.minLevel || 'DEBUG'\n\t\treturn levels.indexOf(level) < levels.indexOf(minLevel)\n\t}\n\n\tprivate formatLog(level: LogLevel, message: string, meta: any, timestamp: string): string {\n\t\tconst logObject: Record<string, any> = {\n\t\t\ttimestamp,\n\t\t\tlevel,\n\t\t\tmessage,\n\t\t\t...meta,\n\t\t}\n\n\t\t// Loki labels (structured fields at root level)\n\t\tif (meta?.requestId) logObject.requestId = meta.requestId\n\t\tif (meta?.userId) logObject.userId = meta.userId\n\t\tif (meta?.feature) logObject.feature = meta.feature\n\n\t\treturn JSON.stringify(logObject)\n\t}\n\n\t/**\n\t * Get metrics in Prometheus text format\n\t */\n\tgetMetrics(): string {\n\t\treturn this.metrics.toPrometheusFormat()\n\t}\n\n\t/**\n\t * Cleanup resources\n\t */\n\tasync dispose(): Promise<void> {\n\t\treturn new Promise((resolve) => {\n\t\t\tif (this.fileStream) {\n\t\t\t\tthis.fileStream.end(() => resolve())\n\t\t\t} else {\n\t\t\t\tresolve()\n\t\t\t}\n\t\t})\n\t}\n}\n\n/**\n * Prometheus metrics collector\n */\nclass MetricsCollector {\n\tprivate logCount: Map<LogLevel, number> = new Map([\n\t\t['DEBUG', 0],\n\t\t['INFO', 0],\n\t\t['WARN', 0],\n\t\t['ERROR', 0],\n\t])\n\tprivate featureCount: Map<string, number> = new Map()\n\n\trecordLog(level: LogLevel, feature?: string): void {\n\t\tthis.logCount.set(level, (this.logCount.get(level) || 0) + 1)\n\t\tif (feature) {\n\t\t\tthis.featureCount.set(feature, (this.featureCount.get(feature) || 0) + 1)\n\t\t}\n\t}\n\n\ttoPrometheusFormat(): string {\n\t\tconst lines: string[] = [\n\t\t\t'# HELP app_logs_total Total number of logs by level',\n\t\t\t'# TYPE app_logs_total counter',\n\t\t]\n\n\t\t// Log counters by level\n\t\tfor (const [level, count] of this.logCount) {\n\t\t\tlines.push(`app_logs_total{level=\"${level}\"} ${count}`)\n\t\t}\n\n\t\tlines.push('')\n\t\tlines.push('# HELP app_feature_logs_total Total logs by feature')\n\t\tlines.push('# TYPE app_feature_logs_total counter')\n\n\t\t// Log counters by feature\n\t\tfor (const [feature, count] of this.featureCount) {\n\t\t\tlines.push(`app_feature_logs_total{feature=\"${feature}\"} ${count}`)\n\t\t}\n\n\t\treturn lines.join('\\n')\n\t}\n}\n\n/**\n * Create logger instance\n */\nexport const makeStructuredLogger = (options?: {\n\tlogDir?: string\n\tenableFile?: boolean\n\tminLevel?: LogLevel\n}): StructuredLogger => {\n\treturn new StructuredLogger(options)\n}\n"],"mappings":"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"}
@@ -0,0 +1,47 @@
1
+ import { n as Logger, t as LogContext } from "./logger-Bl10drB8.js";
2
+
3
+ //#region src/logging/structured-logger.d.ts
4
+ type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
5
+ /**
6
+ * Structured logger implementation
7
+ * - JSON logs compatible with Loki
8
+ * - File + stdout support
9
+ * - Prometheus metrics collection
10
+ */
11
+ declare class StructuredLogger implements Logger {
12
+ private options;
13
+ private fileStream;
14
+ private metrics;
15
+ constructor(options?: {
16
+ logDir?: string;
17
+ enableFile?: boolean;
18
+ minLevel?: LogLevel;
19
+ });
20
+ private initFileStream;
21
+ debug(message: string, meta?: LogContext): void;
22
+ info(message: string, meta?: LogContext): void;
23
+ warn(message: string, meta?: LogContext): void;
24
+ error(message: string, meta?: LogContext | Error): void;
25
+ private log;
26
+ private shouldSkip;
27
+ private formatLog;
28
+ /**
29
+ * Get metrics in Prometheus text format
30
+ */
31
+ getMetrics(): string;
32
+ /**
33
+ * Cleanup resources
34
+ */
35
+ dispose(): Promise<void>;
36
+ }
37
+ /**
38
+ * Create logger instance
39
+ */
40
+ declare const makeStructuredLogger: (options?: {
41
+ logDir?: string;
42
+ enableFile?: boolean;
43
+ minLevel?: LogLevel;
44
+ }) => StructuredLogger;
45
+ //#endregion
46
+ export { makeStructuredLogger as n, StructuredLogger as t };
47
+ //# sourceMappingURL=structured-logger-Dz06Uz-u.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { AwilixContainer } from "awilix";
2
+
3
+ //#region src/db/transaction.d.ts
4
+
5
+ /**
6
+ * Run a function within a database transaction
7
+ * Creates a child scope with transaction-bound repositories
8
+ *
9
+ * Usage:
10
+ * ```typescript
11
+ * const result = await runInTransaction(container, async (txScope) => {
12
+ * const { userRepository } = txScope.cradle
13
+ * await userRepository.save(user)
14
+ * return user
15
+ * })
16
+ * ```
17
+ */
18
+ declare const runInTransaction: <T>(container: AwilixContainer, fn: (txScope: AwilixContainer) => Promise<T>) => Promise<T>;
19
+ type TransactionFn<T> = (txScope: AwilixContainer) => Promise<T>;
20
+ //#endregion
21
+ export { runInTransaction as n, TransactionFn as t };
22
+ //# sourceMappingURL=transaction-akuz5Fch.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { t as makeDrizzleUserRepository } from "./user.drizzle-CgKIqqb3.js";
2
+ import { asFunction, asValue } from "awilix";
3
+
4
+ //#region src/db/transaction.ts
5
+ /**
6
+ * Run a function within a database transaction
7
+ * Creates a child scope with transaction-bound repositories
8
+ *
9
+ * Usage:
10
+ * ```typescript
11
+ * const result = await runInTransaction(container, async (txScope) => {
12
+ * const { userRepository } = txScope.cradle
13
+ * await userRepository.save(user)
14
+ * return user
15
+ * })
16
+ * ```
17
+ */
18
+ const runInTransaction = async (container, fn) => {
19
+ return container.resolve("db").transaction(async (tx) => {
20
+ const txScope = container.createScope();
21
+ txScope.register({
22
+ db: asValue(tx),
23
+ userRepository: asFunction(({ db }) => makeDrizzleUserRepository(db)).scoped()
24
+ });
25
+ try {
26
+ return await fn(txScope);
27
+ } finally {
28
+ txScope.dispose();
29
+ }
30
+ });
31
+ };
32
+
33
+ //#endregion
34
+ export { runInTransaction as t };
35
+ //# sourceMappingURL=transaction-r4Sy3eC-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-r4Sy3eC-.js","names":[],"sources":["../src/db/transaction.ts"],"sourcesContent":["import type { AwilixContainer } from 'awilix'\nimport { asValue, asFunction } from 'awilix'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport { makeDrizzleUserRepository } from './drizzle/repositories/user.drizzle'\n\n/**\n * Run a function within a database transaction\n * Creates a child scope with transaction-bound repositories\n *\n * Usage:\n * ```typescript\n * const result = await runInTransaction(container, async (txScope) => {\n * const { userRepository } = txScope.cradle\n * await userRepository.save(user)\n * return user\n * })\n * ```\n */\nexport const runInTransaction = async <T>(\n\tcontainer: AwilixContainer,\n\tfn: (txScope: AwilixContainer) => Promise<T>\n): Promise<T> => {\n\tconst db = container.resolve<NodePgDatabase>('db')\n\n\treturn db.transaction(async (tx) => {\n\t\t// Create child scope for transaction\n\t\tconst txScope = container.createScope()\n\n\t\t// Register transaction-bound database and repositories\n\t\ttxScope.register({\n\t\t\tdb: asValue(tx),\n\t\t\t// Re-register repositories with tx-bound db\n\t\t\tuserRepository: asFunction(({ db }) => makeDrizzleUserRepository(db)).scoped(),\n\t\t})\n\n\t\ttry {\n\t\t\t// Execute function with transaction scope\n\t\t\treturn await fn(txScope)\n\t\t} finally {\n\t\t\t// Cleanup scope\n\t\t\ttxScope.dispose()\n\t\t}\n\t})\n}\n\nexport type TransactionFn<T> = (txScope: AwilixContainer) => Promise<T>\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAa,mBAAmB,OAC/B,WACA,OACgB;AAGhB,QAFW,UAAU,QAAwB,KAAK,CAExC,YAAY,OAAO,OAAO;EAEnC,MAAM,UAAU,UAAU,aAAa;AAGvC,UAAQ,SAAS;GAChB,IAAI,QAAQ,GAAG;GAEf,gBAAgB,YAAY,EAAE,SAAS,0BAA0B,GAAG,CAAC,CAAC,QAAQ;GAC9E,CAAC;AAEF,MAAI;AAEH,UAAO,MAAM,GAAG,QAAQ;YACf;AAET,WAAQ,SAAS;;GAEjB"}
@@ -0,0 +1,62 @@
1
+ import { t as createDb } from "./db-tAPHBDyL.js";
2
+ import { t as ErrorHandler } from "./error-handler-BDid7SIZ.js";
3
+ import { t as StructuredLogger } from "./structured-logger-Dz06Uz-u.js";
4
+ import { Pool } from "pg";
5
+ import { CacheStore, Clock, EventBus, EventPublisher, Logger, RateLimiterStore, User, UserRepository } from "@kuckit/domain";
6
+ import { google } from "@ai-sdk/google";
7
+ import { auth } from "@kuckit/auth";
8
+
9
+ //#region src/modules/types.d.ts
10
+
11
+ /**
12
+ * Application configuration
13
+ */
14
+ interface Config {
15
+ databaseUrl: string;
16
+ port: number;
17
+ corsOrigin: string;
18
+ googleAiApiKey: string;
19
+ logLevel: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
20
+ enableFileLogging: boolean;
21
+ logDir: string;
22
+ }
23
+ /**
24
+ * Typed Cradle interface for full type safety
25
+ * Includes all registrations from all modules
26
+ */
27
+ interface Cradle {
28
+ config: Config;
29
+ dbPool: Pool;
30
+ db: ReturnType<typeof createDb>;
31
+ clock: Clock;
32
+ logger: Logger & StructuredLogger;
33
+ errorHandler: ErrorHandler;
34
+ auth: typeof auth;
35
+ aiProvider: ReturnType<typeof google>;
36
+ eventBus: EventBus;
37
+ cacheStore: CacheStore;
38
+ rateLimiterStore: RateLimiterStore;
39
+ userRepository: UserRepository;
40
+ getUserProfile: (input: {
41
+ userId: string;
42
+ }) => Promise<User>;
43
+ updateUserProfile: (input: {
44
+ userId: string;
45
+ updates: Partial<{
46
+ name: string;
47
+ email: string;
48
+ }>;
49
+ }) => Promise<User>;
50
+ createUser: (input: {
51
+ name: string;
52
+ email: string;
53
+ emailVerified: boolean;
54
+ }) => Promise<User>;
55
+ eventPublisher: EventPublisher;
56
+ session?: any;
57
+ requestId: string;
58
+ requestLogger: Logger;
59
+ }
60
+ //#endregion
61
+ export { Cradle as n, Config as t };
62
+ //# sourceMappingURL=types-65aFqB5L.d.ts.map
@@ -0,0 +1,52 @@
1
+ import { n as Logger } from "./logger-Bl10drB8.js";
2
+
3
+ //#region src/decorators/use-case-decorator.d.ts
4
+
5
+ /**
6
+ * Use case decorator type
7
+ * Wraps a use case function with cross-cutting concerns
8
+ */
9
+ type UseCase<T extends (...args: any[]) => Promise<any>> = T;
10
+ /**
11
+ * Decorator context passed to all decorators
12
+ */
13
+ interface DecoratorContext {
14
+ logger: Logger;
15
+ requestId?: string;
16
+ userId?: string;
17
+ feature?: string;
18
+ }
19
+ /**
20
+ * Performance metrics collected by decorator
21
+ */
22
+ interface PerformanceMetrics {
23
+ startTime: number;
24
+ endTime: number;
25
+ durationMs: number;
26
+ }
27
+ /**
28
+ * Base decorator that adds performance monitoring
29
+ */
30
+ declare const withPerformanceMonitoring: <T extends (...args: any[]) => Promise<any>>(useCase: T, context: DecoratorContext, featureName: string) => T;
31
+ /**
32
+ * Base decorator that adds error handling and conversion
33
+ */
34
+ declare const withErrorHandling: <T extends (...args: any[]) => Promise<any>>(useCase: T, context: DecoratorContext, featureName: string) => T;
35
+ /**
36
+ * Request tracing decorator - adds context to logs
37
+ */
38
+ declare const withRequestTracing: <T extends (...args: any[]) => Promise<any>>(useCase: T, context: DecoratorContext, featureName: string) => T;
39
+ /**
40
+ * Compose multiple decorators together
41
+ * Order: Tracing → Performance → Error Handling
42
+ * (outermost → innermost)
43
+ */
44
+ declare const decorateUseCase: <T extends (...args: any[]) => Promise<any>>(useCase: T, context: DecoratorContext, featureName: string) => T;
45
+ /**
46
+ * Factory for creating decorated use cases
47
+ * Used in dependency injection to wrap use cases automatically
48
+ */
49
+ declare const makeDecoratedUseCase: <T extends (...args: any[]) => Promise<any>>(useCase: T, context: DecoratorContext, featureName: string) => T;
50
+ //#endregion
51
+ export { makeDecoratedUseCase as a, withRequestTracing as c, decorateUseCase as i, PerformanceMetrics as n, withErrorHandling as o, UseCase as r, withPerformanceMonitoring as s, DecoratorContext as t };
52
+ //# sourceMappingURL=use-case-decorator-DzPSPSv5.d.ts.map