mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
IMP-328: Bump deanonimus. Reverting table optimizations (#393)
This commit is contained in:
parent
0f2441a130
commit
f84c58c442
8
package-lock.json
generated
8
package-lock.json
generated
@ -20,7 +20,7 @@
|
||||
"@angular/platform-server": "18.2.4",
|
||||
"@angular/router": "18.2.4",
|
||||
"@ngneat/input-mask": "6.0.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-6605c72.0",
|
||||
"@vality/domain-proto": "2.0.1-7762f6c.0",
|
||||
"@vality/dominator-proto": "1.0.1-41bee97.0",
|
||||
"@vality/fistful-proto": "2.0.1-88e69a5.0",
|
||||
@ -5920,9 +5920,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vality/deanonimus-proto": {
|
||||
"version": "2.0.1-2a02d87.0",
|
||||
"resolved": "https://registry.npmjs.org/@vality/deanonimus-proto/-/deanonimus-proto-2.0.1-2a02d87.0.tgz",
|
||||
"integrity": "sha512-mokuK6w+ExASdDE6+L9bM2SaS0yVPSyBvXavY8rRtNzZgVdmj7KSRiyGmXz41grhS6jcvD8aR85Nj4o7/iogmQ=="
|
||||
"version": "2.0.1-6605c72.0",
|
||||
"resolved": "https://registry.npmjs.org/@vality/deanonimus-proto/-/deanonimus-proto-2.0.1-6605c72.0.tgz",
|
||||
"integrity": "sha512-vRJV1F+KChEGXRvpA5VBgT4y6pUpIyBOFyKfk74AyRG6VyERGt7Qh5rnUD/odaSOzJrI91qXfb4vIh8qt970ng=="
|
||||
},
|
||||
"node_modules/@vality/domain-proto": {
|
||||
"version": "2.0.1-7762f6c.0",
|
||||
|
@ -29,7 +29,7 @@
|
||||
"@angular/platform-server": "18.2.4",
|
||||
"@angular/router": "18.2.4",
|
||||
"@ngneat/input-mask": "6.0.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-6605c72.0",
|
||||
"@vality/domain-proto": "2.0.1-7762f6c.0",
|
||||
"@vality/dominator-proto": "1.0.1-41bee97.0",
|
||||
"@vality/fistful-proto": "2.0.1-88e69a5.0",
|
||||
|
@ -1,23 +1,27 @@
|
||||
import { Injectable, DestroyRef } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { Domain, DomainObject, Reference } from '@vality/domain-proto/domain';
|
||||
import { DomainObject, Reference } from '@vality/domain-proto/domain';
|
||||
import { Commit, Snapshot, Version } from '@vality/domain-proto/domain_config';
|
||||
import { NotifyLogService, handleError, inProgressFrom, progressTo } from '@vality/ng-core';
|
||||
import { getUnionKey } from '@vality/ng-thrift';
|
||||
import isEqual from 'lodash-es/isEqual';
|
||||
import { BehaviorSubject, defer, Observable, of, ReplaySubject, filter, combineLatest } from 'rxjs';
|
||||
import { map, shareReplay, startWith, switchMap, take, tap } from 'rxjs/operators';
|
||||
|
||||
import { DomainSecretService } from '../../../shared/services';
|
||||
import { RepositoryService } from '../repository.service';
|
||||
import { createObjectHash } from '../utils/create-object-hash';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DomainStoreService {
|
||||
version$ = combineLatest([defer(() => this.snapshot$), defer(() => this.progress$)]).pipe(
|
||||
filter(([, p]) => !p),
|
||||
domain$ = defer(() => this.rawDomain$).pipe(
|
||||
map((d) => this.domainSecretService.reduceDomain(d)),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
version$ = defer(() => this.loadedSnapshot$).pipe(
|
||||
map(([s]) => s.version),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
isLoading$ = inProgressFrom(
|
||||
() => this.progress$,
|
||||
@ -34,8 +38,31 @@ export class DomainStoreService {
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
shareReplay(1),
|
||||
);
|
||||
private loadedSnapshot$ = combineLatest([
|
||||
defer(() => this.snapshot$),
|
||||
defer(() => this.progress$),
|
||||
]).pipe(
|
||||
filter(([, p]) => !p),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
private reload$ = new ReplaySubject<void>(1);
|
||||
private progress$ = new BehaviorSubject(0);
|
||||
private rawDomain$ = this.loadedSnapshot$.pipe(
|
||||
map(([s]) => s?.domain),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
private objects$ = combineLatest([this.rawDomain$, this.domain$]).pipe(
|
||||
map(
|
||||
([rawDomain, domain]) =>
|
||||
new Map(
|
||||
Array.from(rawDomain).map(([ref, raw]) => [
|
||||
createObjectHash(ref),
|
||||
{ raw, reduced: domain.get(ref) },
|
||||
]),
|
||||
),
|
||||
),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
constructor(
|
||||
private repositoryService: RepositoryService,
|
||||
@ -48,17 +75,9 @@ export class DomainStoreService {
|
||||
this.reload$.next();
|
||||
}
|
||||
|
||||
getDomain(raw = false): Observable<Domain> {
|
||||
return combineLatest([defer(() => this.snapshot$), defer(() => this.progress$)]).pipe(
|
||||
filter(([, p]) => !p),
|
||||
map(([s]) => s?.domain),
|
||||
map((d) => (raw ? d : this.domainSecretService.reduceDomain(d))),
|
||||
);
|
||||
}
|
||||
|
||||
getObject(ref: Reference, raw = false): Observable<DomainObject> {
|
||||
return this.getDomain(raw).pipe(
|
||||
map((domain) => Array.from(domain).find(([r]) => isEqual(ref, r))?.[1]),
|
||||
return this.objects$.pipe(
|
||||
map((objects) => objects.get(createObjectHash(ref))?.[raw ? 'raw' : 'reduced']),
|
||||
);
|
||||
}
|
||||
|
||||
@ -69,7 +88,7 @@ export class DomainStoreService {
|
||||
getObjectsRefs<T extends keyof DomainObject>(
|
||||
objectType: T,
|
||||
): Observable<[Reference, DomainObject][]> {
|
||||
return this.getDomain().pipe(
|
||||
return this.domain$.pipe(
|
||||
map((d) => Array.from(d).filter(([, o]) => getUnionKey(o) === objectType)),
|
||||
);
|
||||
}
|
||||
|
@ -92,8 +92,7 @@
|
||||
Change status
|
||||
</button>
|
||||
<button mat-raised-button (click)="createWallet()">Add wallet modification</button>
|
||||
<!-- <button mat-raised-button (click)="createShop(false)">Add shop modifications</button>-->
|
||||
<button mat-raised-button (click)="createShop(true)">Add shop modifications</button>
|
||||
<button mat-raised-button (click)="createShop()">Add shop modifications</button>
|
||||
<button color="primary" mat-raised-button (click)="addModification()">
|
||||
Add modification
|
||||
</button>
|
||||
|
@ -115,13 +115,13 @@ export class ClaimComponent {
|
||||
});
|
||||
}
|
||||
|
||||
createShop(withoutPayout = true) {
|
||||
createShop() {
|
||||
combineLatest([this.party$, this.claim$])
|
||||
.pipe(
|
||||
first(),
|
||||
switchMap(([party, claim]) =>
|
||||
this.dialogService
|
||||
.open(CreateShopDialogComponent, { party, claim, withoutPayout })
|
||||
.open(CreateShopDialogComponent, { party, claim })
|
||||
.afterClosed(),
|
||||
),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
|
@ -74,10 +74,7 @@ const DEFAULT_SHOP_LOCATION: ShopLocation = {
|
||||
styles: ``,
|
||||
})
|
||||
export class CreateShopDialogComponent
|
||||
extends DialogSuperclass<
|
||||
CreateShopDialogComponent,
|
||||
{ party: Party; claim: Claim; withoutPayout: boolean }
|
||||
>
|
||||
extends DialogSuperclass<CreateShopDialogComponent, { party: Party; claim: Claim }>
|
||||
implements OnInit
|
||||
{
|
||||
static defaultDialogConfig = DEFAULT_DIALOG_CONFIG.large;
|
||||
@ -156,7 +153,6 @@ export class CreateShopDialogComponent
|
||||
this.form.value;
|
||||
const contractorId = short().uuid();
|
||||
const contractId = short().uuid();
|
||||
const payoutToolId = short().generate();
|
||||
const shopId = short().uuid();
|
||||
this.claimManagementService
|
||||
.UpdateClaim(
|
||||
@ -188,31 +184,6 @@ export class CreateShopDialogComponent
|
||||
},
|
||||
},
|
||||
},
|
||||
...(this.dialogData.withoutPayout
|
||||
? []
|
||||
: [
|
||||
{
|
||||
party_modification: {
|
||||
contract_modification: {
|
||||
id: contractId,
|
||||
modification: {
|
||||
payout_tool_modification: {
|
||||
payout_tool_id: payoutToolId,
|
||||
modification: {
|
||||
creation: {
|
||||
currency: currency,
|
||||
tool_info: {
|
||||
russian_bank_account:
|
||||
DEFAULT_RUSSIAN_BANK_ACCOUNT,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]),
|
||||
{
|
||||
party_modification: {
|
||||
shop_modification: {
|
||||
@ -223,9 +194,6 @@ export class CreateShopDialogComponent
|
||||
category: category,
|
||||
location: DEFAULT_SHOP_LOCATION,
|
||||
contract_id: contractId,
|
||||
...(this.dialogData.withoutPayout
|
||||
? {}
|
||||
: { payout_tool_id: payoutToolId }),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -59,7 +59,7 @@ export class DomainObjectsTableComponent implements OnInit {
|
||||
(this.qp.params.types as (keyof DomainObject)[]) || [],
|
||||
);
|
||||
objects$: Observable<DomainObjectData[]> = combineLatest([
|
||||
this.domainStoreService.getDomain(),
|
||||
this.domainStoreService.domain$,
|
||||
this.typesControl.valueChanges.pipe(startWith(this.typesControl.value)),
|
||||
]).pipe(
|
||||
switchMap(([objects, types]) =>
|
||||
|
@ -34,7 +34,7 @@ export class DomainObjectCardComponent implements OnChanges {
|
||||
|
||||
ref$ = new ReplaySubject<Reference>(1);
|
||||
progress$ = this.domainStoreService.isLoading$;
|
||||
domainObject$ = combineLatest([this.domainStoreService.getDomain(), this.ref$]).pipe(
|
||||
domainObject$ = combineLatest([this.domainStoreService.domain$, this.ref$]).pipe(
|
||||
map(([domain, ref]) =>
|
||||
domain.get(Array.from(domain.keys()).find((k) => isEqualThrift(k, ref))),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user