permdock 0.3.0 → 0.4.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 (323) hide show
  1. package/dist/a2a/index.d.ts +7 -5
  2. package/dist/a2a/index.js +14 -21
  3. package/dist/ai-sdk/index.d.ts +18 -6
  4. package/dist/ai-sdk/index.js +8 -5
  5. package/dist/app-data-CV8pqqMi.js +59 -0
  6. package/dist/approvals/index.d.ts +2 -2
  7. package/dist/approvals/index.js +3 -3
  8. package/dist/{approvals-DbYAuNkG.js → approvals-DZL76lKW.js} +35 -19
  9. package/dist/{approvers-DT4AVyIg.js → approvers-CqPOLD-o.js} +1 -1
  10. package/dist/{arazzo-BAgw9ap6.js → arazzo-C4BcskbX.js} +6 -5
  11. package/dist/{arazzo-CKwwqFWz.js → arazzo-CD8d0WLb.js} +2 -2
  12. package/dist/authzen/index.d.ts +3 -3
  13. package/dist/authzen/index.js +161 -23
  14. package/dist/better-auth/index.d.ts +2 -2
  15. package/dist/better-auth/index.js +6 -19
  16. package/dist/better-supabase/index.d.ts +112 -87
  17. package/dist/better-supabase/index.js +257 -156
  18. package/dist/{bind-C_ob3LKa.d.ts → bind-BzqG8SMb.d.ts} +16 -5
  19. package/dist/{bind-CuzGytRf.js → bind-kk-uyCwH.js} +14 -6
  20. package/dist/build-instance-DIIV9DbC.js +51 -0
  21. package/dist/{canonical-json-DemiK4Vp.js → canonical-json-CFKyFOke.js} +1 -3
  22. package/dist/{capability-2kYTMWDv.d.ts → capability-CksyCWDH.d.ts} +2 -2
  23. package/dist/{capability-4qPdO9gk.js → capability-txATtKV4.js} +3 -2
  24. package/dist/catalog/index.d.ts +1 -1
  25. package/dist/catalog/index.js +1 -1
  26. package/dist/catalog-6yWAX6Ps.js +2 -0
  27. package/dist/{catalog-dFZdWCGN.js → catalog-WHG4kBq7.js} +2 -2
  28. package/dist/{catalog-doc-DdGm82XT.js → catalog-doc-DWtg0gGR.js} +17 -10
  29. package/dist/{catalog-DWF5cYqB.js → catalog-tZUyOfOv.js} +4 -4
  30. package/dist/claude-agent/index.d.ts +4 -4
  31. package/dist/claude-agent/index.js +4 -5
  32. package/dist/clerk/index.d.ts +3 -3
  33. package/dist/clerk/index.js +8 -33
  34. package/dist/cli/bin.js +1 -1
  35. package/dist/cli/index.d.ts +3 -3
  36. package/dist/cli/index.js +3 -3
  37. package/dist/cloud/index.d.ts +4 -4
  38. package/dist/cloud/index.js +9 -15
  39. package/dist/{cloud-CB_ELYuX.js → cloud-C7bSDgX4.js} +2 -2
  40. package/dist/{cloud-DWLXO2af.js → cloud-PeBN3IEn.js} +5 -5
  41. package/dist/{collect-DSTE3ml9.js → collect-2SrB7lfk.js} +6 -8
  42. package/dist/collect-Bw2Jdq1q.js +2 -0
  43. package/dist/{collect-DClJsheJ.js → collect-CQx4hX4N.js} +3 -3
  44. package/dist/{commands-DSxCqG9A.js → commands-Cpip4ULx.js} +13 -13
  45. package/dist/{compact-y6vfu2_f.js → compact-CAf557ZB.js} +11 -1
  46. package/dist/compile/index.d.ts +1 -1
  47. package/dist/compile/index.js +1 -1
  48. package/dist/{compile-Ba4blROR.js → compile-CcEu2ZQ1.js} +6 -5
  49. package/dist/{compile-BkRyBDBw.d.ts → compile-CtTP7eur.d.ts} +2 -2
  50. package/dist/{config-BJiM-xAm.js → config-BIjREpyE.js} +4 -4
  51. package/dist/{config-Dnszbv-6.js → config-DLt6BvV7.js} +2 -2
  52. package/dist/{config-report-DMvWKUxL.js → config-report--Xb9APJS.js} +5 -6
  53. package/dist/{connection-CU8MQxRi.js → connection-DUsczpB5.js} +3 -2
  54. package/dist/constants-DcJABbLW.js +20 -0
  55. package/dist/{context-Bcy85rGi.js → context-DieZVJXu.js} +16 -5
  56. package/dist/convex/index.d.ts +4 -4
  57. package/dist/convex/index.js +14 -16
  58. package/dist/create-BBO24vj6.js +324 -0
  59. package/dist/{credential-8P81ff4u.js → credential-kue0qpbm.js} +4 -4
  60. package/dist/deciding-columns-Sq12mEA6.js +123 -0
  61. package/dist/delegation-input-FTxMK3ji.js +19 -0
  62. package/dist/denied-text-DfRk15uw.d.ts +19 -0
  63. package/dist/{describe-DMYiCjJV.d.ts → describe-C3ldA9os.d.ts} +11 -2
  64. package/dist/{describe-B_gVZEVi.js → describe-Cgkp7eP0.js} +5 -4
  65. package/dist/{diff-DBIhz_f2.js → diff-Cnghh_Ip.js} +2 -2
  66. package/dist/{diff-2VaeChzX.js → diff-rpqoe7Ag.js} +9 -9
  67. package/dist/{doctor-BwCAMLx_.js → doctor-CuVJvhV_.js} +2 -2
  68. package/dist/doctor-owlv6ddh.js +2166 -0
  69. package/dist/drizzle/index.d.ts +2 -2
  70. package/dist/drizzle/index.js +6 -14
  71. package/dist/elysia/index.d.ts +4 -4
  72. package/dist/elysia/index.js +7 -7
  73. package/dist/{errors-DPdqI50v.d.ts → errors-OD_4c__H.d.ts} +2 -2
  74. package/dist/{errors-Cz5zn0mW.js → errors-drnfxYtm.js} +3 -3
  75. package/dist/{evaluations-tz6D9A2G.js → evaluations-C9YJsv3H.js} +45 -7
  76. package/dist/eve/index.d.ts +5 -5
  77. package/dist/eve/index.js +5 -5
  78. package/dist/express/index.d.ts +4 -4
  79. package/dist/express/index.js +8 -7
  80. package/dist/fastify/index.d.ts +15 -5
  81. package/dist/fastify/index.js +9 -29
  82. package/dist/fields-fwfXN01n.js +1016 -0
  83. package/dist/{files-DWUN9PzI.js → files-D_JIzUrP.js} +12 -3
  84. package/dist/{fixtures-ht28Cplr.js → fixtures-h2eG2OZV.js} +5 -6
  85. package/dist/{from-snapshot-CTLijvdm.js → from-snapshot-7REQZe0H.js} +32 -22
  86. package/dist/{generate-CH7ThJ14.js → generate-CNU1pIOo.js} +1 -3
  87. package/dist/grantee-CXY-0C87.js +254 -0
  88. package/dist/grantee-conditions-MQs5NIuX.js +270 -0
  89. package/dist/grantee-match-fxYp9Nmt.js +141 -0
  90. package/dist/{helpers-H_KARDVC.js → helpers-C9YmyBIa.js} +7 -6
  91. package/dist/hono/index.d.ts +4 -4
  92. package/dist/hono/index.js +8 -8
  93. package/dist/hosted-CBHgkzDl.js +655 -0
  94. package/dist/{http-SO7qGttf.js → http-BBoKefeS.js} +35 -2
  95. package/dist/{http-BIhmLfCc.js → http-BEbdMZ05.js} +2 -24
  96. package/dist/{rls-import-BTFVk3jH.js → import-BFIlhetD.js} +86 -80
  97. package/dist/{openapi-import-cmwetbzw.js → import-UHk1N7vH.js} +6 -7
  98. package/dist/{index-C8z4RjQV.d.ts → index-BwMe94Xq.d.ts} +1 -1
  99. package/dist/{index-0nNqHspG.d.ts → index-DgM7w96K.d.ts} +2 -2
  100. package/dist/{index-C7Tw7MaW.d.ts → index-Dz7didpC.d.ts} +3 -3
  101. package/dist/{index-BNc7Wer_.d.ts → index-UdVQgq48.d.ts} +105 -38
  102. package/dist/index.d.ts +15 -13
  103. package/dist/index.js +22 -22
  104. package/dist/{instance-options-jARdwfPN.d.ts → instance-options-plkrsAog.d.ts} +1 -1
  105. package/dist/{json-schema-BsAflUGW.js → json-schema-DBkdUuCO.js} +1 -3
  106. package/dist/jwt/index.d.ts +4 -4
  107. package/dist/jwt/index.js +13 -13
  108. package/dist/{kernel-_RRHmnMY.js → kernel-CB3LrIJM.js} +81 -32
  109. package/dist/kysely/index.d.ts +2 -2
  110. package/dist/kysely/index.js +6 -14
  111. package/dist/{live-options-H2eG8dfJ.js → live-options-BaAFCIiu.js} +16 -3
  112. package/dist/load-B_shHrmd.js +2 -0
  113. package/dist/{load-DhWEB9P1.js → load-C3_oTHyO.js} +11 -3
  114. package/dist/{manifest-iaoBXHKc.js → manifest-BngWKryL.js} +5 -18
  115. package/dist/{map-claims-Z4QZOiFF.js → map-claims-AVlBaJoa.js} +7 -16
  116. package/dist/{map-error-pgUWNNtG.js → map-error-BE27PYkE.js} +5 -5
  117. package/dist/{markers-B0hYLvMD.js → markers-CiwAOZtO.js} +6 -2
  118. package/dist/{may-use-DndQ5tQ-.js → may-use-BOn_dR_w.js} +4 -3
  119. package/dist/mcp/index.d.ts +26 -9
  120. package/dist/mcp/index.js +456 -446
  121. package/dist/{rls-migrate-CN4TlJTO.js → migrate-BwlB5-Wk.js} +75 -15
  122. package/dist/nest/index.d.ts +4 -4
  123. package/dist/nest/index.js +11 -12
  124. package/dist/next/index.d.ts +31 -8
  125. package/dist/next/index.js +29 -33
  126. package/dist/next/plugin.d.ts +1 -1
  127. package/dist/next/plugin.js +1 -1
  128. package/dist/node/index.d.ts +4 -4
  129. package/dist/node/index.js +4 -4
  130. package/dist/ocsf-uYFXGVw2.js +115 -0
  131. package/dist/openai/index.d.ts +5 -5
  132. package/dist/openai/index.js +4 -4
  133. package/dist/openapi/index.d.ts +3 -3
  134. package/dist/openapi/index.js +1 -1
  135. package/dist/{openapi-CqqEbHsL.js → openapi-BJdBmYDG.js} +19 -23
  136. package/dist/{openapi-BqRBvAng.js → openapi-DBzHQbov.js} +2 -5
  137. package/dist/{openapi-l0xYHkcv.js → openapi-DcQ1Kg40.js} +3 -3
  138. package/dist/orpc/index.d.ts +5 -5
  139. package/dist/orpc/index.js +9 -11
  140. package/dist/otel/index.d.ts +2 -2
  141. package/dist/otel/index.js +26 -23
  142. package/dist/output-files-CgIsvdSa.js +140 -0
  143. package/dist/{rls-ownership-RuFqaqGz.js → ownership-BgnbOJFT.js} +387 -379
  144. package/dist/{package-root-zGkxO3oN.js → package-root-DtNnpmUd.js} +3 -2
  145. package/dist/{parse-BuyjxhZV.js → parse-CVFQHk6c.js} +3 -3
  146. package/dist/{parse-local-manifest-BrMozJCo.js → parse-local-manifest-C-q02Pal.js} +2 -4
  147. package/dist/{parse-local-manifest-JLnaBH0S.d.ts → parse-local-manifest-DvYUR0QL.d.ts} +1 -1
  148. package/dist/pdp/index.d.ts +2 -2
  149. package/dist/pdp/index.js +8 -9
  150. package/dist/{permdock-CbgvLnuo.js → permdock-L26udHSk.js} +1387 -1220
  151. package/dist/{rls-fields-74oZPXWL.js → permission-keys-B26jeyUv.js} +1289 -2066
  152. package/dist/permission-registry-BsblpB-z.js +385 -0
  153. package/dist/{permissions-DttnqqxC.d.ts → permission-types-Dg39z9Kv.d.ts} +59 -31
  154. package/dist/{permissions-RJrovw98.js → permissions-CCJ6lmxB.js} +3 -3
  155. package/dist/{permissions-CDgvKG5L.d.ts → permissions-COH-KRgT.d.ts} +2 -2
  156. package/dist/{policy-IB6yxpC3.d.ts → policy-types-sp9P1iIV.d.ts} +661 -582
  157. package/dist/{policy-D2W7uv19.d.ts → policy-ur0BBK_e.d.ts} +2 -2
  158. package/dist/{powersync-DliZK_-y.js → powersync-BFSbSElQ.js} +2 -2
  159. package/dist/powersync-DCDgZgfZ.js +2 -0
  160. package/dist/{powersync-BylawD_U.js → powersync-cZe4kzhL.js} +26 -27
  161. package/dist/prisma/index.d.ts +1 -1
  162. package/dist/prisma/index.js +6 -12
  163. package/dist/{problem-B43ztKIm.js → problem-CnWraVhC.js} +8 -7
  164. package/dist/{problem-details-_AMOYz-w.js → problem-details-DECUnXAn.js} +2 -2
  165. package/dist/{problem-details-DX075l9V.d.ts → problem-details-rIIo8B2C.d.ts} +1 -1
  166. package/dist/{protected-BdnIEFkY.d.ts → protected-B3_P7xuw.d.ts} +9 -6
  167. package/dist/{protected-utU-SLuy.js → protected-BN7BUdY1.js} +20 -8
  168. package/dist/{provider-CSQd7m92.js → provider-Bi-0HNL3.js} +23 -10
  169. package/dist/{provider-DZY281jO.d.ts → provider-kwHC9CZD.d.ts} +1 -1
  170. package/dist/{provider-store-Cfbvo4DE.js → provider-store-Ctt-81Ni.js} +6 -3
  171. package/dist/react/index.d.ts +7 -7
  172. package/dist/react/index.js +5 -5
  173. package/dist/react/provider-client.d.ts +1 -1
  174. package/dist/react/provider-client.js +1 -1
  175. package/dist/react-native/index.d.ts +20 -11
  176. package/dist/react-native/index.js +33 -17
  177. package/dist/{refs-KYb4ntaz.js → refs-f3imMjNW.js} +1 -1
  178. package/dist/relation-walk-BXnlLtg2.js +186 -0
  179. package/dist/relations-CvmSpG67.js +163 -0
  180. package/dist/{replay-CYyiLiwO.d.ts → replay-COpmZUfx.d.ts} +1 -1
  181. package/dist/request-context-BVM7aWNs.js +71 -0
  182. package/dist/request-context-C2_1lchh.d.ts +5 -0
  183. package/dist/resource-relations-D1Un3pcz.js +243 -0
  184. package/dist/retire-BFcxL6un.js +240 -0
  185. package/dist/{rls-B4ur8nKQ.js → rls-55DQTuf5.js} +14 -2
  186. package/dist/{rls-DQtdgTHB.js → rls-BEktUaqg.js} +884 -484
  187. package/dist/{policy-xyWg7QdR.js → role-builder-B4GbKM-i.js} +235 -541
  188. package/dist/{rpc-DL9Sqvb1.js → rpc-nYC3cR_u.js} +15 -5
  189. package/dist/{run-DKDbM4Du.js → run-DMcNW_8T.js} +3 -3
  190. package/dist/{runtime-CB8gQFvS.js → runtime-D_tMXnsq.js} +1 -1
  191. package/dist/{saas-DhpJjnBA.js → saas-DtaA4JuW.js} +9 -8
  192. package/dist/{openapi-schema--ARjyfQr.js → schema-Bol6gqXA.js} +3 -5
  193. package/dist/{schema-D3MnDMxa.js → schema-DjQBcAP9.js} +4 -2
  194. package/dist/scim/index.d.ts +1 -1
  195. package/dist/scim/index.js +1 -1
  196. package/dist/{scim-BFGBBAqR.js → scim-vFR1O5oG.js} +6 -12
  197. package/dist/{scopes-CVdPrWN-.js → scopes-tvpa34ep.js} +10 -2
  198. package/dist/server/index.d.ts +18 -8
  199. package/dist/server/index.js +8 -8
  200. package/dist/{server-DlZ28Oz5.js → server-ZYEHtNHS.js} +4 -4
  201. package/dist/{create-B1d519XK.d.ts → server-types-DdqBwZN_.d.ts} +69 -33
  202. package/dist/shared-1uhI-e-b.js +294 -0
  203. package/dist/{shared-DRu8VFVM.js → shared-JhMeOsDF.js} +1 -1
  204. package/dist/{sink-Bd9PSyfq.js → sink-BTtmfPnE.js} +1 -1
  205. package/dist/{sink-B1fZzIMf.d.ts → sink-CPN4zLfs.d.ts} +1 -1
  206. package/dist/{skills-Biq5uup3.js → skills-BZdRQkxs.js} +4 -3
  207. package/dist/{skills-Bx-U0irG.js → skills-Dle4ZoLF.js} +2 -2
  208. package/dist/{snapshot-Enxd0n-s.js → snapshot-Dc9CHPME.js} +116 -13
  209. package/dist/{snapshot-cache-D6jLelln.js → snapshot-cache-Cod40D-X.js} +1 -1
  210. package/dist/{snapshot-cache-B-LxUahj.d.ts → snapshot-cache-J5T7t_vD.d.ts} +1 -1
  211. package/dist/solid/index.d.ts +22 -22
  212. package/dist/solid/index.js +40 -10
  213. package/dist/{sources-4p0-4xQm.js → sources-B1-b-R0t.js} +25 -26
  214. package/dist/{sources-BdOYLw9j.d.ts → sources-Dljy06zL.d.ts} +6 -2
  215. package/dist/{sql-xdg5f4Fi.js → sql-t8teWOfo.js} +19 -3
  216. package/dist/{src-BDwEZWrZ.js → src-Bb7no-hS.js} +194 -123
  217. package/dist/ssf/index.d.ts +3 -3
  218. package/dist/ssf/index.js +58 -61
  219. package/dist/store-9KO4BlkB.d.ts +147 -0
  220. package/dist/{store-DMAWwAJV.js → store-ILkLUj_o.js} +4 -4
  221. package/dist/{store-options-ByhZq1jV.js → store-options-CbUHDoSe.js} +16 -7
  222. package/dist/{stores-BT2pSCub.js → stores-BHXdSbw9.js} +7 -3
  223. package/dist/stores-Cxz_80g-.d.ts +31 -0
  224. package/dist/{stream-DDpvynSB.js → stream-BMui98KK.js} +2 -1
  225. package/dist/{stream-D1RXubw2.d.ts → stream-Dwsg6WwE.d.ts} +2 -2
  226. package/dist/{subject-settings-BwBmCdTR.js → subject-settings-CkEwrw3W.js} +23 -5
  227. package/dist/supabase/index.d.ts +4 -4
  228. package/dist/supabase/index.js +3 -3
  229. package/dist/supabase/middleware.d.ts +11 -5
  230. package/dist/supabase/middleware.js +10 -7
  231. package/dist/{supabase-C0qESOa-.js → supabase-C1TWlnYt.js} +36 -52
  232. package/dist/{supabase-Boqb9a_Y.js → supabase-Dbqr141s.js} +2 -2
  233. package/dist/supabase-hook-BULg7Ut_.js +2 -0
  234. package/dist/{supabase-hook-CSLQ4zJ3.js → supabase-hook-Cva3ikXz.js} +731 -782
  235. package/dist/{supautils-Cn4R4cJ4.js → supautils-B6HYL9eL.js} +2 -2
  236. package/dist/svelte/Protected.svelte +9 -2
  237. package/dist/svelte/index.d.ts +6 -6
  238. package/dist/svelte/index.js +25 -11
  239. package/dist/svelte/runtime.d.ts +10 -3
  240. package/dist/svelte/runtime.js +4 -3
  241. package/dist/svelte/source.d.ts +6 -6
  242. package/dist/svelte/source.js +4 -4
  243. package/dist/{validity-uOp8UpYn.js → tenancy-DshjqY0n.js} +3 -39
  244. package/dist/terminal/index.d.ts +5 -5
  245. package/dist/terminal/index.js +18 -34
  246. package/dist/testing/index.d.ts +89 -77
  247. package/dist/testing/index.js +1276 -1262
  248. package/dist/testing/saas/index.d.ts +4 -4
  249. package/dist/testing/saas/index.js +2 -2
  250. package/dist/testing/saas/permissions.d.ts +1 -1
  251. package/dist/testing/saas/permissions.js +1 -1
  252. package/dist/thenable-QSmvt-vZ.js +65 -0
  253. package/dist/{token-CIWxJOCh.js → token-Bx9qy30p.js} +1 -1
  254. package/dist/tool-refusal-CQ7OEia9.js +41 -0
  255. package/dist/trpc/index.d.ts +5 -5
  256. package/dist/trpc/index.js +7 -8
  257. package/dist/{types-DbjRN55U.d.ts → types-7rJVLWe5.d.ts} +82 -4
  258. package/dist/{types-aqOHTHcp.d.ts → types-Br9IXUBG.d.ts} +1 -1
  259. package/dist/types-ByUo56un.d.ts +88 -0
  260. package/dist/{types-Cq_H8N_X.d.ts → types-C0dee0Qf.d.ts} +2 -2
  261. package/dist/{types-DxiCGmmd.d.ts → types-CIlTojhq.d.ts} +2 -2
  262. package/dist/{types-QCuYJh4q.d.ts → types-CUcFZfpU.d.ts} +1 -1
  263. package/dist/{types-C97IskBw.d.ts → types-CqrjB9o6.d.ts} +1 -1
  264. package/dist/{types-BnIEz1sU.d.ts → types-DHrmBJLH.d.ts} +24 -6
  265. package/dist/{types-Dnemwd77.d.ts → types-DpWfQdSh.d.ts} +5 -1
  266. package/dist/{types-Bvc4oWT6.d.ts → types-DvupZE0w.d.ts} +1 -1
  267. package/dist/unplugin/index.d.ts +1 -1
  268. package/dist/unplugin/index.js +1 -1
  269. package/dist/{usage-GTixvDDU.js → usage-4G6t643F.js} +2 -2
  270. package/dist/{usage-ItS7nLcl.js → usage-CG9nOYZw.js} +7 -7
  271. package/dist/usage-iFLJ0-rr.js +2 -0
  272. package/dist/{validation-error-Ba264OaJ.d.ts → validation-error-BSSw0l_8.d.ts} +1 -1
  273. package/dist/{validation-error-CnjZ4t92.js → validation-error-ZfUHbKvf.js} +1 -1
  274. package/dist/validity-dVrUEPJt.js +62 -0
  275. package/dist/{verifier-BxBo6I44.js → verifier-DMr_Zmb_.js} +51 -15
  276. package/dist/{rls-verify-CVQTHTh5.js → verify-BztUB3GX.js} +668 -239
  277. package/dist/{version-BvacVTZR.js → version-BEogC-rB.js} +1 -1
  278. package/dist/{views-Soe7bGSC.js → views-CJsrBS1f.js} +23 -1
  279. package/dist/{vocabulary-DA8a8zif.d.ts → vocabulary-hhEFLFoL.d.ts} +15 -6
  280. package/dist/vue/index.d.ts +24 -19
  281. package/dist/vue/index.js +24 -8
  282. package/dist/watch-C8TpsAl4.js +2 -0
  283. package/dist/{watch-DVBJ9cBq.js → watch-zeucB7eF.js} +6 -6
  284. package/dist/webmcp/index.d.ts +2 -2
  285. package/dist/webmcp/index.js +13 -37
  286. package/dist/wrap-Cr93qqdP.d.ts +14 -0
  287. package/dist/wrap-DWsU_5Bd.js +26 -0
  288. package/package.json +8 -8
  289. package/schemas/catalog-v1.json +6 -0
  290. package/skills/permdock-credentials/SKILL.md +1 -1
  291. package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
  292. package/skills/permdock-data/references/queries-and-rls.md +4 -0
  293. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +1 -0
  294. package/skills/permdock-wire/SKILL.md +2 -2
  295. package/skills/permdock-wire/references/adapters.md +9 -1
  296. package/skills/permdock-wire/references/policy-options.md +10 -1
  297. package/dist/catalog-CRW5Mx_B.js +0 -2
  298. package/dist/collect-DSWOk19R.js +0 -2
  299. package/dist/create-CMwIl-w2.js +0 -253
  300. package/dist/delegation-D8pUEuce.js +0 -103
  301. package/dist/doctor-collect-CHk6XWOA.js +0 -665
  302. package/dist/doctor-igIiM_Hl.js +0 -1194
  303. package/dist/evaluation-items-CfCCejQd.js +0 -40
  304. package/dist/fields-BMl1RxoX.js +0 -26
  305. package/dist/grantee-Cv5Sogfv.js +0 -602
  306. package/dist/hosted-DJQw46hn.js +0 -266
  307. package/dist/instance-options-Dhhcnm3y.js +0 -22
  308. package/dist/load-DwJUafYN.js +0 -2
  309. package/dist/map-AcxK9o_D.js +0 -147
  310. package/dist/permissions-DVoF6dMt.js +0 -662
  311. package/dist/powersync-e_AZrKbg.js +0 -2
  312. package/dist/protected-xAr24FEC.d.ts +0 -40
  313. package/dist/relations-cjOL01hZ.js +0 -505
  314. package/dist/rls-graph-CHwx0V8q.js +0 -435
  315. package/dist/rls-shared-Cewd_-zI.js +0 -495
  316. package/dist/store-jOBYpiXC.d.ts +0 -36
  317. package/dist/stores-C0IMQrGI.d.ts +0 -52
  318. package/dist/supabase-config-BpPXt3x1.js +0 -472
  319. package/dist/supabase-hook-6sYLXg_u.js +0 -2
  320. package/dist/thenable-okc2xDsj.js +0 -10
  321. package/dist/types-CKNSyIf_.d.ts +0 -52
  322. package/dist/usage-DorAJiU_.js +0 -2
  323. package/dist/watch-BwxLTYMZ.js +0 -2
@@ -26,6 +26,39 @@ function parsedBody(body, headers) {
26
26
  if (!headers.has("content-type")) headers.set("content-type", "application/json");
27
27
  return JSON.stringify(body);
28
28
  }
29
+ /**
30
+ * A Fetch `Request` for a framework request. A `GET` or `HEAD` carries no
31
+ * body; otherwise the body the framework parsed, or else `stream()`.
32
+ */
33
+ function fetchRequest(url, method, headers, body, stream) {
34
+ if (method === "GET" || method === "HEAD") return new Request(url, {
35
+ method,
36
+ headers
37
+ });
38
+ const parsed = parsedBody(body, headers);
39
+ if (parsed !== void 0) return new Request(url, {
40
+ method,
41
+ headers,
42
+ body: parsed
43
+ });
44
+ if (stream === void 0) return new Request(url, {
45
+ method,
46
+ headers
47
+ });
48
+ const init = {
49
+ method,
50
+ headers,
51
+ body: stream(),
52
+ duplex: "half"
53
+ };
54
+ return new Request(url, init);
55
+ }
56
+ /** Writes `response` to a Fastify-style reply. */
57
+ async function writeReply(reply, response) {
58
+ reply.code(response.status);
59
+ for (const [key, value] of response.headers.entries()) reply.header(key, value);
60
+ await reply.send(await response.text());
61
+ }
29
62
  /** The Fetch `Request` an RPC context carries as `request` or `req`. */
30
63
  function requestFromContext(context) {
31
64
  if ("request" in context && context.request instanceof Request) return context.request;
@@ -33,7 +66,7 @@ function requestFromContext(context) {
33
66
  }
34
67
  /** Whether the caller sent credentials, which turns a `401` into a `WWW-Authenticate` challenge. */
35
68
  function hasCredentials(request) {
36
- return request.headers.has("authorization");
69
+ return request instanceof Request ? request.headers.has("authorization") : request.headers.authorization !== void 0;
37
70
  }
38
71
  /** The Problem Details `detail` of `cause`, or `fallback` when it has none. */
39
72
  function problemMessage(cause, fallback) {
@@ -41,4 +74,4 @@ function problemMessage(cause, fallback) {
41
74
  return fallback;
42
75
  }
43
76
  //#endregion
44
- export { problemMessage as a, parsedBody as i, hasCredentials as n, requestFromContext as o, headersFrom as r, firstHeader as t };
77
+ export { parsedBody as a, writeReply as c, headersFrom as i, firstHeader as n, problemMessage as o, hasCredentials as r, requestFromContext as s, fetchRequest as t };
@@ -1,31 +1,9 @@
1
- import { i as parsedBody, r as headersFrom, t as firstHeader } from "./http-SO7qGttf.js";
1
+ import { i as headersFrom, n as firstHeader, t as fetchRequest } from "./http-BBoKefeS.js";
2
2
  //#region src/node/http.ts
3
3
  function toRequest(req, stream = req) {
4
4
  const host = firstHeader(req.headers.host) ?? "localhost";
5
5
  const url = `${req.protocol ?? "http"}://${host}${req.originalUrl ?? req.url ?? "/"}`;
6
- const headers = headersFrom(req.headers);
7
- const method = req.method ?? "GET";
8
- if (method === "GET" || method === "HEAD") return new Request(url, {
9
- method,
10
- headers
11
- });
12
- const parsed = parsedBody(req.body, headers);
13
- if (parsed !== void 0) return new Request(url, {
14
- method,
15
- headers,
16
- body: parsed
17
- });
18
- if (stream === null) return new Request(url, {
19
- method,
20
- headers
21
- });
22
- const init = {
23
- method,
24
- headers,
25
- body: incomingBody(stream),
26
- duplex: "half"
27
- };
28
- return new Request(url, init);
6
+ return fetchRequest(url, req.method ?? "GET", headersFrom(req.headers), req.body, stream === null ? void 0 : () => incomingBody(stream));
29
7
  }
30
8
  function chunkOf(chunk) {
31
9
  return typeof chunk === "string" ? Buffer.from(chunk) : new Uint8Array(chunk);
@@ -1,15 +1,18 @@
1
+ import { r as isRecord } from "./compact-CAf557ZB.js";
1
2
  import { o as usageResult } from "./errors-CWfoNg9N.js";
2
- import { i as quoteSqlLiteral, n as escapeSqlIdent } from "./sql-xdg5f4Fi.js";
3
- import { V as parseMembershipsFlag, r as HELPERS } from "./rls-shared-Cewd_-zI.js";
4
- import { t as FIELD_VIEWS, w as connectPg } from "./rls-fields-74oZPXWL.js";
5
- import { n as emptySchema, r as isSchemaKind, t as emitPermissionsModule } from "./generate-CH7ThJ14.js";
6
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
- import { dirname, resolve } from "node:path";
3
+ import { s as writeFileEnsuringDir } from "./files-D_JIzUrP.js";
4
+ import { n as escapeSqlIdent, o as quoteSqlLiteral } from "./sql-t8teWOfo.js";
5
+ import { C as parseMembershipsFlag, r as HELPERS } from "./shared-1uhI-e-b.js";
6
+ import { Z as pgConnector } from "./permission-keys-B26jeyUv.js";
7
+ import { t as FIELD_VIEWS } from "./fields-fwfXN01n.js";
8
+ import { n as emptySchema, r as isSchemaKind, t as emitPermissionsModule } from "./generate-CNU1pIOo.js";
9
+ import { existsSync, readFileSync } from "node:fs";
10
+ import { resolve } from "node:path";
8
11
  import { createHash } from "node:crypto";
9
12
  import { deparse, parse } from "pgsql-parser";
10
- //#region src/cli/rls-import-ast.ts
13
+ //#region src/cli/rls/import-nodes.ts
11
14
  function asNode$1(value) {
12
- if (value !== null && typeof value === "object" && !Array.isArray(value)) return value;
15
+ return isRecord(value) ? value : void 0;
13
16
  }
14
17
  function stringVal(value) {
15
18
  const node = asNode$1(value);
@@ -158,6 +161,29 @@ async function fingerprintSql(sql) {
158
161
  return createHash("sha256").update(sql.replaceAll(/\s+/g, " ").trim().toLowerCase()).digest("hex").slice(0, 16);
159
162
  }
160
163
  }
164
+ function nodeStmt(first) {
165
+ const raw = asNode$1(first?.["RawStmt"]);
166
+ if (raw !== void 0) return raw["stmt"];
167
+ return first?.["stmt"];
168
+ }
169
+ function jwtClaim(value) {
170
+ const node = asNode$1(unwrap(value));
171
+ const expr = asNode$1(node?.["A_Expr"]);
172
+ if (expr === void 0) return;
173
+ const name = operatorName(node);
174
+ if (name !== "->>" && name !== "->" || !isJwtCall(expr["lexpr"])) return;
175
+ const claim = constValue(expr["rexpr"]);
176
+ return typeof claim === "string" ? claim : void 0;
177
+ }
178
+ /** `auth.jwt()` / `auth.session()`, bare or as a scalar `(select …)`; a column's `->>` is row data, not a claim. */
179
+ function isJwtCall(value) {
180
+ const inner = scalarSubselect(value);
181
+ if (inner !== void 0) return isJwtCall(inner);
182
+ const name = funcName(value);
183
+ return name === "auth.jwt" || name === "auth.session";
184
+ }
185
+ //#endregion
186
+ //#region src/cli/rls/import-ast.ts
161
187
  async function conditionFromAst(sql, memberships, functions, unmapped, joins = [], seeds = []) {
162
188
  if (sql === void 0 || sql.trim() === "" || sql.trim() === "true") return {
163
189
  op: "eq",
@@ -338,58 +364,6 @@ async function helperGrants(sql, memberships, functions, seeds) {
338
364
  }
339
365
  return grants;
340
366
  }
341
- const SEED_COLUMNS = [
342
- "role",
343
- "permission",
344
- "grant_key",
345
- "scope",
346
- "effect"
347
- ];
348
- function asScope(value) {
349
- return typeof value === "string" && /^[a-z][a-z0-9_]*$/u.test(value) ? value : void 0;
350
- }
351
- function seedFromRow(row) {
352
- const scope = asScope(row["scope"]);
353
- if (typeof row["role"] !== "string" || typeof row["permission"] !== "string" || typeof row["grant_key"] !== "string" || scope === void 0) return;
354
- return {
355
- role: row["role"],
356
- permission: row["permission"],
357
- grantKey: row["grant_key"],
358
- scope,
359
- effect: row["effect"] === "deny" ? "deny" : "allow"
360
- };
361
- }
362
- /** `role_permissions` rows from the `insert ... values` statements of a SQL dump. */
363
- async function seedsFromSql(sql) {
364
- let parsed;
365
- try {
366
- parsed = await parse(sql);
367
- } catch {
368
- return [];
369
- }
370
- const seeds = [];
371
- for (const item of asStmts(parsed)) {
372
- const insert = asNode$1(asNode$1(nodeStmt(asNode$1(item)))?.["InsertStmt"]);
373
- if (asNode$1(insert?.["relation"])?.["relname"] !== "role_permissions") continue;
374
- const cols = Array.isArray(insert?.["cols"]) ? insert["cols"].map((col) => asNode$1(asNode$1(col)?.["ResTarget"])?.["name"]) : [];
375
- const values = asNode$1(asNode$1(insert?.["selectStmt"])?.["SelectStmt"])?.["valuesLists"];
376
- if (!Array.isArray(values)) continue;
377
- for (const list of values) {
378
- const items = asNode$1(asNode$1(list)?.["List"])?.["items"];
379
- if (!Array.isArray(items)) continue;
380
- const row = {};
381
- for (const [index, col] of cols.entries()) if (typeof col === "string" && SEED_COLUMNS.includes(col)) row[col] = constValue(items[index]);
382
- const seed = seedFromRow(row);
383
- if (seed !== void 0) seeds.push(seed);
384
- }
385
- }
386
- return seeds;
387
- }
388
- function nodeStmt(first) {
389
- const raw = asNode$1(first?.["RawStmt"]);
390
- if (raw !== void 0) return raw["stmt"];
391
- return first?.["stmt"];
392
- }
393
367
  function mapNode(value, ctx) {
394
368
  if (value === void 0) return;
395
369
  const node = asNode$1(unwrap(value));
@@ -505,26 +479,59 @@ function mapNode(value, ctx) {
505
479
  };
506
480
  }
507
481
  }
508
- function jwtClaim(value) {
509
- const node = asNode$1(unwrap(value));
510
- const expr = asNode$1(node?.["A_Expr"]);
511
- if (expr === void 0) return;
512
- const name = operatorName(node);
513
- if (name !== "->>" && name !== "->" || !isJwtCall(expr["lexpr"])) return;
514
- const claim = constValue(expr["rexpr"]);
515
- return typeof claim === "string" ? claim : void 0;
482
+ //#endregion
483
+ //#region src/cli/rls/import-seeds.ts
484
+ const SEED_COLUMNS = [
485
+ "role",
486
+ "permission",
487
+ "grant_key",
488
+ "scope",
489
+ "effect"
490
+ ];
491
+ function asScope(value) {
492
+ return typeof value === "string" && /^[a-z][a-z0-9_]*$/u.test(value) ? value : void 0;
516
493
  }
517
- /** `auth.jwt()` / `auth.session()`, bare or as a scalar `(select …)`; a column's `->>` is row data, not a claim. */
518
- function isJwtCall(value) {
519
- const inner = scalarSubselect(value);
520
- if (inner !== void 0) return isJwtCall(inner);
521
- const name = funcName(value);
522
- return name === "auth.jwt" || name === "auth.session";
494
+ function seedFromRow(row) {
495
+ const scope = asScope(row["scope"]);
496
+ if (typeof row["role"] !== "string" || typeof row["permission"] !== "string" || typeof row["grant_key"] !== "string" || scope === void 0) return;
497
+ return {
498
+ role: row["role"],
499
+ permission: row["permission"],
500
+ grantKey: row["grant_key"],
501
+ scope,
502
+ effect: row["effect"] === "deny" ? "deny" : "allow"
503
+ };
504
+ }
505
+ /** `role_permissions` rows from the `insert ... values` statements of a SQL dump. */
506
+ async function seedsFromSql(sql) {
507
+ let parsed;
508
+ try {
509
+ parsed = await parse(sql);
510
+ } catch {
511
+ return [];
512
+ }
513
+ const seeds = [];
514
+ for (const item of asStmts(parsed)) {
515
+ const insert = asNode$1(asNode$1(nodeStmt(asNode$1(item)))?.["InsertStmt"]);
516
+ if (asNode$1(insert?.["relation"])?.["relname"] !== "role_permissions") continue;
517
+ const cols = Array.isArray(insert?.["cols"]) ? insert["cols"].map((col) => asNode$1(asNode$1(col)?.["ResTarget"])?.["name"]) : [];
518
+ const values = asNode$1(asNode$1(insert?.["selectStmt"])?.["SelectStmt"])?.["valuesLists"];
519
+ if (!Array.isArray(values)) continue;
520
+ for (const list of values) {
521
+ const items = asNode$1(asNode$1(list)?.["List"])?.["items"];
522
+ if (!Array.isArray(items)) continue;
523
+ const row = {};
524
+ for (const [index, col] of cols.entries()) if (typeof col === "string" && SEED_COLUMNS.includes(col)) row[col] = constValue(items[index]);
525
+ const seed = seedFromRow(row);
526
+ if (seed !== void 0) seeds.push(seed);
527
+ }
528
+ }
529
+ return seeds;
523
530
  }
524
531
  //#endregion
525
- //#region src/cli/rls-import-views.ts
532
+ //#region src/cli/rls/import-views.ts
526
533
  function asNode(value) {
527
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
534
+ return isRecord(value) ? value : void 0;
528
535
  }
529
536
  function list(value) {
530
537
  return Array.isArray(value) ? value : [];
@@ -708,7 +715,7 @@ async function viewsSqlFromDb(query) {
708
715
  }).join("\n");
709
716
  }
710
717
  //#endregion
711
- //#region src/cli/rls-import.ts
718
+ //#region src/cli/rls/import.ts
712
719
  const POLICY_RE = /create\s+policy\s+"?([A-Za-z0-9_]+)"?\s+on\s+"?([A-Za-z0-9_]+)"?([\s\S]*?);/gi;
713
720
  function extractParenClause(sql, keyword) {
714
721
  const match = new RegExp(`\\b${keyword}\\s*\\(`, "i").exec(sql);
@@ -876,7 +883,7 @@ async function runRlsImport(input) {
876
883
  policies = splitPolicies(await canonicalDump(sql) ?? sql);
877
884
  if (policies.length === 0) policies = splitPolicies(sql);
878
885
  } else if (input.db !== void 0) try {
879
- const fromDb = await policiesFromDb(input.db, input.connect ?? ((db) => connectPg(db, "permdock rls import --db")));
886
+ const fromDb = await policiesFromDb(input.db, input.connect ?? pgConnector("permdock rls import --db"));
880
887
  policies = fromDb.policies;
881
888
  bodies = fromDb.bodies;
882
889
  seeds = fromDb.seeds;
@@ -911,8 +918,7 @@ async function runRlsImport(input) {
911
918
  const fieldViews = viewsSql === "" ? [] : await fieldViewsFromSql(viewsSql, memberships, functions, seeds);
912
919
  const outRel = input.out ?? "src/permissions.generated.ts";
913
920
  const outPath = resolve(input.cwd, outRel);
914
- mkdirSync(dirname(outPath), { recursive: true });
915
- writeFileSync(outPath, emitGenerated(catalog, fieldViews, input.schema));
921
+ writeFileEnsuringDir(outPath, emitGenerated(catalog, fieldViews, input.schema));
916
922
  const hints = [
917
923
  ...uniqueHints([...new Set(unmapped)], bodies),
918
924
  ...[...new Set(joins)].map(membershipHint),
@@ -1,6 +1,8 @@
1
- import { t as validateOpenapi } from "./openapi-schema--ARjyfQr.js";
1
+ import { t as validateOpenapi } from "./schema-Bol6gqXA.js";
2
+ import { r as isRecord } from "./compact-CAf557ZB.js";
2
3
  import { t as byCodePoint } from "./compare-pfyVnBjE.js";
3
- import { i as schemaExpression, t as emitPermissionsModule } from "./generate-CH7ThJ14.js";
4
+ import { i as readJsonFile } from "./files-D_JIzUrP.js";
5
+ import { i as schemaExpression, t as emitPermissionsModule } from "./generate-CNU1pIOo.js";
4
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
7
  import { dirname, resolve } from "node:path";
6
8
  //#region ../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js
@@ -5635,7 +5637,7 @@ function parseDocument(source, options = {}) {
5635
5637
  return doc;
5636
5638
  }
5637
5639
  //#endregion
5638
- //#region src/cli/openapi-import.ts
5640
+ //#region src/cli/openapi/import.ts
5639
5641
  const METHODS = [
5640
5642
  "get",
5641
5643
  "put",
@@ -5653,9 +5655,6 @@ const UNSAFE_SEGMENTS = /* @__PURE__ */ new Set([
5653
5655
  "prototype"
5654
5656
  ]);
5655
5657
  const SEGMENT = /^[A-Za-z_$][A-Za-z0-9_$-]*$/u;
5656
- function isRecord(value) {
5657
- return value !== null && typeof value === "object" && !Array.isArray(value);
5658
- }
5659
5658
  function operations(document) {
5660
5659
  const paths = isRecord(document["paths"]) ? document["paths"] : {};
5661
5660
  const out = [];
@@ -5801,7 +5800,7 @@ function readMap(cwd, file) {
5801
5800
  if (!existsSync(path)) return `--map file not found: ${file}`;
5802
5801
  let parsed;
5803
5802
  try {
5804
- parsed = JSON.parse(readFileSync(path, "utf8"));
5803
+ parsed = readJsonFile(path);
5805
5804
  } catch {
5806
5805
  return "--map must be a JSON object";
5807
5806
  }
@@ -1,4 +1,4 @@
1
- import { Ft as TokenVerifier, at as DecisionSink, gt as MembershipSource } from "./policy-IB6yxpC3.js";
1
+ import { W as DecisionSink, Z as MembershipSource, ut as TokenVerifier } from "./policy-types-sp9P1iIV.js";
2
2
  import { n as RevocationFeed } from "./revocations-Cy06JNx2.js";
3
3
  //#region src/scim/types.d.ts
4
4
  declare const SCIM_CONTENT_TYPE = "application/scim+json";
@@ -1,5 +1,5 @@
1
- import { C as Policy, Nr as Principal } from "./policy-IB6yxpC3.js";
2
- import { C as SsfPermDock, w as SsfPermDockOptions } from "./types-Cq_H8N_X.js";
1
+ import { E as Policy, Or as Principal } from "./policy-types-sp9P1iIV.js";
2
+ import { C as SsfPermDock, w as SsfPermDockOptions } from "./types-C0dee0Qf.js";
3
3
  //#region src/ssf/create.d.ts
4
4
  declare function createPermDock<TUser, TPrincipal extends Principal = Principal>(policy: Policy<TUser, TPrincipal>, options: SsfPermDockOptions): SsfPermDock;
5
5
  //#endregion
@@ -1,6 +1,6 @@
1
- import { Mr as Membership, Pr as Subject, Pt as TokenSigner, Yn as Decision, bt as RelationSource, ln as PermDock } from "./policy-IB6yxpC3.js";
2
- import { f as Permission, m as PermissionTree } from "./permissions-DttnqqxC.js";
3
- import { a as ApprovalListFilter, c as ApprovalRequest, f as ApprovalStore, i as ApprovalInspectResult, m as ApprovalVerdict, o as ApprovalListQuery, r as ApprovalCancelMeta, s as ApprovalPage } from "./types-aqOHTHcp.js";
1
+ import { Dr as Membership, ir as Decision, jt as PermDock, kr as Subject, lt as TokenSigner, tt as RelationSource } from "./policy-types-sp9P1iIV.js";
2
+ import { d as Permission, p as PermissionTree } from "./permission-types-Dg39z9Kv.js";
3
+ import { a as ApprovalListFilter, c as ApprovalRequest, f as ApprovalStore, i as ApprovalInspectResult, m as ApprovalVerdict, o as ApprovalListQuery, r as ApprovalCancelMeta, s as ApprovalPage } from "./types-Br9IXUBG.js";
4
4
  //#region src/approvals/errors.d.ts
5
5
  type ApprovalErrorCode = "approval-not-found" | "approval-not-pending" | "approval-expired" | "approver-unauthenticated" | "approver-is-actor" | "approver-is-principal" | "approver-not-eligible" | "approver-repeated";
6
6
  declare class ApprovalError extends Error {
@@ -1,5 +1,15 @@
1
- import { $ as AccessEvent, C as Policy, D as PolicyVocabulary, Dr as CustomRole, Gr as SqlFunctionArg, Kr as SqlFunctionCondition, Lr as ConditionRef, Mr as Membership, Nr as Principal, Pr as Subject, Tt as Snapshot, Vr as OpaqueCondition, Zn as DenialReason, bt as RelationSource, dt as LimitStore, gt as MembershipSource, h as Grant, kr as Delegation, ln as PermDock, pt as LocalSnapshotManifest, rt as DecisionEvent, st as EntitlementSource, w as PolicyDelegation, xt as RoleSource } from "./policy-IB6yxpC3.js";
2
- import { C as ResourceRelationInput, f as Permission, m as PermissionTree, n as ActionMeta, t as ActionList, w as ResourceRestricted, x as ResourceParent } from "./permissions-DttnqqxC.js";
1
+ import { Br as SqlFunctionArg, Dr as Membership, E as Policy, G as EntitlementSource, I as SeparationConflict, Ir as OpaqueCondition, Mr as ConditionRef, N as RoleBinding, O as PolicyDelegation, Or as Principal, P as RoleOptions, Sr as CustomRole, V as VocabularyFromInput, Vr as SqlFunctionCondition, Y as LimitStore, Z as MembershipSource, _ as GrantCondition, an as Snapshot, at as SnapshotSource, g as Grant, i as ApprovalOption, in as LocalSnapshotManifest, it as SettingsSource, j as PolicyVocabulary, jt as PermDock, kr as Subject, mn as PolicyScopesInput, nt as RoleSource, p as DefinePolicyOptions, s as AssuranceRequirement, sr as DenialReason, st as TenantSettings, tt as RelationSource, vn as AccessEvent, w as MembershipFixture, wr as Delegation, xn as DecisionEvent } from "./policy-types-sp9P1iIV.js";
2
+ import { C as ResourceRelationInput, T as ResourceXTree, b as ResourceOptions, d as Permission, f as PermissionKind, h as ResourceInit, i as DefinePermissionsOptions, n as ActionMeta, p as PermissionTree, t as ActionList, u as InferPermissionTree, v as ResourceMeta, w as ResourceRestricted, x as ResourceParent, y as ResourceNode } from "./permission-types-Dg39z9Kv.js";
3
+ import { r as Role } from "./vocabulary-hhEFLFoL.js";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+ //#region src/conditions/refs.d.ts
6
+ type KnownRefField = "id" | "issuer" | "kind" | "tenant" | "team" | "roles" | "plans" | "memberships" | "assurance" | "binding" | "session";
7
+ type SubjectRef = ConditionRef & { readonly [K in KnownRefField]: SubjectRef; } & {
8
+ readonly [key: string]: SubjectRef;
9
+ };
10
+ declare const principal: SubjectRef;
11
+ declare const context: SubjectRef;
12
+ //#endregion
3
13
  //#region src/core/custom-roles.d.ts
4
14
  type CustomRoleDropReason = "unknown-permission" | "outside-ceiling" | "condition-not-allowed" | "unknown-level";
5
15
  /** Why part of a custom role was left out: a permission, or an undeclared include. */
@@ -50,32 +60,6 @@ declare function validateCustomRole(policy: Policy, role: CustomRole): CustomRol
50
60
  */
51
61
  declare function customRoleClaim(roles: readonly CustomRole[], policy?: Policy): Readonly<Record<string, readonly string[]>>;
52
62
  //#endregion
53
- //#region src/core/relations.d.ts
54
- type MemoryEdge = {
55
- /** The object's id. */
56
- readonly id: string;
57
- readonly principal: string;
58
- readonly startsAt?: number;
59
- readonly expiresAt?: number;
60
- };
61
- type MemoryRelationsData = {
62
- /** Rows per resource: parent pointers, links, restricted flags and relation columns are read from them. */
63
- readonly rows?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
64
- /** Edge-table rows per resource and relation. */
65
- readonly edges?: Readonly<Record<string, Readonly<Record<string, readonly MemoryEdge[]>>>>;
66
- /**
67
- * Edge tables as the database holds them, keyed by `edge` name: each row
68
- * is read through the relation's `object`, `subject`, `expiresAt`, `match`
69
- * and `groups` columns. A relation whose table is here ignores `edges`.
70
- */
71
- readonly tables?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
72
- };
73
- /**
74
- * An in-process `RelationSource` over plain rows and edges, read against the
75
- * resource definitions in `permissions`. For tests, fixtures and small apps.
76
- */
77
- declare function memoryRelations(permissions: PermissionTree, data?: MemoryRelationsData): RelationSource;
78
- //#endregion
79
63
  //#region src/core/snapshot.d.ts
80
64
  declare function parseSnapshot(json: unknown): Snapshot;
81
65
  //#endregion
@@ -86,17 +70,13 @@ declare function fromSnapshot(snapshot: Snapshot, options?: {
86
70
  }): PermDock;
87
71
  declare function emptySnapshot(): Snapshot;
88
72
  //#endregion
89
- //#region src/conditions/refs.d.ts
90
- type KnownRefField = "id" | "issuer" | "kind" | "tenant" | "team" | "roles" | "plans" | "memberships" | "assurance" | "binding" | "session";
91
- type SubjectRef = ConditionRef & { readonly [K in KnownRefField]: SubjectRef; } & {
92
- readonly [key: string]: SubjectRef;
93
- };
94
- declare const principal: SubjectRef;
95
- declare const context: SubjectRef;
96
- //#endregion
97
73
  //#region src/core/approval-required.d.ts
98
74
  declare function requiresApproval(approval: Grant["approval"] | undefined): boolean;
99
75
  //#endregion
76
+ //#region src/core/policy.d.ts
77
+ declare function definePolicy<TUser, TPrincipal extends Principal, const Input extends PermissionTree | PolicyVocabulary, const S extends PolicyScopesInput = PolicyScopesInput>(permissions: Input, options: DefinePolicyOptions<TUser, TPrincipal, S>): Policy<TUser, TPrincipal, VocabularyFromInput<Input>>;
78
+ declare function separationConflicts(policy: Policy, memberships: readonly MembershipFixture[]): readonly SeparationConflict[];
79
+ //#endregion
100
80
  //#region src/conditions/opaque.d.ts
101
81
  declare function opaque(input: {
102
82
  readonly sql: string;
@@ -109,6 +89,17 @@ declare function sqlFunction(name: string, options: {
109
89
  readonly twin: unknown;
110
90
  }): SqlFunctionCondition;
111
91
  //#endregion
92
+ //#region src/core/memory-sources.d.ts
93
+ declare function memoryEntitlementSource(entries: Readonly<Record<string, readonly string[]>>): EntitlementSource;
94
+ declare function memorySettings(settings: Readonly<Record<string, TenantSettings>>): SettingsSource;
95
+ /** Memberships keyed by principal id; `tenant` is not a filter, as for a database source. */
96
+ declare function memoryMembershipSource(entries: Readonly<Record<string, readonly Membership[]>>): MembershipSource;
97
+ /** A snapshot held in memory; `set` replaces it and notifies every subscriber. */
98
+ declare function memorySnapshotSource(initial: Snapshot | string): SnapshotSource & {
99
+ set(snapshot: Snapshot | string): void;
100
+ };
101
+ declare function memoryRoleSource(customRoles: readonly CustomRole[]): RoleSource;
102
+ //#endregion
112
103
  //#region src/core/memberships.d.ts
113
104
  /**
114
105
  * One `MembershipSource` over several: memberships are merged and
@@ -182,6 +173,32 @@ declare function memoryLimitStore(): LimitStore & {
182
173
  size(): number;
183
174
  };
184
175
  //#endregion
176
+ //#region src/core/memory-relations.d.ts
177
+ type MemoryEdge = {
178
+ /** The object's id. */
179
+ readonly id: string;
180
+ readonly principal: string;
181
+ readonly startsAt?: number;
182
+ readonly expiresAt?: number;
183
+ };
184
+ type MemoryRelationsData = {
185
+ /** Rows per resource: parent pointers, links, restricted flags and relation columns are read from them. */
186
+ readonly rows?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
187
+ /** Edge-table rows per resource and relation. */
188
+ readonly edges?: Readonly<Record<string, Readonly<Record<string, readonly MemoryEdge[]>>>>;
189
+ /**
190
+ * Edge tables as the database holds them, keyed by `edge` name: each row
191
+ * is read through the relation's `object`, `subject`, `expiresAt`, `match`
192
+ * and `groups` columns. A relation whose table is here ignores `edges`.
193
+ */
194
+ readonly tables?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
195
+ };
196
+ /**
197
+ * An in-process `RelationSource` over plain rows and edges, read against the
198
+ * resource definitions in `permissions`. For tests, fixtures and small apps.
199
+ */
200
+ declare function memoryRelations(permissions: PermissionTree, data?: MemoryRelationsData): RelationSource;
201
+ //#endregion
185
202
  //#region src/core/local-manifest.d.ts
186
203
  /**
187
204
  * What the policy grants, as JSON a device turns into snapshots from its own
@@ -253,7 +270,7 @@ type CustomRoleSourceOptions = {
253
270
  */
254
271
  declare function customRoleSource(reader: CustomRoleReader, options?: CustomRoleSourceOptions): RoleSource;
255
272
  //#endregion
256
- //#region src/core/instance.d.ts
273
+ //#region src/core/instance-snapshot.d.ts
257
274
  type SnapshotInclude = readonly (Permission | {
258
275
  readonly [key: string]: unknown;
259
276
  })[];
@@ -283,6 +300,33 @@ type SnapshotForOptions = {
283
300
  */
284
301
  declare function snapshotFor<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, user: TUser | Subject | null, options?: SnapshotForOptions): Snapshot;
285
302
  //#endregion
303
+ //#region src/core/permissions.d.ts
304
+ declare function definePermissions<const Input, PX = never, RX = never>(input: Input, options?: DefinePermissionsOptions<PX, RX>): InferPermissionTree<Input, "", PX> & ResourceXTree<RX>;
305
+ //#endregion
306
+ //#region src/core/permission-registry.d.ts
307
+ declare function getResource<RX = never>(tree: PermissionTree & ResourceXTree<RX>, name: string): ([RX] extends [never] ? ResourceNode : ResourceNode & {
308
+ readonly meta?: ResourceMeta<Readonly<RX>>;
309
+ }) | undefined;
310
+ declare function listPermissions(tree: PermissionTree | Permission): readonly Permission[];
311
+ declare function findPermission(tree: PermissionTree, keyOrScope: string): Permission | undefined;
312
+ /**
313
+ * A permission leaf: string `key`, `scope`, `resource` and `action` plus an
314
+ * object `meta`. `kind` is non-enumerable and does not survive
315
+ * `JSON.stringify`, so a leaf that crossed a serialisation boundary passes
316
+ * without it; when present it must be `instance` or `collection`.
317
+ */
318
+ declare function isPermission(value: unknown): value is Permission;
319
+ declare function mergePermissions<const Trees extends readonly PermissionTree[]>(...trees: Trees): PermissionTree;
320
+ //#endregion
321
+ //#region src/core/permission-leaf.d.ts
322
+ /**
323
+ * The keys `permission` was renamed from, sorted. Empty for a leaf without
324
+ * renames and for one that crossed a serialisation boundary.
325
+ */
326
+ declare function formerKeys(permission: object): readonly string[];
327
+ declare function resource<T, const A extends ActionList = readonly [], const C extends ActionList = readonly []>(schema: StandardSchemaV1<unknown, T>, options?: ResourceOptions<A, C>): ResourceInit<T, A, C>;
328
+ declare function resource<const A extends ActionList = readonly [], const C extends ActionList = readonly []>(options: ResourceOptions<A, C>): ResourceInit<unknown, A, C>;
329
+ //#endregion
286
330
  //#region src/core/presets.d.ts
287
331
  type ReadOnlyMeta = {
288
332
  readonly readOnly: true;
@@ -342,6 +386,25 @@ declare function crud<const A extends ActionList | undefined = undefined, const
342
386
  declare function readable<const A extends ActionList | undefined = undefined, const C extends ActionList | undefined = undefined>(options?: PresetOptions<A, C>): PresetResult<typeof READABLE_ACTIONS, typeof READABLE_COLLECTION, A, C>;
343
387
  declare function writable<const A extends ActionList | undefined = undefined, const C extends ActionList | undefined = undefined>(options?: PresetOptions<A, C>): PresetResult<typeof WRITABLE_ACTIONS, typeof WRITABLE_COLLECTION, A, C>;
344
388
  //#endregion
389
+ //#region src/core/role-builder.d.ts
390
+ type RoleGrants = readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[])[];
391
+ /** A role held at a named scope: `on` is checked against `definePolicy({ scopes })`. */
392
+ declare function role<const S extends string>(name: string | Role, grants: RoleGrants, options: RoleOptions<S> & {
393
+ readonly on: S;
394
+ }): RoleBinding<S>;
395
+ /** A global role, or one held on a resource. */
396
+ declare function role(name: string | Role, grants: RoleGrants, options?: RoleOptions<never>): RoleBinding<never>;
397
+ /** Options built at runtime: the scope name is only checked by `definePolicy`. */
398
+ declare function role(name: string | Role, grants: RoleGrants, options?: RoleOptions): RoleBinding;
399
+ declare function normalizeAssurance(input: AssuranceRequirement | undefined): AssuranceRequirement | undefined;
400
+ //#endregion
401
+ //#region src/core/grant-builders.d.ts
402
+ declare function allow<T, K extends PermissionKind = PermissionKind>(permission: Permission<string, T, K> | readonly Permission<string, T, K>[], condition?: GrantCondition<T, K>): Omit<Grant, "role" | "scope"> | Omit<Grant, "role" | "scope">[];
403
+ declare function deny<T, K extends PermissionKind = PermissionKind>(permission: Permission<string, T, K> | readonly Permission<string, T, K>[], condition?: GrantCondition<T, K>): Omit<Grant, "role" | "scope"> | Omit<Grant, "role" | "scope">[];
404
+ //#endregion
405
+ //#region src/core/approval-normalize.d.ts
406
+ declare function normalizeApproval(approval: ApprovalOption | undefined, permission?: string): Grant["approval"];
407
+ //#endregion
345
408
  //#region src/core/duration.d.ts
346
409
  declare function parseDuration(input: unknown): number | undefined;
347
410
  //#endregion
@@ -392,6 +455,10 @@ type OcsfAuthorizeSession = {
392
455
  readonly source: DecisionEvent["source"];
393
456
  readonly phase?: DecisionEvent["phase"];
394
457
  readonly role?: string | null;
458
+ /** The matched grant's declared `name`. */
459
+ readonly grant?: string;
460
+ /** The names of the app obligations the decision carries. */
461
+ readonly obligations?: readonly string[];
395
462
  readonly via?: string | null;
396
463
  /** Set high-severity break-glass events apart in a SIEM. */
397
464
  readonly breakGlass?: true;
@@ -480,4 +547,4 @@ declare function coveredByDelegation(permission: DelegatedPermission, delegation
480
547
  */
481
548
  declare function delegatedPermissions(delegations: readonly PolicyDelegation[] | undefined, subject: Subject, heldRoles: ReadonlySet<string>, now: number): ReadonlySet<string> | undefined;
482
549
  //#endregion
483
- export { countHolders as A, MemoryEdge as B, mayAccess as C, fromStripeEntitlements as D, StripeEntitlementsClient as E, context as F, CustomRoleRename as G, memoryRelations as H, principal as I, customRoleClaim as J, CustomRoleValidation as K, emptySnapshot as L, sqlFunction as M, opaque as N, claimsFirst as O, requiresApproval as P, fromSnapshot as R, permittedIds as S, memoryLimitStore as T, CustomRoleDrop as U, MemoryRelationsData as V, CustomRoleDropReason as W, validateCustomRole as X, resolveCustomRole as Y, CustomRoleReader as _, toCsvRow as a, PermittedIdsOptions as b, OcsfAuthorizeSession as c, parseDuration as d, crud as f, snapshotFor as g, SnapshotForOptions as h, CSV_COLUMNS as i, isExternallyManaged as j, composeMemberships as k, accessToOcsf as l, writable as m, delegatedPermissions as n, OCSF_VERSION as o, readable as p, ResolvedCustomRole as q, catalogFingerprint as r, OcsfAccountChange as s, coveredByDelegation as t, toOcsf as u, CustomRoleSourceOptions as v, localSnapshotManifest as w, mayUse as x, customRoleSource as y, parseSnapshot as z };
550
+ export { sqlFunction as $, CustomRoleReader as A, memoryRelations as B, getResource as C, definePermissions as D, mergePermissions as E, permittedIds as F, composeMemberships as G, StripeEntitlementsClient as H, mayAccess as I, memoryEntitlementSource as J, countHolders as K, localSnapshotManifest as L, customRoleSource as M, PermittedIdsOptions as N, SnapshotForOptions as O, mayUse as P, memorySnapshotSource as Q, MemoryEdge as R, findPermission as S, listPermissions as T, fromStripeEntitlements as U, memoryLimitStore as V, claimsFirst as W, memoryRoleSource as X, memoryMembershipSource as Y, memorySettings as Z, crud as _, toCsvRow as a, fromSnapshot as at, formerKeys as b, OcsfAuthorizeSession as c, CustomRoleDropReason as ct, parseDuration as d, ResolvedCustomRole as dt, opaque as et, normalizeApproval as f, customRoleClaim as ft, role as g, principal as gt, normalizeAssurance as h, context as ht, CSV_COLUMNS as i, emptySnapshot as it, CustomRoleSourceOptions as j, snapshotFor as k, accessToOcsf as l, CustomRoleRename as lt, deny as m, validateCustomRole as mt, delegatedPermissions as n, separationConflicts as nt, OCSF_VERSION as o, parseSnapshot as ot, allow as p, resolveCustomRole as pt, isExternallyManaged as q, catalogFingerprint as r, requiresApproval as rt, OcsfAccountChange as s, CustomRoleDrop as st, coveredByDelegation as t, definePolicy as tt, toOcsf as u, CustomRoleValidation as ut, readable as v, isPermission as w, resource as x, writable as y, MemoryRelationsData as z };