Skip to content

Commit

Permalink
Removed cross-fetch dependency (#7026)
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaPolit authored Jul 22, 2024
1 parent 028d557 commit a1bfa8a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/api/i18n/specs/routes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'cross-fetch/polyfill';
import 'isomorphic-fetch';
import request from 'supertest';
import waitForExpect from 'wait-for-expect';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fetch from 'cross-fetch';
import 'isomorphic-fetch';
import backend from 'fetch-mock';
import { attachmentsPath, setupTestUploadedPaths } from 'api/files';
import { testingEnvironment } from 'api/utils/testingEnvironment';
import 'cross-fetch/polyfill';
// eslint-disable-next-line node/no-restricted-import
import { tenants } from 'api/tenants';
// eslint-disable-next-line node/no-restricted-import
Expand All @@ -11,11 +10,6 @@ import JSONRequest from 'shared/JSONRequest';
import { Readable } from 'stream';
import { convertToPDFService, MimeTypeNotSupportedForConversion } from '../convertToPdfService';

Object.assign(backend.config, {
Response,
fetch,
});

describe('ConvertToPDFService', () => {
const serviceURL = 'http://service.uwazi.io/';
beforeEach(async () => {
Expand Down
6 changes: 0 additions & 6 deletions app/api/services/ocr/specs/OcrManager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable max-statements */
/* eslint-disable max-lines */
import fetch from 'cross-fetch';
import fetchMock from 'fetch-mock';
import { files, storage } from 'api/files';
import * as filesApi from 'api/files/filesystem';
Expand All @@ -21,11 +20,6 @@ import { cleanupRecordsOfFiles } from '../ocrRecords';

jest.mock('api/services/tasksmanager/TaskManager.ts');

Object.assign(fetchMock.config, {
Response,
fetch,
});

class Mocks {
jestMocks: { [k: string]: jest.SpyInstance };

Expand Down
6 changes: 0 additions & 6 deletions app/api/services/preserve/specs/preserveSync.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from 'cross-fetch';
import backend from 'fetch-mock';
import entities from 'api/entities';
import { generateFileName, testingUploadPaths } from 'api/files/filesystem';
Expand All @@ -24,11 +23,6 @@ import { preserveSync } from '../preserveSync';
import { preserveSyncModel } from '../preserveSyncModel';
import { anotherTemplateId, fixtures, templateId, thesauri1Id, user } from './fixtures';

Object.assign(backend.config, {
Response,
fetch,
});

const mockVault = async (evidences: any[], token: string = '', isoDate = '') => {
const host = 'http://preserve-testing.org';
const queryString = qs.stringify({
Expand Down
2 changes: 1 addition & 1 deletion app/api/sync/specs/syncWorker.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable max-statements */
import 'isomorphic-fetch';
import { Server } from 'http';
// eslint-disable-next-line node/no-restricted-import
import { rm, writeFile } from 'fs/promises';

import bodyParser from 'body-parser';
import 'cross-fetch/polyfill';
import _ from 'lodash';

import authRoutes from 'api/auth/routes';
Expand Down
3 changes: 1 addition & 2 deletions app/api/topicclassification/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-await-in-loop,camelcase,max-lines */

import 'isomorphic-fetch';
import {
IsTopicClassificationReachable,
RPC_DEADLINE_MS,
Expand All @@ -9,7 +9,6 @@ import { search } from 'api/search';
import templates from 'api/templates';
import { extractSequence } from 'api/topicclassification/common';
import { ClassifierModelSchema } from 'app/Thesauri/types/classifierModelType';
import 'cross-fetch/polyfill';
import { buildFullModelName, getThesaurusPropertyNames } from 'shared/commonTopicClassification';
import JSONRequest from 'shared/JSONRequest';
import { propertyTypes } from 'shared/propertyTypes';
Expand Down
2 changes: 1 addition & 1 deletion app/shared/JSONRequest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'cross-fetch/polyfill';
import 'isomorphic-fetch';
import superagent from 'superagent';

import rison from 'rison-node';
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uwazi",
"version": "1.176.0",
"version": "1.176.1",
"description": "Uwazi is a free, open-source solution for organising, analysing and publishing your documents.",
"keywords": [
"react"
Expand Down Expand Up @@ -81,6 +81,7 @@
"bl": "^4.0.3",
"trim": "0.0.3",
"normalize-url": "6.0.1",
"node-fetch": "2.6.7",
"@types/istanbul-lib-report": "^3.0.0",
"underscore": "^1.13.6",
"socket.io-parser": "4.2.4",
Expand Down Expand Up @@ -134,7 +135,6 @@
"cookie": "0.6.0",
"cookie-parser": "1.4.6",
"cors": "^2.8.5",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"csvtojson": "^2.0.10",
"date-fns": "^3.6.0",
Expand All @@ -157,6 +157,7 @@
"immutability-helper": "^3.1.1",
"immutable": "^3.7.6",
"is-reachable": "^5.2.1",
"isomorphic-fetch": "3.0.0",
"jotai": "^2.8.0",
"json-schema": "^0.4.0",
"json-schema-to-typescript": "^13.1.2",
Expand Down
29 changes: 14 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7760,13 +7760,6 @@ [email protected]:
dependencies:
node-fetch "2.6.7"

cross-fetch@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983"
integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==
dependencies:
node-fetch "^2.6.12"

cross-spawn@^4.0.2:
version "4.0.2"
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz"
Expand Down Expand Up @@ -11723,6 +11716,14 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
dependencies:
node-fetch "^2.6.1"
whatwg-fetch "^3.4.1"

isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
Expand Down Expand Up @@ -13562,20 +13563,13 @@ node-fetch-native@^1.0.2:
resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.1.1.tgz#b8977dd7fe6c5599e417301ed3987bca787d3d6f"
integrity sha512-9VvspTSUp2Sxbl+9vbZTlFGq9lHwE8GDVVekxx6YsNd1YH59sb3Ba8v3Y3cD8PkLNcileGGcA21PFjVl0jzDaw==

[email protected], node-fetch@^2.0.0, node-fetch@^2.6.7:
[email protected], node-fetch@^2.0.0, node-fetch@^2.6.1, node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

node-fetch@^2.6.12:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
dependencies:
whatwg-url "^5.0.0"

node-int64@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz"
Expand Down Expand Up @@ -18093,6 +18087,11 @@ whatwg-fetch@^3.0.0:
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==

whatwg-fetch@^3.4.1:
version "3.6.20"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70"
integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==

whatwg-mimetype@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7"
Expand Down

0 comments on commit a1bfa8a

Please sign in to comment.