@rebasepro/server-postgres 0.33.2 → 0.34.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-Bdin0Wxh.js → BranchService-BLcVK_Rd.js} +3 -3
- package/dist/{BranchService-Bdin0Wxh.js.map → BranchService-BLcVK_Rd.js.map} +1 -1
- package/dist/{backup-cli-BEAMPWMs.js → backup-cli-CVLOCTo_.js} +3 -3
- package/dist/{backup-cli-BEAMPWMs.js.map → backup-cli-CVLOCTo_.js.map} +1 -1
- package/dist/{boot-ddl-Bu6gAY-2.js → boot-ddl-C7hAFEvY.js} +2 -2
- package/dist/{boot-ddl-Bu6gAY-2.js.map → boot-ddl-C7hAFEvY.js.map} +1 -1
- package/dist/{cli-console-BU_Rf22O.js → cli-console-E5TM3GaL.js} +4 -4
- package/dist/{cli-console-BU_Rf22O.js.map → cli-console-E5TM3GaL.js.map} +1 -1
- package/dist/{cli-schema-dir-CjDH_31U.js → cli-schema-dir-CdEqBcph.js} +29 -10
- package/dist/cli-schema-dir-CdEqBcph.js.map +1 -0
- package/dist/cli.js +29 -27
- package/dist/cli.js.map +1 -1
- package/dist/{database-preflight-DKzsGnc4.js → database-preflight-NmFI_rFN.js} +2 -2
- package/dist/{database-preflight-DKzsGnc4.js.map → database-preflight-NmFI_rFN.js.map} +1 -1
- package/dist/{deferred-index-build-88bWtYgx.js → deferred-index-build-Bz37bvxW.js} +4 -4
- package/dist/{deferred-index-build-88bWtYgx.js.map → deferred-index-build-Bz37bvxW.js.map} +1 -1
- package/dist/{ensure-policies-nIITKxud.js → ensure-policies-C1UCom37.js} +6 -6
- package/dist/{ensure-policies-nIITKxud.js.map → ensure-policies-C1UCom37.js.map} +1 -1
- package/dist/{ensure-tables-hQ5oAK_j.js → ensure-tables-BVUNi6uG.js} +3 -3
- package/dist/{ensure-tables-hQ5oAK_j.js.map → ensure-tables-BVUNi6uG.js.map} +1 -1
- package/dist/{ensure-tables-Lm-77eM5.js → ensure-tables-DjuNRClr.js} +7 -7
- package/dist/{ensure-tables-Lm-77eM5.js.map → ensure-tables-DjuNRClr.js.map} +1 -1
- package/dist/{enum-labels-kept-mesgEJWH.js → enum-labels-kept-DrCueSHr.js} +2 -2
- package/dist/{enum-labels-kept-mesgEJWH.js.map → enum-labels-kept-DrCueSHr.js.map} +1 -1
- package/dist/{generated-schema-diff-DoT2dYDe.js → generated-schema-diff-DDktAATD.js} +2 -2
- package/dist/{generated-schema-diff-DoT2dYDe.js.map → generated-schema-diff-DDktAATD.js.map} +1 -1
- package/dist/index.es.js +11 -11
- package/dist/{introspect-db-queries-BgiRQqtR.js → introspect-db-queries-D7u9EOfV.js} +66 -4
- package/dist/introspect-db-queries-D7u9EOfV.js.map +1 -0
- package/dist/{introspect-tables-Cw_A-kk4.js → introspect-tables-2yJ3p98l.js} +267 -30
- package/dist/introspect-tables-2yJ3p98l.js.map +1 -0
- package/dist/{migrate-baseline-Bzj5gSCM.js → migrate-baseline-CnIbBRgh.js} +4 -3
- package/dist/{migrate-baseline-Bzj5gSCM.js.map → migrate-baseline-CnIbBRgh.js.map} +1 -1
- package/dist/{migrate-policy-stamps-C2WaOEsB.js → migrate-policy-stamps-D7BaYeKO.js} +4 -4
- package/dist/{migrate-policy-stamps-C2WaOEsB.js.map → migrate-policy-stamps-D7BaYeKO.js.map} +1 -1
- package/dist/{open-rebase-x3yAPy5g.js → open-rebase-DykxNl1j.js} +72 -20
- package/dist/open-rebase-DykxNl1j.js.map +1 -0
- package/dist/{pg-error-utils-CWopxboq.js → pg-error-utils-DXyqf9yP.js} +2 -2
- package/dist/{pg-error-utils-CWopxboq.js.map → pg-error-utils-DXyqf9yP.js.map} +1 -1
- package/dist/{policy-drift-rVLKS2AG.js → policy-drift-B2Czzs2Z.js} +3 -3
- package/dist/{policy-drift-rVLKS2AG.js.map → policy-drift-B2Czzs2Z.js.map} +1 -1
- package/dist/{push-index-adoption-EcamXfW2.js → push-index-adoption-DTLPk_5i.js} +2 -2
- package/dist/{push-index-adoption-EcamXfW2.js.map → push-index-adoption-DTLPk_5i.js.map} +1 -1
- package/dist/{push-index-prebuild-BPIns6wA.js → push-index-prebuild-WP5272gZ.js} +3 -3
- package/dist/{push-index-prebuild-BPIns6wA.js.map → push-index-prebuild-WP5272gZ.js.map} +1 -1
- package/dist/{push-legacy-renames-lmYkb41I.js → push-legacy-renames-CvWSBxRu.js} +3 -3
- package/dist/{push-legacy-renames-lmYkb41I.js.map → push-legacy-renames-CvWSBxRu.js.map} +1 -1
- package/dist/{push-policy-plan-Dqu4FKWh.js → push-policy-plan-D8HvHgPs.js} +3 -3
- package/dist/{push-policy-plan-Dqu4FKWh.js.map → push-policy-plan-D8HvHgPs.js.map} +1 -1
- package/dist/{request-role-cli-Ay0v9oYZ.js → request-role-cli-Y5Uqalop.js} +8 -8
- package/dist/{request-role-cli-Ay0v9oYZ.js.map → request-role-cli-Y5Uqalop.js.map} +1 -1
- package/dist/{request-role-migration-DTE3Owsh.js → request-role-migration-Cc0gJSso.js} +2 -2
- package/dist/{request-role-migration-DTE3Owsh.js.map → request-role-migration-Cc0gJSso.js.map} +1 -1
- package/dist/{rls-enforcement-Ck-d8zdJ.js → rls-enforcement-NZKe3Jr-.js} +2 -2
- package/dist/{rls-enforcement-Ck-d8zdJ.js.map → rls-enforcement-NZKe3Jr-.js.map} +1 -1
- package/dist/schema/destructive-sql.d.ts +9 -1
- package/dist/schema/doctor-cli.js +6 -6
- package/dist/schema/introspect-db-logic.d.ts +51 -0
- package/dist/schema/introspect-db-project.d.ts +6 -0
- package/dist/schema/introspect-db-queries.d.ts +21 -2
- package/dist/schema/introspect-db.js +53 -4
- package/dist/schema/introspect-db.js.map +1 -1
- package/dist/schema/introspect-foreign.d.ts +47 -0
- package/dist/schema/introspect-tables.d.ts +17 -0
- package/dist/schema/undeclarable-constraints.d.ts +16 -3
- package/dist/utils/result-rows.d.ts +20 -0
- package/dist/{websocket-DAVDn7Ki.js → websocket-CvmbzBeS.js} +3 -3
- package/dist/{websocket-DAVDn7Ki.js.map → websocket-CvmbzBeS.js.map} +1 -1
- package/package.json +7 -7
- package/dist/cli-schema-dir-CjDH_31U.js.map +0 -1
- package/dist/introspect-db-queries-BgiRQqtR.js.map +0 -1
- package/dist/introspect-tables-Cw_A-kk4.js.map +0 -1
- package/dist/open-rebase-x3yAPy5g.js.map +0 -1
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
30
|
import type { TableDescriptor, UnmappedTable } from "@rebasepro/types";
|
|
31
|
+
import { type LeftBehind } from "./introspect-foreign.js";
|
|
31
32
|
import { type SchemaMetadata } from "./introspect-db-logic.js";
|
|
32
33
|
import { type QueryableClient } from "./introspect-db-queries.js";
|
|
33
34
|
import type { CheckFactsByTable } from "./introspect-db-constraints.js";
|
|
@@ -125,6 +126,15 @@ export interface DescribeTablesOptions extends IntrospectTablesOptions {
|
|
|
125
126
|
leaveOut?: ReadonlySet<string>;
|
|
126
127
|
/** The CHECK constraints, parsed (`parseCheckConstraints`): validation in `"generate"`. */
|
|
127
128
|
checkFacts?: CheckFactsByTable;
|
|
129
|
+
/**
|
|
130
|
+
* `"supabase"` (`schema introspect --from supabase`) translates Supabase's
|
|
131
|
+
* conventions for a database that is being left: an `auth.uid()` default
|
|
132
|
+
* becomes `.onCreateUser()`, a user-id column becomes text, and `TO anon`
|
|
133
|
+
* / `TO authenticated` become conditions. Off by default, because a
|
|
134
|
+
* database Rebase runs on in place keeps those roles, and Supabase's own
|
|
135
|
+
* API still relies on them.
|
|
136
|
+
*/
|
|
137
|
+
from?: "supabase";
|
|
128
138
|
}
|
|
129
139
|
/**
|
|
130
140
|
* What {@link describeTables} returns: {@link IntrospectedTables} and the notes.
|
|
@@ -133,6 +143,13 @@ export interface DescribeTablesOptions extends IntrospectTablesOptions {
|
|
|
133
143
|
*/
|
|
134
144
|
export interface DescribedTables extends IntrospectedTables {
|
|
135
145
|
notes: IntrospectionNotes;
|
|
146
|
+
/**
|
|
147
|
+
* `"generate"` only: what the files do not carry — functions, triggers,
|
|
148
|
+
* extensions, CHECKs the database would stop enforcing, indexes that are
|
|
149
|
+
* not plain columns, foreign keys into another schema — each with why and,
|
|
150
|
+
* where Postgres can print it, the SQL that recreates it.
|
|
151
|
+
*/
|
|
152
|
+
leftBehind: LeftBehind[];
|
|
136
153
|
}
|
|
137
154
|
/**
|
|
138
155
|
* Describe every table of a Postgres schema, as the runtime serves them.
|
|
@@ -29,12 +29,25 @@
|
|
|
29
29
|
*/
|
|
30
30
|
/** A constraint kind the collection model has no way to declare. */
|
|
31
31
|
export type UndeclarableConstraintKind = "check" | "exclude";
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* A CHECK or EXCLUDE constraint, or a foreign key, as the database holds it
|
|
34
|
+
* now.
|
|
35
|
+
*
|
|
36
|
+
* A foreign key over several columns is undeclarable too: a relation holds one
|
|
37
|
+
* column, so no table definition can state it, and it is kept out of the plan
|
|
38
|
+
* like a CHECK. That is the composite key `schema introspect` lists under "not
|
|
39
|
+
* carried over" with the SQL to recreate it; a push that then dropped it made
|
|
40
|
+
* that advice undo itself. A one-column foreign key is a relation's, so it
|
|
41
|
+
* stays Atlas's to manage (removing the relation drops it), and a push that
|
|
42
|
+
* drops one prompts, as a dropped CHECK does.
|
|
43
|
+
*/
|
|
33
44
|
export interface ExistingConstraint {
|
|
34
45
|
schema: string;
|
|
35
46
|
table: string;
|
|
36
47
|
name: string;
|
|
37
|
-
kind: UndeclarableConstraintKind;
|
|
48
|
+
kind: UndeclarableConstraintKind | "foreign key";
|
|
49
|
+
/** How many columns a foreign key spans. Absent on rows read before it was asked. */
|
|
50
|
+
columns?: number;
|
|
38
51
|
}
|
|
39
52
|
/**
|
|
40
53
|
* Every CHECK and EXCLUDE constraint on an ordinary or partitioned table
|
|
@@ -44,7 +57,7 @@ export interface ExistingConstraint {
|
|
|
44
57
|
* (`f`) and, from PG 18, a catalogued `NOT NULL` (`n`) are what a collection
|
|
45
58
|
* declares, so Atlas keeps managing them.
|
|
46
59
|
*/
|
|
47
|
-
export declare const UNDECLARABLE_CONSTRAINTS_SQL = "\n SELECT n.nspname AS \"schema\",\n c.relname AS \"table\",\n con.conname AS \"name\",\n CASE con.contype WHEN 'c' THEN 'check' ELSE 'exclude' END AS \"kind\"\n FROM pg_constraint con\n JOIN pg_class c ON c.oid = con.conrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE con.contype IN ('c', 'x')\n AND c.relkind IN ('r', 'p')\n AND n.nspname NOT IN ('pg_catalog', 'information_schema')\n AND n.nspname NOT LIKE 'pg\\_%'\n";
|
|
60
|
+
export declare const UNDECLARABLE_CONSTRAINTS_SQL = "\n SELECT n.nspname AS \"schema\",\n c.relname AS \"table\",\n con.conname AS \"name\",\n CASE con.contype WHEN 'c' THEN 'check' WHEN 'f' THEN 'foreign key' ELSE 'exclude' END AS \"kind\",\n coalesce(array_length(con.conkey, 1), 0)::int AS \"columns\"\n FROM pg_constraint con\n JOIN pg_class c ON c.oid = con.conrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE con.contype IN ('c', 'x', 'f')\n AND c.relkind IN ('r', 'p')\n AND n.nspname NOT IN ('pg_catalog', 'information_schema')\n AND n.nspname NOT LIKE 'pg\\_%'\n";
|
|
48
61
|
/**
|
|
49
62
|
* The CHECK and EXCLUDE constraint names a desired state (`schema.sql`)
|
|
50
63
|
* declares — Atlas's to manage, and so never excluded.
|
|
@@ -8,3 +8,23 @@
|
|
|
8
8
|
* the script's answer, as in psql.
|
|
9
9
|
*/
|
|
10
10
|
export declare function rowsOfResult(result: unknown): Record<string, unknown>[];
|
|
11
|
+
/**
|
|
12
|
+
* An instant as `GET /api/data` returns one: RFC 3339, in UTC
|
|
13
|
+
* (`2026-11-18T10:52:23.500Z`). Postgres's own text (`2026-11-18 10:52:23.5+00`)
|
|
14
|
+
* is not something every browser's `Date` parses. A value that is not an
|
|
15
|
+
* instant (`infinity`) is returned as it came.
|
|
16
|
+
*/
|
|
17
|
+
export declare function rfc3339Instant(value: unknown): unknown;
|
|
18
|
+
/**
|
|
19
|
+
* A `bigint` as `GET /api/data` returns one: a number when it fits a safe
|
|
20
|
+
* integer, else the digits as they came, so no digit is lost.
|
|
21
|
+
*/
|
|
22
|
+
export declare function int8AsNumber(value: unknown): unknown;
|
|
23
|
+
/**
|
|
24
|
+
* The rows of a caller-SQL result with values spelled as `/api/data` spells
|
|
25
|
+
* them: every `timestamptz` column RFC 3339 (see {@link rfc3339Instant}),
|
|
26
|
+
* every `bigint` a number when it fits (see {@link int8AsNumber}). Read from
|
|
27
|
+
* the result's field types, so a column named anything, computed or aliased,
|
|
28
|
+
* is covered.
|
|
29
|
+
*/
|
|
30
|
+
export declare function withInstantsAsRfc3339(result: unknown, rows: Record<string, unknown>[]): Record<string, unknown>[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
__createRequire(import.meta.url);
|
|
3
3
|
import { i as __exportAll } from "./cli-prompt-DXG0yk-h.js";
|
|
4
|
-
import { A as reapSilentSockets, at as SQL_RESULT_BYTE_BUDGET, ct as resolveNestedPath, it as sqlRoleRanAs, j as terminateIfBacklogged, k as budgetSendBuffers, lt as assertReadRequestReadable, nt as effectiveSqlRole, ot as SqlResultTooLargeError, st as isNestedPath } from "./open-rebase-
|
|
5
|
-
import { r as BranchingUnsupportedError } from "./BranchService-
|
|
4
|
+
import { A as reapSilentSockets, at as SQL_RESULT_BYTE_BUDGET, ct as resolveNestedPath, it as sqlRoleRanAs, j as terminateIfBacklogged, k as budgetSendBuffers, lt as assertReadRequestReadable, nt as effectiveSqlRole, ot as SqlResultTooLargeError, st as isNestedPath } from "./open-rebase-DykxNl1j.js";
|
|
5
|
+
import { r as BranchingUnsupportedError } from "./BranchService-BLcVK_Rd.js";
|
|
6
6
|
import { ApiError, DATABASE_UNAVAILABLE_MESSAGE, RUNTIME_DEFAULT_MAX_BODY_SIZE, assertFieldOpsValid, assertNestedWriteAllowed, assertNoFieldOpsOnCreate, assertNoUserUpsert, assertUserCreationBodyValid, assertWriteRequestValid, createUserThroughAuthTable, decideImpersonation, declaredErrorAnswer, extractUserFromToken, getAccessModel, isAuthTable, isDatabaseUnreachable, logger, resolveConflictTarget, resolveRequireAuth, safeCompare } from "@rebasepro/server";
|
|
7
7
|
import { ANONYMOUS_USER_ID, ListLimitError, hasAdminRole, isSQLAdmin, isSchemaAdmin, resolveClientListLimit, scopeGrants, scopesForRoles } from "@rebasepro/types";
|
|
8
8
|
import { UnknownFilterOperatorError, deserializeFilter, redactSqlLiterals, relationOf } from "@rebasepro/common";
|
|
@@ -1709,4 +1709,4 @@ function createPostgresWebSocket(server, realtimeService, driver, authConfig, au
|
|
|
1709
1709
|
//#endregion
|
|
1710
1710
|
export { createPostgresWebSocket as a, websocket_exports as c, TOO_MANY_SOCKETS_CLOSE_CODE as i, PUBLIC_TYPES as n, isSocketRealtimeService as o, SESSION_ENDED_CLOSE_CODE as r, socketRealtimeMissing as s, ADMIN_PLANE_TYPES as t };
|
|
1711
1711
|
|
|
1712
|
-
//# sourceMappingURL=websocket-
|
|
1712
|
+
//# sourceMappingURL=websocket-CvmbzBeS.js.map
|