permdock 0.20.0 → 0.20.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 (60) hide show
  1. package/dist/{adoption-scan-BWL5H82_.js → adoption-scan-BTG9Noyy.js} +1 -1
  2. package/dist/{arazzo-C8u26FUA.js → arazzo-CDXfX4u0.js} +1 -1
  3. package/dist/{arazzo-B_CPVseu.js → arazzo-D4mKdaWI.js} +1 -1
  4. package/dist/{casbin-DaY-CWOr.js → casbin-BXlRcCdU.js} +1 -1
  5. package/dist/{casbin-JWZGKqzy.js → casbin-COUi09Ti.js} +1 -1
  6. package/dist/cli/bin.js +1 -1
  7. package/dist/cli/index.js +1 -1
  8. package/dist/{cloud-pEhjaPNs.js → cloud-BW7JKfrF.js} +1 -1
  9. package/dist/{codemod-BUhreN8m.js → codemod-6CBQaT0x.js} +2 -2
  10. package/dist/{codemod-Cv0-7Ogj.js → codemod-CR9EQBVd.js} +1 -1
  11. package/dist/{completion-BG1wcLJ3.js → completion-CYRlOJzv.js} +1 -1
  12. package/dist/{config-Di9kWoLY.js → config-6iLK155o.js} +1 -1
  13. package/dist/{config-report-B0IyW7EQ.js → config-report-BLroaWCe.js} +1 -1
  14. package/dist/{doctor-DpD4nHMS.js → doctor-CJcS0Mrq.js} +13 -13
  15. package/dist/{doctor-Bp3xspBi.js → doctor-DYTgibLC.js} +2 -2
  16. package/dist/{fields-COvJbUva.js → fields-D_TfExiI.js} +1 -1
  17. package/dist/{gen-CKr1Vfiz.js → gen-CH50v9VI.js} +1 -1
  18. package/dist/{gen-B2O9T25-.js → gen-gv_WHBIG.js} +1 -1
  19. package/dist/{import-DG6uswAo.js → import-BlwuuZkr.js} +1 -1
  20. package/dist/{import-DVI_1tO_.js → import-C2ExjVvv.js} +2 -2
  21. package/dist/{init-C-cgOvCl.js → init-B62H9Kyx.js} +1 -1
  22. package/dist/{init-DAPbdjcX.js → init-CalppFAI.js} +3 -3
  23. package/dist/{login-CQGjpkuo.js → login-MxQV1BLh.js} +3 -3
  24. package/dist/{login-Cgix5FgG.js → login-dDb_8muO.js} +1 -1
  25. package/dist/{manifest-CMu1IE0R.js → manifest-DvDzxhy6.js} +32 -32
  26. package/dist/{migrate-BbY5-Khy.js → migrate-CkLHdwuH.js} +1 -1
  27. package/dist/{openapi-lsf1gEtr.js → openapi-BkGtE5kX.js} +2 -2
  28. package/dist/{openapi-FVeCoh97.js → openapi-DKePsnln.js} +1 -1
  29. package/dist/{output-DZQCr2lP.js → output-B2h-2g3F.js} +1 -1
  30. package/dist/{ownership-CBuIjxKh.js → ownership-MGHa5vfX.js} +2 -2
  31. package/dist/{powersync-Dz4H1FLs.js → powersync-CB8RwcB4.js} +4 -4
  32. package/dist/powersync-Cs1E04s6.js +1 -0
  33. package/dist/{powersync-CRtuJXVB.js → powersync-Deim9O47.js} +2 -2
  34. package/dist/pull-BLT25Y5C.js +1 -0
  35. package/dist/{pull-DnhBA9pf.js → pull-BxqVL4Es.js} +1 -1
  36. package/dist/{resolve-names-CDnxNqNb.js → resolve-names-BZQZRnMH.js} +3 -3
  37. package/dist/{rls-CHZi5SUK.js → rls-DpoJ5gCg.js} +1 -1
  38. package/dist/{rls-CbDKv6GP.js → rls-OPorg_2G.js} +12 -12
  39. package/dist/run-CW0QsyA9.js +1 -0
  40. package/dist/{run-Bnm5VZ8m.js → run-YCpANf1B.js} +2 -2
  41. package/dist/{scan-VKkU4Ix9.js → scan-COvn7ZjN.js} +1 -1
  42. package/dist/{schema-5onstWlb.js → schema-BfSDo7Xj.js} +1 -1
  43. package/dist/{shared-DyYVEjKC.js → shared-sW3VYchq.js} +2 -1
  44. package/dist/{skills-B6sLqv4E.js → skills-Ce4C2dq1.js} +1 -1
  45. package/dist/{skills-Yz3LfoAZ.js → skills-N2Hd8KN8.js} +1 -1
  46. package/dist/supabase-hook-7XxWGHQF.js +1 -0
  47. package/dist/{supabase-hook-bDeWbKee.js → supabase-hook-BCSwK5x-.js} +11 -6
  48. package/dist/{supabase-CWpADE8k.js → supabase-zL7PC3RG.js} +2 -2
  49. package/dist/{supautils-0RrdsFT3.js → supautils-7UES0i4a.js} +67 -8
  50. package/dist/{tables-C53U2zrN.js → tables-DSX_Ma_n.js} +328 -67
  51. package/dist/{usage-BFMCEgJp.js → usage-BcAqmjkj.js} +1 -1
  52. package/dist/usage-BdIS9NfN.js +1 -0
  53. package/dist/{usage-B6gmS634.js → usage-CUnw73Y-.js} +2 -2
  54. package/dist/{verify-DFruUfZg.js → verify-V08pirDB.js} +5 -5
  55. package/package.json +1 -1
  56. package/dist/powersync-BV68Jh-T.js +0 -1
  57. package/dist/pull-AOmtUo8V.js +0 -1
  58. package/dist/run-D6U-Gwok.js +0 -1
  59. package/dist/supabase-hook-Clczf4iF.js +0 -1
  60. package/dist/usage-Csu-M5jC.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { s as cliVersion } from "./version-DMQ0dnN5.js";
2
- import { t as DOCS_BASE } from "./manifest-CMu1IE0R.js";
2
+ import { t as DOCS_BASE } from "./manifest-DvDzxhy6.js";
3
3
  //#region src/cli/core/output.ts
4
4
  const CLI_RESULT_SCHEMA = "https://permdock.com/schemas/cli-result-v1.json";
5
5
  function envelope(input) {
@@ -10,8 +10,8 @@ import { i as configError } from "./errors-BhRkoNS7.js";
10
10
  import { i as qualifySqlTable } from "./sql-0WjxIp9g.js";
11
11
  import { a as scopeMembershipTable, i as scopeColumn, s as relatedSql } from "./compile-B_oJqmIg.js";
12
12
  import { l as roleColumn } from "./sources-C4vkzZJV.js";
13
- import { A as quoteQualified, D as qualified, E as helperSchema, L as sqlType, M as textArrayLiteral, O as quoteIdent, R as tenantTypeOf, S as CLAIM, T as declaredArray, _ as subjectClaimJsonSql, b as tenantClaimSql, d as keyTenantSql, f as kindFilterSql, h as roleKindSql, j as quoteTable, k as quoteLiteral, m as memberVia, p as liveSessionSql, s as signedIn, t as CUSTOM_ROLES, u as globalKindFilterSql, v as subjectClaimSql, y as subjectIdSql } from "./shared-DyYVEjKC.js";
14
- import { $ as graphSqlText, A as claimKeptLines, B as hasCustomRoleChecksFor, F as globalRoleRows, I as membershipRows, L as roleRows, M as memberColumn, N as sourceFilters, P as sourcesKeep, U as storedTenant, X as CLOSURE, Z as graphHelper, _t as activeMembershipSql, c as holderSources, ct as memberIdsHelper, d as sourceRowsSql, f as sourceTransferTriggerSql, g as OWNERSHIP, gt as activeInstancesSql, h as ASSIGNMENTS, ht as scopeTable, it as linkHelper, j as disabledColumn, l as pairsSql, m as transferTriggerSql, mt as scopeSources, nt as inheritedRowsHelper, p as holdersTriggerSql, pt as restrictedHelper, st as memberForTable, u as sourceHoldersTriggerSql, ut as memberRoleOf, yt as activeUserSql } from "./tables-C53U2zrN.js";
13
+ import { A as quoteQualified, D as qualified, E as helperSchema, L as sqlType, M as textArrayLiteral, O as quoteIdent, R as tenantTypeOf, S as CLAIM, T as declaredArray, _ as subjectClaimJsonSql, b as tenantClaimSql, d as keyTenantSql, f as kindFilterSql, h as roleKindSql, j as quoteTable, k as quoteLiteral, m as memberVia, p as liveSessionSql, s as signedIn, t as CUSTOM_ROLES, u as globalKindFilterSql, v as subjectClaimSql, y as subjectIdSql } from "./shared-sW3VYchq.js";
14
+ import { $ as graphSqlText, A as claimKeptLines, B as hasCustomRoleChecksFor, F as globalRoleRows, I as membershipRows, L as roleRows, M as memberColumn, N as sourceFilters, P as sourcesKeep, U as storedTenant, X as CLOSURE, Z as graphHelper, _t as activeMembershipSql, c as holderSources, ct as memberIdsHelper, d as sourceRowsSql, f as sourceTransferTriggerSql, g as OWNERSHIP, gt as activeInstancesSql, h as ASSIGNMENTS, ht as scopeTable, it as linkHelper, j as disabledColumn, l as pairsSql, m as transferTriggerSql, mt as scopeSources, nt as inheritedRowsHelper, p as holdersTriggerSql, pt as restrictedHelper, st as memberForTable, u as sourceHoldersTriggerSql, ut as memberRoleOf, yt as activeUserSql } from "./tables-DSX_Ma_n.js";
15
15
  //#region src/cli/sql/conditions.ts
16
16
  const MAX_CLAIM_DEPTH = 8;
17
17
  /**
@@ -15,11 +15,11 @@ import { t as applyFiles } from "./files-CfiRtQ-m.js";
15
15
  import { i as fileDrift } from "./output-files-CM0BnH05.js";
16
16
  import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-Cemqurt8.js";
17
17
  import { n as pgConnector } from "./pg-Ddxsd5ZB.js";
18
- import { A as quoteQualified, O as quoteIdent, a as customRolesOn, t as CUSTOM_ROLES } from "./shared-DyYVEjKC.js";
19
- import { n as tableNameOf, r as tableNames } from "./tables-C53U2zrN.js";
20
- import { d as andConditions, l as collectGrants, o as assignableRoles, p as contextRefs, t as ownershipRules, u as roleNames } from "./ownership-CBuIjxKh.js";
18
+ import { A as quoteQualified, O as quoteIdent, a as customRolesOn, t as CUSTOM_ROLES } from "./shared-sW3VYchq.js";
19
+ import { n as tableNameOf, r as tableNames } from "./tables-DSX_Ma_n.js";
20
+ import { d as andConditions, l as collectGrants, o as assignableRoles, p as contextRefs, t as ownershipRules, u as roleNames } from "./ownership-MGHa5vfX.js";
21
21
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
22
- import { m as tableFor, t as canFixture } from "./verify-DFruUfZg.js";
22
+ import { m as tableFor, t as canFixture } from "./verify-V08pirDB.js";
23
23
  import { resolve } from "node:path";
24
24
  //#region src/cli/powersync/claims.ts
25
25
  /** The `/docs` section that explains why a claim stream needs a reconnect. */
@@ -0,0 +1 @@
1
+ export { n as runPowerSync } from "./powersync-CB8RwcB4.js";
@@ -14,7 +14,7 @@ const generate = defineLeaf({
14
14
  async run(ctx, { flags }) {
15
15
  const out = fileOut("powersync", flags.out);
16
16
  const from = given(flags.policy);
17
- const { runPowerSync } = await import("./powersync-BV68Jh-T.js");
17
+ const { runPowerSync } = await import("./powersync-Cs1E04s6.js");
18
18
  return runPowerSync({
19
19
  cwd: ctx.cwd,
20
20
  config: ctx.config,
@@ -45,7 +45,7 @@ const verify = defineLeaf({
45
45
  const db = await dbUrl(ctx, flags, { required: true });
46
46
  const fixtures = given(flags.fixtures);
47
47
  const from = given(flags.policy);
48
- const { runPowerSync } = await import("./powersync-BV68Jh-T.js");
48
+ const { runPowerSync } = await import("./powersync-Cs1E04s6.js");
49
49
  return runPowerSync({
50
50
  cwd: ctx.cwd,
51
51
  config: ctx.config,
@@ -0,0 +1 @@
1
+ export { n as runCloudPull } from "./pull-BxqVL4Es.js";
@@ -7,7 +7,7 @@ import { o as formatCatalogJson } from "./catalog-doc-nrgfbh8I.js";
7
7
  import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
8
8
  import { n as parseSupabaseManifest } from "./manifest-BdzBobNK.js";
9
9
  import { t as parseCatalog } from "./parse-CXTT7hBq.js";
10
- import { a as nonEmptyOr } from "./output-DZQCr2lP.js";
10
+ import { a as nonEmptyOr } from "./output-B2h-2g3F.js";
11
11
  import { t as POLICY_NOT_PUBLISHED } from "./problem-types-DSsRfONQ.js";
12
12
  import { n as httpRequest, t as authFailure } from "./http-DhMWeB_h.js";
13
13
  import { l as cloudUrl, n as cliRuntime, o as readAuth } from "./auth-j3Eu-j4h.js";
@@ -4,9 +4,9 @@ import { d as scopeList } from "./scopes-BSdYaGHs.js";
4
4
  import { i as configError } from "./errors-BhRkoNS7.js";
5
5
  import "./budget-BBCPDOGP.js";
6
6
  import "./sources-C4vkzZJV.js";
7
- import { A as quoteQualified, D as qualified, I as scopeTypeOf, O as quoteIdent } from "./shared-DyYVEjKC.js";
8
- import { F as globalRoleRows, Q as graphSqlName, Z as graphHelper, _ as PERMISSION_HELPERS, at as memberForHelper, c as holderSources, ct as memberIdsHelper, dt as permittedForHelper, ft as permittedIdsHelper, ht as scopeTable, lt as memberOfHelper, nt as inheritedRowsHelper, o as graphPlan, pt as restrictedHelper, r as tableNames, rt as isTeamScope, tt as hasPermittedUsers, v as checkName, x as permittedByPermissionHelper } from "./tables-C53U2zrN.js";
9
- import { t as FIELD_VIEWS } from "./fields-COvJbUva.js";
7
+ import { A as quoteQualified, D as qualified, I as scopeTypeOf, O as quoteIdent } from "./shared-sW3VYchq.js";
8
+ import { F as globalRoleRows, Q as graphSqlName, Z as graphHelper, _ as PERMISSION_HELPERS, at as memberForHelper, c as holderSources, ct as memberIdsHelper, dt as permittedForHelper, ft as permittedIdsHelper, ht as scopeTable, lt as memberOfHelper, nt as inheritedRowsHelper, o as graphPlan, pt as restrictedHelper, r as tableNames, rt as isTeamScope, tt as hasPermittedUsers, v as checkName, x as permittedByPermissionHelper } from "./tables-DSX_Ma_n.js";
9
+ import { t as FIELD_VIEWS } from "./fields-D_TfExiI.js";
10
10
  //#region src/cli/rls/permission-holders.ts
11
11
  /**
12
12
  * `permitted_<scope>_users(p_permission, p_id)`. Names are part of the SQL
@@ -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-CbDKv6GP.js")).runRls(input);
195
+ return (await import("./rls-OPorg_2G.js")).runRls(input);
196
196
  }
197
197
  const generate = defineLeaf({
198
198
  flags: {
@@ -11,22 +11,22 @@ import "./sources-C4vkzZJV.js";
11
11
  import { t as policyFromCatalog } from "./policy-from-catalog-CUNlpgz0.js";
12
12
  import { t as beforeFirst } from "./text-BMFRfBqc.js";
13
13
  import { i as INDEXES_MARKER, n as GRANTS_MARKER, o as SEEDS_MARKER, t as BACKFILL_MARKER } from "./markers-BeHZ4x9Q.js";
14
- import { a as nonEmptyOr } from "./output-DZQCr2lP.js";
14
+ import { a as nonEmptyOr } from "./output-B2h-2g3F.js";
15
15
  import { i as requirePeer, n as packageManagerOf, t as addLine } from "./peer-BuK9F53f.js";
16
16
  import { t as POLICY_NOT_PUBLISHED } from "./problem-types-DSsRfONQ.js";
17
- import { t as fetchProjectPolicy } from "./pull-DnhBA9pf.js";
17
+ import { t as fetchProjectPolicy } from "./pull-BxqVL4Es.js";
18
18
  import { n as MIGRATION_DIRS } from "./constants-DcJABbLW.js";
19
19
  import { a as isSeedsDirectory, c as parseSplit, d as seedsMigration, f as writeOutputFiles, l as partPath, n as dataMigrationFile, r as driftOf, u as pgDeltaPath } from "./output-files-CM0BnH05.js";
20
20
  import { t as connectPgPool } from "./pg-Ddxsd5ZB.js";
21
- import { b as rbacScaffold, d as resolveSchemas, f as schemasRefusal, o as supabaseHookSql, p as declarativeSql, s as approvalsSql, t as grantsLabel, u as isSupabaseSchemas, y as parseRbacAuthorize } from "./supabase-hook-bDeWbKee.js";
22
- import { A as quoteQualified, D as qualified$1, I as scopeTypeOf, O as quoteIdent$1, _ as subjectClaimJsonSql, c as SESSION_LIVE_HELPER, g as sessionLiveHelperSql, j as quoteTable, k as quoteLiteral, r as HELPERS, t as CUSTOM_ROLES, y as subjectIdSql } from "./shared-DyYVEjKC.js";
23
- import { C as accessSql, G as byKey, T as seedSql, Z as graphHelper, ct as memberIdsHelper, ft as permittedIdsHelper, ht as scopeTable, mt as scopeSources, r as tableNames, s as graphSql, w as helpersSql, x as permittedByPermissionHelper, y as permissionHelpersSql } from "./tables-C53U2zrN.js";
24
- import { c as breakGlassKey, i as assignmentSql, l as collectGrants, n as ownershipSql, s as breakGlassHolder } from "./ownership-CBuIjxKh.js";
21
+ import { b as rbacScaffold, d as resolveSchemas, f as schemasRefusal, o as supabaseHookSql, p as declarativeSql, s as approvalsSql, t as grantsLabel, u as isSupabaseSchemas, y as parseRbacAuthorize } from "./supabase-hook-BCSwK5x-.js";
22
+ import { A as quoteQualified, D as qualified$1, I as scopeTypeOf, O as quoteIdent$1, _ as subjectClaimJsonSql, c as SESSION_LIVE_HELPER, g as sessionLiveHelperSql, j as quoteTable, k as quoteLiteral, r as HELPERS, t as CUSTOM_ROLES, y as subjectIdSql } from "./shared-sW3VYchq.js";
23
+ import { C as accessSql, G as byKey, T as seedSql, Z as graphHelper, ct as memberIdsHelper, ft as permittedIdsHelper, ht as scopeTable, mt as scopeSources, r as tableNames, s as graphSql, w as helpersSql, x as permittedByPermissionHelper, y as permissionHelpersSql } from "./tables-DSX_Ma_n.js";
24
+ import { c as breakGlassKey, i as assignmentSql, l as collectGrants, n as ownershipSql, s as breakGlassHolder } from "./ownership-MGHa5vfX.js";
25
25
  import { a as splitUndiffed } from "./deciding-columns-NB4wcyBf.js";
26
- import { a as fieldViewsSql, c as ACTOR_MAY_WRITE, f as readOnlyActorKinds, i as fieldViews, l as actorMayWriteSql, n as columnGrantSql, o as rowBranches, p as readOnlyActorPolicies, r as columnRevokeSql, u as assemblePolicies } from "./fields-COvJbUva.js";
27
- import { n as permissionHoldersSql } from "./resolve-names-CDnxNqNb.js";
28
- import { _ as indexTargets, a as verifyResult, b as readTableIndexFacts, c as callsHelper, g as INDEX_COLUMNS_SQL, h as COLUMNS_SQL, i as verifyIgnores, l as helperCallKeys, m as tableFor, n as runRlsVerify, o as HELPER_TABLES, p as compileGrants, r as rlsFinding, v as indexesSql, y as pruneIndexTargets } from "./verify-DFruUfZg.js";
29
- import { a as buildContext, c as levelKeys, d as rebuildPlan, i as splitsPart, l as rowHelpersSql, n as generateOptions, o as CANDIDATES, r as isRefusal, s as inheritTargets, t as supautilsRejections, u as DROPPED_LIST } from "./supautils-0RrdsFT3.js";
26
+ import { a as fieldViewsSql, c as ACTOR_MAY_WRITE, f as readOnlyActorKinds, i as fieldViews, l as actorMayWriteSql, n as columnGrantSql, o as rowBranches, p as readOnlyActorPolicies, r as columnRevokeSql, u as assemblePolicies } from "./fields-D_TfExiI.js";
27
+ import { n as permissionHoldersSql } from "./resolve-names-BZQZRnMH.js";
28
+ import { _ as indexTargets, a as verifyResult, b as readTableIndexFacts, c as callsHelper, g as INDEX_COLUMNS_SQL, h as COLUMNS_SQL, i as verifyIgnores, l as helperCallKeys, m as tableFor, n as runRlsVerify, o as HELPER_TABLES, p as compileGrants, r as rlsFinding, v as indexesSql, y as pruneIndexTargets } from "./verify-V08pirDB.js";
29
+ import { a as buildContext, c as levelKeys, d as rebuildPlan, i as splitsPart, l as rowHelpersSql, n as generateOptions, o as CANDIDATES, r as isRefusal, s as inheritTargets, t as supautilsRejections, u as DROPPED_LIST } from "./supautils-7UES0i4a.js";
30
30
  import { readFileSync } from "node:fs";
31
31
  import { basename, delimiter, join } from "node:path";
32
32
  import { spawn } from "node:child_process";
@@ -2502,7 +2502,7 @@ async function migrate(input) {
2502
2502
  output: generated.output
2503
2503
  };
2504
2504
  await requirePeer(() => import("pgsql-parser"), "pgsql-parser", "permdock rls migrate", input.cwd, PGSQL_PARSER_MAJOR);
2505
- const { migrateTarget, runRlsMigrate } = await import("./migrate-BbY5-Khy.js");
2505
+ const { migrateTarget, runRlsMigrate } = await import("./migrate-CkLHdwuH.js");
2506
2506
  return runRlsMigrate({
2507
2507
  cwd: input.cwd,
2508
2508
  sql: input.sql,
@@ -2618,7 +2618,7 @@ async function runRls(input) {
2618
2618
  }
2619
2619
  case "import": {
2620
2620
  await requirePeer(() => import("pgsql-parser"), "pgsql-parser", "permdock rls import", input.cwd, PGSQL_PARSER_MAJOR);
2621
- const { runRlsImport } = await import("./import-DVI_1tO_.js");
2621
+ const { runRlsImport } = await import("./import-C2ExjVvv.js");
2622
2622
  return runRlsImport({
2623
2623
  cwd: input.cwd,
2624
2624
  config: input.config,
@@ -0,0 +1 @@
1
+ export { t as run } from "./run-YCpANf1B.js";
@@ -5,9 +5,9 @@ import { a as resolveCwd, i as readConfig } from "./config-D2oXUwos.js";
5
5
  import { t as beforeFirst } from "./text-BMFRfBqc.js";
6
6
  import { a as GLOBAL_FLAGS, i as suggestion, n as parseFlags, r as parseLeaf } from "./args-iafbHiXn.js";
7
7
  import { r as progressReporter, t as redact } from "./credentials-dkycUsY3.js";
8
- import { a as resolve, i as leaves, n as ROOT, r as SECTIONS, t as DOCS_BASE } from "./manifest-CMu1IE0R.js";
8
+ import { a as resolve, i as leaves, n as ROOT, r as SECTIONS, t as DOCS_BASE } from "./manifest-DvDzxhy6.js";
9
9
  import { t as createStyle } from "./style-Ds11Hmk4.js";
10
- import { i as githubAnnotations, n as envelope, o as sarifLog, t as dataOf } from "./output-DZQCr2lP.js";
10
+ import { i as githubAnnotations, n as envelope, o as sarifLog, t as dataOf } from "./output-B2h-2g3F.js";
11
11
  import { stripVTControlCharacters } from "node:util";
12
12
  import { existsSync, statSync } from "node:fs";
13
13
  import { createHash } from "node:crypto";
@@ -16,7 +16,7 @@ const scan = defineLeaf({
16
16
  }
17
17
  },
18
18
  async run(ctx, { flags }) {
19
- const { runAdoptionScan } = await import("./adoption-scan-BWL5H82_.js");
19
+ const { runAdoptionScan } = await import("./adoption-scan-BTG9Noyy.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 { r as isRecord } from "./compact-CAf557ZB.js";
2
2
  import { l as packageRoot } from "./version-DMQ0dnN5.js";
3
3
  import { t as DRAFT_PINS } from "./pins-nqarl3oE.js";
4
- import { a as nonEmptyOr } from "./output-DZQCr2lP.js";
4
+ import { a as nonEmptyOr } from "./output-B2h-2g3F.js";
5
5
  import { t as require__2020 } from "./2020-CJbO8Bvz.js";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { join } from "node:path";
@@ -288,7 +288,8 @@ function customRolesOn(rls) {
288
288
  */
289
289
  const HELPERS = {
290
290
  has: "permdock_has",
291
- hasFor: "permdock_has_for"
291
+ hasFor: "permdock_has_for",
292
+ tokenCurrent: "permdock_token_current"
292
293
  };
293
294
  /**
294
295
  * Objects `--custom-roles` adds next to the helpers. Names are part of the SQL
@@ -1,7 +1,7 @@
1
1
  import { t as defineLeaf } from "./command-L8EstFNm.js";
2
2
  import { t as checkFlag } from "./flags-BlmpmXoY.js";
3
3
  import { r as pick, t as CANCELLED } from "./prompt-BYc6drYW.js";
4
- import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-Yz3LfoAZ.js";
4
+ import { n as detectedAgents, r as runSkills, t as SKILL_AGENTS } from "./skills-N2Hd8KN8.js";
5
5
  //#region src/cli/commands/skills.ts
6
6
  const forFlag = { for: {
7
7
  type: "string",
@@ -2,7 +2,7 @@ import { t as byCodePoint } from "./compare-DTfyUunF.js";
2
2
  import { i as readJsonFile } from "./files-BSjrtIHw.js";
3
3
  import { l as packageRoot } from "./version-DMQ0dnN5.js";
4
4
  import { t as didYouMean } from "./args-iafbHiXn.js";
5
- import { a as nonEmptyOr } from "./output-DZQCr2lP.js";
5
+ import { a as nonEmptyOr } from "./output-B2h-2g3F.js";
6
6
  import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, writeFileSync } from "node:fs";
7
7
  import { basename, dirname, join, relative, resolve } from "node:path";
8
8
  import { pathToFileURL } from "node:url";
@@ -0,0 +1 @@
1
+ export { i as runSupabase } from "./supabase-hook-BCSwK5x-.js";
@@ -19,13 +19,13 @@ import { n as formatManifestJson, t as MANIFEST_FILE } from "./manifest-json-CAG
19
19
  import { n as MIGRATION_DIRS } from "./constants-DcJABbLW.js";
20
20
  import { f as writeOutputFiles, l as partPath, r as driftOf, u as pgDeltaPath } from "./output-files-CM0BnH05.js";
21
21
  import { n as pgConnector } from "./pg-Ddxsd5ZB.js";
22
- import { A as quoteQualified, D as qualified, F as firstScopeType, I as scopeTypeOf, O as quoteIdent, R as tenantTypeOf, a as customRolesOn, j as quoteTable, k as quoteLiteral, l as USER_ID_HELPER, r as HELPERS, y as subjectIdSql } from "./shared-DyYVEjKC.js";
23
- import { E as TOKEN_SCOPE_ALLOWS, J as apiKeyFields, K as API_KEY_ALLOWS, R as globalRoleSource, _ as PERMISSION_HELPERS, at as memberForHelper, b as permissionKeysForHelper, bt as checkSuspension, ct as memberIdsHelper, dt as permittedForHelper, et as hasMemberFor, ft as permittedIdsHelper, g as OWNERSHIP, h as ASSIGNMENTS, lt as memberOfHelper, ot as memberForSources, rt as isTeamScope, st as memberForTable, tt as hasPermittedUsers, ut as memberRoleOf, v as checkName, vt as activeRowSql, x as permittedByPermissionHelper } from "./tables-C53U2zrN.js";
24
- import { a as guardedTables, t as ownershipRules, u as roleNames } from "./ownership-CBuIjxKh.js";
22
+ import { A as quoteQualified, D as qualified, F as firstScopeType, I as scopeTypeOf, O as quoteIdent, R as tenantTypeOf, a as customRolesOn, j as quoteTable, k as quoteLiteral, l as USER_ID_HELPER, r as HELPERS, y as subjectIdSql } from "./shared-sW3VYchq.js";
23
+ import { E as TOKEN_SCOPE_ALLOWS, J as apiKeyFields, K as API_KEY_ALLOWS, R as globalRoleSource, _ as PERMISSION_HELPERS, at as memberForHelper, b as permissionKeysForHelper, bt as checkSuspension, ct as memberIdsHelper, dt as permittedForHelper, et as hasMemberFor, ft as permittedIdsHelper, g as OWNERSHIP, h as ASSIGNMENTS, lt as memberOfHelper, ot as memberForSources, rt as isTeamScope, st as memberForTable, tt as hasPermittedUsers, ut as memberRoleOf, v as checkName, vt as activeRowSql, x as permittedByPermissionHelper } from "./tables-DSX_Ma_n.js";
24
+ import { a as guardedTables, t as ownershipRules, u as roleNames } from "./ownership-MGHa5vfX.js";
25
25
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
26
26
  import { a as splitUndiffed, r as tableKey, t as decidingColumns } from "./deciding-columns-NB4wcyBf.js";
27
- import { c as ACTOR_MAY_WRITE, f as readOnlyActorKinds } from "./fields-COvJbUva.js";
28
- import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-CDnxNqNb.js";
27
+ import { c as ACTOR_MAY_WRITE, f as readOnlyActorKinds } from "./fields-D_TfExiI.js";
28
+ import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-BZQZRnMH.js";
29
29
  import { existsSync, readFileSync, readdirSync } from "node:fs";
30
30
  import { dirname, join, posix, resolve } from "node:path";
31
31
  //#region ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
@@ -3326,7 +3326,12 @@ as $$
3326
3326
  insert into ${versionTable} as v (user_id, version)
3327
3327
  select distinct u, 1 from unnest(p_users) u
3328
3328
  where u is not null and exists (select 1 from auth.users au where au.id = u)
3329
- on conflict (user_id) do update set version = v.version + 1
3329
+ on conflict (user_id) do update set version = v.version + 1;
3330
+ select set_config(
3331
+ 'permdock.m.gen',
3332
+ (coalesce(nullif(current_setting('permdock.m.gen', true), ''), '0')::int + 1)::text,
3333
+ true
3334
+ )
3330
3335
  $$;
3331
3336
  revoke execute on function ${bumpFor}(uuid[]) from public, anon, authenticated;
3332
3337
 
@@ -47,7 +47,7 @@ const hookGenerate = defineLeaf({
47
47
  const budget = given(flags.budget);
48
48
  const schema = given(flags.schema);
49
49
  const grantsOut = given(flags["grants-out"]);
50
- const { runSupabase } = await import("./supabase-hook-Clczf4iF.js");
50
+ const { runSupabase } = await import("./supabase-hook-7XxWGHQF.js");
51
51
  return runSupabase({
52
52
  cwd: ctx.cwd,
53
53
  config: ctx.config,
@@ -76,7 +76,7 @@ const inspect = defineLeaf({
76
76
  },
77
77
  async run(ctx, { flags }) {
78
78
  const out = flags.out === "" ? true : flags.out === "-" ? void 0 : flags.out;
79
- const { runSupabase } = await import("./supabase-hook-Clczf4iF.js");
79
+ const { runSupabase } = await import("./supabase-hook-7XxWGHQF.js");
80
80
  return runSupabase({
81
81
  cwd: ctx.cwd,
82
82
  config: ctx.config,
@@ -1,22 +1,23 @@
1
1
  import { c as listPermissions, u as renamedKeys } from "./permission-registry-B8tYxPIt.js";
2
- import { d as scopeList, s as resolveScope } from "./scopes-BSdYaGHs.js";
2
+ import { d as scopeList, l as scopeChain, s as resolveScope } from "./scopes-BSdYaGHs.js";
3
3
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
4
4
  import { l as policyLevels } from "./policy-CaAME-Rh.js";
5
5
  import { a as describeError, i as configError } from "./errors-BhRkoNS7.js";
6
6
  import "./budget-BBCPDOGP.js";
7
7
  import { d as sqlTextArray, i as qualifySqlTable } from "./sql-0WjxIp9g.js";
8
+ import { a as scopeMembershipTable, i as scopeColumn } from "./compile-B_oJqmIg.js";
8
9
  import { l as roleColumn } from "./sources-C4vkzZJV.js";
9
10
  import { t as beforeFirst } from "./text-BMFRfBqc.js";
10
11
  import { c as parseSplit } from "./output-files-CM0BnH05.js";
11
- import { x as resolveAuthorize } from "./supabase-hook-bDeWbKee.js";
12
- import { A as quoteQualified, C as parseMembershipsFlag, D as qualified, F as firstScopeType, O as quoteIdent, R as tenantTypeOf, a as customRolesOn, j as quoteTable, k as quoteLiteral, s as signedIn, t as CUSTOM_ROLES } from "./shared-DyYVEjKC.js";
13
- import { G as byKey, H as rolesTableScope, O as tokenScopesPlan, Q as graphSqlName, V as raiseSql, W as byCodeUnit, Y as apiKeysPlan, a as closureDepths, bt as checkSuspension, i as tablelessResources, o as graphPlan, r as tableNames, t as resolveVias, z as currentKeyExpr } from "./tables-C53U2zrN.js";
14
- import { o as assignableRoles, r as unsatisfiedKinds, t as ownershipRules, u as roleNames } from "./ownership-CBuIjxKh.js";
12
+ import { x as resolveAuthorize } from "./supabase-hook-BCSwK5x-.js";
13
+ import { A as quoteQualified, C as parseMembershipsFlag, D as qualified, F as firstScopeType, O as quoteIdent, R as tenantTypeOf, a as customRolesOn, j as quoteTable, k as quoteLiteral, s as signedIn, t as CUSTOM_ROLES } from "./shared-sW3VYchq.js";
14
+ import { G as byKey, H as rolesTableScope, O as tokenScopesPlan, Q as graphSqlName, V as raiseSql, W as byCodeUnit, Y as apiKeysPlan, a as closureDepths, bt as checkSuspension, i as tablelessResources, o as graphPlan, r as tableNames, t as resolveVias, z as currentKeyExpr } from "./tables-DSX_Ma_n.js";
15
+ import { o as assignableRoles, r as unsatisfiedKinds, t as ownershipRules, u as roleNames } from "./ownership-MGHa5vfX.js";
15
16
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
16
17
  import { i as group, o as sqlStatements } from "./deciding-columns-NB4wcyBf.js";
17
- import { d as orSql, h as branchClauses } from "./fields-COvJbUva.js";
18
- import { t as resolveNames } from "./resolve-names-CDnxNqNb.js";
19
- import { m as tableFor } from "./verify-DFruUfZg.js";
18
+ import { d as orSql, h as branchClauses } from "./fields-D_TfExiI.js";
19
+ import { t as resolveNames } from "./resolve-names-BZQZRnMH.js";
20
+ import { m as tableFor } from "./verify-V08pirDB.js";
20
21
  //#region src/cli/rls/custom-role-rebuild.ts
21
22
  const PREFIX = "PermDock CLI";
22
23
  /** A column of the roles-table row `r`. */
@@ -589,6 +590,62 @@ function roleMemberScopesOf(migrate) {
589
590
  const scopes = [...new Set(Object.values(migrate?.helpers ?? {}).flatMap((helper) => helper.form === "role" ? [helper.scope] : []))].toSorted();
590
591
  return scopes.length === 0 ? {} : { roleMemberScopes: scopes };
591
592
  }
593
+ function sameMap(left, right) {
594
+ const keys = Object.keys(left);
595
+ return keys.length === Object.keys(right).length && keys.every((key) => left[key] === right[key]);
596
+ }
597
+ function sameRoleOne(mapped, source) {
598
+ if (!("column" in source)) return false;
599
+ if (typeof mapped === "string") return source.column === mapped && !("through" in source) && !("map" in source);
600
+ if ("map" in mapped) return source.column === mapped.column && "map" in source && sameMap(source.map, mapped.map);
601
+ const [ref, id] = Object.entries(mapped.on)[0] ?? [];
602
+ if (ref === void 0 || id === void 0 || !("through" in source)) return false;
603
+ return source.column === ref && qualifySqlTable(source.through.table) === qualifySqlTable(mapped.through) && source.through.id === id && source.through.column === mapped.column && source.through.on === void 0;
604
+ }
605
+ function isRoleList(role) {
606
+ return Array.isArray(role);
607
+ }
608
+ function isManifestRoleList(role) {
609
+ return Array.isArray(role);
610
+ }
611
+ function sameRole(mapped, source) {
612
+ if (isRoleList(mapped)) return isManifestRoleList(source) && source.length === mapped.length && mapped.every((role, index) => {
613
+ const item = source[index];
614
+ return item !== void 0 && sameRoleOne(role, item);
615
+ });
616
+ return isManifestRoleList(source) ? false : sameRoleOne(mapped, source);
617
+ }
618
+ function sameVia(mapped, source) {
619
+ if (mapped === void 0) return source === void 0;
620
+ if (source === void 0 || typeof mapped === "string") return false;
621
+ return "value" in source && source.value === mapped.value;
622
+ }
623
+ function sameSource(table, scope, scopes, source) {
624
+ const manifest = source.sql.manifest;
625
+ const column = scopeColumn(table, scopes, scope);
626
+ if (column === void 0) return false;
627
+ if (qualifySqlTable(manifest.table) !== qualifySqlTable(table.table) || manifest.user.column !== table.user || "through" in manifest.user || manifest.id.column !== column || !("value" in manifest.scope) || manifest.scope.value !== scope || manifest.disabledAt?.column !== table.disabledAt || manifest.expiresAt?.column !== table.expiresAt || !sameVia(table.via, manifest.via) || source.sql.stream?.guard !== void 0) return false;
628
+ for (const name of scopeChain(scopes, scope)) {
629
+ if (name === scope) continue;
630
+ const held = scopeColumn(table, scopes, name);
631
+ const within = manifest.within;
632
+ if (held !== (within !== void 0 && "columns" in within ? within.columns[name] : void 0)) return false;
633
+ }
634
+ return sameRole(table.role, manifest.role);
635
+ }
636
+ function claimsFirstFor(input, authorize, scopes, memberships) {
637
+ const hook = input.config.supabase?.hook;
638
+ if (input.dialect !== "supabase" || authorize !== "database" || hook === void 0 || hook.version === false || hook.suspension !== void 0 || hook.schema !== void 0) return;
639
+ let mapped = false;
640
+ for (const scope of scopes) {
641
+ const table = scopeMembershipTable(memberships, scopes, scope.name);
642
+ if (table === void 0) continue;
643
+ mapped = true;
644
+ const source = hook.memberships.find((item) => item.sql.scope === scope.name);
645
+ if (source === void 0 || !sameSource(table, scope.name, scopes, source)) return;
646
+ }
647
+ return mapped ? true : void 0;
648
+ }
592
649
  /** `rls.customRoleWrites.requires` as permission keys, or why it names none. */
593
650
  function writeRequirement(policy, requires) {
594
651
  if (requires === void 0) return {};
@@ -649,6 +706,7 @@ function buildContext(input, policy, options) {
649
706
  const memberSources = membershipSourcesOf(input.config).map((source) => guard === void 0 ? source : source.guarded?.(guard) ?? source);
650
707
  const sources = authorize === "database" ? memberSources : void 0;
651
708
  const scopes = scopeList(policy.scopes);
709
+ const claimsFirst = claimsFirstFor(input, authorize, scopes, memberships);
652
710
  const suspension = checkSuspension(rls?.suspension, scopes);
653
711
  const hookRoles = input.config.supabase?.hook?.roles;
654
712
  const roles = rls?.roles ?? (hookRoles === false ? void 0 : hookRoles);
@@ -684,6 +742,7 @@ function buildContext(input, policy, options) {
684
742
  inlineFunctions: input.inlineFunctions || rls?.inlineFunctions === true,
685
743
  schema,
686
744
  authorize,
745
+ ...claimsFirst === void 0 ? {} : { claimsFirst },
687
746
  roleClaim: rls?.roleClaim ?? "user_role",
688
747
  tenantType: input.tenantType ?? firstScopeType(rls?.scopeTypes, scopes),
689
748
  ...rls?.scopeTypes === void 0 ? {} : { scopeTypes: rls.scopeTypes },