diff --git a/package.json b/package.json index 7b552d129..abc9ba6c5 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "compare-versions": "3.3.0", "deep-equal": "1.0.1", "electron-log": "2.2.16", - "electron-rpc-api": "0.2.0", + "electron-rpc-api": "0.2.1", "electron-unhandled": "1.1.0", "electron-updater": "2.23.3", "fs-json-store": "2.0.0", @@ -85,7 +85,7 @@ "keepasshttp-client": "2.2.6", "keytar": "4.2.1", "rolling-rate-limiter": "0.1.11", - "rxjs": "6.2.1", + "rxjs": "6.2.2", "valid-url": "1.0.9" }, "devDependencies": { @@ -112,7 +112,7 @@ "@types/glob": "5.0.35", "@types/html-webpack-plugin": "2.30.3", "@types/jasmine": "2.8.8", - "@types/karma": "1.7.4", + "@types/karma": "1.7.5", "@types/keytar": "4.0.1", "@types/mini-css-extract-plugin": "0.2.0", "@types/mkdirp": "0.5.2", @@ -122,11 +122,11 @@ "@types/source-map": "0.5.7", "@types/stacktrace-js": "0.0.32", "@types/systemjs": "0.20.6", - "@types/tapable": "1.0.3", + "@types/tapable": "1.0.4", "@types/uglifyjs-webpack-plugin": "1.1.0", "@types/valid-url": "1.0.2", "@types/webdriverio": "4.10.3", - "@types/webpack": "4.4.5", + "@types/webpack": "4.4.6", "@types/webpack-dev-server": "2.9.5", "@types/webpack-env": "1.13.6", "@types/webpack-merge": "4.1.3", @@ -142,9 +142,9 @@ "cross-env": "5.2.0", "cross-spawn": "6.0.5", "css-loader": "1.0.0", - "cssnano": "4.0.1", + "cssnano": "4.0.2", "devtron": "1.4.0", - "electron": "2.0.4", + "electron": "2.0.5", "electron-builder": "20.20.4", "exports-loader": "0.7.0", "file-loader": "1.1.11", @@ -154,6 +154,7 @@ "html-loader": "0.5.5", "html-webpack-plugin": "4.0.0-alpha", "hydux-mutator": "0.1.11", + "immer": "1.3.1", "jasmine": "3.1.0", "karma": "2.0.4", "karma-chrome-launcher": "2.2.0", @@ -182,7 +183,7 @@ "raw-loader": "0.5.1", "resolve-url-loader": "2.3.0", "rewiremock": "3.7.4", - "rxjs-compat": "6.2.1", + "rxjs-compat": "6.2.2", "sass-lint": "1.12.1", "sass-loader": "7.0.3", "script-loader": "0.7.2", diff --git a/src/web/src/app/+accounts/accounts.effects.ts b/src/web/src/app/+accounts/accounts.effects.ts index 56b6bdfac..ab7c71c4e 100644 --- a/src/web/src/app/+accounts/accounts.effects.ts +++ b/src/web/src/app/+accounts/accounts.effects.ts @@ -161,7 +161,7 @@ export class AccountsEffects { const {account, webView, unSubscribeOn} = payload; const {type, login, entryUrl} = account.accountConfig; const observable = this.electronService.webViewCaller(webView, type).pipe( - exhaustMap((caller) => caller("notification", {unSubscribeOn, timeoutMs: 0})({entryUrl})), + exhaustMap((caller) => caller("notification", {unSubscribeOn})({entryUrl})), map((notification) => ACCOUNTS_ACTIONS.NotificationPatch({login, notification})), ); diff --git a/src/web/src/app/components/app.component.spec.ts b/src/web/src/app/components/app.component.spec.ts index 0ba14f145..750823560 100644 --- a/src/web/src/app/components/app.component.spec.ts +++ b/src/web/src/app/components/app.component.spec.ts @@ -1,7 +1,7 @@ +import immer from "immer"; import {ComponentFixture, TestBed, TestModuleMetadata} from "@angular/core/testing"; import {Location} from "@angular/common"; import {RouterTestingModule} from "@angular/router/testing"; -import {setIn} from "hydux-mutator"; import {Store, StoreModule} from "@ngrx/store"; import {AppComponent} from "./app.component"; @@ -42,9 +42,12 @@ describe(AppComponent.name, () => { const locationPathStub = jasmine.createSpy().and.returnValue({indexOf: hashIndexOfSpy}); testBed.resetTestingModule(); - testBed = initTestEnvironment((tb) => tb.configureTestingModule(setIn(moduleDef, (_) => _.providers, [{ - provide: Location, useValue: {path: locationPathStub}, - }]))); + + testBed = initTestEnvironment((tb) => tb.configureTestingModule(immer(moduleDef, (draft) => { + draft.providers = [ + {provide: Location, useValue: {path: locationPathStub}}, + ]; + }))); await testBed.compileComponents(); fixture = testBed.createComponent(AppComponent); @@ -60,10 +63,13 @@ describe(AppComponent.name, () => { const event = new KeyboardEvent("keyup", {key: ESC_KEY}); testBed.resetTestingModule(); - testBed = initTestEnvironment((tb) => tb.configureTestingModule(setIn(moduleDef, (_) => _.providers, [ - {provide: Location, useValue: {path: locationPathStub}}, - {provide: Store, useValue: {dispatch: storeDispatchStub}}, - ]))); + testBed = initTestEnvironment((tb) => tb.configureTestingModule(immer(moduleDef, (draft) => { + draft.providers = [ + {provide: Location, useValue: {path: locationPathStub}}, + {provide: Store, useValue: {dispatch: storeDispatchStub}}, + ]; + }))); + await testBed.compileComponents(); fixture = testBed.createComponent(AppComponent); diff --git a/src/web/src/app/store/reducers/accounts.ts b/src/web/src/app/store/reducers/accounts.ts index 7307f0f7a..385dd1188 100644 --- a/src/web/src/app/store/reducers/accounts.ts +++ b/src/web/src/app/store/reducers/accounts.ts @@ -1,6 +1,6 @@ +import immer from "immer"; import {createFeatureSelector, createSelector} from "@ngrx/store"; import {UnionOf} from "unionize"; -import {updateIn} from "hydux-mutator"; import * as fromRoot from "src/web/src/app/store/reducers/root"; import {ACCOUNTS_ACTIONS} from "src/web/src/app/store/actions"; @@ -72,22 +72,16 @@ export function reducer(state = initialState, action: UnionOf { const {index} = selectAccountByLogin(state.accounts, login); - return updateIn( - state, - (_) => _.accounts[index].notifications, - (_) => ({..._, ...notification}), - [index], - ); + return immer(state, (draft) => { + draft.accounts[index].notifications = {...draft.accounts[index].notifications, ...notification}; + }); }, PatchProgress: ({login, patch}) => { const {index} = selectAccountByLogin(state.accounts, login); - return updateIn( - state, - (_) => _.accounts[index].progress, - (progress) => ({...progress, ...patch}), - [index], - ); + return immer(state, (draft) => { + draft.accounts[index].progress = {...draft.accounts[index].progress, ...patch}; + }); }, default: () => state, }); diff --git a/src/web/src/app/store/reducers/options.ts b/src/web/src/app/store/reducers/options.ts index 9d52db333..87a20d069 100644 --- a/src/web/src/app/store/reducers/options.ts +++ b/src/web/src/app/store/reducers/options.ts @@ -1,12 +1,11 @@ import {createFeatureSelector, createSelector} from "@ngrx/store"; +import {UnionOf} from "unionize"; import * as fromRoot from "./root"; import {Config, Settings} from "src/shared/model/options"; import {ElectronContextLocations} from "src/shared/model/electron"; import {OPTIONS_ACTIONS} from "src/web/src/app/store/actions"; import {pickBaseConfigProperties} from "src/shared/util"; -import {UnionOf} from "unionize"; -import {updateIn} from "hydux-mutator"; export const featureName = "options"; @@ -40,14 +39,13 @@ const initialState: State = { export function reducer(state = initialState, action: UnionOf): State { return OPTIONS_ACTIONS.match(action, { - InitResponse: (payload) => ({...state, ...payload}), + InitResponse: (statePatch) => ({...state, ...statePatch}), GetConfigResponse: (config) => ({...state, config}), GetSettingsResponse: (settings) => ({...state, settings}), - PatchProgress: (patch) => updateIn( - state, - (_) => _.progress, - (progress) => ({...progress, ...patch}), - ), + PatchProgress: (progressPatch) => ({ + ...state, + progress: {...state.progress, ...progressPatch}, + }), default: () => state, }); } diff --git a/yarn.lock b/yarn.lock index 162785302..b40c32824 100644 --- a/yarn.lock +++ b/yarn.lock @@ -445,8 +445,8 @@ resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-2.0.0.tgz#9163742ac35c12d3602dece74317643b35db6a80" "@types/bluebird@*": - version "3.5.21" - resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.21.tgz#567615589cc913e84a28ecf9edb031732bdf2634" + version "3.5.22" + resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.22.tgz#519b87fe3c9d290ca6c06381ffc3040770ab452b" "@types/body-parser@*": version "1.17.0" @@ -532,9 +532,9 @@ version "2.8.8" resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9" -"@types/karma@1.7.4": - version "1.7.4" - resolved "https://registry.yarnpkg.com/@types/karma/-/karma-1.7.4.tgz#27140c871d4043be78fd71635feba3b548fe3f6b" +"@types/karma@1.7.5": + version "1.7.5" + resolved "https://registry.yarnpkg.com/@types/karma/-/karma-1.7.5.tgz#72055af26b7be5084a0c7fc09664a408e52e1941" dependencies: "@types/bluebird" "*" "@types/node" "*" @@ -612,17 +612,17 @@ version "0.20.6" resolved "https://registry.yarnpkg.com/@types/systemjs/-/systemjs-0.20.6.tgz#79838d2b4bce9c014330efa0b4c7b9345e830a72" -"@types/tapable@*", "@types/tapable@1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.3.tgz#0db6e44f99933f9bfaa952ab9db9caa9ce4896e2" +"@types/tapable@*", "@types/tapable@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" "@types/tapable@1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.2.tgz#e13182e1b69871a422d7863e11a4a6f5b814a4bd" "@types/uglify-js@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.2.tgz#f30c75458d18e8ee885c792c04adcb78a13bc286" + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.3.tgz#801a5ca1dc642861f47c46d14b700ed2d610840b" dependencies: source-map "^0.6.1" @@ -667,9 +667,9 @@ dependencies: "@types/webpack" "*" -"@types/webpack@*", "@types/webpack@4.4.5": - version "4.4.5" - resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.4.5.tgz#d45596fb67aeb724495ef5e7c78771bfc35f2955" +"@types/webpack@*", "@types/webpack@4.4.6": + version "4.4.6" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.4.6.tgz#91e909370c89aca6e6c55d3bcc3026bc21b2bae6" dependencies: "@types/node" "*" "@types/tapable" "*" @@ -1670,11 +1670,11 @@ browserify-zlib@^0.2.0: pako "~1.0.5" browserslist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.0.0.tgz#48703f1ed7ef981c6719e39e9444f20632b06571" + version "4.0.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.0.1.tgz#61c05ce2a5843c7d96166408bc23d58b5416e818" dependencies: - caniuse-lite "^1.0.30000859" - electron-to-chromium "^1.3.50" + caniuse-lite "^1.0.30000865" + electron-to-chromium "^1.3.52" node-releases "^1.0.0-alpha.10" buffer-alloc-unsafe@^1.1.0: @@ -1724,6 +1724,13 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" +buffer@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.1.0.tgz#c913e43678c7cb7c8bd16afbcddb6c5505e8f9fe" + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + builder-util-runtime@4.4.0, builder-util-runtime@^4.4.0, builder-util-runtime@~4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-4.4.0.tgz#1f486819df12a04abfa128fe082e7c54edda0ef7" @@ -1891,7 +1898,7 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000859: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000865: version "1.0.30000865" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz#70026616e8afe6e1442f8bb4e1092987d81a2f25" @@ -2469,8 +2476,10 @@ crc32-stream@^2.0.0: readable-stream "^2.0.0" crc@^3.4.4: - version "3.5.0" - resolved "https://registry.yarnpkg.com/crc/-/crc-3.5.0.tgz#98b8ba7d489665ba3979f59b21381374101a1964" + version "3.6.0" + resolved "https://registry.yarnpkg.com/crc/-/crc-3.6.0.tgz#50cf87e2601f9bf5e482a1575f006a1138a3ad37" + dependencies: + buffer "^5.1.0" create-ecdh@^4.0.0: version "4.0.3" @@ -2730,9 +2739,9 @@ cssnano-util-same-parent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.0.tgz#d2a3de1039aa98bc4ec25001fa050330c2a16dac" -cssnano@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.0.1.tgz#2c611d3375be46d8908d8e1fb28b8ed875376a10" +cssnano@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.0.2.tgz#0e79a1829afb6583744ba705fd62516fbfd4fda7" dependencies: cosmiconfig "^5.0.0" cssnano-preset-default "^4.0.0" @@ -3285,14 +3294,14 @@ electron-publish@20.22.0: lazy-val "^1.0.3" mime "^2.3.1" -electron-rpc-api@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/electron-rpc-api/-/electron-rpc-api-0.2.0.tgz#0e534d6bbad892d525818068bee989d24374dc14" +electron-rpc-api@0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/electron-rpc-api/-/electron-rpc-api-0.2.1.tgz#c6d8abf2ada16a63c472b8bfa7e171feaef347bd" dependencies: - pubsub-to-stream-api "^0.2.0" + pubsub-to-stream-api "^0.2.1" tslib "^1.9.2" -electron-to-chromium@^1.3.50: +electron-to-chromium@^1.3.52: version "1.3.52" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz#d2d9f1270ba4a3b967b831c40ef71fb4d9ab5ce0" @@ -3318,9 +3327,9 @@ electron-updater@2.23.3: semver "^5.5.0" source-map-support "^0.5.6" -electron@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.4.tgz#87b86b8d9c13748032868c1be97e2b7021a51808" +electron@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.5.tgz#6045db011e2547062a36e8c5da84d4982f434fc0" dependencies: "@types/node" "^8.0.24" electron-download "^3.0.1" @@ -3563,8 +3572,8 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" escodegen@1.x.x: - version "1.10.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.10.0.tgz#f647395de22519fbd0d928ffcf1d17e0dec2603e" + version "1.11.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.0.tgz#b27a9389481d5bfd5bec76f7bb1eb3f8f4556589" dependencies: esprima "^3.1.3" estraverse "^4.2.0" @@ -3628,8 +3637,8 @@ eslint@^2.7.0: user-home "^2.0.0" esm@^3.0.40: - version "3.0.69" - resolved "https://registry.yarnpkg.com/esm/-/esm-3.0.69.tgz#4ce2b06ec32742b28cca1c2187318f8563fb3cb8" + version "3.0.71" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.0.71.tgz#3824987412d7d8fd7782d2381e990a621519a993" espower-location-detector@^1.0.0: version "1.0.0" @@ -3652,8 +3661,8 @@ esprima@3.x.x, esprima@^3.1.3, esprima@~3.1.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" espurify@^1.6.0: version "1.8.1" @@ -4909,8 +4918,8 @@ html-loader@0.5.5: object-assign "^4.1.1" html-minifier@^3.2.3, html-minifier@^3.5.8: - version "3.5.18" - resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.18.tgz#fc8b02826cbbafc6de19a103c41c830a91cffe5a" + version "3.5.19" + resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.19.tgz#ed53c4b7326fe507bc3a1adbcc3bbb56660a2ebd" dependencies: camel-case "3.0.x" clean-css "4.1.x" @@ -5088,6 +5097,10 @@ ignore@^3.1.2, ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" +immer@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/immer/-/immer-1.3.1.tgz#3a8c18d9d618c8b7169760a79beec24a1da6a43e" + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -7653,8 +7666,8 @@ parseurl@~1.3.2: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" parsimmon@^1.6.4: - version "1.11.1" - resolved "https://registry.yarnpkg.com/parsimmon/-/parsimmon-1.11.1.tgz#86493d7130636ffdcf748913b84f23916ec16f31" + version "1.12.0" + resolved "https://registry.yarnpkg.com/parsimmon/-/parsimmon-1.12.0.tgz#886a442fb30b5fc3c8e7c4994050f5cdcfe0ea90" pascalcase@^0.1.1: version "0.1.1" @@ -7867,8 +7880,8 @@ postcss-calc@^6.0.0: reduce-css-calc "^2.0.0" postcss-colormin@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-4.0.0.tgz#8a21f10b3843590d181eedf2a6a109617b6553ec" + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-4.0.1.tgz#6f1c18a0155bc69613f2ff13843e2e4ae8ff0bbe" dependencies: browserslist "^4.0.0" color "^3.0.0" @@ -7931,8 +7944,8 @@ postcss-loader@2.1.6: schema-utils "^0.4.0" postcss-merge-longhand@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-4.0.0.tgz#a4541b668a0a6ac25aa21d930142fd02b41a717c" + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-4.0.1.tgz#98cdebda7cc1bada4ae03c76ed1c44c97a574019" dependencies: postcss "^6.0.0" postcss-value-parser "^3.0.0" @@ -8325,12 +8338,12 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -pubsub-to-stream-api@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/pubsub-to-stream-api/-/pubsub-to-stream-api-0.2.0.tgz#6950d57b4547d166b22106bc876bb3a72bd6437e" +pubsub-to-stream-api@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/pubsub-to-stream-api/-/pubsub-to-stream-api-0.2.1.tgz#ed3cff471cd26dcdf316e3130080aae309bfe0ff" dependencies: deserialize-error "^0.0.3" - rxjs "^6.2.1" + rxjs "^6.2.2" serializerr "^1.0.3" tslib "^1.9.2" uuid-browser "^3.1.0" @@ -9049,13 +9062,13 @@ rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" -rxjs-compat@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.2.1.tgz#f5a5e4bd700db414e82aa7cb34e5c9222c6d3756" +rxjs-compat@6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.2.2.tgz#3c0fcdb46130cc70aa55412c2b1147905ab4680a" -rxjs@6.2.1, rxjs@^6.0.0, rxjs@^6.1.0, rxjs@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.1.tgz#246cebec189a6cbc143a3ef9f62d6f4c91813ca1" +rxjs@6.2.2, rxjs@^6.0.0, rxjs@^6.1.0, rxjs@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" dependencies: tslib "^1.9.0"