@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.
Files changed (44) hide show
  1. package/dist/PostgresBootstrapper.d.ts +8 -0
  2. package/dist/auth/services.d.ts +16 -0
  3. package/dist/backup-service-DH9kPg-E.js +8866 -0
  4. package/dist/backup-service-DH9kPg-E.js.map +1 -0
  5. package/dist/collections/buildRegistry.d.ts +1 -1
  6. package/dist/connection-B5Wndbr1.js +196 -0
  7. package/dist/connection-B5Wndbr1.js.map +1 -0
  8. package/dist/{ensure-collection-tables-DGMYK0fr.js → ensure-collection-tables-CIHSH962.js} +5 -5
  9. package/dist/ensure-collection-tables-CIHSH962.js.map +1 -0
  10. package/dist/history/HistoryService.d.ts +9 -29
  11. package/dist/index.es.js +698 -9604
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/schema/auth-schema.d.ts +83 -144
  14. package/dist/schema/dynamic-tables.d.ts +1 -1
  15. package/dist/schema/introspect-runtime.d.ts +1 -1
  16. package/dist/services/FetchService.d.ts +36 -1
  17. package/dist/services/row-pipeline.d.ts +3 -1
  18. package/dist/{src-3VmUJ8Xn.js → src-DihrDFuP.js} +354 -165
  19. package/dist/src-DihrDFuP.js.map +1 -0
  20. package/dist/{src-D5xBTl32.js → src-DoU9yPqq.js} +79 -189
  21. package/dist/src-DoU9yPqq.js.map +1 -0
  22. package/dist/utils/drizzle-conditions.d.ts +157 -3
  23. package/dist/utils/pg-error-utils.d.ts +6 -3
  24. package/dist/websocket-BKcGvILX.js +528 -0
  25. package/dist/websocket-BKcGvILX.js.map +1 -0
  26. package/package.json +14 -14
  27. package/src/PostgresBootstrapper.ts +23 -6
  28. package/src/auth/ensure-tables.ts +164 -9
  29. package/src/auth/services.ts +21 -2
  30. package/src/collections/buildRegistry.ts +1 -1
  31. package/src/history/HistoryService.ts +13 -31
  32. package/src/schema/auth-schema.ts +30 -19
  33. package/src/schema/dynamic-tables.ts +1 -1
  34. package/src/schema/generate-drizzle-schema-logic.ts +17 -5
  35. package/src/schema/generate-postgres-ddl-logic.ts +7 -3
  36. package/src/schema/introspect-runtime.ts +1 -1
  37. package/src/services/FetchService.ts +79 -11
  38. package/src/services/row-pipeline.ts +3 -1
  39. package/src/utils/drizzle-conditions.ts +509 -45
  40. package/src/utils/pg-error-utils.ts +52 -3
  41. package/dist/chunk-DSJWtz9O.js +0 -40
  42. package/dist/ensure-collection-tables-DGMYK0fr.js.map +0 -1
  43. package/dist/src-3VmUJ8Xn.js.map +0 -1
  44. 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 (CMS mode). The two
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 (CMS path).
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