permdock 0.3.0 → 0.3.1

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 (34) hide show
  1. package/dist/{arazzo-CKwwqFWz.js → arazzo-C9chp3ST.js} +1 -1
  2. package/dist/{catalog-dFZdWCGN.js → catalog-CYj-mX2O.js} +1 -1
  3. package/dist/cli/bin.js +1 -1
  4. package/dist/cli/index.js +1 -1
  5. package/dist/{cloud-CB_ELYuX.js → cloud-CfwZ39Rl.js} +1 -1
  6. package/dist/{collect-DClJsheJ.js → collect-CHB22Sx4.js} +1 -1
  7. package/dist/{commands-DSxCqG9A.js → commands-BeaGNj_o.js} +13 -13
  8. package/dist/{config-Dnszbv-6.js → config-ir40y8m0.js} +2 -2
  9. package/dist/{config-report-DMvWKUxL.js → config-report-CdCgbRnV.js} +2 -2
  10. package/dist/{diff-DBIhz_f2.js → diff-C9RDjjhs.js} +1 -1
  11. package/dist/{doctor-BwCAMLx_.js → doctor-Djh6JDEk.js} +2 -2
  12. package/dist/{doctor-igIiM_Hl.js → doctor-DvH0IQff.js} +7 -7
  13. package/dist/{doctor-collect-CHk6XWOA.js → doctor-collect-CjdO0wQX.js} +2 -2
  14. package/dist/{openapi-l0xYHkcv.js → openapi-CQTsgKoB.js} +1 -1
  15. package/dist/powersync-CrBX8hY6.js +2 -0
  16. package/dist/{powersync-DliZK_-y.js → powersync-DE19b9dT.js} +2 -2
  17. package/dist/{powersync-BylawD_U.js → powersync-Dv1_aWF7.js} +3 -3
  18. package/dist/{rls-DQtdgTHB.js → rls-DiinlRML.js} +7 -7
  19. package/dist/{rls-B4ur8nKQ.js → rls-P-BeBx0n.js} +2 -2
  20. package/dist/{rls-fields-74oZPXWL.js → rls-fields-CZOMlwHl.js} +16 -8
  21. package/dist/{rls-import-BTFVk3jH.js → rls-import-4lLW_pbb.js} +1 -1
  22. package/dist/{rls-ownership-RuFqaqGz.js → rls-ownership-DcYlZ09B.js} +1 -1
  23. package/dist/{rls-verify-CVQTHTh5.js → rls-verify-CMv9H3wV.js} +1 -1
  24. package/dist/{run-DKDbM4Du.js → run-BWc9qqvE.js} +1 -1
  25. package/dist/{skills-Bx-U0irG.js → skills-C5CbhhpG.js} +1 -1
  26. package/dist/{supabase-config-BpPXt3x1.js → supabase-config-Bj3iDH2I.js} +1 -1
  27. package/dist/supabase-hook-gd3s8bxB.js +2 -0
  28. package/dist/{supabase-hook-CSLQ4zJ3.js → supabase-hook-ntETYCQu.js} +4 -4
  29. package/dist/{supabase-Boqb9a_Y.js → supabase-s4o9s1O1.js} +2 -2
  30. package/dist/{supautils-Cn4R4cJ4.js → supautils-u8jXTGrt.js} +1 -1
  31. package/dist/{usage-GTixvDDU.js → usage-B0YuTQRO.js} +1 -1
  32. package/package.json +1 -1
  33. package/dist/powersync-e_AZrKbg.js +0 -2
  34. package/dist/supabase-hook-6sYLXg_u.js +0 -2
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/arazzo.ts
4
4
  function arazzo(ctx) {
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/catalog.ts
4
4
  function catalog(ctx) {
package/dist/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as run } from "../run-DKDbM4Du.js";
2
+ import { t as run } from "../run-BWc9qqvE.js";
3
3
  import { n as streamHasColors } from "../style-CTm1AXDT.js";
4
4
  //#region src/cli/bin.ts
5
5
  const result = await run(process.argv.slice(2), {
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as catalogPath } from "../catalog-path-CnI0XTFK.js";
2
2
  import { t as defineConfig } from "../config-BJiM-xAm.js";
3
3
  import { o as parseGrantsMarker, s as parseHookMarker } from "../markers-B0hYLvMD.js";
4
- import { t as run } from "../run-DKDbM4Du.js";
4
+ import { t as run } from "../run-BWc9qqvE.js";
5
5
  export { catalogPath, defineConfig, parseGrantsMarker, parseHookMarker, run };
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/cloud.ts
4
4
  function cloud(ctx) {
@@ -1,5 +1,5 @@
1
1
  import { i as describeError } from "./errors-CWfoNg9N.js";
2
- import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
2
+ import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/cli/commands/collect.ts
5
5
  function collect(ctx) {
@@ -76,19 +76,19 @@ const COMMAND_DESCRIPTIONS = {
76
76
  };
77
77
  /** Every top-level command, loaded only when it runs or its own `--help` is asked for. */
78
78
  const commands = {
79
- collect: async () => (await import("./collect-DClJsheJ.js")).collect,
80
- catalog: async () => (await import("./catalog-dFZdWCGN.js")).catalog,
81
- diff: async () => (await import("./diff-DBIhz_f2.js")).diff,
82
- usage: async () => (await import("./usage-GTixvDDU.js")).usage,
83
- doctor: async () => (await import("./doctor-BwCAMLx_.js")).doctor,
84
- config: async () => (await import("./config-Dnszbv-6.js")).config,
85
- skills: async () => (await import("./skills-Bx-U0irG.js")).skills,
86
- openapi: async () => (await import("./openapi-l0xYHkcv.js")).openapi,
87
- rls: async () => (await import("./rls-B4ur8nKQ.js")).rls,
88
- arazzo: async () => (await import("./arazzo-CKwwqFWz.js")).arazzo,
89
- cloud: async () => (await import("./cloud-CB_ELYuX.js")).cloud,
90
- supabase: async () => (await import("./supabase-Boqb9a_Y.js")).supabase,
91
- powersync: async () => (await import("./powersync-DliZK_-y.js")).powersync
79
+ collect: async () => (await import("./collect-CHB22Sx4.js")).collect,
80
+ catalog: async () => (await import("./catalog-CYj-mX2O.js")).catalog,
81
+ diff: async () => (await import("./diff-C9RDjjhs.js")).diff,
82
+ usage: async () => (await import("./usage-B0YuTQRO.js")).usage,
83
+ doctor: async () => (await import("./doctor-Djh6JDEk.js")).doctor,
84
+ config: async () => (await import("./config-ir40y8m0.js")).config,
85
+ skills: async () => (await import("./skills-C5CbhhpG.js")).skills,
86
+ openapi: async () => (await import("./openapi-CQTsgKoB.js")).openapi,
87
+ rls: async () => (await import("./rls-P-BeBx0n.js")).rls,
88
+ arazzo: async () => (await import("./arazzo-C9chp3ST.js")).arazzo,
89
+ cloud: async () => (await import("./cloud-CfwZ39Rl.js")).cloud,
90
+ supabase: async () => (await import("./supabase-s4o9s1O1.js")).supabase,
91
+ powersync: async () => (await import("./powersync-DE19b9dT.js")).powersync
92
92
  };
93
93
  function isCommand(name) {
94
94
  return Object.hasOwn(commands, name);
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/config.ts
4
4
  function config(ctx) {
@@ -19,7 +19,7 @@ function config(ctx) {
19
19
  }
20
20
  },
21
21
  async run({ args: parsed }) {
22
- const { runConfig } = await import("./config-report-DMvWKUxL.js");
22
+ const { runConfig } = await import("./config-report-CdCgbRnV.js");
23
23
  ctx.report(runConfig({
24
24
  cwd: ctx.cwd,
25
25
  config: ctx.config,
@@ -3,8 +3,8 @@ import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
3
3
  import { i as rel, t as defaultSrcPath } from "./files-DWUN9PzI.js";
4
4
  import { n as guessPermissions, t as barrelFile } from "./collect-DSTE3ml9.js";
5
5
  import "./sources-4p0-4xQm.js";
6
- import { r as MIGRATION_DIRS } from "./supabase-config-BpPXt3x1.js";
7
- import { t as DEFAULT_SENSITIVE_ACTIONS } from "./doctor-collect-CHk6XWOA.js";
6
+ import { r as MIGRATION_DIRS } from "./supabase-config-Bj3iDH2I.js";
7
+ import { t as DEFAULT_SENSITIVE_ACTIONS } from "./doctor-collect-CjdO0wQX.js";
8
8
  //#region src/cli/config-report.ts
9
9
  function configReport(input) {
10
10
  const { cwd, config } = input;
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/diff.ts
4
4
  function diff(ctx) {
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { n as ask, t as CANCELLED } from "./prompt-CXYhLfsS.js";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/cli/commands/doctor.ts
@@ -34,7 +34,7 @@ function doctor(ctx) {
34
34
  }
35
35
  fix = answer;
36
36
  }
37
- const result = await (await import("./doctor-igIiM_Hl.js")).runDoctor({
37
+ const result = await (await import("./doctor-DvH0IQff.js")).runDoctor({
38
38
  cwd: ctx.cwd,
39
39
  config: ctx.config,
40
40
  only: listArg(rawArgs, "only"),
@@ -12,14 +12,14 @@ import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-4p0-4xQm.js";
12
12
  import "./markers-B0hYLvMD.js";
13
13
  import { t as createStyle } from "./style-CTm1AXDT.js";
14
14
  import { i as runSkillsInstall } from "./skills-Biq5uup3.js";
15
- import { a as pd006, c as pd022, d as group, h as tableKey, i as pd005, l as pd028, n as supabaseConfig, o as pd009, p as sqlStatements, r as MIGRATION_DIRS, s as pd012, t as pd045, u as pd040 } from "./supabase-config-BpPXt3x1.js";
16
- import { m as compileGrants } from "./rls-fields-74oZPXWL.js";
15
+ import { a as pd006, c as pd022, d as group, h as tableKey, i as pd005, l as pd028, n as supabaseConfig, o as pd009, p as sqlStatements, r as MIGRATION_DIRS, s as pd012, t as pd045, u as pd040 } from "./supabase-config-Bj3iDH2I.js";
16
+ import { m as compileGrants } from "./rls-fields-CZOMlwHl.js";
17
17
  import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, u as pd036 } from "./usage-ItS7nLcl.js";
18
- import { C as pd035, E as policyOf, S as pd034, T as pd055, _ as pd029, a as pd004, b as pd032, c as pd018, d as pd021, f as pd023, g as pd027, h as pd026, i as pd003, l as pd019, m as pd025, n as collectedOf, o as pd016, p as pd024, r as pd002, s as pd017, u as pd020, v as pd030, w as pd037, x as pd033, y as pd031 } from "./doctor-collect-CHk6XWOA.js";
19
- import { a as ownershipRules, i as guardedTables } from "./rls-ownership-RuFqaqGz.js";
20
- import { a as supabaseHookManifest, c as attrsPlan, h as partPath, n as hookOut, s as pd039 } from "./supabase-hook-CSLQ4zJ3.js";
21
- import { r as staleFiles, t as powersyncFiles } from "./powersync-BylawD_U.js";
22
- import { t as supautilsRejections } from "./supautils-Cn4R4cJ4.js";
18
+ import { C as pd035, E as policyOf, S as pd034, T as pd055, _ as pd029, a as pd004, b as pd032, c as pd018, d as pd021, f as pd023, g as pd027, h as pd026, i as pd003, l as pd019, m as pd025, n as collectedOf, o as pd016, p as pd024, r as pd002, s as pd017, u as pd020, v as pd030, w as pd037, x as pd033, y as pd031 } from "./doctor-collect-CjdO0wQX.js";
19
+ import { a as ownershipRules, i as guardedTables } from "./rls-ownership-DcYlZ09B.js";
20
+ import { a as supabaseHookManifest, c as attrsPlan, h as partPath, n as hookOut, s as pd039 } from "./supabase-hook-ntETYCQu.js";
21
+ import { r as staleFiles, t as powersyncFiles } from "./powersync-Dv1_aWF7.js";
22
+ import { t as supautilsRejections } from "./supautils-u8jXTGrt.js";
23
23
  import { existsSync, readFileSync } from "node:fs";
24
24
  import { join, resolve } from "node:path";
25
25
  //#region src/cli/doctor-assignments.ts
@@ -10,9 +10,9 @@ import { a as loadModule, n as asPolicy, o as pickNamed } from "./load-DhWEB9P1.
10
10
  import { r as runCollect } from "./collect-DSTE3ml9.js";
11
11
  import { i as quoteSqlLiteral } from "./sql-xdg5f4Fi.js";
12
12
  import "./sources-4p0-4xQm.js";
13
- import { n as supabaseConfig, r as MIGRATION_DIRS } from "./supabase-config-BpPXt3x1.js";
13
+ import { n as supabaseConfig, r as MIGRATION_DIRS } from "./supabase-config-Bj3iDH2I.js";
14
14
  import { T as graphSqlName } from "./rls-shared-Cewd_-zI.js";
15
- import { W as contextRefs, h as tableFor, p as commandFor } from "./rls-fields-74oZPXWL.js";
15
+ import { W as contextRefs, h as tableFor, p as commandFor } from "./rls-fields-CZOMlwHl.js";
16
16
  import { d as rowConditionMessage, l as helperTablePolicies, n as graphPlan, o as ROW_CONDITION_FIX } from "./rls-graph-CHwx0V8q.js";
17
17
  import { t as runUsage } from "./usage-ItS7nLcl.js";
18
18
  import { existsSync, readFileSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/openapi.ts
4
4
  function openapi(ctx) {
@@ -0,0 +1,2 @@
1
+ import { n as runPowerSync } from "./powersync-Dv1_aWF7.js";
2
+ export { runPowerSync };
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/powersync.ts
4
4
  function powersync(ctx) {
@@ -44,7 +44,7 @@ function powersync(ctx) {
44
44
  const db = stringArg(parsed.db);
45
45
  const fixtures = stringArg(parsed.fixtures);
46
46
  const from = stringArg(parsed.from);
47
- const { runPowerSync } = await import("./powersync-e_AZrKbg.js");
47
+ const { runPowerSync } = await import("./powersync-CrBX8hY6.js");
48
48
  ctx.report(await runPowerSync({
49
49
  cwd: ctx.cwd,
50
50
  config: ctx.config,
@@ -10,10 +10,10 @@ import { i as scopeMembershipTable, r as scopeColumn } from "./compile-Ba4blROR.
10
10
  import { i as quoteSqlLiteral, t as SQL_IDENT } from "./sql-xdg5f4Fi.js";
11
11
  import "./sources-4p0-4xQm.js";
12
12
  import { G as quoteIdent, t as CUSTOM_ROLES } from "./rls-shared-Cewd_-zI.js";
13
- import { H as collectGrants, W as contextRefs, h as tableFor, w as connectPg } from "./rls-fields-74oZPXWL.js";
13
+ import { H as collectGrants, W as contextRefs, h as tableFor, w as connectPg } from "./rls-fields-CZOMlwHl.js";
14
14
  import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-ht28Cplr.js";
15
- import { a as ownershipRules } from "./rls-ownership-RuFqaqGz.js";
16
- import { t as canFixture } from "./rls-verify-CVQTHTh5.js";
15
+ import { a as ownershipRules } from "./rls-ownership-DcYlZ09B.js";
16
+ import { t as canFixture } from "./rls-verify-CMv9H3wV.js";
17
17
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
18
18
  import { resolve } from "node:path";
19
19
  //#region src/cli/powersync-streams.ts
@@ -11,14 +11,14 @@ import { n as escapeSqlIdent } from "./sql-xdg5f4Fi.js";
11
11
  import "./sources-4p0-4xQm.js";
12
12
  import { i as SEEDS_MARKER, r as INDEXES_MARKER, t as GRANTS_MARKER } from "./markers-B0hYLvMD.js";
13
13
  import { n as requirePeer } from "./peer-BOr_kJE1.js";
14
- import { f as splitUndiffed, n as supabaseConfig } from "./supabase-config-BpPXt3x1.js";
14
+ import { f as splitUndiffed, n as supabaseConfig } from "./supabase-config-Bj3iDH2I.js";
15
15
  import { $ as sessionLiveHelperSql, G as quoteIdent$1, K as quoteLiteral, Q as scopeTypeOf, R as memberIdsHelper, T as graphSqlName, U as permittedIdsHelper, V as parseMembershipsFlag, W as qualifiedTable$1, X as scopeSources, Z as scopeTable, f as SESSION_LIVE_HELPER, o as qualified$1, q as quoteTable, r as HELPERS, rt as subjectIdSql, tt as subjectClaimJsonSql, w as graphHelper, y as checkSuspension } from "./rls-shared-Cewd_-zI.js";
16
- import { A as helpersSql, B as breakGlassHolder, C as readTableIndexFacts, E as accessSql, F as seedSql, H as collectGrants, S as pruneIndexTargets, T as connectPgPool, U as roleNames, V as breakGlassKey, a as fieldViewsSql, b as indexTargets, c as assemblePolicies, d as readOnlyActorPolicies, f as branchClauses, g as permissionHelpersSql, h as tableFor, i as fieldViews, l as orSql, m as compileGrants, n as columnGrantSql, o as rowBranches, q as apiKeysPlan, r as columnRevokeSql, u as readOnlyActorKinds, v as permittedByPermissionHelper, x as indexesSql, y as COLUMNS_SQL } from "./rls-fields-74oZPXWL.js";
16
+ import { A as helpersSql, B as breakGlassHolder, C as readTableIndexFacts, E as accessSql, F as seedSql, H as collectGrants, S as pruneIndexTargets, T as connectPgPool, U as roleNames, V as breakGlassKey, a as fieldViewsSql, b as indexTargets, c as assemblePolicies, d as readOnlyActorPolicies, f as branchClauses, g as permissionHelpersSql, h as tableFor, i as fieldViews, l as orSql, m as compileGrants, n as columnGrantSql, o as rowBranches, q as apiKeysPlan, r as columnRevokeSql, u as readOnlyActorKinds, v as permittedByPermissionHelper, x as indexesSql, y as COLUMNS_SQL } from "./rls-fields-CZOMlwHl.js";
17
17
  import { c as helperCallKeys, i as HELPER_TABLES, n as graphPlan, r as graphSql, s as callsHelper, t as closureDepths } from "./rls-graph-CHwx0V8q.js";
18
- import { a as ownershipRules, o as ownershipSql, r as assignmentSql } from "./rls-ownership-RuFqaqGz.js";
19
- import { _ as seedsMigration, d as resolveAuthorize, f as driftOf, g as pgDeltaPath, h as partPath, l as parseRbacAuthorize, m as parseSplit, o as supabaseHookSql, p as isSeedsDirectory, t as grantsLabel, u as rbacScaffold, v as writeSqlFiles } from "./supabase-hook-CSLQ4zJ3.js";
20
- import { n as runRlsVerify } from "./rls-verify-CVQTHTh5.js";
21
- import { t as supautilsRejections } from "./supautils-Cn4R4cJ4.js";
18
+ import { a as ownershipRules, o as ownershipSql, r as assignmentSql } from "./rls-ownership-DcYlZ09B.js";
19
+ import { _ as seedsMigration, d as resolveAuthorize, f as driftOf, g as pgDeltaPath, h as partPath, l as parseRbacAuthorize, m as parseSplit, o as supabaseHookSql, p as isSeedsDirectory, t as grantsLabel, u as rbacScaffold, v as writeSqlFiles } from "./supabase-hook-ntETYCQu.js";
20
+ import { n as runRlsVerify } from "./rls-verify-CMv9H3wV.js";
21
+ import { t as supautilsRejections } from "./supautils-u8jXTGrt.js";
22
22
  import { basename, delimiter, join, resolve } from "node:path";
23
23
  import { spawnSync } from "node:child_process";
24
24
  //#region src/cli/rls-advisors.ts
@@ -2471,7 +2471,7 @@ async function runRls(input) {
2471
2471
  }
2472
2472
  case "import": {
2473
2473
  await requirePeer(() => import("pgsql-parser"), "pgsql-parser", "permdock rls import", input.cwd);
2474
- const { runRlsImport } = await import("./rls-import-BTFVk3jH.js");
2474
+ const { runRlsImport } = await import("./rls-import-4lLW_pbb.js");
2475
2475
  return runRlsImport({
2476
2476
  cwd: input.cwd,
2477
2477
  config: input.config,
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/rls.ts
4
4
  function rls(ctx) {
@@ -189,7 +189,7 @@ function rls(ctx) {
189
189
  }
190
190
  },
191
191
  async run({ args: parsed }) {
192
- const result = await (await import("./rls-DQtdgTHB.js")).runRls({
192
+ const result = await (await import("./rls-DiinlRML.js")).runRls({
193
193
  cwd: ctx.cwd,
194
194
  config: ctx.config,
195
195
  rest: parsed._,
@@ -610,8 +610,12 @@ function roleNames(policy) {
610
610
  function qualify(name, schema) {
611
611
  return name.includes(".") ? name : `${schema}.${name}`;
612
612
  }
613
+ function throughTenant(through, roles) {
614
+ if (through === void 0 || roles?.tenant === void 0) return;
615
+ return qualify(roles.table, "public") === through.table ? roles.tenant : void 0;
616
+ }
613
617
  /** Resolves `source` against `schema`, aliasing the table `alias` and the roles table `<alias>k`. */
614
- function globalRoleSource(source, schema, alias) {
618
+ function globalRoleSource(source, schema, alias, roles) {
615
619
  const table = qualify(source.table, schema);
616
620
  const user = source.user ?? "user_id";
617
621
  const role = roleColumn(source.role ?? "role", table, alias, {
@@ -619,14 +623,17 @@ function globalRoleSource(source, schema, alias) {
619
623
  prefix: "PermDock CLI",
620
624
  indent: " "
621
625
  });
626
+ const tenant = role.lateral ? void 0 : throughTenant(role.through, roles);
627
+ const global = tenant === void 0 ? "" : ` and ${alias}k.${quoteIdent(tenant)} is null`;
622
628
  return {
623
629
  table,
624
630
  user,
625
- from: `${quoteTable(table)} ${alias}${role.join}`,
631
+ from: `${quoteTable(table)} ${alias}${role.join}${global}`,
626
632
  userSql: `${alias}.${quoteIdent(user)}`,
627
633
  roleSql: role.sql,
628
634
  role: roleManifest(role),
629
- ...role.through === void 0 ? {} : { through: role.through }
635
+ ...role.through === void 0 ? {} : { through: role.through },
636
+ ...tenant === void 0 ? {} : { tenant }
630
637
  };
631
638
  }
632
639
  //#endregion
@@ -1484,7 +1491,7 @@ function qualifiedName(name) {
1484
1491
  */
1485
1492
  function globalRolesSql(ctx) {
1486
1493
  if (ctx.roles === void 0) return "";
1487
- const source = globalRoleSource(ctx.roles, "public", "t");
1494
+ const source = globalRoleSource(ctx.roles, "public", "t", ctx.customRoles?.table);
1488
1495
  const table = quoteTable(qualifiedName(ctx.roles.table));
1489
1496
  const user = quoteIdent(source.user);
1490
1497
  const fn = qualified$1(ctx, GLOBAL_ROLES.replace);
@@ -1509,9 +1516,10 @@ function globalRolesSql(ctx) {
1509
1516
  const id = quoteIdent(through.id);
1510
1517
  const key = quoteIdent(through.key);
1511
1518
  const ref = quoteIdent(through.ref);
1519
+ const global = source.tenant === void 0 ? "" : ` and k.${quoteIdent(source.tenant)} is null`;
1512
1520
  body = ` select string_agg(w.r, ', ' order by w.r) into v_unknown
1513
1521
  from (${wanted}) w(r)
1514
- where not exists (select 1 from ${keys} k where k.${key}::text = w.r);
1522
+ where not exists (select 1 from ${keys} k where k.${key}::text = w.r${global});
1515
1523
  if v_unknown is not null then
1516
1524
  raise exception using
1517
1525
  errcode = '22023',
@@ -1523,12 +1531,12 @@ function globalRolesSql(ctx) {
1523
1531
  and not exists (
1524
1532
  select 1 from ${keys} k
1525
1533
  where k.${id} = t.${ref}
1526
- and k.${key}::text = any(coalesce(p_roles, '{}'::text[]))
1534
+ and k.${key}::text = any(coalesce(p_roles, '{}'::text[]))${global}
1527
1535
  );
1528
1536
  insert into ${table} (${user}, ${ref})
1529
1537
  select p_user, k.${id}
1530
1538
  from ${keys} k
1531
- where k.${key}::text in (${wanted})
1539
+ where k.${key}::text in (${wanted})${global}
1532
1540
  and not exists (
1533
1541
  select 1 from ${table} t where t.${user} = p_user and t.${ref} = k.${id}
1534
1542
  );`;
@@ -1694,7 +1702,7 @@ function globalRoleRows(ctx) {
1694
1702
  from: `${qualified$1(ctx, "user_roles")} ur`,
1695
1703
  userSql: "ur.user_id",
1696
1704
  roleSql: "ur.role::text"
1697
- } : globalRoleSource(ctx.roles, "public", "ur");
1705
+ } : globalRoleSource(ctx.roles, "public", "ur", ctx.customRoles?.table);
1698
1706
  }
1699
1707
  function customKeysJoin(ctx, scope, allows, denies, includes) {
1700
1708
  return ` cross join lateral ${qualified$1(ctx, CUSTOM_ROLES.keys)}(
@@ -1,7 +1,7 @@
1
1
  import { o as usageResult } from "./errors-CWfoNg9N.js";
2
2
  import { i as quoteSqlLiteral, n as escapeSqlIdent } from "./sql-xdg5f4Fi.js";
3
3
  import { V as parseMembershipsFlag, r as HELPERS } from "./rls-shared-Cewd_-zI.js";
4
- import { t as FIELD_VIEWS, w as connectPg } from "./rls-fields-74oZPXWL.js";
4
+ import { t as FIELD_VIEWS, w as connectPg } from "./rls-fields-CZOMlwHl.js";
5
5
  import { n as emptySchema, r as isSchemaKind, t as emitPermissionsModule } from "./generate-CH7ThJ14.js";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
7
  import { dirname, resolve } from "node:path";
@@ -2,7 +2,7 @@ import { l as scopeChain, o as resolveScope } from "./scopes-CVdPrWN-.js";
2
2
  import { S as findRole } from "./grantee-Cv5Sogfv.js";
3
3
  import { l as roleColumn } from "./sources-4p0-4xQm.js";
4
4
  import { B as memberVia, G as quoteIdent, I as memberForSources, K as quoteLiteral, L as memberForTable, M as kindFilterSql, S as globalKindFilterSql, W as qualifiedTable, X as scopeSources, Y as roleKindSql, Z as scopeTable, at as tenantTypeOf, c as signedIn, o as qualified, q as quoteTable, rt as subjectIdSql, t as CUSTOM_ROLES, z as memberRoleOf } from "./rls-shared-Cewd_-zI.js";
5
- import { D as claimKeptLines, I as sourceFilters, L as sourcesKeep, M as membershipRows, N as membershipTable, O as disabledColumn, P as roleRows, R as hasCustomRoleChecksFor, j as memberColumn, k as globalRoleRows } from "./rls-fields-74oZPXWL.js";
5
+ import { D as claimKeptLines, I as sourceFilters, L as sourcesKeep, M as membershipRows, N as membershipTable, O as disabledColumn, P as roleRows, R as hasCustomRoleChecksFor, j as memberColumn, k as globalRoleRows } from "./rls-fields-CZOMlwHl.js";
6
6
  //#region src/cli/rls-ownership.ts
7
7
  /** Objects the ownership rules add next to the helpers. Names are part of the SQL contract. */
8
8
  const OWNERSHIP = {
@@ -11,7 +11,7 @@ import { a as loadModule, n as asPolicy, o as pickNamed } from "./load-DhWEB9P1.
11
11
  import "./budget-NbEtbJC_.js";
12
12
  import "./sources-4p0-4xQm.js";
13
13
  import { G as quoteIdent, K as quoteLiteral, b as columnTypesOf, q as quoteTable } from "./rls-shared-Cewd_-zI.js";
14
- import { p as commandFor, s as viewName, t as FIELD_VIEWS, w as connectPg } from "./rls-fields-74oZPXWL.js";
14
+ import { p as commandFor, s as viewName, t as FIELD_VIEWS, w as connectPg } from "./rls-fields-CZOMlwHl.js";
15
15
  import { a as HELPER_TABLE_POLICIES_SQL, d as rowConditionMessage, n as graphPlan, u as helperTablePoliciesFromRows } from "./rls-graph-CHwx0V8q.js";
16
16
  import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-ht28Cplr.js";
17
17
  import { resolve } from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { a as exitCodeOf, i as describeError, n as cliErrorKind, r as cliProblem } from "./errors-CWfoNg9N.js";
2
2
  import { o as cliVersion } from "./version-BvacVTZR.js";
3
3
  import { a as resolveCwd, i as readConfig } from "./config-BJiM-xAm.js";
4
- import { i as globalArgs, n as commands, o as resolveArgs, r as isCommand, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
4
+ import { i as globalArgs, n as commands, o as resolveArgs, r as isCommand, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
5
5
  import { stripVTControlCharacters } from "node:util";
6
6
  import { defineCommand, parseArgs, renderUsage, runCommand } from "citty";
7
7
  //#region src/cli/run.ts
@@ -1,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { r as pick, t as CANCELLED } from "./prompt-CXYhLfsS.js";
3
3
  import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-Biq5uup3.js";
4
4
  import { defineCommand } from "citty";
@@ -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-74oZPXWL.js";
3
+ import { t as FIELD_VIEWS } from "./rls-fields-CZOMlwHl.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-ntETYCQu.js";
2
+ export { runSupabase };
@@ -10,10 +10,10 @@ import "./budget-NbEtbJC_.js";
10
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-BpPXt3x1.js";
13
+ import { f as splitUndiffed, h as tableKey, m as decidingColumns, n as supabaseConfig, r as MIGRATION_DIRS } from "./supabase-config-Bj3iDH2I.js";
14
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";
15
+ import { G as API_KEY_ALLOWS, K as apiKeyFields, U as roleNames, _ as permissionKeysForHelper, w as connectPg, z as globalRoleSource } from "./rls-fields-CZOMlwHl.js";
16
+ import { a as ownershipRules, i as guardedTables, n as OWNERSHIP, t as ASSIGNMENTS } from "./rls-ownership-DcYlZ09B.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. */
@@ -1310,7 +1310,7 @@ function hookParts(scopes, config, overrides) {
1310
1310
  tenantClaim,
1311
1311
  users: suspension?.users,
1312
1312
  hook,
1313
- roles: hook.roles === false ? void 0 : globalRoleSource(hook.roles ?? config.rls?.roles ?? { table: `${schema}.user_roles` }, "public", "r"),
1313
+ roles: hook.roles === false ? void 0 : globalRoleSource(hook.roles ?? config.rls?.roles ?? { table: `${schema}.user_roles` }, "public", "r", config.rls?.customRoleWrites?.roles),
1314
1314
  active: activeFromSql(overrides.activeFrom ?? hook.activeFrom, root),
1315
1315
  attrs: hook.attrs === void 0 ? void 0 : attrsPlan(hook.attrs),
1316
1316
  extra: extraPlan.claims,
@@ -1,4 +1,4 @@
1
- import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.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-6sYLXg_u.js");
64
+ const { runSupabase } = await import("./supabase-hook-gd3s8bxB.js");
65
65
  ctx.report(await runSupabase({
66
66
  cwd: ctx.cwd,
67
67
  config: ctx.config,
@@ -1,4 +1,4 @@
1
- import { d as group, p as sqlStatements } from "./supabase-config-BpPXt3x1.js";
1
+ import { d as group, p as sqlStatements } from "./supabase-config-Bj3iDH2I.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,4 +1,4 @@
1
- import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-DSxCqG9A.js";
1
+ import { a as listArg, i as globalArgs, t as COMMAND_DESCRIPTIONS } from "./commands-BeaGNj_o.js";
2
2
  import { defineCommand } from "citty";
3
3
  //#region src/cli/commands/usage.ts
4
4
  function usage(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permdock",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",
@@ -1,2 +0,0 @@
1
- import { n as runPowerSync } from "./powersync-BylawD_U.js";
2
- export { runPowerSync };
@@ -1,2 +0,0 @@
1
- import { i as runSupabase } from "./supabase-hook-CSLQ4zJ3.js";
2
- export { runSupabase };