@authup/server-core 1.0.0-beta.63 → 1.0.0-beta.64

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 (710) hide show
  1. package/dist/adapters/database/data-source/options/module.d.ts +1 -0
  2. package/dist/adapters/database/data-source/options/module.d.ts.map +1 -1
  3. package/dist/adapters/database/data-source/options/module.mjs +33 -4
  4. package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
  5. package/dist/adapters/database/domains/client/entity.d.ts +1 -2
  6. package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
  7. package/dist/adapters/database/domains/client/entity.mjs +7 -14
  8. package/dist/adapters/database/domains/client/entity.mjs.map +1 -1
  9. package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts +2 -1
  10. package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts.map +1 -1
  11. package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs +2 -2
  12. package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs.map +1 -1
  13. package/dist/adapters/database/domains/session/entity.d.ts +8 -0
  14. package/dist/adapters/database/domains/session/entity.d.ts.map +1 -1
  15. package/dist/adapters/database/domains/session/entity.mjs +19 -0
  16. package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
  17. package/dist/adapters/database/domains/user/entity.d.ts +1 -0
  18. package/dist/adapters/database/domains/user/entity.d.ts.map +1 -1
  19. package/dist/adapters/database/domains/user/entity.mjs +6 -0
  20. package/dist/adapters/database/domains/user/entity.mjs.map +1 -1
  21. package/dist/adapters/database/extra-attribute-repository/repository.mjs +1 -1
  22. package/dist/adapters/database/extra-attribute-repository/repository.mjs.map +1 -1
  23. package/dist/adapters/database/extra-attribute-repository/tree/adapter.mjs +4 -2
  24. package/dist/adapters/database/extra-attribute-repository/tree/adapter.mjs.map +1 -1
  25. package/dist/adapters/database/extra-attribute-repository/tree/repository.mjs +1 -1
  26. package/dist/adapters/database/extra-attribute-repository/tree/repository.mjs.map +1 -1
  27. package/dist/adapters/database/index.mjs +3 -3
  28. package/dist/adapters/database/migrations/mysql/1787571998009-SessionUserAndClientColumns.d.ts +56 -0
  29. package/dist/adapters/database/migrations/mysql/1787571998009-SessionUserAndClientColumns.d.ts.map +1 -0
  30. package/dist/adapters/database/migrations/mysql/1787571998009-SessionUserAndClientColumns.mjs +105 -0
  31. package/dist/adapters/database/migrations/mysql/1787571998009-SessionUserAndClientColumns.mjs.map +1 -0
  32. package/dist/adapters/database/migrations/postgres/1787571998009-SessionUserAndClientColumns.d.ts +56 -0
  33. package/dist/adapters/database/migrations/postgres/1787571998009-SessionUserAndClientColumns.d.ts.map +1 -0
  34. package/dist/adapters/database/migrations/postgres/1787571998009-SessionUserAndClientColumns.mjs +104 -0
  35. package/dist/adapters/database/migrations/postgres/1787571998009-SessionUserAndClientColumns.mjs.map +1 -0
  36. package/dist/adapters/database/subscriber/module.d.ts +6 -2
  37. package/dist/adapters/database/subscriber/module.d.ts.map +1 -1
  38. package/dist/adapters/database/subscriber/module.mjs +9 -5
  39. package/dist/adapters/database/subscriber/module.mjs.map +1 -1
  40. package/dist/adapters/http/adapters/oauth2/authorization/module.mjs +1 -1
  41. package/dist/adapters/http/adapters/oauth2/authorization/module.mjs.map +1 -1
  42. package/dist/adapters/http/constants.d.ts +18 -0
  43. package/dist/adapters/http/constants.d.ts.map +1 -0
  44. package/dist/adapters/http/constants.mjs +23 -0
  45. package/dist/adapters/http/constants.mjs.map +1 -0
  46. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +3 -3
  47. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
  48. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts +6 -0
  49. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts.map +1 -1
  50. package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
  51. package/dist/adapters/http/controllers/entities/realm/module.mjs +2 -0
  52. package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
  53. package/dist/adapters/http/controllers/entities/session/module.d.ts +33 -1
  54. package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -1
  55. package/dist/adapters/http/controllers/entities/session/module.mjs +74 -0
  56. package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -1
  57. package/dist/adapters/http/controllers/index.mjs +3 -1
  58. package/dist/adapters/http/controllers/workflows/account/index.d.ts +1 -0
  59. package/dist/adapters/http/controllers/workflows/account/index.d.ts.map +1 -1
  60. package/dist/adapters/http/controllers/workflows/account/module.d.ts +25 -16
  61. package/dist/adapters/http/controllers/workflows/account/module.d.ts.map +1 -1
  62. package/dist/adapters/http/controllers/workflows/account/module.mjs +40 -17
  63. package/dist/adapters/http/controllers/workflows/account/module.mjs.map +1 -1
  64. package/dist/adapters/http/controllers/workflows/account/types.d.ts +33 -0
  65. package/dist/adapters/http/controllers/workflows/account/types.d.ts.map +1 -0
  66. package/dist/adapters/http/controllers/workflows/activate/module.d.ts +8 -4
  67. package/dist/adapters/http/controllers/workflows/activate/module.d.ts.map +1 -1
  68. package/dist/adapters/http/controllers/workflows/activate/module.mjs +7 -9
  69. package/dist/adapters/http/controllers/workflows/activate/module.mjs.map +1 -1
  70. package/dist/adapters/http/controllers/workflows/admin/index.d.ts.map +1 -0
  71. package/dist/adapters/http/controllers/workflows/admin/index.mjs +5 -0
  72. package/dist/adapters/http/controllers/workflows/admin/module.d.ts +30 -0
  73. package/dist/adapters/http/controllers/workflows/admin/module.d.ts.map +1 -0
  74. package/dist/adapters/http/controllers/workflows/admin/module.mjs +88 -0
  75. package/dist/adapters/http/controllers/workflows/admin/module.mjs.map +1 -0
  76. package/dist/adapters/http/controllers/workflows/admin/types.d.ts +14 -0
  77. package/dist/adapters/http/controllers/workflows/admin/types.d.ts.map +1 -0
  78. package/dist/adapters/http/controllers/workflows/auth-console.d.ts +16 -0
  79. package/dist/adapters/http/controllers/workflows/auth-console.d.ts.map +1 -0
  80. package/dist/adapters/http/controllers/workflows/auth-console.mjs +32 -0
  81. package/dist/adapters/http/controllers/workflows/auth-console.mjs.map +1 -0
  82. package/dist/adapters/http/controllers/workflows/authorize/module.d.ts +16 -1
  83. package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
  84. package/dist/adapters/http/controllers/workflows/authorize/module.mjs +40 -22
  85. package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
  86. package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +5 -0
  87. package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
  88. package/dist/adapters/http/controllers/workflows/console-login/index.d.ts +3 -0
  89. package/dist/adapters/http/controllers/workflows/console-login/index.d.ts.map +1 -0
  90. package/dist/adapters/http/controllers/workflows/console-login/index.mjs +5 -0
  91. package/dist/adapters/http/controllers/workflows/console-login/module.d.ts +83 -0
  92. package/dist/adapters/http/controllers/workflows/console-login/module.d.ts.map +1 -0
  93. package/dist/adapters/http/controllers/workflows/console-login/module.mjs +230 -0
  94. package/dist/adapters/http/controllers/workflows/console-login/module.mjs.map +1 -0
  95. package/dist/adapters/http/controllers/workflows/console-login/types.d.ts +58 -0
  96. package/dist/adapters/http/controllers/workflows/console-login/types.d.ts.map +1 -0
  97. package/dist/adapters/http/controllers/workflows/index.d.ts +2 -0
  98. package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
  99. package/dist/adapters/http/controllers/workflows/index.mjs +5 -1
  100. package/dist/adapters/http/controllers/workflows/logout/module.d.ts +32 -3
  101. package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -1
  102. package/dist/adapters/http/controllers/workflows/logout/module.mjs +48 -24
  103. package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -1
  104. package/dist/adapters/http/controllers/workflows/logout/types.d.ts +1 -1
  105. package/dist/adapters/http/controllers/workflows/logout/types.d.ts.map +1 -1
  106. package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts +8 -4
  107. package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts.map +1 -1
  108. package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs +7 -9
  109. package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs.map +1 -1
  110. package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts +8 -4
  111. package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts.map +1 -1
  112. package/dist/adapters/http/controllers/workflows/password-reset/module.mjs +7 -10
  113. package/dist/adapters/http/controllers/workflows/password-reset/module.mjs.map +1 -1
  114. package/dist/adapters/http/controllers/workflows/register/module.d.ts +8 -4
  115. package/dist/adapters/http/controllers/workflows/register/module.d.ts.map +1 -1
  116. package/dist/adapters/http/controllers/workflows/register/module.mjs +7 -9
  117. package/dist/adapters/http/controllers/workflows/register/module.mjs.map +1 -1
  118. package/dist/adapters/http/controllers/workflows/status/module.mjs +1 -1
  119. package/dist/adapters/http/controllers/workflows/token/module.d.ts +45 -2
  120. package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
  121. package/dist/adapters/http/controllers/workflows/token/module.mjs +102 -24
  122. package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
  123. package/dist/adapters/http/cookie/index.d.ts +2 -0
  124. package/dist/adapters/http/cookie/index.d.ts.map +1 -0
  125. package/dist/adapters/http/cookie/index.mjs +5 -0
  126. package/dist/adapters/http/cookie/session.d.ts +35 -0
  127. package/dist/adapters/http/cookie/session.d.ts.map +1 -0
  128. package/dist/adapters/http/cookie/session.mjs +62 -0
  129. package/dist/adapters/http/cookie/session.mjs.map +1 -0
  130. package/dist/adapters/http/index.d.ts +2 -0
  131. package/dist/adapters/http/index.d.ts.map +1 -1
  132. package/dist/adapters/http/index.mjs +20 -16
  133. package/dist/adapters/http/internal-client/index.d.ts +3 -0
  134. package/dist/adapters/http/internal-client/index.d.ts.map +1 -0
  135. package/dist/adapters/http/internal-client/index.mjs +5 -0
  136. package/dist/adapters/http/internal-client/module.d.ts +21 -0
  137. package/dist/adapters/http/internal-client/module.d.ts.map +1 -0
  138. package/dist/adapters/http/{ui/auth-console/http-client.mjs → internal-client/module.mjs} +16 -15
  139. package/dist/adapters/http/internal-client/module.mjs.map +1 -0
  140. package/dist/adapters/http/internal-client/types.d.ts +13 -0
  141. package/dist/adapters/http/internal-client/types.d.ts.map +1 -0
  142. package/dist/adapters/http/middleware/built-in/authorization/index.d.ts +1 -0
  143. package/dist/adapters/http/middleware/built-in/authorization/index.d.ts.map +1 -1
  144. package/dist/adapters/http/middleware/built-in/authorization/index.mjs +2 -1
  145. package/dist/adapters/http/middleware/built-in/authorization/issuance.d.ts +45 -0
  146. package/dist/adapters/http/middleware/built-in/authorization/issuance.d.ts.map +1 -0
  147. package/dist/adapters/http/middleware/built-in/authorization/issuance.mjs +61 -0
  148. package/dist/adapters/http/middleware/built-in/authorization/issuance.mjs.map +1 -0
  149. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +26 -2
  150. package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
  151. package/dist/adapters/http/middleware/built-in/authorization/module.mjs +67 -1
  152. package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
  153. package/dist/adapters/http/middleware/built-in/authorization/types.d.ts +21 -1
  154. package/dist/adapters/http/middleware/built-in/authorization/types.d.ts.map +1 -1
  155. package/dist/adapters/http/middleware/built-in/basic.d.ts +2 -2
  156. package/dist/adapters/http/middleware/built-in/basic.d.ts.map +1 -1
  157. package/dist/adapters/http/middleware/built-in/basic.mjs.map +1 -1
  158. package/dist/adapters/http/middleware/built-in/cors.d.ts +8 -2
  159. package/dist/adapters/http/middleware/built-in/cors.d.ts.map +1 -1
  160. package/dist/adapters/http/middleware/built-in/cors.mjs +20 -3
  161. package/dist/adapters/http/middleware/built-in/cors.mjs.map +1 -1
  162. package/dist/adapters/http/middleware/built-in/error.d.ts +2 -2
  163. package/dist/adapters/http/middleware/built-in/error.d.ts.map +1 -1
  164. package/dist/adapters/http/middleware/built-in/error.mjs.map +1 -1
  165. package/dist/adapters/http/middleware/built-in/index.d.ts +1 -4
  166. package/dist/adapters/http/middleware/built-in/index.d.ts.map +1 -1
  167. package/dist/adapters/http/middleware/built-in/index.mjs +3 -4
  168. package/dist/adapters/http/middleware/built-in/internal-http-client.d.ts +17 -0
  169. package/dist/adapters/http/middleware/built-in/internal-http-client.d.ts.map +1 -0
  170. package/dist/adapters/http/middleware/built-in/internal-http-client.mjs +27 -0
  171. package/dist/adapters/http/middleware/built-in/internal-http-client.mjs.map +1 -0
  172. package/dist/adapters/http/middleware/built-in/logger.mjs +1 -1
  173. package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
  174. package/dist/adapters/http/middleware/built-in/prometheus.d.ts +6 -5
  175. package/dist/adapters/http/middleware/built-in/prometheus.d.ts.map +1 -1
  176. package/dist/adapters/http/middleware/built-in/prometheus.mjs +3 -2
  177. package/dist/adapters/http/middleware/built-in/prometheus.mjs.map +1 -1
  178. package/dist/adapters/http/middleware/built-in/rate-limit.d.ts +2 -2
  179. package/dist/adapters/http/middleware/built-in/rate-limit.d.ts.map +1 -1
  180. package/dist/adapters/http/middleware/built-in/rate-limit.mjs +15 -0
  181. package/dist/adapters/http/middleware/built-in/rate-limit.mjs.map +1 -1
  182. package/dist/adapters/http/middleware/index.mjs +3 -4
  183. package/dist/adapters/http/request/constants.d.ts +1 -1
  184. package/dist/adapters/http/request/constants.d.ts.map +1 -1
  185. package/dist/adapters/http/request/constants.mjs +1 -5
  186. package/dist/adapters/http/request/constants.mjs.map +1 -1
  187. package/dist/adapters/http/request/helpers/index.d.ts +1 -1
  188. package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
  189. package/dist/adapters/http/request/helpers/index.mjs +2 -2
  190. package/dist/adapters/http/request/helpers/locale.d.ts +2 -1
  191. package/dist/adapters/http/request/helpers/locale.d.ts.map +1 -1
  192. package/dist/adapters/http/request/helpers/locale.mjs +1 -1
  193. package/dist/adapters/http/request/helpers/locale.mjs.map +1 -1
  194. package/dist/adapters/http/request/helpers/same-origin.d.ts +38 -0
  195. package/dist/adapters/http/request/helpers/same-origin.d.ts.map +1 -0
  196. package/dist/adapters/http/request/helpers/same-origin.mjs +68 -0
  197. package/dist/adapters/http/request/helpers/same-origin.mjs.map +1 -0
  198. package/dist/adapters/http/request/index.mjs +2 -2
  199. package/dist/adapters/http/request/permission/module.mjs +1 -1
  200. package/dist/adapters/http/request/permission/module.mjs.map +1 -1
  201. package/dist/adapters/http/request/types.d.ts +1 -2
  202. package/dist/adapters/http/request/types.d.ts.map +1 -1
  203. package/dist/adapters/shared/ldap/module.d.ts.map +1 -1
  204. package/dist/adapters/shared/ldap/module.mjs +4 -1
  205. package/dist/adapters/shared/ldap/module.mjs.map +1 -1
  206. package/dist/app/builder.d.ts +4 -4
  207. package/dist/app/builder.d.ts.map +1 -1
  208. package/dist/app/builder.mjs +7 -4
  209. package/dist/app/builder.mjs.map +1 -1
  210. package/dist/app/factory.d.ts +10 -0
  211. package/dist/app/factory.d.ts.map +1 -1
  212. package/dist/app/factory.mjs +26 -2
  213. package/dist/app/factory.mjs.map +1 -1
  214. package/dist/app/index.mjs +17 -19
  215. package/dist/app/modules/authentication/module.d.ts.map +1 -1
  216. package/dist/app/modules/authentication/module.mjs +15 -2
  217. package/dist/app/modules/authentication/module.mjs.map +1 -1
  218. package/dist/app/modules/authentication/repositories/session.d.ts +4 -1
  219. package/dist/app/modules/authentication/repositories/session.d.ts.map +1 -1
  220. package/dist/app/modules/authentication/repositories/session.mjs +20 -3
  221. package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
  222. package/dist/app/modules/components/index.d.ts +1 -0
  223. package/dist/app/modules/components/index.d.ts.map +1 -1
  224. package/dist/app/modules/components/module.d.ts +3 -1
  225. package/dist/app/modules/components/module.d.ts.map +1 -1
  226. package/dist/app/modules/components/module.mjs +26 -7
  227. package/dist/app/modules/components/module.mjs.map +1 -1
  228. package/dist/app/modules/components/types.d.ts +11 -0
  229. package/dist/app/modules/components/types.d.ts.map +1 -0
  230. package/dist/app/modules/config/app-origins.d.ts +10 -0
  231. package/dist/app/modules/config/app-origins.d.ts.map +1 -0
  232. package/dist/app/modules/config/app-origins.mjs +21 -0
  233. package/dist/app/modules/config/app-origins.mjs.map +1 -0
  234. package/dist/app/modules/config/constants.d.ts +23 -50
  235. package/dist/app/modules/config/constants.d.ts.map +1 -1
  236. package/dist/app/modules/config/constants.mjs +34 -51
  237. package/dist/app/modules/config/constants.mjs.map +1 -1
  238. package/dist/app/modules/config/index.d.ts +2 -3
  239. package/dist/app/modules/config/index.d.ts.map +1 -1
  240. package/dist/app/modules/config/index.mjs +4 -8
  241. package/dist/app/modules/config/module.d.ts +2 -2
  242. package/dist/app/modules/config/module.d.ts.map +1 -1
  243. package/dist/app/modules/config/module.mjs +1 -1
  244. package/dist/app/modules/config/module.mjs.map +1 -1
  245. package/dist/app/modules/config/read.d.ts +29 -0
  246. package/dist/app/modules/config/read.d.ts.map +1 -0
  247. package/dist/app/modules/config/read.mjs +65 -0
  248. package/dist/app/modules/config/read.mjs.map +1 -0
  249. package/dist/app/modules/config/types.d.ts +30 -405
  250. package/dist/app/modules/config/types.d.ts.map +1 -1
  251. package/dist/app/modules/config/validator.d.ts.map +1 -1
  252. package/dist/app/modules/config/validator.mjs +3 -87
  253. package/dist/app/modules/config/validator.mjs.map +1 -1
  254. package/dist/app/modules/database/index.d.ts +1 -0
  255. package/dist/app/modules/database/index.d.ts.map +1 -1
  256. package/dist/app/modules/database/index.mjs +2 -1
  257. package/dist/app/modules/database/migration.d.ts +33 -0
  258. package/dist/app/modules/database/migration.d.ts.map +1 -0
  259. package/dist/app/modules/database/migration.mjs +52 -0
  260. package/dist/app/modules/database/migration.mjs.map +1 -0
  261. package/dist/app/modules/database/module.d.ts.map +1 -1
  262. package/dist/app/modules/database/module.mjs +12 -6
  263. package/dist/app/modules/database/module.mjs.map +1 -1
  264. package/dist/app/modules/database/repositories/client/repository.d.ts +6 -1
  265. package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
  266. package/dist/app/modules/database/repositories/client/repository.mjs +21 -4
  267. package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
  268. package/dist/app/modules/database/repositories/event/repository.d.ts +29 -2
  269. package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -1
  270. package/dist/app/modules/database/repositories/event/repository.mjs +42 -24
  271. package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -1
  272. package/dist/app/modules/database/repositories/helpers.d.ts +24 -1
  273. package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
  274. package/dist/app/modules/database/repositories/helpers.mjs +38 -1
  275. package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
  276. package/dist/app/modules/database/repositories/identity-provider/repository.mjs +1 -1
  277. package/dist/app/modules/database/repositories/identity-provider-account/repository.mjs +4 -2
  278. package/dist/app/modules/database/repositories/identity-provider-account/repository.mjs.map +1 -1
  279. package/dist/app/modules/database/repositories/key/repository.mjs +1 -1
  280. package/dist/app/modules/database/repositories/permission/repository.mjs +1 -1
  281. package/dist/app/modules/database/repositories/policy/repository.mjs +1 -1
  282. package/dist/app/modules/database/repositories/role/repository.mjs +1 -1
  283. package/dist/app/modules/database/repositories/scope/repository.mjs +1 -1
  284. package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +1 -1
  285. package/dist/app/modules/database/repositories/user/repository.d.ts +7 -2
  286. package/dist/app/modules/database/repositories/user/repository.d.ts.map +1 -1
  287. package/dist/app/modules/database/repositories/user/repository.mjs +21 -4
  288. package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
  289. package/dist/app/modules/http/constants.d.ts +3 -1
  290. package/dist/app/modules/http/constants.d.ts.map +1 -1
  291. package/dist/app/modules/http/constants.mjs +3 -2
  292. package/dist/app/modules/http/constants.mjs.map +1 -1
  293. package/dist/app/modules/http/module.d.ts +30 -9
  294. package/dist/app/modules/http/module.d.ts.map +1 -1
  295. package/dist/app/modules/http/module.mjs +31 -33
  296. package/dist/app/modules/http/module.mjs.map +1 -1
  297. package/dist/app/modules/http/modules/controller.d.ts +4 -3
  298. package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
  299. package/dist/app/modules/http/modules/controller.mjs +65 -36
  300. package/dist/app/modules/http/modules/controller.mjs.map +1 -1
  301. package/dist/app/modules/http/modules/middleware.d.ts +13 -22
  302. package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
  303. package/dist/app/modules/http/modules/middleware.mjs +20 -36
  304. package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
  305. package/dist/app/modules/identity/module.mjs +4 -4
  306. package/dist/app/modules/identity/repositories/client.mjs +4 -2
  307. package/dist/app/modules/identity/repositories/client.mjs.map +1 -1
  308. package/dist/app/modules/identity/repositories/user.mjs +4 -2
  309. package/dist/app/modules/identity/repositories/user.mjs.map +1 -1
  310. package/dist/app/modules/index.mjs +21 -23
  311. package/dist/app/modules/logger/module.mjs +1 -1
  312. package/dist/app/modules/logger/module.mjs.map +1 -1
  313. package/dist/app/modules/mail/module.d.ts.map +1 -1
  314. package/dist/app/modules/mail/module.mjs.map +1 -1
  315. package/dist/app/modules/oauth2/constants.d.ts +2 -1
  316. package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
  317. package/dist/app/modules/oauth2/constants.mjs +1 -0
  318. package/dist/app/modules/oauth2/constants.mjs.map +1 -1
  319. package/dist/app/modules/oauth2/module.d.ts.map +1 -1
  320. package/dist/app/modules/oauth2/module.mjs +9 -4
  321. package/dist/app/modules/oauth2/module.mjs.map +1 -1
  322. package/dist/app/modules/oauth2/repositories/client/repository.mjs +4 -2
  323. package/dist/app/modules/oauth2/repositories/client/repository.mjs.map +1 -1
  324. package/dist/app/modules/oauth2/repositories/consent/repository.d.ts.map +1 -1
  325. package/dist/app/modules/oauth2/repositories/consent/repository.mjs +3 -2
  326. package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -1
  327. package/dist/app/modules/oauth2/repositories/console-login/index.d.ts +2 -0
  328. package/dist/app/modules/oauth2/repositories/console-login/index.d.ts.map +1 -0
  329. package/dist/app/modules/oauth2/repositories/console-login/index.mjs +5 -0
  330. package/dist/app/modules/oauth2/repositories/console-login/store.d.ts +19 -0
  331. package/dist/app/modules/oauth2/repositories/console-login/store.d.ts.map +1 -0
  332. package/dist/app/modules/oauth2/repositories/console-login/store.mjs +47 -0
  333. package/dist/app/modules/oauth2/repositories/console-login/store.mjs.map +1 -0
  334. package/dist/app/modules/oauth2/repositories/constants.d.ts +1 -0
  335. package/dist/app/modules/oauth2/repositories/constants.d.ts.map +1 -1
  336. package/dist/app/modules/oauth2/repositories/constants.mjs +1 -0
  337. package/dist/app/modules/oauth2/repositories/constants.mjs.map +1 -1
  338. package/dist/app/modules/oauth2/repositories/index.d.ts +1 -0
  339. package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
  340. package/dist/app/modules/oauth2/repositories/index.mjs +3 -1
  341. package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts +2 -2
  342. package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts.map +1 -1
  343. package/dist/app/modules/oauth2/repositories/session-token/repository.mjs +5 -3
  344. package/dist/app/modules/oauth2/repositories/session-token/repository.mjs.map +1 -1
  345. package/dist/app/modules/provisioning/module.d.ts.map +1 -1
  346. package/dist/app/modules/provisioning/module.mjs +5 -6
  347. package/dist/app/modules/provisioning/module.mjs.map +1 -1
  348. package/dist/app/modules/provisioning/sources/composite/module.d.ts.map +1 -1
  349. package/dist/app/modules/provisioning/sources/composite/module.mjs +2 -1
  350. package/dist/app/modules/provisioning/sources/composite/module.mjs.map +1 -1
  351. package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
  352. package/dist/app/modules/provisioning/sources/default/module.mjs +2 -1
  353. package/dist/app/modules/provisioning/sources/default/module.mjs.map +1 -1
  354. package/dist/app/modules/runtime/module.d.ts.map +1 -1
  355. package/dist/app/modules/runtime/module.mjs +2 -1
  356. package/dist/app/modules/runtime/module.mjs.map +1 -1
  357. package/dist/app/types.d.ts +16 -0
  358. package/dist/app/types.d.ts.map +1 -1
  359. package/dist/cli/commands/config.d.ts +40 -0
  360. package/dist/cli/commands/config.d.ts.map +1 -0
  361. package/dist/cli/commands/config.mjs +65 -0
  362. package/dist/cli/commands/config.mjs.map +1 -0
  363. package/dist/cli/commands/healthcheck.d.ts +3 -2
  364. package/dist/cli/commands/healthcheck.d.ts.map +1 -1
  365. package/dist/cli/commands/healthcheck.mjs +6 -3
  366. package/dist/cli/commands/healthcheck.mjs.map +1 -1
  367. package/dist/cli/commands/index.d.ts +3 -0
  368. package/dist/cli/commands/index.d.ts.map +1 -1
  369. package/dist/cli/commands/index.mjs +3 -1
  370. package/dist/cli/commands/migration.d.ts +3 -10
  371. package/dist/cli/commands/migration.d.ts.map +1 -1
  372. package/dist/cli/commands/migration.mjs +17 -9
  373. package/dist/cli/commands/migration.mjs.map +1 -1
  374. package/dist/cli/commands/shutdown.d.ts +16 -0
  375. package/dist/cli/commands/shutdown.d.ts.map +1 -0
  376. package/dist/cli/commands/shutdown.mjs +41 -0
  377. package/dist/cli/commands/shutdown.mjs.map +1 -0
  378. package/dist/cli/commands/start.d.ts +3 -2
  379. package/dist/cli/commands/start.d.ts.map +1 -1
  380. package/dist/cli/commands/start.mjs +3 -21
  381. package/dist/cli/commands/start.mjs.map +1 -1
  382. package/dist/cli/commands/types.d.ts.map +1 -0
  383. package/dist/cli/index.d.ts +8 -0
  384. package/dist/cli/index.d.ts.map +1 -1
  385. package/dist/cli/index.mjs.map +1 -1
  386. package/dist/cli/module.d.ts +0 -2
  387. package/dist/cli/module.d.ts.map +1 -1
  388. package/dist/cli/module.mjs +4 -3
  389. package/dist/cli/module.mjs.map +1 -1
  390. package/dist/components/oauth2-cleaner/module.d.ts +2 -2
  391. package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
  392. package/dist/components/oauth2-cleaner/module.mjs +10 -7
  393. package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
  394. package/dist/core/authentication/index.mjs +2 -1
  395. package/dist/core/authentication/session/constants.d.ts +10 -0
  396. package/dist/core/authentication/session/constants.d.ts.map +1 -0
  397. package/dist/core/authentication/session/constants.mjs +16 -0
  398. package/dist/core/authentication/session/constants.mjs.map +1 -0
  399. package/dist/core/authentication/session/index.d.ts +1 -0
  400. package/dist/core/authentication/session/index.d.ts.map +1 -1
  401. package/dist/core/authentication/session/index.mjs +2 -1
  402. package/dist/core/authentication/session/module.d.ts +2 -1
  403. package/dist/core/authentication/session/module.d.ts.map +1 -1
  404. package/dist/core/authentication/session/module.mjs +7 -1
  405. package/dist/core/authentication/session/module.mjs.map +1 -1
  406. package/dist/core/authentication/session/types.d.ts +70 -1
  407. package/dist/core/authentication/session/types.d.ts.map +1 -1
  408. package/dist/core/authentication/session/types.mjs.map +1 -1
  409. package/dist/core/entities/client/schema.d.ts.map +1 -1
  410. package/dist/core/entities/client/schema.mjs +1 -2
  411. package/dist/core/entities/client/schema.mjs.map +1 -1
  412. package/dist/core/entities/client/service.d.ts.map +1 -1
  413. package/dist/core/entities/client/service.mjs +15 -1
  414. package/dist/core/entities/client/service.mjs.map +1 -1
  415. package/dist/core/entities/client/system-clients.d.ts +0 -5
  416. package/dist/core/entities/client/system-clients.d.ts.map +1 -1
  417. package/dist/core/entities/client/system-clients.mjs +0 -6
  418. package/dist/core/entities/client/system-clients.mjs.map +1 -1
  419. package/dist/core/entities/client/types.d.ts +12 -0
  420. package/dist/core/entities/client/types.d.ts.map +1 -1
  421. package/dist/core/entities/client-permission/service.mjs +1 -1
  422. package/dist/core/entities/client-permission/service.mjs.map +1 -1
  423. package/dist/core/entities/event/constants.d.ts +1 -6
  424. package/dist/core/entities/event/constants.d.ts.map +1 -1
  425. package/dist/core/entities/event/constants.mjs +1 -5
  426. package/dist/core/entities/event/constants.mjs.map +1 -1
  427. package/dist/core/entities/event/entity-event-handler.d.ts.map +1 -1
  428. package/dist/core/entities/event/entity-event-handler.mjs +3 -2
  429. package/dist/core/entities/event/entity-event-handler.mjs.map +1 -1
  430. package/dist/core/entities/event/service.d.ts.map +1 -1
  431. package/dist/core/entities/event/service.mjs +3 -3
  432. package/dist/core/entities/event/service.mjs.map +1 -1
  433. package/dist/core/entities/event/types.d.ts +15 -1
  434. package/dist/core/entities/event/types.d.ts.map +1 -1
  435. package/dist/core/entities/permission/service.mjs +1 -2
  436. package/dist/core/entities/permission/service.mjs.map +1 -1
  437. package/dist/core/entities/role-permission/service.mjs +1 -1
  438. package/dist/core/entities/role-permission/service.mjs.map +1 -1
  439. package/dist/core/entities/session/service.d.ts +13 -1
  440. package/dist/core/entities/session/service.d.ts.map +1 -1
  441. package/dist/core/entities/session/service.mjs +19 -16
  442. package/dist/core/entities/session/service.mjs.map +1 -1
  443. package/dist/core/entities/user/schema.d.ts.map +1 -1
  444. package/dist/core/entities/user/schema.mjs +1 -0
  445. package/dist/core/entities/user/schema.mjs.map +1 -1
  446. package/dist/core/entities/user/service.d.ts.map +1 -1
  447. package/dist/core/entities/user/service.mjs +21 -1
  448. package/dist/core/entities/user/service.mjs.map +1 -1
  449. package/dist/core/entities/user/types.d.ts +12 -0
  450. package/dist/core/entities/user/types.d.ts.map +1 -1
  451. package/dist/core/entities/user-permission/service.mjs +1 -1
  452. package/dist/core/entities/user-permission/service.mjs.map +1 -1
  453. package/dist/core/identity/permission/junction-grant.mjs +1 -1
  454. package/dist/core/identity/permission/junction-grant.mjs.map +1 -1
  455. package/dist/core/identity/provider/account/module.mjs +1 -1
  456. package/dist/core/identity/provider/account/module.mjs.map +1 -1
  457. package/dist/core/identity/provider/authentication/protocols/oauth2/assurance.mjs +1 -1
  458. package/dist/core/identity/provider/authentication/protocols/oauth2/assurance.mjs.map +1 -1
  459. package/dist/core/identity/registration/service.d.ts.map +1 -1
  460. package/dist/core/identity/registration/service.mjs +2 -1
  461. package/dist/core/identity/registration/service.mjs.map +1 -1
  462. package/dist/core/index.mjs +11 -3
  463. package/dist/core/oauth2/authorization/helpers.d.ts +14 -0
  464. package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
  465. package/dist/core/oauth2/authorization/helpers.mjs +9 -1
  466. package/dist/core/oauth2/authorization/helpers.mjs.map +1 -1
  467. package/dist/core/oauth2/authorization/index.mjs +2 -2
  468. package/dist/core/oauth2/authorization/module.mjs +1 -1
  469. package/dist/core/oauth2/authorization/module.mjs.map +1 -1
  470. package/dist/core/oauth2/backchannel-logout/constants.d.ts +16 -0
  471. package/dist/core/oauth2/backchannel-logout/constants.d.ts.map +1 -0
  472. package/dist/core/oauth2/backchannel-logout/constants.mjs +20 -0
  473. package/dist/core/oauth2/backchannel-logout/constants.mjs.map +1 -0
  474. package/dist/core/oauth2/backchannel-logout/index.d.ts +4 -0
  475. package/dist/core/oauth2/backchannel-logout/index.d.ts.map +1 -0
  476. package/dist/core/oauth2/backchannel-logout/index.mjs +6 -0
  477. package/dist/core/oauth2/backchannel-logout/module.d.ts +26 -0
  478. package/dist/core/oauth2/backchannel-logout/module.d.ts.map +1 -0
  479. package/dist/core/oauth2/backchannel-logout/module.mjs +78 -0
  480. package/dist/core/oauth2/backchannel-logout/module.mjs.map +1 -0
  481. package/dist/core/oauth2/backchannel-logout/types.d.ts +29 -0
  482. package/dist/core/oauth2/backchannel-logout/types.d.ts.map +1 -0
  483. package/dist/core/oauth2/console-login/constants.d.ts +19 -0
  484. package/dist/core/oauth2/console-login/constants.d.ts.map +1 -0
  485. package/dist/core/oauth2/console-login/constants.mjs +24 -0
  486. package/dist/core/oauth2/console-login/constants.mjs.map +1 -0
  487. package/dist/core/oauth2/console-login/index.d.ts +3 -0
  488. package/dist/core/oauth2/console-login/index.d.ts.map +1 -0
  489. package/dist/core/oauth2/console-login/index.mjs +5 -0
  490. package/dist/core/oauth2/console-login/types.d.ts +53 -0
  491. package/dist/core/oauth2/console-login/types.d.ts.map +1 -0
  492. package/dist/core/oauth2/end-session/service.mjs +1 -1
  493. package/dist/core/oauth2/end-session/service.mjs.map +1 -1
  494. package/dist/core/oauth2/federated-login/module.mjs +3 -3
  495. package/dist/core/oauth2/federated-login/module.mjs.map +1 -1
  496. package/dist/core/oauth2/index.d.ts +4 -0
  497. package/dist/core/oauth2/index.d.ts.map +1 -1
  498. package/dist/core/oauth2/index.mjs +13 -3
  499. package/dist/core/oauth2/introspection/index.d.ts +3 -0
  500. package/dist/core/oauth2/introspection/index.d.ts.map +1 -0
  501. package/dist/core/oauth2/introspection/index.mjs +5 -0
  502. package/dist/core/oauth2/introspection/module.d.ts +14 -0
  503. package/dist/core/oauth2/introspection/module.d.ts.map +1 -0
  504. package/dist/core/oauth2/introspection/module.mjs +49 -0
  505. package/dist/core/oauth2/introspection/module.mjs.map +1 -0
  506. package/dist/core/oauth2/introspection/types.d.ts +45 -0
  507. package/dist/core/oauth2/introspection/types.d.ts.map +1 -0
  508. package/dist/core/oauth2/introspection/types.mjs +4 -0
  509. package/dist/core/oauth2/openid/claims.d.ts +20 -2
  510. package/dist/core/oauth2/openid/claims.d.ts.map +1 -1
  511. package/dist/core/oauth2/openid/claims.mjs +18 -4
  512. package/dist/core/oauth2/openid/claims.mjs.map +1 -1
  513. package/dist/core/oauth2/session-credential/constants.d.ts +30 -0
  514. package/dist/core/oauth2/session-credential/constants.d.ts.map +1 -0
  515. package/dist/core/oauth2/session-credential/constants.mjs +34 -0
  516. package/dist/core/oauth2/session-credential/constants.mjs.map +1 -0
  517. package/dist/core/oauth2/session-credential/index.d.ts +3 -0
  518. package/dist/core/oauth2/session-credential/index.d.ts.map +1 -0
  519. package/dist/core/oauth2/session-credential/index.mjs +6 -0
  520. package/dist/core/oauth2/session-credential/module.d.ts +31 -0
  521. package/dist/core/oauth2/session-credential/module.d.ts.map +1 -0
  522. package/dist/core/oauth2/session-credential/module.mjs +43 -0
  523. package/dist/core/oauth2/session-credential/module.mjs.map +1 -0
  524. package/dist/core/oauth2/session-token/constants.d.ts +10 -0
  525. package/dist/core/oauth2/session-token/constants.d.ts.map +1 -0
  526. package/dist/core/oauth2/session-token/constants.mjs +16 -0
  527. package/dist/core/oauth2/session-token/constants.mjs.map +1 -0
  528. package/dist/core/oauth2/session-token/index.d.ts +1 -0
  529. package/dist/core/oauth2/session-token/index.d.ts.map +1 -1
  530. package/dist/core/oauth2/session-token/index.mjs +2 -1
  531. package/dist/core/oauth2/session-token/types.d.ts +13 -2
  532. package/dist/core/oauth2/session-token/types.d.ts.map +1 -1
  533. package/dist/core/provisioning/merge/module.mjs +5 -3
  534. package/dist/core/provisioning/merge/module.mjs.map +1 -1
  535. package/dist/core/query/module.mjs +1 -1
  536. package/dist/core/query/module.mjs.map +1 -1
  537. package/dist/core/security/policy/evaluator.mjs +1 -1
  538. package/dist/core/security/policy/evaluator.mjs.map +1 -1
  539. package/dist/index.mjs +62 -59
  540. package/dist/path.mjs +1 -1
  541. package/dist/swagger.json +466 -104
  542. package/dist/utils/error.d.ts +6 -0
  543. package/dist/utils/error.d.ts.map +1 -1
  544. package/dist/utils/error.mjs +6 -2
  545. package/dist/utils/error.mjs.map +1 -1
  546. package/dist/utils/index.mjs +2 -2
  547. package/package.json +31 -25
  548. package/dist/adapters/http/middleware/built-in/assets.d.ts +0 -11
  549. package/dist/adapters/http/middleware/built-in/assets.d.ts.map +0 -1
  550. package/dist/adapters/http/middleware/built-in/assets.mjs +0 -91
  551. package/dist/adapters/http/middleware/built-in/assets.mjs.map +0 -1
  552. package/dist/adapters/http/middleware/built-in/theme.d.ts +0 -15
  553. package/dist/adapters/http/middleware/built-in/theme.d.ts.map +0 -1
  554. package/dist/adapters/http/middleware/built-in/theme.mjs +0 -27
  555. package/dist/adapters/http/middleware/built-in/theme.mjs.map +0 -1
  556. package/dist/adapters/http/middleware/built-in/types.d.ts +0 -14
  557. package/dist/adapters/http/middleware/built-in/types.d.ts.map +0 -1
  558. package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +0 -15
  559. package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts.map +0 -1
  560. package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +0 -25
  561. package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +0 -1
  562. package/dist/adapters/http/request/helpers/redirect.d.ts +0 -14
  563. package/dist/adapters/http/request/helpers/redirect.d.ts.map +0 -1
  564. package/dist/adapters/http/request/helpers/redirect.mjs +0 -36
  565. package/dist/adapters/http/request/helpers/redirect.mjs.map +0 -1
  566. package/dist/adapters/http/ui/account-console/index.d.ts +0 -4
  567. package/dist/adapters/http/ui/account-console/index.d.ts.map +0 -1
  568. package/dist/adapters/http/ui/account-console/index.mjs +0 -6
  569. package/dist/adapters/http/ui/account-console/module.d.ts +0 -28
  570. package/dist/adapters/http/ui/account-console/module.d.ts.map +0 -1
  571. package/dist/adapters/http/ui/account-console/module.mjs +0 -80
  572. package/dist/adapters/http/ui/account-console/module.mjs.map +0 -1
  573. package/dist/adapters/http/ui/account-console/ref.d.ts +0 -30
  574. package/dist/adapters/http/ui/account-console/ref.d.ts.map +0 -1
  575. package/dist/adapters/http/ui/account-console/ref.mjs +0 -50
  576. package/dist/adapters/http/ui/account-console/ref.mjs.map +0 -1
  577. package/dist/adapters/http/ui/account-console/types.d.ts +0 -11
  578. package/dist/adapters/http/ui/account-console/types.d.ts.map +0 -1
  579. package/dist/adapters/http/ui/auth-console/http-client.d.ts +0 -22
  580. package/dist/adapters/http/ui/auth-console/http-client.d.ts.map +0 -1
  581. package/dist/adapters/http/ui/auth-console/http-client.mjs.map +0 -1
  582. package/dist/adapters/http/ui/auth-console/index.d.ts +0 -6
  583. package/dist/adapters/http/ui/auth-console/index.d.ts.map +0 -1
  584. package/dist/adapters/http/ui/auth-console/index.mjs +0 -8
  585. package/dist/adapters/http/ui/auth-console/module.d.ts +0 -4
  586. package/dist/adapters/http/ui/auth-console/module.d.ts.map +0 -1
  587. package/dist/adapters/http/ui/auth-console/module.mjs +0 -73
  588. package/dist/adapters/http/ui/auth-console/module.mjs.map +0 -1
  589. package/dist/adapters/http/ui/auth-console/resolve.d.ts +0 -21
  590. package/dist/adapters/http/ui/auth-console/resolve.d.ts.map +0 -1
  591. package/dist/adapters/http/ui/auth-console/resolve.mjs +0 -53
  592. package/dist/adapters/http/ui/auth-console/resolve.mjs.map +0 -1
  593. package/dist/adapters/http/ui/auth-console/serve.d.ts +0 -9
  594. package/dist/adapters/http/ui/auth-console/serve.d.ts.map +0 -1
  595. package/dist/adapters/http/ui/auth-console/serve.mjs +0 -35
  596. package/dist/adapters/http/ui/auth-console/serve.mjs.map +0 -1
  597. package/dist/adapters/http/ui/auth-console/types.d.ts +0 -26
  598. package/dist/adapters/http/ui/auth-console/types.d.ts.map +0 -1
  599. package/dist/adapters/http/ui/console-packages/index.d.ts.map +0 -1
  600. package/dist/adapters/http/ui/console-packages/index.mjs +0 -5
  601. package/dist/adapters/http/ui/console-packages/module.d.ts +0 -33
  602. package/dist/adapters/http/ui/console-packages/module.d.ts.map +0 -1
  603. package/dist/adapters/http/ui/console-packages/module.mjs +0 -70
  604. package/dist/adapters/http/ui/console-packages/module.mjs.map +0 -1
  605. package/dist/adapters/http/ui/console-packages/types.d.ts +0 -12
  606. package/dist/adapters/http/ui/console-packages/types.d.ts.map +0 -1
  607. package/dist/adapters/http/ui/index.d.ts +0 -6
  608. package/dist/adapters/http/ui/index.d.ts.map +0 -1
  609. package/dist/adapters/http/ui/index.mjs +0 -25
  610. package/dist/adapters/http/ui/shared/html.d.ts +0 -76
  611. package/dist/adapters/http/ui/shared/html.d.ts.map +0 -1
  612. package/dist/adapters/http/ui/shared/html.mjs +0 -104
  613. package/dist/adapters/http/ui/shared/html.mjs.map +0 -1
  614. package/dist/adapters/http/ui/shared/index.d.ts +0 -2
  615. package/dist/adapters/http/ui/shared/index.d.ts.map +0 -1
  616. package/dist/adapters/http/ui/shared/index.mjs +0 -5
  617. package/dist/adapters/http/ui/theme/apply.d.ts +0 -12
  618. package/dist/adapters/http/ui/theme/apply.d.ts.map +0 -1
  619. package/dist/adapters/http/ui/theme/apply.mjs +0 -29
  620. package/dist/adapters/http/ui/theme/apply.mjs.map +0 -1
  621. package/dist/adapters/http/ui/theme/assets.d.ts +0 -20
  622. package/dist/adapters/http/ui/theme/assets.d.ts.map +0 -1
  623. package/dist/adapters/http/ui/theme/assets.mjs +0 -86
  624. package/dist/adapters/http/ui/theme/assets.mjs.map +0 -1
  625. package/dist/adapters/http/ui/theme/constants.d.ts +0 -16
  626. package/dist/adapters/http/ui/theme/constants.d.ts.map +0 -1
  627. package/dist/adapters/http/ui/theme/constants.mjs +0 -20
  628. package/dist/adapters/http/ui/theme/constants.mjs.map +0 -1
  629. package/dist/adapters/http/ui/theme/contract/constants.d.ts +0 -120
  630. package/dist/adapters/http/ui/theme/contract/constants.d.ts.map +0 -1
  631. package/dist/adapters/http/ui/theme/contract/constants.mjs +0 -136
  632. package/dist/adapters/http/ui/theme/contract/constants.mjs.map +0 -1
  633. package/dist/adapters/http/ui/theme/contract/head.d.ts +0 -12
  634. package/dist/adapters/http/ui/theme/contract/head.d.ts.map +0 -1
  635. package/dist/adapters/http/ui/theme/contract/head.mjs +0 -61
  636. package/dist/adapters/http/ui/theme/contract/head.mjs.map +0 -1
  637. package/dist/adapters/http/ui/theme/contract/index.d.ts +0 -6
  638. package/dist/adapters/http/ui/theme/contract/index.d.ts.map +0 -1
  639. package/dist/adapters/http/ui/theme/contract/index.mjs +0 -8
  640. package/dist/adapters/http/ui/theme/contract/manifest.d.ts +0 -25
  641. package/dist/adapters/http/ui/theme/contract/manifest.d.ts.map +0 -1
  642. package/dist/adapters/http/ui/theme/contract/manifest.mjs +0 -77
  643. package/dist/adapters/http/ui/theme/contract/manifest.mjs.map +0 -1
  644. package/dist/adapters/http/ui/theme/contract/types.d.ts +0 -26
  645. package/dist/adapters/http/ui/theme/contract/types.d.ts.map +0 -1
  646. package/dist/adapters/http/ui/theme/contract/utils.d.ts +0 -11
  647. package/dist/adapters/http/ui/theme/contract/utils.d.ts.map +0 -1
  648. package/dist/adapters/http/ui/theme/contract/utils.mjs +0 -22
  649. package/dist/adapters/http/ui/theme/contract/utils.mjs.map +0 -1
  650. package/dist/adapters/http/ui/theme/index.d.ts +0 -7
  651. package/dist/adapters/http/ui/theme/index.d.ts.map +0 -1
  652. package/dist/adapters/http/ui/theme/index.mjs +0 -13
  653. package/dist/adapters/http/ui/theme/module.d.ts +0 -79
  654. package/dist/adapters/http/ui/theme/module.d.ts.map +0 -1
  655. package/dist/adapters/http/ui/theme/module.mjs +0 -206
  656. package/dist/adapters/http/ui/theme/module.mjs.map +0 -1
  657. package/dist/adapters/http/ui/theme/types.d.ts +0 -42
  658. package/dist/adapters/http/ui/theme/types.d.ts.map +0 -1
  659. package/dist/app/modules/config/helpers.d.ts +0 -9
  660. package/dist/app/modules/config/helpers.d.ts.map +0 -1
  661. package/dist/app/modules/config/helpers.mjs +0 -22
  662. package/dist/app/modules/config/helpers.mjs.map +0 -1
  663. package/dist/app/modules/config/normalize.d.ts +0 -3
  664. package/dist/app/modules/config/normalize.d.ts.map +0 -1
  665. package/dist/app/modules/config/normalize.mjs +0 -117
  666. package/dist/app/modules/config/normalize.mjs.map +0 -1
  667. package/dist/app/modules/config/origins.d.ts +0 -25
  668. package/dist/app/modules/config/origins.d.ts.map +0 -1
  669. package/dist/app/modules/config/origins.mjs +0 -46
  670. package/dist/app/modules/config/origins.mjs.map +0 -1
  671. package/dist/app/modules/config/read/env.d.ts +0 -3
  672. package/dist/app/modules/config/read/env.d.ts.map +0 -1
  673. package/dist/app/modules/config/read/env.mjs +0 -139
  674. package/dist/app/modules/config/read/env.mjs.map +0 -1
  675. package/dist/app/modules/config/read/fs.d.ts +0 -3
  676. package/dist/app/modules/config/read/fs.d.ts.map +0 -1
  677. package/dist/app/modules/config/read/fs.mjs +0 -60
  678. package/dist/app/modules/config/read/fs.mjs.map +0 -1
  679. package/dist/app/modules/config/read/index.d.ts +0 -5
  680. package/dist/app/modules/config/read/index.d.ts.map +0 -1
  681. package/dist/app/modules/config/read/index.mjs +0 -7
  682. package/dist/app/modules/config/read/module.d.ts +0 -4
  683. package/dist/app/modules/config/read/module.d.ts.map +0 -1
  684. package/dist/app/modules/config/read/module.mjs +0 -29
  685. package/dist/app/modules/config/read/module.mjs.map +0 -1
  686. package/dist/app/modules/config/read/types.d.ts +0 -9
  687. package/dist/app/modules/config/read/types.d.ts.map +0 -1
  688. package/dist/app/modules/config/trust-proxy.d.ts +0 -28
  689. package/dist/app/modules/config/trust-proxy.d.ts.map +0 -1
  690. package/dist/app/modules/config/trust-proxy.mjs +0 -64
  691. package/dist/app/modules/config/trust-proxy.mjs.map +0 -1
  692. package/dist/cli/config.d.ts +0 -18
  693. package/dist/cli/config.d.ts.map +0 -1
  694. package/dist/cli/config.mjs +0 -34
  695. package/dist/cli/config.mjs.map +0 -1
  696. package/dist/cli/types.d.ts.map +0 -1
  697. package/dist/utils/host.d.ts +0 -2
  698. package/dist/utils/host.d.ts.map +0 -1
  699. package/dist/utils/host.mjs +0 -12
  700. package/dist/utils/host.mjs.map +0 -1
  701. /package/dist/adapters/http/{middleware/built-in → controllers/workflows/account}/types.mjs +0 -0
  702. /package/dist/adapters/http/{ui/console-packages → controllers/workflows/admin}/index.d.ts +0 -0
  703. /package/dist/adapters/http/{ui/account-console → controllers/workflows/admin}/types.mjs +0 -0
  704. /package/dist/adapters/http/{ui/auth-console → controllers/workflows/console-login}/types.mjs +0 -0
  705. /package/dist/adapters/http/{ui/console-packages → internal-client}/types.mjs +0 -0
  706. /package/dist/{adapters/http/ui/theme/contract → app/modules/components}/types.mjs +0 -0
  707. /package/dist/cli/{types.d.ts → commands/types.d.ts} +0 -0
  708. /package/dist/{adapters/http/ui/theme → cli/commands}/types.mjs +0 -0
  709. /package/dist/{app/modules/config/read → core/oauth2/backchannel-logout}/types.mjs +0 -0
  710. /package/dist/{cli → core/oauth2/console-login}/types.mjs +0 -0
@@ -25,7 +25,7 @@ var OAuth2OpenIDClaimsBuilder = class {
25
25
  return value;
26
26
  }],
27
27
  email: "email",
28
- email_verified: "active"
28
+ email_verified: "emailVerified"
29
29
  };
30
30
  /**
31
31
  * Build OpenID Claims form Oauth2 Identity.
@@ -41,17 +41,31 @@ var OAuth2OpenIDClaimsBuilder = class {
41
41
  fromUser(input) {
42
42
  return this.extract(this.userMap, input);
43
43
  }
44
- extract(attributeMap, attributes) {
44
+ /**
45
+ * A claim is emitted only for a value that exists AND is not nullish.
46
+ *
47
+ * The map reads entity columns, several of which are nullable, and OIDC
48
+ * models an unavailable claim as one that is not returned rather than one
49
+ * returned as `null` — so a user without a display name must omit
50
+ * `nickname`, not answer `nickname: null` (#3518). Emitting the null also
51
+ * put a JSON `null` claim value into every id_token, which no relying
52
+ * party expects.
53
+ */ extract(attributeMap, attributes) {
45
54
  const result = {};
46
55
  const keys = Object.keys(attributeMap);
47
56
  for (const key_ of keys) {
48
57
  const attribute = attributeMap[key_];
58
+ let value;
49
59
  if (typeof attribute === "string") {
50
- if (hasOwnProperty(attributes, attribute)) result[key_] = attributes[attribute];
60
+ if (!hasOwnProperty(attributes, attribute)) continue;
61
+ value = attributes[attribute];
51
62
  } else {
52
63
  const [key, transformer] = attribute;
53
- if (hasOwnProperty(attributes, key)) result[key_] = transformer(attributes[key]);
64
+ if (!hasOwnProperty(attributes, key)) continue;
65
+ value = transformer(attributes[key]);
54
66
  }
67
+ if (typeof value === "undefined" || value === null) continue;
68
+ result[key_] = value;
55
69
  }
56
70
  return result;
57
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claims.mjs","names":["hasOwnProperty","OAuth2SubKind","OAuth2OpenIDClaimsBuilder","clientMap","name","nickname","preferred_username","updated_at","value","Math","floor","Date","getTime","userMap","family_name","given_name","email","email_verified","fromIdentity","identity","type","CLIENT","fromClient","data","fromUser","input","extract","attributeMap","attributes","result","keys","Object","key_","attribute","key","transformer"],"sources":["../../../../src/core/oauth2/openid/claims.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\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 {\n Client, \n Identity, \n User,\n} from '@authup/core-kit';\nimport { hasOwnProperty } from '@authup/kit';\nimport type { OpenIDTokenPayload } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { ObjectLiteral } from 'validup';\n\ntype AttributeMapTuple<T> = {\n [K in keyof T]: [K, (value: unknown) => any]\n}[keyof T];\n\ntype AttributeMap<T extends Record<string, any>> = Record<\n keyof OpenIDTokenPayload,\nkeyof T | AttributeMapTuple<T>\n>;\n\nexport class OAuth2OpenIDClaimsBuilder {\n protected clientMap : AttributeMap<Client> = {\n name: 'name',\n nickname: 'name',\n preferred_username: 'name',\n updated_at: [\n 'updatedAt',\n (value: unknown) => {\n if (typeof value === 'string') {\n return Math.floor(new Date(value).getTime() / 1000);\n }\n\n return value;\n },\n ],\n };\n\n protected userMap : AttributeMap<User> = {\n name: 'name',\n family_name: 'lastName',\n given_name: 'firstName',\n nickname: 'displayName',\n preferred_username: 'displayName',\n updated_at: [\n 'updatedAt',\n (value: unknown) => {\n if (typeof value === 'string') {\n return Math.floor(new Date(value).getTime() / 1000);\n }\n\n return value;\n },\n ],\n\n email: 'email',\n email_verified: 'active',\n };\n\n /**\n * Build OpenID Claims form Oauth2 Identity.\n *\n * @param identity\n */\n fromIdentity(identity: Identity) : OpenIDTokenPayload {\n if (identity.type === OAuth2SubKind.CLIENT) {\n return this.fromClient(identity.data);\n }\n\n return this.fromUser(identity.data);\n }\n\n fromClient(input: Client) : OpenIDTokenPayload {\n return this.extract(this.clientMap, input);\n }\n\n fromUser(input: User) : OpenIDTokenPayload {\n return this.extract(this.userMap, input);\n }\n\n protected extract<T extends ObjectLiteral = ObjectLiteral>(\n attributeMap: AttributeMap<T>,\n attributes: T,\n ) : OpenIDTokenPayload {\n const result = {} as OpenIDTokenPayload;\n\n const keys = Object.keys(attributeMap);\n for (const key_ of keys) {\n const attribute = attributeMap[key_];\n if (typeof attribute === 'string') {\n if (hasOwnProperty(attributes, attribute)) {\n result[key_] = attributes[attribute];\n }\n } else {\n const [key, transformer] = attribute as AttributeMapTuple<T>;\n\n if (hasOwnProperty(att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AC3BL,OAAOG,QAAQG,YAAYP,WAAWM,IAAI;GAElD;EACJ;EAEA,OAAOL;CACX;AACJ"}
1
+ {"version":3,"file":"claims.mjs","names":["hasOwnProperty","OAuth2SubKind","OAuth2OpenIDClaimsBuilder","clientMap","name","nickname","preferred_username","updated_at","value","Math","floor","Date","getTime","userMap","family_name","given_name","email","email_verified","fromIdentity","identity","type","CLIENT","fromClient","data","fromUser","input","extract","attributeMap","attributes","result","keys","Object","key_","attribute","key","transformer"],"sources":["../../../../src/core/oauth2/openid/claims.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\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 {\n Client, \n Identity, \n User,\n} from '@authup/core-kit';\nimport { hasOwnProperty } from '@authup/kit';\nimport type { OpenIDClaims, OpenIDTokenPayload } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { ObjectLiteral } from 'validup';\n\ntype AttributeMapTuple<T> = {\n [K in keyof T]: [K, (value: unknown) => any]\n}[keyof T];\n\n/**\n * Keyed on `OpenIDClaims`, never on `OpenIDTokenPayload`: the latter inherits\n * `JWTClaims`' `[key: string]: any`, so `keyof` collapses to `string | number`\n * and the map accepts any claim name at all — a typo compiles and the claim is\n * simply never emitted, which is the failure mode #3518 is about. `OpenIDClaims`\n * carries no index signature, so a name that is not a claim fails the build.\n * `Partial`, because a map declares only the claims its entity can supply.\n */\ntype AttributeMap<T extends Record<string, any>> = Partial<Record<\n keyof OpenIDClaims,\nkeyof T | AttributeMapTuple<T>\n>>;\n\nexport class OAuth2OpenIDClaimsBuilder {\n protected clientMap : AttributeMap<Client> = {\n name: 'name',\n nickname: 'name',\n preferred_username: 'name',\n updated_at: [\n 'updatedAt',\n (value: unknown) => {\n if (typeof value === 'string') {\n return Math.floor(new Date(value).getTime() / 1000);\n }\n\n return value;\n },\n ],\n };\n\n protected userMap : AttributeMap<User> = {\n name: 'name',\n family_name: 'lastName',\n given_name: 'firstName',\n nickname: 'displayName',\n preferred_username: 'displayName',\n updated_at: [\n 'updatedAt',\n (value: unknown) => {\n if (typeof value === 'string') {\n return Math.floor(new Date(value).getTime() / 1000);\n }\n\n return value;\n },\n ],\n\n email: 'email',\n email_verified: 'emailVerified',\n };\n\n /**\n * Build OpenID Claims form Oauth2 Identity.\n *\n * @param identity\n */\n fromIdentity(identity: Identity) : OpenIDTokenPayload {\n if (identity.type === OAuth2SubKind.CLIENT) {\n return this.fromClient(identity.data);\n }\n\n return this.fromUser(identity.data);\n }\n\n fromClient(input: Client) : OpenIDTokenPayload {\n return this.extract(this.clientMap, input);\n }\n\n fromUser(input: User) : OpenIDTokenPayload {\n return this.extract(this.userMap, input);\n }\n\n /**\n * A claim is emitted only for a value that exists AND is not nullish.\n *\n * The map reads entity columns, several of which are nullable, and OIDC\n * models an unavailable claim as one that is not returned rather than one\n * returned as `null` — so a user without a display name must omit\n * `nickname`, not answer `nickname: null` (#3518). Emitting the null also\n * put a JSON `null` claim value into every id_token, which no relying\n * party expects.\n */\n protected extract<T extends ObjectLiteral = ObjectLiteral>(\n attributeMap: AttributeMap<T>,\n attributes: T,\n ) : OpenIDTokenPayload {\n const result = {} as OpenIDTokenPayload;\n\n const keys = Object.keys(attributeMap) as (keyof OpenIDClaims)[];\n for (const key_ of keys) {\n const attribute = attributeMap[key_];\n\n let value : unknown;\n if (typeof attribute === 'string') {\n if (!hasOwnProperty(attributes, attribute)) {\n continue;\n }\n\n value = attributes[attribute];\n } else {\n const [key, transformer] = attribute as AttributeMapTuple<T>;\n\n if (!hasOwnProperty(attributes, key)) {\n continue;\n }\n\n value = transformer(attributes[key]);\n }\n\n if (\n typeof value === 'undefined' ||\n value === null\n ) {\n continue;\n }\n\n // Cast on the VALUE side only: which claim is written is checked by\n // `AttributeMap`'s key type, while the value comes out of an entity\n // column through an untyped transformer and never had a type here.\n (result as Record<string, unknown>)[key_] = value;\n }\n\n return result;\n }\n}\n"],"mappings":";;;;;;A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IAAI;GACvC;GAEA,IACI,OAAO1B,UAAU,eACjBA,UAAU,MAEV;GAMHqB,OAAmCG,QAAQxB;EAChD;EAEA,OAAOqB;CACX;AACJ"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The cookie carrying the opaque session credential: the `secret` half of an
3
+ * `auth_sessions` row, never its id (the id is published as `sid` in every
4
+ * id_token and `/sessions` row, so it is an identifier and not a credential).
5
+ *
6
+ * `HttpOnly`, `Secure` under an https publicUrl, and `SameSite=Strict`: it is
7
+ * an ambient credential for the whole API, so it must never ride a cross-site
8
+ * request. See plan 088 for the full gate (`Strict` + `Origin` + a mandatory
9
+ * `Sec-Fetch-Site: same-origin`).
10
+ */
11
+ export declare const SESSION_COOKIE = "authup_session";
12
+ /**
13
+ * Length of the opaque session credential, in nanoid characters. 48 chars of
14
+ * the default 36-symbol alphabet is ~248 bits. The credential is presented on
15
+ * every request and never rotated within a session, so it is sized well past
16
+ * the point where guessing is the weakest link.
17
+ */
18
+ export declare const SESSION_SECRET_LENGTH = 48;
19
+ /**
20
+ * How often a cookie-authenticated request slides the session's expiry.
21
+ *
22
+ * A bearer-mode session is kept alive by the refresh grant, which cookie mode
23
+ * removes: `ping()` moves only `seenAt`, so an active console user would be
24
+ * signed out mid-task once the session reached its ~3-day lifetime. The cookie
25
+ * branch therefore calls `refresh()` instead, throttled to one write per
26
+ * window so a page load's burst of API calls does not rewrite the row a dozen
27
+ * times. It costs nothing extra: `ping()` was already saving the row.
28
+ */
29
+ export declare const SESSION_REFRESH_THROTTLE: number;
30
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-credential/constants.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,QAAY,CAAC"}
@@ -0,0 +1,34 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ //#region src/core/oauth2/session-credential/constants.ts
5
+ /**
6
+ * The cookie carrying the opaque session credential: the `secret` half of an
7
+ * `auth_sessions` row, never its id (the id is published as `sid` in every
8
+ * id_token and `/sessions` row, so it is an identifier and not a credential).
9
+ *
10
+ * `HttpOnly`, `Secure` under an https publicUrl, and `SameSite=Strict`: it is
11
+ * an ambient credential for the whole API, so it must never ride a cross-site
12
+ * request. See plan 088 for the full gate (`Strict` + `Origin` + a mandatory
13
+ * `Sec-Fetch-Site: same-origin`).
14
+ */ const SESSION_COOKIE = "authup_session";
15
+ /**
16
+ * Length of the opaque session credential, in nanoid characters. 48 chars of
17
+ * the default 36-symbol alphabet is ~248 bits. The credential is presented on
18
+ * every request and never rotated within a session, so it is sized well past
19
+ * the point where guessing is the weakest link.
20
+ */ const SESSION_SECRET_LENGTH = 48;
21
+ /**
22
+ * How often a cookie-authenticated request slides the session's expiry.
23
+ *
24
+ * A bearer-mode session is kept alive by the refresh grant, which cookie mode
25
+ * removes: `ping()` moves only `seenAt`, so an active console user would be
26
+ * signed out mid-task once the session reached its ~3-day lifetime. The cookie
27
+ * branch therefore calls `refresh()` instead, throttled to one write per
28
+ * window so a page load's burst of API calls does not rewrite the row a dozen
29
+ * times. It costs nothing extra: `ping()` was already saving the row.
30
+ */ const SESSION_REFRESH_THROTTLE = 6e4;
31
+ //#endregion
32
+ export { SESSION_COOKIE, SESSION_REFRESH_THROTTLE, SESSION_SECRET_LENGTH };
33
+
34
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":["SESSION_COOKIE","SESSION_SECRET_LENGTH","SESSION_REFRESH_THROTTLE"],"sources":["../../../../src/core/oauth2/session-credential/constants.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\n/**\n * The cookie carrying the opaque session credential: the `secret` half of an\n * `auth_sessions` row, never its id (the id is published as `sid` in every\n * id_token and `/sessions` row, so it is an identifier and not a credential).\n *\n * `HttpOnly`, `Secure` under an https publicUrl, and `SameSite=Strict`: it is\n * an ambient credential for the whole API, so it must never ride a cross-site\n * request. See plan 088 for the full gate (`Strict` + `Origin` + a mandatory\n * `Sec-Fetch-Site: same-origin`).\n */\nexport const SESSION_COOKIE = 'authup_session';\n\n/**\n * Length of the opaque session credential, in nanoid characters. 48 chars of\n * the default 36-symbol alphabet is ~248 bits. The credential is presented on\n * every request and never rotated within a session, so it is sized well past\n * the point where guessing is the weakest link.\n */\nexport const SESSION_SECRET_LENGTH = 48;\n\n/**\n * How often a cookie-authenticated request slides the session's expiry.\n *\n * A bearer-mode session is kept alive by the refresh grant, which cookie mode\n * removes: `ping()` moves only `seenAt`, so an active console user would be\n * signed out mid-task once the session reached its ~3-day lifetime. The cookie\n * branch therefore calls `refresh()` instead, throttled to one write per\n * window so a page load's burst of API calls does not rewrite the row a dozen\n * times. It costs nothing extra: `ping()` was already saving the row.\n */\nexport const SESSION_REFRESH_THROTTLE = 1000 * 60;\n"],"mappings":";;;;;;;;;;;;;GAiBA,MAAaA,iBAAiB;;;;;;GAQ9B,MAAaC,wBAAwB;;;;;;;;;;GAYrC,MAAaC,2BAA2B"}
@@ -0,0 +1,3 @@
1
+ export * from './constants.ts';
2
+ export * from './module.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-credential/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { SESSION_COOKIE, SESSION_REFRESH_THROTTLE, SESSION_SECRET_LENGTH } from "./constants.mjs";
5
+ import { createSessionSecret, hashSessionSecret } from "./module.mjs";
6
+ export { SESSION_COOKIE, SESSION_REFRESH_THROTTLE, SESSION_SECRET_LENGTH, createSessionSecret, hashSessionSecret };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Mint the opaque credential a console browser presents (plan 088). It is
3
+ * written to `auth_sessions.secret` (a `select: false` column resolved only by
4
+ * `ISessionRepository.findOneBySecret`) and handed to the browser in the
5
+ * console session cookie.
6
+ */
7
+ export declare function createSessionSecret(): string;
8
+ /**
9
+ * The value actually stored in `auth_sessions.secret`.
10
+ *
11
+ * `select: false` limits what the ORM projects; it does nothing about what the
12
+ * database CONTAINS, so storing the credential verbatim would make any read of
13
+ * that table — a leaked backup, a read replica, a SQL injection that only
14
+ * SELECTs — a source of replayable `authup_session` cookies. The
15
+ * column holds a digest instead, and the cookie value never lands anywhere it
16
+ * can be read back.
17
+ *
18
+ * A plain SHA-256 rather than a keyed HMAC, deliberately. Keying defends a
19
+ * LOW-entropy input against offline guessing, which is why a password needs
20
+ * bcrypt; this input is 48 nanoid characters over a 36-symbol alphabet (~248
21
+ * bits), so there is no guessing attack for a key to frustrate. A keyed scheme
22
+ * would also have to be GLOBAL — the lookup resolves a session BY this value,
23
+ * so the realm is unknown at that point and a per-realm key is unavailable —
24
+ * and the only global key (`SECRETS_ENCRYPTION_KEY`) is optional, so keying
25
+ * would either be absent by default or need key management of its own.
26
+ *
27
+ * Deterministic, so the lookup stays a single indexed equality. Hex SHA-256 is
28
+ * exactly 64 characters, which is the column's width.
29
+ */
30
+ export declare function hashSessionSecret(secret: string): string;
31
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-credential/module.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAK,MAAM,CAE7C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAI,MAAM,CAEzD"}
@@ -0,0 +1,43 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import "./constants.mjs";
5
+ import { createNanoID } from "@authup/kit";
6
+ import { createHash } from "node:crypto";
7
+ //#region src/core/oauth2/session-credential/module.ts
8
+ /**
9
+ * Mint the opaque credential a console browser presents (plan 088). It is
10
+ * written to `auth_sessions.secret` (a `select: false` column resolved only by
11
+ * `ISessionRepository.findOneBySecret`) and handed to the browser in the
12
+ * console session cookie.
13
+ */ function createSessionSecret() {
14
+ return createNanoID(48);
15
+ }
16
+ /**
17
+ * The value actually stored in `auth_sessions.secret`.
18
+ *
19
+ * `select: false` limits what the ORM projects; it does nothing about what the
20
+ * database CONTAINS, so storing the credential verbatim would make any read of
21
+ * that table — a leaked backup, a read replica, a SQL injection that only
22
+ * SELECTs — a source of replayable `authup_session` cookies. The
23
+ * column holds a digest instead, and the cookie value never lands anywhere it
24
+ * can be read back.
25
+ *
26
+ * A plain SHA-256 rather than a keyed HMAC, deliberately. Keying defends a
27
+ * LOW-entropy input against offline guessing, which is why a password needs
28
+ * bcrypt; this input is 48 nanoid characters over a 36-symbol alphabet (~248
29
+ * bits), so there is no guessing attack for a key to frustrate. A keyed scheme
30
+ * would also have to be GLOBAL — the lookup resolves a session BY this value,
31
+ * so the realm is unknown at that point and a per-realm key is unavailable —
32
+ * and the only global key (`SECRETS_ENCRYPTION_KEY`) is optional, so keying
33
+ * would either be absent by default or need key management of its own.
34
+ *
35
+ * Deterministic, so the lookup stays a single indexed equality. Hex SHA-256 is
36
+ * exactly 64 characters, which is the column's width.
37
+ */ function hashSessionSecret(secret) {
38
+ return createHash("sha256").update(secret).digest("hex");
39
+ }
40
+ //#endregion
41
+ export { createSessionSecret, hashSessionSecret };
42
+
43
+ //# sourceMappingURL=module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.mjs","names":["createHash","createNanoID","SESSION_SECRET_LENGTH","createSessionSecret","hashSessionSecret","secret","update","digest"],"sources":["../../../../src/core/oauth2/session-credential/module.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 { createHash } from 'node:crypto';\nimport { createNanoID } from '@authup/kit';\nimport { SESSION_SECRET_LENGTH } from './constants.ts';\n\n/**\n * Mint the opaque credential a console browser presents (plan 088). It is\n * written to `auth_sessions.secret` (a `select: false` column resolved only by\n * `ISessionRepository.findOneBySecret`) and handed to the browser in the\n * console session cookie.\n */\nexport function createSessionSecret() : string {\n return createNanoID(SESSION_SECRET_LENGTH);\n}\n\n/**\n * The value actually stored in `auth_sessions.secret`.\n *\n * `select: false` limits what the ORM projects; it does nothing about what the\n * database CONTAINS, so storing the credential verbatim would make any read of\n * that table — a leaked backup, a read replica, a SQL injection that only\n * SELECTs — a source of replayable `authup_session` cookies. The\n * column holds a digest instead, and the cookie value never lands anywhere it\n * can be read back.\n *\n * A plain SHA-256 rather than a keyed HMAC, deliberately. Keying defends a\n * LOW-entropy input against offline guessing, which is why a password needs\n * bcrypt; this input is 48 nanoid characters over a 36-symbol alphabet (~248\n * bits), so there is no guessing attack for a key to frustrate. A keyed scheme\n * would also have to be GLOBAL — the lookup resolves a session BY this value,\n * so the realm is unknown at that point and a per-realm key is unavailable —\n * and the only global key (`SECRETS_ENCRYPTION_KEY`) is optional, so keying\n * would either be absent by default or need key management of its own.\n *\n * Deterministic, so the lookup stays a single indexed equality. Hex SHA-256 is\n * exactly 64 characters, which is the column's width.\n */\nexport function hashSessionSecret(secret: string) : string {\n return createHash('sha256').update(secret).digest('hex');\n}\n"],"mappings":";;;;;;;;;;;;GAiBA,SAAgBG,sBAAAA;CACZ,OAAOF,aAAAA,EAAaC;AACxB;;;;;;;;;;;;;;;;;;;;;;GAwBA,SAAgBE,kBAAkBC,QAAc;CAC5C,OAAOL,WAAW,QAAA,CAAA,CAAUM,OAAOD,MAAAA,CAAAA,CAAQE,OAAO,KAAA;AACtD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Rows removed per statement by the session-token expiry sweep. This is the
3
+ * highest-volume table in the schema (one row per issued access token, so one
4
+ * per ~15 minutes per active session), and the sweep runs every minute on
5
+ * every replica. A single unbounded DELETE would be one long transaction,
6
+ * issued concurrently by every replica. Batching keeps each statement
7
+ * bounded; the sweep still drains by looping.
8
+ */
9
+ export declare const SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE = 1000;
10
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-token/constants.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,OAAO,CAAC"}
@@ -0,0 +1,16 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ //#region src/core/oauth2/session-token/constants.ts
5
+ /**
6
+ * Rows removed per statement by the session-token expiry sweep. This is the
7
+ * highest-volume table in the schema (one row per issued access token, so one
8
+ * per ~15 minutes per active session), and the sweep runs every minute on
9
+ * every replica. A single unbounded DELETE would be one long transaction,
10
+ * issued concurrently by every replica. Batching keeps each statement
11
+ * bounded; the sweep still drains by looping.
12
+ */ const SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE = 1e3;
13
+ //#endregion
14
+ export { SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE };
15
+
16
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":["SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE"],"sources":["../../../../src/core/oauth2/session-token/constants.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\n/**\n * Rows removed per statement by the session-token expiry sweep. This is the\n * highest-volume table in the schema (one row per issued access token, so one\n * per ~15 minutes per active session), and the sweep runs every minute on\n * every replica. A single unbounded DELETE would be one long transaction,\n * issued concurrently by every replica. Batching keeps each statement\n * bounded; the sweep still drains by looping.\n */\nexport const SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE = 1000;\n"],"mappings":";;;;;;;;;;;GAeA,MAAaA,wCAAwC"}
@@ -1,3 +1,4 @@
1
+ export * from './constants.ts';
1
2
  export * from './error.ts';
2
3
  export * from './types.ts';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-token/index.ts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-token/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
+ import { SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE } from "./constants.mjs";
4
5
  import { SESSION_TOKEN_RELATION_MISSING_ERROR_INSTANCE, SessionTokenRelationMissingError, isSessionTokenRelationMissingError } from "./error.mjs";
5
- export { SESSION_TOKEN_RELATION_MISSING_ERROR_INSTANCE, SessionTokenRelationMissingError, isSessionTokenRelationMissingError };
6
+ export { SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE, SESSION_TOKEN_RELATION_MISSING_ERROR_INSTANCE, SessionTokenRelationMissingError, isSessionTokenRelationMissingError };
@@ -101,10 +101,21 @@ export interface ISessionTokenRepository {
101
101
  */
102
102
  revokeBySessionId(sessionId: string, at: string): Promise<SessionTokenRef[]>;
103
103
  /**
104
- * Delete every token row whose `expiresAt` is before the given timestamp.
104
+ * Expiry sweep: delete every token row whose `expiresAt` is before the
105
+ * given timestamp. Returns the number of removed rows. Removal is batched
106
+ * (see SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE).
105
107
  *
106
108
  * @param before iso timestamp
109
+ * @param options
107
110
  */
108
- deleteExpired(before: string): Promise<number>;
111
+ deleteExpired(before: string, options?: SessionTokenDeleteExpiredOptions): Promise<number>;
109
112
  }
113
+ export type SessionTokenDeleteExpiredOptions = {
114
+ /**
115
+ * Rows removed per statement. Defaults to
116
+ * SESSION_TOKEN_EXPIRY_SWEEP_BATCH_SIZE, which anything that is not a
117
+ * positive safe integer also falls back to.
118
+ */
119
+ batchSize?: number;
120
+ };
110
121
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/session-token/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACpC;;;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EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAE5D;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D;;;;;;;OAOG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;;;;OAOG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAE7E;;;;;;;OAOG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gCAAgC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9F;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -45,8 +45,10 @@ function mergeProvisioningEntities(target, source, options = {}) {
45
45
  ...source.attributes
46
46
  };
47
47
  const inheritStrategy = options.inheritStrategy ?? true;
48
- if (target.strategy && !source.strategy) if (inheritStrategy) output.strategy = target.strategy;
49
- else delete output.strategy;
48
+ if (target.strategy && !source.strategy) {
49
+ if (inheritStrategy) output.strategy = target.strategy;
50
+ else delete output.strategy;
51
+ }
50
52
  if (target.relations && source.relations) output.relations = mergeProvisioningRecord(target.relations, source.relations, options);
51
53
  else if (target.relations && !source.relations) output.relations = target.relations;
52
54
  if (target.extraAttributes && source.extraAttributes) output.extraAttributes = {
@@ -60,7 +62,7 @@ function mergeProvisioningEntities(target, source, options = {}) {
60
62
  }
61
63
  function mergeProvisioningRecord(target, source, options = {}) {
62
64
  const output = { ...target };
63
- for (const key of Object.keys(source)) output[key] = key in target ? mergeProvisioningValue(target[key], source[key], options) : source[key];
65
+ for (const [key, value] of Object.entries(source)) output[key] = key in target ? mergeProvisioningValue(target[key], value, options) : value;
64
66
  return output;
65
67
  }
66
68
  function mergeProvisioningValue(target, source, options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["isObject","buildProvisioningEntityKey","attributes","name","undefined","realmId","clientId","mergeProvisioningEntities","target","source","options","result","forEach","item","key","push","idx","findIndex","r","mergeProvisioningEntity","output","inheritStrategy","strategy","relations","mergeProvisioningRecord","extraAttributes","children","Object","keys","mergeProvisioningValue","Array","isArray","isProvisioningEntityArray","Set","value","some"],"sources":["../../../../src/core/provisioning/merge/module.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 { isObject } from '@authup/kit';\nimport type { MergeProvisioningOptions, MergeableProvisioningEntity } from './types.ts';\n\nexport function buildProvisioningEntityKey(\n attributes: MergeableProvisioningEntity['attributes'],\n): string | undefined {\n if (!attributes.name) return undefined;\n return `${attributes.name}:${attributes.realmId || ''}:${attributes.clientId || ''}`;\n}\n\nexport function mergeProvisioningEntities<T extends MergeableProvisioningEntity>(\n target: T[] | undefined,\n source: T[] | undefined,\n options: MergeProvisioningOptions = {},\n): T[] | undefined {\n if (!source) return target;\n if (!target) return [...source];\n\n const result = [...target];\n source.forEach((item) => {\n const key = buildProvisioningEntityKey(item.attributes);\n if (!key) {\n result.push(item);\n return;\n }\n\n const idx = result.findIndex((r) => buildProvisioningEntityKey(r.attributes) === key);\n if (idx !== -1) {\n result[idx] = mergeProvisioningEntity(result[idx], item, options) as T;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\n/**\n * Deep-merge two entries sharing a composite key. The later (source) side\n * wins per attribute, but relations are UNIONED — a later source (e.g. a\n * mounted provisioning file) extending a built-in entry (the default\n * source's master realm) must not silently drop the built-in relations\n * (admin user, system client).\n *\n * Policy extraAttributes merge per key with the later source winning —\n * like attributes, NOT like relations: an EA value (a names denylist,\n * an ATTRIBUTES query tree) is policy configuration, and unioning would\n * make shrinking a list impossible and fabricate predicates neither\n * source authored.\n */\nexport function mergeProvisioningEntity(\n target: MergeableProvisioningEntity,\n source: MergeableProvisioningEntity,\n options: MergeProvisioningOptions = {},\n): MergeableProvisioningEntity {\n const output = { ...target, ...source };\n\n output.attributes = { ...target.attributes, ...source.attributes };\n\n const inheritStrategy = options.inheritStrategy ?? true;\n if (target.strategy && !source.strategy) {\n if (inheritStrategy) {\n output.strategy = target.strategy;\n } else {\n delete output.strategy;\n }\n }\n\n if (target.relations && source.relations) {\n output.relations = mergeProvisioningRecord(target.relations, source.relations, options);\n } else if (target.relations && !source.relations) {\n output.relations = target.relations;\n }\n\n if (target.extraAttributes && source.extraAttributes) {\n output.extraAttributes = { ...target.extraAttributes, ...source.extraAttributes };\n } else if (target.extraAttributes && !source.extraAttributes) {\n output.extraAttributes = target.extraAttributes;\n }\n\n if (target.children && source.children) {\n output.children = mergeProvisioningEntities(target.children, source.children, options);\n } else if (target.children && !source.children) {\n output.children = target.children;\n }\n\n return output;\n}\n\nfunction mergeProvisioningRecord(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n options: MergeProvisioningOptions = {},\n): Record<string, unknown> {\n const output : Record<string, unknown> = { ...target };\n for (const key of Object.keys(source)) {\n output[key] = key in target ?\n mergeProvisioningValue(target[key], source[key], options) :\n source[key];\n }\n return output;\n}\n\nfunction mergeProvisioningValue(\n target: unknown,\n source: unknown,\n options: MergeProvisioningOptions = {},\n): unknown {\n if (typeof target === 'undefined') return source;\n if (typeof source === 'undefined') return target;\n\n if (Array.isArray(target) && Array.isArray(source)) {\n if (isProvisioningEntityArray(target) || isProvisioningEntityArray(source)) {\n return mergeProvisioningEntities(\n target as MergeableProvisioningEntity[],\n source as MergeableProvisioningEntity[],\n options,\n );\n }\n return [...new Set([...target, ...source])];\n }\n\n if (isObject(target) && isObject(source)) {\n return mergeProvisioningRecord(target, source, options);\n }\n\n return source;\n}\n\nfunction isProvisioningEntityArray(value: unknown[]): value is MergeableProvisioningEntity[] {\n return value.some(\n (item) => isObject(item) && 'attributes' in item,\n );\n}\n"],"mappings":";;;;;AAUA,SAAgBC,2BACZC,YAAqD;CAErD,IAAI,CAACA,WAAWC,MAAM,OAAOC,KAAAA;CAC7B,OAAO,GAAGF,WAAWC,KAAK,GAAGD,WAAWG,WAAW,GAAG,GAAGH,WAAWI,YAAY;AACpF;AAEA,SAAgBC,0BACZC,QACAC,QACAC,UAAoC,CAAC,GAAC;CAEtC,IAAI,CAACD,QAAQ,OAAOD;CACpB,IAAI,CAACA,QAAQ,OAAO,CAAIC,GAAAA,MAAO;CAE/B,MAAME,SAAS,CAAIH,GAAAA,MAAO;CAC1BC,OAAOG,SAASC,SAAAA;EACZ,MAAMC,MAAMb,2BAA2BY,KAAKX,UAAU;EACtD,IAAI,CAACY,KAAK;GACNH,OAAOI,KAAKF,IAAAA;GACZ;EACJ;EAEA,MAAMG,MAAML,OAAOM,WAAWC,MAAMjB,2BAA2BiB,EAAEhB,UAAU,MAAMY,GAAAA;EACjF,IAAIE,QAAQ,IACRL,OAAOK,OAAOG,wBAAwBR,OAAOK,MAAMH,MAAMH,OAAAA;OAEzDC,OAAOI,KAAKF,IAAAA;CAEpB,CAAA;CACA,OAAOF;AACX;;;;;;;;;;;;;GAeA,SAAgBQ,wBACZX,QACAC,QACAC,UAAoC,CAAC,GAAC;CAEtC,MAAMU,SAAS;EAAE,GAAGZ;EAAQ,GAAGC;CAAO;CAEtCW,OAAOlB,aAAa;EAAE,GAAGM,OAAON;EAAY,GAAGO,OAAOP;CAAW;CAEjE,MAAMmB,kBAAkBX,QAAQW,mBAAmB;CACnD,IAAIb,OAAOc,YAAY,CAACb,OAAOa,UAC3B,IAAID,iBACAD,OAAOE,WAAWd,OAAOc;MAEzB,OAAOF,OAAOE;CAItB,IAAId,OAAOe,a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AAIT,SAASQ,MAAAA,KAAWR,SAASS,MAAAA,GAC7B,OAAOe,wBAAwBhB,QAAQC,QAAQC,OAAAA;CAGnD,OAAOD;AACX;AAEA,SAASuB,0BAA0BE,OAAgB;CAC/C,OAAOA,MAAMC,MACRtB,SAASb,SAASa,IAAAA,KAAS,gBAAgBA,IAAAA;AAEpD"}
1
+ {"version":3,"file":"module.mjs","names":["isObject","buildProvisioningEntityKey","attributes","name","undefined","realmId","clientId","mergeProvisioningEntities","target","source","options","result","forEach","item","key","push","idx","findIndex","r","mergeProvisioningEntity","output","inheritStrategy","strategy","relations","mergeProvisioningRecord","extraAttributes","children","value","Object","entries","mergeProvisioningValue","Array","isArray","isProvisioningEntityArray","Set","some"],"sources":["../../../../src/core/provisioning/merge/module.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 { isObject } from '@authup/kit';\nimport type { MergeProvisioningOptions, MergeableProvisioningEntity } from './types.ts';\n\nexport function buildProvisioningEntityKey(\n attributes: MergeableProvisioningEntity['attributes'],\n): string | undefined {\n if (!attributes.name) return undefined;\n return `${attributes.name}:${attributes.realmId || ''}:${attributes.clientId || ''}`;\n}\n\nexport function mergeProvisioningEntities<T extends MergeableProvisioningEntity>(\n target: T[] | undefined,\n source: T[] | undefined,\n options: MergeProvisioningOptions = {},\n): T[] | undefined {\n if (!source) return target;\n if (!target) return [...source];\n\n const result = [...target];\n source.forEach((item) => {\n const key = buildProvisioningEntityKey(item.attributes);\n if (!key) {\n result.push(item);\n return;\n }\n\n const idx = result.findIndex((r) => buildProvisioningEntityKey(r.attributes) === key);\n if (idx !== -1) {\n result[idx] = mergeProvisioningEntity(result[idx], item, options) as T;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\n/**\n * Deep-merge two entries sharing a composite key. The later (source) side\n * wins per attribute, but relations are UNIONED — a later source (e.g. a\n * mounted provisioning file) extending a built-in entry (the default\n * source's master realm) must not silently drop the built-in relations\n * (admin user, system client).\n *\n * Policy extraAttributes merge per key with the later source winning —\n * like attributes, NOT like relations: an EA value (a names denylist,\n * an ATTRIBUTES query tree) is policy configuration, and unioning would\n * make shrinking a list impossible and fabricate predicates neither\n * source authored.\n */\nexport function mergeProvisioningEntity(\n target: MergeableProvisioningEntity,\n source: MergeableProvisioningEntity,\n options: MergeProvisioningOptions = {},\n): MergeableProvisioningEntity {\n const output = { ...target, ...source };\n\n output.attributes = { ...target.attributes, ...source.attributes };\n\n const inheritStrategy = options.inheritStrategy ?? true;\n if (target.strategy && !source.strategy) {\n if (inheritStrategy) {\n output.strategy = target.strategy;\n } else {\n delete output.strategy;\n }\n }\n\n if (target.relations && source.relations) {\n output.relations = mergeProvisioningRecord(target.relations, source.relations, options);\n } else if (target.relations && !source.relations) {\n output.relations = target.relations;\n }\n\n if (target.extraAttributes && source.extraAttributes) {\n output.extraAttributes = { ...target.extraAttributes, ...source.extraAttributes };\n } else if (target.extraAttributes && !source.extraAttributes) {\n output.extraAttributes = target.extraAttributes;\n }\n\n if (target.children && source.children) {\n output.children = mergeProvisioningEntities(target.children, source.children, options);\n } else if (target.children && !source.children) {\n output.children = target.children;\n }\n\n return output;\n}\n\nfunction mergeProvisioningRecord(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n options: MergeProvisioningOptions = {},\n): Record<string, unknown> {\n const output : Record<string, unknown> = { ...target };\n for (const [key, value] of Object.entries(source)) {\n output[key] = key in target ?\n mergeProvisioningValue(target[key], value, options) :\n value;\n }\n return output;\n}\n\nfunction mergeProvisioningValue(\n target: unknown,\n source: unknown,\n options: MergeProvisioningOptions = {},\n): unknown {\n if (typeof target === 'undefined') return source;\n if (typeof source === 'undefined') return target;\n\n if (Array.isArray(target) && Array.isArray(source)) {\n if (isProvisioningEntityArray(target) || isProvisioningEntityArray(source)) {\n return mergeProvisioningEntities(\n target as MergeableProvisioningEntity[],\n source as MergeableProvisioningEntity[],\n options,\n );\n }\n return [...new Set([...target, ...source])];\n }\n\n if (isObject(target) && isObject(source)) {\n return mergeProvisioningRecord(target, source, options);\n }\n\n return source;\n}\n\nfunction isProvisioningEntityArray(value: unknown[]): value is MergeableProvisioningEntity[] {\n return value.some(\n (item) => isObject(item) && 'attributes' in item,\n );\n}\n"],"mappings":";;;;;AAUA,SAAgBC,2BACZC,YAAqD;CAErD,IAAI,CAACA,WAAWC,MAAM,OAAOC,KAAAA;CAC7B,OAAO,GAAGF,WAAWC,KAAK,GAAGD,WAAWG,WAAW,GAAG,GAAGH,WAAWI,YAAY;AACpF;AAEA,SAAgBC,0BACZC,QACAC,QACAC,UAAoC,CAAC,GAAC;CAEtC,IAAI,CAACD,QAAQ,OAAOD;CACpB,IAAI,CAACA,QAAQ,OAAO,CAAIC,GAAAA,MAAO;CAE/B,MAAME,SAAS,CAAIH,GAAAA,MAAO;CAC1BC,OAAOG,SAASC,SAAAA;EACZ,MAAMC,MAAMb,2BAA2BY,KAAKX,UAAU;EACtD,IAAI,CAACY,KAAK;GACNH,OAAOI,KAAKF,IAAAA;GACZ;EACJ;EAEA,MAAMG,MAAML,OAAOM,WAAWC,MAAMjB,2BAA2BiB,EAAEhB,UAAU,MAAMY,GAAAA;EACjF,IAAIE,QAAQ,IACRL,OAAOK,OAAOG,wBAAwBR,OAAOK,MAAMH,MAAMH,OAAAA;OAEzDC,OAAOI,KAAKF,IAAAA;CAEpB,CAAA;CACA,OAAOF;AACX;;;;;;;;;;;;;GAeA,SAAgBQ,wBACZX,QACAC,QACAC,UAAoC,CAAC,GAAC;CAEtC,MAAMU,SAAS;EAAE,GAAGZ;EAAQ,GAAGC;CAAO;CAEtCW,OAAOlB,aAAa;EAAE,GAAGM,OAAON;EAAY,GAAGO,OAAOP;CAAW;CAEjE,MAAMmB,kBAAkBX,QAAQW,mBAAmB;CACnD,IAAIb,OAAOc,YAAY,CAACb,OAAOa,UAAU;EACrC,IAAID,iBACAD,OAAOE,WAAWd,OAAOc;OAEzB,OAAOF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A,MAAO,CAAA,CAAE;CAC/C;CAEA,IAAIT,SAASQ,MAAAA,KAAWR,SAASS,MAAAA,GAC7B,OAAOe,wBAAwBhB,QAAQC,QAAQC,OAAAA;CAGnD,OAAOD;AACX;AAEA,SAASwB,0BAA0BN,OAAgB;CAC/C,OAAOA,MAAMQ,MACRtB,SAASb,SAASa,IAAAA,KAAS,gBAAgBA,IAAAA;AAEpD"}
@@ -98,7 +98,7 @@ for (const schema of schemas) schemaRegistry.add(schema);
98
98
  * anonymous — the HTTP adapter always builds one); a decode without
99
99
  * an actor is a system call and runs unrestricted.
100
100
  */ async function decodeQuery(input, options) {
101
- const normalized = isObject(input) || typeof input === "string" ? input : {};
101
+ const normalized = typeof input === "string" || isObject(input) ? input : {};
102
102
  return await queryCodec.decodeAsync(normalized, {
103
103
  schema: options.schema,
104
104
  parameters: options.parameters,
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["createURLCodec","Query","SchemaRegistry","isObject","clientSchema","clientPermissionSchema","clientRoleSchema","clientScopeSchema","consentSchema","eventSchema","identityProviderSchema","identityProviderAccountSchema","identityProviderRoleMappingSchema","keySchema","permissionSchema","permissionPolicySchema","policySchema","realmSchema","roleSchema","roleAttributeSchema","rolePermissionSchema","scopeSchema","sessionSchema","sessionTokenSchema","trustAnchorSchema","userSchema","userAttributeSchema","userAuthenticatorSchema","userPermissionSchema","userRoleSchema","schemaRegistry","schemas","schema","add","queryCodec","decodeQuery","input","options","normalized","parsed","decodeAsync","parameters","context","actor","appendQueryConditions","query","conditions","fields","filters","and","relations","pagination","sorts"],"sources":["../../../src/core/query/module.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 { createURLCodec } from '@rapiq/codec-url';\nimport type {\n ICondition,\n IQuery,\n ObjectLiteral,\n Schema,\n} from '@rapiq/core';\nimport { Query, SchemaRegistry, isObject } from '@rapiq/core';\nimport { clientSchema } from '../entities/client/schema.ts';\nimport { clientPermissionSchema } from '../entities/client-permission/schema.ts';\nimport { clientRoleSchema } from '../entities/client-role/schema.ts';\nimport { clientScopeSchema } from '../entities/client-scope/schema.ts';\nimport { consentSchema } from '../entities/consent/schema.ts';\nimport { eventSchema } from '../entities/event/schema.ts';\nimport { identityProviderSchema } from '../entities/identity-provider/schema.ts';\nimport { identityProviderAccountSchema } from '../entities/identity-provider-account/schema.ts';\nimport { identityProviderRoleMappingSchema } from '../entities/identity-provider-role-mapping/schema.ts';\nimport { keySchema } from '../entities/key/schema.ts';\nimport { permissionSchema } from '../entities/permission/schema.ts';\nimport { permissionPolicySchema } from '../entities/permission-policy/schema.ts';\nimport { policySchema } from '../entities/policy/schema.ts';\nimport { realmSchema } from '../entities/realm/schema.ts';\nimport { roleSchema } from '../entities/role/schema.ts';\nimport { roleAttributeSchema } from '../entities/role-attribute/schema.ts';\nimport { rolePermissionSchema } from '../entities/role-permission/schema.ts';\nimport { scopeSchema } from '../entities/scope/schema.ts';\nimport { sessionSchema } from '../entities/session/schema.ts';\nimport { sessionTokenSchema } from '../entities/session-token/schema.ts';\nimport { trustAnchorSchema } from '../entities/trust-anchor/schema.ts';\nimport { userSchema } from '../entities/user/schema.ts';\nimport { userAttributeSchema } from '../entities/user-attribute/schema.ts';\nimport { userAuthenticatorSchema } from '../entities/user-authenticator/schema.ts';\nimport { userPermissionSchema } from '../entities/user-permission/schema.ts';\nimport { userRoleSchema } from '../entities/user-role/schema.ts';\nimport type { DecodeQueryOptions, QueryDecodeContext } from './types.ts';\n\n/**\n * Registry of every entity schema — the server-side allow-list layer.\n * Relation traversal (e.g. a `realm.name` filter) resolves through the\n * `schemaMapping` of the owning schema into the related schema's own\n * allow-lists.\n *\n * The registry deliberately lives in core (persistence-agnostic): the\n * schemas are security policy over the domain types, and services\n * consume them to decode wire queries into the rapiq IR. A repository\n * layer MAY extend the registry with additional, storage-derived\n * schemas (e.g. `@rapiq/adapter-typeorm`'s `defineSchemaRegistryWithDataSource`\n * with the `registry` option — already-registered schemas take\n * precedence), but the allow-lists themselves stay explicit and are\n * never auto-derived from entity metadata.\n */\nexport const schemaRegistry = new SchemaRegistry();\n\n/**\n * Every registered entity schema. Exported so the invariant guard can\n * enumerate them: `SchemaRegistry` keeps its map protected and exposes\n * no iterator (tada5hi/rapiq#904).\n */\nexport const schemas : Schema<any>[] = [\n clientSchema,\n clientPermissionSchema,\n clientRoleSchema,\n clientScopeSchema,\n consentSchema,\n eventSchema,\n identityProviderSchema,\n identityProviderAccountSchema,\n identityProviderRoleMappingSchema,\n keySchema,\n permissionSchema,\n permissionPolicySchema,\n policySchema,\n realmSchema,\n roleSchema,\n roleAttributeSchema,\n rolePermissionSchema,\n scopeSchema,\n sessionSchema,\n sessionTokenSchema,\n trustAnchorSchema,\n userSchema,\n userAttributeSchema,\n userAuthenticatorSchema,\n userPermissionSchema,\n userRoleSchema,\n];\n\nfor (const schema of schemas) {\n schemaRegistry.add(schema);\n}\n\n/**\n * URL transport codec bound to the schema registry: decodes both the\n * v2 expression dialect (stamped or detected) and legacy v1 bracket\n * payloads, so pre-v2 clients keep working.\n */\nexport const queryCodec = createURLCodec(schemaRegistry);\n\n/**\n * Decode a raw wire query (routup `useRequestQuery` output or a raw\n * query string) against a registered schema into the rapiq IR. The\n * schema's allow-lists, defaults and pagination bounds are applied\n * here — downstream consumers (repository adapters) only execute the\n * returned query.\n *\n * Async because the schema validate hooks are: the relations read\n * gate (`createRelationsReadGate`) awaits the actor's permission\n * pre-gate per include, and rapiq refuses async validators on the\n * synchronous decode path. Pass the acting identity via\n * `options.actor` on every request-driven decode (authenticated or\n * anonymous — the HTTP adapter always builds one); a decode without\n * an actor is a system call and runs unrestricted.\n */\nexport async function decodeQuery<RECORD extends ObjectLiteral = ObjectLiteral>(\n input: unknown,\n options: DecodeQueryOptions<RECORD>,\n) : Promise<Query> {\n const normalized = isObject(input) || typeof input === 'string' ? input : {};\n\n const parsed = await queryCodec.decodeAsync(normalized, {\n // Schema<RECORD> is invariant; the codec's non-generic options\n // accept Schema<ObjectLiteral>, so collapse the variance here.\n schema: options.schema as Schema<any> | string,\n parameters: options.parameters,\n context: { actor: options.actor } satisfies QueryDecodeContext,\n });\n\n return parsed ?? new Query({});\n}\n\n/**\n * Append server-derived conditions (a route realm, an owner scope, ...)\n * onto a decoded query by AND-wrapping its filter tree. A client-sent\n * condition on the same field intersects with the scope instead of\n * replacing it, and compound client trees (`or(...)`) are preserved\n * as-is. Same guarantee class as a mandatory `andWhere` at the\n * repository — expressed once in the IR. Appended conditions do not\n * pass through `decodeQuery`, so the schema allow-lists do not\n * constrain them (server-derived context).\n *\n * Immutable: returns a new `Query` whose filters node is the\n * AND-wrapped successor (`IFilters.and`); every other parameter node is\n * carried over **by reference**, so the input query stays untouched and\n * nothing is copied. The node enumeration mirrors rapiq's\n * `QueryContext` — keep it in sync when the IR gains a parameter.\n *\n * Non-displaceability is structural since rapiq beta.19\n * (tada5hi/rapiq#890): filter composition is conjunctive throughout, so\n * no later composition step can drop a conjunct and the appended scope\n * needs no marker to survive.\n */\nexport function appendQueryConditions(query: IQuery, ...conditions: ICondition[]) : Query {\n return new Query({\n fields: query.fields,\n filters: query.filters.and(...conditions),\n relations: query.relations,\n pagination: query.pagination,\n sorts: query.sorts,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DA,MAAa8B,iBAAiB,IAAI5B,eAAAA;;;;;GAOlC,MAAa6B,UAA0B;CACnC3B;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;AACH;AAED,KAAK,MAAMG,UAAUD,SACjBD,eAAeG,IAAID,MAAAA;;;;;GAQvB,MAAaE,aAAalC,eAAe8B,cAAAA;;;;;;;;;;;;;;;GAiBzC,eAAsBK,YAClBC,OACAC,SAAmC;CAEnC,MAAMC,aAAanC,SAASiC,KAAAA,KAAU,OAAOA,UAAU,WAAWA,QAAQ,CAAC;CAU3E,OAAOG,MARcL,WAAWM,YAAYF,YAAY;EAGpDN,QAAQK,QAAQL;EAChBS,YAAYJ,QAAQI;EACpBC,SAAS,EAAEC,OAAON,QAAQM,MAAM;CACpC,CAAA,KAEiB,IAAI1C,MAAM,CAAC,CAAA;AAChC;;;;;;;;;;;;;;;;;;;;;GAuBA,SAAgB2C,sBAAsBC,OAAe,GAAGC,YAAwB;CAC5E,OAAO,IAAI7C,MAAM;EACb8C,QAAQF,MAAME;EACdC,SAASH,MAAMG,QAAQC,IAAG,GAAIH,UAAAA;EAC9BI,WAAWL,MAAMK;EACjBC,YAAYN,MAAMM;EAClBC,OAAOP,MAAMO;CACjB,CAAA;AACJ"}
1
+ {"version":3,"file":"module.mjs","names":["createURLCodec","Query","SchemaRegistry","isObject","clientSchema","clientPermissionSchema","clientRoleSchema","clientScopeSchema","consentSchema","eventSchema","identityProviderSchema","identityProviderAccountSchema","identityProviderRoleMappingSchema","keySchema","permissionSchema","permissionPolicySchema","policySchema","realmSchema","roleSchema","roleAttributeSchema","rolePermissionSchema","scopeSchema","sessionSchema","sessionTokenSchema","trustAnchorSchema","userSchema","userAttributeSchema","userAuthenticatorSchema","userPermissionSchema","userRoleSchema","schemaRegistry","schemas","schema","add","queryCodec","decodeQuery","input","options","normalized","parsed","decodeAsync","parameters","context","actor","appendQueryConditions","query","conditions","fields","filters","and","relations","pagination","sorts"],"sources":["../../../src/core/query/module.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 { createURLCodec } from '@rapiq/codec-url';\nimport type {\n ICondition,\n IQuery,\n ObjectLiteral,\n Schema,\n} from '@rapiq/core';\nimport { Query, SchemaRegistry, isObject } from '@rapiq/core';\nimport { clientSchema } from '../entities/client/schema.ts';\nimport { clientPermissionSchema } from '../entities/client-permission/schema.ts';\nimport { clientRoleSchema } from '../entities/client-role/schema.ts';\nimport { clientScopeSchema } from '../entities/client-scope/schema.ts';\nimport { consentSchema } from '../entities/consent/schema.ts';\nimport { eventSchema } from '../entities/event/schema.ts';\nimport { identityProviderSchema } from '../entities/identity-provider/schema.ts';\nimport { identityProviderAccountSchema } from '../entities/identity-provider-account/schema.ts';\nimport { identityProviderRoleMappingSchema } from '../entities/identity-provider-role-mapping/schema.ts';\nimport { keySchema } from '../entities/key/schema.ts';\nimport { permissionSchema } from '../entities/permission/schema.ts';\nimport { permissionPolicySchema } from '../entities/permission-policy/schema.ts';\nimport { policySchema } from '../entities/policy/schema.ts';\nimport { realmSchema } from '../entities/realm/schema.ts';\nimport { roleSchema } from '../entities/role/schema.ts';\nimport { roleAttributeSchema } from '../entities/role-attribute/schema.ts';\nimport { rolePermissionSchema } from '../entities/role-permission/schema.ts';\nimport { scopeSchema } from '../entities/scope/schema.ts';\nimport { sessionSchema } from '../entities/session/schema.ts';\nimport { sessionTokenSchema } from '../entities/session-token/schema.ts';\nimport { trustAnchorSchema } from '../entities/trust-anchor/schema.ts';\nimport { userSchema } from '../entities/user/schema.ts';\nimport { userAttributeSchema } from '../entities/user-attribute/schema.ts';\nimport { userAuthenticatorSchema } from '../entities/user-authenticator/schema.ts';\nimport { userPermissionSchema } from '../entities/user-permission/schema.ts';\nimport { userRoleSchema } from '../entities/user-role/schema.ts';\nimport type { DecodeQueryOptions, QueryDecodeContext } from './types.ts';\n\n/**\n * Registry of every entity schema — the server-side allow-list layer.\n * Relation traversal (e.g. a `realm.name` filter) resolves through the\n * `schemaMapping` of the owning schema into the related schema's own\n * allow-lists.\n *\n * The registry deliberately lives in core (persistence-agnostic): the\n * schemas are security policy over the domain types, and services\n * consume them to decode wire queries into the rapiq IR. A repository\n * layer MAY extend the registry with additional, storage-derived\n * schemas (e.g. `@rapiq/adapter-typeorm`'s `defineSchemaRegistryWithDataSource`\n * with the `registry` option — already-registered schemas take\n * precedence), but the allow-lists themselves stay explicit and are\n * never auto-derived from entity metadata.\n */\nexport const schemaRegistry = new SchemaRegistry();\n\n/**\n * Every registered entity schema. Exported so the invariant guard can\n * enumerate them: `SchemaRegistry` keeps its map protected and exposes\n * no iterator (tada5hi/rapiq#904).\n */\nexport const schemas : Schema<any>[] = [\n clientSchema,\n clientPermissionSchema,\n clientRoleSchema,\n clientScopeSchema,\n consentSchema,\n eventSchema,\n identityProviderSchema,\n identityProviderAccountSchema,\n identityProviderRoleMappingSchema,\n keySchema,\n permissionSchema,\n permissionPolicySchema,\n policySchema,\n realmSchema,\n roleSchema,\n roleAttributeSchema,\n rolePermissionSchema,\n scopeSchema,\n sessionSchema,\n sessionTokenSchema,\n trustAnchorSchema,\n userSchema,\n userAttributeSchema,\n userAuthenticatorSchema,\n userPermissionSchema,\n userRoleSchema,\n];\n\nfor (const schema of schemas) {\n schemaRegistry.add(schema);\n}\n\n/**\n * URL transport codec bound to the schema registry: decodes both the\n * v2 expression dialect (stamped or detected) and legacy v1 bracket\n * payloads, so pre-v2 clients keep working.\n */\nexport const queryCodec = createURLCodec(schemaRegistry);\n\n/**\n * Decode a raw wire query (routup `useRequestQuery` output or a raw\n * query string) against a registered schema into the rapiq IR. The\n * schema's allow-lists, defaults and pagination bounds are applied\n * here — downstream consumers (repository adapters) only execute the\n * returned query.\n *\n * Async because the schema validate hooks are: the relations read\n * gate (`createRelationsReadGate`) awaits the actor's permission\n * pre-gate per include, and rapiq refuses async validators on the\n * synchronous decode path. Pass the acting identity via\n * `options.actor` on every request-driven decode (authenticated or\n * anonymous — the HTTP adapter always builds one); a decode without\n * an actor is a system call and runs unrestricted.\n */\nexport async function decodeQuery<RECORD extends ObjectLiteral = ObjectLiteral>(\n input: unknown,\n options: DecodeQueryOptions<RECORD>,\n) : Promise<Query> {\n const normalized = typeof input === 'string' || isObject(input) ? input : {};\n\n const parsed = await queryCodec.decodeAsync(normalized, {\n // Schema<RECORD> is invariant; the codec's non-generic options\n // accept Schema<ObjectLiteral>, so collapse the variance here.\n schema: options.schema as Schema<any> | string,\n parameters: options.parameters,\n context: { actor: options.actor } satisfies QueryDecodeContext,\n });\n\n return parsed ?? new Query({});\n}\n\n/**\n * Append server-derived conditions (a route realm, an owner scope, ...)\n * onto a decoded query by AND-wrapping its filter tree. A client-sent\n * condition on the same field intersects with the scope instead of\n * replacing it, and compound client trees (`or(...)`) are preserved\n * as-is. Same guarantee class as a mandatory `andWhere` at the\n * repository — expressed once in the IR. Appended conditions do not\n * pass through `decodeQuery`, so the schema allow-lists do not\n * constrain them (server-derived context).\n *\n * Immutable: returns a new `Query` whose filters node is the\n * AND-wrapped successor (`IFilters.and`); every other parameter node is\n * carried over **by reference**, so the input query stays untouched and\n * nothing is copied. The node enumeration mirrors rapiq's\n * `QueryContext` — keep it in sync when the IR gains a parameter.\n *\n * Non-displaceability is structural since rapiq beta.19\n * (tada5hi/rapiq#890): filter composition is conjunctive throughout, so\n * no later composition step can drop a conjunct and the appended scope\n * needs no marker to survive.\n */\nexport function appendQueryConditions(query: IQuery, ...conditions: ICondition[]) : Query {\n return new Query({\n fields: query.fields,\n filters: query.filters.and(...conditions),\n relations: query.relations,\n pagination: query.pagination,\n sorts: query.sorts,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DA,MAAa8B,iBAAiB,IAAI5B,eAAAA;;;;;GAOlC,MAAa6B,UAA0B;CACnC3B;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;AACH;AAED,KAAK,MAAMG,UAAUD,SACjBD,eAAeG,IAAID,MAAAA;;;;;GAQvB,MAAaE,aAAalC,eAAe8B,cAAAA;;;;;;;;;;;;;;;GAiBzC,eAAsBK,YAClBC,OACAC,SAAmC;CAEnC,MAAMC,aAAa,OAAOF,UAAU,YAAYjC,SAASiC,KAAAA,IAASA,QAAQ,CAAC;CAU3E,OAAOG,MARcL,WAAWM,YAAYF,YAAY;EAGpDN,QAAQK,QAAQL;EAChBS,YAAYJ,QAAQI;EACpBC,SAAS,EAAEC,OAAON,QAAQM,MAAM;CACpC,CAAA,KAEiB,IAAI1C,MAAM,CAAC,CAAA;AAChC;;;;;;;;;;;;;;;;;;;;;GAuBA,SAAgB2C,sBAAsBC,OAAe,GAAGC,YAAwB;CAC5E,OAAO,IAAI7C,MAAM;EACb8C,QAAQF,MAAME;EACdC,SAASH,MAAMG,QAAQC,IAAG,GAAIH,UAAAA;EAC9BI,WAAWL,MAAMK;EACjBC,YAAYN,MAAMM;EAClBC,OAAOP,MAAMO;CACjB,CAAA;AACJ"}
@@ -104,7 +104,7 @@ var PermissionBindingPolicyEvaluator = class {
104
104
  pending: true,
105
105
  issues: pendingIssues
106
106
  };
107
- if (ctx.withConditions && lowerable && conditions.length > 0) result.condition = conditions.length === 1 ? conditions[0] : or(...conditions);
107
+ if (lowerable && ctx.withConditions && conditions.length > 0) result.condition = conditions.length === 1 ? conditions[0] : or(...conditions);
108
108
  return result;
109
109
  }
110
110
  const success = maybeInvertPolicyOutcome(false, policy.invert);
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.mjs","names":["and","or","BuiltInPolicyType","IdentityPolicyEvaluator","PermissionBindingPolicyValidator","PolicyEngine","PolicyIssueCode","RealmMatchPolicyEvaluator","RealmScope","aggregatePermissionPolicyBindings","definePolicyIssueItem","maybeInvertPolicyOutcome","normalizeRealmScope","PermissionBindingPolicyEvaluator","validator","identityEvaluator","realmMatchEvaluator","identityPermissionProvider","requires","PERMISSION_BINDING","accessData","ctx","data","has","isValidated","get","set","setValidated","evaluate","value","policy","run","identity","success","issues","code","DATA_MISSING","message","path","binding","identityBindings","getFor","then","bindings","filter","item","permission","name","realmId","clientId","length","invert","aggr","pendingIssues","conditions","pending","lowerable","grant","grants","reachCondition","realmOutcome","scope","realmScope","NONE","ANY","condition","push","engine","evaluators","outcome","withConditions","result"],"sources":["../../../../src/core/security/policy/evaluator.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-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 type { ICondition } from '@rapiq/core';\nimport { and, or } from '@rapiq/core';\nimport type { Issue } from '@ebec/core';\nimport type {\n IPolicyEvaluator,\n PermissionPolicyBindingAggregated,\n PolicyEvaluationContext,\n PolicyEvaluationResult,\n} from '@authup/access';\nimport {\n BuiltInPolicyType,\n IdentityPolicyEvaluator,\n PermissionBindingPolicyValidator,\n PolicyEngine,\n PolicyIssueCode,\n RealmMatchPolicyEvaluator,\n RealmScope,\n aggregatePermissionPolicyBindings,\n definePolicyIssueItem,\n maybeInvertPolicyOutcome,\n normalizeRealmScope,\n} from '@authup/access';\nimport type { IIdentityPermissionProvider } from '../../identity/permission/types.ts';\n\nexport class PermissionBindingPolicyEvaluator implements IPolicyEvaluator {\n protected validator : PermissionBindingPolicyValidator;\n\n protected identityEvaluator: IdentityPolicyEvaluator;\n\n protected realmMatchEvaluator : RealmMatchPolicyEvaluator;\n\n protected identityPermissionProvider: IIdentityPermissionProvider;\n\n constructor(identityPermissionProvider: IIdentityPermissionProvider) {\n this.validator = new PermissionBindingPolicyValidator();\n this.identityEvaluator = new IdentityPolicyEvaluator();\n this.realmMatchEvaluator = new RealmMatchPolicyEvaluator();\n this.identityPermissionProvider = identityPermissionProvider;\n }\n\n requires() : string[] {\n // IDENTITY is deliberately NOT declared: a missing identity must stay a\n // settled DATA_MISSING deny (fail-closed) so a scope-restricted or anonymous\n // bearer still fails the pre-gate through system.default — pending would be\n // permitted there.\n return [BuiltInPolicyType.PERMISSION_BINDING];\n }\n\n async accessData(ctx: PolicyEvaluationContext) : Promise<PermissionPolicyBindingAggregated | null> {\n if (!ctx.data.has(BuiltInPolicyType.PERMISSION_BINDING)) {\n return null;\n }\n\n if (ctx.data.isValidated(BuiltInPolicyType.PERMISSION_BINDING)) {\n return ctx.data.get(BuiltInPolicyType.PERMISSION_BINDING);\n }\n\n const data = ctx.data.get<PermissionPolicyBindingAggregated>(BuiltInPolicyType.PERMISSION_BINDING);\n\n ctx.data.set(BuiltInPolicyType.PERMISSION_BINDING, data);\n ctx.data.setValidated(BuiltInPolicyType.PERMISSION_BINDING);\n\n return data;\n }\n\n async evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult> {\n const policy = await this.validator.run(value);\n\n const identity = await this.identityEvaluator.accessData(ctx);\n if (!identity) {\n return {\n success: false,\n issues: [\n definePolicyIssueItem({\n code: PolicyIssueCode.DATA_MISSING,\n message: 'The data property identity is missing',\n path: ctx.path,\n }),\n ],\n };\n }\n const binding = await this.accessData(ctx);\n if (!binding) {\n return {\n success: false,\n issues: [\n definePolicyIssueItem({\n code: PolicyIssueCode.DATA_MISSING,\n message: 'The data property permission is missing',\n path: ctx.path,\n }),\n ],\n };\n }\n\n const identityBindings = await this.identityPermissionProvider.getFor(identity)\n .then((bindings) => bindings.filter((item) => {\n if (item.permission.name !== binding.permission.name) {\n return false;\n }\n\n return (binding.permission.realmId ?? null) === (item.permission.realmId ?? null) &&\n (binding.permission.clientId ?? null) === (item.permission.clientId ?? null);\n }));\n\n if (identityBindings.length === 0) {\n return { success: maybeInvertPolicyOutcome(false, policy.invert) };\n }\n\n const [aggr] = aggregatePermissionPolicyBindings(identityBindings);\n if (!aggr) {\n return { success: maybeInvertPolicyOutcome(false, policy.invert) };\n }\n\n // identityBindings is filtered to a single (name, realm_id, client_id) key, so the\n // aggregate yields exactly one entry whose `grants` are the actor's per-grant\n // (realm_scope, policy) disjunction terms; access is the DISJUNCTION over them:\n // ∃ grant . realmScopeMatches(grant.realmScope, resource) ∧ (grant.policy passes)\n // Pairing each grant's realm reach with its OWN policy is what fixes both the mixed\n // policy-free + policy-bound UNDER-grant (a policy-free `own` grant must not mask a\n // policy-bound `any` grant's wider reach) and the symmetric OVER-grant (an `own`\n // grant's passing policy must not ride an `any` grant's wider reach).\n const issues : Issue[] = [];\n const pendingIssues : Issue[] = [];\n const conditions : ICondition[] = [];\n let pending = false;\n let lowerable = true;\n for (const grant of aggr.grants) {\n // Realm reach (coarse, actor-relative) — a SEPARATE factor from the grant's\n // policy, ANDed with it. The realm-match evaluator runs in SCOPE MODE: it reads the\n // resource realm from ctx.data[REALM_MATCH] (fallback ATTRIBUTES.realmId) and\n // neutral-passes when absent (preEvaluate / gate checks / realm-less resources) —\n // key-PRESENCE is the discriminator. Invoked DIRECTLY (not via PolicyEngine) so\n // the reach factor can never be skipped by a caller's include/exclude filters or\n // deferred by the engine's data-availability gate.\n //\n // Under `withConditions` (query-build) with no resource realm present, the\n // reach PENDS with its condition form over the row's realm column instead of\n // neutral-passing — `any` stays unrestricted and `none` reaches nothing, so\n // neither pollutes the composed WHERE with constant terms.\n let reachCondition : ICondition | null = null;\n const realmOutcome = await this.realmMatchEvaluator.evaluate(\n { scope: grant.realmScope },\n ctx,\n );\n if (realmOutcome.pending) {\n const scope = normalizeRealmScope(grant.realmScope);\n if (scope === RealmScope.NONE) {\n continue;\n }\n\n if (scope !== RealmScope.ANY) {\n if (!realmOutcome.condition) {\n pending = true;\n lowerable = false;\n continue;\n }\n\n reachCondition = realmOutcome.condition;\n }\n } else if (!realmOutcome.success) {\n continue;\n }\n\n if (!grant.policy) {\n if (!reachCondition) {\n // Reach matches and this grant carries no further restriction.\n return { success: maybeInvertPolicyOutcome(true, policy.invert) };\n }\n\n // Reach is the grant's only restriction — a pure condition term.\n conditions.push(reachCondition);\n pending = true;\n continue;\n }\n\n // Missing evaluators is a misconfiguration: let the engine fail CLOSED with a\n // surfaced POLICY_EVALUATOR_NOT_FOUND issue (new PolicyEngine(undefined) defaults\n // to an empty registry, so grant.policy resolves to no evaluator) rather than\n // swallowing the grant with a silent issue-less deny.\n const engine = new PolicyEngine(ctx.evaluators);\n const outcome = await engine.evaluate(grant.policy, {\n ...ctx,\n path: [\n ...(ctx.path || []),\n ],\n });\n\n if (outcome.success) {\n if (!reachCondition) {\n return { success: maybeInvertPolicyOutcome(true, policy.invert) };\n }\n\n conditions.push(reachCondition);\n pending = true;\n continue;\n }\n\n // A PENDING junction policy (required data key absent — e.g. an ATTRIBUTES\n // policy at the pre-gate) leaves this grant term UNKNOWN, not failed: the\n // grant could still pass once the data arrives, so it must not settle the\n // disjunction to false.\n if (outcome.pending) {\n pending = true;\n\n if (ctx.withConditions && outcome.condition) {\n conditions.push(\n reachCondition ?\n and(reachCondition, outcome.condition) :\n outcome.condition,\n );\n } else {\n lowerable = false;\n }\n\n if (outcome.issues) {\n pendingIssues.push(...outcome.issues);\n }\n\n continue;\n }\n\n if (outcome.issues) {\n issues.push(...outcome.issues);\n }\n }\n\n // No grant term settled true. If some term is still pending, the disjunction is\n // pending — deliberately uninverted (unknown stays unknown under negation). The\n // condition form composes the grant terms as a disjunction, all-or-nothing: a\n // single non-expressible grant term makes the whole binding non-expressible\n // (pushing a partial OR would wrongly exclude rows).\n if (pending) {\n const result : PolicyEvaluationResult = {\n success: false,\n pending: true,\n issues: pendingIssues,\n };\n\n if (ctx.withConditions && lowerable && conditions.length > 0) {\n result.condition = conditions.length === 1 ?\n conditions[0]! :\n or(...conditions);\n }\n\n return result;\n }\n\n // No grant term satisfied (reach ∧ policies). Apply `invert` ONCE to the aggregated\n // disjunction outcome — never per term, which would corrupt the quantifier.\n const success = maybeInvertPolicyOutcome(false, policy.invert);\n return {\n success,\n issues: success ? [] : issues,\n };\n }\n}\n"],"mappings":";;;;;;AA+BA,IAAaa,mCAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEAC;CAEV,YAAYA,4BAAyD;EACjE,KAAKH,YAAY,IAAIV,iCAAAA;EACrB,KAAKW,oBAAoB,IAAIZ,wBAAAA;EAC7B,KAAKa,sBAAsB,IAAIT,0BAAAA;EAC/B,KAAKU,6BAA6BA;CACtC;CAEAC,W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D,OAAO,EAAE1B,SAAStB,yBAAyB,MAAMmB,OAAOqB,MAAM,EAAE;IAGpEG,WAAWY,KAAKP,cAAAA;IAChBJ,UAAU;IACV;GACJ;GAMA,IAAIc,QAAQd,SAAS;IACjBA,UAAU;IAEV,IAAIlC,IAAIiD,kBAAkBD,QAAQJ,WAC9BX,WAAWY,KACPP,iBACI3D,IAAI2D,gBAAgBU,QAAQJ,SAAS,IACrCI,QAAQJ,SAAS;SAGzBT,YAAY;IAGhB,IAAIa,QAAQnC,QACRmB,cAAca,KAAI,GAAIG,QAAQnC,MAAM;IAGxC;GACJ;GAEA,IAAImC,QAAQnC,QACRA,OAAOgC,KAAI,GAAIG,QAAQnC,MAAM;EAErC;EAOA,IAAIqB,SAAS;GACT,MAAMgB,SAAkC;IACpCtC,SAAS;IACTsB,SAAS;IACTrB,QAAQmB;GACZ;GAEA,IAAIhC,IAAIiD,kBAAkBd,aAAaF,WAAWJ,SAAS,GACvDqB,OAAON,YAAYX,WAAWJ,WAAW,IACrCI,WAAW,KACXrD,GAAAA,GAAMqD,UAAAA;GAGd,OAAOiB;EACX;EAIA,MAAMtC,UAAUtB,yBAAyB,OAAOmB,OAAOqB,MAAM;EAC7D,OAAO;GACHlB;GACAC,QAAQD,UAAU,CAAA,IAAKC;EAC3B;CACJ;AACJ"}
1
+ {"version":3,"file":"evaluator.mjs","names":["and","or","BuiltInPolicyType","IdentityPolicyEvaluator","PermissionBindingPolicyValidator","PolicyEngine","PolicyIssueCode","RealmMatchPolicyEvaluator","RealmScope","aggregatePermissionPolicyBindings","definePolicyIssueItem","maybeInvertPolicyOutcome","normalizeRealmScope","PermissionBindingPolicyEvaluator","validator","identityEvaluator","realmMatchEvaluator","identityPermissionProvider","requires","PERMISSION_BINDING","accessData","ctx","data","has","isValidated","get","set","setValidated","evaluate","value","policy","run","identity","success","issues","code","DATA_MISSING","message","path","binding","identityBindings","getFor","then","bindings","filter","item","permission","name","realmId","clientId","length","invert","aggr","pendingIssues","conditions","pending","lowerable","grant","grants","reachCondition","realmOutcome","scope","realmScope","NONE","ANY","condition","push","engine","evaluators","outcome","withConditions","result"],"sources":["../../../../src/core/security/policy/evaluator.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-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 type { ICondition } from '@rapiq/core';\nimport { and, or } from '@rapiq/core';\nimport type { Issue } from '@ebec/core';\nimport type {\n IPolicyEvaluator,\n PermissionPolicyBindingAggregated,\n PolicyEvaluationContext,\n PolicyEvaluationResult,\n} from '@authup/access';\nimport {\n BuiltInPolicyType,\n IdentityPolicyEvaluator,\n PermissionBindingPolicyValidator,\n PolicyEngine,\n PolicyIssueCode,\n RealmMatchPolicyEvaluator,\n RealmScope,\n aggregatePermissionPolicyBindings,\n definePolicyIssueItem,\n maybeInvertPolicyOutcome,\n normalizeRealmScope,\n} from '@authup/access';\nimport type { IIdentityPermissionProvider } from '../../identity/permission/types.ts';\n\nexport class PermissionBindingPolicyEvaluator implements IPolicyEvaluator {\n protected validator : PermissionBindingPolicyValidator;\n\n protected identityEvaluator: IdentityPolicyEvaluator;\n\n protected realmMatchEvaluator : RealmMatchPolicyEvaluator;\n\n protected identityPermissionProvider: IIdentityPermissionProvider;\n\n constructor(identityPermissionProvider: IIdentityPermissionProvider) {\n this.validator = new PermissionBindingPolicyValidator();\n this.identityEvaluator = new IdentityPolicyEvaluator();\n this.realmMatchEvaluator = new RealmMatchPolicyEvaluator();\n this.identityPermissionProvider = identityPermissionProvider;\n }\n\n requires() : string[] {\n // IDENTITY is deliberately NOT declared: a missing identity must stay a\n // settled DATA_MISSING deny (fail-closed) so a scope-restricted or anonymous\n // bearer still fails the pre-gate through system.default — pending would be\n // permitted there.\n return [BuiltInPolicyType.PERMISSION_BINDING];\n }\n\n async accessData(ctx: PolicyEvaluationContext) : Promise<PermissionPolicyBindingAggregated | null> {\n if (!ctx.data.has(BuiltInPolicyType.PERMISSION_BINDING)) {\n return null;\n }\n\n if (ctx.data.isValidated(BuiltInPolicyType.PERMISSION_BINDING)) {\n return ctx.data.get(BuiltInPolicyType.PERMISSION_BINDING);\n }\n\n const data = ctx.data.get<PermissionPolicyBindingAggregated>(BuiltInPolicyType.PERMISSION_BINDING);\n\n ctx.data.set(BuiltInPolicyType.PERMISSION_BINDING, data);\n ctx.data.setValidated(BuiltInPolicyType.PERMISSION_BINDING);\n\n return data;\n }\n\n async evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult> {\n const policy = await this.validator.run(value);\n\n const identity = await this.identityEvaluator.accessData(ctx);\n if (!identity) {\n return {\n success: false,\n issues: [\n definePolicyIssueItem({\n code: PolicyIssueCode.DATA_MISSING,\n message: 'The data property identity is missing',\n path: ctx.path,\n }),\n ],\n };\n }\n const binding = await this.accessData(ctx);\n if (!binding) {\n return {\n success: false,\n issues: [\n definePolicyIssueItem({\n code: PolicyIssueCode.DATA_MISSING,\n message: 'The data property permission is missing',\n path: ctx.path,\n }),\n ],\n };\n }\n\n const identityBindings = await this.identityPermissionProvider.getFor(identity)\n .then((bindings) => bindings.filter((item) => {\n if (item.permission.name !== binding.permission.name) {\n return false;\n }\n\n return (binding.permission.realmId ?? null) === (item.permission.realmId ?? null) &&\n (binding.permission.clientId ?? null) === (item.permission.clientId ?? null);\n }));\n\n if (identityBindings.length === 0) {\n return { success: maybeInvertPolicyOutcome(false, policy.invert) };\n }\n\n const [aggr] = aggregatePermissionPolicyBindings(identityBindings);\n if (!aggr) {\n return { success: maybeInvertPolicyOutcome(false, policy.invert) };\n }\n\n // identityBindings is filtered to a single (name, realm_id, client_id) key, so the\n // aggregate yields exactly one entry whose `grants` are the actor's per-grant\n // (realm_scope, policy) disjunction terms; access is the DISJUNCTION over them:\n // ∃ grant . realmScopeMatches(grant.realmScope, resource) ∧ (grant.policy passes)\n // Pairing each grant's realm reach with its OWN policy is what fixes both the mixed\n // policy-free + policy-bound UNDER-grant (a policy-free `own` grant must not mask a\n // policy-bound `any` grant's wider reach) and the symmetric OVER-grant (an `own`\n // grant's passing policy must not ride an `any` grant's wider reach).\n const issues : Issue[] = [];\n const pendingIssues : Issue[] = [];\n const conditions : ICondition[] = [];\n let pending = false;\n let lowerable = true;\n for (const grant of aggr.grants) {\n // Realm reach (coarse, actor-relative) — a SEPARATE factor from the grant's\n // policy, ANDed with it. The realm-match evaluator runs in SCOPE MODE: it reads the\n // resource realm from ctx.data[REALM_MATCH] (fallback ATTRIBUTES.realmId) and\n // neutral-passes when absent (preEvaluate / gate checks / realm-less resources) —\n // key-PRESENCE is the discriminator. Invoked DIRECTLY (not via PolicyEngine) so\n // the reach factor can never be skipped by a caller's include/exclude filters or\n // deferred by the engine's data-availability gate.\n //\n // Under `withConditions` (query-build) with no resource realm present, the\n // reach PENDS with its condition form over the row's realm column instead of\n // neutral-passing — `any` stays unrestricted and `none` reaches nothing, so\n // neither pollutes the composed WHERE with constant terms.\n let reachCondition : ICondition | null = null;\n const realmOutcome = await this.realmMatchEvaluator.evaluate(\n { scope: grant.realmScope },\n ctx,\n );\n if (realmOutcome.pending) {\n const scope = normalizeRealmScope(grant.realmScope);\n if (scope === RealmScope.NONE) {\n continue;\n }\n\n if (scope !== RealmScope.ANY) {\n if (!realmOutcome.condition) {\n pending = true;\n lowerable = false;\n continue;\n }\n\n reachCondition = realmOutcome.condition;\n }\n } else if (!realmOutcome.success) {\n continue;\n }\n\n if (!grant.policy) {\n if (!reachCondition) {\n // Reach matches and this grant carries no further restriction.\n return { success: maybeInvertPolicyOutcome(true, policy.invert) };\n }\n\n // Reach is the grant's only restriction — a pure condition term.\n conditions.push(reachCondition);\n pending = true;\n continue;\n }\n\n // Missing evaluators is a misconfiguration: let the engine fail CLOSED with a\n // surfaced POLICY_EVALUATOR_NOT_FOUND issue (new PolicyEngine(undefined) defaults\n // to an empty registry, so grant.policy resolves to no evaluator) rather than\n // swallowing the grant with a silent issue-less deny.\n const engine = new PolicyEngine(ctx.evaluators);\n const outcome = await engine.evaluate(grant.policy, {\n ...ctx,\n path: [\n ...(ctx.path || []),\n ],\n });\n\n if (outcome.success) {\n if (!reachCondition) {\n return { success: maybeInvertPolicyOutcome(true, policy.invert) };\n }\n\n conditions.push(reachCondition);\n pending = true;\n continue;\n }\n\n // A PENDING junction policy (required data key absent — e.g. an ATTRIBUTES\n // policy at the pre-gate) leaves this grant term UNKNOWN, not failed: the\n // grant could still pass once the data arrives, so it must not settle the\n // disjunction to false.\n if (outcome.pending) {\n pending = true;\n\n if (ctx.withConditions && outcome.condition) {\n conditions.push(\n reachCondition ?\n and(reachCondition, outcome.condition) :\n outcome.condition,\n );\n } else {\n lowerable = false;\n }\n\n if (outcome.issues) {\n pendingIssues.push(...outcome.issues);\n }\n\n continue;\n }\n\n if (outcome.issues) {\n issues.push(...outcome.issues);\n }\n }\n\n // No grant term settled true. If some term is still pending, the disjunction is\n // pending — deliberately uninverted (unknown stays unknown under negation). The\n // condition form composes the grant terms as a disjunction, all-or-nothing: a\n // single non-expressible grant term makes the whole binding non-expressible\n // (pushing a partial OR would wrongly exclude rows).\n if (pending) {\n const result : PolicyEvaluationResult = {\n success: false,\n pending: true,\n issues: pendingIssues,\n };\n\n if (lowerable && ctx.withConditions && conditions.length > 0) {\n result.condition = conditions.length === 1 ?\n conditions[0]! :\n or(...conditions);\n }\n\n return result;\n }\n\n // No grant term satisfied (reach ∧ policies). Apply `invert` ONCE to the aggregated\n // disjunction outcome — never per term, which would corrupt the quantifier.\n const success = maybeInvertPolicyOutcome(false, policy.invert);\n return {\n success,\n issues: success ? [] : issues,\n };\n }\n}\n"],"mappings":";;;;;;AA+BA,IAAaa,mCAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEAC;CAEV,YAAYA,4BAAyD;EACjE,KAAKH,YAAY,IAAIV,iCAAAA;EACrB,KAAKW,oBAAoB,IAAIZ,wBAAAA;EAC7B,KAAKa,sBAAsB,IAAIT,0BAAAA;EAC/B,KAAKU,6BAA6BA;CACtC;C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