From c15f77434ba3b957dc55f5df207026eb2028bd57 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Tue, 16 Jun 2020 12:16:48 +0100 Subject: [PATCH] Update pinejs-client-request to 7.x Update pinejs-client-request from 5.2.0 to 7.0.0 Change-type: patch --- package-lock.json | 132 +++++++++++++++++++++++----------------------- package.json | 4 +- repo.yml | 4 ++ src/api-binder.ts | 20 +++---- webpack.config.js | 4 ++ 5 files changed, 87 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77fee9ca..1093990c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -189,6 +189,12 @@ } } }, + "@balena/es-version": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@balena/es-version/-/es-version-1.0.0.tgz", + "integrity": "sha512-o3/sRDyrXC75BUUziMAs+W5C02aVST0YqY5Ny31Ot3a+7CzK2XDRinMGywvK93tm2QVdL83HGkN483S62Xo9Dw==", + "dev": true + }, "@balena/lint": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.1.0.tgz", @@ -436,12 +442,6 @@ "@types/node": "*" } }, - "@types/es6-collections": { - "version": "0.5.31", - "resolved": "https://registry.npmjs.org/@types/es6-collections/-/es6-collections-0.5.31.tgz", - "integrity": "sha512-djEvbdTH5Uw7V0WqdMQLG4NK3+iu/FMZy/ylyhWEFnW5xOsXEWpivo/dhP+cR43Az+ipytza7dTSnpsWCxKYAw==", - "dev": true - }, "@types/event-stream": { "version": "3.3.34", "resolved": "https://registry.npmjs.org/@types/event-stream/-/event-stream-3.3.34.tgz", @@ -532,6 +532,12 @@ "integrity": "sha512-Zst90IcBX5wnwSu7CAS0vvJkTjTELY4ssKbHiTnGcJgi170uiS8yQDdc3v6S77bRqYQIN1App5a1Pc2lceE5/g==", "dev": true }, + "@types/lru-cache": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz", + "integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==", + "dev": true + }, "@types/memoizee": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/@types/memoizee/-/memoizee-0.4.4.tgz", @@ -1838,28 +1844,6 @@ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", "dev": true }, - "bluebird-lru-cache": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-1.0.1.tgz", - "integrity": "sha512-HdQ6UO5vSXG5qK/pE9srZTHCsvRzmzrn7g31XTcKq9JWMK0PG+LJ0mmR6LIYuXO5DeiR+DnLWMnMsYcd0WD2Bg==", - "dev": true, - "requires": { - "bluebird": "^3.0.6", - "lru-cache": "^3.2.0", - "typed-error": "^2.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz", - "integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=", - "dev": true, - "requires": { - "pseudomap": "^1.0.1" - } - } - } - }, "bn.js": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.1.tgz", @@ -6463,12 +6447,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "in-publish": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", - "integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E=", - "dev": true - }, "indent-string": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", @@ -9037,29 +9015,63 @@ "dev": true }, "pinejs-client-core": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/pinejs-client-core/-/pinejs-client-core-5.3.5.tgz", - "integrity": "sha512-GUHIVg7EUyNuPRGaQK/wTXM3FiNGVGYFH8QZcRBr+j79SocG5MytEgyYWOHynSlIlPBmVNy/3bbnOlbtOWnv9Q==", - "dev": true - }, - "pinejs-client-request": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/pinejs-client-request/-/pinejs-client-request-5.2.0.tgz", - "integrity": "sha512-CqmhLgfdjdT6RCduZ+hi5Ne6iVPHF0689IU6RQL7go57kZNcrIXyi6WvKZ6HFmDdZmCtuAv9i/Y0EmMWXhbGjw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pinejs-client-core/-/pinejs-client-core-6.0.0.tgz", + "integrity": "sha512-nw2bMdi0qQmqMfRTKF3NssFxS7hwl6FYDeqUyHgFPhS9YZKvplEc06uCEB51YgmDfvDVfTgQb4Giq52exBjUqg==", "dev": true, "requires": { - "@types/bluebird": "^3.5.23", - "@types/es6-collections": "^0.5.31", - "@types/lodash": "^4.14.104", - "@types/memoizee": "^0.4.2", - "@types/request": "^2.47.1", - "bluebird": "^3.0.6", - "bluebird-lru-cache": "^1.0.0", - "lodash": "^4.17.10", - "pinejs-client-core": "^5.3.1", - "request": "^2.88.0", - "require-npm4-to-publish": "^1.0.0", - "typed-error": "^2.0.0" + "@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==", + "dev": true, + "requires": { + "@types/lodash": "^4.14.155", + "@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", + "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==", + "dev": true + }, + "@types/request": { + "version": "2.48.5", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz", + "integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==", + "dev": true, + "requires": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + } + }, + "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==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "typed-error": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/typed-error/-/typed-error-3.2.0.tgz", + "integrity": "sha512-n0NojMTp7jD2MMgJxtjzS1it/sKIlDfQwqOECSPAGwsIU2jns3G0R6alnakRelQzxz7t8PhjYrlqYoQKUVGOsQ==", + "dev": true + } } }, "pkg-dir": { @@ -9573,16 +9585,6 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "require-npm4-to-publish": { - "version": "1.0.0", - "resolved": "http://registry.npmjs.org/require-npm4-to-publish/-/require-npm4-to-publish-1.0.0.tgz", - "integrity": "sha1-5Z7D5ikQFT3Fu90MpA20IrLE2ec=", - "dev": true, - "requires": { - "in-publish": "^2.0.0", - "semver": "^5.3.0" - } - }, "require-package-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/require-package-name/-/require-package-name-2.0.1.tgz", diff --git a/package.json b/package.json index 10fcce95..0cad76e9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "test:debug": "npm run test:build && TEST=1 mocha --inspect-brk", "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js", "test-build": "tsc --project tsconfig.json", - "release": "tsc --project tsconfig.release.json && cp -r build/src/* build && rm -rf build/src", + "release": "tsc --project tsconfig.release.json && mv build/src/* build", "packagejson:copy": "cp package.json build/", "testitems:copy": "cp -r test/data build/test/", "sync": "ts-node sync/sync.ts" @@ -101,7 +101,7 @@ "mz": "^2.7.0", "network-checker": "^0.1.1", "nodemon": "^2.0.2", - "pinejs-client-request": "^5.2.0", + "pinejs-client-request": "^7.0.0", "pretty-ms": "^5.1.0", "request": "^2.88.2", "resin-cli-visuals": "^1.5.2", diff --git a/repo.yml b/repo.yml index b7961c4a..c8eaed38 100644 --- a/repo.yml +++ b/repo.yml @@ -4,3 +4,7 @@ backports: next: 10.8.x current: 10.3.x sunset: 9.15.x + +upstream: + - repo: 'pinejs-client-request' + url: 'https://github.com/balena-io-modules/pinejs-client-request' diff --git a/src/api-binder.ts b/src/api-binder.ts index cbb17798..ed1085d2 100644 --- a/src/api-binder.ts +++ b/src/api-binder.ts @@ -283,9 +283,9 @@ export class APIBinder { } try { - const res = (await this.balenaApi - .get(reqOpts) - .timeout(timeout)) as Device[]; + const res = (await Bluebird.resolve(this.balenaApi.get(reqOpts)).timeout( + timeout, + )) as Device[]; return res[0]; } catch (e) { return null; @@ -313,13 +313,13 @@ export class APIBinder { ); } - return this.balenaApi - .patch({ + return Bluebird.resolve( + this.balenaApi.patch({ resource: 'device', id, body: updatedFields, - }) - .timeout(conf.apiTimeout); + }), + ).timeout(conf.apiTimeout); } public async provisionDependentDevice(device: Device): Promise { @@ -350,9 +350,9 @@ export class APIBinder { registered_at: Math.floor(Date.now() / 1000), }); - return (await this.balenaApi - .post({ resource: 'device', body: device }) - .timeout(conf.apiTimeout)) as Device; + return (await Bluebird.resolve( + this.balenaApi.post({ resource: 'device', body: device }), + ).timeout(conf.apiTimeout)) as Device; } public startCurrentStateReport() { diff --git a/webpack.config.js b/webpack.config.js index d0555a7b..e086a38c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -78,6 +78,10 @@ module.exports = function (env) { }, resolve: { extensions: ['.js', '.ts', '.json'], + alias: { + // Use the es2018 build instead of the default es2015 build + 'pinejs-client-core': 'pinejs-client-core/es2018', + }, }, target: 'node', node: {