better-supabase 0.29.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.
- package/dist/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/{app-tables-DekyKNQ8.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
- package/dist/astro/index.js +2 -2
- package/dist/{authorization-C7nuWMuB.d.ts → authorization-DfEkyFt_.d.ts} +24 -3
- package/dist/{bind-DmUGUsBd.d.ts → bind-DAx0bMSi.d.ts} +2 -2
- package/dist/{block-env-DWtZsqhH.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
- package/dist/blocks/ai-chat/index.d.ts +3 -3
- package/dist/blocks/announcements/index.d.ts +3 -3
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/attachments/index.d.ts +1 -1
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/automations/index.d.ts +1 -1
- package/dist/blocks/billing/index.d.ts +1 -1
- package/dist/blocks/bookings/index.d.ts +1 -1
- package/dist/blocks/calendar/index.d.ts +7 -3
- package/dist/blocks/calendar/index.js +5 -1
- package/dist/blocks/comments/index.d.ts +4 -4
- package/dist/blocks/employees/index.js +1 -4
- package/dist/blocks/entitlements/index.d.ts +2 -2
- package/dist/blocks/forms/index.d.ts +1 -1
- package/dist/blocks/inbox/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/messaging/index.d.ts +4 -4
- package/dist/blocks/mfa/index.d.ts +1 -1
- package/dist/blocks/notifications/index.d.ts +3 -3
- package/dist/blocks/notifications/index.js +5 -43
- package/dist/blocks/onboarding/index.d.ts +1 -1
- package/dist/blocks/organizations/index.d.ts +34 -21
- package/dist/blocks/organizations/index.js +5 -1
- package/dist/blocks/permissions/index.d.ts +32 -3
- package/dist/blocks/permissions/index.js +23 -2
- package/dist/blocks/push/index.d.ts +10 -2
- package/dist/blocks/push/index.js +23 -7
- package/dist/blocks/reactions/index.d.ts +3 -3
- package/dist/blocks/saved-views/index.d.ts +1 -1
- package/dist/blocks/search/index.d.ts +2 -2
- package/dist/blocks/sessions/index.d.ts +1 -1
- package/dist/blocks/settings/index.d.ts +1 -1
- package/dist/blocks/subjects/index.d.ts +1 -1
- package/dist/blocks/tags/index.d.ts +1 -1
- package/dist/blocks/tasks/index.js +1 -1
- package/dist/blocks/teams/index.d.ts +7 -1
- package/dist/blocks/teams/index.js +8 -7
- package/dist/blocks/undo/index.d.ts +1 -1
- package/dist/blocks/usage/index.d.ts +1 -1
- package/dist/blocks/workflow-editor/index.d.ts +3 -3
- package/dist/blocks/workflows/index.d.ts +3 -3
- package/dist/cli/{add-BKkV99g9.js → add-B9wP0YGU.js} +2 -2
- package/dist/cli/{add-CrQ3jS7t.js → add-DjZXKd7X.js} +10 -10
- package/dist/cli/add-ZcEOEK23.js +1 -0
- package/dist/cli/{app-table-files-PnPOpuB4.js → app-table-files-mtvjHa48.js} +2 -2
- package/dist/cli/{backfill-DDDLhinm.js → backfill-Coshdvh_.js} +2 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-tRfYx_mh.js → blocks-BWCuA0nq.js} +2 -2
- package/dist/cli/{blocks-BCVcjvbm.js → blocks-hiSazThw.js} +1 -1
- package/dist/cli/{cache-DQZ09YOg.js → cache-x2wWAy0h.js} +1 -1
- package/dist/cli/{codemod-HKuwQmi_.js → codemod-BnjV7BpC.js} +210 -11
- package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
- package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
- package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
- package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
- package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
- package/dist/cli/{content-mapper-B0ehR7K-.js → content-mapper-DvOSOdTE.js} +2 -2
- package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
- package/dist/cli/{doctor-CXJOhwLB.js → doctor-Ywy8oJEU.js} +76 -18
- package/dist/cli/env-CNjT_uOV.js +1 -0
- package/dist/cli/{env-BM242BCV.js → env-XMiKvhtV.js} +2 -2
- package/dist/cli/{gen-B7rw4j19.js → gen-B-FbQmG1.js} +14 -14
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-C1bXXB_P.js → init-fb9e1BKX.js} +9 -9
- package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
- package/dist/cli/{live-PpAh9pAc.js → live-DIt7TP-N.js} +2 -2
- package/dist/cli/{mcp-BRNAchdH.js → mcp-CVWwraga.js} +3 -3
- package/dist/cli/{metadata-dAAKb_kR.js → metadata-CannIjel.js} +3 -3
- package/dist/cli/{migrate-BWYXFnaW.js → migrate-Ht2TzIQF.js} +2 -2
- package/dist/cli/{migration-safety-DGQswWZy.js → migration-safety-nNyB05I-.js} +1 -1
- package/dist/cli/{migrations-Cqk-lJwu.js → migrations-bAd7dpk1.js} +2 -2
- package/dist/cli/{module-migration-8-hMiZtW.js → module-migration-CkNux8dr.js} +2 -2
- package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
- package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
- package/dist/cli/{powersync-BWQ-8T3G.js → powersync-B2v0tDwp.js} +100 -7
- package/dist/cli/powersync-D3mAQ6QE.js +1 -0
- package/dist/cli/{print-DSTnq5xz.js → print-CxQ0rBKT.js} +2 -2
- package/dist/cli/{providers-Cjf5iOp5.js → providers-DtI90lSw.js} +1 -1
- package/dist/cli/{remove-CwG8cPv1.js → remove-DYtE4IZ4.js} +6 -6
- package/dist/cli/{render-B18iAdsT.js → render-QGWfEoiB.js} +3 -3
- package/dist/cli/{run-CvPl8iQd.js → run-B5aMwErM.js} +3 -3
- package/dist/cli/{run-C2Yg5MWt.js → run-BNoJKf5I.js} +40 -39
- package/dist/cli/{run-Wx_2Acgv.js → run-DiYX1XEa.js} +8 -8
- package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
- package/dist/cli/seed-Cm-c0BDd.js +1 -0
- package/dist/cli/{shared-BHbtUOvh.js → shared-D_CFi5di.js} +1 -1
- package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
- package/dist/cli/{snapshot-CXgsUPGj.js → snapshot-BlQ4DDcJ.js} +9 -4
- package/dist/cli/{source-B6aMAoEK.js → source-CelMBQMj.js} +1 -1
- package/dist/cli/{spec-EO0TP84d.js → spec-BxcoGE0h.js} +1 -1
- package/dist/cli/{spec-BcYic005.js → spec-iBx1LcYO.js} +3 -3
- package/dist/cli/{sql-layout-CkxDNVEH.js → sql-layout-Dp4Rottt.js} +2 -2
- package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
- package/dist/cli/{stack-env-6hS-WEmh.js → stack-env-3ziggrU3.js} +1 -1
- package/dist/cli/{sync-pq6gmlhG.js → sync-BnORI43S.js} +4 -4
- package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
- package/dist/cli/{upgrade-Dp9p7A69.js → upgrade-CR6-WmIc.js} +5 -5
- package/dist/cli/{upgrade-BoHb4h9P.js → upgrade-fz92aCnh.js} +3 -3
- package/dist/cli/{version-CQHFm-ak.js → version-Dz8ZlOuh.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +4 -4
- package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
- package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
- package/dist/{context-B4TsE2gY.d.ts → context-DWWoP1wK.d.ts} +13 -1
- package/dist/{controller-CtwAsnVV.d.ts → controller-Br9dGKGe.d.ts} +1 -1
- package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +3 -3
- package/dist/create/lite/index.js +3 -3
- package/dist/delivery-events-DbL8IHIY.js +53 -0
- package/dist/edge/index.js +3 -3
- package/dist/{entitlements-Bw3eYGKJ.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
- package/dist/eve/index.js +1 -1
- package/dist/expo/index.js +3 -2
- package/dist/{field-errors-DkzFduux.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
- package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/{index-CB66nl14.d.ts → index-Clyd2Goi.d.ts} +1 -1
- package/dist/{index-Cw5gGSP8.d.ts → index-D98bQs8a.d.ts} +7 -7
- package/dist/{index-BNgpz_BV.d.ts → index-DIdPoQtO.d.ts} +2 -2
- package/dist/{index-BxckmAFc.d.ts → index-I8YLxKq8.d.ts} +2 -2
- package/dist/{index-CBQT_nXf.d.ts → index-eRBuKtMt.d.ts} +2 -2
- package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
- package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/next/index.d.ts +155 -13
- package/dist/next/index.js +245 -52
- package/dist/{operations-CqmQrTKw.d.ts → operations-hm1Isvvs.d.ts} +1 -1
- package/dist/{options-C4LuqmdG.js → options-CF6EVF_G.js} +3 -1
- package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
- package/dist/orpc/index.js +2 -1
- package/dist/otel/index.js +4 -4
- package/dist/{ports-6LBgr1Aa.d.ts → ports-DOrPTJzl.d.ts} +1 -1
- package/dist/powersync/index.d.ts +204 -4
- package/dist/powersync/index.js +361 -4
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
- package/dist/{project-C4NA_van.js → project-DJ9Uo0sT.js} +5 -5
- package/dist/{push-token-BXsrJ7W9.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
- package/dist/react-router/index.js +2 -2
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
- package/dist/records/index.d.ts +5 -5
- package/dist/records/index.js +3 -3
- package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
- package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
- package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +4 -4
- package/dist/sign-in-BzihC_8k.d.ts +50 -0
- package/dist/{sign-in-NO7LWlw4.js → sign-in-CuZ1Ag7O.js} +136 -26
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.js +1 -1
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +3 -3
- package/dist/{sql-CoBySj2F.js → sql-DHp0L7zK.js} +680 -333
- package/dist/ssr/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-Ded341Qz.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
- package/dist/testing/index.d.ts +13 -4
- package/dist/testing/index.js +17 -15
- package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
- package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
- package/dist/{topic-XDdKzlrn.d.ts → topic-BaUElNw2.d.ts} +1 -1
- package/dist/{types-BFwB-E1j.d.ts → types-CMN0h_Ix.d.ts} +2 -2
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-DpN_GEoS.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
- package/dist/workflow-sdk/world/index.js +2 -2
- package/dist/{workflow-sdk-CaEw822d.js → workflow-sdk-DJJkP0dT.js} +47 -8
- package/dist/yjs/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +10 -1
- package/schemas/doctor-report-v1.json +2 -0
- package/skills/better-supabase/references/ui-recipes.md +524 -295
- package/skills/better-supabase-api/references/powersync.md +16 -0
- package/skills/better-supabase-auth/SKILL.md +11 -1
- package/dist/cli/add-CwhrRJz5.js +0 -1
- package/dist/cli/env-uqfUbUzk.js +0 -1
- package/dist/cli/powersync-CbYxLsjv.js +0 -1
- package/dist/cli/seed-BOun22-k.js +0 -1
- package/dist/sign-in-CfwJAJJL.d.ts +0 -24
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { a as list, m as commandMeta, r as defineCliCommand } from "./command-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
16
|
-
import { t as addModules } from "./add-
|
|
17
|
-
import { t as appTablePlan } from "./app-table-files-
|
|
18
|
-
import { t as blockNames } from "./blocks-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import { m as commandMeta, r as defineCliCommand } from "./command-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
2
|
-
import { o as isVariadic, r as commandArgs } from "./parse-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
3
|
-
import { x as installedVersion } from "./snapshot-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
10
|
-
import { d as configFor, r as renderFiles, u as notNullTag } from "./render-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
22
|
-
import { n as migrationsDir, r as moduleLayoutFor, t as blockDeclaredTables } from "./sql-layout-
|
|
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-
|
|
24
|
-
import { i as migrationHolds, o as migrationModules, r as latestMigration, t as MODULES_SUFFIX } from "./module-migration-
|
|
25
|
-
import { o as wiringFor, r as configInstances, t as MIGRATION_SAFETY_RULES } from "./migration-safety-
|
|
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-
|
|
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
|
-
import {
|
|
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-
|
|
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";
|
|
@@ -46,6 +46,16 @@ const PUBLIC_PREFIXES = [
|
|
|
46
46
|
"EXPO_PUBLIC_",
|
|
47
47
|
"NUXT_PUBLIC_"
|
|
48
48
|
];
|
|
49
|
+
/** `SUPABASE_URL`, plain or with a browser prefix. */
|
|
50
|
+
const URL_VARIABLE = new RegExp(`^(?:${PUBLIC_PREFIXES.join("|")})?SUPABASE_URL$`);
|
|
51
|
+
/** The URL without a trailing slash, `null` for a value that isn't one. */
|
|
52
|
+
function normalizedUrl(value) {
|
|
53
|
+
try {
|
|
54
|
+
return new URL(value).href.replace(/\/+$/, "");
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
49
59
|
function envEntries(file) {
|
|
50
60
|
return file.text.split("\n").flatMap((raw, index) => {
|
|
51
61
|
const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(raw);
|
|
@@ -89,7 +99,10 @@ async function loadStackEnvCheck(root, env, signal) {
|
|
|
89
99
|
return { skipped: errorText(cause) };
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Checks on env files and the variables the shell exports (BS501 to BS503 and
|
|
104
|
+
* BS506).
|
|
105
|
+
*/
|
|
93
106
|
const ENV_RULES = [
|
|
94
107
|
{
|
|
95
108
|
code: "BS501",
|
|
@@ -139,6 +152,26 @@ const ENV_RULES = [
|
|
|
139
152
|
target: stale.variable,
|
|
140
153
|
message: `${stale.message} Unset it or start the app with better-supabase dev run -- <cmd>.`
|
|
141
154
|
}))
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
code: "BS506",
|
|
158
|
+
severity: "warning",
|
|
159
|
+
title: "Server and browser Supabase URLs differ",
|
|
160
|
+
description: "The session cookie name comes from the project URL. When SUPABASE_URL and a browser-prefixed spelling such as NEXT_PUBLIC_SUPABASE_URL point at different URLs, the server and the browser client read different cookies, and a sign-in on one side is invisible to the other. Use one URL, or set auth.cookie.name on both clients when the split is intended (a custom domain in the browser, the project URL on the server).",
|
|
161
|
+
check: (context) => context.envFiles.flatMap((file) => {
|
|
162
|
+
const urls = envEntries(file).filter((entry) => URL_VARIABLE.test(entry.key) && entry.value !== "");
|
|
163
|
+
const [server] = urls;
|
|
164
|
+
if (!server) return [];
|
|
165
|
+
const expected = normalizedUrl(server.value);
|
|
166
|
+
return urls.filter((entry) => expected !== null && normalizedUrl(entry.value) !== null && normalizedUrl(entry.value) !== expected).map((entry) => ({
|
|
167
|
+
message: `${entry.key} in ${file.path} (${redactValue(entry.value)}) differs from ${server.key} (${redactValue(server.value)}). The server and the browser then read different session cookies. Use one URL, or set auth.cookie.name on both clients.`,
|
|
168
|
+
target: `${file.path}:${entry.key}`,
|
|
169
|
+
location: {
|
|
170
|
+
file: file.path,
|
|
171
|
+
line: entry.line
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
})
|
|
142
175
|
}
|
|
143
176
|
];
|
|
144
177
|
//#endregion
|
|
@@ -2458,8 +2491,33 @@ function missingExtensions(context) {
|
|
|
2458
2491
|
});
|
|
2459
2492
|
});
|
|
2460
2493
|
}
|
|
2461
|
-
|
|
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
|
+
*/
|
|
2462
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
|
+
},
|
|
2463
2521
|
{
|
|
2464
2522
|
code: "BS317",
|
|
2465
2523
|
severity: "warning",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as envCommand } from "./env-XMiKvhtV.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { m as commandMeta, r as defineCliCommand } from "./command-
|
|
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";
|
|
5
5
|
import { c as insideRoot, i as changeLines, n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
|
|
6
6
|
import { r as publicPrefix, t as detectProject } from "./detect-D9JaAX20.js";
|
|
7
|
-
import {
|
|
7
|
+
import { i as stackEnvValues, n as prefixFromFlag } from "./stack-env-3ziggrU3.js";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { resolve } from "node:path";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { a as list, m as commandMeta, r as defineCliCommand } from "./command-
|
|
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-
|
|
5
|
-
import { a as serializeSnapshot, g as serializeGenerator, h as restrictSchemas, o as snapshotFile, r as openSource, t as loadSnapshot } from "./snapshot-
|
|
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-
|
|
9
|
-
import { n as dataMigration } from "./migrations-
|
|
10
|
-
import { t as syncModules } from "./sync-
|
|
11
|
-
import { t as addModules } from "./add-
|
|
12
|
-
import { n as listModules, t as printModule } from "./print-
|
|
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-
|
|
15
|
-
import { a as runEnv } from "./env-
|
|
16
|
-
import { c as watchLoop, o as parseInterval, r as specOptionsFromConfig, s as stampFiles, t as runSpec } from "./spec-
|
|
17
|
-
import { n as runPowerSync } from "./powersync-
|
|
18
|
-
import { t as runSeed } from "./seed-
|
|
19
|
-
import { t as upgrade } from "./upgrade-
|
|
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
|