@xtandard/permissions 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +364 -2
  3. package/bin/xtandard-permissions.mjs +3 -0
  4. package/dist/better-auth-BEmX8qyz.mjs +94 -0
  5. package/dist/better-auth-BEmX8qyz.mjs.map +1 -0
  6. package/dist/better-auth-DQET1sXa.d.mts +75 -0
  7. package/dist/better-auth-MR7dBtpo.cjs +111 -0
  8. package/dist/better-auth-MR7dBtpo.cjs.map +1 -0
  9. package/dist/better-auth-vgRYgjYK.d.cts +75 -0
  10. package/dist/catalog-DA_d1SdC.d.cts +153 -0
  11. package/dist/catalog-DJcJ3ycq.d.mts +153 -0
  12. package/dist/catalog.cjs +198 -0
  13. package/dist/catalog.cjs.map +1 -0
  14. package/dist/catalog.d.cts +3 -0
  15. package/dist/catalog.d.mts +3 -0
  16. package/dist/catalog.mjs +141 -0
  17. package/dist/catalog.mjs.map +1 -0
  18. package/dist/chunk-DakpK96I.cjs +43 -0
  19. package/dist/cli.cjs +554 -0
  20. package/dist/cli.cjs.map +1 -0
  21. package/dist/cli.d.cts +28 -0
  22. package/dist/cli.d.mts +28 -0
  23. package/dist/cli.mjs +550 -0
  24. package/dist/cli.mjs.map +1 -0
  25. package/dist/contract-BAisPHBw.d.cts +78 -0
  26. package/dist/contract-BganM0fx.mjs +79 -0
  27. package/dist/contract-BganM0fx.mjs.map +1 -0
  28. package/dist/contract-Bpy8yPrS.cjs +70 -0
  29. package/dist/contract-Bpy8yPrS.cjs.map +1 -0
  30. package/dist/contract-Brnu9XXo.cjs +114 -0
  31. package/dist/contract-Brnu9XXo.cjs.map +1 -0
  32. package/dist/contract-CNgMXr2u.d.cts +46 -0
  33. package/dist/contract-CNgMXr2u.d.mts +46 -0
  34. package/dist/contract-CXPMGuHk.d.cts +391 -0
  35. package/dist/contract-D6j-yrBL.d.mts +78 -0
  36. package/dist/contract-DTdTXZtJ.mjs +47 -0
  37. package/dist/contract-DTdTXZtJ.mjs.map +1 -0
  38. package/dist/contract-DhS23Pcp.d.mts +391 -0
  39. package/dist/contract-RMkmERhT.d.cts +2 -0
  40. package/dist/contract-RMkmERhT.d.mts +2 -0
  41. package/dist/create-fetch-handler-B0twltQL.mjs +673 -0
  42. package/dist/create-fetch-handler-B0twltQL.mjs.map +1 -0
  43. package/dist/create-fetch-handler-B711wb64.d.mts +77 -0
  44. package/dist/create-fetch-handler-BHT4vSZs.cjs +690 -0
  45. package/dist/create-fetch-handler-BHT4vSZs.cjs.map +1 -0
  46. package/dist/create-fetch-handler-DxhvXuBA.d.cts +77 -0
  47. package/dist/elysia-shared-BFcWzfc9.cjs +101 -0
  48. package/dist/elysia-shared-BFcWzfc9.cjs.map +1 -0
  49. package/dist/elysia-shared-BwUYg0Ln.mjs +78 -0
  50. package/dist/elysia-shared-BwUYg0Ln.mjs.map +1 -0
  51. package/dist/elysia-shared-C2LnDOj3.d.cts +58 -0
  52. package/dist/elysia-shared-WuDr0jco.d.mts +58 -0
  53. package/dist/engine--C7zo-4M.cjs +667 -0
  54. package/dist/engine--C7zo-4M.cjs.map +1 -0
  55. package/dist/engine-BTgwbHeO.d.cts +336 -0
  56. package/dist/engine-C3xHfi3q.d.mts +336 -0
  57. package/dist/engine-CR75K253.mjs +654 -0
  58. package/dist/engine-CR75K253.mjs.map +1 -0
  59. package/dist/entry-auth-basic.cjs +40 -0
  60. package/dist/entry-auth-basic.cjs.map +1 -0
  61. package/dist/entry-auth-basic.d.cts +24 -0
  62. package/dist/entry-auth-basic.d.mts +24 -0
  63. package/dist/entry-auth-basic.mjs +26 -0
  64. package/dist/entry-auth-basic.mjs.map +1 -0
  65. package/dist/entry-auth-better-auth.cjs +15 -0
  66. package/dist/entry-auth-better-auth.d.cts +5 -0
  67. package/dist/entry-auth-better-auth.d.mts +5 -0
  68. package/dist/entry-auth-better-auth.mjs +4 -0
  69. package/dist/entry-auth-delegated.cjs +8 -0
  70. package/dist/entry-auth-delegated.d.cts +2 -0
  71. package/dist/entry-auth-delegated.d.mts +2 -0
  72. package/dist/entry-auth-delegated.mjs +2 -0
  73. package/dist/entry-auth-jwt.cjs +120 -0
  74. package/dist/entry-auth-jwt.cjs.map +1 -0
  75. package/dist/entry-auth-jwt.d.cts +71 -0
  76. package/dist/entry-auth-jwt.d.mts +71 -0
  77. package/dist/entry-auth-jwt.mjs +109 -0
  78. package/dist/entry-auth-jwt.mjs.map +1 -0
  79. package/dist/entry-auth-none.cjs +14 -0
  80. package/dist/entry-auth-none.d.cts +2 -0
  81. package/dist/entry-auth-none.d.mts +2 -0
  82. package/dist/entry-auth-none.mjs +2 -0
  83. package/dist/entry-auth-session.cjs +86 -0
  84. package/dist/entry-auth-session.cjs.map +1 -0
  85. package/dist/entry-auth-session.d.cts +25 -0
  86. package/dist/entry-auth-session.d.mts +25 -0
  87. package/dist/entry-auth-session.mjs +76 -0
  88. package/dist/entry-auth-session.mjs.map +1 -0
  89. package/dist/entry-authorization-delegated.cjs +31 -0
  90. package/dist/entry-authorization-delegated.cjs.map +1 -0
  91. package/dist/entry-authorization-delegated.d.cts +27 -0
  92. package/dist/entry-authorization-delegated.d.mts +27 -0
  93. package/dist/entry-authorization-delegated.mjs +30 -0
  94. package/dist/entry-authorization-delegated.mjs.map +1 -0
  95. package/dist/entry-authorization-none.cjs +29 -0
  96. package/dist/entry-authorization-none.cjs.map +1 -0
  97. package/dist/entry-authorization-none.d.cts +17 -0
  98. package/dist/entry-authorization-none.d.mts +17 -0
  99. package/dist/entry-authorization-none.mjs +28 -0
  100. package/dist/entry-authorization-none.mjs.map +1 -0
  101. package/dist/entry-authorization-permissions.cjs +4 -0
  102. package/dist/entry-authorization-permissions.d.cts +49 -0
  103. package/dist/entry-authorization-permissions.d.mts +49 -0
  104. package/dist/entry-authorization-permissions.mjs +2 -0
  105. package/dist/entry-authorization-roles.cjs +9 -0
  106. package/dist/entry-authorization-roles.d.cts +37 -0
  107. package/dist/entry-authorization-roles.d.mts +37 -0
  108. package/dist/entry-authorization-roles.mjs +3 -0
  109. package/dist/entry-better-auth-client.cjs +31 -0
  110. package/dist/entry-better-auth-client.cjs.map +1 -0
  111. package/dist/entry-better-auth-client.d.cts +63 -0
  112. package/dist/entry-better-auth-client.d.mts +63 -0
  113. package/dist/entry-better-auth-client.mjs +29 -0
  114. package/dist/entry-better-auth-client.mjs.map +1 -0
  115. package/dist/entry-better-auth.cjs +289 -0
  116. package/dist/entry-better-auth.cjs.map +1 -0
  117. package/dist/entry-better-auth.d.cts +3 -0
  118. package/dist/entry-better-auth.d.mts +3 -0
  119. package/dist/entry-better-auth.mjs +284 -0
  120. package/dist/entry-better-auth.mjs.map +1 -0
  121. package/dist/entry-bridges-audit.cjs +106 -0
  122. package/dist/entry-bridges-audit.cjs.map +1 -0
  123. package/dist/entry-bridges-audit.d.cts +58 -0
  124. package/dist/entry-bridges-audit.d.mts +58 -0
  125. package/dist/entry-bridges-audit.mjs +105 -0
  126. package/dist/entry-bridges-audit.mjs.map +1 -0
  127. package/dist/entry-bridges-webhooks.cjs +90 -0
  128. package/dist/entry-bridges-webhooks.cjs.map +1 -0
  129. package/dist/entry-bridges-webhooks.d.cts +46 -0
  130. package/dist/entry-bridges-webhooks.d.mts +46 -0
  131. package/dist/entry-bridges-webhooks.mjs +88 -0
  132. package/dist/entry-bridges-webhooks.mjs.map +1 -0
  133. package/dist/entry-bun.cjs +33 -0
  134. package/dist/entry-bun.cjs.map +1 -0
  135. package/dist/entry-bun.d.cts +31 -0
  136. package/dist/entry-bun.d.mts +31 -0
  137. package/dist/entry-bun.mjs +30 -0
  138. package/dist/entry-bun.mjs.map +1 -0
  139. package/dist/entry-drizzle-mysql.cjs +34 -0
  140. package/dist/entry-drizzle-mysql.cjs.map +1 -0
  141. package/dist/entry-drizzle-mysql.d.cts +20 -0
  142. package/dist/entry-drizzle-mysql.d.mts +20 -0
  143. package/dist/entry-drizzle-mysql.mjs +33 -0
  144. package/dist/entry-drizzle-mysql.mjs.map +1 -0
  145. package/dist/entry-drizzle-pg.cjs +44 -0
  146. package/dist/entry-drizzle-pg.cjs.map +1 -0
  147. package/dist/entry-drizzle-pg.d.cts +20 -0
  148. package/dist/entry-drizzle-pg.d.mts +20 -0
  149. package/dist/entry-drizzle-pg.mjs +43 -0
  150. package/dist/entry-drizzle-pg.mjs.map +1 -0
  151. package/dist/entry-drizzle-sqlite.cjs +34 -0
  152. package/dist/entry-drizzle-sqlite.cjs.map +1 -0
  153. package/dist/entry-drizzle-sqlite.d.cts +15 -0
  154. package/dist/entry-drizzle-sqlite.d.mts +15 -0
  155. package/dist/entry-drizzle-sqlite.mjs +33 -0
  156. package/dist/entry-drizzle-sqlite.mjs.map +1 -0
  157. package/dist/entry-elysia.cjs +117 -0
  158. package/dist/entry-elysia.cjs.map +1 -0
  159. package/dist/entry-elysia.d.cts +446 -0
  160. package/dist/entry-elysia.d.mts +446 -0
  161. package/dist/entry-elysia.mjs +113 -0
  162. package/dist/entry-elysia.mjs.map +1 -0
  163. package/dist/entry-elysia2.cjs +117 -0
  164. package/dist/entry-elysia2.cjs.map +1 -0
  165. package/dist/entry-elysia2.d.cts +571 -0
  166. package/dist/entry-elysia2.d.mts +571 -0
  167. package/dist/entry-elysia2.mjs +113 -0
  168. package/dist/entry-elysia2.mjs.map +1 -0
  169. package/dist/entry-express.cjs +101 -0
  170. package/dist/entry-express.cjs.map +1 -0
  171. package/dist/entry-express.d.cts +36 -0
  172. package/dist/entry-express.d.mts +36 -0
  173. package/dist/entry-express.mjs +97 -0
  174. package/dist/entry-express.mjs.map +1 -0
  175. package/dist/entry-hono.cjs +63 -0
  176. package/dist/entry-hono.cjs.map +1 -0
  177. package/dist/entry-hono.d.cts +40 -0
  178. package/dist/entry-hono.d.mts +40 -0
  179. package/dist/entry-hono.mjs +60 -0
  180. package/dist/entry-hono.mjs.map +1 -0
  181. package/dist/entry-hooks-log.cjs +39 -0
  182. package/dist/entry-hooks-log.cjs.map +1 -0
  183. package/dist/entry-hooks-log.d.cts +19 -0
  184. package/dist/entry-hooks-log.d.mts +19 -0
  185. package/dist/entry-hooks-log.mjs +36 -0
  186. package/dist/entry-hooks-log.mjs.map +1 -0
  187. package/dist/entry-next.cjs +67 -0
  188. package/dist/entry-next.cjs.map +1 -0
  189. package/dist/entry-next.d.cts +60 -0
  190. package/dist/entry-next.d.mts +60 -0
  191. package/dist/entry-next.mjs +57 -0
  192. package/dist/entry-next.mjs.map +1 -0
  193. package/dist/entry-react.cjs +401 -0
  194. package/dist/entry-react.cjs.map +1 -0
  195. package/dist/entry-react.d.cts +206 -0
  196. package/dist/entry-react.d.mts +206 -0
  197. package/dist/entry-react.mjs +388 -0
  198. package/dist/entry-react.mjs.map +1 -0
  199. package/dist/entry-storage-cloudflare-kv.cjs +8 -0
  200. package/dist/entry-storage-cloudflare-kv.d.cts +2 -0
  201. package/dist/entry-storage-cloudflare-kv.d.mts +2 -0
  202. package/dist/entry-storage-cloudflare-kv.mjs +2 -0
  203. package/dist/entry-storage-drizzle.cjs +71 -0
  204. package/dist/entry-storage-drizzle.cjs.map +1 -0
  205. package/dist/entry-storage-drizzle.d.cts +27 -0
  206. package/dist/entry-storage-drizzle.d.mts +27 -0
  207. package/dist/entry-storage-drizzle.mjs +68 -0
  208. package/dist/entry-storage-drizzle.mjs.map +1 -0
  209. package/dist/entry-storage-file.cjs +54 -0
  210. package/dist/entry-storage-file.cjs.map +1 -0
  211. package/dist/entry-storage-file.d.cts +24 -0
  212. package/dist/entry-storage-file.d.mts +24 -0
  213. package/dist/entry-storage-file.mjs +46 -0
  214. package/dist/entry-storage-file.mjs.map +1 -0
  215. package/dist/entry-storage-libsql.cjs +64 -0
  216. package/dist/entry-storage-libsql.cjs.map +1 -0
  217. package/dist/entry-storage-libsql.d.cts +28 -0
  218. package/dist/entry-storage-libsql.d.mts +28 -0
  219. package/dist/entry-storage-libsql.mjs +61 -0
  220. package/dist/entry-storage-libsql.mjs.map +1 -0
  221. package/dist/entry-storage-memory.cjs +3 -0
  222. package/dist/entry-storage-memory.d.cts +25 -0
  223. package/dist/entry-storage-memory.d.mts +25 -0
  224. package/dist/entry-storage-memory.mjs +2 -0
  225. package/dist/entry-storage-mongodb.cjs +61 -0
  226. package/dist/entry-storage-mongodb.cjs.map +1 -0
  227. package/dist/entry-storage-mongodb.d.cts +25 -0
  228. package/dist/entry-storage-mongodb.d.mts +25 -0
  229. package/dist/entry-storage-mongodb.mjs +58 -0
  230. package/dist/entry-storage-mongodb.mjs.map +1 -0
  231. package/dist/entry-storage-postgres.cjs +62 -0
  232. package/dist/entry-storage-postgres.cjs.map +1 -0
  233. package/dist/entry-storage-postgres.d.cts +29 -0
  234. package/dist/entry-storage-postgres.d.mts +29 -0
  235. package/dist/entry-storage-postgres.mjs +58 -0
  236. package/dist/entry-storage-postgres.mjs.map +1 -0
  237. package/dist/entry-storage-redis.cjs +76 -0
  238. package/dist/entry-storage-redis.cjs.map +1 -0
  239. package/dist/entry-storage-redis.d.cts +29 -0
  240. package/dist/entry-storage-redis.d.mts +29 -0
  241. package/dist/entry-storage-redis.mjs +72 -0
  242. package/dist/entry-storage-redis.mjs.map +1 -0
  243. package/dist/entry-storage-sqlite.cjs +46 -0
  244. package/dist/entry-storage-sqlite.cjs.map +1 -0
  245. package/dist/entry-storage-sqlite.d.cts +22 -0
  246. package/dist/entry-storage-sqlite.d.mts +22 -0
  247. package/dist/entry-storage-sqlite.mjs +43 -0
  248. package/dist/entry-storage-sqlite.mjs.map +1 -0
  249. package/dist/entry-storage-unstorage.cjs +8 -0
  250. package/dist/entry-storage-unstorage.d.cts +2 -0
  251. package/dist/entry-storage-unstorage.d.mts +2 -0
  252. package/dist/entry-storage-unstorage.mjs +2 -0
  253. package/dist/error-codes-9MRMSSMQ.cjs +49 -0
  254. package/dist/error-codes-9MRMSSMQ.cjs.map +1 -0
  255. package/dist/error-codes-CCKuDDu7.mjs +44 -0
  256. package/dist/error-codes-CCKuDDu7.mjs.map +1 -0
  257. package/dist/errors-CG_OLEEv.mjs +64 -0
  258. package/dist/errors-CG_OLEEv.mjs.map +1 -0
  259. package/dist/errors-CjpymzFj.cjs +105 -0
  260. package/dist/errors-CjpymzFj.cjs.map +1 -0
  261. package/dist/events-AE4Ytqmz.d.cts +6 -0
  262. package/dist/events-AE4Ytqmz.d.mts +6 -0
  263. package/dist/events-DYZShrYB.mjs +15 -0
  264. package/dist/events-DYZShrYB.mjs.map +1 -0
  265. package/dist/events-FJ2K0wly.cjs +26 -0
  266. package/dist/events-FJ2K0wly.cjs.map +1 -0
  267. package/dist/guard-Bj8zk23F.mjs +141 -0
  268. package/dist/guard-Bj8zk23F.mjs.map +1 -0
  269. package/dist/guard-DvaoUgjk.cjs +188 -0
  270. package/dist/guard-DvaoUgjk.cjs.map +1 -0
  271. package/dist/guard-VEK0W8ug.d.cts +62 -0
  272. package/dist/guard-k7A71SWC.d.mts +62 -0
  273. package/dist/index-BVVgDSdq.d.cts +1 -0
  274. package/dist/index-BVVgDSdq.d.mts +1 -0
  275. package/dist/index.cjs +243 -0
  276. package/dist/index.cjs.map +1 -0
  277. package/dist/index.d.cts +213 -0
  278. package/dist/index.d.mts +213 -0
  279. package/dist/index.mjs +60 -0
  280. package/dist/index.mjs.map +1 -0
  281. package/dist/kit-51JtMxsn.d.mts +62 -0
  282. package/dist/kit-BM3uosfV.mjs +80 -0
  283. package/dist/kit-BM3uosfV.mjs.map +1 -0
  284. package/dist/kit-BrqnCcDw.cjs +97 -0
  285. package/dist/kit-BrqnCcDw.cjs.map +1 -0
  286. package/dist/kit-DLF7DZrp.d.cts +62 -0
  287. package/dist/memory-BbBbbY8-.mjs +32 -0
  288. package/dist/memory-BbBbbY8-.mjs.map +1 -0
  289. package/dist/memory-knijqKw_.cjs +39 -0
  290. package/dist/memory-knijqKw_.cjs.map +1 -0
  291. package/dist/permissions-CeV6M3v7.mjs +62 -0
  292. package/dist/permissions-CeV6M3v7.mjs.map +1 -0
  293. package/dist/permissions-DDEkHNvN.cjs +73 -0
  294. package/dist/permissions-DDEkHNvN.cjs.map +1 -0
  295. package/dist/policy-BQmlo2lu.mjs +3 -0
  296. package/dist/policy-CGA6QD0a.d.mts +4 -0
  297. package/dist/policy-DFq_SYR3.d.cts +4 -0
  298. package/dist/react-embed.js +18735 -0
  299. package/dist/react.css +1 -0
  300. package/dist/relationships-BLYEJ9tc.cjs +907 -0
  301. package/dist/relationships-BLYEJ9tc.cjs.map +1 -0
  302. package/dist/relationships-BfLonEMI.mjs +756 -0
  303. package/dist/relationships-BfLonEMI.mjs.map +1 -0
  304. package/dist/roles-DBk4i8b5.mjs +69 -0
  305. package/dist/roles-DBk4i8b5.mjs.map +1 -0
  306. package/dist/roles-a8B5uZ35.cjs +104 -0
  307. package/dist/roles-a8B5uZ35.cjs.map +1 -0
  308. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  309. package/dist/routes-B2LrYpT0.cjs +1055 -0
  310. package/dist/routes-B2LrYpT0.cjs.map +1 -0
  311. package/dist/routes-Cx-kl4PY.mjs +1007 -0
  312. package/dist/routes-Cx-kl4PY.mjs.map +1 -0
  313. package/dist/server-Bn643UOy.d.mts +886 -0
  314. package/dist/server-YdH25OEA.d.cts +886 -0
  315. package/dist/table-DA98mVVT.d.cts +2 -0
  316. package/dist/table-DA98mVVT.d.mts +2 -0
  317. package/dist/testing.cjs +59 -0
  318. package/dist/testing.cjs.map +1 -0
  319. package/dist/testing.d.cts +37 -0
  320. package/dist/testing.d.mts +37 -0
  321. package/dist/testing.mjs +57 -0
  322. package/dist/testing.mjs.map +1 -0
  323. package/dist/types-elysia2/adapters/elysia-shared.d.ts +71 -0
  324. package/dist/types-elysia2/adapters/elysia2.d.ts +432 -0
  325. package/dist/types-elysia2/adapters/guard.d.ts +140 -0
  326. package/dist/types-elysia2/auth/contract.d.ts +9 -0
  327. package/dist/types-elysia2/auth-provider/contract.d.ts +85 -0
  328. package/dist/types-elysia2/auth-provider/kit.d.ts +62 -0
  329. package/dist/types-elysia2/authorization/contract.d.ts +53 -0
  330. package/dist/types-elysia2/authorization/permissions.d.ts +54 -0
  331. package/dist/types-elysia2/catalog.d.ts +197 -0
  332. package/dist/types-elysia2/engine.d.ts +233 -0
  333. package/dist/types-elysia2/entry-elysia2.d.ts +9 -0
  334. package/dist/types-elysia2/errors.d.ts +55 -0
  335. package/dist/types-elysia2/hooks/contract.d.ts +100 -0
  336. package/dist/types-elysia2/keys.d.ts +78 -0
  337. package/dist/types-elysia2/policy.d.ts +13 -0
  338. package/dist/types-elysia2/relationships.d.ts +162 -0
  339. package/dist/types-elysia2/schema.d.ts +315 -0
  340. package/dist/types-elysia2/server/cors.d.ts +8 -0
  341. package/dist/types-elysia2/server/create-fetch-handler.d.ts +87 -0
  342. package/dist/types-elysia2/server/openapi.d.ts +29 -0
  343. package/dist/types-elysia2/server/routes.d.ts +143 -0
  344. package/dist/types-elysia2/server/validation.d.ts +205 -0
  345. package/dist/types-elysia2/storage/contract.d.ts +18 -0
  346. package/dist/types-react/catalog.d.ts +197 -0
  347. package/dist/types-react/engine.d.ts +233 -0
  348. package/dist/types-react/entry-react-embed.d.ts +20 -0
  349. package/dist/types-react/errors.d.ts +55 -0
  350. package/dist/types-react/hooks/contract.d.ts +100 -0
  351. package/dist/types-react/keys.d.ts +78 -0
  352. package/dist/types-react/policy.d.ts +13 -0
  353. package/dist/types-react/react-embed.d.ts +37 -0
  354. package/dist/types-react/relationships.d.ts +162 -0
  355. package/dist/types-react/schema.d.ts +315 -0
  356. package/dist/types-react/storage/contract.d.ts +18 -0
  357. package/dist/types-react/ui/App.d.ts +28 -0
  358. package/dist/types-react/ui/api.d.ts +73 -0
  359. package/dist/types-react/ui/components/perm-bits.d.ts +68 -0
  360. package/dist/types-react/ui/lib/queries.d.ts +46 -0
  361. package/dist/types-react/ui/theme.d.ts +10 -0
  362. package/dist/types-react/ui/types.d.ts +118 -0
  363. package/dist/types-react/ui/views/CatalogView.d.ts +3 -0
  364. package/dist/types-react/ui/views/HistoryView.d.ts +6 -0
  365. package/dist/types-react/ui/views/PlaygroundView.d.ts +14 -0
  366. package/dist/types-react/ui/views/RelationshipsView.d.ts +6 -0
  367. package/dist/types-react/ui/views/SubjectDetailView.d.ts +7 -0
  368. package/dist/types-react/ui/views/SubjectsView.d.ts +6 -0
  369. package/dist/ui/apple-touch-icon.png +0 -0
  370. package/dist/ui/assets/index-DCPZRo-Z.css +1 -0
  371. package/dist/ui/assets/index-DdvxpphI.js +104 -0
  372. package/dist/ui/favicon.ico +0 -0
  373. package/dist/ui/favicon.svg +15 -0
  374. package/dist/ui/index.html +20 -0
  375. package/package.json +587 -4
package/dist/index.cjs ADDED
@@ -0,0 +1,243 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_catalog = require("./catalog.cjs");
3
+ const require_relationships = require("./relationships-BLYEJ9tc.cjs");
4
+ const require_errors = require("./errors-CjpymzFj.cjs");
5
+ const require_engine = require("./engine--C7zo-4M.cjs");
6
+ const require_contract = require("./contract-Brnu9XXo.cjs");
7
+ const require_kit = require("./kit-BrqnCcDw.cjs");
8
+ const require_contract$1 = require("./contract-Bpy8yPrS.cjs");
9
+ const require_routes = require("./routes-B2LrYpT0.cjs");
10
+ const require_create_fetch_handler = require("./create-fetch-handler-BHT4vSZs.cjs");
11
+ let _xtandard_kit_storage = require("@xtandard/kit/storage");
12
+ let _xtandard_lib_policy_permix = require("@xtandard/lib/policy/permix");
13
+ let _xtandard_kit_hooks = require("@xtandard/kit/hooks");
14
+ let _xtandard_lib_policy_rebac = require("@xtandard/lib/policy/rebac");
15
+ let _xtandard_kit_util = require("@xtandard/kit/util");
16
+ //#region src/storage/watch.ts
17
+ /**
18
+ * Composable change-notifications. `watch` (push-based snapshot refresh in the
19
+ * engine cache) is **orthogonal** to which storage you use, so rather
20
+ * than bake it into each adapter, {@link withWatch} wraps *any* {@link PermissionsStorage}
21
+ * with a {@link WatchSubscribe} source you provide — Postgres `LISTEN`/`NOTIFY`,
22
+ * Redis pub/sub, an ORM after-write hook, a websocket, an `EventEmitter`, etc.
23
+ *
24
+ * This gives `watch` to adapters that don't implement it themselves (postgres,
25
+ * drizzle, mongodb, unstorage, cloudflare-kv, …), driven by whatever change
26
+ * signal your infrastructure already has.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { withWatch } from "@xtandard/permissions";
31
+ * import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
32
+ *
33
+ * const storage = withWatch(createDrizzleStorage({ db, table }), (notify) => {
34
+ * const sub = redis.subscribe("permission-changes", (m) => notify(m.key));
35
+ * return () => sub.unsubscribe();
36
+ * });
37
+ * ```
38
+ *
39
+ * Both helpers come from `@xtandard/kit/storage`; {@link pgListenNotify} keeps
40
+ * the permissions default channel `"xtandard_permissions"`.
41
+ *
42
+ * @module
43
+ */
44
+ /**
45
+ * A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair with
46
+ * {@link withWatch} for the postgres or drizzle-over-pg adapters. Your migration
47
+ * owns the trigger that `pg_notify`s `channel` with the changed key as payload;
48
+ * this only `LISTEN`s.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { Client } from "pg";
53
+ * const listener = new Client({ connectionString: process.env.DATABASE_URL });
54
+ * await listener.connect();
55
+ * const storage = withWatch(base, pgListenNotify(listener, "xtandard_permissions"));
56
+ * ```
57
+ */
58
+ function pgListenNotify(client, channel = "xtandard_permissions") {
59
+ return (0, _xtandard_kit_storage.pgListenNotify)(client, channel);
60
+ }
61
+ //#endregion
62
+ exports.ALL_ACTIONS = require_contract$1.ALL_ACTIONS;
63
+ exports.API_ROUTES = require_routes.API_ROUTES;
64
+ Object.defineProperty(exports, "AsyncRuleError", {
65
+ enumerable: true,
66
+ get: function() {
67
+ return _xtandard_lib_policy_permix.AsyncRuleError;
68
+ }
69
+ });
70
+ exports.CONFIG_PATHS = require_routes.CONFIG_PATHS;
71
+ exports.ExternalRolesError = require_errors.ExternalRolesError;
72
+ exports.ForbiddenError = require_errors.ForbiddenError;
73
+ Object.defineProperty(exports, "HookDeniedError", {
74
+ enumerable: true,
75
+ get: function() {
76
+ return _xtandard_kit_hooks.HookDeniedError;
77
+ }
78
+ });
79
+ exports.KEY_ROOT = require_relationships.ROOT;
80
+ exports.MUTATING_ACTIONS = require_contract$1.MUTATING_ACTIONS;
81
+ exports.NoSubjectError = require_errors.NoSubjectError;
82
+ exports.NotFoundError = require_errors.NotFoundError;
83
+ exports.ReadonlyError = require_errors.ReadonlyError;
84
+ Object.defineProperty(exports, "RelationDepthError", {
85
+ enumerable: true,
86
+ get: function() {
87
+ return _xtandard_lib_policy_rebac.RelationDepthError;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "RelationSchemaError", {
91
+ enumerable: true,
92
+ get: function() {
93
+ return _xtandard_lib_policy_rebac.RelationSchemaError;
94
+ }
95
+ });
96
+ exports.UnknownPermissionError = require_errors.UnknownPermissionError;
97
+ exports.UnknownRoleError = require_errors.UnknownRoleError;
98
+ Object.defineProperty(exports, "ValidationError", {
99
+ enumerable: true,
100
+ get: function() {
101
+ return _xtandard_kit_util.ValidationError;
102
+ }
103
+ });
104
+ exports.actorSchema = require_relationships.actorSchema;
105
+ exports.buildOpenApiDocument = require_create_fetch_handler.buildOpenApiDocument;
106
+ exports.catalogPaths = require_routes.catalogPaths;
107
+ exports.catalogView = require_routes.catalogView;
108
+ Object.defineProperty(exports, "checkRulesAtPath", {
109
+ enumerable: true,
110
+ get: function() {
111
+ return _xtandard_lib_policy_permix.checkRulesAtPath;
112
+ }
113
+ });
114
+ Object.defineProperty(exports, "computed", {
115
+ enumerable: true,
116
+ get: function() {
117
+ return _xtandard_lib_policy_rebac.computed;
118
+ }
119
+ });
120
+ exports.createFetchHandler = require_create_fetch_handler.createFetchHandler;
121
+ exports.createPermissions = require_engine.createPermissions;
122
+ exports.defaultHookErrorReporter = require_relationships.defaultHookErrorReporter;
123
+ exports.definePermissions = require_catalog.definePermissions;
124
+ Object.defineProperty(exports, "defineRelations", {
125
+ enumerable: true,
126
+ get: function() {
127
+ return _xtandard_lib_policy_rebac.defineRelations;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, "direct", {
131
+ enumerable: true,
132
+ get: function() {
133
+ return _xtandard_lib_policy_rebac.direct;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "exclusion", {
137
+ enumerable: true,
138
+ get: function() {
139
+ return _xtandard_lib_policy_rebac.exclusion;
140
+ }
141
+ });
142
+ exports.externalRoles = require_contract.externalRoles;
143
+ Object.defineProperty(exports, "from", {
144
+ enumerable: true,
145
+ get: function() {
146
+ return _xtandard_lib_policy_rebac.from;
147
+ }
148
+ });
149
+ exports.fromAuthorization = require_catalog.fromAuthorization;
150
+ exports.grantInputSchema = require_relationships.grantInputSchema;
151
+ Object.defineProperty(exports, "hasAssignedPermission", {
152
+ enumerable: true,
153
+ get: function() {
154
+ return _xtandard_lib_policy_permix.hasAssignedPermission;
155
+ }
156
+ });
157
+ Object.defineProperty(exports, "hasPermission", {
158
+ enumerable: true,
159
+ get: function() {
160
+ return _xtandard_lib_policy_permix.hasPermission;
161
+ }
162
+ });
163
+ exports.historyQuerySchema = require_relationships.historyQuerySchema;
164
+ exports.identityOf = require_kit.identityOf;
165
+ Object.defineProperty(exports, "intersection", {
166
+ enumerable: true,
167
+ get: function() {
168
+ return _xtandard_lib_policy_rebac.intersection;
169
+ }
170
+ });
171
+ Object.defineProperty(exports, "isCompareAndSwap", {
172
+ enumerable: true,
173
+ get: function() {
174
+ return _xtandard_kit_storage.isCompareAndSwap;
175
+ }
176
+ });
177
+ exports.isMutatingAction = require_contract$1.isMutatingAction;
178
+ Object.defineProperty(exports, "isTransactional", {
179
+ enumerable: true,
180
+ get: function() {
181
+ return _xtandard_kit_storage.isTransactional;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, "isWatchable", {
185
+ enumerable: true,
186
+ get: function() {
187
+ return _xtandard_kit_storage.isWatchable;
188
+ }
189
+ });
190
+ exports.listObjectsQuerySchema = require_relationships.listObjectsQuerySchema;
191
+ exports.listQuerySchema = require_relationships.listQuerySchema;
192
+ exports.listRelationSubjectsQuerySchema = require_relationships.listRelationSubjectsQuerySchema;
193
+ exports.mapError = require_routes.mapError;
194
+ Object.defineProperty(exports, "normalizeHooks", {
195
+ enumerable: true,
196
+ get: function() {
197
+ return _xtandard_kit_hooks.normalizeHooks;
198
+ }
199
+ });
200
+ exports.normalizeRoles = require_contract.normalizeRoles;
201
+ exports.pgListenNotify = pgListenNotify;
202
+ exports.relationCheckSchema = require_relationships.relationCheckSchema;
203
+ exports.relationshipInputSchema = require_relationships.relationshipInputSchema;
204
+ exports.relationshipQuerySchema = require_relationships.relationshipQuerySchema;
205
+ exports.revokeInputSchema = require_relationships.revokeInputSchema;
206
+ Object.defineProperty(exports, "runAfter", {
207
+ enumerable: true,
208
+ get: function() {
209
+ return _xtandard_kit_hooks.runAfter;
210
+ }
211
+ });
212
+ Object.defineProperty(exports, "runBefore", {
213
+ enumerable: true,
214
+ get: function() {
215
+ return _xtandard_kit_hooks.runBefore;
216
+ }
217
+ });
218
+ exports.serializeCheck = require_routes.serializeCheck;
219
+ exports.setRoleInputSchema = require_relationships.setRoleInputSchema;
220
+ exports.splitRoles = require_contract.splitRoles;
221
+ exports.subjectOf = require_kit.subjectOf;
222
+ exports.toKitAuth = require_kit.toKitAuth;
223
+ Object.defineProperty(exports, "toPermissionSet", {
224
+ enumerable: true,
225
+ get: function() {
226
+ return _xtandard_lib_policy_permix.toPermissionSet;
227
+ }
228
+ });
229
+ Object.defineProperty(exports, "union", {
230
+ enumerable: true,
231
+ get: function() {
232
+ return _xtandard_lib_policy_rebac.union;
233
+ }
234
+ });
235
+ exports.upsertSubjectInputSchema = require_relationships.upsertSubjectInputSchema;
236
+ Object.defineProperty(exports, "withWatch", {
237
+ enumerable: true,
238
+ get: function() {
239
+ return _xtandard_kit_storage.withWatch;
240
+ }
241
+ });
242
+
243
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/storage/watch.ts"],"sourcesContent":["/**\n * Composable change-notifications. `watch` (push-based snapshot refresh in the\n * engine cache) is **orthogonal** to which storage you use, so rather\n * than bake it into each adapter, {@link withWatch} wraps *any* {@link PermissionsStorage}\n * with a {@link WatchSubscribe} source you provide — Postgres `LISTEN`/`NOTIFY`,\n * Redis pub/sub, an ORM after-write hook, a websocket, an `EventEmitter`, etc.\n *\n * This gives `watch` to adapters that don't implement it themselves (postgres,\n * drizzle, mongodb, unstorage, cloudflare-kv, …), driven by whatever change\n * signal your infrastructure already has.\n *\n * @example\n * ```ts\n * import { withWatch } from \"@xtandard/permissions\";\n * import { createDrizzleStorage } from \"@xtandard/permissions/storage/drizzle\";\n *\n * const storage = withWatch(createDrizzleStorage({ db, table }), (notify) => {\n * const sub = redis.subscribe(\"permission-changes\", (m) => notify(m.key));\n * return () => sub.unsubscribe();\n * });\n * ```\n *\n * Both helpers come from `@xtandard/kit/storage`; {@link pgListenNotify} keeps\n * the permissions default channel `\"xtandard_permissions\"`.\n *\n * @module\n */\n\nimport {\n pgListenNotify as kitPgListenNotify,\n type PgNotificationClient,\n type WatchSubscribe,\n} from \"@xtandard/kit/storage\";\n\nexport { withWatch, type PgNotificationClient, type WatchSubscribe } from \"@xtandard/kit/storage\";\n\n/**\n * A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair with\n * {@link withWatch} for the postgres or drizzle-over-pg adapters. Your migration\n * owns the trigger that `pg_notify`s `channel` with the changed key as payload;\n * this only `LISTEN`s.\n *\n * @example\n * ```ts\n * import { Client } from \"pg\";\n * const listener = new Client({ connectionString: process.env.DATABASE_URL });\n * await listener.connect();\n * const storage = withWatch(base, pgListenNotify(listener, \"xtandard_permissions\"));\n * ```\n */\nexport function pgListenNotify(\n client: PgNotificationClient,\n channel = \"xtandard_permissions\",\n): WatchSubscribe {\n return kitPgListenNotify(client, channel);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,eACd,QACA,UAAU,wBACM;CAChB,QAAA,GAAA,sBAAA,gBAAyB,QAAQ,OAAO;AAC1C"}
@@ -0,0 +1,213 @@
1
+ import { A as intersection, C as computed, D as from, E as exclusion, M as union, O as hasAssignedPermission, S as checkRulesAtPath, T as direct, _ as RuleHelpers, a as CheckExplanation, b as SubjectRef, c as ObjectRef, d as RelationExplanation, f as RelationExpr, g as RuleContext, h as RelationTuple, j as toPermissionSet, k as hasPermission, l as PermissionPath, m as RelationSchemaError, n as AsyncRuleError, p as RelationSchema, s as Definition, t as Ability, u as RelationDepthError, v as Rules, w as defineRelations, y as RulesPaths } from "./policy-DFq_SYR3.cjs";
2
+ import { _ as fromAuthorization, a as Label, c as PermissionOf, d as PermissionsConfig, f as PermissionsSubject, g as definePermissions, h as SubjectIdentity, i as DefinitionOf, l as PermissionUnion, m as RoleOf, n as CatalogMeta, o as LabelInput, p as RelationsOf, r as CtxOf, s as NoRelations, t as AnyPermissionsCatalog, u as PermissionsCatalog } from "./catalog-DA_d1SdC.cjs";
3
+ import { a as WatchablePermissionsStorage, c as isWatchable, i as TransactionalPermissionsStorage, n as PermissionsStorage, o as isCompareAndSwap, r as StorageChangeEvent, s as isTransactional, t as CompareAndSwapPermissionsStorage } from "./contract-RMkmERhT.cjs";
4
+ import { a as externalRoles, c as normalizeRoles, i as SubjectLookupFn, l as splitRoles, n as ProviderRoleOptions, r as RoleMapper, t as PermissionsAuthProvider } from "./contract-BAisPHBw.cjs";
5
+ import { a as subjectOf, i as identityOf, n as KitAuthEngine, o as toKitAuth, r as ToKitAuthOptions, t as KitAuth } from "./kit-DLF7DZrp.cjs";
6
+ import { a as PermissionsAction, i as MUTATING_ACTIONS, n as AuthorizationProvider, o as PermissionsResource, r as AuthorizeInput, s as isMutatingAction, t as ALL_ACTIONS } from "./contract-CNgMXr2u.cjs";
7
+ import { A as RoleSource, B as listRelationSubjectsQuerySchema, C as ListQuery, D as RelationshipPage, E as RelationshipInput, F as actorSchema, G as setRoleInputSchema, H as relationshipInputSchema, I as grantInputSchema, K as upsertSubjectInputSchema, L as historyQuerySchema, M as SetRoleInput, N as SubjectRecord, O as RelationshipQuery, P as UpsertSubjectInput, R as listObjectsQuerySchema, S as InstantInput, T as Relationship, U as relationshipQuerySchema, V as relationCheckSchema, W as revokeInputSchema, _ as GrantInput, a as HookDeniedError, b as HistoryQuery, c as PermissionsHooksInput, d as runAfter, f as runBefore, g as Grant, h as CheckResult, i as BeforeEventType, j as RoleSourceMode, k as RevokeInput, l as defaultHookErrorReporter, m as CheckReason, n as AfterEventType, o as HookErrorReporter, p as Actor, r as BeforeEvent, s as PermissionsHooks, t as AfterEvent, u as normalizeHooks, v as HistoryEntry, w as PermissionsSnapshot, x as HistoryType, y as HistoryPage, z as listQuerySchema } from "./contract-CXPMGuHk.cjs";
8
+ import { C as RelationshipsApi, S as RelationsOptions, T as WriteRelationshipResult, _ as LoadRelationsOptions, a as PermissionsAbility, b as RelationFacts, c as SetRoleResult, d as SubjectSummary, f as SubjectView, g as ListRelationSubjectsQuery, h as ListObjectsQuery, i as Permissions, l as SubjectInput, m as DeleteRelationshipResult, n as FactsArgs, o as PermissionsOptions, p as createPermissions, r as PathData, s as RevokeResult, t as AnyPermissions, u as SubjectLookup, v as RelationCheckQuery, w as RepairReport, x as RelationTypeView, y as RelationCheckResult } from "./engine-BTgwbHeO.cjs";
9
+ import { a as AuthProvider, i as PermissionsCorsOptions, n as PermissionsPanelOptions, o as Principal, r as createFetchHandler, t as CreateFetchHandlerResult } from "./create-fetch-handler-DxhvXuBA.cjs";
10
+ import { PgNotificationClient, PgNotificationClient as PgNotificationClient$1, WatchSubscribe, WatchSubscribe as WatchSubscribe$1, withWatch } from "@xtandard/kit/storage";
11
+ import { ValidationError, ValidationIssue } from "@xtandard/kit/util";
12
+ import { RouteSpec as RouteSpec$1 } from "@xtandard/kit/server/router";
13
+
14
+ //#region src/errors.d.ts
15
+ /** A write (or a check) needs a subject id and got none (no session, or an empty id). */
16
+ declare class NoSubjectError extends Error {
17
+ constructor(message?: string);
18
+ }
19
+ /** The permission is not in the catalog's `assignable` list. */
20
+ declare class UnknownPermissionError extends Error {
21
+ /** The rejected permission. */
22
+ readonly permission: string;
23
+ constructor(permission: unknown);
24
+ }
25
+ /** The role is not one of the catalog's `roles` (or may not be assigned). */
26
+ declare class UnknownRoleError extends Error {
27
+ /** The rejected role. */
28
+ readonly role: string;
29
+ constructor(role: unknown, message?: string);
30
+ }
31
+ /** The caller may not perform the operation (e.g. grant without a manager role). */
32
+ declare class ForbiddenError extends Error {
33
+ constructor(message?: string);
34
+ }
35
+ /** A referenced record does not exist. */
36
+ declare class NotFoundError extends Error {
37
+ constructor(message: string);
38
+ }
39
+ /** Thrown by mutating operations when the engine is readonly. */
40
+ declare class ReadonlyError extends Error {
41
+ constructor(operation: string);
42
+ }
43
+ /**
44
+ * `setRole()` on an engine whose `roleSource` is `"external"`: roles are managed by the auth
45
+ * provider, so a stored role would be ignored (ADR 0014). HTTP 409 `ROLES_EXTERNAL`.
46
+ */
47
+ declare class ExternalRolesError extends Error {
48
+ constructor(message?: string);
49
+ }
50
+ //#endregion
51
+ //#region src/keys.d.ts
52
+ /**
53
+ * Key layout (ADR 0003). Pure string helpers; every id segment is
54
+ * `encodeURIComponent`-ed, so any subject id or permission name is safe in a
55
+ * key and can't contain the `/` separator.
56
+ *
57
+ * ```txt
58
+ * perm/grants/{subject}/{permission} -> Grant one key per pair: unique on every driver
59
+ * perm/subjects/{subject} -> SubjectRecord optional role assignment + display fields
60
+ * perm/history/{subject}/{at}-{id} -> HistoryEntry append-only; sortable by the last segment
61
+ *
62
+ * perm/rel/{objectType}/{objectId}/{relation}/{subject} -> Relationship
63
+ * perm/relrev/{subjectType}/{subjectId}/{subjectRel}/{objectType}/{objectId}/{relation}
64
+ * -> RelationshipRef
65
+ * ```
66
+ *
67
+ * Relationships (ADR 0013): one forward key per tuple (unique on every driver, so writes are
68
+ * idempotent), read by `(object, relation)` with one prefix scan; the reverse key serves
69
+ * `listObjects` (every tuple naming a subject, plain or as a userset). `{subject}` is the whole
70
+ * subject reference (`user:ana`, `group:eng#member`, `user:*`) as one segment; `{subjectRel}` is
71
+ * `_` for a plain subject or a wildcard and `#{relation}` (encoded `%23…`) for a userset, so it
72
+ * can't collide with a relation named `_`.
73
+ *
74
+ * @module
75
+ */
76
+ /** Root namespace of every key. */
77
+ declare const ROOT = "perm";
78
+ //#endregion
79
+ //#region src/storage/watch.d.ts
80
+ /**
81
+ * A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair with
82
+ * {@link withWatch} for the postgres or drizzle-over-pg adapters. Your migration
83
+ * owns the trigger that `pg_notify`s `channel` with the changed key as payload;
84
+ * this only `LISTEN`s.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * import { Client } from "pg";
89
+ * const listener = new Client({ connectionString: process.env.DATABASE_URL });
90
+ * await listener.connect();
91
+ * const storage = withWatch(base, pgListenNotify(listener, "xtandard_permissions"));
92
+ * ```
93
+ */
94
+ declare function pgListenNotify(client: PgNotificationClient$1, channel?: string): WatchSubscribe$1;
95
+ //#endregion
96
+ //#region src/server/routes.d.ts
97
+ /** `GET /config` (and `/api/config`): the SPA bootstrap. */
98
+ interface PanelConfig {
99
+ title: string;
100
+ logoUrl?: string;
101
+ basePath: string;
102
+ readonly: boolean;
103
+ /** Who owns roles (ADR 0014): `"external"` hides role changes (the auth provider owns them). */
104
+ roleSource: RoleSourceMode;
105
+ authenticated: boolean;
106
+ /**
107
+ * The caller, with its effective catalog role and the source that decided it; `null` when not
108
+ * authenticated.
109
+ */
110
+ principal: {
111
+ id: string;
112
+ role: string;
113
+ roleSource?: RoleSource;
114
+ name?: string;
115
+ email?: string;
116
+ } | null;
117
+ /**
118
+ * The ADR 0008 actions the caller may perform. Mutating actions are left out of a readonly
119
+ * panel, so the SPA can hide write UI from this list alone.
120
+ */
121
+ allowed: PermissionsAction[];
122
+ }
123
+ /** A role or permission with its label. */
124
+ interface LabeledKey {
125
+ key: string;
126
+ label: string;
127
+ description?: string;
128
+ }
129
+ /** `GET /api/catalog`. */
130
+ interface CatalogView {
131
+ /** Least → most privileged. */
132
+ roles: LabeledKey[];
133
+ assignable: LabeledKey[];
134
+ guestRole: string;
135
+ defaultRole: string;
136
+ managerRoles: string[];
137
+ directGrants: boolean;
138
+ /** Who owns roles: `"stored"` (role changes allowed) or `"external"` (the auth provider's). */
139
+ roleSource: RoleSourceMode;
140
+ /** Every leaf permix path of every role's rules tree, sorted (for the playground). */
141
+ paths: string[];
142
+ /** The relation schema (ReBAC), `null` when the catalog declares none. */
143
+ relations: RelationTypeView[] | null;
144
+ }
145
+ /** `GET /api/subjects`. */
146
+ interface SubjectList {
147
+ subjects: SubjectSummary[];
148
+ }
149
+ /** `GET /api/subjects/:id`: the stored view plus the effective role and active permissions. */
150
+ interface SubjectDetail extends SubjectView {
151
+ /**
152
+ * The role checks use: the stored role (`roleSource: "stored"` mode only), else the auth
153
+ * provider's (`lookupSubject`), else the catalog's `defaultRole`; `roleSource` says which.
154
+ */
155
+ effectiveRole: string;
156
+ /** The non-expired, assignable granted permissions. */
157
+ permissions: string[];
158
+ }
159
+ /** Route tags (OpenAPI grouping). */
160
+ type RouteTag = "panel" | "catalog" | "subjects" | "grants" | "history" | "check" | "relationships" | "runtime";
161
+ /** The documented shape of one route (consumed by the OpenAPI builder). */
162
+ type RouteSpec = RouteSpec$1<PermissionsAction, RouteTag> & {
163
+ /** Runtime route: needs an authenticated principal, no action. */runtime?: boolean;
164
+ };
165
+ /**
166
+ * Every leaf path of every role's rules tree. The trees are built (never evaluated) with a
167
+ * placeholder subject and no grants; a role whose rules can't be built that way is skipped.
168
+ */
169
+ declare function catalogPaths(catalog: AnyPermissionsCatalog): string[];
170
+ /** The catalog view served at `/api/catalog` (`roleSource`: the engine's, default `"stored"`). */
171
+ declare function catalogView(catalog: AnyPermissionsCatalog, roleSource?: RoleSourceMode): CatalogView;
172
+ /** A check result as JSON: `explanation.error` (a thrown value) becomes its message. */
173
+ declare function serializeCheck(result: CheckResult): CheckResult;
174
+ /** The documented route table (every API route, in match order). */
175
+ declare const API_ROUTES: readonly RouteSpec[];
176
+ /** The paths served as the bootstrap config (not in {@link API_ROUTES}). */
177
+ declare const CONFIG_PATHS: readonly string[];
178
+ /** Map domain errors to HTTP responses (ADR 0008), by name across bundles. */
179
+ declare function mapError(err: unknown): Response;
180
+ //#endregion
181
+ //#region src/server/openapi.d.ts
182
+ /**
183
+ * OpenAPI 3.1 description of the panel's HTTP API, served at `GET {basePath}/api/openapi.json`
184
+ * and returned by `createFetchHandler(...).openapi()` (merge it into the host's document).
185
+ *
186
+ * Paths come from the router's own table ({@link API_ROUTES}), so every served route is
187
+ * documented; admin routes carry their action as `x-action`, runtime routes `x-runtime: true`.
188
+ * Component schemas are hand-authored (no generation dependency, the family's precedent).
189
+ *
190
+ * @module
191
+ */
192
+ /** Options for {@link buildOpenApiDocument}. */
193
+ interface OpenApiOptions {
194
+ /** Mount prefix used in the `servers` url (e.g. `"/permissions"`). */
195
+ basePath?: string;
196
+ /** Document title. Default `"@xtandard/permissions"`. */
197
+ title?: string;
198
+ /** Document version. Default `"1"` (the HTTP API version, not the package version). */
199
+ version?: string;
200
+ }
201
+ /**
202
+ * Build the OpenAPI 3.1 document for the panel API.
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * import { buildOpenApiDocument } from "@xtandard/permissions";
207
+ * const doc = buildOpenApiDocument({ basePath: "/permissions" });
208
+ * ```
209
+ */
210
+ declare function buildOpenApiDocument(options?: OpenApiOptions): Record<string, unknown>;
211
+ //#endregion
212
+ export { ALL_ACTIONS, API_ROUTES, type Ability, type Actor, type AfterEvent, type AfterEventType, type AnyPermissions, type AnyPermissionsCatalog, AsyncRuleError, type AuthProvider, type AuthorizationProvider, type AuthorizeInput, type BeforeEvent, type BeforeEventType, CONFIG_PATHS, type CatalogMeta, type CatalogView, type CheckExplanation, type CheckReason, type CheckResult, type CompareAndSwapPermissionsStorage, type CreateFetchHandlerResult, type CtxOf, type Definition, type DefinitionOf, type DeleteRelationshipResult, ExternalRolesError, type FactsArgs, ForbiddenError, type Grant, type GrantInput, type HistoryEntry, type HistoryPage, type HistoryQuery, type HistoryType, HookDeniedError, type HookErrorReporter, type InstantInput, ROOT as KEY_ROOT, type KitAuth, type KitAuthEngine, type Label, type LabelInput, type LabeledKey, type ListObjectsQuery, type ListQuery, type ListRelationSubjectsQuery, type LoadRelationsOptions, MUTATING_ACTIONS, type NoRelations, NoSubjectError, NotFoundError, type ObjectRef, type OpenApiOptions, type PanelConfig, type PathData, type PermissionOf, type PermissionPath, type PermissionUnion, type Permissions, type PermissionsAbility, type PermissionsAction, type PermissionsAuthProvider, type PermissionsCatalog, type PermissionsConfig, type PermissionsCorsOptions, type PermissionsHooks, type PermissionsHooksInput, type PermissionsOptions, type PermissionsPanelOptions, type PermissionsResource, type PermissionsSnapshot, type PermissionsStorage, type PermissionsSubject, type PgNotificationClient, type Principal, type ProviderRoleOptions, ReadonlyError, type RelationCheckQuery, type RelationCheckResult, RelationDepthError, type RelationExplanation, type RelationExpr, type RelationFacts, type RelationSchema, RelationSchemaError, type RelationTuple, type RelationsOf, type RelationsOptions, type Relationship, type RelationshipInput, type RelationshipPage, type RelationshipQuery, type RelationshipsApi, type RepairReport, type RevokeInput, type RevokeResult, type RoleMapper, type RoleOf, type RoleSource, type RoleSourceMode, type RouteSpec, type RouteTag, type RuleContext, type RuleHelpers, type Rules, type RulesPaths, type SetRoleInput, type SetRoleResult, type StorageChangeEvent, type SubjectDetail, type SubjectIdentity, type SubjectInput, type SubjectList, type SubjectLookup, type SubjectLookupFn, type SubjectRecord, type SubjectRef, type SubjectSummary, type SubjectView, type ToKitAuthOptions, type TransactionalPermissionsStorage, UnknownPermissionError, UnknownRoleError, type UpsertSubjectInput, ValidationError, type ValidationIssue, type WatchSubscribe, type WatchablePermissionsStorage, type WriteRelationshipResult, actorSchema, buildOpenApiDocument, catalogPaths, catalogView, checkRulesAtPath, computed, createFetchHandler, createPermissions, defaultHookErrorReporter, definePermissions, defineRelations, direct, exclusion, externalRoles, from, fromAuthorization, grantInputSchema, hasAssignedPermission, hasPermission, historyQuerySchema, identityOf, intersection, isCompareAndSwap, isMutatingAction, isTransactional, isWatchable, listObjectsQuerySchema, listQuerySchema, listRelationSubjectsQuerySchema, mapError, normalizeHooks, normalizeRoles, pgListenNotify, relationCheckSchema, relationshipInputSchema, relationshipQuerySchema, revokeInputSchema, runAfter, runBefore, serializeCheck, setRoleInputSchema, splitRoles, subjectOf, toKitAuth, toPermissionSet, union, upsertSubjectInputSchema, withWatch };
213
+ //# sourceMappingURL=index.d.cts.map