@inixiative/json-rules 2.24.0 → 2.26.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.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -675,6 +675,31 @@ declare const resolveLensBindings: (lensOrNarrowing: Lens | LensNarrowing, bindi
|
|
|
675
675
|
*/
|
|
676
676
|
declare const validateBindNames: (narrowing: LensNarrowing) => string[];
|
|
677
677
|
|
|
678
|
+
type LensPathHop = {
|
|
679
|
+
field: string;
|
|
680
|
+
entry: FieldMapEntry;
|
|
681
|
+
mapName: string;
|
|
682
|
+
modelName: string;
|
|
683
|
+
/** The relation path from the lens anchor to the model this hop reads. */
|
|
684
|
+
relPath: string[];
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* Where a dotted path lands through the lens, hop by hop. `hidden` is a field the model has but
|
|
688
|
+
* the narrowing does not expose at this visit; `missing` is a field the model does not have (or a
|
|
689
|
+
* model the map does not have); `pastScalar` is a segment after a scalar. A path that continues
|
|
690
|
+
* below a Json column resolves at the column with the remainder in `jsonSubPath`.
|
|
691
|
+
*/
|
|
692
|
+
type LensPathResolution = {
|
|
693
|
+
outcome: 'resolved';
|
|
694
|
+
hops: LensPathHop[];
|
|
695
|
+
terminal: LensPathHop;
|
|
696
|
+
jsonSubPath: string[];
|
|
697
|
+
} | {
|
|
698
|
+
outcome: 'hidden' | 'missing' | 'pastScalar';
|
|
699
|
+
index: number;
|
|
700
|
+
hops: LensPathHop[];
|
|
701
|
+
};
|
|
702
|
+
|
|
678
703
|
type RuleLensViolation = {
|
|
679
704
|
path: string;
|
|
680
705
|
reason: string;
|
|
@@ -737,6 +762,15 @@ declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing, opts?: Pro
|
|
|
737
762
|
|
|
738
763
|
declare const validateNarrowing: (narrowing: LensNarrowing) => void;
|
|
739
764
|
|
|
765
|
+
/**
|
|
766
|
+
* Resolve one dotted path through a lens, hop by hop, verifying as it walks: every hop is checked
|
|
767
|
+
* against the narrowing at that visit, so a relation the narrowing dropped is `hidden`, a column the
|
|
768
|
+
* model lacks is `missing`, and a segment past a scalar is `pastScalar`. This is the walk
|
|
769
|
+
* `checkRuleAgainstLens` gates a rule's field with, exposed for consumers that resolve paths of their
|
|
770
|
+
* own (template tokens, loop bindings, presence guards).
|
|
771
|
+
*/
|
|
772
|
+
declare const resolveLensPath: (lensOrNarrowing: Lens | LensNarrowing, path: string) => LensPathResolution;
|
|
773
|
+
|
|
740
774
|
/**
|
|
741
775
|
* The values one rule compares at one declared source — keyed the way `projectByPath`
|
|
742
776
|
* keys a source (`path` + `field`), so the caller can join it back to the source's
|
|
@@ -955,4 +989,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
955
989
|
target?: RuleTarget;
|
|
956
990
|
}) => asserts condition is Condition;
|
|
957
991
|
|
|
958
|
-
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 EngineGlobalsState, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NULLABLE_KINDS, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, type RuleSourceValues, RuleTarget, type RuleValue, STRINGY_KINDS, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSpec, type SourceSqlQuery, type SourceValue, 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 TimeZoneConfig, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, bindingNames, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, parseScopeRef, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, resolveScopeRef, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
992
|
+
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 EngineGlobalsState, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type LensPathHop, type LensPathResolution, type ModelDefaultNarrowing, type ModelNarrowing, NULLABLE_KINDS, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, type RuleSourceValues, RuleTarget, type RuleValue, STRINGY_KINDS, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSpec, type SourceSqlQuery, type SourceValue, 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 TimeZoneConfig, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, bindingNames, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, parseScopeRef, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, resolveLensPath, resolveScopeRef, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -675,6 +675,31 @@ declare const resolveLensBindings: (lensOrNarrowing: Lens | LensNarrowing, bindi
|
|
|
675
675
|
*/
|
|
676
676
|
declare const validateBindNames: (narrowing: LensNarrowing) => string[];
|
|
677
677
|
|
|
678
|
+
type LensPathHop = {
|
|
679
|
+
field: string;
|
|
680
|
+
entry: FieldMapEntry;
|
|
681
|
+
mapName: string;
|
|
682
|
+
modelName: string;
|
|
683
|
+
/** The relation path from the lens anchor to the model this hop reads. */
|
|
684
|
+
relPath: string[];
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* Where a dotted path lands through the lens, hop by hop. `hidden` is a field the model has but
|
|
688
|
+
* the narrowing does not expose at this visit; `missing` is a field the model does not have (or a
|
|
689
|
+
* model the map does not have); `pastScalar` is a segment after a scalar. A path that continues
|
|
690
|
+
* below a Json column resolves at the column with the remainder in `jsonSubPath`.
|
|
691
|
+
*/
|
|
692
|
+
type LensPathResolution = {
|
|
693
|
+
outcome: 'resolved';
|
|
694
|
+
hops: LensPathHop[];
|
|
695
|
+
terminal: LensPathHop;
|
|
696
|
+
jsonSubPath: string[];
|
|
697
|
+
} | {
|
|
698
|
+
outcome: 'hidden' | 'missing' | 'pastScalar';
|
|
699
|
+
index: number;
|
|
700
|
+
hops: LensPathHop[];
|
|
701
|
+
};
|
|
702
|
+
|
|
678
703
|
type RuleLensViolation = {
|
|
679
704
|
path: string;
|
|
680
705
|
reason: string;
|
|
@@ -737,6 +762,15 @@ declare const exposedSurface: (lensOrNarrowing: Lens | LensNarrowing, opts?: Pro
|
|
|
737
762
|
|
|
738
763
|
declare const validateNarrowing: (narrowing: LensNarrowing) => void;
|
|
739
764
|
|
|
765
|
+
/**
|
|
766
|
+
* Resolve one dotted path through a lens, hop by hop, verifying as it walks: every hop is checked
|
|
767
|
+
* against the narrowing at that visit, so a relation the narrowing dropped is `hidden`, a column the
|
|
768
|
+
* model lacks is `missing`, and a segment past a scalar is `pastScalar`. This is the walk
|
|
769
|
+
* `checkRuleAgainstLens` gates a rule's field with, exposed for consumers that resolve paths of their
|
|
770
|
+
* own (template tokens, loop bindings, presence guards).
|
|
771
|
+
*/
|
|
772
|
+
declare const resolveLensPath: (lensOrNarrowing: Lens | LensNarrowing, path: string) => LensPathResolution;
|
|
773
|
+
|
|
740
774
|
/**
|
|
741
775
|
* The values one rule compares at one declared source — keyed the way `projectByPath`
|
|
742
776
|
* keys a source (`path` + `field`), so the caller can join it back to the source's
|
|
@@ -955,4 +989,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
955
989
|
target?: RuleTarget;
|
|
956
990
|
}) => asserts condition is Condition;
|
|
957
991
|
|
|
958
|
-
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 EngineGlobalsState, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type ModelDefaultNarrowing, type ModelNarrowing, NULLABLE_KINDS, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, type RuleSourceValues, RuleTarget, type RuleValue, STRINGY_KINDS, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSpec, type SourceSqlQuery, type SourceValue, 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 TimeZoneConfig, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, bindingNames, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, parseScopeRef, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, resolveScopeRef, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
992
|
+
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 EngineGlobalsState, type EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, type FuzzyConfig, type GroupByStep, type IfThenElse, type Lens, type LensNarrowing, type LensPathHop, type LensPathResolution, type ModelDefaultNarrowing, type ModelNarrowing, NULLABLE_KINDS, NUMERIC_KINDS, type NarrowingDefaults, ORDERABLE_KINDS, Operator, type OrderBy, type OrderedRuleValue, type PathProjection, type PeriodExpr, type PeriodUnit, type PrismaProvider, type PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, type RuleSourceValues, RuleTarget, type RuleValue, STRINGY_KINDS, type ScopeOutOfBounds, type ScopeRef, type ScopedRef, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, type SourceRowShape, type SourceSpec, type SourceSqlQuery, type SourceValue, 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 TimeZoneConfig, type ToPrismaResult, type ValidationIssue, type ValidationResult, ValueShape, WINDOW_SELECTOR, type WeekStart, type WhereStep, type WindowFields, type WindowRuleType, WindowSupport, applyLens, assertValidRule, bindingNames, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, parseScopeRef, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, resolveLensPath, resolveScopeRef, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|