@inixiative/json-rules 2.14.0 → 2.15.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.d.cts CHANGED
@@ -205,6 +205,7 @@ type RuleBase<TOperator extends Operator> = {
205
205
  field: string;
206
206
  operator: TOperator;
207
207
  error?: string;
208
+ caseInsensitive?: boolean;
208
209
  };
209
210
  type DateRuleBase<TOperator extends DateOperator> = {
210
211
  field: string;
@@ -310,6 +311,7 @@ type Rule<TValue = RuleValue> = {
310
311
  path?: string;
311
312
  bind?: string;
312
313
  error?: string;
314
+ caseInsensitive?: boolean;
313
315
  coerceType?: FieldKind;
314
316
  };
315
317
  type ArrayRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowFields & {
@@ -379,6 +381,21 @@ type CheckOptions = {
379
381
  } & DateConfig;
380
382
  declare const check: <TData extends CheckData>(conditions: Condition, data: TData, options?: CheckOptions) => boolean | string;
381
383
 
384
+ type PrismaProvider = 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'cockroachdb' | 'mongodb';
385
+ type EngineGlobalsState = {
386
+ prismaOptions: {
387
+ datasource: {
388
+ provider: PrismaProvider;
389
+ };
390
+ };
391
+ };
392
+ declare const engineGlobals: {
393
+ set: (path: string, value: unknown) => void;
394
+ get: (path: string) => unknown;
395
+ reset: () => void;
396
+ };
397
+ declare const supportsQueryMode: (provider: PrismaProvider) => boolean;
398
+
382
399
  type PrismaWhere = Record<string, unknown>;
383
400
  /** A selectable option — the standard `<select>` shape: a value with an optional display label. */
384
401
  type SourceOption = {
@@ -446,6 +463,9 @@ type BuildOptions = {
446
463
  mapName?: string;
447
464
  model?: string;
448
465
  context?: Record<string, unknown>;
466
+ datasource?: {
467
+ provider?: PrismaProvider;
468
+ };
449
469
  } & DateConfig;
450
470
 
451
471
  type BridgeEndpoint = {
@@ -527,10 +547,16 @@ type ModelDefaultNarrowing = {
527
547
  */
528
548
  sources?: Record<string, SourceValue>;
529
549
  };
530
- /** A sourced field's eligibility `where` plus an optional sibling display-label column. */
550
+ /**
551
+ * A sourced field's eligibility `where` plus an optional sibling display-label column.
552
+ * At least one key is required — `{}` is not a Condition; the unconstrained spelling is `true`.
553
+ */
531
554
  type SourceSpec = {
532
- where?: Condition;
555
+ where: Condition;
533
556
  label?: string;
557
+ } | {
558
+ where?: Condition;
559
+ label: string;
534
560
  };
535
561
  /** A `sources` entry: a bare eligibility `Condition`, or a richer `SourceSpec`. */
536
562
  type SourceValue = Condition | SourceSpec;
@@ -784,4 +810,4 @@ declare const assertValidRule: (condition: unknown, options?: {
784
810
  target?: RuleTarget;
785
811
  }) => asserts condition is Condition;
786
812
 
787
- 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 EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, 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 PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, 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, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, projectByPath, requiredBindings, resolveBindings, resolveLensBindings, sourceQueries, sourceValuesFromRows, stampCoercions, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
813
+ 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 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, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, 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, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, projectByPath, requiredBindings, resolveBindings, resolveLensBindings, sourceQueries, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
package/dist/index.d.ts CHANGED
@@ -205,6 +205,7 @@ type RuleBase<TOperator extends Operator> = {
205
205
  field: string;
206
206
  operator: TOperator;
207
207
  error?: string;
208
+ caseInsensitive?: boolean;
208
209
  };
209
210
  type DateRuleBase<TOperator extends DateOperator> = {
210
211
  field: string;
@@ -310,6 +311,7 @@ type Rule<TValue = RuleValue> = {
310
311
  path?: string;
311
312
  bind?: string;
312
313
  error?: string;
314
+ caseInsensitive?: boolean;
313
315
  coerceType?: FieldKind;
314
316
  };
315
317
  type ArrayRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowFields & {
@@ -379,6 +381,21 @@ type CheckOptions = {
379
381
  } & DateConfig;
380
382
  declare const check: <TData extends CheckData>(conditions: Condition, data: TData, options?: CheckOptions) => boolean | string;
381
383
 
384
+ type PrismaProvider = 'postgresql' | 'mysql' | 'sqlite' | 'sqlserver' | 'cockroachdb' | 'mongodb';
385
+ type EngineGlobalsState = {
386
+ prismaOptions: {
387
+ datasource: {
388
+ provider: PrismaProvider;
389
+ };
390
+ };
391
+ };
392
+ declare const engineGlobals: {
393
+ set: (path: string, value: unknown) => void;
394
+ get: (path: string) => unknown;
395
+ reset: () => void;
396
+ };
397
+ declare const supportsQueryMode: (provider: PrismaProvider) => boolean;
398
+
382
399
  type PrismaWhere = Record<string, unknown>;
383
400
  /** A selectable option — the standard `<select>` shape: a value with an optional display label. */
384
401
  type SourceOption = {
@@ -446,6 +463,9 @@ type BuildOptions = {
446
463
  mapName?: string;
447
464
  model?: string;
448
465
  context?: Record<string, unknown>;
466
+ datasource?: {
467
+ provider?: PrismaProvider;
468
+ };
449
469
  } & DateConfig;
450
470
 
451
471
  type BridgeEndpoint = {
@@ -527,10 +547,16 @@ type ModelDefaultNarrowing = {
527
547
  */
528
548
  sources?: Record<string, SourceValue>;
529
549
  };
530
- /** A sourced field's eligibility `where` plus an optional sibling display-label column. */
550
+ /**
551
+ * A sourced field's eligibility `where` plus an optional sibling display-label column.
552
+ * At least one key is required — `{}` is not a Condition; the unconstrained spelling is `true`.
553
+ */
531
554
  type SourceSpec = {
532
- where?: Condition;
555
+ where: Condition;
533
556
  label?: string;
557
+ } | {
558
+ where?: Condition;
559
+ label: string;
534
560
  };
535
561
  /** A `sources` entry: a bare eligibility `Condition`, or a richer `SourceSpec`. */
536
562
  type SourceValue = Condition | SourceSpec;
@@ -784,4 +810,4 @@ declare const assertValidRule: (condition: unknown, options?: {
784
810
  target?: RuleTarget;
785
811
  }) => asserts condition is Condition;
786
812
 
787
- 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 EnumNarrowing, FIELD_OPERATOR_CATALOG, FieldKind, type FieldMap, type FieldMapEntry, type FieldMapSet, 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 PrismaStep, type PrismaWhere, type ProjectOptions, type ProjectedVisit, type RelativeUnits, type RollingExpr, type Rule, type RuleDescription, type RuleLensCheck, type RuleLensViolation, type RuleScalar, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, 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, executePrismaQueryPlan, exposedSurface, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, projectByPath, requiredBindings, resolveBindings, resolveLensBindings, sourceQueries, sourceValuesFromRows, stampCoercions, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
813
+ 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 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, RuleTarget, type RuleValue, STRINGY_KINDS, type SortDir, type SourceOption, type SourcePrismaQuery, type SourceQuery, 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, getArrayOperators, getOperatorsForKind, getValueShape, getWindowSupport, isAggregateRangeOperator, isAggregateSingleOperator, isOperatorSupportedForTarget, lensRequiredBindings, projectByPath, requiredBindings, resolveBindings, resolveLensBindings, sourceQueries, sourceValuesFromRows, stampCoercions, stitchFieldMaps, supportsQueryMode, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };