better-supabase 0.30.0 → 0.31.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 (205) hide show
  1. package/dist/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
  2. package/dist/ai-sdk/agents/index.d.ts +2 -2
  3. package/dist/{app-tables-yyVncXEt.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
  4. package/dist/astro/index.js +2 -2
  5. package/dist/{authorization-CDU9tYA_.d.ts → authorization-DfEkyFt_.d.ts} +10 -3
  6. package/dist/{bind-p7asfI6H.d.ts → bind-DAx0bMSi.d.ts} +2 -2
  7. package/dist/{block-env-B8wG3xeh.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
  8. package/dist/blocks/ai-chat/index.d.ts +3 -3
  9. package/dist/blocks/announcements/index.d.ts +3 -3
  10. package/dist/blocks/api-keys/index.d.ts +1 -1
  11. package/dist/blocks/attachments/index.d.ts +1 -1
  12. package/dist/blocks/audit/index.d.ts +2 -2
  13. package/dist/blocks/automations/index.d.ts +1 -1
  14. package/dist/blocks/billing/index.d.ts +1 -1
  15. package/dist/blocks/bookings/index.d.ts +1 -1
  16. package/dist/blocks/calendar/index.d.ts +7 -3
  17. package/dist/blocks/calendar/index.js +5 -1
  18. package/dist/blocks/comments/index.d.ts +4 -4
  19. package/dist/blocks/employees/index.js +1 -4
  20. package/dist/blocks/entitlements/index.d.ts +2 -2
  21. package/dist/blocks/forms/index.d.ts +1 -1
  22. package/dist/blocks/inbox/index.d.ts +4 -4
  23. package/dist/blocks/index.d.ts +1 -1
  24. package/dist/blocks/messaging/index.d.ts +4 -4
  25. package/dist/blocks/mfa/index.d.ts +1 -1
  26. package/dist/blocks/notifications/index.d.ts +3 -3
  27. package/dist/blocks/notifications/index.js +5 -43
  28. package/dist/blocks/onboarding/index.d.ts +1 -1
  29. package/dist/blocks/organizations/index.d.ts +34 -21
  30. package/dist/blocks/organizations/index.js +5 -1
  31. package/dist/blocks/permissions/index.d.ts +32 -3
  32. package/dist/blocks/permissions/index.js +23 -2
  33. package/dist/blocks/push/index.d.ts +10 -2
  34. package/dist/blocks/push/index.js +23 -7
  35. package/dist/blocks/reactions/index.d.ts +3 -3
  36. package/dist/blocks/saved-views/index.d.ts +1 -1
  37. package/dist/blocks/search/index.d.ts +2 -2
  38. package/dist/blocks/sessions/index.d.ts +1 -1
  39. package/dist/blocks/settings/index.d.ts +1 -1
  40. package/dist/blocks/subjects/index.d.ts +1 -1
  41. package/dist/blocks/tags/index.d.ts +1 -1
  42. package/dist/blocks/tasks/index.js +1 -1
  43. package/dist/blocks/teams/index.d.ts +7 -1
  44. package/dist/blocks/teams/index.js +8 -7
  45. package/dist/blocks/undo/index.d.ts +1 -1
  46. package/dist/blocks/usage/index.d.ts +1 -1
  47. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  48. package/dist/blocks/workflows/index.d.ts +3 -3
  49. package/dist/cli/{add-Dggyehsy.js → add-B9wP0YGU.js} +2 -2
  50. package/dist/cli/{add-D4w-Axib.js → add-DjZXKd7X.js} +10 -10
  51. package/dist/cli/add-ZcEOEK23.js +1 -0
  52. package/dist/cli/{app-table-files-CiGuwLkO.js → app-table-files-mtvjHa48.js} +2 -2
  53. package/dist/cli/{backfill-DjVjXW_P.js → backfill-Coshdvh_.js} +2 -2
  54. package/dist/cli/bin.js +1 -1
  55. package/dist/cli/{blocks-jRL9K1R8.js → blocks-BWCuA0nq.js} +2 -2
  56. package/dist/cli/{blocks-Bbmb6W_F.js → blocks-hiSazThw.js} +1 -1
  57. package/dist/cli/{cache-BuoIFlUJ.js → cache-x2wWAy0h.js} +1 -1
  58. package/dist/cli/{codemod-DRavXBCb.js → codemod-BnjV7BpC.js} +210 -11
  59. package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
  60. package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
  61. package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
  62. package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
  63. package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
  64. package/dist/cli/{content-mapper-BCtyfKXl.js → content-mapper-DvOSOdTE.js} +2 -2
  65. package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
  66. package/dist/cli/{doctor-Di2ZekfN.js → doctor-Ywy8oJEU.js} +41 -16
  67. package/dist/cli/env-CNjT_uOV.js +1 -0
  68. package/dist/cli/{env-B2CbnbzD.js → env-XMiKvhtV.js} +1 -1
  69. package/dist/cli/{gen-STKC9vkK.js → gen-B-FbQmG1.js} +14 -14
  70. package/dist/cli/index.d.ts +1 -1
  71. package/dist/cli/index.js +7 -7
  72. package/dist/cli/{init-DW6_nIwj.js → init-fb9e1BKX.js} +9 -9
  73. package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
  74. package/dist/cli/{live-0G4Plw3K.js → live-DIt7TP-N.js} +2 -2
  75. package/dist/cli/{mcp-flKS8iU5.js → mcp-CVWwraga.js} +3 -3
  76. package/dist/cli/{metadata-VARUbXEe.js → metadata-CannIjel.js} +3 -3
  77. package/dist/cli/{migrate-Bkq07XcT.js → migrate-Ht2TzIQF.js} +2 -2
  78. package/dist/cli/{migration-safety-BfVeza5j.js → migration-safety-nNyB05I-.js} +1 -1
  79. package/dist/cli/{migrations-BCq7Zs2E.js → migrations-bAd7dpk1.js} +2 -2
  80. package/dist/cli/{module-migration-lbeUrsYv.js → module-migration-CkNux8dr.js} +2 -2
  81. package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
  82. package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
  83. package/dist/cli/{powersync-B15CfH5Y.js → powersync-B2v0tDwp.js} +100 -7
  84. package/dist/cli/powersync-D3mAQ6QE.js +1 -0
  85. package/dist/cli/{print-DjxpBRnv.js → print-CxQ0rBKT.js} +2 -2
  86. package/dist/cli/{providers-dyxcHQY3.js → providers-DtI90lSw.js} +1 -1
  87. package/dist/cli/{remove-BLq5gbal.js → remove-DYtE4IZ4.js} +6 -6
  88. package/dist/cli/{render-CizUf3RW.js → render-QGWfEoiB.js} +3 -3
  89. package/dist/cli/{run-ChEjR7yw.js → run-B5aMwErM.js} +2 -2
  90. package/dist/cli/{run-MwM__teL.js → run-BNoJKf5I.js} +40 -39
  91. package/dist/cli/{run-ChOY6s4o.js → run-DiYX1XEa.js} +8 -8
  92. package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
  93. package/dist/cli/seed-Cm-c0BDd.js +1 -0
  94. package/dist/cli/{shared-DV5wIv-7.js → shared-D_CFi5di.js} +1 -1
  95. package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
  96. package/dist/cli/{snapshot-B5LXkVMC.js → snapshot-BlQ4DDcJ.js} +9 -4
  97. package/dist/cli/{source-BoLNG_2A.js → source-CelMBQMj.js} +1 -1
  98. package/dist/cli/{spec-D6QeE2Zx.js → spec-BxcoGE0h.js} +1 -1
  99. package/dist/cli/{spec-Dz-PGCaM.js → spec-iBx1LcYO.js} +3 -3
  100. package/dist/cli/{sql-layout-zo02f3Dm.js → sql-layout-Dp4Rottt.js} +2 -2
  101. package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
  102. package/dist/cli/{sync-m-oZ_SyI.js → sync-BnORI43S.js} +4 -4
  103. package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
  104. package/dist/cli/{upgrade-C9sgVZ5z.js → upgrade-CR6-WmIc.js} +5 -5
  105. package/dist/cli/{upgrade-WwEJaX3i.js → upgrade-fz92aCnh.js} +3 -3
  106. package/dist/cli/{version-D2BQuqta.js → version-Dz8ZlOuh.js} +1 -1
  107. package/dist/client/index.d.ts +5 -5
  108. package/dist/client/native/index.d.ts +4 -4
  109. package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
  110. package/dist/config/index.d.ts +2 -2
  111. package/dist/config/index.js +4 -4
  112. package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
  113. package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
  114. package/dist/{context-nbYYjv7U.d.ts → context-DWWoP1wK.d.ts} +1 -1
  115. package/dist/{controller-TRocodqG.d.ts → controller-Br9dGKGe.d.ts} +1 -1
  116. package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
  117. package/dist/create/index.d.ts +3 -3
  118. package/dist/create/index.js +3 -3
  119. package/dist/create/lite/index.d.ts +3 -3
  120. package/dist/create/lite/index.js +3 -3
  121. package/dist/delivery-events-DbL8IHIY.js +53 -0
  122. package/dist/edge/index.js +3 -3
  123. package/dist/{entitlements-B1i1-wfe.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
  124. package/dist/eve/index.js +1 -1
  125. package/dist/expo/index.js +3 -2
  126. package/dist/{field-errors-tJvehEFc.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
  127. package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
  128. package/dist/hono/index.js +2 -2
  129. package/dist/{index-BkzXwuIN.d.ts → index-Clyd2Goi.d.ts} +1 -1
  130. package/dist/{index-zsgNmE8m.d.ts → index-D98bQs8a.d.ts} +7 -7
  131. package/dist/{index-BKrxynq9.d.ts → index-DIdPoQtO.d.ts} +2 -2
  132. package/dist/{index-CWAQRWY8.d.ts → index-I8YLxKq8.d.ts} +2 -2
  133. package/dist/{index-8US7qlvW.d.ts → index-eRBuKtMt.d.ts} +2 -2
  134. package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
  135. package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
  136. package/dist/mapper/bin.js +5 -5
  137. package/dist/mcp/index.d.ts +1 -1
  138. package/dist/mcp/index.js +1 -1
  139. package/dist/mcp/sdk/index.js +1 -1
  140. package/dist/next/index.d.ts +73 -6
  141. package/dist/next/index.js +88 -35
  142. package/dist/{operations-CB9atU2e.d.ts → operations-hm1Isvvs.d.ts} +1 -1
  143. package/dist/{options-BKBy5wM_.js → options-CF6EVF_G.js} +2 -1
  144. package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
  145. package/dist/orpc/index.js +2 -1
  146. package/dist/otel/index.js +4 -4
  147. package/dist/{ports-hpbyMySO.d.ts → ports-DOrPTJzl.d.ts} +1 -1
  148. package/dist/powersync/index.d.ts +204 -4
  149. package/dist/powersync/index.js +361 -4
  150. package/dist/preset/index.d.ts +3 -3
  151. package/dist/preset/index.js +3 -3
  152. package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
  153. package/dist/{project-B32wb5J6.js → project-DJ9Uo0sT.js} +5 -5
  154. package/dist/{push-token-DQ1ycFPU.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
  155. package/dist/query/index.d.ts +1 -1
  156. package/dist/query/index.js +1 -1
  157. package/dist/react/index.d.ts +5 -5
  158. package/dist/react/index.js +1 -1
  159. package/dist/react/native/index.d.ts +1 -1
  160. package/dist/react/server.d.ts +5 -5
  161. package/dist/react/server.js +1 -1
  162. package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
  163. package/dist/react-router/index.js +2 -2
  164. package/dist/realtime/index.d.ts +3 -3
  165. package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
  166. package/dist/records/index.d.ts +5 -5
  167. package/dist/records/index.js +3 -3
  168. package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
  169. package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
  170. package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
  171. package/dist/server/index.d.ts +1 -1
  172. package/dist/server/index.js +4 -4
  173. package/dist/{sign-in-Cyj3ZlFX.js → sign-in-CuZ1Ag7O.js} +17 -2
  174. package/dist/solid/index.d.ts +5 -5
  175. package/dist/solid-start/index.js +2 -2
  176. package/dist/spec/index.js +1 -1
  177. package/dist/sql/index.d.ts +4 -4
  178. package/dist/sql/index.js +3 -3
  179. package/dist/{sql-CyeDg3Yh.js → sql-DHp0L7zK.js} +404 -165
  180. package/dist/ssr/index.d.ts +1 -1
  181. package/dist/svelte/index.d.ts +5 -5
  182. package/dist/sveltekit/index.js +2 -2
  183. package/dist/tanstack-start/index.js +2 -2
  184. package/dist/{tenant-C9YE_kqK.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
  185. package/dist/testing/index.d.ts +13 -4
  186. package/dist/testing/index.js +17 -15
  187. package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
  188. package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
  189. package/dist/{topic-breZqx_4.d.ts → topic-BaUElNw2.d.ts} +1 -1
  190. package/dist/{types-C3I7S51U.d.ts → types-CMN0h_Ix.d.ts} +2 -2
  191. package/dist/vue/index.d.ts +5 -5
  192. package/dist/{watch-topic-ItO3dz8m.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
  193. package/dist/workflow-sdk/world/index.js +2 -2
  194. package/dist/{workflow-sdk-BWPsdzVK.js → workflow-sdk-DJJkP0dT.js} +12 -1
  195. package/dist/yjs/index.d.ts +1 -1
  196. package/package.json +1 -1
  197. package/schemas/config-v1.json +9 -1
  198. package/schemas/doctor-report-v1.json +1 -0
  199. package/skills/better-supabase/references/ui-recipes.md +524 -295
  200. package/skills/better-supabase-api/references/powersync.md +16 -0
  201. package/skills/better-supabase-auth/SKILL.md +4 -1
  202. package/dist/cli/add-BdhGOwkB.js +0 -1
  203. package/dist/cli/env-CynGCICL.js +0 -1
  204. package/dist/cli/powersync-DnBsDchT.js +0 -1
  205. package/dist/cli/seed-BOun22-k.js +0 -1
@@ -1,21 +1,21 @@
1
- import { a as list, m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { a as list, m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
- import { t as VERSION } from "./version-D2BQuqta.js";
3
+ import { t as VERSION } from "./version-Dz8ZlOuh.js";
4
4
  import { a as parseNames, n as CliError } from "./errors-BTe6A15O.js";
5
5
  import { r as readIfExists, t as display } from "./io-DH1kcmmP.js";
6
- import { t as loadSnapshot } from "./snapshot-B5LXkVMC.js";
6
+ import { t as loadSnapshot } from "./snapshot-BlQ4DDcJ.js";
7
7
  import { t as isRecord } from "./guards-CUlDNYZs.js";
8
- import { a as toCatalog } from "./source-BoLNG_2A.js";
8
+ import { a as toCatalog } from "./source-CelMBQMj.js";
9
9
  import { a as findConfig, f as INTEGRATIONS, s as loadConfig } from "./config-Cskysxp-.js";
10
10
  import { i as changeLines, n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
11
- import { n as dataMigration } from "./migrations-BCq7Zs2E.js";
12
- import { a as wiringFiles, d as libEntry, f as needsLib, i as wiringChecklist, l as importFrom, n as latestMigrationVersion, o as wiringFor, p as resolveIntegrations, s as TEMPLATES, u as isIntegration } from "./migration-safety-BfVeza5j.js";
11
+ import { n as dataMigration } from "./migrations-bAd7dpk1.js";
12
+ import { a as wiringFiles, d as libEntry, f as needsLib, i as wiringChecklist, l as importFrom, n as latestMigrationVersion, o as wiringFor, p as resolveIntegrations, s as TEMPLATES, u as isIntegration } from "./migration-safety-nNyB05I-.js";
13
13
  import { n as installCommand, t as detectProject } from "./detect-D9JaAX20.js";
14
14
  import { d as setBlockInJson, f as setPathInConfig, h as setPresetInJson, m as setPresetInConfig, n as addBlocksToJson, p as setPathInJson, r as addBlocksToWiring, t as addBlocksToConfig, u as setBlockInConfig } from "./config-edit-CrWfk8s3.js";
15
- import { t as syncModules } from "./sync-m-oZ_SyI.js";
16
- import { t as addModules } from "./add-Dggyehsy.js";
17
- import { t as appTablePlan } from "./app-table-files-CiGuwLkO.js";
18
- import { t as blockNames } from "./blocks-jRL9K1R8.js";
15
+ import { t as syncModules } from "./sync-BnORI43S.js";
16
+ import { t as addModules } from "./add-B9wP0YGU.js";
17
+ import { t as appTablePlan } from "./app-table-files-mtvjHa48.js";
18
+ import { t as blockNames } from "./blocks-BWCuA0nq.js";
19
19
  import { i as sourceArgs, n as SOURCE_ARGS } from "./source-args-v8ljFDfc.js";
20
20
  import { existsSync } from "node:fs";
21
21
  import { dirname, join, posix, resolve } from "node:path";
@@ -0,0 +1 @@
1
+ export { t as addCommand } from "./add-DjZXKd7X.js";
@@ -1,8 +1,8 @@
1
1
  import { n as CliError } from "./errors-BTe6A15O.js";
2
2
  import { h as subjectTagArgs } from "./config-Cskysxp-.js";
3
- import { r as layoutFor } from "./providers-dyxcHQY3.js";
3
+ import { r as layoutFor } from "./providers-DtI90lSw.js";
4
4
  import { d as readSupabaseToml, n as declarativeSchemasDir } from "./supabase-toml-CncmQbO0.js";
5
- import { r as literal } from "./live-0G4Plw3K.js";
5
+ import { r as literal } from "./live-DIt7TP-N.js";
6
6
  import { join, resolve, sep } from "node:path";
7
7
  import { FIELD_FORMATS } from "better-supabase/config";
8
8
  import { APP_TABLES_MODULE, renderBlocks, setTableFeature } from "better-supabase/sql";
@@ -1,9 +1,9 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
3
3
  import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
4
4
  import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-Cskysxp-.js";
5
5
  import { t as connect } from "./db-CQCLx7cx.js";
6
- import { n as ident } from "./live-0G4Plw3K.js";
6
+ import { n as ident } from "./live-DIt7TP-N.js";
7
7
  import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-v8ljFDfc.js";
8
8
  //#region src/cli/commands/backfill.ts
9
9
  const DEFAULT_BATCH = 1e3;
package/dist/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as run } from "./run-MwM__teL.js";
2
+ import { i as run } from "./run-BNoJKf5I.js";
3
3
  import { t as colorEnabled } from "./style-Bm2X5JrN.js";
4
4
  import { existsSync } from "node:fs";
5
5
  import { basename } from "node:path";
@@ -1,7 +1,7 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as CliError } from "./errors-BTe6A15O.js";
3
3
  import { t as SQL_ARGS } from "./args-UEwg0l-N.js";
4
- import { n as listModules, t as printModule } from "./print-DjxpBRnv.js";
4
+ import { n as listModules, t as printModule } from "./print-CxQ0rBKT.js";
5
5
  import { t as decodePresetInput } from "./preset-BwmIfFnh.js";
6
6
  import { BLOCK_CATEGORIES } from "better-supabase/blocks";
7
7
  import { PRESET_CATALOG, PRESET_NAMES, glueCommand } from "better-supabase/preset";
@@ -1 +1 @@
1
- export { n as blocksListCommand, r as blocksSearchCommand, i as blocksViewCommand } from "./blocks-jRL9K1R8.js";
1
+ export { n as blocksListCommand, r as blocksSearchCommand, i as blocksViewCommand } from "./blocks-BWCuA0nq.js";
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-D2BQuqta.js";
1
+ import { t as VERSION } from "./version-Dz8ZlOuh.js";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { createHash } from "node:crypto";
4
4
  import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
@@ -1,10 +1,10 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
3
  import { n as CliError } from "./errors-BTe6A15O.js";
4
- import { t as migrateCliCall } from "./moved-DNOtp9LA.js";
4
+ import { t as migrateCliCall } from "./moved-C3WyRHkA.js";
5
5
  import { t as isRecord$1 } from "./guards-CUlDNYZs.js";
6
6
  import { a as changedFiles, i as changeLines, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
7
- import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-zo02f3Dm.js";
7
+ import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-Dp4Rottt.js";
8
8
  import { a as configObject, c as mask, f as setPathInConfig, g as skipSpace, h as setPresetInJson, i as closingIndex, l as properties, m as setPresetInConfig, o as indentAt, p as setPathInJson, t as addBlocksToConfig, v as codeRanges } from "./config-edit-CrWfk8s3.js";
9
9
  import { i as legacyPrefixNames, n as LEGACY_PREFIXES, t as LEGACY_CLAIMS } from "./legacy-prefix-R7UChFFl.js";
10
10
  import { a as REVIEW_0_15, c as renameSubpaths, r as PLUGIN_IMPORT_RENAMES, s as SUBPATH_RENAMES_0_15, t as BLOCK_EXPORT_RENAMES } from "./codemod-block-renames-BuSaTE_G.js";
@@ -13,7 +13,7 @@ import { existsSync } from "node:fs";
13
13
  import { extname, join, relative, resolve } from "node:path";
14
14
  import { readFile, readdir, stat } from "node:fs/promises";
15
15
  import { DEFAULT_CONVENTIONS, presetSpec } from "better-supabase/preset";
16
- import { currentBlockName, renamedBlock } from "better-supabase/sql";
16
+ import { currentBlockName, formatBsbComment, parseBsbComment, renamedBlock } from "better-supabase/sql";
17
17
  import { BLOCK_EVENT_RENAMES } from "better-supabase/events";
18
18
  //#region src/cli/codemod-calls.ts
19
19
  /** Files whose CLI calls a codemod rewrites. */
@@ -713,6 +713,198 @@ function rewrite015(text) {
713
713
  };
714
714
  }
715
715
  //#endregion
716
+ //#region src/cli/codemod-subjects.ts
717
+ const ENVIRONMENT_KEY$1 = /^\$(?:development|production|test|ci)$/;
718
+ const lineAt = (source, index) => source.slice(0, index).split("\n").length;
719
+ function applyEdits$3(source, edits) {
720
+ let text = source;
721
+ for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
722
+ return text;
723
+ }
724
+ /** The range that removes `prop` with its comma and the space after it. */
725
+ function removal$1(code, prop, close) {
726
+ const after = skipSpace(code, prop.valueEnd);
727
+ if (code[after] === ",") return {
728
+ start: prop.start,
729
+ end: skipSpace(code, after + 1),
730
+ text: ""
731
+ };
732
+ return {
733
+ start: prop.start,
734
+ end: after === close ? prop.valueEnd : after,
735
+ text: ""
736
+ };
737
+ }
738
+ /** Text that adds `entries` before the `}` at `close`. */
739
+ function insertion(source, code, open, close, existing, entries) {
740
+ const outer = indentAt(source, open);
741
+ const first = existing[0];
742
+ const inner = first === void 0 ? `${outer} ` : indentAt(source, first.start);
743
+ let last = close - 1;
744
+ while (last > open && /\s/.test(code[last])) last -= 1;
745
+ const body = entries.map((entry) => `\n${inner}${entry},`).join("");
746
+ if (last === open) return {
747
+ start: open + 1,
748
+ end: close,
749
+ text: `${body}\n${outer}`
750
+ };
751
+ return {
752
+ start: last + 1,
753
+ end: last + 1,
754
+ text: `${code[last] === "," ? "" : ","}${body}`
755
+ };
756
+ }
757
+ /** Moves `records` into `subjects` in the object at `open`. */
758
+ function renameIn(source, code, open, review) {
759
+ const props = properties(source, code, open);
760
+ const close = closingIndex(code, open);
761
+ if (props === void 0 || close === -1) return [];
762
+ const edits = [];
763
+ const records = props.find((prop) => prop.key === "records");
764
+ const subjects = props.find((prop) => prop.key === "subjects");
765
+ if (records !== void 0 && subjects === void 0) {
766
+ const keyEnd = source.indexOf("records", records.start) + 7;
767
+ edits.push({
768
+ start: records.start,
769
+ end: keyEnd,
770
+ text: "subjects"
771
+ });
772
+ } else if (records !== void 0 && subjects !== void 0) {
773
+ const from = code[records.valueStart] === "{" ? properties(source, code, records.valueStart) : void 0;
774
+ const into = code[subjects.valueStart] === "{" ? properties(source, code, subjects.valueStart) : void 0;
775
+ if (from === void 0 || into === void 0) review.push({
776
+ line: lineAt(source, records.start),
777
+ message: "`records` and `subjects` are both set and one isn't an object literal: move the `records` entries into `subjects` by hand"
778
+ });
779
+ else {
780
+ const taken = new Set(into.flatMap((prop) => prop.key ?? []));
781
+ const moved = [];
782
+ for (const entry of from) if (entry.key !== void 0 && taken.has(entry.key)) review.push({
783
+ line: lineAt(source, entry.start),
784
+ message: `\`records.${entry.key}\` is dropped: \`subjects.${entry.key}\` already exists and wins`
785
+ });
786
+ else moved.push(source.slice(entry.start, entry.valueEnd));
787
+ if (moved.length > 0) edits.push(insertion(source, code, subjects.valueStart, closingIndex(code, subjects.valueStart), into, moved));
788
+ edits.push(removal$1(code, records, close));
789
+ }
790
+ }
791
+ for (const prop of props) {
792
+ if (prop.key === void 0 || code[prop.valueStart] !== "{") continue;
793
+ if (ENVIRONMENT_KEY$1.test(prop.key)) edits.push(...renameIn(source, code, prop.valueStart, review));
794
+ else if (prop.key === "$env") {
795
+ for (const environment of properties(source, code, prop.valueStart) ?? []) if (code[environment.valueStart] === "{") edits.push(...renameIn(source, code, environment.valueStart, review));
796
+ }
797
+ }
798
+ return edits;
799
+ }
800
+ function renameJson(value, review) {
801
+ if (!isRecord$1(value)) return value;
802
+ const { records, ...rest } = value;
803
+ const out = { ...rest };
804
+ if (records !== void 0) {
805
+ const subjects = rest["subjects"];
806
+ if (subjects === void 0) out["subjects"] = records;
807
+ else if (isRecord$1(records) && isRecord$1(subjects)) {
808
+ for (const key of Object.keys(records)) if (key in subjects) review.push({
809
+ line: 1,
810
+ message: `\`records.${key}\` is dropped: \`subjects.${key}\` already exists and wins`
811
+ });
812
+ out["subjects"] = {
813
+ ...records,
814
+ ...subjects
815
+ };
816
+ } else {
817
+ out["records"] = records;
818
+ review.push({
819
+ line: 1,
820
+ message: "`records` and `subjects` are both set and one isn't an object: move the `records` entries into `subjects` by hand"
821
+ });
822
+ }
823
+ }
824
+ for (const [key, entry] of Object.entries(out)) if (ENVIRONMENT_KEY$1.test(key)) out[key] = renameJson(entry, review);
825
+ else if (key === "$env" && isRecord$1(entry)) out[key] = Object.fromEntries(Object.entries(entry).map(([name, block]) => [name, renameJson(block, review)]));
826
+ return out;
827
+ }
828
+ /**
829
+ * `better-supabase.config.*` with `records` renamed to `subjects`, at the top
830
+ * level and in the `$env` and `$<environment>` blocks. Where both keys are set,
831
+ * the `records` entries move into `subjects` and an existing `subjects` entry
832
+ * wins, as the 0.29 config loader merges them.
833
+ */
834
+ function recordsToSubjects(source, json) {
835
+ const review = [];
836
+ if (json) {
837
+ let parsed;
838
+ try {
839
+ parsed = JSON.parse(source);
840
+ } catch {
841
+ return {
842
+ ok: false,
843
+ reason: "the file is not valid JSON"
844
+ };
845
+ }
846
+ const renamed = renameJson(parsed, review);
847
+ return JSON.stringify(renamed) === JSON.stringify(parsed) ? {
848
+ ok: true,
849
+ text: source,
850
+ review
851
+ } : {
852
+ ok: true,
853
+ text: `${JSON.stringify(renamed, null, 2)}\n`,
854
+ review
855
+ };
856
+ }
857
+ const code = mask(source);
858
+ const open = configObject(code);
859
+ if (open === void 0) return /\brecords\s*:/.test(code) ? {
860
+ ok: false,
861
+ reason: "no defineConfig({...}) or exported object literal; rename `records` to `subjects` by hand"
862
+ } : {
863
+ ok: true,
864
+ text: source,
865
+ review
866
+ };
867
+ return {
868
+ ok: true,
869
+ text: applyEdits$3(source, renameIn(source, code, open, review)),
870
+ review
871
+ };
872
+ }
873
+ const COMMENT = /(comment\s+on\s+table\s+(?:"?[\w$]+"?\.)?"?[\w$]+"?\s+is\s+)'((?:[^']|'')*)'(\s*;)/giu;
874
+ /**
875
+ * `sql` with the `@bsb record` tags of its `comment on table` statements
876
+ * renamed to `subject`. A comment that has both keeps `subject` and drops
877
+ * `record`, with a review line.
878
+ */
879
+ function recordTagsToSubject(sql) {
880
+ const review = [];
881
+ return {
882
+ text: sql.replaceAll(COMMENT, (statement, head, body, tail, offset) => {
883
+ const parsed = parseBsbComment(body.replaceAll("''", "'"));
884
+ if (!parsed.tags.some((tag) => tag.name === "record")) return statement;
885
+ const hasSubject = parsed.tags.some((tag) => tag.name === "subject");
886
+ if (hasSubject) review.push({
887
+ line: lineAt(sql, offset),
888
+ message: "The `record` tag is dropped: the comment already has a `subject` tag, which wins"
889
+ });
890
+ return `${head}'${formatBsbComment({
891
+ text: parsed.text,
892
+ tags: parsed.tags.flatMap((tag) => tag.name === "record" ? hasSubject ? [] : [{
893
+ ...tag,
894
+ name: "subject"
895
+ }] : [tag])
896
+ }).replaceAll("'", "''")}'${tail}`;
897
+ }),
898
+ review
899
+ };
900
+ }
901
+ const CODEMOD_0_29 = {
902
+ name: "0.29",
903
+ description: "Renames records back to subjects in better-supabase.config.*, reversing the 0.15 rename (at the top level and in the $env and $<environment> blocks; where both are set, the records entries move into subjects and an existing subjects entry wins), and renames @bsb record tags to subject in the comment on table statements of supabase/schemas",
904
+ configFile: recordsToSubjects,
905
+ sqlFile: recordTagsToSubject
906
+ };
907
+ //#endregion
716
908
  //#region src/cli/sql/config-adopt.ts
717
909
  const ADOPT = /(?:\bownership|"ownership"|'ownership')\s*:\s*(["'])adopt\1[ \t]*,?/g;
718
910
  const lineOf$1 = (text, index) => text.slice(0, index).split("\n").length;
@@ -1943,7 +2135,8 @@ const CODEMODS = {
1943
2135
  cliCalls: migrateCliCall,
1944
2136
  source: rewrite015,
1945
2137
  review: REVIEW_0_15
1946
- }
2138
+ },
2139
+ "0.29": CODEMOD_0_29
1947
2140
  };
1948
2141
  const SUPABASE_IMPORT = /\bfrom\s*["'](?:better-supabase(?:\/[\w./-]*)?|[^"']*supabase[^"']*)["']/;
1949
2142
  /**
@@ -2262,6 +2455,10 @@ function applyCodemod(codemod, source, file) {
2262
2455
  review: [...cliCallHints(source, codemod.cliCalls), ...hints]
2263
2456
  };
2264
2457
  }
2458
+ if (file?.endsWith(".sql") === true) return codemod.sqlFile?.(source) ?? {
2459
+ text: source,
2460
+ review: []
2461
+ };
2265
2462
  if (file !== void 0 && DESIGN_FILE_NAME.test(file)) return designFileResult(source, codemod.designFile);
2266
2463
  let text = source;
2267
2464
  const refused = [];
@@ -2354,20 +2551,22 @@ const SKIPPED_DIRS = /* @__PURE__ */ new Set([
2354
2551
  "build",
2355
2552
  "coverage"
2356
2553
  ]);
2554
+ const SCHEMA_SQL = /(?:^|[\\/])supabase[\\/]schemas[\\/].*\.sql$/;
2357
2555
  /**
2358
2556
  * Source, config and script files under `path`, skipping dependencies, build
2359
- * output and `.d.ts` files.
2557
+ * output and `.d.ts` files. With `sql`, the `.sql` files under
2558
+ * `supabase/schemas` too; migrations stay as they are.
2360
2559
  */
2361
- async function sourceFiles(path) {
2560
+ async function sourceFiles(path, sql) {
2362
2561
  const info = await stat(path).catch(() => void 0);
2363
2562
  if (!info) return [];
2364
- if (info.isFile()) return [path];
2563
+ if (info.isFile()) return path.endsWith(".sql") && !sql ? [] : [path];
2365
2564
  const files = [];
2366
2565
  for (const entry of await readdir(path, { withFileTypes: true })) {
2367
2566
  const full = join(path, entry.name);
2368
2567
  if (entry.isDirectory()) {
2369
- if (!SKIPPED_DIRS.has(entry.name)) files.push(...await sourceFiles(full));
2370
- } else if (SOURCE_EXTENSIONS.has(extname(entry.name)) && !entry.name.endsWith(".d.ts") || CONFIG_FILE.test(entry.name) || DESIGN_FILE_NAME.test(entry.name) || CLI_CALL_FILE.test(full) || SHELL_FILE.test(entry.name)) files.push(full);
2568
+ if (!SKIPPED_DIRS.has(entry.name)) files.push(...await sourceFiles(full, sql));
2569
+ } else if (SOURCE_EXTENSIONS.has(extname(entry.name)) && !entry.name.endsWith(".d.ts") || CONFIG_FILE.test(entry.name) || DESIGN_FILE_NAME.test(entry.name) || CLI_CALL_FILE.test(full) || SHELL_FILE.test(entry.name) || sql && SCHEMA_SQL.test(full)) files.push(full);
2371
2570
  }
2372
2571
  return files.toSorted();
2373
2572
  }
@@ -2378,7 +2577,7 @@ async function runCodemod(config, args, paint = plain) {
2378
2577
  const codemod = CODEMODS[name];
2379
2578
  if (!codemod) throw new CliError("usage", `Unknown codemod "${name}". Codemods:\n${names}`);
2380
2579
  const roots = (paths.length > 0 ? paths : ["."]).map((path) => resolve(config.root, path));
2381
- const files = [...new Set((await Promise.all(roots.map(sourceFiles))).flat())];
2580
+ const files = [...new Set((await Promise.all(roots.map((root) => sourceFiles(root, codemod.sqlFile !== void 0)))).flat())];
2382
2581
  const dryRun = args["dry-run"] === true;
2383
2582
  const edits = [];
2384
2583
  const review = [];
@@ -834,6 +834,12 @@ const COMMANDS = [
834
834
  description: "Changes from 0.14 to 0.15: the runtime instance bs becomes bsb, exports take their block, record and provider names, the config regroups, renamed blocks take their 0.15 names, and CLI calls use the new commands",
835
835
  docs: "/docs/cli/codemod",
836
836
  effects: [FILES]
837
+ },
838
+ {
839
+ name: "0.29",
840
+ description: "Changes from 0.28 to 0.29: records is renamed back to subjects in the config, and record tags in the schema files become subject tags",
841
+ docs: "/docs/cli/codemod",
842
+ effects: [FILES]
837
843
  }
838
844
  ]
839
845
  }
@@ -1,5 +1,5 @@
1
- import { n as completionValues, o as listArgs, t as GLOBAL_ARGS, u as COMPLETE_COMMAND } from "./command-DIPmo0wh.js";
2
- import { o as isVariadic, r as commandArgs } from "./parse-BPf3kGnc.js";
1
+ import { n as completionValues, o as listArgs, t as GLOBAL_ARGS, u as COMPLETE_COMMAND } from "./command-CCAwhiOh.js";
2
+ import { o as isVariadic, r as commandArgs } from "./parse-DjHbTaFI.js";
3
3
  //#region src/cli/core/completion.ts
4
4
  const SHELLS = [
5
5
  "bash",
@@ -1 +1 @@
1
- export { n as complete, r as completionLines } from "./completion-DxPxMtyP.js";
1
+ export { n as complete, r as completionLines } from "./completion-BJaB84Pe.js";
@@ -1,6 +1,6 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as CliError } from "./errors-BTe6A15O.js";
3
- import { a as isShell, i as completionScript, t as SHELLS } from "./completion-DxPxMtyP.js";
3
+ import { a as isShell, i as completionScript, t as SHELLS } from "./completion-BJaB84Pe.js";
4
4
  //#region src/cli/commands/completion.ts
5
5
  const ARGS = { shell: {
6
6
  type: "positional",
@@ -1,4 +1,4 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as redact, r as redactUrl } from "./redact-KGAk2Ul9.js";
3
3
  import { t as display } from "./io-DH1kcmmP.js";
4
4
  import { n as presetInfo } from "./preset-BwmIfFnh.js";
@@ -1,6 +1,6 @@
1
1
  import { r as readIfExists } from "./io-DH1kcmmP.js";
2
- import { t as CACHE_DIR } from "./cache-BuoIFlUJ.js";
3
- import { x as installedVersion } from "./snapshot-B5LXkVMC.js";
2
+ import { t as CACHE_DIR } from "./cache-x2wWAy0h.js";
3
+ import { x as installedVersion } from "./snapshot-BlQ4DDcJ.js";
4
4
  import { t as i } from "./jsonc-D5Fu67jw.js";
5
5
  import { resolve } from "node:path";
6
6
  import { createHash } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
3
3
  import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
4
4
  import { t as display } from "./io-DH1kcmmP.js";
@@ -1,36 +1,36 @@
1
- import { a as list, m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { a as list, m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
- import { t as VERSION } from "./version-D2BQuqta.js";
3
+ import { t as VERSION } from "./version-Dz8ZlOuh.js";
4
4
  import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
5
5
  import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
6
6
  import { a as sameText, t as display } from "./io-DH1kcmmP.js";
7
- import { t as CACHE_DIR } from "./cache-BuoIFlUJ.js";
7
+ import { t as CACHE_DIR } from "./cache-x2wWAy0h.js";
8
8
  import { t as byCodePoint } from "./compare-BmIWVEui.js";
9
- import { C as satisfies, S as peerVersions, c as isSqliteLiteDriver, n as managementTarget, o as snapshotFile, r as openSource, s as liteDriverOf, t as loadSnapshot, u as MetadataRejectedError } from "./snapshot-B5LXkVMC.js";
10
- import { d as configFor, r as renderFiles, u as notNullTag } from "./render-CizUf3RW.js";
9
+ import { C as satisfies, S as peerVersions, c as isSqliteLiteDriver, n as managementTarget, o as snapshotFile, r as openSource, s as liteDriverOf, t as loadSnapshot, u as MetadataRejectedError } from "./snapshot-BlQ4DDcJ.js";
10
+ import { d as configFor, r as renderFiles, u as notNullTag } from "./render-QGWfEoiB.js";
11
11
  import { t as isRecord } from "./guards-CUlDNYZs.js";
12
- import { i as request } from "./source-BoLNG_2A.js";
12
+ import { i as request } from "./source-CelMBQMj.js";
13
13
  import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-Cskysxp-.js";
14
- import { a as compiledReadSets, d as providerLabel } from "./providers-dyxcHQY3.js";
14
+ import { a as compiledReadSets, d as providerLabel } from "./providers-DtI90lSw.js";
15
15
  import { a as findRepoRoot, c as httpHooks, d as readSupabaseToml, f as schemaPaths, h as tomlGet, i as diffEngine, l as migrationCommand, n as declarativeSchemasDir, p as sqlWorkflow, u as pgFunctionHooks } from "./supabase-toml-CncmQbO0.js";
16
16
  import { t as PROCESS_ENV } from "./env-BK0xKMeU.js";
17
17
  import { n as readStackStatus } from "./stack-status-BkkYRlXG.js";
18
18
  import { t as connect } from "./db-CQCLx7cx.js";
19
- import { a as hasContentMapper, c as supportsContentMappers, i as contentMapperSetup$1, n as TSCONFIG_SNIPPET, o as needsRunExternalCode, t as RUN_EXTERNAL_CODE } from "./content-mapper-BCtyfKXl.js";
19
+ import { a as hasContentMapper, c as supportsContentMappers, i as contentMapperSetup$1, n as TSCONFIG_SNIPPET, o as needsRunExternalCode, t as RUN_EXTERNAL_CODE } from "./content-mapper-DvOSOdTE.js";
20
20
  import { c as insideRoot, i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
21
- import { C as splinterTables, S as advisorRule, _ as withoutStrings, a as METADATA_GAPS_TEXT, b as appTablesOf, c as accessModule, d as RLS_RULES, f as appliesTo, g as policyHelpers, h as functionObject, l as entitlementsModule, m as functionBody, p as escape$2, s as AUTHORIZATION_RULES, u as COMMANDS$2, v as BLOCK_PREFIX, x as appViewsOf, y as blockTargets } from "./run-ChOY6s4o.js";
22
- import { n as migrationsDir, r as moduleLayoutFor, t as blockDeclaredTables } from "./sql-layout-zo02f3Dm.js";
23
- import { a as permissionCatalogKeys, i as lineOf, l as tableObject, n as exposed, o as policyObject, r as exposedSchemas, s as qualified, t as catalogOf, u as workflowOf } from "./shared-DV5wIv-7.js";
24
- import { i as migrationHolds, o as migrationModules, r as latestMigration, t as MODULES_SUFFIX } from "./module-migration-lbeUrsYv.js";
25
- import { o as wiringFor, r as configInstances, t as MIGRATION_SAFETY_RULES } from "./migration-safety-BfVeza5j.js";
21
+ import { C as splinterTables, S as advisorRule, _ as withoutStrings, a as METADATA_GAPS_TEXT, b as appTablesOf, c as accessModule, d as RLS_RULES, f as appliesTo, g as policyHelpers, h as functionObject, l as entitlementsModule, m as functionBody, p as escape$2, s as AUTHORIZATION_RULES, u as COMMANDS$2, v as BLOCK_PREFIX, x as appViewsOf, y as blockTargets } from "./run-DiYX1XEa.js";
22
+ import { n as migrationsDir, r as moduleLayoutFor, t as blockDeclaredTables } from "./sql-layout-Dp4Rottt.js";
23
+ import { a as permissionCatalogKeys, i as lineOf, l as tableObject, n as exposed, o as policyObject, r as exposedSchemas, s as qualified, t as catalogOf, u as workflowOf } from "./shared-D_CFi5di.js";
24
+ import { i as migrationHolds, o as migrationModules, r as latestMigration, t as MODULES_SUFFIX } from "./module-migration-CkNux8dr.js";
25
+ import { o as wiringFor, r as configInstances, t as MIGRATION_SAFETY_RULES } from "./migration-safety-nNyB05I-.js";
26
26
  import { t as orphanedBlockFiles } from "./orphans-BAboqyVM.js";
27
- import { i as reservedRoles, n as ident$1, r as literal$1, t as LIVE_RULES } from "./live-0G4Plw3K.js";
27
+ import { i as reservedRoles, n as ident$1, r as literal$1, t as LIVE_RULES } from "./live-DIt7TP-N.js";
28
28
  import { a as sourceFlags, n as SOURCE_ARGS } from "./source-args-v8ljFDfc.js";
29
29
  import { i as PLUGIN_SUBPATH_RENAMES, n as BLOCK_SUBPATH_RENAMES, o as SPEC_SUBPATH_RENAMES, t as BLOCK_EXPORT_RENAMES } from "./codemod-block-renames-BuSaTE_G.js";
30
30
  import { n as PLATFORM_SCHEMAS } from "./in-stack-diff-Cp-tVPj2.js";
31
31
  import { a as staleVariables, i as stackEnvValues, r as redactValue, t as PREFIX_NAMES } from "./stack-env-3ziggrU3.js";
32
32
  import { a as readSharedMemory, n as listStacks, t as branchName } from "./stacks-CiDBH1dB.js";
33
- import { i as refuseWithMetadata, r as readMetadataSnapshot } from "./metadata-VARUbXEe.js";
33
+ import { i as refuseWithMetadata, r as readMetadataSnapshot } from "./metadata-CannIjel.js";
34
34
  import { existsSync } from "node:fs";
35
35
  import { dirname, resolve } from "node:path";
36
36
  import { createHash } from "node:crypto";
@@ -2491,8 +2491,33 @@ function missingExtensions(context) {
2491
2491
  });
2492
2492
  });
2493
2493
  }
2494
- /** Statements in declarative schema files that pg-delta can't order. */
2494
+ const PGDELTA_PEERS = ["@supabase/pg-delta", "@supabase/pg-topo"];
2495
+ /**
2496
+ * The pg-delta peers `db diff` loads that a Supabase project on the pg-delta
2497
+ * workflow doesn't install.
2498
+ */
2499
+ function missingPeers(context) {
2500
+ if (context.peers === void 0 || pgdeltaToml(context) === void 0) return [];
2501
+ const installed = new Set(context.peers.flatMap((peer) => peer.installed === void 0 ? [] : [peer.name]));
2502
+ const missing = PGDELTA_PEERS.filter((name) => !installed.has(name));
2503
+ if (missing.length === 0) return [];
2504
+ return [{
2505
+ message: `The project diffs with pg-delta (database.sql.workflow), but ${missing.join(" and ")} ${missing.length === 1 ? "is" : "are"} not installed, so \`better-supabase db diff\` stops before it plans a migration. Install them: pnpm add -D ${PGDELTA_PEERS.join(" ")}`,
2506
+ target: missing.join(", ")
2507
+ }];
2508
+ }
2509
+ /**
2510
+ * The pg-delta peers, and statements in declarative schema files that pg-delta
2511
+ * can't order.
2512
+ */
2495
2513
  const PGDELTA_RULES = [
2514
+ {
2515
+ code: "BS239",
2516
+ severity: "warning",
2517
+ title: "pg-delta packages missing",
2518
+ description: "The project runs the pg-delta workflow, but `@supabase/pg-delta` or `@supabase/pg-topo` is not installed. `db diff` plans the migration with both, so it fails until they are.",
2519
+ check: missingPeers
2520
+ },
2496
2521
  {
2497
2522
  code: "BS317",
2498
2523
  severity: "warning",
@@ -0,0 +1 @@
1
+ export { n as envCommand } from "./env-XMiKvhtV.js";
@@ -1,4 +1,4 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { n as CliError } from "./errors-BTe6A15O.js";
3
3
  import { r as readIfExists, t as display } from "./io-DH1kcmmP.js";
4
4
  import { n as readStackStatus, t as parseStackStatus } from "./stack-status-BkkYRlXG.js";
@@ -1,22 +1,22 @@
1
- import { a as list, m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
1
+ import { a as list, m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
3
  import { a as parseNames, i as failedResult, n as CliError } from "./errors-BTe6A15O.js";
4
- import { u as catalogFingerprint } from "./cache-BuoIFlUJ.js";
5
- import { a as serializeSnapshot, g as serializeGenerator, h as restrictSchemas, o as snapshotFile, r as openSource, t as loadSnapshot } from "./snapshot-B5LXkVMC.js";
4
+ import { u as catalogFingerprint } from "./cache-x2wWAy0h.js";
5
+ import { a as serializeSnapshot, g as serializeGenerator, h as restrictSchemas, o as snapshotFile, r as openSource, t as loadSnapshot } from "./snapshot-BlQ4DDcJ.js";
6
6
  import { d as GEN_TASKS, p as isGenTask } from "./config-Cskysxp-.js";
7
7
  import { c as insideRoot, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
8
- import { n as runGen } from "./run-ChOY6s4o.js";
9
- import { n as dataMigration } from "./migrations-BCq7Zs2E.js";
10
- import { t as syncModules } from "./sync-m-oZ_SyI.js";
11
- import { t as addModules } from "./add-Dggyehsy.js";
12
- import { n as listModules, t as printModule } from "./print-DjxpBRnv.js";
8
+ import { n as runGen } from "./run-DiYX1XEa.js";
9
+ import { n as dataMigration } from "./migrations-bAd7dpk1.js";
10
+ import { t as syncModules } from "./sync-BnORI43S.js";
11
+ import { t as addModules } from "./add-B9wP0YGU.js";
12
+ import { n as listModules, t as printModule } from "./print-CxQ0rBKT.js";
13
13
  import { a as sourceFlags, i as sourceArgs, n as SOURCE_ARGS } from "./source-args-v8ljFDfc.js";
14
- import { a as runMetadataGen, n as checkMetadataFlags, t as EMITS } from "./metadata-VARUbXEe.js";
15
- import { a as runEnv } from "./env-B2CbnbzD.js";
16
- import { c as watchLoop, o as parseInterval, r as specOptionsFromConfig, s as stampFiles, t as runSpec } from "./spec-Dz-PGCaM.js";
17
- import { n as runPowerSync } from "./powersync-B15CfH5Y.js";
18
- import { t as runSeed } from "./seed-CDnL4Tnc.js";
19
- import { t as upgrade } from "./upgrade-C9sgVZ5z.js";
14
+ import { a as runMetadataGen, n as checkMetadataFlags, t as EMITS } from "./metadata-CannIjel.js";
15
+ import { a as runEnv } from "./env-XMiKvhtV.js";
16
+ import { c as watchLoop, o as parseInterval, r as specOptionsFromConfig, s as stampFiles, t as runSpec } from "./spec-iBx1LcYO.js";
17
+ import { n as runPowerSync } from "./powersync-B2v0tDwp.js";
18
+ import { t as runSeed } from "./seed-C-Hu2n_E.js";
19
+ import { t as upgrade } from "./upgrade-CR6-WmIc.js";
20
20
  import { existsSync } from "node:fs";
21
21
  import { resolve } from "node:path";
22
22
  //#region src/cli/commands/sql.ts
@@ -804,6 +804,6 @@ export declare function loadConfig(cwd: string, explicit?: string, environment?:
804
804
  }): Promise<ResolvedConfig>;
805
805
  //#endregion
806
806
  //#region src/cli/version.d.ts
807
- export declare const VERSION = "0.30.0";
807
+ export declare const VERSION = "0.31.0";
808
808
  //#endregion
809
809
  export type { Catalog, CatalogCheck, CatalogColumn, CatalogColumnGrant, CatalogEnum, CatalogForeignKey, CatalogFunction, CatalogFunctionArg, CatalogGrant, CatalogIndex, CatalogPolicy, CatalogTable, CatalogTrigger, CatalogUnique, Choice, Cli, CliArgs, CliCommand, CliCommandDef, CliContext, CliEnv, CliErrorCode, CliErrorOptions, CliIo, CliLog, CliProblem, CliProblemExtensions, CommandResult, CreateCliOptions, ExitCode, ExtrasFunction, ExtrasHook, ExtrasHookFunction, ExtrasTable, ForeignKeyAction, Format, GeneratorMetadata, IntrospectionSource, ManagementSourceOptions, NextStep, Paint, Prompter, Queryable, RunOptions, RunResult, Snapshot, SnapshotBucket, SnapshotExtras };
package/dist/cli/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { a as list, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
- import { i as run, n as createCli, r as help, t as commandNames } from "./run-MwM__teL.js";
3
- import { t as VERSION } from "./version-D2BQuqta.js";
1
+ import { a as list, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
+ import { i as run, n as createCli, r as help, t as commandNames } from "./run-BNoJKf5I.js";
3
+ import { t as VERSION } from "./version-Dz8ZlOuh.js";
4
4
  import { n as CliError, t as CLI_ERRORS_URL } from "./errors-BTe6A15O.js";
5
- import { a as serializeSnapshot, i as parseSnapshot, l as introspect, t as loadSnapshot } from "./snapshot-B5LXkVMC.js";
6
- import { a as emitBlockConfig, l as buildModel, o as GENERATED_HEADER, r as renderFiles, s as emitModule } from "./render-CizUf3RW.js";
7
- import { a as toCatalog, n as managementSource, r as pgSource } from "./source-BoLNG_2A.js";
5
+ import { a as serializeSnapshot, i as parseSnapshot, l as introspect, t as loadSnapshot } from "./snapshot-BlQ4DDcJ.js";
6
+ import { a as emitBlockConfig, l as buildModel, o as GENERATED_HEADER, r as renderFiles, s as emitModule } from "./render-QGWfEoiB.js";
7
+ import { a as toCatalog, n as managementSource, r as pgSource } from "./source-CelMBQMj.js";
8
8
  import { s as loadConfig } from "./config-Cskysxp-.js";
9
- import { n as runGen } from "./run-ChOY6s4o.js";
9
+ import { n as runGen } from "./run-DiYX1XEa.js";
10
10
  //#region src/cli/introspect/from-catalog.ts
11
11
  /**
12
12
  * Builds a snapshot from catalog records: the inverse of `toCatalog`. Tests and