mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-15 18:54:36 +00:00
chore: fixing useComputeApi defaults
This commit is contained in:
@@ -38,12 +38,7 @@ export class FileUploader {
|
||||
: sasJob
|
||||
const uploadUrl = `${this.jobsPath}/?${
|
||||
'_program=' + program
|
||||
}${paramsString}${
|
||||
this.sasjsConfig.serverType === ServerType.SasViya &&
|
||||
this.sasjsConfig.contextName
|
||||
? '&_contextname=' + this.sasjsConfig.contextName
|
||||
: ''
|
||||
}`
|
||||
}${paramsString}`
|
||||
|
||||
const formData = new FormData()
|
||||
|
||||
@@ -54,6 +49,7 @@ export class FileUploader {
|
||||
const csrfToken = this.requestClient.getCsrfToken('file')
|
||||
if (csrfToken) formData.append('_csrf', csrfToken.value)
|
||||
if (this.sasjsConfig.debug) formData.append('_debug', '131')
|
||||
if (this.sasjsConfig.serverType === ServerType.SasViya && this.sasjsConfig.contextName) formData.append('_contextname', this.sasjsConfig.contextName)
|
||||
|
||||
const headers = {
|
||||
'cache-control': 'no-cache',
|
||||
@@ -63,8 +59,12 @@ export class FileUploader {
|
||||
|
||||
return this.requestClient
|
||||
.post(uploadUrl, formData, undefined, 'application/json', headers)
|
||||
.then((res) =>
|
||||
typeof res.result === 'string' ? JSON.parse(res.result) : res.result
|
||||
.then((res) => {
|
||||
let result
|
||||
|
||||
result = typeof res.result === 'string' ? JSON.parse(res.result) : res.result
|
||||
//TODO: append to SASjs requests
|
||||
}
|
||||
)
|
||||
.catch((err: Error) => {
|
||||
if (err instanceof LoginRequiredError) {
|
||||
|
||||
@@ -24,7 +24,7 @@ const defaultConfig: SASjsConfig = {
|
||||
serverType: ServerType.SasViya,
|
||||
debug: false,
|
||||
contextName: 'SAS Job Execution compute context',
|
||||
useComputeApi: false,
|
||||
useComputeApi: null,
|
||||
allowInsecureRequests: false
|
||||
}
|
||||
|
||||
|
||||
@@ -40,23 +40,19 @@ export class SASjsConfig {
|
||||
*/
|
||||
debug: boolean = true
|
||||
/**
|
||||
* The name of the compute context to use when calling the Viya APIs directly.
|
||||
* The name of the compute context to use when calling the Viya services directly.
|
||||
* Example value: 'SAS Job Execution compute context'
|
||||
* If set to missing or empty, and useComputeApi is true, the adapter will use
|
||||
* the JES APIs. If provided, the Job Code will be executed in pooled
|
||||
* compute sessions on this named context.
|
||||
*/
|
||||
contextName: string = ''
|
||||
/**
|
||||
* Set to `false` to use the Job Execution Web Service. To enhance VIYA
|
||||
* If it's `false` adapter will use the JES API as connection approach. To enhance VIYA
|
||||
* performance, set to `true` and provide a `contextName` on which to run
|
||||
* the code. When running on a named context, the code executes under the
|
||||
* user identity. When running as a Job Execution service, the code runs
|
||||
* under the identity in the JES context. If no `contextName` is provided,
|
||||
* and `useComputeApi` is `true`, then the service will run as a Job, except
|
||||
* under the identity in the JES context. If `useComputeApi` is `null` or `undefined`, the service will run as a Job, except
|
||||
* triggered using the APIs instead of the Job Execution Web Service broker.
|
||||
*/
|
||||
useComputeApi = false
|
||||
useComputeApi: boolean | null = null
|
||||
/**
|
||||
* Defaults to `false`.
|
||||
* When set to `true`, the adapter will allow requests to SAS servers that use a self-signed SSL certificate.
|
||||
|
||||
Reference in New Issue
Block a user