mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-10 17:04:36 +00:00
docs: fyxed typos and updated docs
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -76,7 +76,7 @@ export class FileUploader {
|
||||
})
|
||||
.then((responseText) => {
|
||||
if (isLogInRequired(responseText))
|
||||
reject('You must be logged in to upload a file') // FIXME: use ErrorResponse
|
||||
reject('You must be logged in to upload a file')
|
||||
|
||||
if (needsRetry(responseText)) {
|
||||
if (this.retryCount < requestRetryLimit) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { isUrl } from './utils'
|
||||
|
||||
/**
|
||||
* A client for interfacing with the SAS9 REST API
|
||||
* A client for interfacing with the SAS9 REST API.
|
||||
*
|
||||
*/
|
||||
export class SAS9ApiClient {
|
||||
@@ -10,7 +10,7 @@ export class SAS9ApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns on object containing the server URL
|
||||
* Returns an object containing server URL.
|
||||
*/
|
||||
public getConfig() {
|
||||
return {
|
||||
@@ -19,8 +19,8 @@ export class SAS9ApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates serverurl which is not null
|
||||
* @param serverUrl - the URL of the server.
|
||||
* Updates server URL which is not null.
|
||||
* @param serverUrl - URL of the server to be set.
|
||||
*/
|
||||
public setConfig(serverUrl: string) {
|
||||
if (serverUrl) this.serverUrl = serverUrl
|
||||
@@ -28,9 +28,9 @@ export class SAS9ApiClient {
|
||||
|
||||
/**
|
||||
* Executes code on a SAS9 server.
|
||||
* @param linesOfCode - an array of lines of code to execute
|
||||
* @param serverName - the server to execute the code on
|
||||
* @param repositoryName - the repository to execute the code on
|
||||
* @param linesOfCode - an array of code lines to execute.
|
||||
* @param serverName - the server to execute the code on.
|
||||
* @param repositoryName - the repository to execute the code in.
|
||||
*/
|
||||
public async executeScript(
|
||||
linesOfCode: string[],
|
||||
|
||||
@@ -126,7 +126,7 @@ export class SASViyaApiClient {
|
||||
`${this.serverUrl}/compute/contexts?limit=10000`,
|
||||
{ headers }
|
||||
).catch((err) => {
|
||||
throw new Error(err)
|
||||
throw err
|
||||
})
|
||||
|
||||
const contextsList = contexts.items || []
|
||||
@@ -563,13 +563,12 @@ export class SASViyaApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a folder in the specified location. Either parentFolderPath or
|
||||
* parentFolderUri must be provided.
|
||||
* Creates a folder. Path to or URI of the parent folder is required.
|
||||
* @param folderName - the name of the new folder.
|
||||
* @param parentFolderPath - the full path to the parent folder. If not
|
||||
* provided, the parentFolderUri must be provided.
|
||||
* @param parentFolderUri - the URI (eg /folders/folders/UUID) of the parent
|
||||
* folder. If not provided, the parentFolderPath must be provided.
|
||||
* folder. If not provided, the parentFolderPath must be provided.
|
||||
* @param accessToken - an access token for authorizing the request.
|
||||
* @param isForced - flag that indicates if target folder already exists, it and all subfolders have to be deleted.
|
||||
*/
|
||||
@@ -666,7 +665,7 @@ export class SASViyaApiClient {
|
||||
createFolderRequest
|
||||
)
|
||||
|
||||
// update rootFolderMap with newly created folder.
|
||||
// updates rootFolderMap with newly created folder.
|
||||
await this.populateRootFolderMap(accessToken)
|
||||
return createFolderResponse
|
||||
}
|
||||
@@ -728,7 +727,7 @@ export class SASViyaApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a login redirect and returns an auth code for the given client
|
||||
* Performs a login redirect and returns an auth code for the given client.
|
||||
* @param clientId - the client ID to authenticate with.
|
||||
*/
|
||||
public async getAuthCode(clientId: string) {
|
||||
@@ -882,7 +881,7 @@ export class SASViyaApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a job via the SAS Viya Compute API
|
||||
* Executes a job via the SAS Viya Compute API.
|
||||
* @param sasJob - the relative path to the job.
|
||||
* @param contextName - the name of the context where the job is to be executed.
|
||||
* @param debug - sets the _debug flag in the job arguments.
|
||||
@@ -943,7 +942,7 @@ export class SASViyaApiClient {
|
||||
|
||||
code = jobDefinition.code
|
||||
|
||||
// Add code to existing job definition
|
||||
// Adds code to existing job definition
|
||||
jobToExecute.code = code
|
||||
}
|
||||
|
||||
@@ -961,7 +960,7 @@ export class SASViyaApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a job via the SAS Viya Job Execution API
|
||||
* Executes a job via the SAS Viya Job Execution API.
|
||||
* @param sasJob - the relative path to the job.
|
||||
* @param contextName - the name of the context where the job is to be executed.
|
||||
* @param debug - sets the _debug flag in the job arguments.
|
||||
@@ -1448,7 +1447,7 @@ export class SASViyaApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* For performance (and in case of accidental error) the `deleteFolder` function does not actually delete the folder (and all it's content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.
|
||||
* 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.
|
||||
* @param folderPath - the full path (eg `/Public/example/deleteThis`) of the folder to be deleted.
|
||||
* @param accessToken - an access token for authorizing the request.
|
||||
*/
|
||||
|
||||
64
src/SASjs.ts
64
src/SASjs.ts
@@ -193,7 +193,7 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a folder at SAS file system
|
||||
* Creates a folder at SAS file system.
|
||||
* @param folderName - name of the folder to be created.
|
||||
* @param parentFolderPath - the full path (eg `/Public/example/myFolder`) of the parent folder.
|
||||
* @param parentFolderUri - the URI of the parent folder.
|
||||
@@ -311,7 +311,7 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the _csrf token of the current session for the API approach
|
||||
* Returns the _csrf token of the current session for the API approach.
|
||||
*
|
||||
*/
|
||||
public getCsrfApi() {
|
||||
@@ -328,7 +328,7 @@ export default class SASjs {
|
||||
|
||||
/**
|
||||
* Sets the SASjs configuration.
|
||||
* @param config - SASjsConfig indicating SASjs Configuration
|
||||
* @param config - SASjs configuration.
|
||||
*/
|
||||
public async setSASjsConfig(config: SASjsConfig) {
|
||||
this.sasjsConfig = {
|
||||
@@ -339,17 +339,16 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the debug state. Turning this on will enable additional logging to
|
||||
* be returned to the adapter.
|
||||
* @param value - Boolean indicating debug state
|
||||
* Sets the debug state. Turning this on will enable additional logging in the adapter.
|
||||
* @param value - boolean indicating debug state (on/off).
|
||||
*/
|
||||
public setDebugState(value: boolean) {
|
||||
this.sasjsConfig.debug = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a session is active, or login is required
|
||||
* @returns a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`
|
||||
* Checks whether a session is active, or login is required.
|
||||
* @returns - a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`.
|
||||
*/
|
||||
public async checkSession() {
|
||||
const loginResponse = await fetch(this.loginUrl.replace('.do', ''))
|
||||
@@ -363,9 +362,9 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs into the SAS server with the supplied credentials
|
||||
* @param username - a string representing the username
|
||||
* @param password - a string representing the password
|
||||
* Logs into the SAS server with the supplied credentials.
|
||||
* @param username - a string representing the username.
|
||||
* @param password - a string representing the password.
|
||||
*/
|
||||
public async logIn(username: string, password: string) {
|
||||
const loginParams: any = {
|
||||
@@ -434,7 +433,7 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out of the configured SAS server
|
||||
* Logs out of the configured SAS server.
|
||||
*/
|
||||
public logOut() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -448,12 +447,12 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a file to the given service
|
||||
* @param sasJob - The path to the SAS program (ultimately resolves to
|
||||
* Uploads a file to the given service.
|
||||
* @param sasJob - 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`.
|
||||
* @param file - Array of files to be uploaded, including File object and file name.
|
||||
* @param params - Request URL paramaters
|
||||
* Process). Is prepended at runtime with the value of `appLoc`.
|
||||
* @param files - array of files to be uploaded, including File object and file name.
|
||||
* @param params - request URL parameters.
|
||||
*/
|
||||
public uploadFile(sasJob: string, files: UploadFile[], params: any) {
|
||||
const fileUploader =
|
||||
@@ -470,21 +469,21 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request to the SAS Service specified in `SASjob`. The response
|
||||
* Makes a request to the SAS Service specified in `SASjob`. The response
|
||||
* object will always contain table names in lowercase, and column names in
|
||||
* uppercase. Values are returned formatted by default, unformatted
|
||||
* uppercase. Values are returned formatted by default, unformatted
|
||||
* values can be configured as an option in the `%webout` macro.
|
||||
*
|
||||
* @param sasJob - The path to the SAS program (ultimately resolves to
|
||||
* @param sasJob - 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`.
|
||||
* @param data - A JSON object containing one or more tables to be sent to
|
||||
* SAS. Can be `null` if no inputs required.
|
||||
* @param config - Provide any changes to the config here, for instance to
|
||||
* enable / disable `debug`. Any change provided will override the global config,
|
||||
* Process). Is prepended at runtime with the value of `appLoc`.
|
||||
* @param data - a JSON object containing one or more tables to be sent to
|
||||
* SAS. Can be `null` if no inputs required.
|
||||
* @param config - 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.
|
||||
* @param loginRequiredCallback - provide a function here to be called if the
|
||||
* user is not logged in (eg to display a login form). The request will be
|
||||
* user is not logged in (eg to display a login form). The request will be
|
||||
* resubmitted after logon.
|
||||
*/
|
||||
public async request(
|
||||
@@ -538,8 +537,7 @@ export default class SASjs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the folders and services in the provided JSON on the given location
|
||||
* (appLoc) on the given server (serverUrl).
|
||||
* Creates the folders and services at the given location `appLoc` on the given server `serverUrl`.
|
||||
* @param serviceJson - the JSON specifying the folders and services to be created.
|
||||
* @param appLoc - the base folder in which to create the new folders and
|
||||
* services. If not provided, is taken from SASjsConfig.
|
||||
@@ -670,7 +668,7 @@ export default class SASjs {
|
||||
resolve(retryResponse)
|
||||
} else {
|
||||
this.retryCountComputeApi = 0
|
||||
reject({ MESSAGE: 'Compute API retry requests limit reached.' }) // FIXME: use ErrorResponse
|
||||
reject({ MESSAGE: 'Compute API retry requests limit reached.' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +679,7 @@ export default class SASjs {
|
||||
sasjsWaitingRequest.config = config
|
||||
this.sasjsWaitingRequests.push(sasjsWaitingRequest)
|
||||
} else {
|
||||
reject({ MESSAGE: error || 'Job execution failed.' }) // FIXME: use ErrorResponse
|
||||
reject({ MESSAGE: error || 'Job execution failed.' })
|
||||
}
|
||||
|
||||
this.appendSasjsRequest(response.log, sasJob, null)
|
||||
@@ -763,11 +761,11 @@ export default class SASjs {
|
||||
resolve(retryResponse)
|
||||
} else {
|
||||
this.retryCountJeseApi = 0
|
||||
reject({ MESSAGE: 'JES API retry requests limit reached' }) // FIXME: use ErrorResponse
|
||||
reject({ MESSAGE: 'JES API retry requests limit reached' })
|
||||
}
|
||||
}
|
||||
|
||||
reject({ MESSAGE: (e && e.message) || 'Job execution failed.' }) // FIXME: use ErrorResponse
|
||||
reject({ MESSAGE: (e && e.message) || 'Job execution failed.' })
|
||||
})
|
||||
)
|
||||
}
|
||||
@@ -1058,7 +1056,7 @@ export default class SASjs {
|
||||
resolve(resText)
|
||||
})
|
||||
} else {
|
||||
reject('No debug info found in response.') // FIXME: use ErrorResponse
|
||||
reject('No debug info found in response.')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class SASjsConfig {
|
||||
*/
|
||||
appLoc: string = ''
|
||||
/**
|
||||
* Can be SAS9 or SASVIYA
|
||||
* Can be `SAS9` or `SASVIYA`.
|
||||
*/
|
||||
serverType: ServerType | null = null
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Represents requests that are queued, pending a signon event
|
||||
* Represents requests that are queued, pending a signon event.
|
||||
*
|
||||
*/
|
||||
export interface SASjsWaitingRequest {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Server type - Viya or SAS9.
|
||||
* Server type that can be `Viya` or `SAS9`.
|
||||
*
|
||||
*/
|
||||
export enum ServerType {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Represents a object that is passed to file uploader
|
||||
* Represents an object that is passed to the file uploader.
|
||||
*
|
||||
*/
|
||||
export interface UploadFile {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SASjsRequest } from '../types/SASjsRequest'
|
||||
|
||||
/**
|
||||
* Comparator for SASjs request timestamps
|
||||
* Comparator for SASjs request timestamps.
|
||||
*
|
||||
*/
|
||||
export const compareTimestamps = (a: SASjsRequest, b: SASjsRequest) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Checks if string is in URI format
|
||||
* @param str string to check
|
||||
* Checks if string is in URI format.
|
||||
* @param str - string to check.
|
||||
*/
|
||||
export const isUri = (str: string): boolean => /^\/folders\/folders\//.test(str)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Checks if string is in URL format.
|
||||
* @param url - string to check.
|
||||
*/
|
||||
export const isUrl = (url: string): boolean => {
|
||||
const pattern = new RegExp(
|
||||
'^(http://|https://)[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$',
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
"outline": [
|
||||
{
|
||||
"SAS Adapter": {
|
||||
"SASjs": "classes/reflection-708.reflection-180.sasjs",
|
||||
"SASjs": "classes/reflection-717.reflection-180.sasjs",
|
||||
"Types": "modules/types"
|
||||
},
|
||||
"SAS Viya API Client": "classes/reflection-708.reflection-180.sasviyaapiclient",
|
||||
"SAS 9 API Client": "classes/reflection-708.reflection-180.sas9apiclient"
|
||||
"SAS Viya API Client": "classes/reflection-717.reflection-180.sasviyaapiclient",
|
||||
"SAS 9 API Client": "classes/reflection-717.reflection-180.sas9apiclient"
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
|
||||
Reference in New Issue
Block a user