mirror of
https://github.com/sasjs/server.git
synced 2026-01-04 21:30:05 +00:00
fix: updated route for sas code
This commit is contained in:
@@ -5,13 +5,6 @@ import { ExecutionController } from './internal'
|
||||
import { PreProgramVars } from '../types'
|
||||
import { getTmpFilesFolderPath, makeFilesNamesMap } from '../utils'
|
||||
|
||||
interface RunSASPayload {
|
||||
/**
|
||||
* Code of SAS program
|
||||
* @example "* SAS Code HERE;"
|
||||
*/
|
||||
code: string
|
||||
}
|
||||
interface ExecuteReturnJsonPayload {
|
||||
/**
|
||||
* Location of SAS program
|
||||
@@ -48,18 +41,6 @@ export class STPController {
|
||||
return executeReturnRaw(request, _program)
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a SAS program.
|
||||
* @summary Run SAS Program, return raw content
|
||||
*/
|
||||
@Post('/run')
|
||||
public async runSAS(
|
||||
@Request() request: express.Request,
|
||||
@Body() body: RunSASPayload
|
||||
): Promise<string> {
|
||||
return runSAS(request, body)
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a SAS program using it's location in the _program parameter.
|
||||
* Enable debugging using the _debug parameter.
|
||||
@@ -109,25 +90,6 @@ const executeReturnRaw = async (
|
||||
}
|
||||
}
|
||||
|
||||
const runSAS = async (req: any, { code }: RunSASPayload) => {
|
||||
try {
|
||||
const result = await new ExecutionController().executeProgram(
|
||||
code,
|
||||
getPreProgramVariables(req),
|
||||
req.query
|
||||
)
|
||||
|
||||
return result as string
|
||||
} catch (err: any) {
|
||||
throw {
|
||||
code: 400,
|
||||
status: 'failure',
|
||||
message: 'Job execution failed.',
|
||||
error: typeof err === 'object' ? err.toString() : err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const executeReturnJson = async (
|
||||
req: any,
|
||||
_program: string
|
||||
|
||||
Reference in New Issue
Block a user