permdock 0.9.0 → 0.10.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 (108) hide show
  1. package/dist/active-tenant-DVee32-T.js +39 -0
  2. package/dist/{adoption-scan-Ch07MdxN.js → adoption-scan-0oFt2RD5.js} +1 -1
  3. package/dist/{arazzo-BpS7LnV0.js → arazzo-DA9PCXew.js} +1 -1
  4. package/dist/{arazzo-CmQaGPkM.js → arazzo-DhxDfYt-.js} +1 -1
  5. package/dist/better-supabase/index.d.ts +188 -23
  6. package/dist/better-supabase/index.js +246 -62
  7. package/dist/{casbin-bHyIxTNQ.js → casbin-BJu2liqU.js} +1 -1
  8. package/dist/{casbin-B7_yS-oo.js → casbin-BkhqGh2z.js} +1 -1
  9. package/dist/cli/bin.js +1 -1
  10. package/dist/cli/index.d.ts +6 -1
  11. package/dist/cli/index.js +10 -2
  12. package/dist/{cloud-3kWfjnYy.js → cloud-3RIuS4E9.js} +2 -2
  13. package/dist/{codemod-D9Aiii1r.js → codemod-DLcp-B6v.js} +2 -2
  14. package/dist/{codemod-Bv5i-Mzo.js → codemod-DRl_w-bY.js} +1 -1
  15. package/dist/{collect-B80GYEot.js → collect-D9Tt0Bcx.js} +1 -1
  16. package/dist/{completion-_bc0OUQ-.js → completion-VSWvaaPO.js} +1 -1
  17. package/dist/{config-BwPBfN0t.js → config-BR23fL8m.js} +2 -2
  18. package/dist/{config-D5XrLWpk.js → config-kL36AxkE.js} +1 -1
  19. package/dist/{config-report-BmWIskD7.js → config-report-osnfUNg5.js} +2 -2
  20. package/dist/{config-shape-ykV0Vm2n.js → config-shape-tsxHx71E.js} +2 -1
  21. package/dist/{create-BamXmeob.d.ts → create-CDd9c22W.d.ts} +10 -1
  22. package/dist/{doctor-LPMYjSqO.js → doctor-B9FY9H0F.js} +2 -2
  23. package/dist/{doctor-ClRVAtXQ.js → doctor-DfTnMaUt.js} +142 -14
  24. package/dist/{fields-D0vUI6dq.js → fields-DI8s3cPl.js} +1 -1
  25. package/dist/{gen-BtfFWGbz.js → gen-DuAhghDw.js} +1 -1
  26. package/dist/{gen-BFfzZSLH.js → gen-DwgCSC6V.js} +1 -1
  27. package/dist/{import-CST57XLp.js → import-CNBF96hB.js} +2 -2
  28. package/dist/{import-ACkOrv6g.js → import-Iuk9mx8A.js} +1 -1
  29. package/dist/{index-vYjMrXyK.d.ts → index-Cay5-Kvx.d.ts} +3 -51
  30. package/dist/index.d.ts +2 -1
  31. package/dist/{init-BjuFDYT1.js → init-DeoSvkh2.js} +1 -1
  32. package/dist/{init-txYTuW9u.js → init-fNF_XmTa.js} +3 -3
  33. package/dist/{login-CgfCTO3F.js → login-CutVtcmQ.js} +1 -1
  34. package/dist/{login-CfImTJGb.js → login-DYazeWc9.js} +3 -3
  35. package/dist/{manifest-B2QPh19C.js → manifest-B4ENCp2I.js} +33 -33
  36. package/dist/{manifest-CzzWtnAb.d.ts → manifest-B5yF3CIq.d.ts} +19 -0
  37. package/dist/{manifest-wg8WkkpD.js → manifest-BXTbHNIV.js} +1 -1
  38. package/dist/{manifest-schema-2r37XRhD.js → manifest-schema-DQkBK2Mr.js} +28 -1
  39. package/dist/{migrate-B7oP_sQU.js → migrate-BJHxQqT5.js} +2 -2
  40. package/dist/{module-values-BJTBdo6y.js → module-values-B1EVTkHP.js} +1 -1
  41. package/dist/next/index.d.ts +16 -3
  42. package/dist/next/index.js +1 -1
  43. package/dist/next/plugin.d.ts +1 -1
  44. package/dist/next/plugin.js +1 -1
  45. package/dist/{openapi-BGeuunWC.js → openapi-C-ADypaY.js} +1 -1
  46. package/dist/{openapi-BIpw3Mb7.js → openapi-DFj0cirS.js} +2 -2
  47. package/dist/{output-DV5dwOTs.js → output-LsbLe41I.js} +1 -1
  48. package/dist/{ownership-DA5YdYTm.js → ownership-qqBuGJXr.js} +3 -3
  49. package/dist/{postgrest-5Dr3W64L.js → postgrest-DAxFltvO.js} +1 -1
  50. package/dist/{powersync-Bg8u-JcR.js → powersync-B_8uwz7f.js} +2 -2
  51. package/dist/powersync-CSzDCHRu.js +1 -0
  52. package/dist/{powersync-CJrT1DSc.js → powersync-DUT-UKgw.js} +188 -36
  53. package/dist/{pull-2nJr0qg_.js → pull-DQCgvJSC.js} +2 -2
  54. package/dist/pull-DYbyod1f.js +1 -0
  55. package/dist/{push-Bn-lMEmI.js → push-Dq_ca4-j.js} +1 -1
  56. package/dist/{resolve-names-ConCSj1y.js → resolve-names-Y1Cb22cp.js} +4 -4
  57. package/dist/{rls-Cx0dtsB7.js → rls-B57mIeVq.js} +22 -15
  58. package/dist/{rls-Ba9wN0SP.js → rls-j0YrFPpW.js} +1 -1
  59. package/dist/run-BATawNVH.js +1 -0
  60. package/dist/{run-PbRlXTfh.js → run-CLP_fQUF.js} +3 -3
  61. package/dist/{run-ticket-Dv7aF7Dk.js → run-ticket-DfnZCh-u.js} +19 -6
  62. package/dist/{run-ticket-B2o2Kxz8.d.ts → run-ticket-ylovhyFQ.d.ts} +16 -1
  63. package/dist/{scan-CRTj6fke.js → scan-B7xrAvRm.js} +1 -1
  64. package/dist/{schema-BTsE1WRT.js → schema-3PJ8wAeL.js} +1 -1
  65. package/dist/server/index.d.ts +2 -2
  66. package/dist/server/index.js +1 -1
  67. package/dist/{shared-Afctg7B0.js → shared-DrGLwM3s.js} +1 -1
  68. package/dist/{skills-C9uKfSF5.js → skills-BUI8DMqy.js} +1 -1
  69. package/dist/{skills-CQQcuGBi.js → skills-iwbRxavw.js} +1 -1
  70. package/dist/{sources-CMAM-2A3.js → sources-C4vkzZJV.js} +12 -7
  71. package/dist/{types-BMVDHvI0.d.ts → sources-oB1Hg1Fm.d.ts} +316 -2
  72. package/dist/supabase/index.d.ts +2 -3
  73. package/dist/supabase/index.js +4 -4
  74. package/dist/{supabase-DnMMg5Fn.js → supabase-B1EfuD47.js} +2 -2
  75. package/dist/{supabase-SBs3MYUE.js → supabase-BaizG0n7.js} +2 -2
  76. package/dist/{supabase-hook-CrgU06WH.js → supabase-hook-BT2P9wah.js} +110 -47
  77. package/dist/supabase-hook-CbvGAutK.js +1 -0
  78. package/dist/{supautils-ByezN3b8.js → supautils-DBKOoyjn.js} +8 -8
  79. package/dist/{tables-BqrxBCir.js → tables-DimBcVWY.js} +2 -2
  80. package/dist/testing/fixtures/index.d.ts +1 -1
  81. package/dist/testing/fixtures/index.js +26 -28
  82. package/dist/testing/index.d.ts +4 -3
  83. package/dist/testing/index.js +3 -2
  84. package/dist/{types-CzOeVvcC.d.ts → types-Cklw5hJo.d.ts} +23 -2
  85. package/dist/unplugin/index.d.ts +1 -1
  86. package/dist/unplugin/index.js +1 -1
  87. package/dist/{usage-CBzgwfIs.js → usage-B1ZJOUdr.js} +1 -1
  88. package/dist/{usage-B9EtHWLa.js → usage-t_nXnwCW.js} +2 -2
  89. package/dist/usage-weohzv2f.js +1 -0
  90. package/dist/{verify-DlUcTDBz.js → verify-jHrbmn-E.js} +6 -6
  91. package/dist/version-cache-Df11C2Qp.d.ts +51 -0
  92. package/dist/{watch-BFDKqmUa.js → watch-Bpci3hBY.js} +1 -1
  93. package/dist/watch-COuvly20.js +1 -0
  94. package/dist/workflow/index.d.ts +1 -1
  95. package/dist/workflow/index.js +22 -6
  96. package/dist/workflow-sdk/index.d.ts +1 -1
  97. package/package.json +2 -2
  98. package/schemas/run-v1.json +16 -0
  99. package/schemas/supabase-manifest-v1.json +28 -0
  100. package/skills/permdock-agents/references/operations-automations-chat.md +1 -0
  101. package/skills/permdock-wire/references/adapters.md +2 -2
  102. package/dist/powersync-B701tvhE.js +0 -1
  103. package/dist/pull-C3EEGzSw.js +0 -1
  104. package/dist/run-Ck22anC2.js +0 -1
  105. package/dist/sources-CWG32C0G.d.ts +0 -312
  106. package/dist/supabase-hook-C0FyEACZ.js +0 -1
  107. package/dist/usage-0hjZPIRX.js +0 -1
  108. package/dist/watch-ClLuO2TL.js +0 -1
@@ -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-ClLuO2TL.js")).watchCollect(ctx, overrides);
32
+ return (await import("./watch-COuvly20.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-B2QPh19C.js";
3
+ import { a as resolve } from "./manifest-B4ENCp2I.js";
4
4
  import { t as defineLeaf } from "./command-L8EstFNm.js";
5
5
  //#region src/cli/core/completion.ts
6
6
  const SHELLS = [
@@ -1,6 +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 { a as isSection, i as isModuleKey, n as MODULE_KEYS, o as kindOf, r as describeKinds, t as CONFIG_SHAPE } from "./config-shape-ykV0Vm2n.js";
3
+ 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
4
  import { existsSync } from "node:fs";
5
5
  import { relative, resolve } from "node:path";
6
6
  //#region src/cli/project/config-schema.ts
@@ -89,7 +89,7 @@ function hasModuleValue(raw) {
89
89
  return isRecord(raw) && Object.keys(MODULE_KEYS).some((key) => isRecord(raw[key]));
90
90
  }
91
91
  async function traceValues(cwd, file, display, config, options) {
92
- const { traceModuleValues } = await import("./module-values-BJTBdo6y.js");
92
+ const { traceModuleValues } = await import("./module-values-B1EVTkHP.js");
93
93
  return traceModuleValues({
94
94
  cwd,
95
95
  file,
@@ -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-BmWIskD7.js");
13
+ const { runConfig } = await import("./config-report-osnfUNg5.js");
14
14
  return runConfig({
15
15
  cwd: ctx.cwd,
16
16
  config: ctx.config,
@@ -2,8 +2,8 @@ import { a as rel, t as defaultSrcPath } from "./files-BSjrtIHw.js";
2
2
  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
- import "./sources-CMAM-2A3.js";
6
- import { t as DOCS_BASE } from "./manifest-B2QPh19C.js";
5
+ import "./sources-C4vkzZJV.js";
6
+ import { t as DOCS_BASE } from "./manifest-B4ENCp2I.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) {
@@ -81,7 +81,8 @@ const CONFIG_SHAPE = {
81
81
  out: STRING,
82
82
  resources: ARRAY,
83
83
  action: STRING,
84
- manifest: STRING
84
+ manifest: STRING,
85
+ tables: OBJECT
85
86
  },
86
87
  doctor: {
87
88
  sensitiveActions: ARRAY,
@@ -4,7 +4,7 @@ import { _ as PrincipalSource, a as PermDock, n as DecideOptions, o as PermDockO
4
4
  import { m as ApprovalStore } from "./types-DLvhVm1r.js";
5
5
  import { a as AutomationSource } from "./automation-C6Jg75xq.js";
6
6
  import { n as ApprovalWaiter } from "./waiter-CqUKX6CY.js";
7
- import { i as RunBinding, r as RunAutomation } from "./run-ticket-B2o2Kxz8.js";
7
+ import { c as RunResource, i as RunBinding, r as RunAutomation } from "./run-ticket-ylovhyFQ.js";
8
8
  //#region src/workflow/create.d.ts
9
9
  type WorkflowPermDockOptions = PermDockOptions & {
10
10
  /** Signs the run tickets `start` mints. */
@@ -47,6 +47,14 @@ type AutomationOptions = {
47
47
  /** The run id (`jti`); a fresh UUID when absent. */
48
48
  readonly id?: string;
49
49
  readonly binding?: RunBinding;
50
+ /**
51
+ * The record the run is bound to. The automation's permissions on
52
+ * `resource.type` then hold on that id only, through an
53
+ * `authorization_details` `identifier`; a check on another id, or with no
54
+ * row, denies. Its other permissions are unchanged. A type none of its
55
+ * permissions is on denies the start.
56
+ */
57
+ readonly resource?: RunResource;
50
58
  readonly now?: Instant;
51
59
  };
52
60
  type StartAutomationResult = {
@@ -55,6 +63,7 @@ type StartAutomationResult = {
55
63
  readonly run: {
56
64
  readonly id: string;
57
65
  readonly automation: RunAutomation;
66
+ readonly resource?: RunResource;
58
67
  };
59
68
  } | {
60
69
  readonly outcome: "denied";
@@ -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-ClRVAtXQ.js");
13
+ const { DOCTOR_CHECKS } = await import("./doctor-DfTnMaUt.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-ClRVAtXQ.js")).runDoctor({
30
+ return (await import("./doctor-DfTnMaUt.js")).runDoctor({
31
31
  cwd: ctx.cwd,
32
32
  config: ctx.config,
33
33
  only: flags.only,
@@ -1,8 +1,9 @@
1
+ import { r as isRecord } from "./compact-CAf557ZB.js";
1
2
  import { o as hasConditionOp } from "./refs-C8BKxc_e.js";
2
3
  import { c as listPermissions, h as formerKeys } from "./permission-registry-B8tYxPIt.js";
3
4
  import { u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
4
5
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
5
- import { f as scopeList, o as normalizeMemberships, s as resolveScope } from "./scopes-0Up_UA2t.js";
6
+ import { f as scopeList, l as rootScope, o as normalizeMemberships, s as resolveScope } from "./scopes-0Up_UA2t.js";
6
7
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
7
8
  import { u as separationConflicts } from "./policy-CLQ8__GF.js";
8
9
  import { T as validateCustomRole } from "./evaluate-BAmf_AQd.js";
@@ -18,30 +19,32 @@ import { r as runCollect } from "./collect-WCl8cJQV.js";
18
19
  import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
19
20
  import { a as scopeMembershipTable } from "./compile-EzEMB-7v.js";
20
21
  import { n as supabaseTenantClaim } from "./budget-BELja5A9.js";
21
- import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-CMAM-2A3.js";
22
+ import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-C4vkzZJV.js";
22
23
  import { t as parseCatalog } from "./parse-1_ZheTW5.js";
24
+ import { n as activeTenantMismatch } from "./active-tenant-DVee32-T.js";
23
25
  import "./markers-BeHZ4x9Q.js";
24
26
  import { t as didYouMean } from "./args-0FrVs5EH.js";
25
- import { t as DOCS_BASE } from "./manifest-B2QPh19C.js";
27
+ import { t as DOCS_BASE } from "./manifest-B4ENCp2I.js";
26
28
  import { t as createStyle } from "./style-Ds11Hmk4.js";
27
- import { a as nonEmptyOr, r as findingOf } from "./output-DV5dwOTs.js";
28
- import { i as runSkillsInstall } from "./skills-CQQcuGBi.js";
29
+ import { a as nonEmptyOr, r as findingOf } from "./output-LsbLe41I.js";
30
+ import { i as runSkillsInstall } from "./skills-iwbRxavw.js";
29
31
  import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
30
32
  import { l as partPath } from "./output-files-BIQ_9pIs.js";
31
- import { _ as supabaseConfig, a as supabaseHookManifest, c as pd039, g as readSupabaseConfig, h as pd074, m as pd045, n as hookOut, p as attrsPlan, u as resolveSchemas } from "./supabase-hook-CrgU06WH.js";
32
- import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-BqrxBCir.js";
33
- import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-DA5YdYTm.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-BT2P9wah.js";
34
+ import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-DimBcVWY.js";
35
+ import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-qqBuGJXr.js";
34
36
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
35
37
  import { i as group, n as membershipColumns, o as sqlStatements, r as tableKey } from "./deciding-columns-NB4wcyBf.js";
36
- import { t as resolveNames } from "./resolve-names-ConCSj1y.js";
37
- import { t as FIELD_VIEWS } from "./fields-D0vUI6dq.js";
38
- 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-B9EtHWLa.js";
39
- import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-DlUcTDBz.js";
40
- import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-CJrT1DSc.js";
41
- import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-ByezN3b8.js";
38
+ import { t as FIELD_VIEWS } from "./fields-DI8s3cPl.js";
39
+ 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-t_nXnwCW.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-jHrbmn-E.js";
42
+ import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-DUT-UKgw.js";
43
+ import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-DBKOoyjn.js";
42
44
  import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-B2xffQgY.js";
43
45
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
44
46
  import { basename, dirname, join, resolve } from "node:path";
47
+ import { pathToFileURL } from "node:url";
45
48
  import { createRequire } from "node:module";
46
49
  //#region src/cli/shared/doctor-files.ts
47
50
  const nodeFiles = Object.freeze({
@@ -212,6 +215,120 @@ async function pd064(input) {
212
215
  }));
213
216
  }
214
217
  //#endregion
218
+ //#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
+ function activeTenantOf(config) {
238
+ const blocks = config["blocks"];
239
+ const permissions = isRecord(blocks) ? blocks["permissions"] : void 0;
240
+ const value = isRecord(permissions) ? permissions["activeTenant"] : void 0;
241
+ if (value === "claim" || value === "resolver") return value;
242
+ if (isRecord(value) && typeof value["profileColumn"] === "string") {
243
+ const key = value["key"];
244
+ return {
245
+ profileColumn: value["profileColumn"],
246
+ ...typeof key === "string" ? { key } : {}
247
+ };
248
+ }
249
+ }
250
+ /**
251
+ * PermDock's token hook reads the active tenant from another place than
252
+ * better-supabase's `blocks.permissions.activeTenant` writes it, so
253
+ * `switch_organization` never changes the tenant claim.
254
+ */
255
+ async function pd078(input) {
256
+ const hook = input.config.supabase?.hook;
257
+ if (hook === void 0) return [];
258
+ const config = await betterSupabaseConfig(input);
259
+ const activeTenant = config === void 0 ? void 0 : activeTenantOf(config);
260
+ if (activeTenant === void 0) return [];
261
+ const policy = await policyOf(input);
262
+ const root = policy === void 0 ? void 0 : rootScope(scopeList(policy.scopes));
263
+ let from;
264
+ try {
265
+ from = activeSource(hook.activeFrom, root ?? "tenant");
266
+ } catch {
267
+ return [];
268
+ }
269
+ const mismatch = activeTenantMismatch(from, input.config.rls?.tenantClaim ?? "tenant_id", activeTenant);
270
+ return mismatch === void 0 ? [] : [{
271
+ code: "PD078",
272
+ severity: "warning",
273
+ message: mismatch,
274
+ fix: "set supabase.hook.activeFrom, then run permdock supabase hook generate"
275
+ }];
276
+ }
277
+ function isBlockPermissionKey(value) {
278
+ return isRecord(value) && typeof value["module"] === "string" && typeof value["action"] === "string" && typeof value["key"] === "string";
279
+ }
280
+ /**
281
+ * Every permission key the configured blocks check, from the project's own
282
+ * `better-supabase/sql`; `undefined` when it does not resolve or refuses the
283
+ * config.
284
+ */
285
+ async function blockPermissionKeys(cwd, blocks) {
286
+ try {
287
+ const file = createRequire(resolve(cwd, "package.json")).resolve("better-supabase/sql");
288
+ const list = (await import(pathToFileURL(file).href))["modulePermissionKeys"];
289
+ if (!isKeyLister(list)) return;
290
+ const keys = list(blocks, Object.keys(blocks));
291
+ return Array.isArray(keys) ? keys.filter(isBlockPermissionKey) : void 0;
292
+ } catch {
293
+ return;
294
+ }
295
+ }
296
+ function isKeyLister(value) {
297
+ return typeof value === "function";
298
+ }
299
+ /**
300
+ * A permission key a configured better-supabase block checks that the catalog
301
+ * does not list: no role holds it, so the block's SQL checks deny it.
302
+ */
303
+ async function pd079(input) {
304
+ const blocks = (await betterSupabaseConfig(input))?.["blocks"];
305
+ if (!isRecord(blocks)) return [];
306
+ const files = filesOf(input);
307
+ const path = catalogPath(input.config, input.cwd);
308
+ if (!files.exists(path)) return [];
309
+ let declared;
310
+ try {
311
+ declared = new Set(parseCatalog(files.read(path)).permissions.map(({ key }) => key));
312
+ } catch {
313
+ return [];
314
+ }
315
+ const keys = await blockPermissionKeys(input.cwd, blocks);
316
+ if (keys === void 0) return [];
317
+ const missing = /* @__PURE__ */ new Map();
318
+ for (const entry of keys) if (!declared.has(entry.key)) {
319
+ const uses = missing.get(entry.key) ?? [];
320
+ uses.push(`blocks.${entry.module}.permissions.${entry.action}`);
321
+ missing.set(entry.key, uses);
322
+ }
323
+ const catalog = rel(input.cwd, path);
324
+ return [...missing].map(([key, uses]) => ({
325
+ code: "PD079",
326
+ severity: "warning",
327
+ message: `${key} (${[...new Set(uses)].join(", ")}) is not in ${catalog}, so no role holds it and better-supabase's SQL check denies it`,
328
+ fix: `declare ${key} in the policy and run permdock collect, or map the block action to a key the catalog lists`
329
+ }));
330
+ }
331
+ //#endregion
215
332
  //#region src/cli/doctor/catalog.ts
216
333
  /**
217
334
  * A policy that declares `oauthScopes` against a catalog on disk without them,
@@ -2250,6 +2367,17 @@ const DOCTOR_CHECKS = [
2250
2367
  when: (config) => config.policy !== void 0,
2251
2368
  run: pd070
2252
2369
  },
2370
+ {
2371
+ code: "PD078",
2372
+ groups: ["supabase", "better-supabase"],
2373
+ when: (config) => config.supabase?.hook !== void 0,
2374
+ run: pd078
2375
+ },
2376
+ {
2377
+ code: "PD079",
2378
+ groups: ["catalog", "better-supabase"],
2379
+ run: pd079
2380
+ },
2253
2381
  {
2254
2382
  code: "PD005",
2255
2383
  groups: ["skills"],
@@ -1,7 +1,7 @@
1
1
  import { a as sole } from "./compact-CAf557ZB.js";
2
2
  import { i as configError } from "./errors-Vpu6rKHl.js";
3
3
  import { c as jsonSchemaOf } from "./catalog-doc-DjMKzJp9.js";
4
- import { A as quoteQualified, D as qualified, E as helperSchema, O as quoteIdent, _ as subjectClaimJsonSql, k as quoteLiteral, s as signedIn } from "./shared-Afctg7B0.js";
4
+ import { A as quoteQualified, D as qualified, E as helperSchema, O as quoteIdent, _ as subjectClaimJsonSql, k as quoteLiteral, s as signedIn } from "./shared-DrGLwM3s.js";
5
5
  //#region src/cli/sql/clauses.ts
6
6
  /**
7
7
  * True when `sql` is one parenthesised expression, so AND / OR need not wrap it
@@ -10,7 +10,7 @@ import { c as requirePolicy } from "./load-DjSU5KXO.js";
10
10
  import { t as loadConfiguredOperations } from "./catalog-operations-DeHTrJSV.js";
11
11
  import { n as fileSummary, r as planFiles } from "./files-B3AA05f1.js";
12
12
  import { f as writeOutputFiles, r as driftOf } from "./output-files-BIQ_9pIs.js";
13
- import { t as resolveNames } from "./resolve-names-ConCSj1y.js";
13
+ import { t as resolveNames } from "./resolve-names-Y1Cb22cp.js";
14
14
  import { i as schemaExpression } from "./generate-CezbCaTI.js";
15
15
  import { existsSync, readFileSync } from "node:fs";
16
16
  import { dirname, extname, relative, resolve } from "node:path";
@@ -41,7 +41,7 @@ const gen = defineLeaf({
41
41
  const out = given(flags.out);
42
42
  const outDir = given(flags["out-dir"]);
43
43
  const from = given(flags.policy);
44
- const { runGen } = await import("./gen-BtfFWGbz.js");
44
+ const { runGen } = await import("./gen-DuAhghDw.js");
45
45
  return runGen({
46
46
  cwd: ctx.cwd,
47
47
  config: ctx.config,
@@ -2,9 +2,9 @@ import { r as isRecord } from "./compact-CAf557ZB.js";
2
2
  import { i as configError, u as usageResult } from "./errors-Vpu6rKHl.js";
3
3
  import { s as writeFileEnsuringDir } from "./files-BSjrtIHw.js";
4
4
  import { r as escapeSqlIdent, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
5
- import { C as parseMembershipsFlag, r as HELPERS } from "./shared-Afctg7B0.js";
5
+ import { C as parseMembershipsFlag, r as HELPERS } from "./shared-DrGLwM3s.js";
6
6
  import { n as pgConnector } from "./pg-DQTqRrou.js";
7
- import { t as FIELD_VIEWS } from "./fields-D0vUI6dq.js";
7
+ import { t as FIELD_VIEWS } from "./fields-DI8s3cPl.js";
8
8
  import { n as emptySchema, r as isSchemaKind, t as emitPermissionsModule } from "./generate-CezbCaTI.js";
9
9
  import { existsSync, readFileSync } from "node:fs";
10
10
  import { resolve } from "node:path";
@@ -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-BTsE1WRT.js";
7
+ import { t as validateOpenapi } from "./schema-3PJ8wAeL.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
@@ -1,4 +1,4 @@
1
- import { Ar as SqlFunctionCondition, C as MembershipFixture, D as PolicyDelegation, G as CustomRoleSource, I as SeparationConflict, Kn as DenialReason, N as RoleBinding, P as RoleOptions, R as SupportAccessOptions, T as Policy, Tr as OpaqueCondition, Un as Decision, Ut as InstanceHandle, V as VocabularyFromInput, Wn as Denial, Wt as Instant, Y as EntitlementSource, Yt as LocalSnapshotManifest, Z as JwtClaims, Zt as Snapshot, _n as PolicyScopesInput, c as BreakGlassOptions, cn as DeliveryEvent, ct as SnapshotSource, fr as Membership, ft as TenantSettings, g as GrantCondition, h as Grant, hr as Subject, i as ApprovalOption, it as RelationGroup, j as PolicyVocabulary, k as PolicyOptions, kr as SqlFunctionArg, lr as Delegation, mt as TokenSigner, nn as AccessEvent, nt as MembershipSource, on as DecisionEvent, ot as RelationSource, pn as SinkEvent, pr as Principal, s as AssuranceRequirement, sr as CustomRole, st as SettingsSource, vn as Scope, xr as ConditionRef, yt as VersionQuery } from "./policy-types-DGIO_gxq.js";
1
+ import { Ar as SqlFunctionCondition, C as MembershipFixture, D as PolicyDelegation, G as CustomRoleSource, I as SeparationConflict, Kn as DenialReason, N as RoleBinding, P as RoleOptions, R as SupportAccessOptions, T as Policy, Tr as OpaqueCondition, Un as Decision, Ut as InstanceHandle, V as VocabularyFromInput, Wn as Denial, Wt as Instant, Y as EntitlementSource, Yt as LocalSnapshotManifest, Z as JwtClaims, Zt as Snapshot, _n as PolicyScopesInput, c as BreakGlassOptions, cn as DeliveryEvent, ct as SnapshotSource, fr as Membership, ft as TenantSettings, g as GrantCondition, h as Grant, hr as Subject, i as ApprovalOption, it as RelationGroup, j as PolicyVocabulary, k as PolicyOptions, kr as SqlFunctionArg, lr as Delegation, mt as TokenSigner, nn as AccessEvent, nt as MembershipSource, on as DecisionEvent, ot as RelationSource, pn as SinkEvent, pr as Principal, s as AssuranceRequirement, sr as CustomRole, st as SettingsSource, vn as Scope, xr as ConditionRef } from "./policy-types-DGIO_gxq.js";
2
2
  import { E as ResourceXTree, S as ResourceParent, T as ResourceRestricted, b as ResourceNode, d as PermissionKind, f as PermissionTree, g as ResourceInit, m as PermissionsOptions, n as ActionMeta, p as PermissionsOf, t as ActionList, u as Permission, w as ResourceRelationInput, x as ResourceOptions, y as ResourceMeta } from "./permission-types-CAY-GU7e.js";
3
3
  import { a as RoleTree, r as Role } from "./vocabulary-DEJ5j4mR.js";
4
4
  import { a as PermDock, o as PermDockOptions } from "./permdock-CprAPN3w.js";
@@ -7,6 +7,7 @@ import { m as ApprovalStore } from "./types-DLvhVm1r.js";
7
7
  import { t as InstanceOptions } from "./instance-options-CoHn-0e8.js";
8
8
  import { n as PermDockWrap } from "./wrap-DxXB54Wu.js";
9
9
  import { t as JsonSchemaNode } from "./json-schema-BfXgnRNT.js";
10
+ import { n as VersionCache } from "./version-cache-Df11C2Qp.js";
10
11
  import { i as CatalogEventData, s as CloudEvent } from "./sink-B5zoUW_O.js";
11
12
  import { StandardSchemaV1 } from "@standard-schema/spec";
12
13
  //#region src/conditions/refs.d.ts
@@ -191,55 +192,6 @@ declare function memoryCustomRoleSource(customRoles: readonly CustomRole[]): Cus
191
192
  */
192
193
  declare const APPROVAL_POLICY_UNAVAILABLE = "approval-policy-unavailable";
193
194
  //#endregion
194
- //#region src/core/version-cache.d.ts
195
- type VersionCacheStats = {
196
- /** Version reads the cache started. */
197
- readonly reads: number;
198
- /** Calls answered by a read already in flight. */
199
- readonly shared: number;
200
- /** Calls answered from an entry or a token claim, with no read. */
201
- readonly hits: number;
202
- readonly evictions: number;
203
- readonly size: number;
204
- };
205
- /**
206
- * Current authorization versions shared by every instance in a process:
207
- * `claimsFirst(source, { versions })` reads through it.
208
- */
209
- type VersionCache = {
210
- readonly name?: string;
211
- /** How old an entry may be when an instance with intent `read` uses it. */
212
- readonly maxStaleMs: number;
213
- /**
214
- * The current version of `principal`. With `live: false`, an entry at most
215
- * `maxStaleMs` old answers, a read in flight is shared, and a token claim
216
- * newer than the entry raises it; with `live: true`, `read` runs.
217
- */
218
- current: (principal: VersionQuery, read: () => number | undefined | Promise<number | undefined>, options: {
219
- readonly live: boolean;
220
- }) => number | undefined | Promise<number | undefined>;
221
- /** Drops `principal`'s entry, so the next instance reads the version. */
222
- evict: (principal: string) => void;
223
- stats: () => VersionCacheStats;
224
- };
225
- type MemoryVersionCacheOptions = {
226
- /**
227
- * How stale a read may be, in milliseconds: the entry lifetime and the
228
- * longest a removed member keeps read access. Clamped to 0 to 60,000.
229
- */
230
- readonly maxStaleMs: number;
231
- /** Principals kept; the least recently used goes first. Default 10,000. */
232
- readonly maxEntries?: number;
233
- /** The clock, read only when an instance asks for a version. */
234
- readonly now?: () => Instant;
235
- };
236
- /**
237
- * An in-process `VersionCache`: a bounded LRU keyed by principal id that keeps
238
- * resolved versions and shares reads in flight. Create it once at module
239
- * scope.
240
- */
241
- declare function memoryVersionCache(options: MemoryVersionCacheOptions): VersionCache;
242
- //#endregion
243
195
  //#region src/core/memberships.d.ts
244
196
  /**
245
197
  * One `MembershipSource` over several: memberships are merged and
@@ -1198,4 +1150,4 @@ declare function coveredByDelegation(permission: DelegatedPermission, delegation
1198
1150
  */
1199
1151
  declare function delegatedPermissions(delegations: readonly PolicyDelegation[] | undefined, subject: Subject, heldRoles: ReadonlySet<string>, now: number): ReadonlySet<string> | undefined;
1200
1152
  //#endregion
1201
- export { resource as $, opaque as $t, RoleChangeCheckInput as A, HoldingVia as At, ActivateInput as B, countHolders as Bt, parseCatalogEventData as C, validateCustomRole as Cn, SnapshotClaims as Ct, parseSinkEvents as D, SignPolicyDocumentOptions as Dt, parseSinkEvent as E, principal as En, snapshotFromClaims as Et, checkRoleChange as F, memoryRelationSource as Ft, allow as G, memoryVersionCache as Gt, breakGlass as H, MemoryVersionCacheOptions as Ht, decideRoleChange as I, StripeEntitlementsClient as It, role as J, memoryEntitlementSource as Jt, deny as K, APPROVAL_POLICY_UNAVAILABLE as Kt, normalizeMembership as L, stripeEntitlementSource as Lt, RoleChangeOptions as M, whoCan as Mt, RoleChangeTarget as N, MemoryEdge as Nt, RoleChange as O, signPolicyDocument as Ot, RoleRules as P, MemoryRelationSourceData as Pt, formerKeys as Q, sqlFunction as Qt, normalizeMemberships as R, claimsFirst as Rt, SINK_EVENT_SCHEMAS as S, resolveCustomRole as Sn, SignSnapshotOptions as St, parseCloudEventBatch as T, context as Tn, snapshotClaims as Tt, supportAccess as U, VersionCache as Ut, activate as V, isExternallyManaged as Vt, normalizeApproval as W, VersionCacheStats as Wt, readable as X, memorySettingsSource as Xt, crud as Y, memoryMembershipSource as Yt, writable as Z, memorySnapshotSource as Zt, DECISION_EVENT_SCHEMA as _, CustomRoleValidation as _n, ArazzoSimulateInput as _t, catalogFingerprint as a, RoleNameOf as an, customRoleSource as at, EVENT_SCHEMA_IDS as b, customRoleClaim as bn, simulateArazzo as bt, OCSF_VERSION as c, separationConflicts as cn, ShadowMismatch as ct, accessToOcsf as d, fromSnapshot as dn, defineApp as dt, findPermission as en, definePermissions as et, toOcsf as f, parseSnapshot as fn, AppOptions as ft, CREDENTIAL_EVENT_SCHEMA as g, CustomRoleRename as gn, ArazzoPlan as gt, CATALOG_EVENT_SCHEMA as h, CustomRoleEntry as hn, ArazzoFinding as ht, canonicalJson as i, mergePermissions as in, CustomRoleSourceOptions as it, RoleChangeDecision as j, WhoCan as jt, RoleChangeCheck as k, Holder as kt, OcsfAuthorizeSession as l, requiresApproval as ln, ShadowOptions as lt, AUTOMATION_EVENT_SCHEMA as m, CustomRoleDropReason as mn, localSnapshotManifest as mt, delegatedPermissions as n, isPermission as nn, snapshotFor as nt, CSV_COLUMNS as o, definePolicy as on, mayAccess as ot, ACCESS_EVENT_SCHEMA as p, CustomRoleDrop as pn, AppProfile as pt, normalizeAssurance as q, memoryCustomRoleSource as qt, sha256Digest as r, listPermissions as rn, CustomRoleReader as rt, toCsvRow as s, isRoleName as sn, LegacyCheck as st, coveredByDelegation as t, getResource as tn, SnapshotForOptions as tt, OcsfUserManagement as u, emptySnapshot as un, shadowMode as ut, DELIVERY_EVENT_SCHEMA as v, ResolvedCustomRole as vn, ArazzoStepResult as vt, parseCloudEvent as w, claim as wn, signSnapshot as wt, MEMBERSHIP_EVENT_SCHEMA as x, parseCustomRoleEntry as xn, deliveryEvent as xt, DIRECTORY_EVENT_SCHEMA as y, ValidateCustomRoleOptions as yn, arazzoFindings as yt, resolveScope as z, composeMemberships as zt };
1153
+ export { resource as $, listPermissions as $t, RoleChangeCheckInput as A, HoldingVia as At, ActivateInput as B, countHolders as Bt, parseCatalogEventData as C, SnapshotClaims as Ct, parseSinkEvents as D, SignPolicyDocumentOptions as Dt, parseSinkEvent as E, snapshotFromClaims as Et, checkRoleChange as F, memoryRelationSource as Ft, allow as G, memoryMembershipSource as Gt, breakGlass as H, APPROVAL_POLICY_UNAVAILABLE as Ht, decideRoleChange as I, StripeEntitlementsClient as It, role as J, sqlFunction as Jt, deny as K, memorySettingsSource as Kt, normalizeMembership as L, stripeEntitlementSource as Lt, RoleChangeOptions as M, whoCan as Mt, RoleChangeTarget as N, MemoryEdge as Nt, RoleChange as O, signPolicyDocument as Ot, RoleRules as P, MemoryRelationSourceData as Pt, formerKeys as Q, isPermission as Qt, normalizeMemberships as R, claimsFirst as Rt, SINK_EVENT_SCHEMAS as S, principal as Sn, SignSnapshotOptions as St, parseCloudEventBatch as T, snapshotClaims as Tt, supportAccess as U, memoryCustomRoleSource as Ut, activate as V, isExternallyManaged as Vt, normalizeApproval as W, memoryEntitlementSource as Wt, readable as X, findPermission as Xt, crud as Y, opaque as Yt, writable as Z, getResource as Zt, DECISION_EVENT_SCHEMA as _, parseCustomRoleEntry as _n, ArazzoSimulateInput as _t, catalogFingerprint as a, requiresApproval as an, customRoleSource as at, EVENT_SCHEMA_IDS as b, claim as bn, simulateArazzo as bt, OCSF_VERSION as c, parseSnapshot as cn, ShadowMismatch as ct, accessToOcsf as d, CustomRoleEntry as dn, defineApp as dt, mergePermissions as en, definePermissions as et, toOcsf as f, CustomRoleRename as fn, AppOptions as ft, CREDENTIAL_EVENT_SCHEMA as g, customRoleClaim as gn, ArazzoPlan as gt, CATALOG_EVENT_SCHEMA as h, ValidateCustomRoleOptions as hn, ArazzoFinding as ht, canonicalJson as i, separationConflicts as in, CustomRoleSourceOptions as it, RoleChangeDecision as j, WhoCan as jt, RoleChangeCheck as k, Holder as kt, OcsfAuthorizeSession as l, CustomRoleDrop as ln, ShadowOptions as lt, AUTOMATION_EVENT_SCHEMA as m, ResolvedCustomRole as mn, localSnapshotManifest as mt, delegatedPermissions as n, definePolicy as nn, snapshotFor as nt, CSV_COLUMNS as o, emptySnapshot as on, mayAccess as ot, ACCESS_EVENT_SCHEMA as p, CustomRoleValidation as pn, AppProfile as pt, normalizeAssurance as q, memorySnapshotSource as qt, sha256Digest as r, isRoleName as rn, CustomRoleReader as rt, toCsvRow as s, fromSnapshot as sn, LegacyCheck as st, coveredByDelegation as t, RoleNameOf as tn, SnapshotForOptions as tt, OcsfUserManagement as u, CustomRoleDropReason as un, shadowMode as ut, DELIVERY_EVENT_SCHEMA as v, resolveCustomRole as vn, ArazzoStepResult as vt, parseCloudEvent as w, signSnapshot as wt, MEMBERSHIP_EVENT_SCHEMA as x, context as xn, deliveryEvent as xt, DIRECTORY_EVENT_SCHEMA as y, validateCustomRole as yn, arazzoFindings as yt, resolveScope as z, composeMemberships as zt };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $ as LimitRemaining, $n as Quota, $t as SnapshotGrant, A as PolicyScopes, An as Grantee, Ar as SqlFunctionCondition, At as CredentialDecision, B as ValidateMode, Bn as relation, Bt as decideCredential, C as MembershipFixture, Cn as ApproverInput, Cr as MemberOfCondition, Ct as SupportSessionDecision, D as PolicyDelegation, Dn as anyOf, Dr as RelatedHop, Dt as parseSupportSession, E as PolicyAppDataSchemas, En as allOf, Er as RelatedCondition, Et as decideSupportSession, F as RoleScope, Fn as anyone, Fr as isSqlFunctionField, Ft as CredentialPolicyViolation, G as CustomRoleSource, Gn as DenialDetails, Gt as LocalCustomRoleTable, H as WireValidity, Hn as ApprovalRequiredDecision, Ht as parseCredential, I as SeparationConflict, In as assurance, It as CredentialRequest, J as DecisionSink, Jn as ExplainedDecision, Jt as LocalRowValue, K as CustomRoleSourceFactory, Kn as DenialReason, Kt as LocalMembershipRows, L as SubjectOf, Ln as authenticated, Lt as DecideCredentialOptions, M as PrincipalOf, Mn as InheritGrantee, Mr as isCondition, Mt as CredentialPermission, N as RoleBinding, Nn as RelationGrantee, Nr as isConditionDate, Nt as CredentialPermissionInput, O as PolicyOAuthScope, On as holder, Or as RestrictedAncestors, Ot as ApiKeyPrincipal, P as RoleOptions, Pn as actor, Pr as isConditionRef, Pt as CredentialPolicy, Q as LimitConsumeInput, Qn as Obligation, Qt as SnapshotAssignable, R as SupportAccessOptions, Rn as inherit, Rt as credentialDelegation, S as HostedGrantRef, Sn as Approver, Sr as ConditionValue, St as SupportSession, T as Policy, Tn as UserApprover, Tt as SupportSessionRequest, U as CredentialVerifier, Un as Decision, Vn as AppObligation, Vt as isFeedId, W as CustomRoleContext, Wn as Denial, X as Intent, Xn as LimitDetail, Xt as LocalSnapshotRows, Y as EntitlementSource, Yn as GrantedDecision, Yt as LocalSnapshotManifest, Zn as MatchedGrant, Zt as Snapshot, _ as GrantLimit, _n as PolicyScopesInput, _r as ActorKind, _t as VerifiedToken, a as ApprovalRequirement, an as CredentialEvent, ar as AuthorizationDetail, at as RelationHolder, b as GrantScope, bn as ScopeNames, br as Condition, bt as WhereCompiler, c as BreakGlassOptions, cn as DeliveryEvent, cr as CustomRoleGrant, ct as SnapshotSource, d as ClosureContext, dn as EmailCategory, dt as SubjectResolver, en as SnapshotNotEntitled, er as Trace, et as LimitStore, f as ClosureGrantFn, fn as MembershipEvent, fr as Membership, ft as TenantSettings, g as GrantCondition, gr as VerifiedClaims, gt as VerificationFailure, h as Grant, hn as WireDenial, hr as Subject, ht as TokenVerifier, i as ApprovalOption, in as AutomationEvent, ir as Assurance, it as RelationGroup, jn as GranteeInput, jr as hasConditionOp, jt as CredentialKind, kn as user, kr as SqlFunctionArg, kt as Credential, l as BreakGlassRequirements, ln as DeliveryFailureCause, lr as Delegation, lt as SourceContext, m as DelegationTarget, mn as WireDecision, mr as SharedCustomRole, mt as TokenSigner, n as ApprovalEscalation, nn as AccessEvent, nr as TraceSkipReason, nt as MembershipSource, o as ApprovalStage, on as DecisionEvent, or as Binding, ot as RelationSource, p as DelegationInput, pn as SinkEvent, pr as Principal, pt as TokenFailureCause, q as DecisionProvider, qn as DeniedDecision, qt as LocalRowColumn, r as ApprovalMode, rn as AuthEvent, rr as Actor, rt as RelationChain, s as AssuranceRequirement, sn as DeliveryChannel, sr as CustomRole, st as SettingsSource, t as ActivationOption, tn as SnapshotScope, tr as TraceSkip, tt as MemberEntry, u as BreakGlassSpec, un as DirectoryEvent, ur as GnapAccess, ut as SourceMemo, v as GrantMeta, vn as Scope, vr as AdapterId, vt as VersionContext, w as ObligationInput, wn as PermissionApprover, wr as MemberOfParent, wt as SupportSessionPolicy, x as GrantValidity, xn as AnyOfApprover, xr as ConditionRef, xt as DecideSupportSessionOptions, y as GrantOptions, yn as ScopeDeclaration, yr as MembershipVia, yt as VersionQuery, z as SupportConsent, zn as plan, zt as credentialPolicyViolation } from "./policy-types-DGIO_gxq.js";
2
2
  import { A as RESOURCE_NAME, C as ResourceRelation, D as RowOf, E as ResourceXTree, M as AppData, N as AppDataSchema, O as PERMISSION_ROW, P as MetaValue, S as ResourceParent, T as ResourceRestricted, _ as ResourceLevel, a as EdgeGroups, b as ResourceNode, c as FieldRelation, d as PermissionKind, f as PermissionTree, g as ResourceInit, h as PrincipalRelation, i as EdgeGroup, j as RESOURCE_X, k as POLICY_SCOPES, m as PermissionsOptions, n as ActionMeta, o as EdgeMatch, p as PermissionsOf, r as ComputedRelation, s as EdgeRelation, u as Permission, v as ResourceLink, w as ResourceRelationInput, x as ResourceOptions, y as ResourceMeta } from "./permission-types-CAY-GU7e.js";
3
3
  import { a as RoleTree, c as definePlans, d as isPlan, f as isRole, i as RoleMeta, l as defineRoles, m as listRoles, n as PlanTree, o as Vocabulary, p as listPlans, r as Role, s as VocabularyOptions, t as Plan, u as findRole } from "./vocabulary-DEJ5j4mR.js";
4
- import { $ as resource, $t as opaque, A as RoleChangeCheckInput, At as HoldingVia, B as ActivateInput, Bt as countHolders, C as parseCatalogEventData, Cn as validateCustomRole, Ct as SnapshotClaims, D as parseSinkEvents, Dt as SignPolicyDocumentOptions, E as parseSinkEvent, En as principal, Et as snapshotFromClaims, F as checkRoleChange, Ft as memoryRelationSource, G as allow, Gt as memoryVersionCache, H as breakGlass, Ht as MemoryVersionCacheOptions, I as decideRoleChange, It as StripeEntitlementsClient, J as role, Jt as memoryEntitlementSource, K as deny, Kt as APPROVAL_POLICY_UNAVAILABLE, L as normalizeMembership, Lt as stripeEntitlementSource, M as RoleChangeOptions, Mt as whoCan, N as RoleChangeTarget, Nt as MemoryEdge, O as RoleChange, Ot as signPolicyDocument, P as RoleRules, Pt as MemoryRelationSourceData, Q as formerKeys, Qt as sqlFunction, R as normalizeMemberships, Rt as claimsFirst, S as SINK_EVENT_SCHEMAS, Sn as resolveCustomRole, St as SignSnapshotOptions, T as parseCloudEventBatch, Tn as context, Tt as snapshotClaims, U as supportAccess, Ut as VersionCache, V as activate, Vt as isExternallyManaged, W as normalizeApproval, Wt as VersionCacheStats, X as readable, Xt as memorySettingsSource, Y as crud, Yt as memoryMembershipSource, Z as writable, Zt as memorySnapshotSource, _ as DECISION_EVENT_SCHEMA, _n as CustomRoleValidation, _t as ArazzoSimulateInput, a as catalogFingerprint, an as RoleNameOf, at as customRoleSource, b as EVENT_SCHEMA_IDS, bn as customRoleClaim, bt as simulateArazzo, c as OCSF_VERSION, cn as separationConflicts, ct as ShadowMismatch, d as accessToOcsf, dn as fromSnapshot, dt as defineApp, en as findPermission, et as definePermissions, f as toOcsf, fn as parseSnapshot, ft as AppOptions, g as CREDENTIAL_EVENT_SCHEMA, gn as CustomRoleRename, gt as ArazzoPlan, h as CATALOG_EVENT_SCHEMA, hn as CustomRoleEntry, ht as ArazzoFinding, i as canonicalJson, in as mergePermissions, it as CustomRoleSourceOptions, j as RoleChangeDecision, jt as WhoCan, k as RoleChangeCheck, kt as Holder, l as OcsfAuthorizeSession, ln as requiresApproval, lt as ShadowOptions, m as AUTOMATION_EVENT_SCHEMA, mn as CustomRoleDropReason, mt as localSnapshotManifest, n as delegatedPermissions, nn as isPermission, nt as snapshotFor, o as CSV_COLUMNS, on as definePolicy, ot as mayAccess, p as ACCESS_EVENT_SCHEMA, pn as CustomRoleDrop, pt as AppProfile, q as normalizeAssurance, qt as memoryCustomRoleSource, r as sha256Digest, rn as listPermissions, rt as CustomRoleReader, s as toCsvRow, sn as isRoleName, st as LegacyCheck, t as coveredByDelegation, tn as getResource, tt as SnapshotForOptions, u as OcsfUserManagement, un as emptySnapshot, ut as shadowMode, v as DELIVERY_EVENT_SCHEMA, vn as ResolvedCustomRole, vt as ArazzoStepResult, w as parseCloudEvent, wn as claim, wt as signSnapshot, x as MEMBERSHIP_EVENT_SCHEMA, xn as parseCustomRoleEntry, xt as deliveryEvent, y as DIRECTORY_EVENT_SCHEMA, yn as ValidateCustomRoleOptions, yt as arazzoFindings, z as resolveScope, zt as composeMemberships } from "./index-vYjMrXyK.js";
4
+ import { $ as resource, $t as listPermissions, A as RoleChangeCheckInput, At as HoldingVia, B as ActivateInput, Bt as countHolders, C as parseCatalogEventData, Ct as SnapshotClaims, D as parseSinkEvents, Dt as SignPolicyDocumentOptions, E as parseSinkEvent, Et as snapshotFromClaims, F as checkRoleChange, Ft as memoryRelationSource, G as allow, Gt as memoryMembershipSource, H as breakGlass, Ht as APPROVAL_POLICY_UNAVAILABLE, I as decideRoleChange, It as StripeEntitlementsClient, J as role, Jt as sqlFunction, K as deny, Kt as memorySettingsSource, L as normalizeMembership, Lt as stripeEntitlementSource, M as RoleChangeOptions, Mt as whoCan, N as RoleChangeTarget, Nt as MemoryEdge, O as RoleChange, Ot as signPolicyDocument, P as RoleRules, Pt as MemoryRelationSourceData, Q as formerKeys, Qt as isPermission, R as normalizeMemberships, Rt as claimsFirst, S as SINK_EVENT_SCHEMAS, Sn as principal, St as SignSnapshotOptions, T as parseCloudEventBatch, Tt as snapshotClaims, U as supportAccess, Ut as memoryCustomRoleSource, V as activate, Vt as isExternallyManaged, W as normalizeApproval, Wt as memoryEntitlementSource, X as readable, Xt as findPermission, Y as crud, Yt as opaque, Z as writable, Zt as getResource, _ as DECISION_EVENT_SCHEMA, _n as parseCustomRoleEntry, _t as ArazzoSimulateInput, a as catalogFingerprint, an as requiresApproval, at as customRoleSource, b as EVENT_SCHEMA_IDS, bn as claim, bt as simulateArazzo, c as OCSF_VERSION, cn as parseSnapshot, ct as ShadowMismatch, d as accessToOcsf, dn as CustomRoleEntry, dt as defineApp, en as mergePermissions, et as definePermissions, f as toOcsf, fn as CustomRoleRename, ft as AppOptions, g as CREDENTIAL_EVENT_SCHEMA, gn as customRoleClaim, gt as ArazzoPlan, h as CATALOG_EVENT_SCHEMA, hn as ValidateCustomRoleOptions, ht as ArazzoFinding, i as canonicalJson, in as separationConflicts, it as CustomRoleSourceOptions, j as RoleChangeDecision, jt as WhoCan, k as RoleChangeCheck, kt as Holder, l as OcsfAuthorizeSession, ln as CustomRoleDrop, lt as ShadowOptions, m as AUTOMATION_EVENT_SCHEMA, mn as ResolvedCustomRole, mt as localSnapshotManifest, n as delegatedPermissions, nn as definePolicy, nt as snapshotFor, o as CSV_COLUMNS, on as emptySnapshot, ot as mayAccess, p as ACCESS_EVENT_SCHEMA, pn as CustomRoleValidation, pt as AppProfile, q as normalizeAssurance, qt as memorySnapshotSource, r as sha256Digest, rn as isRoleName, rt as CustomRoleReader, s as toCsvRow, sn as fromSnapshot, st as LegacyCheck, t as coveredByDelegation, tn as RoleNameOf, tt as SnapshotForOptions, u as OcsfUserManagement, un as CustomRoleDropReason, ut as shadowMode, v as DELIVERY_EVENT_SCHEMA, vn as resolveCustomRole, vt as ArazzoStepResult, w as parseCloudEvent, wt as signSnapshot, x as MEMBERSHIP_EVENT_SCHEMA, xn as context, xt as deliveryEvent, y as DIRECTORY_EVENT_SCHEMA, yn as validateCustomRole, yt as arazzoFindings, z as resolveScope, zt as composeMemberships } from "./index-Cay5-Kvx.js";
5
5
  import { a as OperationInput, c as defineOperations, d as isOperationRisk, i as OperationEffect, l as OPERATION_RISKS, n as OperationData, o as OperationMap, r as OperationDefinition, s as OperationMeta, t as Operation, u as OperationRisk } from "./operations-Ci_rT6Uo.js";
6
6
  import { A as memoryApprovalPolicySource, C as PermissionCheck, D as ApprovalPolicySource, E as ApprovalPolicyProblem, O as ApprovalPolicyValidation, S as memoryLimitStore, T as ApprovalPolicy, _ as PrincipalSource, a as PermDock, b as Limits, c as RowPair, d as UncheckedData, f as WhereResult, g as PrincipalIdentityLink, h as PrincipalIdentity, i as LoadedRows, j as validateApprovalPolicy, k as approvalPolicies, l as SimulateOptions, m as getPermDockSync, n as DecideOptions, o as PermDockOptions, p as getPermDock, r as DeriveOptions, s as RowData, t as DecideIdsOptions, u as SnapshotOptions, v as memoryPrincipalSource, w as ApprovalPolicies, x as limits, y as PermittedIdsOptions } from "./permdock-CprAPN3w.js";
7
7
  import { d as memoryPolicySource, f as mergeHostedGrants, i as HostedGrantDropped, l as hostedPolicies, m as policyDocumentFromClaims, o as PolicyDocument, p as parsePolicyDocument, r as HostedGrantDropReason, s as PolicySource, t as HostedGrant, u as isPortableCondition } from "./hosted-DVxlLZMe.js";
@@ -13,6 +13,7 @@ import { n as PermDockWrap, r as wrapPermDock, t as PermDockOverrides } from "./
13
13
  import { t as JsonSchemaNode } from "./json-schema-BfXgnRNT.js";
14
14
  import { i as memoryRevocationFeed, n as RevocationFeed, r as RevocationListener, t as RevocationEvent } from "./revocations-BaUXHM1N.js";
15
15
  import { t as ClientNames } from "./clients-C_NOET3z.js";
16
+ import { i as memoryVersionCache, n as VersionCache, r as VersionCacheStats, t as MemoryVersionCacheOptions } from "./version-cache-Df11C2Qp.js";
16
17
  import { a as CapabilityOptions, c as LinkPolicy, d as linkPolicyViolation, f as parseCapability, i as CapabilityInput, l as LinkPolicyViolation, m as signCapability, n as CapabilityClaim, o as CapabilityPrincipal, p as parseCapabilityClaim, r as CapabilityConfirmation, s as CapabilityRedeemer, t as Capability, u as capabilityFromClaims } from "./capability-Di9tiUvi.js";
17
18
  import { a as AutomationSource, c as decideAutomation, i as AutomationRequest, l as memoryAutomationSource, n as AutomationDecision, o as DecideAutomationOptions, r as AutomationMode, s as MemoryAutomationSource, t as Automation, u as parseAutomation } from "./automation-C6Jg75xq.js";
18
19
  import { S as toCloudEvent, _ as credentialEvent, a as CatalogFinding, b as signDecisionBatch, c as CloudEventOptions, d as MemoryDecisionSinkOptions, f as RESERVED_CLOUD_EVENT_TYPES, g as cloudEventType, h as automationEvent, i as CatalogEventData, l as CloudEventType, m as accessEvent, n as CLOUDEVENTS_CONTENT_TYPE, o as CatalogFindingCode, p as SignDecisionBatchOptions, r as CLOUD_EVENT_TYPES, s as CloudEvent, t as CLOUDEVENTS_BATCH_CONTENT_TYPE, u as MemoryDecisionSink, v as membershipEvent, x as supportSessionEvent, y as memoryDecisionSink } from "./sink-B5zoUW_O.js";
@@ -1,6 +1,6 @@
1
1
  import { n as CliError } from "./errors-Vpu6rKHl.js";
2
2
  import { a as decodePreset, g as resolvePreset, i as presetFlags, n as generatePreset, o as encodePreset } from "./preset-BjLzeFpp.js";
3
- import { a as nonEmptyOr } from "./output-DV5dwOTs.js";
3
+ import { a as nonEmptyOr } from "./output-LsbLe41I.js";
4
4
  import { t as addLine } from "./peer-Q0fuZ6hx.js";
5
5
  import { t as applyFiles } from "./files-B3AA05f1.js";
6
6
  import { existsSync } from "node:fs";
@@ -48,7 +48,7 @@ const init = defineLeaf({
48
48
  ...forceFlag
49
49
  },
50
50
  async run(ctx, { flags }) {
51
- const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-BjuFDYT1.js"), import("./peer-C9LvBCcb.js")]);
51
+ const [{ runInit }, { packageManagerOf }] = await Promise.all([import("./init-DeoSvkh2.js"), import("./peer-C9LvBCcb.js")]);
52
52
  const agent = await packageManagerOf(ctx.cwd);
53
53
  const selection = {
54
54
  archetype: flags.archetype,
@@ -79,7 +79,7 @@ const presetDecode = defineLeaf({
79
79
  positionals: presetCode,
80
80
  flags: {},
81
81
  async run(_ctx, { args }) {
82
- const { runPreset } = await import("./init-BjuFDYT1.js");
82
+ const { runPreset } = await import("./init-DeoSvkh2.js");
83
83
  return runPreset("decode", args["code"] ?? "");
84
84
  }
85
85
  });
@@ -87,7 +87,7 @@ const presetUrl = defineLeaf({
87
87
  positionals: presetCode,
88
88
  flags: {},
89
89
  async run(_ctx, { args }) {
90
- const { runPreset } = await import("./init-BjuFDYT1.js");
90
+ const { runPreset } = await import("./init-DeoSvkh2.js");
91
91
  return runPreset("url", args["code"] ?? "");
92
92
  }
93
93
  });
@@ -3,7 +3,7 @@ import { n as CliError } from "./errors-Vpu6rKHl.js";
3
3
  import { i as postForm, r as parseToken, s as runDeviceFlow } from "./device-BwbJNmb2.js";
4
4
  import { i as writeCredentials, n as deleteCredentials, r as readCredentials, t as credentialsPath } from "./storage-C2bWdvJH.js";
5
5
  import { n as randomToken, t as pkce } from "./pkce-CnmmYqUZ.js";
6
- import { a as nonEmptyOr } from "./output-DV5dwOTs.js";
6
+ import { a as nonEmptyOr } from "./output-LsbLe41I.js";
7
7
  import { n as httpRequest } from "./http-DOL33cO0.js";
8
8
  import { c as READ_SCOPES, d as issuerMetadata, i as credentialsInsideRepository, l as cloudUrl, n as cliRuntime, r as credentialStorage, s as CLI_CLIENT_ID, t as CREDENTIAL_SERVICE } from "./auth--yPyZNgr.js";
9
9
  import { spawn } from "node:child_process";
@@ -27,7 +27,7 @@ const login = defineLeaf({
27
27
  }
28
28
  },
29
29
  async run(ctx, { flags }) {
30
- const { runLogin } = await import("./login-CgfCTO3F.js");
30
+ const { runLogin } = await import("./login-CutVtcmQ.js");
31
31
  return runLogin({
32
32
  cwd: ctx.cwd,
33
33
  url: given(flags.url),
@@ -43,7 +43,7 @@ const login = defineLeaf({
43
43
  const logout = defineLeaf({
44
44
  flags: { ...urlFlag },
45
45
  async run(ctx, { flags }) {
46
- const { runLogout } = await import("./login-CgfCTO3F.js");
46
+ const { runLogout } = await import("./login-CutVtcmQ.js");
47
47
  return runLogout({
48
48
  url: given(flags.url),
49
49
  json: ctx.json,
@@ -55,7 +55,7 @@ const logout = defineLeaf({
55
55
  const whoami = defineLeaf({
56
56
  flags: { ...urlFlag },
57
57
  async run(ctx, { flags }) {
58
- const { runWhoami } = await import("./login-CgfCTO3F.js");
58
+ const { runWhoami } = await import("./login-CutVtcmQ.js");
59
59
  return runWhoami({
60
60
  url: given(flags.url),
61
61
  json: ctx.json,