permdock 0.28.0 → 0.29.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 (99) hide show
  1. package/dist/{adoption-scan-BHQm3Li7.js → adoption-scan-obbSy73c.js} +1 -1
  2. package/dist/{arazzo-UwtVzma6.js → arazzo-D9Fv_ZEV.js} +1 -1
  3. package/dist/{arazzo-CAQr4N7Z.js → arazzo-rxj2pNN3.js} +1 -1
  4. package/dist/better-supabase/index.d.ts +7 -0
  5. package/dist/better-supabase/index.js +2 -2
  6. package/dist/{casbin-CSgPeAJK.js → casbin-D3PH6-AJ.js} +1 -1
  7. package/dist/{casbin-Ccbaft52.js → casbin-p8yi9Py5.js} +1 -1
  8. package/dist/cli/bin.js +1 -1
  9. package/dist/cli/generate/watch-worker.js +1 -1
  10. package/dist/cli/index.js +1 -1
  11. package/dist/cli/plugins/app.js +1 -1
  12. package/dist/cli/plugins/openapi.js +1 -1
  13. package/dist/cli/plugins/powersync.js +1 -1
  14. package/dist/cli/plugins/rls.js +1 -1
  15. package/dist/cli/plugins/schemas.js +1 -1
  16. package/dist/cli/plugins/supabase-hook.js +1 -1
  17. package/dist/cli/plugins/supabase.js +2 -2
  18. package/dist/cli/plugins/ui.js +1 -1
  19. package/dist/{cloud-CFtvELWj.js → cloud-DnTSKTYr.js} +2 -2
  20. package/dist/{codemod-ClcPRv4c.js → codemod-C4xmPHZU.js} +1 -1
  21. package/dist/{codemod-3PFIcPag.js → codemod-DwJ1I9er.js} +2 -2
  22. package/dist/{compile-mfTqcMJ5.js → compile-B9SZiEnG.js} +6 -6
  23. package/dist/{completion-D4p_MQX7.js → completion-CHOgUToS.js} +1 -1
  24. package/dist/{conditions-VlAMOm20.js → conditions-ChE7zxJI.js} +2 -2
  25. package/dist/{config-D9bq79Yi.js → config-StFKj2S0.js} +1 -1
  26. package/dist/{config-report-DZfIl6zc.js → config-report-DFj3emJp.js} +1 -1
  27. package/dist/{doctor-FHjwjHYC.js → doctor-BSYAl2XG.js} +76 -29
  28. package/dist/{doctor-CuhkBJ06.js → doctor-CjCJ_U2a.js} +2 -2
  29. package/dist/{execute-DdH84BHC.js → execute-BzQKrYqL.js} +3 -3
  30. package/dist/{fields-6d1j-q3c.js → fields-CViS0EPC.js} +1 -1
  31. package/dist/{gen-CcKymoUw.js → gen-BVDN_Hqx.js} +2 -2
  32. package/dist/gen-D13YdBQP.js +1 -0
  33. package/dist/{gen-kind-Bf9jYVgn.js → gen-kind-BK6bb0gj.js} +1 -1
  34. package/dist/{generate-BCUVV4vB.js → generate-DNAoLMj1.js} +14 -14
  35. package/dist/{generate-options-Cg5sAHhT.js → generate-options-Yfh1pGyX.js} +9 -9
  36. package/dist/{generate-UMuStlLD.js → generate-p7cdH1ac.js} +3 -3
  37. package/dist/{grants-C7bGZFPa.js → grants-Dn6zwfqo.js} +1 -1
  38. package/dist/{hook-sql-C0aUoiOH.js → hook-sql-55514A9t.js} +13 -11
  39. package/dist/{import--taRAR01.js → import-B0nUIp2b.js} +1 -1
  40. package/dist/{import-BqoDHpFt.js → import-Cm8kuezl.js} +2 -2
  41. package/dist/{init-CP3fYFb6.js → init-CjlVWrBE.js} +3 -3
  42. package/dist/{init-Cfi7_gXO.js → init-Ck4PIu9F.js} +1 -1
  43. package/dist/{interactive-only-CQsgMc1E.js → interactive-only-C_olBCPl.js} +28 -2
  44. package/dist/{login-kg9Pd0C2.js → login-BdWIAsFT.js} +1 -1
  45. package/dist/{login-BjkyJNGn.js → login-BhSLL8Pn.js} +3 -3
  46. package/dist/{manifest-C7dWk0k5.js → manifest-CXK3krNu.js} +30 -30
  47. package/dist/{manifest-B-8d2lhG.js → manifest-Ct3eXbLR.js} +1 -1
  48. package/dist/{manifest-schema-DJY5Q_pR.js → manifest-schema-Bp-eFhNZ.js} +1 -1
  49. package/dist/{migrate-BwXtXUtE.js → migrate-BcBFWFt9.js} +1 -1
  50. package/dist/{model-BkQLENu6.js → model-B0rrUh6J.js} +1 -1
  51. package/dist/{openapi-B5jo5ClY.js → openapi-D595qUYF.js} +1 -1
  52. package/dist/{openapi-dJFJTHiW.js → openapi-E2411VYb.js} +1 -1
  53. package/dist/{openapi-document-B58hIsZ4.js → openapi-document-DDzA3CrT.js} +1 -1
  54. package/dist/{output-Pne7BTXn.js → output-BhNN-hvv.js} +1 -1
  55. package/dist/{ownership-BPGoxz1T.js → ownership-mprXkEHG.js} +3 -3
  56. package/dist/{pipeline-CGctXudd.js → pipeline-Ct3YEKjx.js} +1 -1
  57. package/dist/{policy-G8iZ2T5P.js → policy-DfvOwgtX.js} +1 -1
  58. package/dist/{policy-bundle-nbcxlVOb.js → policy-bundle-pwhJJv2-.js} +3 -3
  59. package/dist/{powersync-BoOMFQRl.js → powersync-BdqLK59r.js} +1 -1
  60. package/dist/{powersync-B9KEEiJE.js → powersync-CMu40wtz.js} +1 -1
  61. package/dist/{powersync-CqAj9QJt.js → powersync-Da9op2Zo.js} +7 -7
  62. package/dist/{provider-BnnFjtWI.js → provider-1yWthvi5.js} +14 -4
  63. package/dist/{pull-DXuh-rob.js → pull-AXzbc_kg.js} +2 -2
  64. package/dist/pull-B0ju22jJ.js +1 -0
  65. package/dist/{push-DXh936bz.js → push-N-QI_ArC.js} +1 -1
  66. package/dist/{rbac-FlJv7Ba9.js → rbac-BJTUGJum.js} +2 -2
  67. package/dist/{resolve-names-CROyyjVR.js → resolve-names-B0cqvJxo.js} +4 -4
  68. package/dist/{rls-DV4MUNMb.js → rls-BC1IFnfu.js} +1 -1
  69. package/dist/{rls-BL90Ec30.js → rls-DfzVlo1q.js} +9 -9
  70. package/dist/{rls-files-BgLoAa9x.js → rls-files-BpMqBdji.js} +1 -1
  71. package/dist/{run-BFDAiNuS.js → run-CqAur1Y3.js} +2 -2
  72. package/dist/run-X_cWRiUV.js +1 -0
  73. package/dist/{scan-CoyAmDAz.js → scan-C_YtxPxn.js} +1 -1
  74. package/dist/{schema-9eGIiLry.js → schema-BVhiZyY-.js} +1 -1
  75. package/dist/{shared-BdF5DJDQ.js → shared-Cwxy5N16.js} +2 -1
  76. package/dist/{skills-BPDVfXgR.js → skills-CQ3B9vuz.js} +1 -1
  77. package/dist/{skills-B8nt-KuB.js → skills-DBvXLSo7.js} +1 -1
  78. package/dist/supabase/index.js +2 -2
  79. package/dist/{supabase-Ctn_Z6xf.js → supabase-BzK3lplm.js} +3 -3
  80. package/dist/{supabase-D5KN965n.js → supabase-CakrAxMg.js} +1 -1
  81. package/dist/{supabase-config-CjX-GjEp.js → supabase-config-B2sDFiwy.js} +1 -1
  82. package/dist/{supabase-hook-CmW2MLWa.js → supabase-hook-0q6ohTVN.js} +3 -3
  83. package/dist/supabase-hook-CcmjiBsh.js +2 -0
  84. package/dist/{tables-Btlt_Rp-.js → tables-BDqfipr1.js} +3 -3
  85. package/dist/testing/fixtures/index.js +7 -1
  86. package/dist/testing/index.js +1 -1
  87. package/dist/usage-Cayjfw1S.js +1 -0
  88. package/dist/{usage-DVjr2ZDc.js → usage-CnCNB6XN.js} +2 -2
  89. package/dist/{usage-DRReZaxQ.js → usage-Dodo7Sjb.js} +1 -1
  90. package/dist/{verify-BOB_Jyjx.js → verify-DTlATzWK.js} +5 -5
  91. package/dist/{watch-CnRyGEtp.js → watch-Bz_iEKlB.js} +1 -1
  92. package/package.json +1 -1
  93. package/schemas/supabase-manifest-v1.json +1 -1
  94. package/skills/permdock-wire/references/adapters.md +1 -1
  95. package/dist/gen-BseS8XeZ.js +0 -1
  96. package/dist/pull-8Vce3V1e.js +0 -1
  97. package/dist/run-mEbYi2Ow.js +0 -1
  98. package/dist/supabase-hook-CjChM-eX.js +0 -2
  99. package/dist/usage-nVi3-z-j.js +0 -1
@@ -81,7 +81,7 @@ const importDocument = defineLeaf({
81
81
  async run(ctx, { flags }) {
82
82
  const doc = given(flags.doc);
83
83
  if (doc === void 0) throw missingInput("openapi import", ["--doc"], "the OpenAPI document to import");
84
- return (await import("./import--taRAR01.js")).runOpenapiImport({
84
+ return (await import("./import-B0nUIp2b.js")).runOpenapiImport({
85
85
  cwd: ctx.cwd,
86
86
  doc,
87
87
  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-B5jo5ClY.js");
6
+ const { runOpenapi } = await import("./openapi-D595qUYF.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-C7dWk0k5.js";
2
+ import { t as DOCS_BASE } from "./manifest-CXK3krNu.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,12 +1,12 @@
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, at as memberRoleOf, k as roleRows, l as disabledColumn, lt as scopeSources, nt as memberForTable, p as memberColumn, s as claimKeptLines, ut as scopeTable, y as sourceFilters, z as storedTenant } from "./interactive-only-CQsgMc1E.js";
4
- import { A as tenantTypeOf, f as kindFilterSql, m as memberVia, s as signedIn, t as CUSTOM_ROLES, u as globalKindFilterSql, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
3
+ import { C as sourcesKeep, O as membershipRows, P as hasCustomRoleChecksFor, T as globalRoleRows, a as interactiveSessionSql, at as memberRoleOf, k as roleRows, l as disabledColumn, lt as scopeSources, nt as memberForTable, p as memberColumn, s as claimKeptLines, ut as scopeTable, y as sourceFilters, z as storedTenant } from "./interactive-only-C_olBCPl.js";
4
+ import { A as tenantTypeOf, f as kindFilterSql, m as memberVia, s as signedIn, t as CUSTOM_ROLES, u as globalKindFilterSql, y as subjectIdSql } from "./shared-Cwxy5N16.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
- 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-Btlt_Rp-.js";
9
+ 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-BDqfipr1.js";
10
10
  // src/cli/rls/assignments.ts
11
11
  /**
12
12
  * The client roles whose writes the assignment triggers check; any other role
@@ -1,7 +1,7 @@
1
1
  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
- import { t as policyModel } from "./model-BkQLENu6.js";
4
+ import { t as policyModel } from "./model-B0rrUh6J.js";
5
5
  import { i as orderPlugins } from "./plugin-MQVfUBUS.js";
6
6
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
7
7
  import { join, relative, resolve } from "node:path";
@@ -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-nbcxlVOb.js");
21
+ const { runPolicyBundle } = await import("./policy-bundle-pwhJJv2-.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,
@@ -1,7 +1,7 @@
1
1
  import { n as fileSummary, t as applyFiles } from "./files-DuV7wRim.js";
2
- import { i as buildContext, n as isRefusal, o as inheritTargets, t as generateOptions } from "./generate-options-Cg5sAHhT.js";
3
- import { n as compileGrants } from "./compile-mfTqcMJ5.js";
4
- import { G as POLICY_BUNDLE_FORMAT, K as bundleLoaderSql, i as tableNames, q as policyBundle } from "./tables-Btlt_Rp-.js";
2
+ import { i as buildContext, n as isRefusal, o as inheritTargets, t as generateOptions } from "./generate-options-Yfh1pGyX.js";
3
+ import { n as compileGrants } from "./compile-B9SZiEnG.js";
4
+ import { G as POLICY_BUNDLE_FORMAT, J as policyBundle, i as tableNames, q as bundleLoaderSql } from "./tables-BDqfipr1.js";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import { resolve } from "node:path";
7
7
  // src/cli/policy-bundle.ts
@@ -24,7 +24,7 @@ const verify = defineLeaf({
24
24
  const db = await dbUrl(ctx, flags, { required: true });
25
25
  const fixtures = given(flags.fixtures);
26
26
  const from = given(flags.policy);
27
- const { runPowerSync } = await import("./powersync-B9KEEiJE.js");
27
+ const { runPowerSync } = await import("./powersync-CMu40wtz.js");
28
28
  return runPowerSync({
29
29
  cwd: ctx.cwd,
30
30
  config: ctx.config,
@@ -1 +1 @@
1
- export { r as powersyncFiles, t as runPowerSync } from "./powersync-CqAj9QJt.js";
1
+ export { r as powersyncFiles, t as runPowerSync } from "./powersync-Da9op2Zo.js";
@@ -8,21 +8,21 @@ import { i as fileDrift } from "./output-files-D5D-8-4l.js";
8
8
  import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-Bm0G0A7H.js";
9
9
  import { n as pgConnector } from "./pg-CA651850.js";
10
10
  import { c as requirePolicy } from "./load-CZnlAyZ8.js";
11
- import { t as canFixture } from "./verify-BOB_Jyjx.js";
12
- import { a as roleNames, i as collectGrants, t as assignableRoles } from "./grants-C7bGZFPa.js";
11
+ import { t as canFixture } from "./verify-DTlATzWK.js";
12
+ import { a as roleNames, i as collectGrants, t as assignableRoles } from "./grants-Dn6zwfqo.js";
13
13
  import { a as quoteIdent, s as quoteQualified } from "./quote-BKrTBbcH.js";
14
14
  import { a as scopeMembershipTable, i as scopeColumn } from "./compile-BUKXrueE.js";
15
15
  import { r as isRecord, t as compact } from "./compact-C4LFuqbW.js";
16
16
  import { d as scopeList, s as resolveScope } from "./scopes-B-KX9EI8.js";
17
17
  import { d as keptKeys, t as AUTHZ_VERSION_TABLE } from "./sources-DnjJPGfb.js";
18
- import { a as customRolesOn, t as CUSTOM_ROLES } from "./shared-BdF5DJDQ.js";
18
+ import { a as customRolesOn, t as CUSTOM_ROLES } from "./shared-Cwxy5N16.js";
19
19
  import { t as membershipSourcesOf } from "./sources-BbSUNmFX.js";
20
20
  import { s as quoteSqlLiteral, t as SQL_IDENT } from "./sql-T4GaBh9X.js";
21
- import { t as ownershipRules } from "./ownership-BPGoxz1T.js";
22
- import { i as tableFor } from "./compile-mfTqcMJ5.js";
23
- import { i as tableNames, r as tableNameOf } from "./tables-Btlt_Rp-.js";
21
+ import { t as ownershipRules } from "./ownership-mprXkEHG.js";
22
+ import { i as tableFor } from "./compile-B9SZiEnG.js";
23
+ import { i as tableNames, r as tableNameOf } from "./tables-BDqfipr1.js";
24
24
  import { l as policyLevels } from "./policy-DFD2J5o_.js";
25
- import { r as contextRefs, t as andConditions } from "./conditions-VlAMOm20.js";
25
+ import { r as contextRefs, t as andConditions } from "./conditions-ChE7zxJI.js";
26
26
  import { p as scopeField } from "./tenancy-B5Xxt9Sc.js";
27
27
  import { t as requiresApproval } from "./approval-required-B-R4Yw3J.js";
28
28
  import { resolve } from "node:path";
@@ -2,7 +2,7 @@ import { t as parseCatalog } from "./parse-nfHSt1Wy.js";
2
2
  import { n as freezeDeep } from "./freeze-DGfJq_j2.js";
3
3
  import { a as delegatedScopeMap } from "./permdock-BueSeg7X.js";
4
4
  import { i as qualifySqlTable, l as sqlIdent, s as quoteSqlLiteral } from "./sql-T4GaBh9X.js";
5
- import { n as parseSupabaseManifest, t as hasTokenHook } from "./manifest-B-8d2lhG.js";
5
+ import { n as parseSupabaseManifest, t as hasTokenHook } from "./manifest-Ct3eXbLR.js";
6
6
  import { o as holder, r as approverLeaves } from "./approvers-BkY_ZfWl.js";
7
7
  import { n as asApprover } from "./approval-normalize-Cpp8R0rY.js";
8
8
  // src/better-supabase/active-tenant.ts
@@ -208,6 +208,11 @@ const TEAM_SCOPE = /^teams?$/u;
208
208
  const ACTOR_MAY_WRITE = "permdock_actor_may_write";
209
209
  const APPROVER_FOR = "permdock_approver_for_ids";
210
210
  const MANAGED_USERS = "permdock_managed_user_ids";
211
+ /**
212
+ * Whether a role is the tenant's, for better-supabase's `membership_roles`
213
+ * trigger.
214
+ */
215
+ const ROLE_IN = "permdock_role_in";
211
216
  const OPTIONAL = [
212
217
  "idsWithFor",
213
218
  "isPlatformFor",
@@ -280,8 +285,9 @@ function rowTemplatesOf(schema, manifest, requires, problems) {
280
285
  * lists their helper, which `rls.mode: 'database'` writes. `subject` and
281
286
  * `subjectForTenant` name `permdock_subject()` and `permdock_subject(p_tenant)`
282
287
  * unless `subject: false`; `subjectForTenant`, `bootstrapPermissions`
283
- * (`permdock_bootstrap_permissions(p_tenant)`) and `canIn` (the tenant scope's
284
- * ids by permission, as a set) answer at the root scope only.
288
+ * (`permdock_bootstrap_permissions(p_tenant)`), `canIn` (the tenant scope's ids
289
+ * by permission, as a set) and `roleIn` (`permdock_role_in`) answer at the root
290
+ * scope only.
285
291
  */
286
292
  function providerFunctions(input) {
287
293
  const { manifest, catalog, options, tenantScope, rootTenant, problems } = input;
@@ -347,6 +353,9 @@ function providerFunctions(input) {
347
353
  };
348
354
  const approverFor = setTemplate(APPROVER_FOR);
349
355
  const managedUsers = /\bp_tenant\b/u.test(helpers.get(MANAGED_USERS)?.args ?? "") ? setTemplate(MANAGED_USERS, "{tenant}") : void 0;
356
+ const roleInHelper = options.roleIn === true && rootTenant ? helpers.get(ROLE_IN) : void 0;
357
+ if (options.roleIn === true && roleInHelper === void 0) problems.push(`roleIn: the manifest's rls.helpers has no ${rls.schema}.${ROLE_IN} at the root tenant scope. Set rls.customRoles in database mode, run \`permdock rls generate\`, then \`permdock supabase inspect --out\`.`);
358
+ const roleIn = roleInHelper === void 0 ? void 0 : call(ROLE_IN, "{role}, {tenant}", "postgres", argTypes(roleInHelper.args));
350
359
  return {
351
360
  functions: {
352
361
  ...rowTemplates,
@@ -363,7 +372,8 @@ function providerFunctions(input) {
363
372
  ...subjectForTenant === void 0 ? {} : { subjectForTenant },
364
373
  ...bootstrapPermissions === void 0 ? {} : { bootstrapPermissions },
365
374
  ...approverFor === void 0 ? {} : { approverFor },
366
- ...managedUsers === void 0 ? {} : { managedUsers }
375
+ ...managedUsers === void 0 ? {} : { managedUsers },
376
+ ...roleIn === void 0 ? {} : { roleIn }
367
377
  },
368
378
  requires,
369
379
  canAssign: listed("canAssign", tenantScope)
@@ -1,10 +1,10 @@
1
1
  import { t as parseCatalog } from "./parse-nfHSt1Wy.js";
2
2
  import { t as catalogFingerprint } from "./catalog-fingerprint-DAWZARy6.js";
3
- import { n as parseSupabaseManifest } from "./manifest-B-8d2lhG.js";
3
+ import { n as parseSupabaseManifest } from "./manifest-Ct3eXbLR.js";
4
4
  import { o as formatCatalogJson } from "./catalog-doc-Bp5khmCG.js";
5
5
  import { t as catalogPath } from "./catalog-path-bG0XxHMu.js";
6
6
  import { a as describeError } from "./errors-DgLOqc6j.js";
7
- import { a as nonEmptyOr } from "./output-Pne7BTXn.js";
7
+ import { a as nonEmptyOr } from "./output-BhNN-hvv.js";
8
8
  import { s as cliVersion } from "./version-D-jWyJb9.js";
9
9
  import { s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
10
10
  import { n as formatManifestJson } from "./manifest-json-DMaBWmcG.js";
@@ -0,0 +1 @@
1
+ export { n as runCloudPull } from "./pull-AXzbc_kg.js";
@@ -3,7 +3,7 @@ import { r as pushedPolicy } from "./pushed-policy-rpB6k77P.js";
3
3
  import { r as isRecord } from "./compact-C4LFuqbW.js";
4
4
  import { n as PermDockValidationError } from "./validation-error-CgDOA6VS.js";
5
5
  import { t as catalogFingerprint } from "./catalog-fingerprint-DAWZARy6.js";
6
- import { n as parseSupabaseManifest } from "./manifest-B-8d2lhG.js";
6
+ import { n as parseSupabaseManifest } from "./manifest-Ct3eXbLR.js";
7
7
  import { n as runCatalog } from "./catalog-DXSP1we9.js";
8
8
  import { a as describeError, n as CliError } from "./errors-DgLOqc6j.js";
9
9
  import { n as httpRequest, t as authFailure } from "./http-BbX_Ou3_.js";
@@ -1,6 +1,6 @@
1
- import { n as authorizeSql } from "./supabase-Ctn_Z6xf.js";
1
+ import { n as authorizeSql } from "./supabase-BzK3lplm.js";
2
2
  import { i as configError } from "./errors-DgLOqc6j.js";
3
- import { a as roleNames } from "./grants-C7bGZFPa.js";
3
+ import { a as roleNames } from "./grants-Dn6zwfqo.js";
4
4
  import { a as quoteIdent, c as quoteTable, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
5
5
  // src/cli/rls/rbac.ts
6
6
  /**
@@ -4,10 +4,10 @@ import { d as scopeList } from "./scopes-B-KX9EI8.js";
4
4
  import "./budget-BH81q2cj.js";
5
5
  import "./sources-DnjJPGfb.js";
6
6
  import { i as configError } from "./errors-DgLOqc6j.js";
7
- import { t as FIELD_VIEWS } from "./fields-6d1j-q3c.js";
8
- import { C as forUserContext, Z as graphPlan, d as permittedByPermissionHelper, i as tableNames, o as PERMISSION_HELPERS, p as holderSources, s as checkName, w as grantBodies } from "./tables-Btlt_Rp-.js";
9
- import { D as idTypeOf, O as scopeTypeOf } from "./shared-BdF5DJDQ.js";
10
- import { G as graphHelper, K as graphSqlName, Q as isTeamScope, T as globalRoleRows, X as hasPermittedUsers, Z as inheritedRowsHelper, ct as restrictedHelper, et as memberForHelper, f as holderBody, it as memberOfHelper, ot as permittedForHelper, rt as memberIdsHelper, st as permittedIdsHelper, ut as scopeTable } from "./interactive-only-CQsgMc1E.js";
7
+ import { t as FIELD_VIEWS } from "./fields-CViS0EPC.js";
8
+ import { C as forUserContext, Q as graphPlan, d as permittedByPermissionHelper, i as tableNames, o as PERMISSION_HELPERS, p as holderSources, s as checkName, w as grantBodies } from "./tables-BDqfipr1.js";
9
+ import { D as idTypeOf, O as scopeTypeOf } from "./shared-Cwxy5N16.js";
10
+ import { G as graphHelper, K as graphSqlName, Q as isTeamScope, T as globalRoleRows, X as hasPermittedUsers, Z as inheritedRowsHelper, ct as restrictedHelper, et as memberForHelper, f as holderBody, it as memberOfHelper, ot as permittedForHelper, rt as memberIdsHelper, st as permittedIdsHelper, ut as scopeTable } from "./interactive-only-C_olBCPl.js";
11
11
  import { a as quoteIdent, i as qualified, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
12
12
  // src/cli/rls/permission-holders.ts
13
13
  /**
@@ -192,7 +192,7 @@ async function rlsInput(ctx, verb, shape, options) {
192
192
  };
193
193
  }
194
194
  async function runRls(input) {
195
- return (await import("./rls-BL90Ec30.js")).runRls(input);
195
+ return (await import("./rls-DfzVlo1q.js")).runRls(input);
196
196
  }
197
197
  ({
198
198
  ...shapeFlags,
@@ -2,15 +2,15 @@ import "./sources-DnjJPGfb.js";
2
2
  import { a as describeError, f as usageResult, o as exitCodeOfError } from "./errors-DgLOqc6j.js";
3
3
  import { i as requirePeer, n as packageManagerOf, t as addLine } from "./peer-D77JpXe-.js";
4
4
  import { n as pgConnector, t as connectPgPool } from "./pg-CA651850.js";
5
- import { f as isSupabaseSchemas, m as schemasRefusal } from "./hook-sql-C0aUoiOH.js";
6
- import { a as nonEmptyOr } from "./output-Pne7BTXn.js";
7
- import { n as describeExplain, t as runRlsGenerate } from "./generate-BCUVV4vB.js";
8
- import { a as COLUMNS_SQL, o as INDEX_COLUMNS_SQL, u as readTableIndexFacts } from "./compile-mfTqcMJ5.js";
5
+ import { f as isSupabaseSchemas, m as schemasRefusal } from "./hook-sql-55514A9t.js";
6
+ import { a as nonEmptyOr } from "./output-BhNN-hvv.js";
7
+ import { n as describeExplain, t as runRlsGenerate } from "./generate-DNAoLMj1.js";
8
+ import { a as COLUMNS_SQL, o as INDEX_COLUMNS_SQL, u as readTableIndexFacts } from "./compile-B9SZiEnG.js";
9
9
  import { r as escapeSqlIdent } from "./sql-T4GaBh9X.js";
10
10
  import { t as beforeFirst } from "./text-D704xHVl.js";
11
- import { a as verifyResult, c as callsHelper, i as verifyIgnores, l as helperCallKeys, n as runRlsVerify, o as HELPER_TABLES, r as rlsFinding } from "./verify-BOB_Jyjx.js";
12
- import { c as ACTOR_MAY_WRITE, p as readOnlyActorKinds } from "./fields-6d1j-q3c.js";
13
- import { r as parseRbacAuthorize } from "./rbac-FlJv7Ba9.js";
11
+ import { a as verifyResult, c as callsHelper, i as verifyIgnores, l as helperCallKeys, n as runRlsVerify, o as HELPER_TABLES, r as rlsFinding } from "./verify-DTlATzWK.js";
12
+ import { c as ACTOR_MAY_WRITE, p as readOnlyActorKinds } from "./fields-CViS0EPC.js";
13
+ import { r as parseRbacAuthorize } from "./rbac-BJTUGJum.js";
14
14
  import { delimiter, join } from "node:path";
15
15
  import { spawn } from "node:child_process";
16
16
  // src/cli/rls/grant-calls.ts
@@ -770,7 +770,7 @@ async function migrate(input) {
770
770
  output: generated.output
771
771
  };
772
772
  await requirePeer(() => import("pgsql-parser"), "pgsql-parser", "permdock rls migrate", input.cwd, PGSQL_PARSER_MAJOR);
773
- const { migrateTarget, runRlsMigrate } = await import("./migrate-BwXtXUtE.js");
773
+ const { migrateTarget, runRlsMigrate } = await import("./migrate-BcBFWFt9.js");
774
774
  return runRlsMigrate({
775
775
  cwd: input.cwd,
776
776
  sql: input.sql,
@@ -886,7 +886,7 @@ async function runRls(input) {
886
886
  }
887
887
  case "import": {
888
888
  await requirePeer(() => import("pgsql-parser"), "pgsql-parser", "permdock rls import", input.cwd, PGSQL_PARSER_MAJOR);
889
- const { runRlsImport } = await import("./import-BqoDHpFt.js");
889
+ const { runRlsImport } = await import("./import-Cm8kuezl.js");
890
890
  return runRlsImport({
891
891
  cwd: input.cwd,
892
892
  config: input.config,
@@ -3,7 +3,7 @@ import { i as dateAt } from "./time-r0CKBm57.js";
3
3
  import { n as CliError } from "./errors-DgLOqc6j.js";
4
4
  import { m as seedsMigration, p as seedDeltaNote } from "./output-files-D5D-8-4l.js";
5
5
  import { a as fixturesPresent, i as defaultsSeedSql, o as fixturesSeedSql, r as FIXTURES_PATH, t as DEFAULTS_MARKER } from "./seed-sql-CjF7u0aX.js";
6
- import { t as runRlsGenerate } from "./generate-BCUVV4vB.js";
6
+ import { t as runRlsGenerate } from "./generate-DNAoLMj1.js";
7
7
  import { a as quietIo, r as noted } from "./plugin-MQVfUBUS.js";
8
8
  // src/cli/generate/plugins/rls-options.ts
9
9
  function seedMode(seeds) {
@@ -3,9 +3,9 @@ import { a as resolveCwd, i as readConfig, o as withPluginOutputs } from "./conf
3
3
  import { t as beforeFirst } from "./text-D704xHVl.js";
4
4
  import { a as describeError, n as CliError, r as cliFailure, s as failureOf, u as kindOfCode } from "./errors-DgLOqc6j.js";
5
5
  import { a as suggestion, i as parseLeaf, o as GLOBAL_FLAGS, r as parseFlags } from "./args-Bc0HLiD4.js";
6
- import { c as confirmationRequired, d as quote, f as replayArgv, i as githubAnnotations, l as consentDigest, n as errorDocument, o as resultDocument, s as sarifLog, t as dataOf, u as consentReasons } from "./output-Pne7BTXn.js";
6
+ import { c as confirmationRequired, d as quote, f as replayArgv, i as githubAnnotations, l as consentDigest, n as errorDocument, o as resultDocument, s as sarifLog, t as dataOf, u as consentReasons } from "./output-BhNN-hvv.js";
7
7
  import { r as progressReporter, t as redact } from "./credentials-6ZWbJ-Re.js";
8
- import { a as resolve, i as leaves, n as ROOT, r as SECTIONS, t as DOCS_BASE } from "./manifest-C7dWk0k5.js";
8
+ import { a as resolve, i as leaves, n as ROOT, r as SECTIONS, t as DOCS_BASE } from "./manifest-CXK3krNu.js";
9
9
  import { t as createStyle } from "./style-CQDaLJtP.js";
10
10
  import { s as cliVersion } from "./version-D-jWyJb9.js";
11
11
  import { n as isPermDockPlugin } from "./plugin-MQVfUBUS.js";
@@ -0,0 +1 @@
1
+ export { t as run } from "./run-CqAur1Y3.js";
@@ -16,7 +16,7 @@ const scan = defineLeaf({
16
16
  }
17
17
  },
18
18
  async run(ctx, { flags }) {
19
- const { runAdoptionScan } = await import("./adoption-scan-BHQm3Li7.js");
19
+ const { runAdoptionScan } = await import("./adoption-scan-obbSy73c.js");
20
20
  return runAdoptionScan({
21
21
  cwd: ctx.cwd,
22
22
  srcPath: flags.src.length > 0 ? flags.src : ctx.config.collect?.srcPath ?? ["src"],
@@ -1,7 +1,7 @@
1
1
  import { t as require__2020 } from "./2020-DBXhfpuK.js";
2
2
  import { r as isRecord } from "./compact-C4LFuqbW.js";
3
3
  import { t as DRAFT_PINS } from "./pins-CXXkVEiD.js";
4
- import { a as nonEmptyOr } from "./output-Pne7BTXn.js";
4
+ import { a as nonEmptyOr } from "./output-BhNN-hvv.js";
5
5
  import { l as packageRoot } from "./version-D-jWyJb9.js";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { join } from "node:path";
@@ -306,7 +306,8 @@ const CUSTOM_ROLES = {
306
306
  compile: "permdock_compile_custom_role",
307
307
  compileFor: "permdock_compile_custom_roles_for",
308
308
  compileStatement: "permdock_compile_custom_roles",
309
- recompile: "permdock_recompile_custom_roles"
309
+ recompile: "permdock_recompile_custom_roles",
310
+ roleIn: "permdock_role_in"
310
311
  };
311
312
  /** The function `rls.roles` adds. The name is part of the SQL contract. */
312
313
  const GLOBAL_ROLES = { replace: "permdock_replace_global_roles" };
@@ -1,7 +1,7 @@
1
1
  import { t as defineLeaf } from "./command-9GAzSI7E.js";
2
2
  import { t as checkFlag } from "./flags-C0e-BzGW.js";
3
3
  import { r as pick, t as CANCELLED } from "./prompt-CPlJn_4-.js";
4
- import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-B8nt-KuB.js";
4
+ import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-DBvXLSo7.js";
5
5
  // src/cli/commands/skills.ts
6
6
  const forFlag = { for: {
7
7
  type: "string",
@@ -1,6 +1,6 @@
1
1
  import { t as byCodePoint } from "./compare-dfHDj8kT.js";
2
2
  import { t as didYouMean } from "./args-Bc0HLiD4.js";
3
- import { a as nonEmptyOr } from "./output-Pne7BTXn.js";
3
+ import { a as nonEmptyOr } from "./output-BhNN-hvv.js";
4
4
  import { i as readJsonFile, s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
5
5
  import { l as packageRoot } from "./version-D-jWyJb9.js";
6
6
  import { cpSync, existsSync, lstatSync, readFileSync, readdirSync, readlinkSync, realpathSync } from "node:fs";
@@ -1,9 +1,9 @@
1
1
  import { r as readSubjectRecord } from "../version-cache-BXkl7-Fz.js";
2
2
  import { n as AUTHZ_TOPIC, r as authzUserTopic, t as AUTHZ_EVENT } from "../authz-topic-D8x24Jv-.js";
3
3
  import { n as supabaseMembershipsBudget, r as supabaseTenantClaim } from "../budget-BH81q2cj.js";
4
- import { a as tableApprovalPolicySource, c as exchangeCapability, i as tableApprovalDelegationSource, n as authorizeSql, o as supabaseApprovalStore, r as supabaseRls, s as supabaseClaims, t as definePermDock } from "../supabase-Ctn_Z6xf.js";
4
+ import { a as tableApprovalPolicySource, c as exchangeCapability, i as tableApprovalDelegationSource, n as authorizeSql, o as supabaseApprovalStore, r as supabaseRls, s as supabaseClaims, t as definePermDock } from "../supabase-BzK3lplm.js";
5
5
  import { c as tableMembershipSource, i as authzVersion, o as junctionMembershipSource, s as supabasePostgresQuery, t as AUTHZ_VERSION_TABLE } from "../sources-DnjJPGfb.js";
6
6
  import { r as subjectFromSupabaseClient, s as postgrestSources } from "../resolver-4qxIIHcC.js";
7
7
  import { a as delegationOf, i as actorOf, o as subjectFromSupabase, s as subjectFromSupabaseSession } from "../definition-options-9o8Hdww3.js";
8
- import { n as parseSupabaseManifest, t as hasTokenHook } from "../manifest-B-8d2lhG.js";
8
+ import { n as parseSupabaseManifest, t as hasTokenHook } from "../manifest-Ct3eXbLR.js";
9
9
  export { AUTHZ_EVENT, AUTHZ_TOPIC, AUTHZ_VERSION_TABLE, actorOf, authorizeSql, authzUserTopic, authzVersion, definePermDock, delegationOf, exchangeCapability, hasTokenHook, junctionMembershipSource, parseSupabaseManifest, postgrestSources, readSubjectRecord, subjectFromSupabase, subjectFromSupabaseClient, subjectFromSupabaseSession, supabaseApprovalStore, supabaseClaims, supabaseMembershipsBudget, supabasePostgresQuery, supabaseRls, supabaseTenantClaim, tableApprovalDelegationSource, tableApprovalPolicySource, tableMembershipSource };
@@ -545,7 +545,7 @@ function claimKept(suspension) {
545
545
  }
546
546
  function customDatabaseBranch(q, scope, memberships, declared, levels, suspension) {
547
547
  const role = tenantRole(memberships);
548
- const match = `case when ${q("permdock_is_shared_role")}(${literal(scope)}, ${role.sql}) then c.tenant_id is null else c.tenant_id::text = requested_tenant end and c.scope = ${literal(scope)} and c.scope_id is null and c.role = ${role.sql}`;
548
+ const match = `case when ${q("permdock_is_shared_role")}(${literal(scope)}, ${role.sql}) then c.tenant_id is null else c.tenant_id = v_custom_tenant end and c.scope = ${literal(scope)} and c.scope_id is null and c.role = ${role.sql}`;
549
549
  const rows = (source, value, extra) => `array(select c.${value} from ${q(source)} c where ${match}${extra})`;
550
550
  return ` or exists (
551
551
  select 1
@@ -591,7 +591,7 @@ function databaseBody(q, scope, memberships, custom, suspension) {
591
591
  tenantBranch = ` if requested_tenant is not null then
592
592
  begin
593
593
  v_member_user := uid;
594
- v_member_tenant := requested_tenant;
594
+ v_member_tenant := requested_tenant;${custom === void 0 ? "" : "\n v_custom_tenant := requested_tenant;"}
595
595
  exception when invalid_text_representation or numeric_value_out_of_range then
596
596
  return false; -- not an id of the memberships table
597
597
  end;
@@ -606,7 +606,7 @@ function databaseBody(q, scope, memberships, custom, suspension) {
606
606
  return `declare
607
607
  uid uuid := (select auth.uid());${memberships !== void 0 && tenantColumn !== void 0 ? `
608
608
  v_member_user ${quoteQualifiedTable(memberships.table)}.${ident(memberships.user)}%type;
609
- v_member_tenant ${quoteQualifiedTable(memberships.table)}.${ident(tenantColumn)}%type;` : ""}
609
+ v_member_tenant ${quoteQualifiedTable(memberships.table)}.${ident(tenantColumn)}%type;${custom === void 0 ? "" : `\n v_custom_tenant ${q("custom_role_permissions")}.tenant_id%type;`}` : ""}
610
610
  begin
611
611
  if uid is null then
612
612
  return false;
@@ -15,7 +15,7 @@ const inspect = defineLeaf({
15
15
  },
16
16
  async run(ctx, { flags }) {
17
17
  const out = flags.out === "" ? true : flags.out === "-" ? void 0 : flags.out;
18
- const { runSupabase } = await import("./supabase-hook-CjChM-eX.js");
18
+ const { runSupabase } = await import("./supabase-hook-CcmjiBsh.js");
19
19
  return runSupabase({
20
20
  cwd: ctx.cwd,
21
21
  config: ctx.config,
@@ -1,6 +1,6 @@
1
1
  import "./sources-DnjJPGfb.js";
2
2
  import { a as describeError } from "./errors-DgLOqc6j.js";
3
- import { n as hookUri } from "./rbac-FlJv7Ba9.js";
3
+ import { n as hookUri } from "./rbac-BJTUGJum.js";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { join, posix } from "node:path";
6
6
  // ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
@@ -5,10 +5,10 @@ import { _ as writeOutputFiles, d as pgDeltaPath, g as underSchemaDir, h as serv
5
5
  import { i as readJsonFile, o as sqlFiles, s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
6
6
  import { n as formatManifestJson, t as MANIFEST_FILE } from "./manifest-json-DMaBWmcG.js";
7
7
  import { c as requirePolicy } from "./load-CZnlAyZ8.js";
8
- import { n as hookUri } from "./rbac-FlJv7Ba9.js";
9
- import { a as supabaseHookSql, c as asideAuthzReceive, f as isSupabaseSchemas, h as declarativeSql, i as supabaseHookManifest, l as configToml, m as schemasRefusal, n as hooklessDatabase, o as defaultOut, p as resolveSchemas, r as supabaseDatabaseManifest, s as hookMarker, t as grantsLabel } from "./hook-sql-C0aUoiOH.js";
8
+ import { n as hookUri } from "./rbac-BJTUGJum.js";
9
+ import { a as supabaseHookSql, c as asideAuthzReceive, f as isSupabaseSchemas, h as declarativeSql, i as supabaseHookManifest, l as configToml, m as schemasRefusal, n as hooklessDatabase, o as defaultOut, p as resolveSchemas, r as supabaseDatabaseManifest, s as hookMarker, t as grantsLabel } from "./hook-sql-55514A9t.js";
10
10
  import { r as HOOK_MARKER, s as hookMarkerFields } from "./markers-C-kThnKN.js";
11
- import { a as supabaseConfig } from "./supabase-config-CjX-GjEp.js";
11
+ import { a as supabaseConfig } from "./supabase-config-B2sDFiwy.js";
12
12
  import { t as readMemberships } from "./read-memberships-BkePIa1F.js";
13
13
  import { n as pgConnector } from "./pg-CA651850.js";
14
14
  import { n as MIGRATION_DIRS } from "./constants-PCJiir_3.js";
@@ -0,0 +1,2 @@
1
+ import "./hook-sql-55514A9t.js";
2
+ export { r as runSupabase } from "./supabase-hook-0q6ohTVN.js";
@@ -11,8 +11,8 @@ import { d as sqlTextArray, i as qualifySqlTable, t as SQL_IDENT } from "./sql-T
11
11
  import { d as restrictedRowsSql, i as scopeColumn, l as relationArmSql } from "./compile-BUKXrueE.js";
12
12
  import { t as AUTHZ_VERSION_TABLE } from "./sources-DnjJPGfb.js";
13
13
  import { a as quoteIdent, c as quoteTable, i as qualified, o as quoteLiteral, r as helperSchema, s as quoteQualified } from "./quote-BKrTBbcH.js";
14
- import { A as tenantTypeOf, D as idTypeOf, O as scopeTypeOf, _ as subjectClaimJsonSql, d as keyTenantSql, f as kindFilterSql, h as roleKindSql, i as allowEntry, m as memberVia, n as GLOBAL_ROLES, o as rootName, r as HELPERS, s as signedIn, t as CUSTOM_ROLES, v as subjectClaimSql, x as userIdHelperSql, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
15
- import { $ as linkHelper, A as userActive, B as trustedReaderGrants, C as sourcesKeep, D as keyTenantLine, E as instancesActive, F as perScope, G as graphHelper, H as byKey, I as raiseSql, J as hasMemberFor, K as graphSqlName, L as roleReadersSql, M as currentKeyExpr, N as customRolesSql, P as hasCustomRoleChecksFor, Q as isTeamScope, R as rolesTableScope, S as sourcesBodyOf, V as byCodeUnit, W as CLOSURE, Y as hasMemberOf, _ as memoizes, a as interactiveSessionSql, at as memberRoleOf, b as sourceIdOf, c as claimTenant, ct as restrictedHelper, d as hasBody, dt as activeInstancesSql, et as memberForHelper, ft as activeMembershipSql, g as memoizedSetofSql, gt as grantPermissionSql, h as memoWriteSql, it as memberOfHelper, j as globalRoleSource, l as disabledColumn, lt as scopeSources, m as memoHitList, mt as activeUserSql, n as interactiveAllowsCall, o as memoUserSql, ot as permittedForHelper, p as memberColumn, pt as activeRowSql, q as graphSqlText, r as interactiveAllowsSql, rt as memberIdsHelper, s as claimKeptLines, st as permittedIdsHelper, tt as memberForSources, u as functionBody, ut as scopeTable, v as scopedBody, w as sqlBody, x as sourceRows, y as sourceFilters, z as storedTenant } from "./interactive-only-CQsgMc1E.js";
14
+ import { A as tenantTypeOf, D as idTypeOf, O as scopeTypeOf, _ as subjectClaimJsonSql, d as keyTenantSql, f as kindFilterSql, h as roleKindSql, i as allowEntry, m as memberVia, n as GLOBAL_ROLES, o as rootName, r as HELPERS, s as signedIn, t as CUSTOM_ROLES, v as subjectClaimSql, x as userIdHelperSql, y as subjectIdSql } from "./shared-Cwxy5N16.js";
15
+ import { $ as linkHelper, A as userActive, B as trustedReaderGrants, C as sourcesKeep, D as keyTenantLine, E as instancesActive, F as perScope, G as graphHelper, H as byKey, I as raiseSql, J as hasMemberFor, K as graphSqlName, L as roleReadersSql, M as currentKeyExpr, N as customRolesSql, P as hasCustomRoleChecksFor, Q as isTeamScope, R as rolesTableScope, S as sourcesBodyOf, V as byCodeUnit, W as CLOSURE, Y as hasMemberOf, _ as memoizes, a as interactiveSessionSql, at as memberRoleOf, b as sourceIdOf, c as claimTenant, ct as restrictedHelper, d as hasBody, dt as activeInstancesSql, et as memberForHelper, ft as activeMembershipSql, g as memoizedSetofSql, gt as grantPermissionSql, h as memoWriteSql, it as memberOfHelper, j as globalRoleSource, l as disabledColumn, lt as scopeSources, m as memoHitList, mt as activeUserSql, n as interactiveAllowsCall, o as memoUserSql, ot as permittedForHelper, p as memberColumn, pt as activeRowSql, q as graphSqlText, r as interactiveAllowsSql, rt as memberIdsHelper, s as claimKeptLines, st as permittedIdsHelper, tt as memberForSources, u as functionBody, ut as scopeTable, v as scopedBody, w as sqlBody, x as sourceRows, y as sourceFilters, z as storedTenant } from "./interactive-only-C_olBCPl.js";
16
16
  import { createHash } from "node:crypto";
17
17
  // src/cli/rls/graph.ts
18
18
  function tableFor(resource, tables) {
@@ -3296,4 +3296,4 @@ function resolveVias(tables, scopes, dialect) {
3296
3296
  }
3297
3297
  return Object.keys(out).length === 0 ? void 0 : out;
3298
3298
  }
3299
- export { tokenScopeUnlimitedSql as A, apiKeyUnlimitedSql as B, forUserContext as C, seedSql as D, memoReadsSql as E, capabilityAccessSql as F, POLICY_BUNDLE_FORMAT as G, HOOK_TEAM_READER as H, API_KEY_ALLOWS as I, closureBackfillSql as J, bundleLoaderSql as K, apiKeyAllowsCall as L, memoReadTriggersSql as M, guardAuthAdminGrants as N, TOKEN_SCOPE_ALLOWS as O, unguardAuthAdminGrants as P, graphSql as Q, apiKeyClaimSql as R, accessSql as S, helpersSql as T, hookTeamReader as U, apiKeysPlan as V, hookTeamsHelper as W, graphIdsSql as X, closureDepths as Y, graphPlan as Z, sourceTransferTriggerSql as _, tablelessResources as a, ASSIGNMENTS as b, permissionHelpersSql as c, permittedByPermissionHelper as d, requiresSql as f, sourceRowsSql as g, sourceHoldersTriggerSql as h, tableNames as i, tokenScopesPlan as j, tokenScopeAllowsCall as k, permissionKeysForHelper as l, pairsSql as m, resolveVias as n, PERMISSION_HELPERS as o, holderSources as p, policyBundle as q, tableNameOf as r, checkName as s, checkSharedTables as t, permissionKeysHelper as u, holdersTriggerSql as v, grantBodies as w, OWNERSHIP as x, transferTriggerSql as y, apiKeyFields as z };
3299
+ export { graphSql as $, tokenScopeUnlimitedSql as A, apiKeyUnlimitedSql as B, forUserContext as C, seedSql as D, memoReadsSql as E, capabilityAccessSql as F, POLICY_BUNDLE_FORMAT as G, HOOK_TEAM_READER as H, API_KEY_ALLOWS as I, policyBundle as J, POLICY_BUNDLE_TABLE as K, apiKeyAllowsCall as L, memoReadTriggersSql as M, guardAuthAdminGrants as N, TOKEN_SCOPE_ALLOWS as O, unguardAuthAdminGrants as P, graphPlan as Q, apiKeyClaimSql as R, accessSql as S, helpersSql as T, hookTeamReader as U, apiKeysPlan as V, hookTeamsHelper as W, closureDepths as X, closureBackfillSql as Y, graphIdsSql as Z, sourceTransferTriggerSql as _, tablelessResources as a, ASSIGNMENTS as b, permissionHelpersSql as c, permittedByPermissionHelper as d, requiresSql as f, sourceRowsSql as g, sourceHoldersTriggerSql as h, tableNames as i, tokenScopesPlan as j, tokenScopeAllowsCall as k, permissionKeysForHelper as l, pairsSql as m, resolveVias as n, PERMISSION_HELPERS as o, holderSources as p, bundleLoaderSql as q, tableNameOf as r, checkName as s, checkSharedTables as t, permissionKeysHelper as u, holdersTriggerSql as v, grantBodies as w, OWNERSHIP as x, transferTriggerSql as y, apiKeyFields as z };
@@ -1,5 +1,5 @@
1
1
  import { t as parseCatalog } from "../../parse-nfHSt1Wy.js";
2
- import { n as parseSupabaseManifest } from "../../manifest-B-8d2lhG.js";
2
+ import { n as parseSupabaseManifest } from "../../manifest-Ct3eXbLR.js";
3
3
  // src/testing/fixtures/better-supabase.catalog.json
4
4
  var better_supabase_catalog_default = {
5
5
  $schema: "https://permdock.com/schemas/catalog-v2.json",
@@ -742,6 +742,12 @@ var better_supabase_manifest_default = {
742
742
  "args": "p_permission text, p_id uuid",
743
743
  "returns": "setof uuid",
744
744
  "execute": []
745
+ },
746
+ {
747
+ "name": "permdock_role_in",
748
+ "args": "p_role text, p_tenant uuid",
749
+ "returns": "boolean",
750
+ "execute": []
745
751
  }
746
752
  ],
747
753
  "memberships": [{
@@ -33,7 +33,7 @@ import { t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-rpB6k77P.js";
33
33
  import { n as supabaseMembershipsBudget } from "../budget-BH81q2cj.js";
34
34
  import { t as catalogSchema } from "../schema-BeY3croo.js";
35
35
  import { t as CONNECTOR_SCHEMA } from "../connector-schema-BSRMyq4M.js";
36
- import { t as supabaseManifestSchema } from "../manifest-schema-DJY5Q_pR.js";
36
+ import { t as supabaseManifestSchema } from "../manifest-schema-Bp-eFhNZ.js";
37
37
  import { n as freezeDeep } from "../freeze-DGfJq_j2.js";
38
38
  import { c as evaluateCondition } from "../delegation-BaUNCrE_.js";
39
39
  import { s as parseCredential } from "../credential-ke0KMQeB.js";
@@ -0,0 +1 @@
1
+ export { t as runUsage } from "./usage-CnCNB6XN.js";
@@ -2,8 +2,8 @@ import { a as getResource } from "./permission-registry-DMYRZVcn.js";
2
2
  import { c as jsonSchemaOf } from "./catalog-doc-Bp5khmCG.js";
3
3
  import { r as runCollect } from "./collect-BOh9Pxob.js";
4
4
  import { f as usageResult } from "./errors-DgLOqc6j.js";
5
- import { t as DOCS_BASE } from "./manifest-C7dWk0k5.js";
6
- import { r as findingOf } from "./output-Pne7BTXn.js";
5
+ import { t as DOCS_BASE } from "./manifest-CXK3krNu.js";
6
+ import { r as findingOf } from "./output-BhNN-hvv.js";
7
7
  import { o as USAGE_REPORT_SCHEMA } from "./version-D-jWyJb9.js";
8
8
  import { n as jiti, r as parseSync, t as createVisitor } from "./optional-CaQWp9HA.js";
9
9
  import { a as rel, r as listSourceFiles } from "./files-DAR51W3J.js";
@@ -16,7 +16,7 @@ const usage = defineLeaf({
16
16
  }
17
17
  },
18
18
  async run(ctx, { flags }) {
19
- return (await import("./usage-nVi3-z-j.js")).runUsage({
19
+ return (await import("./usage-Cayjfw1S.js")).runUsage({
20
20
  cwd: ctx.cwd,
21
21
  config: ctx.config,
22
22
  ignore: flags.ignore,
@@ -7,16 +7,16 @@ import { s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
7
7
  import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-Bm0G0A7H.js";
8
8
  import { n as pgConnector } from "./pg-CA651850.js";
9
9
  import { o as loadPolicyAt } from "./load-CZnlAyZ8.js";
10
- import { t as commandFor } from "./compile-mfTqcMJ5.js";
10
+ import { t as commandFor } from "./compile-B9SZiEnG.js";
11
11
  import { r as isRecord } from "./compact-C4LFuqbW.js";
12
12
  import { t as policyRowConditionKeys } from "./row-conditions-DwIJocfQ.js";
13
13
  import { c as rootScope, d as scopeList, o as normalizeMemberships } from "./scopes-B-KX9EI8.js";
14
14
  import { t as beforeFirst } from "./text-D704xHVl.js";
15
- import { T as columnTypesOf, a as customRolesOn, r as HELPERS } from "./shared-BdF5DJDQ.js";
15
+ import { T as columnTypesOf, a as customRolesOn, r as HELPERS } from "./shared-Cwxy5N16.js";
16
16
  import { a as quoteIdent, c as quoteTable, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
17
- import { Z as graphPlan, i as tableNames, r as tableNameOf } from "./tables-Btlt_Rp-.js";
18
- import { s as viewName, t as FIELD_VIEWS } from "./fields-6d1j-q3c.js";
19
- import { t as DOCS_BASE } from "./manifest-C7dWk0k5.js";
17
+ import { Q as graphPlan, i as tableNames, r as tableNameOf } from "./tables-BDqfipr1.js";
18
+ import { s as viewName, t as FIELD_VIEWS } from "./fields-CViS0EPC.js";
19
+ import { t as DOCS_BASE } from "./manifest-CXK3krNu.js";
20
20
  import { b as membershipsClaim, m as customRoleScope } from "./evaluate-D8SdfP3h.js";
21
21
  import { n as defaultSqlCommand, t as SQL_IDENT } from "./sql-T4GaBh9X.js";
22
22
  import "./budget-BH81q2cj.js";
@@ -2,7 +2,7 @@ import { r as isRecord } from "./compact-C4LFuqbW.js";
2
2
  import { i as dateAt } from "./time-r0CKBm57.js";
3
3
  import { a as describeError, n as CliError } from "./errors-DgLOqc6j.js";
4
4
  import { n as createChangeScheduler } from "./watch-BNxvqCS4.js";
5
- import { t as receiptRows } from "./pipeline-CGctXudd.js";
5
+ import { t as receiptRows } from "./pipeline-Ct3YEKjx.js";
6
6
  import { existsSync } from "node:fs";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { Worker } from "node:worker_threads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permdock",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Typed permissions for TypeScript apps, APIs, databases, and AI agents, with the permdock CLI and test runners.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -525,7 +525,7 @@
525
525
  },
526
526
  "helperName": {
527
527
  "type": "string",
528
- "pattern": "^(permdock_has(_for)?|permitted_[a-z][a-z0-9_]*_(ids|permission_keys)(_for)?|permitted_[a-z][a-z0-9_]*_users|member_[a-z][a-z0-9_]*_ids(_for|_of)?|permdock_can_assign(_any|_custom_role)?(_for)?|permdock_api_key_allows|permdock_token_scope_allows|permdock_interactive_allows|permdock_actor_may_write|permdock_is_approver|permdock_manages|permdock_user_id|permdock_subject|permdock_approver_for_ids|permdock_managed_user_ids|permdock_bootstrap_permissions)$"
528
+ "pattern": "^(permdock_has(_for)?|permitted_[a-z][a-z0-9_]*_(ids|permission_keys)(_for)?|permitted_[a-z][a-z0-9_]*_users|member_[a-z][a-z0-9_]*_ids(_for|_of)?|permdock_can_assign(_any|_custom_role)?(_for)?|permdock_api_key_allows|permdock_token_scope_allows|permdock_interactive_allows|permdock_actor_may_write|permdock_is_approver|permdock_manages|permdock_user_id|permdock_subject|permdock_approver_for_ids|permdock_managed_user_ids|permdock_bootstrap_permissions|permdock_role_in)$"
529
529
  },
530
530
  "column": {
531
531
  "type": "object",