@rebasepro/server-postgres 0.11.1-canary.gfd39654 → 0.12.1-canary.gdfba2a1
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 +8 -0
- package/dist/auth/services.d.ts +16 -0
- package/dist/backup-service-DH9kPg-E.js +8866 -0
- package/dist/backup-service-DH9kPg-E.js.map +1 -0
- package/dist/collections/buildRegistry.d.ts +1 -1
- package/dist/connection-B5Wndbr1.js +196 -0
- package/dist/connection-B5Wndbr1.js.map +1 -0
- package/dist/{ensure-collection-tables-DGMYK0fr.js → ensure-collection-tables-CIHSH962.js} +5 -5
- package/dist/ensure-collection-tables-CIHSH962.js.map +1 -0
- package/dist/history/HistoryService.d.ts +9 -29
- package/dist/index.es.js +698 -9604
- package/dist/index.es.js.map +1 -1
- package/dist/schema/auth-schema.d.ts +83 -144
- package/dist/schema/dynamic-tables.d.ts +1 -1
- package/dist/schema/introspect-runtime.d.ts +1 -1
- package/dist/services/FetchService.d.ts +36 -1
- package/dist/services/row-pipeline.d.ts +3 -1
- package/dist/{src-3VmUJ8Xn.js → src-DihrDFuP.js} +354 -165
- package/dist/src-DihrDFuP.js.map +1 -0
- package/dist/{src-D5xBTl32.js → src-DoU9yPqq.js} +79 -189
- package/dist/src-DoU9yPqq.js.map +1 -0
- package/dist/utils/drizzle-conditions.d.ts +157 -3
- package/dist/utils/pg-error-utils.d.ts +6 -3
- package/dist/websocket-BKcGvILX.js +528 -0
- package/dist/websocket-BKcGvILX.js.map +1 -0
- package/package.json +14 -14
- package/src/PostgresBootstrapper.ts +23 -6
- package/src/auth/ensure-tables.ts +164 -9
- package/src/auth/services.ts +21 -2
- package/src/collections/buildRegistry.ts +1 -1
- package/src/history/HistoryService.ts +13 -31
- package/src/schema/auth-schema.ts +30 -19
- package/src/schema/dynamic-tables.ts +1 -1
- package/src/schema/generate-drizzle-schema-logic.ts +17 -5
- package/src/schema/generate-postgres-ddl-logic.ts +7 -3
- package/src/schema/introspect-runtime.ts +1 -1
- package/src/services/FetchService.ts +79 -11
- package/src/services/row-pipeline.ts +3 -1
- package/src/utils/drizzle-conditions.ts +509 -45
- package/src/utils/pg-error-utils.ts +52 -3
- package/dist/chunk-DSJWtz9O.js +0 -40
- package/dist/ensure-collection-tables-DGMYK0fr.js.map +0 -1
- package/dist/src-3VmUJ8Xn.js.map +0 -1
- package/dist/src-D5xBTl32.js.map +0 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* single config file.
|
|
8
8
|
*
|
|
9
9
|
* Distinct from `introspect-db.ts`, which runs the same queries but emits
|
|
10
|
-
* TypeScript *source* for a developer to edit and commit (
|
|
10
|
+
* TypeScript *source* for a developer to edit and commit (declared collections). The two
|
|
11
11
|
* share the mapping helpers in `introspect-db-logic.ts` so a table is described
|
|
12
12
|
* the same way whether it was generated or introspected.
|
|
13
13
|
*/
|
|
@@ -20,6 +20,32 @@ export declare class FetchService {
|
|
|
20
20
|
* Safely narrows the DrizzleClient union type to access db.query[tableName].
|
|
21
21
|
*/
|
|
22
22
|
private getQueryBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* The context the condition builder needs to compile a filter key that is
|
|
25
|
+
* not a column name outright.
|
|
26
|
+
*
|
|
27
|
+
* Two such keys. An owning relation's key resolves through the collection's
|
|
28
|
+
* relations to its foreign-key column; a relation whose link lives on the
|
|
29
|
+
* target table or in a junction resolves to a correlated `EXISTS`, which
|
|
30
|
+
* needs the registry to reach that other table and this table's key column
|
|
31
|
+
* to correlate back.
|
|
32
|
+
*
|
|
33
|
+
* Looked up rather than passed: every read path already has the path, only
|
|
34
|
+
* some have the collection, and a path that names no registered collection
|
|
35
|
+
* (a nested/derived one) is not an error here — the builder simply falls
|
|
36
|
+
* back to guessing the default key shapes, and a relation filter it cannot
|
|
37
|
+
* compile stays unresolvable and so fails closed.
|
|
38
|
+
*/
|
|
39
|
+
private filterContext;
|
|
40
|
+
/**
|
|
41
|
+
* The table column this collection's rows are keyed by, or `undefined`.
|
|
42
|
+
*
|
|
43
|
+
* `getPrimaryKeys` rather than `requirePrimaryKeys`: a collection with no
|
|
44
|
+
* resolvable key is not an error on the filter path — it only means the
|
|
45
|
+
* relation filters that would correlate on it cannot be compiled, which
|
|
46
|
+
* the builder already handles by failing that field closed.
|
|
47
|
+
*/
|
|
48
|
+
private resolveIdColumn;
|
|
23
49
|
/**
|
|
24
50
|
* Build filter conditions from FilterValues
|
|
25
51
|
* Delegates to DrizzleConditionBuilder.buildFilterConditions
|
|
@@ -28,6 +54,15 @@ export declare class FetchService {
|
|
|
28
54
|
/**
|
|
29
55
|
* Resolves the correct Drizzle column for sorting.
|
|
30
56
|
* Automatically maps owning relation property keys to their underlying foreign key column.
|
|
57
|
+
*
|
|
58
|
+
* The relation's own `localKey` is the authority for that foreign key, not
|
|
59
|
+
* `<field>_id`. The default local key comes from `generateForeignKeyName`,
|
|
60
|
+
* which snake-cases *and singularises* — `userProfile` → `user_profile_id`,
|
|
61
|
+
* `users` → `user_id` — and an author can override it outright. A wrong
|
|
62
|
+
* guess resolves to nothing, the caller drops the `ORDER BY`, and the rows
|
|
63
|
+
* come back in whatever order Postgres pleases: paging over that repeats
|
|
64
|
+
* and skips rows rather than erroring. The guesses stay, last, for a
|
|
65
|
+
* caller that hands over no collection to resolve against.
|
|
31
66
|
*/
|
|
32
67
|
private resolveOrderByField;
|
|
33
68
|
/**
|
|
@@ -35,7 +70,7 @@ export declare class FetchService {
|
|
|
35
70
|
* Converts collection relations to a Drizzle-compatible `with` object.
|
|
36
71
|
*
|
|
37
72
|
* When `include` is provided, only those relations are loaded.
|
|
38
|
-
* When `include` is absent, ALL relations are loaded (
|
|
73
|
+
* When `include` is absent, ALL relations are loaded (the admin path).
|
|
39
74
|
*
|
|
40
75
|
* Automatically detects many-to-many junction tables and nests
|
|
41
76
|
* the target relation so actual row data is returned.
|
|
@@ -10,7 +10,9 @@ import { PostgresCollectionRegistry } from "../collections/PostgresCollectionReg
|
|
|
10
10
|
*
|
|
11
11
|
* - `"ref"` — a `{ id, path, __type: "relation" }` reference carrying the
|
|
12
12
|
* target's values. This is what the admin renders.
|
|
13
|
-
* - `"inline"` — the target's own columns, flat. This is what REST serves
|
|
13
|
+
* - `"inline"` — the target's own columns, flat. This is what REST serves, and
|
|
14
|
+
* — since the in-process SDK reads through the same pipeline — what
|
|
15
|
+
* `rebase.data` / `context.data` serve too. A developer never sees a ref.
|
|
14
16
|
*
|
|
15
17
|
* They used to be two functions that happened to agree, and the agreement was
|
|
16
18
|
* not enforced by anything: the row-identity bug had to be fixed five times
|