permdock 0.38.0 → 0.38.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.
- package/dist/{adoption-scan-D-uM3y5a.js → adoption-scan-CkkOzkXs.js} +1 -1
- package/dist/{arazzo-BdWGzdqv.js → arazzo-BKYLAE5e.js} +1 -1
- package/dist/{arazzo-CyENGJ-M.js → arazzo-n8as0lFp.js} +1 -1
- package/dist/{bsb-access-tags-C4iPlzjs.js → bsb-access-tags-DaGRSYnv.js} +1 -1
- package/dist/{casbin-ILRPO6t9.js → casbin-BlQqoRlv.js} +1 -1
- package/dist/{casbin-DdJndgnu.js → casbin-BmYeMFeI.js} +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/watch-worker.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/plugins/app.js +1 -1
- package/dist/cli/plugins/openapi.js +1 -1
- package/dist/cli/plugins/powersync.js +1 -1
- package/dist/cli/plugins/rls.js +1 -1
- package/dist/cli/plugins/schemas.js +1 -1
- package/dist/cli/plugins/supabase-hook.js +1 -1
- package/dist/cli/plugins/supabase.js +2 -2
- package/dist/cli/plugins/ui.js +1 -1
- package/dist/{cloud-C8bHMKjI.js → cloud-DxDQff7G.js} +1 -1
- package/dist/{codemod-D8zh3IYV.js → codemod-CX9EGBJw.js} +1 -1
- package/dist/{codemod-D02eYuzA.js → codemod-DjcAtHr9.js} +4 -4
- package/dist/{compile-7tf8hHlu.js → compile-BWOrvhGt.js} +3 -3
- package/dist/{completion-BZShluF7.js → completion-9B7fZWsn.js} +1 -1
- package/dist/{config-ClypJwe2.js → config-BgBDv1UW.js} +1 -1
- package/dist/{config-report-Kb-mYv9F.js → config-report-oYAr9Opz.js} +1 -1
- package/dist/{context-BQQzAw83.js → context-DntIOpzS.js} +1 -1
- package/dist/{custom-role-rebuild-CRz6Ip6J.js → custom-role-rebuild-BwM6hBqt.js} +1 -1
- package/dist/{doctor-DAx9dIEX.js → doctor-CDSxgnut.js} +2 -2
- package/dist/{doctor-XSdrG1SZ.js → doctor-Dqh8AzIx.js} +17 -17
- package/dist/{execute-DgCH7kEE.js → execute-CUGaCy_9.js} +3 -3
- package/dist/gen-CNYlckFE.js +1 -0
- package/dist/{gen-m1X9N8DZ.js → gen-D85_gUOz.js} +2 -2
- package/dist/{gen-kind-DIltjpY9.js → gen-kind-Bi0dtNoV.js} +1 -1
- package/dist/{generate-DWL9aXjZ.js → generate-BnOSZLka.js} +11 -11
- package/dist/{generate-CIjPy_cH.js → generate-C8kAhef2.js} +3 -3
- package/dist/{generate-options-RvPqyMWE.js → generate-options-eMjRViev.js} +7 -7
- package/dist/{hook-sql-C24FFEWr.js → hook-sql-BQcxbOzi.js} +65 -12
- package/dist/{import-Dmm7N9C6.js → import-BLN-HGJG.js} +1 -1
- package/dist/{init-tXmJlH7f.js → init-B8bPTGMb.js} +3 -3
- package/dist/{init-Cgcea11w.js → init-BQnRbzUb.js} +1 -1
- package/dist/{inspect-functions-DbhgRvDf.js → inspect-functions-GXdyPFwI.js} +1 -1
- package/dist/{interactive-only-ad2JJYk8.js → interactive-only-C9NQJXpi.js} +33 -8
- package/dist/{keys-B4JLF5VZ.js → keys-QhAlAjXf.js} +1 -1
- package/dist/{login-DAqoZl0F.js → login-DnVKv2ib.js} +1 -1
- package/dist/{login-fz4tUg2P.js → login-kQOIJoFN.js} +3 -3
- package/dist/{manifest-DbJC_rXj.js → manifest-CMh8sAAH.js} +34 -34
- package/dist/{measure-R9VWfQ2y.js → measure-DJl28Whs.js} +1 -1
- package/dist/{model-8NWofaam.js → model-DQQYg8UW.js} +1 -1
- package/dist/{openapi-BgXg8LkZ.js → openapi-CuyzmD9h.js} +2 -2
- package/dist/{openapi-uxD7ABpM.js → openapi-D7kRYqWu.js} +1 -1
- package/dist/{openapi-document-BJcbM0-l.js → openapi-document-ClyLB0-z.js} +1 -1
- package/dist/{output-DZS9QWHI.js → output-ONUzppLo.js} +1 -1
- package/dist/{ownership-DO5EF2nr.js → ownership-CCgncSLb.js} +2 -2
- package/dist/{pipeline-IvdKfvuP.js → pipeline-DGFc6y6x.js} +2 -2
- package/dist/{policy-V-sHH2Ku.js → policy-AWd-ccJJ.js} +1 -1
- package/dist/{policy-bundle-DyJKT9TF.js → policy-bundle-rC5_X9hX.js} +3 -3
- package/dist/{powersync-IqzV6QHS.js → powersync-C1OW6iVd.js} +6 -6
- package/dist/{powersync-BkN45DVg.js → powersync-C84aHECl.js} +1 -1
- package/dist/{powersync-BY6r-MIk.js → powersync-DW7seEgS.js} +1 -1
- package/dist/{prune-config-BRqnw6rb.js → prune-config-DeTUhG2J.js} +4 -4
- package/dist/{pull-PDxkxdGN.js → pull-C851tQak.js} +1 -1
- package/dist/pull-CylkuBGR.js +1 -0
- package/dist/{rbac-BK_wp3eK.js → rbac-ByuGspKZ.js} +1 -1
- package/dist/{rename-BbdlodFz.js → rename-BgfR3xB9.js} +2 -2
- package/dist/{resolve-names-B85N2-Ws.js → resolve-names-DmX503uX.js} +2 -2
- package/dist/{rls-DTXsf2zJ.js → rls-DTN_-HX2.js} +3 -3
- package/dist/{rls-BkXnBVXx.js → rls-JSxuWcf-.js} +7 -7
- package/dist/{rls-files-BJMmTuC9.js → rls-files-BsJsEeJ_.js} +1 -1
- package/dist/{run-dwwtRWj6.js → run-BgNlYtQJ.js} +2 -2
- package/dist/run-C7nX-hkR.js +1 -0
- package/dist/{scan-BGTnZXgx.js → scan-pHPntFbs.js} +1 -1
- package/dist/{schema-KPTMZVeK.js → schema-DJd7Gq_p.js} +1 -1
- package/dist/{skills-jPbcwqhX.js → skills-D4ItrS0F.js} +1 -1
- package/dist/{skills-CexZ2QfF.js → skills-txCdqGns.js} +1 -1
- package/dist/{supabase-DgHCnzMW.js → supabase-D-kxyoaX.js} +2 -2
- package/dist/supabase-hook-BTiZ8LTJ.js +2 -0
- package/dist/{supabase-hook-BIBC5Ihn.js → supabase-hook-DDxDjlOU.js} +5 -5
- package/dist/{supabase-schemas-DOc3cNnf.js → supabase-schemas-D6ezN5Ln.js} +1 -1
- package/dist/{table-reads-CXecyZKo.js → table-reads-DHB56kFZ.js} +1 -1
- package/dist/{table-reads-CMP1MnPJ.js → table-reads-Doh_Egx2.js} +1 -1
- package/dist/{tables-C-DzDqKb.js → tables-E-dIHUN_.js} +1 -1
- package/dist/{tenant-check-DoZibca6.js → tenant-check-DGfE7Sns.js} +3 -3
- package/dist/{usage-BiTJQNJO.js → usage-CX_wmL5W.js} +2 -2
- package/dist/usage-DcVP-SFj.js +1 -0
- package/dist/{usage-ltA8iGa4.js → usage-DymSoYQZ.js} +1 -1
- package/dist/{verify-Dj3OjNiD.js → verify-CHlmYg2d.js} +3 -3
- package/dist/{watch--c--3aEf.js → watch-CkL1iuKJ.js} +1 -1
- package/package.json +1 -1
- package/dist/gen-Df-r9jpy.js +0 -1
- package/dist/pull-n6noMzmE.js +0 -1
- package/dist/run-DqqVLgh_.js +0 -1
- package/dist/supabase-hook-8jAi64W9.js +0 -2
- package/dist/usage-D7-bsLte.js +0 -1
|
@@ -18,12 +18,12 @@ import { m as splitUndiffed } from "./ast-Dnm2TOHN.js";
|
|
|
18
18
|
import { c as ACTOR_MAY_WRITE, p as readOnlyActorKinds } from "./fields-CKX-qjWb.js";
|
|
19
19
|
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-B7p94Y0s.js";
|
|
20
20
|
import { a as customRolesOn, r as HELPERS, t as CUSTOM_ROLES } from "./shared-DnVY767H.js";
|
|
21
|
-
import { G as activeRowSql, N as globalRoleSource, a as interactiveOnlyKeys, q as checkSuspension, t as INTERACTIVE_ALLOWS } from "./interactive-only-
|
|
21
|
+
import { G as activeRowSql, N as globalRoleSource, a as interactiveOnlyKeys, q as checkSuspension, t as INTERACTIVE_ALLOWS } from "./interactive-only-C9NQJXpi.js";
|
|
22
22
|
import { f as memberForHelper, g as memberOfHelper, h as memberIdsHelper, t as BOOTSTRAP_PERMISSIONS, u as isTeamScope, v as permittedForHelper, y as permittedIdsHelper } from "./names-DwGleRKB.js";
|
|
23
|
-
import { G as hookTeamReader, K as hookTeamsHelper, M as tokenScopesOn, O as TOKEN_SCOPE_ALLOWS, R as API_KEY_ALLOWS, V as apiKeyFields, W as HOOK_TEAM_READER, b as ASSIGNMENTS, d as permittedByPermissionHelper, l as permissionKeysForHelper, o as PERMISSION_HELPERS, s as checkName, x as OWNERSHIP } 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-
|
|
23
|
+
import { G as hookTeamReader, K as hookTeamsHelper, M as tokenScopesOn, O as TOKEN_SCOPE_ALLOWS, R as API_KEY_ALLOWS, V as apiKeyFields, W as HOOK_TEAM_READER, b as ASSIGNMENTS, d as permittedByPermissionHelper, l as permissionKeysForHelper, o as PERMISSION_HELPERS, s as checkName, x as OWNERSHIP } from "./tables-E-dIHUN_.js";
|
|
24
|
+
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-DmX503uX.js";
|
|
25
|
+
import { a as resolveAuthorize, n as hookUri, t as authAdminRead } from "./rbac-ByuGspKZ.js";
|
|
26
|
+
import { a as guardedTables, t as ownershipRules } from "./ownership-CCgncSLb.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-BEeExHpb.js";
|
|
28
28
|
import { a as hookMemberships, c as typedSourceUsers, i as entriesSql, l as typedUsers, n as activeSource, o as memberForPlan, r as checkSources, s as positiveInteger, t as activeFromSql } from "./memberships-CDiSsFTu.js";
|
|
29
29
|
import { r as tableKey, t as decidingColumns } from "./deciding-columns-DBZsrpdD.js";
|
|
@@ -1003,8 +1003,6 @@ const APPROVER_MATCHES = "permdock_approver_matches";
|
|
|
1003
1003
|
* `p_requests` raises `54000`, so one call never walks an unbounded array.
|
|
1004
1004
|
*/
|
|
1005
1005
|
const MAX_APPROVER_REQUESTS = 5e3;
|
|
1006
|
-
/** The function `rls.approvals.delegations` writes for a cover's own rights. */
|
|
1007
|
-
const COVER_APPROVES = "permdock_cover_approves";
|
|
1008
1006
|
/**
|
|
1009
1007
|
* `permdock_approver_request_ids(p_requests jsonb, p_kinds jsonb, p_current
|
|
1010
1008
|
* boolean default false)`: the `id` of every element of `p_requests` (`{ id,
|
|
@@ -1013,10 +1011,11 @@ const COVER_APPROVES = "permdock_cover_approves";
|
|
|
1013
1011
|
* kind to its approvers, and `p_current` passes each element's `approvers`, as
|
|
1014
1012
|
* the provider's `approvers` and `requestApprovers` options do. An element
|
|
1015
1013
|
* answers as `permdock_is_approver` does for it, but the caller's `holder()`,
|
|
1016
|
-
* manager and cover facts
|
|
1017
|
-
* policy or a set query calls it
|
|
1018
|
-
*
|
|
1019
|
-
* `
|
|
1014
|
+
* manager and cover facts, and each cover's delegator's facts, are read once
|
|
1015
|
+
* per call, not once per request. A policy or a set query calls it
|
|
1016
|
+
* uncorrelated, so Postgres runs it once per statement. More than
|
|
1017
|
+
* `MAX_APPROVER_REQUESTS` elements raise `54000`, and a `p_kinds` entry under
|
|
1018
|
+
* the empty kind matches nothing.
|
|
1020
1019
|
*/
|
|
1021
1020
|
function approverRequestIdsSql(ctx, options) {
|
|
1022
1021
|
const fn = qualified$1(ctx, APPROVER_REQUEST_IDS);
|
|
@@ -1075,6 +1074,37 @@ function approverRequestIdsSql(ctx, options) {
|
|
|
1075
1074
|
from managers m
|
|
1076
1075
|
where jsonb_typeof(m.levels) = 'number' and m.levels::text ~ '^[0-9]{1,2}$'
|
|
1077
1076
|
)` : "";
|
|
1077
|
+
const database = ctx.authorize === "database";
|
|
1078
|
+
const delegatorGlobal = database ? `(
|
|
1079
|
+
select coalesce(jsonb_object_agg(p.permission, coalesce(${qualified$1(ctx, PERMISSION_HELPERS.hasFor)}(d.delegator::${user}, p.permission), false)), '{}'::jsonb)
|
|
1080
|
+
from (select distinct l.permission from cover_leaves l where l.delegator = d.delegator and l.within is null and l.permission is not null) p
|
|
1081
|
+
)` : "'{}'::jsonb";
|
|
1082
|
+
const delegatorTenant = database && root !== void 0 ? `(
|
|
1083
|
+
select coalesce(jsonb_object_agg(p.permission, (
|
|
1084
|
+
select coalesce(jsonb_agg(i.id::text), '[]'::jsonb)
|
|
1085
|
+
from ${qualified$1(ctx, checkName(`${permittedByPermissionHelper(root)}_for`))}(d.delegator::${user}, p.permission) i(id)
|
|
1086
|
+
)), '{}'::jsonb)
|
|
1087
|
+
from (select distinct l.permission from cover_leaves l where l.delegator = d.delegator and l.within is not null and l.permission is not null) p
|
|
1088
|
+
)` : "'{}'::jsonb";
|
|
1089
|
+
const delegatorManages = options.managers ? `,
|
|
1090
|
+
'manages', (
|
|
1091
|
+
select coalesce(jsonb_object_agg(
|
|
1092
|
+
jsonb_build_array(m.requester, m.within, m.levels::text::integer)::text,
|
|
1093
|
+
coalesce(${qualified$1(ctx, MANAGES_FOR)}(d.delegator, m.requester, m.levels::text::integer, m.within), false)
|
|
1094
|
+
), '{}'::jsonb)
|
|
1095
|
+
from cover_managers m
|
|
1096
|
+
where m.delegator = d.delegator and jsonb_typeof(m.levels) = 'number' and m.levels::text ~ '^[0-9]{1,2}$'
|
|
1097
|
+
)` : "";
|
|
1098
|
+
const coverManagerLeaves = options.managers ? `,
|
|
1099
|
+
cover_managers as (
|
|
1100
|
+
select distinct a.delegator, a.r ->> 'requester' as requester, a.r ->> 'within' as within, coalesce(l -> 'levels', '1'::jsonb) as levels
|
|
1101
|
+
from applicable a, jsonb_path_query(a.r -> 'approvers', 'strict $.** ? (@.kind == "manager")') l
|
|
1102
|
+
)` : "";
|
|
1103
|
+
const memberOnly = root === void 0 ? "r ->> 'within' is null" : "(r ->> 'within' is null or r ->> 'within' = any (v_member))";
|
|
1104
|
+
const loadMember = root === void 0 ? "" : `
|
|
1105
|
+
if v_member is null then
|
|
1106
|
+
select coalesce(array_agg(m.id::text), '{}') into v_member from ${qualified$1(ctx, memberIdsHelper(root))}() m(id);
|
|
1107
|
+
end if;`;
|
|
1078
1108
|
const member = root === void 0 ? ` if v_request ->> 'within' is not null then
|
|
1079
1109
|
continue;
|
|
1080
1110
|
end if;` : ` if v_request ->> 'within' is not null then
|
|
@@ -1110,13 +1140,36 @@ ${member}
|
|
|
1110
1140
|
and (c ->> 'within' is null or c ->> 'within' = v_request ->> 'within')
|
|
1111
1141
|
and (c ->> 'resources' is null or c -> 'resources' ? (v_request ->> 'resource'))
|
|
1112
1142
|
loop
|
|
1113
|
-
|
|
1143
|
+
-- Each delegator's facts are read once, over the requests a cover of theirs reaches.
|
|
1144
|
+
if v_cover_facts is null then${loadMember}
|
|
1145
|
+
with applicable as (
|
|
1146
|
+
select c ->> 'delegator' as delegator, r
|
|
1147
|
+
from jsonb_array_elements(v_covers) c, jsonb_array_elements(v_requests) r
|
|
1148
|
+
where coalesce(r ->> 'requester', '') <> ''
|
|
1149
|
+
and c ->> 'delegator' <> r ->> 'requester'
|
|
1150
|
+
and (c ->> 'within' is null or c ->> 'within' = r ->> 'within')
|
|
1151
|
+
and (c ->> 'resources' is null or c -> 'resources' ? (r ->> 'resource'))
|
|
1152
|
+
and ${memberOnly}
|
|
1153
|
+
),
|
|
1154
|
+
cover_leaves as (
|
|
1155
|
+
select a.delegator, a.r ->> 'within' as within, l ->> 'permission' as permission
|
|
1156
|
+
from applicable a, jsonb_path_query(a.r -> 'approvers', 'strict $.** ? (@.kind == "permission")') l
|
|
1157
|
+
)${coverManagerLeaves}
|
|
1158
|
+
select coalesce(jsonb_object_agg(d.delegator, jsonb_build_object(
|
|
1159
|
+
'global', ${delegatorGlobal},
|
|
1160
|
+
'within', ${delegatorTenant}${delegatorManages}
|
|
1161
|
+
)), '{}'::jsonb)
|
|
1162
|
+
into v_cover_facts
|
|
1163
|
+
from (select distinct a.delegator from applicable a) d;
|
|
1164
|
+
end if;
|
|
1165
|
+
if ${matches}(v_request -> 'approvers', v_request ->> 'within', v_request ->> 'requester', v_delegator::text, coalesce(v_cover_facts -> v_delegator::text, '{}'::jsonb)) then
|
|
1114
1166
|
return next v_request ->> 'id';
|
|
1115
1167
|
exit;
|
|
1116
1168
|
end if;
|
|
1117
1169
|
end loop;` : "";
|
|
1118
1170
|
const coverDeclarations = options.delegations ? `
|
|
1119
1171
|
v_covers jsonb;
|
|
1172
|
+
v_cover_facts jsonb;
|
|
1120
1173
|
v_member text[];
|
|
1121
1174
|
v_delegator ${user};` : "";
|
|
1122
1175
|
return `
|
|
@@ -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-DJd7Gq_p.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-BQnRbzUb.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-BQnRbzUb.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-BQnRbzUb.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-ONUzppLo.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as configuredTableReads, o as functionShares } from "./table-reads-
|
|
1
|
+
import { n as configuredTableReads, o as functionShares } from "./table-reads-Doh_Egx2.js";
|
|
2
2
|
// src/cli/rls/inspect-functions.ts
|
|
3
3
|
/**
|
|
4
4
|
* `permdock supabase inspect --functions <pattern>`: for each function the
|
|
@@ -77,6 +77,22 @@ function activeRowSql(row, id) {
|
|
|
77
77
|
const where = parts.length === 0 ? "" : ` where ${parts.join(" and ")}`;
|
|
78
78
|
return `coalesce(${id} in (select s.${quoteIdent(row.id)} from ${table} s${where}), false)`;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The active-row check for an id that is the same for every row, such as the
|
|
82
|
+
* signed-in subject: one primary key probe that Postgres runs once per
|
|
83
|
+
* statement as an init plan. A join on that id would probe again for every
|
|
84
|
+
* membership row, and `id in (select ...)` would read every active row.
|
|
85
|
+
*/
|
|
86
|
+
function activeOnceSql(row, id) {
|
|
87
|
+
const table = quoteTable(qualifySqlTable(row.table));
|
|
88
|
+
const parts = [`s.${quoteIdent(row.id)} = ${id}`];
|
|
89
|
+
if (row.disabledAt !== void 0) parts.push(`s.${quoteIdent(row.disabledAt)} is null`);
|
|
90
|
+
if (row.status !== void 0) {
|
|
91
|
+
const values = (row.active ?? []).map(quoteLiteral).join(", ");
|
|
92
|
+
parts.push(`s.${quoteIdent(row.status)}::text = any(array[${values}]::text[])`);
|
|
93
|
+
}
|
|
94
|
+
return `(select exists (select 1 from ${table} s where ${parts.join(" and ")}))`;
|
|
95
|
+
}
|
|
80
96
|
function activeJoin(row, id, alias) {
|
|
81
97
|
const table = quoteTable(qualifySqlTable(row.table));
|
|
82
98
|
const parts = [`${alias}.${quoteIdent(row.id)} = ${id}`];
|
|
@@ -125,6 +141,11 @@ function activeUserSql(ctx, user = subjectIdSql(ctx)) {
|
|
|
125
141
|
const row = ctx.suspension?.users;
|
|
126
142
|
return row === void 0 ? [] : [activeRowSql(row, user)];
|
|
127
143
|
}
|
|
144
|
+
/** The signed-in subject's active-row check, run once per statement. */
|
|
145
|
+
function activeSubjectSql(ctx) {
|
|
146
|
+
const row = ctx.suspension?.users;
|
|
147
|
+
return row === void 0 ? [] : [activeOnceSql(row, subjectIdSql(ctx))];
|
|
148
|
+
}
|
|
128
149
|
/**
|
|
129
150
|
* The permission of a grant key held in `grant`: `key#group` and `key@level`
|
|
130
151
|
* name `key`.
|
|
@@ -831,19 +852,24 @@ function roleKeys(ctx, scope, role) {
|
|
|
831
852
|
return `${qualified(ctx, "permdock_role_keys")}(${quoteLiteral(scope)}, ${role})`;
|
|
832
853
|
}
|
|
833
854
|
/**
|
|
834
|
-
* How a body reaches the grant keys of a declared role
|
|
835
|
-
* `
|
|
836
|
-
* `
|
|
855
|
+
* How a body reaches the grant keys of a declared role. A body that lists every
|
|
856
|
+
* key (`set`) reads them through a lateral call of
|
|
857
|
+
* `permdock_role_grant_keys(scope, role)`. A body that checks one key probes
|
|
858
|
+
* `role_permissions` by its whole primary key instead: the lateral call read
|
|
859
|
+
* every key of the role for each membership row and filtered afterwards, about
|
|
860
|
+
* 0.05 ms per membership. With `rls.seeds: 'view'` both read the jsonb map
|
|
837
861
|
* `permdock_role_keys(scope, role)`, which a hash lookup answers where the
|
|
838
862
|
* view's `values` list is scanned.
|
|
839
863
|
*/
|
|
840
864
|
function rpJoin(ctx, scope, role, set, indent) {
|
|
865
|
+
if (!set) return "";
|
|
841
866
|
if (ctx.seeds !== "view") return `${indent}cross join lateral ${qualified(ctx, HELPERS.roleGrantKeys)}(${quoteLiteral(scope)}, ${role}) rp(grant_key)\n`;
|
|
842
|
-
return
|
|
867
|
+
return `${indent}cross join lateral jsonb_array_elements_text(coalesce(${roleKeys(ctx, scope, role)}, '[]'::jsonb)) rp(grant_key)\n`;
|
|
843
868
|
}
|
|
844
869
|
function rpConds(ctx, scope, role, set) {
|
|
845
|
-
if (
|
|
846
|
-
|
|
870
|
+
if (set) return [];
|
|
871
|
+
if (ctx.seeds !== "view") return [`exists (select 1 from ${qualified(ctx, "role_permissions")} rp where rp.role = ${role} and rp.grant_key = p_grant and rp.scope = ${quoteLiteral(scope)})`];
|
|
872
|
+
return [`jsonb_exists(${roleKeys(ctx, scope, role)}, p_grant)`];
|
|
847
873
|
}
|
|
848
874
|
function rpWhere(ctx, scope, role, set, indent) {
|
|
849
875
|
return rpConds(ctx, scope, role, set).map((cond) => `\n${indent}and ${cond}`).join("");
|
|
@@ -1063,9 +1089,9 @@ function claimTenant(ctx, scope) {
|
|
|
1063
1089
|
function claimDeclaredBody(ctx, scope, type) {
|
|
1064
1090
|
const grant = "p_grant";
|
|
1065
1091
|
const narrow = narrowsTo(ctx, scope) ? `\n and (${activeTenant(ctx)} is null or ${claimTenant(ctx, scope)} = ${activeTenant(ctx)})` : "";
|
|
1066
|
-
const user = activeUserChecks(ctx, subjectIdSql(ctx), "act_user", " ");
|
|
1067
1092
|
const instances = activeInstanceChecks(ctx, scope, (name) => name === scope ? `m ->> 'id'` : `m -> 'within' ->> ${quoteLiteral(name)}`, (name) => `act_${name}`, " ", grantPermissionSql(grant));
|
|
1068
1093
|
const filters = [
|
|
1094
|
+
...activeSubjectSql(ctx).map((part) => ` and ${part}`),
|
|
1069
1095
|
` and (select ${qualified(ctx, HELPERS.tokenCurrent)}())`,
|
|
1070
1096
|
` and m ->> 'scope' = ${quoteLiteral(scope)}`,
|
|
1071
1097
|
` and m ->> 'id' is not null${narrow}${keyTenantLine(ctx, scope, claimTenant(ctx, scope))}`,
|
|
@@ -1080,7 +1106,6 @@ function claimDeclaredBody(ctx, scope, type) {
|
|
|
1080
1106
|
return [
|
|
1081
1107
|
` select (m ->> 'id')::${type}`,
|
|
1082
1108
|
` from ${membershipRows(ctx)}`,
|
|
1083
|
-
...user.joins,
|
|
1084
1109
|
...instances.joins,
|
|
1085
1110
|
...rpJoin(ctx, scope, "r.role", false, " ").split("\n").filter((line) => line !== ""),
|
|
1086
1111
|
` where ${signedIn(ctx)}`,
|
|
@@ -24,7 +24,7 @@ const keysRename = defineLeaf({
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
async run(ctx, { flags, args }) {
|
|
27
|
-
const { runKeysRename } = await import("./rename-
|
|
27
|
+
const { runKeysRename } = await import("./rename-BgfR3xB9.js");
|
|
28
28
|
const migration = given(flags.migration);
|
|
29
29
|
return runKeysRename({
|
|
30
30
|
cwd: ctx.cwd,
|
|
@@ -3,7 +3,7 @@ import { i as postForm, r as parseToken, s as runDeviceFlow } from "./device-f3J
|
|
|
3
3
|
import { i as writeCredentials, n as deleteCredentials, r as readCredentials, t as credentialsPath } from "./storage-BhGDhsXm.js";
|
|
4
4
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
5
5
|
import { n as httpRequest } from "./http-BbX_Ou3_.js";
|
|
6
|
-
import { o as nonEmptyOr } from "./output-
|
|
6
|
+
import { o as nonEmptyOr } from "./output-ONUzppLo.js";
|
|
7
7
|
import { c as READ_SCOPES, d as issuerMetadata, i as credentialsInsideRepository, l as cloudUrl, n as cliRuntime, r as credentialStorage, s as CLI_CLIENT_ID, t as CREDENTIAL_SERVICE } from "./auth-WHKYWtnS.js";
|
|
8
8
|
import { n as randomToken, t as pkce } from "./pkce-DdsRBK7n.js";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -27,7 +27,7 @@ const login = defineLeaf({
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
async run(ctx, { flags }) {
|
|
30
|
-
const { runLogin } = await import("./login-
|
|
30
|
+
const { runLogin } = await import("./login-DnVKv2ib.js");
|
|
31
31
|
return runLogin({
|
|
32
32
|
cwd: ctx.cwd,
|
|
33
33
|
url: given(flags.url),
|
|
@@ -43,7 +43,7 @@ const login = defineLeaf({
|
|
|
43
43
|
const logout = defineLeaf({
|
|
44
44
|
flags: { ...urlFlag },
|
|
45
45
|
async run(ctx, { flags }) {
|
|
46
|
-
const { runLogout } = await import("./login-
|
|
46
|
+
const { runLogout } = await import("./login-DnVKv2ib.js");
|
|
47
47
|
return runLogout({
|
|
48
48
|
url: given(flags.url),
|
|
49
49
|
json: ctx.json,
|
|
@@ -55,7 +55,7 @@ const logout = defineLeaf({
|
|
|
55
55
|
const whoami = defineLeaf({
|
|
56
56
|
flags: { ...urlFlag },
|
|
57
57
|
async run(ctx, { flags }) {
|
|
58
|
-
const { runWhoami } = await import("./login-
|
|
58
|
+
const { runWhoami } = await import("./login-DnVKv2ib.js");
|
|
59
59
|
return runWhoami({
|
|
60
60
|
url: given(flags.url),
|
|
61
61
|
json: ctx.json,
|
|
@@ -30,20 +30,20 @@ const SECTIONS = [
|
|
|
30
30
|
docs: "init",
|
|
31
31
|
effects: ["files"],
|
|
32
32
|
config: false,
|
|
33
|
-
load: async () => (await import("./init-
|
|
33
|
+
load: async () => (await import("./init-B8bPTGMb.js")).init
|
|
34
34
|
}),
|
|
35
35
|
group("preset", "Decode a preset code, or print its permdock.com/create link", "preset", [leaf("decode", "Print what a preset code holds", {
|
|
36
36
|
examples: ["permdock preset decode p1AQIDBAc"],
|
|
37
37
|
docs: "preset",
|
|
38
38
|
effects: [],
|
|
39
39
|
config: false,
|
|
40
|
-
load: async () => (await import("./init-
|
|
40
|
+
load: async () => (await import("./init-B8bPTGMb.js")).presetDecode
|
|
41
41
|
}), leaf("url", "Print the permdock.com/create link that opens a code", {
|
|
42
42
|
examples: ["permdock preset url p1AQIDBAc"],
|
|
43
43
|
docs: "preset",
|
|
44
44
|
effects: [],
|
|
45
45
|
config: false,
|
|
46
|
-
load: async () => (await import("./init-
|
|
46
|
+
load: async () => (await import("./init-B8bPTGMb.js")).presetUrl
|
|
47
47
|
})]),
|
|
48
48
|
group("skills", "Install, update or list the PermDock Agent Skills", "skills", [
|
|
49
49
|
leaf("install", "Copy the Agent Skills into the agent folders", {
|
|
@@ -55,21 +55,21 @@ const SECTIONS = [
|
|
|
55
55
|
docs: "skills",
|
|
56
56
|
effects: ["files"],
|
|
57
57
|
config: false,
|
|
58
|
-
load: async () => (await import("./skills-
|
|
58
|
+
load: async () => (await import("./skills-txCdqGns.js")).install
|
|
59
59
|
}),
|
|
60
60
|
leaf("update", "Replace installed skills with this version's", {
|
|
61
61
|
examples: ["permdock skills update"],
|
|
62
62
|
docs: "skills",
|
|
63
63
|
effects: ["files"],
|
|
64
64
|
config: false,
|
|
65
|
-
load: async () => (await import("./skills-
|
|
65
|
+
load: async () => (await import("./skills-txCdqGns.js")).update
|
|
66
66
|
}),
|
|
67
67
|
leaf("list", "List the skills and where each is installed", {
|
|
68
68
|
examples: ["permdock skills list"],
|
|
69
69
|
docs: "skills",
|
|
70
70
|
effects: [],
|
|
71
71
|
config: false,
|
|
72
|
-
load: async () => (await import("./skills-
|
|
72
|
+
load: async () => (await import("./skills-txCdqGns.js")).list
|
|
73
73
|
})
|
|
74
74
|
]),
|
|
75
75
|
leaf("doctor", "Check a PermDock installation and print a fix for each finding", {
|
|
@@ -83,7 +83,7 @@ const SECTIONS = [
|
|
|
83
83
|
effects: ["files", "database:read"],
|
|
84
84
|
config: true,
|
|
85
85
|
findings: true,
|
|
86
|
-
load: async () => (await import("./doctor-
|
|
86
|
+
load: async () => (await import("./doctor-CDSxgnut.js")).doctor
|
|
87
87
|
}),
|
|
88
88
|
leaf("completion", "Print the shell completion script for bash, zsh or fish", {
|
|
89
89
|
examples: ["permdock completion zsh > ~/.zfunc/_permdock", "eval \"$(permdock completion bash)\""],
|
|
@@ -91,7 +91,7 @@ const SECTIONS = [
|
|
|
91
91
|
effects: [],
|
|
92
92
|
config: false,
|
|
93
93
|
shellOutput: true,
|
|
94
|
-
load: async () => (await import("./completion-
|
|
94
|
+
load: async () => (await import("./completion-9B7fZWsn.js")).completion
|
|
95
95
|
})
|
|
96
96
|
]
|
|
97
97
|
},
|
|
@@ -125,7 +125,7 @@ const SECTIONS = [
|
|
|
125
125
|
docs: "generate",
|
|
126
126
|
effects: ["files"],
|
|
127
127
|
config: true,
|
|
128
|
-
load: async () => (await import("./generate-
|
|
128
|
+
load: async () => (await import("./generate-C8kAhef2.js")).generate
|
|
129
129
|
}),
|
|
130
130
|
leaf("usage", "Report unused, ungranted and role-less permissions and conditions on undeclared fields", {
|
|
131
131
|
examples: ["permdock usage", "permdock usage --fail-on warning"],
|
|
@@ -133,7 +133,7 @@ const SECTIONS = [
|
|
|
133
133
|
effects: [],
|
|
134
134
|
config: true,
|
|
135
135
|
findings: true,
|
|
136
|
-
load: async () => (await import("./usage-
|
|
136
|
+
load: async () => (await import("./usage-DymSoYQZ.js")).usage
|
|
137
137
|
}),
|
|
138
138
|
leaf("diff", "Compare two policies or catalogs; exit 1 on a breaking change", {
|
|
139
139
|
examples: ["permdock diff main.catalog.json permissions.catalog.json", "permdock diff ./old-policy.ts ./src/policy.ts --impact"],
|
|
@@ -175,7 +175,7 @@ const SECTIONS = [
|
|
|
175
175
|
docs: "keys",
|
|
176
176
|
effects: ["rewrite", "files"],
|
|
177
177
|
config: true,
|
|
178
|
-
load: async () => (await import("./keys-
|
|
178
|
+
load: async () => (await import("./keys-QhAlAjXf.js")).keysRename
|
|
179
179
|
})]),
|
|
180
180
|
group("policy", "Write the static grants of a policy as a content-addressed bundle", "policy", [leaf("bundle", "Write the policy bundle that rls.staticGrants 'ref' pins by hash", {
|
|
181
181
|
examples: [
|
|
@@ -186,7 +186,7 @@ const SECTIONS = [
|
|
|
186
186
|
docs: "policy",
|
|
187
187
|
effects: ["files"],
|
|
188
188
|
config: true,
|
|
189
|
-
load: async () => (await import("./policy-
|
|
189
|
+
load: async () => (await import("./policy-AWd-ccJJ.js")).policyBundle
|
|
190
190
|
})]),
|
|
191
191
|
group("claims", "Measure the memberships claim of an access token", "claims", [leaf("size", "Report claim bytes, token characters and the budget cut", {
|
|
192
192
|
examples: ["permdock claims size --memberships 60", "permdock claims size --memberships 11 --roles 3 --json"],
|
|
@@ -201,7 +201,7 @@ const SECTIONS = [
|
|
|
201
201
|
effects: [],
|
|
202
202
|
config: true,
|
|
203
203
|
findings: true,
|
|
204
|
-
load: async () => (await import("./config-
|
|
204
|
+
load: async () => (await import("./config-BgBDv1UW.js")).config
|
|
205
205
|
})
|
|
206
206
|
]
|
|
207
207
|
},
|
|
@@ -214,7 +214,7 @@ const SECTIONS = [
|
|
|
214
214
|
docs: "rls",
|
|
215
215
|
effects: ["files", "database:read"],
|
|
216
216
|
config: true,
|
|
217
|
-
load: async () => (await import("./rls-
|
|
217
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).importPolicies
|
|
218
218
|
}),
|
|
219
219
|
leaf("verify", "Run the fixtures against the policies, or compare a live database", {
|
|
220
220
|
examples: [
|
|
@@ -226,35 +226,35 @@ const SECTIONS = [
|
|
|
226
226
|
effects: ["files", "database:read"],
|
|
227
227
|
config: true,
|
|
228
228
|
findings: true,
|
|
229
|
-
load: async () => (await import("./rls-
|
|
229
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).verify
|
|
230
230
|
}),
|
|
231
231
|
leaf("migrate", "Rewrite hand-written policies onto the generated helpers", {
|
|
232
232
|
examples: ["permdock rls migrate --sql supabase/migrations --dry-run", "permdock rls migrate --sql supabase/migrations"],
|
|
233
233
|
docs: "rls",
|
|
234
234
|
effects: ["rewrite", "files"],
|
|
235
235
|
config: true,
|
|
236
|
-
load: async () => (await import("./rls-
|
|
236
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).migrate
|
|
237
237
|
}),
|
|
238
238
|
leaf("explain", "Show the tables, membership sources and triggers the SQL binds to", {
|
|
239
239
|
examples: ["permdock rls explain", "permdock rls explain --db-url-stdin --json"],
|
|
240
240
|
docs: "rls",
|
|
241
241
|
effects: ["database:read"],
|
|
242
242
|
config: true,
|
|
243
|
-
load: async () => (await import("./rls-
|
|
243
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).explain
|
|
244
244
|
}),
|
|
245
245
|
leaf("measure", "Run requests as a user and count version reads, helper times and share keys", {
|
|
246
246
|
examples: ["permdock rls measure --as <user-id> --local", "permdock rls measure --as <user-id>,<user-id> --tenant <tenant-id> --requests 50 --db-url-stdin"],
|
|
247
247
|
docs: "rls",
|
|
248
248
|
effects: ["database:read"],
|
|
249
249
|
config: true,
|
|
250
|
-
load: async () => (await import("./rls-
|
|
250
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).measure
|
|
251
251
|
}),
|
|
252
252
|
leaf("report", "List each table's policies by command, role, origin and helper calls", {
|
|
253
253
|
examples: ["permdock rls report", "permdock rls report --local --json"],
|
|
254
254
|
docs: "rls",
|
|
255
255
|
effects: ["database:read"],
|
|
256
256
|
config: true,
|
|
257
|
-
load: async () => (await import("./rls-
|
|
257
|
+
load: async () => (await import("./rls-DTN_-HX2.js")).report
|
|
258
258
|
})
|
|
259
259
|
]),
|
|
260
260
|
group("supabase", "Generate the Supabase Custom Access Token Hook, or inspect its manifest", "supabase", [leaf("inspect", "Print or write the hook and helper manifest", {
|
|
@@ -262,14 +262,14 @@ const SECTIONS = [
|
|
|
262
262
|
docs: "supabase",
|
|
263
263
|
effects: ["files"],
|
|
264
264
|
config: true,
|
|
265
|
-
load: async () => (await import("./supabase-
|
|
265
|
+
load: async () => (await import("./supabase-D-kxyoaX.js")).inspect
|
|
266
266
|
})]),
|
|
267
267
|
group("powersync", "Generate PowerSync Sync Streams from the policy, or verify them", "powersync", [leaf("verify", "Fail on stale streams or a stream that syncs a denied row", {
|
|
268
268
|
examples: ["permdock powersync verify", "permdock powersync verify --db-url-stdin"],
|
|
269
269
|
docs: "powersync",
|
|
270
270
|
effects: ["database:read"],
|
|
271
271
|
config: true,
|
|
272
|
-
load: async () => (await import("./powersync-
|
|
272
|
+
load: async () => (await import("./powersync-C84aHECl.js")).verify
|
|
273
273
|
})])
|
|
274
274
|
]
|
|
275
275
|
},
|
|
@@ -283,7 +283,7 @@ const SECTIONS = [
|
|
|
283
283
|
effects: ["files"],
|
|
284
284
|
config: true,
|
|
285
285
|
findings: true,
|
|
286
|
-
load: async () => (await import("./openapi-
|
|
286
|
+
load: async () => (await import("./openapi-CuyzmD9h.js")).emitDocument
|
|
287
287
|
}),
|
|
288
288
|
leaf("annotate", "Write an operations map from @permission comments or an OpenAPI document", {
|
|
289
289
|
examples: ["permdock openapi annotate --routes 'app/**/route.ts'", "permdock openapi annotate --doc openapi.yaml --tenant-path orgId"],
|
|
@@ -291,14 +291,14 @@ const SECTIONS = [
|
|
|
291
291
|
effects: ["files"],
|
|
292
292
|
config: true,
|
|
293
293
|
findings: true,
|
|
294
|
-
load: async () => (await import("./openapi-
|
|
294
|
+
load: async () => (await import("./openapi-CuyzmD9h.js")).annotateRoutes
|
|
295
295
|
}),
|
|
296
296
|
leaf("import", "Turn an OpenAPI document into a generated definition", {
|
|
297
297
|
examples: ["permdock openapi import --doc openapi.yaml --out src/permissions.generated.ts"],
|
|
298
298
|
docs: "openapi",
|
|
299
299
|
effects: ["files", "network"],
|
|
300
300
|
config: false,
|
|
301
|
-
load: async () => (await import("./openapi-
|
|
301
|
+
load: async () => (await import("./openapi-CuyzmD9h.js")).importDocument
|
|
302
302
|
})
|
|
303
303
|
]),
|
|
304
304
|
group("arazzo", "Check Arazzo workflows against the permissions", "arazzo", [leaf("check", "Resolve every Arazzo step to x-permdock-permissions", {
|
|
@@ -307,7 +307,7 @@ const SECTIONS = [
|
|
|
307
307
|
effects: [],
|
|
308
308
|
config: true,
|
|
309
309
|
findings: true,
|
|
310
|
-
load: async () => (await import("./arazzo-
|
|
310
|
+
load: async () => (await import("./arazzo-BKYLAE5e.js")).check
|
|
311
311
|
})]),
|
|
312
312
|
leaf("scan", "List authorization checks written without PermDock, to adopt it in an existing app", {
|
|
313
313
|
examples: ["permdock scan", "permdock scan --src app,lib --pattern isBeta"],
|
|
@@ -315,7 +315,7 @@ const SECTIONS = [
|
|
|
315
315
|
effects: [],
|
|
316
316
|
config: true,
|
|
317
317
|
findings: true,
|
|
318
|
-
load: async () => (await import("./scan-
|
|
318
|
+
load: async () => (await import("./scan-pHPntFbs.js")).scan
|
|
319
319
|
}),
|
|
320
320
|
group("casl", "Import CASL rules into a generated module", "casl", [leaf("import", "Turn CASL rules per role into a permissions and policy module", {
|
|
321
321
|
examples: ["permdock casl import --rules rules.json --out src/permissions.generated.ts"],
|
|
@@ -329,7 +329,7 @@ const SECTIONS = [
|
|
|
329
329
|
docs: "casbin",
|
|
330
330
|
effects: ["files"],
|
|
331
331
|
config: false,
|
|
332
|
-
load: async () => (await import("./casbin-
|
|
332
|
+
load: async () => (await import("./casbin-BmYeMFeI.js")).casbinImport
|
|
333
333
|
})])
|
|
334
334
|
]
|
|
335
335
|
},
|
|
@@ -341,34 +341,34 @@ const SECTIONS = [
|
|
|
341
341
|
docs: "login",
|
|
342
342
|
effects: ["network", "files"],
|
|
343
343
|
config: false,
|
|
344
|
-
load: async () => (await import("./login-
|
|
344
|
+
load: async () => (await import("./login-kQOIJoFN.js")).login
|
|
345
345
|
}),
|
|
346
346
|
leaf("logout", "Revoke and delete the stored PermDock Cloud login", {
|
|
347
347
|
examples: ["permdock logout"],
|
|
348
348
|
docs: "login",
|
|
349
349
|
effects: ["network", "files"],
|
|
350
350
|
config: false,
|
|
351
|
-
load: async () => (await import("./login-
|
|
351
|
+
load: async () => (await import("./login-kQOIJoFN.js")).logout
|
|
352
352
|
}),
|
|
353
353
|
leaf("whoami", "Print the PermDock Cloud identity the CLI acts as", {
|
|
354
354
|
examples: ["permdock whoami", "permdock whoami --json"],
|
|
355
355
|
docs: "login",
|
|
356
356
|
effects: [],
|
|
357
357
|
config: false,
|
|
358
|
-
load: async () => (await import("./login-
|
|
358
|
+
load: async () => (await import("./login-kQOIJoFN.js")).whoami
|
|
359
359
|
}),
|
|
360
360
|
group("cloud", "Publish to or pull from a PermDock Cloud project", "cloud", [leaf("push", "Publish the catalog, policy and manifest to a Cloud project", {
|
|
361
361
|
examples: ["permdock cloud push --dry-run", "permdock cloud push --project prj_123"],
|
|
362
362
|
docs: "cloud",
|
|
363
363
|
effects: ["network", "cloud:write"],
|
|
364
364
|
config: true,
|
|
365
|
-
load: async () => (await import("./cloud-
|
|
365
|
+
load: async () => (await import("./cloud-DxDQff7G.js")).push
|
|
366
366
|
}), leaf("pull", "Write a Cloud project's published catalog and manifest", {
|
|
367
367
|
examples: ["permdock cloud pull --project prj_123"],
|
|
368
368
|
docs: "cloud",
|
|
369
369
|
effects: ["network", "files"],
|
|
370
370
|
config: true,
|
|
371
|
-
load: async () => (await import("./cloud-
|
|
371
|
+
load: async () => (await import("./cloud-DxDQff7G.js")).pull
|
|
372
372
|
})])
|
|
373
373
|
]
|
|
374
374
|
},
|
|
@@ -383,7 +383,7 @@ const SECTIONS = [
|
|
|
383
383
|
docs: "codemod",
|
|
384
384
|
effects: ["rewrite"],
|
|
385
385
|
config: false,
|
|
386
|
-
load: async () => (await import("./codemod-
|
|
386
|
+
load: async () => (await import("./codemod-DjcAtHr9.js")).codemod
|
|
387
387
|
})]
|
|
388
388
|
}
|
|
389
389
|
];
|
|
@@ -395,7 +395,7 @@ const COMPLETE_LEAF = leaf("__complete", "Print completion candidates for a part
|
|
|
395
395
|
config: false,
|
|
396
396
|
shellOutput: true,
|
|
397
397
|
hidden: true,
|
|
398
|
-
load: async () => (await import("./completion-
|
|
398
|
+
load: async () => (await import("./completion-9B7fZWsn.js")).complete
|
|
399
399
|
});
|
|
400
400
|
const ROOT = group("permdock", "Collect, export, diff and check the permissions a PermDock policy declares", "", [...SECTIONS.flatMap((section) => section.entries), COMPLETE_LEAF]);
|
|
401
401
|
/** Each leaf with its path from the root, in manifest order. */
|
|
@@ -6,7 +6,7 @@ import "./sources-C6Id63F8.js";
|
|
|
6
6
|
import { i as loadConfiguredPolicy } from "./load-m7jmit3y.js";
|
|
7
7
|
import { a as quoteIdent } from "./quote-LNaBdCGA.js";
|
|
8
8
|
import { n as activeSource } from "./memberships-CDiSsFTu.js";
|
|
9
|
-
import { n as configuredTableReads } from "./table-reads-
|
|
9
|
+
import { n as configuredTableReads } from "./table-reads-Doh_Egx2.js";
|
|
10
10
|
// src/cli/rls/measure.ts
|
|
11
11
|
/** Requests per tenant when `--requests` is absent. */
|
|
12
12
|
const DEFAULT_REQUESTS = 20;
|
|
@@ -7,7 +7,7 @@ import { o as sqlFiles } from "./files-DAR51W3J.js";
|
|
|
7
7
|
import { c as jsonSchemaOf } from "./catalog-doc-BX97oFAn.js";
|
|
8
8
|
import { a as quoteIdent, o as quoteLiteral } from "./quote-LNaBdCGA.js";
|
|
9
9
|
import { a as parseSqlFile, f as stringValues, l as readRelation, t as SqlSyntaxError, u as removeStatements } from "./ast-Dnm2TOHN.js";
|
|
10
|
-
import { f as compileConditionSql } from "./rbac-
|
|
10
|
+
import { f as compileConditionSql } from "./rbac-ByuGspKZ.js";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
12
|
import { relative } from "node:path";
|
|
13
13
|
// src/cli/sql/exported-copies.ts
|
|
@@ -79,7 +79,7 @@ const emitFlags = {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
async function executeOpenapiEmit(ctx, flags) {
|
|
82
|
-
return (await import("./openapi-
|
|
82
|
+
return (await import("./openapi-D7kRYqWu.js")).runOpenapi({
|
|
83
83
|
cwd: ctx.cwd,
|
|
84
84
|
config: ctx.config,
|
|
85
85
|
rest: ["emit"],
|
|
@@ -183,7 +183,7 @@ const importDocument = defineLeaf({
|
|
|
183
183
|
async run(ctx, { flags }) {
|
|
184
184
|
const doc = given(flags.doc);
|
|
185
185
|
if (doc === void 0) throw missingInput("openapi import", ["--doc"], "the OpenAPI document to import");
|
|
186
|
-
return (await import("./import-
|
|
186
|
+
return (await import("./import-BLN-HGJG.js")).runOpenapiImport({
|
|
187
187
|
cwd: ctx.cwd,
|
|
188
188
|
doc,
|
|
189
189
|
out: fileOut("openapi import", flags.out),
|
|
@@ -7,7 +7,7 @@ import { i as fileDrift } from "./output-files-8lfALMSU.js";
|
|
|
7
7
|
import { t as shortDiff } from "./text-diff-DxKRNFlx.js";
|
|
8
8
|
import { i as readJsonFile, s as writeFileEnsuringDir } from "./files-DAR51W3J.js";
|
|
9
9
|
import { a as loadModule, n as asPolicy, s as pickNamed, t as asPermissionTree } from "./load-m7jmit3y.js";
|
|
10
|
-
import { n as validateOverlay, t as validateOpenapi } from "./schema-
|
|
10
|
+
import { n as validateOverlay, t as validateOpenapi } from "./schema-DJd7Gq_p.js";
|
|
11
11
|
import { existsSync } from "node:fs";
|
|
12
12
|
import { resolve } from "node:path";
|
|
13
13
|
// src/cli/openapi/emit/merge.ts
|