Options
All
  • Public
  • Public/Protected
  • All
Menu

Module api/viya

Functions

executeScript

  • executeScript(requestClient: RequestClient, sessionManager: SessionManager, rootFolderName: string, jobPath: string, linesOfCode: string[], contextName: string, authConfig?: AuthConfig, data?: any, debug?: boolean, expectWebout?: boolean, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar): Promise<any>
  • Executes code on the current SAS Viya server.

    Parameters

    • requestClient: RequestClient
    • sessionManager: SessionManager
    • rootFolderName: string
    • jobPath: string

      the path to the file being submitted for execution.

    • linesOfCode: string[]

      an array of code lines to execute.

    • contextName: string

      the context to execute the code in.

    • Optional authConfig: AuthConfig

      an object containing an access token, refresh token, client ID and secret.

    • Default value data: any = null

      execution data.

    • Default value debug: boolean = false

      when set to true, the log will be returned.

    • Default value expectWebout: boolean = false

      when set to true, the automatic _webout fileref will be checked for content, and that content returned. This fileref is used when the Job contains a SASjs web request (as opposed to executing arbitrary SAS code).

    • Default value waitForResult: boolean = true

      when set to true, function will return the session

    • Optional pollOptions: PollOptions

      an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.

    • Default value printPid: boolean = false

      a boolean that indicates whether the function should print (PID) of the started job.

    • Optional variables: MacroVar

      an object that represents macro variables.

    Returns Promise<any>

Const getFileStream

  • getFileStream(job: Job, filePath?: undefined | string): Promise<any>

pollJobState

  • pollJobState(requestClient: RequestClient, postedJob: Job, debug: boolean, authConfig?: AuthConfig, pollOptions?: PollOptions): Promise<string>

saveLog

  • saveLog(job: Job, requestClient: RequestClient, startLine: number, endLine: number, logFileStream?: WriteStream, accessToken?: undefined | string): Promise<void>
  • Appends logs to a supplied write stream. This is useful for getting quick feedback on longer running jobs.

    accesstoken
    • an optional access token for authentication/authorization The access token is not required when fetching logs from the browser.

    Parameters

    • job: Job

      the job to fetch logs for

    • requestClient: RequestClient

      the pre-configured HTTP request client

    • startLine: number

      the line at which to start fetching the log

    • endLine: number

      the line at which to stop fetching the log

    • Optional logFileStream: WriteStream

      the write stream to which the log is appended

    • Optional accessToken: undefined | string

    Returns Promise<void>

uploadTables

  • uploadTables(requestClient: RequestClient, data: any, accessToken?: undefined | string): Promise<object[]>
  • Uploads tables to SAS as specially formatted CSVs. This is more compact than JSON, and easier to read within SAS.

    Parameters

    • requestClient: RequestClient

      the pre-configured HTTP request client

    • data: any

      the JSON representation of the data to be uploaded

    • Optional accessToken: undefined | string

      an optional access token for authentication/authorization The access token is not required when uploading tables from the browser.

    Returns Promise<object[]>

Const writeStream

  • writeStream(stream: WriteStream, content: string): Promise<void>

Generated using TypeDoc