permdock 0.2.0 → 0.3.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 (192) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +2 -2
  3. package/dist/ai-sdk/index.d.ts +3 -3
  4. package/dist/ai-sdk/index.js +1 -1
  5. package/dist/approvals/index.d.ts +2 -2
  6. package/dist/{arazzo-cmvX2jDe.js → arazzo-CKwwqFWz.js} +1 -1
  7. package/dist/authzen/index.d.ts +3 -3
  8. package/dist/authzen/index.js +1 -1
  9. package/dist/better-auth/index.d.ts +1 -1
  10. package/dist/better-supabase/index.d.ts +27 -10
  11. package/dist/better-supabase/index.js +44 -16
  12. package/dist/{bind-CVy3Espv.d.ts → bind-C_ob3LKa.d.ts} +5 -5
  13. package/dist/{bind-VnYn2HKq.js → bind-CuzGytRf.js} +1 -1
  14. package/dist/{capability-Dq43tT1u.d.ts → capability-2kYTMWDv.d.ts} +1 -1
  15. package/dist/catalog-CRW5Mx_B.js +2 -0
  16. package/dist/{catalog-z8q6bi_r.js → catalog-DWF5cYqB.js} +2 -2
  17. package/dist/{catalog-h2tlKFkq.js → catalog-dFZdWCGN.js} +2 -2
  18. package/dist/{catalog-doc-Dsc9y7sd.js → catalog-doc-DdGm82XT.js} +3 -26
  19. package/dist/claude-agent/index.d.ts +3 -3
  20. package/dist/claude-agent/index.js +1 -1
  21. package/dist/clerk/index.d.ts +2 -2
  22. package/dist/cli/bin.js +1 -1
  23. package/dist/cli/index.d.ts +1 -1
  24. package/dist/cli/index.js +1 -1
  25. package/dist/cloud/index.d.ts +4 -4
  26. package/dist/{cloud-BGhHS-lY.js → cloud-CB_ELYuX.js} +2 -2
  27. package/dist/{cloud-Bo3e9Ak3.js → cloud-DWLXO2af.js} +3 -3
  28. package/dist/{collect-DLlujdHC.js → collect-DClJsheJ.js} +3 -3
  29. package/dist/{collect-DDDv_ESs.js → collect-DSTE3ml9.js} +1 -1
  30. package/dist/collect-DSWOk19R.js +2 -0
  31. package/dist/{commands-DWOrSQic.js → commands-DSxCqG9A.js} +13 -13
  32. package/dist/compile/index.d.ts +1 -1
  33. package/dist/{compile-CNnl6uIt.d.ts → compile-BkRyBDBw.d.ts} +1 -1
  34. package/dist/{config-Bn00Z3ks.js → config-Dnszbv-6.js} +2 -2
  35. package/dist/{config-report-Dw_JcUqT.js → config-report-DMvWKUxL.js} +4 -4
  36. package/dist/{context-Ttp0ekMT.js → context-Bcy85rGi.js} +2 -2
  37. package/dist/convex/index.d.ts +3 -3
  38. package/dist/convex/index.js +1 -1
  39. package/dist/{create-BWyx3jua.d.ts → create-B1d519XK.d.ts} +5 -5
  40. package/dist/{create-CPhDL6qx.js → create-CMwIl-w2.js} +1 -1
  41. package/dist/{describe-PdoqESvg.d.ts → describe-DMYiCjJV.d.ts} +1 -1
  42. package/dist/{diff-B8Tunc3o.js → diff-2VaeChzX.js} +3 -3
  43. package/dist/{diff-CzqLxZ77.js → diff-DBIhz_f2.js} +2 -2
  44. package/dist/{doctor-rOr-4ZfS.js → doctor-BwCAMLx_.js} +2 -2
  45. package/dist/{doctor-collect-ByfYlNv1.js → doctor-collect-CHk6XWOA.js} +10 -9
  46. package/dist/{doctor-WpvG6p4k.js → doctor-igIiM_Hl.js} +10 -10
  47. package/dist/drizzle/index.d.ts +2 -2
  48. package/dist/elysia/index.d.ts +3 -3
  49. package/dist/elysia/index.js +1 -1
  50. package/dist/{errors-DAqevpNk.d.ts → errors-DPdqI50v.d.ts} +2 -2
  51. package/dist/eve/index.d.ts +3 -3
  52. package/dist/eve/index.js +1 -1
  53. package/dist/express/index.d.ts +3 -3
  54. package/dist/express/index.js +1 -1
  55. package/dist/fastify/index.d.ts +3 -3
  56. package/dist/fastify/index.js +1 -1
  57. package/dist/{from-snapshot-C3sHpZNS.js → from-snapshot-CTLijvdm.js} +1 -0
  58. package/dist/hono/index.d.ts +3 -3
  59. package/dist/hono/index.js +1 -1
  60. package/dist/{index-CtE07CBF.d.ts → index-0nNqHspG.d.ts} +2 -2
  61. package/dist/{index-D3vbkoSI.d.ts → index-BNc7Wer_.d.ts} +1 -1
  62. package/dist/{index-D6_cSa1z.d.ts → index-C7Tw7MaW.d.ts} +2 -2
  63. package/dist/{index-A0YNL8jZ.d.ts → index-C8z4RjQV.d.ts} +1 -1
  64. package/dist/index.d.ts +10 -10
  65. package/dist/index.js +3 -3
  66. package/dist/{instance-options-BK_rNOSC.d.ts → instance-options-jARdwfPN.d.ts} +1 -1
  67. package/dist/jwt/index.d.ts +4 -4
  68. package/dist/{kernel-GSQnMz3O.js → kernel-_RRHmnMY.js} +1 -1
  69. package/dist/kysely/index.d.ts +2 -2
  70. package/dist/mcp/index.d.ts +6 -6
  71. package/dist/mcp/index.js +2 -2
  72. package/dist/nest/index.d.ts +3 -3
  73. package/dist/nest/index.js +1 -1
  74. package/dist/next/index.d.ts +5 -5
  75. package/dist/next/index.js +1 -1
  76. package/dist/next/plugin.d.ts +1 -1
  77. package/dist/next/plugin.js +1 -1
  78. package/dist/node/index.d.ts +3 -3
  79. package/dist/node/index.js +1 -1
  80. package/dist/openai/index.d.ts +3 -3
  81. package/dist/openai/index.js +1 -1
  82. package/dist/openapi/index.d.ts +2 -2
  83. package/dist/{openapi-Bbg4wGVL.js → openapi-l0xYHkcv.js} +1 -1
  84. package/dist/orpc/index.d.ts +4 -4
  85. package/dist/orpc/index.js +2 -2
  86. package/dist/otel/index.d.ts +2 -2
  87. package/dist/{parse-local-manifest-BkGQNzAh.d.ts → parse-local-manifest-JLnaBH0S.d.ts} +1 -1
  88. package/dist/pdp/index.d.ts +2 -2
  89. package/dist/pdp/index.js +1 -1
  90. package/dist/{permdock-CzqXjCpU.js → permdock-CbgvLnuo.js} +35 -27
  91. package/dist/{permissions-CpZrivYv.js → permissions-RJrovw98.js} +1 -1
  92. package/dist/{policy-D8UFyERw.d.ts → policy-D2W7uv19.d.ts} +1 -1
  93. package/dist/{policy-CFZAr_Al.d.ts → policy-IB6yxpC3.d.ts} +21 -5
  94. package/dist/{powersync-C7kLglqX.js → powersync-BylawD_U.js} +7 -7
  95. package/dist/{powersync-yW1UUFzp.js → powersync-DliZK_-y.js} +2 -2
  96. package/dist/powersync-e_AZrKbg.js +2 -0
  97. package/dist/prisma/index.d.ts +1 -1
  98. package/dist/{problem-details-CkL50EEf.d.ts → problem-details-DX075l9V.d.ts} +1 -1
  99. package/dist/{protected-CNsMzrVd.d.ts → protected-BdnIEFkY.d.ts} +3 -3
  100. package/dist/{protected-Cs6kTaHo.js → protected-utU-SLuy.js} +1 -1
  101. package/dist/{protected-bZs6rbT1.d.ts → protected-xAr24FEC.d.ts} +3 -3
  102. package/dist/{provider-DLzpb2Xz.js → provider-CSQd7m92.js} +2 -2
  103. package/dist/{provider-Cjr62YMV.d.ts → provider-DZY281jO.d.ts} +1 -1
  104. package/dist/{provider-store-DNyC1y48.js → provider-store-Cfbvo4DE.js} +2 -2
  105. package/dist/react/index.d.ts +6 -6
  106. package/dist/react/index.js +2 -2
  107. package/dist/react/provider-client.d.ts +1 -1
  108. package/dist/react/provider-client.js +1 -1
  109. package/dist/react-native/index.d.ts +8 -8
  110. package/dist/react-native/index.js +3 -3
  111. package/dist/{replay-sqBGMnNs.d.ts → replay-CYyiLiwO.d.ts} +1 -1
  112. package/dist/{rls-CEvs64Kj.js → rls-B4ur8nKQ.js} +2 -2
  113. package/dist/{rls-BMNydpHk.js → rls-DQtdgTHB.js} +12 -12
  114. package/dist/{rls-fields-BMasREhR.js → rls-fields-74oZPXWL.js} +84 -4
  115. package/dist/{rls-graph-pc9fuXYm.js → rls-graph-CHwx0V8q.js} +2 -2
  116. package/dist/{rls-import-D8F7j35Q.js → rls-import-BTFVk3jH.js} +2 -2
  117. package/dist/{rls-migrate-7wikfrVI.js → rls-migrate-CN4TlJTO.js} +2 -2
  118. package/dist/{rls-ownership-B5Lkq62W.js → rls-ownership-RuFqaqGz.js} +3 -3
  119. package/dist/{rls-shared-aOQ4hGTO.js → rls-shared-Cewd_-zI.js} +4 -2
  120. package/dist/{rls-verify-D8B7dOTh.js → rls-verify-CVQTHTh5.js} +8 -7
  121. package/dist/row-conditions-h2HythXQ.js +27 -0
  122. package/dist/{rpc-DOK54_CS.js → rpc-DL9Sqvb1.js} +1 -1
  123. package/dist/{run-YXCJDNYk.js → run-DKDbM4Du.js} +1 -1
  124. package/dist/{saas-Bj_FFkjN.js → saas-DhpJjnBA.js} +2 -2
  125. package/dist/scim/index.d.ts +1 -1
  126. package/dist/server/index.d.ts +6 -6
  127. package/dist/server/index.js +1 -1
  128. package/dist/{sink-Gs6TTVa-.d.ts → sink-B1fZzIMf.d.ts} +1 -1
  129. package/dist/{skills-JaymNCdK.js → skills-Bx-U0irG.js} +1 -1
  130. package/dist/{snapshot-cache-DwQH8ufx.d.ts → snapshot-cache-B-LxUahj.d.ts} +1 -1
  131. package/dist/solid/index.d.ts +4 -4
  132. package/dist/solid/index.js +2 -2
  133. package/dist/{sources-B0UvrJ21.js → sources-4p0-4xQm.js} +12 -1
  134. package/dist/{sources-BcJgw0lt.d.ts → sources-BdOYLw9j.d.ts} +2 -2
  135. package/dist/{src-CSbUiozF.js → src-BDwEZWrZ.js} +1 -1
  136. package/dist/ssf/index.d.ts +3 -3
  137. package/dist/{store-D_pjn91-.d.ts → store-jOBYpiXC.d.ts} +2 -2
  138. package/dist/{store-options-yO0V6gRn.js → store-options-ByhZq1jV.js} +1 -1
  139. package/dist/{stores-4_sqiOA1.js → stores-BT2pSCub.js} +1 -1
  140. package/dist/{stores-DVR5NHLE.d.ts → stores-C0IMQrGI.d.ts} +2 -2
  141. package/dist/{stream-DlvG2hs-.d.ts → stream-D1RXubw2.d.ts} +1 -1
  142. package/dist/supabase/index.d.ts +15 -4
  143. package/dist/supabase/index.js +2 -2
  144. package/dist/supabase/middleware.d.ts +4 -4
  145. package/dist/supabase/middleware.js +2 -2
  146. package/dist/{supabase-CwafwxxF.js → supabase-Boqb9a_Y.js} +2 -2
  147. package/dist/{supabase-DTBaC20O.js → supabase-C0qESOa-.js} +7 -5
  148. package/dist/{supabase-config-Bs44dare.js → supabase-config-BpPXt3x1.js} +1 -1
  149. package/dist/supabase-hook-6sYLXg_u.js +2 -0
  150. package/dist/{supabase-hook-BuxLQLpU.js → supabase-hook-CSLQ4zJ3.js} +55 -9
  151. package/dist/{supautils-DYZnzRWV.js → supautils-Cn4R4cJ4.js} +1 -1
  152. package/dist/svelte/index.d.ts +5 -5
  153. package/dist/svelte/index.js +2 -2
  154. package/dist/svelte/runtime.d.ts +2 -2
  155. package/dist/svelte/runtime.js +1 -1
  156. package/dist/svelte/source.d.ts +5 -5
  157. package/dist/svelte/source.js +1 -1
  158. package/dist/terminal/index.d.ts +4 -4
  159. package/dist/terminal/index.js +1 -1
  160. package/dist/testing/index.d.ts +5 -5
  161. package/dist/testing/index.js +5 -5
  162. package/dist/testing/saas/index.d.ts +2 -2
  163. package/dist/testing/saas/index.js +2 -2
  164. package/dist/testing/saas/permissions.js +1 -1
  165. package/dist/trpc/index.d.ts +4 -4
  166. package/dist/trpc/index.js +2 -2
  167. package/dist/{types-C3s9xVJG.d.ts → types-BnIEz1sU.d.ts} +1 -1
  168. package/dist/{types-yF5LmQVD.d.ts → types-C97IskBw.d.ts} +1 -1
  169. package/dist/{types-kxznc7cn.d.ts → types-CKNSyIf_.d.ts} +1 -1
  170. package/dist/{types-9AWO9EGt.d.ts → types-Cq_H8N_X.d.ts} +2 -2
  171. package/dist/{types-BPxgszlT.d.ts → types-DbjRN55U.d.ts} +15 -2
  172. package/dist/{types-BVyImy5I.d.ts → types-DxiCGmmd.d.ts} +1 -1
  173. package/dist/{types-vNSDF7Dq.d.ts → types-QCuYJh4q.d.ts} +1 -1
  174. package/dist/{types-vKyAMtcX.d.ts → types-aqOHTHcp.d.ts} +1 -1
  175. package/dist/unplugin/index.d.ts +1 -1
  176. package/dist/unplugin/index.js +1 -1
  177. package/dist/usage-DorAJiU_.js +2 -0
  178. package/dist/{usage-D07N9QJ3.js → usage-GTixvDDU.js} +2 -2
  179. package/dist/{usage-DG1oeCca.js → usage-ItS7nLcl.js} +2 -2
  180. package/dist/{validation-error-CtF23SrC.d.ts → validation-error-Ba264OaJ.d.ts} +1 -1
  181. package/dist/vue/index.d.ts +4 -4
  182. package/dist/vue/index.js +2 -2
  183. package/dist/watch-BwxLTYMZ.js +2 -0
  184. package/dist/{watch-UihESpsJ.js → watch-DVBJ9cBq.js} +1 -1
  185. package/dist/webmcp/index.d.ts +1 -1
  186. package/package.json +3 -3
  187. package/dist/catalog-BjZSovXQ.js +0 -2
  188. package/dist/collect-rG2IQ3t0.js +0 -2
  189. package/dist/powersync-A8x_Yyvh.js +0 -2
  190. package/dist/supabase-hook-D5qVd_D8.js +0 -2
  191. package/dist/usage-D82l1CwK.js +0 -2
  192. package/dist/watch-Etoa_Mvr.js +0 -2
@@ -1,8 +1,8 @@
1
- import { C as Policy, D as PolicyVocabulary, Nr as Principal, Pr as Subject, ln as PermDock } from "../policy-CFZAr_Al.js";
1
+ import { C as Policy, D as PolicyVocabulary, Nr as Principal, Pr as Subject, ln as PermDock } from "../policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "../permissions-DttnqqxC.js";
3
- import { t as InstanceOptions } from "../instance-options-BK_rNOSC.js";
4
- import { n as OpenApiHooks } from "../create-BWyx3jua.js";
5
- import { n as ServerAdapterServices } from "../bind-CVy3Espv.js";
3
+ import { t as InstanceOptions } from "../instance-options-jARdwfPN.js";
4
+ import { n as OpenApiHooks } from "../create-B1d519XK.js";
5
+ import { n as ServerAdapterServices } from "../bind-C_ob3LKa.js";
6
6
  import { Middleware } from "@supabase/middleware";
7
7
  //#region src/supabase/middleware.d.ts
8
8
  /**
@@ -2,8 +2,8 @@ import { t as compact } from "../compact-y6vfu2_f.js";
2
2
  import { r as credentialSubject } from "../credential-8P81ff4u.js";
3
3
  import { i as methodNotAllowed } from "../problem-B43ztKIm.js";
4
4
  import { t as instanceOptions } from "../instance-options-Dhhcnm3y.js";
5
- import { n as createServerKernel } from "../create-CPhDL6qx.js";
6
- import { n as attached } from "../bind-VnYn2HKq.js";
5
+ import { n as createServerKernel } from "../create-CMwIl-w2.js";
6
+ import { n as attached } from "../bind-CuzGytRf.js";
7
7
  import { defineMiddleware } from "@supabase/middleware";
8
8
  //#region src/supabase/middleware.ts
9
9
  const SECRET_KEY_NAME = /^[A-Za-z0-9_-]+$/u;
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DWOrSQic.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/supabase.ts
4
4
  function supabase(ctx) {
@@ -61,7 +61,7 @@ function supabase(ctx) {
61
61
  const budget = stringArg(parsed.budget);
62
62
  const schema = stringArg(parsed.schema);
63
63
  const grantsOut = stringArg(parsed["grants-out"]);
64
- const { runSupabase } = await import("./supabase-hook-D5qVd_D8.js");
64
+ const { runSupabase } = await import("./supabase-hook-6sYLXg_u.js");
65
65
  ctx.report(await runSupabase({
66
66
  cwd: ctx.cwd,
67
67
  config: ctx.config,
@@ -6,7 +6,7 @@ import { a as decodeApprovalCursor, i as approvalPageSize, o as encodeApprovalCu
6
6
  import { t as loadJose } from "./load-jose-BL6LH4bL.js";
7
7
  import "./budget-NbEtbJC_.js";
8
8
  import { a as quoteSqlTable, i as quoteSqlLiteral, r as quoteSqlIdent } from "./sql-xdg5f4Fi.js";
9
- import { l as keptKeys, s as roleColumn } from "./sources-B0UvrJ21.js";
9
+ import { c as hookApiNames, d as keptKeys, l as roleColumn } from "./sources-4p0-4xQm.js";
10
10
  import { i as readMemberships } from "./manifest-iaoBXHKc.js";
11
11
  //#region src/supabase/capability.ts
12
12
  const DEFAULT_TTL = 300;
@@ -319,10 +319,12 @@ function readSubjectRecord(value) {
319
319
  * `postgrestSources` call, so create it per request or per job.
320
320
  */
321
321
  function postgrestSources(client, options = {}) {
322
- const schema = options.schema ?? "permdock";
323
- const fn = options.fn ?? "subject_for";
324
- const membersFn = options.membersFn ?? "members_of";
325
- const versionFn = options.versionFn ?? "authz_version_for";
322
+ const api = options.api;
323
+ const names = api === void 0 ? void 0 : hookApiNames(api.prefix);
324
+ const schema = options.schema ?? (api === void 0 ? "permdock" : api.schema ?? "public");
325
+ const fn = options.fn ?? names?.subjectFor ?? "subject_for";
326
+ const membersFn = options.membersFn ?? names?.membersOf ?? "members_of";
327
+ const versionFn = options.versionFn ?? names?.authzVersionFor ?? "authz_version_for";
326
328
  const declared = options.policy === void 0 ? void 0 : options.policy.index.declaredRoles;
327
329
  const onlyDeclared = (held) => declared !== void 0 && held?.every((name) => declared.has(name)) === true;
328
330
  const loaded = /* @__PURE__ */ new Map();
@@ -1,6 +1,6 @@
1
1
  import { i as describeError } from "./errors-CWfoNg9N.js";
2
2
  import { a as sqlFiles, i as rel } from "./files-DWUN9PzI.js";
3
- import { t as FIELD_VIEWS } from "./rls-fields-BMasREhR.js";
3
+ import { t as FIELD_VIEWS } from "./rls-fields-74oZPXWL.js";
4
4
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
5
5
  import { dirname, join, posix, resolve } from "node:path";
6
6
  import { createRequire } from "node:module";
@@ -0,0 +1,2 @@
1
+ import { i as runSupabase } from "./supabase-hook-CSLQ4zJ3.js";
2
+ export { runSupabase };
@@ -5,15 +5,15 @@ import { a as sqlFiles } from "./files-DWUN9PzI.js";
5
5
  import { a as loadModule, n as asPolicy, o as pickNamed } from "./load-DhWEB9P1.js";
6
6
  import { t as shortDiff } from "./text-diff-BdkkYSbi.js";
7
7
  import { r as scopeColumn } from "./compile-Ba4blROR.js";
8
- import { t as authorizeSql } from "./supabase-DTBaC20O.js";
8
+ import { t as authorizeSql } from "./supabase-C0qESOa-.js";
9
9
  import "./budget-NbEtbJC_.js";
10
- import { c as roleManifest, l as keptKeys, t as AUTHZ_VERSION_TABLE } from "./sources-B0UvrJ21.js";
10
+ import { c as hookApiNames, d as keptKeys, t as AUTHZ_VERSION_TABLE, u as roleManifest } from "./sources-4p0-4xQm.js";
11
11
  import { i as readMemberships } from "./manifest-iaoBXHKc.js";
12
12
  import { a as hookMarkerFields, n as HOOK_MARKER, t as GRANTS_MARKER } from "./markers-B0hYLvMD.js";
13
- import { f as splitUndiffed, h as tableKey, m as decidingColumns, n as supabaseConfig, r as MIGRATION_DIRS } from "./supabase-config-Bs44dare.js";
14
- import { E as hasMemberFor, F as memberForSources, G as quoteLiteral, H as permittedIdsHelper, I as memberForTable, K as quoteTable, L as memberIdsHelper, P as memberForHelper, R as memberRoleOf, U as qualifiedTable, V as permittedForHelper, W as quoteIdent, Z as scopeTypeOf, f as USER_ID_HELPER, h as activeRowSql, it as tenantTypeOf, n as HELPERS, v as checkSuspension } from "./rls-shared-aOQ4hGTO.js";
15
- import { G as API_KEY_ALLOWS, K as apiKeyFields, U as roleNames, _ as permissionKeysForHelper, w as connectPg, z as globalRoleSource } from "./rls-fields-BMasREhR.js";
16
- import { a as ownershipRules, i as guardedTables, n as OWNERSHIP, t as ASSIGNMENTS } from "./rls-ownership-B5Lkq62W.js";
13
+ import { f as splitUndiffed, h as tableKey, m as decidingColumns, n as supabaseConfig, r as MIGRATION_DIRS } from "./supabase-config-BpPXt3x1.js";
14
+ import { D as hasMemberFor, F as memberForHelper, G as quoteIdent, H as permittedForHelper, I as memberForSources, K as quoteLiteral, L as memberForTable, Q as scopeTypeOf, R as memberIdsHelper, U as permittedIdsHelper, W as qualifiedTable, at as tenantTypeOf, g as activeRowSql, p as USER_ID_HELPER, q as quoteTable, r as HELPERS, y as checkSuspension, z as memberRoleOf } from "./rls-shared-Cewd_-zI.js";
15
+ import { G as API_KEY_ALLOWS, K as apiKeyFields, U as roleNames, _ as permissionKeysForHelper, w as connectPg, z as globalRoleSource } from "./rls-fields-74oZPXWL.js";
16
+ import { a as ownershipRules, i as guardedTables, n as OWNERSHIP, t as ASSIGNMENTS } from "./rls-ownership-RuFqaqGz.js";
17
17
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
18
18
  import { dirname, join, resolve } from "node:path";
19
19
  /** `--check`: one entry per file that is missing or differs, naming its part; a differing file carries a short diff. */
@@ -92,10 +92,25 @@ function isSeedsDirectory(cwd, out) {
92
92
  function migrationVersion(now) {
93
93
  return now.toISOString().replaceAll(/[^0-9]/gu, "").slice(0, 14);
94
94
  }
95
+ const VERSION_PREFIX = /^\d{14}(?=_)/u;
96
+ /**
97
+ * The version of a new migration that sorts after every migration in
98
+ * `names`: one second past the newest, so the same directory always gives the
99
+ * same name. Only a directory with no versioned migration falls back to `now`.
100
+ */
101
+ function nextMigrationVersion(names, now) {
102
+ const times = names.flatMap((name) => {
103
+ const stamp = VERSION_PREFIX.exec(name)?.[0];
104
+ return stamp === void 0 ? [] : [Date.UTC(Number(stamp.slice(0, 4)), Number(stamp.slice(4, 6)) - 1, Number(stamp.slice(6, 8)), Number(stamp.slice(8, 10)), Number(stamp.slice(10, 12)), Number(stamp.slice(12, 14)))];
105
+ });
106
+ return times.length === 0 ? migrationVersion(now) : migrationVersion(new Date(Math.max(...times) + 1e3));
107
+ }
95
108
  /**
96
109
  * The seeds part in a migrations directory: the newest migration there that
97
110
  * starts with \`marker\` when its text is \`text\` already, otherwise a new
98
- * \`<version>_permdock_seeds.sql\`. \`current\` is false when a new one is due.
111
+ * \`<version>_permdock_seeds.sql\` one second after the newest migration
112
+ * (\`nextMigrationVersion\`), so a regeneration of the same directory names it
113
+ * the same. \`current\` is false when a new one is due.
99
114
  */
100
115
  function seedsMigration(cwd, dir, marker, text, now) {
101
116
  const base = dir.endsWith("/") ? dir.slice(0, -1) : dir;
@@ -106,7 +121,7 @@ function seedsMigration(cwd, dir, marker, text, now) {
106
121
  current: true
107
122
  };
108
123
  return {
109
- rel: `${base}/${migrationVersion(now)}_permdock_seeds.sql`,
124
+ rel: `${base}/${nextMigrationVersion(existsSync(path) ? readdirSync(path) : [], now)}_permdock_seeds.sql`,
110
125
  current: false
111
126
  };
112
127
  }
@@ -850,6 +865,36 @@ end;
850
865
  $$;
851
866
  revoke execute on function ${fn}(uuid) from public, anon, authenticated;`;
852
867
  }
868
+ /**
869
+ * The PostgREST wrappers `supabase.hook.api` asks for: one `security definer`
870
+ * function per reader, in the API schema, executable by `service_role` only.
871
+ */
872
+ function apiWrappersSql(parts) {
873
+ const api = parts.hook.api;
874
+ if (api === void 0) return "";
875
+ const target = api.schema ?? "public";
876
+ const names = hookApiNames(api.prefix);
877
+ const source = quoteIdent(parts.schema);
878
+ const wrapper = (name, inner, params, args, types, returns) => {
879
+ const fn = `${quoteIdent(target)}.${quoteIdent(name)}`;
880
+ if (target === parts.schema && name === inner) throw new Error(`PermDock CLI: supabase.hook.api would replace ${source}.${inner}: set api.schema or api.prefix`);
881
+ return `create or replace function ${fn}(${params})
882
+ returns ${returns}
883
+ language sql
884
+ stable
885
+ security definer
886
+ set search_path = ''
887
+ as $$ select ${source}.${inner}(${args}) $$;
888
+ revoke execute on function ${fn}(${types}) from public, anon, authenticated;
889
+ grant execute on function ${fn}(${types}) to service_role;`;
890
+ };
891
+ return `-- supabase.hook.api: wrappers in ${quoteIdent(target)} for a backend that reaches the hook schema through the Data API; only service_role may execute them
892
+ ${wrapper(names.subjectFor, SUBJECT_FOR, "p_user uuid", "p_user", "uuid", "jsonb")}
893
+
894
+ ${wrapper(names.membersOf, MEMBERS_OF, "p_scope text, p_id text", "p_scope, p_id", "text, text", "jsonb")}
895
+
896
+ ${wrapper(names.authzVersionFor, AUTHZ_VERSION_FOR, "p_user uuid", "p_user", "uuid", "bigint")}`;
897
+ }
853
898
  const AUTHZ_VERSION_FOR = "authz_version_for";
854
899
  /**
855
900
  * `authz_version_for(p_user uuid) returns bigint`: the authorization version
@@ -1618,7 +1663,7 @@ Reads supabase.hook from permdock.config.ts: the fromTable / fromJunction source
1618
1663
  passes as memberships. hook generate emits custom_access_token_hook(jsonb), the grants it
1619
1664
  needs (the ones db diff drops in --grants-out, for declarative schemas), the permdock_authz_version table
1620
1665
  and its triggers. Never grants anything to
1621
- service_role. inspect prints the manifest: helper schema, names and signatures, tenant claim,
1666
+ service_role unless supabase.hook.api is set, which grants its wrappers to it. inspect prints the manifest: helper schema, names and signatures, tenant claim,
1622
1667
  budget, the claims the hook writes, the membership sources and the columns that decide them.
1623
1668
  --out writes it as JSON, to permdock.manifest.json without a path; --check exits 1 when that
1624
1669
  file differs.
@@ -1656,6 +1701,7 @@ ${toml}${grantsOut === void 0 ? "" : `\n-- what supabase db diff drops from this
1656
1701
  subjectForSql(parts, config),
1657
1702
  authzVersionForSql(parts),
1658
1703
  membersOfSql(parts),
1704
+ apiWrappersSql(parts),
1659
1705
  grantsSql(parts),
1660
1706
  managedSql(parts)
1661
1707
  ].filter((chunk) => chunk !== "").join("\n\n");
@@ -1,4 +1,4 @@
1
- import { d as group, p as sqlStatements } from "./supabase-config-Bs44dare.js";
1
+ import { d as group, p as sqlStatements } from "./supabase-config-BpPXt3x1.js";
2
2
  //#region src/cli/supautils.ts
3
3
  /** `supautils.reserved_roles` of supabase/postgres 17.11.0.002 (supautils 3.4.4). */
4
4
  const RESERVED_ROLES = /* @__PURE__ */ new Set([
@@ -1,10 +1,10 @@
1
- import { n as requiredPlans } from "../problem-details-CkL50EEf.js";
2
- import { i as describe } from "../describe-PdoqESvg.js";
1
+ import { n as requiredPlans } from "../problem-details-DX075l9V.js";
2
+ import { i as describe } from "../describe-DMYiCjJV.js";
3
3
  import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
4
4
  import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
5
- import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-kxznc7cn.js";
6
- import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-bZs6rbT1.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-DVR5NHLE.js";
5
+ import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-CKNSyIf_.js";
6
+ import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-xAr24FEC.js";
7
+ import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-C0IMQrGI.js";
8
8
  import { Component } from "svelte";
9
9
  //#region src/svelte/index.d.ts
10
10
  export declare const Protected: Component<ProtectedProps>;
@@ -2,9 +2,9 @@ import { r as requiredPlans } from "../problem-details-_AMOYz-w.js";
2
2
  import { t as describe } from "../describe-B_gVZEVi.js";
3
3
  import { t as approvalHeaders } from "../headers-BZSDieNT.js";
4
4
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BM8a_P6E.js";
5
- import { t as getStore } from "../context-Ttp0ekMT.js";
5
+ import { t as getStore } from "../context-Bcy85rGi.js";
6
6
  import { n as viewFor, t as scopedFor } from "../runtime-CB8gQFvS.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-4_sqiOA1.js";
7
+ import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-BT2pSCub.js";
8
8
  import "svelte/internal/disclose-version";
9
9
  import * as $ from "svelte/internal/client";
10
10
  import { onDestroy } from "svelte";
@@ -1,6 +1,6 @@
1
1
  import { n as boundaryDigest, r as boundaryFallback, t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
2
- import { t as ClientStore } from "../store-D_pjn91-.js";
3
- import { i as PermissionBoundaryProps, n as scopedFor, r as viewFor, t as ProtectedProps } from "../protected-bZs6rbT1.js";
2
+ import { t as ClientStore } from "../store-jOBYpiXC.js";
3
+ import { i as PermissionBoundaryProps, n as scopedFor, r as viewFor, t as ProtectedProps } from "../protected-xAr24FEC.js";
4
4
  //#region src/svelte/context.d.ts
5
5
  export declare function getStore(): ClientStore;
6
6
  //#endregion
@@ -1,4 +1,4 @@
1
1
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BM8a_P6E.js";
2
- import { t as getStore } from "../context-Ttp0ekMT.js";
2
+ import { t as getStore } from "../context-Bcy85rGi.js";
3
3
  import { n as viewFor, t as scopedFor } from "../runtime-CB8gQFvS.js";
4
4
  export { boundaryDigest, boundaryFallback, getStore, scopedFor, viewFor };
@@ -1,10 +1,10 @@
1
- import { n as requiredPlans } from "../problem-details-CkL50EEf.js";
2
- import { i as describe } from "../describe-PdoqESvg.js";
1
+ import { n as requiredPlans } from "../problem-details-DX075l9V.js";
2
+ import { i as describe } from "../describe-DMYiCjJV.js";
3
3
  import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
4
4
  import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
5
- import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-kxznc7cn.js";
6
- import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-bZs6rbT1.js";
7
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-DVR5NHLE.js";
5
+ import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-CKNSyIf_.js";
6
+ import { i as PermissionBoundaryProps, t as ProtectedProps } from "../protected-xAr24FEC.js";
7
+ import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, p as PermDockSvelteOptions, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-C0IMQrGI.js";
8
8
  import { Component } from "svelte";
9
9
  //#region src/svelte/source.d.ts
10
10
  export declare const Protected: Component<ProtectedProps>;
@@ -1,7 +1,7 @@
1
1
  import { r as requiredPlans } from "../problem-details-_AMOYz-w.js";
2
2
  import { t as describe } from "../describe-B_gVZEVi.js";
3
3
  import { t as approvalHeaders } from "../headers-BZSDieNT.js";
4
- import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-4_sqiOA1.js";
4
+ import { a as getPermDock, c as permissions, d as subject, f as tenant, i as filtered, l as roles, n as assignable, o as memberships, r as assignablePermissions, s as permission, t as approval, u as setPermDock } from "../stores-BT2pSCub.js";
5
5
  import PermissionBoundaryComponent from "./PermissionBoundary.svelte";
6
6
  import ProtectedComponent from "./Protected.svelte";
7
7
  //#region src/svelte/source.ts
@@ -1,8 +1,8 @@
1
- import { C as Policy, D as PolicyVocabulary, Nr as Principal, Pr as Subject, Yn as Decision, ln as PermDock } from "../policy-CFZAr_Al.js";
1
+ import { C as Policy, D as PolicyVocabulary, Nr as Principal, Pr as Subject, Yn as Decision, ln as PermDock } from "../policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "../permissions-DttnqqxC.js";
3
- import { f as ApprovalStore } from "../types-vKyAMtcX.js";
4
- import { a as ProblemDetails, t as ApprovalHint } from "../errors-DAqevpNk.js";
5
- import { t as InstanceOptions } from "../instance-options-BK_rNOSC.js";
3
+ import { f as ApprovalStore } from "../types-aqOHTHcp.js";
4
+ import { a as ProblemDetails, t as ApprovalHint } from "../errors-DPdqI50v.js";
5
+ import { t as InstanceOptions } from "../instance-options-jARdwfPN.js";
6
6
  //#region src/terminal/types.d.ts
7
7
  type TokenSourceName = "device" | "keychain" | "env" | "ci-oidc";
8
8
  type TokenSource = TokenSourceName | {
@@ -1,6 +1,6 @@
1
1
  import { t as compact } from "../compact-y6vfu2_f.js";
2
2
  import { a as deniedMessage, i as approvalMessage, n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "../errors-Cz5zn0mW.js";
3
- import { t as createPermDock$1 } from "../permdock-CzqXjCpU.js";
3
+ import { t as createPermDock$1 } from "../permdock-CbgvLnuo.js";
4
4
  import { n as resourceRef } from "../resource-ref-CaS9yVPi.js";
5
5
  import { i as isSubject } from "../subject-C6dLxqHU.js";
6
6
  import { l as storedApprovalToken, s as resumeDecision } from "../helpers-H_KARDVC.js";
@@ -1,15 +1,15 @@
1
- import { At as SnapshotSource, C as Policy, Ct as SettingsSource, Dr as CustomRole, Ft as TokenVerifier, Mr as Membership, Nr as Principal, Pr as Subject, Pt as TokenSigner, Rt as WhereCompiler, Tt as Snapshot, Wn as ApprovalPolicySource, at as DecisionSink, bn as PolicySource, bt as RelationSource, dt as LimitStore, gt as MembershipSource, jt as SubjectResolver, ln as PermDock, mn as WhereResult, nt as CredentialVerifier, st as EntitlementSource, un as PermDockOptions, xt as RoleSource } from "../policy-CFZAr_Al.js";
1
+ import { At as SnapshotSource, C as Policy, Ct as SettingsSource, Dr as CustomRole, Ft as TokenVerifier, Mr as Membership, Nr as Principal, Pr as Subject, Pt as TokenSigner, Rt as WhereCompiler, Tt as Snapshot, Wn as ApprovalPolicySource, at as DecisionSink, bn as PolicySource, bt as RelationSource, dt as LimitStore, gt as MembershipSource, jt as SubjectResolver, ln as PermDock, mn as WhereResult, nt as CredentialVerifier, st as EntitlementSource, un as PermDockOptions, xt as RoleSource } from "../policy-IB6yxpC3.js";
2
2
  import { f as Permission, g as ResourceInit, u as InferPermissionTree } from "../permissions-DttnqqxC.js";
3
3
  import { r as Role } from "../vocabulary-DA8a8zif.js";
4
- import { f as ApprovalStore } from "../types-vKyAMtcX.js";
4
+ import { f as ApprovalStore } from "../types-aqOHTHcp.js";
5
5
  import { t as ToolMap } from "../types-Bvc4oWT6.js";
6
6
  import { n as SupabaseHookManifest } from "../manifest-uDS9y5de.js";
7
7
  import { t as supabaseMembershipsBudget } from "../budget-JqcRqyhK.js";
8
8
  import { n as RevocationFeed } from "../revocations-Cy06JNx2.js";
9
- import { g as ReplayStore } from "../types-9AWO9EGt.js";
10
- import { v as DirectoryStore } from "../index-A0YNL8jZ.js";
9
+ import { g as ReplayStore } from "../types-Cq_H8N_X.js";
10
+ import { v as DirectoryStore } from "../index-C8z4RjQV.js";
11
11
  import { a as SaasProject } from "../permissions-CDgvKG5L.js";
12
- import { n as saasPolicy } from "../policy-D8UFyERw.js";
12
+ import { n as saasPolicy } from "../policy-D2W7uv19.js";
13
13
  import { expectTypeOf } from "vitest";
14
14
  //#region src/testing/describe-policy.d.ts
15
15
  type MatrixOutcome = "granted" | "denied" | "approval-required";
@@ -1,14 +1,14 @@
1
1
  import { _ as listPermissions, b as resource, n as definePermissions } from "../permissions-DVoF6dMt.js";
2
2
  import { r as principal } from "../refs-KYb4ntaz.js";
3
3
  import { _ as memoryLimitStore, a as definePolicy, m as role, t as allow } from "../policy-xyWg7QdR.js";
4
- import { _ as memoryRoleSource, u as snapshotFor } from "../src-CSbUiozF.js";
4
+ import { _ as memoryRoleSource, u as snapshotFor } from "../src-BDwEZWrZ.js";
5
5
  import { t as memoryRevocationFeed } from "../revocations-Bhr0aMIC.js";
6
6
  import { a as normalizeMemberships, d as scopeList } from "../scopes-CVdPrWN-.js";
7
7
  import { n as parseSnapshot, p as evaluateCondition } from "../snapshot-Enxd0n-s.js";
8
8
  import { i as parsePolicyDocument, r as mergeHostedGrants } from "../hosted-DJQw46hn.js";
9
- import { E as approvalPoliciesFor, b as validateCustomRole, t as createPermDock, v as membershipsClaim } from "../permdock-CzqXjCpU.js";
9
+ import { E as approvalPoliciesFor, b as validateCustomRole, t as createPermDock, v as membershipsClaim } from "../permdock-CbgvLnuo.js";
10
10
  import { t as byCodePoint } from "../compare-pfyVnBjE.js";
11
- import { n as fromSnapshot } from "../from-snapshot-C3sHpZNS.js";
11
+ import { n as fromSnapshot } from "../from-snapshot-CTLijvdm.js";
12
12
  import { o as parseCredential } from "../credential-8P81ff4u.js";
13
13
  import { o as problemFromDecision } from "../problem-B43ztKIm.js";
14
14
  import { l as APPROVAL_HEADER, r as memoryApprovalStore } from "../store-DMAWwAJV.js";
@@ -17,8 +17,8 @@ import { a as parseApiKey } from "../server-DlZ28Oz5.js";
17
17
  import { S as sha256Hex, n as directoryMembershipSource, r as scimHandler } from "../scim-BFGBBAqR.js";
18
18
  import { t as supabaseMembershipsBudget } from "../budget-NbEtbJC_.js";
19
19
  import { a as quoteSqlTable, r as quoteSqlIdent, t as SQL_IDENT } from "../sql-xdg5f4Fi.js";
20
- import { i as saasPermissions } from "../permissions-CpZrivYv.js";
21
- import { C as saasOrg, E as saasSeed, S as saasMemberships, a as saasProject, g as verifySaasSession, h as signSaasToken, k as saasPolicy, t as saasDoc, w as saasPrincipal, x as saasCustomRoles } from "../saas-Bj_FFkjN.js";
20
+ import { i as saasPermissions } from "../permissions-RJrovw98.js";
21
+ import { C as saasOrg, E as saasSeed, S as saasMemberships, a as saasProject, g as verifySaasSession, h as signSaasToken, k as saasPolicy, t as saasDoc, w as saasPrincipal, x as saasCustomRoles } from "../saas-DhpJjnBA.js";
22
22
  import { afterAll, beforeAll, describe, expect, expectTypeOf, it, vi } from "vitest";
23
23
  //#region src/testing/describe-policy.ts
24
24
  function isOutcomeCell(value) {
@@ -1,7 +1,7 @@
1
- import { Cr as Actor, Dr as CustomRole, Mr as Membership, Nr as Principal, Pr as Subject, bt as RelationSource, dt as LimitStore, kr as Delegation, un as PermDockOptions } from "../../policy-CFZAr_Al.js";
1
+ import { Cr as Actor, Dr as CustomRole, Mr as Membership, Nr as Principal, Pr as Subject, bt as RelationSource, dt as LimitStore, kr as Delegation, un as PermDockOptions } from "../../policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "../../permissions-DttnqqxC.js";
3
3
  import { a as SaasProject, c as saasPlans, i as SaasFolderSchema, l as saasRoles, n as SaasDocSchema, o as SaasProjectSchema, r as SaasFolder, s as saasPermissions, t as SaasDoc, u as saasTenantRoleNames } from "../../permissions-CDgvKG5L.js";
4
- import { n as saasPolicy, t as SAAS_API_KEY_LIMIT } from "../../policy-D8UFyERw.js";
4
+ import { n as saasPolicy, t as SAAS_API_KEY_LIMIT } from "../../policy-D2W7uv19.js";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
  //#region src/testing/saas/schema.d.ts
7
7
  type FieldKind = "string" | "boolean" | "nullable-string";
@@ -1,3 +1,3 @@
1
- import { a as saasPlans, c as rowSchema, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-CpZrivYv.js";
2
- import { C as saasOrg, D as saasUsers, E as saasSeed, O as SAAS_API_KEY_LIMIT, S as saasMemberships, T as saasRelations, _ as verifySaasToken, a as saasProject, b as SAAS_EXPIRED_AT, c as saasUser, d as saasIssuer, f as saasJwks, g as verifySaasSession, h as signSaasToken, i as saasLimitStore, k as saasPolicy, l as SAAS_TOKEN_TTL_SECONDS, m as saasPublicJwk, n as saasFolder, o as saasScenarioOptions, p as saasPrivateJwk, r as saasFolderScenarios, s as saasScenarios, t as saasDoc, u as saasAudience, v as saasSchemaSql, w as saasPrincipal, x as saasCustomRoles, y as saasSeedSql } from "../../saas-Bj_FFkjN.js";
1
+ import { a as saasPlans, c as rowSchema, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-RJrovw98.js";
2
+ import { C as saasOrg, D as saasUsers, E as saasSeed, O as SAAS_API_KEY_LIMIT, S as saasMemberships, T as saasRelations, _ as verifySaasToken, a as saasProject, b as SAAS_EXPIRED_AT, c as saasUser, d as saasIssuer, f as saasJwks, g as verifySaasSession, h as signSaasToken, i as saasLimitStore, k as saasPolicy, l as SAAS_TOKEN_TTL_SECONDS, m as saasPublicJwk, n as saasFolder, o as saasScenarioOptions, p as saasPrivateJwk, r as saasFolderScenarios, s as saasScenarios, t as saasDoc, u as saasAudience, v as saasSchemaSql, w as saasPrincipal, x as saasCustomRoles, y as saasSeedSql } from "../../saas-DhpJjnBA.js";
3
3
  export { SAAS_API_KEY_LIMIT, SAAS_EXPIRED_AT, SAAS_TOKEN_TTL_SECONDS, SaasDocSchema, SaasFolderSchema, SaasProjectSchema, rowSchema, saasAudience, saasCustomRoles, saasDoc, saasFolder, saasFolderScenarios, saasIssuer, saasJwks, saasLimitStore, saasMemberships, saasOrg, saasPermissions, saasPlans, saasPolicy, saasPrincipal, saasPrivateJwk, saasProject, saasPublicJwk, saasRelations, saasRoles, saasScenarioOptions, saasScenarios, saasSchemaSql, saasSeed, saasSeedSql, saasTenantRoleNames, saasUser, saasUsers, signSaasToken, verifySaasSession, verifySaasToken };
@@ -1,2 +1,2 @@
1
- import { a as saasPlans, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-CpZrivYv.js";
1
+ import { a as saasPlans, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-RJrovw98.js";
2
2
  export { SaasDocSchema, SaasFolderSchema, SaasProjectSchema, saasPermissions, saasPlans, saasRoles, saasTenantRoleNames };
@@ -1,9 +1,9 @@
1
- import { C as Policy, Nr as Principal } from "../policy-CFZAr_Al.js";
1
+ import { C as Policy, Nr as Principal } from "../policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "../permissions-DttnqqxC.js";
3
3
  import { n as RevocationFeed } from "../revocations-Cy06JNx2.js";
4
- import { A as ConnectionOptions, O as Connection, n as OpenApiHooks } from "../create-BWyx3jua.js";
5
- import { t as ServerAdapterOptions } from "../bind-CVy3Espv.js";
6
- import { t as StreamProtectOptions } from "../stream-DlvG2hs-.js";
4
+ import { A as ConnectionOptions, O as Connection, n as OpenApiHooks } from "../create-B1d519XK.js";
5
+ import { t as ServerAdapterOptions } from "../bind-C_ob3LKa.js";
6
+ import { t as StreamProtectOptions } from "../stream-D1RXubw2.js";
7
7
  import { AnyTRPCMiddlewareFunction } from "@trpc/server";
8
8
  //#region src/trpc/create.d.ts
9
9
  type TrpcMiddlewareOpts<TCtx = object, TInput = unknown> = {
@@ -1,8 +1,8 @@
1
1
  import { a as problemMessage } from "../http-SO7qGttf.js";
2
2
  import { t as problemFromError } from "../map-error-pgUWNNtG.js";
3
- import { n as attached } from "../bind-VnYn2HKq.js";
3
+ import { n as attached } from "../bind-CuzGytRf.js";
4
4
  import { a as reloadAfter, r as isAsyncIterable } from "../stream-DDpvynSB.js";
5
- import { i as rpcCode, n as guardStream, r as problemBody, t as bindRpcKernel } from "../rpc-DOK54_CS.js";
5
+ import { i as rpcCode, n as guardStream, r as problemBody, t as bindRpcKernel } from "../rpc-DL9Sqvb1.js";
6
6
  import { TRPCError, isTrackedEnvelope } from "@trpc/server";
7
7
  //#region src/trpc/create.ts
8
8
  const PROBLEM = Symbol.for("permdock.problem");
@@ -1,4 +1,4 @@
1
- import { Ft as TokenVerifier, Tt as Snapshot, Yn as Decision } from "./policy-CFZAr_Al.js";
1
+ import { Ft as TokenVerifier, Tt as Snapshot, Yn as Decision } from "./policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "./permissions-DttnqqxC.js";
3
3
  import { ReactNode } from "react";
4
4
  //#region src/react/types.d.ts
@@ -1,4 +1,4 @@
1
- import { Nr as Principal, et as AuthEvent } from "./policy-CFZAr_Al.js";
1
+ import { Nr as Principal, et as AuthEvent } from "./policy-IB6yxpC3.js";
2
2
  import { t as ClientNames } from "./clients-C7zLFuWT.js";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  //#region src/supabase/claims.d.ts
@@ -1,4 +1,4 @@
1
- import { Cr as Actor, D as PolicyVocabulary, Nr as Principal, Yn as Decision, kr as Delegation, ln as PermDock } from "./policy-CFZAr_Al.js";
1
+ import { Cr as Actor, D as PolicyVocabulary, Nr as Principal, Yn as Decision, kr as Delegation, ln as PermDock } from "./policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "./permissions-DttnqqxC.js";
3
3
  //#region src/client/types.d.ts
4
4
  type ClientStatus = "ready" | "pending" | "stale" | "server-only";
@@ -1,5 +1,5 @@
1
- import { Cr as Actor, Ft as TokenVerifier, Nr as Principal, Nt as TokenFailureCause, Pr as Subject, ct as JwtClaims, et as AuthEvent, gt as MembershipSource } from "./policy-CFZAr_Al.js";
2
- import { f as ApprovalStore } from "./types-vKyAMtcX.js";
1
+ import { Cr as Actor, Ft as TokenVerifier, Nr as Principal, Nt as TokenFailureCause, Pr as Subject, ct as JwtClaims, et as AuthEvent, gt as MembershipSource } from "./policy-IB6yxpC3.js";
2
+ import { f as ApprovalStore } from "./types-aqOHTHcp.js";
3
3
  import { t as ClientNames } from "./clients-C7zLFuWT.js";
4
4
  import { n as RevocationFeed } from "./revocations-Cy06JNx2.js";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -1,5 +1,5 @@
1
- import { n as RoleThrough } from "./types-yF5LmQVD.js";
2
- import { o as SqlMembershipSource } from "./sources-BcJgw0lt.js";
1
+ import { n as RoleThrough } from "./types-C97IskBw.js";
2
+ import { o as SqlMembershipSource } from "./sources-BdOYLw9j.js";
3
3
  //#region src/cli/types.d.ts
4
4
  type CollectConfig = {
5
5
  readonly srcPath?: readonly string[];
@@ -468,6 +468,19 @@ type SupabaseHookConfig = {
468
468
  readonly budget?: number;
469
469
  /** Keep `permdock_authz_version` and write the `authz_ver` claim. Default `true`. */
470
470
  readonly version?: boolean;
471
+ /**
472
+ * Write PostgREST wrappers for `subject_for`, `members_of` and
473
+ * `authz_version_for` into `schema` (default `public`), named
474
+ * `<prefix>subject_for` and so on (default prefix `permdock_`), for a
475
+ * backend that reaches Postgres through the Data API while the hook schema
476
+ * is not exposed. Each wrapper is `security definer`, revoked from
477
+ * `public`, `anon` and `authenticated`, and granted to `service_role`: the
478
+ * one place the hook grants to it. Pass the same setting to `postgrestSources`.
479
+ */
480
+ readonly api?: {
481
+ readonly schema?: string;
482
+ readonly prefix?: string;
483
+ };
471
484
  /** The `jwt_expiry` the printed `config.toml` block sets. Default 900. */
472
485
  readonly jwtExpiry?: number;
473
486
  /** Suspended users get empty claims. Default `rls.suspension`. */
@@ -1,4 +1,4 @@
1
- import { $n as ExplainedDecision, C as Policy, D as PolicyVocabulary, In as ArazzoPlan, Ln as ArazzoSimulateInput, Mr as Membership, Nr as Principal, Pr as Subject, Yn as Decision, cn as DeriveOptions, fn as SimulateOptions, ln as PermDock, mn as WhereResult, sn as DecideOptions, un as PermDockOptions } from "./policy-CFZAr_Al.js";
1
+ import { $n as ExplainedDecision, C as Policy, D as PolicyVocabulary, In as ArazzoPlan, Ln as ArazzoSimulateInput, Mr as Membership, Nr as Principal, Pr as Subject, Yn as Decision, cn as DeriveOptions, fn as SimulateOptions, ln as PermDock, mn as WhereResult, sn as DecideOptions, un as PermDockOptions } from "./policy-IB6yxpC3.js";
2
2
  import { f as Permission, m as PermissionTree } from "./permissions-DttnqqxC.js";
3
3
  //#region src/pdp/types.d.ts
4
4
  type RemotePdpAuth = {
@@ -1,4 +1,4 @@
1
- import { D as PolicyVocabulary, ln as PermDock, rt as DecisionEvent } from "./policy-CFZAr_Al.js";
1
+ import { D as PolicyVocabulary, ln as PermDock, rt as DecisionEvent } from "./policy-IB6yxpC3.js";
2
2
  //#region src/otel/types.d.ts
3
3
  declare const GENAI_SEMCONV_PIN = "1.37.0";
4
4
  declare const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
@@ -1,4 +1,4 @@
1
- import { G as Approver, Mr as Membership, Pr as Subject, dr as RelationGrantee, o as ApprovalStage, r as ApprovalMode } from "./policy-CFZAr_Al.js";
1
+ import { G as Approver, Mr as Membership, Pr as Subject, dr as RelationGrantee, o as ApprovalStage, r as ApprovalMode } from "./policy-IB6yxpC3.js";
2
2
  //#region src/approvals/types.d.ts
3
3
  type ApprovalStatus = "pending" | "approved" | "rejected" | "expired";
4
4
  type ApprovalApprovers = {
@@ -1,4 +1,4 @@
1
- import { a as PermDockPluginOptions } from "../types-BPxgszlT.js";
1
+ import { a as PermDockPluginOptions } from "../types-DbjRN55U.js";
2
2
  import { createUnplugin } from "unplugin";
3
3
  //#region src/unplugin/index.d.ts
4
4
  type CreateUnplugin = typeof createUnplugin<PermDockPluginOptions | undefined>;
@@ -1,4 +1,4 @@
1
- import { n as createCollectScheduler, r as report } from "../watch-UihESpsJ.js";
1
+ import { n as createCollectScheduler, r as report } from "../watch-DVBJ9cBq.js";
2
2
  import { t as peerHint } from "../peer-BOr_kJE1.js";
3
3
  import { createRequire } from "node:module";
4
4
  //#region src/unplugin/index.ts
@@ -0,0 +1,2 @@
1
+ import { t as runUsage } from "./usage-ItS7nLcl.js";
2
+ export { runUsage };
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DWOrSQic.js";
1
+ import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/usage.ts
4
4
  function usage(ctx) {
@@ -24,7 +24,7 @@ function usage(ctx) {
24
24
  }
25
25
  },
26
26
  async run({ args: parsed, rawArgs }) {
27
- const result = await (await import("./usage-D82l1CwK.js")).runUsage({
27
+ const result = await (await import("./usage-DorAJiU_.js")).runUsage({
28
28
  cwd: ctx.cwd,
29
29
  config: ctx.config,
30
30
  ignore: listArg(rawArgs, "ignore"),
@@ -1,10 +1,10 @@
1
1
  import { c as getResource } from "./permissions-DVoF6dMt.js";
2
2
  import { o as usageResult } from "./errors-CWfoNg9N.js";
3
3
  import { a as USAGE_REPORT_SCHEMA } from "./version-BvacVTZR.js";
4
- import { o as jsonSchemaOf } from "./catalog-doc-Dsc9y7sd.js";
4
+ import { o as jsonSchemaOf } from "./catalog-doc-DdGm82XT.js";
5
5
  import { i as rel, r as listSourceFiles } from "./files-DWUN9PzI.js";
6
6
  import { a as loadModule, n as asPolicy, o as pickNamed } from "./load-DhWEB9P1.js";
7
- import { r as runCollect } from "./collect-DDDv_ESs.js";
7
+ import { r as runCollect } from "./collect-DSTE3ml9.js";
8
8
  import { existsSync, readFileSync, realpathSync } from "node:fs";
9
9
  import { dirname, resolve } from "node:path";
10
10
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,4 +1,4 @@
1
- import { a as ProblemDetails } from "./errors-DAqevpNk.js";
1
+ import { a as ProblemDetails } from "./errors-DPdqI50v.js";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region src/core/validation-error.d.ts
4
4
  /** The base of every Problem Details `type` URI; defined here so a validation error does not pull in the Problem Details builders. */
@@ -1,11 +1,11 @@
1
- import { Ft as TokenVerifier, Mr as Membership, Tt as Snapshot, Yn as Decision } from "../policy-CFZAr_Al.js";
1
+ import { Ft as TokenVerifier, Mr as Membership, Tt as Snapshot, Yn as Decision } from "../policy-IB6yxpC3.js";
2
2
  import { f as Permission } from "../permissions-DttnqqxC.js";
3
3
  import { r as Role } from "../vocabulary-DA8a8zif.js";
4
- import { n as requiredPlans } from "../problem-details-CkL50EEf.js";
5
- import { i as describe } from "../describe-PdoqESvg.js";
4
+ import { n as requiredPlans } from "../problem-details-DX075l9V.js";
5
+ import { i as describe } from "../describe-DMYiCjJV.js";
6
6
  import { t as PermissionBoundaryState } from "../boundary-BmHxVH1J.js";
7
7
  import { t as approvalHeaders } from "../headers-Cf-zWvsO.js";
8
- import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-kxznc7cn.js";
8
+ import { a as FilterResult, c as SubjectView, i as ClientStatus, l as TenantView, n as ApprovalState, o as PermissionSet, r as ClientPermDock, s as PermissionState, t as ApprovalHandle, u as UseRolesOptions } from "../types-CKNSyIf_.js";
9
9
  import { ComputedRef, DefineComponent, MaybeRefOrGetter, Plugin } from "vue";
10
10
  //#region src/vue/types.d.ts
11
11
  type PermDockPluginOptions = {
package/dist/vue/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { r as requiredPlans } from "../problem-details-_AMOYz-w.js";
2
2
  import { t as describe } from "../describe-B_gVZEVi.js";
3
3
  import { t as approvalHeaders } from "../headers-BZSDieNT.js";
4
- import { i as isPromiseLike } from "../store-options-yO0V6gRn.js";
4
+ import { i as isPromiseLike } from "../store-options-ByhZq1jV.js";
5
5
  import { a as protectedView, c as subjectView, i as permissionSet, l as tenantView, n as filterResult, o as rolesView, r as livePermDock, s as scopedTenant, t as approvalHandle } from "../views-Soe7bGSC.js";
6
6
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BM8a_P6E.js";
7
- import { n as switchTenant, t as providerStore } from "../provider-store-DNyC1y48.js";
7
+ import { n as switchTenant, t as providerStore } from "../provider-store-Cfbvo4DE.js";
8
8
  import { computed, defineComponent, effectScope, getCurrentScope, inject, isRef, onErrorCaptured, onScopeDispose, provide, shallowRef, toValue, watch } from "vue";
9
9
  //#region src/vue/context.ts
10
10
  const permDockKey = Symbol("permdock");
@@ -0,0 +1,2 @@
1
+ import { n as createCollectScheduler } from "./watch-DVBJ9cBq.js";
2
+ export { createCollectScheduler };