mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-6019] [ACS-6021] [ACS-6023] Replaced request with node-fetch (#8999)
* [ACS-6019] Replaced request with node-fetch * [ACS-6019] [Non-Functional Change] Added documentation to peopleSelected event emitter - Change to trigger affected E2Es * [ACS-6019] Added return type to getFileFromRemote function. Removed request dependencies from package.json * [ACS-6019] Commit package-lock.json * [ACS-6019] Testing node-fetch v2 * [ACS-6019] Commiting package-lock.json
This commit is contained in:
parent
82fafff114
commit
ef285a1f10
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import program from 'commander';
|
||||
import request = require('request');
|
||||
import fetch from 'node-fetch';
|
||||
import * as fs from 'fs';
|
||||
import { logger } from './logger';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
@ -664,18 +664,29 @@ function findFailingApps(deployedApps: any[]): any[] {
|
||||
* @param url url to file
|
||||
* @param name name
|
||||
*/
|
||||
async function getFileFromRemote(url: string, name: string) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
request(url)
|
||||
.pipe(fs.createWriteStream(`${name}.zip`))
|
||||
.on('finish', () => {
|
||||
async function getFileFromRemote(url: string, name: string): Promise<void> {
|
||||
return fetch(url)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.then((response) => new Promise<void>((resolve, reject) => {
|
||||
const outputFile = fs.createWriteStream(`${name}.zip`);
|
||||
response.body.pipe(outputFile);
|
||||
outputFile.on('finish', () => {
|
||||
logger.info(`The file is finished downloading.`);
|
||||
resolve();
|
||||
})
|
||||
.on('error', (error: any) => {
|
||||
});
|
||||
outputFile.on('error', (error) => {
|
||||
logger.error(`Not possible to download the project form remote`);
|
||||
reject(error);
|
||||
});
|
||||
}))
|
||||
.catch((error) => {
|
||||
logger.error(`Failed to fetch file from remote: ${error.message}`);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
@ViewChild('inputValue', { static: true })
|
||||
input: ElementRef;
|
||||
|
||||
/** Emitted when a valid user has been highlighted */
|
||||
@Output()
|
||||
peopleSelected: EventEmitter<number> = new EventEmitter();
|
||||
|
||||
|
75
package-lock.json
generated
75
package-lock.json
generated
@ -48,9 +48,9 @@
|
||||
"monaco-editor": "^0.33.0",
|
||||
"ng2-charts": "^4.1.1",
|
||||
"ngx-monaco-editor-v2": "^14.0.4",
|
||||
"node-fetch": "^2.7.0",
|
||||
"pdfjs-dist": "3.3.122",
|
||||
"raphael": "2.3.0",
|
||||
"request": "^2.88.2",
|
||||
"rxjs": "6.6.6",
|
||||
"subscriptions-transport-ws": "^0.11.0",
|
||||
"tslib": "^2.6.2",
|
||||
@ -86,7 +86,6 @@
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/node": "18.0.0",
|
||||
"@types/pdfjs-dist": "^2.10.378",
|
||||
"@types/request": "^2.48.9",
|
||||
"@types/selenium-webdriver": "^4.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "5.59.8",
|
||||
"@typescript-eslint/parser": "5.62.0",
|
||||
@ -23075,12 +23074,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/caseless": {
|
||||
"version": "0.12.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.3.tgz",
|
||||
"integrity": "sha512-ZD/NsIJYq/2RH+hY7lXmstfp/v9djGt9ah+xRQ3pcgR79qiKsG4pLl25AI7IcXxVO8dH9GiBE5rAknC0ePntlw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/connect": {
|
||||
"version": "3.4.35",
|
||||
"dev": true,
|
||||
@ -23352,32 +23345,6 @@
|
||||
"@types/react": "^16"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/request": {
|
||||
"version": "2.48.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.9.tgz",
|
||||
"integrity": "sha512-4mi2hYsvPAhe8RXjk5DKB09sAUzbK68T2XjORehHdWyxFoX2zUnfi1VQ5wU4Md28H/5+uB4DkxY9BS4B87N/0A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/caseless": "*",
|
||||
"@types/node": "*",
|
||||
"@types/tough-cookie": "*",
|
||||
"form-data": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/request/node_modules/form-data": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/resolve": {
|
||||
"version": "1.17.1",
|
||||
"dev": true,
|
||||
@ -23456,12 +23423,6 @@
|
||||
"version": "1.0.8",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.3.tgz",
|
||||
"integrity": "sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/uglify-js": {
|
||||
"version": "3.17.1",
|
||||
"license": "MIT",
|
||||
@ -25141,6 +25102,7 @@
|
||||
},
|
||||
"node_modules/asn1": {
|
||||
"version": "0.2.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": "~2.1.0"
|
||||
@ -25170,6 +25132,7 @@
|
||||
},
|
||||
"node_modules/assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
@ -25298,6 +25261,7 @@
|
||||
},
|
||||
"node_modules/aws-sign2": {
|
||||
"version": "0.7.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
@ -25305,6 +25269,7 @@
|
||||
},
|
||||
"node_modules/aws4": {
|
||||
"version": "1.12.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
@ -25773,6 +25738,7 @@
|
||||
},
|
||||
"node_modules/bcrypt-pbkdf": {
|
||||
"version": "1.0.2",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"tweetnacl": "^0.14.3"
|
||||
@ -26916,6 +26882,7 @@
|
||||
},
|
||||
"node_modules/caseless": {
|
||||
"version": "0.12.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/ccount": {
|
||||
@ -29035,6 +29002,7 @@
|
||||
},
|
||||
"node_modules/dashdash": {
|
||||
"version": "1.14.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"assert-plus": "^1.0.0"
|
||||
@ -30216,6 +30184,7 @@
|
||||
},
|
||||
"node_modules/ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jsbn": "~0.1.0",
|
||||
@ -31936,6 +31905,7 @@
|
||||
},
|
||||
"node_modules/extsprintf": {
|
||||
"version": "1.3.0",
|
||||
"dev": true,
|
||||
"engines": [
|
||||
"node >=0.6.0"
|
||||
],
|
||||
@ -32468,6 +32438,7 @@
|
||||
},
|
||||
"node_modules/forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
@ -32905,6 +32876,7 @@
|
||||
},
|
||||
"node_modules/getpass": {
|
||||
"version": "0.1.7",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"assert-plus": "^1.0.0"
|
||||
@ -33211,6 +33183,7 @@
|
||||
},
|
||||
"node_modules/har-schema": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
@ -33218,6 +33191,7 @@
|
||||
},
|
||||
"node_modules/har-validator": {
|
||||
"version": "5.1.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.3",
|
||||
@ -33229,6 +33203,7 @@
|
||||
},
|
||||
"node_modules/har-validator/node_modules/ajv": {
|
||||
"version": "6.12.6",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
@ -33243,6 +33218,7 @@
|
||||
},
|
||||
"node_modules/har-validator/node_modules/json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/hard-rejection": {
|
||||
@ -33953,6 +33929,7 @@
|
||||
},
|
||||
"node_modules/http-signature": {
|
||||
"version": "1.2.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"assert-plus": "^1.0.0",
|
||||
@ -35112,6 +35089,7 @@
|
||||
},
|
||||
"node_modules/isstream": {
|
||||
"version": "0.1.2",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/istanbul-lib-coverage": {
|
||||
@ -37887,6 +37865,7 @@
|
||||
},
|
||||
"node_modules/jsbn": {
|
||||
"version": "0.1.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsdoc-type-pratt-parser": {
|
||||
@ -38081,6 +38060,7 @@
|
||||
},
|
||||
"node_modules/json-schema": {
|
||||
"version": "0.4.0",
|
||||
"dev": true,
|
||||
"license": "(AFL-2.1 OR BSD-3-Clause)"
|
||||
},
|
||||
"node_modules/json-schema-traverse": {
|
||||
@ -38094,6 +38074,7 @@
|
||||
},
|
||||
"node_modules/json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/json5": {
|
||||
@ -38131,6 +38112,7 @@
|
||||
},
|
||||
"node_modules/jsprim": {
|
||||
"version": "1.4.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"assert-plus": "1.0.0",
|
||||
@ -41202,6 +41184,7 @@
|
||||
},
|
||||
"node_modules/oauth-sign": {
|
||||
"version": "0.9.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
@ -42156,6 +42139,7 @@
|
||||
},
|
||||
"node_modules/performance-now": {
|
||||
"version": "2.1.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
@ -44228,6 +44212,7 @@
|
||||
},
|
||||
"node_modules/psl": {
|
||||
"version": "1.9.0",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/public-encrypt": {
|
||||
@ -45276,6 +45261,7 @@
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
|
||||
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
|
||||
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
@ -45304,6 +45290,7 @@
|
||||
},
|
||||
"node_modules/request/node_modules/form-data": {
|
||||
"version": "2.3.3",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
@ -45316,6 +45303,7 @@
|
||||
},
|
||||
"node_modules/request/node_modules/qs": {
|
||||
"version": "6.5.3",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
@ -45323,6 +45311,7 @@
|
||||
},
|
||||
"node_modules/request/node_modules/uuid": {
|
||||
"version": "3.4.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "bin/uuid"
|
||||
@ -47179,6 +47168,7 @@
|
||||
},
|
||||
"node_modules/sshpk": {
|
||||
"version": "1.17.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asn1": "~0.2.3",
|
||||
@ -48782,6 +48772,7 @@
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.28",
|
||||
@ -49176,6 +49167,7 @@
|
||||
},
|
||||
"node_modules/tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
@ -49186,6 +49178,7 @@
|
||||
},
|
||||
"node_modules/tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"dev": true,
|
||||
"license": "Unlicense"
|
||||
},
|
||||
"node_modules/type": {
|
||||
@ -49863,6 +49856,7 @@
|
||||
},
|
||||
"node_modules/verror": {
|
||||
"version": "1.10.0",
|
||||
"dev": true,
|
||||
"engines": [
|
||||
"node >=0.6.0"
|
||||
],
|
||||
@ -49875,6 +49869,7 @@
|
||||
},
|
||||
"node_modules/verror/node_modules/core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vfile": {
|
||||
|
@ -92,9 +92,9 @@
|
||||
"monaco-editor": "^0.33.0",
|
||||
"ng2-charts": "^4.1.1",
|
||||
"ngx-monaco-editor-v2": "^14.0.4",
|
||||
"node-fetch": "^2.7.0",
|
||||
"pdfjs-dist": "3.3.122",
|
||||
"raphael": "2.3.0",
|
||||
"request": "^2.88.2",
|
||||
"rxjs": "6.6.6",
|
||||
"subscriptions-transport-ws": "^0.11.0",
|
||||
"tslib": "^2.6.2",
|
||||
@ -130,7 +130,6 @@
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/node": "18.0.0",
|
||||
"@types/pdfjs-dist": "^2.10.378",
|
||||
"@types/request": "^2.48.9",
|
||||
"@types/selenium-webdriver": "^4.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "5.59.8",
|
||||
"@typescript-eslint/parser": "5.62.0",
|
||||
@ -229,4 +228,3 @@
|
||||
"module": "./index.js",
|
||||
"typings": "./index.d.ts"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user