@xtandard/permissions 0.0.0-stage → 0.1.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 +362 -2
  3. package/bin/xtandard-permissions.mjs +3 -0
  4. package/dist/better-auth-Bp9YVyQa.d.cts +56 -0
  5. package/dist/better-auth-DHyW5-yt.cjs +91 -0
  6. package/dist/better-auth-DHyW5-yt.cjs.map +1 -0
  7. package/dist/better-auth-NO40ZqSM.mjs +74 -0
  8. package/dist/better-auth-NO40ZqSM.mjs.map +1 -0
  9. package/dist/better-auth-NSXgt6ZU.d.mts +56 -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 +548 -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 +544 -0
  24. package/dist/cli.mjs.map +1 -0
  25. package/dist/contract-BMiOmg2f.d.cts +50 -0
  26. package/dist/contract-Bpy8yPrS.cjs +70 -0
  27. package/dist/contract-Bpy8yPrS.cjs.map +1 -0
  28. package/dist/contract-CNgMXr2u.d.cts +46 -0
  29. package/dist/contract-CNgMXr2u.d.mts +46 -0
  30. package/dist/contract-CPmJVoRx.cjs +70 -0
  31. package/dist/contract-CPmJVoRx.cjs.map +1 -0
  32. package/dist/contract-D32H1t0u.d.mts +50 -0
  33. package/dist/contract-DTdTXZtJ.mjs +47 -0
  34. package/dist/contract-DTdTXZtJ.mjs.map +1 -0
  35. package/dist/contract-DUzgB-He.d.mts +375 -0
  36. package/dist/contract-Dk6d2ylD.d.cts +375 -0
  37. package/dist/contract-RMkmERhT.d.cts +2 -0
  38. package/dist/contract-RMkmERhT.d.mts +2 -0
  39. package/dist/contract-Yc5AZuvv.mjs +47 -0
  40. package/dist/contract-Yc5AZuvv.mjs.map +1 -0
  41. package/dist/create-fetch-handler-BHDU4chu.d.mts +77 -0
  42. package/dist/create-fetch-handler-BtX64_rS.d.cts +77 -0
  43. package/dist/create-fetch-handler-C-WyaRCR.cjs +653 -0
  44. package/dist/create-fetch-handler-C-WyaRCR.cjs.map +1 -0
  45. package/dist/create-fetch-handler-ojjpk1Iw.mjs +636 -0
  46. package/dist/create-fetch-handler-ojjpk1Iw.mjs.map +1 -0
  47. package/dist/elysia-shared-BM6cPoCU.mjs +78 -0
  48. package/dist/elysia-shared-BM6cPoCU.mjs.map +1 -0
  49. package/dist/elysia-shared-BUTFTeal.cjs +101 -0
  50. package/dist/elysia-shared-BUTFTeal.cjs.map +1 -0
  51. package/dist/elysia-shared-DtKViycb.d.cts +58 -0
  52. package/dist/elysia-shared-g8zsb_pU.d.mts +58 -0
  53. package/dist/engine-Bufv0TbD.mjs +574 -0
  54. package/dist/engine-Bufv0TbD.mjs.map +1 -0
  55. package/dist/engine-CGGVDCqi.d.cts +296 -0
  56. package/dist/engine-DpFIcbgh.d.mts +296 -0
  57. package/dist/engine-bMoz3iW-.cjs +587 -0
  58. package/dist/engine-bMoz3iW-.cjs.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 +12 -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 +116 -0
  74. package/dist/entry-auth-jwt.cjs.map +1 -0
  75. package/dist/entry-auth-jwt.d.cts +65 -0
  76. package/dist/entry-auth-jwt.d.mts +65 -0
  77. package/dist/entry-auth-jwt.mjs +108 -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 +82 -0
  84. package/dist/entry-auth-session.cjs.map +1 -0
  85. package/dist/entry-auth-session.d.cts +20 -0
  86. package/dist/entry-auth-session.d.mts +20 -0
  87. package/dist/entry-auth-session.mjs +75 -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-bL3XQLfE.mjs +54 -0
  258. package/dist/errors-bL3XQLfE.mjs.map +1 -0
  259. package/dist/errors-vVYic8gz.cjs +89 -0
  260. package/dist/errors-vVYic8gz.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-BOx5cnMP.mjs +141 -0
  268. package/dist/guard-BOx5cnMP.mjs.map +1 -0
  269. package/dist/guard-C3o7V14m.d.cts +62 -0
  270. package/dist/guard-DCbTnqPz.d.mts +62 -0
  271. package/dist/guard-nwdOYe90.cjs +188 -0
  272. package/dist/guard-nwdOYe90.cjs.map +1 -0
  273. package/dist/index-BVVgDSdq.d.cts +1 -0
  274. package/dist/index-BVVgDSdq.d.mts +1 -0
  275. package/dist/index.cjs +240 -0
  276. package/dist/index.cjs.map +1 -0
  277. package/dist/index.d.cts +195 -0
  278. package/dist/index.d.mts +195 -0
  279. package/dist/index.mjs +60 -0
  280. package/dist/index.mjs.map +1 -0
  281. package/dist/kit-C7tepDB2.cjs +76 -0
  282. package/dist/kit-C7tepDB2.cjs.map +1 -0
  283. package/dist/kit-DMVBLBI9.d.mts +57 -0
  284. package/dist/kit-fzXHYb1l.mjs +65 -0
  285. package/dist/kit-fzXHYb1l.mjs.map +1 -0
  286. package/dist/kit-qAROuhOI.d.cts +57 -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-C9PjftY6.mjs +59 -0
  292. package/dist/permissions-C9PjftY6.mjs.map +1 -0
  293. package/dist/permissions-Cxri_P_k.cjs +70 -0
  294. package/dist/permissions-Cxri_P_k.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 +18710 -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-DtRb3EO0.mjs +1001 -0
  310. package/dist/routes-DtRb3EO0.mjs.map +1 -0
  311. package/dist/routes-irNuuZqo.cjs +1049 -0
  312. package/dist/routes-irNuuZqo.cjs.map +1 -0
  313. package/dist/server-C2F4H6bR.d.cts +886 -0
  314. package/dist/server-CJ7AIJpO.d.mts +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 +57 -0
  328. package/dist/types-elysia2/auth-provider/kit.d.ts +57 -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 +192 -0
  333. package/dist/types-elysia2/entry-elysia2.d.ts +9 -0
  334. package/dist/types-elysia2/errors.d.ts +47 -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 +299 -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 +132 -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 +192 -0
  348. package/dist/types-react/entry-react-embed.d.ts +20 -0
  349. package/dist/types-react/errors.d.ts +47 -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 +299 -0
  356. package/dist/types-react/storage/contract.d.ts +18 -0
  357. package/dist/types-react/ui/App.d.ts +23 -0
  358. package/dist/types-react/ui/api.d.ts +73 -0
  359. package/dist/types-react/ui/components/perm-bits.d.ts +64 -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 +109 -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-uXGOtyuj.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
@@ -0,0 +1,88 @@
1
+ import { n as toJson, t as EVENT_NAMES } from "./events-DYZShrYB.mjs";
2
+ //#region src/bridges/webhooks.ts
3
+ /** Event types this bridge publishes (for the webhooks catalog: `upsertEventType`). */
4
+ const PERMISSIONS_EVENT_TYPES = [
5
+ ["granted", "A permission was granted to a subject."],
6
+ ["revoked", "A permission was revoked from a subject."],
7
+ ["role_changed", "A subject's stored role was set, changed or cleared."],
8
+ ["relationship_written", "A relationship (ReBAC tuple) was written."],
9
+ ["relationship_deleted", "A relationship (ReBAC tuple) was deleted."]
10
+ ].map(([name, description]) => ({
11
+ name: `permissions.${name}`,
12
+ description,
13
+ groupName: "Permissions"
14
+ }));
15
+ /** `@xtandard/webhooks` idempotency keys allow `a-z A-Z 0-9 . _ -`, up to 256 chars. */
16
+ const safeKey = (key) => key.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 256);
17
+ /** The webhook payload of an event: plain data, the actor reduced to its id. */
18
+ function payloadOf(event) {
19
+ const actor = event.actor?.id ?? null;
20
+ switch (event.type) {
21
+ case "grant.created": return toJson({
22
+ subject: event.subject,
23
+ permission: event.grant.permission,
24
+ grant: event.grant,
25
+ actor
26
+ });
27
+ case "grant.revoked": return toJson({
28
+ subject: event.subject,
29
+ permission: event.grant.permission,
30
+ grant: event.grant,
31
+ actor,
32
+ reason: event.reason
33
+ });
34
+ case "role.changed": return toJson({
35
+ subject: event.subject,
36
+ role: event.role,
37
+ previous: event.previous,
38
+ actor,
39
+ reason: event.reason
40
+ });
41
+ case "relationship.written": return toJson({
42
+ subject: event.subject,
43
+ relationship: event.relationship,
44
+ actor
45
+ });
46
+ case "relationship.deleted": return toJson({
47
+ subject: event.subject,
48
+ relationship: event.relationship,
49
+ actor,
50
+ reason: event.reason
51
+ });
52
+ }
53
+ }
54
+ /** What the idempotency key names besides the event, the subject and the time. */
55
+ function changeOf(event) {
56
+ switch (event.type) {
57
+ case "grant.created":
58
+ case "grant.revoked": return `.${event.grant.permission}`;
59
+ case "relationship.written":
60
+ case "relationship.deleted": return `.${event.relationship.object}.${event.relationship.relation}`;
61
+ case "role.changed": return "";
62
+ }
63
+ }
64
+ /**
65
+ * `after` hooks that publish permissions changes as webhooks. The idempotency key names the
66
+ * change (event, subject, permission, commit time), so a re-delivered hook dedupes. Publishing
67
+ * errors are isolated by the engine's hook runner (`onHookError`).
68
+ */
69
+ function webhooksHooks(webhooks, options) {
70
+ const prefix = options.eventPrefix ?? "permissions.";
71
+ const only = options.events ? new Set(options.events) : void 0;
72
+ const appOf = typeof options.application === "function" ? options.application : () => options.application;
73
+ return { async after(event) {
74
+ if (only && !only.has(event.type)) return;
75
+ const eventType = `${prefix}${EVENT_NAMES[event.type]}`;
76
+ const what = changeOf(event);
77
+ await webhooks.publish(appOf(event), {
78
+ eventType,
79
+ payload: payloadOf(event),
80
+ timestamp: event.at,
81
+ idempotencyKey: safeKey(`${eventType}.${event.subject}${what}.${event.at}`)
82
+ });
83
+ } };
84
+ }
85
+ //#endregion
86
+ export { PERMISSIONS_EVENT_TYPES, webhooksHooks };
87
+
88
+ //# sourceMappingURL=entry-bridges-webhooks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-bridges-webhooks.mjs","names":[],"sources":["../src/bridges/webhooks.ts"],"sourcesContent":["/**\n * Webhooks bridge (ADR 0011): publish every committed grant, revoke, role\n * change and relationship write / delete as an outbound webhook through\n * `@xtandard/webhooks` (or anything with a compatible `publish`):\n * `permissions.granted`, `permissions.revoked`, `permissions.role_changed`,\n * `permissions.relationship_written`, `permissions.relationship_deleted`.\n *\n * The `webhooks` parameter is structural ({@link WebhooksPublisherLike}); this\n * module imports nothing from `@xtandard/webhooks`. Register\n * {@link PERMISSIONS_EVENT_TYPES} in the webhooks catalog (it requires known\n * event types by default).\n *\n * @example\n * ```ts\n * import { createWebhooksCore } from \"@xtandard/webhooks/core\";\n * import { PERMISSIONS_EVENT_TYPES, webhooksHooks } from \"@xtandard/permissions/bridges/webhooks\";\n *\n * const webhooks = createWebhooksCore({ storage });\n * for (const t of PERMISSIONS_EVENT_TYPES) await webhooks.upsertEventType(t);\n *\n * const perms = createPermissions({\n * catalog,\n * storage,\n * hooks: webhooksHooks(webhooks, { application: \"my-app\" }),\n * });\n * ```\n *\n * @module bridges/webhooks\n */\n\nimport type { AfterEvent, AfterEventType, PermissionsHooks } from \"../hooks/contract.ts\";\nimport { EVENT_NAMES, toJson, type PermissionsEventName } from \"./events.ts\";\n\n/** A JSON value (structural subset of `@xtandard/webhooks`'s payload). */\nexport type WebhooksJsonValue =\n | string\n | number\n | boolean\n | null\n | WebhooksJsonValue[]\n | { [key: string]: WebhooksJsonValue };\n\n/** What the bridge passes to `webhooks.publish` (structural subset of `@xtandard/webhooks`'s `PublishInput`). */\nexport interface WebhooksPublishInputLike {\n eventType: string;\n payload: WebhooksJsonValue;\n timestamp?: string;\n idempotencyKey?: string;\n}\n\n/** Anything with an `@xtandard/webhooks`-compatible `publish`. */\nexport interface WebhooksPublisherLike {\n publish(application: string, input: WebhooksPublishInputLike): Promise<unknown>;\n}\n\n/** Event types this bridge publishes (for the webhooks catalog: `upsertEventType`). */\nexport const PERMISSIONS_EVENT_TYPES: ReadonlyArray<{\n name: string;\n description: string;\n groupName: string;\n}> = (\n [\n [\"granted\", \"A permission was granted to a subject.\"],\n [\"revoked\", \"A permission was revoked from a subject.\"],\n [\"role_changed\", \"A subject's stored role was set, changed or cleared.\"],\n [\"relationship_written\", \"A relationship (ReBAC tuple) was written.\"],\n [\"relationship_deleted\", \"A relationship (ReBAC tuple) was deleted.\"],\n ] satisfies [PermissionsEventName, string][]\n).map(([name, description]) => ({\n name: `permissions.${name}`,\n description,\n groupName: \"Permissions\",\n}));\n\n/** Options for {@link webhooksHooks}. */\nexport interface WebhooksHooksOptions {\n /**\n * The webhooks application to publish to: a fixed key (your app), or one per event (e.g. from\n * the subject's tenant). Required: a subject is a user, not a webhooks consumer.\n */\n application: string | ((event: AfterEvent) => string);\n /** Event type prefix. Default `\"permissions.\"`; change it together with the registered types. */\n eventPrefix?: string;\n /** Only publish these hook event types (default: all). */\n events?: readonly AfterEventType[];\n}\n\n/** `@xtandard/webhooks` idempotency keys allow `a-z A-Z 0-9 . _ -`, up to 256 chars. */\nconst safeKey = (key: string): string => key.replace(/[^a-zA-Z0-9._-]/g, \"_\").slice(0, 256);\n\n/** The webhook payload of an event: plain data, the actor reduced to its id. */\nfunction payloadOf(event: AfterEvent): WebhooksJsonValue {\n const actor = event.actor?.id ?? null;\n switch (event.type) {\n case \"grant.created\":\n return toJson({\n subject: event.subject,\n permission: event.grant.permission,\n grant: event.grant,\n actor,\n });\n case \"grant.revoked\":\n return toJson({\n subject: event.subject,\n permission: event.grant.permission,\n grant: event.grant,\n actor,\n reason: event.reason,\n });\n case \"role.changed\":\n return toJson({\n subject: event.subject,\n role: event.role,\n previous: event.previous,\n actor,\n reason: event.reason,\n });\n case \"relationship.written\":\n return toJson({ subject: event.subject, relationship: event.relationship, actor });\n case \"relationship.deleted\":\n return toJson({\n subject: event.subject,\n relationship: event.relationship,\n actor,\n reason: event.reason,\n });\n }\n}\n\n/** What the idempotency key names besides the event, the subject and the time. */\nfunction changeOf(event: AfterEvent): string {\n switch (event.type) {\n case \"grant.created\":\n case \"grant.revoked\":\n return `.${event.grant.permission}`;\n case \"relationship.written\":\n case \"relationship.deleted\":\n return `.${event.relationship.object}.${event.relationship.relation}`;\n case \"role.changed\":\n return \"\";\n }\n}\n\n/**\n * `after` hooks that publish permissions changes as webhooks. The idempotency key names the\n * change (event, subject, permission, commit time), so a re-delivered hook dedupes. Publishing\n * errors are isolated by the engine's hook runner (`onHookError`).\n */\nexport function webhooksHooks(\n webhooks: WebhooksPublisherLike,\n options: WebhooksHooksOptions,\n): PermissionsHooks {\n const prefix = options.eventPrefix ?? \"permissions.\";\n const only = options.events ? new Set<AfterEventType>(options.events) : undefined;\n const appOf =\n typeof options.application === \"function\"\n ? options.application\n : () => options.application as string;\n return {\n async after(event) {\n if (only && !only.has(event.type)) return;\n const eventType = `${prefix}${EVENT_NAMES[event.type]}`;\n const what = changeOf(event);\n await webhooks.publish(appOf(event), {\n eventType,\n payload: payloadOf(event),\n timestamp: event.at,\n idempotencyKey: safeKey(`${eventType}.${event.subject}${what}.${event.at}`),\n });\n },\n };\n}\n"],"mappings":";;;AAwDA,MAAa,0BAKX;CACE,CAAC,WAAW,wCAAwC;CACpD,CAAC,WAAW,0CAA0C;CACtD,CAAC,gBAAgB,sDAAsD;CACvE,CAAC,wBAAwB,2CAA2C;CACpE,CAAC,wBAAwB,2CAA2C;AACtE,EACA,KAAK,CAAC,MAAM,kBAAkB;CAC9B,MAAM,eAAe;CACrB;CACA,WAAW;AACb,EAAE;;AAgBF,MAAM,WAAW,QAAwB,IAAI,QAAQ,oBAAoB,GAAG,EAAE,MAAM,GAAG,GAAG;;AAG1F,SAAS,UAAU,OAAsC;CACvD,MAAM,QAAQ,MAAM,OAAO,MAAM;CACjC,QAAQ,MAAM,MAAd;EACE,KAAK,iBACH,OAAO,OAAO;GACZ,SAAS,MAAM;GACf,YAAY,MAAM,MAAM;GACxB,OAAO,MAAM;GACb;EACF,CAAC;EACH,KAAK,iBACH,OAAO,OAAO;GACZ,SAAS,MAAM;GACf,YAAY,MAAM,MAAM;GACxB,OAAO,MAAM;GACb;GACA,QAAQ,MAAM;EAChB,CAAC;EACH,KAAK,gBACH,OAAO,OAAO;GACZ,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB;GACA,QAAQ,MAAM;EAChB,CAAC;EACH,KAAK,wBACH,OAAO,OAAO;GAAE,SAAS,MAAM;GAAS,cAAc,MAAM;GAAc;EAAM,CAAC;EACnF,KAAK,wBACH,OAAO,OAAO;GACZ,SAAS,MAAM;GACf,cAAc,MAAM;GACpB;GACA,QAAQ,MAAM;EAChB,CAAC;CACL;AACF;;AAGA,SAAS,SAAS,OAA2B;CAC3C,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK,iBACH,OAAO,IAAI,MAAM,MAAM;EACzB,KAAK;EACL,KAAK,wBACH,OAAO,IAAI,MAAM,aAAa,OAAO,GAAG,MAAM,aAAa;EAC7D,KAAK,gBACH,OAAO;CACX;AACF;;;;;;AAOA,SAAgB,cACd,UACA,SACkB;CAClB,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,OAAO,QAAQ,SAAS,IAAI,IAAoB,QAAQ,MAAM,IAAI,KAAA;CACxE,MAAM,QACJ,OAAO,QAAQ,gBAAgB,aAC3B,QAAQ,oBACF,QAAQ;CACpB,OAAO,EACL,MAAM,MAAM,OAAO;EACjB,IAAI,QAAQ,CAAC,KAAK,IAAI,MAAM,IAAI,GAAG;EACnC,MAAM,YAAY,GAAG,SAAS,YAAY,MAAM;EAChD,MAAM,OAAO,SAAS,KAAK;EAC3B,MAAM,SAAS,QAAQ,MAAM,KAAK,GAAG;GACnC;GACA,SAAS,UAAU,KAAK;GACxB,WAAW,MAAM;GACjB,gBAAgB,QAAQ,GAAG,UAAU,GAAG,MAAM,UAAU,KAAK,GAAG,MAAM,IAAI;EAC5E,CAAC;CACH,EACF;AACF"}
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_create_fetch_handler = require("./create-fetch-handler-C-WyaRCR.cjs");
3
+ const require_guard = require("./guard-nwdOYe90.cjs");
4
+ //#region src/adapters/bun.ts
5
+ /** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */
6
+ function permissionsPanel(options) {
7
+ return require_create_fetch_handler.createFetchHandler(options);
8
+ }
9
+ /**
10
+ * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`
11
+ * JSON when denied, otherwise call the handler with the decision.
12
+ */
13
+ function requirePermission(engine, path, options) {
14
+ return (handler) => require_guard.guardFetch(require_guard.guardEngine(engine), path, options, handler);
15
+ }
16
+ /**
17
+ * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must
18
+ * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.
19
+ *
20
+ * ```ts
21
+ * const canEdit = requireRelation(perms, "editor", (req) => `doc:${new URL(req.url).searchParams.get("id")}`, { provider });
22
+ * Bun.serve({ routes: { "/api/doc": { PUT: canEdit((req, decision) => Response.json(decision)) } } });
23
+ * ```
24
+ */
25
+ function requireRelation(engine, relation, object, options) {
26
+ return (handler) => require_guard.guardFetchRelation(require_guard.relationGuardEngine(engine), relation, object, options, handler);
27
+ }
28
+ //#endregion
29
+ exports.permissionsPanel = permissionsPanel;
30
+ exports.requirePermission = requirePermission;
31
+ exports.requireRelation = requireRelation;
32
+
33
+ //# sourceMappingURL=entry-bun.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-bun.cjs","names":["createFetchHandler","guardFetch","guardEngine","guardFetchRelation","relationGuardEngine"],"sources":["../src/adapters/bun.ts"],"sourcesContent":["/**\n * Bun adapter. The handler is already web-standard: the panel is a passthrough for\n * `Bun.serve({ fetch })`; the guard wraps a route handler.\n *\n * ```ts\n * import { permissionsPanel, requirePermission } from \"@xtandard/permissions/bun\";\n *\n * const panel = permissionsPanel({ permissions: perms, provider, basePath: \"/permissions\" });\n * const canRefund = requirePermission(perms, \"billing.refund\", { provider });\n *\n * Bun.serve({\n * routes: {\n * \"/permissions/*\": panel.fetch,\n * \"/api/refund\": canRefund(async (req, decision) => Response.json({ ok: true })),\n * },\n * });\n * ```\n *\n * @module\n */\n\nimport type { AnyPermissions } from \"../engine.ts\";\nimport type { Definition } from \"../policy.ts\";\nimport type { CheckResult } from \"../schema.ts\";\nimport {\n createFetchHandler,\n type CreateFetchHandlerResult,\n type PermissionsPanelOptions,\n} from \"../server/create-fetch-handler.ts\";\nimport {\n guardEngine,\n guardFetch,\n guardFetchRelation,\n relationGuardEngine,\n type PathOf,\n type RelationDecision,\n type RelationObjectInput,\n type RequirePermissionOptions,\n type RequireRelationOptions,\n} from \"./guard.ts\";\n\n/** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */\nexport function permissionsPanel<\n D extends Definition = Definition,\n R extends string = string,\n P extends string = string,\n X = undefined,\n>(options: PermissionsPanelOptions<D, R, P, X>): CreateFetchHandlerResult<D, R, P, X> {\n return createFetchHandler(options);\n}\n\n/** A Bun route handler that also receives the allowing decision. */\nexport type GuardedBunHandler = (\n request: Request,\n decision: CheckResult,\n) => Response | Promise<Response>;\n\n/**\n * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`\n * JSON when denied, otherwise call the handler with the decision.\n */\nexport function requirePermission<E extends AnyPermissions>(\n engine: E,\n path: PathOf<E>,\n options: RequirePermissionOptions<Request>,\n): (handler: GuardedBunHandler) => (request: Request) => Promise<Response> {\n return (handler) => guardFetch(guardEngine(engine), path, options, handler);\n}\n\n/** A Bun route handler that also receives the allowing relationship decision. */\nexport type RelationGuardedBunHandler = (\n request: Request,\n decision: RelationDecision,\n) => Response | Promise<Response>;\n\n/**\n * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must\n * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.\n *\n * ```ts\n * const canEdit = requireRelation(perms, \"editor\", (req) => `doc:${new URL(req.url).searchParams.get(\"id\")}`, { provider });\n * Bun.serve({ routes: { \"/api/doc\": { PUT: canEdit((req, decision) => Response.json(decision)) } } });\n * ```\n */\nexport function requireRelation<E extends AnyPermissions>(\n engine: E,\n relation: string,\n object: RelationObjectInput<Request>,\n options: RequireRelationOptions<Request>,\n): (handler: RelationGuardedBunHandler) => (request: Request) => Promise<Response> {\n return (handler) =>\n guardFetchRelation(relationGuardEngine(engine), relation, object, options, handler);\n}\n\nexport type {\n CreateFetchHandlerResult,\n PermissionsPanelOptions,\n RelationDecision,\n RelationObjectInput,\n RequirePermissionOptions,\n RequireRelationOptions,\n};\n"],"mappings":";;;;;AA0CA,SAAgB,iBAKd,SAAoF;CACpF,OAAOA,6BAAAA,mBAAmB,OAAO;AACnC;;;;;AAYA,SAAgB,kBACd,QACA,MACA,SACyE;CACzE,QAAQ,YAAYC,cAAAA,WAAWC,cAAAA,YAAY,MAAM,GAAG,MAAM,SAAS,OAAO;AAC5E;;;;;;;;;;AAiBA,SAAgB,gBACd,QACA,UACA,QACA,SACiF;CACjF,QAAQ,YACNC,cAAAA,mBAAmBC,cAAAA,oBAAoB,MAAM,GAAG,UAAU,QAAQ,SAAS,OAAO;AACtF"}
@@ -0,0 +1,31 @@
1
+ import { s as Definition } from "./policy-DFq_SYR3.cjs";
2
+ import { h as CheckResult } from "./contract-Dk6d2ylD.cjs";
3
+ import { t as AnyPermissions } from "./engine-CGGVDCqi.cjs";
4
+ import { n as PermissionsPanelOptions, t as CreateFetchHandlerResult } from "./create-fetch-handler-BtX64_rS.cjs";
5
+ import { a as RequireRelationOptions, i as RequirePermissionOptions, n as RelationDecision, r as RelationObjectInput, t as PathOf } from "./guard-C3o7V14m.cjs";
6
+
7
+ //#region src/adapters/bun.d.ts
8
+ /** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */
9
+ declare function permissionsPanel<D extends Definition = Definition, R extends string = string, P extends string = string, X = undefined>(options: PermissionsPanelOptions<D, R, P, X>): CreateFetchHandlerResult<D, R, P, X>;
10
+ /** A Bun route handler that also receives the allowing decision. */
11
+ type GuardedBunHandler = (request: Request, decision: CheckResult) => Response | Promise<Response>;
12
+ /**
13
+ * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`
14
+ * JSON when denied, otherwise call the handler with the decision.
15
+ */
16
+ declare function requirePermission<E extends AnyPermissions>(engine: E, path: PathOf<E>, options: RequirePermissionOptions<Request>): (handler: GuardedBunHandler) => (request: Request) => Promise<Response>;
17
+ /** A Bun route handler that also receives the allowing relationship decision. */
18
+ type RelationGuardedBunHandler = (request: Request, decision: RelationDecision) => Response | Promise<Response>;
19
+ /**
20
+ * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must
21
+ * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.
22
+ *
23
+ * ```ts
24
+ * const canEdit = requireRelation(perms, "editor", (req) => `doc:${new URL(req.url).searchParams.get("id")}`, { provider });
25
+ * Bun.serve({ routes: { "/api/doc": { PUT: canEdit((req, decision) => Response.json(decision)) } } });
26
+ * ```
27
+ */
28
+ declare function requireRelation<E extends AnyPermissions>(engine: E, relation: string, object: RelationObjectInput<Request>, options: RequireRelationOptions<Request>): (handler: RelationGuardedBunHandler) => (request: Request) => Promise<Response>;
29
+ //#endregion
30
+ export { type CreateFetchHandlerResult, GuardedBunHandler, type PermissionsPanelOptions, type RelationDecision, RelationGuardedBunHandler, type RelationObjectInput, type RequirePermissionOptions, type RequireRelationOptions, permissionsPanel, requirePermission, requireRelation };
31
+ //# sourceMappingURL=entry-bun.d.cts.map
@@ -0,0 +1,31 @@
1
+ import { s as Definition } from "./policy-CGA6QD0a.mjs";
2
+ import { h as CheckResult } from "./contract-DUzgB-He.mjs";
3
+ import { t as AnyPermissions } from "./engine-DpFIcbgh.mjs";
4
+ import { n as PermissionsPanelOptions, t as CreateFetchHandlerResult } from "./create-fetch-handler-BHDU4chu.mjs";
5
+ import { a as RequireRelationOptions, i as RequirePermissionOptions, n as RelationDecision, r as RelationObjectInput, t as PathOf } from "./guard-DCbTnqPz.mjs";
6
+
7
+ //#region src/adapters/bun.d.ts
8
+ /** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */
9
+ declare function permissionsPanel<D extends Definition = Definition, R extends string = string, P extends string = string, X = undefined>(options: PermissionsPanelOptions<D, R, P, X>): CreateFetchHandlerResult<D, R, P, X>;
10
+ /** A Bun route handler that also receives the allowing decision. */
11
+ type GuardedBunHandler = (request: Request, decision: CheckResult) => Response | Promise<Response>;
12
+ /**
13
+ * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`
14
+ * JSON when denied, otherwise call the handler with the decision.
15
+ */
16
+ declare function requirePermission<E extends AnyPermissions>(engine: E, path: PathOf<E>, options: RequirePermissionOptions<Request>): (handler: GuardedBunHandler) => (request: Request) => Promise<Response>;
17
+ /** A Bun route handler that also receives the allowing relationship decision. */
18
+ type RelationGuardedBunHandler = (request: Request, decision: RelationDecision) => Response | Promise<Response>;
19
+ /**
20
+ * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must
21
+ * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.
22
+ *
23
+ * ```ts
24
+ * const canEdit = requireRelation(perms, "editor", (req) => `doc:${new URL(req.url).searchParams.get("id")}`, { provider });
25
+ * Bun.serve({ routes: { "/api/doc": { PUT: canEdit((req, decision) => Response.json(decision)) } } });
26
+ * ```
27
+ */
28
+ declare function requireRelation<E extends AnyPermissions>(engine: E, relation: string, object: RelationObjectInput<Request>, options: RequireRelationOptions<Request>): (handler: RelationGuardedBunHandler) => (request: Request) => Promise<Response>;
29
+ //#endregion
30
+ export { type CreateFetchHandlerResult, GuardedBunHandler, type PermissionsPanelOptions, type RelationDecision, RelationGuardedBunHandler, type RelationObjectInput, type RequirePermissionOptions, type RequireRelationOptions, permissionsPanel, requirePermission, requireRelation };
31
+ //# sourceMappingURL=entry-bun.d.mts.map
@@ -0,0 +1,30 @@
1
+ import { t as createFetchHandler } from "./create-fetch-handler-ojjpk1Iw.mjs";
2
+ import { a as guardFetchRelation, i as guardFetch, r as guardEngine, s as relationGuardEngine } from "./guard-BOx5cnMP.mjs";
3
+ //#region src/adapters/bun.ts
4
+ /** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */
5
+ function permissionsPanel(options) {
6
+ return createFetchHandler(options);
7
+ }
8
+ /**
9
+ * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`
10
+ * JSON when denied, otherwise call the handler with the decision.
11
+ */
12
+ function requirePermission(engine, path, options) {
13
+ return (handler) => guardFetch(guardEngine(engine), path, options, handler);
14
+ }
15
+ /**
16
+ * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must
17
+ * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.
18
+ *
19
+ * ```ts
20
+ * const canEdit = requireRelation(perms, "editor", (req) => `doc:${new URL(req.url).searchParams.get("id")}`, { provider });
21
+ * Bun.serve({ routes: { "/api/doc": { PUT: canEdit((req, decision) => Response.json(decision)) } } });
22
+ * ```
23
+ */
24
+ function requireRelation(engine, relation, object, options) {
25
+ return (handler) => guardFetchRelation(relationGuardEngine(engine), relation, object, options, handler);
26
+ }
27
+ //#endregion
28
+ export { permissionsPanel, requirePermission, requireRelation };
29
+
30
+ //# sourceMappingURL=entry-bun.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-bun.mjs","names":[],"sources":["../src/adapters/bun.ts"],"sourcesContent":["/**\n * Bun adapter. The handler is already web-standard: the panel is a passthrough for\n * `Bun.serve({ fetch })`; the guard wraps a route handler.\n *\n * ```ts\n * import { permissionsPanel, requirePermission } from \"@xtandard/permissions/bun\";\n *\n * const panel = permissionsPanel({ permissions: perms, provider, basePath: \"/permissions\" });\n * const canRefund = requirePermission(perms, \"billing.refund\", { provider });\n *\n * Bun.serve({\n * routes: {\n * \"/permissions/*\": panel.fetch,\n * \"/api/refund\": canRefund(async (req, decision) => Response.json({ ok: true })),\n * },\n * });\n * ```\n *\n * @module\n */\n\nimport type { AnyPermissions } from \"../engine.ts\";\nimport type { Definition } from \"../policy.ts\";\nimport type { CheckResult } from \"../schema.ts\";\nimport {\n createFetchHandler,\n type CreateFetchHandlerResult,\n type PermissionsPanelOptions,\n} from \"../server/create-fetch-handler.ts\";\nimport {\n guardEngine,\n guardFetch,\n guardFetchRelation,\n relationGuardEngine,\n type PathOf,\n type RelationDecision,\n type RelationObjectInput,\n type RequirePermissionOptions,\n type RequireRelationOptions,\n} from \"./guard.ts\";\n\n/** Create a Bun-ready panel handler (`fetch` + `engine` + `openapi`). */\nexport function permissionsPanel<\n D extends Definition = Definition,\n R extends string = string,\n P extends string = string,\n X = undefined,\n>(options: PermissionsPanelOptions<D, R, P, X>): CreateFetchHandlerResult<D, R, P, X> {\n return createFetchHandler(options);\n}\n\n/** A Bun route handler that also receives the allowing decision. */\nexport type GuardedBunHandler = (\n request: Request,\n decision: CheckResult,\n) => Response | Promise<Response>;\n\n/**\n * Guard a Bun route: resolve the subject from the `Request`, decide `path`, answer `401` / `403`\n * JSON when denied, otherwise call the handler with the decision.\n */\nexport function requirePermission<E extends AnyPermissions>(\n engine: E,\n path: PathOf<E>,\n options: RequirePermissionOptions<Request>,\n): (handler: GuardedBunHandler) => (request: Request) => Promise<Response> {\n return (handler) => guardFetch(guardEngine(engine), path, options, handler);\n}\n\n/** A Bun route handler that also receives the allowing relationship decision. */\nexport type RelationGuardedBunHandler = (\n request: Request,\n decision: RelationDecision,\n) => Response | Promise<Response>;\n\n/**\n * Guard a Bun route with a relationship (ReBAC): the caller (`user:{id}` unless `subjectRef`) must\n * have `relation` on the object (fixed, or from the request). `401` / `403` JSON when denied.\n *\n * ```ts\n * const canEdit = requireRelation(perms, \"editor\", (req) => `doc:${new URL(req.url).searchParams.get(\"id\")}`, { provider });\n * Bun.serve({ routes: { \"/api/doc\": { PUT: canEdit((req, decision) => Response.json(decision)) } } });\n * ```\n */\nexport function requireRelation<E extends AnyPermissions>(\n engine: E,\n relation: string,\n object: RelationObjectInput<Request>,\n options: RequireRelationOptions<Request>,\n): (handler: RelationGuardedBunHandler) => (request: Request) => Promise<Response> {\n return (handler) =>\n guardFetchRelation(relationGuardEngine(engine), relation, object, options, handler);\n}\n\nexport type {\n CreateFetchHandlerResult,\n PermissionsPanelOptions,\n RelationDecision,\n RelationObjectInput,\n RequirePermissionOptions,\n RequireRelationOptions,\n};\n"],"mappings":";;;;AA0CA,SAAgB,iBAKd,SAAoF;CACpF,OAAO,mBAAmB,OAAO;AACnC;;;;;AAYA,SAAgB,kBACd,QACA,MACA,SACyE;CACzE,QAAQ,YAAY,WAAW,YAAY,MAAM,GAAG,MAAM,SAAS,OAAO;AAC5E;;;;;;;;;;AAiBA,SAAgB,gBACd,QACA,UACA,QACA,SACiF;CACjF,QAAQ,YACN,mBAAmB,oBAAoB,MAAM,GAAG,UAAU,QAAQ,SAAS,OAAO;AACtF"}
@@ -0,0 +1,34 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _xtandard_kit_drizzle_mysql = require("@xtandard/kit/drizzle/mysql");
3
+ //#region src/drizzle/mysql.ts
4
+ /**
5
+ * `@xtandard/permissions/drizzle/mysql` — the MySQL Drizzle table factory for
6
+ * the permissions KV store. Schema-only (imports just `drizzle-orm/mysql-core`
7
+ * through the kit).
8
+ *
9
+ * The key column is `varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`:
10
+ * MySQL's default `utf8mb4_0900_ai_ci` is case- and accent-insensitive, which
11
+ * would make `perm/grants/Ann/…` and `perm/grants/ann/…` the same primary key.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { mysqlPermissionsTable } from "@xtandard/permissions/drizzle/mysql";
16
+ * export const permissionsKv = mysqlPermissionsTable();
17
+ * ```
18
+ *
19
+ * The table is `mysqlKvTable` from `@xtandard/kit/drizzle/mysql`.
20
+ *
21
+ * @module
22
+ */
23
+ /**
24
+ * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar
25
+ * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name
26
+ * defaults to `"xtandard_permissions_kv"`.
27
+ */
28
+ function mysqlPermissionsTable(name = "xtandard_permissions_kv", opts) {
29
+ return (0, _xtandard_kit_drizzle_mysql.mysqlKvTable)(name, opts);
30
+ }
31
+ //#endregion
32
+ exports.mysqlPermissionsTable = mysqlPermissionsTable;
33
+
34
+ //# sourceMappingURL=entry-drizzle-mysql.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-drizzle-mysql.cjs","names":[],"sources":["../src/drizzle/mysql.ts"],"sourcesContent":["/**\n * `@xtandard/permissions/drizzle/mysql` — the MySQL Drizzle table factory for\n * the permissions KV store. Schema-only (imports just `drizzle-orm/mysql-core`\n * through the kit).\n *\n * The key column is `varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`:\n * MySQL's default `utf8mb4_0900_ai_ci` is case- and accent-insensitive, which\n * would make `perm/grants/Ann/…` and `perm/grants/ann/…` the same primary key.\n *\n * @example\n * ```ts\n * import { mysqlPermissionsTable } from \"@xtandard/permissions/drizzle/mysql\";\n * export const permissionsKv = mysqlPermissionsTable();\n * ```\n *\n * The table is `mysqlKvTable` from `@xtandard/kit/drizzle/mysql`.\n *\n * @module\n */\n\nimport { mysqlKvTable, type MysqlKvTableOptions } from \"@xtandard/kit/drizzle/mysql\";\nimport type { DrizzleKvTable } from \"./table.ts\";\n\nexport type { DrizzleKvTable } from \"./table.ts\";\nexport type { MysqlKeyCollation } from \"@xtandard/kit/drizzle/mysql\";\n\n/**\n * Options for {@link mysqlPermissionsTable}: `keyLength` (default `512`),\n * `keyCollation` (default `\"utf8mb4_bin\"`; pass `\"utf8mb4_0900_bin\"` on MySQL\n * 8.0+ or `\"utf8mb4_nopad_bin\"` on MariaDB for a NO PAD key), `extraColumns`\n * and `extraIndexes`.\n */\nexport type MysqlPermissionsTableOptions = MysqlKvTableOptions;\n\n/**\n * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar\n * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name\n * defaults to `\"xtandard_permissions_kv\"`.\n */\nexport function mysqlPermissionsTable(\n name = \"xtandard_permissions_kv\",\n opts?: MysqlPermissionsTableOptions,\n): DrizzleKvTable {\n return mysqlKvTable(name, opts);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,sBACd,OAAO,2BACP,MACgB;CAChB,QAAA,GAAA,4BAAA,cAAoB,MAAM,IAAI;AAChC"}
@@ -0,0 +1,20 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.cjs";
2
+ import { MysqlKeyCollation, MysqlKvTableOptions } from "@xtandard/kit/drizzle/mysql";
3
+
4
+ //#region src/drizzle/mysql.d.ts
5
+ /**
6
+ * Options for {@link mysqlPermissionsTable}: `keyLength` (default `512`),
7
+ * `keyCollation` (default `"utf8mb4_bin"`; pass `"utf8mb4_0900_bin"` on MySQL
8
+ * 8.0+ or `"utf8mb4_nopad_bin"` on MariaDB for a NO PAD key), `extraColumns`
9
+ * and `extraIndexes`.
10
+ */
11
+ type MysqlPermissionsTableOptions = MysqlKvTableOptions;
12
+ /**
13
+ * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar
14
+ * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name
15
+ * defaults to `"xtandard_permissions_kv"`.
16
+ */
17
+ declare function mysqlPermissionsTable(name?: string, opts?: MysqlPermissionsTableOptions): DrizzleKvTable;
18
+ //#endregion
19
+ export { type DrizzleKvTable, type MysqlKeyCollation, MysqlPermissionsTableOptions, mysqlPermissionsTable };
20
+ //# sourceMappingURL=entry-drizzle-mysql.d.cts.map
@@ -0,0 +1,20 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.mjs";
2
+ import { MysqlKeyCollation, MysqlKvTableOptions } from "@xtandard/kit/drizzle/mysql";
3
+
4
+ //#region src/drizzle/mysql.d.ts
5
+ /**
6
+ * Options for {@link mysqlPermissionsTable}: `keyLength` (default `512`),
7
+ * `keyCollation` (default `"utf8mb4_bin"`; pass `"utf8mb4_0900_bin"` on MySQL
8
+ * 8.0+ or `"utf8mb4_nopad_bin"` on MariaDB for a NO PAD key), `extraColumns`
9
+ * and `extraIndexes`.
10
+ */
11
+ type MysqlPermissionsTableOptions = MysqlKvTableOptions;
12
+ /**
13
+ * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar
14
+ * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name
15
+ * defaults to `"xtandard_permissions_kv"`.
16
+ */
17
+ declare function mysqlPermissionsTable(name?: string, opts?: MysqlPermissionsTableOptions): DrizzleKvTable;
18
+ //#endregion
19
+ export { type DrizzleKvTable, type MysqlKeyCollation, MysqlPermissionsTableOptions, mysqlPermissionsTable };
20
+ //# sourceMappingURL=entry-drizzle-mysql.d.mts.map
@@ -0,0 +1,33 @@
1
+ import { mysqlKvTable } from "@xtandard/kit/drizzle/mysql";
2
+ //#region src/drizzle/mysql.ts
3
+ /**
4
+ * `@xtandard/permissions/drizzle/mysql` — the MySQL Drizzle table factory for
5
+ * the permissions KV store. Schema-only (imports just `drizzle-orm/mysql-core`
6
+ * through the kit).
7
+ *
8
+ * The key column is `varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`:
9
+ * MySQL's default `utf8mb4_0900_ai_ci` is case- and accent-insensitive, which
10
+ * would make `perm/grants/Ann/…` and `perm/grants/ann/…` the same primary key.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { mysqlPermissionsTable } from "@xtandard/permissions/drizzle/mysql";
15
+ * export const permissionsKv = mysqlPermissionsTable();
16
+ * ```
17
+ *
18
+ * The table is `mysqlKvTable` from `@xtandard/kit/drizzle/mysql`.
19
+ *
20
+ * @module
21
+ */
22
+ /**
23
+ * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar
24
+ * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name
25
+ * defaults to `"xtandard_permissions_kv"`.
26
+ */
27
+ function mysqlPermissionsTable(name = "xtandard_permissions_kv", opts) {
28
+ return mysqlKvTable(name, opts);
29
+ }
30
+ //#endregion
31
+ export { mysqlPermissionsTable };
32
+
33
+ //# sourceMappingURL=entry-drizzle-mysql.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-drizzle-mysql.mjs","names":[],"sources":["../src/drizzle/mysql.ts"],"sourcesContent":["/**\n * `@xtandard/permissions/drizzle/mysql` — the MySQL Drizzle table factory for\n * the permissions KV store. Schema-only (imports just `drizzle-orm/mysql-core`\n * through the kit).\n *\n * The key column is `varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin`:\n * MySQL's default `utf8mb4_0900_ai_ci` is case- and accent-insensitive, which\n * would make `perm/grants/Ann/…` and `perm/grants/ann/…` the same primary key.\n *\n * @example\n * ```ts\n * import { mysqlPermissionsTable } from \"@xtandard/permissions/drizzle/mysql\";\n * export const permissionsKv = mysqlPermissionsTable();\n * ```\n *\n * The table is `mysqlKvTable` from `@xtandard/kit/drizzle/mysql`.\n *\n * @module\n */\n\nimport { mysqlKvTable, type MysqlKvTableOptions } from \"@xtandard/kit/drizzle/mysql\";\nimport type { DrizzleKvTable } from \"./table.ts\";\n\nexport type { DrizzleKvTable } from \"./table.ts\";\nexport type { MysqlKeyCollation } from \"@xtandard/kit/drizzle/mysql\";\n\n/**\n * Options for {@link mysqlPermissionsTable}: `keyLength` (default `512`),\n * `keyCollation` (default `\"utf8mb4_bin\"`; pass `\"utf8mb4_0900_bin\"` on MySQL\n * 8.0+ or `\"utf8mb4_nopad_bin\"` on MariaDB for a NO PAD key), `extraColumns`\n * and `extraIndexes`.\n */\nexport type MysqlPermissionsTableOptions = MysqlKvTableOptions;\n\n/**\n * Build the MySQL `mysqlTable` for the permissions KV store: `key varchar\n * … COLLATE utf8mb4_bin PRIMARY KEY`, `value json NOT NULL`. The table name\n * defaults to `\"xtandard_permissions_kv\"`.\n */\nexport function mysqlPermissionsTable(\n name = \"xtandard_permissions_kv\",\n opts?: MysqlPermissionsTableOptions,\n): DrizzleKvTable {\n return mysqlKvTable(name, opts);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,sBACd,OAAO,2BACP,MACgB;CAChB,OAAO,aAAa,MAAM,IAAI;AAChC"}
@@ -0,0 +1,44 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _xtandard_kit_drizzle_pg = require("@xtandard/kit/drizzle/pg");
3
+ //#region src/drizzle/pg.ts
4
+ /**
5
+ * `@xtandard/permissions/drizzle/pg` — the Drizzle table factory for the
6
+ * permissions KV store on Postgres.
7
+ *
8
+ * Schema-only (imports just `drizzle-orm/pg-core` through the kit, never the
9
+ * engine), so it is safe to use inside a Drizzle schema file. Adding the table
10
+ * to your schema brings it into your normal `drizzle-kit` generate/migrate flow
11
+ * instead of an adapter-side `CREATE TABLE`. The key column is `text COLLATE
12
+ * "C"` so ordering and `LIKE` prefixes are bytewise and case-sensitive whatever
13
+ * the database default collation.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // schema.ts
18
+ * import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
19
+ * export const permissionsKv = pgPermissionsTable();
20
+ *
21
+ * // then: createDrizzleStorage({ db, table: permissionsKv })
22
+ * ```
23
+ *
24
+ * The table is `pgKvTable` from `@xtandard/kit/drizzle/pg`, with the
25
+ * permissions name and `COLLATE "C"` key passed explicitly.
26
+ *
27
+ * @module
28
+ */
29
+ /**
30
+ * Build the Drizzle `pgTable` for the permissions KV store. Base columns are
31
+ * fixed — `key text COLLATE "C" PRIMARY KEY`, `value jsonb NOT NULL` — and
32
+ * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`
33
+ * extend it. The table name defaults to `"xtandard_permissions_kv"`.
34
+ */
35
+ function pgPermissionsTable(name = "xtandard_permissions_kv", opts) {
36
+ return (0, _xtandard_kit_drizzle_pg.pgKvTable)(name, {
37
+ keyCollation: "C",
38
+ ...opts
39
+ });
40
+ }
41
+ //#endregion
42
+ exports.pgPermissionsTable = pgPermissionsTable;
43
+
44
+ //# sourceMappingURL=entry-drizzle-pg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-drizzle-pg.cjs","names":[],"sources":["../src/drizzle/pg.ts"],"sourcesContent":["/**\n * `@xtandard/permissions/drizzle/pg` — the Drizzle table factory for the\n * permissions KV store on Postgres.\n *\n * Schema-only (imports just `drizzle-orm/pg-core` through the kit, never the\n * engine), so it is safe to use inside a Drizzle schema file. Adding the table\n * to your schema brings it into your normal `drizzle-kit` generate/migrate flow\n * instead of an adapter-side `CREATE TABLE`. The key column is `text COLLATE\n * \"C\"` so ordering and `LIKE` prefixes are bytewise and case-sensitive whatever\n * the database default collation.\n *\n * @example\n * ```ts\n * // schema.ts\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n * export const permissionsKv = pgPermissionsTable();\n *\n * // then: createDrizzleStorage({ db, table: permissionsKv })\n * ```\n *\n * The table is `pgKvTable` from `@xtandard/kit/drizzle/pg`, with the\n * permissions name and `COLLATE \"C\"` key passed explicitly.\n *\n * @module\n */\n\nimport { pgKvTable, type PgKvTableOptions } from \"@xtandard/kit/drizzle/pg\";\nimport type { DrizzleKvTable } from \"./table.ts\";\n\nexport type { DrizzleKvTable } from \"./table.ts\";\n\n/**\n * Options for {@link pgPermissionsTable}: `schema`, `extraColumns`,\n * `extraIndexes`, and `keyCollation` (default `\"C\"`; `null` declares a plain\n * `text` key).\n */\nexport type PgPermissionsTableOptions = PgKvTableOptions;\n\n/**\n * Build the Drizzle `pgTable` for the permissions KV store. Base columns are\n * fixed — `key text COLLATE \"C\" PRIMARY KEY`, `value jsonb NOT NULL` — and\n * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`\n * extend it. The table name defaults to `\"xtandard_permissions_kv\"`.\n */\nexport function pgPermissionsTable(\n name = \"xtandard_permissions_kv\",\n opts?: PgPermissionsTableOptions,\n): DrizzleKvTable {\n return pgKvTable(name, { keyCollation: \"C\", ...opts });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,mBACd,OAAO,2BACP,MACgB;CAChB,QAAA,GAAA,yBAAA,WAAiB,MAAM;EAAE,cAAc;EAAK,GAAG;CAAK,CAAC;AACvD"}
@@ -0,0 +1,20 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.cjs";
2
+ import { PgKvTableOptions } from "@xtandard/kit/drizzle/pg";
3
+
4
+ //#region src/drizzle/pg.d.ts
5
+ /**
6
+ * Options for {@link pgPermissionsTable}: `schema`, `extraColumns`,
7
+ * `extraIndexes`, and `keyCollation` (default `"C"`; `null` declares a plain
8
+ * `text` key).
9
+ */
10
+ type PgPermissionsTableOptions = PgKvTableOptions;
11
+ /**
12
+ * Build the Drizzle `pgTable` for the permissions KV store. Base columns are
13
+ * fixed — `key text COLLATE "C" PRIMARY KEY`, `value jsonb NOT NULL` — and
14
+ * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`
15
+ * extend it. The table name defaults to `"xtandard_permissions_kv"`.
16
+ */
17
+ declare function pgPermissionsTable(name?: string, opts?: PgPermissionsTableOptions): DrizzleKvTable;
18
+ //#endregion
19
+ export { type DrizzleKvTable, PgPermissionsTableOptions, pgPermissionsTable };
20
+ //# sourceMappingURL=entry-drizzle-pg.d.cts.map
@@ -0,0 +1,20 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.mjs";
2
+ import { PgKvTableOptions } from "@xtandard/kit/drizzle/pg";
3
+
4
+ //#region src/drizzle/pg.d.ts
5
+ /**
6
+ * Options for {@link pgPermissionsTable}: `schema`, `extraColumns`,
7
+ * `extraIndexes`, and `keyCollation` (default `"C"`; `null` declares a plain
8
+ * `text` key).
9
+ */
10
+ type PgPermissionsTableOptions = PgKvTableOptions;
11
+ /**
12
+ * Build the Drizzle `pgTable` for the permissions KV store. Base columns are
13
+ * fixed — `key text COLLATE "C" PRIMARY KEY`, `value jsonb NOT NULL` — and
14
+ * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`
15
+ * extend it. The table name defaults to `"xtandard_permissions_kv"`.
16
+ */
17
+ declare function pgPermissionsTable(name?: string, opts?: PgPermissionsTableOptions): DrizzleKvTable;
18
+ //#endregion
19
+ export { type DrizzleKvTable, PgPermissionsTableOptions, pgPermissionsTable };
20
+ //# sourceMappingURL=entry-drizzle-pg.d.mts.map
@@ -0,0 +1,43 @@
1
+ import { pgKvTable } from "@xtandard/kit/drizzle/pg";
2
+ //#region src/drizzle/pg.ts
3
+ /**
4
+ * `@xtandard/permissions/drizzle/pg` — the Drizzle table factory for the
5
+ * permissions KV store on Postgres.
6
+ *
7
+ * Schema-only (imports just `drizzle-orm/pg-core` through the kit, never the
8
+ * engine), so it is safe to use inside a Drizzle schema file. Adding the table
9
+ * to your schema brings it into your normal `drizzle-kit` generate/migrate flow
10
+ * instead of an adapter-side `CREATE TABLE`. The key column is `text COLLATE
11
+ * "C"` so ordering and `LIKE` prefixes are bytewise and case-sensitive whatever
12
+ * the database default collation.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // schema.ts
17
+ * import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
18
+ * export const permissionsKv = pgPermissionsTable();
19
+ *
20
+ * // then: createDrizzleStorage({ db, table: permissionsKv })
21
+ * ```
22
+ *
23
+ * The table is `pgKvTable` from `@xtandard/kit/drizzle/pg`, with the
24
+ * permissions name and `COLLATE "C"` key passed explicitly.
25
+ *
26
+ * @module
27
+ */
28
+ /**
29
+ * Build the Drizzle `pgTable` for the permissions KV store. Base columns are
30
+ * fixed — `key text COLLATE "C" PRIMARY KEY`, `value jsonb NOT NULL` — and
31
+ * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`
32
+ * extend it. The table name defaults to `"xtandard_permissions_kv"`.
33
+ */
34
+ function pgPermissionsTable(name = "xtandard_permissions_kv", opts) {
35
+ return pgKvTable(name, {
36
+ keyCollation: "C",
37
+ ...opts
38
+ });
39
+ }
40
+ //#endregion
41
+ export { pgPermissionsTable };
42
+
43
+ //# sourceMappingURL=entry-drizzle-pg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-drizzle-pg.mjs","names":[],"sources":["../src/drizzle/pg.ts"],"sourcesContent":["/**\n * `@xtandard/permissions/drizzle/pg` — the Drizzle table factory for the\n * permissions KV store on Postgres.\n *\n * Schema-only (imports just `drizzle-orm/pg-core` through the kit, never the\n * engine), so it is safe to use inside a Drizzle schema file. Adding the table\n * to your schema brings it into your normal `drizzle-kit` generate/migrate flow\n * instead of an adapter-side `CREATE TABLE`. The key column is `text COLLATE\n * \"C\"` so ordering and `LIKE` prefixes are bytewise and case-sensitive whatever\n * the database default collation.\n *\n * @example\n * ```ts\n * // schema.ts\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n * export const permissionsKv = pgPermissionsTable();\n *\n * // then: createDrizzleStorage({ db, table: permissionsKv })\n * ```\n *\n * The table is `pgKvTable` from `@xtandard/kit/drizzle/pg`, with the\n * permissions name and `COLLATE \"C\"` key passed explicitly.\n *\n * @module\n */\n\nimport { pgKvTable, type PgKvTableOptions } from \"@xtandard/kit/drizzle/pg\";\nimport type { DrizzleKvTable } from \"./table.ts\";\n\nexport type { DrizzleKvTable } from \"./table.ts\";\n\n/**\n * Options for {@link pgPermissionsTable}: `schema`, `extraColumns`,\n * `extraIndexes`, and `keyCollation` (default `\"C\"`; `null` declares a plain\n * `text` key).\n */\nexport type PgPermissionsTableOptions = PgKvTableOptions;\n\n/**\n * Build the Drizzle `pgTable` for the permissions KV store. Base columns are\n * fixed — `key text COLLATE \"C\" PRIMARY KEY`, `value jsonb NOT NULL` — and\n * required by `createDrizzleStorage`; `schema`/`extraColumns`/`extraIndexes`\n * extend it. The table name defaults to `\"xtandard_permissions_kv\"`.\n */\nexport function pgPermissionsTable(\n name = \"xtandard_permissions_kv\",\n opts?: PgPermissionsTableOptions,\n): DrizzleKvTable {\n return pgKvTable(name, { keyCollation: \"C\", ...opts });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,mBACd,OAAO,2BACP,MACgB;CAChB,OAAO,UAAU,MAAM;EAAE,cAAc;EAAK,GAAG;CAAK,CAAC;AACvD"}
@@ -0,0 +1,34 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _xtandard_kit_drizzle_sqlite = require("@xtandard/kit/drizzle/sqlite");
3
+ //#region src/drizzle/sqlite.ts
4
+ /**
5
+ * `@xtandard/permissions/drizzle/sqlite` — the SQLite Drizzle table factory for
6
+ * the permissions KV store. Schema-only (imports just `drizzle-orm/sqlite-core`
7
+ * through the kit).
8
+ *
9
+ * Keys are `text PRIMARY KEY` with SQLite's default `BINARY` collation
10
+ * (case-sensitive); the adapters match prefixes with `GLOB`, never the
11
+ * case-folding `LIKE`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { sqlitePermissionsTable } from "@xtandard/permissions/drizzle/sqlite";
16
+ * export const permissionsKv = sqlitePermissionsTable();
17
+ * ```
18
+ *
19
+ * The table is `sqliteKvTable` from `@xtandard/kit/drizzle/sqlite`.
20
+ *
21
+ * @module
22
+ */
23
+ /**
24
+ * Build the SQLite `sqliteTable` for the permissions KV store: `key text
25
+ * PRIMARY KEY`, `value text NOT NULL` (JSON mode). The table name defaults to
26
+ * `"xtandard_permissions_kv"`.
27
+ */
28
+ function sqlitePermissionsTable(name = "xtandard_permissions_kv", opts) {
29
+ return (0, _xtandard_kit_drizzle_sqlite.sqliteKvTable)(name, opts);
30
+ }
31
+ //#endregion
32
+ exports.sqlitePermissionsTable = sqlitePermissionsTable;
33
+
34
+ //# sourceMappingURL=entry-drizzle-sqlite.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-drizzle-sqlite.cjs","names":[],"sources":["../src/drizzle/sqlite.ts"],"sourcesContent":["/**\n * `@xtandard/permissions/drizzle/sqlite` — the SQLite Drizzle table factory for\n * the permissions KV store. Schema-only (imports just `drizzle-orm/sqlite-core`\n * through the kit).\n *\n * Keys are `text PRIMARY KEY` with SQLite's default `BINARY` collation\n * (case-sensitive); the adapters match prefixes with `GLOB`, never the\n * case-folding `LIKE`.\n *\n * @example\n * ```ts\n * import { sqlitePermissionsTable } from \"@xtandard/permissions/drizzle/sqlite\";\n * export const permissionsKv = sqlitePermissionsTable();\n * ```\n *\n * The table is `sqliteKvTable` from `@xtandard/kit/drizzle/sqlite`.\n *\n * @module\n */\n\nimport { sqliteKvTable, type SqliteKvTableOptions } from \"@xtandard/kit/drizzle/sqlite\";\nimport type { DrizzleKvTable } from \"./table.ts\";\n\nexport type { DrizzleKvTable } from \"./table.ts\";\n\n/** Options for {@link sqlitePermissionsTable}: `extraColumns` and `extraIndexes`. */\nexport type SqlitePermissionsTableOptions = SqliteKvTableOptions;\n\n/**\n * Build the SQLite `sqliteTable` for the permissions KV store: `key text\n * PRIMARY KEY`, `value text NOT NULL` (JSON mode). The table name defaults to\n * `\"xtandard_permissions_kv\"`.\n */\nexport function sqlitePermissionsTable(\n name = \"xtandard_permissions_kv\",\n opts?: SqlitePermissionsTableOptions,\n): DrizzleKvTable {\n return sqliteKvTable(name, opts);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,uBACd,OAAO,2BACP,MACgB;CAChB,QAAA,GAAA,6BAAA,eAAqB,MAAM,IAAI;AACjC"}
@@ -0,0 +1,15 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.cjs";
2
+ import { SqliteKvTableOptions } from "@xtandard/kit/drizzle/sqlite";
3
+
4
+ //#region src/drizzle/sqlite.d.ts
5
+ /** Options for {@link sqlitePermissionsTable}: `extraColumns` and `extraIndexes`. */
6
+ type SqlitePermissionsTableOptions = SqliteKvTableOptions;
7
+ /**
8
+ * Build the SQLite `sqliteTable` for the permissions KV store: `key text
9
+ * PRIMARY KEY`, `value text NOT NULL` (JSON mode). The table name defaults to
10
+ * `"xtandard_permissions_kv"`.
11
+ */
12
+ declare function sqlitePermissionsTable(name?: string, opts?: SqlitePermissionsTableOptions): DrizzleKvTable;
13
+ //#endregion
14
+ export { type DrizzleKvTable, SqlitePermissionsTableOptions, sqlitePermissionsTable };
15
+ //# sourceMappingURL=entry-drizzle-sqlite.d.cts.map
@@ -0,0 +1,15 @@
1
+ import { t as DrizzleKvTable } from "./table-DA98mVVT.mjs";
2
+ import { SqliteKvTableOptions } from "@xtandard/kit/drizzle/sqlite";
3
+
4
+ //#region src/drizzle/sqlite.d.ts
5
+ /** Options for {@link sqlitePermissionsTable}: `extraColumns` and `extraIndexes`. */
6
+ type SqlitePermissionsTableOptions = SqliteKvTableOptions;
7
+ /**
8
+ * Build the SQLite `sqliteTable` for the permissions KV store: `key text
9
+ * PRIMARY KEY`, `value text NOT NULL` (JSON mode). The table name defaults to
10
+ * `"xtandard_permissions_kv"`.
11
+ */
12
+ declare function sqlitePermissionsTable(name?: string, opts?: SqlitePermissionsTableOptions): DrizzleKvTable;
13
+ //#endregion
14
+ export { type DrizzleKvTable, SqlitePermissionsTableOptions, sqlitePermissionsTable };
15
+ //# sourceMappingURL=entry-drizzle-sqlite.d.mts.map