Skip to content

Commit eb71f34

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/babel/helpers-7.26.10
2 parents f7f1f08 + d80737c commit eb71f34

File tree

20 files changed

+313
-403
lines changed

20 files changed

+313
-403
lines changed

.changeset/calm-cats-care.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@talend/scripts-config-react-webpack': patch
3+
---
4+
5+
add querystring to resolve.fallback

.changeset/stale-pumas-relate.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@talend/design-system': minor
3+
'@talend/icons': minor
4+
'@talend/http': minor
5+
'@talend/json-schema-form-core': patch
6+
'@talend/scripts-utils': patch
7+
---
8+
9+
Fix remaining dependabot alerts

.github/actions/setup-node/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ runs:
88
using: 'composite'
99
steps:
1010
- name: Set up Node.js
11-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d #v3.8.1
11+
uses: actions/setup-node@v4
1212
with:
1313
node-version-file: '.tool-versions'
1414
registry-url: 'https://registry.npmjs.org/'
@@ -23,7 +23,7 @@ runs:
2323
shell: bash
2424
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
2525

26-
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
26+
- uses: actions/cache@v4
2727
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
2828
with:
2929
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

fork/json-schema-form-core/webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ module.exports = {
66
fallback: {
77
path: false,
88
},
9+
alias: {
10+
'json-refs': require.resolve('json-refs/dist/json-refs.js'),
11+
},
912
},
1013
};

packages/design-system/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"@storybook/react": "^7.6.20",
7474
"@storybook/testing-library": "^0.2.2",
7575
"@storybook/theming": "^7.6.20",
76-
"@svgr/webpack": "^5.5.0",
76+
"@svgr/webpack": "^8.1.0",
7777
"@talend/eslint-config": "^13.2.1",
7878
"@talend/eslint-plugin": "^1.3.1",
7979
"@talend/icons": "^7.10.3",

packages/http/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@talend/scripts-config-typescript": "^11.3.0",
3636
"@types/jest": "^29.5.14",
3737
"@types/node-fetch": "^2.6.11",
38-
"fetch-mock": "^9.11.0",
3938
"node-fetch": "^2.7.0",
4039
"react-dom": "^18.3.1",
4140
"react": "^18.3.1"

packages/http/src/http.common.test.ts

+63-29
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import fetchMock from 'fetch-mock';
2-
import { Response, Headers } from 'node-fetch';
1+
import { Headers, Response } from 'node-fetch';
32

43
import {
5-
HTTP,
4+
addHttpResponseInterceptor,
65
getDefaultConfig,
7-
setDefaultConfig,
6+
HTTP,
87
HTTP_RESPONSE_INTERCEPTORS,
9-
addHttpResponseInterceptor,
8+
setDefaultConfig,
109
} from './config';
11-
import { httpFetch, handleBody, encodePayload, handleHttpResponse } from './http.common';
10+
import { encodePayload, handleBody, handleHttpResponse, httpFetch } from './http.common';
1211
import { HTTP_METHODS, HTTP_STATUS } from './http.constants';
1312
import { TalendHttpError } from './http.types';
1413

@@ -18,6 +17,10 @@ const defaultPayload = {
1817
bar: 42,
1918
};
2019

20+
interface FetchMock extends jest.Mock {
21+
mockResponse?: Response;
22+
}
23+
2124
beforeEach(() => {
2225
jest.clearAllMocks();
2326
});
@@ -199,19 +202,24 @@ describe('#httpFetch with `CSRF` token', () => {
199202
});
200203

201204
afterAll(() => {
202-
fetchMock.restore();
203205
document.cookie = `csrfToken=${CSRFToken}; dwf_section_edit=True; Max-Age=0`;
204206
});
205207
it('should get the CRFS token', async () => {
206208
const url = '/foo';
207209
const headers = new Headers();
208210
headers.append('Content-Type', 'application/json');
209211

210-
fetchMock.mock(url, { body: defaultBody, status: 200 });
212+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
213+
status: 200,
214+
headers: {
215+
'Content-Type': 'application/json',
216+
},
217+
});
218+
211219
const result = await httpFetch(url, {}, HTTP_METHODS.GET, defaultPayload);
212220

213221
expect(result.data).toEqual(defaultBody);
214-
expect(fetchMock.calls()[0][1]).toEqual({
222+
expect(global.self.fetch).toHaveBeenCalledWith(url, {
215223
body: JSON.stringify(defaultPayload),
216224
credentials: 'same-origin',
217225
headers: {
@@ -239,7 +247,6 @@ describe('#httpFetch with CSRF handling configuration', () => {
239247

240248
afterAll(() => {
241249
HTTP.defaultConfig = null;
242-
fetchMock.restore();
243250
document.cookie = `${defaultHttpConfiguration.security.CSRFTokenCookieKey}=${CSRFToken}; dwf_section_edit=True; Max-Age=0`;
244251
});
245252

@@ -251,12 +258,17 @@ describe('#httpFetch with CSRF handling configuration', () => {
251258
const headers = new Headers();
252259
headers.append('Content-Type', 'application/json');
253260

254-
fetchMock.mock(url, { body: defaultBody, status: 200 });
261+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
262+
status: 200,
263+
headers: {
264+
'Content-Type': 'application/json',
265+
},
266+
});
255267

256268
const result = await httpFetch(url, {}, HTTP_METHODS.GET, defaultPayload);
257269

258270
expect(result.data).toEqual(defaultBody);
259-
expect(fetchMock.calls()[0][1]).toEqual({
271+
expect(global.self.fetch).toHaveBeenCalledWith(url, {
260272
body: JSON.stringify(defaultPayload),
261273
credentials: 'same-origin',
262274
headers: {
@@ -276,19 +288,23 @@ describe('#httpFetch with CSRF handling configuration', () => {
276288
describe('#httpFetch', () => {
277289
afterEach(() => {
278290
HTTP.defaultConfig = null;
279-
fetchMock.restore();
280291
});
281292

282293
it('should fetch the request', async () => {
283294
const url = '/foo';
284295
const headers = new Headers();
285296
headers.append('Content-Type', 'application/json');
286-
fetchMock.mock(url, { body: defaultBody, status: 200 });
297+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
298+
status: 200,
299+
headers: {
300+
'Content-Type': 'application/json',
301+
},
302+
});
287303

288304
const result = await httpFetch(url, {}, HTTP_METHODS.GET, defaultPayload);
289305

290306
expect(result.data).toEqual(defaultBody);
291-
expect(fetchMock.calls()[0][1]).toEqual({
307+
expect(global.self.fetch).toHaveBeenCalledWith(url, {
292308
body: JSON.stringify(defaultPayload),
293309
credentials: 'same-origin',
294310
headers: {
@@ -310,12 +326,17 @@ describe('#httpFetch', () => {
310326
},
311327
});
312328

313-
fetchMock.mock(url, { body: defaultBody, status: 200 });
329+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
330+
status: 200,
331+
headers: {
332+
'Content-Type': 'application/json',
333+
},
334+
});
314335

315336
const result = await httpFetch(url, {}, HTTP_METHODS.GET, defaultPayload);
316337

317338
expect(result.data).toEqual(defaultBody);
318-
expect(fetchMock.calls()[0][1]).toEqual({
339+
expect(global.self.fetch).toHaveBeenCalledWith(url, {
319340
body: JSON.stringify(defaultPayload),
320341
credentials: 'same-origin',
321342
headers: {
@@ -333,14 +354,22 @@ describe('#httpFetch', () => {
333354
headers.append('Content-Type', 'application/json');
334355
const payload = new FormData();
335356

336-
fetchMock.mock(url, { body: '{"foo": 42}', status: 200 });
357+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify({ foo: 42 }), {
358+
status: 200,
359+
headers: {
360+
'Content-Type': 'application/json',
361+
},
362+
});
337363

338364
const result = await httpFetch(url, {}, HTTP_METHODS.GET, payload);
339-
expect(result.data).toEqual('{"foo": 42}');
365+
expect(result.data).toEqual({ foo: 42 });
340366

341-
const mockCalls = fetchMock.calls();
342-
expect(mockCalls[0][1]?.credentials).toEqual('same-origin');
343-
expect(mockCalls[0][1]?.headers).toEqual({ Accept: 'application/json' });
367+
expect(global.self.fetch).toHaveBeenCalledWith(url, {
368+
body: payload,
369+
credentials: 'same-origin',
370+
headers: { Accept: 'application/json' },
371+
method: 'GET',
372+
});
344373
});
345374
});
346375

@@ -353,16 +382,17 @@ describe('#httpFetch with interceptors', () => {
353382
}
354383
});
355384

356-
afterEach(() => {
357-
fetchMock.restore();
358-
});
359-
360385
it('should call interceptor', async () => {
361386
const interceptor = jest.fn().mockImplementation((res, _) => res);
362387
addHttpResponseInterceptor('interceptor', interceptor);
363388

364389
const url = '/foo';
365-
fetchMock.mock(url, { body: defaultBody, status: 200 });
390+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
391+
status: 200,
392+
headers: {
393+
'Content-Type': 'application/json',
394+
},
395+
});
366396

367397
await httpFetch(url, {}, HTTP_METHODS.GET, {});
368398
expect(interceptor).toHaveBeenCalled();
@@ -374,8 +404,12 @@ describe('#httpFetch with interceptors', () => {
374404

375405
const url = '/foo';
376406
const context = { async: true };
377-
const response = { body: defaultBody, status: 200 };
378-
fetchMock.mock(url, response);
407+
(global.self.fetch as FetchMock).mockResponse = new Response(JSON.stringify(defaultBody), {
408+
status: 200,
409+
headers: {
410+
'Content-Type': 'application/json',
411+
},
412+
});
379413

380414
await httpFetch(url, { context }, HTTP_METHODS.GET, {});
381415
expect(interceptor).toHaveBeenCalledWith(

packages/icons/.svgo-filters.yml

-45
This file was deleted.

packages/icons/.svgo-icons.yml

-46
This file was deleted.

packages/icons/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"build-storybook": "talend-scripts build-storybook",
3636
"start": "talend-scripts start-storybook -p 6010",
3737
"lint": "echo nothing to lint",
38-
"svgo": "svgo -f src/svg --config=.svgo-icons.yml && svgo -f src/filters --config=.svgo-filters.yml"
38+
"svgo": "svgo -rf src/svg --config svgo-icons.config.mjs && svgo -rf src/filters --config svgo-filters.config.mjs"
3939
},
4040
"files": [
4141
"index.js",
@@ -61,7 +61,7 @@
6161
"@babel/core": "^7.26.0",
6262
"@babel/preset-env": "^7.26.0",
6363
"@babel/preset-react": "^7.25.9",
64-
"@svgr/webpack": "^5.5.0",
64+
"@svgr/webpack": "^8.1.0",
6565
"@talend/eslint-config": "^13.2.1",
6666
"@talend/eslint-plugin": "^1.3.1",
6767
"@talend/scripts-core": "^16.5.1",
@@ -81,7 +81,7 @@
8181
"react-use": "^17.5.1",
8282
"string-replace-loader": "^2.3.0",
8383
"style-loader": "^1.3.0",
84-
"svgo": "^1.3.2",
84+
"svgo": "^3.3.2",
8585
"webfonts-loader": "^8.0.1",
8686
"webpack": "^5.95.0",
8787
"webpack-cli": "^4.10.0"

0 commit comments

Comments
 (0)