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

View File

@ -59,7 +59,7 @@
"tslib": "^2.0.0",
"utility-types": "^3.10.0",
"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"
},
"devDependencies": {

View File

@ -12,13 +12,18 @@ export class DomainService extends ThriftService {
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'
'Commit',
false
);
pullRange: (after: Version, limit: Limit) => Observable<History> = this.toObservableAction(
'PullRange'
'PullRange',
false
);
}

View File

@ -25,7 +25,10 @@ export class 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) =>
new Observable<any>((observer) => {
const cb = (msg) => {
@ -34,7 +37,7 @@ export class ThriftService {
};
this.zone.run(() => {
try {
const client = this.createClient(cb);
const client = this.createClient(cb, deprecatedHeaders);
client[name](...args, (ex: Exception, result) => {
ex ? observer.error(ex) : observer.next(result);
observer.complete();
@ -43,10 +46,10 @@ export class ThriftService {
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;
return connectClient(
location.hostname,
@ -59,17 +62,20 @@ export class ThriftService {
'woody.meta.user-identity.realm': this.realm,
'woody.meta.user-identity.username': preferred_username,
'woody.meta.user-identity.id': sub,
// Deprecated
...(deprecatedHeaders
? {
'x-rbk-meta-user-identity.email': email,
'x-rbk-meta-user-identity.realm': this.realm,
'x-rbk-meta-user-identity.username': preferred_username,
'x-rbk-meta-user-identity.id': sub,
}
: undefined),
},
deadlineConfig: {
amount: 3,
unitOfTime: 'm',
},
deprecatedHeaders,
},
errorCb
);