@rebasepro/server-postgres 0.17.3-canary.gdd23447 → 0.18.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/LICENSE +0 -1
- package/README.md +31 -0
- package/dist/backup-argv.d.ts +19 -0
- package/dist/branch-argv.d.ts +28 -0
- package/dist/branch-prune.d.ts +77 -0
- package/dist/cli-collections-path.d.ts +31 -0
- package/dist/cli-errors.d.ts +123 -0
- package/dist/cli-flags.d.ts +101 -0
- package/dist/cli-helpers.d.ts +94 -10
- package/dist/collection-index-C7LopMyX.js +247 -0
- package/dist/collection-index-C7LopMyX.js.map +1 -0
- package/dist/databasePoolManager.d.ts +27 -0
- package/dist/{ensure-collection-policies-UCqgv_8c.js → ensure-collection-policies-CagOzEPS.js} +6 -6
- package/dist/{ensure-collection-policies-UCqgv_8c.js.map → ensure-collection-policies-CagOzEPS.js.map} +1 -1
- package/dist/{ensure-collection-tables-DgVixhX3.js → ensure-collection-tables-DbAhrjnG.js} +614 -52
- package/dist/ensure-collection-tables-DbAhrjnG.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.es.js +19307 -3059
- package/dist/index.es.js.map +1 -1
- package/dist/{rls-enforcement-DvAbL9YJ.js → rls-enforcement-ClJoTboT.js} +53 -189
- package/dist/rls-enforcement-ClJoTboT.js.map +1 -0
- package/dist/schema/column-type-drift.d.ts +79 -0
- package/dist/schema/doctor.d.ts +42 -0
- package/dist/schema/ensure-collection-tables.d.ts +90 -0
- package/dist/schema/generate-next-step.d.ts +30 -0
- package/dist/schema/generate-postgres-ddl-logic.d.ts +28 -0
- package/dist/schema/generated-schema-staleness.d.ts +37 -0
- package/dist/schema/introspect-db-queries.d.ts +34 -0
- package/dist/security/rls-enforcement.d.ts +63 -2
- package/dist/services/BranchService.d.ts +86 -1
- package/dist/services/collection-helpers.d.ts +1 -1
- package/dist/services/realtimeService.d.ts +30 -2
- package/dist/services/row-pipeline.d.ts +12 -1
- package/dist/utils/pg-error-utils.d.ts +3 -1
- package/dist/utils/pg-numeric-number-patch.d.ts +31 -0
- package/package.json +32 -27
- package/dist/backup-service-DCk7KhhL.js +0 -9044
- package/dist/backup-service-DCk7KhhL.js.map +0 -1
- package/dist/collection-index-BRUg10H5.js +0 -5690
- package/dist/collection-index-BRUg10H5.js.map +0 -1
- package/dist/connection-GOKU3Hu5.js +0 -277
- package/dist/connection-GOKU3Hu5.js.map +0 -1
- package/dist/ensure-collection-tables-DgVixhX3.js.map +0 -1
- package/dist/rls-bootstrap-sql-B5C9LoJ6.js +0 -244
- package/dist/rls-bootstrap-sql-B5C9LoJ6.js.map +0 -1
- package/dist/rls-enforcement-DvAbL9YJ.js.map +0 -1
- package/dist/src-DiB5RP2Z.js +0 -541
- package/dist/src-DiB5RP2Z.js.map +0 -1
- package/dist/websocket-BZ4H5wUz.js +0 -8198
- package/dist/websocket-BZ4H5wUz.js.map +0 -1
- package/src/PostgresAdapter.ts +0 -91
- package/src/PostgresBackendDriver.ts +0 -1857
- package/src/PostgresBootstrapper.ts +0 -1157
- package/src/auth/ensure-tables.ts +0 -896
- package/src/auth/schema-version.ts +0 -260
- package/src/auth/services.ts +0 -1610
- package/src/backup/backup-cli.ts +0 -520
- package/src/backup/backup-cron.ts +0 -212
- package/src/backup/backup-logic.ts +0 -93
- package/src/backup/backup-service.ts +0 -485
- package/src/backup/index.ts +0 -12
- package/src/backup/pg-tools.ts +0 -403
- package/src/backup/retention.ts +0 -86
- package/src/cli-errors.ts +0 -265
- package/src/cli-helpers.ts +0 -569
- package/src/cli-output.ts +0 -43
- package/src/cli.ts +0 -1339
- package/src/collections/PostgresCollectionRegistry.ts +0 -108
- package/src/collections/buildRegistry.ts +0 -68
- package/src/collections/validate-relations.ts +0 -402
- package/src/connection.ts +0 -333
- package/src/data-transformer.ts +0 -845
- package/src/databasePoolManager.ts +0 -95
- package/src/history/HistoryService.ts +0 -254
- package/src/history/ensure-history-table.ts +0 -53
- package/src/index.ts +0 -19
- package/src/interfaces.ts +0 -60
- package/src/module-dir.ts +0 -7
- package/src/schema/atlas-argv.ts +0 -94
- package/src/schema/auth-schema.ts +0 -298
- package/src/schema/auth-users-columns.ts +0 -131
- package/src/schema/carved-out-migration.ts +0 -404
- package/src/schema/classify-change.ts +0 -436
- package/src/schema/collection-index.ts +0 -427
- package/src/schema/collections-schema-version.ts +0 -103
- package/src/schema/destructive-sql.ts +0 -94
- package/src/schema/doctor-cli.ts +0 -66
- package/src/schema/doctor-policy-checks.ts +0 -105
- package/src/schema/doctor.ts +0 -837
- package/src/schema/drizzle-ddl.ts +0 -33
- package/src/schema/dynamic-tables.test.ts +0 -302
- package/src/schema/dynamic-tables.ts +0 -293
- package/src/schema/ensure-collection-policies.ts +0 -198
- package/src/schema/ensure-collection-tables.test.ts +0 -518
- package/src/schema/ensure-collection-tables.ts +0 -1267
- package/src/schema/generate-drizzle-schema-logic.ts +0 -957
- package/src/schema/generate-drizzle-schema.ts +0 -143
- package/src/schema/generate-postgres-ddl-logic.ts +0 -1339
- package/src/schema/generate-postgres-ddl.ts +0 -180
- package/src/schema/generate-schema-commit.ts +0 -267
- package/src/schema/generated-schema-staleness.ts +0 -284
- package/src/schema/introspect-db-constraints.ts +0 -385
- package/src/schema/introspect-db-inference.ts +0 -255
- package/src/schema/introspect-db-logic.ts +0 -1387
- package/src/schema/introspect-db-naming.ts +0 -15
- package/src/schema/introspect-db-project.ts +0 -78
- package/src/schema/introspect-db-queries.ts +0 -326
- package/src/schema/introspect-db-structure.ts +0 -670
- package/src/schema/introspect-db-types.ts +0 -56
- package/src/schema/introspect-db.ts +0 -257
- package/src/schema/introspect-runtime.test.ts +0 -260
- package/src/schema/introspect-runtime.ts +0 -327
- package/src/schema/non-sql-collections.test.ts +0 -131
- package/src/schema/rls-bootstrap-sql.ts +0 -288
- package/src/schema/search-column.ts +0 -643
- package/src/schema/test-schema.ts +0 -11
- package/src/schema/vector-index.ts +0 -491
- package/src/security/anonymous-grants.test.ts +0 -73
- package/src/security/policy-drift.test.ts +0 -435
- package/src/security/policy-drift.ts +0 -473
- package/src/security/rls-enforcement.ts +0 -505
- package/src/services/BranchService.ts +0 -326
- package/src/services/FetchService.ts +0 -2115
- package/src/services/PersistService.ts +0 -557
- package/src/services/RelationService.ts +0 -978
- package/src/services/RelationWriteService.ts +0 -653
- package/src/services/cdc/CdcListener.ts +0 -103
- package/src/services/cdc/junction-tables.ts +0 -91
- package/src/services/cdc/trigger-cdc.ts +0 -173
- package/src/services/channel-bus/ChannelBus.ts +0 -44
- package/src/services/channel-bus/PostgresChannelBus.ts +0 -299
- package/src/services/channel-bus/index.ts +0 -114
- package/src/services/channel-history.ts +0 -424
- package/src/services/channel-presence.ts +0 -185
- package/src/services/collection-helpers.ts +0 -420
- package/src/services/dataService.ts +0 -256
- package/src/services/index.ts +0 -14
- package/src/services/junction-writes.ts +0 -295
- package/src/services/nested-path.ts +0 -145
- package/src/services/pg-notify-listener.ts +0 -151
- package/src/services/realtimeService.ts +0 -2545
- package/src/services/row-pipeline.ts +0 -240
- package/src/services/write-denial.ts +0 -55
- package/src/types.ts +0 -4
- package/src/utils/connection-string.ts +0 -58
- package/src/utils/drizzle-conditions.ts +0 -2743
- package/src/utils/pg-array-null-patch.ts +0 -42
- package/src/utils/pg-error-utils.ts +0 -391
- package/src/websocket.ts +0 -855
package/src/PostgresAdapter.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { DatabaseAdapter, InitializedDriver, RealtimeProvider, DataDriver, DatabaseAdmin, BootstrappedAuth } from "@rebasepro/types";
|
|
2
|
-
import { createPostgresBootstrapper } from "./PostgresBootstrapper";
|
|
3
|
-
import type { PostgresDriverConfig } from "./PostgresBootstrapper";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a Postgres database adapter for Rebase.
|
|
7
|
-
*/
|
|
8
|
-
export function createPostgresAdapter(pgConfig: PostgresDriverConfig): DatabaseAdapter {
|
|
9
|
-
const bootstrapper = createPostgresBootstrapper(pgConfig);
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
type: bootstrapper.type,
|
|
13
|
-
|
|
14
|
-
async initializeDriver(config) {
|
|
15
|
-
return bootstrapper.initializeDriver(config);
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
async initializeRealtime(driverResult) {
|
|
19
|
-
if (bootstrapper.initializeRealtime) {
|
|
20
|
-
return bootstrapper.initializeRealtime({}, driverResult);
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
async initializeAuth(config, driverResult) {
|
|
26
|
-
if (bootstrapper.initializeAuth) {
|
|
27
|
-
return bootstrapper.initializeAuth(config, driverResult);
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
async initializeHistory(config, driverResult) {
|
|
33
|
-
if (bootstrapper.initializeHistory) {
|
|
34
|
-
return bootstrapper.initializeHistory(config, driverResult);
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
// `adapter` is forwarded for the same reason the schema hooks below are:
|
|
40
|
-
// dropping an argument here is invisible at the call site and silent at
|
|
41
|
-
// runtime. This one decided whether the realtime socket authenticates at
|
|
42
|
-
// all — without it, a server whose auth comes from an AuthAdapter fell
|
|
43
|
-
// back to "is a jwtSecret set?", answered no, and admitted every client.
|
|
44
|
-
initializeWebsockets(server, realtimeService, driver, config, adapter) {
|
|
45
|
-
if (bootstrapper.initializeWebsockets) {
|
|
46
|
-
return bootstrapper.initializeWebsockets(server, realtimeService, driver, config, adapter);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// Forwarded so the boot-time schema/RLS provisioning is reachable when
|
|
51
|
-
// this adapter is wrapped back into a bootstrapper. Omitting either left
|
|
52
|
-
// a managed tenant with no tables (500 on every data route) or tables
|
|
53
|
-
// but no policies (401 on every read) — the create step never ran.
|
|
54
|
-
ensureCollectionSchema: bootstrapper.ensureCollectionSchema
|
|
55
|
-
? (collections, driverResult, log) =>
|
|
56
|
-
bootstrapper.ensureCollectionSchema!(collections, driverResult, log)
|
|
57
|
-
: undefined,
|
|
58
|
-
|
|
59
|
-
ensureCollectionPolicies: bootstrapper.ensureCollectionPolicies
|
|
60
|
-
? (collections, driverResult, log) =>
|
|
61
|
-
bootstrapper.ensureCollectionPolicies!(collections, driverResult, log)
|
|
62
|
-
: undefined,
|
|
63
|
-
|
|
64
|
-
// Same forwarding rule, third instance. Dropping these is not a type
|
|
65
|
-
// error and not a runtime error: the stamp is simply never written and
|
|
66
|
-
// never read, so a split deployment loses the only thing that would tell
|
|
67
|
-
// it a unit is serving against a schema it was not built for — and a
|
|
68
|
-
// check that is off looks exactly like a check that passed. This one was
|
|
69
|
-
// in fact dropped on the first attempt, and the e2e caught it.
|
|
70
|
-
readCollectionsSchemaVersion: bootstrapper.readCollectionsSchemaVersion
|
|
71
|
-
? (driverResult) => bootstrapper.readCollectionsSchemaVersion!(driverResult)
|
|
72
|
-
: undefined,
|
|
73
|
-
|
|
74
|
-
stampCollectionsSchemaVersion: bootstrapper.stampCollectionsSchemaVersion
|
|
75
|
-
? (version, driverResult) => bootstrapper.stampCollectionsSchemaVersion!(version, driverResult)
|
|
76
|
-
: undefined,
|
|
77
|
-
|
|
78
|
-
getAdmin(driverResult) {
|
|
79
|
-
if (bootstrapper.getAdmin) {
|
|
80
|
-
return bootstrapper.getAdmin(driverResult);
|
|
81
|
-
}
|
|
82
|
-
return undefined;
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
mountRoutes(app, basePath, driverResult) {
|
|
86
|
-
if (bootstrapper.mountRoutes) {
|
|
87
|
-
bootstrapper.mountRoutes(app, basePath, driverResult);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|