@rebasepro/server-postgres 0.16.1-canary.gef08a6e → 0.17.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/{backup-service-BL5x6Fj5.js → backup-service-BtgHxfFm.js} +2 -1
- package/dist/{backup-service-BL5x6Fj5.js.map → backup-service-BtgHxfFm.js.map} +1 -1
- package/dist/cli-helpers.d.ts +41 -0
- package/dist/{ensure-collection-tables-DpGX_25A.js → collection-index-DxJBvVTH.js} +240 -1913
- package/dist/collection-index-DxJBvVTH.js.map +1 -0
- package/dist/{ensure-collection-policies-RK8-SFLs.js → ensure-collection-policies-DFpOl8SM.js} +3 -3
- package/dist/{ensure-collection-policies-RK8-SFLs.js.map → ensure-collection-policies-DFpOl8SM.js.map} +1 -1
- package/dist/ensure-collection-tables-DMjOkeRy.js +1952 -0
- package/dist/ensure-collection-tables-DMjOkeRy.js.map +1 -0
- package/dist/index.es.js +10 -9
- package/dist/index.es.js.map +1 -1
- package/dist/{rls-enforcement-da7ekLw-.js → rls-enforcement-CInuYj1-.js} +2 -2
- package/dist/{rls-enforcement-da7ekLw-.js.map → rls-enforcement-CInuYj1-.js.map} +1 -1
- package/dist/schema/collection-index.d.ts +182 -0
- package/dist/schema/introspect-db-inference.d.ts +1 -1
- package/dist/schema/introspect-db-logic.d.ts +4 -4
- package/dist/schema/introspect-db-project.d.ts +2 -2
- package/dist/src-DiDgtX8P.js.map +1 -1
- package/dist/{websocket-6b7Iy4TP.js → websocket-HcyLl1ZM.js} +5 -4
- package/dist/{websocket-6b7Iy4TP.js.map → websocket-HcyLl1ZM.js.map} +1 -1
- package/package.json +6 -6
- package/src/cli-helpers.ts +114 -0
- package/src/cli.ts +22 -0
- package/src/schema/collection-index.ts +427 -0
- package/src/schema/ensure-collection-tables.ts +21 -0
- package/src/schema/generate-postgres-ddl-logic.ts +17 -5
- package/src/schema/introspect-db-inference.ts +1 -1
- package/src/schema/introspect-db-logic.ts +4 -4
- package/src/schema/introspect-db-project.ts +2 -2
- package/src/schema/introspect-db.ts +2 -2
- package/src/services/realtimeService.ts +17 -4
- package/src/websocket.ts +1 -1
- package/dist/ensure-collection-tables-DpGX_25A.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -2,11 +2,12 @@ import { createRequire as __createRequire } from "module";
|
|
|
2
2
|
import process from "process";
|
|
3
3
|
__createRequire(import.meta.url);
|
|
4
4
|
import { a as createReadReplicaConnection, c as poolMaxCeiling, i as createPostgresDatabaseConnection, o as guardPoolAgainstDirtyRelease, r as createDirectDatabaseConnection, s as pinSearchPath, t as cappedPoolMax } from "./connection-GOKU3Hu5.js";
|
|
5
|
-
import {
|
|
5
|
+
import { C as getTableName$1, F as firstFreeKey, I as generateForeignKeyName, J as resolveClientListLimit, L as legacyForeignKeyName, T as resolveCollectionRelations, U as camelCase, W as toSnakeCase, Z as isManyToMany, c as parseOrderBySpecStrict, l as CollectionRegistry, o as OrderBySpecError, q as ListLimitError, z as toWireKey } from "./collection-index-DxJBvVTH.js";
|
|
6
6
|
import { l as isRelationalCollectionConfig } from "./src-DiDgtX8P.js";
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
9
|
-
import {
|
|
7
|
+
import { d as authUsersColumnSql, u as AUTH_USERS_COLUMNS } from "./ensure-collection-tables-DMjOkeRy.js";
|
|
8
|
+
import { C as deriveRowAddress, E as buildPropertyCallbacks, S as getUnknownFilterFieldsMode, T as warnOnKeysTheAdminCannotResolve, _ as sanitizeErrorForClient, a as AuthenticatedPostgresBackendDriver, b as configureUnknownFilterFields, c as RoleSwitchUnavailableError, d as generateSchema, f as getDrizzleColumn, g as extractPgError, h as classifyConnectFailure, l as effectiveSqlRole, m as DataService, n as PUBLIC_TYPES, o as CONNECTION_OWNER, p as BranchService, r as createPostgresWebSocket, s as PostgresBackendDriver, t as ADMIN_ONLY_TYPES, u as isRoleSwitchingOptedOut, v as DrizzleConditionBuilder, w as getPrimaryKeys, x as escapeLikePattern, y as PostgresConditionBuilder } from "./websocket-HcyLl1ZM.js";
|
|
9
|
+
import { a as warnOnAnonymousGrants, c as REBASE_USER_ROLE, i as validatePolicyPgRoles, l as revokeInternalTableAccess, n as detectConnectionPosture, o as warnOnLegacyRlsFunctions, r as ensureAppRole, s as warnOnRoleSchemaCollision, t as applyAuthContext, u as revokeInternalTableSql } from "./rls-enforcement-CInuYj1-.js";
|
|
10
|
+
import { A as parseDbNameFromUrl, C as buildRowSecurityPgOptions, D as joinStorageKey, E as globalsFileForDump, F as withDatabaseName, M as resolveConnectionString, N as serverVersionNumToMajor, O as parseBackupDestination, P as splitGlobalsStatements, S as buildPgRestoreListArgs, T as diagnoseRowSecurityDumpFailure, _ as selectBackupsToPrune, a as detectToolMajor, b as buildPgDumpallGlobalsArgs, c as getServerVersionMajor, d as pruneBackups, f as resolvePgBinary, g as require_source, h as validateDump, i as createDump, j as parsePgToolMajor, k as parseBackupTimestamp, l as listBackups, m as uploadBackup, n as applyGlobals, o as discardPartialDump, p as restoreDump, s as ensureDatabaseExists, t as BackupToolError, u as preflight, v as buildBackupFilename, w as checkToolServerCompatibility, x as buildPgRestoreArgs, y as buildPgDumpArgs } from "./backup-service-BtgHxfFm.js";
|
|
10
11
|
import { t as RLS_BOOTSTRAP_STATEMENTS } from "./rls-bootstrap-sql-DNzaWd4C.js";
|
|
11
12
|
import { Client, Pool } from "pg";
|
|
12
13
|
import { drizzle } from "drizzle-orm/node-postgres";
|
|
@@ -1887,13 +1888,13 @@ var RealtimeService = class RealtimeService extends EventEmitter {
|
|
|
1887
1888
|
}
|
|
1888
1889
|
}
|
|
1889
1890
|
}
|
|
1891
|
+
await this.presenceStoreOp(() => this.presenceStore.removeClient(clientId), "client removal");
|
|
1890
1892
|
for (const [channel, members] of this.channels.entries()) if (members.has(clientId)) {
|
|
1891
1893
|
members.delete(clientId);
|
|
1892
1894
|
this.removePresence(clientId, channel, { skipStore: true });
|
|
1893
1895
|
if (members.size === 0) this.channels.delete(channel);
|
|
1894
1896
|
}
|
|
1895
1897
|
for (const [channel] of this.presence) this.removePresence(clientId, channel, { skipStore: true });
|
|
1896
|
-
this.presenceStoreOp(() => this.presenceStore.removeClient(clientId), "client removal");
|
|
1897
1898
|
}
|
|
1898
1899
|
async handleMessage(clientId, message, authContext) {
|
|
1899
1900
|
const payload = message.payload;
|
|
@@ -3451,7 +3452,7 @@ function createBackupCron(config) {
|
|
|
3451
3452
|
enabled: config.enabled ?? true,
|
|
3452
3453
|
timeoutSeconds: 3600,
|
|
3453
3454
|
async handler({ log }) {
|
|
3454
|
-
const { createDump, pruneBackups, uploadBackup, validateDump } = await import("./backup-service-
|
|
3455
|
+
const { createDump, pruneBackups, uploadBackup, validateDump } = await import("./backup-service-BtgHxfFm.js").then((n) => n.r);
|
|
3455
3456
|
const { destination } = config;
|
|
3456
3457
|
if (destination.kind !== "local" && !config.storage) throw new Error(`Backup destination is ${destination.kind} but no storage controller was provided. Pass the backend's configured StorageController to createBackupCron({ storage }).`);
|
|
3457
3458
|
log(`Starting backup of "${dbName}"…`);
|
|
@@ -6891,7 +6892,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
6891
6892
|
* proved it can bootstrap with.
|
|
6892
6893
|
*/
|
|
6893
6894
|
async ensureCollectionSchema(collections, driverResult, log) {
|
|
6894
|
-
const { ensureCollectionTables } = await import("./ensure-collection-tables-
|
|
6895
|
+
const { ensureCollectionTables } = await import("./ensure-collection-tables-DMjOkeRy.js").then((n) => n.t);
|
|
6895
6896
|
const plan = await ensureCollectionTables(provisioningQueryable(driverResult), collections, log);
|
|
6896
6897
|
for (const failure of plan.failures) logger.warn(failure.kind === "comment-column" ? `🔍 [schema] Could not record the search fingerprint on "${failure.target}" — search works, but a later change to the \`search\` block will not be detected: ${failure.error}` : `🔗 [schema] Could not add foreign key "${failure.target}" — the column exists and the collection still serves, but rows are not policed by this constraint: ${failure.error}`);
|
|
6897
6898
|
return { applied: plan.actions.length - plan.failures.length };
|
|
@@ -6912,7 +6913,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
6912
6913
|
* stays RLS-enabled, so it denies rather than leaks.
|
|
6913
6914
|
*/
|
|
6914
6915
|
async ensureCollectionPolicies(collections, driverResult, log) {
|
|
6915
|
-
const { ensureCollectionPolicies } = await import("./ensure-collection-policies-
|
|
6916
|
+
const { ensureCollectionPolicies } = await import("./ensure-collection-policies-DFpOl8SM.js");
|
|
6916
6917
|
const queryable = provisioningQueryable(driverResult);
|
|
6917
6918
|
const outcome = await ensureCollectionPolicies(queryable, collections, log);
|
|
6918
6919
|
for (const skip of outcome.skipped) logger.warn(`🔐 [rls] Policies not applied to "${skip.table}": ${skip.reason}`);
|
|
@@ -6955,7 +6956,7 @@ function createPostgresBootstrapper(pgConfig) {
|
|
|
6955
6956
|
},
|
|
6956
6957
|
mountRoutes(app, basePath, driverResult) {},
|
|
6957
6958
|
async initializeWebsockets(server, realtimeService, driver, config, adapter) {
|
|
6958
|
-
const { createPostgresWebSocket } = await import("./websocket-
|
|
6959
|
+
const { createPostgresWebSocket } = await import("./websocket-HcyLl1ZM.js").then((n) => n.i);
|
|
6959
6960
|
createPostgresWebSocket(server, realtimeService, driver, config, adapter);
|
|
6960
6961
|
}
|
|
6961
6962
|
};
|