From 912e284086c40f9bc8c4a7d43793b99dc00b7684 Mon Sep 17 00:00:00 2001 From: Matthias Lehner Date: Thu, 9 May 2024 11:16:42 +0200 Subject: [PATCH] Update package versions --- package-lock.json | 79 ++++++++++---------- package.json | 6 +- src/main/components/store/model-store.tsx | 23 ++---- src/main/services/patcher/patcher-reducer.ts | 5 +- src/main/utils/actions/actions.ts | 4 +- src/main/utils/fx/assign.ts | 4 +- 6 files changed, 58 insertions(+), 63 deletions(-) diff --git a/package-lock.json b/package-lock.json index 121146934..c546dc9c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,11 +16,11 @@ "react": "18.2.0", "react-color": "2.19.3", "react-dom": "18.2.0", - "react-redux": "8.1.3", + "react-redux": "9.1.2", "react-tooltip": "4.5.1", - "redux": "4.2.1", + "redux": "5.0.1", "redux-saga": "1.3.0", - "redux-thunk": "2.4.2", + "redux-thunk": "3.1.0", "rxjs": "7.8.1", "styled-components": "5.3.11", "tslib": "2.6.2", @@ -2239,6 +2239,7 @@ "version": "3.3.5", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", + "dev": true, "dependencies": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" @@ -2369,7 +2370,8 @@ "node_modules/@types/prop-types": { "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", - "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", + "devOptional": true }, "node_modules/@types/qs": { "version": "6.9.14", @@ -2387,6 +2389,7 @@ "version": "18.2.79", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.79.tgz", "integrity": "sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w==", + "devOptional": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -2406,7 +2409,7 @@ "version": "18.2.25", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.25.tgz", "integrity": "sha512-o/V48vf4MQh7juIKZU2QGDfli6p1+OOi5oXx36Hffpc9adsHeXjVp8rHuPkjd8VT8sOJ2Zp05HR7CdpGTIUFUA==", - "devOptional": true, + "dev": true, "dependencies": { "@types/react": "*" } @@ -2423,6 +2426,15 @@ "redux": "^4.0.0" } }, + "node_modules/@types/react-redux/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/@types/reactcss": { "version": "1.2.12", "resolved": "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.12.tgz", @@ -2441,6 +2453,15 @@ "redux": "^4.0.5" } }, + "node_modules/@types/redux-mock-store/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", @@ -4964,7 +4985,8 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "devOptional": true }, "node_modules/data-urls": { "version": "3.0.2", @@ -12119,38 +12141,22 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/react-redux": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.1.3.tgz", - "integrity": "sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz", + "integrity": "sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==", "dependencies": { - "@babel/runtime": "^7.12.1", - "@types/hoist-non-react-statics": "^3.3.1", "@types/use-sync-external-store": "^0.0.3", - "hoist-non-react-statics": "^3.3.2", - "react-is": "^18.0.0", "use-sync-external-store": "^1.0.0" }, "peerDependencies": { - "@types/react": "^16.8 || ^17.0 || ^18.0", - "@types/react-dom": "^16.8 || ^17.0 || ^18.0", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0", - "react-native": ">=0.59", - "redux": "^4 || ^5.0.0-beta.0" + "@types/react": "^18.2.25", + "react": "^18.0", + "redux": "^5.0.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true }, - "@types/react-dom": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - }, "redux": { "optional": true } @@ -12257,12 +12263,9 @@ } }, "node_modules/redux": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", - "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", - "dependencies": { - "@babel/runtime": "^7.9.2" - } + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" }, "node_modules/redux-mock-store": { "version": "1.5.4", @@ -12282,11 +12285,11 @@ } }, "node_modules/redux-thunk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz", - "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", "peerDependencies": { - "redux": "^4" + "redux": "^5.0.0" } }, "node_modules/reflect.getprototypeof": { diff --git a/package.json b/package.json index 80e502067..e2ad5ac18 100644 --- a/package.json +++ b/package.json @@ -59,11 +59,11 @@ "react": "18.2.0", "react-color": "2.19.3", "react-dom": "18.2.0", - "react-redux": "8.1.3", + "react-redux": "9.1.2", "react-tooltip": "4.5.1", - "redux": "4.2.1", + "redux": "5.0.1", "redux-saga": "1.3.0", - "redux-thunk": "2.4.2", + "redux-thunk": "3.1.0", "rxjs": "7.8.1", "styled-components": "5.3.11", "tslib": "2.6.2", diff --git a/src/main/components/store/model-store.tsx b/src/main/components/store/model-store.tsx index f56de96f4..29cf26c12 100644 --- a/src/main/components/store/model-store.tsx +++ b/src/main/components/store/model-store.tsx @@ -1,17 +1,8 @@ import React, { Component, PropsWithChildren } from 'react'; import { Provider } from 'react-redux'; -import { - applyMiddleware, - combineReducers, - compose, - createStore, - PreloadedState, - Reducer, - Store, - StoreEnhancer, -} from 'redux'; +import { applyMiddleware, combineReducers, compose, createStore, Reducer, Store, StoreEnhancer } from 'redux'; import createSagaMiddleware, { SagaMiddleware } from 'redux-saga'; -import thunk, { ThunkMiddleware } from 'redux-thunk'; +import { thunk, ThunkMiddleware } from 'redux-thunk'; import { Actions } from '../../services/actions'; import { ILayer } from '../../services/layouter/layer'; import { LayouterRepository } from '../../services/layouter/layouter-repository'; @@ -34,18 +25,18 @@ import { UMLModel } from '../../typings'; import { merge } from './merge'; type OwnProps = PropsWithChildren<{ - initialState?: PreloadedState; + initialState?: PartialModelState; patcher?: Patcher; }>; type Props = OwnProps & CanvasContext; export const createReduxStore = ( - initialState: PreloadedState = {}, + initialState: PartialModelState = {}, layer: ILayer | null = null, patcher?: Patcher, ): Store => { - const baseReducer: Reducer = undoable(combineReducers(reducers)); + const baseReducer: Reducer = undoable(combineReducers(reducers) as any); const patchReducer = patcher && createPatcherReducer(patcher, { @@ -57,7 +48,7 @@ export const createReduxStore = ( const reducer: Reducer = (state, action) => { const baseState = baseReducer(state, action); if (patchReducer) { - return patchReducer(baseState, action); + return patchReducer(baseState, action as any); } else { return baseState; } @@ -93,7 +84,7 @@ export const createReduxStore = ( }; const getInitialState = ( - initialState: PreloadedState = {}, + initialState: PartialModelState = {}, layer: ILayer | null = null, patcher?: Patcher, ): { store: Store } => { diff --git a/src/main/services/patcher/patcher-reducer.ts b/src/main/services/patcher/patcher-reducer.ts index 908b4d9ce..55827a09e 100644 --- a/src/main/services/patcher/patcher-reducer.ts +++ b/src/main/services/patcher/patcher-reducer.ts @@ -1,6 +1,7 @@ import { Reducer } from 'redux'; import { Patcher } from './patcher'; -import { PatcherActionTypes } from './patcher-types'; +import { Patch, PatcherActionTypes } from './patcher-types'; +import { SignedPatch } from './patch-verifier'; export type PatcherReducerOptions = { /** @@ -53,7 +54,7 @@ export function createPatcherReducer( return (state, action) => { const { type, payload } = action; if (type === PatcherActionTypes.PATCH) { - const res = patcher.patch(payload, transformInverse(state as U)); + const res = patcher.patch(payload as Patch | SignedPatch, transformInverse(state as U)); if (res.patched) { return merge((state ?? {}) as U, transform(res.result)); diff --git a/src/main/utils/actions/actions.ts b/src/main/utils/actions/actions.ts index 4e1d8107a..074e035f7 100644 --- a/src/main/utils/actions/actions.ts +++ b/src/main/utils/actions/actions.ts @@ -3,12 +3,12 @@ import { PutEffect } from 'redux-saga/effects'; import { ThunkAction, ThunkDispatch } from 'redux-thunk'; import { ModelState } from '../../components/store/model-state'; -export interface Action extends ReduxAction { +export interface Action extends ReduxAction { payload: object; undoable: boolean; } -export interface RedoableAction extends Action { +export interface RedoableAction extends Action { redoable: true; } diff --git a/src/main/utils/fx/assign.ts b/src/main/utils/fx/assign.ts index 84d385c22..f6b56ef08 100644 --- a/src/main/utils/fx/assign.ts +++ b/src/main/utils/fx/assign.ts @@ -1,4 +1,4 @@ -import { DeepPartial } from 'redux'; +import { DeepPartial } from '../../typings'; export const assign = (target: T, source?: DeepPartial): T => { for (const key in source) { @@ -18,7 +18,7 @@ export const assign = (target: T, source?: Dee if (target === undefined) { target = {} as T; } - target[key] = source[key] as T[Extract]; + target[key] = source[key] as T[Extract, string>]; } }