@rebasepro/server-postgres 0.22.0 → 0.24.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-CucnFcSE.js → BranchService-BRt78gfa.js} +35 -18
- package/dist/BranchService-BRt78gfa.js.map +1 -0
- package/dist/PostgresBackendDriver.d.ts +116 -4
- package/dist/auth/services.d.ts +99 -22
- package/dist/{auth-users-columns-D2LBFrMH.js → auth-users-columns-C72EMoDJ.js} +17 -1
- package/dist/{auth-users-columns-D2LBFrMH.js.map → auth-users-columns-C72EMoDJ.js.map} +1 -1
- package/dist/backup/backup-cli.d.ts +22 -0
- package/dist/{backup-cli-DqBakiMO.js → backup-cli-DW5p9_zv.js} +17 -14
- package/dist/backup-cli-DW5p9_zv.js.map +1 -0
- package/dist/{backup-service-CaMOS76G.js → backup-service-EwcDVG-8.js} +7 -9
- package/dist/{backup-service-CaMOS76G.js.map → backup-service-EwcDVG-8.js.map} +1 -1
- package/dist/{cli-errors-Dka89exj.js → cli-errors-DsA-K9uP.js} +101 -1
- package/dist/cli-errors-DsA-K9uP.js.map +1 -0
- package/dist/cli-errors.d.ts +42 -0
- package/dist/cli-flags-BglvpjHv.js +138 -0
- package/dist/cli-flags-BglvpjHv.js.map +1 -0
- package/dist/cli-flags.d.ts +28 -0
- package/dist/cli-helpers.d.ts +18 -12
- package/dist/cli-scratch-database.d.ts +34 -0
- package/dist/cli.js +177 -287
- package/dist/cli.js.map +1 -1
- package/dist/{column-plan-helpers-CpILzHJS.js → column-plan-helpers-1-LQD0yI.js} +44 -38
- package/dist/column-plan-helpers-1-LQD0yI.js.map +1 -0
- package/dist/data-transformer.d.ts +0 -8
- package/dist/{doctor-CU9IogdL.js → doctor-C-sYWbmt.js} +228 -46
- package/dist/doctor-C-sYWbmt.js.map +1 -0
- package/dist/{ensure-collection-policies-Dzd-2S81.js → ensure-collection-policies-B1ureSIV.js} +73 -18
- package/dist/ensure-collection-policies-B1ureSIV.js.map +1 -0
- package/dist/{ensure-collection-tables-CpAgy51F.js → ensure-collection-tables-kkkHk8oo.js} +124 -37
- package/dist/ensure-collection-tables-kkkHk8oo.js.map +1 -0
- package/dist/{ensure-tables-Cr5B4UmH.js → ensure-tables-BmI_tRxc.js} +10 -3
- package/dist/ensure-tables-BmI_tRxc.js.map +1 -0
- package/dist/{generate-drizzle-schema-B537GIvz.js → generate-drizzle-schema-93M0lUxK.js} +2 -2
- package/dist/{generate-drizzle-schema-B537GIvz.js.map → generate-drizzle-schema-93M0lUxK.js.map} +1 -1
- package/dist/{generate-drizzle-schema-logic-BcMl7VSy.js → generate-drizzle-schema-logic-sSFDp6LR.js} +26 -8
- package/dist/generate-drizzle-schema-logic-sSFDp6LR.js.map +1 -0
- package/dist/generate-postgres-ddl-logic-BJsLaVNX.js +152 -0
- package/dist/generate-postgres-ddl-logic-BJsLaVNX.js.map +1 -0
- package/dist/generated-sql.d.ts +28 -0
- package/dist/index.es.js +4768 -1117
- package/dist/index.es.js.map +1 -1
- package/dist/{introspect-db-logic-C6LQdTxj.js → introspect-db-logic-kCETE8TY.js} +532 -39
- package/dist/introspect-db-logic-kCETE8TY.js.map +1 -0
- package/dist/introspect-db-queries-C_Q5VgQw.js +317 -0
- package/dist/introspect-db-queries-C_Q5VgQw.js.map +1 -0
- package/dist/{plan-schema-CboAIwLN.js → plan-schema-DU9exq6C.js} +291 -529
- package/dist/plan-schema-DU9exq6C.js.map +1 -0
- package/dist/{policy-drift-xJfy9xG7.js → policy-drift-B-J2hhm0.js} +3 -3
- package/dist/policy-drift-B-J2hhm0.js.map +1 -0
- package/dist/{generate-postgres-ddl-logic-D7imhYV8.js → render-ddl-Ds2t_d9V.js} +11 -149
- package/dist/render-ddl-Ds2t_d9V.js.map +1 -0
- package/dist/{rls-bootstrap-sql-H3rCFi3F.js → rls-bootstrap-sql-_KNnjanK.js} +562 -35
- package/dist/rls-bootstrap-sql-_KNnjanK.js.map +1 -0
- package/dist/{rls-enforcement-C6Xk0lA6.js → rls-enforcement-CfXOJJaW.js} +10 -2
- package/dist/rls-enforcement-CfXOJJaW.js.map +1 -0
- package/dist/schema/atlas-argv.d.ts +15 -0
- package/dist/schema/auth-schema.d.ts +170 -0
- package/dist/schema/classify-change.d.ts +29 -1
- package/dist/schema/column-plan-helpers.d.ts +51 -20
- package/dist/schema/destructive-sql.d.ts +71 -1
- package/dist/schema/doctor-cli.js +4 -4
- package/dist/schema/doctor.d.ts +34 -1
- package/dist/schema/ensure-collection-policies.d.ts +22 -0
- package/dist/schema/generate-drizzle-schema.js +1 -1
- package/dist/schema/generate-postgres-ddl-logic.d.ts +5 -5
- package/dist/schema/generate-postgres-ddl.js +1 -1
- package/dist/schema/generate-schema-commit.d.ts +12 -0
- package/dist/schema/introspect-db-logic.d.ts +31 -0
- package/dist/schema/introspect-db-queries.d.ts +1 -1
- package/dist/schema/introspect-db-search.d.ts +22 -0
- package/dist/schema/introspect-db-storage.d.ts +83 -0
- package/dist/schema/introspect-db.js +15 -314
- package/dist/schema/introspect-db.js.map +1 -1
- package/dist/schema/plan/diff-plan.d.ts +4 -3
- package/dist/schema/plan/plan-schema.d.ts +26 -11
- package/dist/schema/plan/render-ddl.d.ts +6 -0
- package/dist/schema/plan/types.d.ts +43 -12
- package/dist/search-column-BM-GV6vH.js +442 -0
- package/dist/search-column-BM-GV6vH.js.map +1 -0
- package/dist/security/policy-drift.d.ts +1 -1
- package/dist/security/rls-enforcement.d.ts +7 -0
- package/dist/services/BranchService.d.ts +22 -1
- package/dist/services/FetchService.d.ts +102 -32
- package/dist/services/PersistService.d.ts +41 -5
- package/dist/services/RelationService.d.ts +29 -0
- package/dist/services/RelationWriteService.d.ts +6 -0
- package/dist/services/cdc/CdcListener.d.ts +15 -5
- package/dist/services/cdc/identity-columns.d.ts +19 -0
- package/dist/services/cdc/trigger-cdc.d.ts +45 -7
- package/dist/services/channel-bus/PostgresChannelBus.d.ts +12 -7
- package/dist/services/channel-history.d.ts +17 -1
- package/dist/services/collection-helpers.d.ts +21 -0
- package/dist/services/dataService.d.ts +3 -20
- package/dist/services/field-op-sql.d.ts +71 -0
- package/dist/services/junction-writes.d.ts +19 -3
- package/dist/services/pg-notify-listener.d.ts +95 -6
- package/dist/services/read-field-access.d.ts +19 -0
- package/dist/services/realtimeService.d.ts +232 -44
- package/dist/services/row-pipeline.d.ts +5 -0
- package/dist/services/socket-liveness.d.ts +45 -0
- package/dist/services/soft-delete.d.ts +12 -2
- package/dist/services/sql-script.d.ts +71 -0
- package/dist/services/write-depth.d.ts +16 -0
- package/dist/services/write-transaction-scope.d.ts +42 -0
- package/dist/utils/drizzle-conditions.d.ts +49 -4
- package/dist/utils/sql-redaction.d.ts +21 -0
- package/dist/websocket.d.ts +57 -18
- package/package.json +9 -9
- package/dist/BranchService-CucnFcSE.js.map +0 -1
- package/dist/backup-cli-DqBakiMO.js.map +0 -1
- package/dist/cli-errors-Dka89exj.js.map +0 -1
- package/dist/column-plan-helpers-CpILzHJS.js.map +0 -1
- package/dist/doctor-CU9IogdL.js.map +0 -1
- package/dist/ensure-collection-policies-Dzd-2S81.js.map +0 -1
- package/dist/ensure-collection-tables-CpAgy51F.js.map +0 -1
- package/dist/ensure-tables-Cr5B4UmH.js.map +0 -1
- package/dist/generate-drizzle-schema-logic-BcMl7VSy.js.map +0 -1
- package/dist/generate-postgres-ddl-logic-D7imhYV8.js.map +0 -1
- package/dist/introspect-db-logic-C6LQdTxj.js.map +0 -1
- package/dist/plan-schema-CboAIwLN.js.map +0 -1
- package/dist/policy-drift-xJfy9xG7.js.map +0 -1
- package/dist/rls-bootstrap-sql-H3rCFi3F.js.map +0 -1
- package/dist/rls-enforcement-C6Xk0lA6.js.map +0 -1
package/dist/cli-helpers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GeneratedColumnDependency } from "./schema/generated-column-conflicts.js";
|
|
2
|
+
import { type ExistingColumnType } from "./schema/destructive-sql.js";
|
|
2
3
|
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
4
|
/**
|
|
4
5
|
* Why is a dependency's binary missing — never installed, or installed with its
|
|
@@ -126,10 +127,10 @@ export declare function dropDevDatabase(databaseUrl: string, devDatabaseUrl: str
|
|
|
126
127
|
/**
|
|
127
128
|
* The generated SQL for the project's `search` blocks, if it has any.
|
|
128
129
|
*
|
|
129
|
-
* @param
|
|
130
|
-
* under the working directory.
|
|
130
|
+
* @param sqlDir directory holding the generated SQL. Defaults to
|
|
131
|
+
* `.rebase/sql` under the working directory.
|
|
131
132
|
*/
|
|
132
|
-
export declare function readSearchDdl(
|
|
133
|
+
export declare function readSearchDdl(sqlDir?: string): string;
|
|
133
134
|
/**
|
|
134
135
|
* Bring the search column, its index and their helpers up to date.
|
|
135
136
|
*
|
|
@@ -143,7 +144,7 @@ export declare function readSearchDdl(drizzleDir?: string): string;
|
|
|
143
144
|
* silently pushing a schema whose search column never appeared is how a
|
|
144
145
|
* collection ends up with search configured, no error anywhere, and no results.
|
|
145
146
|
*/
|
|
146
|
-
export declare function applySearchDdl(databaseUrl: string,
|
|
147
|
+
export declare function applySearchDdl(databaseUrl: string, sqlDir?: string): Promise<void>;
|
|
147
148
|
/**
|
|
148
149
|
* Glob patterns keeping Atlas away from the search objects.
|
|
149
150
|
*
|
|
@@ -164,6 +165,11 @@ export declare function getSearchExcludes(collectionsPath: string): Promise<stri
|
|
|
164
165
|
* see `generated-column-conflicts.ts` for why that is necessary at all.
|
|
165
166
|
*/
|
|
166
167
|
export declare function queryGeneratedColumnDependencies(databaseUrl: string): Promise<GeneratedColumnDependency[]>;
|
|
168
|
+
/**
|
|
169
|
+
* Every column in the database with its current type, for the destructive
|
|
170
|
+
* gate to tell a widening `ALTER COLUMN … TYPE` from one that loses data.
|
|
171
|
+
*/
|
|
172
|
+
export declare function queryColumnTypes(databaseUrl: string): Promise<ExistingColumnType[]>;
|
|
167
173
|
/**
|
|
168
174
|
* Drop the generated columns standing in the way of an apply.
|
|
169
175
|
*
|
|
@@ -175,10 +181,10 @@ export declare function dropGeneratedColumns(databaseUrl: string, statements: st
|
|
|
175
181
|
/**
|
|
176
182
|
* The generated SQL for the project's `vector` properties, if it has any.
|
|
177
183
|
*
|
|
178
|
-
* @param
|
|
179
|
-
* under the working directory.
|
|
184
|
+
* @param sqlDir directory holding the generated SQL. Defaults to
|
|
185
|
+
* `.rebase/sql` under the working directory.
|
|
180
186
|
*/
|
|
181
|
-
export declare function readVectorDdl(
|
|
187
|
+
export declare function readVectorDdl(sqlDir?: string): string;
|
|
182
188
|
/**
|
|
183
189
|
* Install pgvector and bring the vector columns and their ANN indexes up to
|
|
184
190
|
* date.
|
|
@@ -194,7 +200,7 @@ export declare function readVectorDdl(drizzleDir?: string): string;
|
|
|
194
200
|
* appeared is how a project ends up with vector search configured, no error
|
|
195
201
|
* anywhere, and no results.
|
|
196
202
|
*/
|
|
197
|
-
export declare function applyVectorDdl(databaseUrl: string,
|
|
203
|
+
export declare function applyVectorDdl(databaseUrl: string, sqlDir?: string): Promise<void>;
|
|
198
204
|
/**
|
|
199
205
|
* Glob patterns keeping Atlas away from the vector objects.
|
|
200
206
|
*
|
|
@@ -206,10 +212,10 @@ export declare function getVectorExcludes(collectionsPath: string): Promise<stri
|
|
|
206
212
|
* The generated SQL for the project's `autoValue: "on_update"` properties, if
|
|
207
213
|
* it has any.
|
|
208
214
|
*
|
|
209
|
-
* @param
|
|
210
|
-
* under the working directory.
|
|
215
|
+
* @param sqlDir directory holding the generated SQL. Defaults to
|
|
216
|
+
* `.rebase/sql` under the working directory.
|
|
211
217
|
*/
|
|
212
|
-
export declare function readTriggersDdl(
|
|
218
|
+
export declare function readTriggersDdl(sqlDir?: string): string;
|
|
213
219
|
/**
|
|
214
220
|
* Install the `updated_at` trigger function and bind it to every column that
|
|
215
221
|
* asked for one.
|
|
@@ -224,7 +230,7 @@ export declare function readTriggersDdl(drizzleDir?: string): string;
|
|
|
224
230
|
* appeared is how `updated_at` ends up silently stale for every writer that is
|
|
225
231
|
* not the driver, which is the whole reason the trigger exists.
|
|
226
232
|
*/
|
|
227
|
-
export declare function applyTriggersDdl(databaseUrl: string,
|
|
233
|
+
export declare function applyTriggersDdl(databaseUrl: string, sqlDir?: string): Promise<void>;
|
|
228
234
|
/** @see getSearchExcludes */
|
|
229
235
|
export declare function getTriggerExcludes(collectionsPath: string): Promise<string[]>;
|
|
230
236
|
/**
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scratch database Atlas plans against, for the length of one db command.
|
|
3
|
+
*
|
|
4
|
+
* `atlas schema apply` and `atlas migrate diff` need a `--dev-url`: an empty
|
|
5
|
+
* database they build the desired state in, made as `<db>_dev_diff` beside the
|
|
6
|
+
* real one. It is a full copy of the schema, so it is removed again once the
|
|
7
|
+
* command that made it has succeeded — every such command, not only an applied
|
|
8
|
+
* `db push`: a `--dry-run` that left one behind while saying nothing was
|
|
9
|
+
* applied, and `db generate`, left one per target on the server.
|
|
10
|
+
*
|
|
11
|
+
* Two cases keep it. A command that fails leaves it as the state Atlas was
|
|
12
|
+
* planning against, which is the one thing worth inspecting. And one this
|
|
13
|
+
* process did not create — made by hand, the remedy for a role without
|
|
14
|
+
* `CREATEDB` — is the user's, and dropping it would put them back at the same
|
|
15
|
+
* refusal next time.
|
|
16
|
+
*/
|
|
17
|
+
export interface ScratchDatabaseOps {
|
|
18
|
+
/** Create it if it is missing; `true` only when this call created it. */
|
|
19
|
+
create(databaseUrl: string, devDatabaseUrl: string): Promise<boolean>;
|
|
20
|
+
drop(databaseUrl: string, devDatabaseUrl: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare class ScratchDatabase {
|
|
23
|
+
private readonly ops;
|
|
24
|
+
private created;
|
|
25
|
+
constructor(ops: ScratchDatabaseOps);
|
|
26
|
+
/** Make sure it exists before an Atlas call that plans against it. */
|
|
27
|
+
ensure(databaseUrl: string, devDatabaseUrl: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Run a command, then drop the scratch database if the command created it.
|
|
30
|
+
* A command that throws skips the drop; one that exits the process never
|
|
31
|
+
* returns here, which is the same thing.
|
|
32
|
+
*/
|
|
33
|
+
around<T>(command: () => Promise<T>): Promise<T>;
|
|
34
|
+
}
|