permdock 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adoption-scan-9brJ_mUG.js → adoption-scan-BJMEEu7V.js} +1 -1
- package/dist/{arazzo-Cs-3yoxR.js → arazzo-BAgh0PT6.js} +1 -1
- package/dist/{arazzo-C0bltfjv.js → arazzo-C_xK2Kaa.js} +1 -1
- package/dist/better-supabase/index.d.ts +26 -4
- package/dist/better-supabase/index.js +11 -2
- package/dist/{bsb-access-tags-B1TBUQLj.js → bsb-access-tags-CjeR7v7-.js} +10 -43
- package/dist/{bsb-action-keys-iKmZChtQ.js → bsb-action-keys-CYEREFMg.js} +1 -1
- package/dist/{casbin-DGsO-QmR.js → casbin-BErdqy1J.js} +1 -1
- package/dist/{casbin-s6_zDJi1.js → casbin-EwdKipQs.js} +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/watch-worker.js +2 -2
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +2 -2
- package/dist/cli/plugins/app.d.ts +1 -1
- package/dist/cli/plugins/app.js +1 -1
- package/dist/cli/plugins/better-supabase.d.ts +1 -1
- package/dist/cli/plugins/openapi.d.ts +1 -1
- package/dist/cli/plugins/openapi.js +1 -1
- package/dist/cli/plugins/powersync.d.ts +1 -1
- package/dist/cli/plugins/powersync.js +1 -1
- package/dist/cli/plugins/rls.d.ts +2 -2
- package/dist/cli/plugins/rls.js +1 -1
- package/dist/cli/plugins/schemas.d.ts +1 -1
- package/dist/cli/plugins/schemas.js +1 -1
- package/dist/cli/plugins/scim.d.ts +2 -2
- package/dist/cli/plugins/supabase-hook.d.ts +2 -2
- package/dist/cli/plugins/supabase-hook.js +1 -1
- package/dist/cli/plugins/supabase.d.ts +3 -3
- package/dist/cli/plugins/supabase.js +2 -2
- package/dist/cli/plugins/ui.d.ts +1 -1
- package/dist/cli/plugins/ui.js +1 -1
- package/dist/{client-subject-BOPbpwgm.d.ts → client-subject-xCSkKD1C.d.ts} +1 -1
- package/dist/{cloud-fRv3j6sq.js → cloud-DW3q3qnp.js} +2 -2
- package/dist/{codemod-DsqEKP6A.js → codemod-CF7NNDzA.js} +14 -11
- package/dist/{codemod-DT0dMVdd.js → codemod-DVDMFsTX.js} +8 -7
- package/dist/{collect-CCgmm5xN.js → collect-CE5wK0AX.js} +1 -1
- package/dist/{compile-DNVVdVWs.js → compile-BXKYYmT1.js} +3 -3
- package/dist/{completion-DrJkWgZa.js → completion-B59uPAnZ.js} +1 -1
- package/dist/{config-D8iWeV9k.js → config-7QvEq57a.js} +2 -2
- package/dist/{config-BaKkd6HB.js → config-VCa1RLUe.js} +1 -1
- package/dist/{config-report-uuD5eVEn.js → config-report-CjvA6lGI.js} +1 -1
- package/dist/{context-Ne0EdD45.js → context-CAFddgb9.js} +1 -1
- package/dist/{custom-role-rebuild-BBKC7Bt1.js → custom-role-rebuild-BK73tPib.js} +1 -1
- package/dist/{doctor-Ch4VGl2q.js → doctor-ELj5hrVv.js} +2 -2
- package/dist/{doctor-C1T2G2mn.js → doctor-ervtBRzG.js} +61 -33
- package/dist/{execute-BhWXiQAy.js → execute-ix7AAdWg.js} +3 -3
- package/dist/{gen-CGjbD8I_.js → gen-8rW_AUG5.js} +2 -2
- package/dist/gen-BtiGMiuH.js +1 -0
- package/dist/{gen-kind-thoT0NYV.js → gen-kind-C9ikF8nb.js} +1 -1
- package/dist/{generate-vEW8Brg8.js → generate-BmpCt5oi.js} +3 -3
- package/dist/{generate-eor7vXGN.js → generate-CW7gNfLr.js} +16 -12
- package/dist/{generate-options-MJgn0dgl.js → generate-options-DiR4r_sk.js} +7 -7
- package/dist/{hook-sql-DJQ_yOEC.js → hook-sql-D-abRHut.js} +5 -5
- package/dist/{import-CGQIK3iN.js → import-BAhoTYTk.js} +1 -1
- package/dist/{init-C6te_dSg.js → init-DkRHIe8-.js} +3 -3
- package/dist/{init-DN19mlwE.js → init-zxb0BVDJ.js} +1 -1
- package/dist/{interactive-only-BjYwp9mm.js → interactive-only-Dqww0ABO.js} +18 -1
- package/dist/{keys-qFqDoYeF.js → keys-DQsHrgBM.js} +1 -1
- package/dist/{login-BYXaH_yT.js → login-C1p3gmj8.js} +1 -1
- package/dist/{login-CMzfsdm8.js → login-DOEZveP6.js} +3 -3
- package/dist/{manager-chain-CStuYb7A.js → manager-chain-DdkiCw5q.js} +1 -1
- package/dist/{manifest-CowZuywo.js → manifest-31igzVGQ.js} +33 -33
- package/dist/{manifest-DdNYR_pl.js → manifest-B487A3po.js} +1 -1
- package/dist/{manifest-CA3E0KP8.d.ts → manifest-DgsxeAsM.d.ts} +38 -1
- package/dist/{manifest-schema-CLbcbDz7.js → manifest-schema-D7RQbnGY.js} +44 -1
- package/dist/{model-BqHWwfcg.js → model-BXhr8gUI.js} +1 -1
- package/dist/next/index.d.ts +2 -1
- package/dist/next/index.js +2 -1
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/{openapi-Dsh0MDSZ.js → openapi-BeMVHVY4.js} +1 -1
- package/dist/{openapi-BP7YpJeF.js → openapi-DEGesHWH.js} +1 -1
- package/dist/{openapi-document-_QSOtSKS.js → openapi-document-CEQ6jqqR.js} +1 -1
- package/dist/{output-Didy9Ys4.js → output-C7EPeSZj.js} +1 -1
- package/dist/{ownership-CG5_N8b5.js → ownership-Csk9C3Js.js} +8 -5
- package/dist/{pipeline-B4iyaOK7.js → pipeline-Bbu7uw28.js} +2 -2
- package/dist/{plugin-DQJuZVl1.d.ts → plugin-L3G7jPGE.d.ts} +1 -1
- package/dist/{policy-hnVT4MC4.js → policy-CSOOQ3rR.js} +1 -1
- package/dist/{policy-bundle-BIDV0DZF.js → policy-bundle-KYI0EnrM.js} +3 -3
- package/dist/{powersync-DUvN9v5a.js → powersync-C1ix7CEY.js} +1 -1
- package/dist/{powersync-D7YfMHke.js → powersync-CGvu6j5U.js} +1 -1
- package/dist/{powersync-_2ElzOhQ.js → powersync-CM6Vg4RH.js} +6 -6
- package/dist/{provider-D1vlNPWo.js → provider-BV_v0JAY.js} +18 -3
- package/dist/{prune-config-5vtQpiLk.js → prune-config-CdoPJIGz.js} +5 -5
- package/dist/{pull-BnxZmo3f.js → pull-BaB401Bk.js} +2 -2
- package/dist/pull-Bp63vtgu.js +1 -0
- package/dist/{push-Bu0uCkJg.js → push-DcjvEj0m.js} +1 -1
- package/dist/{rbac-CwcucZPx.js → rbac-mblGDx-Z.js} +1 -1
- package/dist/{rename-CLoDRrbc.js → rename-BZNOV8H9.js} +2 -2
- package/dist/report-DCAiUc5U.js +1 -0
- package/dist/{report-BI_hek_d.js → report-DievqWhf.js} +75 -5
- package/dist/{resolve-names-CTji5IPe.js → resolve-names-Cth1UQ-8.js} +2 -2
- package/dist/{rls-UY6p6ztg.js → rls-BtkZgaZp.js} +7 -2
- package/dist/{rls-BPHCyA5v.js → rls-DUYok5e9.js} +17 -7
- package/dist/{rls-files-CDZdTh8v.js → rls-files-ucAI0J5j.js} +1 -1
- package/dist/{rls-options-BgD-KZkm.d.ts → rls-options-BFGRmdcH.d.ts} +1 -1
- package/dist/run-BjMxYYTe.js +1 -0
- package/dist/{run-C3ztA88m.js → run-WIqPbnjD.js} +3 -3
- package/dist/{scan-m5m1M6Qn.js → scan-Badcllgg.js} +1 -1
- package/dist/{schema-BpGuLrwk.js → schema-DBRKgQb4.js} +1 -1
- package/dist/{skills-BytzDi34.js → skills-Ba9hHGO6.js} +1 -1
- package/dist/{skills-CzhnDo-C.js → skills-CTKq3o8D.js} +1 -1
- package/dist/{sources-D5n28164.d.ts → sources-CjgZns7t.d.ts} +1 -1
- package/dist/supabase/index.d.ts +3 -3
- package/dist/supabase/index.js +1 -1
- package/dist/{supabase-CAswAUeb.js → supabase-CGiB83XQ.js} +1 -1
- package/dist/supabase-hook-CluYxKee.js +2 -0
- package/dist/{supabase-hook-C0LIaT7b.js → supabase-hook-CqO_0Koh.js} +9 -183
- package/dist/{supabase-schemas-BUFeyErz.js → supabase-schemas-BglbAG2Z.js} +9 -8
- package/dist/table-reads-AnHPrBp8.js +517 -0
- package/dist/table-reads-BviGc0L_.js +1 -0
- package/dist/{tables-sLA1CpuN.js → tables-CDq0HVVq.js} +7 -4
- package/dist/tenant-check-D7g9oNVH.js +105 -0
- package/dist/testing/fixtures/index.d.ts +1 -1
- package/dist/testing/fixtures/index.js +14 -8
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{types-config-BiMM_zJ-.d.ts → types-config-DNIw_Gt5.d.ts} +1 -1
- package/dist/{types-run-N2ffLN_Z.d.ts → types-run-Bwn1MuW0.d.ts} +1 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-DT6QK86a.js → usage-CW6xhRcV.js} +2 -2
- package/dist/usage-Ci7Glu-H.js +1 -0
- package/dist/{usage-Dcbg6zu6.js → usage-n4V2k_a6.js} +1 -1
- package/dist/{verify-DNERav8K.js → verify-CKzngsUH.js} +3 -3
- package/dist/warm-5yxlUmBh.js +32 -0
- package/dist/warm-BR-mrnY-.d.ts +16 -0
- package/dist/{watch-BsQ4n3NV.js → watch-C12Ub7x4.js} +2 -2
- package/dist/{watch-fldErlRf.js → watch-D-5ztqN8.js} +1 -1
- package/dist/watch-J1PfGMfb.js +1 -0
- package/package.json +1 -1
- package/schemas/supabase-manifest-v1.json +109 -19
- package/skills/permdock-data/references/queries-and-rls.md +1 -1
- package/dist/gen-CkUEZ5Z6.js +0 -1
- package/dist/platform-CSxTsLsr.js +0 -35
- package/dist/pull-CGncYZNZ.js +0 -1
- package/dist/report-BevPHMy6.js +0 -1
- package/dist/run-3ySqmufy.js +0 -1
- package/dist/supabase-hook-DXGg5bNn.js +0 -2
- package/dist/tenant-check-gL2miiaS.js +0 -31
- package/dist/usage-DdOFc5xq.js +0 -1
- package/dist/watch-eay1PztJ.js +0 -1
|
@@ -8,7 +8,7 @@ const codemod = defineLeaf({
|
|
|
8
8
|
description: "The release to migrate to (0.5), config with --prune, manager-chain, bsb-access-tags or bsb-action-keys",
|
|
9
9
|
required: true,
|
|
10
10
|
async complete() {
|
|
11
|
-
return (await import("./codemod-
|
|
11
|
+
return (await import("./codemod-CF7NNDzA.js")).codemodVersions();
|
|
12
12
|
}
|
|
13
13
|
}, {
|
|
14
14
|
name: "paths",
|
|
@@ -27,13 +27,13 @@ const codemod = defineLeaf({
|
|
|
27
27
|
},
|
|
28
28
|
check: {
|
|
29
29
|
type: "boolean",
|
|
30
|
-
description: "With config --prune: exit 1 when a key would be removed"
|
|
30
|
+
description: "With config --prune: exit 1 when a key would be removed. With bsb-access-tags: write nothing, exit 1 when a table would move"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
async run(ctx, { flags, args, rest }) {
|
|
34
34
|
if (args["version"] === "config") {
|
|
35
35
|
if (!flags.prune) throw new CliError("usage", "codemod config needs --prune", { code: "invalid_value" });
|
|
36
|
-
return (await import("./prune-config-
|
|
36
|
+
return (await import("./prune-config-CdoPJIGz.js")).runPruneConfig({
|
|
37
37
|
cwd: ctx.cwd,
|
|
38
38
|
check: flags.check,
|
|
39
39
|
dryRun: flags["dry-run"],
|
|
@@ -41,27 +41,28 @@ const codemod = defineLeaf({
|
|
|
41
41
|
json: ctx.json
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
if (args["version"] === "bsb-access-tags") return (await import("./bsb-access-tags-
|
|
44
|
+
if (args["version"] === "bsb-access-tags") return (await import("./bsb-access-tags-CjeR7v7-.js")).runAccessTags({
|
|
45
45
|
cwd: ctx.cwd,
|
|
46
46
|
...rest[0] === void 0 ? {} : { schemas: rest[0] },
|
|
47
47
|
dryRun: flags["dry-run"],
|
|
48
|
+
check: flags.check,
|
|
48
49
|
force: flags.force,
|
|
49
50
|
json: ctx.json
|
|
50
51
|
});
|
|
51
|
-
if (args["version"] === "bsb-action-keys") return (await import("./bsb-action-keys-
|
|
52
|
+
if (args["version"] === "bsb-action-keys") return (await import("./bsb-action-keys-CYEREFMg.js")).runActionKeys({
|
|
52
53
|
cwd: ctx.cwd,
|
|
53
54
|
dryRun: flags["dry-run"],
|
|
54
55
|
force: flags.force,
|
|
55
56
|
json: ctx.json
|
|
56
57
|
});
|
|
57
|
-
if (args["version"] === "manager-chain") return (await import("./manager-chain-
|
|
58
|
+
if (args["version"] === "manager-chain") return (await import("./manager-chain-DdkiCw5q.js")).runManagerChain({
|
|
58
59
|
cwd: ctx.cwd,
|
|
59
60
|
...rest[0] === void 0 ? {} : { schemas: rest[0] },
|
|
60
61
|
dryRun: flags["dry-run"],
|
|
61
62
|
force: flags.force,
|
|
62
63
|
json: ctx.json
|
|
63
64
|
});
|
|
64
|
-
return (await import("./codemod-
|
|
65
|
+
return (await import("./codemod-CF7NNDzA.js")).runCodemod({
|
|
65
66
|
cwd: ctx.cwd,
|
|
66
67
|
version: args["version"],
|
|
67
68
|
paths: rest,
|
|
@@ -29,7 +29,7 @@ const collect = defineLeaf({
|
|
|
29
29
|
};
|
|
30
30
|
if (flags.watch) {
|
|
31
31
|
if (flags.check) throw new CliError("usage", "collect: --watch writes the catalog; drop --check", { code: "invalid_value" });
|
|
32
|
-
return (await import("./watch-
|
|
32
|
+
return (await import("./watch-J1PfGMfb.js")).watchCollect(ctx, overrides);
|
|
33
33
|
}
|
|
34
34
|
const result = await (await import("./collect-CIdE3FGC.js")).runCollect({
|
|
35
35
|
cwd: ctx.cwd,
|
|
@@ -11,13 +11,13 @@ import { l as isConditionRef, o as hasConditionOp } from "./refs-Cix9Zjis.js";
|
|
|
11
11
|
import { t as requiresApproval } from "./approval-required-B-R4Yw3J.js";
|
|
12
12
|
import { c as jsonSchemaOf } from "./catalog-doc-D4g3nyFB.js";
|
|
13
13
|
import { i as configError } from "./errors-DgLOqc6j.js";
|
|
14
|
-
import { F as capabilityAccessSql, L as apiKeyAllowsCall, S as accessSql, f as requiresSql, k as tokenScopeAllowsCall } from "./tables-
|
|
14
|
+
import { F as capabilityAccessSql, L as apiKeyAllowsCall, S as accessSql, f as requiresSql, k as tokenScopeAllowsCall } from "./tables-CDq0HVVq.js";
|
|
15
15
|
import { t as connectPgPool } from "./pg-DmS5ITHu.js";
|
|
16
|
-
import {
|
|
16
|
+
import { r as interactiveAllowsCall, ut as scopeTable } from "./interactive-only-Dqww0ABO.js";
|
|
17
17
|
import { a as quoteIdent, c as quoteTable, o as quoteLiteral } from "./quote-BKrTBbcH.js";
|
|
18
18
|
import { _ as validitySql, h as andSql, v as wrapSql } from "./fields-y_PSRCyJ.js";
|
|
19
19
|
import { _ as arrayColumnsOf, d as subjectClaimSql, u as subjectClaimJsonSql, v as columnTypesOf } from "./subject-CrldGifz.js";
|
|
20
|
-
import { c as breakGlassKey, f as compileConditionSql, l as collectGrants, m as sqlFunctionNames, p as contextRefs, s as breakGlassHolder } from "./rbac-
|
|
20
|
+
import { c as breakGlassKey, f as compileConditionSql, l as collectGrants, m as sqlFunctionNames, p as contextRefs, s as breakGlassHolder } from "./rbac-mblGDx-Z.js";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
// src/cli/rls/indexes.ts
|
|
23
23
|
/** Postgres truncates identifiers longer than this, in bytes. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as suggestion, o as GLOBAL_FLAGS } from "./args-BSpXxMnb.js";
|
|
2
2
|
import { t as defineLeaf } from "./command-9GAzSI7E.js";
|
|
3
|
-
import { a as resolve } from "./manifest-
|
|
3
|
+
import { a as resolve } from "./manifest-31igzVGQ.js";
|
|
4
4
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
5
5
|
// src/cli/core/completion.ts
|
|
6
6
|
const SHELLS = [
|
|
@@ -357,8 +357,8 @@ function betterSupabaseDefaults(config, betterSupabase, installed = false) {
|
|
|
357
357
|
* warns would silently stop doing its job.
|
|
358
358
|
*/
|
|
359
359
|
const REMOVED_KEYS = Object.freeze({
|
|
360
|
-
"doctor.waivers": "doctor.waivers moved into the doctor.baseline file in 0.
|
|
361
|
-
"doctor.ignore": "doctor.ignore moved into the doctor.baseline file in 0.
|
|
360
|
+
"doctor.waivers": "doctor.waivers moved into the doctor.baseline file in 0.31; run permdock codemod 0.31",
|
|
361
|
+
"doctor.ignore": "doctor.ignore moved into the doctor.baseline file in 0.31; run permdock codemod 0.31"
|
|
362
362
|
});
|
|
363
363
|
/** The message for a removed key at `path`, such as `doctor.waivers`. */
|
|
364
364
|
function removedKey(path) {
|
|
@@ -10,7 +10,7 @@ const config = defineLeaf({
|
|
|
10
10
|
...failOnFlag
|
|
11
11
|
},
|
|
12
12
|
async run(ctx, { flags }) {
|
|
13
|
-
const { runConfig } = await import("./config-report-
|
|
13
|
+
const { runConfig } = await import("./config-report-CjvA6lGI.js");
|
|
14
14
|
return runConfig({
|
|
15
15
|
cwd: ctx.cwd,
|
|
16
16
|
config: ctx.config,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./sources-DnjJPGfb.js";
|
|
2
2
|
import { t as catalogPath } from "./catalog-path-bG0XxHMu.js";
|
|
3
3
|
import { n as guessPermissions, t as barrelFile } from "./collect-CPimbkC5.js";
|
|
4
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
4
|
+
import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
|
|
5
5
|
import { r as CONFIG_REPORT_SCHEMA } from "./version-D-jWyJb9.js";
|
|
6
6
|
import { a as rel, t as defaultSrcPath } from "./files-DAR51W3J.js";
|
|
7
7
|
import { n as restatedDefaults, t as resolveConfig } from "./resolve-config-9NYYVc30.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as packageManagerOf } from "./peer-D77JpXe-.js";
|
|
2
|
-
import { c as readSupabaseConfig } from "./supabase-schemas-
|
|
2
|
+
import { c as readSupabaseConfig } from "./supabase-schemas-BglbAG2Z.js";
|
|
3
3
|
import { existsSync, readdirSync } from "node:fs";
|
|
4
4
|
import { join, relative } from "node:path";
|
|
5
5
|
// src/cli/generate/context.ts
|
|
@@ -6,7 +6,7 @@ import { t as beforeFirst } from "./text-D704xHVl.js";
|
|
|
6
6
|
import { C as tenantTypeOf } from "./subject-CrldGifz.js";
|
|
7
7
|
import { a as quoteIdent, c as quoteTable, i as qualified, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
8
8
|
import { t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
|
|
9
|
-
import {
|
|
9
|
+
import { B as rolesTableScope, P as currentKeyExpr } from "./interactive-only-Dqww0ABO.js";
|
|
10
10
|
// src/cli/rls/custom-role-rebuild.ts
|
|
11
11
|
const PREFIX = "PermDock CLI";
|
|
12
12
|
/** A column of the roles-table row `r`. */
|
|
@@ -11,7 +11,7 @@ const doctor = defineLeaf({
|
|
|
11
11
|
description: "Check codes or groups to run",
|
|
12
12
|
valueHint: "code",
|
|
13
13
|
async complete() {
|
|
14
|
-
const { DOCTOR_CHECKS } = await import("./doctor-
|
|
14
|
+
const { DOCTOR_CHECKS } = await import("./doctor-ervtBRzG.js");
|
|
15
15
|
return [.../* @__PURE__ */ new Set([...DOCTOR_CHECKS.map(({ code }) => code), ...DOCTOR_CHECKS.flatMap(({ groups }) => groups)])];
|
|
16
16
|
}
|
|
17
17
|
},
|
|
@@ -46,7 +46,7 @@ const doctor = defineLeaf({
|
|
|
46
46
|
if (answer === void 0) return CANCELLED;
|
|
47
47
|
fix = answer;
|
|
48
48
|
}
|
|
49
|
-
return (await import("./doctor-
|
|
49
|
+
return (await import("./doctor-ervtBRzG.js")).runDoctor({
|
|
50
50
|
cwd: ctx.cwd,
|
|
51
51
|
config: ctx.config,
|
|
52
52
|
only: flags.only,
|
|
@@ -2,32 +2,32 @@ import { c as rootScope, d as scopeList, o as normalizeMemberships, s as resolve
|
|
|
2
2
|
import { r as supabaseTenantClaim } from "./budget-BH81q2cj.js";
|
|
3
3
|
import { r as runCollect } from "./collect-CPimbkC5.js";
|
|
4
4
|
import { t as didYouMean } from "./args-BSpXxMnb.js";
|
|
5
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
6
|
-
import { o as nonEmptyOr, r as findingOf } from "./output-
|
|
5
|
+
import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
|
|
6
|
+
import { o as nonEmptyOr, r as findingOf } from "./output-C7EPeSZj.js";
|
|
7
7
|
import { t as createStyle } from "./style-CQDaLJtP.js";
|
|
8
8
|
import { i as DOCTOR_REPORT_SCHEMA } from "./version-D-jWyJb9.js";
|
|
9
|
-
import { a as rel,
|
|
9
|
+
import { a as rel, n as doctorSrcPath, o as sqlFiles$1, r as listSourceFiles } from "./files-DAR51W3J.js";
|
|
10
10
|
import { r as pgConnector } from "./pg-DmS5ITHu.js";
|
|
11
11
|
import { a as describeError, n as CliError } from "./errors-DgLOqc6j.js";
|
|
12
|
-
import { S as restatedFacts, _ as workspaceDirs, b as readJson, d as betterSupabaseAuthzVersions, f as betterSupabaseConfig, g as betterSupabaseTenantClaim, h as betterSupabaseInstalled, m as betterSupabaseDefaults, o as readParsedConfig, p as betterSupabaseConfigPath, t as configFileIn, u as BETTER_SUPABASE_AUTHZ_TOPIC, v as filesOf, x as membershipDisagreements, y as nodeFiles } from "./config-
|
|
12
|
+
import { S as restatedFacts, _ as workspaceDirs, b as readJson, d as betterSupabaseAuthzVersions, f as betterSupabaseConfig, g as betterSupabaseTenantClaim, h as betterSupabaseInstalled, m as betterSupabaseDefaults, o as readParsedConfig, p as betterSupabaseConfigPath, t as configFileIn, u as BETTER_SUPABASE_AUTHZ_TOPIC, v as filesOf, x as membershipDisagreements, y as nodeFiles } from "./config-7QvEq57a.js";
|
|
13
13
|
import { a as loadModule, i as loadConfiguredPolicy, n as asPolicy, s as pickNamed } from "./load-m7jmit3y.js";
|
|
14
|
-
import { i as runSkillsInstall } from "./skills-
|
|
14
|
+
import { i as runSkillsInstall } from "./skills-CTKq3o8D.js";
|
|
15
15
|
import { i as withSchemaDefaults, n as schemaDefaults, r as schemaTables } from "./schema-tables-Ba9LE_XB.js";
|
|
16
|
-
import { a as pd074, c as readSupabaseConfig, i as pd045, l as supabaseConfig, n as resolveSchemas, o as pd127, s as pd136, u as supabaseConfigName } from "./supabase-schemas-
|
|
17
|
-
import { d as activeSource, i as supabaseHookManifest, n as hooklessDatabase, p as attrsPlan, r as supabaseDatabaseManifest } from "./hook-sql-
|
|
18
|
-
import {
|
|
16
|
+
import { a as pd074, c as readSupabaseConfig, i as pd045, l as supabaseConfig, n as resolveSchemas, o as pd127, s as pd136, u as supabaseConfigName } from "./supabase-schemas-BglbAG2Z.js";
|
|
17
|
+
import { d as activeSource, i as supabaseHookManifest, n as hooklessDatabase, p as attrsPlan, r as supabaseDatabaseManifest } from "./hook-sql-D-abRHut.js";
|
|
18
|
+
import { i as pd039, t as hookOut } from "./supabase-hook-CqO_0Koh.js";
|
|
19
19
|
import { t as parseCatalog } from "./parse-CUqZ_lLC.js";
|
|
20
20
|
import { t as catalogPath } from "./catalog-path-bG0XxHMu.js";
|
|
21
21
|
import { n as bsbActions, t as answerOf } from "./bsb-actions-BHiyBxQZ.js";
|
|
22
22
|
import { c as outFiles } from "./output-files-8lfALMSU.js";
|
|
23
|
-
import { a as guardedTables, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-
|
|
23
|
+
import { a as guardedTables, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-Csk9C3Js.js";
|
|
24
24
|
import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-PCJiir_3.js";
|
|
25
25
|
import { n as membershipColumns, r as tableKey } from "./deciding-columns-DBZsrpdD.js";
|
|
26
26
|
import { a as parseSqlFile, c as readPolicy$1, d as sqlCalls, f as stringValues, h as sqlStatements, l as readRelation, o as parseSqlLenient, p as group, r as functionArgTypes, s as parseSqlStatements, t as SqlSyntaxError } from "./ast-Dnm2TOHN.js";
|
|
27
27
|
import { t as applyFiles } from "./files-DuV7wRim.js";
|
|
28
|
-
import { o as splitIgnored } from "./verify-
|
|
28
|
+
import { o as splitIgnored } from "./verify-CKzngsUH.js";
|
|
29
29
|
import { a as updatedBaseline, i as readBaseline, n as baselineText, t as applyBaseline } from "./baseline-file-BQoki1O_.js";
|
|
30
|
-
import { n as activeTenantMismatch, t as authorizationProvider } from "./provider-
|
|
30
|
+
import { n as activeTenantMismatch, t as authorizationProvider } from "./provider-BV_v0JAY.js";
|
|
31
31
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
32
32
|
import "./authz-topic-D8x24Jv-.js";
|
|
33
33
|
import { n as budgetBreaches, r as snapshotProbeOptions, t as breachText } from "./budgets-Dpumu_Dt.js";
|
|
@@ -35,9 +35,9 @@ import { a as nameOf, i as lineIndex, o as nodes, r as child, u as walk } from "
|
|
|
35
35
|
import { r as parseSync, t as createVisitor } from "./optional-CaQWp9HA.js";
|
|
36
36
|
import { t as canonicalJson } from "./canonical-json-BibZkXtE.js";
|
|
37
37
|
import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-D4g3nyFB.js";
|
|
38
|
-
import { a as pd015, i as pd014, n as ADAPTER_SPECIFIERS, o as runtimeSpecifiers, r as pd001, t as runUsage } from "./usage-
|
|
38
|
+
import { a as pd015, i as pd014, n as ADAPTER_SPECIFIERS, o as runtimeSpecifiers, r as pd001, t as runUsage } from "./usage-CW6xhRcV.js";
|
|
39
39
|
import { c as listPermissions, h as formerKeys } from "./permission-registry-DstT40VS.js";
|
|
40
|
-
import { t as resolveNames } from "./resolve-names-
|
|
40
|
+
import { t as resolveNames } from "./resolve-names-Cth1UQ-8.js";
|
|
41
41
|
import "./markers-C-kThnKN.js";
|
|
42
42
|
import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-T4GaBh9X.js";
|
|
43
43
|
import { s as parseCredential } from "./credential-D9in5keC.js";
|
|
@@ -53,33 +53,33 @@ import { t as operationCoverage } from "./coverage-C3jVYC9Y.js";
|
|
|
53
53
|
import { a as snapshotSize, r as mostPrivilegedRole, t as SNAPSHOT_BUDGET_BYTES } from "./snapshot-size-2fkXbCkP.js";
|
|
54
54
|
import { a as taggedPolicyId, o as taggedPolicyIds } from "./bsb-access-Bcw6GrQm.js";
|
|
55
55
|
import { t as membershipSourcesOf } from "./sources-BbSUNmFX.js";
|
|
56
|
-
import { a as ownedObjects, i as inReservedDir, o as shownKey, r as generatedByPermdock, s as withoutOwned, t as policyModel } from "./model-
|
|
56
|
+
import { a as ownedObjects, i as inReservedDir, o as shownKey, r as generatedByPermdock, s as withoutOwned, t as policyModel } from "./model-BXhr8gUI.js";
|
|
57
57
|
import { a as pd114, i as pd110, r as pd109 } from "./claims-size-BsSDVD5u.js";
|
|
58
58
|
import { t as importFromApp } from "./app-peer-BnMh5lqz.js";
|
|
59
|
-
import {
|
|
59
|
+
import { c as rlsReport, o as policiesFor } from "./report-DievqWhf.js";
|
|
60
60
|
import { a as scopeMembershipTable } from "./compile-BUKXrueE.js";
|
|
61
|
-
import { a as powersyncOut, c as streamOf, i as powersyncFiles, n as staleFiles, o as roleSources, s as scopeSourcesOf } from "./powersync-
|
|
61
|
+
import { a as powersyncOut, c as streamOf, i as powersyncFiles, n as staleFiles, o as roleSources, s as scopeSourcesOf } from "./powersync-CM6Vg4RH.js";
|
|
62
62
|
import { t as parseProgram } from "./program-CvarkLMS.js";
|
|
63
63
|
import { t as FIELD_VIEWS } from "./fields-y_PSRCyJ.js";
|
|
64
64
|
import { n as restatedDefaults } from "./resolve-config-9NYYVc30.js";
|
|
65
65
|
import { t as policyRowConditionKeys } from "./row-conditions-DwIJocfQ.js";
|
|
66
|
-
import { J as policyBundle, Q as graphPlan, i as tableNames, r as tableNameOf } from "./tables-
|
|
66
|
+
import { J as policyBundle, Q as graphPlan, i as tableNames, r as tableNameOf } from "./tables-CDq0HVVq.js";
|
|
67
67
|
import { n as byKey } from "./compare-8SNJN-9U.js";
|
|
68
|
-
import { a as tableFor, n as commandFor, o as unmappedActions, r as compileGrants, t as INFERRED_VERBS } from "./compile-
|
|
69
|
-
import { p as contextRefs } from "./rbac-
|
|
68
|
+
import { a as tableFor, n as commandFor, o as unmappedActions, r as compileGrants, t as INFERRED_VERBS } from "./compile-BXKYYmT1.js";
|
|
69
|
+
import { p as contextRefs } from "./rbac-mblGDx-Z.js";
|
|
70
70
|
import { c as rowConditionMessage, o as helperTablePolicies, r as ROW_CONDITION_FIX } from "./helper-calls-DHvgN9tr.js";
|
|
71
|
-
import {
|
|
71
|
+
import { K as graphSqlName } from "./interactive-only-Dqww0ABO.js";
|
|
72
72
|
import { t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
|
|
73
73
|
import { n as isSeeds } from "./seeds-Bs44UDS3.js";
|
|
74
74
|
import { r as FIXTURES_PATH, s as seedPathsLine } from "./seed-sql-CjF7u0aX.js";
|
|
75
|
-
import { i as buildContext, n as isRefusal, o as inheritTargets, t as generateOptions } from "./generate-options-
|
|
75
|
+
import { i as buildContext, n as isRefusal, o as inheritTargets, t as generateOptions } from "./generate-options-DiR4r_sk.js";
|
|
76
76
|
import { n as propertyKey } from "./edits-CqU8s2GC.js";
|
|
77
77
|
import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-FN4aY6-n.js";
|
|
78
78
|
import { t as supautilsRejections } from "./supautils-C85NuESf.js";
|
|
79
|
-
import { n as parseSupabaseManifest } from "./manifest-DdNYR_pl.js";
|
|
80
79
|
import { t as MANIFEST_FILE } from "./manifest-json-DMaBWmcG.js";
|
|
80
|
+
import { o as sharedFunctionsOf, r as manifestTableReads, t as committedManifest } from "./table-reads-AnHPrBp8.js";
|
|
81
81
|
import { isDeepStrictEqual } from "node:util";
|
|
82
|
-
import {
|
|
82
|
+
import { readFileSync } from "node:fs";
|
|
83
83
|
import { dirname, join, resolve } from "node:path";
|
|
84
84
|
import { pathToFileURL } from "node:url";
|
|
85
85
|
import { createRequire } from "node:module";
|
|
@@ -5291,15 +5291,6 @@ async function pd061(input) {
|
|
|
5291
5291
|
});
|
|
5292
5292
|
}
|
|
5293
5293
|
// src/cli/doctor/table-reads.ts
|
|
5294
|
-
function committed(cwd) {
|
|
5295
|
-
const path = join(cwd, MANIFEST_FILE);
|
|
5296
|
-
if (!existsSync(path)) return;
|
|
5297
|
-
try {
|
|
5298
|
-
return parseSupabaseManifest(readJsonFile(path));
|
|
5299
|
-
} catch {
|
|
5300
|
-
return;
|
|
5301
|
-
}
|
|
5302
|
-
}
|
|
5303
5294
|
/**
|
|
5304
5295
|
* PD128: `permdock.manifest.json` marks a table `tenant` in `rls.tableReads`,
|
|
5305
5296
|
* and the select policies the schema files, migrations and `rls.out` define now
|
|
@@ -5307,7 +5298,7 @@ function committed(cwd) {
|
|
|
5307
5298
|
* who read different rows.
|
|
5308
5299
|
*/
|
|
5309
5300
|
async function pd128(input) {
|
|
5310
|
-
const manifest =
|
|
5301
|
+
const manifest = committedManifest(input.cwd);
|
|
5311
5302
|
const recorded = manifest?.rls.tableReads;
|
|
5312
5303
|
if (manifest === void 0 || recorded === void 0) return [];
|
|
5313
5304
|
const current = await manifestTableReads(input.cwd, input.config, manifest);
|
|
@@ -5326,6 +5317,38 @@ async function pd128(input) {
|
|
|
5326
5317
|
}];
|
|
5327
5318
|
});
|
|
5328
5319
|
}
|
|
5320
|
+
/**
|
|
5321
|
+
* PD137: `permdock.manifest.json` lists a function in `rls.sharedFunctions`,
|
|
5322
|
+
* and the schema files now define it so that better-supabase's BS430 would
|
|
5323
|
+
* refuse it: it reads a `row` table, reads the caller, is no longer `stable`
|
|
5324
|
+
* and `security invoker`, or no longer exists. A tenant cache entry that calls
|
|
5325
|
+
* it would be served to callers who read different rows.
|
|
5326
|
+
*/
|
|
5327
|
+
async function pd137(input) {
|
|
5328
|
+
const manifest = committedManifest(input.cwd);
|
|
5329
|
+
const recorded = manifest?.rls.sharedFunctions;
|
|
5330
|
+
if (manifest === void 0 || recorded === void 0 || recorded.length === 0) return [];
|
|
5331
|
+
const reads = await manifestTableReads(input.cwd, input.config, manifest);
|
|
5332
|
+
const now = new Map(reads.map((read) => [read.table, read]));
|
|
5333
|
+
const valid = new Set((await sharedFunctionsOf({
|
|
5334
|
+
cwd: input.cwd,
|
|
5335
|
+
config: input.config,
|
|
5336
|
+
schema: manifest.rls.schema,
|
|
5337
|
+
tableReads: reads
|
|
5338
|
+
})).map((entry) => entry.function));
|
|
5339
|
+
return recorded.flatMap((entry) => {
|
|
5340
|
+
if (valid.has(entry.function)) return [];
|
|
5341
|
+
const rows = entry.tables.filter((table) => now.get(table)?.share !== "tenant");
|
|
5342
|
+
const why = rows.length > 0 ? `it reads ${rows.join(", ")}, which ${rows.length === 1 ? "is" : "are"} not a tenant table` : "the schema files no longer define it as a stable, security invoker SQL function that reads no caller";
|
|
5343
|
+
return [{
|
|
5344
|
+
code: "PD137",
|
|
5345
|
+
severity: "error",
|
|
5346
|
+
target: `${MANIFEST_FILE}:rls.sharedFunctions:${entry.function}`,
|
|
5347
|
+
message: `${MANIFEST_FILE} lists ${entry.function} in rls.sharedFunctions, but ${why}`,
|
|
5348
|
+
fix: "run permdock supabase inspect --out to rewrite the list, or restore the function"
|
|
5349
|
+
}];
|
|
5350
|
+
});
|
|
5351
|
+
}
|
|
5329
5352
|
const DOCTOR_CHECKS = [
|
|
5330
5353
|
{
|
|
5331
5354
|
code: "PD001",
|
|
@@ -5975,6 +5998,11 @@ const DOCTOR_CHECKS = [
|
|
|
5975
5998
|
groups: ["rls", "supabase"],
|
|
5976
5999
|
run: pd128
|
|
5977
6000
|
},
|
|
6001
|
+
{
|
|
6002
|
+
code: "PD137",
|
|
6003
|
+
groups: ["rls", "supabase"],
|
|
6004
|
+
run: pd137
|
|
6005
|
+
},
|
|
5978
6006
|
{
|
|
5979
6007
|
code: "PD125",
|
|
5980
6008
|
groups: ["supabase", "sql"],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as budgetBreaches, t as breachText } from "./budgets-Dpumu_Dt.js";
|
|
2
2
|
import { a as suggestion } from "./args-BSpXxMnb.js";
|
|
3
3
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
4
|
-
import { r as runGen } from "./gen-
|
|
4
|
+
import { r as runGen } from "./gen-8rW_AUG5.js";
|
|
5
5
|
import { c as requirePolicy } from "./load-m7jmit3y.js";
|
|
6
|
-
import { t as projectContext } from "./context-
|
|
7
|
-
import { r as runGenerate } from "./pipeline-
|
|
6
|
+
import { t as projectContext } from "./context-CAFddgb9.js";
|
|
7
|
+
import { r as runGenerate } from "./pipeline-Bbu7uw28.js";
|
|
8
8
|
import { n as isPermDockPlugin } from "./plugin-MQVfUBUS.js";
|
|
9
9
|
import { relative, resolve } from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -13,7 +13,7 @@ import { c as listPermissions } from "./permission-registry-DstT40VS.js";
|
|
|
13
13
|
import { d as scopeList } from "./scopes-B-KX9EI8.js";
|
|
14
14
|
import { o as listPlans, s as listRoles } from "./vocabulary-CE2k7s1a.js";
|
|
15
15
|
import { c as jsonSchemaOf } from "./catalog-doc-D4g3nyFB.js";
|
|
16
|
-
import { t as resolveNames } from "./resolve-names-
|
|
16
|
+
import { t as resolveNames } from "./resolve-names-Cth1UQ-8.js";
|
|
17
17
|
import { t as DESCRIBE_TITLES } from "./describe-B7EosIKA.js";
|
|
18
18
|
import { i as schemaExpression } from "./generate-5_kz2309.js";
|
|
19
19
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -401,7 +401,7 @@ function modelDigest(model) {
|
|
|
401
401
|
return createHash("sha256").update(canonicalJson(model)).digest("base64url");
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
404
|
-
* `// @generated by permdock generate zod@0.
|
|
404
|
+
* `// @generated by permdock generate zod@0.32.0 from policy.ts sha-256:…; do
|
|
405
405
|
* not edit`.
|
|
406
406
|
*/
|
|
407
407
|
function generatedHeader(kind, info) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as renderKinds } from "./gen-8rW_AUG5.js";
|
|
@@ -47,7 +47,7 @@ function kindPlugin(kind, options = {}) {
|
|
|
47
47
|
}],
|
|
48
48
|
emit: async (_task, model, source) => {
|
|
49
49
|
if (source === void 0) return [];
|
|
50
|
-
const { renderKinds } = await import("./gen-
|
|
50
|
+
const { renderKinds } = await import("./gen-BtiGMiuH.js");
|
|
51
51
|
const files = await renderKinds({
|
|
52
52
|
cwd: source.cwd,
|
|
53
53
|
config: source.config,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as defineLeaf } from "./command-9GAzSI7E.js";
|
|
2
2
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
3
3
|
import { c as generateFlags, f as policyFlag, i as dryRunFlag, n as dbUrl, r as dbUrlFlags, t as checkFlag } from "./flags-DQzNPxg1.js";
|
|
4
|
-
import { t as executeGenerate } from "./execute-
|
|
5
|
-
import { n as receiptRows } from "./pipeline-
|
|
4
|
+
import { t as executeGenerate } from "./execute-ix7AAdWg.js";
|
|
5
|
+
import { n as receiptRows } from "./pipeline-Bbu7uw28.js";
|
|
6
6
|
// src/cli/commands/generate.ts
|
|
7
7
|
function concurrencyFlag(value) {
|
|
8
8
|
if (value === void 0 || value === "") return;
|
|
@@ -24,7 +24,7 @@ const generate = defineLeaf({
|
|
|
24
24
|
const db = await dbUrl(ctx, flags);
|
|
25
25
|
const policy = flags.policy !== void 0 && flags.policy !== "" ? flags.policy : ctx.config.policy;
|
|
26
26
|
if (flags.watch) {
|
|
27
|
-
const { watchGenerate } = await import("./watch-
|
|
27
|
+
const { watchGenerate } = await import("./watch-C12Ub7x4.js");
|
|
28
28
|
return watchGenerate(ctx, {
|
|
29
29
|
...policy === void 0 ? {} : { policy },
|
|
30
30
|
only: flags.only,
|
|
@@ -6,33 +6,33 @@ import { r as isRecord, t as compact } from "./compact-C4LFuqbW.js";
|
|
|
6
6
|
import { n as supabaseDir } from "./supabase-dir-0lxKbrYu.js";
|
|
7
7
|
import { a as parseSqlFile, f as stringValues, g as statementRanges, l as readRelation, m as splitUndiffed, o as parseSqlLenient, t as SqlSyntaxError } from "./ast-Dnm2TOHN.js";
|
|
8
8
|
import { n as loadBsbSql, r as schemaSqlFiles } from "./bsb-access-Bcw6GrQm.js";
|
|
9
|
-
import { $ as graphSql, D as seedSql, N as guardAuthAdminGrants, P as unguardAuthAdminGrants, S as accessSql, T as helpersSql, Y as closureBackfillSql, c as permissionHelpersSql, d as permittedByPermissionHelper, i as tableNames, o as PERMISSION_HELPERS, r as tableNameOf, s as checkName, u as permissionKeysHelper } from "./tables-
|
|
9
|
+
import { $ as graphSql, D as seedSql, N as guardAuthAdminGrants, P as unguardAuthAdminGrants, S as accessSql, T as helpersSql, Y as closureBackfillSql, c as permissionHelpersSql, d as permittedByPermissionHelper, i as tableNames, o as PERMISSION_HELPERS, r as tableNameOf, s as checkName, u as permissionKeysHelper } from "./tables-CDq0HVVq.js";
|
|
10
10
|
import { i as qualifySqlTable } from "./sql-T4GaBh9X.js";
|
|
11
|
-
import { a as tableFor, d as pruneIndexTargets, f as readTableIndexFacts, i as inferredCommand, l as indexTargets, r as compileGrants, u as indexesSql } from "./compile-
|
|
12
|
-
import { a as CANDIDATES, c as rowHelpersSql, i as buildContext, l as rowSetSql, n as isRefusal, o as inheritTargets, r as splitsPart, s as levelKeys, t as generateOptions } from "./generate-options-
|
|
11
|
+
import { a as tableFor, d as pruneIndexTargets, f as readTableIndexFacts, i as inferredCommand, l as indexTargets, r as compileGrants, u as indexesSql } from "./compile-BXKYYmT1.js";
|
|
12
|
+
import { a as CANDIDATES, c as rowHelpersSql, i as buildContext, l as rowSetSql, n as isRefusal, o as inheritTargets, r as splitsPart, s as levelKeys, t as generateOptions } from "./generate-options-DiR4r_sk.js";
|
|
13
13
|
import { t as policyFromCatalog } from "./policy-from-catalog-_zwn1sNj.js";
|
|
14
|
-
import { t as fetchProjectPolicy } from "./pull-
|
|
14
|
+
import { t as fetchProjectPolicy } from "./pull-BaB401Bk.js";
|
|
15
15
|
import { c as requirePolicy } from "./load-m7jmit3y.js";
|
|
16
|
-
import { o as nonEmptyOr } from "./output-
|
|
16
|
+
import { o as nonEmptyOr } from "./output-C7EPeSZj.js";
|
|
17
17
|
import { i as INDEXES_MARKER, n as GRANTS_MARKER, o as SEEDS_MARKER, t as BACKFILL_MARKER } from "./markers-C-kThnKN.js";
|
|
18
|
-
import {
|
|
18
|
+
import { G as graphHelper, K as graphSqlName, U as BOOTSTRAP_PERMISSIONS, lt as scopeSources, rt as memberIdsHelper, st as permittedIdsHelper, ut as scopeTable } from "./interactive-only-Dqww0ABO.js";
|
|
19
19
|
import { a as quoteIdent, c as quoteTable, i as qualified$1, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
20
20
|
import { b as idTypeOf, f as subjectIdSql, l as sessionLiveHelperSql, t as SESSION_LIVE_HELPER, u as subjectClaimJsonSql, x as scopeTypeOf } from "./subject-CrldGifz.js";
|
|
21
|
-
import { a as supabaseHookSql, c as asideAuthzReceive, f as declarativeSql, t as grantsLabel, u as approvalsSql } from "./hook-sql-
|
|
22
|
-
import { i as assignmentSql, n as ownershipSql } from "./ownership-
|
|
23
|
-
import { r as rebuildPlan, t as DROPPED_LIST } from "./custom-role-rebuild-
|
|
21
|
+
import { a as supabaseHookSql, c as asideAuthzReceive, f as declarativeSql, t as grantsLabel, u as approvalsSql } from "./hook-sql-D-abRHut.js";
|
|
22
|
+
import { i as assignmentSql, n as ownershipSql } from "./ownership-Csk9C3Js.js";
|
|
23
|
+
import { r as rebuildPlan, t as DROPPED_LIST } from "./custom-role-rebuild-BK73tPib.js";
|
|
24
24
|
import { p as scopeField } from "./tenancy-B5Xxt9Sc.js";
|
|
25
|
-
import { c as breakGlassKey, i as rbacScaffold, l as collectGrants, s as breakGlassHolder } from "./rbac-
|
|
25
|
+
import { c as breakGlassKey, i as rbacScaffold, l as collectGrants, s as breakGlassHolder } from "./rbac-mblGDx-Z.js";
|
|
26
26
|
import { t as supautilsRejections } from "./supautils-C85NuESf.js";
|
|
27
27
|
import { a as fieldViewsSql, c as ACTOR_MAY_WRITE, d as assemblePolicies, i as fieldViews, l as actorMayWriteCall, m as readOnlyActorPolicies, n as columnGrantSql, o as rowBranches, p as readOnlyActorKinds, r as columnRevokeSql, u as actorMayWriteSql } from "./fields-y_PSRCyJ.js";
|
|
28
28
|
import { l as isFieldRelation } from "./resource-relations-Ck5sjYQR.js";
|
|
29
29
|
import { c as rootScope } from "./scopes-B-KX9EI8.js";
|
|
30
30
|
import { o as rootName, r as HELPERS, t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
|
|
31
|
-
import { n as permissionHoldersSql } from "./resolve-names-
|
|
31
|
+
import { n as permissionHoldersSql } from "./resolve-names-Cth1UQ-8.js";
|
|
32
32
|
import { n as byKey } from "./compare-8SNJN-9U.js";
|
|
33
33
|
import { i as dateAt } from "./time-r0CKBm57.js";
|
|
34
34
|
import { _ as writeOutputFiles, a as isSeedsDirectory, d as pgDeltaPath, g as underSchemaDir, h as serviceRel, l as parseSplit, m as seedsMigration, n as dataMigrationFile, p as seedDeltaNote, r as driftOf, u as partPath } from "./output-files-8lfALMSU.js";
|
|
35
|
-
import { c as readSupabaseConfig, n as resolveSchemas } from "./supabase-schemas-
|
|
35
|
+
import { c as readSupabaseConfig, n as resolveSchemas } from "./supabase-schemas-BglbAG2Z.js";
|
|
36
36
|
import { o as sqlFiles } from "./files-DAR51W3J.js";
|
|
37
37
|
import { n as MIGRATION_DIRS } from "./constants-PCJiir_3.js";
|
|
38
38
|
import { readFileSync } from "node:fs";
|
|
@@ -305,6 +305,10 @@ function describeExplain(explain) {
|
|
|
305
305
|
lines.push("", "@bsb access policies (rendered by better-supabase):");
|
|
306
306
|
for (const policy of explain.tagged) lines.push(` ${policy.name} on ${policy.table} (${policy.operation}): ${policy.tenantColumn} in the ids of ${policy.key}`);
|
|
307
307
|
}
|
|
308
|
+
if (explain.rowTables !== void 0) {
|
|
309
|
+
lines.push("", "tables read per user (share: row):");
|
|
310
|
+
for (const table of explain.rowTables) lines.push(` ${table.table}: ${table.rules.join(", ")}${table.reason === void 0 ? "" : `; ${table.reason}`}`);
|
|
311
|
+
}
|
|
308
312
|
return lines.join("\n");
|
|
309
313
|
}
|
|
310
314
|
// src/cli/rls/generate-load.ts
|
|
@@ -14,13 +14,13 @@ import { l as parseSplit } from "./output-files-8lfALMSU.js";
|
|
|
14
14
|
import { f as orSql, g as branchClauses } from "./fields-y_PSRCyJ.js";
|
|
15
15
|
import { b as idTypeOf, f as subjectIdSql, g as parseMembershipsFlag, n as USER_ID_HELPER, x as scopeTypeOf, y as firstScopeType } from "./subject-CrldGifz.js";
|
|
16
16
|
import { a as customRolesOn, r as HELPERS, s as signedIn, t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
|
|
17
|
-
import {
|
|
18
|
-
import { A as tokenScopeUnlimitedSql, B as apiKeyUnlimitedSql, E as memoReadsSql, I as API_KEY_ALLOWS, M as memoReadTriggersSql, O as TOKEN_SCOPE_ALLOWS, Q as graphPlan, R as apiKeyClaimSql, V as apiKeysPlan, X as closureDepths, Z as graphIdsSql, a as tablelessResources, d as permittedByPermissionHelper, i as tableNames, j as tokenScopesPlan, n as resolveVias, o as PERMISSION_HELPERS, t as checkSharedTables } from "./tables-
|
|
19
|
-
import { t as resolveNames } from "./resolve-names-
|
|
20
|
-
import { a as resolveAuthorize, o as assignableRoles, u as roleNames } from "./rbac-
|
|
21
|
-
import {
|
|
22
|
-
import { r as
|
|
23
|
-
import {
|
|
17
|
+
import { K as graphSqlName, R as raiseSql, a as interactiveOnlyKeys, c as memoUserSql, g as memoHitList, ht as checkSuspension, v as memoizedSetofSql, y as memoizes } from "./interactive-only-Dqww0ABO.js";
|
|
18
|
+
import { A as tokenScopeUnlimitedSql, B as apiKeyUnlimitedSql, E as memoReadsSql, I as API_KEY_ALLOWS, M as memoReadTriggersSql, O as TOKEN_SCOPE_ALLOWS, Q as graphPlan, R as apiKeyClaimSql, V as apiKeysPlan, X as closureDepths, Z as graphIdsSql, a as tablelessResources, d as permittedByPermissionHelper, i as tableNames, j as tokenScopesPlan, n as resolveVias, o as PERMISSION_HELPERS, t as checkSharedTables } from "./tables-CDq0HVVq.js";
|
|
19
|
+
import { t as resolveNames } from "./resolve-names-Cth1UQ-8.js";
|
|
20
|
+
import { a as resolveAuthorize, o as assignableRoles, u as roleNames } from "./rbac-mblGDx-Z.js";
|
|
21
|
+
import { a as tableFor } from "./compile-BXKYYmT1.js";
|
|
22
|
+
import { r as rebuildPlan, t as DROPPED_LIST } from "./custom-role-rebuild-BK73tPib.js";
|
|
23
|
+
import { r as unsatisfiedKinds, t as ownershipRules } from "./ownership-Csk9C3Js.js";
|
|
24
24
|
// src/cli/rls/custom-role-sync.ts
|
|
25
25
|
/**
|
|
26
26
|
* `rls.customRoles.from.sync: 'trigger'`: after-row triggers on the legacy
|
|
@@ -19,11 +19,11 @@ import { m as splitUndiffed } from "./ast-Dnm2TOHN.js";
|
|
|
19
19
|
import { c as ACTOR_MAY_WRITE, p as readOnlyActorKinds } from "./fields-y_PSRCyJ.js";
|
|
20
20
|
import { C as tenantTypeOf, S as sqlType, f as subjectIdSql, n as USER_ID_HELPER, w as userTypeOf, x as scopeTypeOf, y as firstScopeType } from "./subject-CrldGifz.js";
|
|
21
21
|
import { a as customRolesOn, r as HELPERS, t as CUSTOM_ROLES } from "./shared-C6_T7QUo.js";
|
|
22
|
-
import {
|
|
23
|
-
import { H as HOOK_TEAM_READER, I as API_KEY_ALLOWS, O as TOKEN_SCOPE_ALLOWS, U as hookTeamReader, W as hookTeamsHelper, b as ASSIGNMENTS, d as permittedByPermissionHelper, l as permissionKeysForHelper, o as PERMISSION_HELPERS, s as checkName, x as OWNERSHIP, z as apiKeyFields } from "./tables-
|
|
24
|
-
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-
|
|
25
|
-
import { a as resolveAuthorize, n as hookUri, t as authAdminRead } from "./rbac-
|
|
26
|
-
import { a as guardedTables, t as ownershipRules } from "./ownership-
|
|
22
|
+
import { J as hasMemberFor, N as globalRoleSource, Q as isTeamScope, U as BOOTSTRAP_PERMISSIONS, X as hasPermittedUsers, a as interactiveOnlyKeys, at as memberRoleOf, et as memberForHelper, ht as checkSuspension, it as memberOfHelper, nt as memberForTable, ot as permittedForHelper, pt as activeRowSql, rt as memberIdsHelper, st as permittedIdsHelper, t as INTERACTIVE_ALLOWS, tt as memberForSources } from "./interactive-only-Dqww0ABO.js";
|
|
23
|
+
import { H as HOOK_TEAM_READER, I as API_KEY_ALLOWS, O as TOKEN_SCOPE_ALLOWS, U as hookTeamReader, W as hookTeamsHelper, b as ASSIGNMENTS, d as permittedByPermissionHelper, l as permissionKeysForHelper, o as PERMISSION_HELPERS, s as checkName, x as OWNERSHIP, z as apiKeyFields } from "./tables-CDq0HVVq.js";
|
|
24
|
+
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-Cth1UQ-8.js";
|
|
25
|
+
import { a as resolveAuthorize, n as hookUri, t as authAdminRead } from "./rbac-mblGDx-Z.js";
|
|
26
|
+
import { a as guardedTables, t as ownershipRules } from "./ownership-Csk9C3Js.js";
|
|
27
27
|
import { a as REQUEST_APPROVER_IDS, c as MANAGES, d as checkedManagers, l as MANAGES_FOR, o as approvalChainSql, p as managerEdges, s as APPROVES, u as approvalManagersSql } from "./approval-chain-D97rgMoA.js";
|
|
28
28
|
import { r as tableKey, t as decidingColumns } from "./deciding-columns-DBZsrpdD.js";
|
|
29
29
|
// src/cli/claims-schema.ts
|
|
@@ -6,7 +6,7 @@ import { t as applyFiles } from "./files-DuV7wRim.js";
|
|
|
6
6
|
import { n as httpRequest } from "./http-BbX_Ou3_.js";
|
|
7
7
|
import { i as readJsonFile } from "./files-DAR51W3J.js";
|
|
8
8
|
import { i as schemaExpression, t as emitPermissionsModule } from "./generate-5_kz2309.js";
|
|
9
|
-
import { t as validateOpenapi } from "./schema-
|
|
9
|
+
import { t as validateOpenapi } from "./schema-DBRKgQb4.js";
|
|
10
10
|
import { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
// src/cli/openapi/import.ts
|
|
@@ -48,7 +48,7 @@ const init = defineLeaf({
|
|
|
48
48
|
...forceFlag
|
|
49
49
|
},
|
|
50
50
|
async run(ctx, { flags }) {
|
|
51
|
-
const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-
|
|
51
|
+
const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-zxb0BVDJ.js"), import("./peer-BWTpSLs2.js")]);
|
|
52
52
|
const agent = await packageManagerOf(ctx.cwd);
|
|
53
53
|
const selection = {
|
|
54
54
|
archetype: flags.archetype,
|
|
@@ -79,7 +79,7 @@ const presetDecode = defineLeaf({
|
|
|
79
79
|
positionals: presetCode,
|
|
80
80
|
flags: {},
|
|
81
81
|
async run(_ctx, { args }) {
|
|
82
|
-
const { runPreset } = await import("./init-
|
|
82
|
+
const { runPreset } = await import("./init-zxb0BVDJ.js");
|
|
83
83
|
return runPreset("decode", args["code"] ?? "");
|
|
84
84
|
}
|
|
85
85
|
});
|
|
@@ -87,7 +87,7 @@ const presetUrl = defineLeaf({
|
|
|
87
87
|
positionals: presetCode,
|
|
88
88
|
flags: {},
|
|
89
89
|
async run(_ctx, { args }) {
|
|
90
|
-
const { runPreset } = await import("./init-
|
|
90
|
+
const { runPreset } = await import("./init-zxb0BVDJ.js");
|
|
91
91
|
return runPreset("url", args["code"] ?? "");
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as decodePreset, g as resolvePreset, i as presetFlags, n as generatePreset, o as encodePreset } from "./preset-BcFDaeqd.js";
|
|
2
2
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
3
3
|
import { t as applyFiles } from "./files-DuV7wRim.js";
|
|
4
|
-
import { o as nonEmptyOr } from "./output-
|
|
4
|
+
import { o as nonEmptyOr } from "./output-C7EPeSZj.js";
|
|
5
5
|
import { t as addLine } from "./peer-D77JpXe-.js";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -1557,6 +1557,19 @@ function interactiveSessionSql(ctx) {
|
|
|
1557
1557
|
absent(subjectClaimJsonSql(ctx, "act"))
|
|
1558
1558
|
].join(" and ")})`;
|
|
1559
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Global grants for a delegated token. A policy delegation does not compile
|
|
1562
|
+
* into SQL, so an API key holds a global grant only when `rls.apiKeys` caps it
|
|
1563
|
+
* by its scopes, and an OAuth client or an act chain only when
|
|
1564
|
+
* `rls.tokenScopes` caps it by its `scope` claim. Without that cap the token
|
|
1565
|
+
* holds no global grant. Undefined when both caps are configured.
|
|
1566
|
+
*/
|
|
1567
|
+
function delegatedGlobalSql(ctx) {
|
|
1568
|
+
if (ctx.namedUser === true) return;
|
|
1569
|
+
const capped = ctx.apiKeys?.claim;
|
|
1570
|
+
const terms = [...[.../* @__PURE__ */ new Set(["api_key", capped ?? "api_key"])].filter((claim) => claim !== capped).map((claim) => absent(subjectClaimJsonSql(ctx, claim))), ...ctx.tokenScopes === void 0 ? [`coalesce(${subjectClaimSql(ctx, "client_id")}, '') = ''`, absent(subjectClaimJsonSql(ctx, "act"))] : []];
|
|
1571
|
+
return terms.length === 0 ? void 0 : `(${terms.join(" and ")})`;
|
|
1572
|
+
}
|
|
1560
1573
|
function interactiveAllowsCall(ctx, grant) {
|
|
1561
1574
|
return `${qualified(ctx, INTERACTIVE_ALLOWS)}(${grant})`;
|
|
1562
1575
|
}
|
|
@@ -1582,7 +1595,11 @@ end;
|
|
|
1582
1595
|
$$;
|
|
1583
1596
|
${grants}`;
|
|
1584
1597
|
}
|
|
1598
|
+
function memoGlobalUserSql(ctx, user) {
|
|
1599
|
+
const delegated = delegatedGlobalSql(ctx);
|
|
1600
|
+
return delegated === void 0 || ctx.interactiveOnly !== void 0 ? memoUserSql(ctx, user) : `(${user}::text || case when ${delegated} then '' else '|delegated' end)`;
|
|
1601
|
+
}
|
|
1585
1602
|
function memoUserSql(ctx, user) {
|
|
1586
1603
|
return ctx.interactiveOnly === void 0 ? user : `(${user}::text || case when ${interactiveSessionSql(ctx)} then '' else '|delegated' end)`;
|
|
1587
1604
|
}
|
|
1588
|
-
export {
|
|
1605
|
+
export { linkHelper as $, membershipRows as A, rolesTableScope as B, sourceRows as C, globalRoleRows as D, sqlBody as E, customRolesSql as F, graphHelper as G, trustedReaderGrants as H, hasCustomRoleChecksFor as I, hasMemberFor as J, graphSqlName as K, perScope as L, userActive as M, globalRoleSource as N, instancesActive as O, currentKeyExpr as P, isTeamScope as Q, raiseSql as R, sourceIdOf as S, sourcesKeep as T, BOOTSTRAP_PERMISSIONS as U, storedTenant as V, CLOSURE as W, hasPermittedUsers as X, hasMemberOf as Y, inheritedRowsHelper as Z, memoWriteSql as _, interactiveOnlyKeys as a, memberRoleOf as at, scopedBody as b, memoUserSql as c, restrictedHelper as ct, disabledColumn as d, activeInstancesSql as dt, memberForHelper as et, functionBody as f, activeMembershipSql as ft, memoHitList as g, grantPermissionSql as gt, memberColumn as h, checkSuspension as ht, interactiveAllowsSql as i, memberOfHelper as it, roleRows as j, keyTenantLine as k, claimKeptLines as l, scopeSources as lt, holderBody as m, activeUserSql as mt, delegatedGlobalSql as n, memberForTable as nt, interactiveSessionSql as o, permittedForHelper as ot, hasBody as p, activeRowSql as pt, graphSqlText as q, interactiveAllowsCall as r, memberIdsHelper as rt, memoGlobalUserSql as s, permittedIdsHelper as st, INTERACTIVE_ALLOWS as t, memberForSources as tt, claimTenant as u, scopeTable as ut, memoizedSetofSql as v, sourcesBodyOf as w, sourceFilters as x, memoizes as y, roleReadersSql as z };
|