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
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { r as isRecord } from "./compact-CAf557ZB.js";
|
|
1
2
|
import { i as describeError } from "./errors-CWfoNg9N.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./sources-
|
|
5
|
-
import {
|
|
3
|
+
import { o as sqlFiles } from "./files-D_JIzUrP.js";
|
|
4
|
+
import { n as escapeSqlIdent, o as quoteSqlLiteral } from "./sql-t8teWOfo.js";
|
|
5
|
+
import "./sources-B1-b-R0t.js";
|
|
6
|
+
import { a as RETIRE_MARKER } from "./markers-CiwAOZtO.js";
|
|
7
|
+
import { r as HELPERS } from "./shared-1uhI-e-b.js";
|
|
8
|
+
import { l as writeOutputFiles, t as dataMigrationFile } from "./output-files-CgIsvdSa.js";
|
|
9
|
+
import { o as sqlStatements } from "./deciding-columns-Sq12mEA6.js";
|
|
10
|
+
import { i as retireSql, r as retirePlan } from "./retire-BFcxL6un.js";
|
|
6
11
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
12
|
import { relative, resolve } from "node:path";
|
|
8
13
|
import { parse } from "pgsql-parser";
|
|
9
|
-
//#region src/cli/rls
|
|
14
|
+
//#region src/cli/rls/migrate.ts
|
|
10
15
|
function migrateTarget(generated) {
|
|
11
16
|
const granted = /* @__PURE__ */ new Map();
|
|
12
17
|
for (const row of generated.seeds ?? []) {
|
|
@@ -27,11 +32,8 @@ function migrateTarget(generated) {
|
|
|
27
32
|
renamed: generated.keys?.renamed ?? {}
|
|
28
33
|
};
|
|
29
34
|
}
|
|
30
|
-
function isNode(value) {
|
|
31
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32
|
-
}
|
|
33
35
|
function child(node, key) {
|
|
34
|
-
return
|
|
36
|
+
return isRecord(node) ? node[key] : void 0;
|
|
35
37
|
}
|
|
36
38
|
function list(value) {
|
|
37
39
|
return Array.isArray(value) ? value : [];
|
|
@@ -259,9 +261,9 @@ async function migrateSql(file, text, config, target) {
|
|
|
259
261
|
for (const item of node) visit(item, inPolicy);
|
|
260
262
|
return;
|
|
261
263
|
}
|
|
262
|
-
if (!
|
|
264
|
+
if (!isRecord(node)) return;
|
|
263
265
|
for (const [kind, value] of Object.entries(node)) {
|
|
264
|
-
if (kind === "FuncCall" &&
|
|
266
|
+
if (kind === "FuncCall" && isRecord(value)) {
|
|
265
267
|
const call = rewriter.call(value);
|
|
266
268
|
if (call !== void 0) {
|
|
267
269
|
const source = call.end === -1 ? call.name : text.slice(call.start, call.end);
|
|
@@ -305,7 +307,7 @@ async function migrateSql(file, text, config, target) {
|
|
|
305
307
|
const statement = child(raw, "stmt");
|
|
306
308
|
const offset = child(raw, "stmt_location");
|
|
307
309
|
const statementStart = at(typeof offset === "number" ? offset : 0);
|
|
308
|
-
const kind =
|
|
310
|
+
const kind = isRecord(statement) ? Object.keys(statement)[0] : void 0;
|
|
309
311
|
if (kind !== void 0 && BODY_STATEMENTS.has(kind)) {
|
|
310
312
|
for (const body of bodyStrings(child(statement, kind))) {
|
|
311
313
|
const bodyStart = text.indexOf(body, statementStart);
|
|
@@ -329,6 +331,12 @@ async function migrateSql(file, text, config, target) {
|
|
|
329
331
|
text: out
|
|
330
332
|
};
|
|
331
333
|
}
|
|
334
|
+
function describeRetire(plan) {
|
|
335
|
+
return plan.tables.flatMap((table) => {
|
|
336
|
+
if (!table.present) return [`retire ${table.table}: no longer created by --sql`];
|
|
337
|
+
return [`retire ${table.table}: ${String(table.refreshTriggers.length)} refresh trigger(s), ${String(table.refreshFunctions.length)} refresh function(s), ${String(table.readers.length)} reader(s)${table.readers.length === 0 ? "; --retire-out drops it" : ""}`, ...table.readers.map((reader) => ` read by ${reader.kind} ${reader.name} at ${reader.file}:${String(reader.line)}`)];
|
|
338
|
+
});
|
|
339
|
+
}
|
|
332
340
|
function describe(report, write) {
|
|
333
341
|
const lines = [...report.rewrites.map((item) => `${item.file}:${String(item.line)} ${item.from} -> ${item.to}`), ...report.skipped.map((item) => `skipped ${item.file}:${String(item.line)} ${item.call}: ${item.detail}`)];
|
|
334
342
|
const files = new Set(report.rewrites.map((item) => item.file)).size;
|
|
@@ -346,6 +354,7 @@ async function runRlsMigrate(input) {
|
|
|
346
354
|
const files = sqlFiles(root, ["."]);
|
|
347
355
|
const rewrites = [];
|
|
348
356
|
const skipped = [];
|
|
357
|
+
const statements = [];
|
|
349
358
|
for (const path of files) {
|
|
350
359
|
const file = relative(input.cwd, path);
|
|
351
360
|
const text = readFileSync(path, "utf8");
|
|
@@ -353,14 +362,65 @@ async function runRlsMigrate(input) {
|
|
|
353
362
|
rewrites.push(...result.rewrites);
|
|
354
363
|
skipped.push(...result.skipped);
|
|
355
364
|
if (input.write && result.text !== text) writeFileSync(path, result.text);
|
|
365
|
+
for (const statement of sqlStatements(input.write ? result.text : text)) statements.push({
|
|
366
|
+
file,
|
|
367
|
+
...statement
|
|
368
|
+
});
|
|
356
369
|
}
|
|
357
|
-
|
|
370
|
+
if (input.retireOut !== void 0 && input.config.tables === void 0) return {
|
|
371
|
+
code: 2,
|
|
372
|
+
output: "rls migrate --retire-out needs rls.migrate.tables in permdock.config.ts"
|
|
373
|
+
};
|
|
374
|
+
const retire = input.config.tables === void 0 ? void 0 : retirePlan(statements, input.config);
|
|
375
|
+
const report = retire === void 0 ? {
|
|
358
376
|
rewrites,
|
|
359
377
|
skipped
|
|
378
|
+
} : {
|
|
379
|
+
rewrites,
|
|
380
|
+
skipped,
|
|
381
|
+
retire
|
|
382
|
+
};
|
|
383
|
+
const unknown = skipped.some((item) => item.reason === "unknown-key");
|
|
384
|
+
const output = input.json ? JSON.stringify(report, void 0, 2) : [describe(report, input.write), ...retire === void 0 ? [] : describeRetire(retire)].join("\n");
|
|
385
|
+
if (input.retireOut === void 0 || retire === void 0) return {
|
|
386
|
+
code: unknown ? 1 : 0,
|
|
387
|
+
output
|
|
388
|
+
};
|
|
389
|
+
const retired = writeRetire(input.cwd, input.retireOut, retire, input.now);
|
|
390
|
+
return {
|
|
391
|
+
code: unknown || retired.code === 1 ? 1 : 0,
|
|
392
|
+
output: `${output}\n${retired.output}`
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/** `--retire-out`: nothing is written while any listed table is still read. */
|
|
396
|
+
function writeRetire(cwd, out, plan, now) {
|
|
397
|
+
const read = plan.tables.filter((table) => table.present && table.readers.length > 0);
|
|
398
|
+
if (read.length > 0) return {
|
|
399
|
+
code: 1,
|
|
400
|
+
output: `rls migrate --retire-out: ${read.map((table) => table.table).join(", ")} still read; nothing written`
|
|
401
|
+
};
|
|
402
|
+
const text = retireSql(plan);
|
|
403
|
+
if (text === void 0) return {
|
|
404
|
+
code: 0,
|
|
405
|
+
output: "rls migrate --retire-out: nothing to retire"
|
|
406
|
+
};
|
|
407
|
+
const file = dataMigrationFile({
|
|
408
|
+
cwd,
|
|
409
|
+
out,
|
|
410
|
+
part: "retire",
|
|
411
|
+
marker: RETIRE_MARKER,
|
|
412
|
+
text,
|
|
413
|
+
now: now ?? /* @__PURE__ */ new Date(),
|
|
414
|
+
check: false
|
|
415
|
+
});
|
|
416
|
+
if (file === void 0) return {
|
|
417
|
+
code: 0,
|
|
418
|
+
output: "rls migrate --retire-out: up to date"
|
|
360
419
|
};
|
|
420
|
+
const written = writeOutputFiles(cwd, [file]);
|
|
361
421
|
return {
|
|
362
|
-
code:
|
|
363
|
-
output:
|
|
422
|
+
code: 0,
|
|
423
|
+
output: written.printed === "" ? `wrote ${written.wrote.join(", ")}` : written.printed
|
|
364
424
|
};
|
|
365
425
|
}
|
|
366
426
|
//#endregion
|
package/dist/nest/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { E as Policy, Or as Principal, jt as PermDock } from "../policy-types-sp9P1iIV.js";
|
|
2
|
+
import { d as Permission } from "../permission-types-Dg39z9Kv.js";
|
|
3
3
|
import { n as RevocationFeed } from "../revocations-Cy06JNx2.js";
|
|
4
|
-
import { A as ConnectionOptions,
|
|
5
|
-
import { t as ServerAdapterOptions } from "../bind-
|
|
4
|
+
import { A as ConnectionOptions, C as verifyWebBotAuth, O as Connection, b as discoverViaSignatureAgent, i as OpenApiHooks, m as InvalidSignatureError, o as ProtectOptions } from "../server-types-DdqBwZN_.js";
|
|
5
|
+
import { t as ServerAdapterOptions } from "../bind-BzqG8SMb.js";
|
|
6
6
|
import { i as sendResponse, t as NodeRequest } from "../http-DPuDaChb.js";
|
|
7
7
|
import { CanActivate, DynamicModule, ExceptionFilter, ExecutionContext, Type } from "@nestjs/common";
|
|
8
8
|
//#region src/nest/http.d.ts
|
package/dist/nest/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { t as compact } from "../compact-
|
|
2
|
-
import { n as PermDockValidationError } from "../validation-error-
|
|
3
|
-
import { n as PermDockDeniedError, r as PermDockRevokedError, t as PermDockApprovalRequiredError } from "../errors-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { i as
|
|
1
|
+
import { t as compact } from "../compact-CAf557ZB.js";
|
|
2
|
+
import { n as PermDockValidationError } from "../validation-error-ZfUHbKvf.js";
|
|
3
|
+
import { n as PermDockDeniedError, r as PermDockRevokedError, t as PermDockApprovalRequiredError } from "../errors-drnfxYtm.js";
|
|
4
|
+
import { c as writeReply, r as hasCredentials } from "../http-BBoKefeS.js";
|
|
5
|
+
import { i as discoverViaSignatureAgent, r as InvalidSignatureError, s as verifyWebBotAuth } from "../evaluations-C9YJsv3H.js";
|
|
6
|
+
import { t as problemFromError } from "../map-error-BE27PYkE.js";
|
|
7
|
+
import { a as socketConnection, r as bindKernel } from "../bind-kk-uyCwH.js";
|
|
8
|
+
import { i as onRevoked, t as POLICY_VIOLATION } from "../stream-BMui98KK.js";
|
|
9
|
+
import { i as toRequest$1, n as isServerResponse, r as sendResponse } from "../http-BEbdMZ05.js";
|
|
9
10
|
import { Catch, Controller, Get, Inject, Injectable, Module, Post, Req, Res, createParamDecorator } from "@nestjs/common";
|
|
10
11
|
import { APP_FILTER, APP_GUARD, Reflector } from "@nestjs/core";
|
|
11
12
|
//#region src/nest/decorate.ts
|
|
@@ -47,9 +48,7 @@ async function sendNestResponse(res, response) {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
if (isFastifyReply(res)) {
|
|
50
|
-
res
|
|
51
|
-
for (const [key, value] of response.headers.entries()) res.header(key, value);
|
|
52
|
-
await res.send(await response.text());
|
|
51
|
+
await writeReply(res, response);
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
throw new TypeError("permdock/nest supports @nestjs/platform-express and @nestjs/platform-fastify responses");
|
|
@@ -174,7 +173,7 @@ function createPermDock(policy, options) {
|
|
|
174
173
|
class PermDockExceptionFilter {
|
|
175
174
|
send = sendNestResponse;
|
|
176
175
|
async catch(exception, host) {
|
|
177
|
-
const problem = exception instanceof PermDockHttpError ? exception.response : problemFromError(exception, { credentials: host.getType() === "http" && host.switchToHttp().getRequest()
|
|
176
|
+
const problem = exception instanceof PermDockHttpError ? exception.response : problemFromError(exception, { credentials: host.getType() === "http" && hasCredentials(host.switchToHttp().getRequest()) });
|
|
178
177
|
if (problem === void 0) throw new TypeError("unhandled permdock exception");
|
|
179
178
|
if (host.getType() === "http") {
|
|
180
179
|
await this.send(host.switchToHttp().getResponse(), problem);
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { f as ApprovalStore } from "../types-
|
|
4
|
-
import { t as InstanceOptions } from "../instance-options-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { E as Policy, Or as Principal, an as Snapshot, ir as Decision, j as PolicyVocabulary, jt as PermDock, sr as DenialReason } 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 { t as InstanceOptions } from "../instance-options-plkrsAog.js";
|
|
5
|
+
import { n as PermDockWrap } from "../wrap-Cr93qqdP.js";
|
|
6
|
+
import { o as OtelWrap } from "../types-CUcFZfpU.js";
|
|
7
|
+
import { n as DescribeMessages } from "../describe-C3ldA9os.js";
|
|
8
|
+
import { a as snapshotHeaders, i as cacheLifeFor, n as SnapshotHeaders, o as snapshotTag, r as SnapshotHeadersOptions, t as CacheLifeForOptions } from "../snapshot-cache-J5T7t_vD.js";
|
|
7
9
|
import { ReactElement, ReactNode } from "react";
|
|
8
10
|
//#region src/next/types.d.ts
|
|
9
11
|
type NextSubjectInput = unknown;
|
|
@@ -14,6 +16,8 @@ type NextPermDockOptions<TUser = NextSubjectInput> = InstanceOptions & {
|
|
|
14
16
|
readonly store?: ApprovalStore;
|
|
15
17
|
/** `(permdock) => withOtel(permdock, options)` from `permdock/otel`. */
|
|
16
18
|
readonly otel?: OtelWrap;
|
|
19
|
+
/** Wraps each instance after `otel`; build it with `wrapPermDock` to cover derived instances. */
|
|
20
|
+
readonly wrap?: PermDockWrap;
|
|
17
21
|
/**
|
|
18
22
|
* Where `PermDockProvider` sends checks the snapshot cannot answer; default `/api/permdock`.
|
|
19
23
|
* `false` is snapshot-only: no `permdockHandler` route, and those checks are denied with
|
|
@@ -38,6 +42,11 @@ type RequireAccessInput = {
|
|
|
38
42
|
readonly data?: unknown;
|
|
39
43
|
/** The active tenant, as for `getPermDock({ tenant })`; defaults to the factory's `tenant`. */
|
|
40
44
|
readonly tenant?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Runs before the default interrupts; throw or redirect to replace them.
|
|
47
|
+
* Defaults to the factory's `onDenied`.
|
|
48
|
+
*/
|
|
49
|
+
readonly onDenied?: (decision: Decision) => never | void;
|
|
41
50
|
};
|
|
42
51
|
type ServerPermissionState = {
|
|
43
52
|
readonly allowed: boolean;
|
|
@@ -55,6 +64,19 @@ type ServerPermDockProviderProps = {
|
|
|
55
64
|
readonly endpoint?: string | false;
|
|
56
65
|
/** Suspends permission readers until the snapshot streams in, instead of answering `pending`. */
|
|
57
66
|
readonly suspend?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* What every `<Protected>` below renders for a slot it leaves out. Nodes
|
|
69
|
+
* only: a function cannot cross from a Server Component to the client.
|
|
70
|
+
*/
|
|
71
|
+
readonly defaults?: {
|
|
72
|
+
readonly pending?: ReactNode;
|
|
73
|
+
readonly fallback?: ReactNode;
|
|
74
|
+
readonly approval?: ReactNode;
|
|
75
|
+
};
|
|
76
|
+
/** Localised text for `useDescribe()`; records only, for the same reason. */
|
|
77
|
+
readonly messages?: Pick<DescribeMessages, "titles" | "separator"> & {
|
|
78
|
+
readonly reasons?: Partial<Record<DenialReason, string>>;
|
|
79
|
+
};
|
|
58
80
|
};
|
|
59
81
|
type PermDockHandler = {
|
|
60
82
|
readonly POST: (request: Request) => Promise<Response>;
|
|
@@ -75,8 +97,9 @@ type NextPermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
75
97
|
*/
|
|
76
98
|
readonly getSnapshot: (query?: GetSnapshotQuery) => Promise<Snapshot>;
|
|
77
99
|
/**
|
|
78
|
-
* Resolves to the granted `Decision`. A denial
|
|
79
|
-
*
|
|
100
|
+
* Resolves to the granted `Decision`. A denial first runs `onDenied` (the
|
|
101
|
+
* call's, else the factory's), then calls `unauthorized()` for an anonymous
|
|
102
|
+
* subject and `forbidden()` otherwise (`experimental.authInterrupts`);
|
|
80
103
|
* approval-required and boundary validation throw as from `assert`.
|
|
81
104
|
*/
|
|
82
105
|
readonly requireAccess: (input: RequireAccessInput) => Promise<Extract<Decision, {
|
package/dist/next/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as compact } from "../compact-
|
|
2
|
-
import {
|
|
3
|
-
import { n as snapshotHeaders, r as snapshotTag, t as cacheLifeFor } from "../snapshot-cache-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as compact } from "../compact-CAf557ZB.js";
|
|
2
|
+
import { n as wrapPermDock } from "../wrap-DWsU_5Bd.js";
|
|
3
|
+
import { n as snapshotHeaders, r as snapshotTag, t as cacheLifeFor } from "../snapshot-cache-Cod40D-X.js";
|
|
4
|
+
import { n as resolveOrNull, t as buildInstance } from "../build-instance-DIIV9DbC.js";
|
|
5
|
+
import { n as createEvaluationsHandler, u as NO_GRANT } from "../evaluations-C9YJsv3H.js";
|
|
6
6
|
import { cache } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { forbidden, unauthorized, unstable_rethrow } from "#next/navigation";
|
|
@@ -16,7 +16,9 @@ function renderClientProvider(options) {
|
|
|
16
16
|
snapshotPromise: options.snapshotPromise,
|
|
17
17
|
endpoint: options.endpoint,
|
|
18
18
|
tenant: options.tenant,
|
|
19
|
-
suspend: options.suspend
|
|
19
|
+
suspend: options.suspend,
|
|
20
|
+
defaults: options.defaults,
|
|
21
|
+
messages: options.messages
|
|
20
22
|
}),
|
|
21
23
|
children: options.children
|
|
22
24
|
});
|
|
@@ -65,44 +67,34 @@ function afterResponse(sink) {
|
|
|
65
67
|
}
|
|
66
68
|
function wrapInstance(permdock, onDenied) {
|
|
67
69
|
if (onDenied === void 0) return permdock;
|
|
68
|
-
|
|
69
|
-
const assert = ((permission, data, options) => permdock.assert(permission, data, compact({
|
|
70
|
+
return wrapPermDock(permdock, (inner) => ({ assert: ((permission, data, options) => inner.assert(permission, data, compact({
|
|
70
71
|
...options,
|
|
71
72
|
onDenied: options?.onDenied ?? onDenied
|
|
72
|
-
})));
|
|
73
|
-
return Object.freeze({
|
|
74
|
-
...permdock,
|
|
75
|
-
assert,
|
|
76
|
-
tenant: (id) => wrap(permdock.tenant(id)),
|
|
77
|
-
team: (id) => wrap(permdock.team(id)),
|
|
78
|
-
derive: (options) => {
|
|
79
|
-
const derived = permdock.derive(options);
|
|
80
|
-
return derived instanceof Promise ? derived.then(wrap) : wrap(derived);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
73
|
+
}))) }));
|
|
83
74
|
}
|
|
84
75
|
function createPermDock(policy, options) {
|
|
85
76
|
assertServerOnly();
|
|
86
77
|
const sink = options.sink === void 0 ? void 0 : afterResponse(options.sink);
|
|
87
|
-
const resolveSubject = cache(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
78
|
+
const resolveSubject = cache(() => resolveOrNull(() => options.subject(), unstable_rethrow));
|
|
79
|
+
const decorate = (permdock) => {
|
|
80
|
+
const traced = options.otel === void 0 ? permdock : options.otel(permdock);
|
|
81
|
+
return wrapInstance(options.wrap === void 0 ? traced : options.wrap(traced), options.onDenied);
|
|
82
|
+
};
|
|
95
83
|
const resolveFallbackTenant = cache(() => readTenant(options.tenant));
|
|
96
84
|
const instantiate = cache(async (tenantKey) => {
|
|
97
85
|
const tenant = tenantKey === "" ? void 0 : tenantKey;
|
|
98
86
|
const user = await resolveSubject();
|
|
99
87
|
await io();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
88
|
+
return (await buildInstance({
|
|
89
|
+
policy,
|
|
90
|
+
user,
|
|
91
|
+
sources: options,
|
|
92
|
+
scope: {
|
|
93
|
+
tenant,
|
|
94
|
+
sink
|
|
95
|
+
},
|
|
96
|
+
wrap: decorate
|
|
97
|
+
})).permdock;
|
|
106
98
|
});
|
|
107
99
|
const getPermDock = async (query) => {
|
|
108
100
|
const tenant = query?.tenant ?? await resolveFallbackTenant();
|
|
@@ -143,7 +135,9 @@ function createPermDock(policy, options) {
|
|
|
143
135
|
const requireAccess = async (input) => {
|
|
144
136
|
const permdock = await getPermDock(input.tenant === void 0 ? void 0 : { tenant: input.tenant });
|
|
145
137
|
const assert = permdock.assert;
|
|
138
|
+
const handler = input.onDenied ?? options.onDenied;
|
|
146
139
|
return assert(input.permission, input.data, { onDenied: (decision) => {
|
|
140
|
+
handler?.(decision);
|
|
147
141
|
if (decision.outcome !== "denied" || decision.denials.some((denial) => denial.reason === "validation")) return;
|
|
148
142
|
if (permdock.subject.principal === null) unauthorized();
|
|
149
143
|
forbidden();
|
|
@@ -159,6 +153,8 @@ function createPermDock(policy, options) {
|
|
|
159
153
|
endpoint: props.endpoint ?? options.endpoint ?? "/api/permdock",
|
|
160
154
|
tenant: props.tenant,
|
|
161
155
|
suspend: props.suspend,
|
|
156
|
+
defaults: props.defaults,
|
|
157
|
+
messages: props.messages,
|
|
162
158
|
children: props.children
|
|
163
159
|
}));
|
|
164
160
|
};
|
package/dist/next/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PermDockPluginOptions } from "../types-
|
|
1
|
+
import { a as PermDockPluginOptions } from "../types-7rJVLWe5.js";
|
|
2
2
|
//#region src/cli/plugin.d.ts
|
|
3
3
|
/** Any object: Next's `NextConfig` is an interface, so no index signature. */
|
|
4
4
|
type NextConfigLike = object;
|
package/dist/next/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as describeError } from "../errors-CWfoNg9N.js";
|
|
2
|
-
import { n as createCollectScheduler, r as report, t as collectOnce } from "../watch-
|
|
2
|
+
import { n as createCollectScheduler, r as report, t as collectOnce } from "../watch-zeucB7eF.js";
|
|
3
3
|
//#region src/cli/plugin.ts
|
|
4
4
|
const PHASE_BUILD = "phase-production-build";
|
|
5
5
|
const PHASE_DEV = "phase-development-server";
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as ServerAdapterOptions } from "../bind-
|
|
1
|
+
import { E as Policy, Or as Principal, j as PolicyVocabulary, jt as PermDock } from "../policy-types-sp9P1iIV.js";
|
|
2
|
+
import { d as Permission } from "../permission-types-Dg39z9Kv.js";
|
|
3
|
+
import { C as verifyWebBotAuth, b as discoverViaSignatureAgent, i as OpenApiHooks, m as InvalidSignatureError, o as ProtectOptions, s as ScopeGuard, t as Guard } from "../server-types-DdqBwZN_.js";
|
|
4
|
+
import { t as ServerAdapterOptions } from "../bind-BzqG8SMb.js";
|
|
5
5
|
import { a as toRequest, i as sendResponse, n as fromResponse, r as isServerResponse, t as NodeRequest } from "../http-DPuDaChb.js";
|
|
6
6
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
7
7
|
//#region src/node/create.d.ts
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as discoverViaSignatureAgent, r as InvalidSignatureError, s as verifyWebBotAuth } from "../evaluations-
|
|
2
|
-
import { r as bindKernel } from "../bind-
|
|
3
|
-
import { i as toRequest, n as isServerResponse, r as sendResponse, t as fromResponse } from "../http-
|
|
1
|
+
import { i as discoverViaSignatureAgent, r as InvalidSignatureError, s as verifyWebBotAuth } from "../evaluations-C9YJsv3H.js";
|
|
2
|
+
import { r as bindKernel } from "../bind-kk-uyCwH.js";
|
|
3
|
+
import { i as toRequest, n as isServerResponse, r as sendResponse, t as fromResponse } from "../http-BEbdMZ05.js";
|
|
4
4
|
//#region src/node/create.ts
|
|
5
5
|
const nodeRequest = (req) => req;
|
|
6
6
|
function createPermDock(policy, options) {
|
|
@@ -9,7 +9,7 @@ function createPermDock(policy, options) {
|
|
|
9
9
|
const bind = (req) => bound.bind(nodeRequest(req));
|
|
10
10
|
const scopeOf = (req) => bound.scopeOf(nodeRequest(req));
|
|
11
11
|
const permdock = async (req) => kernel.permdock(bind(req), await scopeOf(req));
|
|
12
|
-
const protect = ((permission, loadData, protectOptions) =>
|
|
12
|
+
const protect = ((permission, loadData, protectOptions) => (req) => bound.guard(permission, loadData, nodeRequest(req), protectOptions));
|
|
13
13
|
const permdockHandler = () => {
|
|
14
14
|
const { POST, GET } = kernel.permdockHandler(handlerScope);
|
|
15
15
|
return async (req, res) => {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { t as compact } from "./compact-CAf557ZB.js";
|
|
2
|
+
//#region src/core/ocsf.ts
|
|
3
|
+
/** The OCSF schema version `toOcsf` emits. */
|
|
4
|
+
const OCSF_VERSION = "1.3.0";
|
|
5
|
+
function status(outcome) {
|
|
6
|
+
switch (outcome) {
|
|
7
|
+
case "granted": return {
|
|
8
|
+
status_id: 1,
|
|
9
|
+
status: "Success"
|
|
10
|
+
};
|
|
11
|
+
case "denied": return {
|
|
12
|
+
status_id: 2,
|
|
13
|
+
status: "Failure"
|
|
14
|
+
};
|
|
15
|
+
case "approval-required": return {
|
|
16
|
+
status_id: 99,
|
|
17
|
+
status: "Other"
|
|
18
|
+
};
|
|
19
|
+
default: return unknownStatus(outcome);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** An outcome this build does not know, from a newer producer, is reported as OCSF Unknown. */
|
|
23
|
+
function unknownStatus(_outcome) {
|
|
24
|
+
return {
|
|
25
|
+
status_id: 0,
|
|
26
|
+
status: "Unknown"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** The names of a decision event's app obligations, or `undefined` when it has none. */
|
|
30
|
+
function appObligationNames(event) {
|
|
31
|
+
const names = (event.obligations ?? []).flatMap((obligation) => obligation.kind === "app" ? [obligation.name] : []);
|
|
32
|
+
return names.length === 0 ? void 0 : names;
|
|
33
|
+
}
|
|
34
|
+
/** Projects a decision or approval event onto OCSF Authorize Session; the event itself is unchanged. */
|
|
35
|
+
function toOcsf(event) {
|
|
36
|
+
const principal = event.subject.principal;
|
|
37
|
+
const actor = event.subject.actor;
|
|
38
|
+
const breakGlass = event.matched?.breakGlass === true;
|
|
39
|
+
const detail = event.outcome === "approval-required" ? "approval-required" : event.denials?.map((denial) => denial.reason).join(",");
|
|
40
|
+
const time = Date.parse(event.at);
|
|
41
|
+
return compact({
|
|
42
|
+
class_uid: 3003,
|
|
43
|
+
category_uid: 3,
|
|
44
|
+
activity_id: 1,
|
|
45
|
+
type_uid: 300301,
|
|
46
|
+
severity_id: breakGlass ? 4 : 1,
|
|
47
|
+
time: Number.isNaN(time) ? 0 : time,
|
|
48
|
+
...status(event.outcome),
|
|
49
|
+
status_detail: detail === "" ? void 0 : detail,
|
|
50
|
+
message: `${event.permission} ${event.outcome}`,
|
|
51
|
+
privileges: [event.permission],
|
|
52
|
+
user: principal === null ? { name: "anonymous" } : { uid: principal.id },
|
|
53
|
+
actor: actor === void 0 ? void 0 : compact({
|
|
54
|
+
user: principal === null ? void 0 : { uid: principal.id },
|
|
55
|
+
app_name: actor.id
|
|
56
|
+
}),
|
|
57
|
+
metadata: compact({
|
|
58
|
+
version: OCSF_VERSION,
|
|
59
|
+
product: compact({
|
|
60
|
+
name: "PermDock",
|
|
61
|
+
vendor_name: "PermDock",
|
|
62
|
+
feature: event.adapter === void 0 ? void 0 : { name: event.adapter }
|
|
63
|
+
}),
|
|
64
|
+
tenant_uid: event.tenant,
|
|
65
|
+
correlation_uid: event.token
|
|
66
|
+
}),
|
|
67
|
+
unmapped: compact({
|
|
68
|
+
outcome: event.outcome,
|
|
69
|
+
scope: event.scope,
|
|
70
|
+
resource: event.resource,
|
|
71
|
+
source: event.source,
|
|
72
|
+
phase: event.phase,
|
|
73
|
+
role: event.matched?.role,
|
|
74
|
+
grant: event.matched?.name,
|
|
75
|
+
obligations: appObligationNames(event),
|
|
76
|
+
via: event.via,
|
|
77
|
+
breakGlass: breakGlass ? true : void 0,
|
|
78
|
+
purpose: event.purpose,
|
|
79
|
+
reason: event.reason
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function accessToOcsf(event) {
|
|
84
|
+
const time = Date.parse(event.at);
|
|
85
|
+
const enable = event.operation === "started";
|
|
86
|
+
return compact({
|
|
87
|
+
class_uid: 3001,
|
|
88
|
+
category_uid: 3,
|
|
89
|
+
activity_id: enable ? 2 : 5,
|
|
90
|
+
type_uid: enable ? 300102 : 300105,
|
|
91
|
+
severity_id: 4,
|
|
92
|
+
time: Number.isNaN(time) ? 0 : time,
|
|
93
|
+
message: `support access ${event.operation}`,
|
|
94
|
+
user: { uid: event.principal.id },
|
|
95
|
+
actor: event.actor === void 0 ? void 0 : { user: { uid: event.actor.id } },
|
|
96
|
+
metadata: {
|
|
97
|
+
version: OCSF_VERSION,
|
|
98
|
+
product: {
|
|
99
|
+
name: "PermDock",
|
|
100
|
+
vendor_name: "PermDock"
|
|
101
|
+
},
|
|
102
|
+
tenant_uid: event.tenant
|
|
103
|
+
},
|
|
104
|
+
unmapped: compact({
|
|
105
|
+
operation: event.operation,
|
|
106
|
+
via: event.via,
|
|
107
|
+
roles: event.roles,
|
|
108
|
+
member: event.member,
|
|
109
|
+
grantedBy: event.grantedBy,
|
|
110
|
+
reason: event.reason
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { toOcsf as i, accessToOcsf as n, appObligationNames as r, OCSF_VERSION as t };
|
package/dist/openai/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as ApprovalRequest, f as ApprovalStore } from "../types-
|
|
4
|
-
import { t as InstanceOptions } from "../instance-options-
|
|
5
|
-
import { t as ToolMap } from "../types-
|
|
1
|
+
import { E as Policy, Or as Principal, j as PolicyVocabulary, jt as PermDock, wr as Delegation } from "../policy-types-sp9P1iIV.js";
|
|
2
|
+
import { d as Permission } from "../permission-types-Dg39z9Kv.js";
|
|
3
|
+
import { c as ApprovalRequest, f as ApprovalStore } from "../types-Br9IXUBG.js";
|
|
4
|
+
import { t as InstanceOptions } from "../instance-options-plkrsAog.js";
|
|
5
|
+
import { t as ToolMap } from "../types-DvupZE0w.js";
|
|
6
6
|
//#region src/openai/create.d.ts
|
|
7
7
|
/** The app context passed to `run(agent, input, { context })`. */
|
|
8
8
|
type OpenAiContext = {
|
package/dist/openai/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as compact } from "../compact-
|
|
2
|
-
import { r as memoryApprovalStore } from "../store-
|
|
3
|
-
import {
|
|
4
|
-
import { n as createAgentKernel, t as approvalTokenOf } from "../kernel-
|
|
1
|
+
import { t as compact } from "../compact-CAf557ZB.js";
|
|
2
|
+
import { r as memoryApprovalStore } from "../store-ILkLUj_o.js";
|
|
3
|
+
import { r as instanceOptions } from "../build-instance-DIIV9DbC.js";
|
|
4
|
+
import { n as createAgentKernel, t as approvalTokenOf } from "../kernel-CB3LrIJM.js";
|
|
5
5
|
//#region src/openai/create.ts
|
|
6
6
|
function appContext(runContext) {
|
|
7
7
|
const context = runContext?.context;
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as ProblemDetails } from "../errors-
|
|
1
|
+
import { E as Policy, Or as Principal, jr as Condition } from "../policy-types-sp9P1iIV.js";
|
|
2
|
+
import { d as Permission, p as PermissionTree } from "../permission-types-Dg39z9Kv.js";
|
|
3
|
+
import { a as ProblemDetails } from "../errors-OD_4c__H.js";
|
|
4
4
|
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
//#region src/openapi/types.d.ts
|
|
6
6
|
type OpenApiTarget = "3.1" | "3.2" | "3.3";
|
package/dist/openapi/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as GNAP_RESERVED, r as PROFILE_NAMES, t as DRAFT_PINS } from "../pins-8ILTftC9.js";
|
|
2
|
-
import { a as operationPermissionsFromOpenApi, c as openapiVersion, i as operationPermissions, l as securitySchemesOf, n as securityFor, o as createPermDock, r as problemDetails, s as catalogOf, t as permissionsExtension } from "../openapi-
|
|
2
|
+
import { a as operationPermissionsFromOpenApi, c as openapiVersion, i as operationPermissions, l as securitySchemesOf, n as securityFor, o as createPermDock, r as problemDetails, s as catalogOf, t as permissionsExtension } from "../openapi-DBzHQbov.js";
|
|
3
3
|
export { DRAFT_PINS, GNAP_RESERVED, PROFILE_NAMES, catalogOf, createPermDock, openapiVersion, operationPermissions, operationPermissionsFromOpenApi, permissionsExtension, problemDetails, securityFor, securitySchemesOf };
|