@inixiative/json-rules 2.23.0 → 2.24.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/index.d.cts CHANGED
@@ -587,20 +587,21 @@ type ModelDefaultNarrowing = {
587
587
  * Per-field eligibility over THIS model — decorates a field's option picker.
588
588
  * A bare `Condition` is the eligibility `where`: the field's selectable values =
589
589
  * DISTINCT(field) over this model filtered by `where` (plus the model's own
590
- * narrowing). A `SourceSpec` adds an optional `label` — a sibling column on this
591
- * same model co-selected as each value's display label. Referenced-model option
592
- * sets need no special form: declare the source at a relation-traversed narrowing
593
- * node and it compiles over whatever model that path resolves to. The `where`
594
- * composes AND-only across layers (general via `mapDefaults`, path-specific via
595
- * `root`/`relations`); a later layer's `label` wins.
590
+ * narrowing). A `SourceSpec` adds an optional `label` — a sibling column, or a
591
+ * dotted to-one path ending on a scalar (like `groupBy`), co-selected as each
592
+ * value's display label. Referenced-model option sets need no special form: declare
593
+ * the source at a relation-traversed narrowing node and it compiles over whatever
594
+ * model that path resolves to. The `where` composes AND-only across layers (general
595
+ * via `mapDefaults`, path-specific via `root`/`relations`); a later layer's `label` wins.
596
596
  */
597
597
  sources?: Record<string, SourceValue>;
598
598
  };
599
599
  /**
600
- * A sourced field's eligibility `where` plus an optional sibling display-label column
601
- * and an optional `groupBy` — a dotted path (to-one hops only, ending on a scalar)
602
- * whose value partitions the option set. Grouped options carry `group`; the classic
603
- * flat set is the ungrouped case. At least one key is required — `{}` is not a
600
+ * A sourced field's eligibility `where` plus an optional display-label column — a
601
+ * sibling, or a dotted to-one path ending on a scalar, resolved exactly like a
602
+ * `groupBy` axis — and an optional `groupBy`: a dotted path (to-one hops only, ending
603
+ * on a scalar) whose value partitions the option set. Grouped options carry `group`;
604
+ * the classic flat set is the ungrouped case. At least one key is required — `{}` is not a
604
605
  * Condition; the unconstrained spelling is `true`.
605
606
  */
606
607
  type SourceSpec = {
@@ -707,7 +708,8 @@ type ProjectedVisit = {
707
708
  whereClauses: Condition[];
708
709
  /** Per-field source eligibility wheres, composed across layers (general + path). */
709
710
  sources: Record<string, Condition[]>;
710
- /** Per-field display-label column for a sourced field (from a SourceSpec's `label`). */
711
+ /** Per-field display label for a sourced field (from a SourceSpec's `label`): a sibling
712
+ * column or a dotted to-one path. */
711
713
  sourceLabels: Record<string, string>;
712
714
  /** Per-field option-partition axes for a sourced field (from a SourceSpec's `groupBy`). */
713
715
  sourceGroupBys: Record<string, string[]>;
@@ -802,7 +804,9 @@ type SourceQuery = {
802
804
  mapName: string;
803
805
  model: string;
804
806
  field: string;
805
- /** Sibling column co-selected as each value's display label (from a SourceSpec's `label`). */
807
+ /** Co-selected as each value's display label (from a SourceSpec's `label`): a sibling
808
+ * column, or a dotted to-one path like a groupBy axis — then selected nested in prisma
809
+ * and aliased `__label` in sql. */
806
810
  label?: string;
807
811
  /** Option-partition axes (from a SourceSpec's `groupBy`, normalized); each axis
808
812
  * column is selected nested in prisma and aliased `__group_i` in sql. */
@@ -827,9 +831,9 @@ type SourceRowShape = 'prisma' | 'sql';
827
831
  * Materialize one compiled `SourceQuery`'s fetched rows into its `SourceValues` —
828
832
  * the executor-side counterpart of `sourceQueries`, so apps never hand-map rows.
829
833
  * `rowShape` names the wire format: prisma rows (default) nest each `groupBy` axis
830
- * as related objects; sql rows carry them flat under the statement's `__group_i`
831
- * aliases. Grouped queries fetch without DISTINCT, so dedup per (groups, value)
832
- * happens here.
834
+ * (and a dotted `label`) as related objects; sql rows carry them flat under the
835
+ * statement's `__group_i` / `__label` aliases. Grouped queries fetch without
836
+ * DISTINCT, so dedup per (groups, value) happens here.
833
837
  */
834
838
  declare const sourceValuesFromQueryRows: (query: SourceQuery, rows: readonly Row$1[], opts?: {
835
839
  rowShape?: SourceRowShape;
@@ -843,7 +847,8 @@ type Row = Record<string, unknown>;
843
847
  * the collection fetched UNDER the lens (relations inline), so they are already
844
848
  * lens-scoped: eligibility here is the field's source `where` only, evaluated via
845
849
  * `check()` (`options` feeds `{bind}` clauses). Scalar-list fields contribute one
846
- * option per element, labels take the first non-null sibling, and sorting is
850
+ * option per element, labels take the first non-null value of the label column
851
+ * (a sibling, or a dotted to-one path read through the nested rows), and sorting is
847
852
  * numeric-aware in a fixed locale. Feed the result to `exposedSurface` /
848
853
  * `projectByPath` as `{ sourceValues }`.
849
854
  */
package/dist/index.d.ts CHANGED
@@ -587,20 +587,21 @@ type ModelDefaultNarrowing = {
587
587
  * Per-field eligibility over THIS model — decorates a field's option picker.
588
588
  * A bare `Condition` is the eligibility `where`: the field's selectable values =
589
589
  * DISTINCT(field) over this model filtered by `where` (plus the model's own
590
- * narrowing). A `SourceSpec` adds an optional `label` — a sibling column on this
591
- * same model co-selected as each value's display label. Referenced-model option
592
- * sets need no special form: declare the source at a relation-traversed narrowing
593
- * node and it compiles over whatever model that path resolves to. The `where`
594
- * composes AND-only across layers (general via `mapDefaults`, path-specific via
595
- * `root`/`relations`); a later layer's `label` wins.
590
+ * narrowing). A `SourceSpec` adds an optional `label` — a sibling column, or a
591
+ * dotted to-one path ending on a scalar (like `groupBy`), co-selected as each
592
+ * value's display label. Referenced-model option sets need no special form: declare
593
+ * the source at a relation-traversed narrowing node and it compiles over whatever
594
+ * model that path resolves to. The `where` composes AND-only across layers (general
595
+ * via `mapDefaults`, path-specific via `root`/`relations`); a later layer's `label` wins.
596
596
  */
597
597
  sources?: Record<string, SourceValue>;
598
598
  };
599
599
  /**
600
- * A sourced field's eligibility `where` plus an optional sibling display-label column
601
- * and an optional `groupBy` — a dotted path (to-one hops only, ending on a scalar)
602
- * whose value partitions the option set. Grouped options carry `group`; the classic
603
- * flat set is the ungrouped case. At least one key is required — `{}` is not a
600
+ * A sourced field's eligibility `where` plus an optional display-label column — a
601
+ * sibling, or a dotted to-one path ending on a scalar, resolved exactly like a
602
+ * `groupBy` axis — and an optional `groupBy`: a dotted path (to-one hops only, ending
603
+ * on a scalar) whose value partitions the option set. Grouped options carry `group`;
604
+ * the classic flat set is the ungrouped case. At least one key is required — `{}` is not a
604
605
  * Condition; the unconstrained spelling is `true`.
605
606
  */
606
607
  type SourceSpec = {
@@ -707,7 +708,8 @@ type ProjectedVisit = {
707
708
  whereClauses: Condition[];
708
709
  /** Per-field source eligibility wheres, composed across layers (general + path). */
709
710
  sources: Record<string, Condition[]>;
710
- /** Per-field display-label column for a sourced field (from a SourceSpec's `label`). */
711
+ /** Per-field display label for a sourced field (from a SourceSpec's `label`): a sibling
712
+ * column or a dotted to-one path. */
711
713
  sourceLabels: Record<string, string>;
712
714
  /** Per-field option-partition axes for a sourced field (from a SourceSpec's `groupBy`). */
713
715
  sourceGroupBys: Record<string, string[]>;
@@ -802,7 +804,9 @@ type SourceQuery = {
802
804
  mapName: string;
803
805
  model: string;
804
806
  field: string;
805
- /** Sibling column co-selected as each value's display label (from a SourceSpec's `label`). */
807
+ /** Co-selected as each value's display label (from a SourceSpec's `label`): a sibling
808
+ * column, or a dotted to-one path like a groupBy axis — then selected nested in prisma
809
+ * and aliased `__label` in sql. */
806
810
  label?: string;
807
811
  /** Option-partition axes (from a SourceSpec's `groupBy`, normalized); each axis
808
812
  * column is selected nested in prisma and aliased `__group_i` in sql. */
@@ -827,9 +831,9 @@ type SourceRowShape = 'prisma' | 'sql';
827
831
  * Materialize one compiled `SourceQuery`'s fetched rows into its `SourceValues` —
828
832
  * the executor-side counterpart of `sourceQueries`, so apps never hand-map rows.
829
833
  * `rowShape` names the wire format: prisma rows (default) nest each `groupBy` axis
830
- * as related objects; sql rows carry them flat under the statement's `__group_i`
831
- * aliases. Grouped queries fetch without DISTINCT, so dedup per (groups, value)
832
- * happens here.
834
+ * (and a dotted `label`) as related objects; sql rows carry them flat under the
835
+ * statement's `__group_i` / `__label` aliases. Grouped queries fetch without
836
+ * DISTINCT, so dedup per (groups, value) happens here.
833
837
  */
834
838
  declare const sourceValuesFromQueryRows: (query: SourceQuery, rows: readonly Row$1[], opts?: {
835
839
  rowShape?: SourceRowShape;
@@ -843,7 +847,8 @@ type Row = Record<string, unknown>;
843
847
  * the collection fetched UNDER the lens (relations inline), so they are already
844
848
  * lens-scoped: eligibility here is the field's source `where` only, evaluated via
845
849
  * `check()` (`options` feeds `{bind}` clauses). Scalar-list fields contribute one
846
- * option per element, labels take the first non-null sibling, and sorting is
850
+ * option per element, labels take the first non-null value of the label column
851
+ * (a sibling, or a dotted to-one path read through the nested rows), and sorting is
847
852
  * numeric-aware in a fixed locale. Feed the result to `exposedSurface` /
848
853
  * `projectByPath` as `{ sourceValues }`.
849
854
  */