permdock 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/a2a/index.js +1 -1
  2. package/dist/{adoption-scan-oks22j9J.js → adoption-scan-DLel53Oa.js} +1 -1
  3. package/dist/agent/index.js +1 -1
  4. package/dist/ai-sdk/index.js +2 -2
  5. package/dist/{arazzo-BzVfXbhf.js → arazzo-CHK9NT6u.js} +1 -1
  6. package/dist/{arazzo-CBBIhC40.js → arazzo-CL8CZnpL.js} +1 -1
  7. package/dist/better-supabase/index.d.ts +20 -22
  8. package/dist/better-supabase/index.js +4 -16
  9. package/dist/better-supabase-Dirf_8Ec.js +72 -0
  10. package/dist/{casbin-C8r5trwy.js → casbin-DRFwgVIP.js} +1 -1
  11. package/dist/{casbin-BunKq48W.js → casbin-iAEXjmca.js} +1 -1
  12. package/dist/claude-agent/index.js +1 -1
  13. package/dist/cli/bin.js +1 -1
  14. package/dist/cli/index.js +2 -2
  15. package/dist/{cloud-C_Mau1q2.js → cloud-eOtmuonF.js} +1 -1
  16. package/dist/{codemod-BqYPToUJ.js → codemod-D6NYu4AK.js} +2 -2
  17. package/dist/{codemod-CpMCbp0G.js → codemod-KEDj_3zl.js} +1 -1
  18. package/dist/{collect-D9Tt0Bcx.js → collect-DnXL4B8c.js} +1 -1
  19. package/dist/{completion-Cq4fbT2S.js → completion-DCza8aQY.js} +1 -1
  20. package/dist/{config-0xxCmoD8.js → config-BAM3a3z8.js} +1 -1
  21. package/dist/{config-BR23fL8m.js → config-CcLlvEYW.js} +4 -1
  22. package/dist/{config-report-C1-r59VY.js → config-report-VZcQ0ZpS.js} +1 -1
  23. package/dist/{create-6EwRQlig.js → create-Coq5fIrq.js} +1 -1
  24. package/dist/{diff-BwR1JdP2.js → diff-CxtbOi2l.js} +1 -1
  25. package/dist/{diff-CQegtBAo.js → diff-DfmYaIhB.js} +1 -1
  26. package/dist/{doctor-CDfzrMQB.js → doctor-CMqPKuN_.js} +16 -49
  27. package/dist/{doctor-Dea6IqRw.js → doctor-gIO9WTYo.js} +2 -2
  28. package/dist/eve/index.js +1 -1
  29. package/dist/{fixtures-A1_sp_tR.js → fixtures-Bm4_K1ke.js} +7 -9
  30. package/dist/{import-PP7uH8rC.js → import-DK_J8tVE.js} +1 -1
  31. package/dist/{init-n1gkKHvc.js → init-Buibrl9h.js} +3 -3
  32. package/dist/{init-BuUt4bLJ.js → init-jLSyPMM7.js} +1 -1
  33. package/dist/{kernel-qv4cr9w8.js → kernel-BD8QuMnv.js} +9 -2
  34. package/dist/{login-YsrgkAQo.js → login-CB55O4Gv.js} +1 -1
  35. package/dist/{login-DyQNWJok.js → login-VVpkkund.js} +3 -3
  36. package/dist/{manifest-Cl6yHiVK.js → manifest-CbEyvPN2.js} +33 -33
  37. package/dist/mcp/index.d.ts +21 -3
  38. package/dist/mcp/index.js +87 -16
  39. package/dist/next/plugin.js +1 -1
  40. package/dist/openai/index.js +2 -2
  41. package/dist/{openapi-D8JQtO8k.js → openapi-CleDZYVf.js} +1 -1
  42. package/dist/{openapi-BFyBIe9J.js → openapi-eHZ5hwUJ.js} +2 -2
  43. package/dist/{output-DpCUAST3.js → output-BVZpQDad.js} +1 -1
  44. package/dist/{powersync-Bm3ZjHwD.js → powersync-CFWILHjb.js} +2 -2
  45. package/dist/powersync-CnGzxvEl.js +1 -0
  46. package/dist/{powersync-BTLk8GSl.js → powersync-uqYWxTjq.js} +126 -39
  47. package/dist/{pull-iVPQZsnI.js → pull-BBmCxnqX.js} +1 -1
  48. package/dist/pull-D6dloyrc.js +1 -0
  49. package/dist/react-native/index.d.ts +21 -8
  50. package/dist/react-native/index.js +103 -17
  51. package/dist/{rls-BItB4vkC.js → rls-BwKXdVEW.js} +5 -5
  52. package/dist/{rls-C8nxX0RV.js → rls-yK2nZUcm.js} +1 -1
  53. package/dist/{run-CjFdAzqE.js → run-D5WIJfs7.js} +3 -3
  54. package/dist/run-DlQYPtPv.js +1 -0
  55. package/dist/{scan-COIQvTMg.js → scan-CzdMtHnq.js} +1 -1
  56. package/dist/{schema-CeQZY6bO.js → schema-BDGEVO4g.js} +1 -1
  57. package/dist/{skills-CfkYP7GG.js → skills-BIsm1n26.js} +1 -1
  58. package/dist/{skills-5XWpNzCi.js → skills-BZxPQ_09.js} +1 -1
  59. package/dist/supabase/index.js +1 -1
  60. package/dist/{supabase-CBEK6KEo.js → supabase-DYWnT800.js} +2 -2
  61. package/dist/{supabase-hook-CyuD9Wau.js → supabase-hook-HPgwYb9V.js} +2 -2
  62. package/dist/supabase-hook-qsewAVZY.js +1 -0
  63. package/dist/{supautils-PRhfO-bL.js → supautils-CGk4YpvC.js} +16 -5
  64. package/dist/testing/core.js +1 -1
  65. package/dist/testing/fixtures/index.js +1 -1
  66. package/dist/testing/index.js +2 -2
  67. package/dist/unplugin/index.js +1 -1
  68. package/dist/usage-D3KJyaNS.js +1 -0
  69. package/dist/{usage-BfzSfOpD.js → usage-DBNrpwoT.js} +1 -1
  70. package/dist/{usage-hMYVFsN5.js → usage-e6M1Mls1.js} +2 -2
  71. package/dist/{verify-CmTiQ-yM.js → verify-CgIpJRcG.js} +3 -3
  72. package/dist/watch-CuPz0D2M.js +1 -0
  73. package/dist/{watch-Bpci3hBY.js → watch-DAkjm75Y.js} +1 -1
  74. package/package.json +16 -16
  75. package/skills/permdock-credentials/references/tokens-keys-links.md +1 -1
  76. package/skills/permdock-wire/references/adapters.md +1 -1
  77. package/dist/powersync-CObULVRk.js +0 -1
  78. package/dist/pull-3OQCgxUf.js +0 -1
  79. package/dist/run-BqW8S5TM.js +0 -1
  80. package/dist/supabase-hook-CWvEpdCh.js +0 -1
  81. package/dist/usage-BDiTP763.js +0 -1
  82. package/dist/watch-COuvly20.js +0 -1
  83. package/dist/{core-DzVINFbU.js → core-lxoANyai.js} +1 -1
  84. package/dist/{supabase-CC6rIri4.js → supabase-CDHMsDD0.js} +1 -1
@@ -501,7 +501,7 @@ const subject = subjectFromSupabase(claims, {
501
501
 
502
502
  Write the claims with `permdock supabase hook generate`; `permdock supabase inspect --out` writes the manifest (helper names, tenant claim, budget, claims written) that `authorizationProvider` from `permdock/better-supabase` turns into better-supabase's `authorization` config. No `@supabase/supabase-js` peer. Pair with `permdock rls generate`, or keep SQL as authority and run `permdock rls verify --db-url-stdin` against `sqlFunction` twins ([database-first](https://permdock.com/docs/adapters/rls)); the generic RLS workflow is in the `permdock-data` skill.
503
503
 
504
- With better-supabase, set `auth.authorization: authorizationProvider({ manifest, catalog })` in `better-supabase.config.ts` (top-level `authorization` before 0.15) (with `rls.customRoles` its `canAssign` and `canAssignFor` call `permdock_can_assign_any` and its `_for` form, so custom roles are assignable through better-supabase; regenerate the manifest after turning custom roles on), pass `authorizer({ policy })` to the server (`createNext`, `createHono`, `createMcp`) so every `permission` a resource, action, route guard or tool declares is decided by PermDock from the verified claims (`operations` maps tables for `permissions: true`; a missing or anonymous claim denies), build bucket and topic `access` policies with `bucketPolicy` and `topicPolicy`, and map its session with `subjectFromBetterSupabase(session)` (all from `permdock/better-supabase`): the active tenant's `features` become `principal.plans`. Pass `plans: { keys }` when better-supabase's `entitlements.claim.keys` shortens feature keys, and `apiKeys: { permissions, manifest }` so an `apiKey` session maps to the key's credential subject instead of the anonymous one. For `createMcp` tools, put the permission in `meta` and spread `toolPolicy({ permdock })` into the options: tools without one are hidden and refused, and approval-required calls are refused because `createMcp` collects no approvals. Wrap a `CredentialProvider` with `credentialGuard(provider, { permdock, use, revoke? })` so PermDock decides each token use. `authorizationProvider({ ..., approver })` lets holders of that permission approve AI tool calls, never their own. `approvers: { 'ai-tool': holder(p), 'support-session': ..., 'invoice.send': ... }` fills `isApprover` through `permdock_is_approver` (needs `rls.approvals`); only `user()`, `holder()` and `anyOf()` approvers, and a kind it does not name has no approver. `accessReviewApplier({ client, reviews, policy, demoteTo?, email?, permdockFor? })` applies a review's revoked items: `update_member_role` to the `demoteTo` role when that role lacks the permission, else `remove_member`, plus `revoke_invitation` for the member's matching invitations, then `markApplied`; pass the reviewer's client so the blocks' own checks run. better-supabase's `createAgentRuntime({ toolApproval })` takes `toolApproval` from `permdock/ai-sdk` as it is. Validate its claims with `betterSupabase.claims(supabaseClaims().extend(appSchema))` (`supabaseClaims` from `permdock/supabase`, any Standard Schema as `appSchema`) instead of a hand-written copy of the claim shape. A `supabase.hook.claims` function that needs the user's organizations calls `<schema>.member_organization_ids_for(user_id)` (generated by `rls generate`, executable by `supabase_auth_admin` only) instead of querying the membership tables itself. With a scope named `team` or `teams`, `authorizationProvider` fills better-supabase's `teamIdsOf` with `<schema>.member_team_ids_of(user)`, which answers only for the caller, so with `blocks.permissions.model: 'provider'` (`blocks.access` before 0.15) better-supabase's `team_ids_of()` and team-sharing policies read PermDock's memberships. A token Supabase's OAuth server issued to a third-party app (`client_id`) becomes an `oauth-client` actor limited to its `scope`; `deny(permission, { to: actor('oauth-client') })` keeps such apps out, in the app and, through `rls generate`, in Postgres. A better-supabase support session (`act.kind: 'support'`) is actor kind `support` with `sessionId` and `readOnly`, and `actingAs` (`act.kind: 'impersonation'`) is kind `impersonation`; neither has a delegation, so they reach nothing until a policy delegation names `actor('support')` or `actor('impersonation')`, and `readOnly: true` (also when `read_only` is absent) narrows that to read-only permissions. Generated RLS reads memberships, not `act`, so a support token sent to the Data API writes as the user: add a restrictive `for update` (and `insert` / `delete`) policy per writable table that requires `act ->> 'read_only' = 'false'` when `act` is a support or session level ([support access](https://permdock.com/docs/guides/support-access)). With `rls.anonymousSignIns: 'deny'`, pass `anonymousSignIns: 'deny'` to the subject mapper too (doctor PD057). Check a deployed database against the generated policies with `permdock rls verify --introspect`.
504
+ With better-supabase, set `auth.authorization: authorizationProvider({ manifest, catalog })` in `better-supabase.config.ts` (with `rls.customRoles` its `canAssign` and `canAssignFor` call `permdock_can_assign_any` and its `_for` form, so custom roles are assignable through better-supabase; regenerate the manifest after turning custom roles on), pass `authorizer({ policy })` to the server (`createNext`, `createHono`, `createMcp`) so every `permission` a resource, action, route guard or tool declares is decided by PermDock from the verified claims (`operations` maps tables for `permissions: true`; a missing or anonymous claim denies), build bucket and topic `access` policies with `bucketPolicy` and `topicPolicy`, and map its session with `subjectFromBetterSupabase(session)` (all from `permdock/better-supabase`): the active tenant's `features` become `principal.plans`. Pass `plans: { keys }` when better-supabase's `entitlements.claim.keys` shortens feature keys, and `apiKeys: { permissions, manifest }` so an `apiKey` session maps to the key's credential subject instead of the anonymous one. For `createMcp` tools, put the permission in `meta` and spread `toolPolicy({ permdock })` into the options: tools without one are hidden and refused, and approval-required calls are refused because `createMcp` collects no approvals. Wrap a `CredentialProvider` with `credentialGuard(provider, { permdock, use, revoke? })` so PermDock decides each token use. `authorizationProvider({ ..., approver })` lets holders of that permission approve AI tool calls, never their own. `approvers: { 'ai-tool': holder(p), 'support-session': ..., 'invoice.send': ... }` fills `isApprover` through `permdock_is_approver` (needs `rls.approvals`); only `user()`, `holder()` and `anyOf()` approvers, and a kind it does not name has no approver. `accessReviewApplier({ client, reviews, policy, demoteTo?, email?, permdockFor? })` applies a review's revoked items: `update_member_role` to the `demoteTo` role when that role lacks the permission, else `remove_member`, plus `revoke_invitation` for the member's matching invitations, then `markApplied`; pass the reviewer's client so the blocks' own checks run. better-supabase's `createAgentRuntime({ toolApproval })` takes `toolApproval` from `permdock/ai-sdk` as it is. Validate its claims with `betterSupabase.claims(supabaseClaims().extend(appSchema))` (`supabaseClaims` from `permdock/supabase`, any Standard Schema as `appSchema`) instead of a hand-written copy of the claim shape. A `supabase.hook.claims` function that needs the user's organizations calls `<schema>.member_organization_ids_for(user_id)` (generated by `rls generate`, executable by `supabase_auth_admin` only) instead of querying the membership tables itself. With a scope named `team` or `teams`, `authorizationProvider` fills better-supabase's `teamIdsOf` with `<schema>.member_team_ids_of(user)`, which answers only for the caller, so with `blocks.permissions.model: 'provider'` better-supabase's `team_ids_of()` and team-sharing policies read PermDock's memberships. A token Supabase's OAuth server issued to a third-party app (`client_id`) becomes an `oauth-client` actor limited to its `scope`; `deny(permission, { to: actor('oauth-client') })` keeps such apps out, in the app and, through `rls generate`, in Postgres. A better-supabase support session (`act.kind: 'support'`) is actor kind `support` with `sessionId` and `readOnly`, and `actingAs` (`act.kind: 'impersonation'`) is kind `impersonation`; neither has a delegation, so they reach nothing until a policy delegation names `actor('support')` or `actor('impersonation')`, and `readOnly: true` (also when `read_only` is absent) narrows that to read-only permissions. Generated RLS reads memberships, not `act`, so a support token sent to the Data API writes as the user: add a restrictive `for update` (and `insert` / `delete`) policy per writable table that requires `act ->> 'read_only' = 'false'` when `act` is a support or session level ([support access](https://permdock.com/docs/guides/support-access)). With `rls.anonymousSignIns: 'deny'`, pass `anonymousSignIns: 'deny'` to the subject mapper too (doctor PD057). Check a deployed database against the generated policies with `permdock rls verify --introspect`.
505
505
 
506
506
  The other better-supabase slots, all from `permdock/better-supabase` ([better-supabase](https://permdock.com/docs/adapters/better-supabase)): `hookCan(permdock)` and `handlerCan({ getPermDock })` are the `can` options of `authorizeHook` and `protectWebHandler` in `better-supabase/workflow-sdk`; they decide with no row unless the `data` option loads one (`hookCan(permdock, { data: (tenant, key) => row })`, `handlerCan(source, { data: (request, key) => row })`), so without it a permission with a row condition denies, and `handlerCan` answers `undefined` (401) without a signed-in principal. `supportPolicy({ policy, options?, writable?, approval?, approved? })` is the `authorize` option of `supportSessions`; it decides each start with `decideSupportSession` as the admin, and an `approval-required` start passes only once `approved(input, pending)` returns `{ approvedBy }` for an approver other than the admin. `subscriberPolicy({ policy, principals, events, row?, sender? })` filters outbox, webhook or realtime subscribers to those who may read the event (exact type, then the longest `prefix.*`, then `*`; a type with no entry reaches no one). `principalSource({ claims, identities? })` is a `PrincipalSource` over the claims better-supabase mints, for `decideFor`, `subscribersFor` and delivery; only links the app created through a signed-in flow or a verified address go in `identities`. `authorizationHooks({ policy, claims, service?, principals?, events?, approvers?, support?, tickets? })` is the `authorization` option of `createServer`: it answers automation publish and run-as, delegated OAuth scopes, `approverOf`, identities, delivery audiences, support sessions and run tickets from the claims better-supabase mints now, never from the request.
507
507
 
@@ -1 +0,0 @@
1
- export { n as runPowerSync } from "./powersync-BTLk8GSl.js";
@@ -1 +0,0 @@
1
- export { n as runCloudPull } from "./pull-iVPQZsnI.js";
@@ -1 +0,0 @@
1
- export { t as run } from "./run-CjFdAzqE.js";
@@ -1 +0,0 @@
1
- export { i as runSupabase } from "./supabase-hook-CyuD9Wau.js";
@@ -1 +0,0 @@
1
- export { t as runUsage } from "./usage-hMYVFsN5.js";
@@ -1 +0,0 @@
1
- export { i as watchCollect } from "./watch-Bpci3hBY.js";
@@ -5,8 +5,8 @@ import { y as membershipsClaim } from "./evaluate-BAmf_AQd.js";
5
5
  import { n as parseSnapshot } from "./snapshot-CXlzi69u.js";
6
6
  import { n as fromSnapshot } from "./from-snapshot-DCakWRsr.js";
7
7
  import { t as getPermDock } from "./permdock-BvjivVb9.js";
8
- import { c as quoteSqlTable, n as defaultSqlCommand, o as quoteSqlIdent, t as SQL_IDENT } from "./sql-0WjxIp9g.js";
9
8
  import "./budget-BELja5A9.js";
9
+ import { c as quoteSqlTable, n as defaultSqlCommand, o as quoteSqlIdent, t as SQL_IDENT } from "./sql-0WjxIp9g.js";
10
10
  //#region src/testing/policy-matrix.ts
11
11
  function isOutcomeCell(value) {
12
12
  return value === "granted" || value === "denied" || value === "approval-required" || value !== null && typeof value === "object" && ("denials" in value || "outcome" in value || "alternatives" in value || "obligations" in value || "deniedBy" in value);
@@ -5,8 +5,8 @@ import { s as ApprovalError } from "./types-CcUXciSj.js";
5
5
  import { c as decodeApprovalCursor, l as encodeApprovalCursor, s as approvalPageSize, t as applyApprovalVerdict } from "./store-RNFvaJJv.js";
6
6
  import { a as parseCapability } from "./capability-BqX94r07.js";
7
7
  import { t as loadJose } from "./load-jose-DZ4dnjri.js";
8
- import { a as quoteQualifiedTable, c as quoteSqlTable, d as sqlTextArray, i as qualifySqlTable, o as quoteSqlIdent, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
9
8
  import "./budget-BELja5A9.js";
9
+ import { a as quoteQualifiedTable, c as quoteSqlTable, d as sqlTextArray, i as qualifySqlTable, o as quoteSqlIdent, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
10
10
  import { d as keptKeys, l as roleColumn } from "./sources-C4vkzZJV.js";
11
11
  import { t as callRpc } from "./postgrest-DAxFltvO.js";
12
12
  //#region src/supabase/capability.ts