refactor: remove node-fetch dependency and use native fetch API (#12097)

This commit is contained in:
Denys Vuika
2026-07-27 15:17:49 +00:00
committed by GitHub
parent e1f463aa8a
commit 03e6320bd2
6 changed files with 1612 additions and 1932 deletions
+8 -3
View File
@@ -18,8 +18,9 @@
*/
import { parseArgs } from 'node:util';
import fetch from 'node-fetch';
import * as fs from 'fs';
import { Readable } from 'node:stream';
import type { ReadableStream } from 'node:stream/web';
import { logger } from './logger';
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
import { argv, exit } from 'node:process';
@@ -682,14 +683,18 @@ async function getFileFromRemote(url: string, name: string): Promise<void> {
.then(
(response) =>
new Promise<void>((resolve, reject) => {
if (!response.body) {
reject(new Error('Response body is empty'));
return;
}
const outputFile = fs.createWriteStream(`${name}.zip`);
response.body.pipe(outputFile);
Readable.fromWeb(response.body as ReadableStream<Uint8Array>).pipe(outputFile);
outputFile.on('finish', () => {
logger.info(`The file is finished downloading.`);
resolve();
});
outputFile.on('error', (error) => {
logger.error(`Not possible to download the project form remote`);
logger.error(`Not possible to download the project from remote: ${error.message}`);
reject(error);
});
})
@@ -35,11 +35,11 @@ export class SearchChipListComponent {
facetFiltersService = inject(SearchFacetFiltersService);
/**
* Search filter to supply the data for the chips.
* Not required from 4.5.0 and later versions @deprecated
* @deprecated Search filter to supply the data for the chips.
* Not required from 4.5.0 and later versions
*/
@Input()
searchFilter: SearchFilterComponent;
searchFilter: SearchFilterComponent | undefined;
/** Flag used to enable the display of a clear-all-filters button. */
@Input()
@@ -20,7 +20,7 @@
*/
export interface RequestLocalization {
/**
* A valid timezone id supported by @see java.time.ZoneId
* A valid timezone id supported by {@link java.time.ZoneId}
*/
timezone?: string;
/**