permdock 0.13.0 → 0.15.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/a2a/index.js +1 -1
- package/dist/{adoption-scan-oks22j9J.js → adoption-scan-DLel53Oa.js} +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.js +2 -2
- package/dist/{arazzo-BzVfXbhf.js → arazzo-CHK9NT6u.js} +1 -1
- package/dist/{arazzo-CBBIhC40.js → arazzo-CL8CZnpL.js} +1 -1
- package/dist/better-supabase/index.d.ts +20 -22
- package/dist/better-supabase/index.js +4 -16
- package/dist/better-supabase-Dirf_8Ec.js +72 -0
- package/dist/{casbin-C8r5trwy.js → casbin-DRFwgVIP.js} +1 -1
- package/dist/{casbin-BunKq48W.js → casbin-iAEXjmca.js} +1 -1
- package/dist/claude-agent/index.js +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/{cloud-C_Mau1q2.js → cloud-eOtmuonF.js} +1 -1
- package/dist/{codemod-BqYPToUJ.js → codemod-D6NYu4AK.js} +2 -2
- package/dist/{codemod-CpMCbp0G.js → codemod-KEDj_3zl.js} +1 -1
- package/dist/{collect-D9Tt0Bcx.js → collect-DnXL4B8c.js} +1 -1
- package/dist/{completion-Cq4fbT2S.js → completion-DCza8aQY.js} +1 -1
- package/dist/{config-0xxCmoD8.js → config-BAM3a3z8.js} +1 -1
- package/dist/{config-BR23fL8m.js → config-CcLlvEYW.js} +4 -1
- package/dist/{config-report-C1-r59VY.js → config-report-VZcQ0ZpS.js} +1 -1
- package/dist/{create-6EwRQlig.js → create-Coq5fIrq.js} +1 -1
- package/dist/{diff-BwR1JdP2.js → diff-CxtbOi2l.js} +1 -1
- package/dist/{diff-CQegtBAo.js → diff-DfmYaIhB.js} +1 -1
- package/dist/{doctor-CDfzrMQB.js → doctor-CMqPKuN_.js} +16 -49
- package/dist/{doctor-Dea6IqRw.js → doctor-gIO9WTYo.js} +2 -2
- package/dist/eve/index.js +1 -1
- package/dist/{fixtures-A1_sp_tR.js → fixtures-Bm4_K1ke.js} +7 -9
- package/dist/{import-PP7uH8rC.js → import-DK_J8tVE.js} +1 -1
- package/dist/{init-n1gkKHvc.js → init-Buibrl9h.js} +3 -3
- package/dist/{init-BuUt4bLJ.js → init-jLSyPMM7.js} +1 -1
- package/dist/{kernel-qv4cr9w8.js → kernel-BD8QuMnv.js} +9 -2
- package/dist/{login-YsrgkAQo.js → login-CB55O4Gv.js} +1 -1
- package/dist/{login-DyQNWJok.js → login-VVpkkund.js} +3 -3
- package/dist/{manifest-Cl6yHiVK.js → manifest-CbEyvPN2.js} +33 -33
- package/dist/mcp/index.d.ts +21 -3
- package/dist/mcp/index.js +87 -16
- package/dist/next/plugin.js +1 -1
- package/dist/openai/index.js +2 -2
- package/dist/{openapi-D8JQtO8k.js → openapi-CleDZYVf.js} +1 -1
- package/dist/{openapi-BFyBIe9J.js → openapi-eHZ5hwUJ.js} +2 -2
- package/dist/{output-DpCUAST3.js → output-BVZpQDad.js} +1 -1
- package/dist/{powersync-Bm3ZjHwD.js → powersync-CFWILHjb.js} +2 -2
- package/dist/powersync-CnGzxvEl.js +1 -0
- package/dist/{powersync-BTLk8GSl.js → powersync-uqYWxTjq.js} +126 -39
- package/dist/{pull-iVPQZsnI.js → pull-BBmCxnqX.js} +1 -1
- package/dist/pull-D6dloyrc.js +1 -0
- package/dist/react-native/index.d.ts +21 -8
- package/dist/react-native/index.js +103 -17
- package/dist/{rls-BItB4vkC.js → rls-BwKXdVEW.js} +5 -5
- package/dist/{rls-C8nxX0RV.js → rls-yK2nZUcm.js} +1 -1
- package/dist/{run-CjFdAzqE.js → run-D5WIJfs7.js} +3 -3
- package/dist/run-DlQYPtPv.js +1 -0
- package/dist/{scan-COIQvTMg.js → scan-CzdMtHnq.js} +1 -1
- package/dist/{schema-CeQZY6bO.js → schema-BDGEVO4g.js} +1 -1
- package/dist/{skills-CfkYP7GG.js → skills-BIsm1n26.js} +1 -1
- package/dist/{skills-5XWpNzCi.js → skills-BZxPQ_09.js} +1 -1
- package/dist/supabase/index.js +1 -1
- package/dist/{supabase-CBEK6KEo.js → supabase-DYWnT800.js} +2 -2
- package/dist/{supabase-hook-CyuD9Wau.js → supabase-hook-HPgwYb9V.js} +2 -2
- package/dist/supabase-hook-qsewAVZY.js +1 -0
- package/dist/{supautils-PRhfO-bL.js → supautils-CGk4YpvC.js} +16 -5
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.js +1 -1
- package/dist/testing/index.js +2 -2
- package/dist/unplugin/index.js +1 -1
- package/dist/usage-D3KJyaNS.js +1 -0
- package/dist/{usage-BfzSfOpD.js → usage-DBNrpwoT.js} +1 -1
- package/dist/{usage-hMYVFsN5.js → usage-e6M1Mls1.js} +2 -2
- package/dist/{verify-CmTiQ-yM.js → verify-CgIpJRcG.js} +3 -3
- package/dist/watch-CuPz0D2M.js +1 -0
- package/dist/{watch-Bpci3hBY.js → watch-DAkjm75Y.js} +1 -1
- package/package.json +16 -16
- package/skills/permdock-credentials/references/tokens-keys-links.md +1 -1
- package/skills/permdock-wire/references/adapters.md +1 -1
- package/dist/powersync-CObULVRk.js +0 -1
- package/dist/pull-3OQCgxUf.js +0 -1
- package/dist/run-BqW8S5TM.js +0 -1
- package/dist/supabase-hook-CWvEpdCh.js +0 -1
- package/dist/usage-BDiTP763.js +0 -1
- package/dist/watch-COuvly20.js +0 -1
- package/dist/{core-DzVINFbU.js → core-lxoANyai.js} +1 -1
- package/dist/{supabase-CC6rIri4.js → supabase-CDHMsDD0.js} +1 -1
package/dist/a2a/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { n as resourceRef } from "../resource-ref-CaS9yVPi.js";
|
|
|
8
8
|
import { i as challengeScope, l as withApp, o as hasScope, s as scopesReaching } from "../permdock-BvjivVb9.js";
|
|
9
9
|
import { p as wwwAuthenticate, r as bearerChallenge } from "../problem-BVLHFK33.js";
|
|
10
10
|
import { r as instanceOptions } from "../build-instance-BWXqwQYU.js";
|
|
11
|
-
import { n as createAgentKernel } from "../kernel-
|
|
11
|
+
import { n as createAgentKernel } from "../kernel-BD8QuMnv.js";
|
|
12
12
|
import { t as delegationFrom } from "../delegation-input-FTxMK3ji.js";
|
|
13
13
|
//#region src/a2a/create.ts
|
|
14
14
|
function firstScheme(options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as listSourceFiles } from "./files-BSjrtIHw.js";
|
|
2
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
2
|
+
import { t as DOCS_BASE } from "./manifest-CbEyvPN2.js";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { relative } from "node:path";
|
|
5
5
|
//#region src/cli/adoption-scan.ts
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as createPermDock } from "../create-
|
|
1
|
+
export { n as createPermDock } from "../create-Coq5fIrq.js";
|
package/dist/ai-sdk/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as compact } from "../compact-CAf557ZB.js";
|
|
2
2
|
import { n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "../errors-B6R_lg2a.js";
|
|
3
3
|
import { l as withApp } from "../permdock-BvjivVb9.js";
|
|
4
|
-
import { r as stepUpText, t as approvalTokenOf } from "../kernel-
|
|
5
|
-
import { t as agentRuntime } from "../create-
|
|
4
|
+
import { r as stepUpText, t as approvalTokenOf } from "../kernel-BD8QuMnv.js";
|
|
5
|
+
import { t as agentRuntime } from "../create-Coq5fIrq.js";
|
|
6
6
|
//#region src/ai-sdk/create.ts
|
|
7
7
|
const APPROVAL_STATUSES = /* @__PURE__ */ new Set([
|
|
8
8
|
"approved",
|
|
@@ -3,7 +3,7 @@ import { c as missingInput } from "./errors-Vpu6rKHl.js";
|
|
|
3
3
|
import { i as readJsonFile } from "./files-BSjrtIHw.js";
|
|
4
4
|
import { t as ARAZZO_REPORT_SCHEMA } from "./version-DMQ0dnN5.js";
|
|
5
5
|
import { a as loadModule, s as pickNamed, t as asPermissionTree } from "./load-DjSU5KXO.js";
|
|
6
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
6
|
+
import { t as DOCS_BASE } from "./manifest-CbEyvPN2.js";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { resolve } from "node:path";
|
|
9
9
|
//#region src/cli/arazzo.ts
|
|
@@ -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-CHK9NT6u.js")).runArazzo({
|
|
25
25
|
cwd: ctx.cwd,
|
|
26
26
|
config: ctx.config,
|
|
27
27
|
doc: given(flags.doc),
|
|
@@ -162,9 +162,10 @@ type ApiKeySessionOptions = {
|
|
|
162
162
|
readonly serviceRoles?: ServiceRoles<ApiKeySession>;
|
|
163
163
|
};
|
|
164
164
|
/**
|
|
165
|
-
* better-supabase's `SessionSnapshot`
|
|
166
|
-
* from `bsb.getRequestSession()`, that `'use cache: private'`
|
|
167
|
-
* `issuedAt` and `authzVersion` come from the `iat` and
|
|
165
|
+
* The fields of better-supabase's `SessionSnapshot` a subject reads: one
|
|
166
|
+
* verified token, from `bsb.getRequestSession()`, that `'use cache: private'`
|
|
167
|
+
* scopes share. Its `issuedAt` and `authzVersion` come from the `iat` and
|
|
168
|
+
* `authz_ver` claims.
|
|
168
169
|
*/
|
|
169
170
|
type SessionSnapshotLike = {
|
|
170
171
|
readonly accessToken: string;
|
|
@@ -417,9 +418,8 @@ type AuthorizationProviderOptions = {
|
|
|
417
418
|
/**
|
|
418
419
|
* Fill better-supabase's `rowsWith` (and `rowsWithFor` when the `_for`
|
|
419
420
|
* helpers exist) from the `rls.rowHelpers` helpers the manifest names, so a
|
|
420
|
-
* `config.
|
|
421
|
-
* rows the caller holds a permission on.
|
|
422
|
-
* whose config takes those templates.
|
|
421
|
+
* `config.subjects.<type>.permissions.<action>` entry with `rows` checks the
|
|
422
|
+
* rows the caller holds a permission on.
|
|
423
423
|
*/
|
|
424
424
|
readonly rowHelpers?: boolean;
|
|
425
425
|
};
|
|
@@ -480,13 +480,17 @@ type AuthorizerOptions = {
|
|
|
480
480
|
*/
|
|
481
481
|
readonly memberships?: MembershipSource | readonly MembershipSource[];
|
|
482
482
|
/**
|
|
483
|
-
*
|
|
484
|
-
* `
|
|
483
|
+
* Reads the user's current authorization version, which `claimsFirst`
|
|
484
|
+
* compares with the token's `authz_ver` claim; default the source's own
|
|
485
|
+
* `version`. Pass `authzVersion({ query })` from `permdock/supabase`, which
|
|
486
|
+
* reads `permdock_authz_version`, the table the token hook stamps `authz_ver`
|
|
487
|
+
* from, when the membership source has no `version` of its own or reads
|
|
488
|
+
* another one.
|
|
485
489
|
*/
|
|
486
490
|
readonly version?: MembershipSource["version"];
|
|
487
491
|
/**
|
|
488
|
-
* The version cache for `memberships` when better-supabase passes none (
|
|
489
|
-
*
|
|
492
|
+
* The version cache for `memberships` when better-supabase passes none (a
|
|
493
|
+
* server created without `versions`).
|
|
490
494
|
*/
|
|
491
495
|
readonly versions?: VersionCache;
|
|
492
496
|
/**
|
|
@@ -510,7 +514,7 @@ type AuthorizerOptions = {
|
|
|
510
514
|
* subject is mapped from the verified claims with `subjectFromBetterSupabase`;
|
|
511
515
|
* the request's `context.tenant` selects the active tenant only among the
|
|
512
516
|
* memberships the claims hold. A caller without claims is anonymous, and a
|
|
513
|
-
* throw denies. With better-supabase
|
|
517
|
+
* throw denies. With better-supabase's runtime `memo`, the checks of one
|
|
514
518
|
* request scope share an instance per claims, tenant and intent.
|
|
515
519
|
*/
|
|
516
520
|
export declare function authorizer(options: AuthorizerOptions): Authorizer<Permission>;
|
|
@@ -801,20 +805,14 @@ export declare function roleOrderFromCatalog(catalog: CatalogDocument, options?:
|
|
|
801
805
|
//#region src/better-supabase/share-links.d.ts
|
|
802
806
|
/**
|
|
803
807
|
* The fields of better-supabase's `ResolvedShareLink` a link subject is built
|
|
804
|
-
* from
|
|
805
|
-
* before it.
|
|
808
|
+
* from.
|
|
806
809
|
*/
|
|
807
|
-
type ShareLinkRow =
|
|
810
|
+
type ShareLinkRow = {
|
|
811
|
+
readonly id: string;
|
|
808
812
|
readonly subject: {
|
|
809
813
|
readonly type: string;
|
|
810
814
|
readonly id: string;
|
|
811
815
|
};
|
|
812
|
-
} | {
|
|
813
|
-
readonly subjectType: string;
|
|
814
|
-
readonly subjectId: string;
|
|
815
|
-
});
|
|
816
|
-
type ShareLinkRowFields = {
|
|
817
|
-
readonly id: string;
|
|
818
816
|
readonly organizationId: string;
|
|
819
817
|
readonly role: string;
|
|
820
818
|
/** Set on a link pinned to one version, which `subjectFromShareLink` refuses. */
|
|
@@ -846,8 +844,8 @@ type ShareLinkTarget = {
|
|
|
846
844
|
type ShareLinkSubjectOptions = {
|
|
847
845
|
readonly shareLinks: ShareLinkResolver;
|
|
848
846
|
/**
|
|
849
|
-
* One entry per subject type a guest page serves, keyed by
|
|
850
|
-
* `
|
|
847
|
+
* One entry per subject type a guest page serves, keyed by the row's
|
|
848
|
+
* `subject.type`.
|
|
851
849
|
*/
|
|
852
850
|
readonly links: Readonly<Record<string, ShareLinkTarget>>;
|
|
853
851
|
/**
|
|
@@ -457,12 +457,8 @@ function supportPolicy(options) {
|
|
|
457
457
|
}
|
|
458
458
|
//#endregion
|
|
459
459
|
//#region src/better-supabase/hooks.ts
|
|
460
|
-
/**
|
|
461
|
-
|
|
462
|
-
* `bs_permission_cap` before 0.15, `bsb_permission_cap` from 0.15. A run sets
|
|
463
|
-
* both, so the cap holds on every version in the peer range.
|
|
464
|
-
*/
|
|
465
|
-
const PERMISSION_CAP_CLAIMS = ["bs_permission_cap", "bsb_permission_cap"];
|
|
460
|
+
/** better-supabase's claim that caps a context to the permission keys it lists. */
|
|
461
|
+
const PERMISSION_CAP_CLAIM = "bsb_permission_cap";
|
|
466
462
|
/**
|
|
467
463
|
* Whether `permdock` is granted `key` with no row; an unknown key and
|
|
468
464
|
* `approval-required` are `false`.
|
|
@@ -541,7 +537,7 @@ function authorizationHooks(options) {
|
|
|
541
537
|
if (!isRecord(claims) || !await holdsAll(claims, ref)) return null;
|
|
542
538
|
return Object.freeze({
|
|
543
539
|
...claims,
|
|
544
|
-
|
|
540
|
+
[PERMISSION_CAP_CLAIM]: [...ref.permissions]
|
|
545
541
|
});
|
|
546
542
|
} catch {
|
|
547
543
|
return null;
|
|
@@ -1241,7 +1237,7 @@ const keyOf = (request) => isPermission(request.action) ? request.action.key : n
|
|
|
1241
1237
|
* subject is mapped from the verified claims with `subjectFromBetterSupabase`;
|
|
1242
1238
|
* the request's `context.tenant` selects the active tenant only among the
|
|
1243
1239
|
* memberships the claims hold. A caller without claims is anonymous, and a
|
|
1244
|
-
* throw denies. With better-supabase
|
|
1240
|
+
* throw denies. With better-supabase's runtime `memo`, the checks of one
|
|
1245
1241
|
* request scope share an instance per claims, tenant and intent.
|
|
1246
1242
|
*/
|
|
1247
1243
|
function authorizer(options) {
|
|
@@ -1674,14 +1670,6 @@ function ownEntry(record, key) {
|
|
|
1674
1670
|
return Object.hasOwn(record, key) ? record[key] : void 0;
|
|
1675
1671
|
}
|
|
1676
1672
|
function rowSubject(row) {
|
|
1677
|
-
if (!Object.hasOwn(row, "subject")) {
|
|
1678
|
-
const type = row["subjectType"];
|
|
1679
|
-
const id = row["subjectId"];
|
|
1680
|
-
return isId(type) && isId(id) ? {
|
|
1681
|
-
type,
|
|
1682
|
-
id
|
|
1683
|
-
} : void 0;
|
|
1684
|
-
}
|
|
1685
1673
|
const subject = row["subject"];
|
|
1686
1674
|
if (typeof subject !== "object" || subject === null) return void 0;
|
|
1687
1675
|
const ref = Object.fromEntries(Object.entries(subject));
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { r as isRecord } from "./compact-CAf557ZB.js";
|
|
2
|
+
import "./budget-BELja5A9.js";
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
//#region src/cli/shared/doctor-files.ts
|
|
6
|
+
const nodeFiles = Object.freeze({
|
|
7
|
+
exists: (path) => existsSync(path),
|
|
8
|
+
read: (path) => readFileSync(path, "utf8"),
|
|
9
|
+
list: (path) => readdirSync(path),
|
|
10
|
+
isDirectory: (path) => statSync(path, { throwIfNoEntry: false })?.isDirectory() === true
|
|
11
|
+
});
|
|
12
|
+
function filesOf(input) {
|
|
13
|
+
return input.files ?? nodeFiles;
|
|
14
|
+
}
|
|
15
|
+
/** Parses the JSON file at `path`; throws when it is missing or invalid. */
|
|
16
|
+
function readJson(files, path) {
|
|
17
|
+
return JSON.parse(files.read(path));
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/cli/project/better-supabase.ts
|
|
21
|
+
const CONFIG_FILES = [
|
|
22
|
+
"better-supabase.config.ts",
|
|
23
|
+
"better-supabase.config.mts",
|
|
24
|
+
"better-supabase.config.js",
|
|
25
|
+
"better-supabase.config.mjs"
|
|
26
|
+
];
|
|
27
|
+
/** The default export of the project's `better-supabase.config.*`, if it loads. */
|
|
28
|
+
async function betterSupabaseConfig(input) {
|
|
29
|
+
const files = filesOf(input);
|
|
30
|
+
const path = CONFIG_FILES.map((name) => resolve(input.cwd, name)).find((file) => files.exists(file));
|
|
31
|
+
if (path === void 0) return;
|
|
32
|
+
try {
|
|
33
|
+
const { loadModule } = await import("./load-Dm0pSYH3.js");
|
|
34
|
+
const loaded = (await loadModule(path))["default"];
|
|
35
|
+
return isRecord(loaded) ? loaded : void 0;
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function stringAt(value, ...path) {
|
|
41
|
+
let at = value;
|
|
42
|
+
for (const key of path) {
|
|
43
|
+
if (!isRecord(at)) return void 0;
|
|
44
|
+
at = at[key];
|
|
45
|
+
}
|
|
46
|
+
return typeof at === "string" && at !== "" ? at : void 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The claim better-supabase writes the active tenant to:
|
|
50
|
+
* `auth.organization.claim` in a grouped config, `claims.tenant` in a flat one,
|
|
51
|
+
* then `rls.tenantClaim` and `tenant_id`.
|
|
52
|
+
*/
|
|
53
|
+
function betterSupabaseTenantClaim(config, betterSupabase) {
|
|
54
|
+
return stringAt(betterSupabase, "auth", "organization", "claim") ?? stringAt(betterSupabase, "claims", "tenant") ?? config.rls?.tenantClaim ?? "tenant_id";
|
|
55
|
+
}
|
|
56
|
+
/** Resolve the hook default once for generation, inspection and doctor. */
|
|
57
|
+
function betterSupabaseDefaults(config, betterSupabase) {
|
|
58
|
+
const hook = config.supabase?.hook;
|
|
59
|
+
if (betterSupabase === void 0 || hook === void 0 || hook.activeFrom !== void 0) return config;
|
|
60
|
+
return {
|
|
61
|
+
...config,
|
|
62
|
+
supabase: {
|
|
63
|
+
...config.supabase,
|
|
64
|
+
hook: {
|
|
65
|
+
...hook,
|
|
66
|
+
activeFrom: `app_metadata.${betterSupabaseTenantClaim(config, betterSupabase)}`
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { nodeFiles as a, filesOf as i, betterSupabaseDefaults as n, readJson as o, betterSupabaseTenantClaim as r, betterSupabaseConfig as t };
|
|
@@ -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-iAEXjmca.js");
|
|
20
20
|
return runCasbinImport({
|
|
21
21
|
cwd: ctx.cwd,
|
|
22
22
|
model: given(flags.model),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as nonEmptyOr } from "./output-
|
|
1
|
+
import { a as nonEmptyOr } from "./output-BVZpQDad.js";
|
|
2
2
|
import { t as applyFiles } from "./files-B3AA05f1.js";
|
|
3
3
|
import { n as isIdentifier, t as emitPolicyModule } from "./policy-module-xym9fnSq.js";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as isRecord, t as compact } from "../compact-CAf557ZB.js";
|
|
2
2
|
import { l as withApp } from "../permdock-BvjivVb9.js";
|
|
3
|
-
import { t as agentRuntime } from "../create-
|
|
3
|
+
import { t as agentRuntime } from "../create-Coq5fIrq.js";
|
|
4
4
|
//#region src/claude-agent/create.ts
|
|
5
5
|
const MCP_PREFIX = "mcp__";
|
|
6
6
|
function asInput(input) {
|
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-DJZrPjRi.js"),
|
|
13
13
|
import("../signals-B1vHR3fN.js"),
|
|
14
|
-
import("../run-
|
|
14
|
+
import("../run-DlQYPtPv.js"),
|
|
15
15
|
import("../style-DblOtSga.js")
|
|
16
16
|
]);
|
|
17
17
|
const signals = trapSignals();
|
package/dist/cli/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as catalogPath } from "../catalog-path-CnI0XTFK.js";
|
|
2
|
-
import { t as defineConfig } from "../config-
|
|
2
|
+
import { t as defineConfig } from "../config-CcLlvEYW.js";
|
|
3
3
|
import { n as parsePushedPolicy, r as pushedPolicy, t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-CDuOL2de.js";
|
|
4
4
|
import { c as parseGrantsMarker, l as parseHookMarker } from "../markers-BeHZ4x9Q.js";
|
|
5
|
-
import { t as run } from "../run-
|
|
5
|
+
import { t as run } from "../run-D5WIJfs7.js";
|
|
6
6
|
//#region src/cli/token-schemas.ts
|
|
7
7
|
const ID = {
|
|
8
8
|
type: "string",
|
|
@@ -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-D6dloyrc.js")).runCloudPull({
|
|
74
74
|
cwd: ctx.cwd,
|
|
75
75
|
config: ctx.config,
|
|
76
76
|
url: given(flags.url),
|
|
@@ -7,7 +7,7 @@ const codemod = defineLeaf({
|
|
|
7
7
|
description: "The release to migrate to (0.5)",
|
|
8
8
|
required: true,
|
|
9
9
|
async complete() {
|
|
10
|
-
return (await import("./codemod-
|
|
10
|
+
return (await import("./codemod-KEDj_3zl.js")).codemodVersions();
|
|
11
11
|
}
|
|
12
12
|
}, {
|
|
13
13
|
name: "paths",
|
|
@@ -22,7 +22,7 @@ const codemod = defineLeaf({
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
async run(ctx, { flags, args, rest }) {
|
|
25
|
-
return (await import("./codemod-
|
|
25
|
+
return (await import("./codemod-KEDj_3zl.js")).runCodemod({
|
|
26
26
|
cwd: ctx.cwd,
|
|
27
27
|
version: args["version"],
|
|
28
28
|
paths: rest,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-Vpu6rKHl.js";
|
|
2
2
|
import { a as rel } from "./files-BSjrtIHw.js";
|
|
3
3
|
import { t as beforeFirst } from "./text-BMFRfBqc.js";
|
|
4
|
-
import { n as ROOT } from "./manifest-
|
|
4
|
+
import { n as ROOT } from "./manifest-CbEyvPN2.js";
|
|
5
5
|
import { i as renameMessage, n as DEFAULT_CHANGES, r as flagRename, t as COMMAND_MOVES } from "./renames-CGj7YwcQ.js";
|
|
6
6
|
import { i as refuseDirty, t as applyFiles } from "./files-B3AA05f1.js";
|
|
7
7
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
@@ -29,7 +29,7 @@ const collect = defineLeaf({
|
|
|
29
29
|
};
|
|
30
30
|
if (flags.watch) {
|
|
31
31
|
if (flags.check) throw new CliError("usage", "collect: --watch writes the catalog; drop --check", { code: "invalid_value" });
|
|
32
|
-
return (await import("./watch-
|
|
32
|
+
return (await import("./watch-CuPz0D2M.js")).watchCollect(ctx, overrides);
|
|
33
33
|
}
|
|
34
34
|
const result = await (await import("./collect-D-eroIfV.js")).runCollect({
|
|
35
35
|
cwd: ctx.cwd,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-Vpu6rKHl.js";
|
|
2
2
|
import { a as suggestion, o as GLOBAL_FLAGS } from "./args-0FrVs5EH.js";
|
|
3
|
-
import { a as resolve } from "./manifest-
|
|
3
|
+
import { a as resolve } from "./manifest-CbEyvPN2.js";
|
|
4
4
|
import { t as defineLeaf } from "./command-L8EstFNm.js";
|
|
5
5
|
//#region src/cli/core/completion.ts
|
|
6
6
|
const SHELLS = [
|
|
@@ -10,7 +10,7 @@ const config = defineLeaf({
|
|
|
10
10
|
...failOnFlag
|
|
11
11
|
},
|
|
12
12
|
async run(ctx, { flags }) {
|
|
13
|
-
const { runConfig } = await import("./config-report-
|
|
13
|
+
const { runConfig } = await import("./config-report-VZcQ0ZpS.js");
|
|
14
14
|
return runConfig({
|
|
15
15
|
cwd: ctx.cwd,
|
|
16
16
|
config: ctx.config,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as isRecord } from "./compact-CAf557ZB.js";
|
|
2
2
|
import { i as configError, n as CliError } from "./errors-Vpu6rKHl.js";
|
|
3
|
+
import { n as betterSupabaseDefaults, t as betterSupabaseConfig } from "./better-supabase-Dirf_8Ec.js";
|
|
3
4
|
import { a as isSection, i as isModuleKey, n as MODULE_KEYS, o as kindOf, r as describeKinds, t as CONFIG_SHAPE } from "./config-shape-tsxHx71E.js";
|
|
4
5
|
import { existsSync } from "node:fs";
|
|
5
6
|
import { relative, resolve } from "node:path";
|
|
@@ -80,8 +81,10 @@ async function readConfig(cwd, fromFlag, options) {
|
|
|
80
81
|
const mod = await loadModule(path, options);
|
|
81
82
|
const display = relative(cwd, path).replaceAll("\\", "/");
|
|
82
83
|
const raw = pickNamed(mod, ["default"]);
|
|
84
|
+
const parsed = parseConfig(hasModuleValue(raw) ? await traceValues(cwd, path, display, raw, options) : raw, display);
|
|
83
85
|
return {
|
|
84
|
-
...
|
|
86
|
+
...parsed,
|
|
87
|
+
config: betterSupabaseDefaults(parsed.config, await betterSupabaseConfig({ cwd })),
|
|
85
88
|
file: path
|
|
86
89
|
};
|
|
87
90
|
}
|
|
@@ -3,7 +3,7 @@ import { r as CONFIG_REPORT_SCHEMA } from "./version-DMQ0dnN5.js";
|
|
|
3
3
|
import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
|
|
4
4
|
import { n as guessPermissions, t as barrelFile } from "./collect-WCl8cJQV.js";
|
|
5
5
|
import "./sources-C4vkzZJV.js";
|
|
6
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
6
|
+
import { t as DOCS_BASE } from "./manifest-CbEyvPN2.js";
|
|
7
7
|
import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
|
|
8
8
|
//#region src/cli/config-report.ts
|
|
9
9
|
function configReport(input) {
|
|
@@ -4,7 +4,7 @@ import { o as deniedFor } from "./where-scope-DlCdCM_8.js";
|
|
|
4
4
|
import { l as withApp } from "./permdock-BvjivVb9.js";
|
|
5
5
|
import { t as composeWraps } from "./wrap-B2wziJI_.js";
|
|
6
6
|
import { r as instanceOptions } from "./build-instance-BWXqwQYU.js";
|
|
7
|
-
import { n as createAgentKernel } from "./kernel-
|
|
7
|
+
import { n as createAgentKernel } from "./kernel-BD8QuMnv.js";
|
|
8
8
|
//#region src/agent/create.ts
|
|
9
9
|
function modelRow(modelId) {
|
|
10
10
|
return { id: modelId };
|
|
@@ -21,7 +21,7 @@ const diff = defineLeaf({
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
async run(ctx, { flags, args }) {
|
|
24
|
-
return (await import("./diff-
|
|
24
|
+
return (await import("./diff-DfmYaIhB.js")).runDiff({
|
|
25
25
|
cwd: ctx.cwd,
|
|
26
26
|
config: ctx.config,
|
|
27
27
|
sources: [args["before"], args["after"]].filter((value) => value !== void 0),
|
|
@@ -8,7 +8,7 @@ import { t as buildCatalog } from "./catalog-doc-DjMKzJp9.js";
|
|
|
8
8
|
import { a as loadModule, n as asPolicy, s as pickNamed } from "./load-DjSU5KXO.js";
|
|
9
9
|
import { t as parseCatalog } from "./parse-1_ZheTW5.js";
|
|
10
10
|
import { t as operationFindings } from "./operation-findings-CXtFzlKJ.js";
|
|
11
|
-
import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-
|
|
11
|
+
import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-Bm4_K1ke.js";
|
|
12
12
|
import { existsSync, readFileSync } from "node:fs";
|
|
13
13
|
import { resolve } from "node:path";
|
|
14
14
|
//#region src/cli/diff/format.ts
|
|
@@ -16,51 +16,36 @@ import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-DjMKzJ
|
|
|
16
16
|
import { a as loadModule, i as loadConfiguredPolicy, n as asPolicy, s as pickNamed } from "./load-DjSU5KXO.js";
|
|
17
17
|
import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
|
|
18
18
|
import { r as runCollect } from "./collect-WCl8cJQV.js";
|
|
19
|
+
import { n as supabaseTenantClaim } from "./budget-BELja5A9.js";
|
|
20
|
+
import { a as nodeFiles, i as filesOf, n as betterSupabaseDefaults, o as readJson, r as betterSupabaseTenantClaim, t as betterSupabaseConfig } from "./better-supabase-Dirf_8Ec.js";
|
|
19
21
|
import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
|
|
20
22
|
import { a as scopeMembershipTable } from "./compile-EzEMB-7v.js";
|
|
21
|
-
import { n as supabaseTenantClaim } from "./budget-BELja5A9.js";
|
|
22
23
|
import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-C4vkzZJV.js";
|
|
23
24
|
import { t as parseCatalog } from "./parse-1_ZheTW5.js";
|
|
24
25
|
import { n as activeTenantMismatch } from "./active-tenant-DVee32-T.js";
|
|
25
26
|
import "./markers-BeHZ4x9Q.js";
|
|
26
27
|
import { t as didYouMean } from "./args-0FrVs5EH.js";
|
|
27
|
-
import { t as DOCS_BASE } from "./manifest-
|
|
28
|
+
import { t as DOCS_BASE } from "./manifest-CbEyvPN2.js";
|
|
28
29
|
import { t as createStyle } from "./style-Ds11Hmk4.js";
|
|
29
|
-
import { a as nonEmptyOr, r as findingOf } from "./output-
|
|
30
|
-
import { i as runSkillsInstall } from "./skills-
|
|
30
|
+
import { a as nonEmptyOr, r as findingOf } from "./output-BVZpQDad.js";
|
|
31
|
+
import { i as runSkillsInstall } from "./skills-BZxPQ_09.js";
|
|
31
32
|
import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
|
|
32
33
|
import { l as partPath } from "./output-files-BIQ_9pIs.js";
|
|
33
|
-
import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-
|
|
34
|
+
import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-HPgwYb9V.js";
|
|
34
35
|
import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-DimBcVWY.js";
|
|
35
36
|
import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-qqBuGJXr.js";
|
|
36
37
|
import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
|
|
37
38
|
import { i as group, n as membershipColumns, o as sqlStatements, r as tableKey } from "./deciding-columns-NB4wcyBf.js";
|
|
38
39
|
import { t as FIELD_VIEWS } from "./fields-DI8s3cPl.js";
|
|
39
40
|
import { t as resolveNames } from "./resolve-names-Y1Cb22cp.js";
|
|
40
|
-
import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-
|
|
41
|
-
import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-
|
|
42
|
-
import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-
|
|
43
|
-
import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-
|
|
41
|
+
import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-e6M1Mls1.js";
|
|
42
|
+
import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-CgIpJRcG.js";
|
|
43
|
+
import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-uqYWxTjq.js";
|
|
44
|
+
import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-CGk4YpvC.js";
|
|
44
45
|
import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-B2xffQgY.js";
|
|
45
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
46
46
|
import { basename, dirname, join, resolve } from "node:path";
|
|
47
47
|
import { pathToFileURL } from "node:url";
|
|
48
48
|
import { createRequire } from "node:module";
|
|
49
|
-
//#region src/cli/shared/doctor-files.ts
|
|
50
|
-
const nodeFiles = Object.freeze({
|
|
51
|
-
exists: (path) => existsSync(path),
|
|
52
|
-
read: (path) => readFileSync(path, "utf8"),
|
|
53
|
-
list: (path) => readdirSync(path),
|
|
54
|
-
isDirectory: (path) => statSync(path, { throwIfNoEntry: false })?.isDirectory() === true
|
|
55
|
-
});
|
|
56
|
-
function filesOf(input) {
|
|
57
|
-
return input.files ?? nodeFiles;
|
|
58
|
-
}
|
|
59
|
-
/** Parses the JSON file at `path`; throws when it is missing or invalid. */
|
|
60
|
-
function readJson(files, path) {
|
|
61
|
-
return JSON.parse(files.read(path));
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
49
|
//#region src/cli/project/project.ts
|
|
65
50
|
function loadProject(input) {
|
|
66
51
|
const { cwd, config } = input;
|
|
@@ -216,24 +201,6 @@ async function pd064(input) {
|
|
|
216
201
|
}
|
|
217
202
|
//#endregion
|
|
218
203
|
//#region src/cli/doctor/better-supabase.ts
|
|
219
|
-
const CONFIG_FILES = [
|
|
220
|
-
"better-supabase.config.ts",
|
|
221
|
-
"better-supabase.config.mts",
|
|
222
|
-
"better-supabase.config.js",
|
|
223
|
-
"better-supabase.config.mjs"
|
|
224
|
-
];
|
|
225
|
-
/** The default export of the project's `better-supabase.config.*`, if it loads. */
|
|
226
|
-
async function betterSupabaseConfig(input) {
|
|
227
|
-
const files = filesOf(input);
|
|
228
|
-
const path = CONFIG_FILES.map((name) => resolve(input.cwd, name)).find((file) => files.exists(file));
|
|
229
|
-
if (path === void 0) return;
|
|
230
|
-
try {
|
|
231
|
-
const loaded = (await loadModule(path))["default"];
|
|
232
|
-
return isRecord(loaded) ? loaded : void 0;
|
|
233
|
-
} catch {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
204
|
function activeTenantOf(config) {
|
|
238
205
|
const blocks = config["blocks"];
|
|
239
206
|
const permissions = isRecord(blocks) ? blocks["permissions"] : void 0;
|
|
@@ -253,20 +220,20 @@ function activeTenantOf(config) {
|
|
|
253
220
|
* `switch_organization` never changes the tenant claim.
|
|
254
221
|
*/
|
|
255
222
|
async function pd078(input) {
|
|
256
|
-
|
|
257
|
-
if (hook === void 0) return [];
|
|
223
|
+
if (input.config.supabase?.hook === void 0) return [];
|
|
258
224
|
const config = await betterSupabaseConfig(input);
|
|
259
|
-
|
|
225
|
+
if (config === void 0) return [];
|
|
226
|
+
const activeTenant = activeTenantOf(config);
|
|
260
227
|
if (activeTenant === void 0) return [];
|
|
261
228
|
const policy = await policyOf(input);
|
|
262
229
|
const root = policy === void 0 ? void 0 : rootScope(scopeList(policy.scopes));
|
|
263
230
|
let from;
|
|
264
231
|
try {
|
|
265
|
-
from = activeSource(hook
|
|
232
|
+
from = activeSource(betterSupabaseDefaults(input.config, config).supabase?.hook?.activeFrom, root ?? "tenant");
|
|
266
233
|
} catch {
|
|
267
234
|
return [];
|
|
268
235
|
}
|
|
269
|
-
const mismatch = activeTenantMismatch(from, input.config
|
|
236
|
+
const mismatch = activeTenantMismatch(from, betterSupabaseTenantClaim(input.config, config), activeTenant);
|
|
270
237
|
return mismatch === void 0 ? [] : [{
|
|
271
238
|
code: "PD078",
|
|
272
239
|
severity: "warning",
|
|
@@ -1086,7 +1053,7 @@ async function pd058(input) {
|
|
|
1086
1053
|
code: "PD058",
|
|
1087
1054
|
severity: "warning",
|
|
1088
1055
|
message: gap,
|
|
1089
|
-
fix: "build the source with tableMembershipSource or junctionMembershipSource, without expiresAt
|
|
1056
|
+
fix: "build the source with tableMembershipSource or junctionMembershipSource, without expiresAt, or serve its members from the server"
|
|
1090
1057
|
}));
|
|
1091
1058
|
return [...staleFiles(cwd, compiled.files).map((file) => ({
|
|
1092
1059
|
code: "PD058",
|
|
@@ -10,7 +10,7 @@ const doctor = defineLeaf({
|
|
|
10
10
|
description: "Check codes or groups to run",
|
|
11
11
|
valueHint: "code",
|
|
12
12
|
async complete() {
|
|
13
|
-
const { DOCTOR_CHECKS } = await import("./doctor-
|
|
13
|
+
const { DOCTOR_CHECKS } = await import("./doctor-CMqPKuN_.js");
|
|
14
14
|
return [.../* @__PURE__ */ new Set([...DOCTOR_CHECKS.map(({ code }) => code), ...DOCTOR_CHECKS.flatMap(({ groups }) => groups)])];
|
|
15
15
|
}
|
|
16
16
|
},
|
|
@@ -27,7 +27,7 @@ const doctor = defineLeaf({
|
|
|
27
27
|
if (answer === void 0) return CANCELLED;
|
|
28
28
|
fix = answer;
|
|
29
29
|
}
|
|
30
|
-
return (await import("./doctor-
|
|
30
|
+
return (await import("./doctor-CMqPKuN_.js")).runDoctor({
|
|
31
31
|
cwd: ctx.cwd,
|
|
32
32
|
config: ctx.config,
|
|
33
33
|
only: flags.only,
|
package/dist/eve/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as compact } from "../compact-CAf557ZB.js";
|
|
|
2
2
|
import { l as withApp } from "../permdock-BvjivVb9.js";
|
|
3
3
|
import { c as isApprovalError } from "../types-CcUXciSj.js";
|
|
4
4
|
import { o as resolveApproval } from "../helpers-DJicaG6f.js";
|
|
5
|
-
import { t as agentRuntime } from "../create-
|
|
5
|
+
import { t as agentRuntime } from "../create-Coq5fIrq.js";
|
|
6
6
|
import { t as boundedMap } from "../lru-8q4WZjBV.js";
|
|
7
7
|
//#region src/eve/create.ts
|
|
8
8
|
const TOKENS_PER_PROCESS = 1e3;
|