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

fix(config): set debug to false by default

feat(create-job): add the ability to wait for result
This commit is contained in:
Krishna Acondy
2020-10-16 10:55:56 +01:00
parent bfdb5ef0a6
commit e78dc76e56
2 changed files with 13 additions and 7 deletions

View File

@@ -581,6 +581,8 @@ export class SASViyaApiClient {
if (expectWebout) { if (expectWebout) {
resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content` resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content`
} else {
return currentJob;
} }
if (resultLink) { if (resultLink) {
@@ -953,7 +955,8 @@ export class SASViyaApiClient {
contextName: string, contextName: string,
data?: any, data?: any,
accessToken?: string, accessToken?: string,
waitForResult = true waitForResult = true,
expectWebout = false
) { ) {
if (isRelativePath(sasJob) && !this.rootFolderName) { if (isRelativePath(sasJob) && !this.rootFolderName) {
throw new Error( throw new Error(
@@ -1034,7 +1037,7 @@ export class SASViyaApiClient {
contextName, contextName,
accessToken, accessToken,
data, data,
true, expectWebout,
waitForResult waitForResult
) )
} }

View File

@@ -44,7 +44,7 @@ const defaultConfig: SASjsConfig = {
pathSASViya: '/SASJobExecution', pathSASViya: '/SASJobExecution',
appLoc: '/Public/seedapp', appLoc: '/Public/seedapp',
serverType: ServerType.SASViya, serverType: ServerType.SASViya,
debug: true, debug: false,
contextName: 'SAS Job Execution compute context', contextName: 'SAS Job Execution compute context',
useComputeApi: false useComputeApi: false
} }
@@ -688,7 +688,8 @@ export default class SASjs {
sasJob: string, sasJob: string,
data: any, data: any,
config: any = {}, config: any = {},
accessToken?: string accessToken?: string,
waitForResult?: boolean
) { ) {
config = { config = {
...this.sasjsConfig, ...this.sasjsConfig,
@@ -702,13 +703,13 @@ export default class SASjs {
) )
} }
const waitForResult = false
return this.sasViyaApiClient?.executeComputeJob( return this.sasViyaApiClient?.executeComputeJob(
sasJob, sasJob,
config.contextName, config.contextName,
data, data,
accessToken, accessToken,
waitForResult !!waitForResult,
false
) )
} }
@@ -732,13 +733,15 @@ export default class SASjs {
sasjsWaitingRequest.requestPromise.promise = new Promise( sasjsWaitingRequest.requestPromise.promise = new Promise(
async (resolve, reject) => { async (resolve, reject) => {
const waitForResult = true const waitForResult = true
const expectWebout = true
this.sasViyaApiClient this.sasViyaApiClient
?.executeComputeJob( ?.executeComputeJob(
sasJob, sasJob,
config.contextName, config.contextName,
data, data,
accessToken, accessToken,
waitForResult waitForResult,
expectWebout
) )
.then((response) => { .then((response) => {
if (!config.debug) { if (!config.debug) {