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,6 +1,6 @@
|
|
|
1
1
|
import { v as arazzoFindings } from "./src-HRYn4UFj.js";
|
|
2
2
|
import { d as missingInput } from "./errors-DgLOqc6j.js";
|
|
3
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
3
|
+
import { t as DOCS_BASE } from "./manifest-31igzVGQ.js";
|
|
4
4
|
import { t as ARAZZO_REPORT_SCHEMA } from "./version-D-jWyJb9.js";
|
|
5
5
|
import { i as readJsonFile } from "./files-DAR51W3J.js";
|
|
6
6
|
import { a as loadModule, s as pickNamed, t as asPermissionTree } from "./load-m7jmit3y.js";
|
|
@@ -21,7 +21,7 @@ const check = defineLeaf({
|
|
|
21
21
|
...permissionsFlag
|
|
22
22
|
},
|
|
23
23
|
async run(ctx, { flags }) {
|
|
24
|
-
return (await import("./arazzo-
|
|
24
|
+
return (await import("./arazzo-BAgh0PT6.js")).runArazzo({
|
|
25
25
|
cwd: ctx.cwd,
|
|
26
26
|
config: ctx.config,
|
|
27
27
|
doc: given(flags.doc),
|
|
@@ -5,13 +5,14 @@ import { n as PostgrestSourcesOptions, r as SupabaseRpcCaller } from "../postgre
|
|
|
5
5
|
import { m as ApprovalStore } from "../types-vKKndyxx.js";
|
|
6
6
|
import { i as OperationEffect } from "../operations-DaEoGpMV.js";
|
|
7
7
|
import { E as PermissionTree, w as Permission } from "../vocabulary-DHfKPIC5.js";
|
|
8
|
+
import { n as Warmable } from "../warm-BR-mrnY-.js";
|
|
8
9
|
import { t as InstanceOptions } from "../instance-options-DQCiBBuz.js";
|
|
9
10
|
import { n as SubjectCache, s as VersionCache } from "../subject-cache-CnJcz2K_.js";
|
|
10
|
-
import { A as SupabaseSubjectOptions, C as SupabasePrincipal, N as SupabaseSuspension, O as SupabaseSessionLike, s as SqlMembershipSource } from "../sources-
|
|
11
|
+
import { A as SupabaseSubjectOptions, C as SupabasePrincipal, N as SupabaseSuspension, O as SupabaseSessionLike, s as SqlMembershipSource } from "../sources-CjgZns7t.js";
|
|
11
12
|
import { r as PermissionKeyOf } from "../type-helpers-CUmJFGV6.js";
|
|
12
13
|
import { t as SqlQuery } from "../sql-BYYNi1lu.js";
|
|
13
14
|
import { a as AppOptions, n as PermDockDefinition, r as PermDockQuery } from "../define-permdock-DBgwTFi1.js";
|
|
14
|
-
import { t as SupabaseClaimsClient } from "../client-subject-
|
|
15
|
+
import { t as SupabaseClaimsClient } from "../client-subject-xCSkKD1C.js";
|
|
15
16
|
import { a as CatalogDocument } from "../types-CbJ5mxXv.js";
|
|
16
17
|
import { c as LinkPolicy, o as CapabilityPrincipal, t as Capability } from "../capability-BPzseilU.js";
|
|
17
18
|
import { AccessBucketPolicy, AccessTopicPolicy, AuthorizationHooks, AuthorizationProvider, AuthorizationRequest, Authorizer, BlockTables, CredentialProvider, SupportAuthorize, SupportAuthorizeInput, ToolDecision, ToolRef } from "better-supabase/contract";
|
|
@@ -663,7 +664,7 @@ type AuthorizationHooksOptions<V extends PolicyVocabulary = PolicyVocabulary> =
|
|
|
663
664
|
* was renamed from, or that a policy `oauthScopes` entry covers, and reads no
|
|
664
665
|
* `authorization_details`.
|
|
665
666
|
*/
|
|
666
|
-
export declare function authorizationHooks<V extends PolicyVocabulary = PolicyVocabulary>(options: AuthorizationHooksOptions<V>): AuthorizationHooks;
|
|
667
|
+
export declare function authorizationHooks<V extends PolicyVocabulary = PolicyVocabulary>(options: AuthorizationHooksOptions<V>): AuthorizationHooks & Warmable;
|
|
667
668
|
/**
|
|
668
669
|
* A digest of what `permdock` grants for `permissions` in its tenant, or `null`
|
|
669
670
|
* when two callers with the same digest could still be decided differently or
|
|
@@ -740,6 +741,14 @@ type AuthorizationProviderOptions<P = undefined> = {
|
|
|
740
741
|
* BS428 checks each entry against the generated policies.
|
|
741
742
|
*/
|
|
742
743
|
readonly tables?: boolean;
|
|
744
|
+
/**
|
|
745
|
+
* Fill better-supabase's `sharedFunctions` from the manifest's
|
|
746
|
+
* `rls.sharedFunctions`, which `permdock supabase inspect` writes: the
|
|
747
|
+
* functions that pass BS430 and read only `tenant` tables. Needs `tables:
|
|
748
|
+
* true` and a manifest from `inspect` 0.31 or later; each entry's tables are
|
|
749
|
+
* `tenant` entries of `tables`, and doctor BS430 checks the functions.
|
|
750
|
+
*/
|
|
751
|
+
readonly sharedFunctions?: boolean;
|
|
743
752
|
/**
|
|
744
753
|
* Fill better-supabase's `roleIn` with `permdock_role_in`, which the manifest
|
|
745
754
|
* lists with `rls.customRoles` in `database` mode, so the `membership_roles`
|
|
@@ -747,6 +756,19 @@ type AuthorizationProviderOptions<P = undefined> = {
|
|
|
747
756
|
* or later.
|
|
748
757
|
*/
|
|
749
758
|
readonly roleIn?: boolean;
|
|
759
|
+
/**
|
|
760
|
+
* Fill better-supabase's `portalSubjects` from the `<scope>.<action>` grants
|
|
761
|
+
* of a portal scope. Off by default: better-supabase reads it for every
|
|
762
|
+
* record-attached comment, note and attachment, so a contact's `<scope>.read`
|
|
763
|
+
* would read internal notes on their own record unless the `inbox` block
|
|
764
|
+
* hides them.
|
|
765
|
+
*/
|
|
766
|
+
readonly portalSubjects?: boolean;
|
|
767
|
+
/**
|
|
768
|
+
* Fill better-supabase's `portalParties` from a portal scope. Default on;
|
|
769
|
+
* `false` leaves it out.
|
|
770
|
+
*/
|
|
771
|
+
readonly portalParties?: boolean;
|
|
750
772
|
/**
|
|
751
773
|
* Users better-supabase's access matrix signs in as, one pgTAP file each
|
|
752
774
|
* (`providerPersonaTests`). `setup` creates the memberships and roles with
|
|
@@ -900,7 +922,7 @@ type AuthorizerOptions<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
900
922
|
* throw denies. With better-supabase's runtime `memo`, the checks of one
|
|
901
923
|
* request scope share an instance per claims, tenant and intent.
|
|
902
924
|
*/
|
|
903
|
-
export declare function authorizer<V extends PolicyVocabulary = PolicyVocabulary>(options: AuthorizerOptions<V>): Authorizer<Permission, AnyVersionCache
|
|
925
|
+
export declare function authorizer<V extends PolicyVocabulary = PolicyVocabulary>(options: AuthorizerOptions<V>): Authorizer<Permission, AnyVersionCache> & Warmable;
|
|
904
926
|
/**
|
|
905
927
|
* A roles table the membership's role column references, in better-supabase's
|
|
906
928
|
* `blocks.memberships.options.roleThrough` shape: the role column holds
|
|
@@ -18,14 +18,15 @@ import { r as sha256Digest } from "../sha256-DFsnyVPo.js";
|
|
|
18
18
|
import { r as expandGrants } from "../snapshot-compact-yXFxZLPo.js";
|
|
19
19
|
import { s as scopesReaching, t as getPermDock } from "../permdock-CJPIwU1T.js";
|
|
20
20
|
import { i as snapshotTag } from "../snapshot-cache-DTTEfmxv.js";
|
|
21
|
+
import { n as warmUp } from "../warm-5yxlUmBh.js";
|
|
21
22
|
import { r as isSubject, t as anonymousSubject } from "../subject-DkxY-AhF.js";
|
|
22
23
|
import { r as credentialSubject, s as parseCredential } from "../credential-D9in5keC.js";
|
|
23
24
|
import { s as subjectFromSupabaseSession, t as SUPABASE_OPTIONS } from "../definition-options-9o8Hdww3.js";
|
|
24
|
-
import { n as parseSupabaseManifest } from "../manifest-
|
|
25
|
+
import { n as parseSupabaseManifest } from "../manifest-B487A3po.js";
|
|
25
26
|
import { t as loadPrincipal } from "../principal-source-BIcukkB3.js";
|
|
26
27
|
import { n as subscribersFor } from "../audience-CARf-b-R.js";
|
|
27
28
|
import { t as decideSupportSession } from "../support-session-DpzcGTuV.js";
|
|
28
|
-
import { t as authorizationProvider } from "../provider-
|
|
29
|
+
import { t as authorizationProvider } from "../provider-BV_v0JAY.js";
|
|
29
30
|
import { n as parseApprovalHeader } from "../approval-header-BvszJE3l.js";
|
|
30
31
|
import { i as qualifySqlTable, l as sqlIdent } from "../sql-T4GaBh9X.js";
|
|
31
32
|
import { o as junctionMembershipSource } from "../sources-DnjJPGfb.js";
|
|
@@ -1317,6 +1318,10 @@ function authorizationHooks(options) {
|
|
|
1317
1318
|
return Object.freeze({
|
|
1318
1319
|
apiVersion: 1,
|
|
1319
1320
|
name: "PermDock",
|
|
1321
|
+
warm: () => warmUp(policy, () => resolve(null, {
|
|
1322
|
+
tenant: null,
|
|
1323
|
+
intent: "read"
|
|
1324
|
+
})),
|
|
1320
1325
|
sessionTags: (userId) => [snapshotTag(userId)],
|
|
1321
1326
|
shareKey,
|
|
1322
1327
|
...loadClaims === void 0 ? {} : { automation: Object.freeze(automation) },
|
|
@@ -1544,6 +1549,10 @@ function authorizer(options) {
|
|
|
1544
1549
|
return Object.freeze({
|
|
1545
1550
|
apiVersion: 1,
|
|
1546
1551
|
name: "PermDock",
|
|
1552
|
+
warm: () => warmUp(options.policy, () => resolve(null, {
|
|
1553
|
+
tenant: null,
|
|
1554
|
+
intent: "read"
|
|
1555
|
+
})),
|
|
1547
1556
|
key(ref) {
|
|
1548
1557
|
if (!isPermission(ref)) throw new TypeError("Not a PermDock permission");
|
|
1549
1558
|
return ref.key;
|
|
@@ -3,14 +3,11 @@ import { d as scopeList } from "./scopes-B-KX9EI8.js";
|
|
|
3
3
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
4
4
|
import { i as refuseDirty, t as applyFiles } from "./files-DuV7wRim.js";
|
|
5
5
|
import { a as rel } from "./files-DAR51W3J.js";
|
|
6
|
-
import { a as readConfig } from "./config-
|
|
6
|
+
import { a as readConfig } from "./config-7QvEq57a.js";
|
|
7
7
|
import { c as requirePolicy } from "./load-m7jmit3y.js";
|
|
8
|
-
import { i as
|
|
8
|
+
import { i as keyReasons, n as tenantCheck, r as keyReason, t as svals } from "./tenant-check-D7g9oNVH.js";
|
|
9
9
|
import { a as parseSqlFile, u as removeStatements } from "./ast-Dnm2TOHN.js";
|
|
10
10
|
import { n as loadBsbSql, r as schemaSqlFiles, t as bsbSqlMissing } from "./bsb-access-Bcw6GrQm.js";
|
|
11
|
-
import { r as compileGrants } from "./compile-DNVVdVWs.js";
|
|
12
|
-
import { i as tableNames } from "./tables-sLA1CpuN.js";
|
|
13
|
-
import { n as tenantCheck, t as svals } from "./tenant-check-gL2miiaS.js";
|
|
14
11
|
import { n as supabaseDir } from "./supabase-dir-0lxKbrYu.js";
|
|
15
12
|
import { readFileSync } from "node:fs";
|
|
16
13
|
import { join } from "node:path";
|
|
@@ -118,38 +115,6 @@ function plainPolicy(file, node, helper) {
|
|
|
118
115
|
guard: read.guard
|
|
119
116
|
};
|
|
120
117
|
}
|
|
121
|
-
/**
|
|
122
|
-
* The keys whose `permitted_<scope>_ids_by_permission(k)` answers what
|
|
123
|
-
* `permitted_<scope>_ids(k)` answers: every grant of `k` is an allow under the
|
|
124
|
-
* grant key `k`, so one condition group, no row condition and no deny.
|
|
125
|
-
*/
|
|
126
|
-
function swappableKeys(config, policy, cwd) {
|
|
127
|
-
const generate = {
|
|
128
|
-
cwd,
|
|
129
|
-
config,
|
|
130
|
-
target: "sql",
|
|
131
|
-
dialect: config.rls?.dialect ?? "supabase",
|
|
132
|
-
rbac: false,
|
|
133
|
-
check: false,
|
|
134
|
-
skipClosures: true,
|
|
135
|
-
inlineFunctions: false,
|
|
136
|
-
io: {
|
|
137
|
-
stdout: () => void 0,
|
|
138
|
-
stderr: () => void 0
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const options = generateOptions(generate);
|
|
142
|
-
if (isRefusal(options)) throw new CliError("usage", options.refusal, { code: "invalid_value" });
|
|
143
|
-
const built = buildContext(generate, policy, options);
|
|
144
|
-
if (isRefusal(built)) throw new CliError("usage", built.refusal, { code: "invalid_value" });
|
|
145
|
-
const compiled = compileGrants(policy, built.ctx, tableNames(config.rls?.tables), [], true);
|
|
146
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
147
|
-
for (const row of compiled.rolePermissions) {
|
|
148
|
-
const plain = row.effect === "allow" && row.grantKey === row.permission && !compiled.conditionedKeys.has(row.grantKey);
|
|
149
|
-
byKey.set(row.permission, (byKey.get(row.permission) ?? true) && plain);
|
|
150
|
-
}
|
|
151
|
-
return new Set([...byKey].filter(([, plain]) => plain).map(([key]) => key));
|
|
152
|
-
}
|
|
153
118
|
function quoted(table) {
|
|
154
119
|
return table.split(".").map((part) => `"${part.replaceAll("\"", "\"\"")}"`).join(".");
|
|
155
120
|
}
|
|
@@ -174,13 +139,14 @@ function tableComment(nodes, table) {
|
|
|
174
139
|
* is listed.
|
|
175
140
|
*/
|
|
176
141
|
async function runAccessTags(options) {
|
|
142
|
+
const dryRun = options.dryRun || options.check === true;
|
|
177
143
|
const { config } = await readConfig(options.cwd);
|
|
178
144
|
const policy = await requirePolicy(options.cwd, config.policy, "codemod bsb-access-tags needs `policy` in permdock.config");
|
|
179
145
|
const root = scopeList(policy.scopes)[0]?.name;
|
|
180
146
|
if (root === void 0) throw new CliError("usage", "codemod bsb-access-tags needs a policy with a tenant scope", { code: "invalid_value" });
|
|
181
147
|
const schema = config.rls?.schema ?? "permdock";
|
|
182
148
|
const helper = `${schema}.permitted_${root}_ids`;
|
|
183
|
-
const keys =
|
|
149
|
+
const keys = keyReasons(config, policy, options.cwd);
|
|
184
150
|
const bsb = await bsbSql(options.cwd);
|
|
185
151
|
const canIn = `{tenant} in (select ${schema}.permitted_${root}_ids_by_permission({permission}))`;
|
|
186
152
|
const kept = [];
|
|
@@ -219,7 +185,7 @@ async function runAccessTags(options) {
|
|
|
219
185
|
for (const item of policies) counts.set(item.operation, (counts.get(item.operation) ?? 0) + 1);
|
|
220
186
|
for (const item of policies) {
|
|
221
187
|
const shared = counts.get(item.operation) !== 1 || others.get(table)?.has(item.operation) === true;
|
|
222
|
-
const reason = keys.has(item.key) ? shared ? `${table} has another policy for ${item.operation}` : item.column === policies[0]?.column ? void 0 : "a tenant column that differs from the table's other policies" : `key ${item.key}
|
|
188
|
+
const reason = keys.swappable.has(item.key) ? shared ? `${table} has another policy for ${item.operation}` : item.column === policies[0]?.column ? void 0 : "a tenant column that differs from the table's other policies" : `key ${item.key}: ${keyReason(keys, item.key)}, so permitted_${root}_ids_by_permission answers differently`;
|
|
223
189
|
if (reason === void 0) {
|
|
224
190
|
operations[item.operation] = item.key;
|
|
225
191
|
chosen.push(item);
|
|
@@ -273,7 +239,7 @@ async function runAccessTags(options) {
|
|
|
273
239
|
});
|
|
274
240
|
}
|
|
275
241
|
}
|
|
276
|
-
if (!
|
|
242
|
+
if (!dryRun) {
|
|
277
243
|
refuseDirty({
|
|
278
244
|
command: "codemod",
|
|
279
245
|
invocation: "codemod bsb-access-tags",
|
|
@@ -288,15 +254,16 @@ async function runAccessTags(options) {
|
|
|
288
254
|
kept,
|
|
289
255
|
files: planned.map((file) => rel(options.cwd, file.path))
|
|
290
256
|
};
|
|
257
|
+
const code = options.check === true && moved.length > 0 ? 1 : 0;
|
|
291
258
|
if (options.json) return {
|
|
292
|
-
code
|
|
259
|
+
code,
|
|
293
260
|
output: JSON.stringify(report, null, 2),
|
|
294
261
|
data: report
|
|
295
262
|
};
|
|
296
263
|
return {
|
|
297
|
-
code
|
|
264
|
+
code,
|
|
298
265
|
output: [
|
|
299
|
-
`permdock codemod bsb-access-tags: ${
|
|
266
|
+
`permdock codemod bsb-access-tags: ${dryRun ? "would move" : "moved"} ${String(moved.length)} ${moved.length === 1 ? "table" : "tables"} to @bsb access tags`,
|
|
300
267
|
...moved.map((entry) => ` ${entry.table}: ${Object.entries(entry.operations).map(([op, key]) => `${op}=${key}`).join(" ")}`),
|
|
301
268
|
...kept.map((entry) => ` kept ${entry.table} ${entry.policy}: ${entry.reason}`)
|
|
302
269
|
].join("\n")
|
|
@@ -2,7 +2,7 @@ import { n as guessPermissions } from "./collect-CPimbkC5.js";
|
|
|
2
2
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
3
3
|
import { i as refuseDirty, t as applyFiles } from "./files-DuV7wRim.js";
|
|
4
4
|
import { a as rel } from "./files-DAR51W3J.js";
|
|
5
|
-
import { a as readConfig, p as betterSupabaseConfigPath } from "./config-
|
|
5
|
+
import { a as readConfig, p as betterSupabaseConfigPath } from "./config-7QvEq57a.js";
|
|
6
6
|
import { n as bsbActions, t as answerOf } from "./bsb-actions-BHiyBxQZ.js";
|
|
7
7
|
import { r as parseSync } from "./optional-CaQWp9HA.js";
|
|
8
8
|
import { a as nameOf, o as nodes, r as child, t as applyEdits, u as walk } from "./ast-CAOxvn9t.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applyFiles } from "./files-DuV7wRim.js";
|
|
2
|
-
import { o as nonEmptyOr } from "./output-
|
|
2
|
+
import { o as nonEmptyOr } from "./output-C7EPeSZj.js";
|
|
3
3
|
import { n as isIdentifier, t as emitPolicyModule } from "./policy-module-Bp4HvsRg.js";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { resolve } from "node:path";
|
|
@@ -16,7 +16,7 @@ const casbinImport = defineLeaf({
|
|
|
16
16
|
...outFlag
|
|
17
17
|
},
|
|
18
18
|
async run(ctx, { flags }) {
|
|
19
|
-
const { runCasbinImport } = await import("./casbin-
|
|
19
|
+
const { runCasbinImport } = await import("./casbin-BErdqy1J.js");
|
|
20
20
|
return runCasbinImport({
|
|
21
21
|
cwd: ctx.cwd,
|
|
22
22
|
model: given(flags.model),
|
package/dist/cli/bin.js
CHANGED
|
@@ -11,7 +11,7 @@ if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
|
|
|
11
11
|
const [{ isCi }, { trapSignals }, { run }, { streamHasColors }] = await Promise.all([
|
|
12
12
|
import("../env-hbYumkRp.js"),
|
|
13
13
|
import("../signals-a1NxAP0X.js"),
|
|
14
|
-
import("../run-
|
|
14
|
+
import("../run-BjMxYYTe.js"),
|
|
15
15
|
import("../style-Crf-90o6.js")
|
|
16
16
|
]);
|
|
17
17
|
const signals = trapSignals();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as isRecord } from "../../compact-C4LFuqbW.js";
|
|
2
2
|
import { a as describeError } from "../../errors-DgLOqc6j.js";
|
|
3
|
-
import { a as readConfig } from "../../config-
|
|
4
|
-
import { t as executeGenerate } from "../../execute-
|
|
3
|
+
import { a as readConfig } from "../../config-7QvEq57a.js";
|
|
4
|
+
import { t as executeGenerate } from "../../execute-ix7AAdWg.js";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { parentPort, workerData } from "node:worker_threads";
|
|
7
7
|
// src/cli/generate/watch-worker.ts
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as RlsApiKeys, a as PermDockConfig, c as RlsConfig, d as RlsMembershipTable, f as RlsMemberships, g as RlsTarget, h as RlsSuspension, i as GenKind, l as RlsDialect, m as RlsSuspendedScope, n as CollectConfig, p as RlsSuspendedMembership, r as GenConfig, s as RlsActiveRow, t as CatalogConfig, u as RlsFunctionMapping } from "../types-config-
|
|
1
|
+
import { _ as RlsApiKeys, a as PermDockConfig, c as RlsConfig, d as RlsMembershipTable, f as RlsMemberships, g as RlsTarget, h as RlsSuspension, i as GenKind, l as RlsDialect, m as RlsSuspendedScope, n as CollectConfig, p as RlsSuspendedMembership, r as GenConfig, s as RlsActiveRow, t as CatalogConfig, u as RlsFunctionMapping } from "../types-config-DNIw_Gt5.js";
|
|
2
2
|
import { o as OperationMap } from "../operations-DaEoGpMV.js";
|
|
3
3
|
import { E as PermissionTree } from "../vocabulary-DHfKPIC5.js";
|
|
4
4
|
import { D as Policy } from "../policy-types-CfW4X_yX.js";
|
|
5
5
|
import { o as ResourceNameOf, r as PermissionKeyOf, s as ScopeNameOf, t as ActionNameOf } from "../type-helpers-CUmJFGV6.js";
|
|
6
|
-
import { i as PolicyModel, n as PluginTask, r as definePlugin, t as PermDockPlugin } from "../plugin-
|
|
7
|
-
import { r as RunResult, t as CliIo } from "../types-run-
|
|
6
|
+
import { i as PolicyModel, n as PluginTask, r as definePlugin, t as PermDockPlugin } from "../plugin-L3G7jPGE.js";
|
|
7
|
+
import { r as RunResult, t as CliIo } from "../types-run-Bwn1MuW0.js";
|
|
8
8
|
import { a as pushedPolicy, i as parsePushedPolicy, n as PushedGrant, r as PushedPolicy, t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-DcvO8NXy.js";
|
|
9
9
|
import { a as CatalogDocument, d as CatalogRole, f as CatalogScope, l as CatalogPermission, m as CatalogUsage, n as CatalogApproval, p as CatalogSupportAccess, r as CatalogBreakGlass, t as CatalogActivation, u as CatalogResource } from "../types-CbJ5mxXv.js";
|
|
10
10
|
/**
|
package/dist/cli/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as catalogPath } from "../catalog-path-bG0XxHMu.js";
|
|
2
|
-
import { n as defineConfig } from "../config-
|
|
2
|
+
import { n as defineConfig } from "../config-7QvEq57a.js";
|
|
3
3
|
import { t as definePlugin } from "../plugin-MQVfUBUS.js";
|
|
4
4
|
import { c as parseGrantsMarker, l as parseHookMarker } from "../markers-C-kThnKN.js";
|
|
5
|
-
import { t as run } from "../run-
|
|
5
|
+
import { t as run } from "../run-WIqPbnjD.js";
|
|
6
6
|
import { n as parsePushedPolicy, r as pushedPolicy, t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-DSjSWEAl.js";
|
|
7
7
|
// src/cli/token-schemas.ts
|
|
8
8
|
const ID = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
1
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
2
2
|
import { n as GenKindPluginOptions, t as ConstantsPluginOptions } from "../../gen-kind-DFQnQwFN.js";
|
|
3
3
|
/**
|
|
4
4
|
* Scope, role, permission and operation names and topic and path builders:
|
package/dist/cli/plugins/app.js
CHANGED
|
@@ -32,7 +32,7 @@ function openapi(options = {}) {
|
|
|
32
32
|
return operationsFile(source.cwd, options.routes, task.out);
|
|
33
33
|
}
|
|
34
34
|
if (options.doc === void 0) return [];
|
|
35
|
-
const { openapiDocument } = await import("../../openapi-document-
|
|
35
|
+
const { openapiDocument } = await import("../../openapi-document-CEQ6jqqR.js");
|
|
36
36
|
return openapiDocument(task, options, source);
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -18,7 +18,7 @@ function powersync(options = {}) {
|
|
|
18
18
|
}],
|
|
19
19
|
emit: async (task, _model, source) => {
|
|
20
20
|
if (source === void 0) return [];
|
|
21
|
-
const { powersyncFiles, publicationPath } = await import("../../powersync-
|
|
21
|
+
const { powersyncFiles, publicationPath } = await import("../../powersync-C1ix7CEY.js");
|
|
22
22
|
return powersyncFiles(source.policy, source.config, task.out, await publicationPath(source.cwd, source.config)).files.map((file) => ({
|
|
23
23
|
path: file.path,
|
|
24
24
|
contents: file.text
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
2
|
-
import { t as RlsPluginOptions } from "../../rls-options-
|
|
1
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
2
|
+
import { t as RlsPluginOptions } from "../../rls-options-BFGRmdcH.js";
|
|
3
3
|
/**
|
|
4
4
|
* The RLS plugin. The factory records options; the SQL generator loads on emit,
|
|
5
5
|
* so importing `rls` does not load it.
|
package/dist/cli/plugins/rls.js
CHANGED
|
@@ -19,7 +19,7 @@ function rls(options = {}) {
|
|
|
19
19
|
}],
|
|
20
20
|
config: (config) => withRlsOutputs(config, options),
|
|
21
21
|
emit: async (task, _model, source) => {
|
|
22
|
-
const { filesForRls } = await import("../../rls-files-
|
|
22
|
+
const { filesForRls } = await import("../../rls-files-ucAI0J5j.js");
|
|
23
23
|
return filesForRls(task, options, source);
|
|
24
24
|
}
|
|
25
25
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
1
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
2
2
|
import { n as GenKindPluginOptions, r as ZodPluginOptions } from "../../gen-kind-DFQnQwFN.js";
|
|
3
3
|
/** Row validators as Zod schemas, from the model's JSON Schema. */
|
|
4
4
|
export declare function zod(options?: ZodPluginOptions): PermDockPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as RlsDialect } from "../../types-config-
|
|
2
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
1
|
+
import { l as RlsDialect } from "../../types-config-DNIw_Gt5.js";
|
|
2
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
3
3
|
type ScimPluginOptions = {
|
|
4
4
|
readonly schema?: string;
|
|
5
5
|
readonly dialect?: RlsDialect;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as SupabaseSchemas } from "../../types-config-
|
|
2
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
1
|
+
import { o as SupabaseSchemas } from "../../types-config-DNIw_Gt5.js";
|
|
2
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
3
3
|
type SupabaseHookPluginOptions = {
|
|
4
4
|
readonly out?: string;
|
|
5
5
|
readonly schemas?: SupabaseSchemas;
|
|
@@ -18,7 +18,7 @@ function supabaseHook(options = {}) {
|
|
|
18
18
|
config: (config) => withHookOut(config, options.out),
|
|
19
19
|
emit: async (_task, _model, source) => {
|
|
20
20
|
if (source === void 0) return [];
|
|
21
|
-
const { runSupabase } = await import("../../supabase-hook-
|
|
21
|
+
const { runSupabase } = await import("../../supabase-hook-CluYxKee.js");
|
|
22
22
|
const outcome = await runSupabase({
|
|
23
23
|
cwd: source.cwd,
|
|
24
24
|
config: source.config,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as SupabaseSchemas } from "../../types-config-
|
|
2
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
3
|
-
import { t as RlsPluginOptions } from "../../rls-options-
|
|
1
|
+
import { o as SupabaseSchemas } from "../../types-config-DNIw_Gt5.js";
|
|
2
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
3
|
+
import { t as RlsPluginOptions } from "../../rls-options-BFGRmdcH.js";
|
|
4
4
|
/** The Custom Access Token hook the plugin writes; `false` skips it. */
|
|
5
5
|
type SupabaseHookOption = false | {
|
|
6
6
|
readonly out?: string;
|
|
@@ -37,14 +37,14 @@ function supabase(options = {}) {
|
|
|
37
37
|
config: (config) => withHookOut(withRlsOutputs(config, options), hookOut),
|
|
38
38
|
emit: async (task, _model, source) => {
|
|
39
39
|
if (task.id === "sql") {
|
|
40
|
-
const { filesForRls } = await import("../../rls-files-
|
|
40
|
+
const { filesForRls } = await import("../../rls-files-ucAI0J5j.js");
|
|
41
41
|
return filesForRls(task, {
|
|
42
42
|
...rlsOptions,
|
|
43
43
|
dialect: "supabase"
|
|
44
44
|
}, source);
|
|
45
45
|
}
|
|
46
46
|
if (source === void 0) return [];
|
|
47
|
-
const { runSupabase } = await import("../../supabase-hook-
|
|
47
|
+
const { runSupabase } = await import("../../supabase-hook-CluYxKee.js");
|
|
48
48
|
const hookOptions = hook === false || hook === void 0 ? {} : hook;
|
|
49
49
|
const outcome = await runSupabase({
|
|
50
50
|
cwd: source.cwd,
|
package/dist/cli/plugins/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PermDockPlugin } from "../../plugin-
|
|
1
|
+
import { t as PermDockPlugin } from "../../plugin-L3G7jPGE.js";
|
|
2
2
|
import { n as GenKindPluginOptions } from "../../gen-kind-DFQnQwFN.js";
|
|
3
3
|
/** `permdock/react` bound to the policy's vocabulary. Carries `"use client"`. */
|
|
4
4
|
export declare function reactHooks(options?: GenKindPluginOptions): PermDockPlugin;
|
package/dist/cli/plugins/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as kindPlugin } from "../../gen-kind-
|
|
1
|
+
import { t as kindPlugin } from "../../gen-kind-C9ikF8nb.js";
|
|
2
2
|
// src/cli/plugins/ui.ts
|
|
3
3
|
/** `permdock/react` bound to the policy's vocabulary. Carries `"use client"`. */
|
|
4
4
|
function reactHooks(options = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Or as Subject } from "./policy-types-CfW4X_yX.js";
|
|
2
|
-
import { A as SupabaseSubjectOptions, C as SupabasePrincipal } from "./sources-
|
|
2
|
+
import { A as SupabaseSubjectOptions, C as SupabasePrincipal } from "./sources-CjgZns7t.js";
|
|
3
3
|
/**
|
|
4
4
|
* The part of a supabase-js (or `@supabase/ssr`) client the subject reads:
|
|
5
5
|
* `auth.getClaims()`, which verifies the token against the project's JWKS or
|
|
@@ -41,7 +41,7 @@ const push = defineLeaf({
|
|
|
41
41
|
},
|
|
42
42
|
async run(ctx, { flags }) {
|
|
43
43
|
const env = await withStdinSecret(ctx, "key", flags["key-stdin"], "PERMDOCK_CLOUD_KEY");
|
|
44
|
-
return (await import("./push-
|
|
44
|
+
return (await import("./push-DcjvEj0m.js")).runCloud({
|
|
45
45
|
cwd: ctx.cwd,
|
|
46
46
|
config: ctx.config,
|
|
47
47
|
url: given(flags.url),
|
|
@@ -70,7 +70,7 @@ const pull = defineLeaf({
|
|
|
70
70
|
},
|
|
71
71
|
async run(ctx, { flags }) {
|
|
72
72
|
const env = await withStdinSecret(ctx, "token", flags["token-stdin"], "PERMDOCK_CLOUD_TOKEN");
|
|
73
|
-
return (await import("./pull-
|
|
73
|
+
return (await import("./pull-Bp63vtgu.js")).runCloudPull({
|
|
74
74
|
cwd: ctx.cwd,
|
|
75
75
|
config: ctx.config,
|
|
76
76
|
url: given(flags.url),
|
|
@@ -5,7 +5,7 @@ import { t as catalogFingerprint } from "./catalog-fingerprint-DAWZARy6.js";
|
|
|
5
5
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
6
6
|
import { n as flagSpellings, o as GLOBAL_FLAGS } from "./args-BSpXxMnb.js";
|
|
7
7
|
import { c as generateFlags, f as policyFlag, i as dryRunFlag, r as dbUrlFlags, t as checkFlag } from "./flags-DQzNPxg1.js";
|
|
8
|
-
import { n as ROOT } from "./manifest-
|
|
8
|
+
import { n as ROOT } from "./manifest-31igzVGQ.js";
|
|
9
9
|
import { n as baselineText, r as parseBaseline } from "./baseline-file-BQoki1O_.js";
|
|
10
10
|
import { r as resolveConfigRoot, t as configProperty } from "./config-paths-CQvGng3k.js";
|
|
11
11
|
import { n as propertyKey, r as removeProperty, t as applyEditsStrict } from "./edits-CqU8s2GC.js";
|
|
@@ -294,7 +294,7 @@ function rewriteCliCalls(text, options) {
|
|
|
294
294
|
})
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
|
-
// src/cli/codemod/doctor-baseline-0.
|
|
297
|
+
// src/cli/codemod/doctor-baseline-0.31.ts
|
|
298
298
|
const DEFAULT_BASELINE = "doctor-baseline.json";
|
|
299
299
|
/**
|
|
300
300
|
* The JSON value of a literal: strings, numbers, booleans, `null`, arrays and
|
|
@@ -386,7 +386,7 @@ function ignoreEntries(value) {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
-
* 0.
|
|
389
|
+
* 0.31: `doctor.waivers` and `doctor.ignore` fold into the `doctor.baseline`
|
|
390
390
|
* file. The config loses both keys and gains `baseline` when it has none, and
|
|
391
391
|
* the entries land in the file it names, merged with what the file holds. A
|
|
392
392
|
* list the config computes, or a baseline path that is not a literal, is a
|
|
@@ -460,15 +460,15 @@ function rewriteDoctorBaseline(file, source) {
|
|
|
460
460
|
}] }
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
// src/cli/codemod/codemod-0.
|
|
464
|
-
/** The 0.
|
|
463
|
+
// src/cli/codemod/codemod-0.31.ts
|
|
464
|
+
/** The 0.31 config moves. Each entry moves one key path of `permdock.config.ts`. */
|
|
465
465
|
const CONFIG_MOVES = [];
|
|
466
466
|
/**
|
|
467
|
-
* The 0.
|
|
467
|
+
* The 0.31 rewrites, applied in order to every file after the config moves of
|
|
468
468
|
* the one before. Each returns the file unchanged when it has nothing to do.
|
|
469
469
|
*/
|
|
470
470
|
const REWRITES = [rewriteDoctorBaseline];
|
|
471
|
-
function
|
|
471
|
+
function rewrite031(file, source) {
|
|
472
472
|
let text = source;
|
|
473
473
|
const changes = [];
|
|
474
474
|
const followUps = [];
|
|
@@ -487,11 +487,11 @@ function rewrite032(file, source) {
|
|
|
487
487
|
files
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
|
-
const
|
|
490
|
+
const CODEMOD_0_31 = Object.freeze({
|
|
491
491
|
renames: [],
|
|
492
492
|
signatures: [],
|
|
493
493
|
configMoves: CONFIG_MOVES,
|
|
494
|
-
literals:
|
|
494
|
+
literals: rewrite031
|
|
495
495
|
});
|
|
496
496
|
// src/cli/codemod/config-moves.ts
|
|
497
497
|
/** Passes over one file before the codemod stops; each pass moves one key. */
|
|
@@ -2123,7 +2123,7 @@ const CODEMOD_0_26 = Object.freeze({
|
|
|
2123
2123
|
const CODEMODS = Object.freeze({
|
|
2124
2124
|
"0.17": CODEMOD_0_17,
|
|
2125
2125
|
"0.26": CODEMOD_0_26,
|
|
2126
|
-
"0.
|
|
2126
|
+
"0.31": CODEMOD_0_31
|
|
2127
2127
|
});
|
|
2128
2128
|
function codemodVersions() {
|
|
2129
2129
|
return [
|
|
@@ -2315,9 +2315,12 @@ function withConfigMoves(file, result, set) {
|
|
|
2315
2315
|
followUps: [...result.followUps, ...moved.followUps]
|
|
2316
2316
|
};
|
|
2317
2317
|
}
|
|
2318
|
+
/** Names an earlier build of this release used for a codemod. */
|
|
2319
|
+
const CODEMOD_ALIASES = Object.freeze({ "0.32": "0.31" });
|
|
2318
2320
|
function normaliseVersion(version) {
|
|
2319
2321
|
if (version === void 0) throw new CliError("usage", `codemod needs a version: permdock codemod <version>. Supported: ${Object.keys(CODEMODS).join(", ")}.`);
|
|
2320
|
-
|
|
2322
|
+
const name = /^v?(\d+\.\d+)(?:\.\d+)?$/u.exec(version)?.[1] ?? version;
|
|
2323
|
+
return Object.hasOwn(CODEMOD_ALIASES, name) ? CODEMOD_ALIASES[name] ?? name : name;
|
|
2321
2324
|
}
|
|
2322
2325
|
function isCodeFile(file) {
|
|
2323
2326
|
return EXTENSIONS.has(extname(file));
|