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.
- package/dist/a2a/index.d.ts +7 -5
- package/dist/a2a/index.js +14 -21
- package/dist/ai-sdk/index.d.ts +18 -6
- package/dist/ai-sdk/index.js +8 -5
- package/dist/app-data-CV8pqqMi.js +59 -0
- package/dist/approvals/index.d.ts +2 -2
- package/dist/approvals/index.js +3 -3
- package/dist/{approvals-DbYAuNkG.js → approvals-DZL76lKW.js} +35 -19
- package/dist/{approvers-DT4AVyIg.js → approvers-CqPOLD-o.js} +1 -1
- package/dist/{arazzo-BAgw9ap6.js → arazzo-C4BcskbX.js} +6 -5
- package/dist/{arazzo-CKwwqFWz.js → arazzo-CD8d0WLb.js} +2 -2
- package/dist/authzen/index.d.ts +3 -3
- package/dist/authzen/index.js +161 -23
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +6 -19
- package/dist/better-supabase/index.d.ts +112 -87
- package/dist/better-supabase/index.js +257 -156
- package/dist/{bind-C_ob3LKa.d.ts → bind-BzqG8SMb.d.ts} +16 -5
- package/dist/{bind-CuzGytRf.js → bind-kk-uyCwH.js} +14 -6
- package/dist/build-instance-DIIV9DbC.js +51 -0
- package/dist/{canonical-json-DemiK4Vp.js → canonical-json-CFKyFOke.js} +1 -3
- package/dist/{capability-2kYTMWDv.d.ts → capability-CksyCWDH.d.ts} +2 -2
- package/dist/{capability-4qPdO9gk.js → capability-txATtKV4.js} +3 -2
- package/dist/catalog/index.d.ts +1 -1
- package/dist/catalog/index.js +1 -1
- package/dist/catalog-6yWAX6Ps.js +2 -0
- package/dist/{catalog-dFZdWCGN.js → catalog-WHG4kBq7.js} +2 -2
- package/dist/{catalog-doc-DdGm82XT.js → catalog-doc-DWtg0gGR.js} +17 -10
- package/dist/{catalog-DWF5cYqB.js → catalog-tZUyOfOv.js} +4 -4
- package/dist/claude-agent/index.d.ts +4 -4
- package/dist/claude-agent/index.js +4 -5
- package/dist/clerk/index.d.ts +3 -3
- package/dist/clerk/index.js +8 -33
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +3 -3
- package/dist/cloud/index.d.ts +4 -4
- package/dist/cloud/index.js +9 -15
- package/dist/{cloud-CB_ELYuX.js → cloud-C7bSDgX4.js} +2 -2
- package/dist/{cloud-DWLXO2af.js → cloud-PeBN3IEn.js} +5 -5
- package/dist/{collect-DSTE3ml9.js → collect-2SrB7lfk.js} +6 -8
- package/dist/collect-Bw2Jdq1q.js +2 -0
- package/dist/{collect-DClJsheJ.js → collect-CQx4hX4N.js} +3 -3
- package/dist/{commands-DSxCqG9A.js → commands-Cpip4ULx.js} +13 -13
- package/dist/{compact-y6vfu2_f.js → compact-CAf557ZB.js} +11 -1
- package/dist/compile/index.d.ts +1 -1
- package/dist/compile/index.js +1 -1
- package/dist/{compile-Ba4blROR.js → compile-CcEu2ZQ1.js} +6 -5
- package/dist/{compile-BkRyBDBw.d.ts → compile-CtTP7eur.d.ts} +2 -2
- package/dist/{config-BJiM-xAm.js → config-BIjREpyE.js} +4 -4
- package/dist/{config-Dnszbv-6.js → config-DLt6BvV7.js} +2 -2
- package/dist/{config-report-DMvWKUxL.js → config-report--Xb9APJS.js} +5 -6
- package/dist/{connection-CU8MQxRi.js → connection-DUsczpB5.js} +3 -2
- package/dist/constants-DcJABbLW.js +20 -0
- package/dist/{context-Bcy85rGi.js → context-DieZVJXu.js} +16 -5
- package/dist/convex/index.d.ts +4 -4
- package/dist/convex/index.js +14 -16
- package/dist/create-BBO24vj6.js +324 -0
- package/dist/{credential-8P81ff4u.js → credential-kue0qpbm.js} +4 -4
- package/dist/deciding-columns-Sq12mEA6.js +123 -0
- package/dist/delegation-input-FTxMK3ji.js +19 -0
- package/dist/denied-text-DfRk15uw.d.ts +19 -0
- package/dist/{describe-DMYiCjJV.d.ts → describe-C3ldA9os.d.ts} +11 -2
- package/dist/{describe-B_gVZEVi.js → describe-Cgkp7eP0.js} +5 -4
- package/dist/{diff-DBIhz_f2.js → diff-Cnghh_Ip.js} +2 -2
- package/dist/{diff-2VaeChzX.js → diff-rpqoe7Ag.js} +9 -9
- package/dist/{doctor-BwCAMLx_.js → doctor-CuVJvhV_.js} +2 -2
- package/dist/doctor-owlv6ddh.js +2166 -0
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +6 -14
- package/dist/elysia/index.d.ts +4 -4
- package/dist/elysia/index.js +7 -7
- package/dist/{errors-DPdqI50v.d.ts → errors-OD_4c__H.d.ts} +2 -2
- package/dist/{errors-Cz5zn0mW.js → errors-drnfxYtm.js} +3 -3
- package/dist/{evaluations-tz6D9A2G.js → evaluations-C9YJsv3H.js} +45 -7
- package/dist/eve/index.d.ts +5 -5
- package/dist/eve/index.js +5 -5
- package/dist/express/index.d.ts +4 -4
- package/dist/express/index.js +8 -7
- package/dist/fastify/index.d.ts +15 -5
- package/dist/fastify/index.js +9 -29
- package/dist/fields-fwfXN01n.js +1016 -0
- package/dist/{files-DWUN9PzI.js → files-D_JIzUrP.js} +12 -3
- package/dist/{fixtures-ht28Cplr.js → fixtures-h2eG2OZV.js} +5 -6
- package/dist/{from-snapshot-CTLijvdm.js → from-snapshot-7REQZe0H.js} +32 -22
- package/dist/{generate-CH7ThJ14.js → generate-CNU1pIOo.js} +1 -3
- package/dist/grantee-CXY-0C87.js +254 -0
- package/dist/grantee-conditions-MQs5NIuX.js +270 -0
- package/dist/grantee-match-fxYp9Nmt.js +141 -0
- package/dist/{helpers-H_KARDVC.js → helpers-C9YmyBIa.js} +7 -6
- package/dist/hono/index.d.ts +4 -4
- package/dist/hono/index.js +8 -8
- package/dist/hosted-CBHgkzDl.js +655 -0
- package/dist/{http-SO7qGttf.js → http-BBoKefeS.js} +35 -2
- package/dist/{http-BIhmLfCc.js → http-BEbdMZ05.js} +2 -24
- package/dist/{rls-import-BTFVk3jH.js → import-BFIlhetD.js} +86 -80
- package/dist/{openapi-import-cmwetbzw.js → import-UHk1N7vH.js} +6 -7
- package/dist/{index-C8z4RjQV.d.ts → index-BwMe94Xq.d.ts} +1 -1
- package/dist/{index-0nNqHspG.d.ts → index-DgM7w96K.d.ts} +2 -2
- package/dist/{index-C7Tw7MaW.d.ts → index-Dz7didpC.d.ts} +3 -3
- package/dist/{index-BNc7Wer_.d.ts → index-UdVQgq48.d.ts} +105 -38
- package/dist/index.d.ts +15 -13
- package/dist/index.js +22 -22
- package/dist/{instance-options-jARdwfPN.d.ts → instance-options-plkrsAog.d.ts} +1 -1
- package/dist/{json-schema-BsAflUGW.js → json-schema-DBkdUuCO.js} +1 -3
- package/dist/jwt/index.d.ts +4 -4
- package/dist/jwt/index.js +13 -13
- package/dist/{kernel-_RRHmnMY.js → kernel-CB3LrIJM.js} +81 -32
- package/dist/kysely/index.d.ts +2 -2
- package/dist/kysely/index.js +6 -14
- package/dist/{live-options-H2eG8dfJ.js → live-options-BaAFCIiu.js} +16 -3
- package/dist/load-B_shHrmd.js +2 -0
- package/dist/{load-DhWEB9P1.js → load-C3_oTHyO.js} +11 -3
- package/dist/{manifest-iaoBXHKc.js → manifest-BngWKryL.js} +5 -18
- package/dist/{map-claims-Z4QZOiFF.js → map-claims-AVlBaJoa.js} +7 -16
- package/dist/{map-error-pgUWNNtG.js → map-error-BE27PYkE.js} +5 -5
- package/dist/{markers-B0hYLvMD.js → markers-CiwAOZtO.js} +6 -2
- package/dist/{may-use-DndQ5tQ-.js → may-use-BOn_dR_w.js} +4 -3
- package/dist/mcp/index.d.ts +26 -9
- package/dist/mcp/index.js +456 -446
- package/dist/{rls-migrate-CN4TlJTO.js → migrate-BwlB5-Wk.js} +75 -15
- package/dist/nest/index.d.ts +4 -4
- package/dist/nest/index.js +11 -12
- package/dist/next/index.d.ts +31 -8
- package/dist/next/index.js +29 -33
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.js +4 -4
- package/dist/ocsf-uYFXGVw2.js +115 -0
- package/dist/openai/index.d.ts +5 -5
- package/dist/openai/index.js +4 -4
- package/dist/openapi/index.d.ts +3 -3
- package/dist/openapi/index.js +1 -1
- package/dist/{openapi-CqqEbHsL.js → openapi-BJdBmYDG.js} +19 -23
- package/dist/{openapi-BqRBvAng.js → openapi-DBzHQbov.js} +2 -5
- package/dist/{openapi-l0xYHkcv.js → openapi-DcQ1Kg40.js} +3 -3
- package/dist/orpc/index.d.ts +5 -5
- package/dist/orpc/index.js +9 -11
- package/dist/otel/index.d.ts +2 -2
- package/dist/otel/index.js +26 -23
- package/dist/output-files-CgIsvdSa.js +140 -0
- package/dist/{rls-ownership-RuFqaqGz.js → ownership-BgnbOJFT.js} +387 -379
- package/dist/{package-root-zGkxO3oN.js → package-root-DtNnpmUd.js} +3 -2
- package/dist/{parse-BuyjxhZV.js → parse-CVFQHk6c.js} +3 -3
- package/dist/{parse-local-manifest-BrMozJCo.js → parse-local-manifest-C-q02Pal.js} +2 -4
- package/dist/{parse-local-manifest-JLnaBH0S.d.ts → parse-local-manifest-DvYUR0QL.d.ts} +1 -1
- package/dist/pdp/index.d.ts +2 -2
- package/dist/pdp/index.js +8 -9
- package/dist/{permdock-CbgvLnuo.js → permdock-L26udHSk.js} +1387 -1220
- package/dist/{rls-fields-74oZPXWL.js → permission-keys-B26jeyUv.js} +1289 -2066
- package/dist/permission-registry-BsblpB-z.js +385 -0
- package/dist/{permissions-DttnqqxC.d.ts → permission-types-Dg39z9Kv.d.ts} +59 -31
- package/dist/{permissions-RJrovw98.js → permissions-CCJ6lmxB.js} +3 -3
- package/dist/{permissions-CDgvKG5L.d.ts → permissions-COH-KRgT.d.ts} +2 -2
- package/dist/{policy-IB6yxpC3.d.ts → policy-types-sp9P1iIV.d.ts} +661 -582
- package/dist/{policy-D2W7uv19.d.ts → policy-ur0BBK_e.d.ts} +2 -2
- package/dist/{powersync-DliZK_-y.js → powersync-BFSbSElQ.js} +2 -2
- package/dist/powersync-DCDgZgfZ.js +2 -0
- package/dist/{powersync-BylawD_U.js → powersync-cZe4kzhL.js} +26 -27
- package/dist/prisma/index.d.ts +1 -1
- package/dist/prisma/index.js +6 -12
- package/dist/{problem-B43ztKIm.js → problem-CnWraVhC.js} +8 -7
- package/dist/{problem-details-_AMOYz-w.js → problem-details-DECUnXAn.js} +2 -2
- package/dist/{problem-details-DX075l9V.d.ts → problem-details-rIIo8B2C.d.ts} +1 -1
- package/dist/{protected-BdnIEFkY.d.ts → protected-B3_P7xuw.d.ts} +9 -6
- package/dist/{protected-utU-SLuy.js → protected-BN7BUdY1.js} +20 -8
- package/dist/{provider-CSQd7m92.js → provider-Bi-0HNL3.js} +23 -10
- package/dist/{provider-DZY281jO.d.ts → provider-kwHC9CZD.d.ts} +1 -1
- package/dist/{provider-store-Cfbvo4DE.js → provider-store-Ctt-81Ni.js} +6 -3
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.js +5 -5
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +20 -11
- package/dist/react-native/index.js +33 -17
- package/dist/{refs-KYb4ntaz.js → refs-f3imMjNW.js} +1 -1
- package/dist/relation-walk-BXnlLtg2.js +186 -0
- package/dist/relations-CvmSpG67.js +163 -0
- package/dist/{replay-CYyiLiwO.d.ts → replay-COpmZUfx.d.ts} +1 -1
- package/dist/request-context-BVM7aWNs.js +71 -0
- package/dist/request-context-C2_1lchh.d.ts +5 -0
- package/dist/resource-relations-D1Un3pcz.js +243 -0
- package/dist/retire-BFcxL6un.js +240 -0
- package/dist/{rls-B4ur8nKQ.js → rls-55DQTuf5.js} +14 -2
- package/dist/{rls-DQtdgTHB.js → rls-BEktUaqg.js} +884 -484
- package/dist/{policy-xyWg7QdR.js → role-builder-B4GbKM-i.js} +235 -541
- package/dist/{rpc-DL9Sqvb1.js → rpc-nYC3cR_u.js} +15 -5
- package/dist/{run-DKDbM4Du.js → run-DMcNW_8T.js} +3 -3
- package/dist/{runtime-CB8gQFvS.js → runtime-D_tMXnsq.js} +1 -1
- package/dist/{saas-DhpJjnBA.js → saas-DtaA4JuW.js} +9 -8
- package/dist/{openapi-schema--ARjyfQr.js → schema-Bol6gqXA.js} +3 -5
- package/dist/{schema-D3MnDMxa.js → schema-DjQBcAP9.js} +4 -2
- package/dist/scim/index.d.ts +1 -1
- package/dist/scim/index.js +1 -1
- package/dist/{scim-BFGBBAqR.js → scim-vFR1O5oG.js} +6 -12
- package/dist/{scopes-CVdPrWN-.js → scopes-tvpa34ep.js} +10 -2
- package/dist/server/index.d.ts +18 -8
- package/dist/server/index.js +8 -8
- package/dist/{server-DlZ28Oz5.js → server-ZYEHtNHS.js} +4 -4
- package/dist/{create-B1d519XK.d.ts → server-types-DdqBwZN_.d.ts} +69 -33
- package/dist/shared-1uhI-e-b.js +294 -0
- package/dist/{shared-DRu8VFVM.js → shared-JhMeOsDF.js} +1 -1
- package/dist/{sink-Bd9PSyfq.js → sink-BTtmfPnE.js} +1 -1
- package/dist/{sink-B1fZzIMf.d.ts → sink-CPN4zLfs.d.ts} +1 -1
- package/dist/{skills-Biq5uup3.js → skills-BZdRQkxs.js} +4 -3
- package/dist/{skills-Bx-U0irG.js → skills-Dle4ZoLF.js} +2 -2
- package/dist/{snapshot-Enxd0n-s.js → snapshot-Dc9CHPME.js} +116 -13
- package/dist/{snapshot-cache-D6jLelln.js → snapshot-cache-Cod40D-X.js} +1 -1
- package/dist/{snapshot-cache-B-LxUahj.d.ts → snapshot-cache-J5T7t_vD.d.ts} +1 -1
- package/dist/solid/index.d.ts +22 -22
- package/dist/solid/index.js +40 -10
- package/dist/{sources-4p0-4xQm.js → sources-B1-b-R0t.js} +25 -26
- package/dist/{sources-BdOYLw9j.d.ts → sources-Dljy06zL.d.ts} +6 -2
- package/dist/{sql-xdg5f4Fi.js → sql-t8teWOfo.js} +19 -3
- package/dist/{src-BDwEZWrZ.js → src-Bb7no-hS.js} +194 -123
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +58 -61
- package/dist/store-9KO4BlkB.d.ts +147 -0
- package/dist/{store-DMAWwAJV.js → store-ILkLUj_o.js} +4 -4
- package/dist/{store-options-ByhZq1jV.js → store-options-CbUHDoSe.js} +16 -7
- package/dist/{stores-BT2pSCub.js → stores-BHXdSbw9.js} +7 -3
- package/dist/stores-Cxz_80g-.d.ts +31 -0
- package/dist/{stream-DDpvynSB.js → stream-BMui98KK.js} +2 -1
- package/dist/{stream-D1RXubw2.d.ts → stream-Dwsg6WwE.d.ts} +2 -2
- package/dist/{subject-settings-BwBmCdTR.js → subject-settings-CkEwrw3W.js} +23 -5
- package/dist/supabase/index.d.ts +4 -4
- package/dist/supabase/index.js +3 -3
- package/dist/supabase/middleware.d.ts +11 -5
- package/dist/supabase/middleware.js +10 -7
- package/dist/{supabase-C0qESOa-.js → supabase-C1TWlnYt.js} +36 -52
- package/dist/{supabase-Boqb9a_Y.js → supabase-Dbqr141s.js} +2 -2
- package/dist/supabase-hook-BULg7Ut_.js +2 -0
- package/dist/{supabase-hook-CSLQ4zJ3.js → supabase-hook-Cva3ikXz.js} +731 -782
- package/dist/{supautils-Cn4R4cJ4.js → supautils-B6HYL9eL.js} +2 -2
- package/dist/svelte/Protected.svelte +9 -2
- package/dist/svelte/index.d.ts +6 -6
- package/dist/svelte/index.js +25 -11
- package/dist/svelte/runtime.d.ts +10 -3
- package/dist/svelte/runtime.js +4 -3
- package/dist/svelte/source.d.ts +6 -6
- package/dist/svelte/source.js +4 -4
- package/dist/{validity-uOp8UpYn.js → tenancy-DshjqY0n.js} +3 -39
- package/dist/terminal/index.d.ts +5 -5
- package/dist/terminal/index.js +18 -34
- package/dist/testing/index.d.ts +89 -77
- package/dist/testing/index.js +1276 -1262
- package/dist/testing/saas/index.d.ts +4 -4
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.d.ts +1 -1
- package/dist/testing/saas/permissions.js +1 -1
- package/dist/thenable-QSmvt-vZ.js +65 -0
- package/dist/{token-CIWxJOCh.js → token-Bx9qy30p.js} +1 -1
- package/dist/tool-refusal-CQ7OEia9.js +41 -0
- package/dist/trpc/index.d.ts +5 -5
- package/dist/trpc/index.js +7 -8
- package/dist/{types-DbjRN55U.d.ts → types-7rJVLWe5.d.ts} +82 -4
- package/dist/{types-aqOHTHcp.d.ts → types-Br9IXUBG.d.ts} +1 -1
- package/dist/types-ByUo56un.d.ts +88 -0
- package/dist/{types-Cq_H8N_X.d.ts → types-C0dee0Qf.d.ts} +2 -2
- package/dist/{types-DxiCGmmd.d.ts → types-CIlTojhq.d.ts} +2 -2
- package/dist/{types-QCuYJh4q.d.ts → types-CUcFZfpU.d.ts} +1 -1
- package/dist/{types-C97IskBw.d.ts → types-CqrjB9o6.d.ts} +1 -1
- package/dist/{types-BnIEz1sU.d.ts → types-DHrmBJLH.d.ts} +24 -6
- package/dist/{types-Dnemwd77.d.ts → types-DpWfQdSh.d.ts} +5 -1
- package/dist/{types-Bvc4oWT6.d.ts → types-DvupZE0w.d.ts} +1 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-GTixvDDU.js → usage-4G6t643F.js} +2 -2
- package/dist/{usage-ItS7nLcl.js → usage-CG9nOYZw.js} +7 -7
- package/dist/usage-iFLJ0-rr.js +2 -0
- package/dist/{validation-error-Ba264OaJ.d.ts → validation-error-BSSw0l_8.d.ts} +1 -1
- package/dist/{validation-error-CnjZ4t92.js → validation-error-ZfUHbKvf.js} +1 -1
- package/dist/validity-dVrUEPJt.js +62 -0
- package/dist/{verifier-BxBo6I44.js → verifier-DMr_Zmb_.js} +51 -15
- package/dist/{rls-verify-CVQTHTh5.js → verify-BztUB3GX.js} +668 -239
- package/dist/{version-BvacVTZR.js → version-BEogC-rB.js} +1 -1
- package/dist/{views-Soe7bGSC.js → views-CJsrBS1f.js} +23 -1
- package/dist/{vocabulary-DA8a8zif.d.ts → vocabulary-hhEFLFoL.d.ts} +15 -6
- package/dist/vue/index.d.ts +24 -19
- package/dist/vue/index.js +24 -8
- package/dist/watch-C8TpsAl4.js +2 -0
- package/dist/{watch-DVBJ9cBq.js → watch-zeucB7eF.js} +6 -6
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +13 -37
- package/dist/wrap-Cr93qqdP.d.ts +14 -0
- package/dist/wrap-DWsU_5Bd.js +26 -0
- package/package.json +8 -8
- package/schemas/catalog-v1.json +6 -0
- package/skills/permdock-credentials/SKILL.md +1 -1
- package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
- package/skills/permdock-data/references/queries-and-rls.md +4 -0
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +1 -0
- package/skills/permdock-wire/SKILL.md +2 -2
- package/skills/permdock-wire/references/adapters.md +9 -1
- package/skills/permdock-wire/references/policy-options.md +10 -1
- package/dist/catalog-CRW5Mx_B.js +0 -2
- package/dist/collect-DSWOk19R.js +0 -2
- package/dist/create-CMwIl-w2.js +0 -253
- package/dist/delegation-D8pUEuce.js +0 -103
- package/dist/doctor-collect-CHk6XWOA.js +0 -665
- package/dist/doctor-igIiM_Hl.js +0 -1194
- package/dist/evaluation-items-CfCCejQd.js +0 -40
- package/dist/fields-BMl1RxoX.js +0 -26
- package/dist/grantee-Cv5Sogfv.js +0 -602
- package/dist/hosted-DJQw46hn.js +0 -266
- package/dist/instance-options-Dhhcnm3y.js +0 -22
- package/dist/load-DwJUafYN.js +0 -2
- package/dist/map-AcxK9o_D.js +0 -147
- package/dist/permissions-DVoF6dMt.js +0 -662
- package/dist/powersync-e_AZrKbg.js +0 -2
- package/dist/protected-xAr24FEC.d.ts +0 -40
- package/dist/relations-cjOL01hZ.js +0 -505
- package/dist/rls-graph-CHwx0V8q.js +0 -435
- package/dist/rls-shared-Cewd_-zI.js +0 -495
- package/dist/store-jOBYpiXC.d.ts +0 -36
- package/dist/stores-C0IMQrGI.d.ts +0 -52
- package/dist/supabase-config-BpPXt3x1.js +0 -472
- package/dist/supabase-hook-6sYLXg_u.js +0 -2
- package/dist/thenable-okc2xDsj.js +0 -10
- package/dist/types-CKNSyIf_.d.ts +0 -52
- package/dist/usage-DorAJiU_.js +0 -2
- package/dist/watch-BwxLTYMZ.js +0 -2
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { r as isRecord } from "./compact-CAf557ZB.js";
|
|
2
|
+
import { o as isForbiddenKey } from "./thenable-QSmvt-vZ.js";
|
|
3
|
+
import { t as byCodePoint } from "./compare-pfyVnBjE.js";
|
|
4
|
+
import { a as quoteSqlIdent, i as quoteQualifiedTable, o as quoteSqlLiteral, s as quoteSqlTable, t as SQL_IDENT } from "./sql-t8teWOfo.js";
|
|
5
|
+
import "./sources-B1-b-R0t.js";
|
|
6
|
+
//#region src/cli/sql/quote.ts
|
|
7
|
+
function quoteIdent(name) {
|
|
8
|
+
return quoteSqlIdent(name, CLI);
|
|
9
|
+
}
|
|
10
|
+
function quoteTable(name) {
|
|
11
|
+
return quoteSqlTable(name, CLI);
|
|
12
|
+
}
|
|
13
|
+
/** A table name with `public.` added when it names no schema, quoted. */
|
|
14
|
+
function quoteQualified(name) {
|
|
15
|
+
return quoteQualifiedTable(name, CLI);
|
|
16
|
+
}
|
|
17
|
+
function helperSchema(ctx) {
|
|
18
|
+
return ctx.schema ?? "permdock";
|
|
19
|
+
}
|
|
20
|
+
function qualified(ctx, name) {
|
|
21
|
+
return `${quoteIdent(helperSchema(ctx))}.${name}`;
|
|
22
|
+
}
|
|
23
|
+
function quoteLiteral(value) {
|
|
24
|
+
return quoteSqlLiteral(value);
|
|
25
|
+
}
|
|
26
|
+
const CLI = "PermDock CLI";
|
|
27
|
+
function declaredArray(values) {
|
|
28
|
+
return values.length === 0 ? `'{}'::text[]` : `array[${values.map(quoteLiteral).join(", ")}]::text[]`;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/cli/sql/columns.ts
|
|
32
|
+
/** The Postgres type a JSON Schema property compares as; `undefined` for text or an unknown shape. */
|
|
33
|
+
function columnTypeOf(property) {
|
|
34
|
+
if (!isRecord(property)) return;
|
|
35
|
+
const variants = [property["anyOf"], property["oneOf"]].find(Array.isArray);
|
|
36
|
+
if (variants !== void 0) {
|
|
37
|
+
const present = variants.filter((item) => !(isRecord(item) && item["type"] === "null"));
|
|
38
|
+
return present.length === 1 ? columnTypeOf(present[0]) : void 0;
|
|
39
|
+
}
|
|
40
|
+
const types = (Array.isArray(property["type"]) ? property["type"] : [property["type"]]).filter((item) => item !== "null");
|
|
41
|
+
if (types.length !== 1) return;
|
|
42
|
+
switch (types[0]) {
|
|
43
|
+
case "integer":
|
|
44
|
+
case "number": return "numeric";
|
|
45
|
+
case "boolean": return "boolean";
|
|
46
|
+
case "string": switch (property["format"]) {
|
|
47
|
+
case "date-time": return "timestamptz";
|
|
48
|
+
case "date": return "date";
|
|
49
|
+
case "uuid": return "uuid";
|
|
50
|
+
default: return;
|
|
51
|
+
}
|
|
52
|
+
default: return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Column types from a resource's JSON Schema (`~standard.jsonSchema`): numbers
|
|
57
|
+
* compare as `numeric`, booleans as `boolean`, and `date-time`, `date` and
|
|
58
|
+
* `uuid` strings as `timestamptz`, `date` and `uuid`. Other columns are left
|
|
59
|
+
* out and compare as text.
|
|
60
|
+
*/
|
|
61
|
+
function columnTypesOf(schema) {
|
|
62
|
+
const properties = isRecord(schema) ? schema["properties"] : void 0;
|
|
63
|
+
if (!isRecord(properties)) return {};
|
|
64
|
+
const types = {};
|
|
65
|
+
for (const [name, property] of Object.entries(properties)) {
|
|
66
|
+
const type = isForbiddenKey(name) ? void 0 : columnTypeOf(property);
|
|
67
|
+
if (type !== void 0) types[name] = type;
|
|
68
|
+
}
|
|
69
|
+
return types;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Array columns from a resource's JSON Schema, each with the type its items
|
|
73
|
+
* compare as (`text` when `columnTypesOf` would leave the item out).
|
|
74
|
+
*/
|
|
75
|
+
function arrayColumnsOf(schema) {
|
|
76
|
+
const properties = isRecord(schema) ? schema["properties"] : void 0;
|
|
77
|
+
if (!isRecord(properties)) return {};
|
|
78
|
+
const arrays = {};
|
|
79
|
+
for (const [name, property] of Object.entries(properties)) {
|
|
80
|
+
if (isForbiddenKey(name) || !isRecord(property)) continue;
|
|
81
|
+
const types = (Array.isArray(property["type"]) ? property["type"] : [property["type"]]).filter((item) => item !== "null");
|
|
82
|
+
if (types.length === 1 && types[0] === "array") arrays[name] = columnTypeOf(property["items"]) ?? "text";
|
|
83
|
+
}
|
|
84
|
+
return arrays;
|
|
85
|
+
}
|
|
86
|
+
const SQL_TYPE = /^[A-Za-z_][A-Za-z0-9_]*( [A-Za-z_][A-Za-z0-9_]*)*(\[\])?$/u;
|
|
87
|
+
function sqlType(name) {
|
|
88
|
+
if (!SQL_TYPE.test(name)) throw new Error(`PermDock CLI: unsafe SQL type '${name}'`);
|
|
89
|
+
return name;
|
|
90
|
+
}
|
|
91
|
+
function tenantTypeOf(ctx) {
|
|
92
|
+
return sqlType(ctx.tenantType ?? "uuid");
|
|
93
|
+
}
|
|
94
|
+
function teamTypeOf(ctx) {
|
|
95
|
+
return sqlType(ctx.teamType ?? ctx.tenantType ?? "uuid");
|
|
96
|
+
}
|
|
97
|
+
/** Postgres type of scope `name`'s id: `scopeTypes`, then the tenant / team type by position. */
|
|
98
|
+
function scopeTypeOf(ctx, name) {
|
|
99
|
+
const declared = ctx.scopeTypes?.[name];
|
|
100
|
+
if (declared !== void 0) return sqlType(declared);
|
|
101
|
+
return name === ctx.scopes[1]?.name ? teamTypeOf(ctx) : tenantTypeOf(ctx);
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/cli/sql/context.ts
|
|
105
|
+
const CLAIM = SQL_IDENT;
|
|
106
|
+
function parseMembershipsFlag(raw) {
|
|
107
|
+
if (raw === void 0 || raw === "") return;
|
|
108
|
+
const colon = raw.indexOf(":");
|
|
109
|
+
const table = colon === -1 ? raw : raw.slice(0, colon);
|
|
110
|
+
const cols = (colon === -1 ? "" : raw.slice(colon + 1)).split(",").map((item) => item.trim()).filter((item) => item !== "");
|
|
111
|
+
return { tenant: {
|
|
112
|
+
table,
|
|
113
|
+
tenant: cols[0] ?? "tenant_id",
|
|
114
|
+
user: cols[1] ?? "user_id",
|
|
115
|
+
role: cols[2] ?? "role",
|
|
116
|
+
...cols[3] === void 0 ? {} : { expiresAt: cols[3] }
|
|
117
|
+
} };
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/cli/sql/subject.ts
|
|
121
|
+
/**
|
|
122
|
+
* A role with `for` counts only on a membership of one of those kinds:
|
|
123
|
+
* `case role when 'admin' then via = any(...) ... else true end`. A missing
|
|
124
|
+
* kind (`viaExpr` null) holds none of them. A constant kind folds into the
|
|
125
|
+
* roles it excludes, or no filter. `undefined` when nothing is filtered.
|
|
126
|
+
*/
|
|
127
|
+
function kindFilterSql(ctx, roleExpr, viaExpr) {
|
|
128
|
+
const kinds = Object.entries(ctx.ownership?.kinds ?? {}).toSorted(([a], [b]) => byCodePoint(a, b));
|
|
129
|
+
if (kinds.length === 0) return;
|
|
130
|
+
if (typeof viaExpr !== "string") {
|
|
131
|
+
const excluded = kinds.filter(([, allowed]) => !viaAllowed(viaExpr.value, allowed)).map(([role]) => role);
|
|
132
|
+
return excluded.length === 0 ? void 0 : `not (${roleExpr} = any(array[${excluded.map(quoteLiteral).join(", ")}]::text[]))`;
|
|
133
|
+
}
|
|
134
|
+
return `case ${roleExpr} ${kinds.map(([role, allowed]) => `when ${quoteLiteral(role)} then coalesce(${viaExpr}, '') = any(array[${allowed.map(quoteLiteral).join(", ")}]::text[])`).join(" ")} else true end`;
|
|
135
|
+
}
|
|
136
|
+
/** The kind check for one known role; `undefined` when it has no `for` or a constant kind it allows. */
|
|
137
|
+
function roleKindSql(ctx, role, viaExpr) {
|
|
138
|
+
const allowed = ctx.ownership?.kinds[role];
|
|
139
|
+
if (allowed === void 0) return;
|
|
140
|
+
if (typeof viaExpr !== "string") return viaAllowed(viaExpr.value, allowed) ? void 0 : "false";
|
|
141
|
+
return `coalesce(${viaExpr}, '') = any(array[${allowed.map(quoteLiteral).join(", ")}]::text[])`;
|
|
142
|
+
}
|
|
143
|
+
/** Roles with `for` held globally (no membership, so no kind) grant nothing. */
|
|
144
|
+
function globalKindFilterSql(ctx, roleExpr) {
|
|
145
|
+
const roles = Object.keys(ctx.ownership?.kinds ?? {}).toSorted();
|
|
146
|
+
return roles.length === 0 ? void 0 : `not (${roleExpr} = any(array[${roles.map(quoteLiteral).join(", ")}]::text[]))`;
|
|
147
|
+
}
|
|
148
|
+
function keyTenantSql(ctx, tenant) {
|
|
149
|
+
const keys = ctx.apiKeys;
|
|
150
|
+
if (keys === void 0) return;
|
|
151
|
+
const named = `nullif(${subjectClaimJsonSql(ctx, keys.claim)} ->> ${quoteLiteral(keys.tenant)}, '')`;
|
|
152
|
+
return tenant === void 0 ? `${named} is null` : `(${named} is null or (${tenant})::text = ${named})`;
|
|
153
|
+
}
|
|
154
|
+
/** The active-tenant claim cast to the tenant column's type, so the comparison uses the column's index. */
|
|
155
|
+
function tenantClaimSql(ctx) {
|
|
156
|
+
return `${subjectClaimSql(ctx, ctx.tenantClaim)}::${tenantTypeOf(ctx)}`;
|
|
157
|
+
}
|
|
158
|
+
const USER_ID_HELPER = "permdock_user_id";
|
|
159
|
+
function userIdHelperSql(ctx) {
|
|
160
|
+
return qualified(ctx, USER_ID_HELPER);
|
|
161
|
+
}
|
|
162
|
+
const SESSION_LIVE_HELPER = "permdock_session_live";
|
|
163
|
+
/** `{ subject: { session: { live: true } } }` in a policy; only Supabase has `auth.sessions`. */
|
|
164
|
+
function liveSessionSql(ctx) {
|
|
165
|
+
if (ctx.dialect !== "supabase") throw new Error(`PermDock CLI: { subject: { session: { live: true } } } reads auth.sessions, which only the supabase dialect has (got ${ctx.dialect})`);
|
|
166
|
+
return `(select ${qualified(ctx, SESSION_LIVE_HELPER)}())`;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* `permdock_session_live()`: the token's `session_id` names a session of its
|
|
170
|
+
* user that is still in `auth.sessions`, so a signed-out or revoked session
|
|
171
|
+
* stops passing before the token's `exp`. A token without one, such as a
|
|
172
|
+
* service key's, is never live.
|
|
173
|
+
*/
|
|
174
|
+
function sessionLiveHelperSql(ctx) {
|
|
175
|
+
const name = qualified(ctx, SESSION_LIVE_HELPER);
|
|
176
|
+
return `create or replace function ${name}()
|
|
177
|
+
returns boolean
|
|
178
|
+
language plpgsql
|
|
179
|
+
stable
|
|
180
|
+
security definer
|
|
181
|
+
set search_path = ''
|
|
182
|
+
as $$
|
|
183
|
+
declare
|
|
184
|
+
v_session uuid;
|
|
185
|
+
begin
|
|
186
|
+
begin
|
|
187
|
+
v_session := nullif((select auth.jwt()) ->> 'session_id', '')::uuid;
|
|
188
|
+
exception when invalid_text_representation then
|
|
189
|
+
return false;
|
|
190
|
+
end;
|
|
191
|
+
if v_session is null then
|
|
192
|
+
return false;
|
|
193
|
+
end if;
|
|
194
|
+
return exists (
|
|
195
|
+
select 1
|
|
196
|
+
from auth.sessions s
|
|
197
|
+
where s.id = v_session
|
|
198
|
+
and s.user_id::text = ${subjectIdSql(ctx)}::text
|
|
199
|
+
and (s.not_after is null or s.not_after > now())
|
|
200
|
+
);
|
|
201
|
+
end;
|
|
202
|
+
$$;
|
|
203
|
+
revoke execute on function ${name}() from public, anon;
|
|
204
|
+
grant execute on function ${name}() to authenticated;
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
function subjectIdSql(ctx) {
|
|
208
|
+
if (ctx.subjectId !== void 0) return ctx.subjectId;
|
|
209
|
+
switch (ctx.dialect) {
|
|
210
|
+
case "supabase": return `(select ${userIdHelperSql(ctx)}())`;
|
|
211
|
+
case "neon": return "(select auth.user_id())";
|
|
212
|
+
case "guc": return `(select current_setting(${quoteLiteral(`${ctx.gucPrefix}.user_id`)}, true))`;
|
|
213
|
+
default: return ctx.dialect;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function subjectClaimSql(ctx, claim) {
|
|
217
|
+
if (!CLAIM.test(claim)) throw new Error(`PermDock CLI: unsafe claim name '${claim}'`);
|
|
218
|
+
switch (ctx.dialect) {
|
|
219
|
+
case "supabase": return `((select auth.jwt()) ->> ${quoteLiteral(claim)})`;
|
|
220
|
+
case "neon": return `((select auth.session()) ->> ${quoteLiteral(claim)})`;
|
|
221
|
+
case "guc": return `(select current_setting(${quoteLiteral(`${ctx.gucPrefix}.${claim}`)}, true))`;
|
|
222
|
+
default: return ctx.dialect;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** A claim as `jsonb`; the `guc` dialect stores JSON text in `<prefix>.<claim>`. */
|
|
226
|
+
function subjectClaimJsonSql(ctx, claim) {
|
|
227
|
+
if (!CLAIM.test(claim)) throw new Error(`PermDock CLI: unsafe claim name '${claim}'`);
|
|
228
|
+
switch (ctx.dialect) {
|
|
229
|
+
case "supabase": return `((select auth.jwt()) -> ${quoteLiteral(claim)})`;
|
|
230
|
+
case "neon": return `((select auth.session()) -> ${quoteLiteral(claim)})`;
|
|
231
|
+
case "guc": return `nullif((select current_setting(${quoteLiteral(`${ctx.gucPrefix}.${claim}`)}, true)), '')::jsonb`;
|
|
232
|
+
default: return ctx.dialect;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function viaAllowed(value, allowed) {
|
|
236
|
+
return allowed.includes(value ?? "");
|
|
237
|
+
}
|
|
238
|
+
/** The membership kind of a row `m` of `table`: its column as text, or its constant (`null` without one). */
|
|
239
|
+
function memberVia(table) {
|
|
240
|
+
const via = table.via;
|
|
241
|
+
if (via === void 0) return { value: null };
|
|
242
|
+
return typeof via === "string" ? `m.${quoteIdent(via)}::text` : { value: via.value };
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/cli/sql/shared.ts
|
|
246
|
+
/** `rls.customRoles` turns custom roles on as `true` or as an object. */
|
|
247
|
+
function customRolesOn(rls) {
|
|
248
|
+
const custom = rls?.customRoles;
|
|
249
|
+
return custom === true || typeof custom === "object" && custom !== null;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The per-statement helpers every generated policy calls: `permdock_has` for
|
|
253
|
+
* global roles and one `permitted_<scope>_ids` per scope
|
|
254
|
+
* (`permittedIdsHelper`). Names are part of the SQL contract.
|
|
255
|
+
*/
|
|
256
|
+
const HELPERS = {
|
|
257
|
+
has: "permdock_has",
|
|
258
|
+
hasFor: "permdock_has_for"
|
|
259
|
+
};
|
|
260
|
+
/** Objects `--custom-roles` adds next to the helpers. Names are part of the SQL contract. */
|
|
261
|
+
const CUSTOM_ROLES = {
|
|
262
|
+
permissions: "custom_role_permissions",
|
|
263
|
+
includes: "custom_role_includes",
|
|
264
|
+
ceiling: "permdock_ceiling",
|
|
265
|
+
keys: "permdock_custom_keys",
|
|
266
|
+
beyond: "permdock_custom_role_beyond",
|
|
267
|
+
guard: "permdock_custom_role_guard",
|
|
268
|
+
beyondFor: "permdock_custom_role_beyond_for",
|
|
269
|
+
guardFor: "permdock_custom_role_guard_for",
|
|
270
|
+
shape: "permdock_custom_role_shape",
|
|
271
|
+
entries: "permdock_custom_role_entries",
|
|
272
|
+
replace: "permdock_replace_custom_role_grants",
|
|
273
|
+
rename: "permdock_rename_custom_role_grants",
|
|
274
|
+
remove: "permdock_delete_custom_role_grants",
|
|
275
|
+
trustedReplace: "permdock_trusted_replace_custom_role_grants",
|
|
276
|
+
trustedRename: "permdock_trusted_rename_custom_role_grants",
|
|
277
|
+
trustedRemove: "permdock_trusted_delete_custom_role_grants",
|
|
278
|
+
cascade: "permdock_cascade_custom_role"
|
|
279
|
+
};
|
|
280
|
+
/** The function `rls.roles` adds. The name is part of the SQL contract. */
|
|
281
|
+
const GLOBAL_ROLES = { replace: "permdock_replace_global_roles" };
|
|
282
|
+
/** `user` is the SQL for the user id: the dialect's (the default) or the `p_user` parameter of a `_for` helper. */
|
|
283
|
+
function signedIn(ctx, user = subjectIdSql(ctx)) {
|
|
284
|
+
return `coalesce(${user}::text, '') <> ''`;
|
|
285
|
+
}
|
|
286
|
+
function rootName(ctx) {
|
|
287
|
+
return ctx.scopes[0]?.name ?? "tenant";
|
|
288
|
+
}
|
|
289
|
+
/** The stored allow as `permissions` hands it to `permdock_custom_keys`: `key`, or `key@level` with levels. */
|
|
290
|
+
function allowEntry(ctx) {
|
|
291
|
+
return ctx.customRoles?.levels === true ? "permission || coalesce('@' || c.level, '')" : "permission";
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
export { declaredArray as A, parseMembershipsFlag as C, sqlType as D, scopeTypeOf as E, quoteQualified as F, quoteTable as I, qualified as M, quoteIdent as N, tenantTypeOf as O, quoteLiteral as P, CLAIM as S, columnTypesOf as T, subjectClaimJsonSql as _, customRolesOn as a, tenantClaimSql as b, SESSION_LIVE_HELPER as c, keyTenantSql as d, kindFilterSql as f, sessionLiveHelperSql as g, roleKindSql as h, allowEntry as i, helperSchema as j, CLI as k, USER_ID_HELPER as l, memberVia as m, GLOBAL_ROLES as n, rootName as o, liveSessionSql as p, HELPERS as r, signedIn as s, CUSTOM_ROLES as t, globalKindFilterSql as u, subjectClaimSql as v, arrayColumnsOf as w, userIdHelperSql as x, subjectIdSql as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cn as MembershipEvent, W as DecisionSink, bn as CredentialEvent, lt as TokenSigner, mt as Credential, vn as AccessEvent, wn as SinkEvent } from "./policy-types-sp9P1iIV.js";
|
|
2
2
|
//#region src/core/sink.d.ts
|
|
3
3
|
/** The closed list of CloudEvents `type` values PermDock emits. */
|
|
4
4
|
declare const CLOUD_EVENT_TYPES: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as byCodePoint } from "./compare-pfyVnBjE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as readJsonFile } from "./files-D_JIzUrP.js";
|
|
3
|
+
import { t as packageRoot } from "./package-root-DtNnpmUd.js";
|
|
3
4
|
import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, writeFileSync } from "node:fs";
|
|
4
5
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
@@ -154,7 +155,7 @@ function filesOf(root, folder = root) {
|
|
|
154
155
|
}
|
|
155
156
|
function listSkills(cwd) {
|
|
156
157
|
const lockPath = join(cwd, ".permdock/skills-lock.json");
|
|
157
|
-
const lock = existsSync(lockPath) ?
|
|
158
|
+
const lock = existsSync(lockPath) ? readJsonFile(lockPath) : {};
|
|
158
159
|
const lines = ["permdock skills", ""];
|
|
159
160
|
for (const name of SKILL_NAMES) {
|
|
160
161
|
const places = Object.values(AGENT_FOLDERS).filter((folder) => existsSync(join(cwd, folder, name, "SKILL.md")));
|
|
@@ -186,7 +187,7 @@ function resolveSkillsRoot(cwd, bundled) {
|
|
|
186
187
|
function readPermdockVersion(skillsRoot) {
|
|
187
188
|
const pkg = join(dirname(skillsRoot), "package.json");
|
|
188
189
|
if (!existsSync(pkg)) return "0.0.0";
|
|
189
|
-
return
|
|
190
|
+
return readJsonFile(pkg).version;
|
|
190
191
|
}
|
|
191
192
|
//#endregion
|
|
192
193
|
export { runSkillsInstall as i, detectedAgents as n, runSkills as r, SKILL_AGENTS as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-
|
|
1
|
+
import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-Cpip4ULx.js";
|
|
2
2
|
import { r as pick, t as CANCELLED } from "./prompt-CXYhLfsS.js";
|
|
3
|
-
import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-
|
|
3
|
+
import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-BZdRQkxs.js";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/cli/commands/skills.ts
|
|
6
6
|
function skills(ctx) {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { n as isReadonlyArray, r as
|
|
1
|
+
import { a as sole, n as isReadonlyArray, r as isRecord, t as compact } from "./compact-CAf557ZB.js";
|
|
2
2
|
import { n as freezeDeep } from "./freeze-CrU8nQeX.js";
|
|
3
|
-
import {
|
|
4
|
-
import { c as isConditionRef, i as resolveConditionRef, s as isConditionDate, u as parentHop } from "./refs-
|
|
3
|
+
import { o as isForbiddenKey, s as ownGet } from "./thenable-QSmvt-vZ.js";
|
|
4
|
+
import { c as isConditionRef, i as resolveConditionRef, s as isConditionDate, u as parentHop } from "./refs-f3imMjNW.js";
|
|
5
5
|
import { t as expiredAt } from "./expiry-BoBJ8Tvc.js";
|
|
6
6
|
import { n as sameId } from "./ids-DC4V4CFu.js";
|
|
7
|
-
import { d as scopeList, l as scopeChain, m as tenantOf, o as resolveScope, p as subjectMemberships, r as findScope, t as activeFor, u as scopeIdOf } from "./scopes-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { d as scopeList, l as scopeChain, m as tenantOf, o as resolveScope, p as subjectMemberships, r as findScope, t as activeFor, u as scopeIdOf } from "./scopes-tvpa34ep.js";
|
|
8
|
+
import { g as formerScopes, m as annotationsFor, n as findPermission } from "./permission-registry-BsblpB-z.js";
|
|
9
|
+
import { _ as listPlans, o as flattenGrantee, v as listRoles } from "./grantee-CXY-0C87.js";
|
|
10
|
+
import { t as isActive } from "./validity-dVrUEPJt.js";
|
|
11
|
+
import { o as resourceRoleCondition } from "./grantee-conditions-MQs5NIuX.js";
|
|
12
|
+
import { m as tenantsOf, n as inTeam, o as membershipField, r as isMembershipExpired } from "./tenancy-DshjqY0n.js";
|
|
13
|
+
import { n as matchGrantee } from "./grantee-match-fxYp9Nmt.js";
|
|
10
14
|
//#region src/conditions/evaluate.ts
|
|
11
15
|
function resolveRef(ref, subject) {
|
|
12
16
|
return resolveConditionRef(ref, subject);
|
|
@@ -167,9 +171,6 @@ const denied = (reason) => freezeDeep({
|
|
|
167
171
|
}],
|
|
168
172
|
alternatives: []
|
|
169
173
|
});
|
|
170
|
-
function isRecord(value) {
|
|
171
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
172
|
-
}
|
|
173
174
|
function asString(value) {
|
|
174
175
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
175
176
|
}
|
|
@@ -567,6 +568,105 @@ function rowIdOf(row, field = "id") {
|
|
|
567
568
|
return typeof id === "string" || typeof id === "number" ? String(id) : "*";
|
|
568
569
|
}
|
|
569
570
|
//#endregion
|
|
571
|
+
//#region src/core/delegation.ts
|
|
572
|
+
/** The permission's scope and any scope it was renamed from: tokens issued before a rename keep working. */
|
|
573
|
+
function scopeNames(permission) {
|
|
574
|
+
return [permission.scope, ...formerScopes(permission)];
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Whether a delegated caller may use a permission its principal holds, through
|
|
578
|
+
* OAuth `scopes`, RFC 9396 `authorizationDetails` or GNAP `access`.
|
|
579
|
+
* `undefined` means covered; otherwise the denial reason `decide` would add.
|
|
580
|
+
*/
|
|
581
|
+
function coveredByDelegation(permission, delegation, resourceId, hasActor = false) {
|
|
582
|
+
const unscoped = hasActor ? "no-delegation" : void 0;
|
|
583
|
+
if (delegation === void 0) return unscoped;
|
|
584
|
+
const hasScopes = delegation.scopes !== void 0;
|
|
585
|
+
const hasDetails = delegation.authorizationDetails !== void 0;
|
|
586
|
+
const hasAccess = delegation.access !== void 0;
|
|
587
|
+
if (!hasScopes && !hasDetails && !hasAccess) return unscoped;
|
|
588
|
+
const emptyScopes = hasScopes && (delegation.scopes?.length ?? 0) === 0;
|
|
589
|
+
const emptyAccess = hasAccess && (delegation.access?.length ?? 0) === 0;
|
|
590
|
+
if (emptyScopes && !hasDetails && !hasAccess) return "no-delegation";
|
|
591
|
+
if (emptyAccess && !hasScopes && !hasDetails) return "no-delegation";
|
|
592
|
+
if (emptyScopes && emptyAccess && !hasDetails) return "no-delegation";
|
|
593
|
+
const scopes = scopeNames(permission);
|
|
594
|
+
const scopeOk = delegation.scopes?.some((scope) => scopes.includes(scope)) ?? false;
|
|
595
|
+
const detailOk = delegation.authorizationDetails?.some((detail) => {
|
|
596
|
+
if (detail.type !== permission.resource) return false;
|
|
597
|
+
const identifier = detail["identifier"];
|
|
598
|
+
if (identifier !== void 0 && (typeof identifier !== "string" || identifier !== resourceId)) return false;
|
|
599
|
+
const actions = detail.actions;
|
|
600
|
+
if (actions === void 0) return true;
|
|
601
|
+
return Array.isArray(actions) && actions.includes(permission.action);
|
|
602
|
+
}) ?? false;
|
|
603
|
+
const accessOk = accessCovers(permission, delegation.access, resourceId);
|
|
604
|
+
if (scopeOk || detailOk || accessOk) return;
|
|
605
|
+
return "not-delegated";
|
|
606
|
+
}
|
|
607
|
+
function coversRequirements(tree, requires, delegation, resourceId, hasActor = false) {
|
|
608
|
+
return (requires ?? []).every((key) => {
|
|
609
|
+
const leaf = findPermission(tree, key);
|
|
610
|
+
return leaf !== void 0 && coveredByDelegation(leaf, delegation, resourceId, hasActor) === void 0;
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
function requiresStandIn(grant) {
|
|
614
|
+
return (grant.requires ?? []).length > 0 && annotationsFor(grant.permission).readOnlyHint && !flattenGrantee(grant.to).some((item) => item.kind === "role");
|
|
615
|
+
}
|
|
616
|
+
function accessCovers(permission, access, resourceId) {
|
|
617
|
+
if (access === void 0) return false;
|
|
618
|
+
return access.some((entry) => {
|
|
619
|
+
if (typeof entry === "string") return scopeNames(permission).includes(entry);
|
|
620
|
+
if (entry === null || typeof entry !== "object") return false;
|
|
621
|
+
const type = entry["type"];
|
|
622
|
+
if (typeof type !== "string" || !typeMatches(type, permission.resource)) return false;
|
|
623
|
+
const actions = entry["actions"];
|
|
624
|
+
if (actions !== void 0 && (!Array.isArray(actions) || !actions.includes(permission.action))) return false;
|
|
625
|
+
const identifier = entry["identifier"];
|
|
626
|
+
if (identifier !== void 0 && (typeof identifier !== "string" || identifier !== resourceId)) return false;
|
|
627
|
+
return true;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function typeMatches(type, resource) {
|
|
631
|
+
if (type === resource) return true;
|
|
632
|
+
return type.endsWith(`/${resource}`);
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Whether the subject's principal is a `from` of the delegation: every item
|
|
636
|
+
* matches, with roles checked against the roles the principal holds here
|
|
637
|
+
* (`matchGrantee` leaves role holding to the caller) and nothing that needs a
|
|
638
|
+
* row.
|
|
639
|
+
*/
|
|
640
|
+
function handsOver(delegation, subject, heldRoles, now) {
|
|
641
|
+
const items = flattenGrantee(delegation.from);
|
|
642
|
+
if (items.length === 0 || subject.principal === null) return false;
|
|
643
|
+
return items.every((item) => {
|
|
644
|
+
if (item.kind === "role") return heldRoles.has(item.role);
|
|
645
|
+
if (item.kind === "relation") return false;
|
|
646
|
+
const match = matchGrantee(item, subject, now, void 0);
|
|
647
|
+
return match.matched && match.where === void 0;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* The permission keys the policy's delegations let `subject.actor` use for
|
|
652
|
+
* `subject.principal` right now: the union over every active delegation whose
|
|
653
|
+
* `to` matches the actor and whose `from` the principal holds. `undefined`
|
|
654
|
+
* when none applies, so the call falls back to the token delegation alone.
|
|
655
|
+
* An actor with `readOnly: true` gets only each delegation's read-only keys.
|
|
656
|
+
* Attenuation only: a key here still needs a matching allow and no deny.
|
|
657
|
+
*/
|
|
658
|
+
function delegatedPermissions(delegations, subject, heldRoles, now) {
|
|
659
|
+
const actor = subject.actor;
|
|
660
|
+
if (actor === void 0 || delegations === void 0) return;
|
|
661
|
+
let keys;
|
|
662
|
+
for (const delegation of delegations) {
|
|
663
|
+
if (delegation.to.kind !== actor.kind || delegation.to.id !== void 0 && delegation.to.id !== actor.id || delegation.to.client !== void 0 && delegation.to.client !== actor.client || !isActive(delegation.validity, now) || !handsOver(delegation, subject, heldRoles, now)) continue;
|
|
664
|
+
keys ??= /* @__PURE__ */ new Set();
|
|
665
|
+
for (const key of actor.readOnly === true ? delegation.readOnly : delegation.permissions) keys.add(key);
|
|
666
|
+
}
|
|
667
|
+
return keys;
|
|
668
|
+
}
|
|
669
|
+
//#endregion
|
|
570
670
|
//#region src/conditions/bind.ts
|
|
571
671
|
function isPrimitive(value) {
|
|
572
672
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
@@ -646,11 +746,11 @@ function bindConditionRefs(condition, subject, only) {
|
|
|
646
746
|
}
|
|
647
747
|
//#endregion
|
|
648
748
|
//#region src/core/where-scope.ts
|
|
649
|
-
const ALWAYS = {
|
|
749
|
+
const ALWAYS = freezeDeep({
|
|
650
750
|
op: "eq",
|
|
651
751
|
field: "_",
|
|
652
752
|
value: true
|
|
653
|
-
};
|
|
753
|
+
});
|
|
654
754
|
function eq(field, value) {
|
|
655
755
|
return value === void 0 ? {
|
|
656
756
|
op: "or",
|
|
@@ -838,7 +938,10 @@ function snapshotGrant(grant, membership) {
|
|
|
838
938
|
membership,
|
|
839
939
|
portable: grant.portable ? void 0 : false,
|
|
840
940
|
fields: grant.fields,
|
|
841
|
-
validity: grant.validity
|
|
941
|
+
validity: grant.validity,
|
|
942
|
+
name: grant.name,
|
|
943
|
+
meta: grant.meta,
|
|
944
|
+
obligations: grant.obligations
|
|
842
945
|
});
|
|
843
946
|
return freezeDeep(entry);
|
|
844
947
|
}
|
|
@@ -972,4 +1075,4 @@ function parseSnapshot(json) {
|
|
|
972
1075
|
return freezeDeep(value);
|
|
973
1076
|
}
|
|
974
1077
|
//#endregion
|
|
975
|
-
export { whereFromGrants as a,
|
|
1078
|
+
export { evaluateCondition as _, whereFromGrants as a, coversRequirements as c, isRowPair as d, rowIdOf as f, simulateArazzo as g, isArazzoSimulateInput as h, signSnapshot as i, delegatedPermissions as l, arazzoFindings as m, parseSnapshot as n, bindConditionRefs as o, rowValues as p, snapshotGrant as r, coveredByDelegation as s, buildSnapshot as t, requiresStandIn as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { an as Snapshot } from "./policy-types-sp9P1iIV.js";
|
|
2
2
|
//#region src/core/snapshot-cache.d.ts
|
|
3
3
|
type CacheLifeForOptions = {
|
|
4
4
|
/** Lower bound in seconds. Next.js includes a private entry in per-link prefetches from 30. */
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as Role } from "../vocabulary-
|
|
4
|
-
import { n as requiredPlans } from "../problem-details-
|
|
5
|
-
import { i as describe } from "../describe-
|
|
1
|
+
import { Dr as Membership, an as Snapshot, ir as Decision, rr as ApprovalRequiredDecision, ur as GrantedDecision, ut as TokenVerifier } from "../policy-types-sp9P1iIV.js";
|
|
2
|
+
import { d as Permission } from "../permission-types-Dg39z9Kv.js";
|
|
3
|
+
import { r as Role } from "../vocabulary-hhEFLFoL.js";
|
|
4
|
+
import { n as requiredPlans } from "../problem-details-rIIo8B2C.js";
|
|
5
|
+
import { i as describe, r as DescribeOptions, t as DecisionDescription } from "../describe-C3ldA9os.js";
|
|
6
6
|
import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
|
|
7
7
|
import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
|
|
8
|
-
import { a as
|
|
8
|
+
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, u as ProviderOptionsBase } from "../store-9KO4BlkB.js";
|
|
9
9
|
import { Accessor, Accessor as Accessor$1, JSX } from "solid-js";
|
|
10
10
|
//#region src/solid/types.d.ts
|
|
11
11
|
/** Structural `JSX.Element`: text, a DOM node or a list of children. */
|
|
12
12
|
type SolidChild = string | number | boolean | null | undefined | {
|
|
13
13
|
readonly nodeType: number;
|
|
14
14
|
} | readonly SolidChild[];
|
|
15
|
-
type PermDockProviderProps = {
|
|
15
|
+
type PermDockProviderProps = ProviderOptionsBase & {
|
|
16
16
|
/**
|
|
17
17
|
* An accessor re-hydrates the store when it changes and keeps it `pending`
|
|
18
18
|
* while it returns `undefined` (a loading `createResource`); a promise keeps
|
|
19
19
|
* the store `pending` until it settles.
|
|
20
20
|
*/
|
|
21
21
|
readonly snapshot: Snapshot | string | Accessor$1<Snapshot | string | undefined> | PromiseLike<Snapshot | string>;
|
|
22
|
-
/**
|
|
23
|
-
* The AuthZEN evaluations endpoint for checks the snapshot cannot answer.
|
|
24
|
-
* `false` never calls one: such a check is denied with reason `server-only`.
|
|
25
|
-
*/
|
|
26
|
-
readonly endpoint?: string | false;
|
|
27
|
-
/** Where `refresh()` fetches a fresh snapshot. Defaults to `endpoint`. */
|
|
28
|
-
readonly snapshotUrl?: string;
|
|
29
|
-
readonly approvals?: string;
|
|
30
22
|
/** A change switches the active tenant (`refresh({ tenant })`). */
|
|
31
23
|
readonly tenant?: string;
|
|
32
|
-
/**
|
|
33
|
-
readonly fetch?: typeof fetch;
|
|
24
|
+
/** Read on every request, with `verifier`, so a rotated token applies without a new store. */
|
|
34
25
|
readonly headers?: Readonly<Record<string, string>>;
|
|
35
|
-
readonly maxAge?: number;
|
|
36
26
|
readonly verifier?: TokenVerifier;
|
|
27
|
+
/** What every `<Protected>` below renders for a slot it leaves out. */
|
|
28
|
+
readonly defaults?: PermDockDefaults;
|
|
37
29
|
readonly children: unknown;
|
|
38
30
|
};
|
|
31
|
+
/** Provider-wide content for the `<Protected>` slots a component leaves out. */
|
|
32
|
+
type PermDockDefaults = {
|
|
33
|
+
readonly pending?: SolidChild;
|
|
34
|
+
readonly fallback?: SolidChild | ((decision: Decision) => SolidChild);
|
|
35
|
+
readonly approval?: SolidChild | ((decision: ApprovalRequiredDecision) => SolidChild);
|
|
36
|
+
};
|
|
39
37
|
type PermissionBoundaryProps = {
|
|
40
38
|
/** Rendered in place of the children when one throws `PermDockDeniedError`. */
|
|
41
39
|
readonly denied?: SolidChild | ((state: PermissionBoundaryState) => SolidChild);
|
|
@@ -49,9 +47,9 @@ type ProtectedProps = {
|
|
|
49
47
|
readonly tenant?: string;
|
|
50
48
|
readonly pending?: SolidChild;
|
|
51
49
|
readonly fallback?: SolidChild | ((decision: Decision) => SolidChild);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
/** Rendered for an approval-required decision; defaults to `fallback`. */
|
|
51
|
+
readonly approval?: SolidChild | ((decision: ApprovalRequiredDecision) => SolidChild);
|
|
52
|
+
readonly children: SolidChild | ((decision: GrantedDecision) => SolidChild);
|
|
55
53
|
};
|
|
56
54
|
//#endregion
|
|
57
55
|
//#region src/solid/hooks.d.ts
|
|
@@ -72,6 +70,8 @@ export declare function useAssignablePermissions(options?: {
|
|
|
72
70
|
}>): Accessor<readonly Permission[]>;
|
|
73
71
|
export declare function useSubject(): Accessor<SubjectView>;
|
|
74
72
|
export declare function useApproval(decision: Accessor<Decision>): Accessor<ApprovalHandle>;
|
|
73
|
+
/** `describe` with the provider's `messages`; a call's own `messages` win. */
|
|
74
|
+
export declare function useDescribe(): (decision: Decision, options?: DescribeOptions) => DecisionDescription;
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/solid/boundary.d.ts
|
|
77
77
|
/**
|
|
@@ -90,4 +90,4 @@ export declare function Protected(props: ProtectedProps): JSX.Element;
|
|
|
90
90
|
//#region src/solid/provider.d.ts
|
|
91
91
|
export declare function PermDockProvider(props: PermDockProviderProps): JSX.Element;
|
|
92
92
|
//#endregion
|
|
93
|
-
export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockProviderProps, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SolidChild, type SubjectView, type TenantView, type UseRolesOptions, approvalHeaders, describe, requiredPlans };
|
|
93
|
+
export { type ApprovalHandle, type ApprovalState, type ClientPermDock, type ClientStatus, type FilterResult, type PermDockDefaults, type PermDockProviderProps, type PermissionBoundaryProps, type PermissionBoundaryState, type PermissionSet, type PermissionState, type ProtectedProps, type SolidChild, type SubjectView, type TenantView, type UseRolesOptions, approvalHeaders, describe, requiredPlans };
|