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

fix(context): fixed result parsing

This commit is contained in:
Yury Shkoda
2020-11-26 13:27:35 +03:00
parent 79bb27524c
commit 71a3fe04a0

View File

@@ -154,6 +154,7 @@ export class SASViyaApiClient {
context.name, context.name,
accessToken, accessToken,
null, null,
false,
true, true,
true true
).catch((err) => err) ).catch((err) => err)
@@ -164,30 +165,27 @@ export class SASViyaApiClient {
for (const promise of promises) results.push(await promise()) for (const promise of promises) results.push(await promise())
results.forEach((result: any, index: number) => { results.forEach((result: any, index: number) => {
if (result && result.error && result.error.details) { if (result && result.log) {
try { try {
const resultParsed = result.error.details const resultParsed = result.log
let sysUserId = ''
if (resultParsed && resultParsed.body) { const sysUserIdLog = resultParsed
let sysUserId = '' .split('\n')
.find((line: string) => line.startsWith('SYSUSERID='))
const sysUserIdLog = resultParsed.body if (sysUserIdLog) {
.split('\n') sysUserId = sysUserIdLog.replace('SYSUSERID=', '')
.find((line: string) => line.startsWith('SYSUSERID='))
if (sysUserIdLog) { executableContexts.push({
sysUserId = sysUserIdLog.replace('SYSUSERID=', '') createdBy: contextsList[index].createdBy,
id: contextsList[index].id,
executableContexts.push({ name: contextsList[index].name,
createdBy: contextsList[index].createdBy, version: contextsList[index].version,
id: contextsList[index].id, attributes: {
name: contextsList[index].name, sysUserId
version: contextsList[index].version, }
attributes: { })
sysUserId
}
})
}
} }
} catch (error) { } catch (error) {
throw error throw error