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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as parseCatalog } from "../../parse-CUqZ_lLC.js";
|
|
2
|
-
import { n as parseSupabaseManifest } from "../../manifest-
|
|
2
|
+
import { n as parseSupabaseManifest } from "../../manifest-B487A3po.js";
|
|
3
3
|
// src/testing/fixtures/better-supabase.catalog.json
|
|
4
4
|
var better_supabase_catalog_default = {
|
|
5
5
|
$schema: "https://permdock.com/schemas/catalog-v2.json",
|
|
@@ -798,11 +798,6 @@ var better_supabase_manifest_default = {
|
|
|
798
798
|
"share": "row",
|
|
799
799
|
"rules": ["owner"]
|
|
800
800
|
},
|
|
801
|
-
{
|
|
802
|
-
"table": "public.memberships",
|
|
803
|
-
"share": "row",
|
|
804
|
-
"rules": ["unknown"]
|
|
805
|
-
},
|
|
806
801
|
{
|
|
807
802
|
"table": "public.organization_features",
|
|
808
803
|
"share": "row",
|
|
@@ -837,9 +832,20 @@ var better_supabase_manifest_default = {
|
|
|
837
832
|
{
|
|
838
833
|
"table": "public.staff",
|
|
839
834
|
"share": "row",
|
|
840
|
-
"rules": ["form"]
|
|
835
|
+
"rules": ["form"],
|
|
836
|
+
"reason": "key staff.list: every grant of it is unconditional; permdock codemod bsb-access-tags moves the policy unless another policy or tenant column on the table prevents it; key staff.read: every grant of it is unconditional; permdock codemod bsb-access-tags moves the policy unless another policy or tenant column on the table prevents it"
|
|
841
837
|
}
|
|
842
|
-
]
|
|
838
|
+
],
|
|
839
|
+
"sharedFunctions": [],
|
|
840
|
+
"tenantPureHelpers": [{
|
|
841
|
+
"name": "permdock.permdock_organization_has",
|
|
842
|
+
"keyArgument": "p_grant",
|
|
843
|
+
"tenantArgument": "p_tenant"
|
|
844
|
+
}, {
|
|
845
|
+
"name": "permdock.permitted_organization_permission_keys",
|
|
846
|
+
"keyArgument": "p_keys",
|
|
847
|
+
"tenantArgument": "p_id"
|
|
848
|
+
}]
|
|
843
849
|
},
|
|
844
850
|
decidingColumns: [
|
|
845
851
|
"public.contacts.customer_id",
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { s as SupportSessionSource } from "../index-DWmIuQLz.js";
|
|
|
25
25
|
import { n as ApprovalWaiter } from "../waiter-BqUxSRxq.js";
|
|
26
26
|
import { c as DeliveryTransport, g as TransportMessages } from "../types-BhBfMdQ5.js";
|
|
27
27
|
import { x as DirectoryStore } from "../index-xShPsK8G.js";
|
|
28
|
-
import { r as SupabaseHookManifest } from "../manifest-
|
|
28
|
+
import { r as SupabaseHookManifest } from "../manifest-DgsxeAsM.js";
|
|
29
29
|
import { a as ProblemDetails } from "../errors-COoiWqIs.js";
|
|
30
30
|
import { expectTypeOf } from "vitest";
|
|
31
31
|
/** `policyMatrix` under Vitest: one test per cell, plus the exhaustive check. */
|
package/dist/testing/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import { t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-DSjSWEAl.js";
|
|
|
33
33
|
import { n as supabaseMembershipsBudget } from "../budget-BH81q2cj.js";
|
|
34
34
|
import { t as catalogSchema } from "../schema-D2OK4RrB.js";
|
|
35
35
|
import { t as CONNECTOR_SCHEMA } from "../connector-schema-BSRMyq4M.js";
|
|
36
|
-
import { t as supabaseManifestSchema } from "../manifest-schema-
|
|
36
|
+
import { t as supabaseManifestSchema } from "../manifest-schema-D7RQbnGY.js";
|
|
37
37
|
import { n as freezeDeep } from "../freeze-DGfJq_j2.js";
|
|
38
38
|
import { c as evaluateCondition } from "../delegation-0DVVomzu.js";
|
|
39
39
|
import { s as parseCredential } from "../credential-D9in5keC.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Seeds } from "./seeds-Cih1ztkf.js";
|
|
2
|
-
import { h as RoleThrough, m as RoleMap, s as SqlMembershipSource } from "./sources-
|
|
2
|
+
import { h as RoleThrough, m as RoleMap, s as SqlMembershipSource } from "./sources-CjgZns7t.js";
|
|
3
3
|
/**
|
|
4
4
|
* `permdock powersync generate` and `verify` input. Tables and memberships come
|
|
5
5
|
* from `rls`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CollectConfig } from "./types-config-
|
|
1
|
+
import { n as CollectConfig } from "./types-config-DNIw_Gt5.js";
|
|
2
2
|
/**
|
|
3
3
|
* 0 success, 1 failure, 2 usage or an action only a person can take (an input,
|
|
4
4
|
* a confirmation, a login), 130 interrupted (SIGINT or a cancelled prompt), 143
|
package/dist/unplugin/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PermDockPluginOptions } from "../types-run-
|
|
1
|
+
import { n as PermDockPluginOptions } from "../types-run-Bwn1MuW0.js";
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
3
|
type CreateUnplugin = typeof createUnplugin<PermDockPluginOptions | undefined>;
|
|
4
4
|
export declare const createPermDockUnplugin: ReturnType<CreateUnplugin>;
|
package/dist/unplugin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as peerHint } from "../peer-D77JpXe-.js";
|
|
2
|
-
import { i as report, r as createCollectScheduler } from "../watch-
|
|
2
|
+
import { i as report, r as createCollectScheduler } from "../watch-D-5ztqN8.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
// src/unplugin/index.ts
|
|
5
5
|
function loadCreateUnplugin() {
|
|
@@ -2,8 +2,8 @@ import { a as getResource } from "./permission-registry-DstT40VS.js";
|
|
|
2
2
|
import { c as jsonSchemaOf } from "./catalog-doc-D4g3nyFB.js";
|
|
3
3
|
import { r as runCollect } from "./collect-CPimbkC5.js";
|
|
4
4
|
import { f as usageResult } from "./errors-DgLOqc6j.js";
|
|
5
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
6
|
-
import { r as findingOf } from "./output-
|
|
5
|
+
import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
|
|
6
|
+
import { r as findingOf } from "./output-C7EPeSZj.js";
|
|
7
7
|
import { o as USAGE_REPORT_SCHEMA } from "./version-D-jWyJb9.js";
|
|
8
8
|
import { n as jiti, r as parseSync, t as createVisitor } from "./optional-CaQWp9HA.js";
|
|
9
9
|
import { a as rel, r as listSourceFiles } from "./files-DAR51W3J.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as runUsage } from "./usage-CW6xhRcV.js";
|
|
@@ -7,15 +7,15 @@ import { s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
|
|
|
7
7
|
import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-3aUUP6Nx.js";
|
|
8
8
|
import { r as pgConnector } from "./pg-DmS5ITHu.js";
|
|
9
9
|
import { o as loadPolicyAt } from "./load-m7jmit3y.js";
|
|
10
|
-
import { n as commandFor } from "./compile-
|
|
10
|
+
import { n as commandFor } from "./compile-BXKYYmT1.js";
|
|
11
11
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
12
12
|
import { t as policyRowConditionKeys } from "./row-conditions-DwIJocfQ.js";
|
|
13
13
|
import { c as rootScope, d as scopeList, o as normalizeMemberships } from "./scopes-B-KX9EI8.js";
|
|
14
14
|
import { c as rowConditionMessage, n as HELPER_TABLE_POLICIES_SQL, s as helperTablePoliciesFromRows } from "./helper-calls-DHvgN9tr.js";
|
|
15
15
|
import { a as quoteIdent, c as quoteTable, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
16
|
-
import { Q as graphPlan, i as tableNames, r as tableNameOf } from "./tables-
|
|
16
|
+
import { Q as graphPlan, i as tableNames, r as tableNameOf } from "./tables-CDq0HVVq.js";
|
|
17
17
|
import { s as viewName, t as FIELD_VIEWS } from "./fields-y_PSRCyJ.js";
|
|
18
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
18
|
+
import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
|
|
19
19
|
import { C as membershipsClaim, g as customRoleScope } from "./evaluate-Dmd0bShm.js";
|
|
20
20
|
import { n as defaultSqlCommand, t as SQL_IDENT } from "./sql-T4GaBh9X.js";
|
|
21
21
|
import "./budget-BH81q2cj.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as getPermDock } from "./permdock-CJPIwU1T.js";
|
|
2
|
+
import { c as listPermissions } from "./permission-registry-DstT40VS.js";
|
|
3
|
+
// src/core/warm.ts
|
|
4
|
+
/**
|
|
5
|
+
* Builds one anonymous instance with `build` and runs one check on it, so the
|
|
6
|
+
* first request pays neither. Never rejects: a failure answers `ok: false`.
|
|
7
|
+
*/
|
|
8
|
+
async function warmUp(policy, build) {
|
|
9
|
+
const start = performance.now();
|
|
10
|
+
try {
|
|
11
|
+
const instance = await build();
|
|
12
|
+
const [first] = listPermissions(policy.permissions);
|
|
13
|
+
if (first !== void 0) instance.can(first);
|
|
14
|
+
return {
|
|
15
|
+
ok: true,
|
|
16
|
+
ms: performance.now() - start
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return {
|
|
20
|
+
ok: false,
|
|
21
|
+
ms: performance.now() - start
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `warm(policy)`: the anonymous instance of `getPermDock`, for
|
|
27
|
+
* `instrumentation.ts`.
|
|
28
|
+
*/
|
|
29
|
+
function warm(policy) {
|
|
30
|
+
return warmUp(policy, () => getPermDock(policy, null));
|
|
31
|
+
}
|
|
32
|
+
export { warmUp as n, warm as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { D as Policy, Er as Principal, N as PolicyVocabulary } from "./policy-types-CfW4X_yX.js";
|
|
2
|
+
/** What `warm` measured: `ms` covers the instance and the first check. */
|
|
3
|
+
type WarmReport = {
|
|
4
|
+
readonly ok: boolean;
|
|
5
|
+
readonly ms: number;
|
|
6
|
+
};
|
|
7
|
+
/** An object with a `warm()` for `instrumentation.ts`. */
|
|
8
|
+
type Warmable = {
|
|
9
|
+
readonly warm: () => Promise<WarmReport>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* `warm(policy)`: the anonymous instance of `getPermDock`, for
|
|
13
|
+
* `instrumentation.ts`.
|
|
14
|
+
*/
|
|
15
|
+
declare function warm<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>): Promise<WarmReport>;
|
|
16
|
+
export { Warmable as n, warm as r, WarmReport as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
2
|
import { i as dateAt } from "./time-r0CKBm57.js";
|
|
3
3
|
import { a as describeError, n as CliError } from "./errors-DgLOqc6j.js";
|
|
4
|
-
import { n as createChangeScheduler } from "./watch-
|
|
5
|
-
import { n as receiptRows } from "./pipeline-
|
|
4
|
+
import { n as createChangeScheduler } from "./watch-D-5ztqN8.js";
|
|
5
|
+
import { n as receiptRows } from "./pipeline-Bbu7uw28.js";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { Worker } from "node:worker_threads";
|
|
@@ -2,7 +2,7 @@ import { f as nowMillis, i as dateAt } from "./time-r0CKBm57.js";
|
|
|
2
2
|
import { r as runCollect } from "./collect-CPimbkC5.js";
|
|
3
3
|
import { a as describeError } from "./errors-DgLOqc6j.js";
|
|
4
4
|
import { t as defaultSrcPath } from "./files-DAR51W3J.js";
|
|
5
|
-
import { i as loadConfig, r as isConfigFile } from "./config-
|
|
5
|
+
import { i as loadConfig, r as isConfigFile } from "./config-7QvEq57a.js";
|
|
6
6
|
import { statSync, watch } from "node:fs";
|
|
7
7
|
import { basename, dirname, relative, resolve, sep } from "node:path";
|
|
8
8
|
// src/cli/watch.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as watchCollect } from "./watch-D-5ztqN8.js";
|
package/package.json
CHANGED
|
@@ -51,16 +51,26 @@
|
|
|
51
51
|
"type": "object",
|
|
52
52
|
"required": ["appMetadata"],
|
|
53
53
|
"additionalProperties": false,
|
|
54
|
-
"properties": {
|
|
54
|
+
"properties": {
|
|
55
|
+
"appMetadata": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
55
59
|
},
|
|
56
60
|
{
|
|
57
61
|
"type": "object",
|
|
58
62
|
"required": ["table", "column", "id"],
|
|
59
63
|
"additionalProperties": false,
|
|
60
64
|
"properties": {
|
|
61
|
-
"table": {
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
"table": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"column": {
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"id": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
76
|
]
|
|
@@ -133,8 +143,12 @@
|
|
|
133
143
|
"jwt_exp"
|
|
134
144
|
],
|
|
135
145
|
"properties": {
|
|
136
|
-
"hook_custom_access_token_enabled": {
|
|
137
|
-
|
|
146
|
+
"hook_custom_access_token_enabled": {
|
|
147
|
+
"const": true
|
|
148
|
+
},
|
|
149
|
+
"hook_custom_access_token_uri": {
|
|
150
|
+
"type": "string"
|
|
151
|
+
},
|
|
138
152
|
"jwt_exp": {
|
|
139
153
|
"description": "The access token lifetime in seconds: `[auth] jwt_expiry` of `supabase/config.toml`, or 3600 when it is unset.",
|
|
140
154
|
"type": "integer"
|
|
@@ -328,17 +342,28 @@
|
|
|
328
342
|
"type": "boolean"
|
|
329
343
|
},
|
|
330
344
|
"tableReads": {
|
|
331
|
-
"description": "Whether every holder of a table's select permissions in a tenant reads the same rows, from the select policies the schema files, migrations and rls.out leave defined. Absent from a manifest written before 0.
|
|
345
|
+
"description": "Whether every holder of a table's select permissions in a tenant reads the same rows, from the select policies the schema files, migrations and rls.out leave defined. Absent from a manifest written before 0.31.",
|
|
332
346
|
"type": "array",
|
|
333
347
|
"items": {
|
|
334
348
|
"type": "object",
|
|
335
349
|
"required": ["table", "share"],
|
|
336
350
|
"additionalProperties": false,
|
|
337
351
|
"properties": {
|
|
338
|
-
"table": {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
"
|
|
352
|
+
"table": {
|
|
353
|
+
"type": "string"
|
|
354
|
+
},
|
|
355
|
+
"share": {
|
|
356
|
+
"enum": ["tenant", "row"]
|
|
357
|
+
},
|
|
358
|
+
"column": {
|
|
359
|
+
"type": "string"
|
|
360
|
+
},
|
|
361
|
+
"permissions": {
|
|
362
|
+
"type": "array",
|
|
363
|
+
"items": {
|
|
364
|
+
"type": "string"
|
|
365
|
+
}
|
|
366
|
+
},
|
|
342
367
|
"rules": {
|
|
343
368
|
"type": "array",
|
|
344
369
|
"items": {
|
|
@@ -354,6 +379,55 @@
|
|
|
354
379
|
"unknown"
|
|
355
380
|
]
|
|
356
381
|
}
|
|
382
|
+
},
|
|
383
|
+
"reason": {
|
|
384
|
+
"type": "string"
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"sharedFunctions": {
|
|
390
|
+
"description": "Functions better-supabase doctor BS430 accepts in a tenant fill: language sql, security invoker, stable or immutable, no caller identity, reading tenant tables only. Absent from a manifest written before 0.31.",
|
|
391
|
+
"type": "array",
|
|
392
|
+
"items": {
|
|
393
|
+
"type": "object",
|
|
394
|
+
"required": ["function", "tables", "permissions"],
|
|
395
|
+
"additionalProperties": false,
|
|
396
|
+
"properties": {
|
|
397
|
+
"function": {
|
|
398
|
+
"type": "string"
|
|
399
|
+
},
|
|
400
|
+
"tables": {
|
|
401
|
+
"type": "array",
|
|
402
|
+
"items": {
|
|
403
|
+
"type": "string"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"permissions": {
|
|
407
|
+
"type": "array",
|
|
408
|
+
"items": {
|
|
409
|
+
"type": "string"
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
"tenantPureHelpers": {
|
|
416
|
+
"description": "Generated helpers whose answer for one tenant and key depends only on the caller's grants of that key in the tenant. Absent from a manifest written before 0.31.",
|
|
417
|
+
"type": "array",
|
|
418
|
+
"items": {
|
|
419
|
+
"type": "object",
|
|
420
|
+
"required": ["name", "keyArgument", "tenantArgument"],
|
|
421
|
+
"additionalProperties": false,
|
|
422
|
+
"properties": {
|
|
423
|
+
"name": {
|
|
424
|
+
"type": "string"
|
|
425
|
+
},
|
|
426
|
+
"keyArgument": {
|
|
427
|
+
"type": "string"
|
|
428
|
+
},
|
|
429
|
+
"tenantArgument": {
|
|
430
|
+
"type": "string"
|
|
357
431
|
}
|
|
358
432
|
}
|
|
359
433
|
}
|
|
@@ -409,22 +483,34 @@
|
|
|
409
483
|
"type": "object",
|
|
410
484
|
"required": ["schema", "gucPrefix", "claims", "scopes", "resources"],
|
|
411
485
|
"properties": {
|
|
412
|
-
"schema": {
|
|
413
|
-
|
|
486
|
+
"schema": {
|
|
487
|
+
"type": "string"
|
|
488
|
+
},
|
|
489
|
+
"gucPrefix": {
|
|
490
|
+
"type": "string"
|
|
491
|
+
},
|
|
414
492
|
"claims": {
|
|
415
493
|
"type": "object",
|
|
416
494
|
"required": ["tenant", "role"],
|
|
417
495
|
"properties": {
|
|
418
|
-
"tenant": {
|
|
419
|
-
|
|
496
|
+
"tenant": {
|
|
497
|
+
"type": "string"
|
|
498
|
+
},
|
|
499
|
+
"role": {
|
|
500
|
+
"type": "string"
|
|
501
|
+
}
|
|
420
502
|
}
|
|
421
503
|
},
|
|
422
|
-
"teamScope": {
|
|
504
|
+
"teamScope": {
|
|
505
|
+
"type": "string"
|
|
506
|
+
},
|
|
423
507
|
"scopes": {
|
|
424
508
|
"type": "object",
|
|
425
509
|
"additionalProperties": {
|
|
426
510
|
"type": "object",
|
|
427
|
-
"additionalProperties": {
|
|
511
|
+
"additionalProperties": {
|
|
512
|
+
"type": "string"
|
|
513
|
+
}
|
|
428
514
|
}
|
|
429
515
|
},
|
|
430
516
|
"resources": {
|
|
@@ -437,7 +523,9 @@
|
|
|
437
523
|
"type": "string"
|
|
438
524
|
}
|
|
439
525
|
},
|
|
440
|
-
"additionalProperties": {
|
|
526
|
+
"additionalProperties": {
|
|
527
|
+
"type": "string"
|
|
528
|
+
}
|
|
441
529
|
}
|
|
442
530
|
}
|
|
443
531
|
}
|
|
@@ -466,7 +554,9 @@
|
|
|
466
554
|
"description": "The role keys the defineSeeds fixtures give a member, sorted; without fixture memberships, every role at the root scope and every global role. The better-supabase provider writes one fixtureRoles entry for each.",
|
|
467
555
|
"type": "array",
|
|
468
556
|
"uniqueItems": true,
|
|
469
|
-
"items": {
|
|
557
|
+
"items": {
|
|
558
|
+
"type": "string"
|
|
559
|
+
}
|
|
470
560
|
}
|
|
471
561
|
},
|
|
472
562
|
"$defs": {
|
|
@@ -51,7 +51,7 @@ pnpm exec permdock rls verify --introspect
|
|
|
51
51
|
- When support or impersonation tokens (an `act` claim) reach the Data API, set `rls.readOnlyActors: true`: each table and write command the policies grant gets a restrictive `{table}_{op}_read_only_actors` policy that refuses the write unless `act.read_only` is `false`. Never hand-write that policy per table. With `--helpers-only`, every hand-written insert, update and delete policy calls `(select permdock.permdock_actor_may_write())`, and `rls verify --introspect` names the ones that do not.
|
|
52
52
|
- To list who holds a permission in one organization (notification fan-out, an approver list), server SQL calls `permitted_<scope>_users('<permission key>', <id>)` in `database` mode, never a hand-written join of memberships and `role_permissions`. No client role may execute it; grant it to the backend's Postgres role.
|
|
53
53
|
- When a backend queries Postgres for a verified API key, set `rls.apiKeys` and put the key in the `api_key` claim (`scopes` as permission keys, `tenant` and `roles` for a key that belongs to a tenant): the helpers cap every allow at the scopes and treat a tenant key without `sub` as a service principal of that tenant. A user key whose claim names a `tenant` is held to that tenant even with `rls.tenants: 'all'`, and `permdock_has` is false for it. Never write a `has_scope` check per policy.
|
|
54
|
-
- When OAuth clients, MCP clients or agents (a `client_id` or an agent `act` claim) reach the Data API, set `rls.tokenScopes: true`: the helpers and helper-free allows then pass a grant only when the token's `scope` claim reaches its permission, through the same map better-supabase's `delegation.scopes` reads. A policy delegation does not compile into SQL, so such a client needs permission scopes or `oauthScopes` in its token. Never hand-write a scope check per policy.
|
|
54
|
+
- When OAuth clients, MCP clients or agents (a `client_id` or an agent `act` claim) reach the Data API, set `rls.tokenScopes: true`: the helpers and helper-free allows then pass a grant only when the token's `scope` claim reaches its permission, through the same map better-supabase's `delegation.scopes` reads. A policy delegation does not compile into SQL, so such a client needs permission scopes or `oauthScopes` in its token. Without `rls.tokenScopes` (or `rls.apiKeys` for an API key claim), `permdock_has` refuses every global grant to that token, so a delegated client never holds platform permissions at the Data API. Never hand-write a scope check per policy.
|
|
55
55
|
- On Supabase every generated helper and policy reads the subject through `permdock_user_id()`: the `sub` in `request.jwt.claims`, and null for the empty `sub` of a tenant service key. It ignores the legacy `request.jwt.claim.sub` setting; SQL that impersonates a user sets `request.jwt.claims`. A hand-written policy such a token reaches calls `(select permdock.permdock_user_id())`, never `auth.uid()`, which fails the uuid cast.
|
|
56
56
|
- `rls.assignments` puts a `permdock_assignment` trigger on each mapped membership table, the global-roles table `rls.roles` and each table in `tables`; `ownRole: 'refuse'` (or a map of tables) also refuses a client write to the caller's own row. `doctor` PD064 names a guarded table no migration puts the trigger on.
|
|
57
57
|
- SQL that assigns roles calls `permdock_can_assign_any(role, tenant, scope, scope_id)`, which covers declared and custom roles; SQL acting later for a stored user (an invitation accept re-checking the inviter) calls `permdock_can_assign_any_for(user, ...)`. `permdock supabase inspect` lists both in the manifest's `rls.helpers`.
|
package/dist/gen-CkUEZ5Z6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as renderKinds } from "./gen-CGjbD8I_.js";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/cli/sql/platform.ts
|
|
2
|
-
/** Schemas Postgres, Supabase and its extensions own. */
|
|
3
|
-
const SYSTEM_SCHEMAS = /* @__PURE__ */ new Set([
|
|
4
|
-
"pg_catalog",
|
|
5
|
-
"information_schema",
|
|
6
|
-
"pg_toast",
|
|
7
|
-
"auth",
|
|
8
|
-
"storage",
|
|
9
|
-
"realtime",
|
|
10
|
-
"extensions",
|
|
11
|
-
"graphql",
|
|
12
|
-
"graphql_public",
|
|
13
|
-
"vault",
|
|
14
|
-
"pgsodium",
|
|
15
|
-
"pgsodium_masks",
|
|
16
|
-
"net",
|
|
17
|
-
"cron",
|
|
18
|
-
"supabase_functions",
|
|
19
|
-
"supabase_migrations"
|
|
20
|
-
]);
|
|
21
|
-
/**
|
|
22
|
-
* Stripe Data Pipeline's schemas. Supabase creates the `stripe_sdp` role, and
|
|
23
|
-
* Stripe creates a schema with that prefix and writes its tables as that role;
|
|
24
|
-
* an app reads them but never writes or grants on them.
|
|
25
|
-
*/
|
|
26
|
-
const STRIPE_SDP = "stripe_sdp";
|
|
27
|
-
/** Whether a platform owns `schema`, so no PermDock check or grant reaches it. */
|
|
28
|
-
function isPlatformSchema(schema) {
|
|
29
|
-
return SYSTEM_SCHEMAS.has(schema) || schema.startsWith("pg_") || schema.startsWith(STRIPE_SDP);
|
|
30
|
-
}
|
|
31
|
-
/** Whether `schema` belongs to Stripe Data Pipeline. */
|
|
32
|
-
function isStripeDataPipelineSchema(schema) {
|
|
33
|
-
return schema.startsWith(STRIPE_SDP);
|
|
34
|
-
}
|
|
35
|
-
export { isStripeDataPipelineSchema as n, isPlatformSchema as t };
|
package/dist/pull-CGncYZNZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as runCloudPull } from "./pull-BnxZmo3f.js";
|
package/dist/report-BevPHMy6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as NON_LEAKPROOF_INDEXED_SQL, n as POLICIES_MAX, r as REPORT_POLICIES_SQL, i as droppedPolicy, a as policiesFor, o as reportFiles, s as rlsReport, c as runRlsReport } from "./report-BI_hek_d.js";
|
package/dist/run-3ySqmufy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as run } from "./run-C3ztA88m.js";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
|
-
// src/cli/sql/tenant-check.ts
|
|
3
|
-
/** The `sval` of each `String` node in a parse-tree list. */
|
|
4
|
-
function svals(list) {
|
|
5
|
-
return Array.isArray(list) ? list.flatMap((item) => isRecord(item) && isRecord(item["String"]) && typeof item["String"]["sval"] === "string" ? [item["String"]["sval"]] : []) : [];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* `<column> in (select <schema>.permitted_<scope>_ids('<key>'))`, read from the
|
|
9
|
-
* node.
|
|
10
|
-
*/
|
|
11
|
-
function tenantCheck(expr, helper) {
|
|
12
|
-
const link = isRecord(expr) ? expr["SubLink"] : void 0;
|
|
13
|
-
if (!isRecord(link) || link["subLinkType"] !== "ANY_SUBLINK") return;
|
|
14
|
-
const test = link["testexpr"];
|
|
15
|
-
const ref = isRecord(test) ? test["ColumnRef"] : void 0;
|
|
16
|
-
const column = isRecord(ref) ? svals(ref["fields"]) : [];
|
|
17
|
-
const select = isRecord(link["subselect"]) ? link["subselect"]["SelectStmt"] : void 0;
|
|
18
|
-
if (column.length !== 1 || !isRecord(select) || select["fromClause"] !== void 0) return;
|
|
19
|
-
const targets = Array.isArray(select["targetList"]) ? select["targetList"] : [];
|
|
20
|
-
const target = targets.length === 1 && isRecord(targets[0]) ? targets[0]["ResTarget"] : void 0;
|
|
21
|
-
const call = isRecord(target) && isRecord(target["val"]) ? target["val"]["FuncCall"] : void 0;
|
|
22
|
-
if (!isRecord(call) || svals(call["funcname"]).join(".") !== helper) return;
|
|
23
|
-
const args = Array.isArray(call["args"]) ? call["args"] : [];
|
|
24
|
-
const constant = args.length === 1 && isRecord(args[0]) ? args[0]["A_Const"] : void 0;
|
|
25
|
-
const value = isRecord(constant) && isRecord(constant["sval"]) ? constant["sval"]["sval"] : void 0;
|
|
26
|
-
return typeof value === "string" && column[0] !== void 0 ? {
|
|
27
|
-
column: column[0],
|
|
28
|
-
key: value
|
|
29
|
-
} : void 0;
|
|
30
|
-
}
|
|
31
|
-
export { tenantCheck as n, svals as t };
|
package/dist/usage-DdOFc5xq.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as runUsage } from "./usage-DT6QK86a.js";
|
package/dist/watch-eay1PztJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { a as watchCollect } from "./watch-fldErlRf.js";
|