@rebasepro/server-postgres 0.25.0-canary.g70dad01 → 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-DO_3_CXt.js → BranchService-iXXZeVYD.js} +133 -20
- package/dist/BranchService-iXXZeVYD.js.map +1 -0
- package/dist/backup/backup-service.d.ts +8 -3
- package/dist/backup/pg-tools.d.ts +13 -1
- package/dist/{backup-cli-Ap2WX2uW.js → backup-cli-B2CAn9fR.js} +3 -3
- package/dist/{backup-cli-Ap2WX2uW.js.map → backup-cli-B2CAn9fR.js.map} +1 -1
- package/dist/{backup-service-DytMimsL.js → backup-service-Bb39plam.js} +67 -10
- package/dist/backup-service-Bb39plam.js.map +1 -0
- package/dist/{boot-ddl-D1lMCZLd.js → boot-ddl-s_3Hkz94.js} +2 -2
- package/dist/{boot-ddl-D1lMCZLd.js.map → boot-ddl-s_3Hkz94.js.map} +1 -1
- package/dist/{cli-console-CQGsBzSY.js → cli-console-DQ_K-sdM.js} +4 -4
- package/dist/{cli-console-CQGsBzSY.js.map → cli-console-DQ_K-sdM.js.map} +1 -1
- package/dist/{cli-errors-CJTKAKax.js → cli-errors-DwQnNATs.js} +52 -2
- package/dist/{cli-errors-CJTKAKax.js.map → cli-errors-DwQnNATs.js.map} +1 -1
- package/dist/cli-errors.d.ts +10 -0
- package/dist/cli.js +29 -24
- package/dist/cli.js.map +1 -1
- package/dist/{deferred-index-build-BiTqxqdl.js → deferred-index-build-Cis_HoGn.js} +3 -3
- package/dist/{deferred-index-build-BiTqxqdl.js.map → deferred-index-build-Cis_HoGn.js.map} +1 -1
- package/dist/{doctor-N3J88BN_.js → doctor-DvJH-IQG.js} +2 -2
- package/dist/{doctor-N3J88BN_.js.map → doctor-DvJH-IQG.js.map} +1 -1
- package/dist/{ensure-collection-policies-CVP6kIPT.js → ensure-collection-policies-CCqayoUz.js} +4 -4
- package/dist/{ensure-collection-policies-CVP6kIPT.js.map → ensure-collection-policies-CCqayoUz.js.map} +1 -1
- package/dist/{ensure-collection-tables-1WVNALOW.js → ensure-collection-tables-DvvImXDe.js} +5 -5
- package/dist/{ensure-collection-tables-1WVNALOW.js.map → ensure-collection-tables-DvvImXDe.js.map} +1 -1
- package/dist/{ensure-tables-D-Nm2k3S.js → ensure-tables-Dpgwx5sy.js} +2 -2
- package/dist/{ensure-tables-D-Nm2k3S.js.map → ensure-tables-Dpgwx5sy.js.map} +1 -1
- package/dist/{enum-labels-kept-e_93v2Ic.js → enum-labels-kept-CUlUlRkO.js} +2 -2
- package/dist/{enum-labels-kept-e_93v2Ic.js.map → enum-labels-kept-CUlUlRkO.js.map} +1 -1
- package/dist/index.es.js +6 -6
- package/dist/{open-rebase-Cwnqo5LU.js → open-rebase-BKA7Nyoe.js} +21 -16
- package/dist/{open-rebase-Cwnqo5LU.js.map → open-rebase-BKA7Nyoe.js.map} +1 -1
- package/dist/{pg-error-utils-Cmo8wZPy.js → pg-error-utils-Bv5n2PLn.js} +2 -2
- package/dist/{pg-error-utils-Cmo8wZPy.js.map → pg-error-utils-Bv5n2PLn.js.map} +1 -1
- package/dist/{push-index-prebuild-SXRlWBjc.js → push-index-prebuild-DIequ4bV.js} +3 -3
- package/dist/{push-index-prebuild-SXRlWBjc.js.map → push-index-prebuild-DIequ4bV.js.map} +1 -1
- package/dist/{push-legacy-renames-B37yKDac.js → push-legacy-renames-BqJut4F3.js} +3 -3
- package/dist/{push-legacy-renames-B37yKDac.js.map → push-legacy-renames-BqJut4F3.js.map} +1 -1
- package/dist/{push-policy-plan-jXzHAWSu.js → push-policy-plan-CvX8hiPb.js} +2 -2
- package/dist/{push-policy-plan-jXzHAWSu.js.map → push-policy-plan-CvX8hiPb.js.map} +1 -1
- package/dist/schema/doctor-cli.js +2 -2
- package/dist/schema/introspect-db.js +1 -1
- package/dist/services/BranchService.d.ts +40 -4
- package/dist/{websocket-BT85Yv_G.js → websocket-MC0zTBar.js} +3 -3
- package/dist/{websocket-BT85Yv_G.js.map → websocket-MC0zTBar.js.map} +1 -1
- package/package.json +7 -7
- package/dist/BranchService-DO_3_CXt.js.map +0 -1
- package/dist/backup-service-DytMimsL.js.map +0 -1
|
@@ -2,20 +2,20 @@ 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
11
|
import { n as planSchema, o as sharedRelationName } from "./plan-schema-CXOucCw-.js";
|
|
12
12
|
import { t as generateSchema } from "./generate-drizzle-schema-logic-DA3zM8zc.js";
|
|
13
13
|
import { r as renderPgType } from "./render-ddl-CQNwZdse.js";
|
|
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-
|
|
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-
|
|
18
|
+
import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-Dpgwx5sy.js";
|
|
19
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";
|
|
@@ -19946,6 +19946,11 @@ function diagnoseConnectFailure(err, connectionString) {
|
|
|
19946
19946
|
}
|
|
19947
19947
|
const { fatal, reason, code } = classifyConnectFailure(err);
|
|
19948
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
|
+
}
|
|
19949
19954
|
if (code === "53300") {
|
|
19950
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.";
|
|
19951
19956
|
logger.error(`
|
|
@@ -20431,7 +20436,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20431
20436
|
const openIndexBuildSession = (driverResult) => async () => {
|
|
20432
20437
|
const db = requireProvisioningDb(driverResult);
|
|
20433
20438
|
const pool = "$client" in db ? db.$client : void 0;
|
|
20434
|
-
const { isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-
|
|
20439
|
+
const { isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20435
20440
|
if (isPgPool(pool)) return poolIndexBuildSession(pool)();
|
|
20436
20441
|
const queryable = provisioningQueryable(driverResult);
|
|
20437
20442
|
return {
|
|
@@ -20551,11 +20556,11 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20551
20556
|
unavailable: historyUnavailableReason(state, { requireTransaction: false })
|
|
20552
20557
|
}) };
|
|
20553
20558
|
}
|
|
20554
|
-
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);
|
|
20555
20560
|
const historyTable = await ensureHistoryTableExists(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
|
|
20556
20561
|
const historyIndexes = await ensureHistoryIndexes(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
|
|
20557
20562
|
if (historyIndexes.length > 0) {
|
|
20558
|
-
const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-
|
|
20563
|
+
const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20559
20564
|
const indexOptions = {
|
|
20560
20565
|
log: (message) => logger.info(`[history] ${message}`),
|
|
20561
20566
|
lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS
|
|
@@ -20611,9 +20616,9 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20611
20616
|
* proved it can bootstrap with.
|
|
20612
20617
|
*/
|
|
20613
20618
|
async ensureCollectionSchema(collections, driverResult, log) {
|
|
20614
|
-
const { ensureCollectionTables } = await import("./ensure-collection-tables-
|
|
20619
|
+
const { ensureCollectionTables } = await import("./ensure-collection-tables-DvvImXDe.js").then((n) => n.n);
|
|
20615
20620
|
const queryable = provisioningQueryable(driverResult);
|
|
20616
|
-
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);
|
|
20617
20622
|
const provisionOnly = ["1", "true"].includes((process.env.REBASE_PROVISION_ONLY ?? "").trim().toLowerCase());
|
|
20618
20623
|
const plan = await ensureCollectionTables(queryable, collections, log, {
|
|
20619
20624
|
lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS,
|
|
@@ -20625,7 +20630,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20625
20630
|
pendingIndexBuild?.cancel();
|
|
20626
20631
|
pendingIndexBuild = void 0;
|
|
20627
20632
|
if (!provisionOnly && plan.deferredIndexes.length > 0) {
|
|
20628
|
-
const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-
|
|
20633
|
+
const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-Cis_HoGn.js").then((n) => n.r);
|
|
20629
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.`);
|
|
20630
20635
|
pendingIndexBuild = scheduleDeferredIndexBuild(openIndexBuildSession(driverResult), plan.deferredIndexes, {
|
|
20631
20636
|
log: (message) => logger.info(`[schema] ${message}`),
|
|
@@ -20665,7 +20670,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20665
20670
|
await provisionRlsRuntime(driverResult);
|
|
20666
20671
|
},
|
|
20667
20672
|
async ensureCollectionPolicies(collections, driverResult, log) {
|
|
20668
|
-
const { ensureCollectionPolicies, describeRulesDropped } = await import("./ensure-collection-policies-
|
|
20673
|
+
const { ensureCollectionPolicies, describeRulesDropped } = await import("./ensure-collection-policies-CCqayoUz.js");
|
|
20669
20674
|
const queryable = provisioningQueryable(driverResult);
|
|
20670
20675
|
const { rows } = await queryable.query("SELECT to_regprocedure('rebase.roles()') IS NOT NULL AS present");
|
|
20671
20676
|
if (!rows[0]?.present) await provisionRlsRuntime(driverResult);
|
|
@@ -20781,7 +20786,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
20781
20786
|
return driverResult.internals.driver.admin;
|
|
20782
20787
|
},
|
|
20783
20788
|
async initializeWebsockets(server, realtimeService, driver, config, adapter, limits) {
|
|
20784
|
-
const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-
|
|
20789
|
+
const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-MC0zTBar.js").then((n) => n.c);
|
|
20785
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.`);
|
|
20786
20791
|
const realtimeConfig = effectiveConfig().realtime;
|
|
20787
20792
|
const maxSocketsPerUser = realtimeConfig?.maxSocketsPerUser !== void 0 ? parseMaxSocketsPerUser(realtimeConfig.maxSocketsPerUser, "realtime.maxSocketsPerUser") : void 0;
|
|
@@ -20920,4 +20925,4 @@ async function openRebase(options) {
|
|
|
20920
20925
|
//#endregion
|
|
20921
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 };
|
|
20922
20927
|
|
|
20923
|
-
//# sourceMappingURL=open-rebase-
|
|
20928
|
+
//# sourceMappingURL=open-rebase-BKA7Nyoe.js.map
|