@inixiative/json-rules 3.16.0 → 3.17.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 +143 -116
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -5
- package/dist/index.d.ts +27 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -657,25 +657,47 @@ type EngineGlobalsState = {
|
|
|
657
657
|
finestUnit: ClockUnit | RelativeUnit;
|
|
658
658
|
};
|
|
659
659
|
};
|
|
660
|
-
/**
|
|
661
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Each path `engineGlobals` reads and writes, and the values it takes. An interface, so a library
|
|
662
|
+
* built on the engine adds its own namespace's paths by module augmentation:
|
|
663
|
+
*
|
|
664
|
+
* ```ts
|
|
665
|
+
* declare module '@inixiative/json-rules' {
|
|
666
|
+
* interface EngineGlobalValues { 'permissions.idField': string }
|
|
667
|
+
* }
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
interface EngineGlobalValues {
|
|
662
671
|
'string.caseInsensitive': EngineGlobalsState['string']['caseInsensitive'];
|
|
663
672
|
'string.fuzzy': EngineGlobalsState['string']['fuzzy'];
|
|
664
673
|
'prismaOptions.datasource.provider': EngineGlobalsState['prismaOptions']['datasource']['provider'];
|
|
665
674
|
'prismaOptions.anyNull': EngineGlobalsState['prismaOptions']['anyNull'];
|
|
666
675
|
'sql.dialect': EngineGlobalsState['sql']['dialect'];
|
|
667
676
|
'clock.finestUnit': EngineGlobalsState['clock']['finestUnit'];
|
|
668
|
-
}
|
|
677
|
+
}
|
|
669
678
|
type EngineGlobalPath = keyof EngineGlobalValues;
|
|
679
|
+
/** The defaults a namespace registers: its paths, relative to the namespace. */
|
|
680
|
+
type EngineGlobalDefaults<N extends string> = {
|
|
681
|
+
[P in EngineGlobalPath as P extends `${N}.${infer K}` ? K : never]: EngineGlobalValues[P];
|
|
682
|
+
};
|
|
670
683
|
type DeepPartial<T> = {
|
|
671
684
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
672
685
|
};
|
|
686
|
+
type Overrides = Partial<EngineGlobalValues> | DeepPartial<EngineGlobalsState>;
|
|
687
|
+
/**
|
|
688
|
+
* Register a library's namespace of engine globals and its defaults. A library built on the
|
|
689
|
+
* engine calls this at the top of the module that reads the setting, for its own namespace only.
|
|
690
|
+
* Defaults go in under any value already set (an app may configure a library before importing
|
|
691
|
+
* it). Registering the same defaults again is a no-op (a second installed copy of the library);
|
|
692
|
+
* different defaults, a dotted namespace or one of the engine's own roots throw.
|
|
693
|
+
*/
|
|
694
|
+
declare const registerEngineGlobals: <N extends string>(namespace: N, defaults: EngineGlobalDefaults<N>) => void;
|
|
673
695
|
/** Process-wide defaults, read and written by dotted path (`EngineGlobalPath`). */
|
|
674
696
|
declare const engineGlobals: {
|
|
675
697
|
set: <P extends EngineGlobalPath>(path: P, value: EngineGlobalValues[P]) => void;
|
|
676
698
|
get: <P extends EngineGlobalPath>(path: P) => EngineGlobalValues[P];
|
|
677
699
|
reset: () => void;
|
|
678
|
-
with: <T>(
|
|
700
|
+
with: <T>(overrides: Overrides, fn: () => T) => T;
|
|
679
701
|
};
|
|
680
702
|
|
|
681
703
|
/** A caller's input missing or malformed — the clock, the time zone, a bind's value — not the
|
|
@@ -1380,4 +1402,4 @@ declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKe
|
|
|
1380
1402
|
*/
|
|
1381
1403
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1382
1404
|
|
|
1383
|
-
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 EngineGlobalPath, type EngineGlobalValues, 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 RelativeUnit, 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 };
|
|
1405
|
+
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 EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, 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 RelativeUnit, 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, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -657,25 +657,47 @@ type EngineGlobalsState = {
|
|
|
657
657
|
finestUnit: ClockUnit | RelativeUnit;
|
|
658
658
|
};
|
|
659
659
|
};
|
|
660
|
-
/**
|
|
661
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Each path `engineGlobals` reads and writes, and the values it takes. An interface, so a library
|
|
662
|
+
* built on the engine adds its own namespace's paths by module augmentation:
|
|
663
|
+
*
|
|
664
|
+
* ```ts
|
|
665
|
+
* declare module '@inixiative/json-rules' {
|
|
666
|
+
* interface EngineGlobalValues { 'permissions.idField': string }
|
|
667
|
+
* }
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
interface EngineGlobalValues {
|
|
662
671
|
'string.caseInsensitive': EngineGlobalsState['string']['caseInsensitive'];
|
|
663
672
|
'string.fuzzy': EngineGlobalsState['string']['fuzzy'];
|
|
664
673
|
'prismaOptions.datasource.provider': EngineGlobalsState['prismaOptions']['datasource']['provider'];
|
|
665
674
|
'prismaOptions.anyNull': EngineGlobalsState['prismaOptions']['anyNull'];
|
|
666
675
|
'sql.dialect': EngineGlobalsState['sql']['dialect'];
|
|
667
676
|
'clock.finestUnit': EngineGlobalsState['clock']['finestUnit'];
|
|
668
|
-
}
|
|
677
|
+
}
|
|
669
678
|
type EngineGlobalPath = keyof EngineGlobalValues;
|
|
679
|
+
/** The defaults a namespace registers: its paths, relative to the namespace. */
|
|
680
|
+
type EngineGlobalDefaults<N extends string> = {
|
|
681
|
+
[P in EngineGlobalPath as P extends `${N}.${infer K}` ? K : never]: EngineGlobalValues[P];
|
|
682
|
+
};
|
|
670
683
|
type DeepPartial<T> = {
|
|
671
684
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
672
685
|
};
|
|
686
|
+
type Overrides = Partial<EngineGlobalValues> | DeepPartial<EngineGlobalsState>;
|
|
687
|
+
/**
|
|
688
|
+
* Register a library's namespace of engine globals and its defaults. A library built on the
|
|
689
|
+
* engine calls this at the top of the module that reads the setting, for its own namespace only.
|
|
690
|
+
* Defaults go in under any value already set (an app may configure a library before importing
|
|
691
|
+
* it). Registering the same defaults again is a no-op (a second installed copy of the library);
|
|
692
|
+
* different defaults, a dotted namespace or one of the engine's own roots throw.
|
|
693
|
+
*/
|
|
694
|
+
declare const registerEngineGlobals: <N extends string>(namespace: N, defaults: EngineGlobalDefaults<N>) => void;
|
|
673
695
|
/** Process-wide defaults, read and written by dotted path (`EngineGlobalPath`). */
|
|
674
696
|
declare const engineGlobals: {
|
|
675
697
|
set: <P extends EngineGlobalPath>(path: P, value: EngineGlobalValues[P]) => void;
|
|
676
698
|
get: <P extends EngineGlobalPath>(path: P) => EngineGlobalValues[P];
|
|
677
699
|
reset: () => void;
|
|
678
|
-
with: <T>(
|
|
700
|
+
with: <T>(overrides: Overrides, fn: () => T) => T;
|
|
679
701
|
};
|
|
680
702
|
|
|
681
703
|
/** A caller's input missing or malformed — the clock, the time zone, a bind's value — not the
|
|
@@ -1380,4 +1402,4 @@ declare const getConditionShapeKeys: (shape: ConditionShape) => ConditionShapeKe
|
|
|
1380
1402
|
*/
|
|
1381
1403
|
declare const orderRecords: <T>(items: readonly T[], orderBy: OrderBy) => T[];
|
|
1382
1404
|
|
|
1383
|
-
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 EngineGlobalPath, type EngineGlobalValues, 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 RelativeUnit, 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 };
|
|
1405
|
+
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 EngineGlobalDefaults, type EngineGlobalPath, type EngineGlobalValues, 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 RelativeUnit, 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, registerEngineGlobals, stitchFieldMaps, storeLens, toLensSelect, toLensWhereSql, toPrisma, toSourceQueries, toSql, toWhereSql, validateFieldMaps, validateNarrowing, validateRule, validateRuleInLens, walkLensPath };
|