permdock 0.13.0 → 0.14.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.
Files changed (84) hide show
  1. package/dist/a2a/index.js +1 -1
  2. package/dist/{adoption-scan-oks22j9J.js → adoption-scan-BGtwGfoH.js} +1 -1
  3. package/dist/agent/index.js +1 -1
  4. package/dist/ai-sdk/index.js +2 -2
  5. package/dist/{arazzo-BzVfXbhf.js → arazzo-9uhbmKf5.js} +1 -1
  6. package/dist/{arazzo-CBBIhC40.js → arazzo-Bol9OgF-.js} +1 -1
  7. package/dist/better-supabase/index.d.ts +14 -20
  8. package/dist/better-supabase/index.js +4 -16
  9. package/dist/better-supabase-83Gsetrv.js +56 -0
  10. package/dist/{casbin-C8r5trwy.js → casbin-1PVgMHOR.js} +1 -1
  11. package/dist/{casbin-BunKq48W.js → casbin-CBXD5rFx.js} +1 -1
  12. package/dist/claude-agent/index.js +1 -1
  13. package/dist/cli/bin.js +1 -1
  14. package/dist/cli/index.js +2 -2
  15. package/dist/{cloud-C_Mau1q2.js → cloud-BfJVKpcN.js} +1 -1
  16. package/dist/{codemod-CpMCbp0G.js → codemod-BXLd4K3j.js} +1 -1
  17. package/dist/{codemod-BqYPToUJ.js → codemod-DWfH-KHk.js} +2 -2
  18. package/dist/{collect-D9Tt0Bcx.js → collect-lZgCKMe_.js} +1 -1
  19. package/dist/{completion-Cq4fbT2S.js → completion-fJ19i8Jk.js} +1 -1
  20. package/dist/{config-0xxCmoD8.js → config-BYSk3iKV.js} +1 -1
  21. package/dist/{config-BR23fL8m.js → config-ZZdtyQZy.js} +4 -1
  22. package/dist/{config-report-C1-r59VY.js → config-report-BpztJ3HP.js} +1 -1
  23. package/dist/{create-6EwRQlig.js → create-Coq5fIrq.js} +1 -1
  24. package/dist/{diff-BwR1JdP2.js → diff-CxtbOi2l.js} +1 -1
  25. package/dist/{diff-CQegtBAo.js → diff-DfmYaIhB.js} +1 -1
  26. package/dist/{doctor-Dea6IqRw.js → doctor-NxCr_hba.js} +2 -2
  27. package/dist/{doctor-CDfzrMQB.js → doctor-eNc7A_7I.js} +13 -47
  28. package/dist/eve/index.js +1 -1
  29. package/dist/{fixtures-A1_sp_tR.js → fixtures-Bm4_K1ke.js} +7 -9
  30. package/dist/{import-PP7uH8rC.js → import-efm6qPgx.js} +1 -1
  31. package/dist/{init-n1gkKHvc.js → init-BtWY1L0J.js} +3 -3
  32. package/dist/{init-BuUt4bLJ.js → init-D6rpLPwM.js} +1 -1
  33. package/dist/{kernel-qv4cr9w8.js → kernel-BD8QuMnv.js} +9 -2
  34. package/dist/{login-DyQNWJok.js → login-B8s6VI8Z.js} +3 -3
  35. package/dist/{login-YsrgkAQo.js → login-cLflB63Z.js} +1 -1
  36. package/dist/{manifest-Cl6yHiVK.js → manifest-BWIR_EEB.js} +33 -33
  37. package/dist/mcp/index.d.ts +12 -3
  38. package/dist/mcp/index.js +60 -16
  39. package/dist/next/plugin.js +1 -1
  40. package/dist/openai/index.js +2 -2
  41. package/dist/{openapi-BFyBIe9J.js → openapi-CT55v3WD.js} +2 -2
  42. package/dist/{openapi-D8JQtO8k.js → openapi-DDENzRbG.js} +1 -1
  43. package/dist/{output-DpCUAST3.js → output-3iB3_Hfg.js} +1 -1
  44. package/dist/{powersync-Bm3ZjHwD.js → powersync-COjQTHRD.js} +2 -2
  45. package/dist/{powersync-BTLk8GSl.js → powersync-DVbskWD9.js} +126 -39
  46. package/dist/powersync-k8lUeC37.js +1 -0
  47. package/dist/pull-BY1METGf.js +1 -0
  48. package/dist/{pull-iVPQZsnI.js → pull-Er4aBHlL.js} +1 -1
  49. package/dist/react-native/index.d.ts +7 -7
  50. package/dist/react-native/index.js +57 -16
  51. package/dist/{rls-BItB4vkC.js → rls-DY3Fc18U.js} +5 -5
  52. package/dist/{rls-C8nxX0RV.js → rls-DjjOHlKE.js} +1 -1
  53. package/dist/{run-CjFdAzqE.js → run-BlxXmaDS.js} +3 -3
  54. package/dist/run-DGSLvGty.js +1 -0
  55. package/dist/{scan-COIQvTMg.js → scan-CR_xm71k.js} +1 -1
  56. package/dist/{schema-CeQZY6bO.js → schema-CnrIP94n.js} +1 -1
  57. package/dist/{skills-5XWpNzCi.js → skills-CY-MY_Oj.js} +1 -1
  58. package/dist/{skills-CfkYP7GG.js → skills-uzsVqEi9.js} +1 -1
  59. package/dist/supabase/index.js +1 -1
  60. package/dist/{supabase-CBEK6KEo.js → supabase-DYWnT800.js} +2 -2
  61. package/dist/{supabase-hook-CyuD9Wau.js → supabase-hook-HPgwYb9V.js} +2 -2
  62. package/dist/supabase-hook-qsewAVZY.js +1 -0
  63. package/dist/{supautils-PRhfO-bL.js → supautils-DZ95xxW-.js} +3 -3
  64. package/dist/testing/core.js +1 -1
  65. package/dist/testing/fixtures/index.js +1 -1
  66. package/dist/testing/index.js +2 -2
  67. package/dist/unplugin/index.js +1 -1
  68. package/dist/usage-CH7oISI6.js +1 -0
  69. package/dist/{usage-BfzSfOpD.js → usage-Dm2hn0pS.js} +1 -1
  70. package/dist/{usage-hMYVFsN5.js → usage-WYRc7Kqg.js} +2 -2
  71. package/dist/{verify-CmTiQ-yM.js → verify-CHQgLrtS.js} +3 -3
  72. package/dist/watch-C44FtM79.js +1 -0
  73. package/dist/{watch-Bpci3hBY.js → watch-CTfSlIGD.js} +1 -1
  74. package/package.json +16 -16
  75. package/skills/permdock-credentials/references/tokens-keys-links.md +1 -1
  76. package/skills/permdock-wire/references/adapters.md +1 -1
  77. package/dist/powersync-CObULVRk.js +0 -1
  78. package/dist/pull-3OQCgxUf.js +0 -1
  79. package/dist/run-BqW8S5TM.js +0 -1
  80. package/dist/supabase-hook-CWvEpdCh.js +0 -1
  81. package/dist/usage-BDiTP763.js +0 -1
  82. package/dist/watch-COuvly20.js +0 -1
  83. package/dist/{core-DzVINFbU.js → core-lxoANyai.js} +1 -1
  84. 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-qv4cr9w8.js";
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-Cl6yHiVK.js";
2
+ import { t as DOCS_BASE } from "./manifest-BWIR_EEB.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { relative } from "node:path";
5
5
  //#region src/cli/adoption-scan.ts
@@ -1 +1 @@
1
- export { n as createPermDock } from "../create-6EwRQlig.js";
1
+ export { n as createPermDock } from "../create-Coq5fIrq.js";
@@ -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-qv4cr9w8.js";
5
- import { t as agentRuntime } from "../create-6EwRQlig.js";
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-Cl6yHiVK.js";
6
+ import { t as DOCS_BASE } from "./manifest-BWIR_EEB.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-BzVfXbhf.js")).runArazzo({
24
+ return (await import("./arazzo-9uhbmKf5.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` (0.15 and later): one verified token,
166
- * from `bsb.getRequestSession()`, that `'use cache: private'` scopes share. Its
167
- * `issuedAt` and `authzVersion` come from the `iat` and `authz_ver` claims.
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.records.<type>.permissions.<action>` entry with `rows` checks the
421
- * rows the caller holds a permission on. Needs better-supabase 0.22 or later,
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
  };
@@ -485,8 +485,8 @@ type AuthorizerOptions = {
485
485
  */
486
486
  readonly version?: MembershipSource["version"];
487
487
  /**
488
- * The version cache for `memberships` when better-supabase passes none (0.13
489
- * and 0.14, or a server created without `versions`).
488
+ * The version cache for `memberships` when better-supabase passes none (a
489
+ * server created without `versions`).
490
490
  */
491
491
  readonly versions?: VersionCache;
492
492
  /**
@@ -510,7 +510,7 @@ type AuthorizerOptions = {
510
510
  * subject is mapped from the verified claims with `subjectFromBetterSupabase`;
511
511
  * the request's `context.tenant` selects the active tenant only among the
512
512
  * memberships the claims hold. A caller without claims is anonymous, and a
513
- * throw denies. With better-supabase 0.15's runtime `memo`, the checks of one
513
+ * throw denies. With better-supabase's runtime `memo`, the checks of one
514
514
  * request scope share an instance per claims, tenant and intent.
515
515
  */
516
516
  export declare function authorizer(options: AuthorizerOptions): Authorizer<Permission>;
@@ -801,20 +801,14 @@ export declare function roleOrderFromCatalog(catalog: CatalogDocument, options?:
801
801
  //#region src/better-supabase/share-links.d.ts
802
802
  /**
803
803
  * The fields of better-supabase's `ResolvedShareLink` a link subject is built
804
- * from: `subject` from better-supabase 0.14, `subjectType` and `subjectId`
805
- * before it.
804
+ * from.
806
805
  */
807
- type ShareLinkRow = ShareLinkRowFields & ({
806
+ type ShareLinkRow = {
807
+ readonly id: string;
808
808
  readonly subject: {
809
809
  readonly type: string;
810
810
  readonly id: string;
811
811
  };
812
- } | {
813
- readonly subjectType: string;
814
- readonly subjectId: string;
815
- });
816
- type ShareLinkRowFields = {
817
- readonly id: string;
818
812
  readonly organizationId: string;
819
813
  readonly role: string;
820
814
  /** Set on a link pinned to one version, which `subjectFromShareLink` refuses. */
@@ -846,8 +840,8 @@ type ShareLinkTarget = {
846
840
  type ShareLinkSubjectOptions = {
847
841
  readonly shareLinks: ShareLinkResolver;
848
842
  /**
849
- * One entry per subject type a guest page serves, keyed by better-supabase's
850
- * `subjectType`.
843
+ * One entry per subject type a guest page serves, keyed by the row's
844
+ * `subject.type`.
851
845
  */
852
846
  readonly links: Readonly<Record<string, ShareLinkTarget>>;
853
847
  /**
@@ -457,12 +457,8 @@ function supportPolicy(options) {
457
457
  }
458
458
  //#endregion
459
459
  //#region src/better-supabase/hooks.ts
460
- /**
461
- * better-supabase's claim that caps a context to the permission keys it lists:
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
- ...Object.fromEntries(PERMISSION_CAP_CLAIMS.map((claim) => [claim, [...ref.permissions]]))
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 0.15's runtime `memo`, the checks of one
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,56 @@
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
+ /** Resolve the hook default once for generation, inspection and doctor. */
41
+ function betterSupabaseDefaults(config, detected) {
42
+ const hook = config.supabase?.hook;
43
+ if (!detected || hook === void 0 || hook.activeFrom !== void 0) return config;
44
+ return {
45
+ ...config,
46
+ supabase: {
47
+ ...config.supabase,
48
+ hook: {
49
+ ...hook,
50
+ activeFrom: `app_metadata.${config.rls?.tenantClaim ?? "tenant_id"}`
51
+ }
52
+ }
53
+ };
54
+ }
55
+ //#endregion
56
+ export { readJson as a, nodeFiles as i, betterSupabaseDefaults as n, filesOf 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-BunKq48W.js");
19
+ const { runCasbinImport } = await import("./casbin-CBXD5rFx.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-DpCUAST3.js";
1
+ import { a as nonEmptyOr } from "./output-3iB3_Hfg.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-6EwRQlig.js";
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-BqW8S5TM.js"),
14
+ import("../run-DGSLvGty.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-BR23fL8m.js";
2
+ import { t as defineConfig } from "../config-ZZdtyQZy.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-CjFdAzqE.js";
5
+ import { t as run } from "../run-BlxXmaDS.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-3OQCgxUf.js")).runCloudPull({
73
+ return (await import("./pull-BY1METGf.js")).runCloudPull({
74
74
  cwd: ctx.cwd,
75
75
  config: ctx.config,
76
76
  url: given(flags.url),
@@ -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-Cl6yHiVK.js";
4
+ import { n as ROOT } from "./manifest-BWIR_EEB.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";
@@ -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-CpMCbp0G.js")).codemodVersions();
10
+ return (await import("./codemod-BXLd4K3j.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-CpMCbp0G.js")).runCodemod({
25
+ return (await import("./codemod-BXLd4K3j.js")).runCodemod({
26
26
  cwd: ctx.cwd,
27
27
  version: args["version"],
28
28
  paths: rest,
@@ -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-COuvly20.js")).watchCollect(ctx, overrides);
32
+ return (await import("./watch-C44FtM79.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-Cl6yHiVK.js";
3
+ import { a as resolve } from "./manifest-BWIR_EEB.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-C1-r59VY.js");
13
+ const { runConfig } = await import("./config-report-BpztJ3HP.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-83Gsetrv.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
- ...parseConfig(hasModuleValue(raw) ? await traceValues(cwd, path, display, raw, options) : raw, display),
86
+ ...parsed,
87
+ config: betterSupabaseDefaults(parsed.config, await betterSupabaseConfig({ cwd }) !== void 0),
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-Cl6yHiVK.js";
6
+ import { t as DOCS_BASE } from "./manifest-BWIR_EEB.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-qv4cr9w8.js";
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-CQegtBAo.js")).runDiff({
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-A1_sp_tR.js";
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
@@ -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-CDfzrMQB.js");
13
+ const { DOCTOR_CHECKS } = await import("./doctor-eNc7A_7I.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-CDfzrMQB.js")).runDoctor({
30
+ return (await import("./doctor-eNc7A_7I.js")).runDoctor({
31
31
  cwd: ctx.cwd,
32
32
  config: ctx.config,
33
33
  only: flags.only,
@@ -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 readJson, i as nodeFiles, n as betterSupabaseDefaults, r as filesOf, t as betterSupabaseConfig } from "./better-supabase-83Gsetrv.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-Cl6yHiVK.js";
28
+ import { t as DOCS_BASE } from "./manifest-BWIR_EEB.js";
28
29
  import { t as createStyle } from "./style-Ds11Hmk4.js";
29
- import { a as nonEmptyOr, r as findingOf } from "./output-DpCUAST3.js";
30
- import { i as runSkillsInstall } from "./skills-5XWpNzCi.js";
30
+ import { a as nonEmptyOr, r as findingOf } from "./output-3iB3_Hfg.js";
31
+ import { i as runSkillsInstall } from "./skills-CY-MY_Oj.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-CyuD9Wau.js";
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-hMYVFsN5.js";
41
- import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-CmTiQ-yM.js";
42
- import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-BTLk8GSl.js";
43
- import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-PRhfO-bL.js";
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-WYRc7Kqg.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-CHQgLrtS.js";
43
+ import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-DVbskWD9.js";
44
+ import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-DZ95xxW-.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,8 +220,7 @@ function activeTenantOf(config) {
253
220
  * `switch_organization` never changes the tenant claim.
254
221
  */
255
222
  async function pd078(input) {
256
- const hook = input.config.supabase?.hook;
257
- if (hook === void 0) return [];
223
+ if (input.config.supabase?.hook === void 0) return [];
258
224
  const config = await betterSupabaseConfig(input);
259
225
  const activeTenant = config === void 0 ? void 0 : activeTenantOf(config);
260
226
  if (activeTenant === void 0) return [];
@@ -262,7 +228,7 @@ async function pd078(input) {
262
228
  const root = policy === void 0 ? void 0 : rootScope(scopeList(policy.scopes));
263
229
  let from;
264
230
  try {
265
- from = activeSource(hook.activeFrom, root ?? "tenant");
231
+ from = activeSource(betterSupabaseDefaults(input.config, config !== void 0).supabase?.hook?.activeFrom, root ?? "tenant");
266
232
  } catch {
267
233
  return [];
268
234
  }
@@ -1086,7 +1052,7 @@ async function pd058(input) {
1086
1052
  code: "PD058",
1087
1053
  severity: "warning",
1088
1054
  message: gap,
1089
- fix: "build the source with tableMembershipSource or junctionMembershipSource, without expiresAt or disabledAt, or serve its members from the server"
1055
+ fix: "build the source with tableMembershipSource or junctionMembershipSource, without expiresAt, or serve its members from the server"
1090
1056
  }));
1091
1057
  return [...staleFiles(cwd, compiled.files).map((file) => ({
1092
1058
  code: "PD058",
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-6EwRQlig.js";
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;
@@ -5,12 +5,14 @@ import { a as loadModule, s as pickNamed } from "./load-DjSU5KXO.js";
5
5
  import { existsSync } from "node:fs";
6
6
  import { resolve } from "node:path";
7
7
  //#region src/cli/fixtures.ts
8
- function asFixtures(value) {
8
+ function asFixtures(value, followed = false) {
9
9
  const list = Array.isArray(value) ? value : isRecord(value) && Array.isArray(value["fixtures"]) ? value["fixtures"] : void 0;
10
10
  if (list === void 0) throw configError("PermDock CLI: fixtures must be an array or { fixtures }");
11
11
  return list.map((item, index) => {
12
12
  if (!isRecord(item) || !isRecord(item["subject"]) || item["row"] === void 0) throw configError(`PermDock CLI: fixture ${index} needs subject and row`);
13
- if (typeof item["action"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} needs action`);
13
+ if (followed && item["table"] !== void 0) {
14
+ if (typeof item["table"] !== "string" || item["table"].length === 0 || item["action"] !== void 0 || item["expected"] !== "granted" && item["expected"] !== "denied") throw configError(`PermDock CLI: fixture ${index} needs table and expected (granted or denied), without action`);
15
+ } else if (typeof item["action"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} needs action`);
14
16
  if (typeof item["subject"]["id"] !== "string") throw new TypeError(`PermDock CLI: fixture ${index} subject needs id`);
15
17
  const memberships = item["subject"]["memberships"];
16
18
  if (memberships !== void 0 && !Array.isArray(memberships)) throw configError(`PermDock CLI: fixture ${index} subject.memberships must be an array`);
@@ -26,23 +28,19 @@ function asCustomRoles(value) {
26
28
  if (!Array.isArray(value["customRoles"])) throw new TypeError("PermDock CLI: fixtures customRoles must be an array");
27
29
  return value["customRoles"];
28
30
  }
29
- /**
30
- * A `.json` file or a module exporting `fixtures` (or default) and optionally
31
- * `customRoles`.
32
- */
33
- async function loadFixtures(cwd, path) {
31
+ async function loadFixtures(cwd, path, followed = false) {
34
32
  const abs = resolve(cwd, path);
35
33
  if (!existsSync(abs)) throw configError(`PermDock CLI: fixtures not found: ${path}`);
36
34
  if (abs.endsWith(".json")) {
37
35
  const parsed = readJsonFile(abs);
38
36
  return {
39
- fixtures: asFixtures(parsed),
37
+ fixtures: asFixtures(parsed, followed),
40
38
  customRoles: asCustomRoles(parsed)
41
39
  };
42
40
  }
43
41
  const mod = await loadModule(abs);
44
42
  return {
45
- fixtures: asFixtures(pickNamed(mod, ["fixtures", "default"])),
43
+ fixtures: asFixtures(pickNamed(mod, ["fixtures", "default"]), followed),
46
44
  customRoles: asCustomRoles(mod)
47
45
  };
48
46
  }
@@ -4,7 +4,7 @@ import { i as readJsonFile } from "./files-BSjrtIHw.js";
4
4
  import { t as applyFiles } from "./files-B3AA05f1.js";
5
5
  import { n as httpRequest } from "./http-DOL33cO0.js";
6
6
  import { i as schemaExpression, t as emitPermissionsModule } from "./generate-CezbCaTI.js";
7
- import { t as validateOpenapi } from "./schema-CeQZY6bO.js";
7
+ import { t as validateOpenapi } from "./schema-CnrIP94n.js";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { resolve } from "node:path";
10
10
  //#region ../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js