@inixiative/json-rules 3.2.0 → 3.3.1
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 +4 -3
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
package/dist/index.d.cts
CHANGED
|
@@ -933,6 +933,23 @@ declare function projectLens(lensOrNarrowing: Lens | LensNarrowing, options: Pro
|
|
|
933
933
|
by: 'model';
|
|
934
934
|
}): Lens;
|
|
935
935
|
|
|
936
|
+
/** A value read through a lens, or why the lens refuses the path. */
|
|
937
|
+
type LensValue = {
|
|
938
|
+
ok: true;
|
|
939
|
+
value: unknown;
|
|
940
|
+
} | {
|
|
941
|
+
ok: false;
|
|
942
|
+
reason: 'hidden' | 'missing' | 'pastScalar' | 'relation' | 'list';
|
|
943
|
+
};
|
|
944
|
+
/**
|
|
945
|
+
* One value off a row, as the lens shows it: the path walked as `validateRuleInLens` walks a
|
|
946
|
+
* field (a hidden, missing or past-scalar segment is refused), each related row checked against
|
|
947
|
+
* its visit's grants, the row itself included (a row a grant hides, or a missing one, reads `null`), and only the row's own
|
|
948
|
+
* properties read, into a Json column too. A path ending on a relation, or crossing a list, names
|
|
949
|
+
* rows rather than a value and is refused. `options` is what each grant is checked with.
|
|
950
|
+
*/
|
|
951
|
+
declare const readLensValue: (lensOrNarrowing: Lens | LensNarrowing, row: Row, path: string, options?: CheckOptions) => LensValue;
|
|
952
|
+
|
|
936
953
|
/**
|
|
937
954
|
* A lens as stored, one record per layer: its `id`, the ids of every layer it composes with —
|
|
938
955
|
* the base lens first, the nearest parent last — and its own part. The base lens is the
|
|
@@ -1018,7 +1035,7 @@ declare const executePrismaPlan: (plan: ToPrismaResult, prismaDelegate: Record<s
|
|
|
1018
1035
|
* const where = await executePrismaPlan(plan, prisma);
|
|
1019
1036
|
* await prisma.user.findMany({ where });
|
|
1020
1037
|
*
|
|
1021
|
-
* toPrisma(rule, { lens: narrowing, now }); //
|
|
1038
|
+
* toPrisma(rule, { lens: narrowing, now }); // gated, narrowed (a bare value path read as context), compiled against the base lens
|
|
1022
1039
|
* ```
|
|
1023
1040
|
*/
|
|
1024
1041
|
declare const toPrisma: (rule: Condition, compileOptions?: ToPrismaOptions) => ToPrismaResult;
|
|
@@ -1037,4 +1054,4 @@ type ToSqlOptions = CompileOptions & {
|
|
|
1037
1054
|
* base lens. */
|
|
1038
1055
|
declare const toSql: (rule: Condition, compileOptions?: ToSqlOptions) => ToSqlResult;
|
|
1039
1056
|
|
|
1040
|
-
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 LensNarrowing, type LensPathHop, type LensPathResolution, type LensRelationSelect, type LensSelect, type LensSelectOptions, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, parseScopeRef, projectLens, projectRows, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
|
1057
|
+
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 LensNarrowing, type LensPathHop, type LensPathResolution, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -933,6 +933,23 @@ declare function projectLens(lensOrNarrowing: Lens | LensNarrowing, options: Pro
|
|
|
933
933
|
by: 'model';
|
|
934
934
|
}): Lens;
|
|
935
935
|
|
|
936
|
+
/** A value read through a lens, or why the lens refuses the path. */
|
|
937
|
+
type LensValue = {
|
|
938
|
+
ok: true;
|
|
939
|
+
value: unknown;
|
|
940
|
+
} | {
|
|
941
|
+
ok: false;
|
|
942
|
+
reason: 'hidden' | 'missing' | 'pastScalar' | 'relation' | 'list';
|
|
943
|
+
};
|
|
944
|
+
/**
|
|
945
|
+
* One value off a row, as the lens shows it: the path walked as `validateRuleInLens` walks a
|
|
946
|
+
* field (a hidden, missing or past-scalar segment is refused), each related row checked against
|
|
947
|
+
* its visit's grants, the row itself included (a row a grant hides, or a missing one, reads `null`), and only the row's own
|
|
948
|
+
* properties read, into a Json column too. A path ending on a relation, or crossing a list, names
|
|
949
|
+
* rows rather than a value and is refused. `options` is what each grant is checked with.
|
|
950
|
+
*/
|
|
951
|
+
declare const readLensValue: (lensOrNarrowing: Lens | LensNarrowing, row: Row, path: string, options?: CheckOptions) => LensValue;
|
|
952
|
+
|
|
936
953
|
/**
|
|
937
954
|
* A lens as stored, one record per layer: its `id`, the ids of every layer it composes with —
|
|
938
955
|
* the base lens first, the nearest parent last — and its own part. The base lens is the
|
|
@@ -1018,7 +1035,7 @@ declare const executePrismaPlan: (plan: ToPrismaResult, prismaDelegate: Record<s
|
|
|
1018
1035
|
* const where = await executePrismaPlan(plan, prisma);
|
|
1019
1036
|
* await prisma.user.findMany({ where });
|
|
1020
1037
|
*
|
|
1021
|
-
* toPrisma(rule, { lens: narrowing, now }); //
|
|
1038
|
+
* toPrisma(rule, { lens: narrowing, now }); // gated, narrowed (a bare value path read as context), compiled against the base lens
|
|
1022
1039
|
* ```
|
|
1023
1040
|
*/
|
|
1024
1041
|
declare const toPrisma: (rule: Condition, compileOptions?: ToPrismaOptions) => ToPrismaResult;
|
|
@@ -1037,4 +1054,4 @@ type ToSqlOptions = CompileOptions & {
|
|
|
1037
1054
|
* base lens. */
|
|
1038
1055
|
declare const toSql: (rule: Condition, compileOptions?: ToSqlOptions) => ToSqlResult;
|
|
1039
1056
|
|
|
1040
|
-
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 LensNarrowing, type LensPathHop, type LensPathResolution, type LensRelationSelect, type LensSelect, type LensSelectOptions, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, parseScopeRef, projectLens, projectRows, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
|
1057
|
+
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 LensNarrowing, type LensPathHop, type LensPathResolution, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereStep, type WindowFields, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, listBindings, listLensBindings, materializeSourceQuery, materializeSources, narrowRule, parseScopeRef, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toPrisma, toSourceQueries, toSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|