Optionalconfig: Partial<SASjsConfig>Checks whether a session is active, or login is required.
isLoggedIn, and a string userName.Creates a compute context on the given server.
the name of the context to be created.
the name of the launcher context used by the compute service.
the ID of the account to run the servers for this context as.
the lines of code to execute during session initialization.
an access token for an authorised user.
OptionalauthorisedUsers: string[]
an optional list of authorised user IDs.
Creates a file in the logical SAS folder tree
name of the file to be created.
content of the file to be created.
the full path (eg /Public/example/myFolder) of the parent folder.
OptionalparentFolderUri: string
the URI of the parent folder.
OptionalaccessToken: string
the access token to authorizing the request.
OptionalsasApiClient: SASViyaApiClient
a client for interfacing with SAS API.
Creates a folder in the logical SAS folder tree
name of the folder to be created.
the full path (eg /Public/example/myFolder) of the parent folder.
OptionalparentFolderUri: string
the URI of the parent folder.
OptionalaccessToken: string
the access token to authorizing the request.
OptionalsasApiClient: SASViyaApiClient
a client for interfacing with SAS API.
OptionalisForced: boolean
flag that indicates if target folder already exists, it and all subfolders have to be deleted. Applicable for SAS VIYA only.
OptionalparentFolderPath: stringOptionalparentFolderUri: stringOptionalaccessToken: stringOptionalsasApiClient: SASViyaApiClientCreates a launcher context on the given server.
the name of the context to be created.
the description of the context to be created.
launch type of the context to be created.
an access token for an authorised user.
Deletes a compute context on the given server.
the name of the context to be deleted.
OptionalaccessToken: string
an access token for an authorised user.
For performance (and in case of accidental error) the deleteFolder function does not actually delete the folder (and all its content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.
the full path (eg /Public/example/deleteThis) of the folder to be deleted.
an access token for authorizing the request.
Creates the folders and services at the given location appLoc on the given server serverUrl.
the JSON specifying the folders and services to be created.
OptionalappLoc: string
the base folder in which to create the new folders and services. If not provided, is taken from SASjsConfig.
OptionalserverUrl: string
the server on which to deploy the folders and services. If not provided, is taken from SASjsConfig.
OptionalaccessToken: string
an optional access token to be passed in when using this function from the command line.
flag that indicates if target folder already exists, it and all subfolders have to be deleted.
Turns off verbose mode to log every HTTP response.
Updates a compute context on the given server.
the original name of the context to be deleted.
an object with the properties to be updated.
OptionalaccessToken: string
an access token for an authorised user.
Enables verbose mode that will log a summary of every HTTP response.
OptionalsuccessCallBack: (response: AxiosResponse) => AxiosResponse
function that should be triggered on every HTTP response with the status 2**.
OptionalerrorCallBack: (response: AxiosError) => AxiosError
function that should be triggered on every HTTP response with the status different from 2**.
Executes job on SASJS server.
an object containing job path and debug level.
an application path.
OptionalauthConfig: AuthConfig
an object for authentication.
a promise that resolves into job execution result and log.
Executes code on a SAS server.
lines of code to run.
Fetches content of the log file
url of the log file.
OptionalaccessToken: string
an access token for an authorised user.
Exchanges the auth code for an access token for the given client.
the client ID to authenticate with.
the client secret to authenticate with.
the auth code received from the server.
Returns a JSON representation of a compute context.
an id of the context to return.
OptionalaccessToken: string
an access token for an authorised user.
Returns a JSON representation of a compute context. @example: { "createdBy": "admin", "links": [...], "id": "ID", "version": 2, "name": "context1" }
the name of the context to return.
OptionalaccessToken: string
an access token for an authorised user.
Gets compute contexts.
an access token for an authorised user.
Gets default(system) launcher contexts.
Gets executable compute contexts.
an access token, refresh token, client and secret for an authorised user.
Fetches the file content for a file in the specified folder.
the full path to the folder containing the file. eg: /Public/folder1/folder2
the name of the file in the folderPath
OptionalaccessToken: string
an access token for authorizing the request
Fetches a folder from the SAS file system.
path of the folder to be fetched.
OptionalaccessToken: string
the access token to authorize the request.
Gets launcher contexts.
an access token for an authorised user.
Returns the current SASjs configuration.
Returns the username of the user currently logged in.
Lists children folders for given Viya folder.
the full path (eg /Public/example/myFolder) or URI of the source folder listed. Providing URI instead of path will save one extra request.
OptionalaccessToken: string
an access token for authorizing the request.
Optionallimit: numberwhen set to true, the function will return an array of objects with member details, otherwise it will return an array of member names.
Logs into the SAS server with the supplied credentials.
Optionalusername: string
a string representing the username.
Optionalpassword: string
a string representing the password.
OptionalclientId: string
a string representing the client ID.
Logs out of the configured SAS server.
Moves folder to a new location. The folder may be renamed at the same time.
the full path (eg /Public/example/myFolder) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.
the full path or URI of the parent folder to which the sourceFolder will be moved (eg /Public/newDestination). To move a folder, a user has to have write permissions in targetParentFolder. Providing URI instead of path will save one extra request.
the name of the "moved" folder. If left blank, the original folder name will be used (eg myFolder in /Public/newDestination/myFolder for the example above). Optional field.
an access token for authorizing the request.
Exchanges the refresh token for an access token for the given client.
the client ID to authenticate with.
the client secret to authenticate with.
the refresh token received from the server.
Makes a request to program specified in SASjob (could be a Viya Job, a
SAS 9 Stored Process, or a SASjs Server Stored Program). The response
object will always contain table names in lowercase, and column names in
uppercase. Values are returned formatted by default, unformatted
values can be configured as an option in the %webout macro.
the path to the SAS program (ultimately resolves to
the SAS _program parameter to run a Job Definition or SAS 9 Stored
Process). Is prepended at runtime with the value of appLoc.
a JSON object containing one or more tables to be sent to
SAS. For an example of the table structure, see the project README. This
value can be null if no inputs are required.
provide any changes to the config here, for instance to
enable/disable debug. Any change provided will override the global config,
for that particular function call.
OptionalloginRequiredCallback: () => any
a function that is called if the
user is not logged in (eg to display a login form). The request will be
resubmitted after successful login.
When using a loginRequiredCallback, the call to the request will look, for example, like so:
await request(sasJobPath, data, config, () => setIsLoggedIn(false))
If you are not passing in any data and configuration, it will look like so:
await request(sasJobPath, {}, {}, () => setIsLoggedIn(false))
OptionalauthConfig: AuthConfiga array of predefined values that are used to provide extra attributes (same names as those values) to be added in response Supported values are declared in ExtraResponseAttributes type.
Sets the debug state. Turning this on will enable additional logging in the adapter.
boolean indicating debug state (on/off).
Sets the SASjs configuration.
SASjs configuration.
Sets verbose mode.
value of the verbose mode, can be true, false or bleached(without extra colors).
Kicks off execution of the given job via the compute API.
the path to the SAS program (ultimately resolves to
the SAS _program parameter to run a Job Definition or SAS 9 Stored
Process). Is prepended at runtime with the value of appLoc.
a JSON object containing one or more tables to be sent to
SAS. Can be null if no inputs required.
provide any changes to the config here, for instance to
enable/disable debug. Any change provided will override the global config,
for that particular function call.
OptionalauthConfig: AuthConfig
a valid client, secret, refresh and access tokens that are authorised to execute compute jobs. The access token is not required when the user is authenticated via the browser.
OptionalwaitForResult: boolean
a boolean that indicates whether the function needs to wait for execution to complete.
OptionalpollOptions: PollOptions
an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { maxPollCount: 24 * 60 * 60, pollInterval: 1000 }. More information available at src/api/viya/pollJobState.ts.
a boolean that indicates whether the function should print (PID) of the started job.
Optionalvariables: MacroVar
an object that represents macro variables.
OptionalverboseMode: VerboseMode
boolean or a string equal to 'bleached' to enable verbose mode (log every HTTP response).
OptionalonTokensRefreshed: OnTokensRefreshed
(optional, SAS Viya only) callback invoked with the rotated token pair after a successful internal refresh, so consumers that persist tokens can store the new pair.
an object representing the compute session created for the given job.
Create a tables class containing one or more tables to be sent to SAS.
initial table data
macro name
Tables class
Updates the file content for a file in the specified folder.
the full path to the folder containing the file. eg: /Public/folder1/folder2
the name of the file in the folderPath
the new content to be written to the file
OptionalaccessToken: string
an access token for authorizing the request
Uploads a file to the given service.
the path to the SAS program (ultimately resolves to
the SAS _program parameter to run a Job Definition or SAS 9 Stored
Process). Is prepended at runtime with the value of appLoc.
array of files to be uploaded, including File object and file name.
request URL parameters.
provide any changes to the config here, for instance to
enable/disable debug. Any change provided will override the global config,
for that particular function call.
OptionalloginRequiredCallback: () => any
a function that is called if the user is not logged in (eg to display a login form). The request will be resubmitted after successful login.
SASjs is a JavaScript adapter for SAS.