diff --git a/src/job-execution/WebJobExecutor.ts b/src/job-execution/WebJobExecutor.ts index 95dc201..5ce8da0 100644 --- a/src/job-execution/WebJobExecutor.ts +++ b/src/job-execution/WebJobExecutor.ts @@ -102,6 +102,10 @@ export class WebJobExecutor extends BaseJobExecutor { apiUrl += config.contextName?.trim() ? `&_contextname=${encodeURIComponent(config.contextName)}` : '' + + if (config.runAsTask === true) { + apiUrl += '&_executionTasks=true' + } } let requestParams = { @@ -116,8 +120,7 @@ export class WebJobExecutor extends BaseJobExecutor { // FIXME(viya - SAS Track CS0409737): remove when Viya stops rejecting empty multipart on // _executionTasks=true. Dummy file keeps the body non-empty - const hasExecutionTasksFlag = - sasJob.includes('_executionTasks=true') || config.runAsTask === true + const hasExecutionTasksFlag = config.runAsTask === true if (data) { const stringifiedData = JSON.stringify(data) diff --git a/src/types/SASjsConfig.ts b/src/types/SASjsConfig.ts index 92a0198..f1fafb9 100644 --- a/src/types/SASjsConfig.ts +++ b/src/types/SASjsConfig.ts @@ -79,6 +79,14 @@ export class SASjsConfig { * may affect browser performance, especially with debug (logs) enabled. */ requestHistoryLimit?: number = 10 + /** + * Optional setting. When `true`, the request runs as a Viya execution task — + * appends `_executionTasks=true` to the request URL. Only applies to the Viya + * web jobs path, i.e. when `serverType === SASVIYA` AND + * `useComputeApi` is `null`/`undefined`. Has no effect when `useComputeApi` + * is explicitly set to `true` or `false`. + */ + runAsTask?: boolean = false } export enum LoginMechanism {