TD-43: Bump Angular@13 (#18)

This commit is contained in:
Rinat Arsaev 2022-01-18 11:22:13 +03:00 committed by GitHub
parent 0231bf5d9c
commit 1b8cd2c110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 7551 additions and 9266 deletions

View File

@ -22,6 +22,7 @@ const baseTsRules = {
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
},
};

View File

@ -9,7 +9,7 @@ runs:
- name: Init NodeJS
uses: actions/setup-node@v2
with:
node-version: '16.4.2'
node-version: '16.13.2'
cache: 'npm'
- name: Install Packages

5
.gitignore vendored
View File

@ -9,7 +9,6 @@
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
@ -46,4 +45,8 @@ Thumbs.db
# Sonar
.scannerwork
# ESLint
.eslintcache
# Angular
.angular

5
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

13
.idea/cc.iml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<option name="fix-on-save" value="true" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/cc.iml" filepath="$PROJECT_DIR$/.idea/cc.iml" />
</modules>
</component>
</project>

8
.idea/prettier.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myRunOnSave" value="true" />
<option name="myRunOnReformat" value="true" />
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,json,yaml,yml}" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1
.npmrc
View File

@ -1 +0,0 @@
engine-strict=true

View File

@ -9,3 +9,4 @@ src/**/gen-nodejs/
src/**/meta-*.json
src/assets/api-meta/
src/assets/icons/
.angular

16560
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,17 @@
{
"name": "control-center",
"version": "0.0.0",
"engines": {
"node": "^16.0.0",
"npm": "^7.0.0"
},
"private": true,
"scripts": {
"postinstall": "ngcc",
"start": "ng serve --proxy-config proxy.conf.js --port 4200",
"build": "ng build --extra-webpack-config webpack.extra.js",
"test": "ng test",
"lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 2070 --cache",
"lint-errors": "npm run lint -- --quiet --format codeframe",
"lint-fix": "npm run lint -- --fix",
"lint-cmd": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1634",
"lint-cache-cmd": "npm run lint-cmd -- --cache",
"lint": "npm run lint-cache-cmd",
"lint-fix": "npm run lint-cache-cmd -- --fix",
"lint-errors": "npm run lint-cache-cmd -- --quiet",
"prettier-preset": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,huskyrc,yml,yaml}\"",
"prettier": "npm run prettier-preset -- --list-different",
"prettier:fix": "npm run prettier-preset -- --write",
@ -20,26 +19,25 @@
"compile-thrift-deprecated": "ts-node --project tools/tsconfig.json tools/compile-thrift-deprecated",
"compile-thrift": "ts-node --project tools/tsconfig.json tools/compile-thrift",
"compile": "npm run parallel-cmd -- --names THRIFT,THRIFT_DEP \"npm run compile-thrift\" \"npm run compile-thrift-deprecated\"",
"ci:build": "npm run parallel-cmd -- --names PRETTIER,LINT,BUILD \"npm run prettier\" \"npm run lint-errors\" \"npm run build\"",
"ci:build": "npm run parallel-cmd -- --names PRETTIER,LINT,BUILD \"npm run prettier\" \"npm run lint-cmd -- --quiet\" \"npm run build\"",
"parallel-cmd": "concurrently --kill-others-on-fail --prefix-colors magenta,green,red,yellow,blue"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.1.4",
"@angular/cdk": "^12.1.4",
"@angular/common": "^12.1.4",
"@angular/compiler": "^12.1.4",
"@angular/core": "^12.1.4",
"@angular/flex-layout": "^12.0.0-beta.34",
"@angular/forms": "~12.1.4",
"@angular/material": "~12.1.4",
"@angular/material-moment-adapter": "~12.1.4",
"@angular/platform-browser": "~12.1.4",
"@angular/platform-browser-dynamic": "~12.1.4",
"@angular/platform-server": "~12.1.4",
"@angular/router": "~12.1.4",
"@angular/animations": "~13.1.2",
"@angular/cdk": "^13.1.2",
"@angular/common": "^13.1.2",
"@angular/compiler": "^13.1.2",
"@angular/core": "^13.1.2",
"@angular/flex-layout": "^13.0.0-beta.36",
"@angular/forms": "~13.1.2",
"@angular/material": "~13.1.2",
"@angular/material-moment-adapter": "~13.1.2",
"@angular/platform-browser": "~13.1.2",
"@angular/platform-browser-dynamic": "~13.1.2",
"@angular/platform-server": "~13.1.2",
"@angular/router": "~13.1.2",
"@ngneat/reactive-forms": "^2.0.0",
"@ngneat/until-destroy": "^8.0.3",
"@ngneat/until-destroy": "^9.0.0",
"@s-libs/js-core": "^12.0.0",
"@s-libs/micro-dash": "^12.0.0",
"@s-libs/ng-core": "^12.0.0",
@ -51,12 +49,12 @@
"coerce-property": "^0.3.2",
"humanize-duration": "~3.21.0",
"jsonc-parser": "~2.0.2",
"keycloak-angular": "^8.3.0",
"keycloak-angular": "^9.0.0",
"keycloak-js": "^14.0.0",
"lodash-es": "~4.17.15",
"moment": "~2.22.2",
"monaco-editor": "^0.21.2",
"ngx-mat-select-search": "^3.3.0",
"ngx-mat-select-search": "^4.0.0",
"pdfmake": "^0.1.64",
"rxjs": "^6.6.3",
"short-uuid": "^4.1.0",
@ -67,12 +65,14 @@
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.1.4",
"@angular-eslint/eslint-plugin": "^12.7.0",
"@angular-eslint/eslint-plugin-template": "^12.7.0",
"@angular-eslint/template-parser": "^12.7.0",
"@angular/cli": "^12.1.4",
"@angular/compiler-cli": "^12.1.4",
"@angular-devkit/build-angular": "~13.1.2",
"@angular-eslint/builder": "^13.0.1",
"@angular-eslint/eslint-plugin": "^13.0.1",
"@angular-eslint/eslint-plugin-template": "^13.0.1",
"@angular-eslint/schematics": "~13.0.1",
"@angular-eslint/template-parser": "^13.0.1",
"@angular/cli": "^13.1.3",
"@angular/compiler-cli": "^13.1.2",
"@types/del": "^4.0.0",
"@types/glob": "^7.1.3",
"@types/humanize-duration": "~3.18.0",
@ -82,23 +82,22 @@
"@types/node": "^16.4.12",
"@types/pdfmake": "^0.1.9",
"@types/uuid": "~3.4.3",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "~4.22.0",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "~5.8.0",
"ank-proto": "github:valitydev/ank-proto#d638e44eb8632fd62f0d6730294e51637babcc78",
"chalk": "^4.1.0",
"codelyzer": "^6.0.0",
"concurrently": "^6.5.1",
"damsel": "github:valitydev/damsel#827f692653e8110b0280a4608ff540d2662842ce",
"deanonimus-proto": "github:valitydev/deanonimus-proto#b9fab4fd1c7690186efdc5974d113c82bd5765e9",
"del": "^5.1.0",
"dominant-cache-proto": "github:valitydev/dominant-cache-proto#ebd35c3096cb5e3222aa29317277b59a01c41fbe",
"eslint": "^7.25.0",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jasmine": "^4.1.2",
"eslint-plugin-jsdoc": "^32.3.1",
"eslint-plugin-jsdoc": "^37.4.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-unused-imports": "^1.1.1",
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.11.0",
"file-storage-proto": "github:valitydev/file-storage-proto#281e1ca4cea9bf32229a6c389f0dcf5d49c05a0b",
"fistful-proto": "github:valitydev/fistful-proto#e340259cdd3add024f0139e21f0a2453312ef901",
@ -111,13 +110,13 @@
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"machinegun_proto": "github:valitydev/machinegun_proto#d814d6948d4ff13f6f41d12c6613f59c805750b2",
"machinegun-proto": "github:valitydev/machinegun-proto#d814d6948d4ff13f6f41d12c6613f59c805750b2",
"messages-proto": "github:valitydev/messages-proto#a177efb574136961bcd0a8236b4bfc425264de29",
"ngx-build-plus": "^12.2.0",
"ngx-build-plus": "^13.0.1",
"prettier": "~2.0.4",
"skipper-proto": "github:valitydev/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74",
"ts-mockito": "^2.6.1",
"ts-node": "~8.8.2",
"typescript": "~4.3.5"
"typescript": "~4.5.4"
}
}
}

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-send-comment-theme($theme) {
$warn: map-get($theme, warn);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-not-found-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -7,7 +7,7 @@ import {
Output,
SimpleChanges,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormControlStatus, FormGroup, Validators } from '@angular/forms';
import { ActionType, ModificationAction } from '../../claim/modification-action';
import { ContractorModification } from '../../thrift-services/damsel/gen-model/claim_management';
@ -45,7 +45,7 @@ export class PartyModificationCreationComponent implements OnInit, OnChanges {
valueChanges: EventEmitter<PartyModification> = new EventEmitter();
@Output()
statusChanges: EventEmitter<'VALID' | 'INVALID'> = new EventEmitter();
statusChanges: EventEmitter<FormControlStatus> = new EventEmitter();
actionTypes = ActionType;
shopModificationNames = ShopModificationName;

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-chargeback-details-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-timeline-item-loading-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-party-claim-title-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-party-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-payment-routing-rules-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -7,7 +7,7 @@ import {
Output,
SimpleChanges,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormControlStatus, FormGroup, Validators } from '@angular/forms';
import { ActionType, ModificationAction } from '../../../../claim/modification-action';
import { ContractorModification } from '../../../../thrift-services/damsel/gen-model/claim_management';
@ -45,7 +45,7 @@ export class PartyModificationCreationComponent implements OnInit, OnChanges {
valueChanges: EventEmitter<PartyModification> = new EventEmitter();
@Output()
statusChanges: EventEmitter<'VALID' | 'INVALID'> = new EventEmitter();
statusChanges: EventEmitter<FormControlStatus> = new EventEmitter();
actionTypes = ActionType;
shopModificationNames = ShopModificationName;

View File

@ -3,19 +3,19 @@ import { Layout } from '../create-questionary';
import { createGrid } from './create-grid';
import { ICONS } from './icons';
type Items<T extends any> = string[] | [T, string][];
type Items<T> = string[] | [T, string][];
function itemsIsKeyValue<T extends any>(srcItems: Items<T>): srcItems is [T, string][] {
function itemsIsKeyValue<T>(srcItems: Items<T>): srcItems is [T, string][] {
return Array.isArray(srcItems[0]);
}
function itemsToMap<T extends any>(srcItems: Items<T>): Map<T, string> {
function itemsToMap<T>(srcItems: Items<T>): Map<T, string> {
return itemsIsKeyValue(srcItems)
? new Map(srcItems)
: new Map<T, string>(srcItems.map((i, idx) => [idx, i] as any));
}
function itemsWithActive<T extends any>(
function itemsWithActive<T>(
itemsSrc: Items<T>,
activeKey?: T
): { key: T; value: string; isActive: boolean }[] {
@ -31,14 +31,14 @@ export function createCheckbox(text: string, active = false): Content {
return { text: [active ? ICONS.checkSquare : ICONS.square, ' ', text] };
}
export function createInlineCheckbox<T extends any>(itemsSrc: Items<T>, activeKey?: T): Content {
export function createInlineCheckbox<T>(itemsSrc: Items<T>, activeKey?: T): Content {
const text = itemsWithActive(itemsSrc, activeKey)
.reduce((acc, { value, isActive }) => [...acc, createCheckbox(value, isActive), ' '], [])
.slice(0, -1);
return { text };
}
export function createInlineCheckboxWithTitle<T extends any>(
export function createInlineCheckboxWithTitle<T>(
title: string,
items: Items<T>,
activeKey?: T
@ -47,7 +47,7 @@ export function createInlineCheckboxWithTitle<T extends any>(
return { ...inlineCheckbox, text: [`${title}: `, ...inlineCheckbox.text] };
}
export function createVerticalCheckbox<T extends any>(itemsSrc: Items<T>, activeKey?: T): Content {
export function createVerticalCheckbox<T>(itemsSrc: Items<T>, activeKey?: T): Content {
return {
layout: Layout.NoBorders,
table: {
@ -59,7 +59,7 @@ export function createVerticalCheckbox<T extends any>(itemsSrc: Items<T>, active
};
}
export function createVerticalCheckboxWithTitle<T extends any>(
export function createVerticalCheckboxWithTitle<T>(
title: string,
items: Items<T>,
activeKey?: T
@ -76,10 +76,7 @@ export function createVerticalCheckboxWithTitle<T extends any>(
};
}
export function createHorizontalCheckbox<T extends any>(
itemsSrc: Items<T>,
activeKey?: T
): Content {
export function createHorizontalCheckbox<T>(itemsSrc: Items<T>, activeKey?: T): Content {
return createGrid(
itemsWithActive(itemsSrc, activeKey).map(({ value, isActive }) =>
createCheckbox(value, isActive)

View File

@ -1,4 +1,4 @@
export interface FetchAction<P extends any = any> {
export interface FetchAction<P = any> {
type: 'search' | 'fetchMore';
value?: P;
}

View File

@ -1,5 +1,5 @@
@use '~@angular/material' as mat;
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
@use '@angular/material' as mat;
@import '@angular/material/prebuilt-themes/indigo-pink.css';
@import './overrides/body';

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@import '../../../components/components-themes';
@import '../../shared/components/shared-components-themes';

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@import '../utils/palette';
@import './theme';

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@function cc-typography-config(
$font-family: 'Roboto, "Helvetica Neue", sans-serif',

View File

@ -10,7 +10,7 @@ import {
STRUCTURE_TYPES,
} from './namespace-type';
export function createThriftInstance<T extends { [N in string]: any }, V extends any>(
export function createThriftInstance<T extends { [N in string]: any }, V>(
metadata: any[],
namespaces: T,
indefiniteType: ValueType,
@ -26,20 +26,20 @@ export function createThriftInstance<T extends { [N in string]: any }, V extends
if (isComplexType(type)) {
switch (type.name) {
case 'map':
return new Map(
Array.from(value as Map<any, any>).map(([k, v]) => [
return (new Map(
Array.from((value as unknown) as Map<any, any>).map(([k, v]) => [
internalCreateThriftInstance(type.keyType, k),
internalCreateThriftInstance(type.valueType, v),
])
) as V;
) as unknown) as V;
case 'list':
return (value as any[]).map((v) =>
return (((value as unknown) as any[]).map((v) =>
internalCreateThriftInstance(type.valueType, v)
) as V;
) as unknown) as V;
case 'set':
return Array.from(value as Set<any>).map((v) =>
return (Array.from((value as unknown) as Set<any>).map((v) =>
internalCreateThriftInstance(type.valueType, v)
) as V;
) as unknown) as V;
default:
throw new Error('Unknown complex thrift type');
}

View File

@ -9,7 +9,7 @@ import {
STRUCTURE_TYPES,
} from './namespace-type';
export function thriftInstanceToObject<T extends { [N in string]: any }, V extends any>(
export function thriftInstanceToObject<T extends { [N in string]: any }, V>(
metadata: any[],
namespaces: T,
indefiniteType: ValueType,
@ -25,29 +25,29 @@ export function thriftInstanceToObject<T extends { [N in string]: any }, V exten
if (isComplexType(type)) {
switch (type.name) {
case 'map':
return new Map(
Array.from(value as Map<any, any>).map(([k, v]) => [
return (new Map(
Array.from((value as unknown) as Map<any, any>).map(([k, v]) => [
internalThriftInstanceToObject(type.keyType, k),
internalThriftInstanceToObject(type.valueType, v),
])
) as V;
) as unknown) as V;
case 'list':
return (value as any[]).map((v) =>
return (((value as unknown) as any[]).map((v) =>
internalThriftInstanceToObject(type.valueType, v)
) as V;
) as unknown) as V;
case 'set':
return new Set(
Array.from(value as Set<any>).map((v) =>
return (new Set(
Array.from((value as unknown) as Set<any>).map((v) =>
internalThriftInstanceToObject(type.valueType, v)
)
) as V;
) as unknown) as V;
default:
throw new Error('Unknown complex thrift type');
}
} else if (isPrimitiveType(type)) {
switch (type) {
case 'i64':
return (value as Int64).toNumber() as V;
return (((value as unknown) as Int64).toNumber() as unknown) as V;
default:
return value;
}

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-details-item-theme($theme) {
$foreground: map-get($theme, foreground);

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@import './timeline-item/timeline-item-badge/timeline-item-badge-theme';
@mixin cc-timeline-theme($theme) {

View File

@ -1,4 +1,4 @@
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@mixin cc-timeline-item-badge-theme($theme) {
$blue: map-get($theme, blue);

View File

@ -28,13 +28,13 @@ import { MatFormFieldControl } from '@angular/material/form-field';
import { Subject } from 'rxjs';
import * as uuid from 'uuid';
import { InputMixinBase } from './input-base';
import { INPUT_MIXIN_BASE } from './input-base';
// eslint-disable-next-line @angular-eslint/directive-selector
@Directive({ selector: 'cc-custom-form-control' })
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class CustomFormControl<I extends any = any, P extends any = I> extends InputMixinBase
export class CustomFormControl<I = any, P = I> extends INPUT_MIXIN_BASE
implements
AfterViewInit,
ControlValueAccessor,

View File

@ -1,9 +1,5 @@
import { FormGroupDirective, NgControl, NgForm } from '@angular/forms';
import {
CanUpdateErrorStateCtor,
ErrorStateMatcher,
mixinErrorState,
} from '@angular/material/core';
import { ErrorStateMatcher, mixinErrorState } from '@angular/material/core';
export class InputBase {
constructor(
@ -14,7 +10,4 @@ export class InputBase {
) {}
}
// eslint-disable-next-line @typescript-eslint/naming-convention
export const InputMixinBase: CanUpdateErrorStateCtor & typeof InputBase = mixinErrorState(
InputBase
);
export const INPUT_MIXIN_BASE = mixinErrorState(InputBase);

View File

@ -1,7 +1,7 @@
{
"proto": {
"damsel": { "path": "./node_modules/damsel/proto", "meta": true },
"machinegun": "./node_modules/machinegun_proto/proto",
"machinegun": "./node_modules/machinegun-proto/proto",
"fistful": "./node_modules/fistful-proto/proto",
"messages": "./node_modules/messages-proto/proto",
"file-storage": "./node_modules/file-storage-proto/proto",