@venizia/ignis 0.2.0-2 → 0.2.0-21

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 (291) hide show
  1. package/dist/base/applications/base.d.ts +14 -13
  2. package/dist/base/applications/base.d.ts.map +1 -1
  3. package/dist/base/applications/base.js +55 -52
  4. package/dist/base/applications/base.js.map +1 -1
  5. package/dist/base/applications/boot-steps.d.ts +13 -0
  6. package/dist/base/applications/boot-steps.d.ts.map +1 -0
  7. package/dist/base/applications/boot-steps.js +23 -0
  8. package/dist/base/applications/boot-steps.js.map +1 -0
  9. package/dist/base/applications/common/index.d.ts +2 -0
  10. package/dist/base/applications/common/index.d.ts.map +1 -0
  11. package/dist/base/applications/common/index.js +18 -0
  12. package/dist/base/applications/common/index.js.map +1 -0
  13. package/dist/base/applications/{types.d.ts → common/types.d.ts} +11 -0
  14. package/dist/base/applications/common/types.d.ts.map +1 -0
  15. package/dist/base/applications/common/types.js.map +1 -0
  16. package/dist/base/applications/index.d.ts +2 -1
  17. package/dist/base/applications/index.d.ts.map +1 -1
  18. package/dist/base/applications/index.js +2 -1
  19. package/dist/base/applications/index.js.map +1 -1
  20. package/dist/base/applications/server.d.ts +4 -2
  21. package/dist/base/applications/server.d.ts.map +1 -1
  22. package/dist/base/applications/server.js +25 -2
  23. package/dist/base/applications/server.js.map +1 -1
  24. package/dist/base/controllers/grpc/adapter.d.ts +2 -1
  25. package/dist/base/controllers/grpc/adapter.d.ts.map +1 -1
  26. package/dist/base/controllers/grpc/adapter.js +4 -3
  27. package/dist/base/controllers/grpc/adapter.js.map +1 -1
  28. package/dist/base/middlewares/app-error/app-error.middleware.d.ts +3 -2
  29. package/dist/base/middlewares/app-error/app-error.middleware.d.ts.map +1 -1
  30. package/dist/base/middlewares/app-error/app-error.middleware.js +4 -3
  31. package/dist/base/middlewares/app-error/app-error.middleware.js.map +1 -1
  32. package/dist/base/middlewares/request-spy/request-spy.middleware.d.ts.map +1 -1
  33. package/dist/base/middlewares/request-spy/request-spy.middleware.js +2 -1
  34. package/dist/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
  35. package/dist/components/api-reference/component.d.ts.map +1 -1
  36. package/dist/components/api-reference/component.js +4 -2
  37. package/dist/components/api-reference/component.js.map +1 -1
  38. package/dist/components/api-reference/index.d.ts +1 -1
  39. package/dist/components/api-reference/index.d.ts.map +1 -1
  40. package/dist/components/api-reference/index.js +1 -1
  41. package/dist/components/api-reference/index.js.map +1 -1
  42. package/dist/components/api-reference/ui/factory.d.ts +14 -0
  43. package/dist/components/api-reference/ui/factory.d.ts.map +1 -0
  44. package/dist/components/api-reference/{ui-factory.js → ui/factory.js} +7 -21
  45. package/dist/components/api-reference/ui/factory.js.map +1 -0
  46. package/dist/components/api-reference/ui/index.d.ts +4 -0
  47. package/dist/components/api-reference/ui/index.d.ts.map +1 -0
  48. package/dist/components/api-reference/ui/index.js +20 -0
  49. package/dist/components/api-reference/ui/index.js.map +1 -0
  50. package/dist/components/api-reference/ui/scalar.d.ts +8 -0
  51. package/dist/components/api-reference/ui/scalar.d.ts.map +1 -0
  52. package/dist/components/api-reference/ui/scalar.js +28 -0
  53. package/dist/components/api-reference/ui/scalar.js.map +1 -0
  54. package/dist/components/api-reference/ui/swagger.d.ts +8 -0
  55. package/dist/components/api-reference/ui/swagger.d.ts.map +1 -0
  56. package/dist/components/api-reference/ui/swagger.js +28 -0
  57. package/dist/components/api-reference/ui/swagger.js.map +1 -0
  58. package/dist/components/auth/authenticate/component.d.ts +10 -1
  59. package/dist/components/auth/authenticate/component.d.ts.map +1 -1
  60. package/dist/components/auth/authenticate/component.js +79 -25
  61. package/dist/components/auth/authenticate/component.js.map +1 -1
  62. package/dist/components/auth/authenticate/controllers/factory.d.ts +33 -2
  63. package/dist/components/auth/authenticate/controllers/factory.d.ts.map +1 -1
  64. package/dist/components/auth/authenticate/controllers/index.d.ts +1 -0
  65. package/dist/components/auth/authenticate/controllers/index.d.ts.map +1 -1
  66. package/dist/components/auth/authenticate/controllers/index.js +1 -0
  67. package/dist/components/auth/authenticate/controllers/index.js.map +1 -1
  68. package/dist/components/auth/authenticate/controllers/service-certs/controller.d.ts +10 -0
  69. package/dist/components/auth/authenticate/controllers/service-certs/controller.d.ts.map +1 -0
  70. package/dist/components/auth/authenticate/controllers/service-certs/controller.js +50 -0
  71. package/dist/components/auth/authenticate/controllers/service-certs/controller.js.map +1 -0
  72. package/dist/components/auth/authenticate/controllers/service-certs/definitions.d.ts +73 -0
  73. package/dist/components/auth/authenticate/controllers/service-certs/definitions.d.ts.map +1 -0
  74. package/dist/components/auth/authenticate/controllers/service-certs/definitions.js +34 -0
  75. package/dist/components/auth/authenticate/controllers/service-certs/definitions.js.map +1 -0
  76. package/dist/components/auth/authenticate/controllers/service-certs/index.d.ts +3 -0
  77. package/dist/components/auth/authenticate/controllers/service-certs/index.d.ts.map +1 -0
  78. package/dist/components/auth/authenticate/controllers/service-certs/index.js +19 -0
  79. package/dist/components/auth/authenticate/controllers/service-certs/index.js.map +1 -0
  80. package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +16 -0
  81. package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts.map +1 -1
  82. package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.js +29 -0
  83. package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
  84. package/dist/components/auth/authenticate/services/index.d.ts +1 -0
  85. package/dist/components/auth/authenticate/services/index.d.ts.map +1 -1
  86. package/dist/components/auth/authenticate/services/index.js +1 -0
  87. package/dist/components/auth/authenticate/services/index.js.map +1 -1
  88. package/dist/components/auth/authenticate/services/service/index.d.ts +3 -0
  89. package/dist/components/auth/authenticate/services/service/index.d.ts.map +1 -0
  90. package/dist/components/auth/authenticate/services/service/index.js +19 -0
  91. package/dist/components/auth/authenticate/services/service/index.js.map +1 -0
  92. package/dist/components/auth/authenticate/services/service/signer.service.d.ts +46 -0
  93. package/dist/components/auth/authenticate/services/service/signer.service.d.ts.map +1 -0
  94. package/dist/components/auth/authenticate/services/service/signer.service.js +135 -0
  95. package/dist/components/auth/authenticate/services/service/signer.service.js.map +1 -0
  96. package/dist/components/auth/authenticate/services/service/verifier.service.d.ts +40 -0
  97. package/dist/components/auth/authenticate/services/service/verifier.service.d.ts.map +1 -0
  98. package/dist/components/auth/authenticate/services/service/verifier.service.js +165 -0
  99. package/dist/components/auth/authenticate/services/service/verifier.service.js.map +1 -0
  100. package/dist/components/auth/authenticate/strategies/index.d.ts +2 -1
  101. package/dist/components/auth/authenticate/strategies/index.d.ts.map +1 -1
  102. package/dist/components/auth/authenticate/strategies/index.js +2 -1
  103. package/dist/components/auth/authenticate/strategies/index.js.map +1 -1
  104. package/dist/components/auth/authenticate/strategies/jwks/index.d.ts +3 -0
  105. package/dist/components/auth/authenticate/strategies/jwks/index.d.ts.map +1 -0
  106. package/dist/components/auth/authenticate/strategies/jwks/index.js +19 -0
  107. package/dist/components/auth/authenticate/strategies/jwks/index.js.map +1 -0
  108. package/dist/components/auth/authenticate/strategies/jwks/issuer.d.ts +13 -0
  109. package/dist/components/auth/authenticate/strategies/jwks/issuer.d.ts.map +1 -0
  110. package/dist/components/auth/authenticate/strategies/{jwks.strategy.js → jwks/issuer.js} +4 -27
  111. package/dist/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -0
  112. package/dist/components/auth/authenticate/strategies/{jwks.strategy.d.ts → jwks/verifier.d.ts} +2 -10
  113. package/dist/components/auth/authenticate/strategies/jwks/verifier.d.ts.map +1 -0
  114. package/dist/components/auth/authenticate/strategies/jwks/verifier.js +45 -0
  115. package/dist/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -0
  116. package/dist/components/auth/authenticate/strategies/service.strategy.d.ts +19 -0
  117. package/dist/components/auth/authenticate/strategies/service.strategy.d.ts.map +1 -0
  118. package/dist/components/auth/authenticate/strategies/service.strategy.js +73 -0
  119. package/dist/components/auth/authenticate/strategies/service.strategy.js.map +1 -0
  120. package/dist/components/auth/authorize/adapters/base-filtered.d.ts +1 -1
  121. package/dist/components/auth/authorize/adapters/base-filtered.d.ts.map +1 -1
  122. package/dist/components/auth/authorize/adapters/base-filtered.js +5 -8
  123. package/dist/components/auth/authorize/adapters/base-filtered.js.map +1 -1
  124. package/dist/components/auth/authorize/adapters/common/index.d.ts +2 -0
  125. package/dist/components/auth/authorize/adapters/common/index.d.ts.map +1 -0
  126. package/dist/components/auth/authorize/adapters/common/index.js +18 -0
  127. package/dist/components/auth/authorize/adapters/common/index.js.map +1 -0
  128. package/dist/components/auth/authorize/adapters/{types.d.ts → common/types.d.ts} +1 -1
  129. package/dist/components/auth/authorize/adapters/common/types.d.ts.map +1 -0
  130. package/dist/components/auth/authorize/adapters/common/types.js.map +1 -0
  131. package/dist/components/auth/authorize/adapters/connector.d.ts +10 -0
  132. package/dist/components/auth/authorize/adapters/connector.d.ts.map +1 -0
  133. package/dist/components/auth/authorize/adapters/connector.js +20 -0
  134. package/dist/components/auth/authorize/adapters/connector.js.map +1 -0
  135. package/dist/components/auth/authorize/adapters/custom-grant-expander.d.ts +52 -0
  136. package/dist/components/auth/authorize/adapters/custom-grant-expander.d.ts.map +1 -0
  137. package/dist/components/auth/authorize/adapters/custom-grant-expander.js +111 -0
  138. package/dist/components/auth/authorize/adapters/custom-grant-expander.js.map +1 -0
  139. package/dist/components/auth/authorize/adapters/index.d.ts +4 -2
  140. package/dist/components/auth/authorize/adapters/index.d.ts.map +1 -1
  141. package/dist/components/auth/authorize/adapters/index.js +4 -2
  142. package/dist/components/auth/authorize/adapters/index.js.map +1 -1
  143. package/dist/components/auth/authorize/adapters/scoped-casbin/adapter.d.ts +93 -0
  144. package/dist/components/auth/authorize/adapters/scoped-casbin/adapter.d.ts.map +1 -0
  145. package/dist/components/auth/authorize/adapters/{scoped-casbin.adapter.js → scoped-casbin/adapter.js} +95 -97
  146. package/dist/components/auth/authorize/adapters/scoped-casbin/adapter.js.map +1 -0
  147. package/dist/components/auth/authorize/adapters/scoped-casbin/common/constants.d.ts +2 -0
  148. package/dist/components/auth/authorize/adapters/scoped-casbin/common/constants.d.ts.map +1 -0
  149. package/dist/components/auth/authorize/adapters/scoped-casbin/common/constants.js +5 -0
  150. package/dist/components/auth/authorize/adapters/scoped-casbin/common/constants.js.map +1 -0
  151. package/dist/components/auth/authorize/adapters/scoped-casbin/common/index.d.ts +3 -0
  152. package/dist/components/auth/authorize/adapters/scoped-casbin/common/index.d.ts.map +1 -0
  153. package/dist/components/auth/authorize/adapters/scoped-casbin/common/index.js +19 -0
  154. package/dist/components/auth/authorize/adapters/scoped-casbin/common/index.js.map +1 -0
  155. package/dist/components/auth/authorize/adapters/scoped-casbin/common/types.d.ts +50 -0
  156. package/dist/components/auth/authorize/adapters/scoped-casbin/common/types.d.ts.map +1 -0
  157. package/dist/components/auth/authorize/adapters/scoped-casbin/common/types.js +3 -0
  158. package/dist/components/auth/authorize/adapters/scoped-casbin/common/types.js.map +1 -0
  159. package/dist/components/auth/authorize/adapters/scoped-casbin/index.d.ts +4 -0
  160. package/dist/components/auth/authorize/adapters/scoped-casbin/index.d.ts.map +1 -0
  161. package/dist/components/auth/authorize/adapters/scoped-casbin/index.js +19 -0
  162. package/dist/components/auth/authorize/adapters/scoped-casbin/index.js.map +1 -0
  163. package/dist/components/auth/authorize/adapters/scoped-casbin/policy-edges.d.ts +17 -0
  164. package/dist/components/auth/authorize/adapters/scoped-casbin/policy-edges.d.ts.map +1 -0
  165. package/dist/components/auth/authorize/adapters/scoped-casbin/policy-edges.js +11 -0
  166. package/dist/components/auth/authorize/adapters/scoped-casbin/policy-edges.js.map +1 -0
  167. package/dist/components/auth/authorize/component.d.ts.map +1 -1
  168. package/dist/components/auth/authorize/component.js +3 -0
  169. package/dist/components/auth/authorize/component.js.map +1 -1
  170. package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts +7 -36
  171. package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts.map +1 -1
  172. package/dist/components/auth/authorize/enforcers/casbin.enforcer.js +48 -117
  173. package/dist/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
  174. package/dist/components/auth/authorize/enforcers/index.d.ts +2 -1
  175. package/dist/components/auth/authorize/enforcers/index.d.ts.map +1 -1
  176. package/dist/components/auth/authorize/enforcers/index.js +2 -1
  177. package/dist/components/auth/authorize/enforcers/index.js.map +1 -1
  178. package/dist/components/auth/authorize/enforcers/policy-line-codec.d.ts +26 -0
  179. package/dist/components/auth/authorize/enforcers/policy-line-codec.d.ts.map +1 -0
  180. package/dist/components/auth/authorize/enforcers/policy-line-codec.js +57 -0
  181. package/dist/components/auth/authorize/enforcers/policy-line-codec.js.map +1 -0
  182. package/dist/components/auth/authorize/enforcers/user-policy-line-cache.d.ts +46 -0
  183. package/dist/components/auth/authorize/enforcers/user-policy-line-cache.d.ts.map +1 -0
  184. package/dist/components/auth/authorize/enforcers/user-policy-line-cache.js +98 -0
  185. package/dist/components/auth/authorize/enforcers/user-policy-line-cache.js.map +1 -0
  186. package/dist/components/auth/authorize/index.d.ts +1 -0
  187. package/dist/components/auth/authorize/index.d.ts.map +1 -1
  188. package/dist/components/auth/authorize/index.js +1 -0
  189. package/dist/components/auth/authorize/index.js.map +1 -1
  190. package/dist/components/auth/authorize/role-managers/base.d.ts +34 -0
  191. package/dist/components/auth/authorize/role-managers/base.d.ts.map +1 -0
  192. package/dist/components/auth/authorize/role-managers/base.js +76 -0
  193. package/dist/components/auth/authorize/role-managers/base.js.map +1 -0
  194. package/dist/components/auth/authorize/role-managers/domain-hierarchy.d.ts +28 -0
  195. package/dist/components/auth/authorize/role-managers/domain-hierarchy.d.ts.map +1 -0
  196. package/dist/components/auth/authorize/role-managers/domain-hierarchy.js +77 -0
  197. package/dist/components/auth/authorize/role-managers/domain-hierarchy.js.map +1 -0
  198. package/dist/components/auth/authorize/role-managers/index.d.ts +5 -0
  199. package/dist/components/auth/authorize/role-managers/index.d.ts.map +1 -0
  200. package/dist/components/auth/authorize/role-managers/index.js +21 -0
  201. package/dist/components/auth/authorize/role-managers/index.js.map +1 -0
  202. package/dist/components/auth/authorize/role-managers/membership.d.ts +21 -0
  203. package/dist/components/auth/authorize/role-managers/membership.d.ts.map +1 -0
  204. package/dist/components/auth/authorize/role-managers/membership.js +69 -0
  205. package/dist/components/auth/authorize/role-managers/membership.js.map +1 -0
  206. package/dist/components/auth/authorize/{enforcers/resource-role-manager.d.ts → role-managers/resource.d.ts} +3 -9
  207. package/dist/components/auth/authorize/role-managers/resource.d.ts.map +1 -0
  208. package/dist/components/auth/authorize/{enforcers/resource-role-manager.js → role-managers/resource.js} +9 -21
  209. package/dist/components/auth/authorize/role-managers/resource.js.map +1 -0
  210. package/dist/components/auth/models/entities/policy-definition.model.d.ts +49 -14
  211. package/dist/components/auth/models/entities/policy-definition.model.d.ts.map +1 -1
  212. package/dist/components/auth/models/entities/policy-definition.model.js +45 -11
  213. package/dist/components/auth/models/entities/policy-definition.model.js.map +1 -1
  214. package/dist/components/auth/models/entities/user.model.d.ts +2 -2
  215. package/dist/components/mail/common/constants.d.ts +7 -0
  216. package/dist/components/mail/common/constants.d.ts.map +1 -1
  217. package/dist/components/mail/common/constants.js +7 -1
  218. package/dist/components/mail/common/constants.js.map +1 -1
  219. package/dist/components/mail/common/types/index.d.ts +6 -0
  220. package/dist/components/mail/common/types/index.d.ts.map +1 -0
  221. package/dist/components/mail/common/types/index.js +22 -0
  222. package/dist/components/mail/common/types/index.js.map +1 -0
  223. package/dist/components/mail/common/types/message.d.ts +48 -0
  224. package/dist/components/mail/common/types/message.d.ts.map +1 -0
  225. package/dist/components/mail/common/types/message.js +3 -0
  226. package/dist/components/mail/common/types/message.js.map +1 -0
  227. package/dist/components/mail/common/types/options.d.ts +42 -0
  228. package/dist/components/mail/common/types/options.d.ts.map +1 -0
  229. package/dist/components/mail/common/types/options.js +3 -0
  230. package/dist/components/mail/common/types/options.js.map +1 -0
  231. package/dist/components/mail/common/types/queue.d.ts +53 -0
  232. package/dist/components/mail/common/types/queue.d.ts.map +1 -0
  233. package/dist/components/mail/common/types/queue.js +3 -0
  234. package/dist/components/mail/common/types/queue.js.map +1 -0
  235. package/dist/components/mail/common/types/template.d.ts +33 -0
  236. package/dist/components/mail/common/types/template.d.ts.map +1 -0
  237. package/dist/components/mail/common/types/template.js +3 -0
  238. package/dist/components/mail/common/types/template.js.map +1 -0
  239. package/dist/components/mail/common/types/verification.d.ts +26 -0
  240. package/dist/components/mail/common/types/verification.d.ts.map +1 -0
  241. package/dist/components/mail/common/types/verification.js +3 -0
  242. package/dist/components/mail/common/types/verification.js.map +1 -0
  243. package/dist/components/mail/services/generators/index.d.ts +4 -0
  244. package/dist/components/mail/services/generators/index.d.ts.map +1 -0
  245. package/dist/components/mail/services/generators/index.js +20 -0
  246. package/dist/components/mail/services/generators/index.js.map +1 -0
  247. package/dist/components/mail/services/generators/numeric-code.d.ts +7 -0
  248. package/dist/components/mail/services/generators/numeric-code.d.ts.map +1 -0
  249. package/dist/components/mail/services/generators/numeric-code.js +20 -0
  250. package/dist/components/mail/services/generators/numeric-code.js.map +1 -0
  251. package/dist/components/mail/services/generators/random-token.d.ts +7 -0
  252. package/dist/components/mail/services/generators/random-token.d.ts.map +1 -0
  253. package/dist/components/mail/services/generators/random-token.js +18 -0
  254. package/dist/components/mail/services/generators/random-token.js.map +1 -0
  255. package/dist/components/mail/services/generators/verification-data.d.ts +9 -0
  256. package/dist/components/mail/services/generators/verification-data.d.ts.map +1 -0
  257. package/dist/components/mail/services/{generator.service.js → generators/verification-data.js} +10 -25
  258. package/dist/components/mail/services/generators/verification-data.js.map +1 -0
  259. package/dist/components/mail/services/index.d.ts +1 -1
  260. package/dist/components/mail/services/index.d.ts.map +1 -1
  261. package/dist/components/mail/services/index.js +1 -1
  262. package/dist/components/mail/services/index.js.map +1 -1
  263. package/dist/components/static-asset/controller/factory.d.ts +34 -2
  264. package/dist/components/static-asset/controller/factory.d.ts.map +1 -1
  265. package/dist/components/static-asset/models/base.model.d.ts +4 -4
  266. package/dist/index.d.ts +1 -1
  267. package/dist/index.d.ts.map +1 -1
  268. package/package.json +22 -23
  269. package/dist/base/applications/types.d.ts.map +0 -1
  270. package/dist/base/applications/types.js.map +0 -1
  271. package/dist/components/api-reference/ui-factory.d.ts +0 -21
  272. package/dist/components/api-reference/ui-factory.d.ts.map +0 -1
  273. package/dist/components/api-reference/ui-factory.js.map +0 -1
  274. package/dist/components/auth/authenticate/strategies/jwks.strategy.d.ts.map +0 -1
  275. package/dist/components/auth/authenticate/strategies/jwks.strategy.js.map +0 -1
  276. package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.d.ts +0 -121
  277. package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.d.ts.map +0 -1
  278. package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.js.map +0 -1
  279. package/dist/components/auth/authorize/adapters/types.d.ts.map +0 -1
  280. package/dist/components/auth/authorize/adapters/types.js.map +0 -1
  281. package/dist/components/auth/authorize/enforcers/resource-role-manager.d.ts.map +0 -1
  282. package/dist/components/auth/authorize/enforcers/resource-role-manager.js.map +0 -1
  283. package/dist/components/mail/common/types.d.ts +0 -201
  284. package/dist/components/mail/common/types.d.ts.map +0 -1
  285. package/dist/components/mail/common/types.js +0 -10
  286. package/dist/components/mail/common/types.js.map +0 -1
  287. package/dist/components/mail/services/generator.service.d.ts +0 -14
  288. package/dist/components/mail/services/generator.service.d.ts.map +0 -1
  289. package/dist/components/mail/services/generator.service.js.map +0 -1
  290. /package/dist/base/applications/{types.js → common/types.js} +0 -0
  291. /package/dist/components/auth/authorize/adapters/{types.js → common/types.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/adapters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0DAAwC;AACxC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/adapters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2CAAyB;AACzB,8CAA4B;AAC5B,0DAAwC;AACxC,kDAAgC"}
@@ -0,0 +1,93 @@
1
+ import type { IdType } from '../../../../../base';
2
+ import { type Model } from 'casbin';
3
+ import { type SQL } from 'drizzle-orm';
4
+ import { BaseFilteredAdapter } from '../base-filtered';
5
+ import { CustomGrantExpander } from '../custom-grant-expander';
6
+ import type { ICasbinPolicySource, IScopedCasbinEntities } from '../common';
7
+ import { type TPrincipalPolicyRow } from './policy-edges';
8
+ import { type IScopedCasbinPolicyFilter, type TGrantRow, type TResolveDomainEdgesFn } from './common';
9
+ /**
10
+ * Filtered casbin adapter for the scoped RBAC model: loads ONE principal's edges (role assignments,
11
+ * memberships, grants) plus the shared structural hierarchy trees as casbin lines. Read-only.
12
+ *
13
+ * EVERY branch below must select by `variant = <known value>` or `variant IN (<known values>)`.
14
+ * Never `variant NOT IN (...)`, and never a bare select that classifies afterwards. Applications
15
+ * store their own edge kinds in this same table (declared via `extraVariants`), and an exclusion
16
+ * filter would sweep those unknown rows into a branch that has no idea what they mean. The current
17
+ * shape makes an undeclared variant inert, which is what makes sharing the table safe.
18
+ */
19
+ export declare class ScopedCasbinAdapter extends BaseFilteredAdapter<IScopedCasbinPolicyFilter> {
20
+ protected readonly entities: IScopedCasbinEntities;
21
+ protected readonly customGrantExpander: CustomGrantExpander;
22
+ protected readonly resolveDomainEdges?: TResolveDomainEdgesFn;
23
+ constructor(opts: {
24
+ dataSource: ICasbinPolicySource;
25
+ entities: IScopedCasbinEntities;
26
+ resolveDomainEdges?: TResolveDomainEdgesFn;
27
+ });
28
+ /**
29
+ * One wave: the principal-scoped CTE and the merged structural-edges query are issued together -
30
+ * the role closure resolves in SQL, so neither waits on the other. `resolveDomainEdges` cannot
31
+ * join that wave - it needs the domain closure the principal-scoped CTE produces - but it does
32
+ * not wait for the structural-edges query either: both run concurrently once the closure is known.
33
+ */
34
+ loadFilteredPolicy(model: Model, filter: IScopedCasbinPolicyFilter): Promise<void>;
35
+ /** Route one `direct` row to its casbin line, or to the grant batch. */
36
+ protected collectDirectRow(opts: {
37
+ row: TPrincipalPolicyRow;
38
+ principal: {
39
+ type: string;
40
+ id: IdType;
41
+ };
42
+ lines: string[];
43
+ directGrants: TGrantRow[];
44
+ }): void;
45
+ /**
46
+ * Calls the `resolveDomainEdges` hook, if supplied, and turns its edges into `g3` lines using
47
+ * the same shape the DOMAIN_EDGE branch emits. A throwing hook is logged and treated as no
48
+ * edges - the rows already gathered for this principal still load. This is the safe direction:
49
+ * a missing hierarchy edge can only narrow what `g`/`g2`/`g3` reach, never widen it, so the
50
+ * failure degrades to less access rather than either an outage or excess access.
51
+ */
52
+ protected resolveDomainEdgeLines(opts: {
53
+ principal: {
54
+ type: string;
55
+ id: IdType;
56
+ };
57
+ domains: string[];
58
+ }): Promise<string[]>;
59
+ /** Schema for a table, defaulting to `public`. */
60
+ protected schemaOf(table: {
61
+ schemaName?: string;
62
+ }): string;
63
+ /** The casbin domain token, built from the stored pair - one expression for every SELECT so they cannot drift. NULL reaches `buildGrantLines` as `ANY_MEMBER`. The alias is emitted raw for the same reason as in `softDeleteClause`: quoting folds it to a different case than the unquoted FROM alias. */
64
+ protected domainTokenSelection(opts: {
65
+ alias: string;
66
+ }): SQL;
67
+ /** Schema-qualified table reference (`"<schema>"."<table>"`) for use after FROM/JOIN with an alias. */
68
+ protected qualifiedTable(opts: {
69
+ table: {
70
+ schemaName?: string;
71
+ tableName: string;
72
+ };
73
+ }): SQL;
74
+ /** `AND <alias>.<col> IS NULL` when soft-delete is on, else empty. The alias is emitted raw to match the unquoted FROM alias - quoting folds it to a different case and breaks the join. */
75
+ protected softDeleteClause(opts: {
76
+ alias: string;
77
+ }): SQL;
78
+ /** One statement for everything scoped to a principal: its own edges, the role_inherits edges reachable from its roles, and the grants of that closure. `UNION` in the recursive term is what terminates a cyclic role graph. */
79
+ protected queryPrincipalPolicies(opts: {
80
+ principal: {
81
+ type: string;
82
+ id: IdType;
83
+ };
84
+ }): Promise<TPrincipalPolicyRow[]>;
85
+ /** Turn fetched grant rows into casbin lines. Shared by the direct and role-closure branches. */
86
+ protected buildGrantLines(opts: {
87
+ subjectType: string;
88
+ rows: TGrantRow[];
89
+ }): Promise<string[]>;
90
+ /** The two code-fixed structural trees only (`g4` resource, `g5` action) - constant regardless of tenant count. Domain edges (`g3`) grow with the domain count, so they are principal-scoped in {@link queryPrincipalPolicies} instead. */
91
+ protected queryEdgePolicies(): Promise<string[]>;
92
+ }
93
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAO,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAQ5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAwB,MAAM,0BAA0B,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAEL,KAAK,yBAAyB,EAE9B,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAElB;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB,CAAC,yBAAyB,CAAC;IACrF,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC5D,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC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E,GAAG,GAAG;IASxD,iOAAiO;cACjN,sBAAsB,CAAC,IAAI,EAAE;QAC3C,SAAS,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KACzC,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA8IlC,iGAAiG;cACjF,eAAe,CAAC,IAAI,EAAE;QACpC,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,SAAS,EAAE,CAAC;KACnB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA4FrB,2OAA2O;cAC3N,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CA6BvD"}
@@ -1,58 +1,87 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScopedCasbinAdapter = exports.PrincipalPolicyEdges = void 0;
3
+ exports.ScopedCasbinAdapter = void 0;
4
4
  const drizzle_orm_1 = require("drizzle-orm");
5
5
  const ignis_kernel_1 = require("@venizia/ignis-kernel");
6
6
  const ignis_kernel_2 = require("@venizia/ignis-kernel");
7
- const base_filtered_1 = require("./base-filtered");
8
- class PrincipalPolicyEdges {
9
- static { this.DIRECT = 'direct'; }
10
- static { this.ROLE_EDGE = 'roleEdge'; }
11
- static { this.ROLE_GRANT = 'roleGrant'; }
12
- static { this.DOMAIN_EDGE = 'domainEdge'; }
13
- }
14
- exports.PrincipalPolicyEdges = PrincipalPolicyEdges;
15
- const DEFAULT_SCHEMA = 'public';
16
- /** Filtered casbin adapter for the scoped RBAC model: loads ONE principal's edges (role assignments, memberships, grants) plus the shared structural hierarchy trees as casbin lines. Read-only. */
7
+ const base_filtered_1 = require("../base-filtered");
8
+ const custom_grant_expander_1 = require("../custom-grant-expander");
9
+ const policy_edges_1 = require("./policy-edges");
10
+ const common_1 = require("./common");
11
+ /**
12
+ * Filtered casbin adapter for the scoped RBAC model: loads ONE principal's edges (role assignments,
13
+ * memberships, grants) plus the shared structural hierarchy trees as casbin lines. Read-only.
14
+ *
15
+ * EVERY branch below must select by `variant = <known value>` or `variant IN (<known values>)`.
16
+ * Never `variant NOT IN (...)`, and never a bare select that classifies afterwards. Applications
17
+ * store their own edge kinds in this same table (declared via `extraVariants`), and an exclusion
18
+ * filter would sweep those unknown rows into a branch that has no idea what they mean. The current
19
+ * shape makes an undeclared variant inert, which is what makes sharing the table safe.
20
+ */
17
21
  class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
18
22
  constructor(opts) {
19
23
  super({ scope: ScopedCasbinAdapter.name, dataSource: opts.dataSource });
20
24
  this.entities = opts.entities;
25
+ this.resolveDomainEdges = opts.resolveDomainEdges;
26
+ this.customGrantExpander = new custom_grant_expander_1.CustomGrantExpander({
27
+ dataSource: opts.dataSource,
28
+ entities: { permission: opts.entities.permission, softDelete: opts.entities.softDelete },
29
+ });
21
30
  }
22
- /** One wave: the principal-scoped CTE and the merged structural-edges query are issued together - the role closure resolves in SQL, so neither waits on the other. */
31
+ /**
32
+ * One wave: the principal-scoped CTE and the merged structural-edges query are issued together -
33
+ * the role closure resolves in SQL, so neither waits on the other. `resolveDomainEdges` cannot
34
+ * join that wave - it needs the domain closure the principal-scoped CTE produces - but it does
35
+ * not wait for the structural-edges query either: both run concurrently once the closure is known.
36
+ */
23
37
  async loadFilteredPolicy(model, filter) {
24
38
  const { principal } = filter;
25
39
  const { principals } = this.entities;
26
- const [principalRows, structuralEdges] = await Promise.all([
27
- this.queryPrincipalPolicies({ principal }),
28
- this.queryEdgePolicies(),
29
- ]);
40
+ const principalPoliciesPromise = this.queryPrincipalPolicies({ principal });
41
+ const structuralEdgesPromise = this.queryEdgePolicies();
42
+ const principalRows = await principalPoliciesPromise;
30
43
  const lines = [];
31
44
  const directGrants = [];
32
45
  const roleGrants = [];
46
+ const domainClosure = new Set();
33
47
  for (const row of principalRows) {
34
48
  switch (row.kind) {
35
- case PrincipalPolicyEdges.ROLE_EDGE: {
49
+ case policy_edges_1.PrincipalPolicyEdges.ROLE_EDGE: {
36
50
  lines.push(`${ignis_kernel_2.AuthorizationPolicyVariants.ROLE_INHERITS.rule}, ${principals.role}_${row.subjectId}, ${principals.role}_${row.targetId}, *`);
37
51
  break;
38
52
  }
39
- case PrincipalPolicyEdges.ROLE_GRANT: {
53
+ case policy_edges_1.PrincipalPolicyEdges.ROLE_GRANT: {
40
54
  roleGrants.push(row);
41
55
  break;
42
56
  }
43
- case PrincipalPolicyEdges.DOMAIN_EDGE: {
57
+ case policy_edges_1.PrincipalPolicyEdges.DOMAIN_EDGE: {
44
58
  lines.push(`${ignis_kernel_2.AuthorizationPolicyVariants.DOMAIN_INHERITS.rule}, ${row.subjectId}, ${row.targetId}`);
59
+ // Both ends are, by construction, members of the principal's domain_closure CTE.
60
+ domainClosure.add(String(row.subjectId));
61
+ domainClosure.add(String(row.targetId));
45
62
  break;
46
63
  }
47
64
  default: {
65
+ if (row.variant === ignis_kernel_2.AuthorizationPolicyVariants.JOIN_DOMAIN.action) {
66
+ domainClosure.add(`${row.targetType}_${row.targetId}`);
67
+ }
48
68
  this.collectDirectRow({ row, principal, lines, directGrants });
49
69
  break;
50
70
  }
51
71
  }
52
72
  }
73
+ const hookLinesPromise = this.resolveDomainEdgeLines({
74
+ principal,
75
+ domains: [...domainClosure],
76
+ });
53
77
  lines.push(...(await this.buildGrantLines({ subjectType: principal.type, rows: directGrants })));
54
78
  lines.push(...(await this.buildGrantLines({ subjectType: principals.role, rows: roleGrants })));
79
+ const [structuralEdges, hookLines] = await Promise.all([
80
+ structuralEdgesPromise,
81
+ hookLinesPromise,
82
+ ]);
55
83
  lines.push(...structuralEdges);
84
+ lines.push(...hookLines);
56
85
  await this.loadLines({ model, lines });
57
86
  }
58
87
  /** Route one `direct` row to its casbin line, or to the grant batch. */
@@ -80,9 +109,43 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
80
109
  }
81
110
  }
82
111
  }
112
+ /**
113
+ * Calls the `resolveDomainEdges` hook, if supplied, and turns its edges into `g3` lines using
114
+ * the same shape the DOMAIN_EDGE branch emits. A throwing hook is logged and treated as no
115
+ * edges - the rows already gathered for this principal still load. This is the safe direction:
116
+ * a missing hierarchy edge can only narrow what `g`/`g2`/`g3` reach, never widen it, so the
117
+ * failure degrades to less access rather than either an outage or excess access.
118
+ */
119
+ async resolveDomainEdgeLines(opts) {
120
+ if (!this.resolveDomainEdges) {
121
+ return [];
122
+ }
123
+ let edges;
124
+ try {
125
+ edges = await this.resolveDomainEdges(opts);
126
+ }
127
+ catch (error) {
128
+ this.logger
129
+ .for(this.resolveDomainEdgeLines.name)
130
+ .error('resolveDomainEdges hook threw - continuing without its edges for this load | principal: %s_%s | error: %s', opts.principal.type, opts.principal.id, error);
131
+ return [];
132
+ }
133
+ return edges.map(edge => `${ignis_kernel_2.AuthorizationPolicyVariants.DOMAIN_INHERITS.rule}, ${edge.child}, ${edge.parent}`);
134
+ }
83
135
  /** Schema for a table, defaulting to `public`. */
84
136
  schemaOf(table) {
85
- return table.schemaName ?? DEFAULT_SCHEMA;
137
+ return table.schemaName ?? common_1.DEFAULT_SCHEMA;
138
+ }
139
+ /** The casbin domain token, built from the stored pair - one expression for every SELECT so they cannot drift. NULL reaches `buildGrantLines` as `ANY_MEMBER`. The alias is emitted raw for the same reason as in `softDeleteClause`: quoting folds it to a different case than the unquoted FROM alias. */
140
+ domainTokenSelection(opts) {
141
+ const column = (name) => (0, drizzle_orm_1.sql) `${drizzle_orm_1.sql.raw(opts.alias)}.${drizzle_orm_1.sql.identifier(name)}`;
142
+ const domainType = column('domain_type');
143
+ const domainId = column('domain_id');
144
+ return (0, drizzle_orm_1.sql) `CASE
145
+ WHEN ${domainType} IS NULL THEN NULL
146
+ WHEN ${domainId} IS NULL THEN ${domainType}
147
+ ELSE ${domainType} || '_' || ${domainId}::text
148
+ END AS "domain"`;
86
149
  }
87
150
  /** Schema-qualified table reference (`"<schema>"."<table>"`) for use after FROM/JOIN with an alias. */
88
151
  qualifiedTable(opts) {
@@ -145,14 +208,14 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
145
208
  )
146
209
 
147
210
  SELECT
148
- ${PrincipalPolicyEdges.DIRECT}::text AS "kind",
211
+ ${policy_edges_1.PrincipalPolicyEdges.DIRECT}::text AS "kind",
149
212
  policyDefinition.variant,
150
213
  policyDefinition.subject_id::text AS "subjectId",
151
214
  policyDefinition.target_type AS "targetType",
152
215
  policyDefinition.target_id::text AS "targetId",
153
216
  policyDefinition.action,
154
217
  policyDefinition.effect,
155
- policyDefinition.domain,
218
+ ${this.domainTokenSelection({ alias: 'policyDefinition' })},
156
219
  permission.code AS "objectCode",
157
220
  permission.subject AS "objectSubject",
158
221
  permission.method AS "objectMethod"${metadataSelection}
@@ -174,7 +237,7 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
174
237
  UNION ALL
175
238
 
176
239
  SELECT
177
- ${PrincipalPolicyEdges.ROLE_EDGE}::text AS "kind",
240
+ ${policy_edges_1.PrincipalPolicyEdges.ROLE_EDGE}::text AS "kind",
178
241
  policyDefinition.variant,
179
242
  policyDefinition.subject_id::text AS "subjectId",
180
243
  policyDefinition.target_type AS "targetType",
@@ -192,14 +255,14 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
192
255
  UNION ALL
193
256
 
194
257
  SELECT
195
- ${PrincipalPolicyEdges.ROLE_GRANT}::text AS "kind",
258
+ ${policy_edges_1.PrincipalPolicyEdges.ROLE_GRANT}::text AS "kind",
196
259
  policyDefinition.variant,
197
260
  policyDefinition.subject_id::text AS "subjectId",
198
261
  policyDefinition.target_type AS "targetType",
199
262
  policyDefinition.target_id::text AS "targetId",
200
263
  policyDefinition.action,
201
264
  policyDefinition.effect,
202
- policyDefinition.domain,
265
+ ${this.domainTokenSelection({ alias: 'policyDefinition' })},
203
266
  permission.code AS "objectCode",
204
267
  permission.subject AS "objectSubject",
205
268
  permission.method AS "objectMethod"${metadataSelection}
@@ -213,7 +276,7 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
213
276
  UNION ALL
214
277
 
215
278
  SELECT
216
- ${PrincipalPolicyEdges.DOMAIN_EDGE}::text AS "kind",
279
+ ${policy_edges_1.PrincipalPolicyEdges.DOMAIN_EDGE}::text AS "kind",
217
280
  policyDefinition.variant,
218
281
  policyDefinition.subject_type || '_' || policyDefinition.subject_id::text AS "subjectId",
219
282
  NULL AS "targetType",
@@ -268,7 +331,7 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
268
331
  .error('Skipping custom grant row whose subject or method did not resolve - the target is missing or soft-deleted | subject: %s_%s | object: %s', subjectType, row.subjectId, row.objectCode);
269
332
  continue;
270
333
  }
271
- const rejection = this.rejectCustomRow({
334
+ const rejection = this.customGrantExpander.rejectCustomRow({
272
335
  row: {
273
336
  subjectId: row.subjectId,
274
337
  objectCode: row.objectCode,
@@ -290,78 +353,13 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
290
353
  effect,
291
354
  });
292
355
  }
293
- lines.push(...(await this.expandCustomGrants({ subjectType, customRows })));
294
- return lines;
295
- }
296
- /** Why a custom-looking grant row cannot be honoured, or null when it is well formed. */
297
- rejectCustomRow(opts) {
298
- const { row, parsed, isCustomAction, metadataColumnName } = opts;
299
- if (isCustomAction && !metadataColumnName) {
300
- return `Skipping custom grant - entities.policyDefinition.metadata.columnName is not mapped, so metadata.ops cannot be read | subject id: ${row.subjectId} | object: ${row.objectCode}`;
301
- }
302
- if (isCustomAction && !parsed) {
303
- return `Skipping custom grant - metadata.ops is missing, empty, or not an array of non-empty strings | subject id: ${row.subjectId} | object: ${row.objectCode}`;
304
- }
305
- if (!isCustomAction && parsed) {
306
- return `Skipping grant - metadata.ops is present but action is not "${ignis_kernel_2.AuthorizationActions.CUSTOM}", so the intent is ambiguous | subject id: ${row.subjectId} | object: ${row.objectCode}`;
307
- }
308
- if (row.objectMethod !== ignis_kernel_1.AuthorizationPermissionBuilder.RESOURCE_NODE_METHOD) {
309
- return `Skipping custom grant - the target must be a subject-level resource node | subject id: ${row.subjectId} | object: ${row.objectCode}`;
310
- }
311
- return null;
312
- }
313
- /** Resolve every custom row's ops in one catalog query, then emit one line per resolved operation. */
314
- async expandCustomGrants(opts) {
315
- if (!opts.customRows.length) {
316
- return [];
317
- }
318
- const seen = new Set();
319
- const pairs = [];
320
- const candidates = opts.customRows.flatMap(row => row.ops.map(op => ({ subject: row.objectSubject, method: op })));
321
- for (const candidate of candidates) {
322
- const key = `${candidate.subject}.${candidate.method}`;
323
- if (seen.has(key)) {
324
- continue;
325
- }
326
- seen.add(key);
327
- pairs.push(candidate);
328
- }
329
- const catalog = await this.queryOperationCatalog({ pairs });
330
- const byKey = new Map(catalog.map(entry => [`${entry.subject}.${entry.method}`, entry]));
331
- const lines = [];
332
- for (const row of opts.customRows) {
333
- const { valid, unknown } = ignis_kernel_1.GrantBuilder.getInstance().validateCustomGrantOps({
334
- ops: row.ops,
335
- subject: row.objectSubject,
336
- catalog,
337
- });
338
- if (unknown.length) {
339
- this.logger
340
- .for(this.expandCustomGrants.name)
341
- .error('Skipping unresolvable operations in a custom grant | subject id: %s | resource: %s | unknown: %s', row.subjectId, row.objectSubject, unknown.join(', '));
342
- }
343
- for (const op of valid) {
344
- const entry = byKey.get(`${row.objectSubject}.${op}`);
345
- lines.push(`${ignis_kernel_2.AuthorizationPolicyVariants.GRANT.rule}, ${opts.subjectType}_${row.subjectId}, ${row.domain}, ${entry.code}, ${entry.action}, ${row.effect}`);
346
- }
356
+ const expanded = await this.customGrantExpander.expandCustomGrants({ subjectType, customRows });
357
+ for (const rejection of expanded.rejections) {
358
+ this.logger.for(this.buildGrantLines.name).error(rejection);
347
359
  }
360
+ lines.push(...expanded.lines);
348
361
  return lines;
349
362
  }
350
- /** Resolve `(subject, method)` pairs to catalogued operations. One query for the whole extraction. */
351
- async queryOperationCatalog(opts) {
352
- if (!opts.pairs.length) {
353
- return [];
354
- }
355
- const permissionTable = this.qualifiedTable({ table: this.entities.permission });
356
- return this.query({
357
- statement: (0, drizzle_orm_1.sql) `
358
- SELECT permission.subject, permission.method, permission.code, permission.action
359
- FROM ${permissionTable} permission
360
- WHERE (permission.subject, permission.method) IN (${drizzle_orm_1.sql.join(opts.pairs.map(pair => (0, drizzle_orm_1.sql) `(${pair.subject}, ${pair.method})`), (0, drizzle_orm_1.sql) `, `)})
361
- AND permission.method <> ${ignis_kernel_1.AuthorizationPermissionBuilder.RESOURCE_NODE_METHOD}${this.softDeleteClause({ alias: 'permission' })}
362
- `,
363
- });
364
- }
365
363
  /** The two code-fixed structural trees only (`g4` resource, `g5` action) - constant regardless of tenant count. Domain edges (`g3`) grow with the domain count, so they are principal-scoped in {@link queryPrincipalPolicies} instead. */
366
364
  async queryEdgePolicies() {
367
365
  const { policyDefinition, permission } = this.entities;
@@ -392,4 +390,4 @@ class ScopedCasbinAdapter extends base_filtered_1.BaseFilteredAdapter {
392
390
  }
393
391
  }
394
392
  exports.ScopedCasbinAdapter = ScopedCasbinAdapter;
395
- //# sourceMappingURL=scoped-casbin.adapter.js.map
393
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/adapter.ts"],"names":[],"mappings":";;;AAEA,6CAA4C;AAC5C,wDAAqD;AACrD,wDAK+B;AAC/B,oDAAuD;AACvD,oEAAqF;AAErF,iDAAgF;AAChF,qCAMkB;AAElB;;;;;;;;;GASG;AACH,MAAa,mBAAoB,SAAQ,mCAA8C;IAKrF,YAAY,IAIX;QACC,KAAK,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC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CAA2B,CAAC,eAAe,CAAC,IAAI;;;aAG7C,qBAAqB;yCACO,0CAA2B,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;KAC7I;SACA,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAvdD,kDAudC"}
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_SCHEMA = "public";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SCHEMA = void 0;
4
+ exports.DEFAULT_SCHEMA = 'public';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './constants';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./constants"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B"}
@@ -0,0 +1,50 @@
1
+ import type { IdType } from '../../../../../../base';
2
+ import type { TNullable } from '@venizia/ignis-helpers/common';
3
+ export type TDomainHierarchyEdge = {
4
+ child: string;
5
+ parent: string;
6
+ };
7
+ export interface IScopedCasbinPolicyFilter {
8
+ principal: {
9
+ type: string;
10
+ id: IdType;
11
+ };
12
+ }
13
+ /** A grant row as fetched, before it becomes casbin lines. Permission columns are null when the join misses. */
14
+ export type TGrantRow = {
15
+ subjectId: IdType;
16
+ objectCode: TNullable<string>;
17
+ objectSubject: TNullable<string>;
18
+ objectMethod: TNullable<string>;
19
+ action: TNullable<string>;
20
+ effect: TNullable<string>;
21
+ domain: TNullable<string>;
22
+ metadata?: unknown;
23
+ };
24
+ /**
25
+ * Per-principal domain edges sourced from business data the app already owns (e.g. a tenant
26
+ * foreign key) - read live on every cache miss, never duplicated into `domain_inherits`. An app
27
+ * whose hierarchy genuinely lives in `domain_inherits` rows does not need this hook at all: the
28
+ * DOMAIN_EDGE branch above already emits those as `g3` lines. `domains` is the principal's own
29
+ * domain closure, already `<Type>_<id>` tokens; the returned edges must be too - neither side
30
+ * re-formats them.
31
+ *
32
+ * `domains` is the principal's **membership closure** - built from `join_domain` rows plus both
33
+ * ends of every `domainEdge` row. It is NOT the set of domains the principal holds a role in via
34
+ * `assign_role`: a principal can carry `assign_role` at a domain it never joined. A hook ported
35
+ * from a mechanism that derived its domains from `assign_role` will silently lose access for
36
+ * exactly those principals - no error, no log, just fewer edges reaching `g`/`g2`/`g3` than before.
37
+ *
38
+ * More than one hierarchy axis (e.g. an organizer tree and a separate region tree)? Write one
39
+ * function per axis and concatenate their results here - this hook deliberately takes a single
40
+ * function, so composition stays visible in the application, not hidden inside the framework:
41
+ * `resolveDomainEdges: async opts => [...(await organizerEdges(opts)), ...(await regionEdges(opts))]`.
42
+ */
43
+ export type TResolveDomainEdgesFn = (opts: {
44
+ principal: {
45
+ type: string;
46
+ id: IdType;
47
+ };
48
+ domains: string[];
49
+ }) => Promise<TDomainHierarchyEdge[]>;
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,gHAAgH;AAChH,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,KAAK,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/scoped-casbin/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type { IScopedCasbinPolicyFilter, TDomainHierarchyEdge, TGrantRow, TResolveDomainEdgesFn, } from './common';
2
+ export * from './policy-edges';
3
+ export * from './adapter';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,yBAAyB,EACzB,oBAAoB,EACpB,SAAS,EACT,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./policy-edges"), exports);
18
+ __exportStar(require("./adapter"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA,iDAA+B;AAC/B,4CAA0B"}
@@ -0,0 +1,17 @@
1
+ import type { IdType } from '../../../../../base';
2
+ import type { TConstValue, TNullable } from '@venizia/ignis-helpers/common';
3
+ import type { TGrantRow } from './common';
4
+ export declare class PrincipalPolicyEdges {
5
+ static readonly DIRECT = "direct";
6
+ static readonly ROLE_EDGE = "roleEdge";
7
+ static readonly ROLE_GRANT = "roleGrant";
8
+ static readonly DOMAIN_EDGE = "domainEdge";
9
+ }
10
+ /** A row from the single principal-policy statement; `kind` says which branch produced it. */
11
+ export type TPrincipalPolicyRow = TGrantRow & {
12
+ kind: TConstValue<typeof PrincipalPolicyEdges>;
13
+ variant: string;
14
+ targetType: TNullable<string>;
15
+ targetId: IdType;
16
+ };
17
+ //# sourceMappingURL=policy-edges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-edges.d.ts","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/policy-edges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,SAAS,cAAc;IACvC,MAAM,CAAC,QAAQ,CAAC,UAAU,eAAe;IACzC,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAgB;CAC5C;AAED,8FAA8F;AAC9F,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,IAAI,EAAE,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrincipalPolicyEdges = void 0;
4
+ class PrincipalPolicyEdges {
5
+ static { this.DIRECT = 'direct'; }
6
+ static { this.ROLE_EDGE = 'roleEdge'; }
7
+ static { this.ROLE_GRANT = 'roleGrant'; }
8
+ static { this.DOMAIN_EDGE = 'domainEdge'; }
9
+ }
10
+ exports.PrincipalPolicyEdges = PrincipalPolicyEdges;
11
+ //# sourceMappingURL=policy-edges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-edges.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authorize/adapters/scoped-casbin/policy-edges.ts"],"names":[],"mappings":";;;AAIA,MAAa,oBAAoB;aACf,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,UAAU,CAAC;aACvB,eAAU,GAAG,WAAW,CAAC;aACzB,gBAAW,GAAG,YAAY,CAAC;;AAJ7C,oDAKC"}
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/authorize/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,qBAAa,kBAAmB,SAAQ,aAAa;IAEG,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,eAAe;IAQjF,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC;IAkBxC,OAAO,CAAC,oBAAoB;CAS7B"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/authorize/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,qBAAa,kBAAmB,SAAQ,aAAa;IAEG,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,eAAe;IAQjF,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC;IAsBxC,OAAO,CAAC,oBAAoB;CAS7B"}