@inixiative/json-rules 3.20.0 → 3.22.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
@@ -501,11 +501,14 @@ type AggregateRuleBase<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
501
501
  };
502
502
  type AggregateSingleOperator = OperatorValues['equals'] | OperatorValues['notEquals'] | OperatorValues['lessThan'] | OperatorValues['lessThanEquals'] | OperatorValues['greaterThan'] | OperatorValues['greaterThanEquals'];
503
503
  type AggregateRangeOperator = OperatorValues['between'] | OperatorValues['notBetween'];
504
+ type AggregatePresenceOperator = OperatorValues['exists'] | OperatorValues['notExists'];
504
505
  type StrictAggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = (AggregateRuleBase<TRuleValue, TDateValue> & {
505
506
  operator: AggregateSingleOperator;
506
507
  } & ValueSource<number>) | (AggregateRuleBase<TRuleValue, TDateValue> & {
507
508
  operator: AggregateRangeOperator;
508
- } & ValueSource<[number, number]>);
509
+ } & ValueSource<[number, number]>) | (AggregateRuleBase<TRuleValue, TDateValue> & {
510
+ operator: AggregatePresenceOperator;
511
+ });
509
512
  type SortDir = 'asc' | 'desc';
510
513
  type OrderBy = {
511
514
  field: string;
@@ -526,6 +529,7 @@ type AggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowF
526
529
  condition?: Condition<TRuleValue, TDateValue>;
527
530
  operator: Operator;
528
531
  error?: string;
532
+ coerceType?: FieldKind;
529
533
  } & ValueSourceFields<number | [number, number]>;
530
534
  type Rule<TValue = RuleValue> = ValueSourceFields<TValue> & {
531
535
  field: string;
@@ -652,9 +656,10 @@ type ListBindingsOptions = {
652
656
  declare const listBindings: (condition: Condition, { required }?: ListBindingsOptions) => string[];
653
657
  /**
654
658
  * The paths a rule reads from the row it is checked on, sorted: each leaf's `field` and each
655
- * `{ path }` on its value side. A relation node (`arrayOperator`, `aggregate`) contributes its own
656
- * field; what its `condition` / `filter` read is relative to the related rows, so it is not listed.
657
- * For a caller that must load what a rule reads before checking it (a hydrator).
659
+ * `{ path }` on its value side, scope prefix dropped. Inside a relation node (`arrayOperator`,
660
+ * `aggregate`) a bare `field` reads the related row and is not listed, while a bare value path and
661
+ * a scope ref that climbs back to the row (`$$.` one relation down, `$$$.` two down) are. For a
662
+ * caller that must load what a rule reads before checking it (a hydrator).
658
663
  */
659
664
  declare const listFields: (condition: Condition) => string[];
660
665
  /**
@@ -948,7 +953,7 @@ type GroupByStep = {
948
953
  args: {
949
954
  by: string[];
950
955
  where: Record<string, unknown>;
951
- having: Record<string, unknown>;
956
+ having?: Record<string, unknown>;
952
957
  };
953
958
  extract: string;
954
959
  };
package/dist/index.d.ts CHANGED
@@ -501,11 +501,14 @@ type AggregateRuleBase<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
501
501
  };
502
502
  type AggregateSingleOperator = OperatorValues['equals'] | OperatorValues['notEquals'] | OperatorValues['lessThan'] | OperatorValues['lessThanEquals'] | OperatorValues['greaterThan'] | OperatorValues['greaterThanEquals'];
503
503
  type AggregateRangeOperator = OperatorValues['between'] | OperatorValues['notBetween'];
504
+ type AggregatePresenceOperator = OperatorValues['exists'] | OperatorValues['notExists'];
504
505
  type StrictAggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = (AggregateRuleBase<TRuleValue, TDateValue> & {
505
506
  operator: AggregateSingleOperator;
506
507
  } & ValueSource<number>) | (AggregateRuleBase<TRuleValue, TDateValue> & {
507
508
  operator: AggregateRangeOperator;
508
- } & ValueSource<[number, number]>);
509
+ } & ValueSource<[number, number]>) | (AggregateRuleBase<TRuleValue, TDateValue> & {
510
+ operator: AggregatePresenceOperator;
511
+ });
509
512
  type SortDir = 'asc' | 'desc';
510
513
  type OrderBy = {
511
514
  field: string;
@@ -526,6 +529,7 @@ type AggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowF
526
529
  condition?: Condition<TRuleValue, TDateValue>;
527
530
  operator: Operator;
528
531
  error?: string;
532
+ coerceType?: FieldKind;
529
533
  } & ValueSourceFields<number | [number, number]>;
530
534
  type Rule<TValue = RuleValue> = ValueSourceFields<TValue> & {
531
535
  field: string;
@@ -652,9 +656,10 @@ type ListBindingsOptions = {
652
656
  declare const listBindings: (condition: Condition, { required }?: ListBindingsOptions) => string[];
653
657
  /**
654
658
  * The paths a rule reads from the row it is checked on, sorted: each leaf's `field` and each
655
- * `{ path }` on its value side. A relation node (`arrayOperator`, `aggregate`) contributes its own
656
- * field; what its `condition` / `filter` read is relative to the related rows, so it is not listed.
657
- * For a caller that must load what a rule reads before checking it (a hydrator).
659
+ * `{ path }` on its value side, scope prefix dropped. Inside a relation node (`arrayOperator`,
660
+ * `aggregate`) a bare `field` reads the related row and is not listed, while a bare value path and
661
+ * a scope ref that climbs back to the row (`$$.` one relation down, `$$$.` two down) are. For a
662
+ * caller that must load what a rule reads before checking it (a hydrator).
658
663
  */
659
664
  declare const listFields: (condition: Condition) => string[];
660
665
  /**
@@ -948,7 +953,7 @@ type GroupByStep = {
948
953
  args: {
949
954
  by: string[];
950
955
  where: Record<string, unknown>;
951
- having: Record<string, unknown>;
956
+ having?: Record<string, unknown>;
952
957
  };
953
958
  extract: string;
954
959
  };