mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-21 22:47:49 +00:00
Update pinejs-client-request and make use of a named key
Update pinejs-client-request from 7.0.0 to 7.1.0 Change-type: patch
This commit is contained in:
parent
02cb6d8d75
commit
511cbbe74e
68
package-lock.json
generated
68
package-lock.json
generated
@ -1604,7 +1604,7 @@
|
||||
},
|
||||
"util": {
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
|
||||
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -1704,14 +1704,6 @@
|
||||
"@types/semver": "^7.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"semver": "^7.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz",
|
||||
"integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
@ -3699,7 +3691,7 @@
|
||||
},
|
||||
"stream-combiner": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
|
||||
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
|
||||
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
|
||||
"requires": {
|
||||
"duplexer": "~0.1.1",
|
||||
@ -3886,7 +3878,7 @@
|
||||
},
|
||||
"stream-combiner": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
|
||||
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
|
||||
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -4258,7 +4250,7 @@
|
||||
},
|
||||
"event-stream": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
|
||||
"resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
|
||||
"integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -7782,7 +7774,7 @@
|
||||
},
|
||||
"map-stream": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
|
||||
"integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=",
|
||||
"dev": true
|
||||
},
|
||||
@ -7980,7 +7972,7 @@
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
},
|
||||
@ -8129,7 +8121,7 @@
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"dev": true
|
||||
},
|
||||
@ -9074,34 +9066,34 @@
|
||||
"dev": true
|
||||
},
|
||||
"pinejs-client-core": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pinejs-client-core/-/pinejs-client-core-6.0.0.tgz",
|
||||
"integrity": "sha512-nw2bMdi0qQmqMfRTKF3NssFxS7hwl6FYDeqUyHgFPhS9YZKvplEc06uCEB51YgmDfvDVfTgQb4Giq52exBjUqg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pinejs-client-core/-/pinejs-client-core-6.1.0.tgz",
|
||||
"integrity": "sha512-sp9/LYOOsJuYtlp8d8gR3QqW/oZNN/WEb1UhNJJqRMawNh/LBQRCP3TXCkBwhVmTcH3kYsopj/oCc4Gei+htkQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@balena/es-version": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"pinejs-client-request": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pinejs-client-request/-/pinejs-client-request-7.0.0.tgz",
|
||||
"integrity": "sha512-UF2g3/IpG9AZJhGxHop9F9CyykZXdJTAOdnw2dCj8ZhIm5lAL+XQTuhi2jyqkyb2SuS1P4q35B7rW4AIyy/iSg==",
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pinejs-client-request/-/pinejs-client-request-7.1.0.tgz",
|
||||
"integrity": "sha512-BZmBLfiS+C/dfA07GYNJDz3oqj8G7mBC0kL36PRD9kDWjYZHd4RSOSgGOae/S8/NnxeQheQ0xtnqNDcamTlpcA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/lodash": "^4.14.155",
|
||||
"@types/lodash": "^4.14.158",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"@types/request": "^2.48.5",
|
||||
"lodash": "^4.17.15",
|
||||
"lru-cache": "^5.1.1",
|
||||
"pinejs-client-core": "^6.0.0",
|
||||
"lodash": "^4.17.19",
|
||||
"lru-cache": "^6.0.0",
|
||||
"pinejs-client-core": "^6.1.0",
|
||||
"request": "^2.88.2",
|
||||
"typed-error": "^3.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/lodash": {
|
||||
"version": "4.14.155",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.155.tgz",
|
||||
"integrity": "sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==",
|
||||
"version": "4.14.158",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.158.tgz",
|
||||
"integrity": "sha512-InCEXJNTv/59yO4VSfuvNrZHt7eeNtWQEgnieIA+mIC+MOWM9arOWG2eQ8Vhk6NbOre6/BidiXhkZYeDY9U35w==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/request": {
|
||||
@ -9117,12 +9109,12 @@
|
||||
}
|
||||
},
|
||||
"lru-cache": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
|
||||
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"yallist": "^3.0.2"
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"typed-error": {
|
||||
@ -9130,6 +9122,12 @@
|
||||
"resolved": "https://registry.npmjs.org/typed-error/-/typed-error-3.2.0.tgz",
|
||||
"integrity": "sha512-n0NojMTp7jD2MMgJxtjzS1it/sKIlDfQwqOECSPAGwsIU2jns3G0R6alnakRelQzxz7t8PhjYrlqYoQKUVGOsQ==",
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -9484,7 +9482,7 @@
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
@ -10339,7 +10337,7 @@
|
||||
},
|
||||
"split": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz",
|
||||
"integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -10444,7 +10442,7 @@
|
||||
},
|
||||
"stream-combiner": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
|
||||
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
|
||||
"integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -102,7 +102,7 @@
|
||||
"mz": "^2.7.0",
|
||||
"network-checker": "^0.1.1",
|
||||
"nodemon": "^2.0.2",
|
||||
"pinejs-client-request": "^7.0.0",
|
||||
"pinejs-client-request": "^7.1.0",
|
||||
"pretty-ms": "^5.1.0",
|
||||
"request": "^2.88.2",
|
||||
"resin-cli-visuals": "^1.5.2",
|
||||
|
@ -243,20 +243,6 @@ export class APIBinder {
|
||||
apiKey: string,
|
||||
timeout: number,
|
||||
): Promise<Device | null> {
|
||||
const reqOpts = {
|
||||
resource: 'device',
|
||||
options: {
|
||||
$filter: {
|
||||
uuid,
|
||||
},
|
||||
},
|
||||
passthrough: {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (this.balenaApi == null) {
|
||||
throw new InternalInconsistencyError(
|
||||
'fetchDevice called without an initialized API client',
|
||||
@ -264,10 +250,19 @@ export class APIBinder {
|
||||
}
|
||||
|
||||
try {
|
||||
const res = (await Bluebird.resolve(this.balenaApi.get(reqOpts)).timeout(
|
||||
timeout,
|
||||
)) as Device[];
|
||||
return res[0];
|
||||
return (await Bluebird.resolve(
|
||||
this.balenaApi.get({
|
||||
resource: 'device',
|
||||
id: {
|
||||
uuid,
|
||||
},
|
||||
passthrough: {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
},
|
||||
}),
|
||||
).timeout(timeout)) as Device;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -30,10 +30,7 @@ api.balenaBackend = {
|
||||
}
|
||||
},
|
||||
getDeviceHandler: (req, res) => {
|
||||
const uuid =
|
||||
req.query['$filter'] != null
|
||||
? req.query['$filter'].match(/uuid eq '(.*)'/)[1]
|
||||
: null;
|
||||
const uuid = req.params[0];
|
||||
if (uuid != null) {
|
||||
return res.json({
|
||||
d: _.filter(api.balenaBackend!.devices, (dev) => dev.uuid === uuid),
|
||||
@ -51,7 +48,7 @@ api.post('/device/register', (req, res) =>
|
||||
api.balenaBackend!.registerHandler(req, res, _.noop),
|
||||
);
|
||||
|
||||
api.get('/v6/device', (req, res) =>
|
||||
api.get(/\/v6\/device\(uuid=%27([0-9a-f]+)%27\)/, (req, res) =>
|
||||
api.balenaBackend!.getDeviceHandler(req, res, _.noop),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user