@authup/server-core 1.0.0-beta.55 → 1.0.0-beta.57

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 (410) hide show
  1. package/dist/adapters/database/domains/role/entity.d.ts.map +1 -1
  2. package/dist/adapters/database/domains/role/entity.mjs +2 -1
  3. package/dist/adapters/database/domains/role/entity.mjs.map +1 -1
  4. package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.d.ts +25 -0
  5. package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.d.ts.map +1 -0
  6. package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.mjs +60 -0
  7. package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.mjs.map +1 -0
  8. package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.d.ts +25 -0
  9. package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.d.ts.map +1 -0
  10. package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.mjs +60 -0
  11. package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.mjs.map +1 -0
  12. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +1 -1
  13. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
  14. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +1 -1
  15. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
  16. package/dist/adapters/http/adapters/oauth2/grant-types/identity.mjs +1 -1
  17. package/dist/adapters/http/adapters/oauth2/grant-types/identity.mjs.map +1 -1
  18. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +1 -1
  19. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
  20. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +1 -1
  21. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
  22. package/dist/adapters/http/controllers/entities/client/module.d.ts +6 -6
  23. package/dist/adapters/http/controllers/entities/client/module.d.ts.map +1 -1
  24. package/dist/adapters/http/controllers/entities/client/module.mjs +30 -7
  25. package/dist/adapters/http/controllers/entities/client/module.mjs.map +1 -1
  26. package/dist/adapters/http/controllers/entities/client-permission/module.d.ts +5 -5
  27. package/dist/adapters/http/controllers/entities/client-permission/module.d.ts.map +1 -1
  28. package/dist/adapters/http/controllers/entities/client-permission/module.mjs +23 -5
  29. package/dist/adapters/http/controllers/entities/client-permission/module.mjs.map +1 -1
  30. package/dist/adapters/http/controllers/entities/client-role/module.d.ts +4 -4
  31. package/dist/adapters/http/controllers/entities/client-role/module.d.ts.map +1 -1
  32. package/dist/adapters/http/controllers/entities/client-role/module.mjs +19 -4
  33. package/dist/adapters/http/controllers/entities/client-role/module.mjs.map +1 -1
  34. package/dist/adapters/http/controllers/entities/client-scope/module.d.ts +4 -4
  35. package/dist/adapters/http/controllers/entities/client-scope/module.d.ts.map +1 -1
  36. package/dist/adapters/http/controllers/entities/client-scope/module.mjs +19 -4
  37. package/dist/adapters/http/controllers/entities/client-scope/module.mjs.map +1 -1
  38. package/dist/adapters/http/controllers/entities/consent/module.d.ts +3 -3
  39. package/dist/adapters/http/controllers/entities/consent/module.d.ts.map +1 -1
  40. package/dist/adapters/http/controllers/entities/consent/module.mjs +15 -3
  41. package/dist/adapters/http/controllers/entities/consent/module.mjs.map +1 -1
  42. package/dist/adapters/http/controllers/entities/event/module.d.ts +2 -2
  43. package/dist/adapters/http/controllers/entities/event/module.d.ts.map +1 -1
  44. package/dist/adapters/http/controllers/entities/event/module.mjs +11 -2
  45. package/dist/adapters/http/controllers/entities/event/module.mjs.map +1 -1
  46. package/dist/adapters/http/controllers/entities/identity-provide-role/module.d.ts +5 -5
  47. package/dist/adapters/http/controllers/entities/identity-provide-role/module.d.ts.map +1 -1
  48. package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs +23 -5
  49. package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs.map +1 -1
  50. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +6 -6
  51. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
  52. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +23 -7
  53. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
  54. package/dist/adapters/http/controllers/entities/key/module.d.ts +5 -5
  55. package/dist/adapters/http/controllers/entities/key/module.d.ts.map +1 -1
  56. package/dist/adapters/http/controllers/entities/key/module.mjs +23 -5
  57. package/dist/adapters/http/controllers/entities/key/module.mjs.map +1 -1
  58. package/dist/adapters/http/controllers/entities/permission/module.d.ts +6 -6
  59. package/dist/adapters/http/controllers/entities/permission/module.d.ts.map +1 -1
  60. package/dist/adapters/http/controllers/entities/permission/module.mjs +27 -6
  61. package/dist/adapters/http/controllers/entities/permission/module.mjs.map +1 -1
  62. package/dist/adapters/http/controllers/entities/permission-policy/module.d.ts +4 -4
  63. package/dist/adapters/http/controllers/entities/permission-policy/module.d.ts.map +1 -1
  64. package/dist/adapters/http/controllers/entities/permission-policy/module.mjs +19 -4
  65. package/dist/adapters/http/controllers/entities/permission-policy/module.mjs.map +1 -1
  66. package/dist/adapters/http/controllers/entities/policy/module.d.ts +7 -7
  67. package/dist/adapters/http/controllers/entities/policy/module.d.ts.map +1 -1
  68. package/dist/adapters/http/controllers/entities/policy/module.mjs +27 -6
  69. package/dist/adapters/http/controllers/entities/policy/module.mjs.map +1 -1
  70. package/dist/adapters/http/controllers/entities/realm/module.d.ts +6 -6
  71. package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
  72. package/dist/adapters/http/controllers/entities/realm/module.mjs +29 -8
  73. package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
  74. package/dist/adapters/http/controllers/entities/role/module.d.ts +6 -6
  75. package/dist/adapters/http/controllers/entities/role/module.d.ts.map +1 -1
  76. package/dist/adapters/http/controllers/entities/role/module.mjs +27 -6
  77. package/dist/adapters/http/controllers/entities/role/module.mjs.map +1 -1
  78. package/dist/adapters/http/controllers/entities/role-attribute/module.d.ts +5 -5
  79. package/dist/adapters/http/controllers/entities/role-attribute/module.d.ts.map +1 -1
  80. package/dist/adapters/http/controllers/entities/role-attribute/module.mjs +23 -5
  81. package/dist/adapters/http/controllers/entities/role-attribute/module.mjs.map +1 -1
  82. package/dist/adapters/http/controllers/entities/role-permission/module.d.ts +5 -5
  83. package/dist/adapters/http/controllers/entities/role-permission/module.d.ts.map +1 -1
  84. package/dist/adapters/http/controllers/entities/role-permission/module.mjs +23 -5
  85. package/dist/adapters/http/controllers/entities/role-permission/module.mjs.map +1 -1
  86. package/dist/adapters/http/controllers/entities/scope/module.d.ts +6 -6
  87. package/dist/adapters/http/controllers/entities/scope/module.d.ts.map +1 -1
  88. package/dist/adapters/http/controllers/entities/scope/module.mjs +27 -6
  89. package/dist/adapters/http/controllers/entities/scope/module.mjs.map +1 -1
  90. package/dist/adapters/http/controllers/entities/session/module.d.ts +3 -3
  91. package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -1
  92. package/dist/adapters/http/controllers/entities/session/module.mjs +15 -3
  93. package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -1
  94. package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts +5 -5
  95. package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts.map +1 -1
  96. package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs +23 -5
  97. package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs.map +1 -1
  98. package/dist/adapters/http/controllers/entities/user/module.d.ts +6 -6
  99. package/dist/adapters/http/controllers/entities/user/module.d.ts.map +1 -1
  100. package/dist/adapters/http/controllers/entities/user/module.mjs +27 -6
  101. package/dist/adapters/http/controllers/entities/user/module.mjs.map +1 -1
  102. package/dist/adapters/http/controllers/entities/user-attribute/module.d.ts +5 -5
  103. package/dist/adapters/http/controllers/entities/user-attribute/module.d.ts.map +1 -1
  104. package/dist/adapters/http/controllers/entities/user-attribute/module.mjs +23 -5
  105. package/dist/adapters/http/controllers/entities/user-attribute/module.mjs.map +1 -1
  106. package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts +4 -4
  107. package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts.map +1 -1
  108. package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +19 -4
  109. package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs.map +1 -1
  110. package/dist/adapters/http/controllers/entities/user-permission/module.d.ts +5 -5
  111. package/dist/adapters/http/controllers/entities/user-permission/module.d.ts.map +1 -1
  112. package/dist/adapters/http/controllers/entities/user-permission/module.mjs +23 -5
  113. package/dist/adapters/http/controllers/entities/user-permission/module.mjs.map +1 -1
  114. package/dist/adapters/http/controllers/entities/user-role/module.d.ts +4 -4
  115. package/dist/adapters/http/controllers/entities/user-role/module.d.ts.map +1 -1
  116. package/dist/adapters/http/controllers/entities/user-role/module.mjs +19 -4
  117. package/dist/adapters/http/controllers/entities/user-role/module.mjs.map +1 -1
  118. package/dist/adapters/http/controllers/index.mjs +2 -1
  119. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs +1 -1
  120. package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs.map +1 -1
  121. package/dist/adapters/http/controllers/workflows/index.d.ts +1 -0
  122. package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
  123. package/dist/adapters/http/controllers/workflows/index.mjs +3 -1
  124. package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -1
  125. package/dist/adapters/http/controllers/workflows/logout/module.mjs +5 -1
  126. package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -1
  127. package/dist/adapters/http/controllers/workflows/userinfo/index.d.ts +2 -0
  128. package/dist/adapters/http/controllers/workflows/userinfo/index.d.ts.map +1 -0
  129. package/dist/adapters/http/controllers/workflows/userinfo/index.mjs +5 -0
  130. package/dist/adapters/http/controllers/workflows/userinfo/module.d.ts +18 -0
  131. package/dist/adapters/http/controllers/workflows/userinfo/module.d.ts.map +1 -0
  132. package/dist/adapters/http/controllers/workflows/userinfo/module.mjs +53 -0
  133. package/dist/adapters/http/controllers/workflows/userinfo/module.mjs.map +1 -0
  134. package/dist/adapters/http/index.mjs +2 -1
  135. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +1 -0
  136. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
  137. package/dist/adapters/http/middleware/built-in/authorization/module.mjs +8 -0
  138. package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
  139. package/dist/adapters/http/middleware/built-in/rate-limit.d.ts.map +1 -1
  140. package/dist/adapters/http/middleware/built-in/rate-limit.mjs +2 -0
  141. package/dist/adapters/http/middleware/built-in/rate-limit.mjs.map +1 -1
  142. package/dist/adapters/http/request/event-context.mjs +1 -1
  143. package/dist/adapters/http/request/event-context.mjs.map +1 -1
  144. package/dist/app/factory.d.ts +2 -1
  145. package/dist/app/factory.d.ts.map +1 -1
  146. package/dist/app/factory.mjs +2 -2
  147. package/dist/app/factory.mjs.map +1 -1
  148. package/dist/app/index.d.ts +1 -0
  149. package/dist/app/index.d.ts.map +1 -1
  150. package/dist/app/index.mjs +5 -1
  151. package/dist/app/modules/authentication/repositories/session.mjs +2 -2
  152. package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
  153. package/dist/app/modules/components/module.d.ts +3 -0
  154. package/dist/app/modules/components/module.d.ts.map +1 -1
  155. package/dist/app/modules/components/module.mjs +17 -2
  156. package/dist/app/modules/components/module.mjs.map +1 -1
  157. package/dist/app/modules/config/constants.d.ts +1 -0
  158. package/dist/app/modules/config/constants.d.ts.map +1 -1
  159. package/dist/app/modules/config/constants.mjs +1 -0
  160. package/dist/app/modules/config/constants.mjs.map +1 -1
  161. package/dist/app/modules/config/helpers.d.ts +9 -0
  162. package/dist/app/modules/config/helpers.d.ts.map +1 -0
  163. package/dist/app/modules/config/helpers.mjs +21 -0
  164. package/dist/app/modules/config/helpers.mjs.map +1 -0
  165. package/dist/app/modules/config/index.d.ts +2 -0
  166. package/dist/app/modules/config/index.d.ts.map +1 -1
  167. package/dist/app/modules/config/index.mjs +6 -1
  168. package/dist/app/modules/config/module.d.ts.map +1 -1
  169. package/dist/app/modules/config/module.mjs +2 -7
  170. package/dist/app/modules/config/module.mjs.map +1 -1
  171. package/dist/app/modules/config/normalize.d.ts.map +1 -1
  172. package/dist/app/modules/config/normalize.mjs +4 -0
  173. package/dist/app/modules/config/normalize.mjs.map +1 -1
  174. package/dist/app/modules/config/read/env.d.ts.map +1 -1
  175. package/dist/app/modules/config/read/env.mjs +2 -0
  176. package/dist/app/modules/config/read/env.mjs.map +1 -1
  177. package/dist/app/modules/config/read/fs.d.ts.map +1 -1
  178. package/dist/app/modules/config/read/fs.mjs +31 -8
  179. package/dist/app/modules/config/read/fs.mjs.map +1 -1
  180. package/dist/app/modules/config/trust-proxy.d.ts +28 -0
  181. package/dist/app/modules/config/trust-proxy.d.ts.map +1 -0
  182. package/dist/app/modules/config/trust-proxy.mjs +64 -0
  183. package/dist/app/modules/config/trust-proxy.mjs.map +1 -0
  184. package/dist/app/modules/config/types.d.ts +18 -0
  185. package/dist/app/modules/config/types.d.ts.map +1 -1
  186. package/dist/app/modules/config/validator.d.ts.map +1 -1
  187. package/dist/app/modules/config/validator.mjs +7 -0
  188. package/dist/app/modules/config/validator.mjs.map +1 -1
  189. package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
  190. package/dist/app/modules/database/repositories/client/repository.mjs +3 -4
  191. package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
  192. package/dist/app/modules/database/repositories/client-permission/repository.mjs +2 -2
  193. package/dist/app/modules/database/repositories/client-permission/repository.mjs.map +1 -1
  194. package/dist/app/modules/database/repositories/client-role/repository.mjs +2 -2
  195. package/dist/app/modules/database/repositories/client-role/repository.mjs.map +1 -1
  196. package/dist/app/modules/database/repositories/client-scope/repository.mjs +2 -2
  197. package/dist/app/modules/database/repositories/client-scope/repository.mjs.map +1 -1
  198. package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -1
  199. package/dist/app/modules/database/repositories/event/repository.mjs +4 -3
  200. package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -1
  201. package/dist/app/modules/database/repositories/identity-provider/repository.mjs +2 -2
  202. package/dist/app/modules/database/repositories/identity-provider/repository.mjs.map +1 -1
  203. package/dist/app/modules/database/repositories/identity-provider-role-mapping/repository.mjs +2 -2
  204. package/dist/app/modules/database/repositories/identity-provider-role-mapping/repository.mjs.map +1 -1
  205. package/dist/app/modules/database/repositories/key/repository.mjs +2 -2
  206. package/dist/app/modules/database/repositories/key/repository.mjs.map +1 -1
  207. package/dist/app/modules/database/repositories/permission/repository.mjs +2 -2
  208. package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
  209. package/dist/app/modules/database/repositories/permission-policy/repository.mjs +2 -2
  210. package/dist/app/modules/database/repositories/permission-policy/repository.mjs.map +1 -1
  211. package/dist/app/modules/database/repositories/policy/repository.mjs +2 -2
  212. package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
  213. package/dist/app/modules/database/repositories/query.d.ts +20 -0
  214. package/dist/app/modules/database/repositories/query.d.ts.map +1 -1
  215. package/dist/app/modules/database/repositories/query.mjs +26 -3
  216. package/dist/app/modules/database/repositories/query.mjs.map +1 -1
  217. package/dist/app/modules/database/repositories/realm/repository.mjs +2 -2
  218. package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
  219. package/dist/app/modules/database/repositories/role/repository.mjs +2 -2
  220. package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
  221. package/dist/app/modules/database/repositories/role-attribute/repository.mjs +2 -2
  222. package/dist/app/modules/database/repositories/role-attribute/repository.mjs.map +1 -1
  223. package/dist/app/modules/database/repositories/role-permission/repository.mjs +2 -2
  224. package/dist/app/modules/database/repositories/role-permission/repository.mjs.map +1 -1
  225. package/dist/app/modules/database/repositories/schema-validation.d.ts +17 -3
  226. package/dist/app/modules/database/repositories/schema-validation.d.ts.map +1 -1
  227. package/dist/app/modules/database/repositories/schema-validation.mjs +29 -5
  228. package/dist/app/modules/database/repositories/schema-validation.mjs.map +1 -1
  229. package/dist/app/modules/database/repositories/scope/repository.mjs +2 -2
  230. package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
  231. package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +2 -2
  232. package/dist/app/modules/database/repositories/trust-anchor/repository.mjs.map +1 -1
  233. package/dist/app/modules/database/repositories/user/repository.mjs +2 -2
  234. package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
  235. package/dist/app/modules/database/repositories/user-attribute/repository.mjs +2 -2
  236. package/dist/app/modules/database/repositories/user-attribute/repository.mjs.map +1 -1
  237. package/dist/app/modules/database/repositories/user-authenticator/repository.mjs +2 -2
  238. package/dist/app/modules/database/repositories/user-authenticator/repository.mjs.map +1 -1
  239. package/dist/app/modules/database/repositories/user-permission/repository.mjs +2 -2
  240. package/dist/app/modules/database/repositories/user-permission/repository.mjs.map +1 -1
  241. package/dist/app/modules/database/repositories/user-role/repository.mjs +2 -2
  242. package/dist/app/modules/database/repositories/user-role/repository.mjs.map +1 -1
  243. package/dist/app/modules/http/constants.d.ts +2 -13
  244. package/dist/app/modules/http/constants.d.ts.map +1 -1
  245. package/dist/app/modules/http/constants.mjs.map +1 -1
  246. package/dist/app/modules/http/module.d.ts.map +1 -1
  247. package/dist/app/modules/http/module.mjs +7 -1
  248. package/dist/app/modules/http/module.mjs.map +1 -1
  249. package/dist/app/modules/http/modules/controller.d.ts +4 -2
  250. package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
  251. package/dist/app/modules/http/modules/controller.mjs +16 -3
  252. package/dist/app/modules/http/modules/controller.mjs.map +1 -1
  253. package/dist/app/modules/index.mjs +5 -1
  254. package/dist/app/modules/oauth2/repositories/consent/repository.mjs +2 -2
  255. package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -1
  256. package/dist/app/modules/provisioning/module.d.ts.map +1 -1
  257. package/dist/app/modules/provisioning/module.mjs +12 -4
  258. package/dist/app/modules/provisioning/module.mjs.map +1 -1
  259. package/dist/app/types.d.ts +5 -0
  260. package/dist/app/types.d.ts.map +1 -0
  261. package/dist/app/types.mjs +4 -0
  262. package/dist/cli/commands/healthcheck.d.ts +2 -1
  263. package/dist/cli/commands/healthcheck.d.ts.map +1 -1
  264. package/dist/cli/commands/healthcheck.mjs +3 -2
  265. package/dist/cli/commands/healthcheck.mjs.map +1 -1
  266. package/dist/cli/commands/index.d.ts +0 -1
  267. package/dist/cli/commands/index.d.ts.map +1 -1
  268. package/dist/cli/commands/index.mjs +1 -2
  269. package/dist/cli/commands/migration.d.ts +2 -1
  270. package/dist/cli/commands/migration.d.ts.map +1 -1
  271. package/dist/cli/commands/migration.mjs +3 -2
  272. package/dist/cli/commands/migration.mjs.map +1 -1
  273. package/dist/cli/commands/start.d.ts +2 -1
  274. package/dist/cli/commands/start.d.ts.map +1 -1
  275. package/dist/cli/commands/start.mjs +3 -2
  276. package/dist/cli/commands/start.mjs.map +1 -1
  277. package/dist/cli/config.d.ts +18 -0
  278. package/dist/cli/config.d.ts.map +1 -0
  279. package/dist/cli/config.mjs +34 -0
  280. package/dist/cli/config.mjs.map +1 -0
  281. package/dist/cli/module.d.ts +8 -8
  282. package/dist/cli/module.d.ts.map +1 -1
  283. package/dist/cli/module.mjs +8 -28
  284. package/dist/cli/module.mjs.map +1 -1
  285. package/dist/cli/types.d.ts +5 -0
  286. package/dist/cli/types.d.ts.map +1 -0
  287. package/dist/cli/types.mjs +4 -0
  288. package/dist/components/event-cleaner/module.d.ts.map +1 -1
  289. package/dist/components/event-cleaner/module.mjs +26 -14
  290. package/dist/components/event-cleaner/module.mjs.map +1 -1
  291. package/dist/components/index.d.ts +0 -1
  292. package/dist/components/index.d.ts.map +1 -1
  293. package/dist/components/index.mjs +1 -4
  294. package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
  295. package/dist/components/oauth2-cleaner/module.mjs +29 -17
  296. package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
  297. package/dist/components/types.d.ts +1 -0
  298. package/dist/components/types.d.ts.map +1 -1
  299. package/dist/core/authentication/login-throttle/service.d.ts.map +1 -1
  300. package/dist/core/authentication/login-throttle/service.mjs +2 -1
  301. package/dist/core/authentication/login-throttle/service.mjs.map +1 -1
  302. package/dist/core/entities/client/constants.d.ts +10 -0
  303. package/dist/core/entities/client/constants.d.ts.map +1 -0
  304. package/dist/core/entities/client/constants.mjs +20 -0
  305. package/dist/core/entities/client/constants.mjs.map +1 -0
  306. package/dist/core/entities/client/index.d.ts +1 -0
  307. package/dist/core/entities/client/index.d.ts.map +1 -1
  308. package/dist/core/entities/client/index.mjs +3 -2
  309. package/dist/core/entities/client/schema.d.ts.map +1 -1
  310. package/dist/core/entities/client/schema.mjs +40 -3
  311. package/dist/core/entities/client/schema.mjs.map +1 -1
  312. package/dist/core/entities/client/service.d.ts.map +1 -1
  313. package/dist/core/entities/client/service.mjs +8 -60
  314. package/dist/core/entities/client/service.mjs.map +1 -1
  315. package/dist/core/entities/client/web-client.d.ts +39 -3
  316. package/dist/core/entities/client/web-client.d.ts.map +1 -1
  317. package/dist/core/entities/client/web-client.mjs +68 -12
  318. package/dist/core/entities/client/web-client.mjs.map +1 -1
  319. package/dist/core/entities/client-scope/schema.d.ts.map +1 -1
  320. package/dist/core/entities/client-scope/schema.mjs +3 -1
  321. package/dist/core/entities/client-scope/schema.mjs.map +1 -1
  322. package/dist/core/entities/event/constants.d.ts +7 -0
  323. package/dist/core/entities/event/constants.d.ts.map +1 -1
  324. package/dist/core/entities/event/constants.mjs +7 -1
  325. package/dist/core/entities/event/constants.mjs.map +1 -1
  326. package/dist/core/entities/event/index.mjs +2 -2
  327. package/dist/core/entities/event/service.mjs +1 -1
  328. package/dist/core/entities/event/service.mjs.map +1 -1
  329. package/dist/core/entities/index.mjs +4 -3
  330. package/dist/core/entities/role/schema.d.ts.map +1 -1
  331. package/dist/core/entities/role/schema.mjs +4 -0
  332. package/dist/core/entities/role/schema.mjs.map +1 -1
  333. package/dist/core/entities/session/schema.d.ts.map +1 -1
  334. package/dist/core/entities/session/schema.mjs +2 -0
  335. package/dist/core/entities/session/schema.mjs.map +1 -1
  336. package/dist/core/entities/user/schema.d.ts.map +1 -1
  337. package/dist/core/entities/user/schema.mjs +2 -0
  338. package/dist/core/entities/user/schema.mjs.map +1 -1
  339. package/dist/core/identity/password-recovery/check.mjs +4 -4
  340. package/dist/core/identity/password-recovery/check.mjs.map +1 -1
  341. package/dist/core/identity/registration/check.mjs +2 -2
  342. package/dist/core/identity/registration/check.mjs.map +1 -1
  343. package/dist/core/index.mjs +5 -3
  344. package/dist/core/key/check.mjs +2 -2
  345. package/dist/core/key/check.mjs.map +1 -1
  346. package/dist/core/provisioning/entities/client/relations-validator.d.ts.map +1 -1
  347. package/dist/core/provisioning/entities/client/relations-validator.mjs +2 -0
  348. package/dist/core/provisioning/entities/client/relations-validator.mjs.map +1 -1
  349. package/dist/core/provisioning/entities/client/types.d.ts +8 -0
  350. package/dist/core/provisioning/entities/client/types.d.ts.map +1 -1
  351. package/dist/core/provisioning/synchronizer/client/module.d.ts +3 -1
  352. package/dist/core/provisioning/synchronizer/client/module.d.ts.map +1 -1
  353. package/dist/core/provisioning/synchronizer/client/module.mjs +10 -0
  354. package/dist/core/provisioning/synchronizer/client/module.mjs.map +1 -1
  355. package/dist/core/provisioning/synchronizer/client/types.d.ts +3 -1
  356. package/dist/core/provisioning/synchronizer/client/types.d.ts.map +1 -1
  357. package/dist/core/provisioning/synchronizer/entity-resolver.d.ts +4 -1
  358. package/dist/core/provisioning/synchronizer/entity-resolver.d.ts.map +1 -1
  359. package/dist/core/provisioning/synchronizer/entity-resolver.mjs +14 -29
  360. package/dist/core/provisioning/synchronizer/entity-resolver.mjs.map +1 -1
  361. package/dist/core/provisioning/synchronizer/index.d.ts +1 -0
  362. package/dist/core/provisioning/synchronizer/index.d.ts.map +1 -1
  363. package/dist/core/provisioning/synchronizer/realm/module.d.ts.map +1 -1
  364. package/dist/core/provisioning/synchronizer/realm/module.mjs +8 -8
  365. package/dist/core/provisioning/synchronizer/realm/module.mjs.map +1 -1
  366. package/dist/core/provisioning/synchronizer/types.d.ts +11 -0
  367. package/dist/core/provisioning/synchronizer/types.d.ts.map +1 -0
  368. package/dist/core/provisioning/synchronizer/types.mjs +4 -0
  369. package/dist/core/query/describe.d.ts +25 -0
  370. package/dist/core/query/describe.d.ts.map +1 -0
  371. package/dist/core/query/describe.mjs +50 -0
  372. package/dist/core/query/describe.mjs.map +1 -0
  373. package/dist/core/query/fields.d.ts +44 -0
  374. package/dist/core/query/fields.d.ts.map +1 -0
  375. package/dist/core/query/fields.mjs +46 -0
  376. package/dist/core/query/fields.mjs.map +1 -0
  377. package/dist/core/query/index.d.ts +1 -0
  378. package/dist/core/query/index.d.ts.map +1 -1
  379. package/dist/core/query/index.mjs +2 -1
  380. package/dist/core/query/module.d.ts +1 -1
  381. package/dist/core/query/module.mjs +1 -1
  382. package/dist/core/query/module.mjs.map +1 -1
  383. package/dist/index.mjs +6 -2
  384. package/dist/swagger.json +852 -145
  385. package/dist/ui/client/.vite/ssr-manifest.json +862 -754
  386. package/dist/ui/client/assets/index-Bk6-OZy9.css +2 -0
  387. package/dist/ui/client/assets/index-DO6_7NTJ.js +106 -0
  388. package/dist/ui/client/index.html +2 -2
  389. package/dist/ui/server/server.js +152569 -156411
  390. package/package.json +40 -40
  391. package/dist/cli/commands/reset.d.ts +0 -2
  392. package/dist/cli/commands/reset.d.ts.map +0 -1
  393. package/dist/cli/commands/reset.mjs +0 -23
  394. package/dist/cli/commands/reset.mjs.map +0 -1
  395. package/dist/components/database/index.d.ts +0 -2
  396. package/dist/components/database/index.d.ts.map +0 -1
  397. package/dist/components/database/index.mjs +0 -7
  398. package/dist/components/database/unique-entries/factory.d.ts +0 -4
  399. package/dist/components/database/unique-entries/factory.d.ts.map +0 -1
  400. package/dist/components/database/unique-entries/factory.mjs +0 -12
  401. package/dist/components/database/unique-entries/factory.mjs.map +0 -1
  402. package/dist/components/database/unique-entries/index.d.ts +0 -3
  403. package/dist/components/database/unique-entries/index.d.ts.map +0 -1
  404. package/dist/components/database/unique-entries/index.mjs +0 -6
  405. package/dist/components/database/unique-entries/module.d.ts +0 -15
  406. package/dist/components/database/unique-entries/module.d.ts.map +0 -1
  407. package/dist/components/database/unique-entries/module.mjs +0 -69
  408. package/dist/components/database/unique-entries/module.mjs.map +0 -1
  409. package/dist/ui/client/assets/index-CiHrf73J.css +0 -2
  410. package/dist/ui/client/assets/index-mtJngmng.js +0 -131
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","names":["oneOf","read","readArray","readBool","readInt","hasEnvDataSourceOptions","readDataSourceOptionsFromEnv","ConfigEnvironmentVariableName","BOOLEAN_TRUE_VALUES","Set","BOOLEAN_FALSE_VALUES","readBoolStrict","name","raw","trim","length","undefined","normalized","toLowerCase","has","Error","readConfigRawFromEnv","options","env","NODE_ENV","writableDirectoryPath","WRITABLE_DIRECTORY_PATH","db","redis","REDIS","smtp","SMTP","host","HOST","port","PORT","publicURL","PUBLIC_URL","publicUrl","mtlsPublicURL","MTLS_PUBLIC_URL","mtlsPublicUrl","certificateSource","CERTIFICATE_SOURCE","trustedOrigins","TRUSTED_ORIGINS","tokenAccessMaxAge","TOKEN_ACCESS_MAX_AGE","tokenRefreshMaxAge","TOKEN_REFRESH_MAX_AGE","tokenRefreshGracePeriod","TOKEN_REFRESH_GRACE_PERIOD","promptLoginMaxAge","PROMPT_LOGIN_MAX_AGE","endSessionHintGracePeriod","END_SESSION_HINT_GRACE_PERIOD","registrationEnabled","REGISTRATION_ENABLED","emailVerificationEnabled","EMAIL_VERIFICATION_ENABLED","passwordRecoveryEnabled","PASSWORD_RECOVERY_ENABLED","passwordMinLength","PASSWORD_MIN_LENGTH","eventLogEnabled","EVENT_LOG_ENABLED","eventLogRetentionDays","EVENT_LOG_RETENTION_DAYS","eventLogEntityEnabled","EVENT_LOG_ENTITY_ENABLED","eventLogEntityRetentionDays","EVENT_LOG_ENTITY_RETENTION_DAYS","loginAttemptThrottleEnabled","LOGIN_ATTEMPT_THROTTLE_ENABLED","loginAttemptThreshold","LOGIN_ATTEMPT_THRESHOLD","loginAttemptWindow","LOGIN_ATTEMPT_WINDOW","mfaEnabled","MFA_ENABLED","mfaRequired","MFA_REQUIRED","mfaFreshnessMaxAge","MFA_FRESHNESS_MAX_AGE","mfaTicketMaxAge","MFA_TICKET_MAX_AGE","secretsEncryptionKey","SECRETS_ENCRYPTION_KEY","clientBasicAuth","CLIENT_AUTH_BASIC","clientAuthBasic","clientSystemEnabled","CLIENT_SYSTEM_ENABLED","clientAdminSecret","CLIENT_SYSTEM_SECRET","clientSystemSecret","clientAdminSecretReset","CLIENT_SYSTEM_SECRET_RESET","clientSystemSecretReset","userBasicAuth","USER_AUTH_BASIC","userAuthBasic","userAdminEnabled","USER_ADMIN_ENABLED","userAdminPassword","USER_ADMIN_PASSWORD","userAdminPasswordReset","USER_ADMIN_PASSWORD_RESET","permissions","PERMISSIONS","permissionsDefaultPolicyAssignment","PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT"],"sources":["../../../../../src/app/modules/config/read/env.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n oneOf,\n read,\n readArray,\n readBool,\n readInt,\n} from 'envix';\nimport { hasEnvDataSourceOptions, readDataSourceOptionsFromEnv } from 'typeorm-extension';\nimport type { BetterSqlite3DataSourceOptions } from 'typeorm/driver/better-sqlite3/BetterSqlite3DataSourceOptions.js';\nimport type { MysqlDataSourceOptions } from 'typeorm/driver/mysql/MysqlDataSourceOptions.js';\nimport type { PostgresDataSourceOptions } from 'typeorm/driver/postgres/PostgresDataSourceOptions.js';\n\nimport { ConfigEnvironmentVariableName } from '../constants.ts';\nimport type { ConfigInput } from '../types.ts';\n\nconst BOOLEAN_TRUE_VALUES = new Set(['true', 't', '1', 'yes', 'y', 'on']);\nconst BOOLEAN_FALSE_VALUES = new Set(['false', 'f', '0', 'no', 'n', 'off']);\n\n/**\n * Boolean env reader that FAILS LOUD on a set-but-unrecognized value instead\n * of silently falling back to the default (envix's `readBool` swallows e.g.\n * `MFA_REQUIRED=yes`). Reserved for security-relevant toggles where a silent\n * default is a weakened posture. Returns `undefined` when the var is unset.\n */\nfunction readBoolStrict(name: ConfigEnvironmentVariableName) : boolean | undefined {\n const raw = read(name);\n if (typeof raw !== 'string' || raw.trim().length === 0) {\n return undefined;\n }\n\n const normalized = raw.trim().toLowerCase();\n if (BOOLEAN_TRUE_VALUES.has(normalized)) {\n return true;\n }\n if (BOOLEAN_FALSE_VALUES.has(normalized)) {\n return false;\n }\n\n throw new Error(`The environment variable ${name} must be a boolean value (received \"${raw}\").`);\n}\n\nexport function readConfigRawFromEnv() : ConfigInput {\n const options : ConfigInput = {};\n\n const env = read(ConfigEnvironmentVariableName.NODE_ENV);\n if (env) {\n options.env = env;\n }\n\n const writableDirectoryPath = read(ConfigEnvironmentVariableName.WRITABLE_DIRECTORY_PATH);\n if (writableDirectoryPath) {\n options.writableDirectoryPath = writableDirectoryPath;\n }\n\n // -------------------------------------------------------------\n\n if (hasEnvDataSourceOptions()) {\n // todo: type casting should be avoided\n options.db = readDataSourceOptionsFromEnv() as MysqlDataSourceOptions |\n PostgresDataSourceOptions |\n BetterSqlite3DataSourceOptions;\n }\n\n const redis = oneOf([\n readBool(ConfigEnvironmentVariableName.REDIS),\n read(ConfigEnvironmentVariableName.REDIS),\n ]);\n if (typeof redis !== 'undefined') {\n options.redis = redis;\n }\n\n const smtp = oneOf([\n readBool(ConfigEnvironmentVariableName.SMTP),\n read(ConfigEnvironmentVariableName.SMTP),\n ]);\n if (typeof smtp !== 'undefined') {\n options.smtp = smtp;\n }\n\n // -------------------------------------------------------------\n\n const host = read(ConfigEnvironmentVariableName.HOST);\n if (host) {\n options.host = host;\n }\n\n const port = readInt(ConfigEnvironmentVariableName.PORT);\n if (typeof port !== 'undefined') {\n options.port = port;\n }\n\n const publicURL = read(ConfigEnvironmentVariableName.PUBLIC_URL);\n if (publicURL) {\n options.publicUrl = publicURL;\n }\n\n const mtlsPublicURL = read(ConfigEnvironmentVariableName.MTLS_PUBLIC_URL);\n if (mtlsPublicURL) {\n options.mtlsPublicUrl = mtlsPublicURL;\n }\n\n const certificateSource = read(ConfigEnvironmentVariableName.CERTIFICATE_SOURCE);\n if (certificateSource) {\n options.certificateSource = certificateSource as ConfigInput['certificateSource'];\n }\n\n const trustedOrigins = readArray(ConfigEnvironmentVariableName.TRUSTED_ORIGINS);\n if (trustedOrigins && trustedOrigins.length > 0) {\n options.trustedOrigins = trustedOrigins;\n }\n\n const tokenAccessMaxAge = readInt(ConfigEnvironmentVariableName.TOKEN_ACCESS_MAX_AGE);\n if (typeof tokenAccessMaxAge !== 'undefined') {\n options.tokenAccessMaxAge = tokenAccessMaxAge;\n }\n\n const tokenRefreshMaxAge = readInt(ConfigEnvironmentVariableName.TOKEN_REFRESH_MAX_AGE);\n if (typeof tokenRefreshMaxAge !== 'undefined') {\n options.tokenRefreshMaxAge = tokenRefreshMaxAge;\n }\n\n const tokenRefreshGracePeriod = readInt(ConfigEnvironmentVariableName.TOKEN_REFRESH_GRACE_PERIOD);\n if (typeof tokenRefreshGracePeriod !== 'undefined') {\n options.tokenRefreshGracePeriod = tokenRefreshGracePeriod;\n }\n\n const promptLoginMaxAge = readInt(ConfigEnvironmentVariableName.PROMPT_LOGIN_MAX_AGE);\n if (typeof promptLoginMaxAge !== 'undefined') {\n options.promptLoginMaxAge = promptLoginMaxAge;\n }\n\n const endSessionHintGracePeriod = readInt(ConfigEnvironmentVariableName.END_SESSION_HINT_GRACE_PERIOD);\n if (typeof endSessionHintGracePeriod !== 'undefined') {\n options.endSessionHintGracePeriod = endSessionHintGracePeriod;\n }\n\n const registrationEnabled = readBool(ConfigEnvironmentVariableName.REGISTRATION_ENABLED);\n if (typeof registrationEnabled !== 'undefined') {\n options.registrationEnabled = registrationEnabled;\n }\n\n const emailVerificationEnabled = readBool(ConfigEnvironmentVariableName.EMAIL_VERIFICATION_ENABLED);\n if (typeof emailVerificationEnabled !== 'undefined') {\n options.emailVerificationEnabled = emailVerificationEnabled;\n }\n\n const passwordRecoveryEnabled = readBool(ConfigEnvironmentVariableName.PASSWORD_RECOVERY_ENABLED);\n if (typeof passwordRecoveryEnabled !== 'undefined') {\n options.passwordRecoveryEnabled = passwordRecoveryEnabled;\n }\n\n const passwordMinLength = readInt(ConfigEnvironmentVariableName.PASSWORD_MIN_LENGTH);\n if (typeof passwordMinLength !== 'undefined') {\n options.passwordMinLength = passwordMinLength;\n }\n\n // ---------------------------------------------------------------\n\n const eventLogEnabled = readBoolStrict(ConfigEnvironmentVariableName.EVENT_LOG_ENABLED);\n if (typeof eventLogEnabled !== 'undefined') {\n options.eventLogEnabled = eventLogEnabled;\n }\n\n const eventLogRetentionDays = readInt(ConfigEnvironmentVariableName.EVENT_LOG_RETENTION_DAYS);\n if (typeof eventLogRetentionDays !== 'undefined') {\n options.eventLogRetentionDays = eventLogRetentionDays;\n }\n\n const eventLogEntityEnabled = readBoolStrict(ConfigEnvironmentVariableName.EVENT_LOG_ENTITY_ENABLED);\n if (typeof eventLogEntityEnabled !== 'undefined') {\n options.eventLogEntityEnabled = eventLogEntityEnabled;\n }\n\n const eventLogEntityRetentionDays = readInt(ConfigEnvironmentVariableName.EVENT_LOG_ENTITY_RETENTION_DAYS);\n if (typeof eventLogEntityRetentionDays !== 'undefined') {\n options.eventLogEntityRetentionDays = eventLogEntityRetentionDays;\n }\n\n const loginAttemptThrottleEnabled = readBoolStrict(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_THROTTLE_ENABLED);\n if (typeof loginAttemptThrottleEnabled !== 'undefined') {\n options.loginAttemptThrottleEnabled = loginAttemptThrottleEnabled;\n }\n\n const loginAttemptThreshold = readInt(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_THRESHOLD);\n if (typeof loginAttemptThreshold !== 'undefined') {\n options.loginAttemptThreshold = loginAttemptThreshold;\n }\n\n const loginAttemptWindow = readInt(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_WINDOW);\n if (typeof loginAttemptWindow !== 'undefined') {\n options.loginAttemptWindow = loginAttemptWindow;\n }\n\n // ---------------------------------------------------------------\n\n const mfaEnabled = readBoolStrict(ConfigEnvironmentVariableName.MFA_ENABLED);\n if (typeof mfaEnabled !== 'undefined') {\n options.mfaEnabled = mfaEnabled;\n }\n\n const mfaRequired = readBoolStrict(ConfigEnvironmentVariableName.MFA_REQUIRED);\n if (typeof mfaRequired !== 'undefined') {\n options.mfaRequired = mfaRequired;\n }\n\n const mfaFreshnessMaxAge = readInt(ConfigEnvironmentVariableName.MFA_FRESHNESS_MAX_AGE);\n if (typeof mfaFreshnessMaxAge !== 'undefined') {\n options.mfaFreshnessMaxAge = mfaFreshnessMaxAge;\n }\n\n const mfaTicketMaxAge = readInt(ConfigEnvironmentVariableName.MFA_TICKET_MAX_AGE);\n if (typeof mfaTicketMaxAge !== 'undefined') {\n options.mfaTicketMaxAge = mfaTicketMaxAge;\n }\n\n const secretsEncryptionKey = read(ConfigEnvironmentVariableName.SECRETS_ENCRYPTION_KEY);\n if (secretsEncryptionKey) {\n options.secretsEncryptionKey = secretsEncryptionKey;\n }\n\n // ---------------------------------------------------------------\n\n const clientBasicAuth = readBool(ConfigEnvironmentVariableName.CLIENT_AUTH_BASIC);\n if (typeof clientBasicAuth !== 'undefined') {\n options.clientAuthBasic = clientBasicAuth;\n }\n\n const clientSystemEnabled = readBool(ConfigEnvironmentVariableName.CLIENT_SYSTEM_ENABLED);\n if (typeof clientSystemEnabled !== 'undefined') {\n options.clientSystemEnabled = clientSystemEnabled;\n }\n\n const clientAdminSecret = read(ConfigEnvironmentVariableName.CLIENT_SYSTEM_SECRET);\n if (clientAdminSecret) {\n options.clientSystemSecret = clientAdminSecret;\n }\n\n const clientAdminSecretReset = readBool(ConfigEnvironmentVariableName.CLIENT_SYSTEM_SECRET_RESET);\n if (typeof clientAdminSecretReset !== 'undefined') {\n options.clientSystemSecretReset = clientAdminSecretReset;\n }\n\n // ---------------------------------------------------------------\n\n const userBasicAuth = readBool(ConfigEnvironmentVariableName.USER_AUTH_BASIC);\n if (typeof userBasicAuth !== 'undefined') {\n options.userAuthBasic = userBasicAuth;\n }\n\n const userAdminEnabled = readBool(ConfigEnvironmentVariableName.USER_ADMIN_ENABLED);\n if (typeof userAdminEnabled !== 'undefined') {\n options.userAdminEnabled = userAdminEnabled;\n }\n\n const userAdminPassword = read(ConfigEnvironmentVariableName.USER_ADMIN_PASSWORD);\n if (userAdminPassword) {\n options.userAdminPassword = userAdminPassword;\n }\n\n const userAdminPasswordReset = readBool(ConfigEnvironmentVariableName.USER_ADMIN_PASSWORD_RESET);\n if (typeof userAdminPasswordReset !== 'undefined') {\n options.userAdminPasswordReset = userAdminPasswordReset;\n }\n\n // ---------------------------------------------------------------\n\n const permissions = readArray(ConfigEnvironmentVariableName.PERMISSIONS);\n if (permissions && permissions.length > 0) {\n options.permissions = permissions;\n }\n\n const permissionsDefaultPolicyAssignment = readBool(ConfigEnvironmentVariableName.PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT);\n if (typeof permissionsDefaultPolicyAssignment !== 'undefined') {\n options.permissionsDefaultPolicyAssignment = permissionsDefaultPolicyAssignment;\n }\n\n return options;\n}\n"],"mappings":";;;;;;;AAsBA,MAAMQ,sCAAsB,IAAIC,IAAI;CAAC;CAAQ;CAAK;CAAK;CAAO;CAAK;AAAK,CAAA;AACxE,MAAMC,uCAAuB,IAAID,IAAI;CAAC;CAAS;CAAK;CAAK;CAAM;CAAK;AAAM,CAAA;;;;;;GAQ1E,SAASE,eAAeC,MAAmC;CACvD,MAAMC,MAAMZ,KAAKW,IAAAA;CACjB,IAAI,OAAOC,QAAQ,YAAYA,IAA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,SAASI,8BAA8BqF,qBAAqB;CACxF,IAAI,OAAOD,wBAAwB,aAC/BrE,QAAQqE,sBAAsBA;CAGlC,MAAME,oBAAoB5F,KAAKM,8BAA8BuF,oBAAoB;CACjF,IAAID,mBACAvE,QAAQyE,qBAAqBF;CAGjC,MAAMG,yBAAyB7F,SAASI,8BAA8B0F,0BAA0B;CAChG,IAAI,OAAOD,2BAA2B,aAClC1E,QAAQ4E,0BAA0BF;CAKtC,MAAMG,gBAAgBhG,SAASI,8BAA8B6F,eAAe;CAC5E,IAAI,OAAOD,kBAAkB,aACzB7E,QAAQ+E,gBAAgBF;CAG5B,MAAMG,mBAAmBnG,SAASI,8BAA8BgG,kBAAkB;CAClF,IAAI,OAAOD,qBAAqB,aAC5BhF,QAAQgF,mBAAmBA;CAG/B,MAAME,oBAAoBvG,KAAKM,8BAA8BkG,mBAAmB;CAChF,IAAID,mBACAlF,QAAQkF,oBAAoBA;CAGhC,MAAME,yBAAyBvG,SAASI,8BAA8BoG,yBAAyB;CAC/F,IAAI,OAAOD,2BAA2B,aAClCpF,QAAQoF,yBAAyBA;CAKrC,MAAME,cAAc1G,UAAUK,8BAA8BsG,WAAW;CACvE,IAAID,eAAeA,YAAY7F,SAAS,GACpCO,QAAQsF,cAAcA;CAG1B,MAAME,qCAAqC3G,SAASI,8BAA8BwG,qCAAqC;CACvH,IAAI,OAAOD,uCAAuC,aAC9CxF,QAAQwF,qCAAqCA;CAGjD,OAAOxF;AACX"}
1
+ {"version":3,"file":"env.mjs","names":["oneOf","read","readArray","readBool","readInt","hasEnvDataSourceOptions","readDataSourceOptionsFromEnv","ConfigEnvironmentVariableName","BOOLEAN_TRUE_VALUES","Set","BOOLEAN_FALSE_VALUES","readBoolStrict","name","raw","trim","length","undefined","normalized","toLowerCase","has","Error","readConfigRawFromEnv","options","env","NODE_ENV","writableDirectoryPath","WRITABLE_DIRECTORY_PATH","db","redis","REDIS","smtp","SMTP","host","HOST","port","PORT","publicURL","PUBLIC_URL","publicUrl","mtlsPublicURL","MTLS_PUBLIC_URL","mtlsPublicUrl","certificateSource","CERTIFICATE_SOURCE","trustProxy","TRUST_PROXY","trustedOrigins","TRUSTED_ORIGINS","tokenAccessMaxAge","TOKEN_ACCESS_MAX_AGE","tokenRefreshMaxAge","TOKEN_REFRESH_MAX_AGE","tokenRefreshGracePeriod","TOKEN_REFRESH_GRACE_PERIOD","promptLoginMaxAge","PROMPT_LOGIN_MAX_AGE","endSessionHintGracePeriod","END_SESSION_HINT_GRACE_PERIOD","registrationEnabled","REGISTRATION_ENABLED","emailVerificationEnabled","EMAIL_VERIFICATION_ENABLED","passwordRecoveryEnabled","PASSWORD_RECOVERY_ENABLED","passwordMinLength","PASSWORD_MIN_LENGTH","eventLogEnabled","EVENT_LOG_ENABLED","eventLogRetentionDays","EVENT_LOG_RETENTION_DAYS","eventLogEntityEnabled","EVENT_LOG_ENTITY_ENABLED","eventLogEntityRetentionDays","EVENT_LOG_ENTITY_RETENTION_DAYS","loginAttemptThrottleEnabled","LOGIN_ATTEMPT_THROTTLE_ENABLED","loginAttemptThreshold","LOGIN_ATTEMPT_THRESHOLD","loginAttemptWindow","LOGIN_ATTEMPT_WINDOW","mfaEnabled","MFA_ENABLED","mfaRequired","MFA_REQUIRED","mfaFreshnessMaxAge","MFA_FRESHNESS_MAX_AGE","mfaTicketMaxAge","MFA_TICKET_MAX_AGE","secretsEncryptionKey","SECRETS_ENCRYPTION_KEY","clientBasicAuth","CLIENT_AUTH_BASIC","clientAuthBasic","clientSystemEnabled","CLIENT_SYSTEM_ENABLED","clientAdminSecret","CLIENT_SYSTEM_SECRET","clientSystemSecret","clientAdminSecretReset","CLIENT_SYSTEM_SECRET_RESET","clientSystemSecretReset","userBasicAuth","USER_AUTH_BASIC","userAuthBasic","userAdminEnabled","USER_ADMIN_ENABLED","userAdminPassword","USER_ADMIN_PASSWORD","userAdminPasswordReset","USER_ADMIN_PASSWORD_RESET","permissions","PERMISSIONS","permissionsDefaultPolicyAssignment","PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT"],"sources":["../../../../../src/app/modules/config/read/env.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n oneOf,\n read,\n readArray,\n readBool,\n readInt,\n} from 'envix';\nimport { hasEnvDataSourceOptions, readDataSourceOptionsFromEnv } from 'typeorm-extension';\nimport type { BetterSqlite3DataSourceOptions } from 'typeorm/driver/better-sqlite3/BetterSqlite3DataSourceOptions.js';\nimport type { MysqlDataSourceOptions } from 'typeorm/driver/mysql/MysqlDataSourceOptions.js';\nimport type { PostgresDataSourceOptions } from 'typeorm/driver/postgres/PostgresDataSourceOptions.js';\n\nimport { ConfigEnvironmentVariableName } from '../constants.ts';\nimport type { ConfigInput } from '../types.ts';\n\nconst BOOLEAN_TRUE_VALUES = new Set(['true', 't', '1', 'yes', 'y', 'on']);\nconst BOOLEAN_FALSE_VALUES = new Set(['false', 'f', '0', 'no', 'n', 'off']);\n\n/**\n * Boolean env reader that FAILS LOUD on a set-but-unrecognized value instead\n * of silently falling back to the default (envix's `readBool` swallows e.g.\n * `MFA_REQUIRED=yes`). Reserved for security-relevant toggles where a silent\n * default is a weakened posture. Returns `undefined` when the var is unset.\n */\nfunction readBoolStrict(name: ConfigEnvironmentVariableName) : boolean | undefined {\n const raw = read(name);\n if (typeof raw !== 'string' || raw.trim().length === 0) {\n return undefined;\n }\n\n const normalized = raw.trim().toLowerCase();\n if (BOOLEAN_TRUE_VALUES.has(normalized)) {\n return true;\n }\n if (BOOLEAN_FALSE_VALUES.has(normalized)) {\n return false;\n }\n\n throw new Error(`The environment variable ${name} must be a boolean value (received \"${raw}\").`);\n}\n\nexport function readConfigRawFromEnv() : ConfigInput {\n const options : ConfigInput = {};\n\n const env = read(ConfigEnvironmentVariableName.NODE_ENV);\n if (env) {\n options.env = env;\n }\n\n const writableDirectoryPath = read(ConfigEnvironmentVariableName.WRITABLE_DIRECTORY_PATH);\n if (writableDirectoryPath) {\n options.writableDirectoryPath = writableDirectoryPath;\n }\n\n // -------------------------------------------------------------\n\n if (hasEnvDataSourceOptions()) {\n // todo: type casting should be avoided\n options.db = readDataSourceOptionsFromEnv() as MysqlDataSourceOptions |\n PostgresDataSourceOptions |\n BetterSqlite3DataSourceOptions;\n }\n\n const redis = oneOf([\n readBool(ConfigEnvironmentVariableName.REDIS),\n read(ConfigEnvironmentVariableName.REDIS),\n ]);\n if (typeof redis !== 'undefined') {\n options.redis = redis;\n }\n\n const smtp = oneOf([\n readBool(ConfigEnvironmentVariableName.SMTP),\n read(ConfigEnvironmentVariableName.SMTP),\n ]);\n if (typeof smtp !== 'undefined') {\n options.smtp = smtp;\n }\n\n // -------------------------------------------------------------\n\n const host = read(ConfigEnvironmentVariableName.HOST);\n if (host) {\n options.host = host;\n }\n\n const port = readInt(ConfigEnvironmentVariableName.PORT);\n if (typeof port !== 'undefined') {\n options.port = port;\n }\n\n const publicURL = read(ConfigEnvironmentVariableName.PUBLIC_URL);\n if (publicURL) {\n options.publicUrl = publicURL;\n }\n\n const mtlsPublicURL = read(ConfigEnvironmentVariableName.MTLS_PUBLIC_URL);\n if (mtlsPublicURL) {\n options.mtlsPublicUrl = mtlsPublicURL;\n }\n\n const certificateSource = read(ConfigEnvironmentVariableName.CERTIFICATE_SOURCE);\n if (certificateSource) {\n options.certificateSource = certificateSource as ConfigInput['certificateSource'];\n }\n\n // canonicalized again in normalizeConfig for every config surface; the\n // env read keeps the raw string, the shared canonicalizer decides.\n const trustProxy = read(ConfigEnvironmentVariableName.TRUST_PROXY);\n if (typeof trustProxy === 'string' && trustProxy.trim().length > 0) {\n options.trustProxy = trustProxy;\n }\n\n const trustedOrigins = readArray(ConfigEnvironmentVariableName.TRUSTED_ORIGINS);\n if (trustedOrigins && trustedOrigins.length > 0) {\n options.trustedOrigins = trustedOrigins;\n }\n\n const tokenAccessMaxAge = readInt(ConfigEnvironmentVariableName.TOKEN_ACCESS_MAX_AGE);\n if (typeof tokenAccessMaxAge !== 'undefined') {\n options.tokenAccessMaxAge = tokenAccessMaxAge;\n }\n\n const tokenRefreshMaxAge = readInt(ConfigEnvironmentVariableName.TOKEN_REFRESH_MAX_AGE);\n if (typeof tokenRefreshMaxAge !== 'undefined') {\n options.tokenRefreshMaxAge = tokenRefreshMaxAge;\n }\n\n const tokenRefreshGracePeriod = readInt(ConfigEnvironmentVariableName.TOKEN_REFRESH_GRACE_PERIOD);\n if (typeof tokenRefreshGracePeriod !== 'undefined') {\n options.tokenRefreshGracePeriod = tokenRefreshGracePeriod;\n }\n\n const promptLoginMaxAge = readInt(ConfigEnvironmentVariableName.PROMPT_LOGIN_MAX_AGE);\n if (typeof promptLoginMaxAge !== 'undefined') {\n options.promptLoginMaxAge = promptLoginMaxAge;\n }\n\n const endSessionHintGracePeriod = readInt(ConfigEnvironmentVariableName.END_SESSION_HINT_GRACE_PERIOD);\n if (typeof endSessionHintGracePeriod !== 'undefined') {\n options.endSessionHintGracePeriod = endSessionHintGracePeriod;\n }\n\n const registrationEnabled = readBool(ConfigEnvironmentVariableName.REGISTRATION_ENABLED);\n if (typeof registrationEnabled !== 'undefined') {\n options.registrationEnabled = registrationEnabled;\n }\n\n const emailVerificationEnabled = readBool(ConfigEnvironmentVariableName.EMAIL_VERIFICATION_ENABLED);\n if (typeof emailVerificationEnabled !== 'undefined') {\n options.emailVerificationEnabled = emailVerificationEnabled;\n }\n\n const passwordRecoveryEnabled = readBool(ConfigEnvironmentVariableName.PASSWORD_RECOVERY_ENABLED);\n if (typeof passwordRecoveryEnabled !== 'undefined') {\n options.passwordRecoveryEnabled = passwordRecoveryEnabled;\n }\n\n const passwordMinLength = readInt(ConfigEnvironmentVariableName.PASSWORD_MIN_LENGTH);\n if (typeof passwordMinLength !== 'undefined') {\n options.passwordMinLength = passwordMinLength;\n }\n\n // ---------------------------------------------------------------\n\n const eventLogEnabled = readBoolStrict(ConfigEnvironmentVariableName.EVENT_LOG_ENABLED);\n if (typeof eventLogEnabled !== 'undefined') {\n options.eventLogEnabled = eventLogEnabled;\n }\n\n const eventLogRetentionDays = readInt(ConfigEnvironmentVariableName.EVENT_LOG_RETENTION_DAYS);\n if (typeof eventLogRetentionDays !== 'undefined') {\n options.eventLogRetentionDays = eventLogRetentionDays;\n }\n\n const eventLogEntityEnabled = readBoolStrict(ConfigEnvironmentVariableName.EVENT_LOG_ENTITY_ENABLED);\n if (typeof eventLogEntityEnabled !== 'undefined') {\n options.eventLogEntityEnabled = eventLogEntityEnabled;\n }\n\n const eventLogEntityRetentionDays = readInt(ConfigEnvironmentVariableName.EVENT_LOG_ENTITY_RETENTION_DAYS);\n if (typeof eventLogEntityRetentionDays !== 'undefined') {\n options.eventLogEntityRetentionDays = eventLogEntityRetentionDays;\n }\n\n const loginAttemptThrottleEnabled = readBoolStrict(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_THROTTLE_ENABLED);\n if (typeof loginAttemptThrottleEnabled !== 'undefined') {\n options.loginAttemptThrottleEnabled = loginAttemptThrottleEnabled;\n }\n\n const loginAttemptThreshold = readInt(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_THRESHOLD);\n if (typeof loginAttemptThreshold !== 'undefined') {\n options.loginAttemptThreshold = loginAttemptThreshold;\n }\n\n const loginAttemptWindow = readInt(ConfigEnvironmentVariableName.LOGIN_ATTEMPT_WINDOW);\n if (typeof loginAttemptWindow !== 'undefined') {\n options.loginAttemptWindow = loginAttemptWindow;\n }\n\n // ---------------------------------------------------------------\n\n const mfaEnabled = readBoolStrict(ConfigEnvironmentVariableName.MFA_ENABLED);\n if (typeof mfaEnabled !== 'undefined') {\n options.mfaEnabled = mfaEnabled;\n }\n\n const mfaRequired = readBoolStrict(ConfigEnvironmentVariableName.MFA_REQUIRED);\n if (typeof mfaRequired !== 'undefined') {\n options.mfaRequired = mfaRequired;\n }\n\n const mfaFreshnessMaxAge = readInt(ConfigEnvironmentVariableName.MFA_FRESHNESS_MAX_AGE);\n if (typeof mfaFreshnessMaxAge !== 'undefined') {\n options.mfaFreshnessMaxAge = mfaFreshnessMaxAge;\n }\n\n const mfaTicketMaxAge = readInt(ConfigEnvironmentVariableName.MFA_TICKET_MAX_AGE);\n if (typeof mfaTicketMaxAge !== 'undefined') {\n options.mfaTicketMaxAge = mfaTicketMaxAge;\n }\n\n const secretsEncryptionKey = read(ConfigEnvironmentVariableName.SECRETS_ENCRYPTION_KEY);\n if (secretsEncryptionKey) {\n options.secretsEncryptionKey = secretsEncryptionKey;\n }\n\n // ---------------------------------------------------------------\n\n const clientBasicAuth = readBool(ConfigEnvironmentVariableName.CLIENT_AUTH_BASIC);\n if (typeof clientBasicAuth !== 'undefined') {\n options.clientAuthBasic = clientBasicAuth;\n }\n\n const clientSystemEnabled = readBool(ConfigEnvironmentVariableName.CLIENT_SYSTEM_ENABLED);\n if (typeof clientSystemEnabled !== 'undefined') {\n options.clientSystemEnabled = clientSystemEnabled;\n }\n\n const clientAdminSecret = read(ConfigEnvironmentVariableName.CLIENT_SYSTEM_SECRET);\n if (clientAdminSecret) {\n options.clientSystemSecret = clientAdminSecret;\n }\n\n const clientAdminSecretReset = readBool(ConfigEnvironmentVariableName.CLIENT_SYSTEM_SECRET_RESET);\n if (typeof clientAdminSecretReset !== 'undefined') {\n options.clientSystemSecretReset = clientAdminSecretReset;\n }\n\n // ---------------------------------------------------------------\n\n const userBasicAuth = readBool(ConfigEnvironmentVariableName.USER_AUTH_BASIC);\n if (typeof userBasicAuth !== 'undefined') {\n options.userAuthBasic = userBasicAuth;\n }\n\n const userAdminEnabled = readBool(ConfigEnvironmentVariableName.USER_ADMIN_ENABLED);\n if (typeof userAdminEnabled !== 'undefined') {\n options.userAdminEnabled = userAdminEnabled;\n }\n\n const userAdminPassword = read(ConfigEnvironmentVariableName.USER_ADMIN_PASSWORD);\n if (userAdminPassword) {\n options.userAdminPassword = userAdminPassword;\n }\n\n const userAdminPasswordReset = readBool(ConfigEnvironmentVariableName.USER_ADMIN_PASSWORD_RESET);\n if (typeof userAdminPasswordReset !== 'undefined') {\n options.userAdminPasswordReset = userAdminPasswordReset;\n }\n\n // ---------------------------------------------------------------\n\n const permissions = readArray(ConfigEnvironmentVariableName.PERMISSIONS);\n if (permissions && permissions.length > 0) {\n options.permissions = permissions;\n }\n\n const permissionsDefaultPolicyAssignment = readBool(ConfigEnvironmentVariableName.PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT);\n if (typeof permissionsDefaultPolicyAssignment !== 'undefined') {\n options.permissionsDefaultPolicyAssignment = permissionsDefaultPolicyAssignment;\n }\n\n return options;\n}\n"],"mappings":";;;;;;;AAsBA,MAAMQ,sCAAsB,IAAIC,IAAI;CAAC;CAAQ;CAAK;CAAK;CAAO;CAAK;AAAK,CAAA;AACxE,MAAMC,uCAAuB,IAAID,IAAI;CAAC;CAAS;CAAK;CAAK;CAAM;CAAK;AAAM,CAAA;;;;;;GAQ1E,SAASE,eAAeC,MAAmC;CACvD,MAAMC,MAAMZ,KAAKW,IAAAA;CACjB,IAAI,OAAOC,QAAQ,YAAYA,IAAIC,KAAI,CAAA,CAAGC,WAAW,GACjD;CAGJ,MAAME,aAAaJ,IAAIC,KAAI,CAAA,CAAGI,YAAW;CACzC,IAAIV,oBAAoBW,IAAIF,UAAAA,GACxB,OAAO;CAEX,IAAIP,qBAAqBS,IAAIF,UAAAA,GACzB,OAAO;CAGX,MAAM,IAAIG,MAAM,4BAA4BR,KAAK,sCAAsCC,IAAI,IAAI;AACnG;AAEA,SAAgBQ,uBAAAA;CACZ,MAAMC,UAAwB,CAAC;CAE/B,MAAMC,MAAMtB,KAAKM,8BAA8BiB,QAAQ;CACvD,IAAID,KACAD,QAAQC,MAAMA;CAGlB,MAAME,wBAAwBxB,KAAKM,8BAA8BmB,uBAAuB;CACxF,IAAID,uBACAH,QAAQG,wBAAwBA;CAKpC,IAAIpB,wBAAAA,GAEAiB,QAAQK,KAAKrB,6BAAAA;CAKjB,MAAMsB,QAAQ5B,MAAM,CAChBG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CAClF,IAAI,OAAOD,qBAAqB,aAC5BlF,QAAQkF,mBAAmBA;CAG/B,MAAME,oBAAoBzG,KAAKM,8BAA8BoG,mBAAmB;CAChF,IAAID,mBACApF,QAAQoF,oBAAoBA;CAGhC,MAAME,yBAAyBzG,SAASI,8BAA8BsG,yBAAyB;CAC/F,IAAI,OAAOD,2BAA2B,aAClCtF,QAAQsF,yBAAyBA;CAKrC,MAAME,cAAc5G,UAAUK,8BAA8BwG,WAAW;CACvE,IAAID,eAAeA,YAAY/F,SAAS,GACpCO,QAAQwF,cAAcA;CAG1B,MAAME,qCAAqC7G,SAASI,8BAA8B0G,qCAAqC;CACvH,IAAI,OAAOD,uCAAuC,aAC9C1F,QAAQ0F,qCAAqCA;CAGjD,OAAO1F;AACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/config/read/fs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,mBAAwB,kDA0C1E"}
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/config/read/fs.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAiCtD,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,mBAAwB,kDA6C1E"}
@@ -1,29 +1,52 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- import { Container } from "confinity";
4
+ import { isObject, merge } from "smob";
5
+ import { FSStore } from "confinity";
5
6
  //#region src/app/modules/config/read/fs.ts
7
+ /**
8
+ * Resolve one infrastructure section (`db`, `redis`, `smtp`), which may be
9
+ * declared at the top level (shared), under `server.*` or under `server.core.*`.
10
+ *
11
+ * Keys are ordered **least specific first**. Two objects are merged, so a
12
+ * shared base survives while the more specific declaration wins per key; a
13
+ * scalar (a `redis://…` connection string, say) replaces whatever preceded it.
14
+ * That is what "the most specific declaration wins" means for a section the
15
+ * documentation explicitly describes as shared — `db.type` set once at the top
16
+ * level still applies when only `db.database` is overridden per component.
17
+ *
18
+ * confinity v1 applied exactly this precedence inside `get([...keys])`; v2
19
+ * removed the array form, so it is spelled out here instead.
20
+ */ function readSection(store, keys) {
21
+ let output;
22
+ for (const key of keys) {
23
+ const value = store.getSync(key);
24
+ if (typeof value === "undefined") continue;
25
+ output = isObject(value) && isObject(output) ? merge(value, output) : value;
26
+ }
27
+ return output;
28
+ }
6
29
  async function readConfigRawFromFS(options = {}) {
7
- const container = new Container({
30
+ const store = new FSStore({
8
31
  prefix: "authup",
9
32
  cwd: options.cwd
10
33
  });
11
- if (options.file) await container.loadFile(options.file);
12
- else await container.load();
13
- const raw = container.get("server.core") || {};
14
- const db = container.get([
34
+ if (options.file) await store.loadFile(options.file);
35
+ else await store.load();
36
+ const raw = store.getSync("server.core") || {};
37
+ const db = readSection(store, [
15
38
  "db",
16
39
  "server.db",
17
40
  "server.core.db"
18
41
  ]);
19
42
  if (db) raw.db = db;
20
- const redis = container.get([
43
+ const redis = readSection(store, [
21
44
  "redis",
22
45
  "server.redis",
23
46
  "server.core.redis"
24
47
  ]);
25
48
  if (redis) raw.redis = redis;
26
- const smtp = container.get([
49
+ const smtp = readSection(store, [
27
50
  "smtp",
28
51
  "server.smtp",
29
52
  "server.core.smtp"
@@ -1 +1 @@
1
- {"version":3,"file":"fs.mjs","names":["Container","readConfigRawFromFS","options","container","prefix","cwd","file","loadFile","load","raw","get","db","redis","smtp"],"sources":["../../../../../src/app/modules/config/read/fs.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { Container } from 'confinity';\nimport type { ConfigInput } from '../types.ts';\nimport type { ConfigReadFsOptions } from './types.ts';\n\nexport async function readConfigRawFromFS(options: ConfigReadFsOptions = {}) {\n const container = new Container({\n prefix: 'authup',\n cwd: options.cwd,\n });\n\n if (options.file) {\n await container.loadFile(options.file);\n } else {\n await container.load();\n }\n\n const raw : ConfigInput = container.get('server.core') || {};\n\n const db = container.get([\n 'db',\n 'server.db',\n 'server.core.db',\n ]);\n if (db) {\n raw.db = db;\n }\n\n const redis = container.get([\n 'redis',\n 'server.redis',\n 'server.core.redis',\n ]);\n if (redis) {\n raw.redis = redis;\n }\n\n const smtp = container.get([\n 'smtp',\n 'server.smtp',\n 'server.core.smtp',\n ]);\n if (smtp) {\n raw.smtp = smtp;\n }\n\n return raw;\n}\n"],"mappings":";;;;;AAWA,eAAsBC,oBAAoBC,UAA+B,CAAC,GAAC;CACvE,MAAMC,YAAY,IAAIH,UAAU;EAC5BI,QAAQ;EACRC,KAAKH,QAAQG;CACjB,CAAA;CAEA,IAAIH,QAAQI,MACR,MAAMH,UAAUI,SAASL,QAAQI,IAAI;MAErC,MAAMH,UAAUK,KAAI;CAGxB,MAAMC,MAAoBN,UAAUO,IAAI,aAAA,KAAkB,CAAC;CAE3D,MAAMC,KAAKR,UAAUO,IAAI;EACrB;EACA;EACA;CACH,CAAA;CACD,IAAIC,IACAF,IAAIE,KAAKA;CAGb,MAAMC,QAAQT,UAAUO,IAAI;EACxB;EACA;EACA;CACH,CAAA;CACD,IAAIE,OACAH,IAAIG,QAAQA;CAGhB,MAAMC,OAAOV,UAAUO,IAAI;EACvB;EACA;EACA;CACH,CAAA;CACD,IAAIG,MACAJ,IAAII,OAAOA;CAGf,OAAOJ;AACX"}
1
+ {"version":3,"file":"fs.mjs","names":["FSStore","isObject","merge","readSection","store","keys","output","key","value","getSync","readConfigRawFromFS","options","prefix","cwd","file","loadFile","load","raw","db","redis","smtp"],"sources":["../../../../../src/app/modules/config/read/fs.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { FSStore } from 'confinity';\nimport { isObject, merge } from 'smob';\nimport type { ConfigInput } from '../types.ts';\nimport type { ConfigReadFsOptions } from './types.ts';\n\n/**\n * Resolve one infrastructure section (`db`, `redis`, `smtp`), which may be\n * declared at the top level (shared), under `server.*` or under `server.core.*`.\n *\n * Keys are ordered **least specific first**. Two objects are merged, so a\n * shared base survives while the more specific declaration wins per key; a\n * scalar (a `redis://…` connection string, say) replaces whatever preceded it.\n * That is what \"the most specific declaration wins\" means for a section the\n * documentation explicitly describes as shared — `db.type` set once at the top\n * level still applies when only `db.database` is overridden per component.\n *\n * confinity v1 applied exactly this precedence inside `get([...keys])`; v2\n * removed the array form, so it is spelled out here instead.\n */\nfunction readSection<T>(store: FSStore, keys: string[]) : T | undefined {\n let output : unknown;\n\n for (const key of keys) {\n const value = store.getSync(key);\n if (typeof value === 'undefined') {\n continue;\n }\n\n output = isObject(value) && isObject(output) ?\n merge(value, output) :\n value;\n }\n\n return output as T | undefined;\n}\n\nexport async function readConfigRawFromFS(options: ConfigReadFsOptions = {}) {\n const store = new FSStore({\n prefix: 'authup',\n cwd: options.cwd,\n });\n\n if (options.file) {\n await store.loadFile(options.file);\n } else {\n await store.load();\n }\n\n // Read synchronously after the explicit load. `get` is asynchronous in\n // confinity v2, and a missing `await` would hand a Promise to code that\n // only checks whether it received an object.\n const raw : ConfigInput = store.getSync<ConfigInput>('server.core') || {};\n\n const db = readSection<ConfigInput['db']>(store, [\n 'db',\n 'server.db',\n 'server.core.db',\n ]);\n if (db) {\n raw.db = db;\n }\n\n const redis = readSection<ConfigInput['redis']>(store, [\n 'redis',\n 'server.redis',\n 'server.core.redis',\n ]);\n if (redis) {\n raw.redis = redis;\n }\n\n const smtp = readSection<ConfigInput['smtp']>(store, [\n 'smtp',\n 'server.smtp',\n 'server.core.smtp',\n ]);\n if (smtp) {\n raw.smtp = smtp;\n }\n\n return raw;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;GA0BA,SAASG,YAAeC,OAAgBC,MAAc;CAClD,IAAIC;CAEJ,KAAK,MAAMC,OAAOF,MAAM;EACpB,MAAMG,QAAQJ,MAAMK,QAAQF,GAAAA;EAC5B,IAAI,OAAOC,UAAU,aACjB;EAGJF,SAASL,SAASO,KAAAA,KAAUP,SAASK,MAAAA,IACjCJ,MAAMM,OAAOF,MAAAA,IACbE;CACR;CAEA,OAAOF;AACX;AAEA,eAAsBI,oBAAoBC,UAA+B,CAAC,GAAC;CACvE,MAAMP,QAAQ,IAAIJ,QAAQ;EACtBY,QAAQ;EACRC,KAAKF,QAAQE;CACjB,CAAA;CAEA,IAAIF,QAAQG,MACR,MAAMV,MAAMW,SAASJ,QAAQG,IAAI;MAEjC,MAAMV,MAAMY,KAAI;CAMpB,MAAMC,MAAoBb,MAAMK,QAAqB,aAAA,KAAkB,CAAC;CAExE,MAAMS,KAAKf,YAA+BC,OAAO;EAC7C;EACA;EACA;CACH,CAAA;CACD,IAAIc,IACAD,IAAIC,KAAKA;CAGb,MAAMC,QAAQhB,YAAkCC,OAAO;EACnD;EACA;EACA;CACH,CAAA;CACD,IAAIe,OACAF,IAAIE,QAAQA;CAGhB,MAAMC,OAAOjB,YAAiCC,OAAO;EACjD;EACA;EACA;CACH,CAAA;CACD,IAAIgB,MACAH,IAAIG,OAAOA;CAGf,OAAOH;AACX"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Canonicalize a string-form trustProxy value into its semantic type. This
3
+ * MUST run for every config surface (env, .conf, file, programmatic input) —
4
+ * not just env: proxy-addr accepts single-integer "long value" IPv4 notation,
5
+ * so an un-canonicalized `trustProxy: "1"` (e.g. a stringifying configmap)
6
+ * would silently compile to an allowlist of `0.0.0.1` instead of one trusted
7
+ * hop. The integer form wins over the boolean words (`'1'` means ONE hop,
8
+ * never trust-all); anything else lowercases (IPs, CIDRs, and the proxy-addr
9
+ * presets are all case-insensitive semantically, but proxy-addr matches the
10
+ * presets case-sensitively) and passes through as the allowlist form.
11
+ */
12
+ export declare function canonicalizeTrustProxy(raw: string): boolean | number | string;
13
+ /**
14
+ * An entry of the explicit array (allowlist) form must be an address, CIDR,
15
+ * or preset — an integer-string or boolean word there is a mis-typed scalar
16
+ * form and must fail loud instead of compiling to a bogus `0.0.0.1`-style
17
+ * allowlist entry.
18
+ */
19
+ export declare function isValidTrustProxyListEntry(value: string): boolean;
20
+ /**
21
+ * The allowlist form needs the same trim + lowercase the scalar form gets:
22
+ * proxy-addr trims a comma-separated scalar string itself and matches its
23
+ * presets case-sensitively, so without this an array entry that PASSES
24
+ * validation (which compares the canonicalized value) — ` 10.0.0.0/8 ` or
25
+ * `LOOPBACK` — would still throw `invalid IP address` inside `new App`.
26
+ */
27
+ export declare function canonicalizeTrustProxyListEntry(value: string): string;
28
+ //# sourceMappingURL=trust-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust-proxy.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/trust-proxy.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAyB7E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMjE;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErE"}
@@ -0,0 +1,64 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { AuthupError } from "@authup/errors";
5
+ //#region src/app/modules/config/trust-proxy.ts
6
+ const BOOLEAN_TRUE_WORDS = /* @__PURE__ */ new Set([
7
+ "true",
8
+ "t",
9
+ "yes",
10
+ "y",
11
+ "on"
12
+ ]);
13
+ const BOOLEAN_FALSE_WORDS = /* @__PURE__ */ new Set([
14
+ "false",
15
+ "f",
16
+ "no",
17
+ "n",
18
+ "off"
19
+ ]);
20
+ const INTEGER = /^\d+$/;
21
+ /**
22
+ * Canonicalize a string-form trustProxy value into its semantic type. This
23
+ * MUST run for every config surface (env, .conf, file, programmatic input) —
24
+ * not just env: proxy-addr accepts single-integer "long value" IPv4 notation,
25
+ * so an un-canonicalized `trustProxy: "1"` (e.g. a stringifying configmap)
26
+ * would silently compile to an allowlist of `0.0.0.1` instead of one trusted
27
+ * hop. The integer form wins over the boolean words (`'1'` means ONE hop,
28
+ * never trust-all); anything else lowercases (IPs, CIDRs, and the proxy-addr
29
+ * presets are all case-insensitive semantically, but proxy-addr matches the
30
+ * presets case-sensitively) and passes through as the allowlist form.
31
+ */ function canonicalizeTrustProxy(raw) {
32
+ const normalized = raw.trim();
33
+ if (INTEGER.test(normalized)) {
34
+ const hops = Number.parseInt(normalized, 10);
35
+ if (!Number.isSafeInteger(hops)) throw new AuthupError(`The trustProxy hop count "${normalized}" exceeds the safe integer range.`);
36
+ return hops;
37
+ }
38
+ const lowered = normalized.toLowerCase();
39
+ if (BOOLEAN_TRUE_WORDS.has(lowered)) return true;
40
+ if (BOOLEAN_FALSE_WORDS.has(lowered)) return false;
41
+ return lowered;
42
+ }
43
+ /**
44
+ * An entry of the explicit array (allowlist) form must be an address, CIDR,
45
+ * or preset — an integer-string or boolean word there is a mis-typed scalar
46
+ * form and must fail loud instead of compiling to a bogus `0.0.0.1`-style
47
+ * allowlist entry.
48
+ */ function isValidTrustProxyListEntry(value) {
49
+ const normalized = canonicalizeTrustProxyListEntry(value);
50
+ return normalized.length > 0 && !INTEGER.test(normalized) && !BOOLEAN_TRUE_WORDS.has(normalized) && !BOOLEAN_FALSE_WORDS.has(normalized);
51
+ }
52
+ /**
53
+ * The allowlist form needs the same trim + lowercase the scalar form gets:
54
+ * proxy-addr trims a comma-separated scalar string itself and matches its
55
+ * presets case-sensitively, so without this an array entry that PASSES
56
+ * validation (which compares the canonicalized value) — ` 10.0.0.0/8 ` or
57
+ * `LOOPBACK` — would still throw `invalid IP address` inside `new App`.
58
+ */ function canonicalizeTrustProxyListEntry(value) {
59
+ return value.trim().toLowerCase();
60
+ }
61
+ //#endregion
62
+ export { canonicalizeTrustProxy, canonicalizeTrustProxyListEntry, isValidTrustProxyListEntry };
63
+
64
+ //# sourceMappingURL=trust-proxy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust-proxy.mjs","names":["AuthupError","BOOLEAN_TRUE_WORDS","Set","BOOLEAN_FALSE_WORDS","INTEGER","canonicalizeTrustProxy","raw","normalized","trim","test","hops","Number","parseInt","isSafeInteger","lowered","toLowerCase","has","isValidTrustProxyListEntry","value","canonicalizeTrustProxyListEntry","length"],"sources":["../../../../src/app/modules/config/trust-proxy.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { AuthupError } from '@authup/errors';\n\nconst BOOLEAN_TRUE_WORDS = new Set(['true', 't', 'yes', 'y', 'on']);\nconst BOOLEAN_FALSE_WORDS = new Set(['false', 'f', 'no', 'n', 'off']);\n\nconst INTEGER = /^\\d+$/;\n\n/**\n * Canonicalize a string-form trustProxy value into its semantic type. This\n * MUST run for every config surface (env, .conf, file, programmatic input) —\n * not just env: proxy-addr accepts single-integer \"long value\" IPv4 notation,\n * so an un-canonicalized `trustProxy: \"1\"` (e.g. a stringifying configmap)\n * would silently compile to an allowlist of `0.0.0.1` instead of one trusted\n * hop. The integer form wins over the boolean words (`'1'` means ONE hop,\n * never trust-all); anything else lowercases (IPs, CIDRs, and the proxy-addr\n * presets are all case-insensitive semantically, but proxy-addr matches the\n * presets case-sensitively) and passes through as the allowlist form.\n */\nexport function canonicalizeTrustProxy(raw: string): boolean | number | string {\n const normalized = raw.trim();\n if (INTEGER.test(normalized)) {\n const hops = Number.parseInt(normalized, 10);\n // The typed surface rejects an out-of-range hop count (zod's int() is\n // safe-integer bounded), so the string surface must not smuggle one\n // past it — canonicalization runs AFTER validation, and parseInt\n // saturates a huge digit string into an unsafe integer / Infinity,\n // which routup reads as \"trust every hop\".\n if (!Number.isSafeInteger(hops)) {\n throw new AuthupError(`The trustProxy hop count \"${normalized}\" exceeds the safe integer range.`);\n }\n\n return hops;\n }\n\n const lowered = normalized.toLowerCase();\n if (BOOLEAN_TRUE_WORDS.has(lowered)) {\n return true;\n }\n if (BOOLEAN_FALSE_WORDS.has(lowered)) {\n return false;\n }\n\n return lowered;\n}\n\n/**\n * An entry of the explicit array (allowlist) form must be an address, CIDR,\n * or preset — an integer-string or boolean word there is a mis-typed scalar\n * form and must fail loud instead of compiling to a bogus `0.0.0.1`-style\n * allowlist entry.\n */\nexport function isValidTrustProxyListEntry(value: string): boolean {\n const normalized = canonicalizeTrustProxyListEntry(value);\n return normalized.length > 0 &&\n !INTEGER.test(normalized) &&\n !BOOLEAN_TRUE_WORDS.has(normalized) &&\n !BOOLEAN_FALSE_WORDS.has(normalized);\n}\n\n/**\n * The allowlist form needs the same trim + lowercase the scalar form gets:\n * proxy-addr trims a comma-separated scalar string itself and matches its\n * presets case-sensitively, so without this an array entry that PASSES\n * validation (which compares the canonicalized value) — ` 10.0.0.0/8 ` or\n * `LOOPBACK` — would still throw `invalid IP address` inside `new App`.\n */\nexport function canonicalizeTrustProxyListEntry(value: string): string {\n return value.trim().toLowerCase();\n}\n"],"mappings":";;;;;AASA,MAAMC,qCAAqB,IAAIC,IAAI;CAAC;CAAQ;CAAK;CAAO;CAAK;AAAK,CAAA;AAClE,MAAMC,sCAAsB,IAAID,IAAI;CAAC;CAAS;CAAK;CAAM;CAAK;AAAM,CAAA;AAEpE,MAAME,UAAU;;;;;;;;;;;GAahB,SAAgBC,uBAAuBC,KAAW;CAC9C,MAAMC,aAAaD,IAAIE,KAAI;CAC3B,IAAIJ,QAAQK,KAAKF,UAAAA,GAAa;EAC1B,MAAMG,OAAOC,OAAOC,SAASL,YAAY,EAAA;EAMzC,IAAI,CAACI,OAAOE,cAAcH,IAAAA,GACtB,MAAM,IAAIV,YAAY,6BAA6BO,WAAW,kCAAkC;EAGpG,OAAOG;CACX;CAEA,MAAMI,UAAUP,WAAWQ,YAAW;CACtC,IAAId,mBAAmBe,IAAIF,OAAAA,GACvB,OAAO;CAEX,IAAIX,oBAAoBa,IAAIF,OAAAA,GACxB,OAAO;CAGX,OAAOA;AACX;;;;;;GAQA,SAAgBG,2BAA2BC,OAAa;CACpD,MAAMX,aAAaY,gCAAgCD,KAAAA;CACnD,OAAOX,WAAWa,SAAS,KACvB,CAAChB,QAAQK,KAAKF,UAAAA,KACd,CAACN,mBAAmBe,IAAIT,UAAAA,KACxB,CAACJ,oBAAoBa,IAAIT,UAAAA;AACjC;;;;;;;GASA,SAAgBY,gCAAgCD,OAAa;CACzD,OAAOA,MAAMV,KAAI,CAAA,CAAGO,YAAW;AACnC"}
@@ -71,6 +71,24 @@ export type Config = {
71
71
  * default: disabled
72
72
  */
73
73
  certificateSource: CertificateSource;
74
+ /**
75
+ * Which upstream proxies to trust when deriving the client IP from
76
+ * `X-Forwarded-For` (routup's `TrustProxyInput` minus the function
77
+ * form): `true` trusts every hop, `false` trusts none (the socket
78
+ * peer address is used), a number trusts that many hops, and a
79
+ * string / string[] is a proxy-addr allowlist (IPs, CIDRs, or the
80
+ * presets `loopback`, `linklocal`, `uniquelocal`; a comma-separated
81
+ * string splits into a list).
82
+ *
83
+ * SECURITY: with `true`, any DIRECT client can spoof its IP via the
84
+ * `X-Forwarded-For` header — login-throttle keys, audit-event rows,
85
+ * and the session inventory all record the forged value. Pin the
86
+ * actual proxy (`1`, `loopback`, or its address/CIDR) when the
87
+ * listener is reachable without a proxy or exact attribution
88
+ * matters.
89
+ * default: true
90
+ */
91
+ trustProxy: boolean | number | string | string[];
74
92
  /**
75
93
  * Trusted first-party app origins (besides publicUrl) — used as
76
94
  * redirect targets for the per-realm public `web` client. Does NOT
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,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MAAM,CAAC;cAC/B,UAAU;CA2GhC"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/validator.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,qBAAa,eAAgB,SAAQ,SAAS,CAAC,MAAM,CAAC;cAC/B,UAAU;CAyHhC"}
@@ -2,6 +2,7 @@ import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
4
  import { expandToOrigins } from "./origins.mjs";
5
+ import { isValidTrustProxyListEntry } from "./trust-proxy.mjs";
5
6
  import { CERTIFICATE_SOURCES } from "../../../adapters/http/request/constants.mjs";
6
7
  import "../../../adapters/http/request/index.mjs";
7
8
  import { isObject } from "@authup/kit";
@@ -32,6 +33,12 @@ var ConfigValidator = class extends Container {
32
33
  publicUrl: createValidator(z.url()),
33
34
  mtlsPublicUrl: createValidator(z.url().nullable()),
34
35
  certificateSource: createValidator(z.enum(CERTIFICATE_SOURCES)),
36
+ trustProxy: createValidator(z.union([
37
+ z.boolean(),
38
+ z.number().int().nonnegative(),
39
+ z.string(),
40
+ z.array(z.string().refine(isValidTrustProxyListEntry, "must be an IP, CIDR, or proxy-addr preset"))
41
+ ])),
35
42
  trustedOrigins: createValidator(z.array(z.string().refine((value) => {
36
43
  try {
37
44
  expandToOrigins(value);
@@ -1 +1 @@
1
- {"version":3,"file":"validator.mjs","names":["USER_PASSWORD_MAX_LENGTH","isObject","createValidator","Container","z","expandToOrigins","CERTIFICATE_SOURCES","ConfigValidator","initialize","stringValidator","string","booleanValidator","boolean","nonNegativeNumberValidator","number","nonnegative","secretValidator","min","max","middlewareValidator","or","record","any","serviceValidator","custom","value","validators","env","rootPath","writableDirectoryPath","logger","db","redis","smtp","port","host","publicUrl","url","mtlsPublicUrl","nullable","certificateSource","enum","trustedOrigins","array","refine","middlewareBody","middlewareCors","middlewareCookie","middlewareQuery","middlewarePrometheus","middlewareRateLimit","middlewareSwagger","tokenAccessMaxAge","tokenRefreshMaxAge","tokenRefreshGracePeriod","promptLoginMaxAge","endSessionHintGracePeriod","registrationEnabled","emailVerificationEnabled","passwordRecoveryEnabled","passwordMinLength","int","positive","eventLogEnabled","eventLogRetentionDays","eventLogEntityEnabled","eventLogEntityRetentionDays","loginAttemptThrottleEnabled","loginAttemptThreshold","loginAttemptWindow","secretsEncryptionKey","union","literal","base64","mfaEnabled","mfaRequired","mfaFreshnessMaxAge","mfaTicketMaxAge","clientAuthBasic","clientSystemEnabled","clientSystemSecret","clientSystemSecretReset","userAuthBasic","userAdminEnabled","userAdminPassword","userAdminPasswordReset","permissions","permissionsDefaultPolicyAssignment","keys","Object","key","mount","optional"],"sources":["../../../../src/app/modules/config/validator.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { USER_PASSWORD_MAX_LENGTH } from '@authup/core-kit';\nimport { isObject } from '@authup/kit';\nimport { createValidator } from '@validup/zod';\nimport type { BetterSqlite3DataSourceOptions } from 'typeorm/driver/better-sqlite3/BetterSqlite3DataSourceOptions.js';\nimport type { MysqlDataSourceOptions } from 'typeorm/driver/mysql/MysqlDataSourceOptions.js';\nimport type { PostgresDataSourceOptions } from 'typeorm/driver/postgres/PostgresDataSourceOptions.js';\nimport type { ValidatorDescriptor } from 'validup';\nimport { Container } from 'validup';\nimport { z } from 'zod';\nimport { expandToOrigins } from './origins.ts';\nimport type { Config } from './types.ts';\nimport { CERTIFICATE_SOURCES } from '../../../adapters/http/request/index.ts';\n\nexport class ConfigValidator extends Container<Config> {\n protected override initialize() {\n super.initialize();\n\n const stringValidator = createValidator(z.string());\n const booleanValidator = createValidator(z.boolean());\n const nonNegativeNumberValidator = createValidator(z.number().nonnegative());\n const secretValidator = createValidator(z.string().min(3).max(256));\n const middlewareValidator = createValidator(\n z.boolean().or(z.record(z.string(), z.any())),\n );\n const serviceValidator = createValidator(\n z.string()\n .or(z.boolean())\n .or(z.custom<Record<string, any>>((value) => isObject(value))),\n );\n\n // Record<keyof Config, ...> is the compile-time exhaustiveness\n // guard: a Config key without a validator here fails the build\n // instead of being silently stripped by run().\n const validators: Record<keyof Config, ValidatorDescriptor> = {\n env: stringValidator,\n rootPath: stringValidator,\n writableDirectoryPath: stringValidator,\n\n logger: booleanValidator,\n db: createValidator(\n z.custom<MysqlDataSourceOptions | PostgresDataSourceOptions | BetterSqlite3DataSourceOptions>(\n (value) => isObject(value),\n ),\n ),\n redis: serviceValidator,\n smtp: serviceValidator,\n\n port: nonNegativeNumberValidator,\n host: stringValidator,\n publicUrl: createValidator(z.url()),\n mtlsPublicUrl: createValidator(z.url().nullable()),\n certificateSource: createValidator(z.enum(CERTIFICATE_SOURCES)),\n trustedOrigins: createValidator(\n z.array(z.string().refine((value) => {\n try {\n expandToOrigins(value);\n return true;\n } catch {\n return false;\n }\n }, 'must be a http(s) origin or a bare host[:port]')),\n ),\n\n middlewareBody: middlewareValidator,\n middlewareCors: middlewareValidator,\n middlewareCookie: middlewareValidator,\n middlewareQuery: middlewareValidator,\n middlewarePrometheus: middlewareValidator,\n middlewareRateLimit: middlewareValidator,\n middlewareSwagger: booleanValidator,\n\n tokenAccessMaxAge: nonNegativeNumberValidator,\n tokenRefreshMaxAge: nonNegativeNumberValidator,\n tokenRefreshGracePeriod: nonNegativeNumberValidator,\n promptLoginMaxAge: nonNegativeNumberValidator,\n endSessionHintGracePeriod: nonNegativeNumberValidator,\n registrationEnabled: booleanValidator,\n emailVerificationEnabled: booleanValidator,\n passwordRecoveryEnabled: booleanValidator,\n passwordMinLength: createValidator(\n z.number().int().positive().max(USER_PASSWORD_MAX_LENGTH),\n ),\n\n eventLogEnabled: booleanValidator,\n eventLogRetentionDays: nonNegativeNumberValidator,\n eventLogEntityEnabled: booleanValidator,\n eventLogEntityRetentionDays: nonNegativeNumberValidator,\n loginAttemptThrottleEnabled: booleanValidator,\n loginAttemptThreshold: createValidator(z.number().int().positive()),\n loginAttemptWindow: createValidator(z.number().int().positive()),\n\n // '' = unset; otherwise a base64 string (normalizeConfig enforces\n // the decoded 32-byte length at boot).\n secretsEncryptionKey: createValidator(z.union([z.literal(''), z.base64()])),\n\n mfaEnabled: booleanValidator,\n mfaRequired: booleanValidator,\n mfaFreshnessMaxAge: nonNegativeNumberValidator,\n mfaTicketMaxAge: createValidator(z.number().int().positive()),\n\n clientAuthBasic: booleanValidator,\n clientSystemEnabled: booleanValidator,\n clientSystemSecret: secretValidator,\n clientSystemSecretReset: booleanValidator,\n\n userAuthBasic: booleanValidator,\n userAdminEnabled: booleanValidator,\n userAdminPassword: secretValidator,\n userAdminPasswordReset: booleanValidator,\n\n permissions: createValidator(\n z.string().or(z.array(z.string())),\n ),\n permissionsDefaultPolicyAssignment: booleanValidator,\n };\n\n const keys = Object.keys(validators) as (keyof Config)[];\n for (const key of keys) {\n this.mount(key, { optional: true }, validators[key]);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAaO,kBAAb,cAAqCJ,UAAAA;CACdK,aAAa;EAC5B,MAAMA,WAAAA;EAEN,MAAMC,kBAAkBP,gBAAgBE,EAAEM,OAAM,CAAA;EAChD,MAAMC,mBAAmBT,gBAAgBE,EAAEQ,QAAO,CAAA;EAClD,MAAMC,6BAA6BX,gBAAgBE,EAAEU,OAAM,CAAA,CAAGC,YAAW,CAAA;EACzE,MAAMC,kBAAkBd,gBAAgBE,EAAEM,OAAM,CAAA,CAAGO,IAAI,CAAA,CAAA,CAAGC,IAAI,GAAA,CAAA;EAC9D,MAAMC,sBAAsBjB,gBACxBE,EAAEQ,QAAO,CAAA,CAAGQ,GAAGhB,EAAEiB,OAAOjB,EAAEM,OAAM,GAAIN,EAAEkB,IAAG,CAAA,CAAA,CAAA;EAE7C,MAAMC,mBAAmBrB,gBACrBE,EAAEM,OAAM,CAAA,CACHU,GAAGhB,EA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AAEU,OAAM,CAAA,CAAG+C,IAAG,CAAA,CAAGC,SAAQ,CAAA;GAChEO,oBAAoBnE,gBAAgBE,EAAEU,OAAM,CAAA,CAAG+C,IAAG,CAAA,CAAGC,SAAQ,CAAA;GAI7DQ,sBAAsBpE,gBAAgBE,EAAEmE,MAAM,CAACnE,EAAEoE,QAAQ,EAAA,GAAKpE,EAAEqE,OAAM,CAAG,CAAA,CAAA;GAEzEC,YAAY/D;GACZgE,aAAahE;GACbiE,oBAAoB/D;GACpBgE,iBAAiB3E,gBAAgBE,EAAEU,OAAM,CAAA,CAAG+C,IAAG,CAAA,CAAGC,SAAQ,CAAA;GAE1DgB,iBAAiBnE;GACjBoE,qBAAqBpE;GACrBqE,oBAAoBhE;GACpBiE,yBAAyBtE;GAEzBuE,eAAevE;GACfwE,kBAAkBxE;GAClByE,mBAAmBpE;GACnBqE,wBAAwB1E;GAExB2E,aAAapF,gBACTE,EAAEM,OAAM,CAAA,CAAGU,GAAGhB,EAAEuC,MAAMvC,EAAEM,OAAM,CAAA,CAAA,CAAA;GAElC6E,oCAAoC5E;EACxC;EAEA,MAAM6E,OAAOC,OAAOD,KAAK9D,UAAAA;EACzB,KAAK,MAAMgE,OAAOF,MACd,KAAKG,MAAMD,KAAK,EAAEE,UAAU,KAAK,GAAGlE,WAAWgE,IAAI;CAE3D;AACJ"}
1
+ {"version":3,"file":"validator.mjs","names":["USER_PASSWORD_MAX_LENGTH","isObject","createValidator","Container","z","expandToOrigins","isValidTrustProxyListEntry","CERTIFICATE_SOURCES","ConfigValidator","initialize","stringValidator","string","booleanValidator","boolean","nonNegativeNumberValidator","number","nonnegative","secretValidator","min","max","middlewareValidator","or","record","any","serviceValidator","custom","value","validators","env","rootPath","writableDirectoryPath","logger","db","redis","smtp","port","host","publicUrl","url","mtlsPublicUrl","nullable","certificateSource","enum","trustProxy","union","int","array","refine","trustedOrigins","middlewareBody","middlewareCors","middlewareCookie","middlewareQuery","middlewarePrometheus","middlewareRateLimit","middlewareSwagger","tokenAccessMaxAge","tokenRefreshMaxAge","tokenRefreshGracePeriod","promptLoginMaxAge","endSessionHintGracePeriod","registrationEnabled","emailVerificationEnabled","passwordRecoveryEnabled","passwordMinLength","positive","eventLogEnabled","eventLogRetentionDays","eventLogEntityEnabled","eventLogEntityRetentionDays","loginAttemptThrottleEnabled","loginAttemptThreshold","loginAttemptWindow","secretsEncryptionKey","literal","base64","mfaEnabled","mfaRequired","mfaFreshnessMaxAge","mfaTicketMaxAge","clientAuthBasic","clientSystemEnabled","clientSystemSecret","clientSystemSecretReset","userAuthBasic","userAdminEnabled","userAdminPassword","userAdminPasswordReset","permissions","permissionsDefaultPolicyAssignment","keys","Object","key","mount","optional"],"sources":["../../../../src/app/modules/config/validator.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { USER_PASSWORD_MAX_LENGTH } from '@authup/core-kit';\nimport { isObject } from '@authup/kit';\nimport { createValidator } from '@validup/zod';\nimport type { BetterSqlite3DataSourceOptions } from 'typeorm/driver/better-sqlite3/BetterSqlite3DataSourceOptions.js';\nimport type { MysqlDataSourceOptions } from 'typeorm/driver/mysql/MysqlDataSourceOptions.js';\nimport type { PostgresDataSourceOptions } from 'typeorm/driver/postgres/PostgresDataSourceOptions.js';\nimport type { ValidatorDescriptor } from 'validup';\nimport { Container } from 'validup';\nimport { z } from 'zod';\nimport { expandToOrigins } from './origins.ts';\nimport { isValidTrustProxyListEntry } from './trust-proxy.ts';\nimport type { Config } from './types.ts';\nimport { CERTIFICATE_SOURCES } from '../../../adapters/http/request/index.ts';\n\nexport class ConfigValidator extends Container<Config> {\n protected override initialize() {\n super.initialize();\n\n const stringValidator = createValidator(z.string());\n const booleanValidator = createValidator(z.boolean());\n const nonNegativeNumberValidator = createValidator(z.number().nonnegative());\n const secretValidator = createValidator(z.string().min(3).max(256));\n const middlewareValidator = createValidator(\n z.boolean().or(z.record(z.string(), z.any())),\n );\n const serviceValidator = createValidator(\n z.string()\n .or(z.boolean())\n .or(z.custom<Record<string, any>>((value) => isObject(value))),\n );\n\n // Record<keyof Config, ...> is the compile-time exhaustiveness\n // guard: a Config key without a validator here fails the build\n // instead of being silently stripped by run().\n const validators: Record<keyof Config, ValidatorDescriptor> = {\n env: stringValidator,\n rootPath: stringValidator,\n writableDirectoryPath: stringValidator,\n\n logger: booleanValidator,\n db: createValidator(\n z.custom<MysqlDataSourceOptions | PostgresDataSourceOptions | BetterSqlite3DataSourceOptions>(\n (value) => isObject(value),\n ),\n ),\n redis: serviceValidator,\n smtp: serviceValidator,\n\n port: nonNegativeNumberValidator,\n host: stringValidator,\n publicUrl: createValidator(z.url()),\n mtlsPublicUrl: createValidator(z.url().nullable()),\n certificateSource: createValidator(z.enum(CERTIFICATE_SOURCES)),\n trustProxy: createValidator(z.union([\n z.boolean(),\n z.number().int().nonnegative(),\n // scalar strings are canonicalized in normalizeConfig\n // (integer/boolean words → their semantic type)\n z.string(),\n // the explicit allowlist form: an integer-string or boolean\n // word entry is a mis-typed scalar and must fail loud —\n // proxy-addr would silently compile '1' to 0.0.0.1\n z.array(z.string().refine(\n isValidTrustProxyListEntry,\n 'must be an IP, CIDR, or proxy-addr preset',\n )),\n ])),\n trustedOrigins: createValidator(\n z.array(z.string().refine((value) => {\n try {\n expandToOrigins(value);\n return true;\n } catch {\n return false;\n }\n }, 'must be a http(s) origin or a bare host[:port]')),\n ),\n\n middlewareBody: middlewareValidator,\n middlewareCors: middlewareValidator,\n middlewareCookie: middlewareValidator,\n middlewareQuery: middlewareValidator,\n middlewarePrometheus: middlewareValidator,\n middlewareRateLimit: middlewareValidator,\n middlewareSwagger: booleanValidator,\n\n tokenAccessMaxAge: nonNegativeNumberValidator,\n tokenRefreshMaxAge: nonNegativeNumberValidator,\n tokenRefreshGracePeriod: nonNegativeNumberValidator,\n promptLoginMaxAge: nonNegativeNumberValidator,\n endSessionHintGracePeriod: nonNegativeNumberValidator,\n registrationEnabled: booleanValidator,\n emailVerificationEnabled: booleanValidator,\n passwordRecoveryEnabled: booleanValidator,\n passwordMinLength: createValidator(\n z.number().int().positive().max(USER_PASSWORD_MAX_LENGTH),\n ),\n\n eventLogEnabled: booleanValidator,\n eventLogRetentionDays: nonNegativeNumberValidator,\n eventLogEntityEnabled: booleanValidator,\n eventLogEntityRetentionDays: nonNegativeNumberValidator,\n loginAttemptThrottleEnabled: booleanValidator,\n loginAttemptThreshold: createValidator(z.number().int().positive()),\n loginAttemptWindow: createValidator(z.number().int().positive()),\n\n // '' = unset; otherwise a base64 string (normalizeConfig enforces\n // the decoded 32-byte length at boot).\n secretsEncryptionKey: createValidator(z.union([z.literal(''), z.base64()])),\n\n mfaEnabled: booleanValidator,\n mfaRequired: booleanValidator,\n mfaFreshnessMaxAge: nonNegativeNumberValidator,\n mfaTicketMaxAge: createValidator(z.number().int().positive()),\n\n clientAuthBasic: booleanValidator,\n clientSystemEnabled: booleanValidator,\n clientSystemSecret: secretValidator,\n clientSystemSecretReset: booleanValidator,\n\n userAuthBasic: booleanValidator,\n userAdminEnabled: booleanValidator,\n userAdminPassword: secretValidator,\n userAdminPasswordReset: booleanValidator,\n\n permissions: createValidator(\n z.string().or(z.array(z.string())),\n ),\n permissionsDefaultPolicyAssignment: booleanValidator,\n };\n\n const keys = Object.keys(validators) as (keyof Config)[];\n for (const key of keys) {\n this.mount(key, { optional: true }, validators[key]);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAaQ,kBAAb,cAAqCL,UAAAA;CACdM,aAAa;EAC5B,MAAMA,WAAAA;EAEN,MAAMC,kBAAkBR,gBAAgBE,EAAEO,OAAM,CAAA;EAChD,MAAMC,mBAAmBV,gBAAgBE,EAAES,QAAO,CAAA;EAClD,MAAMC,6BAA6BZ,gBAAgBE,EAAEW,OAAM,CAAA,CAAGC,YAAW,CAAA;EACzE,MAAMC,kBAAkBf,gBAAgBE,EAAEO,OAAM,CAAA,CAAGO,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IAAI,CAAC;IAM3E,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzD,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7D,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAY3E,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;IAIrC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;IAI9C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzD,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxE,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAmBvD,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAUzF"}
@@ -6,8 +6,8 @@ import { ClientEntity } from "../../../../../adapters/database/domains/client/en
6
6
  import { ClientRoleEntity } from "../../../../../adapters/database/domains/client-role/entity.mjs";
7
7
  import { ClientPermissionEntity } from "../../../../../adapters/database/domains/client-permission/entity.mjs";
8
8
  import "../../../../../adapters/database/domains/index.mjs";
9
- import { applyQuery } from "../query.mjs";
10
- import { applyRealmScopeSelect, isEntityUnique, translateWhereConditions } from "../helpers.mjs";
9
+ import { applyQuery, redactFieldConditions } from "../query.mjs";
10
+ import { isEntityUnique, translateWhereConditions } from "../helpers.mjs";
11
11
  import { DatabaseConflictError } from "../../../../../adapters/database/errors/conflict.mjs";
12
12
  import "../../../../../adapters/database/index.mjs";
13
13
  import { loadBoundPermissions } from "../bindings.mjs";
@@ -27,10 +27,9 @@ var ClientRepositoryAdapter = class {
27
27
  const qb = this.repository.createQueryBuilder("client");
28
28
  qb.groupBy("client.id");
29
29
  const { pagination } = applyQuery(qb, query);
30
- applyRealmScopeSelect(qb, "client", ["secretHashed", "secretEncrypted"]);
31
30
  const [entities, total] = await qb.getManyAndCount();
32
31
  return {
33
- data: entities,
32
+ data: redactFieldConditions(query, entities),
34
33
  meta: {
35
34
  total,
36
35
  ...pagination
@@ -1 +1 @@
1
- {"version":3,"file":"repository.mjs","names":["buildRedisKeyPath","isUUID","validateEntityJoinColumns","applyQuery","DatabaseConflictError","applyRealmScopeSelect","isEntityUnique","translateWhereConditions","loadBoundPermissions","CachePrefix","ClientEntity","ClientPermissionEntity","ClientRoleEntity","RealmRepositoryAdapter","ClientRepositoryAdapter","repository","realmRepository","ctx","findMany","query","qb","createQueryBuilder","groupBy","pagination","entities","total","getManyAndCount","data","meta","findOneById","id","findOneBy","findOneByName","name","realmKey","where","realmId","resolveId","andWhere","getOne","findOne","findOneByIdOrName","idOrName","realm","findManyBy","findBy","findOneWithSecret","Object","entries","forEach","key","value","addSelect","create","merge","entity","save","remove","validateJoinColumns","dataSource","manager","connection","entityTarget","checkUniqueness","existing","isUnique","entityExisting","getBoundRoles","getRepository","find","clientId","relations","role","cache","prefix","CLIENT_OWNED_ROLES","milliseconds","map","entry","getBoundPermissions","junctionTarget","cachePrefix","CLIENT_OWNED_PERMISSIONS","cacheKey"],"sources":["../../../../../../src/app/modules/database/repositories/client/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Client, Realm, Role } from '@authup/core-kit';\nimport type { IQuery } from '@rapiq/core';\nimport type { PermissionPolicyBinding } from '@authup/access';\nimport { buildRedisKeyPath } from '@authup/server-kit';\nimport { isUUID } from '@authup/kit';\nimport type { Repository } from 'typeorm';\nimport { validateEntityJoinColumns } from 'typeorm-extension';\nimport { applyQuery } from '../query.ts';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IClientRepository, IRealmRepository } from '../../../../../core/index.ts';\nimport { DatabaseConflictError } from '../../../../../adapters/database/index.ts';\nimport { applyRealmScopeSelect, isEntityUnique, translateWhereConditions } from '../helpers.ts';\nimport { loadBoundPermissions } from '../bindings.ts';\nimport {\n CachePrefix,\n ClientEntity,\n ClientPermissionEntity,\n ClientRoleEntity,\n} from '../../../../../adapters/database/domains/index.ts';\nimport { RealmRepositoryAdapter } from '../realm/repository.ts';\n\nexport type ClientRepositoryAdapterContext = {\n repository: Repository<Client>,\n realmRepository: Repository<Realm>,\n};\n\nexport class ClientRepositoryAdapter implements IClientRepository {\n private readonly repository: Repository<Client>;\n\n private readonly realmRepository: IRealmRepository;\n\n constructor(ctx: ClientRepositoryAdapterContext) {\n this.repository = ctx.repository;\n this.realmRepository = new RealmRepositoryAdapter(ctx.realmRepository);\n }\n\n async findMany(query: IQuery): Promise<EntityRepositoryFindManyResult<Client>> {\n const qb = this.repository.createQueryBuilder('client');\n qb.groupBy('client.id');\n\n const { pagination } = applyQuery(qb, query);\n\n applyRealmScopeSelect(qb, 'client', ['secretHashed', 'secretEncrypted']);\n\n const [entities, total] = await qb.getManyAndCount();\n\n return {\n data: entities,\n meta: {\n total,\n ...pagination,\n },\n };\n }\n\n findOneById(id: string): Promise<Client | null> {\n return this.findOneBy({ id });\n }\n\n async findOneByName(name: string, realmKey?: string): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n qb.where('client.name = :name', { name });\n\n if (realmKey) {\n const realmId = await this.realmRepository.resolveId(realmKey);\n if (!realmId) {\n return null;\n }\n qb.andWhere('client.realmId = :realmId', { realmId });\n }\n\n return qb.getOne();\n }\n\n async findOne(id: string, query?: IQuery, realmKey?: string): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n\n if (isUUID(id)) {\n qb.where('client.id = :id', { id });\n } else {\n qb.where('client.name = :name', { name: id });\n\n if (realmKey) {\n const realmId = await this.realmRepository.resolveId(realmKey);\n if (!realmId) {\n return null;\n }\n qb.andWhere('client.realmId = :realmId', { realmId });\n }\n }\n\n applyQuery(qb, query);\n\n return qb.getOne();\n }\n\n async findOneByIdOrName(idOrName: string, realm?: string): Promise<Client | null> {\n return isUUID(idOrName) ?\n this.findOneById(idOrName) :\n this.findOneByName(idOrName, realm);\n }\n\n async findManyBy(where: Record<string, any>): Promise<Client[]> {\n return this.repository.findBy(translateWhereConditions(where));\n }\n\n async findOneBy(where: Record<string, any>): Promise<Client | null> {\n return this.repository.findOneBy(translateWhereConditions(where));\n }\n\n async findOneWithSecret(where: Record<string, any>): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n\n Object.entries(where).forEach(([key, value]) => {\n qb.andWhere(`client.${key} = :${key}`, { [key]: value });\n });\n\n qb.addSelect('client.secret');\n\n return qb.getOne();\n }\n\n create(data: Partial<Client>): Client {\n return this.repository.create(data);\n }\n\n merge(entity: Client, data: Partial<Client>): Client {\n return this.repository.merge(entity, data);\n }\n\n async save(entity: Client): Promise<Client> {\n return this.repository.save(entity);\n }\n\n async remove(entity: Client): Promise<void> {\n await this.repository.remove(entity);\n }\n\n async validateJoinColumns(data: Partial<Client>): Promise<void> {\n await validateEntityJoinColumns(data, {\n dataSource: this.repository.manager.connection,\n entityTarget: ClientEntity,\n });\n }\n\n async checkUniqueness(data: Partial<Client>, existing?: Client): Promise<void> {\n const isUnique = await isEntityUnique({\n dataSource: this.repository.manager.connection,\n entityTarget: ClientEntity,\n entity: data,\n entityExisting: existing,\n });\n\n if (!isUnique) {\n throw new DatabaseConflictError();\n }\n }\n\n async getBoundRoles(entity: string | Client): Promise<Role[]> {\n const id = typeof entity === 'string' ? entity : entity.id;\n const entries = await this.repository.manager\n .getRepository(ClientRoleEntity)\n .find({\n where: { clientId: id },\n relations: { role: true },\n cache: {\n id: buildRedisKeyPath({\n prefix: CachePrefix.CLIENT_OWNED_ROLES,\n key: id,\n }),\n milliseconds: 60_000,\n },\n });\n\n return entries.map((entry) => entry.role);\n }\n\n async getBoundPermissions(entity: string | Client): Promise<PermissionPolicyBinding[]> {\n const id = typeof entity === 'string' ? entity : entity.id;\n return loadBoundPermissions({\n manager: this.repository.manager,\n junctionTarget: ClientPermissionEntity,\n where: { clientId: id },\n cachePrefix: CachePrefix.CLIENT_OWNED_PERMISSIONS,\n cacheKey: id,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,IAAac,0BAAb,MAAaA;CACQC;CAEAC;CAEjB,YAAYC,KAAqC;EAC7C,KAAKF,aAAaE,IAAIF;EACtB,KAAKC,kBAAkB,IAAIH,uBAAuBI,IAAID,eAAe;CACzE;CAEA,MAAME,SAASC,OAAgE;EAC3E,MAAMC,KAAK,KAAKL,WAAWM,mBAAmB,QAAA;EAC9CD,GAAGE,QAAQ,WAAA;EAEX,MAAM,EAAEC,eAAepB,WAAWiB,IAAID,KAAAA;EAEtCd,sBAAsBe,IAAI,UAAU,CAAC,gBAAgB,iBAAkB,CAAA;EAEvE,MAAM,CAACI,UAAUC,SAAS,MAAML,GAAGM,gBAAe;EAElD,OAAO;GACHC,MAAMH;GACNI,MAAM;IACFH;IACA,GAAGF;GACP;EACJ;CACJ;CAEAM,YAAYC,IAAoC;EAC5C,OAAO,KAAKC,UAAU,EAAED,GAAG,CAAA;CAC/B;CAEA,MAAME,cAAcC,MAAcC,UAA2C;EACzE,MAAMd,KAAK,KAAKL,WAAWM,mBAAmB,QAAA;EAC9CD,GAAGe,MAAM,uB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WAAWA,SAASA,OAAOzB;EACxD,OAAOtB,qBAAqB;GACxBoD,SAAS,KAAK7C,WAAW6C;GACzBoB,gBAAgBrE;GAChBwB,OAAO,EAAEmC,UAAUxC,GAAG;GACtBmD,aAAaxE,YAAYyE;GACzBC,UAAUrD;EACd,CAAA;CACJ;AACJ"}
1
+ {"version":3,"file":"repository.mjs","names":["buildRedisKeyPath","isUUID","validateEntityJoinColumns","applyQuery","redactFieldConditions","DatabaseConflictError","isEntityUnique","translateWhereConditions","loadBoundPermissions","CachePrefix","ClientEntity","ClientPermissionEntity","ClientRoleEntity","RealmRepositoryAdapter","ClientRepositoryAdapter","repository","realmRepository","ctx","findMany","query","qb","createQueryBuilder","groupBy","pagination","entities","total","getManyAndCount","data","meta","findOneById","id","findOneBy","findOneByName","name","realmKey","where","realmId","resolveId","andWhere","getOne","findOne","findOneByIdOrName","idOrName","realm","findManyBy","findBy","findOneWithSecret","Object","entries","forEach","key","value","addSelect","create","merge","entity","save","remove","validateJoinColumns","dataSource","manager","connection","entityTarget","checkUniqueness","existing","isUnique","entityExisting","getBoundRoles","getRepository","find","clientId","relations","role","cache","prefix","CLIENT_OWNED_ROLES","milliseconds","map","entry","getBoundPermissions","junctionTarget","cachePrefix","CLIENT_OWNED_PERMISSIONS","cacheKey"],"sources":["../../../../../../src/app/modules/database/repositories/client/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Client, Realm, Role } from '@authup/core-kit';\nimport type { IQuery } from '@rapiq/core';\nimport type { PermissionPolicyBinding } from '@authup/access';\nimport { buildRedisKeyPath } from '@authup/server-kit';\nimport { isUUID } from '@authup/kit';\nimport type { Repository } from 'typeorm';\nimport { validateEntityJoinColumns } from 'typeorm-extension';\nimport { applyQuery, redactFieldConditions } from '../query.ts';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IClientRepository, IRealmRepository } from '../../../../../core/index.ts';\nimport { DatabaseConflictError } from '../../../../../adapters/database/index.ts';\nimport { isEntityUnique, translateWhereConditions } from '../helpers.ts';\nimport { loadBoundPermissions } from '../bindings.ts';\nimport {\n CachePrefix,\n ClientEntity,\n ClientPermissionEntity,\n ClientRoleEntity,\n} from '../../../../../adapters/database/domains/index.ts';\nimport { RealmRepositoryAdapter } from '../realm/repository.ts';\n\nexport type ClientRepositoryAdapterContext = {\n repository: Repository<Client>,\n realmRepository: Repository<Realm>,\n};\n\nexport class ClientRepositoryAdapter implements IClientRepository {\n private readonly repository: Repository<Client>;\n\n private readonly realmRepository: IRealmRepository;\n\n constructor(ctx: ClientRepositoryAdapterContext) {\n this.repository = ctx.repository;\n this.realmRepository = new RealmRepositoryAdapter(ctx.realmRepository);\n }\n\n async findMany(query: IQuery): Promise<EntityRepositoryFindManyResult<Client>> {\n const qb = this.repository.createQueryBuilder('client');\n qb.groupBy('client.id');\n\n const { pagination } = applyQuery(qb, query);\n\n const [entities, total] = await qb.getManyAndCount();\n\n return {\n data: redactFieldConditions(query, entities),\n meta: {\n total,\n ...pagination,\n },\n };\n }\n\n findOneById(id: string): Promise<Client | null> {\n return this.findOneBy({ id });\n }\n\n async findOneByName(name: string, realmKey?: string): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n qb.where('client.name = :name', { name });\n\n if (realmKey) {\n const realmId = await this.realmRepository.resolveId(realmKey);\n if (!realmId) {\n return null;\n }\n qb.andWhere('client.realmId = :realmId', { realmId });\n }\n\n return qb.getOne();\n }\n\n async findOne(id: string, query?: IQuery, realmKey?: string): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n\n if (isUUID(id)) {\n qb.where('client.id = :id', { id });\n } else {\n qb.where('client.name = :name', { name: id });\n\n if (realmKey) {\n const realmId = await this.realmRepository.resolveId(realmKey);\n if (!realmId) {\n return null;\n }\n qb.andWhere('client.realmId = :realmId', { realmId });\n }\n }\n\n applyQuery(qb, query);\n\n return qb.getOne();\n }\n\n async findOneByIdOrName(idOrName: string, realm?: string): Promise<Client | null> {\n return isUUID(idOrName) ?\n this.findOneById(idOrName) :\n this.findOneByName(idOrName, realm);\n }\n\n async findManyBy(where: Record<string, any>): Promise<Client[]> {\n return this.repository.findBy(translateWhereConditions(where));\n }\n\n async findOneBy(where: Record<string, any>): Promise<Client | null> {\n return this.repository.findOneBy(translateWhereConditions(where));\n }\n\n async findOneWithSecret(where: Record<string, any>): Promise<Client | null> {\n const qb = this.repository.createQueryBuilder('client');\n\n Object.entries(where).forEach(([key, value]) => {\n qb.andWhere(`client.${key} = :${key}`, { [key]: value });\n });\n\n qb.addSelect('client.secret');\n\n return qb.getOne();\n }\n\n create(data: Partial<Client>): Client {\n return this.repository.create(data);\n }\n\n merge(entity: Client, data: Partial<Client>): Client {\n return this.repository.merge(entity, data);\n }\n\n async save(entity: Client): Promise<Client> {\n return this.repository.save(entity);\n }\n\n async remove(entity: Client): Promise<void> {\n await this.repository.remove(entity);\n }\n\n async validateJoinColumns(data: Partial<Client>): Promise<void> {\n await validateEntityJoinColumns(data, {\n dataSource: this.repository.manager.connection,\n entityTarget: ClientEntity,\n });\n }\n\n async checkUniqueness(data: Partial<Client>, existing?: Client): Promise<void> {\n const isUnique = await isEntityUnique({\n dataSource: this.repository.manager.connection,\n entityTarget: ClientEntity,\n entity: data,\n entityExisting: existing,\n });\n\n if (!isUnique) {\n throw new DatabaseConflictError();\n }\n }\n\n async getBoundRoles(entity: string | Client): Promise<Role[]> {\n const id = typeof entity === 'string' ? entity : entity.id;\n const entries = await this.repository.manager\n .getRepository(ClientRoleEntity)\n .find({\n where: { clientId: id },\n relations: { role: true },\n cache: {\n id: buildRedisKeyPath({\n prefix: CachePrefix.CLIENT_OWNED_ROLES,\n key: id,\n }),\n milliseconds: 60_000,\n },\n });\n\n return entries.map((entry) => entry.role);\n }\n\n async getBoundPermissions(entity: string | Client): Promise<PermissionPolicyBinding[]> {\n const id = typeof entity === 'string' ? entity : entity.id;\n return loadBoundPermissions({\n manager: this.repository.manager,\n junctionTarget: ClientPermissionEntity,\n where: { clientId: id },\n cachePrefix: CachePrefix.CLIENT_OWNED_PERMISSIONS,\n cacheKey: id,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,IAAac,0BAAb,MAAaA;CACQC;CAEAC;CAEjB,YAAYC,KAAqC;EAC7C,KAAKF,aAAaE,IAAIF;EACtB,KAAKC,kBAAkB,IAAIH,uBAAuBI,IAAID,eAAe;CACzE;CAEA,MAAME,SAASC,OAAgE;EAC3E,MAAMC,KAAK,KAAKL,WAAWM,mBAAmB,QAAA;EAC9CD,GAAGE,QAAQ,WAAA;EAEX,MAAM,EAAEC,eAAepB,WAAWiB,IAAID,KAAAA;EAEtC,MAAM,CAACK,UAAUC,SAAS,MAAML,GAAGM,gBAAe;EAElD,OAAO;GACHC,MAAMvB,sBAAsBe,OAAOK,QAAAA;GACnCI,MAAM;IACFH;IACA,GAAGF;GACP;EACJ;CACJ;CAEAM,YAAYC,IAAoC;EAC5C,OAAO,KAAKC,UAAU,EAAED,GAAG,CAAA;CAC/B;CAEA,MAAME,cAAcC,MAAcC,UAA2C;EACzE,MAAMd,KAAK,KAAKL,WAAWM,mBAAmB,QAAA;EAC9CD,GAAGe,MAAM,uBAAuB,EAAEF,KAAK,CAAA;EAEvC,IAAIC,UAAU;GACV,MAAME,UAAU,MAAM,KAAKpB,gBAAgBqB,UAAUH,QAAAA;GACrD,IAAI,CAACE,SACD,OAAO;GAEXhB,GAAGkB,SAAS,6BAA6B,EAAEF,QAAQ,CAAA;EACvD;EAEA,OAAOhB,GAAGmB,OAAM;CACpB;CAEA,MAAMC,QAAQV,IAAYX,OAAgBe,UAA2C;EACjF,MAAMd,KAAK,KAAKL,WAAWM,mBAAmB,QAAA;EAE9C,IAAIpB,OAAO6B,EAAAA,GACPV,GAAGe,MAAM,mBAAmB,EAAEL,GAAG,CAAA;OAC9B;GACHV,GAAGe,MAAM,uBAAuB,EAAEF,MA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C;EAC5D,MAAMzB,0BAA0ByB,MAAM;GAClCgC,YAAY,KAAK5C,WAAW6C,QAAQC;GACpCC,cAAcpD;EAClB,CAAA;CACJ;CAEA,MAAMqD,gBAAgBpC,MAAuBqC,UAAkC;EAQ3E,IAAI,CAACC,MAPkB3D,eAAe;GAClCqD,YAAY,KAAK5C,WAAW6C,QAAQC;GACpCC,cAAcpD;GACd6C,QAAQ5B;GACRuC,gBAAgBF;EACpB,CAAA,GAGI,MAAM,IAAI3D,sBAAAA;CAElB;CAEA,MAAM8D,cAAcZ,QAA0C;EAC1D,MAAMzB,KAAK,OAAOyB,WAAW,WAAWA,SAASA,OAAOzB;EAexD,QAAOkB,MAde,KAAKjC,WAAW6C,QACjCQ,cAAcxD,gBAAAA,CAAAA,CACdyD,KAAK;GACFlC,OAAO,EAAEmC,UAAUxC,GAAG;GACtByC,WAAW,EAAEC,MAAM,KAAK;GACxBC,OAAO;IACH3C,IAAI9B,kBAAkB;KAClB0E,QAAQjE,YAAYkE;KACpBzB,KAAKpB;IACT,CAAA;IACA8C,cAAc;GAClB;EACJ,CAAA,EAAA,CAEWC,KAAKC,UAAUA,MAAMN,IAAI;CAC5C;CAEA,MAAMO,oBAAoBxB,QAA6D;EACnF,MAAMzB,KAAK,OAAOyB,WAAW,WAAWA,SAASA,OAAOzB;EACxD,OAAOtB,qBAAqB;GACxBoD,SAAS,KAAK7C,WAAW6C;GACzBoB,gBAAgBrE;GAChBwB,OAAO,EAAEmC,UAAUxC,GAAG;GACtBmD,aAAaxE,YAAYyE;GACzBC,UAAUrD;EACd,CAAA;CACJ;AACJ"}
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { ClientPermissionEntity } from "../../../../../adapters/database/domains/client-permission/entity.mjs";
5
5
  import "../../../../../adapters/database/domains/index.mjs";
6
- import { applyQuery } from "../query.mjs";
6
+ import { applyQuery, redactFieldConditions } from "../query.mjs";
7
7
  import { translateWhereConditions } from "../helpers.mjs";
8
8
  import { validateEntityJoinColumns } from "typeorm-extension";
9
9
  //#region src/app/modules/database/repositories/client-permission/repository.ts
@@ -18,7 +18,7 @@ var ClientPermissionRepositoryAdapter = class {
18
18
  const { pagination } = applyQuery(qb, query);
19
19
  const [entities, total] = await qb.getManyAndCount();
20
20
  return {
21
- data: entities,
21
+ data: redactFieldConditions(query, entities),
22
22
  meta: {
23
23
  total,
24
24
  ...pagination
@@ -1 +1 @@
1
- {"version":3,"file":"repository.mjs","names":["validateEntityJoinColumns","applyQuery","ClientPermissionEntity","translateWhereConditions","ClientPermissionRepositoryAdapter","repository","findMany","query","qb","createQueryBuilder","groupBy","pagination","entities","total","getManyAndCount","data","meta","findOneById","id","findOneBy","findOneByName","_name","Promise","resolve","findOneByIdOrName","idOrName","findManyBy","where","findBy","create","merge","entity","save","remove","validateJoinColumns","dataSource","manager","connection","entityTarget"],"sources":["../../../../../../src/app/modules/database/repositories/client-permission/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientPermission } from '@authup/core-kit';\nimport type { IQuery } from '@rapiq/core';\nimport type { Repository } from 'typeorm';\nimport { validateEntityJoinColumns } from 'typeorm-extension';\nimport { applyQuery } from '../query.ts';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IClientPermissionRepository } from '../../../../../core/entities/client-permission/types.ts';\nimport { ClientPermissionEntity } from '../../../../../adapters/database/domains/index.ts';\nimport { translateWhereConditions } from '../helpers.ts';\n\nexport class ClientPermissionRepositoryAdapter implements IClientPermissionRepository {\n private readonly repository: Repository<ClientPermission>;\n\n constructor(repository: Repository<ClientPermission>) {\n this.repository = repository;\n }\n\n async findMany(query: IQuery): Promise<EntityRepositoryFindManyResult<ClientPermission>> {\n const qb = this.repository.createQueryBuilder('clientPermission');\n qb.groupBy('clientPermission.id');\n\n const { pagination } = applyQuery(qb, query);\n\n const [entities, total] = await qb.getManyAndCount();\n\n return {\n data: entities,\n meta: {\n total,\n ...pagination,\n },\n };\n }\n\n findOneById(id: string): Promise<ClientPermission | null> {\n return this.findOneBy({ id });\n }\n\n findOneByName(_name: string): Promise<ClientPermission | null> {\n return Promise.resolve(null);\n }\n\n findOneByIdOrName(idOrName: string): Promise<ClientPermission | null> {\n return this.findOneById(idOrName);\n }\n\n async findManyBy(where: Record<string, any>): Promise<ClientPermission[]> {\n return this.repository.findBy(translateWhereConditions(where));\n }\n\n async findOneBy(where: Record<string, any>): Promise<ClientPermission | null> {\n return this.repository.findOneBy(translateWhereConditions(where));\n }\n\n create(data: Partial<ClientPermission>): ClientPermission {\n return this.repository.create(data);\n }\n\n merge(entity: ClientPermission, data: Partial<ClientPermission>): ClientPermission {\n return this.repository.merge(entity, data);\n }\n\n async save(entity: ClientPermission): Promise<ClientPermission> {\n return this.repository.save(entity);\n }\n\n async remove(entity: ClientPermission): Promise<void> {\n await this.repository.remove(entity);\n }\n\n async validateJoinColumns(data: Partial<ClientPermission>): Promise<void> {\n await validateEntityJoinColumns(data, {\n dataSource: this.repository.manager.connection,\n entityTarget: ClientPermissionEntity,\n });\n }\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAaI,oCAAb,MAAaA;CACQC;CAEjB,YAAYA,YAA0C;EAClD,KAAKA,aAAaA;CACtB;CAEA,MAAMC,SAASC,OAA0E;EACrF,MAAMC,KAAK,KAAKH,WAAWI,mBAAmB,kBAAA;EAC9CD,GAAGE,QAAQ,qBAAA;EAEX,MAAM,EAAEC,eAAeV,WAAWO,IAAID,KAAAA;EAEtC,MAAM,CAACK,UAAUC,SAAS,MAAML,GAAGM,gBAAe;EAElD,OAAO;GACHC,MAAMH;GACNI,MAAM;IACFH;IACA,GAAGF;GACP;EACJ;CACJ;CAEAM,YAAYC,IAA8C;EACtD,OAAO,KAAKC,UAAU,EAAED,GAAG,CAAA;CAC/B;CAEAE,cAAcC,OAAiD;EAC3D,OAAOC,QAAQC,QAAQ,IAAA;CAC3B;CAEAC,kBAAkBC,UAAoD;EAClE,OAAO,KAAKR,YAAYQ,QAAAA;CAC5B;CAEA,MAAMC,WAAWC,OAAyD;EACtE,OAAO,KAAKtB,WAAWuB,OAAOzB,yBAAyBwB,KAAAA,CAAAA;CAC3D;CAEA,MAAMR,UAAUQ,OAA8D;EAC1E,OAAO,KAAKtB,WAAWc,UAAUhB,yBAAyBwB,KAAAA,CAAAA;CAC9D;CAEAE,OAAOd,MAAmD;EACtD,OAAO,KAAKV,WAAWwB,OAAOd,IAAAA;CAClC;CAEAe,MAAMC,QAA0BhB,MAAmD;EAC/E,OAAO,KAAKV,WAAWyB,MAAMC,QAAQhB,IAAAA;CACzC;CAEA,MAAMiB,KAAKD,QAAqD;EAC5D,OAAO,KAAK1B,WAAW2B,KAAKD,MAAAA;CAChC;CAEA,MAAME,OAAOF,QAAyC;EAClD,MAAM,KAAK1B,WAAW4B,OAAOF,MAAAA;CACjC;CAEA,MAAMG,oBAAoBnB,MAAgD;EACtE,MAAMf,0BAA0Be,MAAM;GAClCoB,YAAY,KAAK9B,WAAW+B,QAAQC;GACpCC,cAAcpC;EAClB,CAAA;CACJ;AACJ"}
1
+ {"version":3,"file":"repository.mjs","names":["validateEntityJoinColumns","applyQuery","redactFieldConditions","ClientPermissionEntity","translateWhereConditions","ClientPermissionRepositoryAdapter","repository","findMany","query","qb","createQueryBuilder","groupBy","pagination","entities","total","getManyAndCount","data","meta","findOneById","id","findOneBy","findOneByName","_name","Promise","resolve","findOneByIdOrName","idOrName","findManyBy","where","findBy","create","merge","entity","save","remove","validateJoinColumns","dataSource","manager","connection","entityTarget"],"sources":["../../../../../../src/app/modules/database/repositories/client-permission/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientPermission } from '@authup/core-kit';\nimport type { IQuery } from '@rapiq/core';\nimport type { Repository } from 'typeorm';\nimport { validateEntityJoinColumns } from 'typeorm-extension';\nimport { applyQuery, redactFieldConditions } from '../query.ts';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IClientPermissionRepository } from '../../../../../core/entities/client-permission/types.ts';\nimport { ClientPermissionEntity } from '../../../../../adapters/database/domains/index.ts';\nimport { translateWhereConditions } from '../helpers.ts';\n\nexport class ClientPermissionRepositoryAdapter implements IClientPermissionRepository {\n private readonly repository: Repository<ClientPermission>;\n\n constructor(repository: Repository<ClientPermission>) {\n this.repository = repository;\n }\n\n async findMany(query: IQuery): Promise<EntityRepositoryFindManyResult<ClientPermission>> {\n const qb = this.repository.createQueryBuilder('clientPermission');\n qb.groupBy('clientPermission.id');\n\n const { pagination } = applyQuery(qb, query);\n\n const [entities, total] = await qb.getManyAndCount();\n\n return {\n data: redactFieldConditions(query, entities),\n meta: {\n total,\n ...pagination,\n },\n };\n }\n\n findOneById(id: string): Promise<ClientPermission | null> {\n return this.findOneBy({ id });\n }\n\n findOneByName(_name: string): Promise<ClientPermission | null> {\n return Promise.resolve(null);\n }\n\n findOneByIdOrName(idOrName: string): Promise<ClientPermission | null> {\n return this.findOneById(idOrName);\n }\n\n async findManyBy(where: Record<string, any>): Promise<ClientPermission[]> {\n return this.repository.findBy(translateWhereConditions(where));\n }\n\n async findOneBy(where: Record<string, any>): Promise<ClientPermission | null> {\n return this.repository.findOneBy(translateWhereConditions(where));\n }\n\n create(data: Partial<ClientPermission>): ClientPermission {\n return this.repository.create(data);\n }\n\n merge(entity: ClientPermission, data: Partial<ClientPermission>): ClientPermission {\n return this.repository.merge(entity, data);\n }\n\n async save(entity: ClientPermission): Promise<ClientPermission> {\n return this.repository.save(entity);\n }\n\n async remove(entity: ClientPermission): Promise<void> {\n await this.repository.remove(entity);\n }\n\n async validateJoinColumns(data: Partial<ClientPermission>): Promise<void> {\n await validateEntityJoinColumns(data, {\n dataSource: this.repository.manager.connection,\n entityTarget: ClientPermissionEntity,\n });\n }\n}\n"],"mappings":";;;;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A;CACJ;AACJ"}
@@ -3,7 +3,7 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { ClientRoleEntity } from "../../../../../adapters/database/domains/client-role/entity.mjs";
5
5
  import "../../../../../adapters/database/domains/index.mjs";
6
- import { applyQuery } from "../query.mjs";
6
+ import { applyQuery, redactFieldConditions } from "../query.mjs";
7
7
  import { translateWhereConditions } from "../helpers.mjs";
8
8
  import { validateEntityJoinColumns } from "typeorm-extension";
9
9
  //#region src/app/modules/database/repositories/client-role/repository.ts
@@ -18,7 +18,7 @@ var ClientRoleRepositoryAdapter = class {
18
18
  const { pagination } = applyQuery(qb, query);
19
19
  const [entities, total] = await qb.getManyAndCount();
20
20
  return {
21
- data: entities,
21
+ data: redactFieldConditions(query, entities),
22
22
  meta: {
23
23
  total,
24
24
  ...pagination