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
@@ -1,5 +1,5 @@
1
- import { d as group, p as sqlStatements } from "./supabase-config-BpPXt3x1.js";
2
- //#region src/cli/supautils.ts
1
+ import { i as group, o as sqlStatements } from "./deciding-columns-Sq12mEA6.js";
2
+ //#region src/cli/sql/supautils.ts
3
3
  /** `supautils.reserved_roles` of supabase/postgres 17.11.0.002 (supautils 3.4.4). */
4
4
  const RESERVED_ROLES = /* @__PURE__ */ new Set([
5
5
  "supabase_admin",
@@ -3,7 +3,9 @@
3
3
 
4
4
  import {
5
5
  getStore,
6
+ getUi,
6
7
  scopedFor,
8
+ slotContent,
7
9
  viewFor,
8
10
  type ProtectedProps,
9
11
  } from './runtime.js';
@@ -15,9 +17,11 @@
15
17
  children,
16
18
  pending,
17
19
  fallback,
20
+ approval,
18
21
  }: ProtectedProps = $props();
19
22
 
20
23
  const store = getStore();
24
+ const { defaults } = getUi();
21
25
  let tick = $state(0);
22
26
  onDestroy(
23
27
  store.subscribe(() => {
@@ -29,12 +33,15 @@
29
33
  const generation = tick;
30
34
  return viewFor(store, permission, data, scoped, generation);
31
35
  });
36
+ const own = $derived({ pending, fallback, approval });
32
37
  </script>
33
38
 
34
39
  {#if view.slot === 'pending'}
35
- {@render pending?.()}
40
+ {@render slotContent('pending', own, defaults)?.()}
41
+ {:else if view.slot === 'approval'}
42
+ {@render slotContent('approval', own, defaults)?.(view.decision)}
36
43
  {:else if view.slot === 'fallback'}
37
- {@render fallback?.(view.decision)}
44
+ {@render slotContent('fallback', own, defaults)?.(view.decision)}
38
45
  {:else}
39
46
  {@render children?.(view.decision)}
40
47
  {/if}
@@ -1,13 +1,13 @@
1
- import { n as requiredPlans } from "../problem-details-DX075l9V.js";
2
- import { i as describe } from "../describe-DMYiCjJV.js";
1
+ import { n as requiredPlans } from "../problem-details-rIIo8B2C.js";
2
+ import { i as describe } from "../describe-C3ldA9os.js";
3
3
  import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
4
4
  import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
5
- import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-CKNSyIf_.js";
6
- import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-xAr24FEC.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-C0IMQrGI.js";
5
+ import { a as ClientPermDock, c as PermissionSet, d as SubjectView, f as TenantView, i as ApprovalState, l as PermissionState, o as ClientStatus, p as UseRolesOptions, r as ApprovalHandle, s as FilterResult } from "../store-9KO4BlkB.js";
6
+ import { n as PermDockSvelteOptions, r as ProtectedProps, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-ByUo56un.js";
7
+ import { a as getDescribe, c as permission, d as setPermDock, f as subject, i as filtered, l as permissions, n as assignable, o as getPermDock, p as tenant, r as assignablePermissions, s as memberships, t as approval, u as roles } from "../stores-Cxz_80g-.js";
8
8
  import { Component } from "svelte";
9
9
  //#region src/svelte/index.d.ts
10
10
  export declare const Protected: Component<ProtectedProps>;
11
11
  export declare const PermissionBoundary: Component<PermissionBoundaryProps>;
12
12
  //#endregion
13
- export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockSvelteOptions, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SubjectView, type TenantView, type UseRolesOptions, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
13
+ export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockDefaults, type PermDockSvelteOptions, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SubjectView, type TenantView, type UseRolesOptions, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getDescribe, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
@@ -1,10 +1,11 @@
1
- import { r as requiredPlans } from "../problem-details-_AMOYz-w.js";
2
- import { t as describe } from "../describe-B_gVZEVi.js";
1
+ import { r as requiredPlans } from "../problem-details-DECUnXAn.js";
2
+ import { t as describe } from "../describe-Cgkp7eP0.js";
3
3
  import { t as approvalHeaders } from "../headers-BZSDieNT.js";
4
+ import { l as slotContent } from "../views-CJsrBS1f.js";
4
5
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BM8a_P6E.js";
5
- import { t as getStore } from "../context-Bcy85rGi.js";
6
- import { n as viewFor, t as scopedFor } from "../runtime-CB8gQFvS.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-BT2pSCub.js";
6
+ import { n as getUi, t as getStore } from "../context-DieZVJXu.js";
7
+ import { n as viewFor, t as scopedFor } from "../runtime-D_tMXnsq.js";
8
+ import { a as getDescribe, c as permission, d as setPermDock, f as subject, i as filtered, l as permissions, n as assignable, o as getPermDock, p as tenant, r as assignablePermissions, s as memberships, t as approval, u as roles } from "../stores-BHXdSbw9.js";
8
9
  import "svelte/internal/disclose-version";
9
10
  import * as $ from "svelte/internal/client";
10
11
  import { onDestroy } from "svelte";
@@ -62,6 +63,7 @@ function PermissionBoundary$1($$anchor, $$props) {
62
63
  function Protected$1($$anchor, $$props) {
63
64
  $.push($$props, true);
64
65
  const store = getStore();
66
+ const { defaults } = getUi();
65
67
  let tick = $.state(0);
66
68
  onDestroy(store.subscribe(() => {
67
69
  $.set(tick, $.get(tick) + 1);
@@ -71,29 +73,41 @@ function Protected$1($$anchor, $$props) {
71
73
  const generation = $.get(tick);
72
74
  return viewFor(store, $$props.permission, $$props.data, $.get(scoped), generation);
73
75
  });
76
+ const own = $.derived(() => ({
77
+ pending: $$props.pending,
78
+ fallback: $$props.fallback,
79
+ approval: $$props.approval
80
+ }));
74
81
  var fragment = $.comment();
75
82
  var node = $.first_child(fragment);
76
83
  var consequent = ($$anchor) => {
77
84
  var fragment_1 = $.comment();
78
85
  var node_1 = $.first_child(fragment_1);
79
- $.snippet(node_1, () => $$props.pending ?? $.noop);
86
+ $.snippet(node_1, () => slotContent("pending", $.get(own), defaults) ?? $.noop);
80
87
  $.append($$anchor, fragment_1);
81
88
  };
82
89
  var consequent_1 = ($$anchor) => {
83
90
  var fragment_2 = $.comment();
84
91
  var node_2 = $.first_child(fragment_2);
85
- $.snippet(node_2, () => $$props.fallback ?? $.noop, () => $.get(view).decision);
92
+ $.snippet(node_2, () => slotContent("approval", $.get(own), defaults) ?? $.noop, () => $.get(view).decision);
86
93
  $.append($$anchor, fragment_2);
87
94
  };
88
- var alternate = ($$anchor) => {
95
+ var consequent_2 = ($$anchor) => {
89
96
  var fragment_3 = $.comment();
90
97
  var node_3 = $.first_child(fragment_3);
91
- $.snippet(node_3, () => $$props.children ?? $.noop, () => $.get(view).decision);
98
+ $.snippet(node_3, () => slotContent("fallback", $.get(own), defaults) ?? $.noop, () => $.get(view).decision);
92
99
  $.append($$anchor, fragment_3);
93
100
  };
101
+ var alternate = ($$anchor) => {
102
+ var fragment_4 = $.comment();
103
+ var node_4 = $.first_child(fragment_4);
104
+ $.snippet(node_4, () => $$props.children ?? $.noop, () => $.get(view).decision);
105
+ $.append($$anchor, fragment_4);
106
+ };
94
107
  $.if(node, ($$render) => {
95
108
  if ($.get(view).slot === "pending") $$render(consequent);
96
- else if ($.get(view).slot === "fallback") $$render(consequent_1, 1);
109
+ else if ($.get(view).slot === "approval") $$render(consequent_1, 1);
110
+ else if ($.get(view).slot === "fallback") $$render(consequent_2, 2);
97
111
  else $$render(alternate, -1);
98
112
  });
99
113
  $.append($$anchor, fragment);
@@ -104,4 +118,4 @@ function Protected$1($$anchor, $$props) {
104
118
  const Protected = Protected$1;
105
119
  const PermissionBoundary = PermissionBoundary$1;
106
120
  //#endregion
107
- export { PermissionBoundary, Protected, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
121
+ export { PermissionBoundary, Protected, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getDescribe, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
@@ -1,7 +1,14 @@
1
+ import { n as DescribeMessages } from "../describe-C3ldA9os.js";
1
2
  import { n as boundaryDigest, r as boundaryFallback, t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
2
- import { t as ClientStore } from "../store-jOBYpiXC.js";
3
- import { i as PermissionBoundaryProps, n as scopedFor, r as viewFor, t as ProtectedProps } from "../protected-xAr24FEC.js";
3
+ import { t as ClientStore } from "../store-9KO4BlkB.js";
4
+ import { a as viewFor, i as scopedFor, o as slotContent, r as ProtectedProps, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-ByUo56un.js";
4
5
  //#region src/svelte/context.d.ts
6
+ /** The provider's `defaults` and `messages`. */
7
+ type PermDockUi = {
8
+ readonly defaults?: PermDockDefaults | undefined;
9
+ readonly messages?: DescribeMessages | undefined;
10
+ };
11
+ export declare function getUi(): PermDockUi;
5
12
  export declare function getStore(): ClientStore;
6
13
  //#endregion
7
- export { type PermissionBoundaryProps, type PermissionBoundaryState, type ProtectedProps, boundaryDigest, boundaryFallback, scopedFor, viewFor };
14
+ export { type PermissionBoundaryProps, type PermissionBoundaryState, type ProtectedProps, boundaryDigest, boundaryFallback, scopedFor, slotContent, viewFor };
@@ -1,4 +1,5 @@
1
+ import { l as slotContent } from "../views-CJsrBS1f.js";
1
2
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BM8a_P6E.js";
2
- import { t as getStore } from "../context-Bcy85rGi.js";
3
- import { n as viewFor, t as scopedFor } from "../runtime-CB8gQFvS.js";
4
- export { boundaryDigest, boundaryFallback, getStore, scopedFor, viewFor };
3
+ import { n as getUi, t as getStore } from "../context-DieZVJXu.js";
4
+ import { n as viewFor, t as scopedFor } from "../runtime-D_tMXnsq.js";
5
+ export { boundaryDigest, boundaryFallback, getStore, getUi, scopedFor, slotContent, viewFor };
@@ -1,13 +1,13 @@
1
- import { n as requiredPlans } from "../problem-details-DX075l9V.js";
2
- import { i as describe } from "../describe-DMYiCjJV.js";
1
+ import { n as requiredPlans } from "../problem-details-rIIo8B2C.js";
2
+ import { i as describe } from "../describe-C3ldA9os.js";
3
3
  import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
4
4
  import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
5
- import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-CKNSyIf_.js";
6
- import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-xAr24FEC.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-C0IMQrGI.js";
5
+ import { a as ClientPermDock, c as PermissionSet, d as SubjectView, f as TenantView, i as ApprovalState, l as PermissionState, o as ClientStatus, p as UseRolesOptions, r as ApprovalHandle, s as FilterResult } from "../store-9KO4BlkB.js";
6
+ import { n as PermDockSvelteOptions, r as ProtectedProps, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-ByUo56un.js";
7
+ import { a as getDescribe, c as permission, d as setPermDock, f as subject, i as filtered, l as permissions, n as assignable, o as getPermDock, p as tenant, r as assignablePermissions, s as memberships, t as approval, u as roles } from "../stores-Cxz_80g-.js";
8
8
  import { Component } from "svelte";
9
9
  //#region src/svelte/source.d.ts
10
10
  export declare const Protected: Component<ProtectedProps>;
11
11
  export declare const PermissionBoundary: Component<PermissionBoundaryProps>;
12
12
  //#endregion
13
- export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockSvelteOptions, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SubjectView, type TenantView, type UseRolesOptions, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
13
+ export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockDefaults, type PermDockSvelteOptions, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SubjectView, type TenantView, type UseRolesOptions, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getDescribe, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
@@ -1,11 +1,11 @@
1
- import { r as requiredPlans } from "../problem-details-_AMOYz-w.js";
2
- import { t as describe } from "../describe-B_gVZEVi.js";
1
+ import { r as requiredPlans } from "../problem-details-DECUnXAn.js";
2
+ import { t as describe } from "../describe-Cgkp7eP0.js";
3
3
  import { t as approvalHeaders } from "../headers-BZSDieNT.js";
4
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-BT2pSCub.js";
4
+ import { a as getDescribe, c as permission, d as setPermDock, f as subject, i as filtered, l as permissions, n as assignable, o as getPermDock, p as tenant, r as assignablePermissions, s as memberships, t as approval, u as roles } from "../stores-BHXdSbw9.js";
5
5
  import PermissionBoundaryComponent from "./PermissionBoundary.svelte";
6
6
  import ProtectedComponent from "./Protected.svelte";
7
7
  //#region src/svelte/source.ts
8
8
  const Protected = ProtectedComponent;
9
9
  const PermissionBoundary = PermissionBoundaryComponent;
10
10
  //#endregion
11
- export { PermissionBoundary, Protected, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
11
+ export { PermissionBoundary, Protected, approval, approvalHeaders, assignable, assignablePermissions, describe, filtered, getDescribe, getPermDock, memberships, permission, permissions, requiredPlans, roles, setPermDock, subject, tenant };
@@ -1,7 +1,7 @@
1
- import { f as isFieldRelation } from "./permissions-DVoF6dMt.js";
2
1
  import { t as expiredAt } from "./expiry-BoBJ8Tvc.js";
3
2
  import { n as sameId } from "./ids-DC4V4CFu.js";
4
- import { c as rootScope, l as scopeChain, m as tenantOf, o as resolveScope, r as findScope, t as activeFor, u as scopeIdOf } from "./scopes-CVdPrWN-.js";
3
+ import { c as rootScope, l as scopeChain, m as tenantOf, o as resolveScope, r as findScope, t as activeFor, u as scopeIdOf } from "./scopes-tvpa34ep.js";
4
+ import { l as isFieldRelation } from "./resource-relations-D1Un3pcz.js";
5
5
  //#region src/core/tenancy.ts
6
6
  function nowSeconds(now) {
7
7
  return now ?? Date.now() / 1e3;
@@ -206,40 +206,4 @@ function membershipField(resource, membershipResource, resources) {
206
206
  }
207
207
  }
208
208
  //#endregion
209
- //#region src/core/validity.ts
210
- /**
211
- * An instant as Unix seconds: a finite number is taken as seconds already, a
212
- * string must parse as RFC 3339. Anything else is `undefined`, and the caller
213
- * decides whether that is "absent" or an error.
214
- */
215
- function instantOf(input) {
216
- if (typeof input === "number") return Number.isFinite(input) ? Math.floor(input) : void 0;
217
- if (typeof input !== "string" || input.trim() === "") return;
218
- const millis = Date.parse(input);
219
- return Number.isFinite(millis) ? Math.floor(millis / 1e3) : void 0;
220
- }
221
- /**
222
- * The normalised validity of a grant, or `undefined` when neither bound is
223
- * set. Fail-closed at definition time: a bound that does not parse, or a
224
- * window that ends before it starts, throws so a typo never widens a grant.
225
- */
226
- function normalizeValidity(options, permissionKey) {
227
- const from = options.validFrom === void 0 ? void 0 : instantOf(options.validFrom);
228
- const until = options.validUntil === void 0 ? void 0 : instantOf(options.validUntil);
229
- if (options.validFrom !== void 0 && from === void 0) throw new Error(`PermDock: validFrom on '${permissionKey}' must be an RFC 3339 string or Unix seconds`);
230
- if (options.validUntil !== void 0 && until === void 0) throw new Error(`PermDock: validUntil on '${permissionKey}' must be an RFC 3339 string or Unix seconds`);
231
- if (from !== void 0 && until !== void 0 && until <= from) throw new Error(`PermDock: validUntil on '${permissionKey}' must be after validFrom`);
232
- if (from === void 0 && until === void 0) return;
233
- return Object.freeze({
234
- ...from === void 0 ? {} : { from },
235
- ...until === void 0 ? {} : { until }
236
- });
237
- }
238
- /** Whether a grant with this validity applies at `now` (Unix seconds); no validity always applies. */
239
- function isActive(validity, now) {
240
- if (validity === void 0) return true;
241
- if (validity.from !== void 0 && now < validity.from) return false;
242
- return validity.until === void 0 || now < validity.until;
243
- }
244
- //#endregion
245
- export { isMembershipExpired as a, membershipField as c, partitionsOf as d, relatesTo as f, tenantsOf as g, scopeField as h, inTeam as i, nestedAppliesWithoutRow as l, rowInScope as m, normalizeValidity as n, matchScopedMembership as o, resolveActiveTenant as p, heldRoleNamesIn as r, memberOfFields as s, isActive as t, nowSeconds as u };
209
+ export { memberOfFields as a, nowSeconds as c, resolveActiveTenant as d, rowInScope as f, matchScopedMembership as i, partitionsOf as l, tenantsOf as m, inTeam as n, membershipField as o, scopeField as p, isMembershipExpired as r, nestedAppliesWithoutRow as s, heldRoleNamesIn as t, relatesTo as u };
@@ -1,8 +1,8 @@
1
- import { C as Policy, D as PolicyVocabulary, Nr as Principal, Pr as Subject, Yn as Decision, ln as PermDock } from "../policy-IB6yxpC3.js";
2
- import { f as Permission } from "../permissions-DttnqqxC.js";
3
- import { f as ApprovalStore } from "../types-aqOHTHcp.js";
4
- import { a as ProblemDetails, t as ApprovalHint } from "../errors-DPdqI50v.js";
5
- import { t as InstanceOptions } from "../instance-options-jARdwfPN.js";
1
+ import { E as Policy, Or as Principal, ir as Decision, j as PolicyVocabulary, jt as PermDock, kr as Subject } from "../policy-types-sp9P1iIV.js";
2
+ import { d as Permission } from "../permission-types-Dg39z9Kv.js";
3
+ import { f as ApprovalStore } from "../types-Br9IXUBG.js";
4
+ import { a as ProblemDetails, t as ApprovalHint } from "../errors-OD_4c__H.js";
5
+ import { t as InstanceOptions } from "../instance-options-plkrsAog.js";
6
6
  //#region src/terminal/types.d.ts
7
7
  type TokenSourceName = "device" | "keychain" | "env" | "ci-oidc";
8
8
  type TokenSource = TokenSourceName | {
@@ -1,11 +1,10 @@
1
- import { t as compact } from "../compact-y6vfu2_f.js";
2
- import { a as deniedMessage, i as approvalMessage, n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "../errors-Cz5zn0mW.js";
3
- import { t as createPermDock$1 } from "../permdock-CbgvLnuo.js";
1
+ import { r as isRecord, t as compact } from "../compact-CAf557ZB.js";
2
+ import { a as deniedMessage, i as approvalMessage, n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "../errors-drnfxYtm.js";
4
3
  import { n as resourceRef } from "../resource-ref-CaS9yVPi.js";
5
4
  import { i as isSubject } from "../subject-C6dLxqHU.js";
6
- import { l as storedApprovalToken, s as resumeDecision } from "../helpers-H_KARDVC.js";
5
+ import { l as storedApprovalToken, s as resumeDecision } from "../helpers-C9YmyBIa.js";
7
6
  import { t as timeoutSignal } from "../timeout-D51niuQP.js";
8
- import { t as instanceOptions } from "../instance-options-Dhhcnm3y.js";
7
+ import { n as resolveOrNull, t as buildInstance } from "../build-instance-DIIV9DbC.js";
9
8
  import { mkdirSync, readFileSync, statSync, unlinkSync, writeFileSync } from "node:fs";
10
9
  import path from "node:path";
11
10
  import { createInterface } from "node:readline";
@@ -13,13 +12,10 @@ import { homedir } from "node:os";
13
12
  //#region src/terminal/device.ts
14
13
  /** Milliseconds an authorization server request may take. */
15
14
  const TERMINAL_TIMEOUT_MS = 1e4;
16
- function isRecord$1(value) {
17
- return value !== null && typeof value === "object" && !Array.isArray(value);
18
- }
19
15
  async function readJson(response) {
20
16
  try {
21
17
  const body = await response.json();
22
- return isRecord$1(body) ? body : null;
18
+ return isRecord(body) ? body : null;
23
19
  } catch {
24
20
  return null;
25
21
  }
@@ -288,9 +284,6 @@ function credentialsPath(service, runtime) {
288
284
  const xdg = env["XDG_CONFIG_HOME"] ?? path.join(home(), ".config");
289
285
  return path.join(xdg, service, "credentials.json");
290
286
  }
291
- function isRecord(value) {
292
- return value !== null && typeof value === "object" && !Array.isArray(value);
293
- }
294
287
  function parseCredential(value) {
295
288
  if (!isRecord(value) || typeof value["access_token"] !== "string") return null;
296
289
  return compact({
@@ -606,28 +599,19 @@ function createPermDock(policy, options) {
606
599
  token: tokenFor(profile, resolveOptions.source),
607
600
  profile
608
601
  };
609
- let user = null;
610
- try {
611
- user = await options.subject(context);
612
- } catch {
613
- user = null;
614
- }
615
- let actor;
616
- let delegation;
617
- if (options.actor !== void 0) try {
618
- const resolved = actorFromResolved(await options.actor(context));
619
- actor = resolved.actor;
620
- delegation = resolved.delegation;
621
- } catch {
622
- actor = void 0;
623
- delegation = void 0;
624
- }
625
- const built = await createPermDock$1(policy, user, compact({
626
- tenant: options.tenant,
627
- actor,
628
- delegation,
629
- ...instanceOptions(options)
630
- }));
602
+ const user = await resolveOrNull(() => options.subject(context));
603
+ const resolveActor = options.actor;
604
+ const resolved = resolveActor === void 0 ? null : await resolveOrNull(async () => actorFromResolved(await resolveActor(context)));
605
+ const { permdock: built } = await buildInstance({
606
+ policy,
607
+ user,
608
+ sources: options,
609
+ scope: {
610
+ tenant: options.tenant,
611
+ actor: resolved?.actor,
612
+ delegation: resolved?.delegation
613
+ }
614
+ });
631
615
  last = built;
632
616
  return built;
633
617
  };
@@ -1,15 +1,15 @@
1
- import { At as SnapshotSource, C as Policy, Ct as SettingsSource, Dr as CustomRole, Ft as TokenVerifier, Mr as Membership, Nr as Principal, Pr as Subject, Pt as TokenSigner, Rt as WhereCompiler, Tt as Snapshot, Wn as ApprovalPolicySource, at as DecisionSink, bn as PolicySource, bt as RelationSource, dt as LimitStore, gt as MembershipSource, jt as SubjectResolver, ln as PermDock, mn as WhereResult, nt as CredentialVerifier, st as EntitlementSource, un as PermDockOptions, xt as RoleSource } from "../policy-IB6yxpC3.js";
2
- import { f as Permission, g as ResourceInit, u as InferPermissionTree } from "../permissions-DttnqqxC.js";
3
- import { r as Role } from "../vocabulary-DA8a8zif.js";
4
- import { f as ApprovalStore } from "../types-aqOHTHcp.js";
5
- import { t as ToolMap } from "../types-Bvc4oWT6.js";
1
+ import { Dr as Membership, E as Policy, G as EntitlementSource, H as CredentialVerifier, Ht as PolicySource, It as WhereResult, Mt as PermDockOptions, Or as Principal, Sr as CustomRole, W as DecisionSink, Xt as ApprovalPolicySource, Y as LimitStore, Z as MembershipSource, an as Snapshot, at as SnapshotSource, it as SettingsSource, jt as PermDock, kr as Subject, lt as TokenSigner, nt as RoleSource, ot as SubjectResolver, pt as WhereCompiler, tt as RelationSource, ut as TokenVerifier } from "../policy-types-sp9P1iIV.js";
2
+ import { d as Permission, h as ResourceInit, u as InferPermissionTree } from "../permission-types-Dg39z9Kv.js";
3
+ import { r as Role } from "../vocabulary-hhEFLFoL.js";
4
+ import { f as ApprovalStore } from "../types-Br9IXUBG.js";
5
+ import { t as ToolMap } from "../types-DvupZE0w.js";
6
6
  import { n as SupabaseHookManifest } from "../manifest-uDS9y5de.js";
7
7
  import { t as supabaseMembershipsBudget } from "../budget-JqcRqyhK.js";
8
8
  import { n as RevocationFeed } from "../revocations-Cy06JNx2.js";
9
- import { g as ReplayStore } from "../types-Cq_H8N_X.js";
10
- import { v as DirectoryStore } from "../index-C8z4RjQV.js";
11
- import { a as SaasProject } from "../permissions-CDgvKG5L.js";
12
- import { n as saasPolicy } from "../policy-D2W7uv19.js";
9
+ import { g as ReplayStore } from "../types-C0dee0Qf.js";
10
+ import { v as DirectoryStore } from "../index-BwMe94Xq.js";
11
+ import { a as SaasProject } from "../permissions-COH-KRgT.js";
12
+ import { n as saasPolicy } from "../policy-ur0BBK_e.js";
13
13
  import { expectTypeOf } from "vitest";
14
14
  //#region src/testing/describe-policy.d.ts
15
15
  type MatrixOutcome = "granted" | "denied" | "approval-required";
@@ -229,7 +229,7 @@ export declare function snapshotFixture(policy: Policy, subject: unknown, option
229
229
  readonly simulated?: boolean;
230
230
  }): Promise<Snapshot>;
231
231
  //#endregion
232
- //#region src/testing/http-adapter.d.ts
232
+ //#region src/testing/http-adapter/domain.d.ts
233
233
  /**
234
234
  * What a mount wires into its framework. Every value is server-side: the
235
235
  * subject comes from a verified bearer token, memberships and plans from the
@@ -352,6 +352,8 @@ type HttpAdapterOptions = {
352
352
  /** The mount serves the events stream; the `stream-*` scenarios run only then. */
353
353
  readonly streams?: boolean;
354
354
  };
355
+ //#endregion
356
+ //#region src/testing/http-adapter/scenarios.d.ts
355
357
  /**
356
358
  * Real-life HTTP scenarios over the shared SaaS domain. `mount` builds the
357
359
  * application once with the adapter under test; every expectation below is
@@ -511,21 +513,70 @@ export declare const authzenTodoData: {
511
513
  */
512
514
  export declare function authzenTodoVectors(): AuthZenVectors;
513
515
  //#endregion
514
- //#region src/testing/conformance.d.ts
515
- export declare function testSubjectResolver<TInput>(resolver: SubjectResolver<TInput>, options: {
516
- readonly invalid: TInput;
516
+ //#region src/testing/conformance/approvals.d.ts
517
+ type ApprovalStoreOptions = {
518
+ /**
519
+ * Opens a second store over the same backing storage, as a restarted process
520
+ * would. Omit it for stores that do not persist (the resume-after-restart
521
+ * case is then skipped).
522
+ */
523
+ readonly reopen?: () => ApprovalStore | Promise<ApprovalStore>;
524
+ };
525
+ export declare function testApprovalStore(store: ApprovalStore, options?: ApprovalStoreOptions): void;
526
+ /**
527
+ * Checks an `ApprovalPolicySource`: entries are plain JSON, belong to the
528
+ * queried tenant or to none, and every entry loads against `policy` (an
529
+ * entry that does not would deny every call).
530
+ */
531
+ export declare function testApprovalPolicySource(source: ApprovalPolicySource, options: {
532
+ readonly policy: Policy;
533
+ readonly tenant: string;
534
+ readonly unknown?: string;
517
535
  }): void;
518
- export declare function testMembershipSource(source: MembershipSource, options: {
519
- readonly principals: readonly {
520
- readonly id: string;
521
- readonly kind?: string;
522
- }[];
523
- readonly expect?: Record<string, readonly Membership[]>;
524
- /** With the policy, every membership must name one of its scopes and carry its parent ids. */
536
+ //#endregion
537
+ //#region src/testing/conformance/where.d.ts
538
+ type WhereRow = Readonly<Record<string, unknown>>;
539
+ /**
540
+ * `matches` answers whether the compiled output selects `row`, for example
541
+ * by running it against a table holding only that row. With it, every case
542
+ * must select the rows the in-memory evaluator keeps, including rows whose
543
+ * fields are NULL.
544
+ */
545
+ export declare function testWhereCompiler<TTarget>(compiler: WhereCompiler<TTarget>, options: {
546
+ readonly target: TTarget;
547
+ readonly isFailClosed?: (compiled: unknown) => boolean;
548
+ readonly matches?: (compiled: unknown, row: WhereRow) => boolean | Promise<boolean>;
549
+ }): void;
550
+ //#endregion
551
+ //#region src/testing/conformance/credentials.d.ts
552
+ export declare function testReplayStore(store: ReplayStore): void;
553
+ export declare function testRevocationFeed(feed: RevocationFeed): void;
554
+ export declare function testTokenVerifier(verifier: TokenVerifier, options?: {
555
+ readonly audience?: string;
556
+ readonly issuer?: string;
557
+ }): void;
558
+ /**
559
+ * `key` is a live key the verifier knows, or a function issuing one (called
560
+ * once). `revoke`, when given, revokes it; the runner then expects the key
561
+ * to stop verifying.
562
+ */
563
+ export declare function testCredentialVerifier(verifier: CredentialVerifier, options: {
564
+ readonly key: string | (() => string | Promise<string>);
565
+ readonly revoke?: () => void | Promise<void>;
566
+ }): void;
567
+ export declare function testTokenSigner(signer: TokenSigner, options: {
568
+ readonly verifier: TokenVerifier;
569
+ }): void;
570
+ //#endregion
571
+ //#region src/testing/conformance/runtime-stores.d.ts
572
+ export declare function testLimitStore(store: LimitStore): void;
573
+ export declare function testDecisionSink(sink: DecisionSink): void;
574
+ export declare function testSnapshotSource(source: SnapshotSource): void;
575
+ export declare function testPolicySource(source: PolicySource, options?: {
525
576
  readonly policy?: Policy;
526
- /** Passed to every `membershipsFor`; a source keyed by tenant answers nothing without one. */
527
- readonly tenant?: string;
528
577
  }): void;
578
+ //#endregion
579
+ //#region src/testing/conformance/relations.d.ts
529
580
  /**
530
581
  * A `RelationSource` answers facts only: well-formed chains nearest first and
531
582
  * no longer than `depth`, holders with principal ids or group references and
@@ -548,6 +599,22 @@ export declare function testRelationSource(source: RelationSource, options: {
548
599
  readonly links?: Readonly<Record<string, string>>;
549
600
  };
550
601
  }): void;
602
+ //#endregion
603
+ //#region src/testing/conformance/identity.d.ts
604
+ export declare function testSubjectResolver<TInput>(resolver: SubjectResolver<TInput>, options: {
605
+ readonly invalid: TInput;
606
+ }): void;
607
+ export declare function testMembershipSource(source: MembershipSource, options: {
608
+ readonly principals: readonly {
609
+ readonly id: string;
610
+ readonly kind?: string;
611
+ }[];
612
+ readonly expect?: Record<string, readonly Membership[]>;
613
+ /** With the policy, every membership must name one of its scopes and carry its parent ids. */
614
+ readonly policy?: Policy;
615
+ /** Passed to every `membershipsFor`; a source keyed by tenant answers nothing without one. */
616
+ readonly tenant?: string;
617
+ }): void;
551
618
  export declare function testEntitlementSource(source: EntitlementSource, options: {
552
619
  readonly principal: {
553
620
  readonly id: string;
@@ -566,69 +633,14 @@ export declare function testRoleSource(source: RoleSource, options: {
566
633
  */
567
634
  readonly every?: readonly string[];
568
635
  }): void;
569
- export declare function testLimitStore(store: LimitStore): void;
570
- export declare function testDecisionSink(sink: DecisionSink): void;
571
- export declare function testSnapshotSource(source: SnapshotSource): void;
572
- export declare function testPolicySource(source: PolicySource, options?: {
573
- readonly policy?: Policy;
574
- }): void;
575
- export declare function testReplayStore(store: ReplayStore): void;
576
- export declare function testRevocationFeed(feed: RevocationFeed): void;
577
636
  export declare function testDirectoryStore(store: DirectoryStore, options: {
578
637
  readonly tenants: readonly [string, string];
579
638
  }): void;
580
- type ApprovalStoreOptions = {
581
- /**
582
- * Opens a second store over the same backing storage, as a restarted process
583
- * would. Omit it for stores that do not persist (the resume-after-restart
584
- * case is then skipped).
585
- */
586
- readonly reopen?: () => ApprovalStore | Promise<ApprovalStore>;
587
- };
588
- export declare function testApprovalStore(store: ApprovalStore, options?: ApprovalStoreOptions): void;
589
- export declare function testTokenVerifier(verifier: TokenVerifier, options?: {
590
- readonly audience?: string;
591
- readonly issuer?: string;
592
- }): void;
593
639
  /** Settings for `tenant`, or `undefined`; a thrown source fails the runner. */
594
640
  export declare function testSettingsSource(source: SettingsSource, options: {
595
641
  readonly tenant: string;
596
642
  readonly unknown?: string;
597
643
  }): void;
598
- /**
599
- * Checks an `ApprovalPolicySource`: entries are plain JSON, belong to the
600
- * queried tenant or to none, and every entry loads against `policy` (an
601
- * entry that does not would deny every call).
602
- */
603
- export declare function testApprovalPolicySource(source: ApprovalPolicySource, options: {
604
- readonly policy: Policy;
605
- readonly tenant: string;
606
- readonly unknown?: string;
607
- }): void;
608
- /**
609
- * `key` is a live key the verifier knows, or a function issuing one (called
610
- * once). `revoke`, when given, revokes it; the runner then expects the key
611
- * to stop verifying.
612
- */
613
- export declare function testCredentialVerifier(verifier: CredentialVerifier, options: {
614
- readonly key: string | (() => string | Promise<string>);
615
- readonly revoke?: () => void | Promise<void>;
616
- }): void;
617
- export declare function testTokenSigner(signer: TokenSigner, options: {
618
- readonly verifier: TokenVerifier;
619
- }): void;
620
- type WhereRow = Readonly<Record<string, unknown>>;
621
- /**
622
- * `matches` answers whether the compiled output selects `row`, for example
623
- * by running it against a table holding only that row. With it, every case
624
- * must select the rows the in-memory evaluator keeps, including rows whose
625
- * fields are NULL.
626
- */
627
- export declare function testWhereCompiler<TTarget>(compiler: WhereCompiler<TTarget>, options: {
628
- readonly target: TTarget;
629
- readonly isFailClosed?: (compiled: unknown) => boolean;
630
- readonly matches?: (compiled: unknown, row: WhereRow) => boolean | Promise<boolean>;
631
- }): void;
632
644
  //#endregion
633
645
  //#region src/testing/jwt-fixtures.d.ts
634
646
  export declare const jwtFixtureJwks: {