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

fix(context): fixed executeScript method

This commit is contained in:
Yury Shkoda
2020-12-24 13:54:19 +03:00
parent d991ead86a
commit 8d155283dd
2 changed files with 4 additions and 7 deletions

View File

@@ -325,7 +325,6 @@ export class ContextManager {
executeScript: Function, executeScript: Function,
accessToken?: string accessToken?: string
) { ) {
console.log(`[324]`, 324)
const headers: any = { const headers: any = {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
@@ -344,13 +343,11 @@ export class ContextManager {
const contextsList = contexts.items || [] const contextsList = contexts.items || []
const executableContexts: any[] = [] const executableContexts: any[] = []
console.log(`[this.sasViyaApiClient]`, this.sasViyaApiClient)
const promises = contextsList.map((context: any) => { const promises = contextsList.map((context: any) => {
const linesOfCode = ['%put &=sysuserid;'] const linesOfCode = ['%put &=sysuserid;']
return () => return () =>
this.sasViyaApiClient!.executeScript( executeScript(
`test-${context.name}`, `test-${context.name}`,
linesOfCode, linesOfCode,
context.name, context.name,
@@ -366,8 +363,6 @@ export class ContextManager {
for (const promise of promises) results.push(await promise()) for (const promise of promises) results.push(await promise())
console.log(`[results]`, results)
results.forEach((result: any, index: number) => { results.forEach((result: any, index: number) => {
if (result && result.log) { if (result && result.log) {
try { try {

View File

@@ -117,8 +117,10 @@ export class SASViyaApiClient {
* @param accessToken - an access token for an authorized user. * @param accessToken - an access token for an authorized user.
*/ */
public async getExecutableContexts(accessToken?: string) { public async getExecutableContexts(accessToken?: string) {
const bindedExecuteScript = this.executeScript.bind(this)
return await this.contextManager.getExecutableContexts( return await this.contextManager.getExecutableContexts(
this.executeScript, bindedExecuteScript,
accessToken accessToken
) )
} }