mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-10 17:04:36 +00:00
feat(variables): added macro variables to executeComputeJob method
This commit is contained in:
14256
package-lock.json
generated
14256
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -61,7 +61,7 @@
|
||||
},
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@sasjs/utils": "^2.14.0",
|
||||
"@sasjs/utils": "^2.17.1",
|
||||
"axios": "^0.21.1",
|
||||
"axios-cookiejar-support": "^1.0.1",
|
||||
"form-data": "^4.0.0",
|
||||
|
||||
@@ -28,7 +28,7 @@ import { timestampToYYYYMMDDHHMMSS } from '@sasjs/utils/time'
|
||||
import { Logger, LogLevel } from '@sasjs/utils/logger'
|
||||
import { isAuthorizeFormRequired } from './auth/isAuthorizeFormRequired'
|
||||
import { RequestClient } from './request/RequestClient'
|
||||
import { SasAuthResponse } from '@sasjs/utils/types'
|
||||
import { SasAuthResponse, MacroVar } from '@sasjs/utils/types'
|
||||
import { prefixMessage } from '@sasjs/utils/error'
|
||||
|
||||
/**
|
||||
@@ -271,6 +271,7 @@ export class SASViyaApiClient {
|
||||
* @param waitForResult - when set to true, function will return the session
|
||||
* @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.
|
||||
* @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
|
||||
* @param variables - an object that represents macro variables.
|
||||
*/
|
||||
public async executeScript(
|
||||
jobPath: string,
|
||||
@@ -282,7 +283,8 @@ export class SASViyaApiClient {
|
||||
expectWebout = false,
|
||||
waitForResult = true,
|
||||
pollOptions?: PollOptions,
|
||||
printPid = false
|
||||
printPid = false,
|
||||
variables?: MacroVar
|
||||
): Promise<any> {
|
||||
try {
|
||||
const headers: any = {
|
||||
@@ -356,6 +358,8 @@ export class SASViyaApiClient {
|
||||
: jobPath
|
||||
}
|
||||
|
||||
if (variables) jobVariables = { ...jobVariables, ...variables }
|
||||
|
||||
let files: any[] = []
|
||||
|
||||
if (data) {
|
||||
@@ -386,6 +390,8 @@ export class SASViyaApiClient {
|
||||
arguments: jobArguments
|
||||
}
|
||||
|
||||
console.log(`[jobRequestBody]`, jobRequestBody)
|
||||
|
||||
const { result: postedJob, etag } = await this.requestClient
|
||||
.post<Job>(
|
||||
`/compute/sessions/${executionSessionId}/jobs`,
|
||||
@@ -814,6 +820,7 @@ export class SASViyaApiClient {
|
||||
* @param expectWebout - a boolean indicating whether to expect a _webout response.
|
||||
* @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.
|
||||
* @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
|
||||
* @param variables - an object that represents macro variables.
|
||||
*/
|
||||
public async executeComputeJob(
|
||||
sasJob: string,
|
||||
@@ -824,7 +831,8 @@ export class SASViyaApiClient {
|
||||
waitForResult = true,
|
||||
expectWebout = false,
|
||||
pollOptions?: PollOptions,
|
||||
printPid = false
|
||||
printPid = false,
|
||||
variables?: MacroVar
|
||||
) {
|
||||
if (isRelativePath(sasJob) && !this.rootFolderName) {
|
||||
throw new Error(
|
||||
@@ -903,7 +911,8 @@ export class SASViyaApiClient {
|
||||
expectWebout,
|
||||
waitForResult,
|
||||
pollOptions,
|
||||
printPid
|
||||
printPid,
|
||||
variables
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { SASViyaApiClient } from './SASViyaApiClient'
|
||||
import { SAS9ApiClient } from './SAS9ApiClient'
|
||||
import { FileUploader } from './FileUploader'
|
||||
import { AuthManager } from './auth'
|
||||
import { ServerType } from '@sasjs/utils/types'
|
||||
import { ServerType, MacroVar } from '@sasjs/utils/types'
|
||||
import { RequestClient } from './request/RequestClient'
|
||||
import {
|
||||
JobExecutor,
|
||||
@@ -671,6 +671,7 @@ export default class SASjs {
|
||||
* @param waitForResult - a boolean that indicates whether the function needs to wait for execution to complete.
|
||||
* @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.
|
||||
* @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
|
||||
* @param variables - an object that represents macro variables.
|
||||
*/
|
||||
public async startComputeJob(
|
||||
sasJob: string,
|
||||
@@ -679,7 +680,8 @@ export default class SASjs {
|
||||
accessToken?: string,
|
||||
waitForResult?: boolean,
|
||||
pollOptions?: PollOptions,
|
||||
printPid = false
|
||||
printPid = false,
|
||||
variables?: MacroVar
|
||||
) {
|
||||
config = {
|
||||
...this.sasjsConfig,
|
||||
@@ -702,7 +704,8 @@ export default class SASjs {
|
||||
!!waitForResult,
|
||||
false,
|
||||
pollOptions,
|
||||
printPid
|
||||
printPid,
|
||||
variables
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user