@rebasepro/server-postgres 0.25.0-canary.ge06257e → 0.25.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-DNg4txyf.js → BranchService-iXXZeVYD.js} +222 -19
- package/dist/BranchService-iXXZeVYD.js.map +1 -0
- package/dist/backup/backup-cli.d.ts +33 -1
- package/dist/backup/backup-service.d.ts +68 -0
- package/dist/backup/pg-binary.d.ts +2 -2
- package/dist/backup/pg-tools.d.ts +60 -1
- package/dist/{backup-cli-HCEkPcQj.js → backup-cli-B2CAn9fR.js} +105 -14
- package/dist/backup-cli-B2CAn9fR.js.map +1 -0
- package/dist/{backup-service-D-UpT7DH.js → backup-service-Bb39plam.js} +358 -21
- package/dist/backup-service-Bb39plam.js.map +1 -0
- package/dist/{boot-ddl-Dnvpmm_T.js → boot-ddl-s_3Hkz94.js} +2 -2
- package/dist/{boot-ddl-Dnvpmm_T.js.map → boot-ddl-s_3Hkz94.js.map} +1 -1
- package/dist/branch-prune.d.ts +18 -0
- package/dist/{cli-console-C_ISGwJo.js → cli-console-DQ_K-sdM.js} +17 -10
- package/dist/cli-console-DQ_K-sdM.js.map +1 -0
- package/dist/cli-console.d.ts +4 -3
- package/dist/{cli-errors-mx4sSjB8.js → cli-errors-DwQnNATs.js} +80 -12
- package/dist/{cli-errors-mx4sSjB8.js.map → cli-errors-DwQnNATs.js.map} +1 -1
- package/dist/cli-errors.d.ts +12 -1
- package/dist/{cli-flags-DUozBFyK.js → cli-flags-D-b0qL9T.js} +3 -2
- package/dist/{cli-flags-DUozBFyK.js.map → cli-flags-D-b0qL9T.js.map} +1 -1
- package/dist/cli.js +106 -40
- package/dist/cli.js.map +1 -1
- package/dist/collections/validate-relations.d.ts +8 -2
- package/dist/{deferred-index-build-Ca6OqKyR.js → deferred-index-build-Cis_HoGn.js} +6 -6
- package/dist/{deferred-index-build-Ca6OqKyR.js.map → deferred-index-build-Cis_HoGn.js.map} +1 -1
- package/dist/{doctor-CJyuhV1n.js → doctor-DvJH-IQG.js} +6 -6
- package/dist/doctor-DvJH-IQG.js.map +1 -0
- package/dist/{ensure-collection-policies-C1ux3V_z.js → ensure-collection-policies-CCqayoUz.js} +54 -8
- package/dist/ensure-collection-policies-CCqayoUz.js.map +1 -0
- package/dist/{ensure-collection-tables-Do-Bvb64.js → ensure-collection-tables-DvvImXDe.js} +7 -7
- package/dist/{ensure-collection-tables-Do-Bvb64.js.map → ensure-collection-tables-DvvImXDe.js.map} +1 -1
- package/dist/{ensure-tables-Dl_Eh9ow.js → ensure-tables-Dpgwx5sy.js} +2 -2
- package/dist/{ensure-tables-Dl_Eh9ow.js.map → ensure-tables-Dpgwx5sy.js.map} +1 -1
- package/dist/{enum-labels-kept-D9eTIWCz.js → enum-labels-kept-CUlUlRkO.js} +3 -3
- package/dist/{enum-labels-kept-D9eTIWCz.js.map → enum-labels-kept-CUlUlRkO.js.map} +1 -1
- package/dist/{generate-drizzle-schema-Bf8canaR.js → generate-drizzle-schema-C3EAP9HE.js} +3 -3
- package/dist/{generate-drizzle-schema-Bf8canaR.js.map → generate-drizzle-schema-C3EAP9HE.js.map} +1 -1
- package/dist/{generate-drizzle-schema-logic-BaT0H7Gq.js → generate-drizzle-schema-logic-DA3zM8zc.js} +3 -3
- package/dist/{generate-drizzle-schema-logic-BaT0H7Gq.js.map → generate-drizzle-schema-logic-DA3zM8zc.js.map} +1 -1
- package/dist/{generate-files-D50Pxw1G.js → generate-files-ClmOUHXj.js} +5 -5
- package/dist/{generate-files-D50Pxw1G.js.map → generate-files-ClmOUHXj.js.map} +1 -1
- package/dist/{generate-next-step-DCd7yiJ2.js → generate-next-step-DCeS4LrJ.js} +22 -14
- package/dist/{generate-next-step-DCd7yiJ2.js.map → generate-next-step-DCeS4LrJ.js.map} +1 -1
- package/dist/{generate-postgres-ddl-logic-B4k9djAV.js → generate-postgres-ddl-logic-4eUP4t8w.js} +3 -3
- package/dist/{generate-postgres-ddl-logic-B4k9djAV.js.map → generate-postgres-ddl-logic-4eUP4t8w.js.map} +1 -1
- package/dist/index.es.js +8 -8
- package/dist/{introspect-db-logic-j2vYhmdP.js → introspect-db-logic-CI5CU_n0.js} +2 -2
- package/dist/{introspect-db-logic-j2vYhmdP.js.map → introspect-db-logic-CI5CU_n0.js.map} +1 -1
- package/dist/{open-rebase-D8rytTP0.js → open-rebase-BKA7Nyoe.js} +47 -27
- package/dist/{open-rebase-D8rytTP0.js.map → open-rebase-BKA7Nyoe.js.map} +1 -1
- package/dist/{pg-error-utils-CdsGYMTm.js → pg-error-utils-Bv5n2PLn.js} +11 -4
- package/dist/pg-error-utils-Bv5n2PLn.js.map +1 -0
- package/dist/{plan-schema-CsNgK0qi.js → plan-schema-CXOucCw-.js} +2 -2
- package/dist/{plan-schema-CsNgK0qi.js.map → plan-schema-CXOucCw-.js.map} +1 -1
- package/dist/{policy-drift-CY5P1ZRu.js → policy-drift-vm0BcvcE.js} +2 -2
- package/dist/{policy-drift-CY5P1ZRu.js.map → policy-drift-vm0BcvcE.js.map} +1 -1
- package/dist/{push-index-prebuild-BDFcfRPo.js → push-index-prebuild-DIequ4bV.js} +4 -4
- package/dist/{push-index-prebuild-BDFcfRPo.js.map → push-index-prebuild-DIequ4bV.js.map} +1 -1
- package/dist/{push-legacy-renames-D4bvMWAb.js → push-legacy-renames-BqJut4F3.js} +4 -4
- package/dist/{push-legacy-renames-D4bvMWAb.js.map → push-legacy-renames-BqJut4F3.js.map} +1 -1
- package/dist/{push-policy-plan-DTXE6aVa.js → push-policy-plan-CvX8hiPb.js} +22 -6
- package/dist/push-policy-plan-CvX8hiPb.js.map +1 -0
- package/dist/{render-ddl-CrfEe__B.js → render-ddl-CQNwZdse.js} +3 -3
- package/dist/{render-ddl-CrfEe__B.js.map → render-ddl-CQNwZdse.js.map} +1 -1
- package/dist/schema/atlas-argv.d.ts +3 -1
- package/dist/schema/doctor-cli.js +4 -4
- package/dist/schema/ensure-collection-policies.d.ts +24 -0
- package/dist/schema/generate-drizzle-schema.js +1 -1
- package/dist/schema/generate-next-step.d.ts +20 -8
- package/dist/schema/generate-postgres-ddl.js +2 -2
- package/dist/schema/introspect-db.js +5 -4
- package/dist/schema/introspect-db.js.map +1 -1
- package/dist/schema/push-policy-plan.d.ts +5 -2
- package/dist/services/BranchService.d.ts +67 -0
- package/dist/{source-DB6xJv3p.js → source-Bv5KPeIx.js} +45 -2
- package/dist/source-Bv5KPeIx.js.map +1 -0
- package/dist/{websocket-DMeXOoyv.js → websocket-MC0zTBar.js} +3 -3
- package/dist/{websocket-DMeXOoyv.js.map → websocket-MC0zTBar.js.map} +1 -1
- package/package.json +7 -7
- package/dist/BranchService-DNg4txyf.js.map +0 -1
- package/dist/backup-cli-HCEkPcQj.js.map +0 -1
- package/dist/backup-service-D-UpT7DH.js.map +0 -1
- package/dist/cli-console-C_ISGwJo.js.map +0 -1
- package/dist/doctor-CJyuhV1n.js.map +0 -1
- package/dist/ensure-collection-policies-C1ux3V_z.js.map +0 -1
- package/dist/pg-error-utils-CdsGYMTm.js.map +0 -1
- package/dist/push-policy-plan-DTXE6aVa.js.map +0 -1
- package/dist/source-DB6xJv3p.js.map +0 -1
|
@@ -2,21 +2,21 @@ import { createRequire as __createRequire } from "module";
|
|
|
2
2
|
__createRequire(import.meta.url);
|
|
3
3
|
import { i as createPostgresDatabaseConnection } from "./connection-C938nR3E.js";
|
|
4
4
|
import { _ as visibleColumnProjection, a as buildSearchColumnSpec, l as searchColumnNames, r as SEARCH_UNACCENT_FN, s as hiddenColumnsOption } from "./search-column-BM-GV6vH.js";
|
|
5
|
-
import {
|
|
6
|
-
import { a as pgErrorToFriendlyMessage, i as isRowLevelSecurityDenial, n as extractPgError, o as reachedDatabase, r as isRoleSwitchingPermissionError, s as sanitizeErrorForClient, t as classifyConnectFailure } from "./pg-error-utils-
|
|
7
|
-
import { t as BranchService } from "./BranchService-
|
|
5
|
+
import { a as diagnoseDbError, c as isEconnrefused, n as closedDatabaseName, nt as extractCauseMessage, r as deepestErrorMessage, u as parseHostInfo } from "./cli-errors-DwQnNATs.js";
|
|
6
|
+
import { a as pgErrorToFriendlyMessage, i as isRowLevelSecurityDenial, n as extractPgError, o as reachedDatabase, r as isRoleSwitchingPermissionError, s as sanitizeErrorForClient, t as classifyConnectFailure } from "./pg-error-utils-Bv5n2PLn.js";
|
|
7
|
+
import { t as BranchService } from "./BranchService-iXXZeVYD.js";
|
|
8
8
|
import { a as ensureAppRoleGrants, d as warnOnLegacyRlsFunctions, f as warnOnRoleSchemaCollision, i as ensureAppRole, l as validatePolicyPgRoles, n as applyAuthContext, r as detectConnectionPosture, s as revokeUserRoleSql, t as REBASE_USER_ROLE$1, u as warnOnAnonymousGrants } from "./rls-enforcement-D7P4-ZYX.js";
|
|
9
9
|
import { u as resolveColumnName } from "./column-plan-helpers-D_V4oaZh.js";
|
|
10
10
|
import { i as isAuthCollection, t as AUTH_USERS_COLUMNS } from "./auth-users-columns-C72EMoDJ.js";
|
|
11
|
-
import { n as planSchema, o as sharedRelationName } from "./plan-schema-
|
|
12
|
-
import { t as generateSchema } from "./generate-drizzle-schema-logic-
|
|
13
|
-
import { r as renderPgType } from "./render-ddl-
|
|
14
|
-
import { u as typesAgree } from "./deferred-index-build-
|
|
15
|
-
import { a as isLockTimeout, c as resolveBootLockOptions, l as sleep, n as BOOT_LOCK_TIMEOUT_MS } from "./boot-ddl-
|
|
16
|
-
import { a as readSchemaFactsFor, r as planCollectionSchemaEnsure } from "./ensure-collection-tables-
|
|
11
|
+
import { n as planSchema, o as sharedRelationName } from "./plan-schema-CXOucCw-.js";
|
|
12
|
+
import { t as generateSchema } from "./generate-drizzle-schema-logic-DA3zM8zc.js";
|
|
13
|
+
import { r as renderPgType } from "./render-ddl-CQNwZdse.js";
|
|
14
|
+
import { u as typesAgree } from "./deferred-index-build-Cis_HoGn.js";
|
|
15
|
+
import { a as isLockTimeout, c as resolveBootLockOptions, l as sleep, n as BOOT_LOCK_TIMEOUT_MS } from "./boot-ddl-s_3Hkz94.js";
|
|
16
|
+
import { a as readSchemaFactsFor, r as planCollectionSchemaEnsure } from "./ensure-collection-tables-DvvImXDe.js";
|
|
17
17
|
import { t as DatabasePoolManager } from "./databasePoolManager-Yqdw14wY.js";
|
|
18
|
-
import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-
|
|
19
|
-
import { _ as humanize, g as mapPgType, i as buildTablesMap, l as getIconForTable, p as singularize, r as buildEnumMap, u as identifyJoinTables } from "./introspect-db-logic-
|
|
18
|
+
import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-Dpgwx5sy.js";
|
|
19
|
+
import { _ as humanize, g as mapPgType, i as buildTablesMap, l as getIconForTable, p as singularize, r as buildEnumMap, u as identifyJoinTables } from "./introspect-db-logic-CI5CU_n0.js";
|
|
20
20
|
import { Client, DatabaseError, Pool } from "pg";
|
|
21
21
|
import { drizzle } from "drizzle-orm/node-postgres";
|
|
22
22
|
import { ApiError, assertQueryFieldsReadable, createDdlBootstrapper, createEmailService, logger, rawQueryLoggingEnabled, resolveBatchRefs, rowETag, splitFieldOps } from "@rebasepro/server";
|
|
@@ -16485,9 +16485,10 @@ function staleCodegenDefect(table, { legacy, current }) {
|
|
|
16485
16485
|
* table, a target belonging to another backend — because a false alarm here
|
|
16486
16486
|
* costs more than a missed one: it would block boot on a working app.
|
|
16487
16487
|
*/
|
|
16488
|
-
function findRelationDefects(collections, registry) {
|
|
16488
|
+
function findRelationDefects(collections, registry, given) {
|
|
16489
16489
|
const defects = [];
|
|
16490
16490
|
const registeredSlugs = new Set(registry.getCollections().map((c) => c.slug));
|
|
16491
|
+
const givenSlugs = given ? new Set(given.map((c) => c.slug)) : void 0;
|
|
16491
16492
|
for (const collection of collections) {
|
|
16492
16493
|
const sourceTableName = getTableName$1(collection);
|
|
16493
16494
|
const sourceTable = registry.getTable(sourceTableName);
|
|
@@ -16515,7 +16516,11 @@ function findRelationDefects(collections, registry) {
|
|
|
16515
16516
|
const targetTableName = getTableName$1(targetCollection);
|
|
16516
16517
|
const targetTable = registry.getTable(targetTableName);
|
|
16517
16518
|
if (!targetTable) {
|
|
16518
|
-
defects.push({
|
|
16519
|
+
defects.push(givenSlugs && !givenSlugs.has(targetCollection.slug) ? {
|
|
16520
|
+
...at,
|
|
16521
|
+
problem: `it points at collection \`${targetCollection.slug}\`, which is not among the collections this backend was given — it is registered only as this relation's target, so no table was built for it`,
|
|
16522
|
+
fix: `add the \`${targetCollection.slug}\` collection to the \`collections\` you pass, or pass every collection the relations reach`
|
|
16523
|
+
} : {
|
|
16519
16524
|
...at,
|
|
16520
16525
|
problem: `it points at collection \`${targetCollection.slug}\`, which has no table \`${targetTableName}\` in the schema`,
|
|
16521
16526
|
fix: `create the \`${targetTableName}\` table, or correct \`table\` on the \`${targetCollection.slug}\` collection`
|
|
@@ -16658,8 +16663,8 @@ function findRelationDefects(collections, registry) {
|
|
|
16658
16663
|
* "nothing" is the kind of bug found in production, weeks later, by a user
|
|
16659
16664
|
* asking where their data went.
|
|
16660
16665
|
*/
|
|
16661
|
-
function assertRelationsResolve(collections, registry) {
|
|
16662
|
-
const defects = findRelationDefects(collections, registry);
|
|
16666
|
+
function assertRelationsResolve(collections, registry, given) {
|
|
16667
|
+
const defects = findRelationDefects(collections, registry, given);
|
|
16663
16668
|
if (defects.length === 0) return;
|
|
16664
16669
|
const lines = defects.map((d) => ` • ${d.collection}.${d.relationName} (${d.kind})\n ${d.problem}\n fix: ${d.fix}`);
|
|
16665
16670
|
throw new Error(`${defects.length} relation${defects.length === 1 ? "" : "s"} cannot resolve against the database this server is connected to.
|
|
@@ -16697,7 +16702,7 @@ function buildCollectionRegistry(schema) {
|
|
|
16697
16702
|
if (schema.enums) registry.registerEnums(schema.enums);
|
|
16698
16703
|
if (schema.relations) registry.registerRelations(schema.relations);
|
|
16699
16704
|
warnOnKeysTheAdminCannotResolve(registry.getCollections(), registry);
|
|
16700
|
-
assertRelationsResolve(registry.getCollections(), registry);
|
|
16705
|
+
assertRelationsResolve(registry.getCollections(), registry, schema.collections);
|
|
16701
16706
|
return registry;
|
|
16702
16707
|
}
|
|
16703
16708
|
//#endregion
|
|
@@ -19941,6 +19946,18 @@ function diagnoseConnectFailure(err, connectionString) {
|
|
|
19941
19946
|
}
|
|
19942
19947
|
const { fatal, reason, code } = classifyConnectFailure(err);
|
|
19943
19948
|
const detail = code ? ` [${code}]` : "";
|
|
19949
|
+
const closed = closedDatabaseName(err);
|
|
19950
|
+
if (closed) {
|
|
19951
|
+
logger.error(diagnoseDbError(err, url) ?? `❌ Database "${closed}" at ${hostInfo} is closed to new connections`);
|
|
19952
|
+
return new Error(`Database "${closed}" at ${hostInfo} is closed to new connections: ${reason}${detail}. Open it again with \`rebase db branch list\`.`, { cause: err });
|
|
19953
|
+
}
|
|
19954
|
+
if (code === "53300") {
|
|
19955
|
+
const remedy = extractPgError(err)?.hint ?? "Close another client, cap this process's pool with REBASE_DB_POOL_MAX, or raise the server's max_connections.";
|
|
19956
|
+
logger.error(`
|
|
19957
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19958
|
+
❌ PostgreSQL at ${hostInfo} has no free connection\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n ${reason}${detail}\n\n ${remedy}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
|
|
19959
|
+
return;
|
|
19960
|
+
}
|
|
19944
19961
|
if (fatal) {
|
|
19945
19962
|
logger.error(diagnoseDbError(err, url) ?? `
|
|
19946
19963
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
@@ -20419,7 +20436,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20419
20436
|
const openIndexBuildSession = (driverResult) => async () => {
|
|
20420
20437
|
const db = requireProvisioningDb(driverResult);
|
|
20421
20438
|
const pool = "$client" in db ? db.$client : void 0;
|
|
20422
|
-
const { isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-
|
|
20439
|
+
const { isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20423
20440
|
if (isPgPool(pool)) return poolIndexBuildSession(pool)();
|
|
20424
20441
|
const queryable = provisioningQueryable(driverResult);
|
|
20425
20442
|
return {
|
|
@@ -20539,11 +20556,11 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20539
20556
|
unavailable: historyUnavailableReason(state, { requireTransaction: false })
|
|
20540
20557
|
}) };
|
|
20541
20558
|
}
|
|
20542
|
-
const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-
|
|
20559
|
+
const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-s_3Hkz94.js").then((n) => n.i);
|
|
20543
20560
|
const historyTable = await ensureHistoryTableExists(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
|
|
20544
20561
|
const historyIndexes = await ensureHistoryIndexes(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
|
|
20545
20562
|
if (historyIndexes.length > 0) {
|
|
20546
|
-
const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-
|
|
20563
|
+
const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20547
20564
|
const indexOptions = {
|
|
20548
20565
|
log: (message) => logger.info(`[history] ${message}`),
|
|
20549
20566
|
lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS
|
|
@@ -20580,7 +20597,9 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20580
20597
|
try {
|
|
20581
20598
|
await db.execute(sql`SELECT 1`);
|
|
20582
20599
|
} catch (err) {
|
|
20583
|
-
|
|
20600
|
+
const hostInfo = parseHostInfo(pgConfig.connectionString ?? "");
|
|
20601
|
+
const { reason, code } = classifyConnectFailure(err);
|
|
20602
|
+
throw diagnoseConnectFailure(err, pgConfig.connectionString) ?? new Error(code === "53300" ? `PostgreSQL at ${hostInfo} has no free connection: ${reason} [53300]` : `Cannot reach PostgreSQL at ${hostInfo} to provision the collection schema.`, { cause: err });
|
|
20584
20603
|
}
|
|
20585
20604
|
},
|
|
20586
20605
|
/**
|
|
@@ -20597,9 +20616,9 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20597
20616
|
* proved it can bootstrap with.
|
|
20598
20617
|
*/
|
|
20599
20618
|
async ensureCollectionSchema(collections, driverResult, log) {
|
|
20600
|
-
const { ensureCollectionTables } = await import("./ensure-collection-tables-
|
|
20619
|
+
const { ensureCollectionTables } = await import("./ensure-collection-tables-DvvImXDe.js").then((n) => n.n);
|
|
20601
20620
|
const queryable = provisioningQueryable(driverResult);
|
|
20602
|
-
const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-
|
|
20621
|
+
const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-s_3Hkz94.js").then((n) => n.i);
|
|
20603
20622
|
const provisionOnly = ["1", "true"].includes((process.env.REBASE_PROVISION_ONLY ?? "").trim().toLowerCase());
|
|
20604
20623
|
const plan = await ensureCollectionTables(queryable, collections, log, {
|
|
20605
20624
|
lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS,
|
|
@@ -20611,7 +20630,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20611
20630
|
pendingIndexBuild?.cancel();
|
|
20612
20631
|
pendingIndexBuild = void 0;
|
|
20613
20632
|
if (!provisionOnly && plan.deferredIndexes.length > 0) {
|
|
20614
|
-
const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-
|
|
20633
|
+
const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20615
20634
|
logger.info(`[schema] ${plan.deferredIndexes.length} index(es) are missing, or were left INVALID, on tables that already exist. They are built in the background once the server is serving, one at a time, without blocking reads or writes.`);
|
|
20616
20635
|
pendingIndexBuild = scheduleDeferredIndexBuild(openIndexBuildSession(driverResult), plan.deferredIndexes, {
|
|
20617
20636
|
log: (message) => logger.info(`[schema] ${message}`),
|
|
@@ -20651,7 +20670,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20651
20670
|
await provisionRlsRuntime(driverResult);
|
|
20652
20671
|
},
|
|
20653
20672
|
async ensureCollectionPolicies(collections, driverResult, log) {
|
|
20654
|
-
const { ensureCollectionPolicies, describeRulesDropped } = await import("./ensure-collection-policies-
|
|
20673
|
+
const { ensureCollectionPolicies, describeRulesDropped } = await import("./ensure-collection-policies-CCqayoUz.js");
|
|
20655
20674
|
const queryable = provisioningQueryable(driverResult);
|
|
20656
20675
|
const { rows } = await queryable.query("SELECT to_regprocedure('rebase.roles()') IS NOT NULL AS present");
|
|
20657
20676
|
if (!rows[0]?.present) await provisionRlsRuntime(driverResult);
|
|
@@ -20767,7 +20786,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20767
20786
|
return driverResult.internals.driver.admin;
|
|
20768
20787
|
},
|
|
20769
20788
|
async initializeWebsockets(server, realtimeService, driver, config, adapter, limits) {
|
|
20770
|
-
const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-
|
|
20789
|
+
const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-MC0zTBar.js").then((n) => n.c);
|
|
20771
20790
|
if (!isSocketRealtimeService(realtimeService)) throw new Error(`The realtime service handed to the Postgres socket cannot serve it — it has no ${socketRealtimeMissing(realtimeService).join(", ")}. Every socket would fail on its first frame.`);
|
|
20772
20791
|
const realtimeConfig = effectiveConfig().realtime;
|
|
20773
20792
|
const maxSocketsPerUser = realtimeConfig?.maxSocketsPerUser !== void 0 ? parseMaxSocketsPerUser(realtimeConfig.maxSocketsPerUser, "realtime.maxSocketsPerUser") : void 0;
|
|
@@ -20838,7 +20857,8 @@ async function openRebase(options) {
|
|
|
20838
20857
|
await pool?.query("SELECT 1");
|
|
20839
20858
|
} catch (error) {
|
|
20840
20859
|
await owned?.pool.end().catch(() => void 0);
|
|
20841
|
-
|
|
20860
|
+
const hint = extractPgError(error)?.hint;
|
|
20861
|
+
throw new Error(`Cannot connect to PostgreSQL at ${parseHostInfo(connectionString ?? "")}: ${deepestErrorMessage(error) ?? "the connection failed"}.${hint ? ` ${hint}` : ""}`, { cause: error });
|
|
20842
20862
|
}
|
|
20843
20863
|
let opened;
|
|
20844
20864
|
try {
|
|
@@ -20905,4 +20925,4 @@ async function openRebase(options) {
|
|
|
20905
20925
|
//#endregion
|
|
20906
20926
|
export { AuthenticatedPostgresBackendDriver as $, budgetSendBuffers as A, mfaFactors as B, PG_NOTIFY_MAX_PAYLOAD_BYTES as C, MemoryChannelBus as D, parseChannelBusPayload as E, createAuthSchema as F, recoveryCodesRelations as G, passwordResetTokens as H, magicLinkTokens as I, userIdentities as J, refreshTokens as K, magicLinkTokensRelations as L, terminateIfBacklogged as M, assertReadRequestReadable as N, frameByteLength as O, appConfig as P, usersSchema as Q, mfaChallenges as R, DEFAULT_BATCH_WINDOW_MS as S, parseChannelBusFrame as T, passwordResetTokensRelations as U, mfaFactorsRelations as V, recoveryCodes as W, users as X, userIdentitiesRelations as Y, usersRelations as Z, parseRealtimeTuning as _, listedColumnKeys as _t, openPostgresDriver as a, isRoleSwitchingOptedOut as at, resolveChannelBusSetting as b, resolveSourceUrls as c, SqlResultTooLargeError as ct, DEFAULT_RECOUNT_MIN_ROWS as d, DrizzleConditionBuilder as dt, CONNECTION_OWNER as et, PostgresRealtimeProvider as f, PostgresConditionBuilder as ft, parseMaxSubscriptionsPerSocket as g, joinColumn as gt, parseMaxSocketsPerUser as h, getUnknownFilterFieldsMode as ht, isScaffoldedLocalDatabase as i, effectiveSqlRole as it, reapSilentSockets as j, isChannelBusInstance$1 as k, PostgresCollectionRegistry as l, isNestedPath as lt, packEntityChanges as m, escapeLikePattern as mt, createPostgresBootstrapper as n, RoleSwitchUnavailableError as nt, postgresDriverConfigFromEnv as o, sqlRoleRanAs as ot, RealtimeService as p, configureUnknownFilterFields as pt, refreshTokensRelations as q, describeSchemaDriftCause as r, branchParentDatabase as rt, resolveDriftCheckName as s, SQL_RESULT_BYTE_BUDGET as st, openRebase as t, PostgresBackendDriver as tt, DEFAULT_MAX_SUBSCRIPTIONS_PER_SOCKET as u, resolveNestedPath as ut, refetchConcurrencyFor as v, PostgresChannelBus as w, CHANNEL_BUS_NOTIFY_CHANNEL as x, createChannelBus as y, mfaChallengesRelations as z };
|
|
20907
20927
|
|
|
20908
|
-
//# sourceMappingURL=open-rebase-
|
|
20928
|
+
//# sourceMappingURL=open-rebase-BKA7Nyoe.js.map
|