From e78dc76e567f829db2d62f7a059f863846064b14 Mon Sep 17 00:00:00 2001 From: Krishna Acondy Date: Fri, 16 Oct 2020 10:55:56 +0100 Subject: [PATCH] fix(config): set debug to false by default feat(create-job): add the ability to wait for result --- src/SASViyaApiClient.ts | 7 +++++-- src/SASjs.ts | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index 3d63d1e..1bd2129 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -581,6 +581,8 @@ export class SASViyaApiClient { if (expectWebout) { resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content` + } else { + return currentJob; } if (resultLink) { @@ -953,7 +955,8 @@ export class SASViyaApiClient { contextName: string, data?: any, accessToken?: string, - waitForResult = true + waitForResult = true, + expectWebout = false ) { if (isRelativePath(sasJob) && !this.rootFolderName) { throw new Error( @@ -1034,7 +1037,7 @@ export class SASViyaApiClient { contextName, accessToken, data, - true, + expectWebout, waitForResult ) } diff --git a/src/SASjs.ts b/src/SASjs.ts index 82b52e0..f9d6819 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -44,7 +44,7 @@ const defaultConfig: SASjsConfig = { pathSASViya: '/SASJobExecution', appLoc: '/Public/seedapp', serverType: ServerType.SASViya, - debug: true, + debug: false, contextName: 'SAS Job Execution compute context', useComputeApi: false } @@ -688,7 +688,8 @@ export default class SASjs { sasJob: string, data: any, config: any = {}, - accessToken?: string + accessToken?: string, + waitForResult?: boolean ) { config = { ...this.sasjsConfig, @@ -702,13 +703,13 @@ export default class SASjs { ) } - const waitForResult = false return this.sasViyaApiClient?.executeComputeJob( sasJob, config.contextName, data, accessToken, - waitForResult + !!waitForResult, + false ) } @@ -732,13 +733,15 @@ export default class SASjs { sasjsWaitingRequest.requestPromise.promise = new Promise( async (resolve, reject) => { const waitForResult = true + const expectWebout = true this.sasViyaApiClient ?.executeComputeJob( sasJob, config.contextName, data, accessToken, - waitForResult + waitForResult, + expectWebout ) .then((response) => { if (!config.debug) {