@inixiative/json-rules 3.22.0 → 4.0.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
@@ -686,6 +686,9 @@ type ScopeOutOfBounds = {
686
686
  * ref and `$.` read the innermost, `$$.` the one above it, … A ref deeper than the stack comes
687
687
  * back as `{ outOfBounds }` with its message; it never throws. */
688
688
  declare const readScopeRef: <S>(ref: string, scopes: readonly S[]) => ScopedRef<S> | ScopeOutOfBounds;
689
+ /** The keys a path reads, in order, as `check()` reads them: dotted names, bracket indices and
690
+ * quoted keys (`ids[1]` → `['ids', '1']`, `meta["a.b"]` → `['meta', 'a.b']`). `''` is `['']`. */
691
+ declare const pathSegments: (path: string) => string[];
689
692
 
690
693
  /** `bindings`: the caller's values, read by `{ bind }`. The rest is the clock and zone. */
691
694
  type CheckOptions = {
@@ -917,10 +920,10 @@ type RuleSourceDescription = {
917
920
  /**
918
921
  * Which values a rule names at each source the lens declares — the lens owns the
919
922
  * vocabulary, so it answers questions about it; callers never spell a path. A leaf reaches a
920
- * source by its absolute path through the lens: nested (`{ field: 'orders', arrayOperator,
921
- * condition: { field: 'sku' } }`) and dotted (`{ field: 'orders.sku' }`) spellings are one path,
922
- * resolved by `lensPathEnd` — declared relations, visibility, `mapDefaults`, and the Json boundary
923
- * all apply, so a source declared in `mapDefaults` answers wherever a declared path reaches its model. Quantifier-blind on
923
+ * source walked as the gate walks it (`stepIntoField`, scope by scope): `{ field: 'orders',
924
+ * arrayOperator, condition: { field: 'sku' } }` reaches `orders.sku`, and a plain path the gate
925
+ * refuses (one continuing past a to-many relation, `{ field: 'orders.sku' }`) is silent. Declared
926
+ * relations, visibility, `mapDefaults`, and the Json boundary all apply, so a source declared in `mapDefaults` answers wherever a declared path reaches its model. Quantifier-blind on
924
927
  * purpose — a `none` relation names its value as much as an `any` one, `notIn` as much as `in` —
925
928
  * but shape-aware via the operator catalog: only literal-naming shapes contribute `values`;
926
929
  * substring / pattern / range / window operators, and operators the catalog does not know, mark
@@ -1523,4 +1526,4 @@ declare const valueClockUnit: (expression: ValueExpression) => ClockUnit | null;
1523
1526
  */
1524
1527
  declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
1525
1528
 
1526
- 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 };
1529
+ 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, pathSegments, 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
@@ -686,6 +686,9 @@ type ScopeOutOfBounds = {
686
686
  * ref and `$.` read the innermost, `$$.` the one above it, … A ref deeper than the stack comes
687
687
  * back as `{ outOfBounds }` with its message; it never throws. */
688
688
  declare const readScopeRef: <S>(ref: string, scopes: readonly S[]) => ScopedRef<S> | ScopeOutOfBounds;
689
+ /** The keys a path reads, in order, as `check()` reads them: dotted names, bracket indices and
690
+ * quoted keys (`ids[1]` → `['ids', '1']`, `meta["a.b"]` → `['meta', 'a.b']`). `''` is `['']`. */
691
+ declare const pathSegments: (path: string) => string[];
689
692
 
690
693
  /** `bindings`: the caller's values, read by `{ bind }`. The rest is the clock and zone. */
691
694
  type CheckOptions = {
@@ -917,10 +920,10 @@ type RuleSourceDescription = {
917
920
  /**
918
921
  * Which values a rule names at each source the lens declares — the lens owns the
919
922
  * vocabulary, so it answers questions about it; callers never spell a path. A leaf reaches a
920
- * source by its absolute path through the lens: nested (`{ field: 'orders', arrayOperator,
921
- * condition: { field: 'sku' } }`) and dotted (`{ field: 'orders.sku' }`) spellings are one path,
922
- * resolved by `lensPathEnd` — declared relations, visibility, `mapDefaults`, and the Json boundary
923
- * all apply, so a source declared in `mapDefaults` answers wherever a declared path reaches its model. Quantifier-blind on
923
+ * source walked as the gate walks it (`stepIntoField`, scope by scope): `{ field: 'orders',
924
+ * arrayOperator, condition: { field: 'sku' } }` reaches `orders.sku`, and a plain path the gate
925
+ * refuses (one continuing past a to-many relation, `{ field: 'orders.sku' }`) is silent. Declared
926
+ * relations, visibility, `mapDefaults`, and the Json boundary all apply, so a source declared in `mapDefaults` answers wherever a declared path reaches its model. Quantifier-blind on
924
927
  * purpose — a `none` relation names its value as much as an `any` one, `notIn` as much as `in` —
925
928
  * but shape-aware via the operator catalog: only literal-naming shapes contribute `values`;
926
929
  * substring / pattern / range / window operators, and operators the catalog does not know, mark
@@ -1523,4 +1526,4 @@ declare const valueClockUnit: (expression: ValueExpression) => ClockUnit | null;
1523
1526
  */
1524
1527
  declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
1525
1528
 
1526
- 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 };
1529
+ 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, pathSegments, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, validateValue, valueClockUnit, walkLensPath };