@inixiative/json-rules 2.12.0 → 2.13.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.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -90
- package/dist/index.d.ts +93 -90
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
package/dist/index.d.cts
CHANGED
|
@@ -45,6 +45,95 @@ declare const DateOperator: {
|
|
|
45
45
|
};
|
|
46
46
|
type DateOperator = (typeof DateOperator)[keyof typeof DateOperator];
|
|
47
47
|
|
|
48
|
+
declare const FieldKind: {
|
|
49
|
+
readonly String: "String";
|
|
50
|
+
readonly Boolean: "Boolean";
|
|
51
|
+
readonly Int: "Int";
|
|
52
|
+
readonly BigInt: "BigInt";
|
|
53
|
+
readonly Float: "Float";
|
|
54
|
+
readonly Decimal: "Decimal";
|
|
55
|
+
readonly DateTime: "DateTime";
|
|
56
|
+
readonly Json: "Json";
|
|
57
|
+
readonly Bytes: "Bytes";
|
|
58
|
+
readonly Enum: "Enum";
|
|
59
|
+
};
|
|
60
|
+
type FieldKind = (typeof FieldKind)[keyof typeof FieldKind];
|
|
61
|
+
declare const NUMERIC_KINDS: readonly FieldKind[];
|
|
62
|
+
declare const ORDERABLE_KINDS: readonly FieldKind[];
|
|
63
|
+
declare const STRINGY_KINDS: readonly FieldKind[];
|
|
64
|
+
declare const EQUATABLE_KINDS: readonly FieldKind[];
|
|
65
|
+
declare const ALL_KINDS: readonly FieldKind[];
|
|
66
|
+
declare const NULLABLE_KINDS: readonly FieldKind[];
|
|
67
|
+
declare const RuleTarget: {
|
|
68
|
+
readonly check: "check";
|
|
69
|
+
readonly toPrisma: "toPrisma";
|
|
70
|
+
readonly toSql: "toSql";
|
|
71
|
+
};
|
|
72
|
+
type RuleTarget = (typeof RuleTarget)[keyof typeof RuleTarget];
|
|
73
|
+
declare const ValueShape: {
|
|
74
|
+
readonly none: "none";
|
|
75
|
+
readonly scalar: "scalar";
|
|
76
|
+
readonly ordered: "ordered";
|
|
77
|
+
readonly array: "array";
|
|
78
|
+
readonly string: "string";
|
|
79
|
+
readonly pattern: "pattern";
|
|
80
|
+
readonly range: "range";
|
|
81
|
+
readonly dateValue: "dateValue";
|
|
82
|
+
readonly dateRange: "dateRange";
|
|
83
|
+
readonly dateWindow: "dateWindow";
|
|
84
|
+
readonly dayList: "dayList";
|
|
85
|
+
readonly count: "count";
|
|
86
|
+
readonly predicate: "predicate";
|
|
87
|
+
};
|
|
88
|
+
type ValueShape = (typeof ValueShape)[keyof typeof ValueShape];
|
|
89
|
+
type CatalogEntry = {
|
|
90
|
+
kinds: readonly FieldKind[];
|
|
91
|
+
targets: readonly RuleTarget[];
|
|
92
|
+
valueShape: ValueShape;
|
|
93
|
+
acceptsExpr?: boolean;
|
|
94
|
+
};
|
|
95
|
+
declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
|
|
96
|
+
declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
|
|
97
|
+
type ArrayCatalogEntry = {
|
|
98
|
+
targets: readonly RuleTarget[];
|
|
99
|
+
valueShape: ValueShape;
|
|
100
|
+
};
|
|
101
|
+
declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
|
|
102
|
+
declare const WindowSupport: {
|
|
103
|
+
readonly full: "full";
|
|
104
|
+
readonly extremal: "extremal";
|
|
105
|
+
readonly none: "none";
|
|
106
|
+
};
|
|
107
|
+
type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
|
|
108
|
+
declare const WINDOW_SELECTOR: {
|
|
109
|
+
readonly fields: readonly ["filter", "orderBy", "take", "skip"];
|
|
110
|
+
readonly sortDirs: readonly ["asc", "desc"];
|
|
111
|
+
readonly support: {
|
|
112
|
+
readonly array: {
|
|
113
|
+
readonly check: "full";
|
|
114
|
+
readonly toPrisma: "extremal";
|
|
115
|
+
readonly toSql: "none";
|
|
116
|
+
};
|
|
117
|
+
readonly aggregate: {
|
|
118
|
+
readonly check: "full";
|
|
119
|
+
readonly toPrisma: "none";
|
|
120
|
+
readonly toSql: "none";
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
|
|
125
|
+
declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
|
|
126
|
+
declare const AGGREGATE_OPERATORS: readonly Operator[];
|
|
127
|
+
declare const isAggregateSingleOperator: (operator: Operator) => boolean;
|
|
128
|
+
declare const isAggregateRangeOperator: (operator: Operator) => boolean;
|
|
129
|
+
declare const getValueShape: (operator: Operator | DateOperator | ArrayOperator) => ValueShape;
|
|
130
|
+
declare const isOperatorSupportedForTarget: (operator: Operator | DateOperator | ArrayOperator, target: RuleTarget) => boolean;
|
|
131
|
+
declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
132
|
+
field: Operator[];
|
|
133
|
+
date: DateOperator[];
|
|
134
|
+
};
|
|
135
|
+
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
136
|
+
|
|
48
137
|
type OperatorValues = typeof Operator;
|
|
49
138
|
type ArrayOperatorValues = typeof ArrayOperator;
|
|
50
139
|
type DateOperatorValues = typeof DateOperator;
|
|
@@ -221,6 +310,7 @@ type Rule<TValue = RuleValue> = {
|
|
|
221
310
|
path?: string;
|
|
222
311
|
bind?: string;
|
|
223
312
|
error?: string;
|
|
313
|
+
coerceType?: FieldKind;
|
|
224
314
|
};
|
|
225
315
|
type ArrayRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowFields & {
|
|
226
316
|
field?: string;
|
|
@@ -517,95 +607,6 @@ type CreateLensInput = {
|
|
|
517
607
|
};
|
|
518
608
|
declare const createLens: (input: CreateLensInput) => Lens;
|
|
519
609
|
|
|
520
|
-
declare const FieldKind: {
|
|
521
|
-
readonly String: "String";
|
|
522
|
-
readonly Boolean: "Boolean";
|
|
523
|
-
readonly Int: "Int";
|
|
524
|
-
readonly BigInt: "BigInt";
|
|
525
|
-
readonly Float: "Float";
|
|
526
|
-
readonly Decimal: "Decimal";
|
|
527
|
-
readonly DateTime: "DateTime";
|
|
528
|
-
readonly Json: "Json";
|
|
529
|
-
readonly Bytes: "Bytes";
|
|
530
|
-
readonly Enum: "Enum";
|
|
531
|
-
};
|
|
532
|
-
type FieldKind = (typeof FieldKind)[keyof typeof FieldKind];
|
|
533
|
-
declare const NUMERIC_KINDS: readonly FieldKind[];
|
|
534
|
-
declare const ORDERABLE_KINDS: readonly FieldKind[];
|
|
535
|
-
declare const STRINGY_KINDS: readonly FieldKind[];
|
|
536
|
-
declare const EQUATABLE_KINDS: readonly FieldKind[];
|
|
537
|
-
declare const ALL_KINDS: readonly FieldKind[];
|
|
538
|
-
declare const NULLABLE_KINDS: readonly FieldKind[];
|
|
539
|
-
declare const RuleTarget: {
|
|
540
|
-
readonly check: "check";
|
|
541
|
-
readonly toPrisma: "toPrisma";
|
|
542
|
-
readonly toSql: "toSql";
|
|
543
|
-
};
|
|
544
|
-
type RuleTarget = (typeof RuleTarget)[keyof typeof RuleTarget];
|
|
545
|
-
declare const ValueShape: {
|
|
546
|
-
readonly none: "none";
|
|
547
|
-
readonly scalar: "scalar";
|
|
548
|
-
readonly ordered: "ordered";
|
|
549
|
-
readonly array: "array";
|
|
550
|
-
readonly string: "string";
|
|
551
|
-
readonly pattern: "pattern";
|
|
552
|
-
readonly range: "range";
|
|
553
|
-
readonly dateValue: "dateValue";
|
|
554
|
-
readonly dateRange: "dateRange";
|
|
555
|
-
readonly dateWindow: "dateWindow";
|
|
556
|
-
readonly dayList: "dayList";
|
|
557
|
-
readonly count: "count";
|
|
558
|
-
readonly predicate: "predicate";
|
|
559
|
-
};
|
|
560
|
-
type ValueShape = (typeof ValueShape)[keyof typeof ValueShape];
|
|
561
|
-
type CatalogEntry = {
|
|
562
|
-
kinds: readonly FieldKind[];
|
|
563
|
-
targets: readonly RuleTarget[];
|
|
564
|
-
valueShape: ValueShape;
|
|
565
|
-
acceptsExpr?: boolean;
|
|
566
|
-
};
|
|
567
|
-
declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
|
|
568
|
-
declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
|
|
569
|
-
type ArrayCatalogEntry = {
|
|
570
|
-
targets: readonly RuleTarget[];
|
|
571
|
-
valueShape: ValueShape;
|
|
572
|
-
};
|
|
573
|
-
declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
|
|
574
|
-
declare const WindowSupport: {
|
|
575
|
-
readonly full: "full";
|
|
576
|
-
readonly extremal: "extremal";
|
|
577
|
-
readonly none: "none";
|
|
578
|
-
};
|
|
579
|
-
type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
|
|
580
|
-
declare const WINDOW_SELECTOR: {
|
|
581
|
-
readonly fields: readonly ["filter", "orderBy", "take", "skip"];
|
|
582
|
-
readonly sortDirs: readonly ["asc", "desc"];
|
|
583
|
-
readonly support: {
|
|
584
|
-
readonly array: {
|
|
585
|
-
readonly check: "full";
|
|
586
|
-
readonly toPrisma: "extremal";
|
|
587
|
-
readonly toSql: "none";
|
|
588
|
-
};
|
|
589
|
-
readonly aggregate: {
|
|
590
|
-
readonly check: "full";
|
|
591
|
-
readonly toPrisma: "none";
|
|
592
|
-
readonly toSql: "none";
|
|
593
|
-
};
|
|
594
|
-
};
|
|
595
|
-
};
|
|
596
|
-
type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
|
|
597
|
-
declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
|
|
598
|
-
declare const AGGREGATE_OPERATORS: readonly Operator[];
|
|
599
|
-
declare const isAggregateSingleOperator: (operator: Operator) => boolean;
|
|
600
|
-
declare const isAggregateRangeOperator: (operator: Operator) => boolean;
|
|
601
|
-
declare const getValueShape: (operator: Operator | DateOperator | ArrayOperator) => ValueShape;
|
|
602
|
-
declare const isOperatorSupportedForTarget: (operator: Operator | DateOperator | ArrayOperator, target: RuleTarget) => boolean;
|
|
603
|
-
declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
604
|
-
field: Operator[];
|
|
605
|
-
date: DateOperator[];
|
|
606
|
-
};
|
|
607
|
-
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
608
|
-
|
|
609
610
|
type RuleDescription = {
|
|
610
611
|
sources: string[];
|
|
611
612
|
bridgesCrossed: boolean;
|
|
@@ -682,6 +683,8 @@ type SourceQuery = {
|
|
|
682
683
|
*/
|
|
683
684
|
declare const sourceQueries: (lensOrNarrowing: Lens | LensNarrowing) => SourceQuery[];
|
|
684
685
|
|
|
686
|
+
declare const stampCoercions: (condition: Condition, lensOrNarrowing: Lens | LensNarrowing) => Condition;
|
|
687
|
+
|
|
685
688
|
/**
|
|
686
689
|
* Execute a Prisma query plan produced by toPrisma().
|
|
687
690
|
*
|
|
@@ -767,4 +770,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
767
770
|
target?: RuleTarget;
|
|
768
771
|
}) => asserts condition is Condition;
|
|
769
772
|
|
|
770
|
-
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, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
773
|
+
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, stampCoercions, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,95 @@ declare const DateOperator: {
|
|
|
45
45
|
};
|
|
46
46
|
type DateOperator = (typeof DateOperator)[keyof typeof DateOperator];
|
|
47
47
|
|
|
48
|
+
declare const FieldKind: {
|
|
49
|
+
readonly String: "String";
|
|
50
|
+
readonly Boolean: "Boolean";
|
|
51
|
+
readonly Int: "Int";
|
|
52
|
+
readonly BigInt: "BigInt";
|
|
53
|
+
readonly Float: "Float";
|
|
54
|
+
readonly Decimal: "Decimal";
|
|
55
|
+
readonly DateTime: "DateTime";
|
|
56
|
+
readonly Json: "Json";
|
|
57
|
+
readonly Bytes: "Bytes";
|
|
58
|
+
readonly Enum: "Enum";
|
|
59
|
+
};
|
|
60
|
+
type FieldKind = (typeof FieldKind)[keyof typeof FieldKind];
|
|
61
|
+
declare const NUMERIC_KINDS: readonly FieldKind[];
|
|
62
|
+
declare const ORDERABLE_KINDS: readonly FieldKind[];
|
|
63
|
+
declare const STRINGY_KINDS: readonly FieldKind[];
|
|
64
|
+
declare const EQUATABLE_KINDS: readonly FieldKind[];
|
|
65
|
+
declare const ALL_KINDS: readonly FieldKind[];
|
|
66
|
+
declare const NULLABLE_KINDS: readonly FieldKind[];
|
|
67
|
+
declare const RuleTarget: {
|
|
68
|
+
readonly check: "check";
|
|
69
|
+
readonly toPrisma: "toPrisma";
|
|
70
|
+
readonly toSql: "toSql";
|
|
71
|
+
};
|
|
72
|
+
type RuleTarget = (typeof RuleTarget)[keyof typeof RuleTarget];
|
|
73
|
+
declare const ValueShape: {
|
|
74
|
+
readonly none: "none";
|
|
75
|
+
readonly scalar: "scalar";
|
|
76
|
+
readonly ordered: "ordered";
|
|
77
|
+
readonly array: "array";
|
|
78
|
+
readonly string: "string";
|
|
79
|
+
readonly pattern: "pattern";
|
|
80
|
+
readonly range: "range";
|
|
81
|
+
readonly dateValue: "dateValue";
|
|
82
|
+
readonly dateRange: "dateRange";
|
|
83
|
+
readonly dateWindow: "dateWindow";
|
|
84
|
+
readonly dayList: "dayList";
|
|
85
|
+
readonly count: "count";
|
|
86
|
+
readonly predicate: "predicate";
|
|
87
|
+
};
|
|
88
|
+
type ValueShape = (typeof ValueShape)[keyof typeof ValueShape];
|
|
89
|
+
type CatalogEntry = {
|
|
90
|
+
kinds: readonly FieldKind[];
|
|
91
|
+
targets: readonly RuleTarget[];
|
|
92
|
+
valueShape: ValueShape;
|
|
93
|
+
acceptsExpr?: boolean;
|
|
94
|
+
};
|
|
95
|
+
declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
|
|
96
|
+
declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
|
|
97
|
+
type ArrayCatalogEntry = {
|
|
98
|
+
targets: readonly RuleTarget[];
|
|
99
|
+
valueShape: ValueShape;
|
|
100
|
+
};
|
|
101
|
+
declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
|
|
102
|
+
declare const WindowSupport: {
|
|
103
|
+
readonly full: "full";
|
|
104
|
+
readonly extremal: "extremal";
|
|
105
|
+
readonly none: "none";
|
|
106
|
+
};
|
|
107
|
+
type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
|
|
108
|
+
declare const WINDOW_SELECTOR: {
|
|
109
|
+
readonly fields: readonly ["filter", "orderBy", "take", "skip"];
|
|
110
|
+
readonly sortDirs: readonly ["asc", "desc"];
|
|
111
|
+
readonly support: {
|
|
112
|
+
readonly array: {
|
|
113
|
+
readonly check: "full";
|
|
114
|
+
readonly toPrisma: "extremal";
|
|
115
|
+
readonly toSql: "none";
|
|
116
|
+
};
|
|
117
|
+
readonly aggregate: {
|
|
118
|
+
readonly check: "full";
|
|
119
|
+
readonly toPrisma: "none";
|
|
120
|
+
readonly toSql: "none";
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
|
|
125
|
+
declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
|
|
126
|
+
declare const AGGREGATE_OPERATORS: readonly Operator[];
|
|
127
|
+
declare const isAggregateSingleOperator: (operator: Operator) => boolean;
|
|
128
|
+
declare const isAggregateRangeOperator: (operator: Operator) => boolean;
|
|
129
|
+
declare const getValueShape: (operator: Operator | DateOperator | ArrayOperator) => ValueShape;
|
|
130
|
+
declare const isOperatorSupportedForTarget: (operator: Operator | DateOperator | ArrayOperator, target: RuleTarget) => boolean;
|
|
131
|
+
declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
132
|
+
field: Operator[];
|
|
133
|
+
date: DateOperator[];
|
|
134
|
+
};
|
|
135
|
+
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
136
|
+
|
|
48
137
|
type OperatorValues = typeof Operator;
|
|
49
138
|
type ArrayOperatorValues = typeof ArrayOperator;
|
|
50
139
|
type DateOperatorValues = typeof DateOperator;
|
|
@@ -221,6 +310,7 @@ type Rule<TValue = RuleValue> = {
|
|
|
221
310
|
path?: string;
|
|
222
311
|
bind?: string;
|
|
223
312
|
error?: string;
|
|
313
|
+
coerceType?: FieldKind;
|
|
224
314
|
};
|
|
225
315
|
type ArrayRule<TRuleValue = RuleValue, TDateValue = DateRuleValue> = WindowFields & {
|
|
226
316
|
field?: string;
|
|
@@ -517,95 +607,6 @@ type CreateLensInput = {
|
|
|
517
607
|
};
|
|
518
608
|
declare const createLens: (input: CreateLensInput) => Lens;
|
|
519
609
|
|
|
520
|
-
declare const FieldKind: {
|
|
521
|
-
readonly String: "String";
|
|
522
|
-
readonly Boolean: "Boolean";
|
|
523
|
-
readonly Int: "Int";
|
|
524
|
-
readonly BigInt: "BigInt";
|
|
525
|
-
readonly Float: "Float";
|
|
526
|
-
readonly Decimal: "Decimal";
|
|
527
|
-
readonly DateTime: "DateTime";
|
|
528
|
-
readonly Json: "Json";
|
|
529
|
-
readonly Bytes: "Bytes";
|
|
530
|
-
readonly Enum: "Enum";
|
|
531
|
-
};
|
|
532
|
-
type FieldKind = (typeof FieldKind)[keyof typeof FieldKind];
|
|
533
|
-
declare const NUMERIC_KINDS: readonly FieldKind[];
|
|
534
|
-
declare const ORDERABLE_KINDS: readonly FieldKind[];
|
|
535
|
-
declare const STRINGY_KINDS: readonly FieldKind[];
|
|
536
|
-
declare const EQUATABLE_KINDS: readonly FieldKind[];
|
|
537
|
-
declare const ALL_KINDS: readonly FieldKind[];
|
|
538
|
-
declare const NULLABLE_KINDS: readonly FieldKind[];
|
|
539
|
-
declare const RuleTarget: {
|
|
540
|
-
readonly check: "check";
|
|
541
|
-
readonly toPrisma: "toPrisma";
|
|
542
|
-
readonly toSql: "toSql";
|
|
543
|
-
};
|
|
544
|
-
type RuleTarget = (typeof RuleTarget)[keyof typeof RuleTarget];
|
|
545
|
-
declare const ValueShape: {
|
|
546
|
-
readonly none: "none";
|
|
547
|
-
readonly scalar: "scalar";
|
|
548
|
-
readonly ordered: "ordered";
|
|
549
|
-
readonly array: "array";
|
|
550
|
-
readonly string: "string";
|
|
551
|
-
readonly pattern: "pattern";
|
|
552
|
-
readonly range: "range";
|
|
553
|
-
readonly dateValue: "dateValue";
|
|
554
|
-
readonly dateRange: "dateRange";
|
|
555
|
-
readonly dateWindow: "dateWindow";
|
|
556
|
-
readonly dayList: "dayList";
|
|
557
|
-
readonly count: "count";
|
|
558
|
-
readonly predicate: "predicate";
|
|
559
|
-
};
|
|
560
|
-
type ValueShape = (typeof ValueShape)[keyof typeof ValueShape];
|
|
561
|
-
type CatalogEntry = {
|
|
562
|
-
kinds: readonly FieldKind[];
|
|
563
|
-
targets: readonly RuleTarget[];
|
|
564
|
-
valueShape: ValueShape;
|
|
565
|
-
acceptsExpr?: boolean;
|
|
566
|
-
};
|
|
567
|
-
declare const FIELD_OPERATOR_CATALOG: Record<Operator, CatalogEntry>;
|
|
568
|
-
declare const DATE_OPERATOR_CATALOG: Record<DateOperator, CatalogEntry>;
|
|
569
|
-
type ArrayCatalogEntry = {
|
|
570
|
-
targets: readonly RuleTarget[];
|
|
571
|
-
valueShape: ValueShape;
|
|
572
|
-
};
|
|
573
|
-
declare const ARRAY_OPERATOR_CATALOG: Record<ArrayOperator, ArrayCatalogEntry>;
|
|
574
|
-
declare const WindowSupport: {
|
|
575
|
-
readonly full: "full";
|
|
576
|
-
readonly extremal: "extremal";
|
|
577
|
-
readonly none: "none";
|
|
578
|
-
};
|
|
579
|
-
type WindowSupport = (typeof WindowSupport)[keyof typeof WindowSupport];
|
|
580
|
-
declare const WINDOW_SELECTOR: {
|
|
581
|
-
readonly fields: readonly ["filter", "orderBy", "take", "skip"];
|
|
582
|
-
readonly sortDirs: readonly ["asc", "desc"];
|
|
583
|
-
readonly support: {
|
|
584
|
-
readonly array: {
|
|
585
|
-
readonly check: "full";
|
|
586
|
-
readonly toPrisma: "extremal";
|
|
587
|
-
readonly toSql: "none";
|
|
588
|
-
};
|
|
589
|
-
readonly aggregate: {
|
|
590
|
-
readonly check: "full";
|
|
591
|
-
readonly toPrisma: "none";
|
|
592
|
-
readonly toSql: "none";
|
|
593
|
-
};
|
|
594
|
-
};
|
|
595
|
-
};
|
|
596
|
-
type WindowRuleType = keyof typeof WINDOW_SELECTOR.support;
|
|
597
|
-
declare const getWindowSupport: (ruleType: WindowRuleType, target: RuleTarget) => WindowSupport;
|
|
598
|
-
declare const AGGREGATE_OPERATORS: readonly Operator[];
|
|
599
|
-
declare const isAggregateSingleOperator: (operator: Operator) => boolean;
|
|
600
|
-
declare const isAggregateRangeOperator: (operator: Operator) => boolean;
|
|
601
|
-
declare const getValueShape: (operator: Operator | DateOperator | ArrayOperator) => ValueShape;
|
|
602
|
-
declare const isOperatorSupportedForTarget: (operator: Operator | DateOperator | ArrayOperator, target: RuleTarget) => boolean;
|
|
603
|
-
declare const getOperatorsForKind: (kind: FieldKind, target?: RuleTarget) => {
|
|
604
|
-
field: Operator[];
|
|
605
|
-
date: DateOperator[];
|
|
606
|
-
};
|
|
607
|
-
declare const getArrayOperators: (target?: RuleTarget) => ArrayOperator[];
|
|
608
|
-
|
|
609
610
|
type RuleDescription = {
|
|
610
611
|
sources: string[];
|
|
611
612
|
bridgesCrossed: boolean;
|
|
@@ -682,6 +683,8 @@ type SourceQuery = {
|
|
|
682
683
|
*/
|
|
683
684
|
declare const sourceQueries: (lensOrNarrowing: Lens | LensNarrowing) => SourceQuery[];
|
|
684
685
|
|
|
686
|
+
declare const stampCoercions: (condition: Condition, lensOrNarrowing: Lens | LensNarrowing) => Condition;
|
|
687
|
+
|
|
685
688
|
/**
|
|
686
689
|
* Execute a Prisma query plan produced by toPrisma().
|
|
687
690
|
*
|
|
@@ -767,4 +770,4 @@ declare const assertValidRule: (condition: unknown, options?: {
|
|
|
767
770
|
target?: RuleTarget;
|
|
768
771
|
}) => asserts condition is Condition;
|
|
769
772
|
|
|
770
|
-
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, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|
|
773
|
+
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, stampCoercions, stitchFieldMaps, toPrisma, toSql, validateBindNames, validateFieldMap, validateFieldMapSet, validateNarrowing, validateRule };
|