1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-01 17:50:06 +00:00

fix(executeJobSASjs): add parse webout response

This commit is contained in:
Yury Shkoda
2022-02-11 13:10:38 +03:00
parent b1979f63ef
commit 30a99f9cc5
3 changed files with 7 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import { RequestClient } from './request/RequestClient'
import { getAccessTokenForSasjs } from './auth/getAccessTokenForSasjs' import { getAccessTokenForSasjs } from './auth/getAccessTokenForSasjs'
import { refreshTokensForSasjs } from './auth/refreshTokensForSasjs' import { refreshTokensForSasjs } from './auth/refreshTokensForSasjs'
import { getAuthCodeForSasjs } from './auth/getAuthCodeForSasjs' import { getAuthCodeForSasjs } from './auth/getAuthCodeForSasjs'
import { parseWeboutResponse } from './utils'
export class SASjsApiClient { export class SASjsApiClient {
constructor( constructor(
@@ -35,8 +36,13 @@ export class SASjsApiClient {
log?: string log?: string
logPath?: string logPath?: string
error?: {} error?: {}
_webout?: string
}>('SASjsApi/stp/execute', query, undefined) }>('SASjsApi/stp/execute', query, undefined)
if (Object.keys(result).includes('_webout')) {
result._webout = parseWeboutResponse(result._webout!)
}
return Promise.resolve(result) return Promise.resolve(result)
} }

View File

@@ -1,5 +1,4 @@
export interface ExecutionQuery { export interface ExecutionQuery {
_program: string _program: string
_debug?: number _debug?: number
_returnLog?: boolean
} }

View File

@@ -10,6 +10,7 @@ export const parseWeboutResponse = (response: string, url?: string): string => {
.split('>>weboutEND<<')[0] .split('>>weboutEND<<')[0]
} catch (e) { } catch (e) {
if (url) throw new WeboutResponseError(url) if (url) throw new WeboutResponseError(url)
sasResponse = '' sasResponse = ''
console.error(e) console.error(e)
} }