FR-624: Id generator implementation (#485)

* id generator implementation

* replace genXRequestID with id-generator and remove it

* remove export

* lint error fix

* package lock gen with npm 7

* package lock gen with npm 7

* package lock gen with npm 7

* fixes

* package lock fix

* fixes
This commit is contained in:
Denis Ezhov 2021-06-10 16:55:16 +03:00 committed by GitHub
parent 0f9a67e44e
commit d60e5d24d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 296 additions and 315 deletions

110
package-lock.json generated
View File

@ -23,6 +23,7 @@
"@ngneat/reactive-forms": "^1.5.0", "@ngneat/reactive-forms": "^1.5.0",
"@ngneat/transloco": "^2.19.1", "@ngneat/transloco": "^2.19.1",
"@ngneat/until-destroy": "^8.0.3", "@ngneat/until-destroy": "^8.0.3",
"@rbkmoney/id-generator": "^0.1.3",
"@rbkmoney/partial-fetcher": "~0.4.0", "@rbkmoney/partial-fetcher": "~0.4.0",
"@rbkmoney/utils": "~0.4.0", "@rbkmoney/utils": "~0.4.0",
"@s-libs/js-core": "^11.3.0", "@s-libs/js-core": "^11.3.0",
@ -52,7 +53,6 @@
"ts-keycode-enum": "^1.0.6", "ts-keycode-enum": "^1.0.6",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"utility-types": "^3.10.0", "utility-types": "^3.10.0",
"uuid": "^3.3.3",
"zone.js": "~0.10.2" "zone.js": "~0.10.2"
}, },
"devDependencies": { "devDependencies": {
@ -77,7 +77,6 @@
"@types/moment": "^2.13.0", "@types/moment": "^2.13.0",
"@types/node": "^12.12.32", "@types/node": "^12.12.32",
"@types/prettier": "^2.2.3", "@types/prettier": "^2.2.3",
"@types/uuid": "^3.4.5",
"@typescript-eslint/parser": "~4.22.0", "@typescript-eslint/parser": "~4.22.0",
"del": "^5.1.0", "del": "^5.1.0",
"eslint": "^7.25.0", "eslint": "^7.25.0",
@ -3714,6 +3713,19 @@
"eslint": ">=7.0.0" "eslint": ">=7.0.0"
} }
}, },
"node_modules/@rbkmoney/id-generator": {
"version": "0.1.3",
"resolved": "https://npm.pkg.github.com/download/@rbkmoney/id-generator/0.1.3/e77ad9daf20909c488cdecfdaec68da4d5e5c03a8b99df9707d09b470e6d5552",
"integrity": "sha512-Fk5D87oWc3MMqPLC6vYEa3DDRGQGlez8IUGC8zrrkxJdyfft+r/VnHGjIXLVEaRozI9CSiS8g4CtawXGcyyRkQ==",
"dependencies": {
"short-uuid": "^4.2.0",
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^11.2.14",
"@angular/core": "^11.2.14"
}
},
"node_modules/@rbkmoney/partial-fetcher": { "node_modules/@rbkmoney/partial-fetcher": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://npm.pkg.github.com/download/@rbkmoney/partial-fetcher/0.4.0/e6fe12d5cd6e7f102449888933146488afd0dc47e35b80e6ffe4dcf9dbfa42e0", "resolved": "https://npm.pkg.github.com/download/@rbkmoney/partial-fetcher/0.4.0/e6fe12d5cd6e7f102449888933146488afd0dc47e35b80e6ffe4dcf9dbfa42e0",
@ -4419,12 +4431,6 @@
"integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==",
"dev": true "dev": true
}, },
"node_modules/@types/uuid": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
"integrity": "sha512-XDwyIlt/47l2kWLTzw/mtrpLdB+GPSskR2n/PIcPn+VYhVO77rGhRncIR5GPU0KRzXuqkDO+J5qqrG0Y8P6jzQ==",
"dev": true
},
"node_modules/@types/webpack-sources": { "node_modules/@types/webpack-sources": {
"version": "0.1.8", "version": "0.1.8",
"resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz", "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz",
@ -5290,6 +5296,11 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/any-base": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
},
"node_modules/anymatch": { "node_modules/anymatch": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
@ -6397,19 +6408,6 @@
"fsevents": "~2.3.1" "fsevents": "~2.3.1"
} }
}, },
"node_modules/chokidar/node_modules/fsevents": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz",
"integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==",
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/chownr": { "node_modules/chownr": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
@ -18874,6 +18872,26 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/short-uuid": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz",
"integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==",
"dependencies": {
"any-base": "^1.1.0",
"uuid": "^8.3.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/short-uuid/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
@ -21280,6 +21298,7 @@
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true,
"bin": { "bin": {
"uuid": "bin/uuid" "uuid": "bin/uuid"
} }
@ -26493,6 +26512,15 @@
} }
} }
}, },
"@rbkmoney/id-generator": {
"version": "0.1.3",
"resolved": "https://npm.pkg.github.com/download/@rbkmoney/id-generator/0.1.3/e77ad9daf20909c488cdecfdaec68da4d5e5c03a8b99df9707d09b470e6d5552",
"integrity": "sha512-Fk5D87oWc3MMqPLC6vYEa3DDRGQGlez8IUGC8zrrkxJdyfft+r/VnHGjIXLVEaRozI9CSiS8g4CtawXGcyyRkQ==",
"requires": {
"short-uuid": "^4.2.0",
"tslib": "^2.0.0"
}
},
"@rbkmoney/partial-fetcher": { "@rbkmoney/partial-fetcher": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://npm.pkg.github.com/download/@rbkmoney/partial-fetcher/0.4.0/e6fe12d5cd6e7f102449888933146488afd0dc47e35b80e6ffe4dcf9dbfa42e0", "resolved": "https://npm.pkg.github.com/download/@rbkmoney/partial-fetcher/0.4.0/e6fe12d5cd6e7f102449888933146488afd0dc47e35b80e6ffe4dcf9dbfa42e0",
@ -27140,12 +27168,6 @@
"integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==",
"dev": true "dev": true
}, },
"@types/uuid": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
"integrity": "sha512-XDwyIlt/47l2kWLTzw/mtrpLdB+GPSskR2n/PIcPn+VYhVO77rGhRncIR5GPU0KRzXuqkDO+J5qqrG0Y8P6jzQ==",
"dev": true
},
"@types/webpack-sources": { "@types/webpack-sources": {
"version": "0.1.8", "version": "0.1.8",
"resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz", "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz",
@ -27802,6 +27824,11 @@
"color-convert": "^1.9.0" "color-convert": "^1.9.0"
} }
}, },
"any-base": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
},
"anymatch": { "anymatch": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
@ -28747,15 +28774,6 @@
"is-glob": "~4.0.1", "is-glob": "~4.0.1",
"normalize-path": "~3.0.0", "normalize-path": "~3.0.0",
"readdirp": "~3.5.0" "readdirp": "~3.5.0"
},
"dependencies": {
"fsevents": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz",
"integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==",
"dev": true,
"optional": true
}
} }
}, },
"chownr": { "chownr": {
@ -34967,7 +34985,6 @@
"requires": { "requires": {
"@schematics/angular": "8.0.0", "@schematics/angular": "8.0.0",
"cross-spawn": "^6.0.5", "cross-spawn": "^6.0.5",
"rxjs": "6.4.0",
"webpack-dev-server": "^3.1.14", "webpack-dev-server": "^3.1.14",
"webpack-merge": "^4.2.1" "webpack-merge": "^4.2.1"
}, },
@ -38935,6 +38952,22 @@
"rechoir": "^0.6.2" "rechoir": "^0.6.2"
} }
}, },
"short-uuid": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz",
"integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==",
"requires": {
"any-base": "^1.1.0",
"uuid": "^8.3.2"
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
"signal-exit": { "signal-exit": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
@ -40969,7 +41002,8 @@
"uuid": { "uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}, },
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.3.0", "version": "2.3.0",

View File

@ -7,7 +7,7 @@
"build": "ng build --prod --extraWebpackConfig webpack.extra.js --progress=false", "build": "ng build --prod --extraWebpackConfig webpack.extra.js --progress=false",
"test": "ng test", "test": "ng test",
"test-ci": "ng run dashboard:test-ci", "test-ci": "ng run dashboard:test-ci",
"lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 2247 --cache", "lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 2226 --cache",
"lint-errors": "npm run lint -- --quiet", "lint-errors": "npm run lint -- --quiet",
"lint-fix": "npm run lint -- --fix", "lint-fix": "npm run lint -- --fix",
"e2e": "ng e2e", "e2e": "ng e2e",
@ -40,6 +40,7 @@
"@ngneat/reactive-forms": "^1.5.0", "@ngneat/reactive-forms": "^1.5.0",
"@ngneat/transloco": "^2.19.1", "@ngneat/transloco": "^2.19.1",
"@ngneat/until-destroy": "^8.0.3", "@ngneat/until-destroy": "^8.0.3",
"@rbkmoney/id-generator": "^0.1.3",
"@rbkmoney/partial-fetcher": "~0.4.0", "@rbkmoney/partial-fetcher": "~0.4.0",
"@rbkmoney/utils": "~0.4.0", "@rbkmoney/utils": "~0.4.0",
"@s-libs/js-core": "^11.3.0", "@s-libs/js-core": "^11.3.0",
@ -69,7 +70,6 @@
"ts-keycode-enum": "^1.0.6", "ts-keycode-enum": "^1.0.6",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"utility-types": "^3.10.0", "utility-types": "^3.10.0",
"uuid": "^3.3.3",
"zone.js": "~0.10.2" "zone.js": "~0.10.2"
}, },
"devDependencies": { "devDependencies": {
@ -94,7 +94,6 @@
"@types/moment": "^2.13.0", "@types/moment": "^2.13.0",
"@types/node": "^12.12.32", "@types/node": "^12.12.32",
"@types/prettier": "^2.2.3", "@types/prettier": "^2.2.3",
"@types/uuid": "^3.4.5",
"@typescript-eslint/parser": "~4.22.0", "@typescript-eslint/parser": "~4.22.0",
"del": "^5.1.0", "del": "^5.1.0",
"eslint": "^7.25.0", "eslint": "^7.25.0",

View File

@ -1,15 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Account, AccountsService } from '@dsh/api-codegen/capi/swagger-codegen'; import { Account, AccountsService } from '@dsh/api-codegen/capi/swagger-codegen';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class AccountService { export class AccountService {
constructor(private accountsService: AccountsService) {} constructor(private accountsService: AccountsService, private idGenerator: IdGeneratorService) {}
getAccountByID(accountID: number): Observable<Account> { getAccountByID(accountID: number): Observable<Account> {
return this.accountsService.getAccountByID(genXRequestID(), accountID); return this.accountsService.getAccountByID(this.idGenerator.shortUuid(), accountID);
} }
} }

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators'; import { switchMap } from 'rxjs/operators';
@ -17,7 +18,7 @@ import {
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { PaymentInstitutionRealm } from '../model'; import { PaymentInstitutionRealm } from '../model';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
@Injectable() @Injectable()
export class AnalyticsService { export class AnalyticsService {
@ -25,7 +26,8 @@ export class AnalyticsService {
constructor( constructor(
private analyticsService: APIAnalyticsService, private analyticsService: APIAnalyticsService,
private keycloakTokenInfoService: KeycloakTokenInfoService private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {} ) {}
getAveragePayment( getAveragePayment(
@ -40,7 +42,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getAveragePayment( this.analyticsService.getAveragePayment(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -65,7 +67,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsAmount( this.analyticsService.getPaymentsAmount(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -90,7 +92,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsCount( this.analyticsService.getPaymentsCount(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -115,7 +117,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsErrorDistribution( this.analyticsService.getPaymentsErrorDistribution(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -140,7 +142,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsSubErrorDistribution( this.analyticsService.getPaymentsSubErrorDistribution(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -165,7 +167,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsToolDistribution( this.analyticsService.getPaymentsToolDistribution(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -190,7 +192,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getRefundsAmount( this.analyticsService.getRefundsAmount(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -216,7 +218,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsSplitAmount( this.analyticsService.getPaymentsSplitAmount(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -243,7 +245,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getPaymentsSplitCount( this.analyticsService.getPaymentsSplitCount(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -265,7 +267,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getCurrentBalances( this.analyticsService.getCurrentBalances(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
undefined, undefined,
params.shopIDs, params.shopIDs,
@ -280,7 +282,7 @@ export class AnalyticsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.analyticsService.getCurrentBalancesGroupByShop( this.analyticsService.getCurrentBalancesGroupByShop(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
undefined, undefined,
params.shopIDs, params.shopIDs,

View File

@ -1,14 +1,13 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { ClaimChangeset, ClaimsService } from '@dsh/api-codegen/capi'; import { ClaimChangeset, ClaimsService } from '@dsh/api-codegen/capi';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class CapiClaimsService { export class CapiClaimsService {
constructor(private claimsService: ClaimsService) {} constructor(private claimsService: ClaimsService, private idGenerator: IdGeneratorService) {}
createClaim(claimChangeset: ClaimChangeset) { createClaim(claimChangeset: ClaimChangeset) {
return this.claimsService.createClaim(genXRequestID(), claimChangeset); return this.claimsService.createClaim(this.idGenerator.shortUuid(), claimChangeset);
} }
} }

View File

@ -1,18 +1,17 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { PartiesService, Party } from '@dsh/api-codegen/capi'; import { PartiesService, Party } from '@dsh/api-codegen/capi';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class CapiPartiesService { export class CapiPartiesService {
constructor(private partiesService: PartiesService) {} constructor(private partiesService: PartiesService, private idGenerator: IdGeneratorService) {}
/** /**
* Create if not exist and return party * Create if not exist and return party
*/ */
getMyParty(): Observable<Party> { getMyParty(): Observable<Party> {
return this.partiesService.getMyParty(genXRequestID()); return this.partiesService.getMyParty(this.idGenerator.shortUuid());
} }
} }

View File

@ -1,5 +1,4 @@
import moment from 'moment'; import moment from 'moment';
import * as uuid from 'uuid/v4';
import { import {
ClaimChangeset, ClaimChangeset,
@ -127,11 +126,11 @@ const shopAccountCreationChange = (shopID: string, currency: string): ShopAccoun
}; };
}; };
export const createTestShopClaimChangeset = (id?: string): ClaimChangeset => { export const createTestShopClaimChangeset = (
const testShopID = id || uuid(); testShopID: string,
const testContractID = id || uuid(); testContractID: string,
const testPayoutToolID = id || uuid(); testPayoutToolID: string
): ClaimChangeset => {
return [ return [
contractCreationChange(testContractID, 1), contractCreationChange(testContractID, 1),
contractPayoutToolCreationChange(testContractID, testPayoutToolID, 'RUB'), contractPayoutToolCreationChange(testContractID, testPayoutToolID, 'RUB'),

View File

@ -1,11 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { shareReplay, switchMap } from 'rxjs/operators'; import { shareReplay, switchMap } from 'rxjs/operators';
import { CategoriesService as CategoriesApiService } from '@dsh/api-codegen/capi'; import { CategoriesService as CategoriesApiService } from '@dsh/api-codegen/capi';
import { SHARE_REPLAY_CONF } from '../../custom-operators'; import { SHARE_REPLAY_CONF } from '../../custom-operators';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class CategoriesService { export class CategoriesService {
@ -13,11 +13,11 @@ export class CategoriesService {
// eslint-disable-next-line @typescript-eslint/member-ordering // eslint-disable-next-line @typescript-eslint/member-ordering
categories$ = this.reloadCategories$.pipe( categories$ = this.reloadCategories$.pipe(
switchMap(() => this.categoriesService.getCategories(genXRequestID())), switchMap(() => this.categoriesService.getCategories(this.idGenerator.shortUuid())),
shareReplay(SHARE_REPLAY_CONF) shareReplay(SHARE_REPLAY_CONF)
); );
constructor(private categoriesService: CategoriesApiService) {} constructor(private categoriesService: CategoriesApiService, private idGenerator: IdGeneratorService) {}
reload() { reload() {
this.reloadCategories$.next(); this.reloadCategories$.next();

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { shareReplay } from 'rxjs/operators'; import { shareReplay } from 'rxjs/operators';
@ -11,14 +12,13 @@ import {
} from '@dsh/api-codegen/claim-management'; } from '@dsh/api-codegen/claim-management';
import { mapResult, noContinuationToken } from '../../custom-operators'; import { mapResult, noContinuationToken } from '../../custom-operators';
import { genXRequestID } from '../utils';
export const CLAIM_STATUS = StatusModificationUnit.StatusEnum; export const CLAIM_STATUS = StatusModificationUnit.StatusEnum;
// TODO: refactor this service as claim requests service // TODO: refactor this service as claim requests service
@Injectable() @Injectable()
export class ClaimsService { export class ClaimsService {
constructor(private claimsService: APIClaimsService) {} constructor(private claimsService: APIClaimsService, private idGenerator: IdGeneratorService) {}
searchClaims( searchClaims(
limit: number, limit: number,
@ -27,7 +27,7 @@ export class ClaimsService {
continuationToken?: string continuationToken?: string
) { ) {
return this.claimsService.searchClaims( return this.claimsService.searchClaims(
genXRequestID(), this.idGenerator.shortUuid(),
limit, limit,
undefined, undefined,
continuationToken, continuationToken,
@ -41,22 +41,28 @@ export class ClaimsService {
} }
getClaimByID(claimID: number): Observable<Claim> { getClaimByID(claimID: number): Observable<Claim> {
return this.claimsService.getClaimByID(genXRequestID(), claimID); return this.claimsService.getClaimByID(this.idGenerator.shortUuid(), claimID);
} }
createClaim(changeset: Modification[]): Observable<Claim> { createClaim(changeset: Modification[]): Observable<Claim> {
return this.claimsService.createClaim(genXRequestID(), changeset); return this.claimsService.createClaim(this.idGenerator.shortUuid(), changeset);
} }
updateClaimByID(claimID: number, claimRevision: number, changeset: Modification[]): Observable<void> { updateClaimByID(claimID: number, claimRevision: number, changeset: Modification[]): Observable<void> {
return this.claimsService.updateClaimByID(genXRequestID(), claimID, claimRevision, changeset); return this.claimsService.updateClaimByID(this.idGenerator.shortUuid(), claimID, claimRevision, changeset);
} }
revokeClaimByID(claimID: number, claimRevision: number, reason: Reason): Observable<void> { revokeClaimByID(claimID: number, claimRevision: number, reason: Reason): Observable<void> {
return this.claimsService.revokeClaimByID(genXRequestID(), claimID, claimRevision, undefined, reason); return this.claimsService.revokeClaimByID(
this.idGenerator.shortUuid(),
claimID,
claimRevision,
undefined,
reason
);
} }
requestReviewClaimByID(claimID: number, claimRevision: number): Observable<void> { requestReviewClaimByID(claimID: number, claimRevision: number): Observable<void> {
return this.claimsService.requestReviewClaimByID(genXRequestID(), claimID, claimRevision); return this.claimsService.requestReviewClaimByID(this.idGenerator.shortUuid(), claimID, claimRevision);
} }
} }

View File

@ -1,15 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Contract, ContractsService as ContractsAPIService } from '@dsh/api-codegen/capi/swagger-codegen'; import { Contract, ContractsService as ContractsAPIService } from '@dsh/api-codegen/capi/swagger-codegen';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class ContractsService { export class ContractsService {
constructor(private contractsService: ContractsAPIService) {} constructor(private contractsService: ContractsAPIService, private idGenerator: IdGeneratorService) {}
getContractByID(contractID: string): Observable<Contract> { getContractByID(contractID: string): Observable<Contract> {
return this.contractsService.getContractByID(genXRequestID(), contractID); return this.contractsService.getContractByID(this.idGenerator.shortUuid(), contractID);
} }
} }

View File

@ -1,17 +1,18 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { DepositsService as ApiDepositsService } from '@dsh/api-codegen/wallet-api/swagger-codegen'; import { DepositsService as ApiDepositsService } from '@dsh/api-codegen/wallet-api/swagger-codegen';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { DepositsSearchParams } from './deposits-search-params'; import { DepositsSearchParams } from './deposits-search-params';
@Injectable() @Injectable()
export class DepositsService { export class DepositsService {
constructor(private depositsService: ApiDepositsService) {} constructor(private depositsService: ApiDepositsService, private idGenerator: IdGeneratorService) {}
listDeposits(params: DepositsSearchParams, limit = 20, continuationToken?: string) { listDeposits(params: DepositsSearchParams, limit = 20, continuationToken?: string) {
return this.depositsService.listDeposits( return this.depositsService.listDeposits(
genXRequestID(), this.idGenerator.shortUuid(),
limit, limit,
undefined, undefined,
params.walletID, params.walletID,
@ -30,7 +31,7 @@ export class DepositsService {
listDepositReverts(params: DepositsSearchParams, limit = 20, continuationToken?: string) { listDepositReverts(params: DepositsSearchParams, limit = 20, continuationToken?: string) {
return this.depositsService.listDepositReverts( return this.depositsService.listDepositReverts(
genXRequestID(), this.idGenerator.shortUuid(),
limit, limit,
undefined, undefined,
params.walletID, params.walletID,

View File

@ -1,16 +1,19 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { forkJoin, Observable, of } from 'rxjs'; import { forkJoin, Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators'; import { map, switchMap } from 'rxjs/operators';
import { FilesService as FilesApiService } from '@dsh/api-codegen/dark-api'; import { FilesService as FilesApiService } from '@dsh/api-codegen/dark-api';
import { FileData, FileDownload, FileUploadData } from '@dsh/api-codegen/dark-api/swagger-codegen'; import { FileData, FileDownload, FileUploadData } from '@dsh/api-codegen/dark-api/swagger-codegen';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class FilesService { export class FilesService {
constructor(private filesService: FilesApiService, private http: HttpClient) {} constructor(
private filesService: FilesApiService,
private http: HttpClient,
private idGenerator: IdGeneratorService
) {}
uploadFiles(files: File[]): Observable<string[]> { uploadFiles(files: File[]): Observable<string[]> {
return forkJoin( return forkJoin(
@ -26,7 +29,7 @@ export class FilesService {
} }
getFileInfo(fileID: string): Observable<FileData> { getFileInfo(fileID: string): Observable<FileData> {
return this.filesService.getFileInfo(genXRequestID(), fileID).pipe( return this.filesService.getFileInfo(this.idGenerator.shortUuid(), fileID).pipe(
map((file) => ({ map((file) => ({
...file, ...file,
fileName: decodeURI(file.fileName), fileName: decodeURI(file.fileName),
@ -35,7 +38,7 @@ export class FilesService {
} }
downloadFile(fileID: string): Observable<FileDownload> { downloadFile(fileID: string): Observable<FileDownload> {
return this.filesService.downloadFile(genXRequestID(), fileID); return this.filesService.downloadFile(this.idGenerator.shortUuid(), fileID);
} }
private uploadFileToUrl(file: File, url: string): Observable<any> { private uploadFileToUrl(file: File, url: string): Observable<any> {
@ -50,6 +53,6 @@ export class FilesService {
} }
private getUploadLink(): Observable<FileUploadData> { private getUploadLink(): Observable<FileUploadData> {
return this.filesService.uploadFile(genXRequestID(), { metadata: {} }); return this.filesService.uploadFile(this.idGenerator.shortUuid(), { metadata: {} });
} }
} }

View File

@ -1,11 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { pluck, shareReplay, startWith, switchMapTo } from 'rxjs/operators'; import { pluck, shareReplay, startWith, switchMapTo } from 'rxjs/operators';
import { IdentitiesService, Identity } from '@dsh/api-codegen/wallet-api/swagger-codegen'; import { IdentitiesService, Identity } from '@dsh/api-codegen/wallet-api/swagger-codegen';
import { SHARE_REPLAY_CONF } from '../../custom-operators'; import { SHARE_REPLAY_CONF } from '../../custom-operators';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class IdentityService { export class IdentityService {
@ -19,13 +19,13 @@ export class IdentityService {
shareReplay(SHARE_REPLAY_CONF) shareReplay(SHARE_REPLAY_CONF)
); );
constructor(private identityService: IdentitiesService) {} constructor(private identityService: IdentitiesService, private idGenerator: IdGeneratorService) {}
reloadIdentities() { reloadIdentities() {
this.reloadIdentities$.next(); this.reloadIdentities$.next();
} }
listIdentities() { listIdentities() {
return this.identityService.listIdentities(genXRequestID(), 1000); return this.identityService.listIdentities(this.idGenerator.shortUuid(), 1000);
} }
} }

View File

@ -1,21 +1,23 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { import {
InvoiceTemplateCreateParams, InvoiceTemplateCreateParams,
InvoiceTemplatesService as InvoiceTemplatesApiService, InvoiceTemplatesService as InvoiceTemplatesApiService,
} from '@dsh/api-codegen/capi'; } from '@dsh/api-codegen/capi';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class InvoiceTemplatesService { export class InvoiceTemplatesService {
constructor(private invoiceTemplatesService: InvoiceTemplatesApiService) {} constructor(private invoiceTemplatesService: InvoiceTemplatesApiService, private idGenerator: IdGeneratorService) {}
createInvoiceTemplate(params: InvoiceTemplateCreateParams) { createInvoiceTemplate(params: InvoiceTemplateCreateParams) {
return this.invoiceTemplatesService.createInvoiceTemplate(genXRequestID(), params); return this.invoiceTemplatesService.createInvoiceTemplate(this.idGenerator.shortUuid(), params);
} }
getInvoicePaymentMethodsByTemplateID(invoiceTemplateID: string) { getInvoicePaymentMethodsByTemplateID(invoiceTemplateID: string) {
return this.invoiceTemplatesService.getInvoicePaymentMethodsByTemplateID(genXRequestID(), invoiceTemplateID); return this.invoiceTemplatesService.getInvoicePaymentMethodsByTemplateID(
this.idGenerator.shortUuid(),
invoiceTemplateID
);
} }
} }

View File

@ -1,40 +1,40 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Invoice, InvoiceParams, Reason } from '@dsh/api-codegen/capi'; import { Invoice, InvoiceParams, Reason } from '@dsh/api-codegen/capi';
import { InvoicesService } from '@dsh/api-codegen/capi/invoices.service'; import { InvoicesService } from '@dsh/api-codegen/capi/invoices.service';
import { Replace } from '../../../type-utils'; import { Replace } from '../../../type-utils';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class InvoiceService { export class InvoiceService {
constructor(private invoicesService: InvoicesService) {} constructor(private invoicesService: InvoicesService, private idGenerator: IdGeneratorService) {}
getInvoiceByID(invoiceID: string): Observable<Invoice> { getInvoiceByID(invoiceID: string): Observable<Invoice> {
return this.invoicesService.getInvoiceByID(genXRequestID(), invoiceID); return this.invoicesService.getInvoiceByID(this.idGenerator.shortUuid(), invoiceID);
} }
createInvoice({ dueDate, ...invoiceParams }: Replace<InvoiceParams, { dueDate: string }>) { createInvoice({ dueDate, ...invoiceParams }: Replace<InvoiceParams, { dueDate: string }>) {
return this.invoicesService.createInvoice(genXRequestID(), { return this.invoicesService.createInvoice(this.idGenerator.shortUuid(), {
...invoiceParams, ...invoiceParams,
dueDate: dueDate as any as Date, dueDate: dueDate as any as Date,
}); });
} }
createInvoiceAccessToken(invoiceID: string) { createInvoiceAccessToken(invoiceID: string) {
return this.invoicesService.createInvoiceAccessToken(genXRequestID(), invoiceID); return this.invoicesService.createInvoiceAccessToken(this.idGenerator.shortUuid(), invoiceID);
} }
getInvoicePaymentMethods(invoiceID: string) { getInvoicePaymentMethods(invoiceID: string) {
return this.invoicesService.getInvoicePaymentMethods(genXRequestID(), invoiceID); return this.invoicesService.getInvoicePaymentMethods(this.idGenerator.shortUuid(), invoiceID);
} }
fulfillInvoice(invoiceID: string, reason: Reason) { fulfillInvoice(invoiceID: string, reason: Reason) {
return this.invoicesService.fulfillInvoice(genXRequestID(), invoiceID, reason); return this.invoicesService.fulfillInvoice(this.idGenerator.shortUuid(), invoiceID, reason);
} }
rescindInvoice(invoiceID: string, reason: Reason) { rescindInvoice(invoiceID: string, reason: Reason) {
return this.invoicesService.rescindInvoice(genXRequestID(), invoiceID, reason); return this.invoicesService.rescindInvoice(this.idGenerator.shortUuid(), invoiceID, reason);
} }
} }

View File

@ -1,10 +1,8 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IdGeneratorModule } from '../../shared';
import { OrganizationsService } from './organizations.service'; import { OrganizationsService } from './organizations.service';
@NgModule({ @NgModule({
imports: [IdGeneratorModule],
providers: [OrganizationsService], providers: [OrganizationsService],
}) })
export class OrganizationsModule {} export class OrganizationsModule {}

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
@ -21,7 +22,6 @@ import {
RoleId, RoleId,
RolesService, RolesService,
} from '@dsh/api-codegen/organizations'; } from '@dsh/api-codegen/organizations';
import { IdGeneratorService } from '@dsh/app/shared';
import { PickMutable } from '@dsh/type-utils'; import { PickMutable } from '@dsh/type-utils';
@Injectable() @Injectable()
@ -35,41 +35,37 @@ export class OrganizationsService {
) {} ) {}
listOrgMembership(limit?: number, continuationToken?: string): Observable<OrganizationSearchResult> { listOrgMembership(limit?: number, continuationToken?: string): Observable<OrganizationSearchResult> {
return this.orgsService.listOrgMembership( return this.orgsService.listOrgMembership(this.idGeneratorService.shortUuid(), limit, continuationToken);
this.idGeneratorService.generateRequestID(),
limit,
continuationToken
);
} }
getOrg(orgId: Organization['id']): Observable<Organization> { getOrg(orgId: Organization['id']): Observable<Organization> {
return this.orgsService.getOrg(this.idGeneratorService.generateRequestID(), orgId); return this.orgsService.getOrg(this.idGeneratorService.shortUuid(), orgId);
} }
// TODO: Organization.owner should be readonly (maybe fix swag) // TODO: Organization.owner should be readonly (maybe fix swag)
createOrg(org: Omit<PickMutable<Organization>, 'owner'>): Observable<Organization> { createOrg(org: Omit<PickMutable<Organization>, 'owner'>): Observable<Organization> {
return this.orgsService.createOrg(this.idGeneratorService.generateRequestID(), org as Organization); return this.orgsService.createOrg(this.idGeneratorService.shortUuid(), org as Organization);
} }
patchOrg(orgId: Organization['id'], org: InlineObject): Observable<Organization> { patchOrg(orgId: Organization['id'], org: InlineObject): Observable<Organization> {
return this.orgsService.patchOrg(this.idGeneratorService.generateRequestID(), orgId, org); return this.orgsService.patchOrg(this.idGeneratorService.shortUuid(), orgId, org);
} }
joinOrg(request: OrganizationJoinRequest): Observable<OrganizationMembership> { joinOrg(request: OrganizationJoinRequest): Observable<OrganizationMembership> {
return this.orgsService.joinOrg(this.idGeneratorService.generateRequestID(), request); return this.orgsService.joinOrg(this.idGeneratorService.shortUuid(), request);
} }
getOrgRole(orgId: Organization['id'], roleId: RoleId): Observable<Role> { getOrgRole(orgId: Organization['id'], roleId: RoleId): Observable<Role> {
return this.rolesService.getOrgRole(this.idGeneratorService.generateRequestID(), orgId, roleId); return this.rolesService.getOrgRole(this.idGeneratorService.shortUuid(), orgId, roleId);
} }
getOrgMember(orgId: Organization['id'], userId: string): Observable<Member> { getOrgMember(orgId: Organization['id'], userId: string): Observable<Member> {
return this.membersService.getOrgMember(this.idGeneratorService.generateRequestID(), orgId, userId); return this.membersService.getOrgMember(this.idGeneratorService.shortUuid(), orgId, userId);
} }
assignMemberRole(orgId: string, userId: string, memberRole: PickMutable<MemberRole>): Observable<MemberRole> { assignMemberRole(orgId: string, userId: string, memberRole: PickMutable<MemberRole>): Observable<MemberRole> {
return this.membersService.assignMemberRole( return this.membersService.assignMemberRole(
this.idGeneratorService.generateRequestID(), this.idGeneratorService.shortUuid(),
orgId, orgId,
userId, userId,
memberRole as MemberRole memberRole as MemberRole
@ -77,32 +73,27 @@ export class OrganizationsService {
} }
removeMemberRole(orgId: string, userId: string, memberRoleId: MemberRole['id']): Observable<any> { removeMemberRole(orgId: string, userId: string, memberRoleId: MemberRole['id']): Observable<any> {
return this.membersService.removeMemberRole( return this.membersService.removeMemberRole(this.idGeneratorService.shortUuid(), orgId, userId, memberRoleId);
this.idGeneratorService.generateRequestID(),
orgId,
userId,
memberRoleId
);
} }
listOrgMembers(orgId: Organization['id']): Observable<MemberOrgListResult> { listOrgMembers(orgId: Organization['id']): Observable<MemberOrgListResult> {
return this.membersService.listOrgMembers(this.idGeneratorService.generateRequestID(), orgId); return this.membersService.listOrgMembers(this.idGeneratorService.shortUuid(), orgId);
} }
expelOrgMember(orgId: Organization['id'], userId: string): Observable<any> { expelOrgMember(orgId: Organization['id'], userId: string): Observable<any> {
return this.membersService.expelOrgMember(this.idGeneratorService.generateRequestID(), orgId, userId); return this.membersService.expelOrgMember(this.idGeneratorService.shortUuid(), orgId, userId);
} }
cancelOrgMembership(orgId: Organization['id']): Observable<any> { cancelOrgMembership(orgId: Organization['id']): Observable<any> {
return this.orgsService.cancelOrgMembership(this.idGeneratorService.generateRequestID(), orgId); return this.orgsService.cancelOrgMembership(this.idGeneratorService.shortUuid(), orgId);
} }
createInvitation(orgId: Organization['id'], invitation: InvitationRequest): Observable<Invitation> { createInvitation(orgId: Organization['id'], invitation: InvitationRequest): Observable<Invitation> {
return this.invitationsService.createInvitation(this.idGeneratorService.generateRequestID(), orgId, invitation); return this.invitationsService.createInvitation(this.idGeneratorService.shortUuid(), orgId, invitation);
} }
listInvitations(orgId: Organization['id']): Observable<InvitationListResult> { listInvitations(orgId: Organization['id']): Observable<InvitationListResult> {
return this.invitationsService.listInvitations(this.idGeneratorService.generateRequestID(), orgId); return this.invitationsService.listInvitations(this.idGeneratorService.shortUuid(), orgId);
} }
revokeInvitation( revokeInvitation(
@ -111,7 +102,7 @@ export class OrganizationsService {
status?: InlineObject1 status?: InlineObject1
): Observable<any> { ): Observable<any> {
return this.invitationsService.revokeInvitation( return this.invitationsService.revokeInvitation(
this.idGeneratorService.generateRequestID(), this.idGeneratorService.shortUuid(),
orgId, orgId,
invitationId, invitationId,
status status

View File

@ -1,27 +1,26 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { CaptureParams, Payment, PaymentsService } from '@dsh/api-codegen/capi/swagger-codegen'; import { CaptureParams, Payment, PaymentsService } from '@dsh/api-codegen/capi/swagger-codegen';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class PaymentService { export class PaymentService {
constructor(private paymentsService: PaymentsService) {} constructor(private paymentsService: PaymentsService, private idGenerator: IdGeneratorService) {}
cancelPayment(invoiceID: string, paymentID: string, reason: string): Observable<void> { cancelPayment(invoiceID: string, paymentID: string, reason: string): Observable<void> {
return this.paymentsService.cancelPayment(genXRequestID(), invoiceID, paymentID, { reason }); return this.paymentsService.cancelPayment(this.idGenerator.shortUuid(), invoiceID, paymentID, { reason });
} }
capturePayment(invoiceID: string, paymentID: string, params: CaptureParams): Observable<void> { capturePayment(invoiceID: string, paymentID: string, params: CaptureParams): Observable<void> {
return this.paymentsService.capturePayment(genXRequestID(), invoiceID, paymentID, params); return this.paymentsService.capturePayment(this.idGenerator.shortUuid(), invoiceID, paymentID, params);
} }
getPaymentByID(invoiceID: string, paymentID: string): Observable<Payment> { getPaymentByID(invoiceID: string, paymentID: string): Observable<Payment> {
return this.paymentsService.getPaymentByID(genXRequestID(), invoiceID, paymentID); return this.paymentsService.getPaymentByID(this.idGenerator.shortUuid(), invoiceID, paymentID);
} }
getPayments(invoiceID: string): Observable<Payment[]> { getPayments(invoiceID: string): Observable<Payment[]> {
return this.paymentsService.getPayments(genXRequestID(), invoiceID); return this.paymentsService.getPayments(this.idGenerator.shortUuid(), invoiceID);
} }
} }

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
@ -8,21 +9,19 @@ import {
PayoutTool, PayoutTool,
} from '@dsh/api-codegen/capi/swagger-codegen'; } from '@dsh/api-codegen/capi/swagger-codegen';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class PayoutsService { export class PayoutsService {
constructor(private payoutsService: PayoutsAPIService) {} constructor(private payoutsService: PayoutsAPIService, private idGenerator: IdGeneratorService) {}
createPayout(params: PayoutParams): Observable<Payout> { createPayout(params: PayoutParams): Observable<Payout> {
return this.payoutsService.createPayout(genXRequestID(), params); return this.payoutsService.createPayout(this.idGenerator.shortUuid(), params);
} }
getPayoutTools(contractID: string): Observable<PayoutTool[]> { getPayoutTools(contractID: string): Observable<PayoutTool[]> {
return this.payoutsService.getPayoutTools(genXRequestID(), contractID); return this.payoutsService.getPayoutTools(this.idGenerator.shortUuid(), contractID);
} }
getPayoutToolByID(contractID: string, payoutToolID: string): Observable<PayoutTool> { getPayoutToolByID(contractID: string, payoutToolID: string): Observable<PayoutTool> {
return this.payoutsService.getPayoutToolByID(genXRequestID(), contractID, payoutToolID); return this.payoutsService.getPayoutToolByID(this.idGenerator.shortUuid(), contractID, payoutToolID);
} }
} }

View File

@ -1,11 +1,8 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IdGeneratorModule } from '@dsh/app/shared/services';
import { RefundService } from './refund.service'; import { RefundService } from './refund.service';
@NgModule({ @NgModule({
imports: [IdGeneratorModule],
providers: [RefundService], providers: [RefundService],
}) })
export class RefundModule {} export class RefundModule {}

View File

@ -1,23 +1,18 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { PaymentsService, Refund, RefundParams } from '@dsh/api-codegen/capi/swagger-codegen'; import { PaymentsService, Refund, RefundParams } from '@dsh/api-codegen/capi/swagger-codegen';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service';
@Injectable() @Injectable()
export class RefundService { export class RefundService {
constructor(private paymentsService: PaymentsService, private idsService: IdGeneratorService) {} constructor(private paymentsService: PaymentsService, private idsService: IdGeneratorService) {}
createRefund(invoiceID: string, paymentID: string, refundParams: RefundParams): Observable<Refund> { createRefund(invoiceID: string, paymentID: string, refundParams: RefundParams): Observable<Refund> {
return this.paymentsService.createRefund( return this.paymentsService.createRefund(this.idsService.shortUuid(), invoiceID, paymentID, refundParams);
this.idsService.generateRequestID(),
invoiceID,
paymentID,
refundParams
);
} }
getRefunds(invoiceID: string, paymentID: string): Observable<Refund[]> { getRefunds(invoiceID: string, paymentID: string): Observable<Refund[]> {
return this.paymentsService.getRefunds(this.idsService.generateRequestID(), invoiceID, paymentID); return this.paymentsService.getRefunds(this.idsService.shortUuid(), invoiceID, paymentID);
} }
} }

View File

@ -1,11 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators'; import { switchMap } from 'rxjs/operators';
import { InlineResponse20013, Report, ReportLink, ReportsService as ReportsApiService } from '@dsh/api-codegen/anapi'; import { InlineResponse20013, Report, ReportLink, ReportsService as ReportsApiService } from '@dsh/api-codegen/anapi';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { CreateReportReq } from './create-reports'; import { CreateReportReq } from './create-reports';
import { SearchReportsReq } from './search-reports'; import { SearchReportsReq } from './search-reports';
@ -15,14 +16,15 @@ export class ReportsService {
constructor( constructor(
private reportsService: ReportsApiService, private reportsService: ReportsApiService,
private keycloakTokenInfoService: KeycloakTokenInfoService private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {} ) {}
createReport({ fromTime, toTime, shopID }: CreateReportReq): Observable<Report> { createReport({ fromTime, toTime, shopID }: CreateReportReq): Observable<Report> {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.reportsService.createReport( this.reportsService.createReport(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -44,7 +46,7 @@ export class ReportsService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.reportsService.searchReports( this.reportsService.searchReports(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),
@ -61,10 +63,10 @@ export class ReportsService {
} }
downloadFile(reportID: number, fileID: string): Observable<ReportLink> { downloadFile(reportID: number, fileID: string): Observable<ReportLink> {
return this.reportsService.downloadFile(genXRequestID(), reportID, fileID); return this.reportsService.downloadFile(this.idGenerator.shortUuid(), reportID, fileID);
} }
cancelReport(reportID: number): Observable<void> { cancelReport(reportID: number): Observable<void> {
return this.reportsService.cancelReport(genXRequestID(), reportID); return this.reportsService.cancelReport(this.idGenerator.shortUuid(), reportID);
} }
} }

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import moment from 'moment'; import moment from 'moment';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators'; import { map, switchMap } from 'rxjs/operators';
@ -6,7 +7,7 @@ import { map, switchMap } from 'rxjs/operators';
import { InlineResponse2009, Invoice, SearchService } from '@dsh/api-codegen/anapi'; import { InlineResponse2009, Invoice, SearchService } from '@dsh/api-codegen/anapi';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { Duration, InvoicesSearchParams } from './model'; import { Duration, InvoicesSearchParams } from './model';
export type InvoicesAndContinuationToken = InlineResponse2009; export type InvoicesAndContinuationToken = InlineResponse2009;
@ -15,7 +16,11 @@ export type InvoicesAndContinuationToken = InlineResponse2009;
export class InvoiceSearchService { export class InvoiceSearchService {
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$; private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {} constructor(
private searchService: SearchService,
private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {}
searchInvoices( searchInvoices(
fromTime: string, fromTime: string,
@ -27,7 +32,7 @@ export class InvoiceSearchService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.searchService.searchInvoices( this.searchService.searchInvoices(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import moment from 'moment'; import moment from 'moment';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators'; import { map, switchMap } from 'rxjs/operators';
@ -6,7 +7,7 @@ import { map, switchMap } from 'rxjs/operators';
import { InlineResponse20010, PaymentSearchResult, SearchService } from '@dsh/api-codegen/anapi'; import { InlineResponse20010, PaymentSearchResult, SearchService } from '@dsh/api-codegen/anapi';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { Duration, PaymentsSearchParams } from './model'; import { Duration, PaymentsSearchParams } from './model';
export type PaymentsAndContinuationToken = InlineResponse20010; export type PaymentsAndContinuationToken = InlineResponse20010;
@ -15,7 +16,11 @@ export type PaymentsAndContinuationToken = InlineResponse20010;
export class PaymentSearchService { export class PaymentSearchService {
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$; private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {} constructor(
private searchService: SearchService,
private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {}
searchPayments( searchPayments(
fromTime: string, fromTime: string,
@ -27,7 +32,7 @@ export class PaymentSearchService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.searchService.searchPayments( this.searchService.searchPayments(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),

View File

@ -1,11 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators'; import { switchMap } from 'rxjs/operators';
import { InlineResponse20011, SearchService } from '@dsh/api-codegen/anapi'; import { InlineResponse20011, SearchService } from '@dsh/api-codegen/anapi';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { PayoutsSearchParams } from './model'; import { PayoutsSearchParams } from './model';
type PayoutsAndContinuationToken = InlineResponse20011; type PayoutsAndContinuationToken = InlineResponse20011;
@ -14,7 +15,11 @@ type PayoutsAndContinuationToken = InlineResponse20011;
export class PayoutSearchService { export class PayoutSearchService {
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$; private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {} constructor(
private searchService: SearchService,
private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {}
searchPayouts( searchPayouts(
fromTime: string, fromTime: string,
@ -25,7 +30,7 @@ export class PayoutSearchService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.searchService.searchPayouts( this.searchService.searchPayouts(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import moment from 'moment'; import moment from 'moment';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators'; import { map, switchMap } from 'rxjs/operators';
@ -6,7 +7,7 @@ import { map, switchMap } from 'rxjs/operators';
import { InlineResponse20012, Refund, SearchService } from '@dsh/api-codegen/anapi'; import { InlineResponse20012, Refund, SearchService } from '@dsh/api-codegen/anapi';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services'; import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { Duration, RefundsSearchParams } from './model'; import { Duration, RefundsSearchParams } from './model';
export type RefundsAndContinuationToken = InlineResponse20012; export type RefundsAndContinuationToken = InlineResponse20012;
@ -15,7 +16,11 @@ export type RefundsAndContinuationToken = InlineResponse20012;
export class RefundSearchService { export class RefundSearchService {
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$; private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {} constructor(
private searchService: SearchService,
private keycloakTokenInfoService: KeycloakTokenInfoService,
private idGenerator: IdGeneratorService
) {}
searchRefunds( searchRefunds(
fromTime: string, fromTime: string,
@ -27,7 +32,7 @@ export class RefundSearchService {
return this.partyID$.pipe( return this.partyID$.pipe(
switchMap((partyID) => switchMap((partyID) =>
this.searchService.searchRefunds( this.searchService.searchRefunds(
genXRequestID(), this.idGenerator.shortUuid(),
partyID, partyID,
toDateLike(fromTime), toDateLike(fromTime),
toDateLike(toTime), toDateLike(toTime),

View File

@ -1,11 +1,10 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SenderModule as ApiSenderModule } from '../../api-codegen/sender'; import { SenderModule as ApiSenderModule } from '../../api-codegen/sender';
import { IdGeneratorModule } from '../../shared/services';
import { MessagesService } from './services/messages/messages.service'; import { MessagesService } from './services/messages/messages.service';
@NgModule({ @NgModule({
imports: [ApiSenderModule, IdGeneratorModule], imports: [ApiSenderModule],
providers: [MessagesService], providers: [MessagesService],
}) })
export class SenderModule {} export class SenderModule {}

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service'; import { Observable } from 'rxjs';
import { MessagesService as ApiMessagesService } from '../../../../api-codegen/sender'; import { MessagesService as ApiMessagesService } from '../../../../api-codegen/sender';
@ -8,7 +8,7 @@ import { MessagesService as ApiMessagesService } from '../../../../api-codegen/s
export class MessagesService { export class MessagesService {
constructor(private messagesService: ApiMessagesService, private idGeneratorService: IdGeneratorService) {} constructor(private messagesService: ApiMessagesService, private idGeneratorService: IdGeneratorService) {}
sendFeedbackEmailMsg(text: string) { sendFeedbackEmailMsg(text: string): Observable<any> {
return this.messagesService.sendFeedbackEmailMsg(this.idGeneratorService.generateRequestID(), { text }); return this.messagesService.sendFeedbackEmailMsg(this.idGeneratorService.shortUuid(), { text });
} }
} }

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { shareReplay, startWith, switchMapTo } from 'rxjs/operators'; import { shareReplay, startWith, switchMapTo } from 'rxjs/operators';
@ -6,7 +7,6 @@ import { Shop } from '@dsh/api-codegen/capi';
import { ShopsService } from '@dsh/api-codegen/capi/shops.service'; import { ShopsService } from '@dsh/api-codegen/capi/shops.service';
import { SHARE_REPLAY_CONF } from '../../custom-operators'; import { SHARE_REPLAY_CONF } from '../../custom-operators';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class ApiShopsService { export class ApiShopsService {
@ -15,18 +15,18 @@ export class ApiShopsService {
// eslint-disable-next-line @typescript-eslint/member-ordering // eslint-disable-next-line @typescript-eslint/member-ordering
shops$: Observable<Shop[]> = this.reloadShops$.pipe( shops$: Observable<Shop[]> = this.reloadShops$.pipe(
startWith<void, null>(null), startWith<void, null>(null),
switchMapTo(this.shopsService.getShops(genXRequestID())), switchMapTo(this.shopsService.getShops(this.idGenerator.shortUuid())),
shareReplay(SHARE_REPLAY_CONF) shareReplay(SHARE_REPLAY_CONF)
); );
constructor(private shopsService: ShopsService) {} constructor(private shopsService: ShopsService, private idGenerator: IdGeneratorService) {}
getShopByID(shopID: string): Observable<Shop> { getShopByID(shopID: string): Observable<Shop> {
return this.shopsService.getShopByID(genXRequestID(), shopID); return this.shopsService.getShopByID(this.idGenerator.shortUuid(), shopID);
} }
getShops(): Observable<Shop[]> { getShops(): Observable<Shop[]> {
return this.shopsService.getShops(genXRequestID()); return this.shopsService.getShops(this.idGenerator.shortUuid());
} }
reloadShops() { reloadShops() {
@ -34,10 +34,10 @@ export class ApiShopsService {
} }
suspendShop(shopID: string) { suspendShop(shopID: string) {
return this.shopsService.suspendShop(genXRequestID(), shopID); return this.shopsService.suspendShop(this.idGenerator.shortUuid(), shopID);
} }
activateShop(shopID: string) { activateShop(shopID: string) {
return this.shopsService.activateShop(genXRequestID(), shopID); return this.shopsService.activateShop(this.idGenerator.shortUuid(), shopID);
} }
} }

View File

@ -1,14 +1,16 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { ShortenerService } from '@dsh/api-codegen/url-shortener'; import { ShortenerService } from '@dsh/api-codegen/url-shortener';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class UrlShortenerService { export class UrlShortenerService {
constructor(private shortenerService: ShortenerService) {} constructor(private shortenerService: ShortenerService, private idGenerator: IdGeneratorService) {}
shortenUrl(sourceUrl: string, expiresAt: string) { shortenUrl(sourceUrl: string, expiresAt: string) {
return this.shortenerService.shortenUrl(genXRequestID(), { sourceUrl, expiresAt: expiresAt as any as Date }); return this.shortenerService.shortenUrl(this.idGenerator.shortUuid(), {
sourceUrl,
expiresAt: expiresAt as any as Date,
});
} }
} }

View File

@ -1,8 +0,0 @@
import { randomString as s } from '../../../utils';
/**
* @deprecated use IdGeneratorService
*/
export function genXRequestID() {
return `${s(8)}-${s(4)}-${s(4)}`;
}

View File

@ -1,3 +1,2 @@
export * from './to-date-like'; export * from './to-date-like';
export * from './gen-x-request-id';
export * from './create-union-type-guard-creator'; export * from './create-union-type-guard-creator';

View File

@ -1,27 +1,26 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Webhook, WebhooksService as ApiWebhooksService } from '@dsh/api-codegen/wallet-api'; import { Webhook, WebhooksService as ApiWebhooksService } from '@dsh/api-codegen/wallet-api';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class WalletWebhooksService { export class WalletWebhooksService {
constructor(private apiWebhooksService: ApiWebhooksService) {} constructor(private apiWebhooksService: ApiWebhooksService, private idGenerator: IdGeneratorService) {}
createWebhook(params: Webhook): Observable<Webhook> { createWebhook(params: Webhook): Observable<Webhook> {
return this.apiWebhooksService.createWebhook(genXRequestID(), params); return this.apiWebhooksService.createWebhook(this.idGenerator.shortUuid(), params);
} }
getWebhooks(identityID: string): Observable<Webhook[]> { getWebhooks(identityID: string): Observable<Webhook[]> {
return this.apiWebhooksService.getWebhooks(genXRequestID(), identityID); return this.apiWebhooksService.getWebhooks(this.idGenerator.shortUuid(), identityID);
} }
getWebhookByID(webhookID: string, identityID: string): Observable<Webhook> { getWebhookByID(webhookID: string, identityID: string): Observable<Webhook> {
return this.apiWebhooksService.getWebhookByID(genXRequestID(), webhookID, identityID); return this.apiWebhooksService.getWebhookByID(this.idGenerator.shortUuid(), webhookID, identityID);
} }
deleteWebhookByID(webhookID: string, identityID: string): Observable<any> { deleteWebhookByID(webhookID: string, identityID: string): Observable<any> {
return this.apiWebhooksService.deleteWebhookByID(genXRequestID(), webhookID, identityID); return this.apiWebhooksService.deleteWebhookByID(this.idGenerator.shortUuid(), webhookID, identityID);
} }
} }

View File

@ -1,11 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, map, pluck, shareReplay } from 'rxjs/operators'; import { catchError, map, pluck, shareReplay } from 'rxjs/operators';
import { Wallet, WalletGrantRequest, WalletService as ApiWalletsService } from '@dsh/api-codegen/wallet-api'; import { Wallet, WalletGrantRequest, WalletService as ApiWalletsService } from '@dsh/api-codegen/wallet-api';
import { SHARE_REPLAY_CONF } from '../../custom-operators'; import { SHARE_REPLAY_CONF } from '../../custom-operators';
import { genXRequestID } from '../utils';
import { WalletsSearchParams } from './wallets-search-params'; import { WalletsSearchParams } from './wallets-search-params';
@Injectable() @Injectable()
@ -23,15 +23,15 @@ export class WalletService {
shareReplay(SHARE_REPLAY_CONF) shareReplay(SHARE_REPLAY_CONF)
); );
constructor(private apiWalletsService: ApiWalletsService) {} constructor(private apiWalletsService: ApiWalletsService, private idGenerator: IdGeneratorService) {}
getWalletByExternalID(externalID: string) { getWalletByExternalID(externalID: string) {
return this.apiWalletsService.getWalletByExternalID(genXRequestID(), externalID); return this.apiWalletsService.getWalletByExternalID(this.idGenerator.shortUuid(), externalID);
} }
listWallets(limit: number, params?: WalletsSearchParams, continuationToken?: string) { listWallets(limit: number, params?: WalletsSearchParams, continuationToken?: string) {
return this.apiWalletsService.listWallets( return this.apiWalletsService.listWallets(
genXRequestID(), this.idGenerator.shortUuid(),
limit, limit,
undefined, undefined,
params?.identityID, params?.identityID,
@ -41,18 +41,18 @@ export class WalletService {
} }
createWallet(wallet: Wallet) { createWallet(wallet: Wallet) {
return this.apiWalletsService.createWallet(genXRequestID(), wallet, undefined); return this.apiWalletsService.createWallet(this.idGenerator.shortUuid(), wallet, undefined);
} }
getWallet(walletID: string) { getWallet(walletID: string) {
return this.apiWalletsService.getWallet(genXRequestID(), walletID); return this.apiWalletsService.getWallet(this.idGenerator.shortUuid(), walletID);
} }
getWalletAccount(walletID: string) { getWalletAccount(walletID: string) {
return this.apiWalletsService.getWalletAccount(genXRequestID(), walletID); return this.apiWalletsService.getWalletAccount(this.idGenerator.shortUuid(), walletID);
} }
issueWalletGrant(walletID: string, request: WalletGrantRequest) { issueWalletGrant(walletID: string, request: WalletGrantRequest) {
return this.apiWalletsService.issueWalletGrant(genXRequestID(), walletID, request); return this.apiWalletsService.issueWalletGrant(this.idGenerator.shortUuid(), walletID, request);
} }
} }

View File

@ -1,27 +1,26 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Webhook, WebhooksService as ApiWebhooksService } from '@dsh/api-codegen/capi'; import { Webhook, WebhooksService as ApiWebhooksService } from '@dsh/api-codegen/capi';
import { genXRequestID } from '../utils';
@Injectable() @Injectable()
export class WebhooksService { export class WebhooksService {
constructor(private apiWebhooksService: ApiWebhooksService) {} constructor(private apiWebhooksService: ApiWebhooksService, private idGenerator: IdGeneratorService) {}
createWebhook(params: Webhook): Observable<Webhook> { createWebhook(params: Webhook): Observable<Webhook> {
return this.apiWebhooksService.createWebhook(genXRequestID(), params); return this.apiWebhooksService.createWebhook(this.idGenerator.shortUuid(), params);
} }
getWebhooks(): Observable<Webhook[]> { getWebhooks(): Observable<Webhook[]> {
return this.apiWebhooksService.getWebhooks(genXRequestID()); return this.apiWebhooksService.getWebhooks(this.idGenerator.shortUuid());
} }
getWebhookByID(webhookID: string): Observable<Webhook> { getWebhookByID(webhookID: string): Observable<Webhook> {
return this.apiWebhooksService.getWebhookByID(genXRequestID(), webhookID); return this.apiWebhooksService.getWebhookByID(this.idGenerator.shortUuid(), webhookID);
} }
deleteWebhookByID(webhookID: string): Observable<any> { deleteWebhookByID(webhookID: string): Observable<any> {
return this.apiWebhooksService.deleteWebhookByID(genXRequestID(), webhookID); return this.apiWebhooksService.deleteWebhookByID(this.idGenerator.shortUuid(), webhookID);
} }
} }

View File

@ -1,17 +1,18 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { WithdrawalsService as ApiWithdrawalsService } from '@dsh/api-codegen/wallet-api/swagger-codegen'; import { WithdrawalsService as ApiWithdrawalsService } from '@dsh/api-codegen/wallet-api/swagger-codegen';
import { genXRequestID, toDateLike } from '../utils'; import { toDateLike } from '../utils';
import { WithdrawalsSearchParams } from './withdrawals-search-params'; import { WithdrawalsSearchParams } from './withdrawals-search-params';
@Injectable() @Injectable()
export class WithdrawalsService { export class WithdrawalsService {
constructor(private withdrawalsService: ApiWithdrawalsService) {} constructor(private withdrawalsService: ApiWithdrawalsService, private idGenerator: IdGeneratorService) {}
listWithdrawals(params: WithdrawalsSearchParams, limit = 20, continuationToken?: string) { listWithdrawals(params: WithdrawalsSearchParams, limit = 20, continuationToken?: string) {
return this.withdrawalsService.listWithdrawals( return this.withdrawalsService.listWithdrawals(
genXRequestID(), this.idGenerator.shortUuid(),
limit, limit,
undefined, undefined,
params.walletID, params.walletID,

View File

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { TranslocoService } from '@ngneat/transloco'; import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { concat, defer, Observable, of, ReplaySubject, throwError } from 'rxjs'; import { concat, defer, Observable, of, ReplaySubject, throwError } from 'rxjs';
import { catchError, first, mapTo, shareReplay, switchMap, takeLast, tap } from 'rxjs/operators'; import { catchError, first, mapTo, shareReplay, switchMap, takeLast, tap } from 'rxjs/operators';
@ -31,7 +32,8 @@ export class BootstrapService {
private capiPartiesService: CapiPartiesService, private capiPartiesService: CapiPartiesService,
private errorService: ErrorService, private errorService: ErrorService,
private organizationsService: OrganizationsService, private organizationsService: OrganizationsService,
private transloco: TranslocoService private transloco: TranslocoService,
private idGenerator: IdGeneratorService
) {} ) {}
bootstrap(): void { bootstrap(): void {
@ -77,6 +79,10 @@ export class BootstrapService {
} }
private createTestShop(): Observable<boolean> { private createTestShop(): Observable<boolean> {
return this.capiClaimsService.createClaim(createTestShopClaimChangeset()).pipe(mapTo(true)); return this.capiClaimsService
.createClaim(
createTestShopClaimChangeset(this.idGenerator.uuid(), this.idGenerator.uuid(), this.idGenerator.uuid())
)
.pipe(mapTo(true));
} }
} }

View File

@ -4,9 +4,9 @@ import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { TranslocoService } from '@ngneat/transloco'; import { TranslocoService } from '@ngneat/transloco';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { forkJoin, Observable, of, Subject, throwError } from 'rxjs'; import { forkJoin, Observable, of, Subject, throwError } from 'rxjs';
import { catchError, filter, map, pluck, switchMap } from 'rxjs/operators'; import { catchError, filter, map, pluck, switchMap } from 'rxjs/operators';
import * as uuid from 'uuid/v4';
import { OrgType, PartyContent, ReqResponse } from '@dsh/api-codegen/aggr-proxy'; import { OrgType, PartyContent, ReqResponse } from '@dsh/api-codegen/aggr-proxy';
import { QuestionaryData } from '@dsh/api-codegen/questionary'; import { QuestionaryData } from '@dsh/api-codegen/questionary';
@ -35,7 +35,8 @@ export class CompanySearchService {
private transloco: TranslocoService, private transloco: TranslocoService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private konturFocusService: KonturFocusService, private konturFocusService: KonturFocusService,
private keycloakService: KeycloakService private keycloakService: KeycloakService,
private idGenerator: IdGeneratorService
) { ) {
this.leaveOnboarding$ this.leaveOnboarding$
.pipe( .pipe(
@ -54,7 +55,7 @@ export class CompanySearchService {
} }
createInitialClaim(data: QuestionaryData): Observable<{ claimID: number; documentID: string }> { createInitialClaim(data: QuestionaryData): Observable<{ claimID: number; documentID: string }> {
const initialDocumentID = uuid(); const initialDocumentID = this.idGenerator.uuid();
const changeset = [createDocumentModificationUnit(initialDocumentID)]; const changeset = [createDocumentModificationUnit(initialDocumentID)];
const defaultEmail = this.keycloakService.getUsername(); const defaultEmail = this.keycloakService.getUsername();
const questionaryData: QuestionaryData = { ...data, contactInfo: { email: defaultEmail, ...data.contactInfo } }; const questionaryData: QuestionaryData = { ...data, contactInfo: { email: defaultEmail, ...data.contactInfo } };

View File

@ -1,4 +1,5 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
@ -7,7 +8,6 @@ import { deepEqual, instance, mock, verify, when } from 'ts-mockito';
import { Claim, Modification } from '@dsh/api-codegen/claim-management'; import { Claim, Modification } from '@dsh/api-codegen/claim-management';
import { ClaimsService } from '@dsh/api/claims'; import { ClaimsService } from '@dsh/api/claims';
import { createTestContractCreationModification } from '@dsh/api/claims/claim-party-modification'; import { createTestContractCreationModification } from '@dsh/api/claims/claim-party-modification';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service';
import { createTestContractPayoutToolModification } from '../../tests/create-test-contract-payout-tool-modification'; import { createTestContractPayoutToolModification } from '../../tests/create-test-contract-payout-tool-modification';
import { createTestInternationalLegalEntityModification } from '../../tests/create-test-international-legal-entity-modification'; import { createTestInternationalLegalEntityModification } from '../../tests/create-test-international-legal-entity-modification';
@ -82,7 +82,7 @@ describe('CreateInternationalShopEntityService', () => {
]; ];
beforeEach(() => { beforeEach(() => {
when(mockIdGeneratorService.generateUUID()).thenReturn(TEST_UUID); when(mockIdGeneratorService.uuid()).thenReturn(TEST_UUID);
when(mockClaimsService.createClaim(deepEqual(modifications))).thenReturn(of(claim)); when(mockClaimsService.createClaim(deepEqual(modifications))).thenReturn(of(claim));
when(mockClaimsService.requestReviewClaimByID(claim.id, claim.revision)).thenReturn(of(null)); when(mockClaimsService.requestReviewClaimByID(claim.id, claim.revision)).thenReturn(of(null));
}); });

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import isNil from 'lodash-es/isNil'; import isNil from 'lodash-es/isNil';
import { forkJoin, of } from 'rxjs'; import { forkJoin, of } from 'rxjs';
import { pluck, switchMap } from 'rxjs/operators'; import { pluck, switchMap } from 'rxjs/operators';
@ -12,7 +13,6 @@ import {
makeShopLocation, makeShopLocation,
} from '@dsh/api/claims/claim-party-modification'; } from '@dsh/api/claims/claim-party-modification';
import { createInternationalContractPayoutToolModification } from '@dsh/api/claims/claim-party-modification/claim-contract-modification/create-international-contract-payout-tool-modification'; import { createInternationalContractPayoutToolModification } from '@dsh/api/claims/claim-party-modification/claim-contract-modification/create-international-contract-payout-tool-modification';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service';
import { InternationalShopEntityFormValue } from '../../types/international-shop-entity-form-value'; import { InternationalShopEntityFormValue } from '../../types/international-shop-entity-form-value';
@ -39,10 +39,10 @@ export class CreateInternationalShopEntityService {
payoutTool, payoutTool,
correspondentPayoutTool = null, correspondentPayoutTool = null,
}: InternationalShopEntityFormValue): Modification[] { }: InternationalShopEntityFormValue): Modification[] {
const contractorID = this.idGenerator.generateUUID(); const contractorID = this.idGenerator.uuid();
const contractID = this.idGenerator.generateUUID(); const contractID = this.idGenerator.uuid();
const payoutToolID = this.idGenerator.generateUUID(); const payoutToolID = this.idGenerator.uuid();
const shopID = this.idGenerator.generateUUID(); const shopID = this.idGenerator.uuid();
return [ return [
createInternationalLegalEntityModification(contractorID, { createInternationalLegalEntityModification(contractorID, {

View File

@ -13,7 +13,6 @@ import { ClaimsModule } from '@dsh/api/claims';
import { PayoutToolDetailsModule } from '@dsh/app/shared/components'; import { PayoutToolDetailsModule } from '@dsh/app/shared/components';
import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog'; import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog';
import { AutocompleteVirtualScrollModule } from '@dsh/app/shared/components/selects/autocomplete-virtual-scroll'; import { AutocompleteVirtualScrollModule } from '@dsh/app/shared/components/selects/autocomplete-virtual-scroll';
import { IdGeneratorModule } from '@dsh/app/shared/services';
import { ButtonModule } from '@dsh/components/buttons'; import { ButtonModule } from '@dsh/components/buttons';
import { FormatInputModule } from '@dsh/components/form-controls'; import { FormatInputModule } from '@dsh/components/form-controls';
import { DetailsItemModule } from '@dsh/components/layout'; import { DetailsItemModule } from '@dsh/components/layout';
@ -45,7 +44,6 @@ import { CreateRussianShopEntityService } from './services/create-russian-shop-e
DetailsItemModule, DetailsItemModule,
AutocompleteVirtualScrollModule, AutocompleteVirtualScrollModule,
ClaimsModule, ClaimsModule,
IdGeneratorModule,
BaseDialogModule, BaseDialogModule,
], ],
declarations: [ declarations: [

View File

@ -1,4 +1,5 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
@ -8,7 +9,6 @@ import { Contract } from '@dsh/api-codegen/capi';
import { Claim, Modification } from '@dsh/api-codegen/claim-management'; import { Claim, Modification } from '@dsh/api-codegen/claim-management';
import { ClaimsService } from '@dsh/api/claims'; import { ClaimsService } from '@dsh/api/claims';
import { createContractCreationModification } from '@dsh/api/claims/claim-party-modification'; import { createContractCreationModification } from '@dsh/api/claims/claim-party-modification';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service';
import { createTestLegalEntityModification } from '../../tests/create-test-legal-entity-modification'; import { createTestLegalEntityModification } from '../../tests/create-test-legal-entity-modification';
import { createTestRussianContractPayoutToolModification } from '../../tests/create-test-russian-contract-payout-tool-modification'; import { createTestRussianContractPayoutToolModification } from '../../tests/create-test-russian-contract-payout-tool-modification';
@ -92,7 +92,7 @@ describe('CreateRussianShopEntityService', () => {
let modifications: Modification[]; let modifications: Modification[];
beforeEach(() => { beforeEach(() => {
when(mockIdGeneratorService.generateUUID()).thenReturn(TEST_UUID); when(mockIdGeneratorService.uuid()).thenReturn(TEST_UUID);
}); });
afterEach(() => { afterEach(() => {

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { IdGeneratorService } from '@rbkmoney/id-generator';
import { forkJoin, Observable, of } from 'rxjs'; import { forkJoin, Observable, of } from 'rxjs';
import { pluck, switchMap } from 'rxjs/operators'; import { pluck, switchMap } from 'rxjs/operators';
@ -12,7 +13,6 @@ import {
createShopCreationModification, createShopCreationModification,
makeShopLocation, makeShopLocation,
} from '@dsh/api/claims/claim-party-modification'; } from '@dsh/api/claims/claim-party-modification';
import { IdGeneratorService } from '@dsh/app/shared/services/id-generator/id-generator.service';
import { RussianShopCreateData } from '../../types/russian-shop-create-data'; import { RussianShopCreateData } from '../../types/russian-shop-create-data';
@ -36,9 +36,9 @@ export class CreateRussianShopEntityService {
payoutToolID, payoutToolID,
bankAccount: { account, bankName, bankPostAccount, bankBik }, bankAccount: { account, bankName, bankPostAccount, bankBik },
}: RussianShopCreateData): PartyModification[] { }: RussianShopCreateData): PartyModification[] {
const contractorID = this.idGenerator.generateUUID(); const contractorID = this.idGenerator.uuid();
const contractID = this.idGenerator.generateUUID(); const contractID = this.idGenerator.uuid();
const shopID = this.idGenerator.generateUUID(); const shopID = this.idGenerator.uuid();
const { const {
actualAddress, actualAddress,
@ -77,13 +77,9 @@ export class CreateRussianShopEntityService {
}), }),
]; ];
if (!payoutToolID) { if (!payoutToolID) {
payoutToolID = this.idGenerator.generateUUID(); payoutToolID = this.idGenerator.uuid();
result.push( result.push(
createRussianContractPayoutToolCreationModification( createRussianContractPayoutToolCreationModification(contractID, this.idGenerator.uuid(), bankAccount)
contractID,
this.idGenerator.generateUUID(),
bankAccount
)
); );
} }
return [ return [

View File

@ -1,8 +0,0 @@
import { NgModule } from '@angular/core';
import { IdGeneratorService } from './id-generator.service';
@NgModule({
providers: [IdGeneratorService],
})
export class IdGeneratorModule {}

View File

@ -1,28 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { IdGeneratorService } from './id-generator.service';
describe('IdGeneratorService', () => {
let service: IdGeneratorService;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [IdGeneratorService],
});
service = TestBed.inject(IdGeneratorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
describe('generateUUID', () => {
it('should generate uuid', () => {
expect(service.generateUUID()).toBeTruthy();
});
it('new generated uuid should be not like it was before', () => {
expect(service.generateUUID()).not.toBe(service.generateUUID());
});
});
});

View File

@ -1,15 +0,0 @@
import { Injectable } from '@angular/core';
import uuid from 'uuid';
import { genXRequestID } from '@dsh/api/utils';
@Injectable()
export class IdGeneratorService {
generateUUID(): string {
return uuid();
}
generateRequestID(): string {
return genXRequestID();
}
}

View File

@ -1,2 +0,0 @@
export * from './id-generator.module';
export * from './id-generator.service';

View File

@ -2,7 +2,6 @@ export * from './country-codes';
export * from './query-params-store'; export * from './query-params-store';
export * from './expanded-id-manager'; export * from './expanded-id-manager';
export * from './logger'; export * from './logger';
export * from './id-generator';
export * from './fake-paginator.service'; export * from './fake-paginator.service';
export * from './notification'; export * from './notification';
export * from './error'; export * from './error';

View File

@ -3,7 +3,7 @@
*/ */
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
export async function download(url: string, name?: string) { export async function download(url: string, name?: string): Promise<void> {
const a = document.createElement('a'); const a = document.createElement('a');
a.id = url; a.id = url;
a.download = name; a.download = name;
@ -16,7 +16,7 @@ export async function download(url: string, name?: string) {
a.remove(); a.remove();
} }
export function multipleDownload(urls: string[]) { export function multipleDownload(urls: string[]): void {
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
urls.forEach(async (url, i) => { urls.forEach(async (url, i) => {
await delay(i * 1000); await delay(i * 1000);