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
@@ -5,12 +5,14 @@ import { a as loadModule, s as pickNamed } from "./load-DjSU5KXO.js";
5
5
  import { existsSync } from "node:fs";
6
6
  import { resolve } from "node:path";
7
7
  //#region src/cli/fixtures.ts
8
- function asFixtures(value) {
8
+ function asFixtures(value, followed = false) {
9
9
  const list = Array.isArray(value) ? value : isRecord(value) && Array.isArray(value["fixtures"]) ? value["fixtures"] : void 0;
10
10
  if (list === void 0) throw configError("PermDock CLI: fixtures must be an array or { fixtures }");
11
11
  return list.map((item, index) => {
12
12
  if (!isRecord(item) || !isRecord(item["subject"]) || item["row"] === void 0) throw configError(`PermDock CLI: fixture ${index} needs subject and row`);
13
- if (typeof item["action"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} needs action`);
13
+ if (followed && item["table"] !== void 0) {
14
+ if (typeof item["table"] !== "string" || item["table"].length === 0 || item["action"] !== void 0 || item["expected"] !== "granted" && item["expected"] !== "denied") throw configError(`PermDock CLI: fixture ${index} needs table and expected (granted or denied), without action`);
15
+ } else if (typeof item["action"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} needs action`);
14
16
  if (typeof item["subject"]["id"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} subject needs id`);
15
17
  const memberships = item["subject"]["memberships"];
16
18
  if (memberships !== void 0 && !Array.isArray(memberships)) throw configError(`PermDock CLI: fixture ${index} subject.memberships must be an array`);
@@ -26,23 +28,19 @@ function asCustomRoles(value) {
26
28
  if (!Array.isArray(value["customRoles"])) throw new TypeError("PermDock CLI: fixtures customRoles must be an array");
27
29
  return value["customRoles"];
28
30
  }
29
- /**
30
- * A `.json` file or a module exporting `fixtures` (or default) and optionally
31
- * `customRoles`.
32
- */
33
- async function loadFixtures(cwd, path) {
31
+ async function loadFixtures(cwd, path, followed = false) {
34
32
  const abs = resolve(cwd, path);
35
33
  if (!existsSync(abs)) throw configError(`PermDock CLI: fixtures not found: ${path}`);
36
34
  if (abs.endsWith(".json")) {
37
35
  const parsed = readJsonFile(abs);
38
36
  return {
39
- fixtures: asFixtures(parsed),
37
+ fixtures: asFixtures(parsed, followed),
40
38
  customRoles: asCustomRoles(parsed)
41
39
  };
42
40
  }
43
41
  const mod = await loadModule(abs);
44
42
  return {
45
- fixtures: asFixtures(pickNamed(mod, ["fixtures", "default"])),
43
+ fixtures: asFixtures(pickNamed(mod, ["fixtures", "default"]), followed),
46
44
  customRoles: asCustomRoles(mod)
47
45
  };
48
46
  }
@@ -4,7 +4,7 @@ import { i as readJsonFile } from "./files-BSjrtIHw.js";
4
4
  import { t as applyFiles } from "./files-B3AA05f1.js";
5
5
  import { n as httpRequest } from "./http-DOL33cO0.js";
6
6
  import { i as schemaExpression, t as emitPermissionsModule } from "./generate-CezbCaTI.js";
7
- import { t as validateOpenapi } from "./schema-CeQZY6bO.js";
7
+ import { t as validateOpenapi } from "./schema-BDGEVO4g.js";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { resolve } from "node:path";
10
10
  //#region ../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js
@@ -48,7 +48,7 @@ const init = defineLeaf({
48
48
  ...forceFlag
49
49
  },
50
50
  async run(ctx, { flags }) {
51
- const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-BuUt4bLJ.js"), import("./peer-C9LvBCcb.js")]);
51
+ const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-jLSyPMM7.js"), import("./peer-C9LvBCcb.js")]);
52
52
  const agent = await packageManagerOf(ctx.cwd);
53
53
  const selection = {
54
54
  archetype: flags.archetype,
@@ -79,7 +79,7 @@ const presetDecode = defineLeaf({
79
79
  positionals: presetCode,
80
80
  flags: {},
81
81
  async run(_ctx, { args }) {
82
- const { runPreset } = await import("./init-BuUt4bLJ.js");
82
+ const { runPreset } = await import("./init-jLSyPMM7.js");
83
83
  return runPreset("decode", args["code"] ?? "");
84
84
  }
85
85
  });
@@ -87,7 +87,7 @@ const presetUrl = defineLeaf({
87
87
  positionals: presetCode,
88
88
  flags: {},
89
89
  async run(_ctx, { args }) {
90
- const { runPreset } = await import("./init-BuUt4bLJ.js");
90
+ const { runPreset } = await import("./init-jLSyPMM7.js");
91
91
  return runPreset("url", args["code"] ?? "");
92
92
  }
93
93
  });
@@ -1,6 +1,6 @@
1
1
  import { n as CliError } from "./errors-Vpu6rKHl.js";
2
2
  import { a as decodePreset, g as resolvePreset, i as presetFlags, n as generatePreset, o as encodePreset } from "./preset-BjLzeFpp.js";
3
- import { a as nonEmptyOr } from "./output-DpCUAST3.js";
3
+ import { a as nonEmptyOr } from "./output-BVZpQDad.js";
4
4
  import { t as addLine } from "./peer-Q0fuZ6hx.js";
5
5
  import { t as applyFiles } from "./files-B3AA05f1.js";
6
6
  import { existsSync } from "node:fs";
@@ -228,6 +228,11 @@ function createAgentKernel(policy, given) {
228
228
  const boundary = options.boundary ?? "tool-args";
229
229
  const tools = options.tools ?? {};
230
230
  const run = async (binding, args, context, how) => {
231
+ const onError = (error) => {
232
+ try {
233
+ how.decideOptions.onError?.(error);
234
+ } catch {}
235
+ };
231
236
  let permdock;
232
237
  try {
233
238
  permdock = await instance(context);
@@ -252,7 +257,8 @@ function createAgentKernel(policy, given) {
252
257
  if (binding.data !== void 0) {
253
258
  try {
254
259
  data = await binding.data(args);
255
- } catch {
260
+ } catch (error) {
261
+ onError(error);
256
262
  return {
257
263
  ok: false,
258
264
  failure: "load-failed",
@@ -291,7 +297,8 @@ function createAgentKernel(policy, given) {
291
297
  raw,
292
298
  decision
293
299
  };
294
- } catch {
300
+ } catch (error) {
301
+ onError(error);
295
302
  return compact({
296
303
  ok: false,
297
304
  failure: "failed",
@@ -3,7 +3,7 @@ import { n as CliError } from "./errors-Vpu6rKHl.js";
3
3
  import { i as postForm, r as parseToken, s as runDeviceFlow } from "./device-BwbJNmb2.js";
4
4
  import { i as writeCredentials, n as deleteCredentials, r as readCredentials, t as credentialsPath } from "./storage-C2bWdvJH.js";
5
5
  import { n as randomToken, t as pkce } from "./pkce-CnmmYqUZ.js";
6
- import { a as nonEmptyOr } from "./output-DpCUAST3.js";
6
+ import { a as nonEmptyOr } from "./output-BVZpQDad.js";
7
7
  import { n as httpRequest } from "./http-DOL33cO0.js";
8
8
  import { c as READ_SCOPES, d as issuerMetadata, i as credentialsInsideRepository, l as cloudUrl, n as cliRuntime, r as credentialStorage, s as CLI_CLIENT_ID, t as CREDENTIAL_SERVICE } from "./auth--yPyZNgr.js";
9
9
  import { spawn } from "node:child_process";
@@ -27,7 +27,7 @@ const login = defineLeaf({
27
27
  }
28
28
  },
29
29
  async run(ctx, { flags }) {
30
- const { runLogin } = await import("./login-YsrgkAQo.js");
30
+ const { runLogin } = await import("./login-CB55O4Gv.js");
31
31
  return runLogin({
32
32
  cwd: ctx.cwd,
33
33
  url: given(flags.url),
@@ -43,7 +43,7 @@ const login = defineLeaf({
43
43
  const logout = defineLeaf({
44
44
  flags: { ...urlFlag },
45
45
  async run(ctx, { flags }) {
46
- const { runLogout } = await import("./login-YsrgkAQo.js");
46
+ const { runLogout } = await import("./login-CB55O4Gv.js");
47
47
  return runLogout({
48
48
  url: given(flags.url),
49
49
  json: ctx.json,
@@ -55,7 +55,7 @@ const logout = defineLeaf({
55
55
  const whoami = defineLeaf({
56
56
  flags: { ...urlFlag },
57
57
  async run(ctx, { flags }) {
58
- const { runWhoami } = await import("./login-YsrgkAQo.js");
58
+ const { runWhoami } = await import("./login-CB55O4Gv.js");
59
59
  return runWhoami({
60
60
  url: given(flags.url),
61
61
  json: ctx.json,
@@ -30,20 +30,20 @@ const SECTIONS = [
30
30
  docs: "init",
31
31
  effects: ["files"],
32
32
  config: false,
33
- load: async () => (await import("./init-n1gkKHvc.js")).init
33
+ load: async () => (await import("./init-Buibrl9h.js")).init
34
34
  }),
35
35
  group("preset", "Decode a preset code, or print its permdock.com/create link", "preset", [leaf("decode", "Print what a preset code holds", {
36
36
  examples: ["permdock preset decode p1AQIDBAc"],
37
37
  docs: "preset",
38
38
  effects: [],
39
39
  config: false,
40
- load: async () => (await import("./init-n1gkKHvc.js")).presetDecode
40
+ load: async () => (await import("./init-Buibrl9h.js")).presetDecode
41
41
  }), leaf("url", "Print the permdock.com/create link that opens a code", {
42
42
  examples: ["permdock preset url p1AQIDBAc"],
43
43
  docs: "preset",
44
44
  effects: [],
45
45
  config: false,
46
- load: async () => (await import("./init-n1gkKHvc.js")).presetUrl
46
+ load: async () => (await import("./init-Buibrl9h.js")).presetUrl
47
47
  })]),
48
48
  group("skills", "Install, update or list the PermDock Agent Skills", "skills", [
49
49
  leaf("install", "Copy the Agent Skills into the agent folders", {
@@ -55,21 +55,21 @@ const SECTIONS = [
55
55
  docs: "skills",
56
56
  effects: ["files"],
57
57
  config: false,
58
- load: async () => (await import("./skills-CfkYP7GG.js")).install
58
+ load: async () => (await import("./skills-BIsm1n26.js")).install
59
59
  }),
60
60
  leaf("update", "Replace installed skills with this version's", {
61
61
  examples: ["permdock skills update"],
62
62
  docs: "skills",
63
63
  effects: ["files"],
64
64
  config: false,
65
- load: async () => (await import("./skills-CfkYP7GG.js")).update
65
+ load: async () => (await import("./skills-BIsm1n26.js")).update
66
66
  }),
67
67
  leaf("list", "List the skills and where each is installed", {
68
68
  examples: ["permdock skills list"],
69
69
  docs: "skills",
70
70
  effects: [],
71
71
  config: false,
72
- load: async () => (await import("./skills-CfkYP7GG.js")).list
72
+ load: async () => (await import("./skills-BIsm1n26.js")).list
73
73
  })
74
74
  ]),
75
75
  leaf("doctor", "Check a PermDock installation and print a fix for each finding", {
@@ -82,7 +82,7 @@ const SECTIONS = [
82
82
  effects: ["files"],
83
83
  config: true,
84
84
  findings: true,
85
- load: async () => (await import("./doctor-Dea6IqRw.js")).doctor
85
+ load: async () => (await import("./doctor-gIO9WTYo.js")).doctor
86
86
  }),
87
87
  leaf("completion", "Print the shell completion script for bash, zsh or fish", {
88
88
  examples: ["permdock completion zsh > ~/.zfunc/_permdock", "eval \"$(permdock completion bash)\""],
@@ -90,7 +90,7 @@ const SECTIONS = [
90
90
  effects: [],
91
91
  config: false,
92
92
  shellOutput: true,
93
- load: async () => (await import("./completion-Cq4fbT2S.js")).completion
93
+ load: async () => (await import("./completion-DCza8aQY.js")).completion
94
94
  })
95
95
  ]
96
96
  },
@@ -106,7 +106,7 @@ const SECTIONS = [
106
106
  docs: "collect",
107
107
  effects: ["files"],
108
108
  config: true,
109
- load: async () => (await import("./collect-D9Tt0Bcx.js")).collect
109
+ load: async () => (await import("./collect-DnXL4B8c.js")).collect
110
110
  }),
111
111
  leaf("catalog", "Export the catalog as catalog JSON, JSON Schema or Markdown", {
112
112
  examples: ["permdock catalog --out permissions.catalog.json", "permdock catalog --kind markdown"],
@@ -132,14 +132,14 @@ const SECTIONS = [
132
132
  effects: [],
133
133
  config: true,
134
134
  findings: true,
135
- load: async () => (await import("./usage-BfzSfOpD.js")).usage
135
+ load: async () => (await import("./usage-DBNrpwoT.js")).usage
136
136
  }),
137
137
  leaf("diff", "Compare two policies or catalogs; exit 1 on a breaking change", {
138
138
  examples: ["permdock diff main.catalog.json permissions.catalog.json", "permdock diff ./old-policy.ts ./src/policy.ts --impact"],
139
139
  docs: "diff",
140
140
  effects: [],
141
141
  config: true,
142
- load: async () => (await import("./diff-BwR1JdP2.js")).diff
142
+ load: async () => (await import("./diff-CxtbOi2l.js")).diff
143
143
  }),
144
144
  leaf("config", "Check permdock.config.ts for unknown keys, or print the effective config", {
145
145
  examples: ["permdock config", "permdock config --print"],
@@ -147,7 +147,7 @@ const SECTIONS = [
147
147
  effects: [],
148
148
  config: true,
149
149
  findings: true,
150
- load: async () => (await import("./config-0xxCmoD8.js")).config
150
+ load: async () => (await import("./config-BAM3a3z8.js")).config
151
151
  })
152
152
  ]
153
153
  },
@@ -164,14 +164,14 @@ const SECTIONS = [
164
164
  "network"
165
165
  ],
166
166
  config: true,
167
- load: async () => (await import("./rls-C8nxX0RV.js")).generate
167
+ load: async () => (await import("./rls-yK2nZUcm.js")).generate
168
168
  }),
169
169
  leaf("import", "Turn existing RLS policies into a generated definition", {
170
170
  examples: ["permdock rls import --sql schema.sql --out src/permissions.generated.ts", "permdock rls import --db-url-stdin --out src/permissions.generated.ts"],
171
171
  docs: "rls",
172
172
  effects: ["files", "database:read"],
173
173
  config: true,
174
- load: async () => (await import("./rls-C8nxX0RV.js")).importPolicies
174
+ load: async () => (await import("./rls-yK2nZUcm.js")).importPolicies
175
175
  }),
176
176
  leaf("verify", "Run the fixtures against the policies, or compare a live database", {
177
177
  examples: [
@@ -183,21 +183,21 @@ const SECTIONS = [
183
183
  effects: ["files", "database:read"],
184
184
  config: true,
185
185
  findings: true,
186
- load: async () => (await import("./rls-C8nxX0RV.js")).verify
186
+ load: async () => (await import("./rls-yK2nZUcm.js")).verify
187
187
  }),
188
188
  leaf("migrate", "Rewrite hand-written policies onto the generated helpers", {
189
189
  examples: ["permdock rls migrate --sql supabase/migrations --dry-run", "permdock rls migrate --sql supabase/migrations"],
190
190
  docs: "rls",
191
191
  effects: ["rewrite", "files"],
192
192
  config: true,
193
- load: async () => (await import("./rls-C8nxX0RV.js")).migrate
193
+ load: async () => (await import("./rls-yK2nZUcm.js")).migrate
194
194
  }),
195
195
  leaf("explain", "Show the tables, membership sources and triggers the SQL binds to", {
196
196
  examples: ["permdock rls explain", "permdock rls explain --db-url-stdin --json"],
197
197
  docs: "rls",
198
198
  effects: ["database:read"],
199
199
  config: true,
200
- load: async () => (await import("./rls-C8nxX0RV.js")).explain
200
+ load: async () => (await import("./rls-yK2nZUcm.js")).explain
201
201
  })
202
202
  ]),
203
203
  group("supabase", "Generate the Supabase Custom Access Token Hook, or inspect its manifest", "supabase", [group("hook", "The Custom Access Token Hook", "supabase", [leaf("generate", "Compile the membership sources into the hook migration", {
@@ -205,26 +205,26 @@ const SECTIONS = [
205
205
  docs: "supabase",
206
206
  effects: ["files", "database:read"],
207
207
  config: true,
208
- load: async () => (await import("./supabase-CBEK6KEo.js")).hookGenerate
208
+ load: async () => (await import("./supabase-DYWnT800.js")).hookGenerate
209
209
  })]), leaf("inspect", "Print or write the hook and helper manifest", {
210
210
  examples: ["permdock supabase inspect", "permdock supabase inspect --out"],
211
211
  docs: "supabase",
212
212
  effects: ["files"],
213
213
  config: true,
214
- load: async () => (await import("./supabase-CBEK6KEo.js")).inspect
214
+ load: async () => (await import("./supabase-DYWnT800.js")).inspect
215
215
  })]),
216
216
  group("powersync", "Generate PowerSync Sync Streams from the policy, or verify them", "powersync", [leaf("generate", "Compile the read grants into sync-config.yaml", {
217
217
  examples: ["permdock powersync generate", "permdock powersync generate --check"],
218
218
  docs: "powersync",
219
219
  effects: ["files"],
220
220
  config: true,
221
- load: async () => (await import("./powersync-Bm3ZjHwD.js")).generate
221
+ load: async () => (await import("./powersync-CFWILHjb.js")).generate
222
222
  }), leaf("verify", "Fail on stale streams or a stream that syncs a denied row", {
223
223
  examples: ["permdock powersync verify", "permdock powersync verify --db-url-stdin"],
224
224
  docs: "powersync",
225
225
  effects: ["database:read"],
226
226
  config: true,
227
- load: async () => (await import("./powersync-Bm3ZjHwD.js")).verify
227
+ load: async () => (await import("./powersync-CFWILHjb.js")).verify
228
228
  })]),
229
229
  group("scim", "Generate the Postgres tables postgresDirectoryStore keeps a SCIM directory in", "scim", [leaf("generate", "Write the tenant-keyed users, groups and members tables", {
230
230
  examples: [
@@ -247,13 +247,13 @@ const SECTIONS = [
247
247
  docs: "openapi",
248
248
  effects: ["files"],
249
249
  config: true,
250
- load: async () => (await import("./openapi-BFyBIe9J.js")).emit
250
+ load: async () => (await import("./openapi-eHZ5hwUJ.js")).emit
251
251
  }), leaf("import", "Turn an OpenAPI document into a generated definition", {
252
252
  examples: ["permdock openapi import --doc openapi.yaml --out src/permissions.generated.ts"],
253
253
  docs: "openapi",
254
254
  effects: ["files", "network"],
255
255
  config: false,
256
- load: async () => (await import("./openapi-BFyBIe9J.js")).importDocument
256
+ load: async () => (await import("./openapi-eHZ5hwUJ.js")).importDocument
257
257
  })]),
258
258
  group("arazzo", "Check Arazzo workflows against the permissions", "arazzo", [leaf("check", "Resolve every Arazzo step to x-permdock-permissions", {
259
259
  examples: ["permdock arazzo check --doc arazzo.json --openapi openapi.json"],
@@ -261,7 +261,7 @@ const SECTIONS = [
261
261
  effects: [],
262
262
  config: true,
263
263
  findings: true,
264
- load: async () => (await import("./arazzo-CBBIhC40.js")).check
264
+ load: async () => (await import("./arazzo-CL8CZnpL.js")).check
265
265
  })]),
266
266
  leaf("scan", "List authorization checks written without PermDock, to adopt it in an existing app", {
267
267
  examples: ["permdock scan", "permdock scan --src app,lib --pattern isBeta"],
@@ -269,7 +269,7 @@ const SECTIONS = [
269
269
  effects: [],
270
270
  config: true,
271
271
  findings: true,
272
- load: async () => (await import("./scan-COIQvTMg.js")).scan
272
+ load: async () => (await import("./scan-CzdMtHnq.js")).scan
273
273
  }),
274
274
  group("casl", "Import CASL rules into a generated module", "casl", [leaf("import", "Turn CASL rules per role into a permissions and policy module", {
275
275
  examples: ["permdock casl import --rules rules.json --out src/permissions.generated.ts"],
@@ -283,7 +283,7 @@ const SECTIONS = [
283
283
  docs: "casbin",
284
284
  effects: ["files"],
285
285
  config: false,
286
- load: async () => (await import("./casbin-C8r5trwy.js")).casbinImport
286
+ load: async () => (await import("./casbin-DRFwgVIP.js")).casbinImport
287
287
  })])
288
288
  ]
289
289
  },
@@ -295,34 +295,34 @@ const SECTIONS = [
295
295
  docs: "login",
296
296
  effects: ["network", "files"],
297
297
  config: false,
298
- load: async () => (await import("./login-DyQNWJok.js")).login
298
+ load: async () => (await import("./login-VVpkkund.js")).login
299
299
  }),
300
300
  leaf("logout", "Revoke and delete the stored PermDock Cloud login", {
301
301
  examples: ["permdock logout"],
302
302
  docs: "login",
303
303
  effects: ["network", "files"],
304
304
  config: false,
305
- load: async () => (await import("./login-DyQNWJok.js")).logout
305
+ load: async () => (await import("./login-VVpkkund.js")).logout
306
306
  }),
307
307
  leaf("whoami", "Print the PermDock Cloud identity the CLI acts as", {
308
308
  examples: ["permdock whoami", "permdock whoami --json"],
309
309
  docs: "login",
310
310
  effects: [],
311
311
  config: false,
312
- load: async () => (await import("./login-DyQNWJok.js")).whoami
312
+ load: async () => (await import("./login-VVpkkund.js")).whoami
313
313
  }),
314
314
  group("cloud", "Publish to or pull from a PermDock Cloud project", "cloud", [leaf("push", "Publish the catalog, policy and manifest to a Cloud project", {
315
315
  examples: ["permdock cloud push --dry-run", "permdock cloud push --project prj_123"],
316
316
  docs: "cloud",
317
317
  effects: ["network", "cloud:write"],
318
318
  config: true,
319
- load: async () => (await import("./cloud-C_Mau1q2.js")).push
319
+ load: async () => (await import("./cloud-eOtmuonF.js")).push
320
320
  }), leaf("pull", "Write a Cloud project's published catalog and manifest", {
321
321
  examples: ["permdock cloud pull --project prj_123"],
322
322
  docs: "cloud",
323
323
  effects: ["network", "files"],
324
324
  config: true,
325
- load: async () => (await import("./cloud-C_Mau1q2.js")).pull
325
+ load: async () => (await import("./cloud-eOtmuonF.js")).pull
326
326
  })])
327
327
  ]
328
328
  },
@@ -333,7 +333,7 @@ const SECTIONS = [
333
333
  docs: "codemod",
334
334
  effects: ["rewrite"],
335
335
  config: false,
336
- load: async () => (await import("./codemod-BqYPToUJ.js")).codemod
336
+ load: async () => (await import("./codemod-D6NYu4AK.js")).codemod
337
337
  })]
338
338
  }
339
339
  ];
@@ -345,7 +345,7 @@ const COMPLETE_LEAF = leaf("__complete", "Print completion candidates for a part
345
345
  config: false,
346
346
  shellOutput: true,
347
347
  hidden: true,
348
- load: async () => (await import("./completion-Cq4fbT2S.js")).complete
348
+ load: async () => (await import("./completion-DCza8aQY.js")).complete
349
349
  });
350
350
  const ROOT = group("permdock", "Collect, export, diff and check the permissions a PermDock policy declares", "", [...SECTIONS.flatMap((section) => section.entries), COMPLETE_LEAF]);
351
351
  /** Each leaf with its path from the root, in manifest order. */
@@ -112,6 +112,24 @@ type McpProcedureEnforcement = {
112
112
  readonly permissionFor: (name: string) => Permission | undefined;
113
113
  readonly oauthScopesFor?: (name: string) => readonly string[] | undefined;
114
114
  };
115
+ /** What an `onError` sink receives next to the thrown error. */
116
+ type McpErrorContext = {
117
+ /** The key of the permission being checked. */
118
+ readonly permission: string | null;
119
+ /** The tool, resource or prompt name. */
120
+ readonly name: string;
121
+ /**
122
+ * The tenant the `tenant` option resolves for the call, or `null` when it
123
+ * resolves none or throws.
124
+ */
125
+ readonly tenant: string | null;
126
+ };
127
+ /**
128
+ * Receives an error a check threw: a loader, `decide`, an approval input or a
129
+ * subject a list cannot build. The call still refuses; a sink that throws is
130
+ * ignored. A `BetterSupabaseOnError` from `permdock/better-supabase` fits.
131
+ */
132
+ type McpOnError = (error: unknown, context: McpErrorContext) => void;
115
133
  type McpPermDockOptions<TUser = unknown> = InstanceOptions & {
116
134
  /**
117
135
  * Receives the verified auth info, or `{}` on a transport without one
@@ -195,8 +213,8 @@ type McpPermDock = {
195
213
  * `permission`.
196
214
  */
197
215
  readonly protectServer: {
198
- (server: McpServer): GuardedMcpServer;
199
- (server: McpServer, options: McpProcedureEnforcement): ProcedureMcpServer;
216
+ (server: McpServer, onError?: McpOnError): GuardedMcpServer;
217
+ (server: McpServer, options: McpProcedureEnforcement, onError?: McpOnError): ProcedureMcpServer;
200
218
  };
201
219
  };
202
220
  //#endregion
@@ -290,4 +308,4 @@ type McpSubjectOptions = Pick<JwtSubjectOptions, "claims" | "groupRoles" | "sche
290
308
  */
291
309
  export declare function subjectFromMcp(authInfo: McpAuthInfo | undefined, options?: McpSubjectOptions): Subject<McpPrincipal>;
292
310
  //#endregion
293
- export type { DeniedText, DeniedTextEvent, GuardedMcpServer, McpAuthInfo, McpPermDock, McpPermDockOptions, McpPrincipal, McpProcedureEnforcement, McpProcedureToolConfig, McpPromptConfig, McpResourceConfig, McpResourceGuardOptions, McpResourceGuardResult, McpSubjectOptions, McpToolConfig, McpUiResourceConfig, ProcedureMcpServer, ProtectedResourceMetadataOptions };
311
+ export type { DeniedText, DeniedTextEvent, GuardedMcpServer, McpAuthInfo, McpErrorContext, McpOnError, McpPermDock, McpPermDockOptions, McpPrincipal, McpProcedureEnforcement, McpProcedureToolConfig, McpPromptConfig, McpResourceConfig, McpResourceGuardOptions, McpResourceGuardResult, McpSubjectOptions, McpToolConfig, McpUiResourceConfig, ProcedureMcpServer, ProtectedResourceMetadataOptions };