permdock 0.1.0 → 0.3.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 (350) hide show
  1. package/README.md +106 -47
  2. package/dist/a2a/index.d.ts +7 -16
  3. package/dist/a2a/index.js +59 -98
  4. package/dist/adapter-context-mlWsVGGg.js +23 -0
  5. package/dist/ai-sdk/index.d.ts +37 -16
  6. package/dist/ai-sdk/index.js +30 -13
  7. package/dist/approvals/index.d.ts +3 -3
  8. package/dist/approvals/index.js +5 -4
  9. package/dist/{approvals-DaxY-Bdg.js → approvals-DbYAuNkG.js} +17 -11
  10. package/dist/approvers-DT4AVyIg.js +52 -0
  11. package/dist/{arazzo-CTeVuXr5.js → arazzo-BAgw9ap6.js} +2 -2
  12. package/dist/{arazzo-aoTkqYsJ.js → arazzo-CKwwqFWz.js} +2 -2
  13. package/dist/authzen/index.d.ts +4 -13
  14. package/dist/authzen/index.js +16 -50
  15. package/dist/better-auth/index.d.ts +20 -3
  16. package/dist/better-auth/index.js +27 -7
  17. package/dist/better-supabase/index.d.ts +223 -0
  18. package/dist/better-supabase/index.js +648 -0
  19. package/dist/bind-C_ob3LKa.d.ts +25 -0
  20. package/dist/bind-CuzGytRf.js +97 -0
  21. package/dist/boundary-BM8a_P6E.js +13 -0
  22. package/dist/boundary-BmHxVH1J.d.ts +15 -0
  23. package/dist/canonical-json-DemiK4Vp.js +26 -0
  24. package/dist/{capability-BDG_nkxt.d.ts → capability-2kYTMWDv.d.ts} +2 -2
  25. package/dist/{capability-B68OFnZx.js → capability-4qPdO9gk.js} +7 -5
  26. package/dist/catalog/index.d.ts +1 -1
  27. package/dist/catalog/index.js +1 -1
  28. package/dist/catalog-CRW5Mx_B.js +2 -0
  29. package/dist/{catalog-H-vFGwWK.js → catalog-DWF5cYqB.js} +4 -4
  30. package/dist/{catalog-B0E6bggc.js → catalog-dFZdWCGN.js} +2 -2
  31. package/dist/{catalog-doc-BSo_Q_-6.js → catalog-doc-DdGm82XT.js} +20 -32
  32. package/dist/claude-agent/index.d.ts +5 -14
  33. package/dist/claude-agent/index.js +4 -10
  34. package/dist/clerk/index.d.ts +12 -3
  35. package/dist/clerk/index.js +26 -5
  36. package/dist/cli/bin.js +1 -1
  37. package/dist/cli/index.d.ts +3 -3
  38. package/dist/cli/index.js +2 -2
  39. package/dist/clients-C7zLFuWT.d.ts +12 -0
  40. package/dist/clients-DjU5ABMy.js +23 -0
  41. package/dist/cloud/index.d.ts +4 -5
  42. package/dist/cloud/index.js +20 -6
  43. package/dist/{cloud-BNQTrmrr.js → cloud-CB_ELYuX.js} +2 -2
  44. package/dist/{cloud-Cuxr6Czw.js → cloud-DWLXO2af.js} +7 -6
  45. package/dist/collect-DClJsheJ.js +83 -0
  46. package/dist/{collect-O-tOtbnk.js → collect-DSTE3ml9.js} +194 -42
  47. package/dist/collect-DSWOk19R.js +2 -0
  48. package/dist/{commands-BMh_Etm2.js → commands-DSxCqG9A.js} +16 -12
  49. package/dist/compile/index.d.ts +3 -0
  50. package/dist/compile/index.js +2 -0
  51. package/dist/{compile-D22iwvuV.js → compile-Ba4blROR.js} +85 -30
  52. package/dist/compile-BkRyBDBw.d.ts +94 -0
  53. package/dist/config-BJiM-xAm.js +157 -0
  54. package/dist/config-Dnszbv-6.js +36 -0
  55. package/dist/config-report-DMvWKUxL.js +44 -0
  56. package/dist/{connection-JvqwHODC.js → connection-CU8MQxRi.js} +1 -1
  57. package/dist/{context-CKEAabd7.js → context-Bcy85rGi.js} +36 -27
  58. package/dist/convex/index.d.ts +9 -4
  59. package/dist/convex/index.js +14 -4
  60. package/dist/create-B1d519XK.d.ts +245 -0
  61. package/dist/create-CMwIl-w2.js +253 -0
  62. package/dist/{credential-B_rkUNlY.js → credential-8P81ff4u.js} +26 -46
  63. package/dist/delegation-D8pUEuce.js +103 -0
  64. package/dist/{describe-Bt1YD5uS.js → describe-B_gVZEVi.js} +10 -15
  65. package/dist/{describe-DernyItf.d.ts → describe-DMYiCjJV.d.ts} +9 -10
  66. package/dist/{diff-x5Il8LVa.js → diff-2VaeChzX.js} +44 -11
  67. package/dist/{diff-BUzf5Poi.js → diff-DBIhz_f2.js} +2 -2
  68. package/dist/{doctor-Bqo6FwUa.js → doctor-BwCAMLx_.js} +2 -2
  69. package/dist/doctor-collect-CHk6XWOA.js +665 -0
  70. package/dist/doctor-igIiM_Hl.js +1194 -0
  71. package/dist/drizzle/index.d.ts +4 -3
  72. package/dist/drizzle/index.js +3 -3
  73. package/dist/elysia/index.d.ts +6 -28
  74. package/dist/elysia/index.js +16 -60
  75. package/dist/{errors-DSMnAVNa.js → errors-CWfoNg9N.js} +8 -4
  76. package/dist/{errors-Iy71s7Oj.js → errors-Cz5zn0mW.js} +17 -71
  77. package/dist/{errors-DbZ1YOnb.d.ts → errors-DPdqI50v.d.ts} +8 -21
  78. package/dist/{errors-m3u9TmDu.js → errors-DRnGZHzF.js} +4 -1
  79. package/dist/evaluation-items-CfCCejQd.js +40 -0
  80. package/dist/{evaluations-DsAU9ppl.js → evaluations-tz6D9A2G.js} +28 -46
  81. package/dist/eve/index.d.ts +6 -15
  82. package/dist/eve/index.js +7 -12
  83. package/dist/expiry-BoBJ8Tvc.js +7 -0
  84. package/dist/express/index.d.ts +6 -29
  85. package/dist/express/index.js +28 -58
  86. package/dist/fastify/index.d.ts +6 -29
  87. package/dist/fastify/index.js +16 -65
  88. package/dist/fields-BMl1RxoX.js +26 -0
  89. package/dist/{files-B_wAGYmt.js → files-DWUN9PzI.js} +5 -1
  90. package/dist/{fixtures-Cvaw0gDG.js → fixtures-ht28Cplr.js} +5 -2
  91. package/dist/{freeze-y1_jQL4v.js → freeze-CrU8nQeX.js} +31 -2
  92. package/dist/{from-snapshot-BMGnhmgv.js → from-snapshot-CTLijvdm.js} +66 -48
  93. package/dist/{grantee-Bv04_Vzf.js → grantee-Cv5Sogfv.js} +88 -7
  94. package/dist/graph-sql-B-dsAT6j.d.ts +29 -0
  95. package/dist/{headers-B5RRv3Xm.js → headers-BZSDieNT.js} +1 -1
  96. package/dist/{headers-C8SHQccD.d.ts → headers-Cf-zWvsO.d.ts} +1 -1
  97. package/dist/helpers-H_KARDVC.js +421 -0
  98. package/dist/hono/index.d.ts +6 -28
  99. package/dist/hono/index.js +11 -43
  100. package/dist/{hosted-BwKQ1BTA.js → hosted-DJQw46hn.js} +6 -5
  101. package/dist/{http-GgVApX1k.js → http-BIhmLfCc.js} +4 -20
  102. package/dist/http-SO7qGttf.js +44 -0
  103. package/dist/ids-DC4V4CFu.js +18 -0
  104. package/dist/index-0nNqHspG.d.ts +6 -0
  105. package/dist/{index-xIxJLwOQ.d.ts → index-BNc7Wer_.d.ts} +75 -7
  106. package/dist/{index-CltcQ4Bf.d.ts → index-C7Tw7MaW.d.ts} +68 -5
  107. package/dist/{index-LF_hS-yn.d.ts → index-C8z4RjQV.d.ts} +1 -1
  108. package/dist/index.d.ts +14 -9
  109. package/dist/index.js +22 -17
  110. package/dist/instance-options-Dhhcnm3y.js +22 -0
  111. package/dist/instance-options-jARdwfPN.d.ts +11 -0
  112. package/dist/{parse-DPfIvFMU.js → json-schema-BsAflUGW.js} +28 -57
  113. package/dist/jwt/index.d.ts +10 -6
  114. package/dist/jwt/index.js +32 -13
  115. package/dist/kernel-_RRHmnMY.js +208 -0
  116. package/dist/kysely/index.d.ts +4 -3
  117. package/dist/kysely/index.js +3 -3
  118. package/dist/live-options-H2eG8dfJ.js +60 -0
  119. package/dist/{load-BZ24CpZP.js → load-DhWEB9P1.js} +16 -10
  120. package/dist/load-DwJUafYN.js +2 -0
  121. package/dist/manifest-iaoBXHKc.js +783 -0
  122. package/dist/manifest-uDS9y5de.d.ts +206 -0
  123. package/dist/{map-DowSO96j.js → map-AcxK9o_D.js} +4 -15
  124. package/dist/{map-claims-B_6I1Rn-.js → map-claims-Z4QZOiFF.js} +13 -4
  125. package/dist/map-error-pgUWNNtG.js +23 -0
  126. package/dist/may-use-DndQ5tQ-.js +77 -0
  127. package/dist/mcp/index.d.ts +54 -22
  128. package/dist/mcp/index.js +218 -178
  129. package/dist/nest/index.d.ts +26 -31
  130. package/dist/nest/index.js +75 -84
  131. package/dist/next/client.d.ts +7 -8
  132. package/dist/next/client.js +11 -9
  133. package/dist/next/index.d.ts +30 -47
  134. package/dist/next/index.js +45 -60
  135. package/dist/next/plugin.d.ts +1 -1
  136. package/dist/next/plugin.js +32 -1
  137. package/dist/node/index.d.ts +9 -28
  138. package/dist/node/index.js +11 -43
  139. package/dist/openai/index.d.ts +6 -15
  140. package/dist/openai/index.js +7 -20
  141. package/dist/openapi/index.d.ts +87 -4
  142. package/dist/openapi/index.js +3 -3
  143. package/dist/{openapi-DcqM8nU7.js → openapi-BqRBvAng.js} +237 -5
  144. package/dist/{openapi-DWD0Uc_4.js → openapi-CqqEbHsL.js} +5 -5
  145. package/dist/{openapi-import-BWRUNNeW.js → openapi-import-cmwetbzw.js} +1 -1
  146. package/dist/{openapi-CwePaF7C.js → openapi-l0xYHkcv.js} +3 -3
  147. package/dist/{openapi-schema-D8j_T9tO.js → openapi-schema--ARjyfQr.js} +2 -2
  148. package/dist/orpc/index.d.ts +15 -28
  149. package/dist/orpc/index.js +74 -117
  150. package/dist/otel/index.d.ts +2 -2
  151. package/dist/parse-BuyjxhZV.js +53 -0
  152. package/dist/parse-local-manifest-BrMozJCo.js +36 -0
  153. package/dist/parse-local-manifest-JLnaBH0S.d.ts +10 -0
  154. package/dist/pdp/index.d.ts +2 -2
  155. package/dist/pdp/index.js +14 -127
  156. package/dist/{permdock-yoZ7EjxX.js → permdock-CbgvLnuo.js} +672 -149
  157. package/dist/{permissions-B8vCg_bI.d.ts → permissions-CDgvKG5L.d.ts} +2 -2
  158. package/dist/{permissions-DC7GROPA.js → permissions-DVoF6dMt.js} +77 -15
  159. package/dist/{permissions-B4apnahQ.d.ts → permissions-DttnqqxC.d.ts} +34 -5
  160. package/dist/{permissions-CofRqesP.js → permissions-RJrovw98.js} +3 -3
  161. package/dist/{pins-CqE1jZuF.js → pins-8ILTftC9.js} +2 -2
  162. package/dist/{policy-Cq2fB8Q5.d.ts → policy-D2W7uv19.d.ts} +2 -2
  163. package/dist/{policy-CInmNGkM.d.ts → policy-IB6yxpC3.d.ts} +351 -42
  164. package/dist/{policy-ANp36PnI.js → policy-xyWg7QdR.js} +173 -22
  165. package/dist/powersync-BylawD_U.js +540 -0
  166. package/dist/powersync-DliZK_-y.js +62 -0
  167. package/dist/powersync-e_AZrKbg.js +2 -0
  168. package/dist/prisma/index.d.ts +3 -2
  169. package/dist/prisma/index.js +45 -20
  170. package/dist/{problem-Cgp9-KZA.js → problem-B43ztKIm.js} +74 -109
  171. package/dist/problem-details-DX075l9V.d.ts +7 -0
  172. package/dist/problem-details-_AMOYz-w.js +144 -0
  173. package/dist/{protected-BuPAycJT.d.ts → protected-BdnIEFkY.d.ts} +5 -4
  174. package/dist/protected-utU-SLuy.js +100 -0
  175. package/dist/protected-xAr24FEC.d.ts +40 -0
  176. package/dist/provider-CSQd7m92.js +52 -0
  177. package/dist/{provider-wTAUda2v.d.ts → provider-DZY281jO.d.ts} +1 -1
  178. package/dist/provider-store-Cfbvo4DE.js +43 -0
  179. package/dist/react/index.d.ts +7 -5
  180. package/dist/react/index.js +5 -4
  181. package/dist/react/provider-client.d.ts +1 -1
  182. package/dist/react/provider-client.js +1 -1
  183. package/dist/react-native/index.d.ts +166 -10
  184. package/dist/react-native/index.js +607 -85
  185. package/dist/{refs-ChLSxbST.js → refs-KYb4ntaz.js} +4 -3
  186. package/dist/{relations-r4soIFZB.js → relations-cjOL01hZ.js} +110 -31
  187. package/dist/replay-BsOyTrdV.js +28 -0
  188. package/dist/replay-CYyiLiwO.d.ts +5 -0
  189. package/dist/resource-ref-CaS9yVPi.js +20 -0
  190. package/dist/revocations-Bhr0aMIC.js +27 -0
  191. package/dist/{rls-BOFU3chG.js → rls-B4ur8nKQ.js} +8 -3
  192. package/dist/rls-DQtdgTHB.js +2521 -0
  193. package/dist/rls-fields-74oZPXWL.js +3582 -0
  194. package/dist/{rls-graph-DxQ39PJj.js → rls-graph-CHwx0V8q.js} +100 -36
  195. package/dist/{rls-import-CXV6LBlS.js → rls-import-BTFVk3jH.js} +7 -6
  196. package/dist/{rls-migrate-DrFPbf8p.js → rls-migrate-CN4TlJTO.js} +6 -5
  197. package/dist/rls-ownership-RuFqaqGz.js +843 -0
  198. package/dist/rls-shared-Cewd_-zI.js +495 -0
  199. package/dist/rls-verify-CVQTHTh5.js +746 -0
  200. package/dist/{row-check-BajTgQZ-.d.ts → row-check-Dt35czLy.d.ts} +12 -15
  201. package/dist/row-conditions-h2HythXQ.js +27 -0
  202. package/dist/rpc-DL9Sqvb1.js +89 -0
  203. package/dist/{run-CJ6UvS3a.js → run-DKDbM4Du.js} +31 -12
  204. package/dist/runtime-CB8gQFvS.js +11 -0
  205. package/dist/{saas-BRrZzJkM.js → saas-DhpJjnBA.js} +17 -7
  206. package/dist/{schema-P8yoma__.js → schema-D3MnDMxa.js} +8 -4
  207. package/dist/scim/index.d.ts +1 -1
  208. package/dist/scim/index.js +1 -1
  209. package/dist/{scim-9NFa0XVZ.js → scim-BFGBBAqR.js} +1 -1
  210. package/dist/{scopes-cKVp_WTw.js → scopes-CVdPrWN-.js} +35 -8
  211. package/dist/server/index.d.ts +22 -11
  212. package/dist/server/index.js +11 -8
  213. package/dist/{credentials-BgRX3WEg.js → server-DlZ28Oz5.js} +1 -1
  214. package/dist/shared-DRu8VFVM.js +123 -0
  215. package/dist/{sink-Cfr9-7YC.d.ts → sink-B1fZzIMf.d.ts} +1 -1
  216. package/dist/skills-Biq5uup3.js +192 -0
  217. package/dist/{skills-C_lpV4Jx.js → skills-Bx-U0irG.js} +10 -4
  218. package/dist/{snapshot-DE8dE_hz.js → snapshot-Enxd0n-s.js} +138 -214
  219. package/dist/snapshot-cache-B-LxUahj.d.ts +45 -0
  220. package/dist/snapshot-cache-D6jLelln.js +44 -0
  221. package/dist/solid/index.d.ts +39 -9
  222. package/dist/solid/index.js +76 -85
  223. package/dist/sources-4p0-4xQm.js +545 -0
  224. package/dist/sources-BdOYLw9j.d.ts +192 -0
  225. package/dist/{sql-Bll1d7y0.js → sql-xdg5f4Fi.js} +6 -1
  226. package/dist/{src-CTNT-PBW.js → src-BDwEZWrZ.js} +149 -11
  227. package/dist/ssf/index.d.ts +3 -2
  228. package/dist/ssf/index.js +3 -29
  229. package/dist/store-DMAWwAJV.js +371 -0
  230. package/dist/{store-Bq90395i.d.ts → store-jOBYpiXC.d.ts} +13 -4
  231. package/dist/store-options-ByhZq1jV.js +716 -0
  232. package/dist/{stores-CkG2HrSg.js → stores-BT2pSCub.js} +10 -63
  233. package/dist/{stores-CvOnu_2T.d.ts → stores-C0IMQrGI.d.ts} +20 -9
  234. package/dist/{stream-BhMfZOwr.d.ts → stream-D1RXubw2.d.ts} +2 -2
  235. package/dist/{stream-Q_xlB6Ko.js → stream-DDpvynSB.js} +16 -2
  236. package/dist/subject-settings-BwBmCdTR.js +128 -0
  237. package/dist/supabase/index.d.ts +133 -6
  238. package/dist/supabase/index.js +4 -3
  239. package/dist/supabase/middleware.d.ts +32 -27
  240. package/dist/supabase/middleware.js +56 -22
  241. package/dist/{supabase-D8UlBA7Z.js → supabase-Boqb9a_Y.js} +3 -3
  242. package/dist/{supabase-DTxGtYdi.js → supabase-C0qESOa-.js} +347 -367
  243. package/dist/supabase-config-BpPXt3x1.js +472 -0
  244. package/dist/supabase-hook-6sYLXg_u.js +2 -0
  245. package/dist/{supabase-hook-D_OqGb_V.js → supabase-hook-CSLQ4zJ3.js} +1037 -705
  246. package/dist/supautils-Cn4R4cJ4.js +91 -0
  247. package/dist/svelte/PermissionBoundary.svelte +37 -0
  248. package/dist/svelte/Protected.svelte +8 -2
  249. package/dist/svelte/index.d.ts +9 -6
  250. package/dist/svelte/index.js +61 -7
  251. package/dist/svelte/runtime.d.ts +4 -3
  252. package/dist/svelte/runtime.js +4 -3
  253. package/dist/svelte/source.d.ts +9 -6
  254. package/dist/svelte/source.js +7 -4
  255. package/dist/terminal/index.d.ts +6 -14
  256. package/dist/terminal/index.js +44 -32
  257. package/dist/testing/index.d.ts +105 -16
  258. package/dist/testing/index.js +504 -40
  259. package/dist/testing/saas/index.d.ts +4 -4
  260. package/dist/testing/saas/index.js +2 -2
  261. package/dist/testing/saas/permissions.d.ts +1 -1
  262. package/dist/testing/saas/permissions.js +1 -1
  263. package/dist/token-CIWxJOCh.js +50 -0
  264. package/dist/trpc/index.d.ts +7 -26
  265. package/dist/trpc/index.js +17 -100
  266. package/dist/types-BnIEz1sU.d.ts +48 -0
  267. package/dist/{types-CxquUByI.d.ts → types-Bvc4oWT6.d.ts} +1 -1
  268. package/dist/{sources-DOpW5Ila.d.ts → types-C97IskBw.d.ts} +86 -127
  269. package/dist/types-CKNSyIf_.d.ts +52 -0
  270. package/dist/types-Cq_H8N_X.d.ts +197 -0
  271. package/dist/{types-D6Z6-rKJ.d.ts → types-DbjRN55U.d.ts} +273 -22
  272. package/dist/{types-BBK-exvJ.d.ts → types-Dnemwd77.d.ts} +7 -1
  273. package/dist/{types-BvBk1wgn.d.ts → types-DxiCGmmd.d.ts} +5 -3
  274. package/dist/{types-B9dmiiab.d.ts → types-QCuYJh4q.d.ts} +1 -1
  275. package/dist/{types-B8w5PFtS.d.ts → types-aqOHTHcp.d.ts} +17 -1
  276. package/dist/unplugin/index.d.ts +1 -1
  277. package/dist/unplugin/index.js +10 -9
  278. package/dist/usage-DorAJiU_.js +2 -0
  279. package/dist/{usage-1ozMubLY.js → usage-GTixvDDU.js} +2 -2
  280. package/dist/{usage-CUnK6Ou9.js → usage-ItS7nLcl.js} +225 -62
  281. package/dist/validation-error-Ba264OaJ.d.ts +26 -0
  282. package/dist/validation-error-CnjZ4t92.js +33 -0
  283. package/dist/{validity-D0uRmJKJ.js → validity-uOp8UpYn.js} +57 -36
  284. package/dist/{verifier-B90agnhl.js → verifier-BxBo6I44.js} +10 -5
  285. package/dist/version-BvacVTZR.js +17 -0
  286. package/dist/views-Soe7bGSC.js +95 -0
  287. package/dist/{vocabulary-Dk0fs-Jk.d.ts → vocabulary-DA8a8zif.d.ts} +1 -1
  288. package/dist/vue/index.d.ts +35 -13
  289. package/dist/vue/index.js +86 -93
  290. package/dist/watch-BwxLTYMZ.js +2 -0
  291. package/dist/watch-DVBJ9cBq.js +128 -0
  292. package/dist/webmcp/index.d.ts +2 -2
  293. package/dist/webmcp/index.js +7 -13
  294. package/package.json +62 -36
  295. package/schemas/approval-request-v1.json +175 -0
  296. package/schemas/catalog-v1.json +29 -1
  297. package/schemas/supabase-claims-v1.json +6 -1
  298. package/schemas/supabase-manifest-v1.json +150 -6
  299. package/skills/permdock/SKILL.md +7 -7
  300. package/skills/permdock-agents/SKILL.md +5 -5
  301. package/skills/permdock-agents/references/runtimes.md +12 -10
  302. package/skills/permdock-approvals/SKILL.md +4 -4
  303. package/skills/permdock-approvals/references/stores-and-resume.md +15 -4
  304. package/skills/permdock-audit/SKILL.md +3 -3
  305. package/skills/permdock-credentials/SKILL.md +4 -4
  306. package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
  307. package/skills/permdock-data/SKILL.md +4 -4
  308. package/skills/permdock-data/references/queries-and-rls.md +14 -6
  309. package/skills/permdock-data/references/relationships.md +5 -3
  310. package/skills/permdock-tenancy/SKILL.md +9 -6
  311. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +14 -8
  312. package/skills/permdock-wire/SKILL.md +4 -4
  313. package/skills/permdock-wire/references/adapters.md +42 -30
  314. package/skills/permdock-wire/references/policy-options.md +5 -3
  315. package/dist/approvers-aH0PJkmf.js +0 -20
  316. package/dist/catalog-idsHc0vo.js +0 -2
  317. package/dist/collect-B7_TIfmg.js +0 -49
  318. package/dist/collect-fRPAQIWb.js +0 -2
  319. package/dist/compile-CQbvyIBr.d.ts +0 -30
  320. package/dist/config-BPYmjTOp.js +0 -26
  321. package/dist/context-gtAwAILx.js +0 -6
  322. package/dist/create-BKF3dgFk.d.ts +0 -162
  323. package/dist/create-CSkhDU9T.js +0 -222
  324. package/dist/doctor-BGle8Gqi.js +0 -1314
  325. package/dist/helpers-DnSOrhB9.js +0 -682
  326. package/dist/index-fG6NSXlc.d.ts +0 -9
  327. package/dist/kernel-YOGCWNLf.js +0 -211
  328. package/dist/load-QOOm1z70.js +0 -2
  329. package/dist/manifest-DDQbC6K0.d.ts +0 -118
  330. package/dist/map-error-RJ3ZsUyA.js +0 -16
  331. package/dist/may-use-CnFEjVEp.js +0 -37
  332. package/dist/pg-4GJWDUxG.js +0 -953
  333. package/dist/plugin-4gr7IxFJ.js +0 -65
  334. package/dist/protected-B4K3BKoX.js +0 -138
  335. package/dist/protected-wY7nXhY9.d.ts +0 -23
  336. package/dist/provider-_wx46HpB.js +0 -48
  337. package/dist/rls-CJVja9Ww.js +0 -2119
  338. package/dist/rls-helpers-BxRuif0l.js +0 -1346
  339. package/dist/runtime-DP9ttFh1.js +0 -27
  340. package/dist/skills-Dx3QLnMY.js +0 -110
  341. package/dist/source-DoBBYJi2.js +0 -6
  342. package/dist/sources-DVHM3Mwq.js +0 -284
  343. package/dist/store-C6hFW6ta.js +0 -508
  344. package/dist/subject-settings-xt7V845g.js +0 -82
  345. package/dist/supabase-hook-DW-xP4hU.js +0 -2
  346. package/dist/types-DbWdEfcm.d.ts +0 -87
  347. package/dist/types-bva3i4Gf.d.ts +0 -98
  348. package/dist/types-i4BAOvdb.d.ts +0 -97
  349. package/dist/usage-PyEor6GA.js +0 -2
  350. package/dist/version-CnSh33Fj.js +0 -16
@@ -0,0 +1,52 @@
1
+ import { Cr as Actor, D as PolicyVocabulary, Nr as Principal, Yn as Decision, kr as Delegation, ln as PermDock } from "./policy-IB6yxpC3.js";
2
+ import { f as Permission } from "./permissions-DttnqqxC.js";
3
+ //#region src/client/types.d.ts
4
+ type ClientStatus = "ready" | "pending" | "stale" | "server-only";
5
+ type PermissionState = {
6
+ readonly allowed: boolean;
7
+ readonly status: ClientStatus;
8
+ readonly decision: Decision;
9
+ };
10
+ type PermissionSet = {
11
+ readonly granted: readonly Permission[];
12
+ get(permission: Permission): PermissionState | undefined;
13
+ };
14
+ type ClientPermDock<V extends PolicyVocabulary = PolicyVocabulary> = PermDock<V> & {
15
+ status(permission?: Permission, data?: unknown): ClientStatus;
16
+ invalidate(ref: Permission | {
17
+ readonly [key: string]: unknown;
18
+ }): void;
19
+ refresh(options?: {
20
+ readonly tenant?: string;
21
+ }): Promise<void>;
22
+ clear(): void;
23
+ subscribe(listener: () => void): () => void;
24
+ };
25
+ type ApprovalState = "not-needed" | "required" | "pending" | "approved" | "rejected" | "expired";
26
+ type ApprovalHandle = {
27
+ readonly state: ApprovalState;
28
+ readonly token: string | undefined;
29
+ readonly request: (note?: string) => Promise<void>;
30
+ };
31
+ type SubjectView = {
32
+ readonly principal: Principal | null;
33
+ readonly actor: Actor | undefined;
34
+ readonly delegation: Delegation | undefined;
35
+ readonly expiresAt: number | undefined;
36
+ readonly simulated: boolean;
37
+ };
38
+ type TenantView = {
39
+ readonly tenant: string | null;
40
+ readonly tenants: readonly string[];
41
+ readonly switchTo: (id: string) => Promise<void>;
42
+ readonly status: ClientStatus;
43
+ };
44
+ type FilterResult<T> = readonly T[] & {
45
+ readonly partial: boolean;
46
+ };
47
+ type UseRolesOptions = {
48
+ readonly tenant?: string;
49
+ readonly team?: string;
50
+ };
51
+ //#endregion
52
+ export { FilterResult as a, SubjectView as c, ClientStatus as i, TenantView as l, ApprovalState as n, PermissionSet as o, ClientPermDock as r, PermissionState as s, ApprovalHandle as t, UseRolesOptions as u };
@@ -0,0 +1,197 @@
1
+ import { Cr as Actor, Ft as TokenVerifier, Nr as Principal, Nt as TokenFailureCause, Pr as Subject, ct as JwtClaims, et as AuthEvent, gt as MembershipSource } from "./policy-IB6yxpC3.js";
2
+ import { f as ApprovalStore } from "./types-aqOHTHcp.js";
3
+ import { t as ClientNames } from "./clients-C7zLFuWT.js";
4
+ import { n as RevocationFeed } from "./revocations-Cy06JNx2.js";
5
+ import { StandardSchemaV1 } from "@standard-schema/spec";
6
+ //#region src/ssf/types.d.ts
7
+ type CaepEventName = "session-revoked" | "credential-change" | "assurance-level-change" | "token-claims-change" | "device-compliance-change";
8
+ type SetSubject = {
9
+ readonly format: string;
10
+ readonly [key: string]: unknown;
11
+ };
12
+ type SsfSubject = {
13
+ readonly id: string;
14
+ readonly session?: string;
15
+ readonly issuer?: string;
16
+ };
17
+ type SsfSubjectMapper = (setSubject: SetSubject, meta?: {
18
+ readonly session?: string;
19
+ readonly issuer?: string;
20
+ }) => string | SsfSubject | null | undefined | Promise<string | SsfSubject | null | undefined>;
21
+ type SsfEventInput = {
22
+ readonly subject: SsfSubject;
23
+ readonly event: Readonly<Record<string, unknown>>;
24
+ readonly event_timestamp?: number;
25
+ readonly jti: string;
26
+ readonly type: string;
27
+ };
28
+ type SsfEventHandler = (input: SsfEventInput) => void | Promise<void>;
29
+ type SsfOnEvent = { readonly [K in CaepEventName]?: SsfEventHandler; } & {
30
+ readonly "*"?: SsfEventHandler;
31
+ };
32
+ /**
33
+ * Keys are opaque strings namespaced by issuer. A store that implements both
34
+ * `claim` and `release` makes concurrent deliveries of one SET dispatch once;
35
+ * one with only `seen` and `remember` is checked and recorded non-atomically.
36
+ */
37
+ type ReplayStore = {
38
+ seen(key: string): boolean | Promise<boolean>;
39
+ remember(key: string, expiresAt?: number): void | Promise<void>;
40
+ /** Records `key` and returns `true` only if it was not already recorded. */
41
+ claim?(key: string, expiresAt?: number): boolean | Promise<boolean>;
42
+ /** Forgets a claimed `key` so a failed delivery can be retried. */
43
+ release?(key: string): void | Promise<void>;
44
+ };
45
+ type SsfAuditEvent = {
46
+ readonly type: string;
47
+ readonly subject?: SsfSubject;
48
+ readonly transmitter?: string;
49
+ readonly jti?: string;
50
+ readonly replayed?: true;
51
+ readonly cancelled?: number;
52
+ readonly unknown?: "event" | "subject";
53
+ readonly err?: string;
54
+ readonly cause?: TokenFailureCause;
55
+ };
56
+ type SsfEventListener = (event: SsfAuditEvent) => void;
57
+ type PollOptions = {
58
+ readonly endpoint: string;
59
+ readonly every?: number | string;
60
+ readonly token?: string;
61
+ readonly fetch?: typeof fetch;
62
+ readonly signal?: AbortSignal;
63
+ };
64
+ type PollHandle = {
65
+ readonly stop: () => void;
66
+ };
67
+ type PollResult = {
68
+ readonly acked: readonly string[];
69
+ };
70
+ type SsfPermDockOptions = {
71
+ readonly issuer?: string;
72
+ readonly audience: string | readonly string[];
73
+ readonly jwks?: JwtJwks | string;
74
+ readonly discovery?: DiscoveryInput;
75
+ readonly verifier?: TokenVerifier;
76
+ readonly subject: SsfSubjectMapper;
77
+ readonly onEvent?: SsfOnEvent;
78
+ readonly replay?: ReplayStore;
79
+ readonly approvals?: ApprovalStore;
80
+ /**
81
+ * Publishes `session-revoked` for a revoked session and `changed` for
82
+ * credential, assurance and claims changes, so open connections end or
83
+ * revalidate.
84
+ */
85
+ readonly revocations?: RevocationFeed;
86
+ readonly clockTolerance?: number;
87
+ };
88
+ type SsfReceiver = {
89
+ push(request: Request): Promise<Response>;
90
+ logout(request: Request): Promise<Response>;
91
+ poll(options: PollOptions): Promise<PollResult> | PollHandle;
92
+ on(event: "event", handler: SsfEventListener): () => void;
93
+ };
94
+ type SsfPermDock = {
95
+ readonly receiver: SsfReceiver;
96
+ };
97
+ //#endregion
98
+ //#region src/jwt/types.d.ts
99
+ type JwtAlgorithm = "ES256" | "PS256" | "Ed25519" | "RS256" | "HS256" | "EdDSA";
100
+ type JwtProfile = "fapi2";
101
+ type JsonWebKeySet = {
102
+ readonly keys: readonly Record<string, unknown>[];
103
+ };
104
+ type JwtJwks = URL | string | JsonWebKeySet | {
105
+ readonly secret: Uint8Array | string;
106
+ };
107
+ type DiscoveryInput = string | {
108
+ readonly issuer: string;
109
+ readonly metadata?: {
110
+ readonly issuer?: string;
111
+ readonly jwks_uri?: string;
112
+ };
113
+ };
114
+ type JwksCacheOptions = {
115
+ readonly minTtl?: number;
116
+ readonly maxTtl?: number;
117
+ readonly cooldown?: number;
118
+ /** Milliseconds a discovery or JWKS request may take before it counts as failed. Default 5000. */
119
+ readonly timeout?: number;
120
+ };
121
+ type JoseTokenVerifierOptions = {
122
+ readonly jwks?: JwtJwks;
123
+ readonly discovery?: DiscoveryInput;
124
+ readonly issuer?: string;
125
+ readonly algorithms?: readonly JwtAlgorithm[];
126
+ readonly typ?: string | readonly string[];
127
+ readonly audience?: string | readonly string[];
128
+ readonly clockTolerance?: number;
129
+ readonly decryptionKeys?: JsonWebKeySet | Record<string, unknown>;
130
+ readonly decryptionAlgorithms?: readonly string[];
131
+ readonly profile?: JwtProfile;
132
+ readonly jwksCache?: JwksCacheOptions;
133
+ readonly fetch?: typeof fetch;
134
+ };
135
+ type JoseTokenSignerOptions = {
136
+ readonly key: Record<string, unknown> | Uint8Array;
137
+ readonly alg: JwtAlgorithm;
138
+ readonly kid: string;
139
+ readonly issuer?: string;
140
+ };
141
+ type JwtClaimPaths = {
142
+ readonly id?: string;
143
+ readonly roles?: string;
144
+ readonly groups?: string;
145
+ readonly entitlements?: string;
146
+ readonly plans?: string;
147
+ readonly tenant?: string;
148
+ readonly memberships?: string;
149
+ readonly kind?: string;
150
+ readonly assurance?: string | {
151
+ readonly acr?: string;
152
+ readonly amr?: string;
153
+ readonly authTime?: string;
154
+ /** OpenID Connect for Identity Assurance; default `verified_claims`. */
155
+ readonly verified?: string;
156
+ };
157
+ readonly session?: string;
158
+ };
159
+ type JwtDelegationPaths = {
160
+ readonly scopes?: string;
161
+ readonly authorizationDetails?: string;
162
+ readonly access?: string;
163
+ };
164
+ type JwtSubjectOptions = JoseTokenVerifierOptions & {
165
+ readonly accept?: "access-token" | "id-token";
166
+ readonly claims?: JwtClaimPaths;
167
+ readonly groupRoles?: Readonly<Record<string, readonly string[]>>;
168
+ readonly schema?: StandardSchemaV1;
169
+ readonly delegation?: JwtDelegationPaths;
170
+ readonly actor?: {
171
+ readonly from?: "act";
172
+ readonly kind?: string;
173
+ /** Names for client ids (`ClientNames`): the actor gets `client` set to the name of `act.sub`. */
174
+ readonly clients?: ClientNames;
175
+ } | ((claims: JwtClaims) => Actor | undefined);
176
+ readonly sender?: "none" | "dpop" | "mtls";
177
+ /** With `sender: "dpop"`, rejects a proof `jti` already used by the same key within 60 seconds. */
178
+ readonly replay?: ReplayStore;
179
+ readonly memberships?: MembershipSource;
180
+ readonly verifier?: TokenVerifier;
181
+ readonly certificateThumbprint?: string;
182
+ readonly onAuth?: (event: AuthEvent) => void;
183
+ readonly requestId?: string;
184
+ };
185
+ type JwtPrincipal = Principal & {
186
+ readonly issuer?: string;
187
+ readonly claims?: Readonly<Record<string, unknown>>;
188
+ };
189
+ type DpopProofResult = {
190
+ readonly ok: true;
191
+ } | {
192
+ readonly ok: false;
193
+ readonly cause: TokenFailureCause;
194
+ };
195
+ type MappedSubject = Subject<JwtPrincipal>;
196
+ //#endregion
197
+ export { SsfPermDock as C, SsfSubjectMapper as D, SsfSubject as E, SsfOnEvent as S, SsfReceiver as T, SetSubject as _, JsonWebKeySet as a, SsfEventInput as b, JwtJwks as c, MappedSubject as d, CaepEventName as f, ReplayStore as g, PollResult as h, JoseTokenVerifierOptions as i, JwtPrincipal as l, PollOptions as m, DpopProofResult as n, JwtAlgorithm as o, PollHandle as p, JoseTokenSignerOptions as r, JwtClaimPaths as s, DiscoveryInput as t, JwtSubjectOptions as u, SsfAuditEvent as v, SsfPermDockOptions as w, SsfEventListener as x, SsfEventHandler as y };
@@ -1,4 +1,5 @@
1
- import { a as SqlMembershipSource } from "./sources-DOpW5Ila.js";
1
+ import { n as RoleThrough } from "./types-C97IskBw.js";
2
+ import { o as SqlMembershipSource } from "./sources-BdOYLw9j.js";
2
3
  //#region src/cli/types.d.ts
3
4
  type CollectConfig = {
4
5
  readonly srcPath?: readonly string[];
@@ -13,7 +14,11 @@ type RlsTarget = "sql" | "drizzle" | "prisma";
13
14
  type RlsMembershipTable = {
14
15
  readonly table: string;
15
16
  readonly user: string;
16
- readonly role: string;
17
+ /**
18
+ * The role key column, a reference to a roles table that holds the key, or
19
+ * several of them: the row holds every non-null key.
20
+ */
21
+ readonly role: string | RoleThrough | readonly (string | RoleThrough)[];
17
22
  /** Per scope name, the column holding that scope's id: the table's own scope and its ancestors. */
18
23
  readonly columns?: Readonly<Record<string, string>>;
19
24
  /** Column of the first scope's id; shorthand for `columns[<first scope>]`. */
@@ -22,8 +27,14 @@ type RlsMembershipTable = {
22
27
  readonly team?: string;
23
28
  readonly id?: string;
24
29
  readonly expiresAt?: string;
25
- /** Column holding the membership kind (`Membership.via`); roles with `for` need it. */
26
- readonly via?: string;
30
+ readonly disabledAt?: string;
31
+ /**
32
+ * The membership kind (`Membership.via`) roles with `for` match: a column
33
+ * holding it, or `{ value }` when every row has the same kind.
34
+ */
35
+ readonly via?: string | {
36
+ readonly value: string;
37
+ };
27
38
  };
28
39
  type RlsMemberships = {
29
40
  /** The membership table of each named scope. */
@@ -45,11 +56,28 @@ type RlsActiveRow = {
45
56
  readonly status?: string;
46
57
  readonly active?: readonly string[];
47
58
  };
59
+ /** A scope's active-row table, with the permissions its suspended instances keep. */
60
+ type RlsSuspendedScope = RlsActiveRow & {
61
+ /**
62
+ * Permissions (references or keys) members of a suspended instance, and of
63
+ * every instance nested in it, still hold: restoring it, cancelling a
64
+ * scheduled deletion, exporting before a purge.
65
+ */
66
+ readonly keep?: readonly (string | {
67
+ readonly key: string;
68
+ })[];
69
+ };
70
+ type RlsSuspendedMembership = {
71
+ readonly keep?: readonly (string | {
72
+ readonly key: string;
73
+ })[];
74
+ };
48
75
  type RlsSuspension = {
49
76
  /** A suspended user holds no role and no membership. */
50
77
  readonly users?: RlsActiveRow;
51
- /** Per scope name: a suspended instance voids its memberships and every membership nested under it. */
52
- readonly scopes?: Readonly<Record<string, RlsActiveRow>>;
78
+ /** Per scope name: a suspended instance voids its memberships and every membership nested under it, except for `keep`. */
79
+ readonly scopes?: Readonly<Record<string, RlsSuspendedScope>>;
80
+ readonly memberships?: RlsSuspendedMembership;
53
81
  };
54
82
  type RlsFunctionMapping = {
55
83
  readonly twin: unknown;
@@ -74,6 +102,14 @@ type RlsConfig = {
74
102
  readonly force?: boolean;
75
103
  readonly fixtures?: string;
76
104
  readonly tenantClaim?: string;
105
+ /**
106
+ * Which tenants the helpers and `memberOf` checks admit. `'active'`
107
+ * (default): when the token carries a non-empty `tenantClaim`, only that
108
+ * tenant; without one, every tenant the subject is a member of. `'all'`:
109
+ * every such tenant whatever the claim says, for apps whose tenant comes
110
+ * from the URL or the query.
111
+ */
112
+ readonly tenants?: "active" | "all";
77
113
  /** Postgres type of tenant columns (`uuid` by default); the tenant claim and helper results are cast to it. */
78
114
  readonly tenantType?: string;
79
115
  /** Postgres type of team columns; defaults to `tenantType`. */
@@ -87,12 +123,12 @@ type RlsConfig = {
87
123
  readonly drizzle?: {
88
124
  /** Module exporting the tables, as imported from `out`. Default `./schema`. */
89
125
  readonly schema?: string;
90
- /** Export name per table name; defaults to the camelCased table name. */
126
+ /** Export name per table name; defaults to the camelCased table name without its schema. */
91
127
  readonly exports?: Readonly<Record<string, string>>;
92
128
  };
93
129
  /** `--target prisma`: the model each table maps to. */
94
130
  readonly prisma?: {
95
- /** Model name per table name; defaults to the PascalCased table name. */
131
+ /** Model name per table name; defaults to the PascalCased table name without its schema. */
96
132
  readonly models?: Readonly<Record<string, string>>;
97
133
  };
98
134
  /** Schema of `role_permissions` and the RLS helpers (`permdock_has`, `permitted_<scope>_ids`, `member_<scope>_ids`) (and the RBAC scaffold). Default `permdock`; keep it out of `[api] schemas`. */
@@ -107,6 +143,25 @@ type RlsConfig = {
107
143
  * always intersected with the `permdock_ceiling` view. Off by default.
108
144
  */
109
145
  readonly customRoles?: boolean;
146
+ /** How the generated custom-role write functions check the caller (`database` mode with `customRoles`). */
147
+ readonly customRoleWrites?: {
148
+ /**
149
+ * Who may change custom roles at all, checked before the hand-out check:
150
+ * permission keys of which the caller must hold one in the tenant (or
151
+ * through a global role; only through a global role for a platform custom
152
+ * role), or `'manageRoles'` for any permission with `meta.manageRoles`.
153
+ * Unset, any member may write a role within what they may hand out.
154
+ */
155
+ readonly requires?: "manageRoles" | readonly string[];
156
+ /**
157
+ * The application's own roles table, one row per custom role. A trigger
158
+ * on it moves a role's grants and includes when the row's name, tenant,
159
+ * scope or instance changes, and deletes them with the row. A signed-in
160
+ * caller goes through the same checks as the write functions; a trusted
161
+ * path (a migration, a job, a nested trigger) moves the rows directly.
162
+ */
163
+ readonly roles?: RlsCustomRoleTable;
164
+ };
110
165
  /**
111
166
  * Let link capabilities reach resource-scoped grants: `anon` policies that call
112
167
  * `permdock_capability_ids`, which reads the `capability` claim `exchangeCapability`
@@ -121,6 +176,69 @@ type RlsConfig = {
121
176
  * too. Off by default.
122
177
  */
123
178
  readonly anonymousSignIns?: "deny";
179
+ /**
180
+ * Grant `anon` usage on the helper schema and `execute` on the helpers, for
181
+ * hand-written policies that apply to `public` or `anon` and call them. They
182
+ * find no subject for `anon` and return nothing. Off by default: a policy
183
+ * that calls a helper says `to authenticated`.
184
+ */
185
+ readonly anonExecute?: boolean;
186
+ /**
187
+ * Check role assignments in the database: a trigger on each scope's
188
+ * `rls.memberships` table, the global-roles table `rls.roles` and each
189
+ * table in `tables` (such as invitations) refuses a client write that
190
+ * assigns, changes or removes a role the caller may not assign there, by
191
+ * the policy's `assigns` graph or, for a custom role, by what the caller may
192
+ * hand out. Writes that do not run as a client role (the table owner, a
193
+ * `security definer` function, a backend role) are trusted. Needs a role
194
+ * that declares `assigns`.
195
+ */
196
+ readonly assignments?: true | {
197
+ readonly tables?: readonly RlsAssignmentTable[];
198
+ /**
199
+ * `'refuse'`: a client write to a row whose user is the caller is
200
+ * refused on every guarded table with a user column, whatever the
201
+ * role. A map refuses it on the tables it names (`schema.table` as
202
+ * configured). Unset, a caller may change their own row within what
203
+ * they may assign.
204
+ */
205
+ readonly ownRole?: "refuse" | Readonly<Record<string, "refuse">>;
206
+ };
207
+ /**
208
+ * Add the approval store `supabaseApprovalStore` reads and writes: the
209
+ * `approval_requests` table and one function per `ApprovalStore` method, in
210
+ * the helper schema, executable by no client role. Off by default. An
211
+ * object adopts a table the app already has instead.
212
+ */
213
+ readonly approvals?: boolean | RlsApprovalsAdopt;
214
+ /**
215
+ * A pg_jsonschema check constraint on generated `jsonb` columns: the
216
+ * approval store's `body` must match `approval-request-v1.json`. `true`
217
+ * installs the extension into `extensions`; `'auto'` adds the constraint
218
+ * only where `pg_available_extensions` lists it. Off by default.
219
+ */
220
+ readonly jsonSchema?: "auto" | boolean;
221
+ /**
222
+ * `false` leaves out the holder-count and transfer-only triggers `min`,
223
+ * `max` and `transferOnly` put on the membership tables; a map with
224
+ * `<scope>: false` leaves them out for those scopes only. Those rules are
225
+ * then checked by `decideRoleChange` alone. On by default.
226
+ */
227
+ readonly ownershipTriggers?: false | Readonly<Record<string, false>>;
228
+ /**
229
+ * Make a session acting for a user read-only in the database: one
230
+ * restrictive policy per table and write command the generated policies
231
+ * allow, refusing the write when the token's `act` claim names one of these
232
+ * actor kinds, unless `act.read_only` is `false`. `true` is
233
+ * `['support', 'impersonation']`; with `support`, an `act` with a
234
+ * `session_id` and no `kind` counts too. Off by default.
235
+ */
236
+ readonly readOnlyActors?: boolean | readonly string[];
237
+ readonly apiKeys?: true | RlsApiKeys;
238
+ /** Supabase Realtime: policies on `realtime.messages` for private channels. Supabase dialect only. */
239
+ readonly realtime?: RlsRealtime;
240
+ /** Supabase Storage: policies on `storage.objects` for buckets keyed by a scope folder. Supabase dialect only. */
241
+ readonly storage?: RlsStorage;
124
242
  /**
125
243
  * `'views'`: one `security_invoker` view `<table>_visible` per table with field-limited
126
244
  * read grants, whose restricted columns are `case when <permitted> then col end`. Off by default.
@@ -149,6 +267,14 @@ type RlsConfig = {
149
267
  readonly actions?: RlsActions;
150
268
  /** Emit only the helpers, their seeds and the scaffold; the table policies stay hand-written. */
151
269
  readonly helpersOnly?: boolean;
270
+ /**
271
+ * Emit `permitted_<resource>_rows(p_permission)` and its `_for` form for
272
+ * these resources, or for every resource a grant reaches with `true`: the
273
+ * row ids the caller may act on, as the generated policies decide them.
274
+ */
275
+ readonly rowHelpers?: true | readonly string[];
276
+ readonly trustedReaders?: readonly string[];
277
+ readonly treeValues?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
152
278
  /** `rls migrate`: how existing helper calls map onto the generated helpers. */
153
279
  readonly migrate?: RlsMigrateConfig;
154
280
  /**
@@ -158,6 +284,72 @@ type RlsConfig = {
158
284
  */
159
285
  readonly shims?: boolean | RlsShimsConfig;
160
286
  };
287
+ /**
288
+ * `rls.approvals` on a table the app already has: the store functions keep
289
+ * each request's body in `body` and its token in `token` (both added when
290
+ * missing) and read every field from the body; `mirror` copies request
291
+ * fields into the app's own columns on each write, converted to their types.
292
+ */
293
+ type RlsApprovalsAdopt = {
294
+ /** `table` or `schema.table`. */
295
+ readonly table: string;
296
+ /** A text column unique per request. Default `token`. */
297
+ readonly token?: string;
298
+ /** A jsonb column holding the `ApprovalRequest`. Default `body`. */
299
+ readonly body?: string;
300
+ readonly open?: "insert" | "attach";
301
+ readonly schema?: string;
302
+ /** Request fields copied into the app's columns, field to column. */
303
+ readonly mirror?: {
304
+ readonly status?: string;
305
+ readonly permission?: string;
306
+ readonly tenant?: string;
307
+ readonly principalId?: string;
308
+ readonly actorId?: string;
309
+ readonly session?: string;
310
+ readonly approvals?: string;
311
+ readonly createdAt?: string;
312
+ readonly expiresAt?: string;
313
+ readonly resolvedAt?: string;
314
+ readonly resolvedBy?: string;
315
+ readonly consumedAt?: string;
316
+ };
317
+ };
318
+ type RlsApiKeys = {
319
+ readonly claim?: string;
320
+ readonly scopes?: string;
321
+ readonly tenant?: string;
322
+ readonly roles?: string;
323
+ readonly serviceRoles?: readonly string[];
324
+ };
325
+ /** One more table whose rows assign a role, such as invitations (`rls.assignments.tables`). */
326
+ type RlsAssignmentTable = {
327
+ readonly table: string;
328
+ /** The declared scope the row assigns the role at. */
329
+ readonly scope: string;
330
+ /** The column holding the scope instance id. */
331
+ readonly id: string;
332
+ /** The tenant column for a scope below the first; defaults to `id` at the first scope. */
333
+ readonly tenant?: string;
334
+ /** The role key column, a reference to a roles table that holds the key, or several of them. */
335
+ readonly role: string | RoleThrough | readonly (string | RoleThrough)[];
336
+ /** The column holding the user the row assigns to, which `ownRole` compares with the caller. */
337
+ readonly user?: string;
338
+ };
339
+ /** `rls.customRoleWrites.roles`: the application's table of custom roles. */
340
+ type RlsCustomRoleTable = {
341
+ readonly table: string;
342
+ /** The column holding the role name. */
343
+ readonly key: string;
344
+ /** The tenant column; a row with no tenant is a platform custom role (`scope: 'global'`). Without it every row is a platform role. */
345
+ readonly tenant?: string;
346
+ /** A text column holding the scope name; without it a row with a tenant lives at the first scope. */
347
+ readonly scope?: string;
348
+ /** A column pinning the role to one instance of its scope. */
349
+ readonly id?: string;
350
+ /** A boolean column marking rows that are not custom roles (declared or system roles); those rows are skipped. */
351
+ readonly skip?: string;
352
+ };
161
353
  /** `rls.shims`: where the legacy-named wrappers go. */
162
354
  type RlsShimsConfig = {
163
355
  /** Schema of the legacy helpers. Default `public`. */
@@ -190,24 +382,44 @@ type RlsMigrateConfig = {
190
382
  /** For `scoped` helpers, a scope literal's PermDock scope when the names differ. */
191
383
  readonly scopes?: Readonly<Record<string, string>>;
192
384
  };
193
- /**
194
- * The role column of a global-roles table that holds a foreign key: the role
195
- * key is `column` of `through`, joined on `on` (`{ role_id: 'id' }`).
196
- */
197
- type RoleThrough = {
198
- /** The roles table; unqualified, it is in the global-roles table's schema. */
199
- readonly through: string;
200
- /** One entry: the global-roles column to the roles table column it references. */
201
- readonly on: Readonly<Record<string, string>>;
202
- /** The roles table column that holds the role key. */
203
- readonly column: string;
204
- };
205
385
  /** Where global roles live: `table (user, role)`. Defaults `user_id` and `role`. */
206
386
  type GlobalRoles = {
207
387
  readonly table: string;
208
388
  readonly user?: string;
209
389
  readonly role?: string | RoleThrough;
210
390
  };
391
+ /** A permission reference from the app's definitions; only its `key` is read. */
392
+ type RlsPermissionRef = {
393
+ readonly key: string;
394
+ };
395
+ /**
396
+ * One private Realtime topic pattern, such as `org:{organization}:chat`:
397
+ * `:`-separated segments, one of them `{<scope>}`, which holds the id of a
398
+ * scope instance.
399
+ */
400
+ type RlsRealtimeTopic = {
401
+ /** Receive broadcast and presence messages: `select` on `realtime.messages`. */
402
+ readonly read: RlsPermissionRef;
403
+ /** Send broadcast messages and track presence: `insert`. Absent: nobody may. */
404
+ readonly write?: RlsPermissionRef;
405
+ };
406
+ type RlsRealtime = {
407
+ readonly topics: Readonly<Record<string, RlsRealtimeTopic>>;
408
+ };
409
+ /** One Storage bucket whose object paths start with a scope instance id. */
410
+ type RlsStorageBucket = {
411
+ readonly scope: string;
412
+ /** The 1-based `storage.foldername(name)` entry that holds the id. Default 1. */
413
+ readonly folder?: number;
414
+ /** Download and list: `select` on `storage.objects`. */
415
+ readonly read?: RlsPermissionRef;
416
+ /** Upload and overwrite: `insert` and `update`. */
417
+ readonly write?: RlsPermissionRef;
418
+ readonly delete?: RlsPermissionRef;
419
+ };
420
+ type RlsStorage = {
421
+ readonly buckets: Readonly<Record<string, RlsStorageBucket>>;
422
+ };
211
423
  /** `permdock supabase hook generate` input. */
212
424
  type SupabaseHookConfig = {
213
425
  /** The same `fromTable` / `fromJunction` sources the app passes as `memberships`. */
@@ -239,16 +451,36 @@ type SupabaseHookConfig = {
239
451
  };
240
452
  /**
241
453
  * Claims other packages own, each `claim: '<schema>.<function>'`, for
242
- * example `{ features: 'better_supabase.feature_claims' }`. The function
454
+ * example `{ features: 'public.feature_claims' }`. The function
243
455
  * takes the user id (`uuid`) and returns `jsonb`; `null` omits the claim.
244
456
  * Reserved names are refused, the claims sit outside `budget`, and a
245
457
  * suspended user gets none.
246
458
  */
247
459
  readonly claims?: Readonly<Record<string, string>>;
460
+ readonly before?: string | readonly string[];
461
+ /**
462
+ * Check the claims the hook wrote against `supabase-claims-v1.json` with
463
+ * pg_jsonschema, and drop them all on a mismatch so the user signs in with
464
+ * no PermDock access instead of an error. Needs the extension. Default `false`.
465
+ */
466
+ readonly validate?: boolean;
248
467
  /** Bytes of JSON the `memberships` claim may use. Default `supabaseMembershipsBudget` (1024). */
249
468
  readonly budget?: number;
250
469
  /** Keep `permdock_authz_version` and write the `authz_ver` claim. Default `true`. */
251
470
  readonly version?: boolean;
471
+ /**
472
+ * Write PostgREST wrappers for `subject_for`, `members_of` and
473
+ * `authz_version_for` into `schema` (default `public`), named
474
+ * `<prefix>subject_for` and so on (default prefix `permdock_`), for a
475
+ * backend that reaches Postgres through the Data API while the hook schema
476
+ * is not exposed. Each wrapper is `security definer`, revoked from
477
+ * `public`, `anon` and `authenticated`, and granted to `service_role`: the
478
+ * one place the hook grants to it. Pass the same setting to `postgrestSources`.
479
+ */
480
+ readonly api?: {
481
+ readonly schema?: string;
482
+ readonly prefix?: string;
483
+ };
252
484
  /** The `jwt_expiry` the printed `config.toml` block sets. Default 900. */
253
485
  readonly jwtExpiry?: number;
254
486
  /** Suspended users get empty claims. Default `rls.suspension`. */
@@ -259,6 +491,13 @@ type SupabaseConfig = {
259
491
  readonly hook?: SupabaseHookConfig;
260
492
  };
261
493
  type DoctorConfig = {
494
+ /**
495
+ * Directories or globs the source checks read (PD001, PD002, PD007 to
496
+ * PD015, PD044 and the other checks over files), default `collect.srcPath`.
497
+ * The catalog `collect` writes still comes from `collect.srcPath`, and PD004
498
+ * compares the catalog on disk with that one.
499
+ */
500
+ readonly srcPath?: readonly string[];
262
501
  readonly sensitiveActions?: readonly string[];
263
502
  readonly memberships?: string;
264
503
  /** A JSON fixture `{ credentials?, settings? }` of API-key credentials and per-tenant settings (the `memorySettings` input) for PD029. */
@@ -280,8 +519,20 @@ type PermDockConfig = {
280
519
  };
281
520
  readonly rls?: RlsConfig;
282
521
  readonly supabase?: SupabaseConfig;
522
+ readonly powersync?: PowerSyncConfig;
283
523
  readonly doctor?: DoctorConfig;
284
524
  };
525
+ /** `permdock powersync generate` and `verify` input. Tables and memberships come from `rls`. */
526
+ type PowerSyncConfig = {
527
+ /** The Sync Streams file; default `sync-config.yaml`. */
528
+ readonly out?: string;
529
+ /** Resources that get a stream; default every resource with a grant of `action`. */
530
+ readonly resources?: readonly string[];
531
+ /** The action whose grants decide which rows sync; default `read`. */
532
+ readonly action?: string;
533
+ /** Where `generate` writes `localSnapshotManifest(policy)` as JSON for `localSnapshot` and `powersyncSource`; none by default. */
534
+ readonly manifest?: string;
535
+ };
285
536
  type CliIo = {
286
537
  readonly stdout: (text: string) => void;
287
538
  readonly stderr: (text: string) => void;
@@ -309,4 +560,4 @@ type PermDockPluginOptions = {
309
560
  readonly check?: boolean;
310
561
  };
311
562
  //#endregion
312
- export { PermDockPluginOptions as a, RlsDialect as c, RlsMemberships as d, RlsSuspension as f, PermDockConfig as i, RlsFunctionMapping as l, RunResult as m, CliIo as n, RlsActiveRow as o, RlsTarget as p, CollectConfig as r, RlsConfig as s, CatalogConfig as t, RlsMembershipTable as u };
563
+ export { RunResult as _, PermDockPluginOptions as a, RlsConfig as c, RlsMembershipTable as d, RlsMemberships as f, RlsTarget as g, RlsSuspension as h, PermDockConfig as i, RlsDialect as l, RlsSuspendedScope as m, CliIo as n, RlsActiveRow as o, RlsSuspendedMembership as p, CollectConfig as r, RlsApiKeys as s, CatalogConfig as t, RlsFunctionMapping as u };