@inixiative/json-rules 3.19.1 → 3.21.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/README.md +11 -5
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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;
|
|
@@ -948,7 +951,7 @@ type GroupByStep = {
|
|
|
948
951
|
args: {
|
|
949
952
|
by: string[];
|
|
950
953
|
where: Record<string, unknown>;
|
|
951
|
-
having
|
|
954
|
+
having?: Record<string, unknown>;
|
|
952
955
|
};
|
|
953
956
|
extract: string;
|
|
954
957
|
};
|
|
@@ -1453,6 +1456,13 @@ type ConditionShapeKeys = {
|
|
|
1453
1456
|
/** The keys a node of one shape takes: those it must have and those it may. */
|
|
1454
1457
|
declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKeys;
|
|
1455
1458
|
|
|
1459
|
+
/** Stamp the coercion a value expression's aggregates need from the lens, as `coerceRule` does for
|
|
1460
|
+
* a rule's field rules: a `distinct` / `min` / `max` over a DateTime column gets
|
|
1461
|
+
* `coerceType: 'DateTime'`, so ISO date strings read as dates. An aggregate that already names
|
|
1462
|
+
* its coercion, or that the lens can't type, is left as it is. Non-mutating; throws on a
|
|
1463
|
+
* malformed expression. */
|
|
1464
|
+
declare const coerceValue: (expression: ValueExpression, lensOrNarrowing: Lens | LensNarrowing) => ValueExpression;
|
|
1465
|
+
|
|
1456
1466
|
/** A value expression under a lens: its type, the dotted paths it reads from the row (a relation's
|
|
1457
1467
|
* rows under the relation: `fanMissions.status`), its clock unit, and every problem the
|
|
1458
1468
|
* validator, the lens gate and type inference find. Never throws on a bad expression. */
|
|
@@ -1511,4 +1521,4 @@ declare const valueClockUnit: (expression: ValueExpression) => ClockUnit | null;
|
|
|
1511
1521
|
*/
|
|
1512
1522
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1513
1523
|
|
|
1514
|
-
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type AggregateValue, type All, type Any, ArrayOperator, type ArrayRule, type BareLiteral, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, CLOCK_UNITS, type CheckData, type CheckOptions, type ClockUnit, type CompileOptions, type Condition, ConditionShape, type ConditionShapeKeys, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type IfThenElseValue, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type LensWhereSql, type LensWhereSqlOptions, type ListBindingsOptions, type ListValue, type Magnitude, type MaterializeSourceQueryOptions, type ModelDefaultNarrowing, type ModelEntry, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, type NumberOffset, Operator, type OperatorFamily, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectLensOptions, type ProjectRowsOptions, type ProjectedVisit, type RelativeUnit, type RelativeUnits, type RollingExpr, type Row, type Rule, type RuleDescription, type RuleScalar, type RuleSourceDescription, RuleTarget, type RuleValue, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceEntry, type SourceOption, SourceOptionOrder, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, SqlDialect, type StepRef, type StoredLens, 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 TimeZoneConfig, type ToPrismaOptions, type ToPrismaResult, type ToSqlOptions, type ToSqlResult, UsageError, VALUE_AGGREGATE_MODES, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, type ValueAggregateMode, type ValueDescription, type ValueExpression, ValueShape, type ValueSourceFields, type ValueSourceOf, type ValueType, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, assertValidValue, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, composeLens, createLens, describeRule, describeRuleSources, describeValue, engineGlobals, evaluateValue, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, inferValueType, lensVisit, listBindings, listFields, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, validateValue, valueClockUnit, walkLensPath };
|
|
1524
|
+
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type AggregateValue, type All, type Any, ArrayOperator, type ArrayRule, type BareLiteral, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, CLOCK_UNITS, type CheckData, type CheckOptions, type ClockUnit, type CompileOptions, type Condition, ConditionShape, type ConditionShapeKeys, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type IfThenElseValue, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type LensWhereSql, type LensWhereSqlOptions, type ListBindingsOptions, type ListValue, type Magnitude, type MaterializeSourceQueryOptions, type ModelDefaultNarrowing, type ModelEntry, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, type NumberOffset, Operator, type OperatorFamily, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectLensOptions, type ProjectRowsOptions, type ProjectedVisit, type RelativeUnit, type RelativeUnits, type RollingExpr, type Row, type Rule, type RuleDescription, type RuleScalar, type RuleSourceDescription, RuleTarget, type RuleValue, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceEntry, type SourceOption, SourceOptionOrder, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, SqlDialect, type StepRef, type StoredLens, 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 TimeZoneConfig, type ToPrismaOptions, type ToPrismaResult, type ToSqlOptions, type ToSqlResult, UsageError, VALUE_AGGREGATE_MODES, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, type ValueAggregateMode, type ValueDescription, type ValueExpression, ValueShape, type ValueSourceFields, type ValueSourceOf, type ValueType, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, assertValidValue, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, coerceValue, composeLens, createLens, describeRule, describeRuleSources, describeValue, engineGlobals, evaluateValue, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, inferValueType, lensVisit, listBindings, listFields, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, validateValue, valueClockUnit, walkLensPath };
|
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;
|
|
@@ -948,7 +951,7 @@ type GroupByStep = {
|
|
|
948
951
|
args: {
|
|
949
952
|
by: string[];
|
|
950
953
|
where: Record<string, unknown>;
|
|
951
|
-
having
|
|
954
|
+
having?: Record<string, unknown>;
|
|
952
955
|
};
|
|
953
956
|
extract: string;
|
|
954
957
|
};
|
|
@@ -1453,6 +1456,13 @@ type ConditionShapeKeys = {
|
|
|
1453
1456
|
/** The keys a node of one shape takes: those it must have and those it may. */
|
|
1454
1457
|
declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKeys;
|
|
1455
1458
|
|
|
1459
|
+
/** Stamp the coercion a value expression's aggregates need from the lens, as `coerceRule` does for
|
|
1460
|
+
* a rule's field rules: a `distinct` / `min` / `max` over a DateTime column gets
|
|
1461
|
+
* `coerceType: 'DateTime'`, so ISO date strings read as dates. An aggregate that already names
|
|
1462
|
+
* its coercion, or that the lens can't type, is left as it is. Non-mutating; throws on a
|
|
1463
|
+
* malformed expression. */
|
|
1464
|
+
declare const coerceValue: (expression: ValueExpression, lensOrNarrowing: Lens | LensNarrowing) => ValueExpression;
|
|
1465
|
+
|
|
1456
1466
|
/** A value expression under a lens: its type, the dotted paths it reads from the row (a relation's
|
|
1457
1467
|
* rows under the relation: `fanMissions.status`), its clock unit, and every problem the
|
|
1458
1468
|
* validator, the lens gate and type inference find. Never throws on a bad expression. */
|
|
@@ -1511,4 +1521,4 @@ declare const valueClockUnit: (expression: ValueExpression) => ClockUnit | null;
|
|
|
1511
1521
|
*/
|
|
1512
1522
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1513
1523
|
|
|
1514
|
-
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type AggregateValue, type All, type Any, ArrayOperator, type ArrayRule, type BareLiteral, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, CLOCK_UNITS, type CheckData, type CheckOptions, type ClockUnit, type CompileOptions, type Condition, ConditionShape, type ConditionShapeKeys, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type IfThenElseValue, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type LensWhereSql, type LensWhereSqlOptions, type ListBindingsOptions, type ListValue, type Magnitude, type MaterializeSourceQueryOptions, type ModelDefaultNarrowing, type ModelEntry, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, type NumberOffset, Operator, type OperatorFamily, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectLensOptions, type ProjectRowsOptions, type ProjectedVisit, type RelativeUnit, type RelativeUnits, type RollingExpr, type Row, type Rule, type RuleDescription, type RuleScalar, type RuleSourceDescription, RuleTarget, type RuleValue, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceEntry, type SourceOption, SourceOptionOrder, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, SqlDialect, type StepRef, type StoredLens, 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 TimeZoneConfig, type ToPrismaOptions, type ToPrismaResult, type ToSqlOptions, type ToSqlResult, UsageError, VALUE_AGGREGATE_MODES, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, type ValueAggregateMode, type ValueDescription, type ValueExpression, ValueShape, type ValueSourceFields, type ValueSourceOf, type ValueType, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, assertValidValue, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, composeLens, createLens, describeRule, describeRuleSources, describeValue, engineGlobals, evaluateValue, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, inferValueType, lensVisit, listBindings, listFields, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, validateValue, valueClockUnit, walkLensPath };
|
|
1524
|
+
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type AggregateValue, type All, type Any, ArrayOperator, type ArrayRule, type BareLiteral, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, CLOCK_UNITS, type CheckData, type CheckOptions, type ClockUnit, type CompileOptions, type Condition, ConditionShape, type ConditionShapeKeys, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type IfThenElseValue, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type LensWhereSql, type LensWhereSqlOptions, type ListBindingsOptions, type ListValue, type Magnitude, type MaterializeSourceQueryOptions, type ModelDefaultNarrowing, type ModelEntry, type ModelNarrowing, NUMERIC_KINDS, type NarrowingDefaults, type NumberOffset, Operator, type OperatorFamily, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectLensOptions, type ProjectRowsOptions, type ProjectedVisit, type RelativeUnit, type RelativeUnits, type RollingExpr, type Row, type Rule, type RuleDescription, type RuleScalar, type RuleSourceDescription, RuleTarget, type RuleValue, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceEntry, type SourceOption, SourceOptionOrder, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, SqlDialect, type StepRef, type StoredLens, 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 TimeZoneConfig, type ToPrismaOptions, type ToPrismaResult, type ToSqlOptions, type ToSqlResult, UsageError, VALUE_AGGREGATE_MODES, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, type ValueAggregateMode, type ValueDescription, type ValueExpression, ValueShape, type ValueSourceFields, type ValueSourceOf, type ValueType, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, assertValidValue, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, coerceValue, composeLens, createLens, describeRule, describeRuleSources, describeValue, engineGlobals, evaluateValue, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, inferValueType, lensVisit, listBindings, listFields, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, validateValue, valueClockUnit, walkLensPath };
|