@rebasepro/server-postgres 0.12.0 → 0.12.1-canary.g06f263c
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/PostgresBootstrapper.d.ts +25 -1
- package/dist/auth/services.d.ts +16 -0
- package/dist/backup-service-vAKWJkYL.js +8867 -0
- package/dist/backup-service-vAKWJkYL.js.map +1 -0
- package/dist/cli-helpers.d.ts +24 -0
- package/dist/connection-BuZ97wsr.js +250 -0
- package/dist/connection-BuZ97wsr.js.map +1 -0
- package/dist/connection.d.ts +42 -0
- package/dist/ensure-collection-policies-BjSwj0FM.js +57 -0
- package/dist/ensure-collection-policies-BjSwj0FM.js.map +1 -0
- package/dist/ensure-collection-tables-D6-XhqnQ.js +590 -0
- package/dist/ensure-collection-tables-D6-XhqnQ.js.map +1 -0
- package/dist/index.es.js +545 -9629
- package/dist/index.es.js.map +1 -1
- package/dist/policy-CeA1JcxP.js +105 -0
- package/dist/policy-CeA1JcxP.js.map +1 -0
- package/dist/schema/auth-schema.d.ts +83 -144
- package/dist/schema/ensure-collection-policies.d.ts +60 -0
- package/dist/schema/ensure-collection-tables.d.ts +24 -2
- package/dist/schema/generate-postgres-ddl-logic.d.ts +116 -1
- package/dist/{src-BbFOPJ1S.js → src-C_NHNVW2.js} +94 -153
- package/dist/src-C_NHNVW2.js.map +1 -0
- package/dist/{src-Zqwaw3P5.js → src-DoU9yPqq.js} +3 -159
- package/dist/src-DoU9yPqq.js.map +1 -0
- package/dist/utils/pg-error-utils.d.ts +19 -0
- package/dist/websocket-DB7TbFPT.js +529 -0
- package/dist/websocket-DB7TbFPT.js.map +1 -0
- package/package.json +14 -14
- package/src/PostgresAdapter.ts +14 -0
- package/src/PostgresBootstrapper.ts +192 -33
- package/src/auth/ensure-tables.ts +164 -9
- package/src/auth/services.ts +21 -2
- package/src/cli-helpers.ts +44 -0
- package/src/cli.ts +31 -3
- package/src/connection.ts +73 -0
- package/src/databasePoolManager.ts +5 -2
- package/src/schema/auth-schema.ts +30 -19
- package/src/schema/ensure-collection-policies.ts +105 -0
- package/src/schema/ensure-collection-tables.test.ts +105 -9
- package/src/schema/ensure-collection-tables.ts +142 -25
- package/src/schema/generate-drizzle-schema-logic.ts +16 -5
- package/src/schema/generate-postgres-ddl-logic.ts +335 -16
- package/src/schema/introspect-runtime.test.ts +56 -8
- package/src/schema/introspect-runtime.ts +31 -9
- package/src/services/RelationService.ts +38 -3
- package/src/services/realtimeService.ts +3 -3
- package/src/utils/pg-error-utils.ts +46 -0
- package/src/websocket.ts +3 -3
- package/dist/chunk-DSJWtz9O.js +0 -40
- package/dist/ensure-collection-tables-CNTcZGvn.js +0 -304
- package/dist/ensure-collection-tables-CNTcZGvn.js.map +0 -1
- package/dist/src-BbFOPJ1S.js.map +0 -1
- package/dist/src-Zqwaw3P5.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
|
*
|
package/dist/auth/services.d.ts
CHANGED
|
@@ -9,6 +9,22 @@ export interface AuthSchemaTables {
|
|
|
9
9
|
appConfig: RebasePgTable;
|
|
10
10
|
userIdentities: RebasePgTable;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The single definition of what an email address looks like in storage.
|
|
14
|
+
*
|
|
15
|
+
* Reads have always folded case; writes did not, and normalising was left to
|
|
16
|
+
* each caller. That asymmetry is only ever one forgotten `.toLowerCase()` away
|
|
17
|
+
* from a row no lookup can find — the account exists, every sign-in path
|
|
18
|
+
* reports no such user, and the byte-exact UNIQUE on the column does not stop a
|
|
19
|
+
* duplicate differing only in case. Applied on both sides here so the guarantee
|
|
20
|
+
* belongs to the repository rather than to its callers' discipline; the
|
|
21
|
+
* `lower(email)` unique index added in `ensureAuthTablesExist` is the database
|
|
22
|
+
* half of the same rule.
|
|
23
|
+
*
|
|
24
|
+
* Whitespace goes too: a trailing space survives the fold and reproduces the
|
|
25
|
+
* problem exactly.
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeEmail<T>(email: T): T | string;
|
|
12
28
|
/**
|
|
13
29
|
* PostgreSQL implementation of UserRepository.
|
|
14
30
|
* Handles all user-related database operations using Drizzle ORM.
|