@balena/sbvr-types
Advanced tools
Comparing version 4.0.0-true-boolean-b7f3cfd557e03ea393d45f76cf8152b03a77e431 to 4.0.0-v4-99cdcc0b418c931c3a1c71109da12ed4c12e4c90-1
@@ -8,6 +8,73 @@ # Change Log | ||
# v4.0.0 | ||
## (2021-05-03) | ||
## (2022-11-25) | ||
* Switch `Boolean` to use `BOOLEAN` db type instead of `INTEGER` [Pagan Gazzard] | ||
* Assert that JSON input typeof is object [Josh Bowling] | ||
# v3.4.15 | ||
## (2022-11-18) | ||
* Dev: Migrate husky setup for v8 [Josh Bowling] | ||
# v3.4.14 | ||
## (2022-11-17) | ||
* Update dependency mocha to 10.1.0 [Renovate Bot] | ||
# v3.4.13 | ||
## (2022-11-17) | ||
* Update dependency lint-staged to 13.0.3 [Renovate Bot] | ||
# v3.4.12 | ||
## (2022-11-17) | ||
* Update dependency husky to 8.0.2 [Renovate Bot] | ||
# v3.4.11 | ||
## (2022-11-17) | ||
* Dev: Add lint-fix npm script [Josh Bowling] | ||
# v3.4.10 | ||
## (2022-11-17) | ||
* Dev: Move type deps to dev [Josh Bowling] | ||
# v3.4.9 | ||
## (2022-11-17) | ||
* Add .npmrc [Josh Bowling] | ||
# v3.4.8 | ||
## (2022-10-14) | ||
* Switch from balenaCI to flowzone [Pagan Gazzard] | ||
# v3.4.7 | ||
## (2022-04-08) | ||
* Update dependencies [Pagan Gazzard] | ||
* Remove circleci [Pagan Gazzard] | ||
# v3.4.6 | ||
## (2021-09-21) | ||
* Avoid creating a new Date object when we already have one [Pagan Gazzard] | ||
# v3.4.5 | ||
## (2021-09-07) | ||
* Convert tests to type checked javascript [Pagan Gazzard] | ||
# v3.4.4 | ||
## (2021-06-30) | ||
* Delete CODEOWNERS [Thodoris Greasidis] | ||
# v3.4.3 | ||
## (2021-05-11) | ||
* Support boolean results from the db as well as integer [Pagan Gazzard] | ||
# v3.4.2 | ||
@@ -14,0 +81,0 @@ ## (2021-03-22) |
@@ -5,3 +5,3 @@ export interface DatabaseTypeFn { | ||
} | ||
export declare type DatabaseType = string | DatabaseTypeFn; | ||
export type DatabaseType = string | DatabaseTypeFn; | ||
export interface SbvrType { | ||
@@ -41,3 +41,3 @@ types: { | ||
}; | ||
text: (length?: number | undefined) => { | ||
text: (length?: number) => { | ||
(value: any, required: true): Promise<string>; | ||
@@ -44,0 +44,0 @@ (value: undefined | null, required: false): Promise<null>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const TypeUtils = require("../type-utils"); | ||
const typeFunc = (necessity, index, defaultValue = ' DEFAULT 0') => 'BOOLEAN' + defaultValue + necessity + index; | ||
const typeFunc = (necessity, index, defaultValue = ' DEFAULT FALSE') => 'BOOLEAN' + defaultValue + necessity + index; | ||
typeFunc.castType = 'BOOLEAN'; | ||
@@ -8,0 +8,0 @@ exports.types = { |
@@ -14,6 +14,6 @@ "use strict"; | ||
const fetchProcessing = (data) => { | ||
if (data != null) { | ||
return new Date(data); | ||
if (data == null || data instanceof Date) { | ||
return data; | ||
} | ||
return data; | ||
return new Date(data); | ||
}; | ||
@@ -20,0 +20,0 @@ exports.fetchProcessing = fetchProcessing; |
@@ -14,6 +14,6 @@ "use strict"; | ||
const fetchProcessing = (data) => { | ||
if (data != null) { | ||
return new Date(data); | ||
if (data == null || data instanceof Date) { | ||
return data; | ||
} | ||
return data; | ||
return new Date(data); | ||
}; | ||
@@ -20,0 +20,0 @@ exports.fetchProcessing = fetchProcessing; |
@@ -16,2 +16,5 @@ "use strict"; | ||
exports.validate = TypeUtils.validate.checkRequired((value) => { | ||
if (typeof value !== 'object') { | ||
throw new Error(`is not an object/array: ${typeof value}`); | ||
} | ||
try { | ||
@@ -18,0 +21,0 @@ return JSON.stringify(value); |
{ | ||
"name": "@balena/sbvr-types", | ||
"version": "4.0.0-true-boolean-b7f3cfd557e03ea393d45f76cf8152b03a77e431", | ||
"version": "4.0.0-v4-99cdcc0b418c931c3a1c71109da12ed4c12e4c90-1", | ||
"description": "SBVR type definitions.", | ||
"main": "out", | ||
"scripts": { | ||
"lint": "balena-lint test && balena-lint --typescript src", | ||
"pretest": "npm run lint && npm run prepare", | ||
"lint": "balena-lint -e js -e ts src test && npx tsc --noEmit --project tsconfig.js.json", | ||
"lint-fix": "balena-lint --fix -e js -e ts src test", | ||
"pretest": "npm run prepare", | ||
"test": "mocha", | ||
"posttest": "npm run lint", | ||
"prepublish": "require-npm4-to-publish", | ||
"prepare": "tsc", | ||
"prettify": "balena-lint --typescript --fix src" | ||
"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\" && tsc", | ||
"prettify": "balena-lint -e js -e ts --fix src test" | ||
}, | ||
@@ -17,8 +19,5 @@ "repository": "https://github.com/balena-io-modules/sbvr-types.git", | ||
"license": "BSD", | ||
"dependencies": { | ||
"@types/bcrypt": "^3.0.1", | ||
"@types/sha.js": "^2.4.0" | ||
}, | ||
"dependencies": {}, | ||
"optionalDependencies": { | ||
"bcrypt": "^5.0.0", | ||
"bcrypt": "^5.0.1", | ||
"bcryptjs": "^2.4.3", | ||
@@ -28,27 +27,28 @@ "sha.js": "^2.4.11" | ||
"devDependencies": { | ||
"@balena/lint": "^5.4.2", | ||
"@types/lodash": "^4.14.168", | ||
"@balena/lint": "^6.2.0", | ||
"@types/bcrypt": "^5.0.0", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/chai-datetime": "^0.0.37", | ||
"@types/lodash": "^4.14.181", | ||
"@types/mocha": "^10.0.0", | ||
"@types/sha.js": "^2.4.0", | ||
"bluebird": "^3.7.2", | ||
"chai": "^4.3.4", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-datetime": "^1.8.0", | ||
"coffeescript": "^2.5.1", | ||
"husky": "^4.3.8", | ||
"lint-staged": "^10.5.4", | ||
"husky": "^8.0.0", | ||
"lint-staged": "^13.0.0", | ||
"lodash": "^4.17.21", | ||
"mocha": "^8.3.2", | ||
"mocha": "^10.0.0", | ||
"require-npm4-to-publish": "^1.0.0", | ||
"typescript": "^4.2.4" | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
"balena-lint --typescript --fix" | ||
"balena-lint --fix" | ||
], | ||
"*.coffee": [ | ||
"balena-lint" | ||
"*.js": [ | ||
"balena-lint --fix" | ||
] | ||
@@ -59,5 +59,8 @@ }, | ||
"recursive": true, | ||
"require": "coffeescript/register", | ||
"_": "test/**/*.coffee" | ||
"require": "ts-node/register/transpile-only", | ||
"_": "test/**/*.js" | ||
}, | ||
"versionist": { | ||
"publishedAt": "2022-11-25T15:01:03.492Z" | ||
} | ||
} |
@@ -6,3 +6,3 @@ import * as TypeUtils from '../type-utils'; | ||
index: string, | ||
defaultValue = ' DEFAULT 0', | ||
defaultValue = ' DEFAULT FALSE', | ||
) => 'BOOLEAN' + defaultValue + necessity + index; | ||
@@ -9,0 +9,0 @@ typeFunc.castType = 'BOOLEAN'; |
@@ -13,6 +13,6 @@ import * as TypeUtils from '../type-utils'; | ||
export const fetchProcessing = (data: any) => { | ||
if (data != null) { | ||
return new Date(data); | ||
if (data == null || data instanceof Date) { | ||
return data; | ||
} | ||
return data; | ||
return new Date(data); | ||
}; | ||
@@ -19,0 +19,0 @@ |
@@ -13,6 +13,6 @@ import * as TypeUtils from '../type-utils'; | ||
export const fetchProcessing = (data: any) => { | ||
if (data != null) { | ||
return new Date(data); | ||
if (data == null || data instanceof Date) { | ||
return data; | ||
} | ||
return data; | ||
return new Date(data); | ||
}; | ||
@@ -19,0 +19,0 @@ |
@@ -30,5 +30,5 @@ import * as TypeUtils from '../type-utils'; | ||
return new Buffer(value, 'hex'); | ||
} catch (e) { | ||
} catch (e: any) { | ||
throw new Error(`could not be converted to binary: ${e.message}`); | ||
} | ||
}); |
@@ -15,2 +15,7 @@ import * as TypeUtils from '../type-utils'; | ||
export const validate = TypeUtils.validate.checkRequired((value) => { | ||
// Disallow primitives | ||
if (typeof value !== 'object') { | ||
throw new Error(`is not an object/array: ${typeof value}`); | ||
} | ||
try { | ||
@@ -17,0 +22,0 @@ return JSON.stringify(value); |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2018", | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"noUnusedParameters": true, | ||
"noUnusedLocals": true, | ||
"outDir": "out/", | ||
"preserveConstEnums": true, | ||
"removeComments": true, | ||
"rootDir": "src", | ||
"sourceMap": true, | ||
"target": "es2018", | ||
"declaration": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true | ||
"rootDir": "src", | ||
"outDir": "out", | ||
"allowJs": true | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
"src/**/*" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
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
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
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
108028
3
93
1644
19
- Removed@types/bcrypt@^3.0.1
- Removed@types/sha.js@^2.4.0
- Removed@types/bcrypt@3.0.1(transitive)
- Removed@types/node@22.10.5(transitive)
- Removed@types/sha.js@2.4.4(transitive)
- Removedundici-types@6.20.0(transitive)