@balena/sbvr-types
Advanced tools
Comparing version 3.4.0 to 3.4.1-remove-synonymous-verbs-64e889f7bda6f3dcf4c539248e737fef26b5686c
@@ -7,2 +7,7 @@ # Change Log | ||
# v3.4.1 | ||
## (2021-02-10) | ||
* Remove unnecessary native fact type entries for synonymous forms [Pagan Gazzard] | ||
# v3.4.0 | ||
@@ -9,0 +14,0 @@ ## (2021-02-08) |
@@ -22,11 +22,7 @@ export interface DatabaseTypeFn { | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
comparison: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -33,0 +29,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validate = exports.nativeFactTypeTemplates = void 0; | ||
const equality = (from, to) => ['Equals', from, to]; | ||
const checkRequired = (validateFn) => { | ||
@@ -17,14 +16,8 @@ async function runCheck(value, required) { | ||
}; | ||
const equality = { | ||
'is equal to': (from, to) => ['Equals', from, to], | ||
}; | ||
exports.nativeFactTypeTemplates = { | ||
equality: { | ||
'is equal to': equality, | ||
equals: equality, | ||
}, | ||
equality, | ||
comparison: { | ||
'is greater than': (from, to) => ['GreaterThan', from, to], | ||
'is greater than or equal to': (from, to) => [ | ||
'GreaterThanOrEqual', | ||
from, | ||
to, | ||
], | ||
'is less than': (from, to) => ['LessThan', from, to], | ||
@@ -36,4 +29,3 @@ 'is less than or equal to': (from, to) => [ | ||
], | ||
'is equal to': equality, | ||
equals: equality, | ||
...equality, | ||
}, | ||
@@ -40,0 +32,0 @@ }; |
@@ -11,16 +11,10 @@ export declare const types: { | ||
Integer: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
Real: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -27,0 +21,0 @@ }; |
@@ -11,16 +11,10 @@ export declare const types: { | ||
Integer: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
Real: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -27,0 +21,0 @@ }; |
@@ -13,5 +13,3 @@ export declare const types: { | ||
'is before': (from: string, to: string) => string[]; | ||
'is after': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -18,0 +16,0 @@ }; |
@@ -24,3 +24,2 @@ "use strict"; | ||
'is before': (from, to) => ['LessThan', from, to], | ||
'is after': (from, to) => ['GreaterThan', from, to], | ||
}, | ||
@@ -27,0 +26,0 @@ }; |
@@ -13,5 +13,3 @@ export declare const types: { | ||
'is before': (from: string, to: string) => string[]; | ||
'is after': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -18,0 +16,0 @@ }; |
@@ -24,3 +24,2 @@ "use strict"; | ||
'is before': (from, to) => ['LessThan', from, to], | ||
'is after': (from, to) => ['GreaterThan', from, to], | ||
}, | ||
@@ -27,0 +26,0 @@ }; |
@@ -11,16 +11,10 @@ export declare const types: { | ||
Integer: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
Real: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -27,0 +21,0 @@ }; |
@@ -11,16 +11,10 @@ export declare const types: { | ||
Integer: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
Real: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -27,0 +21,0 @@ }; |
@@ -11,16 +11,10 @@ export declare const types: { | ||
Integer: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
Real: { | ||
'is greater than': (from: string, to: string) => string[]; | ||
'is greater than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
'is less than': (from: string, to: string) => string[]; | ||
'is less than or equal to': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -27,0 +21,0 @@ }; |
@@ -19,5 +19,3 @@ export declare const types: { | ||
contains: (from: string, to: string) => string[]; | ||
'is contained in': (from: string, to: string) => string[]; | ||
'is equal to': (from: string, to: string) => string[]; | ||
equals: (from: string, to: string) => string[]; | ||
}; | ||
@@ -24,0 +22,0 @@ }; |
@@ -24,3 +24,2 @@ "use strict"; | ||
contains: (from, to) => ['Contains', from, to], | ||
'is contained in': (from, to) => ['Contains', to, from], | ||
}, | ||
@@ -27,0 +26,0 @@ }; |
{ | ||
"name": "@balena/sbvr-types", | ||
"version": "3.4.0", | ||
"version": "3.4.1-remove-synonymous-verbs-64e889f7bda6f3dcf4c539248e737fef26b5686c", | ||
"description": "SBVR type definitions.", | ||
@@ -5,0 +5,0 @@ "main": "out", |
@@ -145,9 +145,5 @@ ## sbvr-types | ||
'Integer': | ||
'is greater than': (from, to) -> ['GreaterThan', from, to] | ||
'is greater than or equal to': (from, to) -> ['GreaterThanOrEqual', from, to] | ||
'is less than': (from, to) -> ['LessThan', from, to] | ||
'is less than or equal to': (from, to) -> ['LessThanOrEqual', from, to] | ||
'Real': | ||
'is greater than': (from, to) -> ['GreaterThan', from, to] | ||
'is greater than or equal to': (from, to) -> ['GreaterThanOrEqual', from, to] | ||
'is less than': (from, to) -> ['LessThan', from, to] | ||
@@ -157,5 +153,7 @@ 'is less than or equal to': (from, to) -> ['LessThanOrEqual', from, to] | ||
Note: You only need to specify the verb for the canonical for of the fact type, any synonymous forms will automatically be remapped to the canonical form | ||
### Tests | ||
Tests can be found under the `test/` folder, to run the whole suite use `npm test` |
@@ -20,3 +20,2 @@ export interface DatabaseTypeFn { | ||
const equality = (from: string, to: string) => ['Equals', from, to]; | ||
const checkRequired = <T>(validateFn: (value: any) => T) => { | ||
@@ -38,14 +37,8 @@ function runCheck(value: any, required: true): Promise<T>; | ||
const equality = { | ||
'is equal to': (from: string, to: string) => ['Equals', from, to], | ||
}; | ||
export const nativeFactTypeTemplates = { | ||
equality: { | ||
'is equal to': equality, | ||
equals: equality, | ||
}, | ||
equality, | ||
comparison: { | ||
'is greater than': (from: string, to: string) => ['GreaterThan', from, to], | ||
'is greater than or equal to': (from: string, to: string) => [ | ||
'GreaterThanOrEqual', | ||
from, | ||
to, | ||
], | ||
'is less than': (from: string, to: string) => ['LessThan', from, to], | ||
@@ -57,4 +50,3 @@ 'is less than or equal to': (from: string, to: string) => [ | ||
], | ||
'is equal to': equality, | ||
equals: equality, | ||
...equality, | ||
}, | ||
@@ -61,0 +53,0 @@ }; |
@@ -23,3 +23,2 @@ import * as TypeUtils from '../type-utils'; | ||
'is before': (from: string, to: string) => ['LessThan', from, to], | ||
'is after': (from: string, to: string) => ['GreaterThan', from, to], | ||
}, | ||
@@ -26,0 +25,0 @@ }; |
@@ -23,3 +23,2 @@ import * as TypeUtils from '../type-utils'; | ||
'is before': (from: string, to: string) => ['LessThan', from, to], | ||
'is after': (from: string, to: string) => ['GreaterThan', from, to], | ||
}, | ||
@@ -26,0 +25,0 @@ }; |
@@ -24,3 +24,2 @@ import * as TypeUtils from '../type-utils'; | ||
contains: (from: string, to: string) => ['Contains', from, to], | ||
'is contained in': (from: string, to: string) => ['Contains', to, from], | ||
}, | ||
@@ -27,0 +26,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99852
1618
2
158