Fix parsing of not-really-numeric device UUID parameters

Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
This commit is contained in:
Paulo Castro 2019-02-22 15:26:43 +00:00
parent 2ffb9bb574
commit 0bff122b1c
4 changed files with 8 additions and 6 deletions

View File

@ -165,7 +165,7 @@ export class DeviceAPI {
}
}
return Bluebird.fromCallback(
return Bluebird.fromCallback<[request.Response, { message: string }]>(
cb => {
return requestMethod(opts, cb);
},

View File

@ -21,6 +21,7 @@ export function normalizeUuidProp(
propName = 'uuid',
) {
if (_.isNumber(params[propName])) {
params[propName] = _.toString(params[propName]);
params[propName] =
params[propName + '_raw'] || _.toString(params[propName]);
}
}

View File

@ -6,7 +6,7 @@ import * as rindle from 'rindle';
export async function executeWithPrivileges(
command: string[],
stderr?: NodeJS.WritableStream,
): Promise<void> {
): Promise<string> {
const opts = {
stdio: ['inherit', 'inherit', stderr ? 'pipe' : 'inherit'],
env: process.env,
@ -22,5 +22,5 @@ export async function executeWithPrivileges(
ps.stderr.pipe(stderr);
}
return Bluebird.fromCallback(resolver => rindle.wait(ps, resolver));
return Bluebird.fromCallback<string>(callback => rindle.wait(ps, callback));
}

View File

@ -64,7 +64,7 @@
},
"devDependencies": {
"@types/archiver": "2.1.2",
"@types/bluebird": "3.5.19",
"@types/bluebird": "3.5.21",
"@types/common-tags": "1.4.0",
"@types/es6-promise": "0.0.32",
"@types/fs-extra": "5.0.4",
@ -97,6 +97,7 @@
"@resin.io/valid-email": "^0.1.0",
"@types/dockerode": "2.5.5",
"@types/mixpanel": "2.14.0",
"@types/request": "2.48.1",
"@types/stream-to-promise": "2.2.0",
"@types/through2": "^2.0.33",
"@zeit/dockerignore": "0.0.3",
@ -114,7 +115,7 @@
"bash": "0.0.1",
"bluebird": "^3.3.3",
"body-parser": "^1.14.1",
"capitano": "^1.8.2",
"capitano": "^1.9.0",
"chalk": "^2.3.0",
"cli-truncate": "^1.1.0",
"coffeescript": "^1.12.6",