@standardbeagle/edit-db 0.4.416 → 0.4.417

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.
@@ -0,0 +1,35 @@
1
+ import { Join } from '../types/schema';
2
+ /**
3
+ * Minimal descriptor of the parent→child relationship needed to decide whether
4
+ * (and how) to scope a polymorphic drill-down. Mirrors the polymorphic fields
5
+ * projected onto a multi-join by the server's `_dbSchema` resolver.
6
+ */
7
+ export interface PolymorphicDescriptor {
8
+ isPolymorphic?: boolean;
9
+ polymorphicTypeColumn?: string;
10
+ polymorphicTypeValue?: string;
11
+ }
12
+ /**
13
+ * Build the discriminator filter clause for a polymorphic child drill-down, or
14
+ * `null` when the relationship is not polymorphic (or lacks discriminator info).
15
+ *
16
+ * Returns a single filter object clause string such as
17
+ * `{entity_type: {_eq: "company"}}` ready to be combined with the id predicate.
18
+ */
19
+ export declare function buildPolymorphicClause(rel: PolymorphicDescriptor): string | null;
20
+ /**
21
+ * Build the complete drill-down filter for a parent→child relationship,
22
+ * combining the id predicate with the polymorphic discriminator when present.
23
+ *
24
+ * - Non-polymorphic: `{<idColumn>: {_eq: $id}}` (unchanged legacy shape).
25
+ * - Polymorphic: `{and: [{<idColumn>: {_eq: $id}}, {<typeColumn>: {_eq: "<typeValue>"}}]}`.
26
+ *
27
+ * `idVar` defaults to `$id` to match `buildQuery`'s variable naming.
28
+ */
29
+ export declare function buildChildDrillDownFilter(idColumn: string, rel: PolymorphicDescriptor, idVar?: string): string;
30
+ /**
31
+ * Locate the parent table's multi-join that targets a given child via a given
32
+ * destination (id) column, so the drill-down can read its polymorphic fields.
33
+ * Returns `undefined` when no matching multi-join exists.
34
+ */
35
+ export declare function findChildMultiJoin(parentMultiJoins: Join[] | undefined, childTable: string, idColumn: string): Join | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -98,6 +98,16 @@ export interface Join {
98
98
  destinationTable: string;
99
99
  /** Column names in the target table */
100
100
  destinationColumnNames: string[];
101
+ /**
102
+ * True when the target is a shared polymorphic child table keyed by a
103
+ * discriminator column plus an id column (e.g. notes keyed by entity_type +
104
+ * entity_id). Only present on multi-joins; absent/false on plain FK joins.
105
+ */
106
+ isPolymorphic?: boolean;
107
+ /** Discriminator column on the child table (e.g. "entity_type"). Set when isPolymorphic. */
108
+ polymorphicTypeColumn?: string;
109
+ /** Discriminator value identifying this parent's rows (e.g. "company"). Set when isPolymorphic. */
110
+ polymorphicTypeValue?: string;
101
111
  }
102
112
  /**
103
113
  * Many-to-many bridge between this entity and a target entity through a
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@standardbeagle/edit-db",
3
3
  "private": false,
4
- "version": "0.4.416",
4
+ "version": "0.4.417",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@radix-ui/react-slot": "^1.2.4",