@inixiative/json-rules 2.6.0 → 2.7.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
@@ -187,6 +187,7 @@ type OrderBy = {
187
187
  dir: SortDir;
188
188
  }[];
189
189
  type WindowFields = {
190
+ filter?: Condition;
190
191
  orderBy?: OrderBy;
191
192
  take?: number;
192
193
  skip?: number;
@@ -479,6 +480,7 @@ declare const ValueShape: {
479
480
  readonly range: "range";
480
481
  readonly dateValue: "dateValue";
481
482
  readonly dateRange: "dateRange";
483
+ readonly dateWindow: "dateWindow";
482
484
  readonly dayList: "dayList";
483
485
  readonly count: "count";
484
486
  readonly predicate: "predicate";
@@ -488,6 +490,7 @@ type CatalogEntry = {
488
490
  kinds: readonly FieldKind[];
489
491
  targets: readonly RuleTarget[];
490
492
  valueShape: ValueShape;
493
+ acceptsExpr?: boolean;
491
494
  };
492
495
  declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
493
496
  declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
@@ -496,6 +499,30 @@ type ArrayCatalogEntry = {
496
499
  valueShape: ValueShape;
497
500
  };
498
501
  declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
502
+ declare const WindowSupport: {
503
+ readonly full: "full";
504
+ readonly extremal: "extremal";
505
+ readonly none: "none";
506
+ };
507
+ type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
508
+ declare const WINDOW_SELECTOR: {
509
+ readonly fields: readonly ["filter", "orderBy", "take", "skip"];
510
+ readonly sortDirs: readonly ["asc", "desc"];
511
+ readonly support: {
512
+ readonly array: {
513
+ readonly check: "full";
514
+ readonly toPrisma: "extremal";
515
+ readonly toSql: "none";
516
+ };
517
+ readonly aggregate: {
518
+ readonly check: "full";
519
+ readonly toPrisma: "none";
520
+ readonly toSql: "none";
521
+ };
522
+ };
523
+ };
524
+ type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
525
+ declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
499
526
  declare const AGGREGATE_OPERATORS: readonly Operator[];
500
527
  declare const isAggregateSingleOperator: (operator: Operator) => boolean;
501
528
  declare const isAggregateRangeOperator: (operator: Operator) => boolean;
@@ -592,4 +619,4 @@ declare const assertValidRule: (condition: unknown, options?: {
592
619
  target?: RuleTarget;
593
620
  }) => asserts condition is Condition;
594
621
 
595
- export { AGGREGATE_OPERATORS, ALL_KINDS, ARRAY_OPERATOR_CATALOG, type AggregateMode, type AggregateRule, type All, type Any, type ArrayCatalogEntry, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type BuildOptions, type CatalogEntry, type CheckOptions, type Condition, type CreateLensInput, DATE_OPERATOR_CATALOG, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, DateOperator, type DateRule, type DateRuleValue, EQUATABLE_KINDS, type EdgeExpr, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaStep, type PrismaWhere, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SqlResult, type StepRef, type StrictAggregateRule, type StrictAll, type StrictAny, type StrictArrayCountRule, type StrictArrayPredicateRule, type StrictArrayPresenceRule, type StrictArrayRule, type StrictCondition, type StrictContainsRule, type StrictDateComparisonRule, type StrictDateDayRule, type StrictDateRangeRule, type StrictDateRule, type StrictEqualityRule, type StrictIfThenElse, type StrictMembershipRule, type StrictOrderedComparisonRule, type StrictPatternRule, type StrictPresenceRule, type StrictRangeRule, type StrictRule, type StrictStringBoundaryRule, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, type WeekStart, type WhereStep, type WindowFields, applyLens, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, executePrismaQueryPlan, getArrayOperators, getOperatorsForKind, getValueShape, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
622
+ export { AGGREGATE_OPERATORS, ALL_KINDS, ARRAY_OPERATOR_CATALOG, type AggregateMode, type AggregateRule, type All, type Any, type ArrayCatalogEntry, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type BuildOptions, type CatalogEntry, type CheckOptions, type Condition, type CreateLensInput, DATE_OPERATOR_CATALOG, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, DateOperator, type DateRule, type DateRuleValue, EQUATABLE_KINDS, type EdgeExpr, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaStep, type PrismaWhere, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SqlResult, type StepRef, type StrictAggregateRule, type StrictAll, type StrictAny, type StrictArrayCountRule, type StrictArrayPredicateRule, type StrictArrayPresenceRule, type StrictArrayRule, type StrictCondition, type StrictContainsRule, type StrictDateComparisonRule, type StrictDateDayRule, type StrictDateRangeRule, type StrictDateRule, type StrictEqualityRule, type StrictIfThenElse, type StrictMembershipRule, type StrictOrderedComparisonRule, type StrictPatternRule, type StrictPresenceRule, type StrictRangeRule, type StrictRule, type StrictStringBoundaryRule, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, executePrismaQueryPlan, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
package/dist/index.d.ts CHANGED
@@ -187,6 +187,7 @@ type OrderBy = {
187
187
  dir: SortDir;
188
188
  }[];
189
189
  type WindowFields = {
190
+ filter?: Condition;
190
191
  orderBy?: OrderBy;
191
192
  take?: number;
192
193
  skip?: number;
@@ -479,6 +480,7 @@ declare const ValueShape: {
479
480
  readonly range: "range";
480
481
  readonly dateValue: "dateValue";
481
482
  readonly dateRange: "dateRange";
483
+ readonly dateWindow: "dateWindow";
482
484
  readonly dayList: "dayList";
483
485
  readonly count: "count";
484
486
  readonly predicate: "predicate";
@@ -488,6 +490,7 @@ type CatalogEntry = {
488
490
  kinds: readonly FieldKind[];
489
491
  targets: readonly RuleTarget[];
490
492
  valueShape: ValueShape;
493
+ acceptsExpr?: boolean;
491
494
  };
492
495
  declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
493
496
  declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
@@ -496,6 +499,30 @@ type ArrayCatalogEntry = {
496
499
  valueShape: ValueShape;
497
500
  };
498
501
  declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
502
+ declare const WindowSupport: {
503
+ readonly full: "full";
504
+ readonly extremal: "extremal";
505
+ readonly none: "none";
506
+ };
507
+ type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
508
+ declare const WINDOW_SELECTOR: {
509
+ readonly fields: readonly ["filter", "orderBy", "take", "skip"];
510
+ readonly sortDirs: readonly ["asc", "desc"];
511
+ readonly support: {
512
+ readonly array: {
513
+ readonly check: "full";
514
+ readonly toPrisma: "extremal";
515
+ readonly toSql: "none";
516
+ };
517
+ readonly aggregate: {
518
+ readonly check: "full";
519
+ readonly toPrisma: "none";
520
+ readonly toSql: "none";
521
+ };
522
+ };
523
+ };
524
+ type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
525
+ declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
499
526
  declare const AGGREGATE_OPERATORS: readonly Operator[];
500
527
  declare const isAggregateSingleOperator: (operator: Operator) => boolean;
501
528
  declare const isAggregateRangeOperator: (operator: Operator) => boolean;
@@ -592,4 +619,4 @@ declare const assertValidRule: (condition: unknown, options?: {
592
619
  target?: RuleTarget;
593
620
  }) => asserts condition is Condition;
594
621
 
595
- export { AGGREGATE_OPERATORS, ALL_KINDS, ARRAY_OPERATOR_CATALOG, type AggregateMode, type AggregateRule, type All, type Any, type ArrayCatalogEntry, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type BuildOptions, type CatalogEntry, type CheckOptions, type Condition, type CreateLensInput, DATE_OPERATOR_CATALOG, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, DateOperator, type DateRule, type DateRuleValue, EQUATABLE_KINDS, type EdgeExpr, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaStep, type PrismaWhere, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SqlResult, type StepRef, type StrictAggregateRule, type StrictAll, type StrictAny, type StrictArrayCountRule, type StrictArrayPredicateRule, type StrictArrayPresenceRule, type StrictArrayRule, type StrictCondition, type StrictContainsRule, type StrictDateComparisonRule, type StrictDateDayRule, type StrictDateRangeRule, type StrictDateRule, type StrictEqualityRule, type StrictIfThenElse, type StrictMembershipRule, type StrictOrderedComparisonRule, type StrictPatternRule, type StrictPresenceRule, type StrictRangeRule, type StrictRule, type StrictStringBoundaryRule, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, type WeekStart, type WhereStep, type WindowFields, applyLens, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, executePrismaQueryPlan, getArrayOperators, getOperatorsForKind, getValueShape, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
622
+ export { AGGREGATE_OPERATORS, ALL_KINDS, ARRAY_OPERATOR_CATALOG, type AggregateMode, type AggregateRule, type All, type Any, type ArrayCatalogEntry, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type BuildOptions, type CatalogEntry, type CheckOptions, type Condition, type CreateLensInput, DATE_OPERATOR_CATALOG, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, DateOperator, type DateRule, type DateRuleValue, EQUATABLE_KINDS, type EdgeExpr, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaStep, type PrismaWhere, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SqlResult, type StepRef, type StrictAggregateRule, type StrictAll, type StrictAny, type StrictArrayCountRule, type StrictArrayPredicateRule, type StrictArrayPresenceRule, type StrictArrayRule, type StrictCondition, type StrictContainsRule, type StrictDateComparisonRule, type StrictDateDayRule, type StrictDateRangeRule, type StrictDateRule, type StrictEqualityRule, type StrictIfThenElse, type StrictMembershipRule, type StrictOrderedComparisonRule, type StrictPatternRule, type StrictPresenceRule, type StrictRangeRule, type StrictRule, type StrictStringBoundaryRule, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, executePrismaQueryPlan, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };