better-supabase 0.25.0 → 0.28.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/{access-sql-bjWFUWlk.js → access-sql-CTDNuxRv.js} +177 -12
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/{app-tables-xij_MI5H.d.ts → app-tables-62GqZIhd.d.ts} +1 -1
- package/dist/{authorization-BJV2i8xB.d.ts → authorization-BCG1v0iC.d.ts} +24 -3
- package/dist/{bind-vKDmdu_4.d.ts → bind-C54jD0r3.d.ts} +1 -1
- package/dist/{block-env-wVLz0KMV.d.ts → block-env-CM-LFfj4.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 +1 -1
- package/dist/blocks/comments/index.d.ts +4 -4
- package/dist/blocks/custom-fields/index.js +1 -1
- package/dist/blocks/drive/index.d.ts +1 -1
- package/dist/blocks/employees/index.js +1 -1
- 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/onboarding/index.d.ts +1 -1
- package/dist/blocks/organizations/index.d.ts +2 -2
- package/dist/blocks/permissions/index.d.ts +1 -1
- package/dist/blocks/push/index.d.ts +1 -1
- package/dist/blocks/reactions/index.d.ts +3 -3
- package/dist/blocks/reminders/index.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/blocks/tasks/index.js +1 -1
- 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-C2pNvVpu.js → add-BKcE_g9D.js} +2 -2
- package/dist/cli/{add-BTVrOGJF.js → add-DUyg9qna.js} +40 -15
- package/dist/cli/add-pDOlqWUa.js +1 -0
- package/dist/cli/{backfill-BicVPugb.js → backfill-r9RELEEh.js} +4 -4
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-sScN-ik-.js → blocks-DTOFdrxL.js} +1 -1
- package/dist/cli/{blocks-BmYOH4T-.js → blocks-k1OG8XDs.js} +2 -2
- package/dist/cli/{cache-1TfBy2K4.js → cache-Czfw7Iow.js} +1 -1
- package/dist/cli/{codemod-ylE6wGLo.js → codemod-ClmbiLuL.js} +3 -3
- package/dist/cli/{command-BWEEXmtz.js → command-CVzTJSLp.js} +31 -0
- package/dist/cli/{completion-8EDK21xj.js → completion-CNCqE-Gb.js} +1 -1
- package/dist/cli/{completion-BfnKI4QZ.js → completion-Dpk6vh0p.js} +2 -2
- package/dist/cli/{completion-Bt7LMypX.js → completion-DxEXxFpz.js} +2 -2
- package/dist/cli/{config-CeaQMrvS.js → config-D2YUlzrl.js} +1 -1
- package/dist/cli/{config-WKDixoGK.js → config-EjNj3HfT.js} +1 -1
- package/dist/cli/{config-BVfeG3A5.js → config-KvV-sLZL.js} +290 -10
- package/dist/cli/{content-mapper-hUW2nb92.js → content-mapper-ez_mT0d4.js} +2 -2
- package/dist/cli/{db-DwjyUbAh.js → db-uYN6O5Eg.js} +38 -14
- package/dist/cli/{doctor-D3WKFBSv.js → doctor-BD9oo4MG.js} +31 -28
- package/dist/cli/{env-DMgjB_4y.js → env-BK0xKMeU.js} +1 -2
- package/dist/cli/{env-C-Bl6Awn.js → env-Bat6ogep.js} +1 -1
- package/dist/cli/env-Cy2lWBRC.js +1 -0
- package/dist/cli/{env-BCgVZkcb.js → env-DEAtgGoj.js} +2 -2
- package/dist/cli/{exec--Q1ZEWUW.js → exec-Ca5s-ygi.js} +1 -1
- package/dist/cli/{gen-CqsUdsB2.js → gen-8Ya8n2sA.js} +16 -16
- package/dist/cli/in-stack-diff-Cp-tVPj2.js +186 -0
- package/dist/cli/index.d.ts +1 -2
- package/dist/cli/index.js +8 -8
- package/dist/cli/{init-DryZ5Mp1.js → init-DgL3sDfQ.js} +118 -11
- package/dist/cli/{keys-CbaL0lnw.js → keys-CsanNk-2.js} +1 -1
- package/dist/cli/{live-Di45imoV.js → live-CMMEct_F.js} +2 -2
- package/dist/cli/{mcp-BklC-3eK.js → mcp-DEHtzAkq.js} +4 -4
- package/dist/cli/{metadata-7PsBF5Xw.js → metadata-BZh-cOzC.js} +3 -3
- package/dist/cli/migrate-sVs1QYTM.js +306 -0
- package/dist/cli/{migration-safety-Doy9qYO8.js → migration-safety-ClnYNMdq.js} +2 -2
- package/dist/cli/migrations-DWh38tO9.js +117 -0
- package/dist/cli/{module-migration-ZIn1NCMi.js → module-migration-CXfRJIV4.js} +2 -2
- package/dist/cli/{moved-DVwgE8lV.js → moved-Cnb4fp49.js} +1 -1
- package/dist/cli/{parse-B079x40m.js → parse-BWM6IGhF.js} +1 -1
- package/dist/cli/powersync-DURhWDVc.js +1 -0
- package/dist/cli/{powersync-BRGXOCJ0.js → powersync-Dnyr-Wy5.js} +4 -3
- package/dist/cli/{print-Dfqd4DB-.js → print-DJrSr56b.js} +2 -2
- package/dist/cli/{migrations-JtsPYv8g.js → providers-CpaISitn.js} +4 -116
- package/dist/cli/{remove-CQzSCYTu.js → remove-ChaieK3t.js} +6 -6
- package/dist/cli/{render-DWRz-uPQ.js → render-DUNJ4Pss.js} +8 -5
- package/dist/cli/{run-DPLedqTF.js → run-ChCQPYOh.js} +41 -39
- package/dist/cli/{run-j54rk2w-.js → run-Cl9COGuy.js} +10 -10
- package/dist/cli/{run-DmOTMa44.js → run-CxFDjL1Q.js} +4 -4
- package/dist/cli/seed-BJ7c-ktX.js +1 -0
- package/dist/cli/{seed-BMynpMPy.js → seed-BzVLTdRl.js} +3 -3
- package/dist/cli/{shared-CslNcs-R.js → shared-5uqc1GBj.js} +1 -1
- package/dist/cli/{skills-FXAVPLzp.js → skills-0gz_qjVb.js} +1 -1
- package/dist/cli/{snapshot-DdN5GlhH.js → snapshot-DdAP7LWO.js} +3 -3
- package/dist/cli/{source-COARbqch.js → source-2irbWSck.js} +1 -1
- package/dist/cli/{source-args-CDmmFmFG.js → source-args-DAcQt-Mh.js} +1 -1
- package/dist/cli/{spec-CgLNZc_C.js → spec-B7n4Rthp.js} +3 -3
- package/dist/cli/{spec-DIhBQlBF.js → spec-_MS0ym5r.js} +1 -1
- package/dist/cli/{sql-layout-8jrP5gIa.js → sql-layout-DYKkQw1k.js} +21 -7
- package/dist/cli/{stack-DgASZP0K.js → stack-CteM33gC.js} +3 -3
- package/dist/cli/{stack-status-B_Ipd_-z.js → stack-status-BkkYRlXG.js} +1 -1
- package/dist/cli/{stacks-BYlQ96WS.js → stacks-CiDBH1dB.js} +1 -1
- package/dist/cli/{sync-SqyVHRSJ.js → sync-DnSOrQuA.js} +4 -3
- package/dist/cli/table-DeH8X0qz.js +89 -0
- package/dist/cli/{upgrade-CY-vj_qh.js → upgrade-CWdrC-K3.js} +5 -4
- package/dist/cli/{upgrade-D0aLhluU.js → upgrade-cMy5fKkg.js} +3 -3
- package/dist/cli/{version-Bhca9D6q.js → version-C5RAWmrD.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +4 -4
- package/dist/{config-CP-WaboC.js → config-CTeR7XHK.js} +3 -3
- package/dist/{config-C19McoGo.js → config-CvJHIy5q.js} +1 -1
- package/dist/{context-BJoHD20l.d.ts → context-BFEX0b7H.d.ts} +106 -3
- package/dist/{controller-CwGXms17.d.ts → controller-Cl6HmMBk.d.ts} +1 -1
- package/dist/create/index.d.ts +62 -3
- package/dist/create/index.js +67 -4
- package/dist/create/lite/index.d.ts +140 -3
- package/dist/create/lite/index.js +399 -47
- package/dist/{entitlements-CsZcfllV.d.ts → entitlements-Y-n4RGAd.d.ts} +1 -1
- package/dist/{field-errors-6BVg31Yp.d.ts → field-errors-Btn3czyz.d.ts} +4 -4
- package/dist/{index-Cagz4Z2k.d.ts → index-8wOL81rB.d.ts} +1 -1
- package/dist/{index-D01wHGSN.d.ts → index-C0_cweyT.d.ts} +6 -6
- package/dist/{index-CbUCGMqj.d.ts → index-CAY7rIQs.d.ts} +2 -2
- package/dist/{index-DOHx3JuB.d.ts → index-DPMVWm_Z.d.ts} +2 -2
- package/dist/{index-C0QuN9_P.d.ts → index-k-SyCzcQ.d.ts} +104 -119
- package/dist/{instances-qz2MCMyK.js → instances-C7qUTjhJ.js} +1 -1
- package/dist/mapper/bin.js +7 -7
- package/dist/mcp/index.d.ts +1 -1
- package/dist/next/index.d.ts +3 -3
- package/dist/{operations-CPhOcuzl.d.ts → operations-DE7SOBw-.d.ts} +1 -1
- package/dist/{options-BOGo1qCA.js → options-B5E2MGIz.js} +3 -1
- package/dist/{options-D2s7fT1s.js → options-COo7_3MX.js} +2 -1
- package/dist/{options-D32-YxnO.js → options-DhoLMknl.js} +3 -1
- package/dist/otel/index.js +4 -4
- package/dist/{ports-Bw7uxPd_.d.ts → ports-DP0bthUk.d.ts} +1 -1
- package/dist/powersync/index.d.ts +2 -2
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-BbSWLoXM.js → preset-DwuWNBip.js} +2 -2
- package/dist/{project-TN03XDsA.js → project-Bo1vZqVs.js} +5 -5
- package/dist/{push-token-vykw2JXT.d.ts → push-token-v3xCcVU7.d.ts} +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/realtime/index.d.ts +3 -3
- package/dist/realtime/index.js +1 -1
- package/dist/records/index.d.ts +3 -3
- package/dist/{resolved-names-Dsf28_Dr.js → resolved-names-iLBOUaib.js} +2 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/solid/index.d.ts +5 -5
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +5 -5
- package/dist/{sql-Dg3W1ENk.js → sql-B7vBP9g0.js} +3577 -1246
- package/dist/ssr/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/{subjects-NomQg6Eg.d.ts → subjects-BYCL-6hA.d.ts} +15 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/{tenant-BRmKZ7aq.d.ts → tenant-CyLEXgot.d.ts} +1 -1
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +2 -2
- package/dist/{topic-CpsKVBot.d.ts → topic-B_DGdAEs.d.ts} +1 -1
- package/dist/{topic-F0FKzJyQ.js → topic-DnsNG4Kj.js} +1 -1
- package/dist/{types-CjRwmCRP.d.ts → types-DF8JYEf5.d.ts} +2 -2
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-BaMZX139.d.ts → watch-topic-1zIAtiNM.d.ts} +1 -1
- package/dist/workflow-sdk/world/index.js +1 -1
- package/dist/{workflow-sdk-CE8sEK57.js → workflow-sdk-CaEw822d.js} +25 -4
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/index.js +1 -1
- package/package.json +11 -1
- package/schemas/config-v1.json +42 -0
- package/dist/cli/add-Bf1fyCWm.js +0 -1
- package/dist/cli/env-xhwXk5Ri.js +0 -1
- package/dist/cli/in-stack-diff-DQTW53Vf.js +0 -257
- package/dist/cli/powersync-Dq-txa0_.js +0 -1
- package/dist/cli/seed-CO3j_bly.js +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
|
|
2
2
|
import { n as importPath } from "./io-DH1kcmmP.js";
|
|
3
|
-
import { i as cachedTypesModule, n as cachedDatabaseTypes, s as typesModuleKey } from "./cache-
|
|
3
|
+
import { i as cachedTypesModule, n as cachedDatabaseTypes, s as typesModuleKey } from "./cache-Czfw7Iow.js";
|
|
4
4
|
import { t as byCodePoint } from "./compare-BmIWVEui.js";
|
|
5
|
-
import { f as generateDatabaseTypes, h as restrictSchemas, p as oxfmtInstalled, v as tsTypeOf } from "./snapshot-
|
|
5
|
+
import { f as generateDatabaseTypes, h as restrictSchemas, p as oxfmtInstalled, v as tsTypeOf } from "./snapshot-DdAP7LWO.js";
|
|
6
6
|
import { t as isRecord$1 } from "./guards-CUlDNYZs.js";
|
|
7
|
-
import { a as toCatalog } from "./source-
|
|
7
|
+
import { a as toCatalog } from "./source-2irbWSck.js";
|
|
8
|
+
import { m as withTableTags } from "./config-KvV-sLZL.js";
|
|
8
9
|
import { basename, dirname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
9
10
|
import { entityNames } from "better-supabase/blocks";
|
|
10
11
|
import { DEFAULT_CLAIMS, blockEntities, blockEntityRenames, blockSubjectTypes, tenantClaimPaths, tenantNameOf } from "better-supabase/config";
|
|
@@ -248,7 +249,7 @@ function literalPart(text) {
|
|
|
248
249
|
/** Permission keys by owner (block, subject or app table), then action. */
|
|
249
250
|
function permissionGroups(config) {
|
|
250
251
|
const groups = {};
|
|
251
|
-
for (const entry of modulePermissionKeys(config.blocks, config.blockNames)) groups[entry.module] = {
|
|
252
|
+
for (const entry of modulePermissionKeys(config.blocks, config.blockNames, config.subjects)) groups[entry.module] = {
|
|
252
253
|
...groups[entry.module],
|
|
253
254
|
[entry.action]: entry.key
|
|
254
255
|
};
|
|
@@ -1569,6 +1570,7 @@ function blockConfigEntries(config) {
|
|
|
1569
1570
|
const layout = {
|
|
1570
1571
|
modules: config.blocks,
|
|
1571
1572
|
instances: config.instances,
|
|
1573
|
+
subjects: config.subjects,
|
|
1572
1574
|
...config.sql.scope === void 0 ? {} : { scope: config.sql.scope }
|
|
1573
1575
|
};
|
|
1574
1576
|
const entry = generatedEntry({
|
|
@@ -2112,7 +2114,8 @@ async function renderFiles(config, snapshot, options = {}) {
|
|
|
2112
2114
|
async function renderTypesModule(config, snapshot, configText) {
|
|
2113
2115
|
return cachedTypesModule(config.root, config.output, typesModuleKey(config, configText, snapshot), async () => (await render(config, snapshot, { typesModule: true })).typesModule ?? "");
|
|
2114
2116
|
}
|
|
2115
|
-
async function render(
|
|
2117
|
+
async function render(declared, snapshot, options = {}) {
|
|
2118
|
+
const config = withTableTags(declared, snapshot.generator.tables);
|
|
2116
2119
|
const model = buildModel(snapshot, config);
|
|
2117
2120
|
const runtime = options.runtimeImport ? { runtimeImport: options.runtimeImport } : {};
|
|
2118
2121
|
const output = resolve(config.root, config.output);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as COMMANDS, d as GROUPS, f as RESERVED_NAMES, h as runCommand, i as joinRepeated, m as parseArgs$2, o as listArgs, s as runsWithInvalidConfig, t as GLOBAL_ARGS, u as DOCS_ORIGIN } from "./command-
|
|
1
|
+
import { c as COMMANDS, d as GROUPS, f as RESERVED_NAMES, h as runCommand, i as joinRepeated, m as parseArgs$2, o as listArgs, s as runsWithInvalidConfig, t as GLOBAL_ARGS, u as DOCS_ORIGIN } from "./command-CVzTJSLp.js";
|
|
2
2
|
import { n as highlight, r as painter } from "./style-Bm2X5JrN.js";
|
|
3
|
-
import { t as VERSION } from "./version-
|
|
3
|
+
import { t as VERSION } from "./version-C5RAWmrD.js";
|
|
4
4
|
import { n as CliError, o as toCliError } from "./errors-BTe6A15O.js";
|
|
5
5
|
import { a as missingInputNext, o as resolveAgent, t as checkConsent } from "./agent-CbuPvI2x.js";
|
|
6
|
-
import { a as globalFlags, c as resolveCommand, i as commandTree, n as closestName, o as isVariadic, r as commandArgs, t as checkArgs } from "./parse-
|
|
7
|
-
import { n as movedCommand, r as movedFlag } from "./moved-
|
|
6
|
+
import { a as globalFlags, c as resolveCommand, i as commandTree, n as closestName, o as isVariadic, r as commandArgs, t as checkArgs } from "./parse-BWM6IGhF.js";
|
|
7
|
+
import { n as movedCommand, r as movedFlag } from "./moved-Cnb4fp49.js";
|
|
8
8
|
import { n as HTTP_CHANNEL, t as EXEC_CHANNEL } from "./trace-VbdO6bcN.js";
|
|
9
9
|
import { stripVTControlCharacters } from "node:util";
|
|
10
10
|
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
@@ -16,38 +16,40 @@ import { resolve } from "node:path";
|
|
|
16
16
|
* loads on demand, so `--version` and `--help` import no command.
|
|
17
17
|
*/
|
|
18
18
|
const LOADERS = [
|
|
19
|
-
["init", () => import("./init-
|
|
20
|
-
["add", () => import("./add-
|
|
21
|
-
["remove", () => import("./remove-
|
|
22
|
-
["upgrade", () => import("./upgrade-
|
|
23
|
-
["
|
|
24
|
-
["
|
|
25
|
-
["
|
|
26
|
-
["
|
|
27
|
-
["db
|
|
28
|
-
["db
|
|
29
|
-
["
|
|
30
|
-
["
|
|
31
|
-
["dev
|
|
32
|
-
["dev
|
|
33
|
-
["dev
|
|
34
|
-
["
|
|
35
|
-
["
|
|
36
|
-
["blocks
|
|
37
|
-
["
|
|
38
|
-
["
|
|
39
|
-
["
|
|
40
|
-
["
|
|
41
|
-
["
|
|
42
|
-
["
|
|
43
|
-
["
|
|
44
|
-
["
|
|
45
|
-
["codemod 0.
|
|
46
|
-
["codemod 0.
|
|
47
|
-
["codemod 0.
|
|
48
|
-
["codemod 0.
|
|
49
|
-
["
|
|
50
|
-
["
|
|
19
|
+
["init", () => import("./init-DgL3sDfQ.js").then((m) => m.initCommand)],
|
|
20
|
+
["add", () => import("./add-pDOlqWUa.js").then((m) => m.addCommand)],
|
|
21
|
+
["remove", () => import("./remove-ChaieK3t.js").then((m) => m.removeCommand)],
|
|
22
|
+
["upgrade", () => import("./upgrade-cMy5fKkg.js").then((m) => m.upgradeCommand)],
|
|
23
|
+
["table", () => import("./table-DeH8X0qz.js").then((m) => m.tableCommand)],
|
|
24
|
+
["migrate schema-first", () => import("./migrate-sVs1QYTM.js").then((m) => m.migrateSchemaFirstCommand)],
|
|
25
|
+
["gen", () => import("./gen-8Ya8n2sA.js").then((m) => m.genCommand)],
|
|
26
|
+
["doctor", () => import("./doctor-BD9oo4MG.js").then((m) => m.doctorCommand)],
|
|
27
|
+
["db query", () => import("./db-uYN6O5Eg.js").then((m) => m.dbQueryCommand)],
|
|
28
|
+
["db diff", () => import("./db-uYN6O5Eg.js").then((m) => m.dbDiffCommand)],
|
|
29
|
+
["db seed", () => import("./seed-BJ7c-ktX.js").then((m) => m.seedCommand)],
|
|
30
|
+
["db backfill", () => import("./backfill-r9RELEEh.js").then((m) => m.dbBackfillCommand)],
|
|
31
|
+
["dev env", () => import("./env-Cy2lWBRC.js").then((m) => m.envCommand)],
|
|
32
|
+
["dev run", () => import("./run-CxFDjL1Q.js").then((m) => m.runCommand)],
|
|
33
|
+
["dev keys", () => import("./keys-CsanNk-2.js").then((m) => m.keysCommand)],
|
|
34
|
+
["dev stack ls", () => import("./stack-CteM33gC.js").then((m) => m.stackLsCommand)],
|
|
35
|
+
["dev stack prune", () => import("./stack-CteM33gC.js").then((m) => m.stackPruneCommand)],
|
|
36
|
+
["blocks list", () => import("./blocks-DTOFdrxL.js").then((m) => m.blocksListCommand)],
|
|
37
|
+
["blocks view", () => import("./blocks-DTOFdrxL.js").then((m) => m.blocksViewCommand)],
|
|
38
|
+
["blocks search", () => import("./blocks-DTOFdrxL.js").then((m) => m.blocksSearchCommand)],
|
|
39
|
+
["powersync streams", () => import("./powersync-DURhWDVc.js").then((m) => m.powersyncStreamsCommand)],
|
|
40
|
+
["spec emit", () => import("./spec-_MS0ym5r.js").then((m) => m.specEmitCommand)],
|
|
41
|
+
["spec validate", () => import("./spec-_MS0ym5r.js").then((m) => m.specValidateCommand)],
|
|
42
|
+
["mcp", () => import("./mcp-DEHtzAkq.js").then((m) => m.mcpCommand)],
|
|
43
|
+
["skills list", () => import("./skills-0gz_qjVb.js").then((m) => m.skillsListCommand)],
|
|
44
|
+
["skills install", () => import("./skills-0gz_qjVb.js").then((m) => m.skillsInstallCommand)],
|
|
45
|
+
["codemod 0.4", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.4"))],
|
|
46
|
+
["codemod 0.5", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.5"))],
|
|
47
|
+
["codemod 0.6", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.6"))],
|
|
48
|
+
["codemod 0.9", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.9"))],
|
|
49
|
+
["codemod 0.11", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.11"))],
|
|
50
|
+
["codemod 0.15", () => import("./codemod-ClmbiLuL.js").then((m) => m.codemodCommand("0.15"))],
|
|
51
|
+
["completion", () => import("./completion-Dpk6vh0p.js").then((m) => m.completionCommand)],
|
|
52
|
+
["config", () => import("./config-EjNj3HfT.js").then((m) => m.configCommand)]
|
|
51
53
|
];
|
|
52
54
|
/** The built-in commands, for `createCli`. */
|
|
53
55
|
function builtinCommands() {
|
|
@@ -466,7 +468,7 @@ function cliFromTree(init, extra = {}) {
|
|
|
466
468
|
};
|
|
467
469
|
if (argv[0] === "__complete") {
|
|
468
470
|
const words = argv[1] === "--" ? argv.slice(2) : argv.slice(1);
|
|
469
|
-
const lines = await import("./completion-
|
|
471
|
+
const lines = await import("./completion-CNCqE-Gb.js").then(async ({ complete, completionLines }) => completionLines(await complete(tree, words))).catch(() => "");
|
|
470
472
|
if (lines !== "") out(lines);
|
|
471
473
|
return {
|
|
472
474
|
code: 0,
|
|
@@ -595,8 +597,8 @@ function cliFromTree(init, extra = {}) {
|
|
|
595
597
|
try {
|
|
596
598
|
const [loaded, { defaultConfig, discoverConfig, loadConfig }, { configEnvironment, isCi, parseEnv }] = await Promise.all([
|
|
597
599
|
node.load(),
|
|
598
|
-
import("./config-
|
|
599
|
-
import("./env-
|
|
600
|
+
import("./config-D2YUlzrl.js"),
|
|
601
|
+
import("./env-Bat6ogep.js")
|
|
600
602
|
]);
|
|
601
603
|
command = loaded;
|
|
602
604
|
rawArgs = joinRepeated(rest, listArgs(command));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { r as errorText } from "./errors-BTe6A15O.js";
|
|
2
2
|
import { a as sameText, t as display } from "./io-DH1kcmmP.js";
|
|
3
|
-
import { c as writeAtomic, o as storeTypesModule, s as typesModuleKey, t as CACHE_DIR } from "./cache-
|
|
3
|
+
import { c as writeAtomic, o as storeTypesModule, s as typesModuleKey, t as CACHE_DIR } from "./cache-Czfw7Iow.js";
|
|
4
4
|
import { t as byCodePoint } from "./compare-BmIWVEui.js";
|
|
5
|
-
import { _ as stabilizeMetadata, b as typegenVersionNotice, p as oxfmtInstalled, t as loadSnapshot, y as typegenVersion } from "./snapshot-
|
|
6
|
-
import { n as render } from "./render-
|
|
7
|
-
import {
|
|
8
|
-
import { s as schemaStampPath } from "./content-mapper-
|
|
5
|
+
import { _ as stabilizeMetadata, b as typegenVersionNotice, p as oxfmtInstalled, t as loadSnapshot, y as typegenVersion } from "./snapshot-DdAP7LWO.js";
|
|
6
|
+
import { n as render } from "./render-DUNJ4Pss.js";
|
|
7
|
+
import { a as compiledReadSets, c as entitlementRequirements, d as providerLabel, f as unsafeKey, l as entitlementsMode, o as accessProviderMode, s as accessRequirements, u as moduleKeyProblems } from "./providers-CpaISitn.js";
|
|
8
|
+
import { s as schemaStampPath } from "./content-mapper-ez_mT0d4.js";
|
|
9
9
|
import { a as changedFiles, d as fileDiff, i as changeLines, r as applyPlan, s as hasConflicts } from "./files-CX71yBm8.js";
|
|
10
|
-
import { n as migrationsDir, o as writtenByBlocks } from "./sql-layout-
|
|
11
|
-
import { l as tableObject, n as exposed, o as policyObject, s as qualified, t as catalogOf } from "./shared-
|
|
12
|
-
import { c as sameModuleMigration, l as writeLatestMigration, n as READ_SETS_SUFFIX, r as latestMigration, u as writesMigrations } from "./module-migration-
|
|
10
|
+
import { n as migrationsDir, o as writtenByBlocks } from "./sql-layout-DYKkQw1k.js";
|
|
11
|
+
import { l as tableObject, n as exposed, o as policyObject, s as qualified, t as catalogOf } from "./shared-5uqc1GBj.js";
|
|
12
|
+
import { c as sameModuleMigration, l as writeLatestMigration, n as READ_SETS_SUFFIX, r as latestMigration, u as writesMigrations } from "./module-migration-CXfRJIV4.js";
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
15
15
|
import { readFile } from "node:fs/promises";
|
|
@@ -142,7 +142,7 @@ function appViewsOf(context) {
|
|
|
142
142
|
const BLOCK_PREFIX = "bsb_";
|
|
143
143
|
/** The app tables (`schema.table`) that blocks run over. */
|
|
144
144
|
function blockTargets(context) {
|
|
145
|
-
return new Set(adoptedTables(context.config.blocks, appTablesOf(context)).map((table) => `${table.schema}.${table.table}`));
|
|
145
|
+
return new Set(adoptedTables(context.config.blocks, appTablesOf(context), { subjects: context.config.subjects }).map((table) => `${table.schema}.${table.table}`));
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Whether permissive policies that overlap on `table` are one app policy and
|
|
@@ -999,7 +999,7 @@ const AUTHORIZATION_RULES = [
|
|
|
999
999
|
target: requirement.function
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
|
-
findings.push(...moduleKeyProblems(provider, modulePermissionKeys(context.config.blocks, context.config.blockNames)));
|
|
1002
|
+
findings.push(...moduleKeyProblems(provider, modulePermissionKeys(context.config.blocks, context.config.blockNames, context.config.subjects)));
|
|
1003
1003
|
if ((context.config.blocks.permissions?.functions?.canAssign ?? provider.functions.canAssign) === void 0) findings.push({
|
|
1004
1004
|
severity: "warning",
|
|
1005
1005
|
message: `Neither blocks.permissions.functions.canAssign nor ${providerLabel(provider)} sets canAssign, so under the provider model only the service role assigns roles: the memberships guard refuses every membership a member adds or changes. Use a provider that sets authorization.functions.canAssign, or set blocks.permissions.functions.canAssign.`,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { p as commandMeta, r as defineCliCommand } from "./command-
|
|
1
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
2
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
3
|
-
import { t as PROCESS_ENV } from "./env-
|
|
4
|
-
import { n as spawnInherited } from "./exec
|
|
3
|
+
import { t as PROCESS_ENV } from "./env-BK0xKMeU.js";
|
|
4
|
+
import { n as spawnInherited } from "./exec-Ca5s-ygi.js";
|
|
5
5
|
import { i as staleVariables } from "./stack-env-6hS-WEmh.js";
|
|
6
|
-
import { i as readStackEnv } from "./env-
|
|
6
|
+
import { i as readStackEnv } from "./env-DEAtgGoj.js";
|
|
7
7
|
//#region src/cli/commands/run.ts
|
|
8
8
|
const ARGS = {
|
|
9
9
|
prefix: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as seedCommand } from "./seed-BzVLTdRl.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { p as commandMeta, r as defineCliCommand } from "./command-
|
|
1
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
2
|
import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
|
|
3
3
|
import { t as display } from "./io-DH1kcmmP.js";
|
|
4
|
-
import { l as stdinDatabaseUrl, n as databaseUrl, o as importExport } from "./config-
|
|
4
|
+
import { l as stdinDatabaseUrl, n as databaseUrl, o as importExport } from "./config-KvV-sLZL.js";
|
|
5
5
|
import { m as supabaseDir } from "./supabase-toml-CncmQbO0.js";
|
|
6
6
|
import { t as connect } from "./db-CQCLx7cx.js";
|
|
7
7
|
import { c as insideRoot, i as changeLines, n as PLAN_ARGS, r as applyPlan, s as hasConflicts, u as planResult } from "./files-CX71yBm8.js";
|
|
8
|
-
import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-
|
|
8
|
+
import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-DAcQt-Mh.js";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
import { resolve } from "node:path";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as toCatalog } from "./source-
|
|
1
|
+
import { a as toCatalog } from "./source-2irbWSck.js";
|
|
2
2
|
import { h as tomlGet, p as sqlWorkflow, r as detectWorkflow } from "./supabase-toml-CncmQbO0.js";
|
|
3
3
|
//#region src/cli/doctor/shared.ts
|
|
4
4
|
const catalogs = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as list, p as commandMeta, r as defineCliCommand } from "./command-
|
|
1
|
+
import { a as list, p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
2
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
3
3
|
import { t as byCodePoint } from "./compare-BmIWVEui.js";
|
|
4
4
|
import { n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
|
|
2
|
-
import { d as readExtras, l as TYPEGEN_VERSION, r as cachedIntrospect } from "./cache-
|
|
2
|
+
import { d as readExtras, l as TYPEGEN_VERSION, r as cachedIntrospect } from "./cache-Czfw7Iow.js";
|
|
3
3
|
import { t as byCodePoint } from "./compare-BmIWVEui.js";
|
|
4
|
-
import { n as managementSource, r as pgSource } from "./source-
|
|
5
|
-
import { n as databaseUrl, u as accessToken } from "./config-
|
|
4
|
+
import { n as managementSource, r as pgSource } from "./source-2irbWSck.js";
|
|
5
|
+
import { n as databaseUrl, u as accessToken } from "./config-KvV-sLZL.js";
|
|
6
6
|
import { d as readSupabaseToml, f as schemaPaths, h as tomlGet, u as pgFunctionHooks } from "./supabase-toml-CncmQbO0.js";
|
|
7
7
|
import { t as connect } from "./db-CQCLx7cx.js";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as VERSION } from "./version-
|
|
1
|
+
import { t as VERSION } from "./version-C5RAWmrD.js";
|
|
2
2
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
3
3
|
import { r as redactUrl } from "./redact-KGAk2Ul9.js";
|
|
4
4
|
import { n as HTTP_CHANNEL } from "./trace-VbdO6bcN.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
2
|
-
import { l as stdinDatabaseUrl } from "./config-
|
|
2
|
+
import { l as stdinDatabaseUrl } from "./config-KvV-sLZL.js";
|
|
3
3
|
//#region src/cli/commands/source-args.ts
|
|
4
4
|
/**
|
|
5
5
|
* The connection string from stdin, for commands that connect but read no
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __require, t as __commonJSMin } from "./rolldown-runtime-kJ_i4yPo.js";
|
|
2
|
-
import { p as commandMeta, r as defineCliCommand } from "./command-
|
|
3
|
-
import { t as VERSION } from "./version-
|
|
2
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
3
|
+
import { t as VERSION } from "./version-C5RAWmrD.js";
|
|
4
4
|
import { i as failedResult, n as CliError, r as errorText } from "./errors-BTe6A15O.js";
|
|
5
5
|
import { t as display } from "./io-DH1kcmmP.js";
|
|
6
|
-
import { c as writeAtomic, t as CACHE_DIR } from "./cache-
|
|
6
|
+
import { c as writeAtomic, t as CACHE_DIR } from "./cache-Czfw7Iow.js";
|
|
7
7
|
import { t as isRecord } from "./guards-CUlDNYZs.js";
|
|
8
8
|
import { t as importFresh } from "./fresh-import-DzgsGHkX.js";
|
|
9
9
|
import { a as changedFiles, i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as specEmitCommand, i as specValidateCommand } from "./spec-
|
|
1
|
+
export { n as specEmitCommand, i as specValidateCommand } from "./spec-B7n4Rthp.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as TypegenMissingError, i as parseSnapshot } from "./snapshot-
|
|
2
|
-
import { a as toCatalog } from "./source-
|
|
1
|
+
import { d as TypegenMissingError, i as parseSnapshot } from "./snapshot-DdAP7LWO.js";
|
|
2
|
+
import { a as toCatalog } from "./source-2irbWSck.js";
|
|
3
3
|
import { d as readSupabaseToml, f as schemaPaths, n as declarativeSchemasDir, p as sqlWorkflow } from "./supabase-toml-CncmQbO0.js";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { readFile, readdir } from "node:fs/promises";
|
|
7
|
-
import { adoptedColumnProblems, auditRegistrations, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, extensionSchema, moduleLayout, policyGrants, resolveBlocks, resolveExposeColumns, rlsTables, sameTenantLayout } from "better-supabase/sql";
|
|
7
|
+
import { adoptedColumnProblems, auditRegistrations, declaredIndexes, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, extensionSchema, moduleLayout, policyGrants, resolveBlocks, resolveExposeColumns, rlsTables, sameTenantLayout } from "better-supabase/sql";
|
|
8
8
|
//#region src/cli/sql-layout.ts
|
|
9
9
|
/** The folder the module data files sit next to, for the project's workflow. */
|
|
10
10
|
async function schemasDirOf(config) {
|
|
@@ -44,7 +44,7 @@ async function auditedTables(config) {
|
|
|
44
44
|
async function moduleLayoutFor(config, input) {
|
|
45
45
|
const resolved = new Set(resolveBlocks(input.names, input.entitlementsProvider ? { entitlementsProvider: input.entitlementsProvider } : {}).map((module) => module.name));
|
|
46
46
|
const own = await ownLayout(config);
|
|
47
|
-
const adopted = adoptedColumnProblems(config.blocks, await declarativeTexts(config), config.schemas, own.ownTables);
|
|
47
|
+
const adopted = adoptedColumnProblems(config.blocks, await declarativeTexts(config), config.schemas, own.ownTables, config.subjects);
|
|
48
48
|
if (adopted.length > 0) throw new TypeError(adopted.join("\n"));
|
|
49
49
|
const fromPolicies = resolved.has("grants") && config.blocks["grants"]?.options?.["fromPolicies"] === true;
|
|
50
50
|
const sessionPolicies = resolved.has("sessions") && config.blocks["sessions"]?.options?.["policies"] === true;
|
|
@@ -96,9 +96,15 @@ async function ownLayout(config) {
|
|
|
96
96
|
ownPolicies: {
|
|
97
97
|
...database.policies,
|
|
98
98
|
...declaredPolicies(own, config.schemas)
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
|
+
ownIndexes: mergeIndexes(database.indexes, declaredIndexes(own, config.schemas))
|
|
100
101
|
};
|
|
101
102
|
}
|
|
103
|
+
function mergeIndexes(database, declared) {
|
|
104
|
+
const merged = { ...database };
|
|
105
|
+
for (const [table, indexes] of declared) merged[table] = [...merged[table] ?? [], ...indexes];
|
|
106
|
+
return merged;
|
|
107
|
+
}
|
|
102
108
|
/** A trigger function named like one that keeps `updated_at` current. */
|
|
103
109
|
const UPDATED_AT_FUNCTION = /updated_at|moddatetime|touch/i;
|
|
104
110
|
const BLOCK_MARKER = /^-- @(?:bsb-block|bsb-tables|bs-module|bs-app-tables)\b/m;
|
|
@@ -125,7 +131,8 @@ async function databaseTables(config) {
|
|
|
125
131
|
views: {},
|
|
126
132
|
columns: {},
|
|
127
133
|
updatedAtTriggers: {},
|
|
128
|
-
policies: {}
|
|
134
|
+
policies: {},
|
|
135
|
+
indexes: {}
|
|
129
136
|
};
|
|
130
137
|
const path = config.source.snapshot;
|
|
131
138
|
if (path === void 0 || !existsSync(resolve(config.root, path))) return none;
|
|
@@ -137,11 +144,13 @@ async function databaseTables(config) {
|
|
|
137
144
|
throw cause;
|
|
138
145
|
}
|
|
139
146
|
const created = blockDeclaredTables(await schemaTexts(config), config.schemas);
|
|
147
|
+
const blockIndexes = new Set([...declaredIndexes((await schemaTexts(config)).filter(writtenByBlocks), config.schemas).values()].flatMap((list) => list.map((index) => index.name)));
|
|
140
148
|
const tables = {};
|
|
141
149
|
const views = {};
|
|
142
150
|
const columns = {};
|
|
143
151
|
const updatedAtTriggers = {};
|
|
144
152
|
const policies = {};
|
|
153
|
+
const indexes = {};
|
|
145
154
|
for (const table of toCatalog(snapshot).tables) {
|
|
146
155
|
const name = `${table.schema}.${table.name}`;
|
|
147
156
|
if (config.schemas.includes(table.schema) && !created.has(name)) {
|
|
@@ -151,6 +160,10 @@ async function databaseTables(config) {
|
|
|
151
160
|
const kept = table.triggers.find((trigger) => !trigger.name.startsWith("bsb_") && trigger.events.includes("update") && UPDATED_AT_FUNCTION.test(trigger.function));
|
|
152
161
|
if (kept !== void 0) updatedAtTriggers[name] = kept.name;
|
|
153
162
|
policies[name] = table.policies.filter((policy) => !policy.name.startsWith("bsb_"));
|
|
163
|
+
indexes[name] = table.indexes.filter((index) => !index.partial && [void 0, "btree"].includes(index.method) && !blockIndexes.has(index.name)).map((index) => ({
|
|
164
|
+
name: index.name,
|
|
165
|
+
columns: index.columns
|
|
166
|
+
}));
|
|
154
167
|
}
|
|
155
168
|
}
|
|
156
169
|
return {
|
|
@@ -158,7 +171,8 @@ async function databaseTables(config) {
|
|
|
158
171
|
views,
|
|
159
172
|
columns,
|
|
160
173
|
updatedAtTriggers,
|
|
161
|
-
policies
|
|
174
|
+
policies,
|
|
175
|
+
indexes
|
|
162
176
|
};
|
|
163
177
|
}
|
|
164
178
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as commandMeta, r as defineCliCommand } from "./command-
|
|
2
|
-
import { r as supabaseCli } from "./exec
|
|
3
|
-
import { a as readSharedMemory, i as reportStacks, n as listStacks, r as prunePlan, t as branchName } from "./stacks-
|
|
1
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
|
+
import { r as supabaseCli } from "./exec-Ca5s-ygi.js";
|
|
3
|
+
import { a as readSharedMemory, i as reportStacks, n as listStacks, r as prunePlan, t as branchName } from "./stacks-CiDBH1dB.js";
|
|
4
4
|
//#region src/cli/commands/stack.ts
|
|
5
5
|
const DEFAULT_DEPS = {
|
|
6
6
|
memory: (root, env) => readSharedMemory(root, env),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
2
|
-
import { r as supabaseCli } from "./exec
|
|
2
|
+
import { r as supabaseCli } from "./exec-Ca5s-ygi.js";
|
|
3
3
|
//#region src/cli/stack-status.ts
|
|
4
4
|
/** Parses the JSON object `supabase status` prints after any progress lines. */
|
|
5
5
|
function parseStackStatus(stdout) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
2
|
-
import { r as supabaseCli, t as runProcess } from "./exec
|
|
2
|
+
import { r as supabaseCli, t as runProcess } from "./exec-Ca5s-ygi.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region src/cli/shm.ts
|
|
5
5
|
const DIGITS = /^\d+$/;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
2
2
|
import { t as display } from "./io-DH1kcmmP.js";
|
|
3
|
-
import {
|
|
3
|
+
import { r as layoutFor } from "./providers-CpaISitn.js";
|
|
4
4
|
import { d as readSupabaseToml, f as schemaPaths, h as tomlGet, i as diffEngine, l as migrationCommand, o as findSupabaseRoot, p as sqlWorkflow, t as PGDELTA_TABLE } from "./supabase-toml-CncmQbO0.js";
|
|
5
5
|
import { d as fileDiff, i as changeLines, l as keepHandEdit, o as handEditedError, r as applyPlan, t as HAND_EDITED, u as planResult } from "./files-CX71yBm8.js";
|
|
6
|
-
import { a as sqlPlan, n as migrationsDir } from "./sql-layout-
|
|
7
|
-
import {
|
|
6
|
+
import { a as sqlPlan, n as migrationsDir } from "./sql-layout-DYKkQw1k.js";
|
|
7
|
+
import { a as writeExtensionsMigration, t as DATA_NEXT } from "./migrations-DWh38tO9.js";
|
|
8
|
+
import { c as sameModuleMigration, l as writeLatestMigration, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-CXfRJIV4.js";
|
|
8
9
|
import { t as loadTopics } from "./topics-BpdnYmWb.js";
|
|
9
10
|
import { t as orphanedBlockFiles } from "./orphans-BAboqyVM.js";
|
|
10
11
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
|
+
import { i as plain } from "./style-Bm2X5JrN.js";
|
|
3
|
+
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
4
|
+
import { t as display } from "./io-DH1kcmmP.js";
|
|
5
|
+
import { m as supabaseDir } from "./supabase-toml-CncmQbO0.js";
|
|
6
|
+
import { n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
|
|
7
|
+
import { join, relative } from "node:path";
|
|
8
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
9
|
+
import { TABLE_FEATURES, createsTable, isTableFeature, setTableFeature } from "better-supabase/sql";
|
|
10
|
+
//#region src/cli/commands/table.ts
|
|
11
|
+
const TABLE_ARGS = {
|
|
12
|
+
table: {
|
|
13
|
+
type: "positional",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "The table, as name or schema.name"
|
|
16
|
+
},
|
|
17
|
+
action: {
|
|
18
|
+
type: "positional",
|
|
19
|
+
required: true,
|
|
20
|
+
description: "enable or disable"
|
|
21
|
+
},
|
|
22
|
+
feature: {
|
|
23
|
+
type: "positional",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "The feature: realtime, audit, audit-reads, subject, json, expose, encrypted, server, events or vector-search"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
async function sqlFiles(dir) {
|
|
29
|
+
const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
30
|
+
return (await Promise.all(entries.map(async (entry) => entry.isDirectory() ? sqlFiles(join(dir, entry.name)) : entry.name.endsWith(".sql") ? [join(dir, entry.name)] : []))).flat().toSorted();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Turns a per-table feature on or off by editing the `@bsb` tag in the table's
|
|
34
|
+
* comment, in the file under `supabase/schemas` that creates the table (ADR
|
|
35
|
+
* 0102). Nothing else in the file changes; `db diff` then writes the
|
|
36
|
+
* migration.
|
|
37
|
+
*/
|
|
38
|
+
async function runTable(config, args, deps = {}) {
|
|
39
|
+
const { action, feature } = args;
|
|
40
|
+
if (action !== "enable" && action !== "disable") throw new CliError("usage", `Expected enable or disable, got ${action}.`);
|
|
41
|
+
if (!isTableFeature(feature)) throw new CliError("usage", `Unknown feature ${feature}. Use one of ${TABLE_FEATURES.join(", ")}.`);
|
|
42
|
+
const [schema, name] = args.table.includes(".") ? args.table.split(".", 2) : ["public", args.table];
|
|
43
|
+
if (schema === void 0 || name === void 0 || name === "") throw new CliError("usage", `Expected a table, got ${args.table}.`);
|
|
44
|
+
const dir = join(config.root, supabaseDir(config.root), "schemas");
|
|
45
|
+
const files = await sqlFiles(dir);
|
|
46
|
+
const matches = [];
|
|
47
|
+
for (const path of files) {
|
|
48
|
+
const text = await readFile(path, "utf-8");
|
|
49
|
+
if (createsTable(text, schema, name)) matches.push({
|
|
50
|
+
path,
|
|
51
|
+
text
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const [found, ...others] = matches;
|
|
55
|
+
if (found === void 0) throw new CliError("usage", `No file under ${display(config.root, dir)} creates ${schema}.${name}. Tables you own live in supabase/schemas; add the table there first.`);
|
|
56
|
+
if (others.length > 0) throw new CliError("usage", `${schema}.${name} is created in ${String(matches.length)} files: ${matches.map((match) => relative(config.root, match.path)).join(", ")}. Keep one.`);
|
|
57
|
+
const next = setTableFeature(found.text, schema, name, feature, action === "enable");
|
|
58
|
+
const plan = {
|
|
59
|
+
root: config.root,
|
|
60
|
+
regenerate: `better-supabase table ${args.table} ${action} ${feature}`,
|
|
61
|
+
files: [{
|
|
62
|
+
path: found.path,
|
|
63
|
+
contents: next,
|
|
64
|
+
policy: "edit"
|
|
65
|
+
}]
|
|
66
|
+
};
|
|
67
|
+
const applied = await applyPlan(plan, args, deps.paint ?? plain);
|
|
68
|
+
const summary = applied.mode === "write" && applied.drift ? `${action === "enable" ? "Enabled" : "Disabled"} ${feature} on ${schema}.${name}. Run \`better-supabase db diff -f ${feature}_${name}\` for the migration.` : void 0;
|
|
69
|
+
const data = {
|
|
70
|
+
table: `${schema}.${name}`,
|
|
71
|
+
feature,
|
|
72
|
+
enabled: action === "enable"
|
|
73
|
+
};
|
|
74
|
+
return planResult(plan, applied, {
|
|
75
|
+
data,
|
|
76
|
+
...summary === void 0 ? {} : { summary }
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const tableCommand = defineCliCommand({
|
|
80
|
+
meta: commandMeta("table"),
|
|
81
|
+
args: {
|
|
82
|
+
...TABLE_ARGS,
|
|
83
|
+
"dry-run": PLAN_ARGS["dry-run"],
|
|
84
|
+
check: PLAN_ARGS.check
|
|
85
|
+
},
|
|
86
|
+
run: (args, { config, paint }) => runTable(config, args, { paint })
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { tableCommand };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as display } from "./io-DH1kcmmP.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as layoutFor } from "./providers-CpaISitn.js";
|
|
3
3
|
import { d as fileDiff, i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
|
|
4
|
-
import { a as sqlPlan, n as migrationsDir } from "./sql-layout-
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
4
|
+
import { a as sqlPlan, n as migrationsDir } from "./sql-layout-DYKkQw1k.js";
|
|
5
|
+
import { r as migrationStamp } from "./migrations-DWh38tO9.js";
|
|
6
|
+
import { a as migrationInstances, c as sameModuleMigration, o as migrationModules, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-CXfRJIV4.js";
|
|
7
|
+
import { a as write, o as topicPolicyFile, r as nextStep } from "./sync-DnSOrQuA.js";
|
|
7
8
|
import { a as legacyPrefixSql, i as legacyPrefixNames, r as legacyBlocksTableSql } from "./legacy-prefix-R7UChFFl.js";
|
|
8
9
|
import { resolve } from "node:path";
|
|
9
10
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as commandMeta, r as defineCliCommand } from "./command-
|
|
1
|
+
import { p as commandMeta, r as defineCliCommand } from "./command-CVzTJSLp.js";
|
|
2
2
|
import { i as plain } from "./style-Bm2X5JrN.js";
|
|
3
|
-
import { t as syncModules } from "./sync-
|
|
3
|
+
import { t as syncModules } from "./sync-DnSOrQuA.js";
|
|
4
4
|
import { t as SQL_ARGS } from "./args-UEwg0l-N.js";
|
|
5
|
-
import { t as upgrade } from "./upgrade-
|
|
5
|
+
import { t as upgrade } from "./upgrade-CWdrC-K3.js";
|
|
6
6
|
//#region src/cli/commands/upgrade.ts
|
|
7
7
|
const UPGRADE_ARGS = {
|
|
8
8
|
check: {
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as DataSync, c as LocalTablesOption, i as DataEntry, l as liveEngine, n as DataEngine, o as DataSyncState, r as DataEngineOptions, s as LiveEngineOptions, t as DataChanges, u as memoryEngine } from "../data-engine-BWoz9lED.js";
|
|
2
|
-
import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-
|
|
3
|
-
import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../ports-
|
|
4
|
-
import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../bind-
|
|
5
|
-
import { a as defineController, i as ControllerState, n as Controller, o as whileSignedIn, r as ControllerParts, t as AuthPort } from "../controller-
|
|
2
|
+
import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-1zIAtiNM.js";
|
|
3
|
+
import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../ports-DP0bthUk.js";
|
|
4
|
+
import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../bind-C54jD0r3.js";
|
|
5
|
+
import { a as defineController, i as ControllerState, n as Controller, o as whileSignedIn, r as ControllerParts, t as AuthPort } from "../controller-Cl6HmMBk.js";
|
|
6
6
|
import { n as FunctionContract } from "../function-contract-DxFNOmsm.js";
|
|
7
|
-
import { a as webDeepLinks, c as webPorts, d as FunctionContracts, f as FunctionsHost, h as functions, i as WebPushTokenOptions, l as webPushToken, m as TypedFunctions, n as createClient, o as webFilePicker, p as InvokeOptions, r as PushRegistrationLike, s as webKeyboard, t as ClientOptions, u as webStorage } from "../index-
|
|
7
|
+
import { a as webDeepLinks, c as webPorts, d as FunctionContracts, f as FunctionsHost, h as functions, i as WebPushTokenOptions, l as webPushToken, m as TypedFunctions, n as createClient, o as webFilePicker, p as InvokeOptions, r as PushRegistrationLike, s as webKeyboard, t as ClientOptions, u as webStorage } from "../index-DPMVWm_Z.js";
|
|
8
8
|
export { type AuthPort, type AuthSnapshot, type AuthUser, type BetterClient, type BindClientOptions, type ClientAuth, ClientOptions, type ClientPorts, type Controller, type ControllerParts, type ControllerState, type DataChanges, type DataEngine, type DataEngineOptions, type DataEntry, type DataSync, type DataSyncState, type DeepLinkPort, type FilePickerPort, type FunctionContract, type FunctionContracts, type FunctionsHost, type InvokeOptions, type KeyboardPort, type LiveEngineOptions, type LocalTablesOption, type PickFilesOptions, type PickedFile, type PushRegistrationLike, type PushTokenPort, type Shortcut, type StoragePort, type TopicHandle, type TopicPort, type TopicWatch, type TypedFunctions, type UploadDestination, type UploadPort, type WebPushTokenOptions, bindClient, createClient, defineController, functions, liveEngine, memoryEngine, memoryStorage, storageUpload, webDeepLinks, webFilePicker, webKeyboard, webPorts, webPushToken, webStorage, whileSignedIn };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as AsyncResult } from "../../result-DZeA5KS6.js";
|
|
2
2
|
import { T as UploadOptions, w as UploadBody } from "../../bucket-vc-QRrva.js";
|
|
3
|
-
import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../../watch-topic-
|
|
4
|
-
import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../../ports-
|
|
5
|
-
import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../../bind-
|
|
6
|
-
import { n as ExpoPushTokenOptions, r as expoPushToken, t as ExpoNotificationsLike } from "../../push-token-
|
|
3
|
+
import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../../watch-topic-1zIAtiNM.js";
|
|
4
|
+
import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../../ports-DP0bthUk.js";
|
|
5
|
+
import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../../bind-C54jD0r3.js";
|
|
6
|
+
import { n as ExpoPushTokenOptions, r as expoPushToken, t as ExpoNotificationsLike } from "../../push-token-v3xCcVU7.js";
|
|
7
7
|
import { a as OAuthSignInOptions, c as linkParams, i as OAuthClient, l as signInWithOAuthBrowser, n as AuthLinkClient, o as WebBrowserLike, r as AuthLinkResult, s as handleAuthDeepLink, t as AuthFailure } from "../../auth-link-B4NL84XU.js";
|
|
8
8
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
9
9
|
//#region src/client/native/auto-refresh.d.ts
|