@inixiative/json-rules 3.12.2 → 3.14.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/README.md +3 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -300,6 +300,9 @@ declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
|
300
300
|
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
301
301
|
/** The comparisons an aggregate rule takes; every target compiles all of them. */
|
|
302
302
|
declare const getAggregateOperators: () => readonly Operator[];
|
|
303
|
+
/** The steps a clock-relative date moves by, finest first. */
|
|
304
|
+
declare const CLOCK_UNITS: readonly ["second", "minute", "hour", "day", "week", "month", "quarter", "year"];
|
|
305
|
+
type ClockUnit = (typeof CLOCK_UNITS)[number];
|
|
303
306
|
|
|
304
307
|
type OperatorValues = typeof Operator;
|
|
305
308
|
type ArrayOperatorValues = typeof ArrayOperator;
|
|
@@ -559,6 +562,16 @@ type CheckOptions = {
|
|
|
559
562
|
* structurally invalid rule or malformed data. */
|
|
560
563
|
declare const check: <TData extends CheckData>(conditions: Condition, data: TData, options?: CheckOptions) => boolean | string;
|
|
561
564
|
|
|
565
|
+
/**
|
|
566
|
+
* The finest clock unit a rule's answer can change by while its data stays the same: the smallest
|
|
567
|
+
* unit any relative date in the tree names (`{ ago: { hours: 2 } }` → `hour`, `{ this: 'week' }`
|
|
568
|
+
* → `week`), at any depth. Null when the rule reads no clock: absolute dates, column compares and
|
|
569
|
+
* their offsets, weekday lists. A bound value (`{ bind }`) is read as written, not as what a
|
|
570
|
+
* binding may supply. Throws on a unit finer than the engine's `clock.finestUnit`, as evaluating
|
|
571
|
+
* the rule does.
|
|
572
|
+
*/
|
|
573
|
+
declare const clockUnit: (condition: Condition) => ClockUnit | null;
|
|
574
|
+
|
|
562
575
|
type PrismaProvider = 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'cockroachdb' | 'mongodb';
|
|
563
576
|
/** The SQL dialects the engine writes. `toSql` writes PostgreSQL; `toWhereSql` writes the
|
|
564
577
|
* engine's `sql.dialect`. */
|
|
@@ -584,12 +597,17 @@ type EngineGlobalsState = {
|
|
|
584
597
|
/** The dialect SQL-writing functions that take one emit (`toWhereSql`, `toLensWhereSql`). */
|
|
585
598
|
dialect: SqlDialect;
|
|
586
599
|
};
|
|
600
|
+
clock: {
|
|
601
|
+
/** The finest clock unit a rule may read: a rule naming a finer one fails to evaluate. */
|
|
602
|
+
finestUnit: ClockUnit;
|
|
603
|
+
};
|
|
587
604
|
};
|
|
588
605
|
type DeepPartial<T> = {
|
|
589
606
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
590
607
|
};
|
|
591
608
|
/** Process-wide defaults, read and written by dotted path (`string.caseInsensitive`,
|
|
592
|
-
* `string.fuzzy`, `prismaOptions.datasource.provider`, `prismaOptions.anyNull`, `sql.dialect
|
|
609
|
+
* `string.fuzzy`, `prismaOptions.datasource.provider`, `prismaOptions.anyNull`, `sql.dialect`,
|
|
610
|
+
* `clock.finestUnit`). */
|
|
593
611
|
declare const engineGlobals: {
|
|
594
612
|
set: (path: string, value: unknown) => void;
|
|
595
613
|
get: (path: string) => unknown;
|
|
@@ -1288,4 +1306,4 @@ declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKe
|
|
|
1288
1306
|
*/
|
|
1289
1307
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1290
1308
|
|
|
1291
|
-
export { ALL_KINDS, type Absent, 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, ConditionShape, type ConditionShapeKeys, 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 LensWhereSql, type LensWhereSqlOptions, 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, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
|
1309
|
+
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, 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 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 LensWhereSql, type LensWhereSqlOptions, 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, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -300,6 +300,9 @@ declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
|
300
300
|
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
301
301
|
/** The comparisons an aggregate rule takes; every target compiles all of them. */
|
|
302
302
|
declare const getAggregateOperators: () => readonly Operator[];
|
|
303
|
+
/** The steps a clock-relative date moves by, finest first. */
|
|
304
|
+
declare const CLOCK_UNITS: readonly ["second", "minute", "hour", "day", "week", "month", "quarter", "year"];
|
|
305
|
+
type ClockUnit = (typeof CLOCK_UNITS)[number];
|
|
303
306
|
|
|
304
307
|
type OperatorValues = typeof Operator;
|
|
305
308
|
type ArrayOperatorValues = typeof ArrayOperator;
|
|
@@ -559,6 +562,16 @@ type CheckOptions = {
|
|
|
559
562
|
* structurally invalid rule or malformed data. */
|
|
560
563
|
declare const check: <TData extends CheckData>(conditions: Condition, data: TData, options?: CheckOptions) => boolean | string;
|
|
561
564
|
|
|
565
|
+
/**
|
|
566
|
+
* The finest clock unit a rule's answer can change by while its data stays the same: the smallest
|
|
567
|
+
* unit any relative date in the tree names (`{ ago: { hours: 2 } }` → `hour`, `{ this: 'week' }`
|
|
568
|
+
* → `week`), at any depth. Null when the rule reads no clock: absolute dates, column compares and
|
|
569
|
+
* their offsets, weekday lists. A bound value (`{ bind }`) is read as written, not as what a
|
|
570
|
+
* binding may supply. Throws on a unit finer than the engine's `clock.finestUnit`, as evaluating
|
|
571
|
+
* the rule does.
|
|
572
|
+
*/
|
|
573
|
+
declare const clockUnit: (condition: Condition) => ClockUnit | null;
|
|
574
|
+
|
|
562
575
|
type PrismaProvider = 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'cockroachdb' | 'mongodb';
|
|
563
576
|
/** The SQL dialects the engine writes. `toSql` writes PostgreSQL; `toWhereSql` writes the
|
|
564
577
|
* engine's `sql.dialect`. */
|
|
@@ -584,12 +597,17 @@ type EngineGlobalsState = {
|
|
|
584
597
|
/** The dialect SQL-writing functions that take one emit (`toWhereSql`, `toLensWhereSql`). */
|
|
585
598
|
dialect: SqlDialect;
|
|
586
599
|
};
|
|
600
|
+
clock: {
|
|
601
|
+
/** The finest clock unit a rule may read: a rule naming a finer one fails to evaluate. */
|
|
602
|
+
finestUnit: ClockUnit;
|
|
603
|
+
};
|
|
587
604
|
};
|
|
588
605
|
type DeepPartial<T> = {
|
|
589
606
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
590
607
|
};
|
|
591
608
|
/** Process-wide defaults, read and written by dotted path (`string.caseInsensitive`,
|
|
592
|
-
* `string.fuzzy`, `prismaOptions.datasource.provider`, `prismaOptions.anyNull`, `sql.dialect
|
|
609
|
+
* `string.fuzzy`, `prismaOptions.datasource.provider`, `prismaOptions.anyNull`, `sql.dialect`,
|
|
610
|
+
* `clock.finestUnit`). */
|
|
593
611
|
declare const engineGlobals: {
|
|
594
612
|
set: (path: string, value: unknown) => void;
|
|
595
613
|
get: (path: string) => unknown;
|
|
@@ -1288,4 +1306,4 @@ declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKe
|
|
|
1288
1306
|
*/
|
|
1289
1307
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1290
1308
|
|
|
1291
|
-
export { ALL_KINDS, type Absent, 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, ConditionShape, type ConditionShapeKeys, 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 LensWhereSql, type LensWhereSqlOptions, 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, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
|
1309
|
+
export { ALL_KINDS, type Absent, type AggregateMode, type AggregateRule, type All, type Any, ArrayOperator, type ArrayRule, 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 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 LensWhereSql, type LensWhereSqlOptions, 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, 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, type ValidateRuleOptions, type ValidationIssue, type ValidationResult, ValueShape, type ValueSourceFields, type ValueSourceOf, type WeekStart, type WhereSqlOptions, type WhereStep, type WindowFields, andWhere, assertValidFieldMaps, assertValidNarrowing, assertValidRule, bindLens, bindRule, check, clampLens, clockUnit, coerceRule, composeLens, createLens, describeRule, describeRuleSources, engineGlobals, executePrismaPlan, getAggregateOperators, getArrayOperators, getConditionShapeKeys, getLensRoot, getOperatorsForKind, getValueShape, indexBridges, lensVisit, listBindings, listLensBindings, matchAll, matchNothing, materializeSourceQuery, materializeSources, narrowRule, orWhere, orderRecords, parseScopeRef, prefixConditionFields, projectLens, projectRows, readLensValue, readScopeRef, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|