@inixiative/json-rules 2.21.0 → 2.22.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 +9 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -202,12 +202,15 @@ type ValueSource<TValue> = {
|
|
|
202
202
|
value: TValue;
|
|
203
203
|
path?: never;
|
|
204
204
|
bind?: never;
|
|
205
|
+
bindOptional?: never;
|
|
205
206
|
} | {
|
|
206
207
|
path: string;
|
|
207
208
|
value?: never;
|
|
208
209
|
bind?: never;
|
|
210
|
+
bindOptional?: never;
|
|
209
211
|
} | {
|
|
210
212
|
bind: string;
|
|
213
|
+
bindOptional?: boolean;
|
|
211
214
|
value?: never;
|
|
212
215
|
path?: never;
|
|
213
216
|
};
|
|
@@ -317,6 +320,7 @@ type AggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowF
|
|
|
317
320
|
value?: number | [number, number];
|
|
318
321
|
path?: string;
|
|
319
322
|
bind?: string;
|
|
323
|
+
bindOptional?: boolean;
|
|
320
324
|
error?: string;
|
|
321
325
|
};
|
|
322
326
|
type Rule<TValue = RuleValue> = {
|
|
@@ -325,6 +329,7 @@ type Rule<TValue = RuleValue> = {
|
|
|
325
329
|
value?: TValue;
|
|
326
330
|
path?: string;
|
|
327
331
|
bind?: string;
|
|
332
|
+
bindOptional?: boolean;
|
|
328
333
|
error?: string;
|
|
329
334
|
caseInsensitive?: boolean;
|
|
330
335
|
fuzzy?: boolean | FuzzyConfig;
|
|
@@ -343,6 +348,7 @@ type DateRule<TValue = DateRuleValue> = {
|
|
|
343
348
|
value?: TValue;
|
|
344
349
|
path?: string;
|
|
345
350
|
bind?: string;
|
|
351
|
+
bindOptional?: boolean;
|
|
346
352
|
error?: string;
|
|
347
353
|
};
|
|
348
354
|
type All<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
|
|
@@ -376,7 +382,13 @@ type StrictIfThenElse<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
|
|
|
376
382
|
};
|
|
377
383
|
type StrictCondition<TRuleValue = RuleValue, TDateValue = DateRuleValue> = StrictRule<TRuleValue> | StrictAggregateRule<TRuleValue, TDateValue> | StrictArrayRule<TRuleValue, TDateValue> | StrictDateRule | StrictAll<TRuleValue, TDateValue> | StrictAny<TRuleValue, TDateValue> | StrictIfThenElse<TRuleValue, TDateValue> | boolean;
|
|
378
384
|
|
|
379
|
-
/** Names of every `{ bind }` token in the tree
|
|
385
|
+
/** Names of every `{ bind }` token in the tree, optional or not — what a lens declares. */
|
|
386
|
+
declare const bindingNames: (condition: Condition) => Set<string>;
|
|
387
|
+
/**
|
|
388
|
+
* Names a bindings map must cover: every `{ bind }` token not marked `bindOptional`. A
|
|
389
|
+
* name that is optional at one leaf and required at another is required. An optional
|
|
390
|
+
* name left unsupplied evaluates and compiles as `null`.
|
|
391
|
+
*/
|
|
380
392
|
declare const requiredBindings: (condition: Condition) => Set<string>;
|
|
381
393
|
/**
|
|
382
394
|
* Substitute covered binds with their values; uncovered tokens stay in place (partial
|
|
@@ -637,7 +649,8 @@ type LensNarrowing = {
|
|
|
637
649
|
declare const applyLens: (rule: Condition, lensOrNarrowing: Lens | LensNarrowing) => Condition;
|
|
638
650
|
|
|
639
651
|
/**
|
|
640
|
-
* Every bind name a lens (its whole narrowing chain) needs supplied to execute
|
|
652
|
+
* Every bind name a lens (its whole narrowing chain) needs supplied to execute —
|
|
653
|
+
* `bindOptional` tokens are not required (unsupplied, they resolve to null).
|
|
641
654
|
* `parent:` references collapse to their base name — the caller supplies one value
|
|
642
655
|
* per name and an inherited reference draws the same one. This is the "what does
|
|
643
656
|
* this lens require" answer; pass `narrowing.parent` to see the names a child must
|
|
@@ -923,4 +936,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
923
936
|
target?: RuleTarget;
|
|
924
937
|
}) => asserts condition is Condition;
|
|
925
938
|
|
|
926
|
-
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 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, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
939
|
+
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 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, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -202,12 +202,15 @@ type ValueSource<TValue> = {
|
|
|
202
202
|
value: TValue;
|
|
203
203
|
path?: never;
|
|
204
204
|
bind?: never;
|
|
205
|
+
bindOptional?: never;
|
|
205
206
|
} | {
|
|
206
207
|
path: string;
|
|
207
208
|
value?: never;
|
|
208
209
|
bind?: never;
|
|
210
|
+
bindOptional?: never;
|
|
209
211
|
} | {
|
|
210
212
|
bind: string;
|
|
213
|
+
bindOptional?: boolean;
|
|
211
214
|
value?: never;
|
|
212
215
|
path?: never;
|
|
213
216
|
};
|
|
@@ -317,6 +320,7 @@ type AggregateRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowF
|
|
|
317
320
|
value?: number | [number, number];
|
|
318
321
|
path?: string;
|
|
319
322
|
bind?: string;
|
|
323
|
+
bindOptional?: boolean;
|
|
320
324
|
error?: string;
|
|
321
325
|
};
|
|
322
326
|
type Rule<TValue = RuleValue> = {
|
|
@@ -325,6 +329,7 @@ type Rule<TValue = RuleValue> = {
|
|
|
325
329
|
value?: TValue;
|
|
326
330
|
path?: string;
|
|
327
331
|
bind?: string;
|
|
332
|
+
bindOptional?: boolean;
|
|
328
333
|
error?: string;
|
|
329
334
|
caseInsensitive?: boolean;
|
|
330
335
|
fuzzy?: boolean | FuzzyConfig;
|
|
@@ -343,6 +348,7 @@ type DateRule<TValue = DateRuleValue> = {
|
|
|
343
348
|
value?: TValue;
|
|
344
349
|
path?: string;
|
|
345
350
|
bind?: string;
|
|
351
|
+
bindOptional?: boolean;
|
|
346
352
|
error?: string;
|
|
347
353
|
};
|
|
348
354
|
type All<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
|
|
@@ -376,7 +382,13 @@ type StrictIfThenElse<TRuleValue = RuleValue, TDateValue = DateRuleValue> = {
|
|
|
376
382
|
};
|
|
377
383
|
type StrictCondition<TRuleValue = RuleValue, TDateValue = DateRuleValue> = StrictRule<TRuleValue> | StrictAggregateRule<TRuleValue, TDateValue> | StrictArrayRule<TRuleValue, TDateValue> | StrictDateRule | StrictAll<TRuleValue, TDateValue> | StrictAny<TRuleValue, TDateValue> | StrictIfThenElse<TRuleValue, TDateValue> | boolean;
|
|
378
384
|
|
|
379
|
-
/** Names of every `{ bind }` token in the tree
|
|
385
|
+
/** Names of every `{ bind }` token in the tree, optional or not — what a lens declares. */
|
|
386
|
+
declare const bindingNames: (condition: Condition) => Set<string>;
|
|
387
|
+
/**
|
|
388
|
+
* Names a bindings map must cover: every `{ bind }` token not marked `bindOptional`. A
|
|
389
|
+
* name that is optional at one leaf and required at another is required. An optional
|
|
390
|
+
* name left unsupplied evaluates and compiles as `null`.
|
|
391
|
+
*/
|
|
380
392
|
declare const requiredBindings: (condition: Condition) => Set<string>;
|
|
381
393
|
/**
|
|
382
394
|
* Substitute covered binds with their values; uncovered tokens stay in place (partial
|
|
@@ -637,7 +649,8 @@ type LensNarrowing = {
|
|
|
637
649
|
declare const applyLens: (rule: Condition, lensOrNarrowing: Lens | LensNarrowing) => Condition;
|
|
638
650
|
|
|
639
651
|
/**
|
|
640
|
-
* Every bind name a lens (its whole narrowing chain) needs supplied to execute
|
|
652
|
+
* Every bind name a lens (its whole narrowing chain) needs supplied to execute —
|
|
653
|
+
* `bindOptional` tokens are not required (unsupplied, they resolve to null).
|
|
641
654
|
* `parent:` references collapse to their base name — the caller supplies one value
|
|
642
655
|
* per name and an inherited reference draws the same one. This is the "what does
|
|
643
656
|
* this lens require" answer; pass `narrowing.parent` to see the names a child must
|
|
@@ -923,4 +936,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
923
936
|
target?: RuleTarget;
|
|
924
937
|
}) => asserts condition is Condition;
|
|
925
938
|
|
|
926
|
-
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 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, buildBridgeDictionary, check, checkRuleAgainstLens, createLens, describeRule, engineGlobals, executePrismaQueryPlan, exposedSurface, fuzzyContains, getAggregateOperators, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, maxFuzzyDistance, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
939
|
+
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 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, projectByPath, requiredBindings, resolveBindings, resolveCaseInsensitive, resolveFuzzy, resolveLensBindings, ruleSourceValues, sourceQueries, sourceValuesFromQueryRows, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|