permdock 0.31.0 → 0.32.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 (142) hide show
  1. package/dist/{adoption-scan-9brJ_mUG.js → adoption-scan-BJMEEu7V.js} +1 -1
  2. package/dist/{arazzo-Cs-3yoxR.js → arazzo-BAgh0PT6.js} +1 -1
  3. package/dist/{arazzo-C0bltfjv.js → arazzo-C_xK2Kaa.js} +1 -1
  4. package/dist/better-supabase/index.d.ts +26 -4
  5. package/dist/better-supabase/index.js +11 -2
  6. package/dist/{bsb-access-tags-B1TBUQLj.js → bsb-access-tags-CjeR7v7-.js} +10 -43
  7. package/dist/{bsb-action-keys-iKmZChtQ.js → bsb-action-keys-CYEREFMg.js} +1 -1
  8. package/dist/{casbin-DGsO-QmR.js → casbin-BErdqy1J.js} +1 -1
  9. package/dist/{casbin-s6_zDJi1.js → casbin-EwdKipQs.js} +1 -1
  10. package/dist/cli/bin.js +1 -1
  11. package/dist/cli/generate/watch-worker.js +2 -2
  12. package/dist/cli/index.d.ts +3 -3
  13. package/dist/cli/index.js +2 -2
  14. package/dist/cli/plugins/app.d.ts +1 -1
  15. package/dist/cli/plugins/app.js +1 -1
  16. package/dist/cli/plugins/better-supabase.d.ts +1 -1
  17. package/dist/cli/plugins/openapi.d.ts +1 -1
  18. package/dist/cli/plugins/openapi.js +1 -1
  19. package/dist/cli/plugins/powersync.d.ts +1 -1
  20. package/dist/cli/plugins/powersync.js +1 -1
  21. package/dist/cli/plugins/rls.d.ts +2 -2
  22. package/dist/cli/plugins/rls.js +1 -1
  23. package/dist/cli/plugins/schemas.d.ts +1 -1
  24. package/dist/cli/plugins/schemas.js +1 -1
  25. package/dist/cli/plugins/scim.d.ts +2 -2
  26. package/dist/cli/plugins/supabase-hook.d.ts +2 -2
  27. package/dist/cli/plugins/supabase-hook.js +1 -1
  28. package/dist/cli/plugins/supabase.d.ts +3 -3
  29. package/dist/cli/plugins/supabase.js +2 -2
  30. package/dist/cli/plugins/ui.d.ts +1 -1
  31. package/dist/cli/plugins/ui.js +1 -1
  32. package/dist/{client-subject-BOPbpwgm.d.ts → client-subject-xCSkKD1C.d.ts} +1 -1
  33. package/dist/{cloud-fRv3j6sq.js → cloud-DW3q3qnp.js} +2 -2
  34. package/dist/{codemod-DsqEKP6A.js → codemod-CF7NNDzA.js} +14 -11
  35. package/dist/{codemod-DT0dMVdd.js → codemod-DVDMFsTX.js} +8 -7
  36. package/dist/{collect-CCgmm5xN.js → collect-CE5wK0AX.js} +1 -1
  37. package/dist/{compile-DNVVdVWs.js → compile-BXKYYmT1.js} +3 -3
  38. package/dist/{completion-DrJkWgZa.js → completion-B59uPAnZ.js} +1 -1
  39. package/dist/{config-D8iWeV9k.js → config-7QvEq57a.js} +2 -2
  40. package/dist/{config-BaKkd6HB.js → config-VCa1RLUe.js} +1 -1
  41. package/dist/{config-report-uuD5eVEn.js → config-report-CjvA6lGI.js} +1 -1
  42. package/dist/{context-Ne0EdD45.js → context-CAFddgb9.js} +1 -1
  43. package/dist/{custom-role-rebuild-BBKC7Bt1.js → custom-role-rebuild-BK73tPib.js} +1 -1
  44. package/dist/{doctor-Ch4VGl2q.js → doctor-ELj5hrVv.js} +2 -2
  45. package/dist/{doctor-C1T2G2mn.js → doctor-ervtBRzG.js} +61 -33
  46. package/dist/{execute-BhWXiQAy.js → execute-ix7AAdWg.js} +3 -3
  47. package/dist/{gen-CGjbD8I_.js → gen-8rW_AUG5.js} +2 -2
  48. package/dist/gen-BtiGMiuH.js +1 -0
  49. package/dist/{gen-kind-thoT0NYV.js → gen-kind-C9ikF8nb.js} +1 -1
  50. package/dist/{generate-vEW8Brg8.js → generate-BmpCt5oi.js} +3 -3
  51. package/dist/{generate-eor7vXGN.js → generate-CW7gNfLr.js} +16 -12
  52. package/dist/{generate-options-MJgn0dgl.js → generate-options-DiR4r_sk.js} +7 -7
  53. package/dist/{hook-sql-DJQ_yOEC.js → hook-sql-D-abRHut.js} +5 -5
  54. package/dist/{import-CGQIK3iN.js → import-BAhoTYTk.js} +1 -1
  55. package/dist/{init-C6te_dSg.js → init-DkRHIe8-.js} +3 -3
  56. package/dist/{init-DN19mlwE.js → init-zxb0BVDJ.js} +1 -1
  57. package/dist/{interactive-only-BjYwp9mm.js → interactive-only-Dqww0ABO.js} +18 -1
  58. package/dist/{keys-qFqDoYeF.js → keys-DQsHrgBM.js} +1 -1
  59. package/dist/{login-BYXaH_yT.js → login-C1p3gmj8.js} +1 -1
  60. package/dist/{login-CMzfsdm8.js → login-DOEZveP6.js} +3 -3
  61. package/dist/{manager-chain-CStuYb7A.js → manager-chain-DdkiCw5q.js} +1 -1
  62. package/dist/{manifest-CowZuywo.js → manifest-31igzVGQ.js} +33 -33
  63. package/dist/{manifest-DdNYR_pl.js → manifest-B487A3po.js} +1 -1
  64. package/dist/{manifest-CA3E0KP8.d.ts → manifest-DgsxeAsM.d.ts} +38 -1
  65. package/dist/{manifest-schema-CLbcbDz7.js → manifest-schema-D7RQbnGY.js} +44 -1
  66. package/dist/{model-BqHWwfcg.js → model-BXhr8gUI.js} +1 -1
  67. package/dist/next/index.d.ts +2 -1
  68. package/dist/next/index.js +2 -1
  69. package/dist/next/plugin.d.ts +1 -1
  70. package/dist/next/plugin.js +1 -1
  71. package/dist/{openapi-Dsh0MDSZ.js → openapi-BeMVHVY4.js} +1 -1
  72. package/dist/{openapi-BP7YpJeF.js → openapi-DEGesHWH.js} +1 -1
  73. package/dist/{openapi-document-_QSOtSKS.js → openapi-document-CEQ6jqqR.js} +1 -1
  74. package/dist/{output-Didy9Ys4.js → output-C7EPeSZj.js} +1 -1
  75. package/dist/{ownership-CG5_N8b5.js → ownership-Csk9C3Js.js} +8 -5
  76. package/dist/{pipeline-B4iyaOK7.js → pipeline-Bbu7uw28.js} +2 -2
  77. package/dist/{plugin-DQJuZVl1.d.ts → plugin-L3G7jPGE.d.ts} +1 -1
  78. package/dist/{policy-hnVT4MC4.js → policy-CSOOQ3rR.js} +1 -1
  79. package/dist/{policy-bundle-BIDV0DZF.js → policy-bundle-KYI0EnrM.js} +3 -3
  80. package/dist/{powersync-DUvN9v5a.js → powersync-C1ix7CEY.js} +1 -1
  81. package/dist/{powersync-D7YfMHke.js → powersync-CGvu6j5U.js} +1 -1
  82. package/dist/{powersync-_2ElzOhQ.js → powersync-CM6Vg4RH.js} +6 -6
  83. package/dist/{provider-D1vlNPWo.js → provider-BV_v0JAY.js} +18 -3
  84. package/dist/{prune-config-5vtQpiLk.js → prune-config-CdoPJIGz.js} +5 -5
  85. package/dist/{pull-BnxZmo3f.js → pull-BaB401Bk.js} +2 -2
  86. package/dist/pull-Bp63vtgu.js +1 -0
  87. package/dist/{push-Bu0uCkJg.js → push-DcjvEj0m.js} +1 -1
  88. package/dist/{rbac-CwcucZPx.js → rbac-mblGDx-Z.js} +1 -1
  89. package/dist/{rename-CLoDRrbc.js → rename-BZNOV8H9.js} +2 -2
  90. package/dist/report-DCAiUc5U.js +1 -0
  91. package/dist/{report-BI_hek_d.js → report-DievqWhf.js} +75 -5
  92. package/dist/{resolve-names-CTji5IPe.js → resolve-names-Cth1UQ-8.js} +2 -2
  93. package/dist/{rls-UY6p6ztg.js → rls-BtkZgaZp.js} +7 -2
  94. package/dist/{rls-BPHCyA5v.js → rls-DUYok5e9.js} +17 -7
  95. package/dist/{rls-files-CDZdTh8v.js → rls-files-ucAI0J5j.js} +1 -1
  96. package/dist/{rls-options-BgD-KZkm.d.ts → rls-options-BFGRmdcH.d.ts} +1 -1
  97. package/dist/run-BjMxYYTe.js +1 -0
  98. package/dist/{run-C3ztA88m.js → run-WIqPbnjD.js} +3 -3
  99. package/dist/{scan-m5m1M6Qn.js → scan-Badcllgg.js} +1 -1
  100. package/dist/{schema-BpGuLrwk.js → schema-DBRKgQb4.js} +1 -1
  101. package/dist/{skills-BytzDi34.js → skills-Ba9hHGO6.js} +1 -1
  102. package/dist/{skills-CzhnDo-C.js → skills-CTKq3o8D.js} +1 -1
  103. package/dist/{sources-D5n28164.d.ts → sources-CjgZns7t.d.ts} +1 -1
  104. package/dist/supabase/index.d.ts +3 -3
  105. package/dist/supabase/index.js +1 -1
  106. package/dist/{supabase-CAswAUeb.js → supabase-CGiB83XQ.js} +1 -1
  107. package/dist/supabase-hook-CluYxKee.js +2 -0
  108. package/dist/{supabase-hook-C0LIaT7b.js → supabase-hook-CqO_0Koh.js} +9 -183
  109. package/dist/{supabase-schemas-BUFeyErz.js → supabase-schemas-BglbAG2Z.js} +9 -8
  110. package/dist/table-reads-AnHPrBp8.js +517 -0
  111. package/dist/table-reads-BviGc0L_.js +1 -0
  112. package/dist/{tables-sLA1CpuN.js → tables-CDq0HVVq.js} +7 -4
  113. package/dist/tenant-check-D7g9oNVH.js +105 -0
  114. package/dist/testing/fixtures/index.d.ts +1 -1
  115. package/dist/testing/fixtures/index.js +14 -8
  116. package/dist/testing/index.d.ts +1 -1
  117. package/dist/testing/index.js +1 -1
  118. package/dist/{types-config-BiMM_zJ-.d.ts → types-config-DNIw_Gt5.d.ts} +1 -1
  119. package/dist/{types-run-N2ffLN_Z.d.ts → types-run-Bwn1MuW0.d.ts} +1 -1
  120. package/dist/unplugin/index.d.ts +1 -1
  121. package/dist/unplugin/index.js +1 -1
  122. package/dist/{usage-DT6QK86a.js → usage-CW6xhRcV.js} +2 -2
  123. package/dist/usage-Ci7Glu-H.js +1 -0
  124. package/dist/{usage-Dcbg6zu6.js → usage-n4V2k_a6.js} +1 -1
  125. package/dist/{verify-DNERav8K.js → verify-CKzngsUH.js} +3 -3
  126. package/dist/warm-5yxlUmBh.js +32 -0
  127. package/dist/warm-BR-mrnY-.d.ts +16 -0
  128. package/dist/{watch-BsQ4n3NV.js → watch-C12Ub7x4.js} +2 -2
  129. package/dist/{watch-fldErlRf.js → watch-D-5ztqN8.js} +1 -1
  130. package/dist/watch-J1PfGMfb.js +1 -0
  131. package/package.json +1 -1
  132. package/schemas/supabase-manifest-v1.json +109 -19
  133. package/skills/permdock-data/references/queries-and-rls.md +1 -1
  134. package/dist/gen-CkUEZ5Z6.js +0 -1
  135. package/dist/platform-CSxTsLsr.js +0 -35
  136. package/dist/pull-CGncYZNZ.js +0 -1
  137. package/dist/report-BevPHMy6.js +0 -1
  138. package/dist/run-3ySqmufy.js +0 -1
  139. package/dist/supabase-hook-DXGg5bNn.js +0 -2
  140. package/dist/tenant-check-gL2miiaS.js +0 -31
  141. package/dist/usage-DdOFc5xq.js +0 -1
  142. package/dist/watch-eay1PztJ.js +0 -1
@@ -24,7 +24,7 @@ const keysRename = defineLeaf({
24
24
  }
25
25
  },
26
26
  async run(ctx, { flags, args }) {
27
- const { runKeysRename } = await import("./rename-CLoDRrbc.js");
27
+ const { runKeysRename } = await import("./rename-BZNOV8H9.js");
28
28
  const migration = given(flags.migration);
29
29
  return runKeysRename({
30
30
  cwd: ctx.cwd,
@@ -3,7 +3,7 @@ import { i as postForm, r as parseToken, s as runDeviceFlow } from "./device-f3J
3
3
  import { i as writeCredentials, n as deleteCredentials, r as readCredentials, t as credentialsPath } from "./storage-BhGDhsXm.js";
4
4
  import { n as CliError } from "./errors-DgLOqc6j.js";
5
5
  import { n as httpRequest } from "./http-BbX_Ou3_.js";
6
- import { o as nonEmptyOr } from "./output-Didy9Ys4.js";
6
+ import { o as nonEmptyOr } from "./output-C7EPeSZj.js";
7
7
  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-WHKYWtnS.js";
8
8
  import { n as randomToken, t as pkce } from "./pkce-DdsRBK7n.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-BYXaH_yT.js");
30
+ const { runLogin } = await import("./login-C1p3gmj8.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-BYXaH_yT.js");
46
+ const { runLogout } = await import("./login-C1p3gmj8.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-BYXaH_yT.js");
58
+ const { runWhoami } = await import("./login-C1p3gmj8.js");
59
59
  return runWhoami({
60
60
  url: given(flags.url),
61
61
  json: ctx.json,
@@ -2,7 +2,7 @@ import { r as isRecord } from "./compact-C4LFuqbW.js";
2
2
  import { n as CliError } from "./errors-DgLOqc6j.js";
3
3
  import { i as refuseDirty, t as applyFiles } from "./files-DuV7wRim.js";
4
4
  import { a as rel } from "./files-DAR51W3J.js";
5
- import { a as readConfig } from "./config-D8iWeV9k.js";
5
+ import { a as readConfig } from "./config-7QvEq57a.js";
6
6
  import { a as REQUEST_APPROVER_IDS, d as checkedManagers, f as isManagerRows, i as MANAGES_ROW, n as MANAGED_ROW_IDS, r as MANAGED_ROW_IDS_IN, t as ACCESSIBLE_ROW_IDS } from "./approval-chain-D97rgMoA.js";
7
7
  import { a as parseSqlFile, n as charIndex, u as removeStatements } from "./ast-Dnm2TOHN.js";
8
8
  import { n as supabaseDir } from "./supabase-dir-0lxKbrYu.js";
@@ -30,20 +30,20 @@ const SECTIONS = [
30
30
  docs: "init",
31
31
  effects: ["files"],
32
32
  config: false,
33
- load: async () => (await import("./init-C6te_dSg.js")).init
33
+ load: async () => (await import("./init-DkRHIe8-.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-C6te_dSg.js")).presetDecode
40
+ load: async () => (await import("./init-DkRHIe8-.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-C6te_dSg.js")).presetUrl
46
+ load: async () => (await import("./init-DkRHIe8-.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-BytzDi34.js")).install
58
+ load: async () => (await import("./skills-Ba9hHGO6.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-BytzDi34.js")).update
65
+ load: async () => (await import("./skills-Ba9hHGO6.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-BytzDi34.js")).list
72
+ load: async () => (await import("./skills-Ba9hHGO6.js")).list
73
73
  })
74
74
  ]),
75
75
  leaf("doctor", "Check a PermDock installation and print a fix for each finding", {
@@ -83,7 +83,7 @@ const SECTIONS = [
83
83
  effects: ["files", "database:read"],
84
84
  config: true,
85
85
  findings: true,
86
- load: async () => (await import("./doctor-Ch4VGl2q.js")).doctor
86
+ load: async () => (await import("./doctor-ELj5hrVv.js")).doctor
87
87
  }),
88
88
  leaf("completion", "Print the shell completion script for bash, zsh or fish", {
89
89
  examples: ["permdock completion zsh > ~/.zfunc/_permdock", "eval \"$(permdock completion bash)\""],
@@ -91,7 +91,7 @@ const SECTIONS = [
91
91
  effects: [],
92
92
  config: false,
93
93
  shellOutput: true,
94
- load: async () => (await import("./completion-DrJkWgZa.js")).completion
94
+ load: async () => (await import("./completion-B59uPAnZ.js")).completion
95
95
  })
96
96
  ]
97
97
  },
@@ -107,7 +107,7 @@ const SECTIONS = [
107
107
  docs: "collect",
108
108
  effects: ["files"],
109
109
  config: true,
110
- load: async () => (await import("./collect-CCgmm5xN.js")).collect
110
+ load: async () => (await import("./collect-CE5wK0AX.js")).collect
111
111
  }),
112
112
  leaf("catalog", "Export the catalog as catalog JSON, JSON Schema or Markdown", {
113
113
  examples: ["permdock catalog --out permissions.catalog.json", "permdock catalog --kind markdown"],
@@ -125,7 +125,7 @@ const SECTIONS = [
125
125
  docs: "generate",
126
126
  effects: ["files"],
127
127
  config: true,
128
- load: async () => (await import("./generate-vEW8Brg8.js")).generate
128
+ load: async () => (await import("./generate-BmpCt5oi.js")).generate
129
129
  }),
130
130
  leaf("usage", "Report unused, ungranted and role-less permissions and conditions on undeclared fields", {
131
131
  examples: ["permdock usage", "permdock usage --fail-on warning"],
@@ -133,7 +133,7 @@ const SECTIONS = [
133
133
  effects: [],
134
134
  config: true,
135
135
  findings: true,
136
- load: async () => (await import("./usage-Dcbg6zu6.js")).usage
136
+ load: async () => (await import("./usage-n4V2k_a6.js")).usage
137
137
  }),
138
138
  leaf("diff", "Compare two policies or catalogs; exit 1 on a breaking change", {
139
139
  examples: ["permdock diff main.catalog.json permissions.catalog.json", "permdock diff ./old-policy.ts ./src/policy.ts --impact"],
@@ -175,7 +175,7 @@ const SECTIONS = [
175
175
  docs: "keys",
176
176
  effects: ["rewrite", "files"],
177
177
  config: true,
178
- load: async () => (await import("./keys-qFqDoYeF.js")).keysRename
178
+ load: async () => (await import("./keys-DQsHrgBM.js")).keysRename
179
179
  })]),
180
180
  group("policy", "Write the static grants of a policy as a content-addressed bundle", "policy", [leaf("bundle", "Write the policy bundle that rls.staticGrants 'ref' pins by hash", {
181
181
  examples: [
@@ -186,7 +186,7 @@ const SECTIONS = [
186
186
  docs: "policy",
187
187
  effects: ["files"],
188
188
  config: true,
189
- load: async () => (await import("./policy-hnVT4MC4.js")).policyBundle
189
+ load: async () => (await import("./policy-CSOOQ3rR.js")).policyBundle
190
190
  })]),
191
191
  group("claims", "Measure the memberships claim of an access token", "claims", [leaf("size", "Report claim bytes, token characters and the budget cut", {
192
192
  examples: ["permdock claims size --memberships 60", "permdock claims size --memberships 11 --roles 3 --json"],
@@ -201,7 +201,7 @@ const SECTIONS = [
201
201
  effects: [],
202
202
  config: true,
203
203
  findings: true,
204
- load: async () => (await import("./config-BaKkd6HB.js")).config
204
+ load: async () => (await import("./config-VCa1RLUe.js")).config
205
205
  })
206
206
  ]
207
207
  },
@@ -214,7 +214,7 @@ const SECTIONS = [
214
214
  docs: "rls",
215
215
  effects: ["files", "database:read"],
216
216
  config: true,
217
- load: async () => (await import("./rls-UY6p6ztg.js")).importPolicies
217
+ load: async () => (await import("./rls-BtkZgaZp.js")).importPolicies
218
218
  }),
219
219
  leaf("verify", "Run the fixtures against the policies, or compare a live database", {
220
220
  examples: [
@@ -226,28 +226,28 @@ const SECTIONS = [
226
226
  effects: ["files", "database:read"],
227
227
  config: true,
228
228
  findings: true,
229
- load: async () => (await import("./rls-UY6p6ztg.js")).verify
229
+ load: async () => (await import("./rls-BtkZgaZp.js")).verify
230
230
  }),
231
231
  leaf("migrate", "Rewrite hand-written policies onto the generated helpers", {
232
232
  examples: ["permdock rls migrate --sql supabase/migrations --dry-run", "permdock rls migrate --sql supabase/migrations"],
233
233
  docs: "rls",
234
234
  effects: ["rewrite", "files"],
235
235
  config: true,
236
- load: async () => (await import("./rls-UY6p6ztg.js")).migrate
236
+ load: async () => (await import("./rls-BtkZgaZp.js")).migrate
237
237
  }),
238
238
  leaf("explain", "Show the tables, membership sources and triggers the SQL binds to", {
239
239
  examples: ["permdock rls explain", "permdock rls explain --db-url-stdin --json"],
240
240
  docs: "rls",
241
241
  effects: ["database:read"],
242
242
  config: true,
243
- load: async () => (await import("./rls-UY6p6ztg.js")).explain
243
+ load: async () => (await import("./rls-BtkZgaZp.js")).explain
244
244
  }),
245
245
  leaf("report", "List each table's policies by command, role, origin and helper calls", {
246
246
  examples: ["permdock rls report", "permdock rls report --local --json"],
247
247
  docs: "rls",
248
248
  effects: ["database:read"],
249
249
  config: true,
250
- load: async () => (await import("./rls-UY6p6ztg.js")).report
250
+ load: async () => (await import("./rls-BtkZgaZp.js")).report
251
251
  })
252
252
  ]),
253
253
  group("supabase", "Generate the Supabase Custom Access Token Hook, or inspect its manifest", "supabase", [leaf("inspect", "Print or write the hook and helper manifest", {
@@ -255,14 +255,14 @@ const SECTIONS = [
255
255
  docs: "supabase",
256
256
  effects: ["files"],
257
257
  config: true,
258
- load: async () => (await import("./supabase-CAswAUeb.js")).inspect
258
+ load: async () => (await import("./supabase-CGiB83XQ.js")).inspect
259
259
  })]),
260
260
  group("powersync", "Generate PowerSync Sync Streams from the policy, or verify them", "powersync", [leaf("verify", "Fail on stale streams or a stream that syncs a denied row", {
261
261
  examples: ["permdock powersync verify", "permdock powersync verify --db-url-stdin"],
262
262
  docs: "powersync",
263
263
  effects: ["database:read"],
264
264
  config: true,
265
- load: async () => (await import("./powersync-D7YfMHke.js")).verify
265
+ load: async () => (await import("./powersync-CGvu6j5U.js")).verify
266
266
  })])
267
267
  ]
268
268
  },
@@ -275,13 +275,13 @@ const SECTIONS = [
275
275
  effects: ["files"],
276
276
  config: true,
277
277
  findings: true,
278
- load: async () => (await import("./openapi-BP7YpJeF.js")).annotateRoutes
278
+ load: async () => (await import("./openapi-DEGesHWH.js")).annotateRoutes
279
279
  }), leaf("import", "Turn an OpenAPI document into a generated definition", {
280
280
  examples: ["permdock openapi import --doc openapi.yaml --out src/permissions.generated.ts"],
281
281
  docs: "openapi",
282
282
  effects: ["files", "network"],
283
283
  config: false,
284
- load: async () => (await import("./openapi-BP7YpJeF.js")).importDocument
284
+ load: async () => (await import("./openapi-DEGesHWH.js")).importDocument
285
285
  })]),
286
286
  group("arazzo", "Check Arazzo workflows against the permissions", "arazzo", [leaf("check", "Resolve every Arazzo step to x-permdock-permissions", {
287
287
  examples: ["permdock arazzo check --doc arazzo.json --openapi openapi.json"],
@@ -289,7 +289,7 @@ const SECTIONS = [
289
289
  effects: [],
290
290
  config: true,
291
291
  findings: true,
292
- load: async () => (await import("./arazzo-C0bltfjv.js")).check
292
+ load: async () => (await import("./arazzo-C_xK2Kaa.js")).check
293
293
  })]),
294
294
  leaf("scan", "List authorization checks written without PermDock, to adopt it in an existing app", {
295
295
  examples: ["permdock scan", "permdock scan --src app,lib --pattern isBeta"],
@@ -297,7 +297,7 @@ const SECTIONS = [
297
297
  effects: [],
298
298
  config: true,
299
299
  findings: true,
300
- load: async () => (await import("./scan-m5m1M6Qn.js")).scan
300
+ load: async () => (await import("./scan-Badcllgg.js")).scan
301
301
  }),
302
302
  group("casl", "Import CASL rules into a generated module", "casl", [leaf("import", "Turn CASL rules per role into a permissions and policy module", {
303
303
  examples: ["permdock casl import --rules rules.json --out src/permissions.generated.ts"],
@@ -311,7 +311,7 @@ const SECTIONS = [
311
311
  docs: "casbin",
312
312
  effects: ["files"],
313
313
  config: false,
314
- load: async () => (await import("./casbin-s6_zDJi1.js")).casbinImport
314
+ load: async () => (await import("./casbin-EwdKipQs.js")).casbinImport
315
315
  })])
316
316
  ]
317
317
  },
@@ -323,34 +323,34 @@ const SECTIONS = [
323
323
  docs: "login",
324
324
  effects: ["network", "files"],
325
325
  config: false,
326
- load: async () => (await import("./login-CMzfsdm8.js")).login
326
+ load: async () => (await import("./login-DOEZveP6.js")).login
327
327
  }),
328
328
  leaf("logout", "Revoke and delete the stored PermDock Cloud login", {
329
329
  examples: ["permdock logout"],
330
330
  docs: "login",
331
331
  effects: ["network", "files"],
332
332
  config: false,
333
- load: async () => (await import("./login-CMzfsdm8.js")).logout
333
+ load: async () => (await import("./login-DOEZveP6.js")).logout
334
334
  }),
335
335
  leaf("whoami", "Print the PermDock Cloud identity the CLI acts as", {
336
336
  examples: ["permdock whoami", "permdock whoami --json"],
337
337
  docs: "login",
338
338
  effects: [],
339
339
  config: false,
340
- load: async () => (await import("./login-CMzfsdm8.js")).whoami
340
+ load: async () => (await import("./login-DOEZveP6.js")).whoami
341
341
  }),
342
342
  group("cloud", "Publish to or pull from a PermDock Cloud project", "cloud", [leaf("push", "Publish the catalog, policy and manifest to a Cloud project", {
343
343
  examples: ["permdock cloud push --dry-run", "permdock cloud push --project prj_123"],
344
344
  docs: "cloud",
345
345
  effects: ["network", "cloud:write"],
346
346
  config: true,
347
- load: async () => (await import("./cloud-fRv3j6sq.js")).push
347
+ load: async () => (await import("./cloud-DW3q3qnp.js")).push
348
348
  }), leaf("pull", "Write a Cloud project's published catalog and manifest", {
349
349
  examples: ["permdock cloud pull --project prj_123"],
350
350
  docs: "cloud",
351
351
  effects: ["network", "files"],
352
352
  config: true,
353
- load: async () => (await import("./cloud-fRv3j6sq.js")).pull
353
+ load: async () => (await import("./cloud-DW3q3qnp.js")).pull
354
354
  })])
355
355
  ]
356
356
  },
@@ -365,7 +365,7 @@ const SECTIONS = [
365
365
  docs: "codemod",
366
366
  effects: ["rewrite"],
367
367
  config: false,
368
- load: async () => (await import("./codemod-DT0dMVdd.js")).codemod
368
+ load: async () => (await import("./codemod-DVDMFsTX.js")).codemod
369
369
  })]
370
370
  }
371
371
  ];
@@ -377,7 +377,7 @@ const COMPLETE_LEAF = leaf("__complete", "Print completion candidates for a part
377
377
  config: false,
378
378
  shellOutput: true,
379
379
  hidden: true,
380
- load: async () => (await import("./completion-DrJkWgZa.js")).complete
380
+ load: async () => (await import("./completion-B59uPAnZ.js")).complete
381
381
  });
382
382
  const ROOT = group("permdock", "Collect, export, diff and check the permissions a PermDock policy declares", "", [...SECTIONS.flatMap((section) => section.entries), COMPLETE_LEAF]);
383
383
  /** Each leaf with its path from the root, in manifest order. */
@@ -1,7 +1,7 @@
1
1
  import { n as freezeDeep } from "./freeze-DGfJq_j2.js";
2
2
  import { n as copyJson, t as checkSchema } from "./json-schema-jtX26ydD.js";
3
3
  import { n as PermDockValidationError } from "./validation-error-CgDOA6VS.js";
4
- import { t as supabaseManifestSchema } from "./manifest-schema-CLbcbDz7.js";
4
+ import { t as supabaseManifestSchema } from "./manifest-schema-D7RQbnGY.js";
5
5
  // src/supabase/manifest.ts
6
6
  /** Whether the manifest describes a token hook. */
7
7
  function hasTokenHook(manifest) {
@@ -351,9 +351,23 @@ type SupabaseManifestRls = {
351
351
  /**
352
352
  * Whether every holder of a table's select permissions in a tenant reads the
353
353
  * same rows, read from the select policies the schema files, migrations and
354
- * `rls.out` leave defined. Absent from a manifest written before 0.32.
354
+ * `rls.out` leave defined. Absent from a manifest written before 0.31.
355
355
  */
356
356
  readonly tableReads?: readonly SupabaseManifestTableRead[];
357
+ /**
358
+ * The functions the schema files define that better-supabase's doctor BS430
359
+ * accepts in a `share: "tenant"` fill: `language sql`, `security invoker`,
360
+ * `stable` or `immutable`, no caller identity, reading `tenant` tables only.
361
+ * Absent from a manifest written before 0.31.
362
+ */
363
+ readonly sharedFunctions?: readonly SupabaseManifestSharedFunction[];
364
+ /**
365
+ * The generated helpers whose answer for one tenant and one key depends only
366
+ * on the caller's grants of that key in that tenant, so two callers with an
367
+ * equal `grantFingerprint` for the key get the same answer. Absent from a
368
+ * manifest written before 0.31.
369
+ */
370
+ readonly tenantPureHelpers?: readonly SupabaseManifestTenantHelper[];
357
371
  readonly apiKeys?: {
358
372
  readonly claim: string;
359
373
  readonly scopes: string;
@@ -362,6 +376,24 @@ type SupabaseManifestRls = {
362
376
  readonly serviceRoles: readonly string[];
363
377
  };
364
378
  };
379
+ /** One entry of `rls.sharedFunctions`. */
380
+ type SupabaseManifestSharedFunction = {
381
+ /** `schema.name`. */
382
+ readonly function: string;
383
+ /** The `tenant` tables the function reads, as `schema.table`. */
384
+ readonly tables: readonly string[];
385
+ /** The keys the select policies of those tables check. */
386
+ readonly permissions: readonly string[];
387
+ };
388
+ /** One entry of `rls.tenantPureHelpers`. */
389
+ type SupabaseManifestTenantHelper = {
390
+ /** `schema.name`. */
391
+ readonly name: string;
392
+ /** The argument that holds the permission or grant key (`text` or `text[]`). */
393
+ readonly keyArgument: string;
394
+ /** The argument that holds the tenant id; it must be the entry's tenant. */
395
+ readonly tenantArgument: string;
396
+ };
365
397
  /** One entry of `rls.tableReads`. */
366
398
  type SupabaseManifestTableRead = {
367
399
  /** `schema.table`. */
@@ -377,6 +409,11 @@ type SupabaseManifestTableRead = {
377
409
  readonly permissions?: readonly string[];
378
410
  /** Why the table is `row`. */
379
411
  readonly rules?: readonly ("follows" | "via" | "walk" | "owner" | "condition" | "restrictive" | "fields" | "form" | "unknown")[];
412
+ /**
413
+ * For a `form` table, the grant of each key its policies pass that keeps
414
+ * `permitted_<root>_ids_by_permission` from answering as the plain helper.
415
+ */
416
+ readonly reason?: string;
380
417
  };
381
418
  /**
382
419
  * The manifest of a project in `rls.authorize: 'database'` mode without
@@ -277,7 +277,7 @@ const supabaseManifestSchema = freezeDeep({
277
277
  },
278
278
  tokenScopes: { type: "boolean" },
279
279
  tableReads: {
280
- description: "Whether every holder of a table's select permissions in a tenant reads the same rows, from the select policies the schema files, migrations and rls.out leave defined. Absent from a manifest written before 0.32.",
280
+ description: "Whether every holder of a table's select permissions in a tenant reads the same rows, from the select policies the schema files, migrations and rls.out leave defined. Absent from a manifest written before 0.31.",
281
281
  type: "array",
282
282
  items: {
283
283
  type: "object",
@@ -304,10 +304,53 @@ const supabaseManifestSchema = freezeDeep({
304
304
  "form",
305
305
  "unknown"
306
306
  ] }
307
+ },
308
+ reason: { type: "string" }
309
+ }
310
+ }
311
+ },
312
+ sharedFunctions: {
313
+ description: "Functions better-supabase doctor BS430 accepts in a tenant fill: language sql, security invoker, stable or immutable, no caller identity, reading tenant tables only. Absent from a manifest written before 0.31.",
314
+ type: "array",
315
+ items: {
316
+ type: "object",
317
+ required: [
318
+ "function",
319
+ "tables",
320
+ "permissions"
321
+ ],
322
+ additionalProperties: false,
323
+ properties: {
324
+ function: { type: "string" },
325
+ tables: {
326
+ type: "array",
327
+ items: { type: "string" }
328
+ },
329
+ permissions: {
330
+ type: "array",
331
+ items: { type: "string" }
307
332
  }
308
333
  }
309
334
  }
310
335
  },
336
+ tenantPureHelpers: {
337
+ description: "Generated helpers whose answer for one tenant and key depends only on the caller's grants of that key in the tenant. Absent from a manifest written before 0.31.",
338
+ type: "array",
339
+ items: {
340
+ type: "object",
341
+ required: [
342
+ "name",
343
+ "keyArgument",
344
+ "tenantArgument"
345
+ ],
346
+ additionalProperties: false,
347
+ properties: {
348
+ name: { type: "string" },
349
+ keyArgument: { type: "string" },
350
+ tenantArgument: { type: "string" }
351
+ }
352
+ }
353
+ },
311
354
  apiKeys: {
312
355
  type: "object",
313
356
  required: [
@@ -7,7 +7,7 @@ import { o as sqlFiles } from "./files-DAR51W3J.js";
7
7
  import { c as jsonSchemaOf } from "./catalog-doc-D4g3nyFB.js";
8
8
  import { a as quoteIdent, o as quoteLiteral } from "./quote-BKrTBbcH.js";
9
9
  import { a as parseSqlFile, f as stringValues, l as readRelation, t as SqlSyntaxError, u as removeStatements } from "./ast-Dnm2TOHN.js";
10
- import { f as compileConditionSql } from "./rbac-CwcucZPx.js";
10
+ import { f as compileConditionSql } from "./rbac-mblGDx-Z.js";
11
11
  import { readFileSync } from "node:fs";
12
12
  import { relative } from "node:path";
13
13
  // src/cli/sql/exported-copies.ts
@@ -1,4 +1,5 @@
1
1
  import { a as snapshotHeaders, i as cacheLifeFor, n as SnapshotHeaders, o as snapshotKey, r as SnapshotHeadersOptions, s as snapshotTag, t as CacheLifeForOptions } from "../snapshot-cache-DGvLQW0-.js";
2
+ import { r as warm, t as WarmReport } from "../warm-BR-mrnY-.js";
2
3
  import { D as Policy, Er as Principal, N as PolicyVocabulary, Or as Subject, Q as Intent, ar as DenialReason, dn as SnapshotTenants, nn as Snapshot, nr as Decision } from "../policy-types-CfW4X_yX.js";
3
4
  import { m as ApprovalStore } from "../types-vKKndyxx.js";
4
5
  import { b as ProtectedAction, y as ActionResult } from "../store-core-BdFcruPm.js";
@@ -273,4 +274,4 @@ type NextRouteParams = Readonly<Record<string, string | readonly string[] | unde
273
274
  * instance has no tenant instead of the factory's default.
274
275
  */
275
276
  export declare function tenantFromPath(options: NextTenantFromPathOptions): (params: NextRouteParams | Promise<NextRouteParams>) => Promise<string>;
276
- export { type ActionResult, type CacheLifeForOptions, type GetPermDockQuery, type GetSnapshotQuery, type NextPermDock, type NextPermDockOptions, type NextPermDockProviderProps, type NextRouteParams, type NextTenantFromPathOptions, type PermDockHandler, type PermissionRequirementOptions, type ProtectAction, type ProtectActionOptions, type ProtectedAction, type ProtectedActionContext, type ProtectedActionHandler, type ServerPermissionState, type SnapshotHeaders, type SnapshotHeadersOptions, type TenantSlugResolver, cacheLifeFor, snapshotHeaders, snapshotKey, snapshotTag };
277
+ export { type ActionResult, type CacheLifeForOptions, type GetPermDockQuery, type GetSnapshotQuery, type NextPermDock, type NextPermDockOptions, type NextPermDockProviderProps, type NextRouteParams, type NextTenantFromPathOptions, type PermDockHandler, type PermissionRequirementOptions, type ProtectAction, type ProtectActionOptions, type ProtectedAction, type ProtectedActionContext, type ProtectedActionHandler, type ServerPermissionState, type SnapshotHeaders, type SnapshotHeadersOptions, type TenantSlugResolver, type WarmReport, cacheLifeFor, snapshotHeaders, snapshotKey, snapshotTag, warm };
@@ -1,4 +1,5 @@
1
1
  import { i as snapshotTag, n as snapshotHeaders, r as snapshotKey, t as cacheLifeFor } from "../snapshot-cache-DTTEfmxv.js";
2
+ import { t as warm } from "../warm-5yxlUmBh.js";
2
3
  import { u as withApp } from "../permdock-CJPIwU1T.js";
3
4
  import { n as resolveOrNull, t as buildInstance } from "../build-instance-CFiegi_w.js";
4
5
  import { a as permissionStates } from "../checks-DSm45qH7.js";
@@ -486,4 +487,4 @@ function tenantFromPath(options) {
486
487
  return resolveTenantSlug(options.resolve, slug);
487
488
  };
488
489
  }
489
- export { cacheLifeFor, createPermDock, snapshotHeaders, snapshotKey, snapshotTag, tenantFromPath };
490
+ export { cacheLifeFor, createPermDock, snapshotHeaders, snapshotKey, snapshotTag, tenantFromPath, warm };
@@ -1,4 +1,4 @@
1
- import { n as PermDockPluginOptions } from "../types-run-N2ffLN_Z.js";
1
+ import { n as PermDockPluginOptions } from "../types-run-Bwn1MuW0.js";
2
2
  /** Any object: Next's `NextConfig` is an interface, so no index signature. */
3
3
  type NextConfigLike = object;
4
4
  /** What `next.config` may export: an object, or a function of the phase. */
@@ -1,5 +1,5 @@
1
1
  import { a as describeError } from "../errors-DgLOqc6j.js";
2
- import { i as report, r as createCollectScheduler, t as collectOnce } from "../watch-fldErlRf.js";
2
+ import { i as report, r as createCollectScheduler, t as collectOnce } from "../watch-D-5ztqN8.js";
3
3
  // src/cli/plugin.ts
4
4
  const PHASE_BUILD = "phase-production-build";
5
5
  const PHASE_DEV = "phase-development-server";
@@ -7,7 +7,7 @@ import { i as fileDrift } from "./output-files-8lfALMSU.js";
7
7
  import { t as shortDiff } from "./text-diff-DxKRNFlx.js";
8
8
  import { i as readJsonFile, s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
9
9
  import { a as loadModule, n as asPolicy, s as pickNamed, t as asPermissionTree } from "./load-m7jmit3y.js";
10
- import { n as validateOverlay, t as validateOpenapi } from "./schema-BpGuLrwk.js";
10
+ import { n as validateOverlay, t as validateOpenapi } from "./schema-DBRKgQb4.js";
11
11
  import { existsSync } from "node:fs";
12
12
  import { resolve } from "node:path";
13
13
  // src/cli/openapi/emit/merge.ts
@@ -88,7 +88,7 @@ const importDocument = defineLeaf({
88
88
  async run(ctx, { flags }) {
89
89
  const doc = given(flags.doc);
90
90
  if (doc === void 0) throw missingInput("openapi import", ["--doc"], "the OpenAPI document to import");
91
- return (await import("./import-CGQIK3iN.js")).runOpenapiImport({
91
+ return (await import("./import-BAhoTYTk.js")).runOpenapiImport({
92
92
  cwd: ctx.cwd,
93
93
  doc,
94
94
  out: fileOut("openapi import", flags.out),
@@ -3,7 +3,7 @@ import { n as CliError } from "./errors-DgLOqc6j.js";
3
3
  /** The annotated document, without writing it. */
4
4
  async function openapiDocument(task, options, source) {
5
5
  if (options.doc === void 0) return [];
6
- const { runOpenapi } = await import("./openapi-Dsh0MDSZ.js");
6
+ const { runOpenapi } = await import("./openapi-BeMVHVY4.js");
7
7
  const outcome = await runOpenapi({
8
8
  cwd: source.cwd,
9
9
  config: source.config,
@@ -1,5 +1,5 @@
1
1
  import { c as isActionRequired, l as isRetryable, n as CliError, t as CLI_ERRORS_URL } from "./errors-DgLOqc6j.js";
2
- import { t as DOCS_BASE } from "./manifest-CowZuywo.js";
2
+ import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
3
3
  import { s as cliVersion } from "./version-D-jWyJb9.js";
4
4
  import { createHash } from "node:crypto";
5
5
  // src/cli/core/consent.ts
@@ -1,13 +1,13 @@
1
1
  import { l as scopeChain, s as resolveScope } from "./scopes-B-KX9EI8.js";
2
2
  import { r as findRole } from "./vocabulary-CE2k7s1a.js";
3
- import { C as sourcesKeep, O as membershipRows, P as hasCustomRoleChecksFor, T as globalRoleRows, a as interactiveSessionSql, ct as scopeTable, et as memberForTable, k as roleRows, l as disabledColumn, p as memberColumn, rt as memberRoleOf, s as claimKeptLines, st as scopeSources, y as sourceFilters, z as storedTenant } from "./interactive-only-BjYwp9mm.js";
3
+ import { A as membershipRows, D as globalRoleRows, I as hasCustomRoleChecksFor, T as sourcesKeep, V as storedTenant, at as memberRoleOf, d as disabledColumn, h as memberColumn, j as roleRows, l as claimKeptLines, lt as scopeSources, n as delegatedGlobalSql, nt as memberForTable, o as interactiveSessionSql, ut as scopeTable, x as sourceFilters } from "./interactive-only-Dqww0ABO.js";
4
4
  import { C as tenantTypeOf, a as kindFilterSql, f as subjectIdSql, r as globalKindFilterSql, s as memberVia } from "./subject-CrldGifz.js";
5
5
  import { i as qualifySqlTable } from "./sql-T4GaBh9X.js";
6
6
  import { l as roleColumn } from "./sources-DnjJPGfb.js";
7
7
  import { i as configError } from "./errors-DgLOqc6j.js";
8
8
  import { a as quoteIdent, i as qualified, n as declaredArray, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
9
9
  import { s as signedIn, t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
10
- import { _ as sourceTransferTriggerSql, b as ASSIGNMENTS, g as sourceRowsSql, h as sourceHoldersTriggerSql, m as pairsSql, p as holderSources, v as holdersTriggerSql, x as OWNERSHIP, y as transferTriggerSql } from "./tables-sLA1CpuN.js";
10
+ import { _ as sourceTransferTriggerSql, b as ASSIGNMENTS, g as sourceRowsSql, h as sourceHoldersTriggerSql, m as pairsSql, p as holderSources, v as holdersTriggerSql, x as OWNERSHIP, y as transferTriggerSql } from "./tables-CDq0HVVq.js";
11
11
  // src/cli/rls/assignments.ts
12
12
  /**
13
13
  * The client roles whose writes the assignment triggers check; any other role
@@ -245,7 +245,8 @@ function canAssignSql(base, own, forUser = false) {
245
245
  const ctx = forUser ? {
246
246
  ...base,
247
247
  subjectId: "p_user",
248
- tenants: "all"
248
+ tenants: "all",
249
+ namedUser: true
249
250
  } : base;
250
251
  const fn = qualified(ctx, forUser ? OWNERSHIP.canAssignFor : OWNERSHIP.canAssign);
251
252
  const parts = [];
@@ -255,19 +256,21 @@ function canAssignSql(base, own, forUser = false) {
255
256
  return `v_user_${String(index)}`;
256
257
  };
257
258
  const global = own.assigns.filter((pair) => pair.scope === "global");
259
+ const delegated = delegatedGlobalSql(ctx);
260
+ const gate = delegated === void 0 ? "" : ` and ${delegated}`;
258
261
  for (const [instance, pairs] of [["p_scope_id is not null", global.filter((pair) => pair.at !== "global")], ["p_scope_id is null", global.filter((pair) => pair.at === "global")]]) {
259
262
  if (pairs.length === 0) continue;
260
263
  if (ctx.authorize === "database") {
261
264
  const ur = globalRoleRows(ctx);
262
265
  const kind = globalKindFilterSql(ctx, ur.roleSql);
263
- parts.push(`${instance} and exists (
266
+ parts.push(`${instance}${gate} and exists (
264
267
  select 1 from ${ur.from}
265
268
  where ${ur.userSql} = ${subjectIdSql(ctx)}
266
269
  and (${ur.roleSql}, p_role) in (${pairsSql(pairs)})${kind === void 0 ? "" : `\n and ${kind}`}
267
270
  )`);
268
271
  } else {
269
272
  const kind = globalKindFilterSql(ctx, "r.role");
270
- parts.push(`${instance} and exists (
273
+ parts.push(`${instance}${gate} and exists (
271
274
  select 1 from ${roleRows(ctx)}
272
275
  where (r.role, p_role) in (${pairsSql(pairs)})${kind === void 0 ? "" : `\n and ${kind}`}
273
276
  )`);
@@ -2,8 +2,8 @@ import { t as canonicalJson } from "./canonical-json-BibZkXtE.js";
2
2
  import { r as planFiles, t as applyFiles } from "./files-DuV7wRim.js";
3
3
  import { s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
4
4
  import { n as CliError } from "./errors-DgLOqc6j.js";
5
- import { a as ownedObjects, i as inReservedDir, n as foreignSchemaFiles, o as shownKey, s as withoutOwned, t as policyModel } from "./model-BqHWwfcg.js";
6
- import { n as resolveSchemas } from "./supabase-schemas-BUFeyErz.js";
5
+ import { a as ownedObjects, i as inReservedDir, n as foreignSchemaFiles, o as shownKey, s as withoutOwned, t as policyModel } from "./model-BXhr8gUI.js";
6
+ import { n as resolveSchemas } from "./supabase-schemas-BglbAG2Z.js";
7
7
  import { i as orderPlugins } from "./plugin-MQVfUBUS.js";
8
8
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
9
9
  import { join, relative, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
1
  import { D as Policy, Nr as Condition, _ as Grant, kn as Scope } from "./policy-types-CfW4X_yX.js";
2
- import { a as PermDockConfig } from "./types-config-BiMM_zJ-.js";
2
+ import { a as PermDockConfig } from "./types-config-DNIw_Gt5.js";
3
3
  import { P as ResourceNode } from "./vocabulary-DHfKPIC5.js";
4
4
  /** The settings of the Supabase project config doctor reads. */
5
5
  type SupabaseConfig = {
@@ -18,7 +18,7 @@ const policyBundle = defineLeaf({
18
18
  },
19
19
  async run(ctx, { flags }) {
20
20
  try {
21
- const { runPolicyBundle } = await import("./policy-bundle-BIDV0DZF.js");
21
+ const { runPolicyBundle } = await import("./policy-bundle-KYI0EnrM.js");
22
22
  const policy = await requirePolicy(ctx.cwd, given(flags.policy) ?? ctx.config.policy, "set policy in permdock.config.ts or pass --policy");
23
23
  return runPolicyBundle({
24
24
  cwd: ctx.cwd,