@rebasepro/server-postgres 0.12.1-canary.g35be8cb → 0.12.1-canary.g389e9b2

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.
Files changed (32) hide show
  1. package/dist/PostgresBootstrapper.d.ts +25 -1
  2. package/dist/{backup-service-DH9kPg-E.js → backup-service-vAKWJkYL.js} +3 -2
  3. package/dist/{backup-service-DH9kPg-E.js.map → backup-service-vAKWJkYL.js.map} +1 -1
  4. package/dist/cli-helpers.d.ts +24 -0
  5. package/dist/{connection-B5Wndbr1.js → connection-BuZ97wsr.js} +57 -3
  6. package/dist/connection-BuZ97wsr.js.map +1 -0
  7. package/dist/connection.d.ts +42 -0
  8. package/dist/{ensure-collection-policies-Vl3Cv1Q9.js → ensure-collection-policies-BjSwj0FM.js} +2 -2
  9. package/dist/{ensure-collection-policies-Vl3Cv1Q9.js.map → ensure-collection-policies-BjSwj0FM.js.map} +1 -1
  10. package/dist/{ensure-collection-tables-DsDsNl6o.js → ensure-collection-tables-D6-XhqnQ.js} +2 -2
  11. package/dist/{ensure-collection-tables-DsDsNl6o.js.map → ensure-collection-tables-D6-XhqnQ.js.map} +1 -1
  12. package/dist/index.es.js +100 -27
  13. package/dist/index.es.js.map +1 -1
  14. package/dist/policy-CeA1JcxP.js +105 -0
  15. package/dist/policy-CeA1JcxP.js.map +1 -0
  16. package/dist/{src-DihrDFuP.js → src-C_NHNVW2.js} +12 -81
  17. package/dist/src-C_NHNVW2.js.map +1 -0
  18. package/dist/{websocket-BKcGvILX.js → websocket-DB7TbFPT.js} +5 -4
  19. package/dist/websocket-DB7TbFPT.js.map +1 -0
  20. package/package.json +6 -6
  21. package/src/PostgresBootstrapper.ts +83 -22
  22. package/src/cli-helpers.ts +44 -0
  23. package/src/cli.ts +31 -3
  24. package/src/connection.ts +73 -0
  25. package/src/databasePoolManager.ts +5 -2
  26. package/src/schema/generate-drizzle-schema-logic.ts +9 -2
  27. package/src/services/RelationService.ts +38 -3
  28. package/src/services/realtimeService.ts +3 -3
  29. package/src/websocket.ts +3 -3
  30. package/dist/connection-B5Wndbr1.js.map +0 -1
  31. package/dist/src-DihrDFuP.js.map +0 -1
  32. package/dist/websocket-BKcGvILX.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  * Implements the `BackendBootstrapper` interface for PostgreSQL.
5
5
  */
6
6
  import { NodePgDatabase } from "drizzle-orm/node-postgres";
7
- import { BackendBootstrapper, type RealtimeChannelsConfig } from "@rebasepro/types";
7
+ import { BackendBootstrapper, CollectionConfig, type RealtimeChannelsConfig } from "@rebasepro/types";
8
8
  import { PostgresBackendDriver } from "./PostgresBackendDriver";
9
9
  import { RealtimeService } from "./services/realtimeService";
10
10
  import { DatabasePoolManager } from "./databasePoolManager";
@@ -65,6 +65,30 @@ export interface PostgresDriverInternals {
65
65
  */
66
66
  provisionCdcForTables?: (tables: CdcTableRef[]) => Promise<void>;
67
67
  }
68
+ /**
69
+ * Which table name the boot-time drift check should look for, for one collection.
70
+ *
71
+ * A declared `table` IS the table name, not a hint to be second-guessed. This
72
+ * used to ask the registry whether it had indexed the declared name and fall
73
+ * back to the SLUG when it had not — but "the registry does not know this table"
74
+ * is exactly the condition the drift check exists to report, so the fallback
75
+ * fired precisely when it was most harmful.
76
+ *
77
+ * A collection with `slug: "usage-daily", table: "usage_daily"` was reported as
78
+ * missing table `usage-daily`: a name that does not exist, should never exist,
79
+ * and that nobody can find by looking. Worse, the remediation the caller prints
80
+ * says to run `rebase db push` — which would then CREATE that invented table
81
+ * beside the correct one, the same "second copy" hazard the misplaced-schema
82
+ * branch further down exists to prevent. Seen in production, where a correctly
83
+ * migrated database reported drift on every boot.
84
+ *
85
+ * The slug is used only when nothing was declared, which is the config shape
86
+ * where the slug genuinely is the table name.
87
+ *
88
+ * Exported for its own test: the caller needs a live pool and a real database,
89
+ * and this is the part that was wrong.
90
+ */
91
+ export declare function resolveDriftCheckName(col: CollectionConfig, registeredTableNames: string[]): string;
68
92
  /**
69
93
  * Default PostgreSQL bootstrapper.
70
94
  *
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  import process from "process";
3
3
  __createRequire(import.meta.url);
4
- import { c as __require, l as __toESM, o as __commonJSMin, s as __exportAll } from "./connection-B5Wndbr1.js";
4
+ import { c as __exportAll, l as __require, s as __commonJSMin, u as __toESM } from "./connection-BuZ97wsr.js";
5
5
  import "./src-DoU9yPqq.js";
6
6
  import "@rebasepro/server";
7
7
  import fs from "fs";
@@ -23,6 +23,7 @@ import { appendFileSync, createReadStream, createWriteStream, readFileSync, stat
23
23
  import { finished } from "node:stream/promises";
24
24
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
25
25
  import { Buffer as Buffer$1 } from "node:buffer";
26
+ import "module";
26
27
  import { fileURLToPath as fileURLToPath$1 } from "url";
27
28
  //#region src/backup/pg-tools.ts
28
29
  /**
@@ -8863,4 +8864,4 @@ async function pruneBackups(dest, options, storage) {
8863
8864
  //#endregion
8864
8865
  export { serverVersionNumToMajor as A, globalsFileForDump as C, parseDbNameFromUrl as D, parseBackupTimestamp as E, withDatabaseName as M, parsePgToolMajor as O, checkToolServerCompatibility as S, parseBackupDestination as T, buildBackupFilename as _, detectToolMajor as a, buildPgRestoreArgs as b, listBackups as c, resolvePgBinary as d, restoreDump as f, selectBackupsToPrune as g, require_source as h, createDump as i, splitGlobalsStatements as j, resolveConnectionString as k, preflight as l, validateDump as m, applyGlobals as n, ensureDatabaseExists as o, uploadBackup as p, backup_service_exports as r, getServerVersionMajor as s, BackupToolError as t, pruneBackups as u, buildPgDumpArgs as v, joinStorageKey as w, buildPgRestoreListArgs as x, buildPgDumpallGlobalsArgs as y };
8865
8866
 
8866
- //# sourceMappingURL=backup-service-DH9kPg-E.js.map
8867
+ //# sourceMappingURL=backup-service-vAKWJkYL.js.map