@inixiative/json-rules 3.5.1 → 3.5.2

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
@@ -1116,6 +1116,38 @@ declare const readScopeRef: <S>(ref: string, scopes: readonly S[]) => ScopedRef<
1116
1116
  */
1117
1117
  declare const executePrismaPlan: (plan: ToPrismaResult, prismaDelegate: Record<string, object>) => Promise<Record<string, unknown>>;
1118
1118
 
1119
+ /**
1120
+ * The two boolean constants and how Prisma reads them.
1121
+ *
1122
+ * `{}` is match-all only where Prisma treats an empty filter as "no constraint": the top
1123
+ * level, an AND arm, a relation filter (`some: {}`). Inside an OR Prisma DROPS it — `OR: [x, {}]`
1124
+ * is just `x` — and `NOT: {}` is not the negation of true. `{ OR: [] }` is the documented
1125
+ * match-nothing, and it holds at the top level, as an OR arm, under NOT and inside a relation
1126
+ * filter — but NOT as an arm of an AND list: Prisma drops it there and `AND: [x, { OR: [] }]`
1127
+ * is just `x` (measured on Prisma 7 + Postgres and Prisma 6 + MySQL).
1128
+ *
1129
+ * So the logical builders never nest a constant under OR or NOT; they fold it instead:
1130
+ * a `true` arm absorbs an OR, a `false` arm absorbs an AND, either drops out of the other,
1131
+ * and NOT of a constant is the other constant. The fold runs on compiled output, so it also
1132
+ * covers constants that arrive indirectly — `all: []`, `any: []`, `atLeast 0`, and the bridge
1133
+ * over-fetch sentinel (a bridge under `any` now over-fetches the disjunction instead of being
1134
+ * dropped by Prisma and under-fetching).
1135
+ *
1136
+ * Every arm is compiled exactly once, in order, BEFORE folding. Count operators push a
1137
+ * groupBy step into `state` as they compile, so an arm that then folds away leaves its step
1138
+ * behind — harmless (an unreferenced step is executed and ignored) and necessary: step refs
1139
+ * are positional, so nothing may be rebuilt or renumbered.
1140
+ */
1141
+ /** A consumer composing a compiled where with its own filters (a scope, a floor, a clamp) goes
1142
+ * through andWhere / orWhere, never a hand-written `AND: [...]` — the same fold, so a compiled
1143
+ * `false` still matches nothing. */
1144
+ declare const matchAll: () => PrismaWhere;
1145
+ declare const matchNothing: () => PrismaWhere;
1146
+ /** AND of arms: match-nothing absorbs, match-all drops, one arm stands alone. */
1147
+ declare const andWhere: (arms: PrismaWhere[]) => PrismaWhere;
1148
+ /** OR of arms: match-all absorbs, match-nothing drops, one arm stands alone. */
1149
+ declare const orWhere: (arms: PrismaWhere[]) => PrismaWhere;
1150
+
1119
1151
  /**
1120
1152
  * Compile a condition to a Prisma query plan: `steps`, any groupBy steps (counts and relation
1121
1153
  * aggregates, which need `{ map, model }` or `{ lens }`) and then the final `where`. With `lens`,
@@ -1158,4 +1190,4 @@ declare const toSql: (rule: Condition, compileOptions?: ToSqlOptions) => ToSqlRe
1158
1190
  */
1159
1191
  declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
1160
1192
 
1161
- export { ALL_KINDS, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type CheckData, type CheckOptions, type CompileOptions, type Condition, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type ListBindingsOptions, 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 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, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, orderRecords, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
1193
+ export { ALL_KINDS, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type CheckData, type CheckOptions, type CompileOptions, type Condition, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type ListBindingsOptions, 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 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, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
package/dist/index.d.ts CHANGED
@@ -1116,6 +1116,38 @@ declare const readScopeRef: <S>(ref: string, scopes: readonly S[]) => ScopedRef<
1116
1116
  */
1117
1117
  declare const executePrismaPlan: (plan: ToPrismaResult, prismaDelegate: Record<string, object>) => Promise<Record<string, unknown>>;
1118
1118
 
1119
+ /**
1120
+ * The two boolean constants and how Prisma reads them.
1121
+ *
1122
+ * `{}` is match-all only where Prisma treats an empty filter as "no constraint": the top
1123
+ * level, an AND arm, a relation filter (`some: {}`). Inside an OR Prisma DROPS it — `OR: [x, {}]`
1124
+ * is just `x` — and `NOT: {}` is not the negation of true. `{ OR: [] }` is the documented
1125
+ * match-nothing, and it holds at the top level, as an OR arm, under NOT and inside a relation
1126
+ * filter — but NOT as an arm of an AND list: Prisma drops it there and `AND: [x, { OR: [] }]`
1127
+ * is just `x` (measured on Prisma 7 + Postgres and Prisma 6 + MySQL).
1128
+ *
1129
+ * So the logical builders never nest a constant under OR or NOT; they fold it instead:
1130
+ * a `true` arm absorbs an OR, a `false` arm absorbs an AND, either drops out of the other,
1131
+ * and NOT of a constant is the other constant. The fold runs on compiled output, so it also
1132
+ * covers constants that arrive indirectly — `all: []`, `any: []`, `atLeast 0`, and the bridge
1133
+ * over-fetch sentinel (a bridge under `any` now over-fetches the disjunction instead of being
1134
+ * dropped by Prisma and under-fetching).
1135
+ *
1136
+ * Every arm is compiled exactly once, in order, BEFORE folding. Count operators push a
1137
+ * groupBy step into `state` as they compile, so an arm that then folds away leaves its step
1138
+ * behind — harmless (an unreferenced step is executed and ignored) and necessary: step refs
1139
+ * are positional, so nothing may be rebuilt or renumbered.
1140
+ */
1141
+ /** A consumer composing a compiled where with its own filters (a scope, a floor, a clamp) goes
1142
+ * through andWhere / orWhere, never a hand-written `AND: [...]` — the same fold, so a compiled
1143
+ * `false` still matches nothing. */
1144
+ declare const matchAll: () => PrismaWhere;
1145
+ declare const matchNothing: () => PrismaWhere;
1146
+ /** AND of arms: match-nothing absorbs, match-all drops, one arm stands alone. */
1147
+ declare const andWhere: (arms: PrismaWhere[]) => PrismaWhere;
1148
+ /** OR of arms: match-all absorbs, match-nothing drops, one arm stands alone. */
1149
+ declare const orWhere: (arms: PrismaWhere[]) => PrismaWhere;
1150
+
1119
1151
  /**
1120
1152
  * Compile a condition to a Prisma query plan: `steps`, any groupBy steps (counts and relation
1121
1153
  * aggregates, which need `{ map, model }` or `{ lens }`) and then the final `where`. With `lens`,
@@ -1158,4 +1190,4 @@ declare const toSql: (rule: Condition, compileOptions?: ToSqlOptions) => ToSqlRe
1158
1190
  */
1159
1191
  declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
1160
1192
 
1161
- export { ALL_KINDS, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type CheckData, type CheckOptions, type CompileOptions, type Condition, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type ListBindingsOptions, 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 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, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, orderRecords, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
1193
+ export { ALL_KINDS, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, type Bridge, type BridgeCardinality, type BridgeDictionary, type BridgeEndpoint, type CheckData, type CheckOptions, type CompileOptions, type Condition, type DateConfig, type DateExpr, type DateInputOrExpr, type DateInputValue, type DateOffset, DateOperator, type DateRule, type DateRuleValue, type EdgeExpr, type EngineGlobalsState, type EnumNarrowing, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensClamps, type LensNarrowing, type LensPathHop, type LensPathResolution, LensRefusal, type LensRelationSelect, type LensSelect, type LensSelectOptions, type LensValue, type ListBindingsOptions, 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 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, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSelect, type SourceSpec, type SourceSqlQuery, type SourceValues, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };