mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 16:40:06 +00:00
Merge pull request #700 from sasjs/parse-log-in-executeScript
fix: parse log in executeScript method on sasjs server
This commit is contained in:
@@ -62,8 +62,8 @@ export class SASjsApiClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes code on a SASJS server.
|
* Executes code on a SASJS server.
|
||||||
* @param serverUrl - a server url to execute code.
|
|
||||||
* @param code - a string of code to execute.
|
* @param code - a string of code to execute.
|
||||||
|
* @param authConfig - an object for authentication.
|
||||||
*/
|
*/
|
||||||
public async executeScript(code: string, authConfig?: AuthConfig) {
|
public async executeScript(code: string, authConfig?: AuthConfig) {
|
||||||
let access_token = (authConfig || {}).access_token
|
let access_token = (authConfig || {}).access_token
|
||||||
@@ -74,12 +74,23 @@ export class SASjsApiClient {
|
|||||||
ServerType.Sasjs
|
ServerType.Sasjs
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
const response = await this.requestClient.post(
|
|
||||||
'SASjsApi/code/execute',
|
let parsedSasjsServerLog = ''
|
||||||
{ code },
|
|
||||||
access_token
|
await this.requestClient
|
||||||
)
|
.post('SASjsApi/code/execute', { code }, access_token)
|
||||||
return response.result as string
|
.then((res: any) => {
|
||||||
|
if (res.result?.log) {
|
||||||
|
parsedSasjsServerLog = res.result.log
|
||||||
|
.map((logLine: any) => logLine.line)
|
||||||
|
.join('\n')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
parsedSasjsServerLog = err
|
||||||
|
})
|
||||||
|
|
||||||
|
return parsedSasjsServerLog
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user