better-supabase 0.63.2 → 0.64.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 (113) hide show
  1. package/dist/{adapter-base-DXF0tNJJ.js → adapter-base-BWp_GpBq.js} +1 -1
  2. package/dist/{api-DhCLHpIU.js → api-TwaJ4nS8.js} +1 -1
  3. package/dist/astro/index.js +3 -3
  4. package/dist/{build-Vd4JkaqJ.js → build-CF_wE706.js} +1 -1
  5. package/dist/cli/{add-B8H-eHVK.js → add-CAEF20DB.js} +9 -9
  6. package/dist/cli/{add-DzsB2EMd.js → add-DAbzG8-C.js} +2 -2
  7. package/dist/cli/add-bP1hqEPB.js +1 -0
  8. package/dist/cli/{app-table-files-BNbkk4mU.js → app-table-files-BNnw-4C9.js} +3 -3
  9. package/dist/cli/{app-tables-B9xoTgSg.js → app-tables-D2TRhx62.js} +2 -2
  10. package/dist/cli/{backfill-DxGGF0tw.js → backfill-DgqbUamk.js} +1 -1
  11. package/dist/cli/bin.js +1 -1
  12. package/dist/cli/{blocks-zWXWOGcv.js → blocks-CWVG1w3P.js} +1 -1
  13. package/dist/cli/{blocks-xgk0tdfI.js → blocks-DykCgrRb.js} +1 -1
  14. package/dist/cli/{cache-DGTzqvsc.js → cache-JroD4zCO.js} +1 -1
  15. package/dist/cli/{codemod-C63P8ybN.js → codemod-CAz5XmH0.js} +4 -4
  16. package/dist/cli/{codemod-naming-wb0ni9VH.js → codemod-naming-DtzMgEs7.js} +1 -1
  17. package/dist/cli/{column-renames-Cw-VJmbc.js → column-renames-DcEFMXX4.js} +2 -2
  18. package/dist/cli/{content-mapper-DXjq7Wfl.js → content-mapper-DQczPByw.js} +1 -1
  19. package/dist/cli/{dev-r1oRNl1e.js → dev-Bwy7jmxv.js} +3 -3
  20. package/dist/cli/{doctor-BHIIEqOU.js → doctor-BjwgIEEk.js} +17 -17
  21. package/dist/cli/{emit-C6S__22g.js → emit-D1NL_ewe.js} +2 -2
  22. package/dist/cli/{gen-DWNQMbqr.js → gen-5GahcSRz.js} +3 -3
  23. package/dist/cli/{gen-tasks-D0_qerE6.js → gen-tasks-BNqtXDSZ.js} +9 -9
  24. package/dist/cli/index.d.ts +1 -1
  25. package/dist/cli/index.js +7 -7
  26. package/dist/cli/{init-DiYhhVtO.js → init-DwJ-fzKE.js} +8 -8
  27. package/dist/cli/{live-C7AMtQsQ.js → live-hA0NkWeP.js} +2 -2
  28. package/dist/cli/{mcp-DaymIFzT.js → mcp-BpU-r3at.js} +2 -2
  29. package/dist/cli/{memo-backend-DaO-IuUk.js → memo-backend-jPoQR64l.js} +1 -1
  30. package/dist/cli/{metadata-CsSZ8mZc.js → metadata-DsItgHac.js} +4 -4
  31. package/dist/cli/{migrate-Ceai0fte.js → migrate-bs8m1S4X.js} +1 -1
  32. package/dist/cli/{migration-safety-BXKmX5ar.js → migration-safety-CYnC7qr0.js} +1 -1
  33. package/dist/cli/{module-migration-ueN8AWpK.js → module-migration-DI1bC407.js} +1 -1
  34. package/dist/cli/{partition-DMv3-JOr.js → partition-B_o9eCEl.js} +1 -1
  35. package/dist/cli/powersync-BeiG2uAK.js +1 -0
  36. package/dist/cli/{powersync-QpdoYTM1.js → powersync-CYzLue5S.js} +3 -3
  37. package/dist/cli/{print-CQe9SQD_.js → print-CX3mfrR4.js} +2 -2
  38. package/dist/cli/{providers-DocDgHot.js → providers-C_0X8CZ5.js} +1 -1
  39. package/dist/cli/{prune-workflows-w_4KdMR9.js → prune-workflows-BRymSktV.js} +1 -1
  40. package/dist/cli/{remove-DvnCBCVe.js → remove-Ddd7JMeU.js} +6 -6
  41. package/dist/cli/{render-X1jNuye8.js → render-D0JOrrdH.js} +4 -4
  42. package/dist/cli/{render-cache-Be5Sm_Eu.js → render-cache-B6_cW4jQ.js} +1 -1
  43. package/dist/cli/{run-BoLLvybx.js → run-CRbd_qI2.js} +30 -30
  44. package/dist/cli/{run-72NxM1zM.js → run-CivaFfvS.js} +101 -21
  45. package/dist/cli/{shared-BR48oJN4.js → shared-77CYy2Ff.js} +1 -1
  46. package/dist/cli/{source-aefKuXMY.js → source-H6tArdAg.js} +1 -1
  47. package/dist/cli/{spec-Dvz-C4MP.js → spec-Bn4ArkKk.js} +2 -2
  48. package/dist/cli/{spec-CxtMMgXM.js → spec-CKr1A_Oo.js} +1 -1
  49. package/dist/cli/{sql-layout-B2fda2KP.js → sql-layout--Tblsahr.js} +2 -2
  50. package/dist/cli/{squash-D7KwCZHj.js → squash-BdHHGvSy.js} +1 -1
  51. package/dist/cli/{sync-DvD3jbb4.js → sync-koAHC0Xq.js} +4 -4
  52. package/dist/cli/{upgrade-hDU5DI6_.js → upgrade-B6MOyby0.js} +5 -5
  53. package/dist/cli/{upgrade-C6Pw49Jc.js → upgrade-D9dPPfIy.js} +5 -5
  54. package/dist/cli/{version-CiDgdPUD.js → version-3_JBFBjw.js} +1 -1
  55. package/dist/client/index.js +1 -1
  56. package/dist/client/native/index.js +2 -2
  57. package/dist/{composite-C13UCNgm.js → composite-RorL_F8I.js} +1 -1
  58. package/dist/config/index.js +4 -4
  59. package/dist/{config-1kAVpZc_.js → config-BuZW7wNr.js} +3 -3
  60. package/dist/{config-L5_4kg24.js → config-ocvgjLWV.js} +1 -1
  61. package/dist/create/index.js +3 -3
  62. package/dist/create/lite/index.js +4 -4
  63. package/dist/{define-runtime-BbNPkt-5.js → define-runtime-DQC2Gjdr.js} +4 -0
  64. package/dist/{define-runtime-full-gpz09qAj.js → define-runtime-full-BIrEQWJR.js} +1 -1
  65. package/dist/edge/index.js +4 -4
  66. package/dist/{executor-DABWqMfV.js → executor-D7avvqx3.js} +1 -1
  67. package/dist/expo/index.js +3 -3
  68. package/dist/{former-permission-keys-FPrqQHXf.js → former-permission-keys-DVwR65bj.js} +1 -1
  69. package/dist/{framework-BQgHM3zD.js → framework-DxCx0pmS.js} +1 -1
  70. package/dist/generators/factories/index.js +1 -1
  71. package/dist/generators/json-schema/index.js +1 -1
  72. package/dist/generators/nuqs/index.js +1 -1
  73. package/dist/generators/standard-schema/index.js +1 -1
  74. package/dist/generators/valibot/index.js +1 -1
  75. package/dist/generators/zod/index.js +1 -1
  76. package/dist/hono/index.js +3 -3
  77. package/dist/{index-B2NJNoRd.d.ts → index-CwvF-r09.d.ts} +8 -0
  78. package/dist/{instances-PZAWgQEX.js → instances-B9oCgEOH.js} +76 -0
  79. package/dist/{json-schema-BwfI_jJ2.js → json-schema-BuzopJOK.js} +1 -1
  80. package/dist/mapper/bin.js +5 -5
  81. package/dist/mcp/index.js +1 -1
  82. package/dist/mcp/sdk/index.js +1 -1
  83. package/dist/{mcp-Cif2SnK4.js → mcp-BCP-kBjf.js} +3 -3
  84. package/dist/next/index.js +2 -2
  85. package/dist/orpc/index.js +2 -2
  86. package/dist/otel/index.js +5 -5
  87. package/dist/{ports-ClJbgoyt.js → ports-BfHdHz1e.js} +1 -1
  88. package/dist/powersync/index.js +1 -1
  89. package/dist/preset/index.js +3 -3
  90. package/dist/{preset-BcwGsW_B.js → preset-DrfMF0Hv.js} +2 -2
  91. package/dist/{project-DYyr_iyu.js → project-BdZTXDVG.js} +5 -5
  92. package/dist/react/index.d.ts +1 -1
  93. package/dist/react/index.js +1 -1
  94. package/dist/react/server.d.ts +1 -1
  95. package/dist/react/server.js +1 -1
  96. package/dist/{react-hb2gg5UV.js → react-BkLf1aNc.js} +14 -1
  97. package/dist/react-router/index.js +3 -3
  98. package/dist/server/index.js +4 -4
  99. package/dist/{server-B0T944J9.js → server-DpcMKAt_.js} +1 -1
  100. package/dist/solid-start/index.js +3 -3
  101. package/dist/spec/index.js +2 -2
  102. package/dist/sql/index.js +2 -2
  103. package/dist/{sql-DPpcMNUF.js → sql-B3e0Ji-Q.js} +79 -3
  104. package/dist/sqlite/index.js +1 -1
  105. package/dist/sveltekit/index.js +3 -3
  106. package/dist/tanstack-start/index.js +3 -3
  107. package/dist/testing/index.js +3 -3
  108. package/dist/{version-B9H4YoiS.js → version-Adj2H6dY.js} +1 -1
  109. package/dist/webmcp/index.js +1 -1
  110. package/package.json +1 -1
  111. package/skills/better-supabase/references/ui-recipes.md +1174 -532
  112. package/dist/cli/add-BpikP7u5.js +0 -1
  113. package/dist/cli/powersync-CEhwfawV.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { c as runsWithInvalidConfig, d as DOCS_ORIGIN, f as GROUPS, g as runCommand, h as parseArgs$2, i as joinRepeated, l as COMMANDS, o as listArgs, p as RESERVED_NAMES, s as readsLegacyTables, t as GLOBAL_ARGS } from "./command-fqvJ0TdG.js";
2
2
  import { s as setCacheEnabled } from "./store-DP-nmqBt.js";
3
3
  import { n as highlight, r as painter } from "./style-B5-nByxb.js";
4
- import { t as VERSION } from "./version-CiDgdPUD.js";
4
+ import { t as VERSION } from "./version-3_JBFBjw.js";
5
5
  import { a as missingInputNext, o as resolveAgent, t as checkConsent } from "./agent-BlYLJPzM.js";
6
6
  import { a as isActionRequired, l as toCliError, n as CliError, o as isReport, s as isRetryable } from "./errors-B7i-VGxk.js";
7
7
  import { r as splitCommandLine } from "./shell-omi9-T2X.js";
@@ -21,48 +21,48 @@ const LOADERS = [
21
21
  ["login", () => import("./account-BzhVD6jJ.js").then((m) => m.loginCommand)],
22
22
  ["logout", () => import("./account-BzhVD6jJ.js").then((m) => m.logoutCommand)],
23
23
  ["whoami", () => import("./account-BzhVD6jJ.js").then((m) => m.whoamiCommand)],
24
- ["init", () => import("./init-DiYhhVtO.js").then((m) => m.initCommand)],
25
- ["add", () => import("./add-BpikP7u5.js").then((m) => m.addCommand)],
26
- ["remove", () => import("./remove-DvnCBCVe.js").then((m) => m.removeCommand)],
27
- ["upgrade", () => import("./upgrade-C6Pw49Jc.js").then((m) => m.upgradeCommand)],
24
+ ["init", () => import("./init-DwJ-fzKE.js").then((m) => m.initCommand)],
25
+ ["add", () => import("./add-bP1hqEPB.js").then((m) => m.addCommand)],
26
+ ["remove", () => import("./remove-Ddd7JMeU.js").then((m) => m.removeCommand)],
27
+ ["upgrade", () => import("./upgrade-D9dPPfIy.js").then((m) => m.upgradeCommand)],
28
28
  ["table", () => import("./table-CcO-m_7t.js").then((m) => m.tableCommand)],
29
- ["migrate schema-first", () => import("./migrate-Ceai0fte.js").then((m) => m.migrateSchemaFirstCommand)],
30
- ["gen", () => import("./gen-DWNQMbqr.js").then((m) => m.genCommand)],
31
- ["doctor", () => import("./doctor-BHIIEqOU.js").then((m) => m.doctorCommand)],
29
+ ["migrate schema-first", () => import("./migrate-bs8m1S4X.js").then((m) => m.migrateSchemaFirstCommand)],
30
+ ["gen", () => import("./gen-5GahcSRz.js").then((m) => m.genCommand)],
31
+ ["doctor", () => import("./doctor-BjwgIEEk.js").then((m) => m.doctorCommand)],
32
32
  ["codes", () => import("./codes-D_oa7Aw5.js").then((m) => m.codesCommand)],
33
33
  ["db query", () => import("./db-C4up7wFU.js").then((m) => m.dbQueryCommand)],
34
34
  ["db diff", () => import("./db-C4up7wFU.js").then((m) => m.dbDiffCommand)],
35
35
  ["db seed", () => import("./seed-B3MrC1Qe.js").then((m) => m.seedCommand)],
36
- ["db backfill", () => import("./backfill-DxGGF0tw.js").then((m) => m.dbBackfillCommand)],
36
+ ["db backfill", () => import("./backfill-DgqbUamk.js").then((m) => m.dbBackfillCommand)],
37
37
  ["db verify", () => import("./verify-CR7f21Ri.js").then((m) => m.dbVerifyCommand)],
38
- ["db partition", () => import("./partition-DMv3-JOr.js").then((m) => m.dbPartitionCommand)],
39
- ["db squash", () => import("./squash-D7KwCZHj.js").then((m) => m.dbSquashCommand)],
40
- ["workflows prune", () => import("./prune-workflows-w_4KdMR9.js").then((m) => m.workflowsPruneCommand)],
41
- ["dev", () => import("./dev-r1oRNl1e.js").then((m) => m.devCommand)],
38
+ ["db partition", () => import("./partition-B_o9eCEl.js").then((m) => m.dbPartitionCommand)],
39
+ ["db squash", () => import("./squash-BdHHGvSy.js").then((m) => m.dbSquashCommand)],
40
+ ["workflows prune", () => import("./prune-workflows-BRymSktV.js").then((m) => m.workflowsPruneCommand)],
41
+ ["dev", () => import("./dev-Bwy7jmxv.js").then((m) => m.devCommand)],
42
42
  ["dev env", () => import("./env-bItpF97w.js").then((m) => m.envCommand)],
43
43
  ["dev run", () => import("./run-DbR0NaN_.js").then((m) => m.runCommand)],
44
44
  ["dev keys", () => import("./keys-f9iMQepr.js").then((m) => m.keysCommand)],
45
45
  ["dev stack ls", () => import("./stack-BUrc8jsg.js").then((m) => m.stackLsCommand)],
46
46
  ["dev stack prune", () => import("./stack-BUrc8jsg.js").then((m) => m.stackPruneCommand)],
47
47
  ["automations list", () => import("./automations-C1yZj3mn.js").then((m) => m.automationsListCommand)],
48
- ["blocks list", () => import("./blocks-xgk0tdfI.js").then((m) => m.blocksListCommand)],
49
- ["blocks view", () => import("./blocks-xgk0tdfI.js").then((m) => m.blocksViewCommand)],
50
- ["blocks search", () => import("./blocks-xgk0tdfI.js").then((m) => m.blocksSearchCommand)],
51
- ["powersync streams", () => import("./powersync-CEhwfawV.js").then((m) => m.powersyncStreamsCommand)],
52
- ["spec emit", () => import("./spec-CxtMMgXM.js").then((m) => m.specEmitCommand)],
53
- ["spec validate", () => import("./spec-CxtMMgXM.js").then((m) => m.specValidateCommand)],
54
- ["mcp", () => import("./mcp-DaymIFzT.js").then((m) => m.mcpCommand)],
48
+ ["blocks list", () => import("./blocks-DykCgrRb.js").then((m) => m.blocksListCommand)],
49
+ ["blocks view", () => import("./blocks-DykCgrRb.js").then((m) => m.blocksViewCommand)],
50
+ ["blocks search", () => import("./blocks-DykCgrRb.js").then((m) => m.blocksSearchCommand)],
51
+ ["powersync streams", () => import("./powersync-BeiG2uAK.js").then((m) => m.powersyncStreamsCommand)],
52
+ ["spec emit", () => import("./spec-CKr1A_Oo.js").then((m) => m.specEmitCommand)],
53
+ ["spec validate", () => import("./spec-CKr1A_Oo.js").then((m) => m.specValidateCommand)],
54
+ ["mcp", () => import("./mcp-BpU-r3at.js").then((m) => m.mcpCommand)],
55
55
  ["skills list", () => import("./skills-C4vNmuxw.js").then((m) => m.skillsListCommand)],
56
56
  ["skills install", () => import("./skills-C4vNmuxw.js").then((m) => m.skillsInstallCommand)],
57
- ["codemod naming", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("naming"))],
58
- ["codemod extra-columns", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("extra-columns"))],
59
- ["codemod owned-columns", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("owned-columns"))],
60
- ["codemod config", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("config"))],
61
- ["codemod table-modules", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("table-modules"))],
62
- ["codemod account-calls", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("account-calls"))],
63
- ["codemod server-imports", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("server-imports"))],
64
- ["codemod generators", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("generators"))],
65
- ["codemod read-many", () => import("./codemod-C63P8ybN.js").then((m) => m.codemodCommand("read-many"))],
57
+ ["codemod naming", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("naming"))],
58
+ ["codemod extra-columns", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("extra-columns"))],
59
+ ["codemod owned-columns", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("owned-columns"))],
60
+ ["codemod config", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("config"))],
61
+ ["codemod table-modules", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("table-modules"))],
62
+ ["codemod account-calls", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("account-calls"))],
63
+ ["codemod server-imports", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("server-imports"))],
64
+ ["codemod generators", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("generators"))],
65
+ ["codemod read-many", () => import("./codemod-CAz5XmH0.js").then((m) => m.codemodCommand("read-many"))],
66
66
  ["completion", () => import("./completion-Ct0kXYpV.js").then((m) => m.completionCommand)],
67
67
  ["cache purge", () => import("./cache-DwdJCb29.js").then((m) => m.cachePurgeCommand)],
68
68
  ["config", () => import("./config-J8LaJ0Nl.js").then((m) => m.configCommand)]
@@ -747,7 +747,7 @@ function cliFromTree(init, extra = {}) {
747
747
  digest: globals["effects-digest"]
748
748
  });
749
749
  };
750
- await import("./memo-backend-DaO-IuUk.js").then(({ installMemo }) => installMemo(config.root));
750
+ await import("./memo-backend-jPoQR64l.js").then(({ installMemo }) => installMemo(config.root));
751
751
  context = {
752
752
  cwd,
753
753
  config,
@@ -1,17 +1,17 @@
1
1
  import { t as CACHE_DIR } from "./store-DP-nmqBt.js";
2
2
  import { a as entitlementsMode, c as unsafeKey, i as entitlementRequirements, n as accessRequirements, o as moduleKeyProblems, s as providerLabel } from "./authorization-CNWhpdKb.js";
3
- import { B as typegenVersionNotice, H as installedVersion, L as stabilizeMetadata, N as oxfmtInstalled, V as declaredPeers, W as satisfies, d as loadSnapshot, i as migrationsDir, z as typegenVersion } from "./sql-layout-B2fda2KP.js";
4
- import { s as schemaStampPath } from "./content-mapper-DXjq7Wfl.js";
3
+ import { B as typegenVersionNotice, H as installedVersion, L as stabilizeMetadata, N as oxfmtInstalled, V as declaredPeers, W as satisfies, d as loadSnapshot, i as migrationsDir, z as typegenVersion } from "./sql-layout--Tblsahr.js";
4
+ import { s as schemaStampPath } from "./content-mapper-DQczPByw.js";
5
5
  import { a as changedFiles, d as fileDiff, i as changeLines, r as applyPlan, s as hasConflicts } from "./files-NnXnawki.js";
6
6
  import { a as sameText, t as display } from "./io-CngfGyMA.js";
7
- import { n as adoptionContext, r as appTablesOf, t as accessModule } from "./app-tables-B9xoTgSg.js";
7
+ import { n as adoptionContext, r as appTablesOf, t as accessModule } from "./app-tables-D2TRhx62.js";
8
8
  import { r as errorText } from "./errors-B7i-VGxk.js";
9
- import { c as qualified, l as tableObject, r as exposed, s as policyObject, t as catalogOf } from "./shared-BR48oJN4.js";
10
- import { a as storeTypesModule, o as typesModuleKey, s as writeAtomic } from "./cache-DGTzqvsc.js";
9
+ import { c as qualified, l as tableObject, r as exposed, s as policyObject, t as catalogOf } from "./shared-77CYy2Ff.js";
10
+ import { a as storeTypesModule, o as typesModuleKey, s as writeAtomic } from "./cache-JroD4zCO.js";
11
11
  import { t as compiledReadSets } from "./read-sets-77o7SxpK.js";
12
- import { c as sameModuleMigration, l as writeLatestMigration, n as READ_SETS_SUFFIX, r as latestMigration, u as writesMigrations } from "./module-migration-ueN8AWpK.js";
12
+ import { c as sameModuleMigration, l as writeLatestMigration, n as READ_SETS_SUFFIX, r as latestMigration, u as writesMigrations } from "./module-migration-DI1bC407.js";
13
13
  import { t as byCodePoint } from "./compare-yl4sSwVn.js";
14
- import { n as render } from "./render-X1jNuye8.js";
14
+ import { n as render } from "./render-D0JOrrdH.js";
15
15
  import { existsSync } from "node:fs";
16
16
  import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
17
17
  import { readFile } from "node:fs/promises";
@@ -377,29 +377,108 @@ function onlyWrapped(name, expressions) {
377
377
  }
378
378
  return calls > 0 && calls === wraps;
379
379
  }
380
+ const templateName = (template) => {
381
+ const name = template?.slice(0, template.indexOf("(")).trim();
382
+ return name ? [escape(name).replaceAll(escape("{scope}"), "\\w+")] : [];
383
+ };
384
+ const NO_PINS = {
385
+ sets: [],
386
+ platform: []
387
+ };
388
+ function tenantPins(context) {
389
+ const functions = context.config.authorization?.functions;
390
+ return {
391
+ sets: [...templateName(functions?.idsWith), ...templateName(functions?.memberIds)],
392
+ platform: templateName(functions?.isPlatform)
393
+ };
394
+ }
395
+ function unwrap(expression) {
396
+ let text = expression.trim();
397
+ while (text.startsWith("(") && closing(text, 0) === text.length - 1) text = text.slice(1, -1).trim();
398
+ return text;
399
+ }
400
+ function closing(text, open) {
401
+ let depth = 0;
402
+ let quoted = false;
403
+ for (let at = open; at < text.length; at += 1) {
404
+ const char = text.charAt(at);
405
+ if (char === "'") quoted = !quoted;
406
+ else if (!quoted) {
407
+ depth += char === "(" ? 1 : char === ")" ? -1 : 0;
408
+ if (depth === 0) return at;
409
+ }
410
+ }
411
+ return -1;
412
+ }
413
+ function operands(expression, op) {
414
+ const parts = [];
415
+ const word = new RegExp(`^\\s+${op}\\s+`, "i");
416
+ let depth = 0;
417
+ let quoted = false;
418
+ let from = 0;
419
+ for (let at = 0; at < expression.length; at += 1) {
420
+ const char = expression.charAt(at);
421
+ if (char === "'") quoted = !quoted;
422
+ else if (!quoted) {
423
+ depth += char === "(" ? 1 : char === ")" ? -1 : 0;
424
+ const match = depth === 0 ? word.exec(expression.slice(at)) : null;
425
+ if (match) {
426
+ parts.push(expression.slice(from, at));
427
+ from = at + match[0].length;
428
+ at = from - 1;
429
+ }
430
+ }
431
+ }
432
+ parts.push(expression.slice(from));
433
+ return parts.map((part) => part.trim()).filter((part) => part !== "");
434
+ }
435
+ function holds(expression, atom, orNull) {
436
+ const text = unwrap(expression);
437
+ const branches = operands(text, "or");
438
+ if (branches.length > 1) return branches.every((branch) => holds(branch, atom, orNull));
439
+ const parts = operands(text, "and");
440
+ if (parts.length > 1) return parts.some((part) => holds(part, atom, orNull)) || orNull !== void 0 && parts.some((part) => orNull.column.test(unwrap(part))) && parts.some((part) => orNull.platform.test(part));
441
+ return !/\bor\b/i.test(text) && atom.test(text);
442
+ }
380
443
  /**
381
444
  * Whether every permissive policy that lets `role` run `command` holds `column`
382
- * to a tenant the caller acts in, with no `or` around it: equal to
383
- * `current_tenant_id()`, passed to `can('tenant', column, ...)`, or in `(select
384
- * tenant_ids_with(...))` or `(select member_<tenant>_ids())`. A write can't
385
- * name a tenant the caller isn't in then. The guest branch `ctx.scope.guest`
386
- * adds (`or (column, ...) in (select g.tenant ... portal_subjects(...) g)`)
387
- * pins it to a tenant the caller is a guest of, so it doesn't count as an
388
- * `or`.
445
+ * to a tenant the caller acts in: equal to `current_tenant_id()`, passed to
446
+ * `can('tenant', column, ...)`, or in `(select tenant_ids_with(...))`, `(select
447
+ * member_<tenant>_ids())` or the provider's `idsWith` and `memberIds` helpers.
448
+ * A write can't name a tenant the caller isn't in then. An `or` holds when each
449
+ * branch does, and a branch that writes a null tenant under a platform check
450
+ * (`is_platform(...)` or the provider's `isPlatform`) holds too: only a
451
+ * platform role writes those rows. The guest branch `ctx.scope.guest` adds (`or
452
+ * (column, ...) in (select g.tenant ... portal_subjects(...) g)`) pins it to a
453
+ * tenant the caller is a guest of.
389
454
  */
390
- function pinnedToTenant(table, column, command, role) {
455
+ function pinnedToTenant(table, column, command, role, pins = NO_PINS) {
391
456
  if (!table.rls) return false;
392
457
  const col = `"?${escape(column)}"?`;
458
+ const sets = ["better_supabase\\.(?:tenant_ids_with|member_\\w+_ids)", ...pins.sets];
393
459
  const pin = new RegExp([
394
460
  `(?<![\\w."])${col}\\s*=\\s*\\(?\\s*(?:select\\s+)?better_supabase\\.current_tenant_id\\(\\)`,
395
461
  `better_supabase\\.can\\(\\s*'tenant'(?:::text)?\\s*,\\s*${col}\\s*,`,
396
- `(?<![\\w."])${col}\\s+in\\s+\\(\\s*select\\s+better_supabase\\.(?:tenant_ids_with|member_\\w+_ids)\\(`
462
+ `(?<![\\w."])${col}\\s+in\\s+\\(\\s*select\\s+(?:${sets.join("|")})\\(`
397
463
  ].join("|"), "i");
464
+ const orNull = {
465
+ column: new RegExp(`^(?:\\w+\\.)?${col}\\s+is\\s+null$`, "i"),
466
+ platform: new RegExp(`(?:${["better_supabase\\.is_platform", ...pins.platform].join("|")})\\(`, "i")
467
+ };
398
468
  const guest = new RegExp(`\\bor\\s+\\(*\\(?${col}\\)?(?:::text)?\\s*,(?:[^()]|\\([^()]*\\))*\\)\\s+in\\s+\\(\\s*select\\s+g\\.tenant\\b[^()]*from\\s+better_supabase\\.portal_(?:subjects|parties)\\([^()]*\\)\\s+g(?:\\([^()]*\\))?\\)`, "gi");
399
469
  const applying = table.policies.filter((policy) => policy.permissive && (policy.command === "all" || policy.command === command) && appliesTo(policy, role));
400
470
  return applying.length > 0 && applying.every((policy) => {
401
471
  const check = (policy.check ?? policy.using)?.replaceAll(guest, "");
402
- return check !== void 0 && !/\bor\b/i.test(check) && pin.test(check);
472
+ return check !== void 0 && holds(check, pin, orNull);
473
+ });
474
+ }
475
+ function pinnedToCaller(table, column, command, role) {
476
+ if (!table.rls || command !== "insert") return false;
477
+ const atom = new RegExp(`(?<![\\w."])"?${escape(column)}"?\\s*=\\s*\\(\\s*select\\s+auth\\.uid\\(\\)`, "i");
478
+ const applying = table.policies.filter((policy) => policy.permissive && (policy.command === "all" || policy.command === command) && appliesTo(policy, role));
479
+ return applying.length > 0 && applying.every((policy) => {
480
+ const check = policy.check ?? policy.using;
481
+ return check !== null && holds(check, atom);
403
482
  });
404
483
  }
405
484
  /**
@@ -408,11 +487,11 @@ function pinnedToTenant(table, column, command, role) {
408
487
  * stops a write from taking over another row), and so is a column every policy
409
488
  * pins to the request's tenant, unless the provider lists it in `deciding`.
410
489
  */
411
- function writableColumns(table, columns, command, role, deciding = /* @__PURE__ */ new Set()) {
490
+ function writableColumns(table, columns, command, role, deciding = /* @__PURE__ */ new Set(), pins) {
412
491
  if (!policyAllows(table, command, role)) return [];
413
492
  const privilege = command.toUpperCase();
414
493
  const tableLevel = table.grants.some((grant) => grantsTo(grant, role) && grant.privileges.includes(privilege));
415
- const risky = columns.filter((column) => deciding.has(column) || !(table.primaryKey.length === 1 && table.primaryKey[0] === column) && !pinnedToTenant(table, column, command, role));
494
+ const risky = columns.filter((column) => deciding.has(column) || !(table.primaryKey.length === 1 && table.primaryKey[0] === column) && !pinnedToTenant(table, column, command, role, pins) && !pinnedToCaller(table, column, command, role));
416
495
  if (tableLevel) return risky;
417
496
  return risky.filter((column) => (table.columnGrants ?? []).some((grant) => grantsTo(grant, role) && grant.column === column && grant.privileges.includes(privilege)));
418
497
  }
@@ -531,9 +610,10 @@ const RLS_RULES = [
531
610
  code: "BS213",
532
611
  severity: "warning",
533
612
  title: "API roles can write the columns that grant access",
534
- description: "RLS helpers decide access from columns such as `memberships.user_id`, `memberships.role` or `contacts.customer_id`, and an authorization provider lists them as `decidingColumns`. When `anon` or `authenticated` may insert or update one of them, and a policy lets them write the row, a user can grant themselves access. A table-level grant counts even after a column-level revoke. A single-column primary key, a tenant column every write policy pins to a tenant the caller acts in (`current_tenant_id()`, `can('tenant', column, ...)`, `tenant_ids_with(...)` or the membership helper `member_organization_ids()`, alone or next to a guest's grant from `portal_subjects()`), a subject's `deletedAt` column in `config.recordTypes` and a block's soft-delete column (they only hide rows) don't count unless the provider lists them.",
613
+ description: "RLS helpers decide access from columns such as `memberships.user_id`, `memberships.role` or `contacts.customer_id`, and an authorization provider lists them as `decidingColumns`. When `anon` or `authenticated` may insert or update one of them, and a policy lets them write the row, a user can grant themselves access. A table-level grant counts even after a column-level revoke. A single-column primary key, a tenant column every write policy pins to a tenant the caller acts in (`current_tenant_id()`, `can('tenant', column, ...)`, `tenant_ids_with(...)`, the membership helper `member_organization_ids()` or the provider's `idsWith` and `memberIds` helpers, alone, next to a guest's grant from `portal_subjects()`, or next to a branch that writes a null tenant under a platform check), a column every insert policy pins to the caller (`column = (select auth.uid())`, on insert only), a subject's `deletedAt` column in `config.recordTypes` and a block's soft-delete column (they only hide rows) don't count unless the provider lists them.",
535
614
  check: (context) => {
536
615
  const tables = new Map(catalogOf(context).tables.map((table) => [qualified(table), table]));
616
+ const pins = tenantPins(context);
537
617
  return [...grantColumns(context)].flatMap(([name, byColumn]) => {
538
618
  const table = tables.get(name);
539
619
  if (!table) return [];
@@ -545,7 +625,7 @@ const RLS_RULES = [
545
625
  const tableLevel = [];
546
626
  const revoked = /* @__PURE__ */ new Set();
547
627
  for (const command of WRITES) {
548
- const writable = writableColumns(table, columns, command, role, deciding);
628
+ const writable = writableColumns(table, columns, command, role, deciding, pins);
549
629
  if (writable.length === 0) continue;
550
630
  writes.push(`${role} may ${command} ${writable.join(", ")}`);
551
631
  const privilege = command.toUpperCase();
@@ -1,4 +1,4 @@
1
- import { a as toCatalog } from "./source-aefKuXMY.js";
1
+ import { a as toCatalog } from "./source-H6tArdAg.js";
2
2
  import { h as tomlGet, p as sqlWorkflow, r as detectWorkflow } from "./supabase-toml-B6-eEV5p.js";
3
3
  // src/cli/doctor/shared.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-CiDgdPUD.js";
1
+ import { t as VERSION } from "./version-3_JBFBjw.js";
2
2
  import { n as CliError } from "./errors-B7i-VGxk.js";
3
3
  import { r as redactUrl } from "./redact--zOGdWzo.js";
4
4
  import { n as HTTP_CHANNEL } from "./trace-D3TNqWBg.js";
@@ -4,8 +4,8 @@ import { t as CACHE_DIR } from "./store-DP-nmqBt.js";
4
4
  import { i as failedResult, n as CliError, r as errorText } from "./errors-B7i-VGxk.js";
5
5
  import { a as changedFiles, i as changeLines, r as applyPlan } from "./files-NnXnawki.js";
6
6
  import { t as display } from "./io-CngfGyMA.js";
7
- import { s as writeAtomic } from "./cache-DGTzqvsc.js";
8
- import { t as VERSION } from "./version-CiDgdPUD.js";
7
+ import { s as writeAtomic } from "./cache-JroD4zCO.js";
8
+ import { t as VERSION } from "./version-3_JBFBjw.js";
9
9
  import { t as importFresh } from "./fresh-import-CdO2oQaQ.js";
10
10
  import { t as isRecord } from "./guards-DxwRG0Uv.js";
11
11
  import { t as loadTopics } from "./topics-CqhOV1S0.js";
@@ -1 +1 @@
1
- export { n as specEmitCommand, i as specValidateCommand } from "./spec-Dvz-C4MP.js";
1
+ export { n as specEmitCommand, i as specValidateCommand } from "./spec-Bn4ArkKk.js";
@@ -4,8 +4,8 @@ import { d as readSupabaseToml, f as schemaPaths, h as tomlGet, n as declarative
4
4
  import { n as databaseUrl, p as accessToken } from "./config-By5EbpdJ.js";
5
5
  import { n as CliError, r as errorText } from "./errors-B7i-VGxk.js";
6
6
  import { t as connect } from "./db-B_xr3ZvK.js";
7
- import { c as TYPEGEN_VERSION, n as cachedIntrospect, u as readExtras } from "./cache-DGTzqvsc.js";
8
- import { a as toCatalog, n as managementSource, r as pgSource } from "./source-aefKuXMY.js";
7
+ import { c as TYPEGEN_VERSION, n as cachedIntrospect, u as readExtras } from "./cache-JroD4zCO.js";
8
+ import { a as toCatalog, n as managementSource, r as pgSource } from "./source-H6tArdAg.js";
9
9
  import { existsSync } from "node:fs";
10
10
  import { dirname, join, posix, relative, resolve, sep } from "node:path";
11
11
  import { glob, readFile, readdir } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  import { m as commandMeta, r as defineCliCommand } from "./command-fqvJ0TdG.js";
2
2
  import { n as CliError, r as errorText } from "./errors-B7i-VGxk.js";
3
3
  import { r as supabaseCli } from "./exec-DBgtTCHK.js";
4
- import { i as migrationsDir } from "./sql-layout-B2fda2KP.js";
4
+ import { i as migrationsDir } from "./sql-layout--Tblsahr.js";
5
5
  import { r as migrationStamp } from "./migration-names-7zAdXfcd.js";
6
6
  import { resolve } from "node:path";
7
7
  import { readFile, readdir, rm, writeFile } from "node:fs/promises";
@@ -1,12 +1,12 @@
1
1
  import { d as fileDiff, i as changeLines, l as keepHandEdit, o as handEditedError, r as applyPlan, t as HAND_EDITED, u as planResult } from "./files-NnXnawki.js";
2
2
  import { t as display } from "./io-CngfGyMA.js";
3
- import { i as migrationsDir, l as sqlPlan } from "./sql-layout-B2fda2KP.js";
3
+ import { i as migrationsDir, l as sqlPlan } from "./sql-layout--Tblsahr.js";
4
4
  import { n as CliError } from "./errors-B7i-VGxk.js";
5
5
  import { t as loadTopics } from "./topics-CqhOV1S0.js";
6
- import { c as sameModuleMigration, l as writeLatestMigration, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-ueN8AWpK.js";
6
+ import { c as sameModuleMigration, l as writeLatestMigration, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-DI1bC407.js";
7
7
  import { t as orphanedBlockFiles } from "./orphans-ByB0gKOp.js";
8
- import { r as layoutFor } from "./providers-DocDgHot.js";
9
- import { n as renderBlocksCached, t as cacheOf } from "./render-cache-Be5Sm_Eu.js";
8
+ import { r as layoutFor } from "./providers-C_0X8CZ5.js";
9
+ import { n as renderBlocksCached, t as cacheOf } from "./render-cache-B6_cW4jQ.js";
10
10
  import { d as readSupabaseToml, f as schemaPaths, h as tomlGet, i as diffEngine, l as migrationCommand, o as findSupabaseRoot, p as sqlWorkflow, t as PGDELTA_TABLE } from "./supabase-toml-B6-eEV5p.js";
11
11
  import { n as migrationFile, t as hasMigrationSuffix } from "./migration-names-7zAdXfcd.js";
12
12
  import { dirname, join, resolve } from "node:path";
@@ -1,12 +1,12 @@
1
1
  import { d as fileDiff, i as changeLines, r as applyPlan } from "./files-NnXnawki.js";
2
2
  import { t as display } from "./io-CngfGyMA.js";
3
- import { i as migrationsDir, l as sqlPlan } from "./sql-layout-B2fda2KP.js";
3
+ import { i as migrationsDir, l as sqlPlan } from "./sql-layout--Tblsahr.js";
4
4
  import { d as readSupabaseToml, p as sqlWorkflow } from "./supabase-toml-B6-eEV5p.js";
5
- import { a as write, r as nextStep, s as topicPolicyFile } from "./sync-DvD3jbb4.js";
5
+ import { a as write, r as nextStep, s as topicPolicyFile } from "./sync-koAHC0Xq.js";
6
6
  import { n as migrationFile } from "./migration-names-7zAdXfcd.js";
7
- import { a as migrationInstances, c as sameModuleMigration, o as migrationModules, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-ueN8AWpK.js";
8
- import { r as layoutFor } from "./providers-DocDgHot.js";
9
- import { n as renderBlocksCached, t as cacheOf } from "./render-cache-Be5Sm_Eu.js";
7
+ import { a as migrationInstances, c as sameModuleMigration, o as migrationModules, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-DI1bC407.js";
8
+ import { r as layoutFor } from "./providers-C_0X8CZ5.js";
9
+ import { n as renderBlocksCached, t as cacheOf } from "./render-cache-B6_cW4jQ.js";
10
10
  import { resolve } from "node:path";
11
11
  import { readFile, readdir } from "node:fs/promises";
12
12
  import { PRELUDE_FUNCTIONS, PRELUDE_MODULE, SQL_MODULES, buildModel, conflicts, duplicatePolicies, entityRenamePlan, moduleFileVersion, moduleTopics, sameBlockFile, upgradePlan } from "better-supabase/sql";
@@ -1,10 +1,10 @@
1
1
  import { m as commandMeta, r as defineCliCommand } from "./command-fqvJ0TdG.js";
2
- import { t as shadowedBlockColumns } from "./column-renames-Cw-VJmbc.js";
3
- import { n as appSchemaTexts } from "./sql-layout-B2fda2KP.js";
2
+ import { t as shadowedBlockColumns } from "./column-renames-DcEFMXX4.js";
3
+ import { n as appSchemaTexts } from "./sql-layout--Tblsahr.js";
4
4
  import { t as SQL_ARGS } from "./args-CS_64_tg.js";
5
- import { o as dataMigration, t as syncModules } from "./sync-DvD3jbb4.js";
6
- import { r as renderStats } from "./render-cache-Be5Sm_Eu.js";
7
- import { t as upgrade } from "./upgrade-hDU5DI6_.js";
5
+ import { o as dataMigration, t as syncModules } from "./sync-koAHC0Xq.js";
6
+ import { r as renderStats } from "./render-cache-B6_cW4jQ.js";
7
+ import { t as upgrade } from "./upgrade-B6MOyby0.js";
8
8
  import { i as plain } from "./style-B5-nByxb.js";
9
9
  // src/cli/commands/upgrade.ts
10
10
  const UPGRADE_ARGS = {
@@ -1,3 +1,3 @@
1
1
  // src/cli/version.ts
2
- const VERSION = "0.63.2";
2
+ const VERSION = "0.64.0";
3
3
  export { VERSION as t };
@@ -1,5 +1,5 @@
1
1
  import { i as parsePublicEnv } from "../public-CCEJuurM.js";
2
- import { n as storageUpload, r as bindClient, t as memoryStorage } from "../ports-ClJbgoyt.js";
2
+ import { n as storageUpload, r as bindClient, t as memoryStorage } from "../ports-BfHdHz1e.js";
3
3
  import { r as authzUserTopic, t as AUTHZ_EVENT } from "../authz-topic-D7fPUY4P.js";
4
4
  import { n as dbError } from "../errors-DK1wGb9z.js";
5
5
  import { i as isProblem, r as fromProblem } from "../problem-BwplIuhI.js";
@@ -1,5 +1,5 @@
1
- import { t as provideConnectionRuntime } from "../../define-runtime-full-gpz09qAj.js";
2
- import { n as storageUpload, r as bindClient, t as memoryStorage } from "../../ports-ClJbgoyt.js";
1
+ import { t as provideConnectionRuntime } from "../../define-runtime-full-BIrEQWJR.js";
2
+ import { n as storageUpload, r as bindClient, t as memoryStorage } from "../../ports-BfHdHz1e.js";
3
3
  import { i as signInWithOAuthBrowser, n as handleAuthDeepLink, r as linkParams, t as startNativeAuthzRefresh } from "../../authz-refresh-27sp45FG.js";
4
4
  import { r as authzUserTopic, t as AUTHZ_EVENT } from "../../authz-topic-D7fPUY4P.js";
5
5
  import { t as expoPushToken } from "../../push-token-CO28k46S.js";
@@ -1,5 +1,5 @@
1
1
  import { a as withAuthMode, i as withAuth, o as withJwtClaims, s as withUserClaims } from "./claims-DouHL7ZL.js";
2
- import { a as withSupport, i as withTenant, o as withServerContext, t as createServer } from "./server-B0T944J9.js";
2
+ import { a as withSupport, i as withTenant, o as withServerContext, t as createServer } from "./server-DpcMKAt_.js";
3
3
  import { c as serverCore, i as withSession } from "./sessions-w6xril_l.js";
4
4
  import { o as problemResponse } from "./problem-BwplIuhI.js";
5
5
  import { i as guard, n as defaultExpose } from "./respond-DLvLJwwN.js";
@@ -1,7 +1,7 @@
1
- import { _ as CONFIG_DEFAULTS, a as blockEntityRenames, c as blockSubjectTypes, g as resolveJsonSchema, i as blockEntities, o as blockEventRenames, s as blockFormerFunctions, t as FormerPermissionKeyError } from "../former-permission-keys-FPrqQHXf.js";
2
- import { A as blockEntrySource, D as CONFIG_GROUPS, F as INTEGRATION_INFO, I as INTEGRATION_NAMES, L as SKILLS_AGENTS, M as groupConfig, N as groupEntries, O as RENAMED_BLOCK_KEYS, P as GEN_TASKS, j as flattenConfig, k as RENAMED_CONFIG_KEYS } from "../config-L5_4kg24.js";
1
+ import { _ as CONFIG_DEFAULTS, a as blockEntityRenames, c as blockSubjectTypes, g as resolveJsonSchema, i as blockEntities, o as blockEventRenames, s as blockFormerFunctions, t as FormerPermissionKeyError } from "../former-permission-keys-DVwR65bj.js";
2
+ import { A as blockEntrySource, D as CONFIG_GROUPS, F as INTEGRATION_INFO, I as INTEGRATION_NAMES, L as SKILLS_AGENTS, M as groupConfig, N as groupEntries, O as RENAMED_BLOCK_KEYS, P as GEN_TASKS, j as flattenConfig, k as RENAMED_CONFIG_KEYS } from "../config-ocvgjLWV.js";
3
3
  import { a as tenantClaimPaths, r as claimPaths, t as DEFAULT_CLAIMS } from "../claims-CX-ar1vt.js";
4
- import { A as APP_ON_DELETE_ACTIONS, D as APP_COLUMN_ACCESS, M as APP_TABLE_EVENT_KINDS, O as APP_COLUMN_FORMATS, R as DEFAULT_ACTIVE_TENANT, V as tenantNameOf, j as APP_ROLLUP_AGGREGATES, k as APP_COLUMN_TYPES } from "../instances-PZAWgQEX.js";
4
+ import { A as APP_ON_DELETE_ACTIONS, D as APP_COLUMN_ACCESS, M as APP_TABLE_EVENT_KINDS, O as APP_COLUMN_FORMATS, R as DEFAULT_ACTIVE_TENANT, V as tenantNameOf, j as APP_ROLLUP_AGGREGATES, k as APP_COLUMN_TYPES } from "../instances-B9oCgEOH.js";
5
5
  import { i as FIELD_FORMATS } from "../field-formats-sLYMh1ZK.js";
6
- import { a as PERMISSION_LEVEL_SEPARATOR, c as resolvePersonas, i as resolveConfig, l as splitPermissionLevel, n as defineConfig, o as permissionLevelKey, r as generatorProblem, s as providerApiProblem, t as CONFIG_SCHEMA_URL } from "../config-1kAVpZc_.js";
6
+ import { a as PERMISSION_LEVEL_SEPARATOR, c as resolvePersonas, i as resolveConfig, l as splitPermissionLevel, n as defineConfig, o as permissionLevelKey, r as generatorProblem, s as providerApiProblem, t as CONFIG_SCHEMA_URL } from "../config-BuZW7wNr.js";
7
7
  export { APP_COLUMN_ACCESS, APP_COLUMN_FORMATS, APP_COLUMN_TYPES, APP_ON_DELETE_ACTIONS, APP_ROLLUP_AGGREGATES, APP_TABLE_EVENT_KINDS, CONFIG_DEFAULTS, CONFIG_GROUPS, CONFIG_SCHEMA_URL, DEFAULT_ACTIVE_TENANT, DEFAULT_CLAIMS, FIELD_FORMATS, FormerPermissionKeyError, GEN_TASKS, INTEGRATION_INFO, INTEGRATION_NAMES, PERMISSION_LEVEL_SEPARATOR, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, SKILLS_AGENTS, blockEntities, blockEntityRenames, blockEntrySource, blockEventRenames, blockFormerFunctions, blockSubjectTypes, claimPaths, defineConfig, flattenConfig, generatorProblem, groupConfig, groupEntries, permissionLevelKey, providerApiProblem, resolveConfig, resolveJsonSchema, resolvePersonas, splitPermissionLevel, tenantClaimPaths, tenantNameOf };
@@ -1,9 +1,9 @@
1
- import { _ as CONFIG_DEFAULTS, u as withBlockSubjects } from "./former-permission-keys-FPrqQHXf.js";
2
- import { j as flattenConfig, n as expandFlatPreset, r as expandPreset } from "./config-L5_4kg24.js";
1
+ import { _ as CONFIG_DEFAULTS, u as withBlockSubjects } from "./former-permission-keys-DVwR65bj.js";
2
+ import { j as flattenConfig, n as expandFlatPreset, r as expandPreset } from "./config-ocvgjLWV.js";
3
3
  import { t as DEFAULT_CLAIMS } from "./claims-CX-ar1vt.js";
4
4
  import { o as tenantNames } from "./entity-naming-CUsC8bC1.js";
5
5
  import { o as frameworkRegistry } from "./frameworks-D_2HeAEj.js";
6
- import { V as tenantNameOf, _ as appTablesOf, o as resolveInstances, r as blocksByName, v as withAppTableSubjects } from "./instances-PZAWgQEX.js";
6
+ import { V as tenantNameOf, _ as appTablesOf, o as resolveInstances, r as blocksByName, v as withAppTableSubjects } from "./instances-B9oCgEOH.js";
7
7
  // src/config/authorization.ts
8
8
  /**
9
9
  * The personas the access matrix signs in as: `personas` as listed, or one per
@@ -1,4 +1,4 @@
1
- import { F as linkNeedsRelations, I as PRESET_CATALOG, z as asBlocksConfig } from "./instances-PZAWgQEX.js";
1
+ import { F as linkNeedsRelations, I as PRESET_CATALOG, z as asBlocksConfig } from "./instances-B9oCgEOH.js";
2
2
  import { t as DEFAULT_TENANT } from "./entity-naming-CUsC8bC1.js";
3
3
  import { a as QUALITY, c as SAAS_LINKED, i as PUBLIC_MEDIA, l as TICKETS, n as CONTROLLED_DOCUMENTS, o as QUOTE_TO_ORDER, r as ERP, s as SAAS } from "./preset-blocks-DDsAXYDY.js";
4
4
  import { t as canonicalJson } from "./canonical-json-CTT9fC4F.js";
@@ -1,6 +1,6 @@
1
- import { A as APP_ON_DELETE_ACTIONS } from "../instances-PZAWgQEX.js";
2
- import { $ as eventsColumnsEdited, A as renameColumn, B as computedColumnRenamed, C as editTable, D as isEmptyDesign, E as isAppTable, F as tidy, G as isRollupAggregate, H as computedTableRenamed, I as updateTable, J as readableColumns, K as lookupSources, L as userConnection, M as setColumn, N as setTableId, O as moveTables, P as singular, Q as tableWithoutComputed, R as withDesign, S as duplicateTable, T as identifierError, U as filterColumns, V as computedRows, W as fittedRollup, X as rollupSources, Y as rollupColumns, Z as tableWithComputed, _ as columnError, a as parseSchema, at as encryptable, b as deleteColumn, c as tenantColumnOf, ct as optionError, d as previewFiles, et as subjectColumns, f as designIssues, g as appTableId, h as addTable, i as keyColumnsOf, it as columnLabel, j as renameTable, k as referenceFrom, l as schemaData, lt as takesBounds, m as EMPTY_DESIGN, n as loadProject, nt as subjectTypeError, o as schemaRelations, ot as fitted, p as APP_MODULE, q as prunedComputed, r as checkDesign, rt as boundError, s as tableStatements, st as lockedWithoutDefault, t as checkProject, tt as subjectColumnsEdited, u as previewAccessProvider, ut as withBounds, v as connect, w as freeTableName, x as deleteTable, y as defaultError, z as ROLLUP_AGGREGATES } from "../project-DYyr_iyu.js";
3
- import { m as diffDesigns } from "../preset-BcwGsW_B.js";
1
+ import { A as APP_ON_DELETE_ACTIONS } from "../instances-B9oCgEOH.js";
2
+ import { $ as eventsColumnsEdited, A as renameColumn, B as computedColumnRenamed, C as editTable, D as isEmptyDesign, E as isAppTable, F as tidy, G as isRollupAggregate, H as computedTableRenamed, I as updateTable, J as readableColumns, K as lookupSources, L as userConnection, M as setColumn, N as setTableId, O as moveTables, P as singular, Q as tableWithoutComputed, R as withDesign, S as duplicateTable, T as identifierError, U as filterColumns, V as computedRows, W as fittedRollup, X as rollupSources, Y as rollupColumns, Z as tableWithComputed, _ as columnError, a as parseSchema, at as encryptable, b as deleteColumn, c as tenantColumnOf, ct as optionError, d as previewFiles, et as subjectColumns, f as designIssues, g as appTableId, h as addTable, i as keyColumnsOf, it as columnLabel, j as renameTable, k as referenceFrom, l as schemaData, lt as takesBounds, m as EMPTY_DESIGN, n as loadProject, nt as subjectTypeError, o as schemaRelations, ot as fitted, p as APP_MODULE, q as prunedComputed, r as checkDesign, rt as boundError, s as tableStatements, st as lockedWithoutDefault, t as checkProject, tt as subjectColumnsEdited, u as previewAccessProvider, ut as withBounds, v as connect, w as freeTableName, x as deleteTable, y as defaultError, z as ROLLUP_AGGREGATES } from "../project-BdZTXDVG.js";
3
+ import { m as diffDesigns } from "../preset-DrfMF0Hv.js";
4
4
  // src/create/column-kinds.ts
5
5
  /** The groups of the column type picker, in the order it shows them. */
6
6
  const KIND_GROUPS = [
@@ -1,8 +1,8 @@
1
1
  import { n as loadLite, t as LITE_INSTALL } from "../../runtime-sBnEajcK.js";
2
- import { b as appDefaultError } from "../../instances-PZAWgQEX.js";
3
- import { t as defineApi } from "../../api-DhCLHpIU.js";
4
- import { n as loadProject } from "../../project-DYyr_iyu.js";
5
- import { c as resolvePersonas } from "../../config-1kAVpZc_.js";
2
+ import { b as appDefaultError } from "../../instances-B9oCgEOH.js";
3
+ import { t as defineApi } from "../../api-TwaJ4nS8.js";
4
+ import { n as loadProject } from "../../project-BdZTXDVG.js";
5
+ import { c as resolvePersonas } from "../../config-BuZW7wNr.js";
6
6
  import { i as fillTemplate } from "../../access-sql-Dvl7BRy0.js";
7
7
  // src/create/lite/apply.ts
8
8
  const MISSING_EXTENSION = /extension "([^"]+)" is not available/u;
@@ -1250,6 +1250,7 @@ function createRepository(runner, table) {
1250
1250
  * installs the runtime without them.
1251
1251
  */
1252
1252
  let extras;
1253
+ const FULL_RUNTIME_SLOT = Symbol.for("better-supabase.connection-runtime.full");
1253
1254
  /**
1254
1255
  * Turns one definition into a `db`. Lives apart from the definition class so
1255
1256
  * entries that only read the definition (the proxy, the sessions runtime) do
@@ -1558,6 +1559,9 @@ function connectorOf(definition) {
1558
1559
  */
1559
1560
  function provideLeanConnectionRuntime(withExtras) {
1560
1561
  extras ??= withExtras;
1562
+ const host = globalThis;
1563
+ if (withExtras === void 0 && host[FULL_RUNTIME_SLOT] === true) return;
1564
+ if (withExtras !== void 0) host[FULL_RUNTIME_SLOT] = true;
1561
1565
  installConnectionRuntime({
1562
1566
  connect: (definition, source, context, options) => connectorOf(definition).connect(source, context, options),
1563
1567
  registerTable: (definition, table) => {
@@ -4,7 +4,7 @@ import { a as ok, r as err, s as toDbError, t as AsyncResult } from "./result-Di
4
4
  import { t as DbException } from "./db-exception-Dv18UZ-I.js";
5
5
  import { r as addLazyTable, t as builderFor } from "./build-ByfDs2ru.js";
6
6
  import { t as decodeRows } from "./codec-CJaAdLjG.js";
7
- import { a as loadReachedTables, i as NO_PLUGINS, n as decodeRpcResult, o as runSpec, r as rpcFunction, t as provideLeanConnectionRuntime } from "./define-runtime-BbNPkt-5.js";
7
+ import { a as loadReachedTables, i as NO_PLUGINS, n as decodeRpcResult, o as runSpec, r as rpcFunction, t as provideLeanConnectionRuntime } from "./define-runtime-DQC2Gjdr.js";
8
8
  import { n as isRecord } from "./guards-CsRa6v57.js";
9
9
  import { t as vectorLiteral } from "./search-DtbkD0h0.js";
10
10
  import { t as EventHub } from "./events-Da482tiF.js";
@@ -1,16 +1,16 @@
1
1
  import { n as dbError } from "../errors-DK1wGb9z.js";
2
2
  import { o as problemResponse } from "../problem-BwplIuhI.js";
3
3
  import { a as ok, r as err } from "../result-DijoXEFG.js";
4
- import { t as adapterBase } from "../adapter-base-DXF0tNJJ.js";
4
+ import { t as adapterBase } from "../adapter-base-BWp_GpBq.js";
5
5
  import { _ as withFlush, g as unexpectedResponse } from "../sessions-w6xril_l.js";
6
- import { t as withBetterSupabase } from "../composite-C13UCNgm.js";
6
+ import { t as withBetterSupabase } from "../composite-RorL_F8I.js";
7
7
  import { n as corsConfig, t as SUPABASE_CORS_HEADERS } from "../cors-DrDFLMNn.js";
8
8
  import { t as withExtra } from "../extra-Dz9n5y1s.js";
9
- import { t as EVERY_CALLER } from "../framework-BQgHM3zD.js";
9
+ import { t as EVERY_CALLER } from "../framework-DxCx0pmS.js";
10
10
  import { i as requireCaller } from "../kit-BgRTtW9w.js";
11
11
  import { n as resourceRouter } from "../resources-CM9wwyfa.js";
12
12
  import { o as respond, s as settle } from "../respond-DLvLJwwN.js";
13
- import { n as extendServer, t as createServer } from "../server-B0T944J9.js";
13
+ import { n as extendServer, t as createServer } from "../server-DpcMKAt_.js";
14
14
  import { i as defineAction } from "../resource-BxSmk1R1.js";
15
15
  import { t as FUNCTION_DESCRIPTOR } from "../function-contract-Bf6llTkE.js";
16
16
  import { n as validate } from "../standard-DM4THQrL.js";
@@ -6,7 +6,7 @@ import { p as isQuerySpec } from "./read-set-DfScfSsf.js";
6
6
  import { a as ok, r as err, s as toDbError } from "./result-DijoXEFG.js";
7
7
  import { n as simplifyOrFalse } from "./simplify-BzThKn5b.js";
8
8
  import { n as whereClause, t as integer } from "./shared-BRFaCh8n.js";
9
- import { t as provideConnectionRuntime } from "./define-runtime-full-gpz09qAj.js";
9
+ import { t as provideConnectionRuntime } from "./define-runtime-full-BIrEQWJR.js";
10
10
  // src/compile/sqlite.ts
11
11
  /**
12
12
  * The operation needs something the SQLite dialect can't express: full-text
@@ -6,11 +6,11 @@ import { t as tenantOf } from "../tenant-Duq0dWqX.js";
6
6
  import { i as claimsOf } from "../claims-CX-ar1vt.js";
7
7
  import { t as DbException } from "../db-exception-Dv18UZ-I.js";
8
8
  import { c as toProblem } from "../problem-BwplIuhI.js";
9
- import { t as adapterBase } from "../adapter-base-DXF0tNJJ.js";
9
+ import { t as adapterBase } from "../adapter-base-BWp_GpBq.js";
10
10
  import { g as unexpectedResponse } from "../sessions-w6xril_l.js";
11
- import { c as bootstrapSchema, l as bootstrapWith, n as extendServer, s as accessOf, t as createServer } from "../server-B0T944J9.js";
11
+ import { c as bootstrapSchema, l as bootstrapWith, n as extendServer, s as accessOf, t as createServer } from "../server-DpcMKAt_.js";
12
12
  import { i as userSessionTags, r as tableTags, t as sessionIdTag } from "../cache-tags-C5Oivuxo.js";
13
- import { t as withBetterSupabase } from "../composite-C13UCNgm.js";
13
+ import { t as withBetterSupabase } from "../composite-RorL_F8I.js";
14
14
  import { r as refreshFor } from "../request-kind-BMNdlQpz.js";
15
15
  import { i as guard, o as respond } from "../respond-DLvLJwwN.js";
16
16
  import { bufferRequest, pipeline, seedContext } from "@supabase/middleware";
@@ -1,5 +1,5 @@
1
1
  import { a as entityNoun, i as entityNames, n as checkEntityName, s as tenantRename, t as DEFAULT_TENANT } from "./entity-naming-CUsC8bC1.js";
2
- import { B as resolveBlock, I as PRESET_CATALOG, V as tenantNameOf } from "./instances-PZAWgQEX.js";
2
+ import { B as resolveBlock, I as PRESET_CATALOG, V as tenantNameOf } from "./instances-B9oCgEOH.js";
3
3
  // src/config/defaults.ts
4
4
  /**
5
5
  * Every default `resolveConfig` fills in. Other modules (the SQL module
@@ -1,6 +1,6 @@
1
1
  import { c as snapshotOf } from "./snapshot-C1KUHKTc.js";
2
2
  import { i as toSession } from "./view-DpKWWhP2.js";
3
- import { t as withBetterSupabase } from "./composite-C13UCNgm.js";
3
+ import { t as withBetterSupabase } from "./composite-RorL_F8I.js";
4
4
  // src/server/framework.ts
5
5
  /**
6
6
  * Every caller: the framework factories guard per loader, action or route
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "../../version-B9H4YoiS.js";
1
+ import { t as VERSION } from "../../version-Adj2H6dY.js";
2
2
  import { f as siblingPath, t as HEADER } from "../../shared-BXRDj6UR.js";
3
3
  import { r as relativeImport } from "../../kit-D6kdfQFj.js";
4
4
  // src/generators/factories.ts
@@ -1 +1 @@
1
- export { t as jsonSchema, n as toJsonSchema } from "../../json-schema-BwfI_jJ2.js";
1
+ export { t as jsonSchema, n as toJsonSchema } from "../../json-schema-BuzopJOK.js";