Bump woody (#184)

This commit is contained in:
Ildar Galeev 2020-09-15 14:24:45 +03:00 committed by GitHub
parent f1ecfb99b7
commit 31aeab2cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 22 deletions

16
package-lock.json generated
View File

@ -7655,9 +7655,9 @@
"dev": true "dev": true
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.564", "version": "1.3.568",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.564.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.568.tgz",
"integrity": "sha512-fNaYN3EtKQWLQsrKXui8mzcryJXuA0LbCLoizeX6oayG2emBaS5MauKjCPAvc29NEY4FpLHIUWiP+Y0Bfrs5dg==" "integrity": "sha512-j9MlEwgTHVW/lq93Hw8yhzA886oLjDm3Hz7eDkWP2v4fzLVuqOWhpNluziSnmR/tBqgoYldagbLknrdg+B7Tlw=="
}, },
"elliptic": { "elliptic": {
"version": "6.5.3", "version": "6.5.3",
@ -18156,8 +18156,8 @@
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
}, },
"woody_js": { "woody_js": {
"version": "git+ssh://git@github.com/rbkmoney/woody_js.git#14e154f78a63029a700954fbc92a2183cb13e1df", "version": "git+ssh://git@github.com/rbkmoney/woody_js.git#19da32be428acf1ecb21b1e877ae2b0fadeb29e0",
"from": "git+ssh://git@github.com/rbkmoney/woody_js.git#14e154f78a63029a700954fbc92a2183cb13e1df", "from": "git+ssh://git@github.com/rbkmoney/woody_js.git#19da32be428acf1ecb21b1e877ae2b0fadeb29e0",
"requires": { "requires": {
"babel-core": "6.26.3", "babel-core": "6.26.3",
"babel-loader": "7.1.4", "babel-loader": "7.1.4",
@ -18340,9 +18340,9 @@
} }
}, },
"moment": { "moment": {
"version": "2.27.0", "version": "2.28.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.28.0.tgz",
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" "integrity": "sha512-Z5KOjYmnHyd/ukynmFd/WwyXHd7L4J9vTI/nn5Ap9AVUgaAE15VvQ9MOGmJJygEUklupqIrFnor/tjTwRU+tQw=="
}, },
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",

View File

@ -59,7 +59,7 @@
"tslib": "^2.0.0", "tslib": "^2.0.0",
"utility-types": "^3.10.0", "utility-types": "^3.10.0",
"uuid": "~3.3.2", "uuid": "~3.3.2",
"woody_js": "git+ssh://git@github.com/rbkmoney/woody_js.git#14e154f78a63029a700954fbc92a2183cb13e1df", "woody_js": "git+ssh://git@github.com/rbkmoney/woody_js.git#19da32be428acf1ecb21b1e877ae2b0fadeb29e0",
"zone.js": "~0.10.2" "zone.js": "~0.10.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -12,13 +12,18 @@ export class DomainService extends ThriftService {
super(zone, keycloakTokenInfoService, '/v1/domain/repository', Repository); super(zone, keycloakTokenInfoService, '/v1/domain/repository', Repository);
} }
checkout: (reference: Reference) => Observable<Snapshot> = this.toObservableAction('Checkout'); checkout: (reference: Reference) => Observable<Snapshot> = this.toObservableAction(
'Checkout',
false
);
commit: (version: Version, commit: Commit) => Observable<Version> = this.toObservableAction( commit: (version: Version, commit: Commit) => Observable<Version> = this.toObservableAction(
'Commit' 'Commit',
false
); );
pullRange: (after: Version, limit: Limit) => Observable<History> = this.toObservableAction( pullRange: (after: Version, limit: Limit) => Observable<History> = this.toObservableAction(
'PullRange' 'PullRange',
false
); );
} }

View File

@ -25,7 +25,10 @@ export class ThriftService {
this.service = thriftService; this.service = thriftService;
} }
protected toObservableAction<T extends (...A: any[]) => Observable<any>>(name: string): T { protected toObservableAction<T extends (...A: any[]) => Observable<any>>(
name: string,
deprecatedHeaders = true
): T {
return ((...args) => return ((...args) =>
new Observable<any>((observer) => { new Observable<any>((observer) => {
const cb = (msg) => { const cb = (msg) => {
@ -34,7 +37,7 @@ export class ThriftService {
}; };
this.zone.run(() => { this.zone.run(() => {
try { try {
const client = this.createClient(cb); const client = this.createClient(cb, deprecatedHeaders);
client[name](...args, (ex: Exception, result) => { client[name](...args, (ex: Exception, result) => {
ex ? observer.error(ex) : observer.next(result); ex ? observer.error(ex) : observer.next(result);
observer.complete(); observer.complete();
@ -43,10 +46,10 @@ export class ThriftService {
cb(e); cb(e);
} }
}); });
}).pipe(timeout(120000))) as any; }).pipe(timeout(60000 * 3))) as any;
} }
private createClient(errorCb: (cb: () => void) => void) { private createClient(errorCb: (cb: () => void) => void, deprecatedHeaders: boolean) {
const { email, preferred_username, sub } = this.keycloakTokenInfoService.decodedUserToken; const { email, preferred_username, sub } = this.keycloakTokenInfoService.decodedUserToken;
return connectClient( return connectClient(
location.hostname, location.hostname,
@ -59,17 +62,20 @@ export class ThriftService {
'woody.meta.user-identity.realm': this.realm, 'woody.meta.user-identity.realm': this.realm,
'woody.meta.user-identity.username': preferred_username, 'woody.meta.user-identity.username': preferred_username,
'woody.meta.user-identity.id': sub, 'woody.meta.user-identity.id': sub,
...(deprecatedHeaders
// Deprecated ? {
'x-rbk-meta-user-identity.email': email, 'x-rbk-meta-user-identity.email': email,
'x-rbk-meta-user-identity.realm': this.realm, 'x-rbk-meta-user-identity.realm': this.realm,
'x-rbk-meta-user-identity.username': preferred_username, 'x-rbk-meta-user-identity.username': preferred_username,
'x-rbk-meta-user-identity.id': sub, 'x-rbk-meta-user-identity.id': sub,
}
: undefined),
}, },
deadlineConfig: { deadlineConfig: {
amount: 3, amount: 3,
unitOfTime: 'm', unitOfTime: 'm',
}, },
deprecatedHeaders,
}, },
errorCb errorCb
); );