@os.io/nest-kit 0.0.1-alpha.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 (287) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/dist/auth/auth.constants.d.ts +19 -0
  4. package/dist/auth/auth.constants.d.ts.map +1 -0
  5. package/dist/auth/auth.constants.js +19 -0
  6. package/dist/auth/auth.constants.js.map +1 -0
  7. package/dist/auth/auth.guard.d.ts +20 -0
  8. package/dist/auth/auth.guard.d.ts.map +1 -0
  9. package/dist/auth/auth.guard.js +84 -0
  10. package/dist/auth/auth.guard.js.map +1 -0
  11. package/dist/auth/auth.module.d.ts +26 -0
  12. package/dist/auth/auth.module.d.ts.map +1 -0
  13. package/dist/auth/auth.module.js +344 -0
  14. package/dist/auth/auth.module.js.map +1 -0
  15. package/dist/auth/auth.options.d.ts +179 -0
  16. package/dist/auth/auth.options.d.ts.map +1 -0
  17. package/dist/auth/auth.options.js +2 -0
  18. package/dist/auth/auth.options.js.map +1 -0
  19. package/dist/auth/auth.service.d.ts +57 -0
  20. package/dist/auth/auth.service.d.ts.map +1 -0
  21. package/dist/auth/auth.service.js +175 -0
  22. package/dist/auth/auth.service.js.map +1 -0
  23. package/dist/auth/authorization/index.d.ts +3 -0
  24. package/dist/auth/authorization/index.d.ts.map +1 -0
  25. package/dist/auth/authorization/index.js +3 -0
  26. package/dist/auth/authorization/index.js.map +1 -0
  27. package/dist/auth/authorization/pbac/index.d.ts +6 -0
  28. package/dist/auth/authorization/pbac/index.d.ts.map +1 -0
  29. package/dist/auth/authorization/pbac/index.js +4 -0
  30. package/dist/auth/authorization/pbac/index.js.map +1 -0
  31. package/dist/auth/authorization/pbac/pbac.decorator.d.ts +18 -0
  32. package/dist/auth/authorization/pbac/pbac.decorator.d.ts.map +1 -0
  33. package/dist/auth/authorization/pbac/pbac.decorator.js +14 -0
  34. package/dist/auth/authorization/pbac/pbac.decorator.js.map +1 -0
  35. package/dist/auth/authorization/pbac/pbac.guard.d.ts +19 -0
  36. package/dist/auth/authorization/pbac/pbac.guard.d.ts.map +1 -0
  37. package/dist/auth/authorization/pbac/pbac.guard.js +60 -0
  38. package/dist/auth/authorization/pbac/pbac.guard.js.map +1 -0
  39. package/dist/auth/authorization/pbac/pbac.service.d.ts +44 -0
  40. package/dist/auth/authorization/pbac/pbac.service.d.ts.map +1 -0
  41. package/dist/auth/authorization/pbac/pbac.service.js +146 -0
  42. package/dist/auth/authorization/pbac/pbac.service.js.map +1 -0
  43. package/dist/auth/authorization/pbac/pbac.types.d.ts +47 -0
  44. package/dist/auth/authorization/pbac/pbac.types.d.ts.map +1 -0
  45. package/dist/auth/authorization/pbac/pbac.types.js +2 -0
  46. package/dist/auth/authorization/pbac/pbac.types.js.map +1 -0
  47. package/dist/auth/authorization/rbac/index.d.ts +4 -0
  48. package/dist/auth/authorization/rbac/index.d.ts.map +1 -0
  49. package/dist/auth/authorization/rbac/index.js +4 -0
  50. package/dist/auth/authorization/rbac/index.js.map +1 -0
  51. package/dist/auth/authorization/rbac/rbac.decorator.d.ts +18 -0
  52. package/dist/auth/authorization/rbac/rbac.decorator.d.ts.map +1 -0
  53. package/dist/auth/authorization/rbac/rbac.decorator.js +25 -0
  54. package/dist/auth/authorization/rbac/rbac.decorator.js.map +1 -0
  55. package/dist/auth/authorization/rbac/rbac.guard.d.ts +19 -0
  56. package/dist/auth/authorization/rbac/rbac.guard.d.ts.map +1 -0
  57. package/dist/auth/authorization/rbac/rbac.guard.js +50 -0
  58. package/dist/auth/authorization/rbac/rbac.guard.js.map +1 -0
  59. package/dist/auth/authorization/rbac/rbac.service.d.ts +43 -0
  60. package/dist/auth/authorization/rbac/rbac.service.d.ts.map +1 -0
  61. package/dist/auth/authorization/rbac/rbac.service.js +95 -0
  62. package/dist/auth/authorization/rbac/rbac.service.js.map +1 -0
  63. package/dist/auth/decorators/current-user.decorator.d.ts +17 -0
  64. package/dist/auth/decorators/current-user.decorator.d.ts.map +1 -0
  65. package/dist/auth/decorators/current-user.decorator.js +23 -0
  66. package/dist/auth/decorators/current-user.decorator.js.map +1 -0
  67. package/dist/auth/decorators/index.d.ts +3 -0
  68. package/dist/auth/decorators/index.d.ts.map +1 -0
  69. package/dist/auth/decorators/index.js +3 -0
  70. package/dist/auth/decorators/index.js.map +1 -0
  71. package/dist/auth/decorators/public.decorator.d.ts +13 -0
  72. package/dist/auth/decorators/public.decorator.d.ts.map +1 -0
  73. package/dist/auth/decorators/public.decorator.js +15 -0
  74. package/dist/auth/decorators/public.decorator.js.map +1 -0
  75. package/dist/auth/index.d.ts +63 -0
  76. package/dist/auth/index.d.ts.map +1 -0
  77. package/dist/auth/index.js +65 -0
  78. package/dist/auth/index.js.map +1 -0
  79. package/dist/auth/interfaces/auth-request.interface.d.ts +18 -0
  80. package/dist/auth/interfaces/auth-request.interface.d.ts.map +1 -0
  81. package/dist/auth/interfaces/auth-request.interface.js +2 -0
  82. package/dist/auth/interfaces/auth-request.interface.js.map +1 -0
  83. package/dist/auth/interfaces/auth-result.interface.d.ts +28 -0
  84. package/dist/auth/interfaces/auth-result.interface.d.ts.map +1 -0
  85. package/dist/auth/interfaces/auth-result.interface.js +2 -0
  86. package/dist/auth/interfaces/auth-result.interface.js.map +1 -0
  87. package/dist/auth/interfaces/auth-strategy.interface.d.ts +37 -0
  88. package/dist/auth/interfaces/auth-strategy.interface.d.ts.map +1 -0
  89. package/dist/auth/interfaces/auth-strategy.interface.js +16 -0
  90. package/dist/auth/interfaces/auth-strategy.interface.js.map +1 -0
  91. package/dist/auth/interfaces/auth-user.interface.d.ts +25 -0
  92. package/dist/auth/interfaces/auth-user.interface.d.ts.map +1 -0
  93. package/dist/auth/interfaces/auth-user.interface.js +2 -0
  94. package/dist/auth/interfaces/auth-user.interface.js.map +1 -0
  95. package/dist/auth/interfaces/cache-service.interface.d.ts +30 -0
  96. package/dist/auth/interfaces/cache-service.interface.d.ts.map +1 -0
  97. package/dist/auth/interfaces/cache-service.interface.js +2 -0
  98. package/dist/auth/interfaces/cache-service.interface.js.map +1 -0
  99. package/dist/auth/interfaces/index.d.ts +8 -0
  100. package/dist/auth/interfaces/index.d.ts.map +1 -0
  101. package/dist/auth/interfaces/index.js +2 -0
  102. package/dist/auth/interfaces/index.js.map +1 -0
  103. package/dist/auth/interfaces/user-service.interface.d.ts +34 -0
  104. package/dist/auth/interfaces/user-service.interface.d.ts.map +1 -0
  105. package/dist/auth/interfaces/user-service.interface.js +2 -0
  106. package/dist/auth/interfaces/user-service.interface.js.map +1 -0
  107. package/dist/auth/password/password.service.d.ts +23 -0
  108. package/dist/auth/password/password.service.d.ts.map +1 -0
  109. package/dist/auth/password/password.service.js +52 -0
  110. package/dist/auth/password/password.service.js.map +1 -0
  111. package/dist/auth/session/device-session.service.d.ts +43 -0
  112. package/dist/auth/session/device-session.service.d.ts.map +1 -0
  113. package/dist/auth/session/device-session.service.js +72 -0
  114. package/dist/auth/session/device-session.service.js.map +1 -0
  115. package/dist/auth/session/index.d.ts +5 -0
  116. package/dist/auth/session/index.d.ts.map +1 -0
  117. package/dist/auth/session/index.js +4 -0
  118. package/dist/auth/session/index.js.map +1 -0
  119. package/dist/auth/session/jwt.service.d.ts +37 -0
  120. package/dist/auth/session/jwt.service.d.ts.map +1 -0
  121. package/dist/auth/session/jwt.service.js +119 -0
  122. package/dist/auth/session/jwt.service.js.map +1 -0
  123. package/dist/auth/session/token-blacklist.service.d.ts +37 -0
  124. package/dist/auth/session/token-blacklist.service.d.ts.map +1 -0
  125. package/dist/auth/session/token-blacklist.service.js +70 -0
  126. package/dist/auth/session/token-blacklist.service.js.map +1 -0
  127. package/dist/auth/strategies/anonymous/anonymous.strategy.d.ts +19 -0
  128. package/dist/auth/strategies/anonymous/anonymous.strategy.d.ts.map +1 -0
  129. package/dist/auth/strategies/anonymous/anonymous.strategy.js +49 -0
  130. package/dist/auth/strategies/anonymous/anonymous.strategy.js.map +1 -0
  131. package/dist/auth/strategies/base/base.strategy.d.ts +11 -0
  132. package/dist/auth/strategies/base/base.strategy.d.ts.map +1 -0
  133. package/dist/auth/strategies/base/base.strategy.js +6 -0
  134. package/dist/auth/strategies/base/base.strategy.js.map +1 -0
  135. package/dist/auth/strategies/credentials/credentials.strategy.d.ts +21 -0
  136. package/dist/auth/strategies/credentials/credentials.strategy.d.ts.map +1 -0
  137. package/dist/auth/strategies/credentials/credentials.strategy.js +67 -0
  138. package/dist/auth/strategies/credentials/credentials.strategy.js.map +1 -0
  139. package/dist/auth/strategies/index.d.ts +12 -0
  140. package/dist/auth/strategies/index.d.ts.map +1 -0
  141. package/dist/auth/strategies/index.js +12 -0
  142. package/dist/auth/strategies/index.js.map +1 -0
  143. package/dist/auth/strategies/magic-link/magic-link.strategy.d.ts +31 -0
  144. package/dist/auth/strategies/magic-link/magic-link.strategy.d.ts.map +1 -0
  145. package/dist/auth/strategies/magic-link/magic-link.strategy.js +88 -0
  146. package/dist/auth/strategies/magic-link/magic-link.strategy.js.map +1 -0
  147. package/dist/auth/strategies/oauth/index.d.ts +3 -0
  148. package/dist/auth/strategies/oauth/index.d.ts.map +1 -0
  149. package/dist/auth/strategies/oauth/index.js +3 -0
  150. package/dist/auth/strategies/oauth/index.js.map +1 -0
  151. package/dist/auth/strategies/oauth/oauth-provider-registry.d.ts +13 -0
  152. package/dist/auth/strategies/oauth/oauth-provider-registry.d.ts.map +1 -0
  153. package/dist/auth/strategies/oauth/oauth-provider-registry.js +20 -0
  154. package/dist/auth/strategies/oauth/oauth-provider-registry.js.map +1 -0
  155. package/dist/auth/strategies/oauth/oauth.strategy.d.ts +23 -0
  156. package/dist/auth/strategies/oauth/oauth.strategy.d.ts.map +1 -0
  157. package/dist/auth/strategies/oauth/oauth.strategy.js +79 -0
  158. package/dist/auth/strategies/oauth/oauth.strategy.js.map +1 -0
  159. package/dist/auth/strategies/onetap/onetap.strategy.d.ts +24 -0
  160. package/dist/auth/strategies/onetap/onetap.strategy.d.ts.map +1 -0
  161. package/dist/auth/strategies/onetap/onetap.strategy.js +77 -0
  162. package/dist/auth/strategies/onetap/onetap.strategy.js.map +1 -0
  163. package/dist/auth/strategies/otp/otp.strategy.d.ts +31 -0
  164. package/dist/auth/strategies/otp/otp.strategy.d.ts.map +1 -0
  165. package/dist/auth/strategies/otp/otp.strategy.js +93 -0
  166. package/dist/auth/strategies/otp/otp.strategy.js.map +1 -0
  167. package/dist/auth/strategies/passkey/passkey.strategy.d.ts +32 -0
  168. package/dist/auth/strategies/passkey/passkey.strategy.d.ts.map +1 -0
  169. package/dist/auth/strategies/passkey/passkey.strategy.js +102 -0
  170. package/dist/auth/strategies/passkey/passkey.strategy.js.map +1 -0
  171. package/dist/auth/strategies/sso/sso.strategy.d.ts +25 -0
  172. package/dist/auth/strategies/sso/sso.strategy.d.ts.map +1 -0
  173. package/dist/auth/strategies/sso/sso.strategy.js +80 -0
  174. package/dist/auth/strategies/sso/sso.strategy.js.map +1 -0
  175. package/dist/auth/strategies/totp/totp.strategy.d.ts +37 -0
  176. package/dist/auth/strategies/totp/totp.strategy.d.ts.map +1 -0
  177. package/dist/auth/strategies/totp/totp.strategy.js +109 -0
  178. package/dist/auth/strategies/totp/totp.strategy.js.map +1 -0
  179. package/dist/auth/throttling/index.d.ts +2 -0
  180. package/dist/auth/throttling/index.d.ts.map +1 -0
  181. package/dist/auth/throttling/index.js +2 -0
  182. package/dist/auth/throttling/index.js.map +1 -0
  183. package/dist/auth/throttling/throttle.service.d.ts +27 -0
  184. package/dist/auth/throttling/throttle.service.d.ts.map +1 -0
  185. package/dist/auth/throttling/throttle.service.js +63 -0
  186. package/dist/auth/throttling/throttle.service.js.map +1 -0
  187. package/dist/bootstrap/cache/config.d.ts +135 -0
  188. package/dist/bootstrap/cache/config.d.ts.map +1 -0
  189. package/dist/bootstrap/cache/config.js +189 -0
  190. package/dist/bootstrap/cache/config.js.map +1 -0
  191. package/dist/bootstrap/cache/index.d.ts +11 -0
  192. package/dist/bootstrap/cache/index.d.ts.map +1 -0
  193. package/dist/bootstrap/cache/index.js +11 -0
  194. package/dist/bootstrap/cache/index.js.map +1 -0
  195. package/dist/bootstrap/index.d.ts +21 -0
  196. package/dist/bootstrap/index.d.ts.map +1 -0
  197. package/dist/bootstrap/index.js +21 -0
  198. package/dist/bootstrap/index.js.map +1 -0
  199. package/dist/bootstrap/scalar/api-docs.d.ts +39 -0
  200. package/dist/bootstrap/scalar/api-docs.d.ts.map +1 -0
  201. package/dist/bootstrap/scalar/api-docs.js +41 -0
  202. package/dist/bootstrap/scalar/api-docs.js.map +1 -0
  203. package/dist/bootstrap/scalar/index.d.ts +39 -0
  204. package/dist/bootstrap/scalar/index.d.ts.map +1 -0
  205. package/dist/bootstrap/scalar/index.js +41 -0
  206. package/dist/bootstrap/scalar/index.js.map +1 -0
  207. package/dist/bootstrap/swagger/api-docs.d.ts +73 -0
  208. package/dist/bootstrap/swagger/api-docs.d.ts.map +1 -0
  209. package/dist/bootstrap/swagger/api-docs.js +87 -0
  210. package/dist/bootstrap/swagger/api-docs.js.map +1 -0
  211. package/dist/bootstrap/swagger/index.d.ts +37 -0
  212. package/dist/bootstrap/swagger/index.d.ts.map +1 -0
  213. package/dist/bootstrap/swagger/index.js +36 -0
  214. package/dist/bootstrap/swagger/index.js.map +1 -0
  215. package/dist/bootstrap/typeorm/config/index.d.ts +12 -0
  216. package/dist/bootstrap/typeorm/config/index.d.ts.map +1 -0
  217. package/dist/bootstrap/typeorm/config/index.js +62 -0
  218. package/dist/bootstrap/typeorm/config/index.js.map +1 -0
  219. package/dist/bootstrap/typeorm/crud/controller.d.ts +13 -0
  220. package/dist/bootstrap/typeorm/crud/controller.d.ts.map +1 -0
  221. package/dist/bootstrap/typeorm/crud/controller.js +72 -0
  222. package/dist/bootstrap/typeorm/crud/controller.js.map +1 -0
  223. package/dist/bootstrap/typeorm/crud/index.d.ts +4 -0
  224. package/dist/bootstrap/typeorm/crud/index.d.ts.map +1 -0
  225. package/dist/bootstrap/typeorm/crud/index.js +3 -0
  226. package/dist/bootstrap/typeorm/crud/index.js.map +1 -0
  227. package/dist/bootstrap/typeorm/crud/service.d.ts +10 -0
  228. package/dist/bootstrap/typeorm/crud/service.d.ts.map +1 -0
  229. package/dist/bootstrap/typeorm/crud/service.js +21 -0
  230. package/dist/bootstrap/typeorm/crud/service.js.map +1 -0
  231. package/dist/bootstrap/typeorm/index.d.ts +18 -0
  232. package/dist/bootstrap/typeorm/index.d.ts.map +1 -0
  233. package/dist/bootstrap/typeorm/index.js +18 -0
  234. package/dist/bootstrap/typeorm/index.js.map +1 -0
  235. package/dist/bootstrap/typeorm/uow/factory.d.ts +5 -0
  236. package/dist/bootstrap/typeorm/uow/factory.d.ts.map +1 -0
  237. package/dist/bootstrap/typeorm/uow/factory.js +27 -0
  238. package/dist/bootstrap/typeorm/uow/factory.js.map +1 -0
  239. package/dist/bootstrap/typeorm/uow/index.d.ts +4 -0
  240. package/dist/bootstrap/typeorm/uow/index.d.ts.map +1 -0
  241. package/dist/bootstrap/typeorm/uow/index.js +4 -0
  242. package/dist/bootstrap/typeorm/uow/index.js.map +1 -0
  243. package/dist/bootstrap/typeorm/uow/transactional.decorator.d.ts +62 -0
  244. package/dist/bootstrap/typeorm/uow/transactional.decorator.d.ts.map +1 -0
  245. package/dist/bootstrap/typeorm/uow/transactional.decorator.js +114 -0
  246. package/dist/bootstrap/typeorm/uow/transactional.decorator.js.map +1 -0
  247. package/dist/bootstrap/typeorm/uow/unit-of-work.d.ts +11 -0
  248. package/dist/bootstrap/typeorm/uow/unit-of-work.d.ts.map +1 -0
  249. package/dist/bootstrap/typeorm/uow/unit-of-work.js +23 -0
  250. package/dist/bootstrap/typeorm/uow/unit-of-work.js.map +1 -0
  251. package/dist/core/index.d.ts +11 -0
  252. package/dist/core/index.d.ts.map +1 -0
  253. package/dist/core/index.js +11 -0
  254. package/dist/core/index.js.map +1 -0
  255. package/dist/infra/audit-log/index.d.ts +12 -0
  256. package/dist/infra/audit-log/index.d.ts.map +1 -0
  257. package/dist/infra/audit-log/index.js +13 -0
  258. package/dist/infra/audit-log/index.js.map +1 -0
  259. package/dist/infra/index.d.ts +20 -0
  260. package/dist/infra/index.d.ts.map +1 -0
  261. package/dist/infra/index.js +21 -0
  262. package/dist/infra/index.js.map +1 -0
  263. package/dist/infra/logger/index.d.ts +12 -0
  264. package/dist/infra/logger/index.d.ts.map +1 -0
  265. package/dist/infra/logger/index.js +13 -0
  266. package/dist/infra/logger/index.js.map +1 -0
  267. package/dist/infra/metrics/index.d.ts +18 -0
  268. package/dist/infra/metrics/index.d.ts.map +1 -0
  269. package/dist/infra/metrics/index.js +19 -0
  270. package/dist/infra/metrics/index.js.map +1 -0
  271. package/dist/infra/notification/index.d.ts +12 -0
  272. package/dist/infra/notification/index.d.ts.map +1 -0
  273. package/dist/infra/notification/index.js +13 -0
  274. package/dist/infra/notification/index.js.map +1 -0
  275. package/dist/infra/storage/index.d.ts +12 -0
  276. package/dist/infra/storage/index.d.ts.map +1 -0
  277. package/dist/infra/storage/index.js +13 -0
  278. package/dist/infra/storage/index.js.map +1 -0
  279. package/dist/infra/stripe/index.d.ts +12 -0
  280. package/dist/infra/stripe/index.d.ts.map +1 -0
  281. package/dist/infra/stripe/index.js +13 -0
  282. package/dist/infra/stripe/index.js.map +1 -0
  283. package/dist/saas/index.d.ts +18 -0
  284. package/dist/saas/index.d.ts.map +1 -0
  285. package/dist/saas/index.js +19 -0
  286. package/dist/saas/index.js.map +1 -0
  287. package/package.json +165 -0
@@ -0,0 +1,37 @@
1
+ import type { INestApplication } from '@nestjs/common';
2
+ import type { SwaggerCustomOptions, SwaggerDocumentOptions } from '@nestjs/swagger';
3
+ /**
4
+ * Options for {@link configSwagger}.
5
+ */
6
+ export interface ConfigSwaggerOptions {
7
+ /** OpenAPI title (default: `'NestJS API'`). */
8
+ title?: string;
9
+ /** OpenAPI description (default: `''`). */
10
+ description?: string;
11
+ /** OpenAPI version (default: `'1.0'`). */
12
+ version?: string;
13
+ /** Mount path (default: `'api/docs'`). */
14
+ path?: string;
15
+ /** Extra options forwarded to `SwaggerModule.setup`. */
16
+ swaggerCustomOptions?: SwaggerCustomOptions;
17
+ /** Extra options forwarded to `SwaggerModule.createDocument`. */
18
+ swaggerDocumentOptions?: SwaggerDocumentOptions;
19
+ }
20
+ /**
21
+ * Configure Swagger UI on the NestJS app.
22
+ *
23
+ * Mounts the Swagger UI at the given `path` (default `api/docs`).
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { configSwagger } from '@os.io/nest-kit/bootstrap/swagger';
28
+ *
29
+ * configSwagger(app);
30
+ * // Browse to http://localhost:3000/api/docs
31
+ * ```
32
+ *
33
+ * @param app - The NestJS application instance.
34
+ * @param options - Configuration overrides.
35
+ */
36
+ export declare function configSwagger(app: INestApplication, options?: ConfigSwaggerOptions): void;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/bootstrap/swagger/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKpF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iEAAiE;IACjE,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAkBzF"}
@@ -0,0 +1,36 @@
1
+ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
2
+ const DEFAULT_FAVICON_URL = 'https://scalar.com/favicon.svg';
3
+ /**
4
+ * Configure Swagger UI on the NestJS app.
5
+ *
6
+ * Mounts the Swagger UI at the given `path` (default `api/docs`).
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { configSwagger } from '@os.io/nest-kit/bootstrap/swagger';
11
+ *
12
+ * configSwagger(app);
13
+ * // Browse to http://localhost:3000/api/docs
14
+ * ```
15
+ *
16
+ * @param app - The NestJS application instance.
17
+ * @param options - Configuration overrides.
18
+ */
19
+ export function configSwagger(app, options) {
20
+ const builder = new DocumentBuilder()
21
+ .setTitle(options?.title ?? 'NestJS API')
22
+ .setDescription(options?.description ?? '')
23
+ .setVersion(options?.version ?? '1.0')
24
+ .addBearerAuth();
25
+ const config = builder.build();
26
+ const document = SwaggerModule.createDocument(app, config, options?.swaggerDocumentOptions);
27
+ SwaggerModule.setup(options?.path ?? 'api/docs', app, document, {
28
+ customfavIcon: options?.swaggerCustomOptions?.customfavIcon ?? DEFAULT_FAVICON_URL,
29
+ ...options?.swaggerCustomOptions,
30
+ swaggerOptions: {
31
+ persistAuthorization: true,
32
+ ...options?.swaggerCustomOptions?.swaggerOptions,
33
+ },
34
+ });
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/bootstrap/swagger/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAoB7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,GAAqB,EAAE,OAA8B;IACjF,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE;SAClC,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,YAAY,CAAC;SACxC,cAAc,CAAC,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;SAC1C,UAAU,CAAC,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC;SACrC,aAAa,EAAE,CAAC;IAEnB,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,aAAa,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IAE5F,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE;QAC9D,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,aAAa,IAAI,mBAAmB;QAClF,GAAG,OAAO,EAAE,oBAAoB;QAChC,cAAc,EAAE;YACd,oBAAoB,EAAE,IAAI;YAC1B,GAAG,OAAO,EAAE,oBAAoB,EAAE,cAAc;SACjD;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type TypeOrmModuleOptions } from '@nestjs/typeorm';
2
+ import { ConfigService } from '@nestjs/config';
3
+ export interface TypeOrmConfigOptions {
4
+ schema?: string;
5
+ poolSize?: number;
6
+ idleTimeoutMs?: number;
7
+ connectionTimeoutMs?: number;
8
+ statementTimeoutMs?: number;
9
+ }
10
+ export declare function configTypeOrm(options?: TypeOrmConfigOptions): TypeOrmModuleOptions;
11
+ export declare function configTypeOrmAsync(configService: ConfigService, options?: TypeOrmConfigOptions): TypeOrmModuleOptions;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA2DD,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,CAYlF;AAID,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,oBAAoB,CAStB"}
@@ -0,0 +1,62 @@
1
+ const DEFAULTS = {
2
+ postgres: { port: 5432, database: 'postgres' },
3
+ mysql: { port: 3306, database: 'mysql' },
4
+ mariadb: { port: 3306, database: 'mysql' },
5
+ 'better-sqlite3': { port: 0, database: ':memory:' },
6
+ };
7
+ function buildConfig(get, options) {
8
+ const defaults = DEFAULTS[get.str('DB_TYPE') ?? 'postgres'];
9
+ return {
10
+ type: get.str('DB_TYPE') ?? 'postgres',
11
+ host: get.str('DB_HOST') ?? 'localhost',
12
+ port: get.num('DB_PORT') ?? defaults?.port ?? 5432,
13
+ username: get.str('DB_USERNAME'),
14
+ password: get.str('DB_PASSWORD'),
15
+ database: get.str('DB_DATABASE') ?? defaults?.database ?? 'database',
16
+ synchronize: get.bool('DB_SYNCHRONIZE', false),
17
+ logging: get.bool('DB_LOGGING', false) ? 'all' : false,
18
+ autoLoadEntities: true,
19
+ retryAttempts: 10,
20
+ retryDelay: 3000,
21
+ ...(get.bool('DB_RDS_ENABLED', false) || get.bool('DB_SSL_REJECT_UNAUTHORIZED', false)
22
+ ? { ssl: { rejectUnauthorized: true } }
23
+ : {}),
24
+ ...(get.bool('DB_RDS_ENABLED', false)
25
+ ? {
26
+ extra: {
27
+ ssl: { rejectUnauthorized: true },
28
+ max: options?.poolSize ?? 20,
29
+ idleTimeoutMillis: options?.idleTimeoutMs ?? 30000,
30
+ connectionTimeoutMillis: options?.connectionTimeoutMs ?? 10000,
31
+ ...(options?.statementTimeoutMs !== undefined
32
+ ? { statement_timeout: options.statementTimeoutMs }
33
+ : {}),
34
+ ...(options?.schema ? { schema: options.schema } : {}),
35
+ ...(get.bool('RDS_USE_IAM', false)
36
+ ? { region: get.str('RDS_REGION') ?? 'us-east-1' }
37
+ : {}),
38
+ },
39
+ }
40
+ : {}),
41
+ ...(options?.schema && !get.bool('DB_RDS_ENABLED', false) ? { schema: options.schema } : {}),
42
+ };
43
+ }
44
+ /* ---------- for TypeOrmModule.forRoot (reads process.env) ---------- */
45
+ export function configTypeOrm(options) {
46
+ return buildConfig({
47
+ str: (key) => process.env[key],
48
+ num: (key) => (process.env[key] !== undefined ? Number(process.env[key]) : undefined),
49
+ bool: (key, def) => process.env[key] !== undefined
50
+ ? process.env[key] === 'true' || process.env[key] === '1'
51
+ : def,
52
+ }, options);
53
+ }
54
+ /* ---------- for TypeOrmModule.forRootAsync (uses ConfigService) ---------- */
55
+ export function configTypeOrmAsync(configService, options) {
56
+ return buildConfig({
57
+ str: (key) => configService.get(key),
58
+ num: (key) => configService.get(key),
59
+ bool: (key, def) => configService.get(key, def) ?? def,
60
+ }, options);
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/config/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ import type { CrudService } from './service';
2
+ export declare function createCrudController<T>(service: CrudService<T>, options?: {
3
+ path?: string;
4
+ }): {
5
+ new (): {
6
+ findAll(): Promise<T[]>;
7
+ findOne(id: string): Promise<T | null>;
8
+ create(data: Record<string, unknown>): Promise<T>;
9
+ update(id: string, data: Record<string, unknown>): Promise<T>;
10
+ remove(id: string): Promise<import("typeorm").DeleteResult>;
11
+ };
12
+ };
13
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;;;oBAS/D,MAAM;qBAKV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;mBAKpB,MAAM,QAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;mBAK7C,MAAM;;EAMjC"}
@@ -0,0 +1,72 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Controller, Get, Post, Patch, Delete, Param, Body } from '@nestjs/common';
14
+ export function createCrudController(service, options) {
15
+ let CrudController = class CrudController {
16
+ findAll() {
17
+ return service.findAll();
18
+ }
19
+ findOne(id) {
20
+ return service.findOne(id);
21
+ }
22
+ create(data) {
23
+ return service.create(data);
24
+ }
25
+ update(id, data) {
26
+ return service.update(id, data);
27
+ }
28
+ remove(id) {
29
+ return service.remove(id);
30
+ }
31
+ };
32
+ __decorate([
33
+ Get(),
34
+ __metadata("design:type", Function),
35
+ __metadata("design:paramtypes", []),
36
+ __metadata("design:returntype", void 0)
37
+ ], CrudController.prototype, "findAll", null);
38
+ __decorate([
39
+ Get(':id'),
40
+ __param(0, Param('id')),
41
+ __metadata("design:type", Function),
42
+ __metadata("design:paramtypes", [String]),
43
+ __metadata("design:returntype", void 0)
44
+ ], CrudController.prototype, "findOne", null);
45
+ __decorate([
46
+ Post(),
47
+ __param(0, Body()),
48
+ __metadata("design:type", Function),
49
+ __metadata("design:paramtypes", [Object]),
50
+ __metadata("design:returntype", void 0)
51
+ ], CrudController.prototype, "create", null);
52
+ __decorate([
53
+ Patch(':id'),
54
+ __param(0, Param('id')),
55
+ __param(1, Body()),
56
+ __metadata("design:type", Function),
57
+ __metadata("design:paramtypes", [String, Object]),
58
+ __metadata("design:returntype", void 0)
59
+ ], CrudController.prototype, "update", null);
60
+ __decorate([
61
+ Delete(':id'),
62
+ __param(0, Param('id')),
63
+ __metadata("design:type", Function),
64
+ __metadata("design:paramtypes", [String]),
65
+ __metadata("design:returntype", void 0)
66
+ ], CrudController.prototype, "remove", null);
67
+ CrudController = __decorate([
68
+ Controller(options?.path ?? '')
69
+ ], CrudController);
70
+ return CrudController;
71
+ }
72
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGnF,MAAM,UAAU,oBAAoB,CAAI,OAAuB,EAAE,OAA2B;IAE1F,IAAM,cAAc,GAApB,MAAM,cAAc;QAElB,OAAO;YACL,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QAGD,OAAO,CAAc,EAAU;YAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;QAGD,MAAM,CAAS,IAA6B;YAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,IAA6B,CAAC,CAAC;QACvD,CAAC;QAGD,MAAM,CAAc,EAAU,EAAU,IAA6B;YACnE,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,IAA6B,CAAC,CAAC;QAC3D,CAAC;QAGD,MAAM,CAAc,EAAU;YAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;KACF,CAAA;IAvBC;QADC,GAAG,EAAE;;;;iDAGL;IAGD;QADC,GAAG,CAAC,KAAK,CAAC;QACF,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;;;;iDAEnB;IAGD;QADC,IAAI,EAAE;QACC,WAAA,IAAI,EAAE,CAAA;;;;gDAEb;IAGD;QADC,KAAK,CAAC,KAAK,CAAC;QACL,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;QAAc,WAAA,IAAI,EAAE,CAAA;;;;gDAEtC;IAGD;QADC,MAAM,CAAC,KAAK,CAAC;QACN,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;;;;gDAElB;IAxBG,cAAc;QADnB,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;OAC1B,cAAc,CAyBnB;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createCrudService } from './service';
2
+ export { createCrudController } from './controller';
3
+ export type { CrudService } from './service';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createCrudService } from './service';
2
+ export { createCrudController } from './controller';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { DeleteResult, ObjectLiteral, Repository } from 'typeorm';
2
+ export interface CrudService<T> {
3
+ findAll(): Promise<T[]>;
4
+ findOne(id: string | number): Promise<T | null>;
5
+ create(data: Partial<T>): Promise<T>;
6
+ update(id: string | number, data: Partial<T>): Promise<T>;
7
+ remove(id: string | number): Promise<DeleteResult>;
8
+ }
9
+ export declare function createCrudService<T extends ObjectLiteral>(repo: Repository<T>): CrudService<T>;
10
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAuB9F"}
@@ -0,0 +1,21 @@
1
+ export function createCrudService(repo) {
2
+ return {
3
+ findAll() {
4
+ return repo.find();
5
+ },
6
+ findOne(id) {
7
+ return repo.findOneBy({ id });
8
+ },
9
+ create(data) {
10
+ return repo.save(repo.create(data));
11
+ },
12
+ async update(id, data) {
13
+ await repo.update(id, data);
14
+ return repo.findOneBy({ id });
15
+ },
16
+ async remove(id) {
17
+ return repo.delete(id);
18
+ },
19
+ };
20
+ }
21
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/crud/service.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,iBAAiB,CAA0B,IAAmB;IAC5E,OAAO;QACL,OAAO;YACL,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QAED,OAAO,CAAC,EAAE;YACR,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAW,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,CAAC,IAAI;YACT,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAS,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI;YACnB,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAW,CAAe,CAAC;QACvD,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,EAAE;YACb,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @os.io/nest-kit/bootstrap/typeorm
3
+ *
4
+ * TypeORM configuration, CRUD factories, and Unit of Work support for NestJS applications.
5
+ *
6
+ * ## Sub-modules
7
+ *
8
+ * - `config` — `configTypeOrm` / `configTypeOrmAsync` for connection setup
9
+ * - `crud` — `createCrudService` / `createCrudController` for generic REST endpoints
10
+ * - `uow` — `UnitOfWork`, `@Transactional()`, `@TransactionalController()`
11
+ *
12
+ * @module
13
+ * @packageDocumentation
14
+ */
15
+ export * from './config';
16
+ export * from './crud';
17
+ export * from './uow';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/bootstrap/typeorm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @os.io/nest-kit/bootstrap/typeorm
3
+ *
4
+ * TypeORM configuration, CRUD factories, and Unit of Work support for NestJS applications.
5
+ *
6
+ * ## Sub-modules
7
+ *
8
+ * - `config` — `configTypeOrm` / `configTypeOrmAsync` for connection setup
9
+ * - `crud` — `createCrudService` / `createCrudController` for generic REST endpoints
10
+ * - `uow` — `UnitOfWork`, `@Transactional()`, `@TransactionalController()`
11
+ *
12
+ * @module
13
+ * @packageDocumentation
14
+ */
15
+ export * from './config';
16
+ export * from './crud';
17
+ export * from './uow';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/bootstrap/typeorm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { DataSource } from 'typeorm';
2
+ import { UnitOfWork } from './unit-of-work';
3
+ export declare function createUnitOfWork(dataSource: DataSource): Promise<UnitOfWork>;
4
+ export declare function withUnitOfWork<T>(dataSource: DataSource, fn: (uow: UnitOfWork) => Promise<T>): Promise<T>;
5
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAIlF;AAED,wBAAsB,cAAc,CAAC,CAAC,EACpC,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
@@ -0,0 +1,27 @@
1
+ import { UnitOfWork } from './unit-of-work';
2
+ export async function createUnitOfWork(dataSource) {
3
+ const uow = new UnitOfWork(dataSource);
4
+ await uow.start();
5
+ return uow;
6
+ }
7
+ export async function withUnitOfWork(dataSource, fn) {
8
+ const uow = await createUnitOfWork(dataSource);
9
+ try {
10
+ const result = await fn(uow);
11
+ await uow.commit();
12
+ return result;
13
+ }
14
+ catch (error) {
15
+ try {
16
+ await uow.rollback();
17
+ }
18
+ catch {
19
+ // rollback failure — discard, original error takes precedence
20
+ }
21
+ throw error;
22
+ }
23
+ finally {
24
+ await uow.release();
25
+ }
26
+ }
27
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAsB;IAC3D,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAClB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAsB,EACtB,EAAmC;IAEnC,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE/C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UnitOfWork } from './unit-of-work';
2
+ export { createUnitOfWork, withUnitOfWork } from './factory';
3
+ export { Transactional, TransactionalController, getCurrentUnitOfWork, } from './transactional.decorator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UnitOfWork } from './unit-of-work';
2
+ export { createUnitOfWork, withUnitOfWork } from './factory';
3
+ export { Transactional, TransactionalController, getCurrentUnitOfWork, } from './transactional.decorator';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { UnitOfWork } from './unit-of-work';
2
+ /**
3
+ * Returns the current `UnitOfWork` active inside a `@Transactional()` /
4
+ * `@TransactionalController()` method.
5
+ *
6
+ * Must be called from within a method decorated with `@Transactional()` or a
7
+ * class decorated with `@TransactionalController()`.
8
+ */
9
+ export declare function getCurrentUnitOfWork(): UnitOfWork | undefined;
10
+ /**
11
+ * Wraps a controller / service method in a database transaction.
12
+ *
13
+ * @param dataSourceProp - Name of the class property holding the `DataSource`
14
+ * (default: `'dataSource'`).
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * \@Injectable()
19
+ * class UsersService {
20
+ * constructor(private dataSource: DataSource) {}
21
+ *
22
+ * \@Transactional()
23
+ * async create(data: CreateUserDto): Promise<User> {
24
+ * const uow = getCurrentUnitOfWork();
25
+ * const repo = uow.getRepository(User);
26
+ * return repo.save(data);
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ export declare function Transactional(dataSourceProp?: string): MethodDecorator;
32
+ /**
33
+ * Class-level decorator that wraps every method of the controller in a
34
+ * database transaction.
35
+ *
36
+ * @param dataSourceProp - Name of the class property holding the `DataSource`
37
+ * (default: `'dataSource'`).
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * \@Controller('users')
42
+ * \@TransactionalController()
43
+ * export class UsersController {
44
+ * constructor(\@InjectDataSource() private readonly dataSource: DataSource) {}
45
+ *
46
+ * \@Post()
47
+ * async create(\@Body() data: CreateUserDto) {
48
+ * const uow = getCurrentUnitOfWork();
49
+ * const repo = uow.getRepository(User);
50
+ * return repo.save(data);
51
+ * }
52
+ *
53
+ * \@Get()
54
+ * async findAll() {
55
+ * const uow = getCurrentUnitOfWork();
56
+ * return uow.getRepository(User).find();
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ export declare function TransactionalController(dataSourceProp?: string): ClassDecorator;
62
+ //# sourceMappingURL=transactional.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional.decorator.d.ts","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/transactional.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAmC5C;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,GAAG,SAAS,CAE7D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,cAAc,GAAE,MAAqB,GAAG,eAAe,CAMpF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,GAAE,MAAqB,GAAG,cAAc,CAiB7F"}
@@ -0,0 +1,114 @@
1
+ import { AsyncLocalStorage } from 'async_hooks';
2
+ import { UnitOfWork } from './unit-of-work';
3
+ const uowStorage = new AsyncLocalStorage();
4
+ function createUowWrapper(originalMethod, dataSourceProp) {
5
+ return async function (...args) {
6
+ const dataSource = this[dataSourceProp];
7
+ if (!dataSource) {
8
+ throw new Error(`@Transactional() requires a DataSource at this.${dataSourceProp}. ` +
9
+ `Inject via constructor: constructor(private ${dataSourceProp}: DataSource) {}`);
10
+ }
11
+ const uow = new UnitOfWork(dataSource);
12
+ await uow.start();
13
+ try {
14
+ const result = await uowStorage.run(uow, () => originalMethod.apply(this, args));
15
+ await uow.commit();
16
+ return result;
17
+ }
18
+ catch (error) {
19
+ try {
20
+ await uow.rollback();
21
+ }
22
+ catch {
23
+ // rollback failure — discard, original error takes precedence
24
+ }
25
+ throw error;
26
+ }
27
+ finally {
28
+ await uow.release();
29
+ }
30
+ };
31
+ }
32
+ /**
33
+ * Returns the current `UnitOfWork` active inside a `@Transactional()` /
34
+ * `@TransactionalController()` method.
35
+ *
36
+ * Must be called from within a method decorated with `@Transactional()` or a
37
+ * class decorated with `@TransactionalController()`.
38
+ */
39
+ export function getCurrentUnitOfWork() {
40
+ return uowStorage.getStore();
41
+ }
42
+ /**
43
+ * Wraps a controller / service method in a database transaction.
44
+ *
45
+ * @param dataSourceProp - Name of the class property holding the `DataSource`
46
+ * (default: `'dataSource'`).
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * \@Injectable()
51
+ * class UsersService {
52
+ * constructor(private dataSource: DataSource) {}
53
+ *
54
+ * \@Transactional()
55
+ * async create(data: CreateUserDto): Promise<User> {
56
+ * const uow = getCurrentUnitOfWork();
57
+ * const repo = uow.getRepository(User);
58
+ * return repo.save(data);
59
+ * }
60
+ * }
61
+ * ```
62
+ */
63
+ export function Transactional(dataSourceProp = 'dataSource') {
64
+ return (_target, _propertyKey, descriptor) => {
65
+ const originalMethod = descriptor.value;
66
+ descriptor.value = createUowWrapper(originalMethod, dataSourceProp);
67
+ return descriptor;
68
+ };
69
+ }
70
+ /**
71
+ * Class-level decorator that wraps every method of the controller in a
72
+ * database transaction.
73
+ *
74
+ * @param dataSourceProp - Name of the class property holding the `DataSource`
75
+ * (default: `'dataSource'`).
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * \@Controller('users')
80
+ * \@TransactionalController()
81
+ * export class UsersController {
82
+ * constructor(\@InjectDataSource() private readonly dataSource: DataSource) {}
83
+ *
84
+ * \@Post()
85
+ * async create(\@Body() data: CreateUserDto) {
86
+ * const uow = getCurrentUnitOfWork();
87
+ * const repo = uow.getRepository(User);
88
+ * return repo.save(data);
89
+ * }
90
+ *
91
+ * \@Get()
92
+ * async findAll() {
93
+ * const uow = getCurrentUnitOfWork();
94
+ * return uow.getRepository(User).find();
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ export function TransactionalController(dataSourceProp = 'dataSource') {
100
+ return (target) => {
101
+ const ctor = target;
102
+ const proto = ctor.prototype;
103
+ const methodNames = Object.getOwnPropertyNames(proto).filter((name) => name !== 'constructor' && typeof proto[name] === 'function');
104
+ for (const methodName of methodNames) {
105
+ const descriptor = Object.getOwnPropertyDescriptor(proto, methodName);
106
+ if (!descriptor?.value)
107
+ continue;
108
+ const originalMethod = descriptor.value;
109
+ descriptor.value = createUowWrapper(originalMethod, dataSourceProp);
110
+ Object.defineProperty(proto, methodName, descriptor);
111
+ }
112
+ };
113
+ }
114
+ //# sourceMappingURL=transactional.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional.decorator.js","sourceRoot":"","sources":["../../../../packages/bootstrap/typeorm/uow/transactional.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAc,CAAC;AAEvD,SAAS,gBAAgB,CAAC,cAA+C,EAAE,cAAsB;IAC/F,OAAO,KAAK,WAA0C,GAAG,IAAe;QACtE,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAA2B,CAAC;QAElE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,kDAAkD,cAAc,IAAI;gBAClE,+CAA+C,cAAc,kBAAkB,CAClF,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;QACvC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAElB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACjF,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;YACvB,CAAC;YAAC,MAAM,CAAC;gBACP,8DAA8D;YAChE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,iBAAyB,YAAY;IACjE,OAAO,CAAC,OAAe,EAAE,YAA6B,EAAE,UAA8B,EAAE,EAAE;QACxF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAwC,CAAC;QAC3E,UAAU,CAAC,KAAK,GAAG,gBAAgB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACpE,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,uBAAuB,CAAC,iBAAyB,YAAY;IAC3E,OAAO,CAAC,MAAc,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,MAAgD,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,MAAM,CAC1D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,aAAa,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CACtE,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YACtE,IAAI,CAAC,UAAU,EAAE,KAAK;gBAAE,SAAS;YAEjC,MAAM,cAAc,GAAG,UAAU,CAAC,KAAwC,CAAC;YAC3E,UAAU,CAAC,KAAK,GAAG,gBAAgB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;YACpE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { DataSource, EntityTarget, ObjectLiteral, Repository } from 'typeorm';
2
+ export declare class UnitOfWork {
3
+ private queryRunner;
4
+ constructor(dataSource: DataSource);
5
+ start(): Promise<void>;
6
+ commit(): Promise<void>;
7
+ rollback(): Promise<void>;
8
+ release(): Promise<void>;
9
+ getRepository<T extends ObjectLiteral>(entity: EntityTarget<T>): Repository<T>;
10
+ }
11
+ //# sourceMappingURL=unit-of-work.d.ts.map