@rebasepro/server-postgres 0.28.2 → 0.29.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/{BranchService-BPssiD8_.js → BranchService-JiYJ_n9E.js} +3 -3
- package/dist/{BranchService-BPssiD8_.js.map → BranchService-JiYJ_n9E.js.map} +1 -1
- package/dist/PostgresBackendDriver.d.ts +147 -1
- package/dist/PostgresBootstrapper.d.ts +34 -1
- package/dist/{backup-cli-C1wcj-rc.js → backup-cli-D_aKXPyX.js} +3 -3
- package/dist/{backup-cli-C1wcj-rc.js.map → backup-cli-D_aKXPyX.js.map} +1 -1
- package/dist/{boot-ddl-CIGoIGcC.js → boot-ddl-D4W9o9xE.js} +2 -2
- package/dist/{boot-ddl-CIGoIGcC.js.map → boot-ddl-D4W9o9xE.js.map} +1 -1
- package/dist/{cli-console-C0FYkICX.js → cli-console-DPdZCWTi.js} +6 -6
- package/dist/{cli-console-C0FYkICX.js.map → cli-console-DPdZCWTi.js.map} +1 -1
- package/dist/{cli-errors-DYets7cp.js → cli-errors-D8s4z_3g.js} +26 -6
- package/dist/cli-errors-D8s4z_3g.js.map +1 -0
- package/dist/cli-helpers.d.ts +10 -0
- package/dist/cli.js +41 -35
- package/dist/cli.js.map +1 -1
- package/dist/{connection-czvI7TZL.js → connection-COuS5Fm-.js} +126 -36
- package/dist/connection-COuS5Fm-.js.map +1 -0
- package/dist/connection.d.ts +63 -0
- package/dist/database-health.d.ts +23 -0
- package/dist/{databasePoolManager-BjoVvuAq.js → databasePoolManager-7hXVurmG.js} +2 -2
- package/dist/{databasePoolManager-BjoVvuAq.js.map → databasePoolManager-7hXVurmG.js.map} +1 -1
- package/dist/{deferred-index-build-BcJ_oulu.js → deferred-index-build-F2GWu009.js} +34 -5
- package/dist/{deferred-index-build-BcJ_oulu.js.map → deferred-index-build-F2GWu009.js.map} +1 -1
- package/dist/{doctor-TJApVglQ.js → doctor-_g2tHRtG.js} +20 -6
- package/dist/doctor-_g2tHRtG.js.map +1 -0
- package/dist/{ensure-collection-policies-BNwSQfVx.js → ensure-collection-policies-DUpWJb5D.js} +8 -8
- package/dist/{ensure-collection-policies-BNwSQfVx.js.map → ensure-collection-policies-DUpWJb5D.js.map} +1 -1
- package/dist/{ensure-collection-tables-CSbgkTBx.js → ensure-collection-tables-BK--gDo6.js} +15 -9
- package/dist/ensure-collection-tables-BK--gDo6.js.map +1 -0
- package/dist/{ensure-tables-CF-8zgYA.js → ensure-tables-Bx1DYarz.js} +4 -4
- package/dist/{ensure-tables-CF-8zgYA.js.map → ensure-tables-Bx1DYarz.js.map} +1 -1
- package/dist/{enum-labels-kept-BCgFGAbJ.js → enum-labels-kept-DyFE4Gaq.js} +3 -3
- package/dist/{enum-labels-kept-BCgFGAbJ.js.map → enum-labels-kept-DyFE4Gaq.js.map} +1 -1
- package/dist/{generate-drizzle-schema-logic-CVRmZjP3.js → generate-drizzle-schema-logic-DpFA1UVd.js} +2 -2
- package/dist/{generate-drizzle-schema-logic-CVRmZjP3.js.map → generate-drizzle-schema-logic-DpFA1UVd.js.map} +1 -1
- package/dist/{generate-drizzle-schema-BAIp9nKT.js → generate-drizzle-schema-taNTu3xv.js} +2 -2
- package/dist/{generate-drizzle-schema-BAIp9nKT.js.map → generate-drizzle-schema-taNTu3xv.js.map} +1 -1
- package/dist/{generate-files-DutUrsSS.js → generate-files-DbwU8Btx.js} +11 -4
- package/dist/generate-files-DbwU8Btx.js.map +1 -0
- package/dist/{generate-postgres-ddl-logic-0rbAqwYT.js → generate-postgres-ddl-logic-ISVgsP34.js} +11 -4
- package/dist/{generate-postgres-ddl-logic-0rbAqwYT.js.map → generate-postgres-ddl-logic-ISVgsP34.js.map} +1 -1
- package/dist/{generated-schema-diff-ChFg6UxI.js → generated-schema-diff-4lOC0g1_.js} +21 -6
- package/dist/generated-schema-diff-4lOC0g1_.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.es.js +13 -13
- package/dist/{migrate-baseline-DPawvckr.js → migrate-baseline-BeepEphh.js} +2 -2
- package/dist/{migrate-baseline-DPawvckr.js.map → migrate-baseline-BeepEphh.js.map} +1 -1
- package/dist/{migrate-policy-stamps-B-8vTSIm.js → migrate-policy-stamps-cYMJ_9Ha.js} +7 -7
- package/dist/{migrate-policy-stamps-B-8vTSIm.js.map → migrate-policy-stamps-cYMJ_9Ha.js.map} +1 -1
- package/dist/{open-rebase-D9n8idex.js → open-rebase-CTNBmmH8.js} +1712 -164
- package/dist/open-rebase-CTNBmmH8.js.map +1 -0
- package/dist/{pg-error-utils-BIHfsGZL.js → pg-error-utils-BLOVXK67.js} +2 -2
- package/dist/{pg-error-utils-BIHfsGZL.js.map → pg-error-utils-BLOVXK67.js.map} +1 -1
- package/dist/pipelined-transaction.d.ts +131 -0
- package/dist/{plan-schema-DMVh77yb.js → plan-schema-CMNWvqIa.js} +62 -3
- package/dist/plan-schema-CMNWvqIa.js.map +1 -0
- package/dist/{policy-drift-0Cp4Lc0x.js → policy-drift-IjD2AUD-.js} +2 -2
- package/dist/{policy-drift-0Cp4Lc0x.js.map → policy-drift-IjD2AUD-.js.map} +1 -1
- package/dist/pooled-database.d.ts +38 -0
- package/dist/{push-index-prebuild-DR3P4yOw.js → push-index-prebuild-CIvajIrL.js} +4 -4
- package/dist/{push-index-prebuild-DR3P4yOw.js.map → push-index-prebuild-CIvajIrL.js.map} +1 -1
- package/dist/{push-kept-defaults-BSqPzp0T.js → push-kept-defaults-CLbsuSmo.js} +2 -2
- package/dist/{push-kept-defaults-BSqPzp0T.js.map → push-kept-defaults-CLbsuSmo.js.map} +1 -1
- package/dist/{push-legacy-renames-BIxBmVLl.js → push-legacy-renames-DeW_HTLJ.js} +4 -4
- package/dist/{push-legacy-renames-BIxBmVLl.js.map → push-legacy-renames-DeW_HTLJ.js.map} +1 -1
- package/dist/{push-policy-plan-BHsasXa7.js → push-policy-plan--oRXOj4X.js} +4 -4
- package/dist/{push-policy-plan-BHsasXa7.js.map → push-policy-plan--oRXOj4X.js.map} +1 -1
- package/dist/read-routing.d.ts +139 -0
- package/dist/{render-ddl-NpPPDACz.js → render-ddl-CzVcbbR1.js} +77 -3
- package/dist/render-ddl-CzVcbbR1.js.map +1 -0
- package/dist/{rls-enforcement-BOHuHVlc.js → rls-enforcement-jZTv1yci.js} +48 -16
- package/dist/{rls-enforcement-BOHuHVlc.js.map → rls-enforcement-jZTv1yci.js.map} +1 -1
- package/dist/schema/deferred-index-build.d.ts +9 -0
- package/dist/schema/doctor-cli.js +4 -4
- package/dist/schema/generate-drizzle-schema.js +1 -1
- package/dist/schema/generate-files.d.ts +2 -1
- package/dist/schema/generate-postgres-ddl-logic.d.ts +6 -0
- package/dist/schema/generate-postgres-ddl.js +1 -1
- package/dist/schema/introspect-db.js +2 -2
- package/dist/schema/introspect-runtime.d.ts +10 -1
- package/dist/schema/plan/plan-schema.d.ts +9 -1
- package/dist/schema/plan/render-ddl.d.ts +25 -1
- package/dist/schema/plan/types.d.ts +24 -0
- package/dist/security/rls-enforcement.d.ts +11 -0
- package/dist/services/FetchService.d.ts +12 -12
- package/dist/services/PersistService.d.ts +59 -0
- package/dist/services/collection-helpers.d.ts +3 -1
- package/dist/services/view-access.d.ts +21 -0
- package/dist/{websocket-D4wrzF3b.js → websocket-D2y88dOa.js} +3 -3
- package/dist/{websocket-D4wrzF3b.js.map → websocket-D2y88dOa.js.map} +1 -1
- package/package.json +7 -7
- package/dist/cli-errors-DYets7cp.js.map +0 -1
- package/dist/connection-czvI7TZL.js.map +0 -1
- package/dist/doctor-TJApVglQ.js.map +0 -1
- package/dist/ensure-collection-tables-CSbgkTBx.js.map +0 -1
- package/dist/generate-files-DutUrsSS.js.map +0 -1
- package/dist/generated-schema-diff-ChFg6UxI.js.map +0 -1
- package/dist/open-rebase-D9n8idex.js.map +0 -1
- package/dist/plan-schema-DMVh77yb.js.map +0 -1
- package/dist/render-ddl-NpPPDACz.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
__createRequire(import.meta.url);
|
|
3
3
|
import { n as require_arg, o as __toESM, t as promptConfirm } from "./cli-prompt-DXG0yk-h.js";
|
|
4
|
-
import { $ as
|
|
4
|
+
import { $ as isSyncedPlan, A as getTriggerExcludes, B as readViewsDdl, C as diagnoseMissingBin, D as getForeignIndexExcludes, E as ensureDevDatabaseExists, F as queryGeneratedColumnDependencies, G as GENERATED_SQL_DIR, H as withAppClient, I as queryUndeclarableConstraints, J as decidePushSafety, K as generatedSqlDir, L as readSearchDdl, M as getVectorExcludes, N as loadCollectionsForCli, O as getSearchExcludes, P as queryColumnTypes, Q as fromAlterTable, R as readTriggersDdl, S as detectProjectPackageManager, T as dropGeneratedColumns, U as workspaceMemberDir, V as resolveLocalBin, W as DESIRED_STATE_URL, X as detectDestructiveStatements, Y as destructiveOptInFlag, Z as extractPlanStatements, _ as atlasDevDatabaseUrl, a as diagnoseDbError, b as describeDevAddCommand, c as isEconnrefused, d as reportCommandFailure, et as warnIfYesApprovedDestructive, f as ExcludeIntrospectionError, g as applyViewsDdl, h as applyVectorDdl, i as diagnoseAtlasFailure, j as getUndeclaredConstraintExcludes, k as getTableExcludes, l as isSslNotEnabled, m as applyTriggersDdl, o as formatForeignGeneratedColumnBanner, p as applySearchDdl, q as prepareGeneratedSqlDir, rt as redactConnectionPasswords, s as isAuthFailure, t as checkDatabaseConnectivity, tt as forAtlas, v as closeAppClients, w as dropDevDatabase, x as describeReinstallCommand, y as describeBuildScriptRemedy, z as readVectorDdl } from "./cli-errors-D8s4z_3g.js";
|
|
5
5
|
import { a as outWarn, i as outError, o as atlasExcludePattern, r as out, s as excludePatternParts, t as chalk } from "./source-fZb92pN8.js";
|
|
6
6
|
import { t as nextStepAfterDbGenerate } from "./generate-next-step-DgK5BlBn.js";
|
|
7
|
-
import { D as execa, S as RLS_BOOTSTRAP_SQL, b as parseDriverLine, c as isDriverDbSubcommand, d as branchNameIn, f as branchSourceIn, g as assertKnownFlags, i as latestRecordedMigration, l as backupActionOf, m as unexpectedBranchArgs, o as planBaseline, p as resolveBranchSwitches, r as describeBaselinePlan, s as DRIVER_DB_SUBCOMMANDS, t as baselineVersionProblem, v as collectionsPathIn, w as dropLegacyAuthSchema, x as resolveDriverSwitches } from "./migrate-baseline-
|
|
7
|
+
import { D as execa, S as RLS_BOOTSTRAP_SQL, b as parseDriverLine, c as isDriverDbSubcommand, d as branchNameIn, f as branchSourceIn, g as assertKnownFlags, i as latestRecordedMigration, l as backupActionOf, m as unexpectedBranchArgs, o as planBaseline, p as resolveBranchSwitches, r as describeBaselinePlan, s as DRIVER_DB_SUBCOMMANDS, t as baselineVersionProblem, v as collectionsPathIn, w as dropLegacyAuthSchema, x as resolveDriverSwitches } from "./migrate-baseline-BeepEphh.js";
|
|
8
8
|
import { formatRelativeTime } from "@rebasepro/utils";
|
|
9
9
|
import path from "path";
|
|
10
10
|
import fs from "fs";
|
|
@@ -1207,7 +1207,7 @@ function generatesInProcess() {
|
|
|
1207
1207
|
async function generateInProcess(what, label, run) {
|
|
1208
1208
|
let generators;
|
|
1209
1209
|
try {
|
|
1210
|
-
generators = await import("./generate-files-
|
|
1210
|
+
generators = await import("./generate-files-DbwU8Btx.js").then((n) => n.t);
|
|
1211
1211
|
} catch (err) {
|
|
1212
1212
|
outError(chalk.red(`✗ Failed to run ${what}: ${err instanceof Error ? err.message : String(err)}`));
|
|
1213
1213
|
process.exit(1);
|
|
@@ -1254,7 +1254,7 @@ async function runPluginCommand(args) {
|
|
|
1254
1254
|
else if (domain === "schema") await schemaCommand(subcommand, args);
|
|
1255
1255
|
else if (domain === "doctor") await doctorPluginCommand(args);
|
|
1256
1256
|
else if (domain === "console") {
|
|
1257
|
-
const { consoleCommand } = await import("./cli-console-
|
|
1257
|
+
const { consoleCommand } = await import("./cli-console-DPdZCWTi.js");
|
|
1258
1258
|
process.exitCode = await consoleCommand(args);
|
|
1259
1259
|
} else {
|
|
1260
1260
|
outError(chalk.red(`Unknown domain command: ${domain}`));
|
|
@@ -1421,7 +1421,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1421
1421
|
return;
|
|
1422
1422
|
}
|
|
1423
1423
|
if (subcommand === "backup" || subcommand === "restore" || subcommand === "backups") {
|
|
1424
|
-
const { backupCommand, restoreCommand, backupsCommand } = await import("./backup-cli-
|
|
1424
|
+
const { backupCommand, restoreCommand, backupsCommand } = await import("./backup-cli-D_aKXPyX.js").then((n) => n.t);
|
|
1425
1425
|
if (subcommand === "backup" && backupActionOf(rawArgs) === "list") await backupsCommand(rawArgs);
|
|
1426
1426
|
else if (subcommand === "backup") await backupCommand(rawArgs);
|
|
1427
1427
|
else if (subcommand === "restore") await restoreCommand(rawArgs);
|
|
@@ -1468,7 +1468,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
const searchContent = readSearchDdl();
|
|
1470
1470
|
if (searchContent) {
|
|
1471
|
-
const { searchColumnDependencies } = await import("./generate-postgres-ddl-logic-
|
|
1471
|
+
const { searchColumnDependencies } = await import("./generate-postgres-ddl-logic-ISVgsP34.js").then((n) => n.s);
|
|
1472
1472
|
const migrationConflicts = findGeneratedColumnConflicts(parseColumnMutations(migrationContent), searchColumnDependencies(await loadCollectionsForCli(collectionsPath)));
|
|
1473
1473
|
const preamble = migrationDropPreamble(migrationConflicts);
|
|
1474
1474
|
if (preamble) {
|
|
@@ -1483,6 +1483,11 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1483
1483
|
migrationContent = `${migrationContent}\n\n${triggersContent}`;
|
|
1484
1484
|
out(chalk.gray(" ✓ Appended `updated_at` triggers to the migration"));
|
|
1485
1485
|
}
|
|
1486
|
+
const viewsContent = readViewsDdl();
|
|
1487
|
+
if (viewsContent) {
|
|
1488
|
+
migrationContent = `${migrationContent}\n\n${viewsContent}`;
|
|
1489
|
+
out(chalk.gray(" ✓ Appended views to the migration"));
|
|
1490
|
+
}
|
|
1486
1491
|
fs.writeFileSync(newestMigrationFile, migrationContent, "utf-8");
|
|
1487
1492
|
const policiesFile = path.join(generatedSqlDir(), "policies.sql");
|
|
1488
1493
|
if (fs.existsSync(policiesFile)) {
|
|
@@ -1688,6 +1693,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1688
1693
|
await applyVectorDdl(databaseUrl);
|
|
1689
1694
|
await applySearchDdl(databaseUrl);
|
|
1690
1695
|
await applyTriggersDdl(databaseUrl);
|
|
1696
|
+
await applyViewsDdl(databaseUrl);
|
|
1691
1697
|
await applyPolicies(databaseUrl, collectionsPath);
|
|
1692
1698
|
await reconcilePolicies(databaseUrl, collectionsPath);
|
|
1693
1699
|
await ensureRlsUserRole(databaseUrl);
|
|
@@ -1736,7 +1742,7 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1736
1742
|
if (databaseUrl) {
|
|
1737
1743
|
await ensureRlsUserRole(databaseUrl);
|
|
1738
1744
|
await retireLegacyAuthSchema(databaseUrl);
|
|
1739
|
-
const { stampMigratedPolicies } = await import("./migrate-policy-stamps-
|
|
1745
|
+
const { stampMigratedPolicies } = await import("./migrate-policy-stamps-cYMJ_9Ha.js");
|
|
1740
1746
|
await stampMigratedPolicies(databaseUrl, collectionsPath);
|
|
1741
1747
|
}
|
|
1742
1748
|
}
|
|
@@ -1764,8 +1770,8 @@ async function dbCommand(subcommand, rawArgs) {
|
|
|
1764
1770
|
* no such column reads nothing.
|
|
1765
1771
|
*/
|
|
1766
1772
|
async function keepDatabaseOwnedDefaults(databaseUrl, collectionsPath) {
|
|
1767
|
-
const { loadCollections } = await import("./doctor-
|
|
1768
|
-
const { databaseOwnedDefaultColumns, readKeptDefaults, withKeptDefaults } = await import("./push-kept-defaults-
|
|
1773
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1774
|
+
const { databaseOwnedDefaultColumns, readKeptDefaults, withKeptDefaults } = await import("./push-kept-defaults-CLbsuSmo.js");
|
|
1769
1775
|
const columns = databaseOwnedDefaultColumns(await loadCollections(path.resolve(process.cwd(), collectionsPath)));
|
|
1770
1776
|
if (columns.length === 0) return;
|
|
1771
1777
|
let kept;
|
|
@@ -1790,8 +1796,8 @@ async function keepDatabaseOwnedDefaults(databaseUrl, collectionsPath) {
|
|
|
1790
1796
|
async function renameLegacyForeignKeys(databaseUrl, collectionsPath, dryRun) {
|
|
1791
1797
|
let renames;
|
|
1792
1798
|
try {
|
|
1793
|
-
const { loadCollections } = await import("./doctor-
|
|
1794
|
-
const { legacyForeignKeyRenames } = await import("./push-legacy-renames-
|
|
1799
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1800
|
+
const { legacyForeignKeyRenames } = await import("./push-legacy-renames-DeW_HTLJ.js");
|
|
1795
1801
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
1796
1802
|
renames = await withAppClient(databaseUrl, (client) => legacyForeignKeyRenames({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, collections));
|
|
1797
1803
|
} catch {
|
|
@@ -1810,8 +1816,8 @@ async function renameLegacyForeignKeys(databaseUrl, collectionsPath, dryRun) {
|
|
|
1810
1816
|
/** Names the enum labels the database keeps after the collections dropped them. See `schema/enum-labels-kept.ts`. */
|
|
1811
1817
|
async function reportKeptEnumLabels(databaseUrl, collectionsPath) {
|
|
1812
1818
|
try {
|
|
1813
|
-
const { loadCollections } = await import("./doctor-
|
|
1814
|
-
const { keptEnumLabels, formatKeptEnumLabelsNotice } = await import("./enum-labels-kept-
|
|
1819
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1820
|
+
const { keptEnumLabels, formatKeptEnumLabelsNotice } = await import("./enum-labels-kept-DyFE4Gaq.js");
|
|
1815
1821
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
1816
1822
|
const kept = await withAppClient(databaseUrl, (client) => keptEnumLabels({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, collections));
|
|
1817
1823
|
if (kept.length > 0) outWarn(chalk.yellow(formatKeptEnumLabelsNotice(kept)));
|
|
@@ -1820,8 +1826,8 @@ async function reportKeptEnumLabels(databaseUrl, collectionsPath) {
|
|
|
1820
1826
|
async function prebuildForeignKeyIndexes(databaseUrl, collectionsPath, dryRun) {
|
|
1821
1827
|
let missing;
|
|
1822
1828
|
try {
|
|
1823
|
-
const { loadCollections } = await import("./doctor-
|
|
1824
|
-
const { missingForeignKeyIndexes } = await import("./push-index-prebuild-
|
|
1829
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1830
|
+
const { missingForeignKeyIndexes } = await import("./push-index-prebuild-CIvajIrL.js");
|
|
1825
1831
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
1826
1832
|
missing = await withAppClient(databaseUrl, (client) => missingForeignKeyIndexes({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, collections));
|
|
1827
1833
|
} catch {
|
|
@@ -1831,7 +1837,7 @@ async function prebuildForeignKeyIndexes(databaseUrl, collectionsPath, dryRun) {
|
|
|
1831
1837
|
if (missing.length === 0 || dryRun) return names;
|
|
1832
1838
|
out(chalk.gray(` Building ${missing.length} foreign-key index(es) on existing tables first — CONCURRENTLY, so writes go on:`));
|
|
1833
1839
|
try {
|
|
1834
|
-
const { buildDeferredIndexes } = await import("./deferred-index-build-
|
|
1840
|
+
const { buildDeferredIndexes } = await import("./deferred-index-build-F2GWu009.js").then((n) => n.r);
|
|
1835
1841
|
const outcome = await withAppClient(databaseUrl, (client) => buildDeferredIndexes(async () => ({
|
|
1836
1842
|
dedicated: true,
|
|
1837
1843
|
query: async (text) => ({ rows: (await client.query(text)).rows }),
|
|
@@ -1879,9 +1885,9 @@ async function lockManagedTables(databaseUrl, collectionsPath) {
|
|
|
1879
1885
|
let unsecured;
|
|
1880
1886
|
let userRole;
|
|
1881
1887
|
try {
|
|
1882
|
-
const { lockCollectionTables } = await import("./ensure-collection-policies-
|
|
1883
|
-
const { loadCollections } = await import("./doctor-
|
|
1884
|
-
userRole = (await import("./rls-enforcement-
|
|
1888
|
+
const { lockCollectionTables } = await import("./ensure-collection-policies-DUpWJb5D.js");
|
|
1889
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1890
|
+
userRole = (await import("./rls-enforcement-jZTv1yci.js").then((n) => n.u)).REBASE_USER_ROLE;
|
|
1885
1891
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
1886
1892
|
({unsecured} = await withAppClient(databaseUrl, (client) => lockCollectionTables({ query: async (text) => ({ rows: (await client.query(text)).rows }) }, collections)));
|
|
1887
1893
|
} catch (err) {
|
|
@@ -1916,8 +1922,8 @@ async function lockManagedTables(databaseUrl, collectionsPath) {
|
|
|
1916
1922
|
async function ensureAuthTables(databaseUrl, collectionsPath) {
|
|
1917
1923
|
try {
|
|
1918
1924
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
1919
|
-
const { ensureAuthTablesExist } = await import("./ensure-tables-
|
|
1920
|
-
const { loadCollections } = await import("./doctor-
|
|
1925
|
+
const { ensureAuthTablesExist } = await import("./ensure-tables-Bx1DYarz.js").then((n) => n.n);
|
|
1926
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
1921
1927
|
const authCollection = (await loadCollections(path.resolve(process.cwd(), collectionsPath))).find((c) => {
|
|
1922
1928
|
const a = c.auth;
|
|
1923
1929
|
return a === true || typeof a === "object" && a !== null && a.enabled === true;
|
|
@@ -1937,7 +1943,7 @@ async function ensureRlsUserRole(databaseUrl) {
|
|
|
1937
1943
|
const schemas = ["public", "rebase"];
|
|
1938
1944
|
let rls;
|
|
1939
1945
|
try {
|
|
1940
|
-
rls = await import("./rls-enforcement-
|
|
1946
|
+
rls = await import("./rls-enforcement-jZTv1yci.js").then((n) => n.u);
|
|
1941
1947
|
} catch (err) {
|
|
1942
1948
|
outError(chalk.red(`\n ✗ Could not load the RLS provisioning module: ${err instanceof Error ? err.message : String(err)}`));
|
|
1943
1949
|
return;
|
|
@@ -1997,10 +2003,10 @@ async function applyPolicies(databaseUrl, collectionsPath) {
|
|
|
1997
2003
|
*/
|
|
1998
2004
|
async function policyStamping(databaseUrl, collectionsPath, policiesSql) {
|
|
1999
2005
|
try {
|
|
2000
|
-
const { loadCollections } = await import("./doctor-
|
|
2001
|
-
const { planCollectionPolicies } = await import("./generate-postgres-ddl-logic-
|
|
2002
|
-
const { policyStampSql } = await import("./ensure-collection-policies-
|
|
2003
|
-
const { pinSearchPath } = await import("./connection-
|
|
2006
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
2007
|
+
const { planCollectionPolicies } = await import("./generate-postgres-ddl-logic-ISVgsP34.js").then((n) => n.s);
|
|
2008
|
+
const { policyStampSql } = await import("./ensure-collection-policies-DUpWJb5D.js");
|
|
2009
|
+
const { pinSearchPath } = await import("./connection-COuS5Fm-.js").then((n) => n.r);
|
|
2004
2010
|
return {
|
|
2005
2011
|
statements: stampableTables(planCollectionPolicies(await loadCollections(path.resolve(process.cwd(), collectionsPath))), policiesSql).map((plan) => policyStampSql(plan)).filter((statement) => statement !== void 0),
|
|
2006
2012
|
searchPath: pinSearchPath(databaseUrl) === databaseUrl ? void 0 : "public"
|
|
@@ -2017,9 +2023,9 @@ async function policyStamping(databaseUrl, collectionsPath, policiesSql) {
|
|
|
2017
2023
|
*/
|
|
2018
2024
|
async function readPolicyPushPlan(databaseUrl, collectionsPath) {
|
|
2019
2025
|
try {
|
|
2020
|
-
const { formatPolicyPushPlan, planPolicyPush, summarizePolicyPushPlan } = await import("./push-policy-plan
|
|
2021
|
-
const { loadCollections } = await import("./doctor-
|
|
2022
|
-
const { pinSearchPath } = await import("./connection-
|
|
2026
|
+
const { formatPolicyPushPlan, planPolicyPush, summarizePolicyPushPlan } = await import("./push-policy-plan--oRXOj4X.js");
|
|
2027
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
2028
|
+
const { pinSearchPath } = await import("./connection-COuS5Fm-.js").then((n) => n.r);
|
|
2023
2029
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
2024
2030
|
const plan = await withAppClient(databaseUrl, (client) => planPolicyPush({ query: async (text, values) => ({ rows: (await client.query(text, values)).rows }) }, collections, { searchPath: pinSearchPath(databaseUrl) === databaseUrl ? void 0 : "public" }));
|
|
2025
2031
|
return {
|
|
@@ -2046,8 +2052,8 @@ async function readPolicyPushPlan(databaseUrl, collectionsPath) {
|
|
|
2046
2052
|
*/
|
|
2047
2053
|
async function reconcilePolicies(databaseUrl, collectionsPath) {
|
|
2048
2054
|
try {
|
|
2049
|
-
const { checkPolicyDrift, dropOrphanedPolicies, formatPolicyDrift, hasDrift } = await import("./policy-drift-
|
|
2050
|
-
const { loadCollections } = await import("./doctor-
|
|
2055
|
+
const { checkPolicyDrift, dropOrphanedPolicies, formatPolicyDrift, hasDrift } = await import("./policy-drift-IjD2AUD-.js").then((n) => n.s);
|
|
2056
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
2051
2057
|
const collections = await loadCollections(path.resolve(process.cwd(), collectionsPath));
|
|
2052
2058
|
await withAppClient(databaseUrl, async (client) => {
|
|
2053
2059
|
const drift = await checkPolicyDrift(client, collections);
|
|
@@ -2132,8 +2138,8 @@ async function branchCommand(rawArgs) {
|
|
|
2132
2138
|
outError(chalk.red("✗ DATABASE_URL is not set. Make sure your .env file is configured."));
|
|
2133
2139
|
process.exit(1);
|
|
2134
2140
|
}
|
|
2135
|
-
const { DatabasePoolManager } = await import("./databasePoolManager-
|
|
2136
|
-
const { BranchService, reopenClosedDatabases, reopenedDatabasesNotice } = await import("./BranchService-
|
|
2141
|
+
const { DatabasePoolManager } = await import("./databasePoolManager-7hXVurmG.js").then((n) => n.n);
|
|
2142
|
+
const { BranchService, reopenClosedDatabases, reopenedDatabasesNotice } = await import("./BranchService-JiYJ_n9E.js").then((n) => n.n);
|
|
2137
2143
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
2138
2144
|
const { Pool } = await import("pg");
|
|
2139
2145
|
const healed = await reopenClosedDatabases(databaseUrl, [branchAction === "create" ? createSource(rawArgs) : void 0, process.env[ACTIVE_BRANCH_DATABASE_ENV]]);
|
|
@@ -2680,9 +2686,9 @@ async function schemaStaleCommand(rawArgs) {
|
|
|
2680
2686
|
const schemaFile = path.resolve(process.cwd(), outputPath);
|
|
2681
2687
|
const fix = Boolean(argsList["--fix"]);
|
|
2682
2688
|
const generatedExists = fs.existsSync(schemaFile);
|
|
2683
|
-
const { loadCollections } = await import("./doctor-
|
|
2689
|
+
const { loadCollections } = await import("./doctor-_g2tHRtG.js").then((n) => n.t);
|
|
2684
2690
|
const { findLegacyForeignKeyNames, compareGeneratedDeclarations, staleVerdict } = await import("./generated-schema-staleness-BvNF3i-s.js").then((n) => n.r);
|
|
2685
|
-
const { generateSchema } = await import("./generate-drizzle-schema-logic-
|
|
2691
|
+
const { generateSchema } = await import("./generate-drizzle-schema-logic-DpFA1UVd.js").then((n) => n.n);
|
|
2686
2692
|
const { relationalCollections } = await import("@rebasepro/common");
|
|
2687
2693
|
let stale = [];
|
|
2688
2694
|
let differences = [];
|