permdock 0.26.0 → 0.27.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-b0_Xpab8.js → adoption-scan-Bd-m2Fe_.js} +1 -1
- package/dist/{arazzo-Hxerfx3_.js → arazzo-BGfRLmhk.js} +1 -1
- package/dist/{arazzo-DMmcumRx.js → arazzo-CsifZ8xx.js} +1 -1
- package/dist/{casbin-CYwbggCS.js → casbin-D8T6IXmf.js} +1 -1
- package/dist/{casbin-Co1KcLWU.js → casbin-n0dqdBSj.js} +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/watch-worker.js +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/cli/plugins/app.d.ts +10 -4
- package/dist/cli/plugins/app.js +15 -5
- 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/{cloud-BfEI9TLS.js → cloud-g-922e2y.js} +1 -1
- package/dist/{codemod-DwH0IZ2x.js → codemod-9WzZaZsY.js} +1 -1
- package/dist/{codemod-p67ePW25.js → codemod-BrSNfQG4.js} +2 -2
- package/dist/{compile-Blrr5WWw.js → compile-DVzlNtwB.js} +1 -1
- package/dist/{completion-CfrZOGcB.js → completion-Duu9XUtU.js} +1 -1
- package/dist/{config-D6gh_xvs.js → config-B46LCIi1.js} +1 -1
- package/dist/{config-report-BaHEBpt-.js → config-report-BwSd_ErT.js} +1 -1
- package/dist/{doctor-DCsyH7YR.js → doctor-BaqGN07N.js} +2 -2
- package/dist/{doctor-Bg12v-8M.js → doctor-CNV-I5-C.js} +13 -13
- package/dist/{execute-SN8_dlch.js → execute-DVGgG2j9.js} +1 -1
- package/dist/{gen-B4GUqsfM.js → gen-DovbVJ0i.js} +31 -23
- package/dist/{gen-kind-Bahz_i3U.js → gen-kind-DRWg-ta4.js} +3 -1
- package/dist/gen-rrMLA6rz.js +1 -0
- package/dist/{generate-CbtjKcjn.js → generate-DBmalxoO.js} +1 -1
- package/dist/{generate-options-BDgadlwe.js → generate-options-WJQoS1Lu.js} +112 -31
- package/dist/{generate-B-msjuaO.js → generate-yGW045al.js} +10 -11
- package/dist/{hook-sql-BIR4fL7i.js → hook-sql-FU-vnUkl.js} +3 -3
- package/dist/{import-BZi1tZxq.js → import-C7tYaABo.js} +1 -1
- package/dist/{init-K3tKOwf4.js → init-CN7tPYLP.js} +3 -3
- package/dist/{init-9cqnSJWG.js → init-CntB_X4r.js} +1 -1
- package/dist/{login-CP0UxnLw.js → login-CnR0EQd6.js} +1 -1
- package/dist/{login-C1I5KIsK.js → login-gwlxVT40.js} +3 -3
- package/dist/{manifest-DvS2IoXo.js → manifest-B2syNUwo.js} +30 -30
- package/dist/next/plugin.d.ts +1 -1
- package/dist/{openapi-BT5XY7HY.js → openapi-C4btogJT.js} +1 -1
- package/dist/{openapi-document-Ca5yAjc6.js → openapi-document-BqXMCObA.js} +1 -1
- package/dist/{openapi-BHqqNSoG.js → openapi-qD85gUJ5.js} +1 -1
- package/dist/{output-djxu62oH.js → output-ubzzotuT.js} +1 -1
- package/dist/{ownership-BO0sI5FB.js → ownership-Cw5-N2Ul.js} +1 -1
- package/dist/{plugin-DGmbeXwA.d.ts → plugin-1XW5OfAZ.d.ts} +1 -1
- package/dist/{policy-BhSUlHRr.js → policy-C3-aUrcn.js} +1 -1
- package/dist/{policy-bundle-97xaDULc.js → policy-bundle-COTjSP1d.js} +3 -3
- package/dist/{powersync-DdDLP02A.js → powersync-3MJa650H.js} +4 -4
- package/dist/{powersync-CN7IQIKk.js → powersync-BcIQ5rz6.js} +1 -1
- package/dist/{powersync-m9uYgCFF.js → powersync-DzFm4hgt.js} +1 -1
- package/dist/pull-8AsfQuQR.js +1 -0
- package/dist/{pull-9oQvY18T.js → pull-AjAqYEpz.js} +1 -1
- package/dist/{resolve-names-Cmg6SPAa.js → resolve-names-Bb6tL3EI.js} +1 -1
- package/dist/{rls-Cv1V8YfI.js → rls-GYIzJF3m.js} +5 -5
- package/dist/{rls-files-Bj446vbj.js → rls-files-D1aDyRlu.js} +1 -1
- package/dist/{rls-BrsMogAP.js → rls-fzNIKj80.js} +1 -1
- package/dist/{rls-options-Dpj_pEyU.d.ts → rls-options-CEpg5nDP.d.ts} +1 -1
- package/dist/{run-DX4D6S6V.js → run-Cs9E4tsz.js} +2 -2
- package/dist/run-Dordj5mh.js +1 -0
- package/dist/{scan-Cj7PQLrS.js → scan-CoG-QiZ6.js} +1 -1
- package/dist/{schema-CJPvTfeN.js → schema-C1J6y5a1.js} +1 -1
- package/dist/{skills-Cr1C0b9D.js → skills-ByTBjMpX.js} +1 -1
- package/dist/{skills-B5bc6JIA.js → skills-CkRRq5tM.js} +1 -1
- package/dist/{supabase-BG1HPdQU.js → supabase-DlINOaAC.js} +1 -1
- package/dist/supabase-hook-BMBUDtLU.js +2 -0
- package/dist/{supabase-hook-tdR45aXY.js → supabase-hook-CjVG8JJC.js} +1 -1
- package/dist/{tables-CRTCBuFi.js → tables-BYICzaNo.js} +24 -13
- package/dist/{types-D8VXQxKL.d.ts → types-nXo_oQYk.d.ts} +6 -2
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/{usage-B-E747wO.js → usage-CFSPH513.js} +1 -1
- package/dist/usage-DfponlA-.js +1 -0
- package/dist/{usage-B7nx0_aa.js → usage-EQlT--OM.js} +2 -2
- package/dist/{verify-9HObfifg.js → verify-BNhn8P33.js} +3 -3
- package/package.json +1 -1
- package/dist/gen-BC66z5Fd.js +0 -1
- package/dist/pull-jvJPMQhP.js +0 -1
- package/dist/run-decqEKNa.js +0 -1
- package/dist/supabase-hook-hd9abKy4.js +0 -2
- package/dist/usage-rqQ9ViXv.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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-C0e-BzGW.js";
|
|
4
|
-
import { t as executeGenerate } from "./execute-
|
|
4
|
+
import { t as executeGenerate } from "./execute-DVGgG2j9.js";
|
|
5
5
|
import { t as receiptRows } from "./pipeline-CXuwijr2.js";
|
|
6
6
|
// src/cli/commands/generate.ts
|
|
7
7
|
function concurrencyFlag(value) {
|
|
@@ -12,15 +12,15 @@ import { t as beforeFirst } from "./text-D704xHVl.js";
|
|
|
12
12
|
import { l as parseSplit } from "./output-files-DNid6TBl.js";
|
|
13
13
|
import { f as orSql, g as branchClauses } from "./fields-6d1j-q3c.js";
|
|
14
14
|
import { a as quoteIdent, c as quoteTable, i as qualified, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
15
|
-
import { A as tenantTypeOf, C as parseMembershipsFlag, D as idTypeOf, E as firstScopeType, O as scopeTypeOf, a as customRolesOn, r as HELPERS, s as signedIn, t as CUSTOM_ROLES, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
|
|
15
|
+
import { A as tenantTypeOf, C as parseMembershipsFlag, D as idTypeOf, E as firstScopeType, O as scopeTypeOf, a as customRolesOn, l as USER_ID_HELPER, r as HELPERS, s as signedIn, t as CUSTOM_ROLES, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
|
|
16
16
|
import { H as byKey, I as raiseSql, K as graphSqlName, M as currentKeyExpr, R as rolesTableScope, V as byCodeUnit, _ as memoizes, g as memoizedSetofSql, ht as checkSuspension, i as interactiveOnlyKeys, m as memoHitList, o as memoUserSql } from "./interactive-only-BZu9rLpa.js";
|
|
17
|
-
import { A as
|
|
18
|
-
import { t as resolveNames } from "./resolve-names-
|
|
17
|
+
import { A as tokenScopeUnlimitedSql, B as apiKeyUnlimitedSql, E as memoReadsSql, I as API_KEY_ALLOWS, M as memoReadTriggersSql, O as TOKEN_SCOPE_ALLOWS, R as apiKeyClaimSql, V as apiKeysPlan, X as graphIdsSql, Y as closureDepths, Z as graphPlan, a as tablelessResources, d as permittedByPermissionHelper, i as tableNames, j as tokenScopesPlan, n as resolveVias, o as PERMISSION_HELPERS, t as checkSharedTables } from "./tables-BYICzaNo.js";
|
|
18
|
+
import { t as resolveNames } from "./resolve-names-Bb6tL3EI.js";
|
|
19
19
|
import { a as roleNames, t as assignableRoles } from "./grants-BzjbUCdR.js";
|
|
20
20
|
import { a as resolveAuthorize } from "./rbac-B-49toAp.js";
|
|
21
|
-
import { r as unsatisfiedKinds, t as ownershipRules } from "./ownership-
|
|
21
|
+
import { r as unsatisfiedKinds, t as ownershipRules } from "./ownership-Cw5-N2Ul.js";
|
|
22
22
|
import { t as membershipSourcesOf } from "./sources-BbSUNmFX.js";
|
|
23
|
-
import { i as tableFor } from "./compile-
|
|
23
|
+
import { i as tableFor } from "./compile-DVzlNtwB.js";
|
|
24
24
|
// src/cli/rls/custom-role-rebuild.ts
|
|
25
25
|
const PREFIX = "PermDock CLI";
|
|
26
26
|
/** A column of the roles-table row `r`. */
|
|
@@ -346,6 +346,74 @@ create trigger ${quoteIdent(trigger)}
|
|
|
346
346
|
if (from.includes !== void 0 && plan.includesRef !== void 0) chunks.push(one("includes", from.includes.table, plan.includesRef), guardOne("includes", from.includes.table, plan.includesRef));
|
|
347
347
|
return `${chunks.join("\n\n")}\n`;
|
|
348
348
|
}
|
|
349
|
+
// src/cli/rls/hoist.ts
|
|
350
|
+
const HOISTED = "permdock_hoisted";
|
|
351
|
+
const LITERAL_ARGS = "(?:'(?:[^']|'')*'(?:, ?'(?:[^']|'')*')*)?";
|
|
352
|
+
const UNLIMITED_KEY = "key_unlimited";
|
|
353
|
+
const UNLIMITED_SCOPE = "scope_unlimited";
|
|
354
|
+
function escape(text) {
|
|
355
|
+
return text.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`);
|
|
356
|
+
}
|
|
357
|
+
function callPattern(prefix, names) {
|
|
358
|
+
return `(?<!in )\\(select ${prefix}(?:${names})\\(${LITERAL_ARGS}\\)\\)`;
|
|
359
|
+
}
|
|
360
|
+
function invariantPattern(ctx) {
|
|
361
|
+
const prefix = escape(qualified(ctx, ""));
|
|
362
|
+
const scalar = [PERMISSION_HELPERS.has, USER_ID_HELPER].join("|");
|
|
363
|
+
return new RegExp(`${callPattern(prefix, scalar)}|array\\(select ${prefix}\\w+_by_permission\\(${LITERAL_ARGS}\\)\\)`, "gu");
|
|
364
|
+
}
|
|
365
|
+
function ceilingPattern(ctx, name) {
|
|
366
|
+
return new RegExp(callPattern(escape(qualified(ctx, "")), name), "gu");
|
|
367
|
+
}
|
|
368
|
+
function guardCeilings(ctx, sql, used) {
|
|
369
|
+
let out = sql;
|
|
370
|
+
if (ctx.apiKeys !== void 0) out = out.replaceAll(ceilingPattern(ctx, API_KEY_ALLOWS), (call) => {
|
|
371
|
+
used.add(UNLIMITED_KEY);
|
|
372
|
+
return `(${HOISTED}.${UNLIMITED_KEY} or ${call})`;
|
|
373
|
+
});
|
|
374
|
+
if (ctx.tokenScopes !== void 0) out = out.replaceAll(ceilingPattern(ctx, TOKEN_SCOPE_ALLOWS), (call) => {
|
|
375
|
+
used.add(UNLIMITED_SCOPE);
|
|
376
|
+
return `(${HOISTED}.${UNLIMITED_SCOPE} or ${call})`;
|
|
377
|
+
});
|
|
378
|
+
return out;
|
|
379
|
+
}
|
|
380
|
+
function ceilingColumns(ctx, used) {
|
|
381
|
+
const out = [];
|
|
382
|
+
if (used.has(UNLIMITED_KEY) && ctx.apiKeys !== void 0) out.push(`coalesce(${apiKeyUnlimitedSql(`(${apiKeyClaimSql(ctx, ctx.apiKeys)})`)}, false) as ${UNLIMITED_KEY}`);
|
|
383
|
+
if (used.has(UNLIMITED_SCOPE)) out.push(`coalesce(${tokenScopeUnlimitedSql(ctx)}, false) as ${UNLIMITED_SCOPE}`);
|
|
384
|
+
return out;
|
|
385
|
+
}
|
|
386
|
+
function hoistInvariants(ctx, arms) {
|
|
387
|
+
const pattern = invariantPattern(ctx);
|
|
388
|
+
const counts = /* @__PURE__ */ new Map();
|
|
389
|
+
for (const arm of arms) for (const call of arm.sql.match(pattern) ?? []) counts.set(call, (counts.get(call) ?? 0) + 1);
|
|
390
|
+
const found = /* @__PURE__ */ new Map();
|
|
391
|
+
const ceilings = /* @__PURE__ */ new Set();
|
|
392
|
+
const rewritten = arms.map((arm) => ({
|
|
393
|
+
key: arm.key,
|
|
394
|
+
sql: guardCeilings(ctx, arm.sql.replaceAll(pattern, (call) => {
|
|
395
|
+
if ((counts.get(call) ?? 0) < 2) return call;
|
|
396
|
+
let entry = found.get(call);
|
|
397
|
+
if (entry === void 0) {
|
|
398
|
+
entry = {
|
|
399
|
+
column: `h${String(found.size + 1)}`,
|
|
400
|
+
keys: []
|
|
401
|
+
};
|
|
402
|
+
found.set(call, entry);
|
|
403
|
+
}
|
|
404
|
+
if (!entry.keys.includes(arm.key)) entry.keys.push(arm.key);
|
|
405
|
+
return `${HOISTED}.${entry.column}`;
|
|
406
|
+
}), ceilings)
|
|
407
|
+
}));
|
|
408
|
+
const columns = [...[...found].map(([call, { column, keys }]) => `case when p_permission in (${keys.map(quoteLiteral).join(", ")}) then ${call} end as ${column}`), ...ceilingColumns(ctx, ceilings)];
|
|
409
|
+
return columns.length === 0 ? {
|
|
410
|
+
arms,
|
|
411
|
+
columns: void 0
|
|
412
|
+
} : {
|
|
413
|
+
arms: rewritten,
|
|
414
|
+
columns: columns.join(",\n ")
|
|
415
|
+
};
|
|
416
|
+
}
|
|
349
417
|
// src/cli/rls/row-memo.ts
|
|
350
418
|
function memoRowTriggersSql(ctx, policy, tables, rowSets = "") {
|
|
351
419
|
const plan = graphPlan(policy);
|
|
@@ -404,12 +472,36 @@ function usingOf(branches) {
|
|
|
404
472
|
const parts = branches.map(clauseOf);
|
|
405
473
|
return parts.length === 0 ? void 0 : orSql(parts);
|
|
406
474
|
}
|
|
407
|
-
function
|
|
475
|
+
function permissionArm(branches) {
|
|
408
476
|
const allow = usingOf(branches.filter((branch) => branch.effect === "allow"));
|
|
409
477
|
if (allow === void 0) return;
|
|
410
478
|
const deny = usingOf(branches.filter((branch) => branch.effect === "deny"));
|
|
411
479
|
const granted = `coalesce((${allow}), false)`;
|
|
412
|
-
return
|
|
480
|
+
return deny === void 0 ? granted : `${granted} and (${deny}) is not true`;
|
|
481
|
+
}
|
|
482
|
+
function caseSql(ctx, branches, otherwise) {
|
|
483
|
+
const arms = [...branches.keys()].toSorted().flatMap((key) => {
|
|
484
|
+
const sql = permissionArm(branches.get(key) ?? []);
|
|
485
|
+
return sql === void 0 ? [] : [{
|
|
486
|
+
key,
|
|
487
|
+
sql
|
|
488
|
+
}];
|
|
489
|
+
});
|
|
490
|
+
if (arms.length === 0) return {
|
|
491
|
+
where: otherwise,
|
|
492
|
+
hoisted: void 0
|
|
493
|
+
};
|
|
494
|
+
const hoisted = hoistInvariants(ctx, arms);
|
|
495
|
+
return {
|
|
496
|
+
where: `case p_permission\n${hoisted.arms.map((arm) => ` when ${quoteLiteral(arm.key)} then ${arm.sql}`).join("\n")}\n else ${otherwise}\n end`,
|
|
497
|
+
hoisted: hoisted.columns
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function hoistedCte(hoisted) {
|
|
501
|
+
return hoisted === void 0 ? "" : `${HOISTED} as materialized (\n select\n ${hoisted}\n )`;
|
|
502
|
+
}
|
|
503
|
+
function fromHoisted(hoisted) {
|
|
504
|
+
return hoisted === void 0 ? "" : `, ${HOISTED}`;
|
|
413
505
|
}
|
|
414
506
|
function forUserSql(ctx, fn, helper, ids, idType) {
|
|
415
507
|
const user = ctx.dialect === "supabase" ? "uuid" : "text";
|
|
@@ -483,9 +575,10 @@ function canHelper(resource) {
|
|
|
483
575
|
}
|
|
484
576
|
function matchSql(ctx, node, table, branches) {
|
|
485
577
|
const fn = qualified(ctx, matchHelper(node.name));
|
|
578
|
+
const { where, hoisted } = caseSql(ctx, branches, "false");
|
|
486
579
|
const seenTouch = /* @__PURE__ */ new Set();
|
|
487
580
|
const touches = (ctx.memoTouches ?? []).filter((touch) => {
|
|
488
|
-
if (seenTouch.has(touch.call)) return false;
|
|
581
|
+
if (seenTouch.has(touch.call) || !where.includes(touch.call)) return false;
|
|
489
582
|
seenTouch.add(touch.call);
|
|
490
583
|
return true;
|
|
491
584
|
}).map((touch) => `(select count(*) from (${memoHitList(touch.scope, touch.keySql, touch.call, `${memoUserSql(ctx, subjectIdSql(ctx))}::text`, ctx.memo)}) s) >= 0`).join(" and ");
|
|
@@ -498,8 +591,8 @@ security definer
|
|
|
498
591
|
${plannerOf(ctx)}
|
|
499
592
|
set search_path = ''
|
|
500
593
|
as $$
|
|
501
|
-
with ${CANDIDATES} as (select (p_row).*)
|
|
502
|
-
select exists (select 1 from ${CANDIDATES} where ${guard}${
|
|
594
|
+
with ${CANDIDATES} as (select (p_row).*)${hoisted === void 0 ? "" : `,\n ${hoistedCte(hoisted)}`}
|
|
595
|
+
select exists (select 1 from ${CANDIDATES}${fromHoisted(hoisted)} where ${guard}${where})
|
|
503
596
|
$$;
|
|
504
597
|
revoke execute on function ${fn}(${table}, text) from public, anon;
|
|
505
598
|
grant execute on function ${fn}(${table}, text) to authenticated;`;
|
|
@@ -545,13 +638,6 @@ $$;
|
|
|
545
638
|
revoke execute on function ${fn}(${idType}, text) from public, anon;
|
|
546
639
|
grant execute on function ${fn}(${idType}, text) to authenticated;`;
|
|
547
640
|
}
|
|
548
|
-
function whereOf(branches) {
|
|
549
|
-
const cases = [...branches.keys()].toSorted().flatMap((key) => {
|
|
550
|
-
const sql = permissionCase(key, branches.get(key) ?? []);
|
|
551
|
-
return sql === void 0 ? [] : [sql];
|
|
552
|
-
});
|
|
553
|
-
return cases.length === 0 ? "false" : `case p_permission\n${cases.join("\n")}\n else false\n end`;
|
|
554
|
-
}
|
|
555
641
|
function candidatesSql(fn, table, id, idType, match) {
|
|
556
642
|
const assign = (indent) => `${indent}v_row.${id} := v_id;\n${indent}v_rows := pg_catalog.array_append(v_rows, v_row);`;
|
|
557
643
|
return `create or replace function ${fn}(p_permission text, p_ids ${idType}[])
|
|
@@ -687,15 +773,13 @@ as $$
|
|
|
687
773
|
$$;
|
|
688
774
|
${grants}`;
|
|
689
775
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const arms = [...branches].toSorted(([a], [b]) => Number(a > b) - Number(a < b)).flatMap(([key, list]) => permissionCase(key, list) ?? []);
|
|
698
|
-
return arms.length === 0 ? match : `case p_permission\n${arms.join("\n")}\n else ${match}\n end`;
|
|
776
|
+
function rowsCaseSql(ctx, node, branches) {
|
|
777
|
+
return caseSql(ctx, branches, `${qualified(ctx, matchHelper(node.name))}(${ROW}, p_permission)`);
|
|
778
|
+
}
|
|
779
|
+
function rowsQuery(head, table, where, cases) {
|
|
780
|
+
const cte = hoistedCte(cases.hoisted);
|
|
781
|
+
return `${cte === "" ? "" : `with ${cte}\n `}${head} from ${table} as ${ROW}${fromHoisted(cases.hoisted)}
|
|
782
|
+
where ${where}${cases.where}`;
|
|
699
783
|
}
|
|
700
784
|
/**
|
|
701
785
|
* `permitted_<resource>_ids_in(p_permission, p_ids)`: the given ids the caller
|
|
@@ -742,9 +826,7 @@ ${rowSetFunctionSql(ctx, {
|
|
|
742
826
|
node,
|
|
743
827
|
params: [["p_permission", "text"], ["p_tenant", tenantType]],
|
|
744
828
|
idType,
|
|
745
|
-
query: `select ${quoteIdent(node.id)}::${idType}
|
|
746
|
-
where ${ROW}.${quoteIdent(column)} = p_tenant
|
|
747
|
-
and ${rowsWhereSql(ctx, node, branches)}`
|
|
829
|
+
query: rowsQuery(`select ${quoteIdent(node.id)}::${idType}`, table, `${ROW}.${quoteIdent(column)} = p_tenant\n and `, rowsCaseSql(ctx, node, branches))
|
|
748
830
|
})}
|
|
749
831
|
-- ${node.name}: how many of them the caller may act on, counted up to p_cap
|
|
750
832
|
create or replace function ${count}(p_permission text, p_tenant ${tenantType}, p_cap integer)
|
|
@@ -775,8 +857,7 @@ ${rowSetFunctionSql(ctx, {
|
|
|
775
857
|
node,
|
|
776
858
|
params: [["p_permission", "text"]],
|
|
777
859
|
idType,
|
|
778
|
-
query: `select ${quoteIdent(node.id)}::${idType}
|
|
779
|
-
where ${rowsWhereSql(ctx, node, branches)}`
|
|
860
|
+
query: rowsQuery(`select ${quoteIdent(node.id)}::${idType}`, table, "", rowsCaseSql(ctx, node, branches))
|
|
780
861
|
})}
|
|
781
862
|
${candidatesSql(fn, table, quoteIdent(node.id), idType, match)}
|
|
782
863
|
${idsInSql(ctx, node, fn, idType)}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { c as listPermissions, u as renamedKeys } from "./permission-registry-DMYRZVcn.js";
|
|
2
2
|
import { t as policyRowConditionKeys } from "./row-conditions-DwIJocfQ.js";
|
|
3
3
|
import { a as describeError, i as configError, o as exitCodeOfError } from "./errors-DgLOqc6j.js";
|
|
4
|
-
import { D as seedSql,
|
|
4
|
+
import { D as seedSql, J as closureBackfillSql, N as guardAuthAdminGrants, P as unguardAuthAdminGrants, Q as graphSql, S as accessSql, T as helpersSql, c as permissionHelpersSql, d as permittedByPermissionHelper, i as tableNames, r as tableNameOf, s as checkName, u as permissionKeysHelper } from "./tables-BYICzaNo.js";
|
|
5
5
|
import { i as qualifySqlTable } from "./sql-T4GaBh9X.js";
|
|
6
|
-
import { c as indexesSql, i as tableFor, l as pruneIndexTargets, n as compileGrants, r as inferredCommand, s as indexTargets, u as readTableIndexFacts } from "./compile-
|
|
7
|
-
import { a as CANDIDATES, c as rowHelpersSql, d as rebuildPlan, i as buildContext, l as rowSetSql, n as isRefusal, o as inheritTargets, r as splitsPart, s as levelKeys, t as generateOptions, u as DROPPED_LIST } from "./generate-options-
|
|
6
|
+
import { c as indexesSql, i as tableFor, l as pruneIndexTargets, n as compileGrants, r as inferredCommand, s as indexTargets, u as readTableIndexFacts } from "./compile-DVzlNtwB.js";
|
|
7
|
+
import { a as CANDIDATES, c as rowHelpersSql, d as rebuildPlan, i as buildContext, l as rowSetSql, n as isRefusal, o as inheritTargets, r as splitsPart, s as levelKeys, t as generateOptions, u as DROPPED_LIST } from "./generate-options-WJQoS1Lu.js";
|
|
8
8
|
import { t as policyFromCatalog } from "./policy-from-catalog-YKaTeaco.js";
|
|
9
|
-
import { t as fetchProjectPolicy } from "./pull-
|
|
9
|
+
import { t as fetchProjectPolicy } from "./pull-AjAqYEpz.js";
|
|
10
10
|
import { c as requirePolicy } from "./load-CZnlAyZ8.js";
|
|
11
11
|
import { t as compact } from "./compact-C4LFuqbW.js";
|
|
12
|
-
import { a as nonEmptyOr } from "./output-
|
|
12
|
+
import { a as nonEmptyOr } from "./output-ubzzotuT.js";
|
|
13
13
|
import { i as INDEXES_MARKER, n as GRANTS_MARKER, o as SEEDS_MARKER, t as BACKFILL_MARKER } from "./markers-C-kThnKN.js";
|
|
14
14
|
import { G as graphHelper, H as byKey, K as graphSqlName, U as BOOTSTRAP_PERMISSIONS, lt as scopeSources, rt as memberIdsHelper, st as permittedIdsHelper, ut as scopeTable } from "./interactive-only-BZu9rLpa.js";
|
|
15
15
|
import { a as quoteIdent, c as quoteTable, i as qualified$1, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
16
16
|
import { D as idTypeOf, O as scopeTypeOf, _ as subjectClaimJsonSql, c as SESSION_LIVE_HELPER, g as sessionLiveHelperSql, o as rootName, r as HELPERS, t as CUSTOM_ROLES, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
|
|
17
|
-
import { a as supabaseHookSql, c as asideAuthzReceive, h as declarativeSql, p as resolveSchemas, t as grantsLabel, u as approvalsSql } from "./hook-sql-
|
|
18
|
-
import { i as assignmentSql, n as ownershipSql } from "./ownership-
|
|
17
|
+
import { a as supabaseHookSql, c as asideAuthzReceive, h as declarativeSql, p as resolveSchemas, t as grantsLabel, u as approvalsSql } from "./hook-sql-FU-vnUkl.js";
|
|
18
|
+
import { i as assignmentSql, n as ownershipSql } from "./ownership-Cw5-N2Ul.js";
|
|
19
19
|
import { p as scopeField } from "./tenancy-B5Xxt9Sc.js";
|
|
20
20
|
import { i as collectGrants, n as breakGlassHolder, r as breakGlassKey } from "./grants-BzjbUCdR.js";
|
|
21
21
|
import { t as supautilsRejections } from "./supautils-DXzJ2E2Q.js";
|
|
22
22
|
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-6d1j-q3c.js";
|
|
23
23
|
import { l as isFieldRelation } from "./resource-relations-Ck5sjYQR.js";
|
|
24
24
|
import { c as rootScope } from "./scopes-B-KX9EI8.js";
|
|
25
|
-
import { n as permissionHoldersSql } from "./resolve-names-
|
|
25
|
+
import { n as permissionHoldersSql } from "./resolve-names-Bb6tL3EI.js";
|
|
26
26
|
import { i as rbacScaffold } from "./rbac-B-49toAp.js";
|
|
27
27
|
import { i as dateAt } from "./time-r0CKBm57.js";
|
|
28
28
|
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-DNid6TBl.js";
|
|
@@ -1198,7 +1198,6 @@ function bootstrapPermissionsSql(ctx, keys, grants) {
|
|
|
1198
1198
|
const platform = Object.entries(grants.get("global") ?? {}).filter(([key, effects]) => effects.allow.length > 0 && keys.includes(key)).map(([key]) => key).toSorted();
|
|
1199
1199
|
const memberIds = qualified$1(ctx, memberIdsHelper(root));
|
|
1200
1200
|
const held = qualified$1(ctx, checkName(permissionKeysHelper(root)));
|
|
1201
|
-
const has = qualified$1(ctx, PERMISSION_HELPERS.has);
|
|
1202
1201
|
return `-- the caller's permissions in better-supabase's compact BootstrapPermissionsWire: the policy's keys once, a bitset per ${root} the caller is a member of (p_tenant alone when given) and one for platform
|
|
1203
1202
|
create or replace function ${fn}(p_tenant text default null)
|
|
1204
1203
|
returns jsonb
|
|
@@ -1216,8 +1215,8 @@ as $$
|
|
|
1216
1215
|
where p_tenant is null or t.id::text = p_tenant
|
|
1217
1216
|
),
|
|
1218
1217
|
pdk_p(n) as (
|
|
1219
|
-
select k.n from pdk_k k
|
|
1220
|
-
where k.key = any(${textArray(platform)})
|
|
1218
|
+
select k.n from ${held}(null::${scopeTypeOf(ctx, root)}) h(key) join pdk_k k on k.key = h.key
|
|
1219
|
+
where k.key = any(${textArray(platform)})
|
|
1221
1220
|
)
|
|
1222
1221
|
select jsonb_strip_nulls(jsonb_build_object(
|
|
1223
1222
|
'apiVersion', 1,
|
|
@@ -16,12 +16,12 @@ import { c as ACTOR_MAY_WRITE, p as readOnlyActorKinds } from "./fields-6d1j-q3c
|
|
|
16
16
|
import { a as quoteIdent, c as quoteTable, i as qualified$1, o as quoteLiteral, s as quoteQualified } from "./quote-BKrTBbcH.js";
|
|
17
17
|
import { A as tenantTypeOf, E as firstScopeType, O as scopeTypeOf, a as customRolesOn, j as userTypeOf, k as sqlType, l as USER_ID_HELPER, r as HELPERS, y as subjectIdSql } from "./shared-BdF5DJDQ.js";
|
|
18
18
|
import { J as hasMemberFor, Q as isTeamScope, U as BOOTSTRAP_PERMISSIONS, X as hasPermittedUsers, at as memberRoleOf, et as memberForHelper, ht as checkSuspension, i as interactiveOnlyKeys, it as memberOfHelper, j as globalRoleSource, 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-BZu9rLpa.js";
|
|
19
|
-
import {
|
|
20
|
-
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-
|
|
19
|
+
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-BYICzaNo.js";
|
|
20
|
+
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-Bb6tL3EI.js";
|
|
21
21
|
import { a as supabaseConfig, t as declarativeSchemaDir } from "./supabase-config-mXcggV5I.js";
|
|
22
22
|
import { a as resolveAuthorize, n as hookUri, t as authAdminRead } from "./rbac-B-49toAp.js";
|
|
23
23
|
import { a as splitUndiffed, r as tableKey, t as decidingColumns } from "./deciding-columns-BnglEKqU.js";
|
|
24
|
-
import { a as guardedTables, t as ownershipRules } from "./ownership-
|
|
24
|
+
import { a as guardedTables, t as ownershipRules } from "./ownership-Cw5-N2Ul.js";
|
|
25
25
|
import { t as membershipSourcesOf } from "./sources-BbSUNmFX.js";
|
|
26
26
|
// src/cli/claims-schema.ts
|
|
27
27
|
/**
|
|
@@ -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-C1J6y5a1.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-CntB_X4r.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-CntB_X4r.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-CntB_X4r.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 { a as nonEmptyOr } from "./output-
|
|
4
|
+
import { a as nonEmptyOr } from "./output-ubzzotuT.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";
|
|
@@ -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 { a as nonEmptyOr } from "./output-
|
|
6
|
+
import { a as nonEmptyOr } from "./output-ubzzotuT.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-CnR0EQd6.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-CnR0EQd6.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-CnR0EQd6.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-CN7tPYLP.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-CN7tPYLP.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-CN7tPYLP.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-CkRRq5tM.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-CkRRq5tM.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-CkRRq5tM.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-BaqGN07N.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-Duu9XUtU.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-DBmalxoO.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-CFSPH513.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"],
|
|
@@ -165,7 +165,7 @@ const SECTIONS = [
|
|
|
165
165
|
docs: "policy",
|
|
166
166
|
effects: ["files"],
|
|
167
167
|
config: true,
|
|
168
|
-
load: async () => (await import("./policy-
|
|
168
|
+
load: async () => (await import("./policy-C3-aUrcn.js")).policyBundle
|
|
169
169
|
})]),
|
|
170
170
|
group("claims", "Measure the memberships claim of an access token", "claims", [leaf("size", "Report claim bytes, token characters and the budget cut", {
|
|
171
171
|
examples: ["permdock claims size --memberships 60", "permdock claims size --memberships 11 --roles 3 --json"],
|
|
@@ -180,7 +180,7 @@ const SECTIONS = [
|
|
|
180
180
|
effects: [],
|
|
181
181
|
config: true,
|
|
182
182
|
findings: true,
|
|
183
|
-
load: async () => (await import("./config-
|
|
183
|
+
load: async () => (await import("./config-B46LCIi1.js")).config
|
|
184
184
|
})
|
|
185
185
|
]
|
|
186
186
|
},
|
|
@@ -193,7 +193,7 @@ const SECTIONS = [
|
|
|
193
193
|
docs: "rls",
|
|
194
194
|
effects: ["files", "database:read"],
|
|
195
195
|
config: true,
|
|
196
|
-
load: async () => (await import("./rls-
|
|
196
|
+
load: async () => (await import("./rls-fzNIKj80.js")).importPolicies
|
|
197
197
|
}),
|
|
198
198
|
leaf("verify", "Run the fixtures against the policies, or compare a live database", {
|
|
199
199
|
examples: [
|
|
@@ -205,21 +205,21 @@ const SECTIONS = [
|
|
|
205
205
|
effects: ["files", "database:read"],
|
|
206
206
|
config: true,
|
|
207
207
|
findings: true,
|
|
208
|
-
load: async () => (await import("./rls-
|
|
208
|
+
load: async () => (await import("./rls-fzNIKj80.js")).verify
|
|
209
209
|
}),
|
|
210
210
|
leaf("migrate", "Rewrite hand-written policies onto the generated helpers", {
|
|
211
211
|
examples: ["permdock rls migrate --sql supabase/migrations --dry-run", "permdock rls migrate --sql supabase/migrations"],
|
|
212
212
|
docs: "rls",
|
|
213
213
|
effects: ["rewrite", "files"],
|
|
214
214
|
config: true,
|
|
215
|
-
load: async () => (await import("./rls-
|
|
215
|
+
load: async () => (await import("./rls-fzNIKj80.js")).migrate
|
|
216
216
|
}),
|
|
217
217
|
leaf("explain", "Show the tables, membership sources and triggers the SQL binds to", {
|
|
218
218
|
examples: ["permdock rls explain", "permdock rls explain --db-url-stdin --json"],
|
|
219
219
|
docs: "rls",
|
|
220
220
|
effects: ["database:read"],
|
|
221
221
|
config: true,
|
|
222
|
-
load: async () => (await import("./rls-
|
|
222
|
+
load: async () => (await import("./rls-fzNIKj80.js")).explain
|
|
223
223
|
})
|
|
224
224
|
]),
|
|
225
225
|
group("supabase", "Generate the Supabase Custom Access Token Hook, or inspect its manifest", "supabase", [leaf("inspect", "Print or write the hook and helper manifest", {
|
|
@@ -227,14 +227,14 @@ const SECTIONS = [
|
|
|
227
227
|
docs: "supabase",
|
|
228
228
|
effects: ["files"],
|
|
229
229
|
config: true,
|
|
230
|
-
load: async () => (await import("./supabase-
|
|
230
|
+
load: async () => (await import("./supabase-DlINOaAC.js")).inspect
|
|
231
231
|
})]),
|
|
232
232
|
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", {
|
|
233
233
|
examples: ["permdock powersync verify", "permdock powersync verify --db-url-stdin"],
|
|
234
234
|
docs: "powersync",
|
|
235
235
|
effects: ["database:read"],
|
|
236
236
|
config: true,
|
|
237
|
-
load: async () => (await import("./powersync-
|
|
237
|
+
load: async () => (await import("./powersync-BcIQ5rz6.js")).verify
|
|
238
238
|
})])
|
|
239
239
|
]
|
|
240
240
|
},
|
|
@@ -247,13 +247,13 @@ const SECTIONS = [
|
|
|
247
247
|
effects: ["files"],
|
|
248
248
|
config: true,
|
|
249
249
|
findings: true,
|
|
250
|
-
load: async () => (await import("./openapi-
|
|
250
|
+
load: async () => (await import("./openapi-qD85gUJ5.js")).annotateRoutes
|
|
251
251
|
}), leaf("import", "Turn an OpenAPI document into a generated definition", {
|
|
252
252
|
examples: ["permdock openapi import --doc openapi.yaml --out src/permissions.generated.ts"],
|
|
253
253
|
docs: "openapi",
|
|
254
254
|
effects: ["files", "network"],
|
|
255
255
|
config: false,
|
|
256
|
-
load: async () => (await import("./openapi-
|
|
256
|
+
load: async () => (await import("./openapi-qD85gUJ5.js")).importDocument
|
|
257
257
|
})]),
|
|
258
258
|
group("arazzo", "Check Arazzo workflows against the permissions", "arazzo", [leaf("check", "Resolve every Arazzo step to x-permdock-permissions", {
|
|
259
259
|
examples: ["permdock arazzo check --doc arazzo.json --openapi openapi.json"],
|
|
@@ -261,7 +261,7 @@ const SECTIONS = [
|
|
|
261
261
|
effects: [],
|
|
262
262
|
config: true,
|
|
263
263
|
findings: true,
|
|
264
|
-
load: async () => (await import("./arazzo-
|
|
264
|
+
load: async () => (await import("./arazzo-BGfRLmhk.js")).check
|
|
265
265
|
})]),
|
|
266
266
|
leaf("scan", "List authorization checks written without PermDock, to adopt it in an existing app", {
|
|
267
267
|
examples: ["permdock scan", "permdock scan --src app,lib --pattern isBeta"],
|
|
@@ -269,7 +269,7 @@ const SECTIONS = [
|
|
|
269
269
|
effects: [],
|
|
270
270
|
config: true,
|
|
271
271
|
findings: true,
|
|
272
|
-
load: async () => (await import("./scan-
|
|
272
|
+
load: async () => (await import("./scan-CoG-QiZ6.js")).scan
|
|
273
273
|
}),
|
|
274
274
|
group("casl", "Import CASL rules into a generated module", "casl", [leaf("import", "Turn CASL rules per role into a permissions and policy module", {
|
|
275
275
|
examples: ["permdock casl import --rules rules.json --out src/permissions.generated.ts"],
|
|
@@ -283,7 +283,7 @@ const SECTIONS = [
|
|
|
283
283
|
docs: "casbin",
|
|
284
284
|
effects: ["files"],
|
|
285
285
|
config: false,
|
|
286
|
-
load: async () => (await import("./casbin-
|
|
286
|
+
load: async () => (await import("./casbin-D8T6IXmf.js")).casbinImport
|
|
287
287
|
})])
|
|
288
288
|
]
|
|
289
289
|
},
|
|
@@ -295,34 +295,34 @@ const SECTIONS = [
|
|
|
295
295
|
docs: "login",
|
|
296
296
|
effects: ["network", "files"],
|
|
297
297
|
config: false,
|
|
298
|
-
load: async () => (await import("./login-
|
|
298
|
+
load: async () => (await import("./login-gwlxVT40.js")).login
|
|
299
299
|
}),
|
|
300
300
|
leaf("logout", "Revoke and delete the stored PermDock Cloud login", {
|
|
301
301
|
examples: ["permdock logout"],
|
|
302
302
|
docs: "login",
|
|
303
303
|
effects: ["network", "files"],
|
|
304
304
|
config: false,
|
|
305
|
-
load: async () => (await import("./login-
|
|
305
|
+
load: async () => (await import("./login-gwlxVT40.js")).logout
|
|
306
306
|
}),
|
|
307
307
|
leaf("whoami", "Print the PermDock Cloud identity the CLI acts as", {
|
|
308
308
|
examples: ["permdock whoami", "permdock whoami --json"],
|
|
309
309
|
docs: "login",
|
|
310
310
|
effects: [],
|
|
311
311
|
config: false,
|
|
312
|
-
load: async () => (await import("./login-
|
|
312
|
+
load: async () => (await import("./login-gwlxVT40.js")).whoami
|
|
313
313
|
}),
|
|
314
314
|
group("cloud", "Publish to or pull from a PermDock Cloud project", "cloud", [leaf("push", "Publish the catalog, policy and manifest to a Cloud project", {
|
|
315
315
|
examples: ["permdock cloud push --dry-run", "permdock cloud push --project prj_123"],
|
|
316
316
|
docs: "cloud",
|
|
317
317
|
effects: ["network", "cloud:write"],
|
|
318
318
|
config: true,
|
|
319
|
-
load: async () => (await import("./cloud-
|
|
319
|
+
load: async () => (await import("./cloud-g-922e2y.js")).push
|
|
320
320
|
}), leaf("pull", "Write a Cloud project's published catalog and manifest", {
|
|
321
321
|
examples: ["permdock cloud pull --project prj_123"],
|
|
322
322
|
docs: "cloud",
|
|
323
323
|
effects: ["network", "files"],
|
|
324
324
|
config: true,
|
|
325
|
-
load: async () => (await import("./cloud-
|
|
325
|
+
load: async () => (await import("./cloud-g-922e2y.js")).pull
|
|
326
326
|
})])
|
|
327
327
|
]
|
|
328
328
|
},
|
|
@@ -333,7 +333,7 @@ const SECTIONS = [
|
|
|
333
333
|
docs: "codemod",
|
|
334
334
|
effects: ["rewrite"],
|
|
335
335
|
config: false,
|
|
336
|
-
load: async () => (await import("./codemod-
|
|
336
|
+
load: async () => (await import("./codemod-BrSNfQG4.js")).codemod
|
|
337
337
|
})]
|
|
338
338
|
}
|
|
339
339
|
];
|
|
@@ -345,7 +345,7 @@ const COMPLETE_LEAF = leaf("__complete", "Print completion candidates for a part
|
|
|
345
345
|
config: false,
|
|
346
346
|
shellOutput: true,
|
|
347
347
|
hidden: true,
|
|
348
|
-
load: async () => (await import("./completion-
|
|
348
|
+
load: async () => (await import("./completion-Duu9XUtU.js")).complete
|
|
349
349
|
});
|
|
350
350
|
const ROOT = group("permdock", "Collect, export, diff and check the permissions a PermDock policy declares", "", [...SECTIONS.flatMap((section) => section.entries), COMPLETE_LEAF]);
|
|
351
351
|
/** Each leaf with its path from the root, in manifest order. */
|
package/dist/next/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as PermDockPluginOptions } from "../types-
|
|
1
|
+
import { s as PermDockPluginOptions } from "../types-nXo_oQYk.js";
|
|
2
2
|
/** Any object: Next's `NextConfig` is an interface, so no index signature. */
|
|
3
3
|
type NextConfigLike = object;
|
|
4
4
|
/** What `next.config` may export: an object, or a function of the phase. */
|