@inixiative/json-rules 2.9.0 → 2.10.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
@@ -538,10 +538,6 @@ type RuleDescription = {
538
538
  };
539
539
  declare const describeRule: (rule: Condition, lensOrNarrowing: Lens | LensNarrowing) => RuleDescription;
540
540
 
541
- declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing) => Lens;
542
-
543
- declare const validateNarrowing: (narrowing: LensNarrowing) => void;
544
-
545
541
  type ProjectedVisit = {
546
542
  mapName: string;
547
543
  modelName: string;
@@ -551,7 +547,27 @@ type ProjectedVisit = {
551
547
  sources: Record<string, Condition[]>;
552
548
  };
553
549
  type PathProjection = Map<string, ProjectedVisit>;
554
- declare const projectByPath: (lensOrNarrowing: Lens | LensNarrowing) => PathProjection;
550
+ /**
551
+ * The materialized option set for one sourced field — the fetched companion to a
552
+ * serializable lens. Shaped to be exactly what `sourceQueries()` emits plus the
553
+ * fetched `values`, so it feeds both projections: `projectByPath` keys by
554
+ * `path`+`field` (exact), `exposedSurface` by `mapName`+`model`+`field` (union).
555
+ */
556
+ type SourceValues = {
557
+ path: string;
558
+ mapName: string;
559
+ model: string;
560
+ field: string;
561
+ values: readonly string[];
562
+ };
563
+ type ProjectOptions = {
564
+ sourceValues?: readonly SourceValues[];
565
+ };
566
+ declare const projectByPath: (lensOrNarrowing: Lens | LensNarrowing, opts?: ProjectOptions) => PathProjection;
567
+
568
+ declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing, opts?: ProjectOptions) => Lens;
569
+
570
+ declare const validateNarrowing: (narrowing: LensNarrowing) => void;
555
571
 
556
572
  type SourcePrismaQuery = {
557
573
  model: string;
@@ -585,19 +601,6 @@ type SourceQuery = {
585
601
  * its own client) to materialize each field's option set.
586
602
  */
587
603
  declare const sourceQueries: (lensOrNarrowing: Lens | LensNarrowing) => SourceQuery[];
588
- type SourceValues = {
589
- path: string;
590
- field: string;
591
- values: readonly string[];
592
- };
593
- /**
594
- * Decorate fetched DISTINCT values back onto the projected lens. Each result's
595
- * values land on `projection.get(path).fields[field].values` — the existing
596
- * pseudo-enum primitive the builder reads. Per-path, so the same model at two
597
- * paths can carry different option sets. Pure: returns a new projection;
598
- * results for unknown paths or fields are ignored.
599
- */
600
- declare const applySourceValues: (projection: PathProjection, results: readonly SourceValues[]) => PathProjection;
601
604
 
602
605
  /**
603
606
  * Execute a Prisma query plan produced by toPrisma().
@@ -684,4 +687,4 @@ declare const assertValidRule: (condition: unknown, options?: {
684
687
  target?: RuleTarget;
685
688
  }) => asserts condition is Condition;
686
689
 
687
- 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 RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourcePrismaQuery, type SourceQuery, type SourceSqlQuery, type SourceValues, 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, applySourceValues, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, sourceQueries, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
690
+ 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 ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourcePrismaQuery, type SourceQuery, type SourceSqlQuery, type SourceValues, 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, describeRule, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, sourceQueries, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
package/dist/index.d.ts CHANGED
@@ -538,10 +538,6 @@ type RuleDescription = {
538
538
  };
539
539
  declare const describeRule: (rule: Condition, lensOrNarrowing: Lens | LensNarrowing) => RuleDescription;
540
540
 
541
- declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing) => Lens;
542
-
543
- declare const validateNarrowing: (narrowing: LensNarrowing) => void;
544
-
545
541
  type ProjectedVisit = {
546
542
  mapName: string;
547
543
  modelName: string;
@@ -551,7 +547,27 @@ type ProjectedVisit = {
551
547
  sources: Record<string, Condition[]>;
552
548
  };
553
549
  type PathProjection = Map<string, ProjectedVisit>;
554
- declare const projectByPath: (lensOrNarrowing: Lens | LensNarrowing) => PathProjection;
550
+ /**
551
+ * The materialized option set for one sourced field — the fetched companion to a
552
+ * serializable lens. Shaped to be exactly what `sourceQueries()` emits plus the
553
+ * fetched `values`, so it feeds both projections: `projectByPath` keys by
554
+ * `path`+`field` (exact), `exposedSurface` by `mapName`+`model`+`field` (union).
555
+ */
556
+ type SourceValues = {
557
+ path: string;
558
+ mapName: string;
559
+ model: string;
560
+ field: string;
561
+ values: readonly string[];
562
+ };
563
+ type ProjectOptions = {
564
+ sourceValues?: readonly SourceValues[];
565
+ };
566
+ declare const projectByPath: (lensOrNarrowing: Lens | LensNarrowing, opts?: ProjectOptions) => PathProjection;
567
+
568
+ declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing, opts?: ProjectOptions) => Lens;
569
+
570
+ declare const validateNarrowing: (narrowing: LensNarrowing) => void;
555
571
 
556
572
  type SourcePrismaQuery = {
557
573
  model: string;
@@ -585,19 +601,6 @@ type SourceQuery = {
585
601
  * its own client) to materialize each field's option set.
586
602
  */
587
603
  declare const sourceQueries: (lensOrNarrowing: Lens | LensNarrowing) => SourceQuery[];
588
- type SourceValues = {
589
- path: string;
590
- field: string;
591
- values: readonly string[];
592
- };
593
- /**
594
- * Decorate fetched DISTINCT values back onto the projected lens. Each result's
595
- * values land on `projection.get(path).fields[field].values` — the existing
596
- * pseudo-enum primitive the builder reads. Per-path, so the same model at two
597
- * paths can carry different option sets. Pure: returns a new projection;
598
- * results for unknown paths or fields are ignored.
599
- */
600
- declare const applySourceValues: (projection: PathProjection, results: readonly SourceValues[]) => PathProjection;
601
604
 
602
605
  /**
603
606
  * Execute a Prisma query plan produced by toPrisma().
@@ -684,4 +687,4 @@ declare const assertValidRule: (condition: unknown, options?: {
684
687
  target?: RuleTarget;
685
688
  }) => asserts condition is Condition;
686
689
 
687
- 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 RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourcePrismaQuery, type SourceQuery, type SourceSqlQuery, type SourceValues, 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, applySourceValues, assertValidRule, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, sourceQueries, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
690
+ 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 ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourcePrismaQuery, type SourceQuery, type SourceSqlQuery, type SourceValues, 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, describeRule, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, projectByPath, sourceQueries, stitchFieldMaps, toPrisma, toSql, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };