mirror of
https://github.com/sasjs/server.git
synced 2026-01-15 18:00:05 +00:00
Merge branch 'issue16-session' of github.com:sasjs/server into issue16-session
Conflicts: src/routes/index.ts src/utils/upload.ts
This commit is contained in:
@@ -41,7 +41,7 @@ export class ExecutionController {
|
|||||||
|
|
||||||
let webout = path.join(session.path, 'webout.txt')
|
let webout = path.join(session.path, 'webout.txt')
|
||||||
await createFile(webout, '')
|
await createFile(webout, '')
|
||||||
|
|
||||||
program = `
|
program = `
|
||||||
%let sasjsprocessmode=Stored Program;
|
%let sasjsprocessmode=Stored Program;
|
||||||
filename _webout "${webout}";
|
filename _webout "${webout}";
|
||||||
@@ -89,7 +89,7 @@ ${program}`
|
|||||||
(key: string) => key.toLowerCase() === '_debug'
|
(key: string) => key.toLowerCase() === '_debug'
|
||||||
)
|
)
|
||||||
|
|
||||||
if (debug && vars[debug] >= 131 || stderr) {
|
if ((debug && vars[debug] >= 131) || stderr) {
|
||||||
webout = `<html><body>
|
webout = `<html><body>
|
||||||
${webout}
|
${webout}
|
||||||
<div style="text-align:left">
|
<div style="text-align:left">
|
||||||
@@ -98,7 +98,7 @@ ${webout}
|
|||||||
</div>
|
</div>
|
||||||
</body></html>`
|
</body></html>`
|
||||||
}
|
}
|
||||||
|
|
||||||
session.inUse = false
|
session.inUse = false
|
||||||
|
|
||||||
sessionController.deleteSession(session)
|
sessionController.deleteSession(session)
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { createFileTree, getSessionController, getTreeExample } from '../controllers'
|
import {
|
||||||
|
createFileTree,
|
||||||
|
getSessionController,
|
||||||
|
getTreeExample
|
||||||
|
} from '../controllers'
|
||||||
import { ExecutionResult, isRequestQuery, isFileTree } from '../types'
|
import { ExecutionResult, isRequestQuery, isFileTree } from '../types'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { addExtensionIfNotFound, getTmpFilesFolderPath, getTmpFolderPath, makeFilesNamesMap } from '../utils'
|
import {
|
||||||
|
addExtensionIfNotFound,
|
||||||
|
getTmpFilesFolderPath,
|
||||||
|
getTmpFolderPath,
|
||||||
|
makeFilesNamesMap
|
||||||
|
} from '../utils'
|
||||||
import { ExecutionController, FileUploadController } from '../controllers'
|
import { ExecutionController, FileUploadController } from '../controllers'
|
||||||
|
import { uuidv4 } from '@sasjs/utils'
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
@@ -51,7 +61,7 @@ router.get('/SASjsExecutor/do', async (req, res) => {
|
|||||||
let sasCodePath = path
|
let sasCodePath = path
|
||||||
.join(getTmpFilesFolderPath(), req.query._program)
|
.join(getTmpFilesFolderPath(), req.query._program)
|
||||||
.replace(new RegExp('/', 'g'), path.sep)
|
.replace(new RegExp('/', 'g'), path.sep)
|
||||||
|
|
||||||
// If no extension provided, add .sas extension
|
// If no extension provided, add .sas extension
|
||||||
sasCodePath += !sasCodePath.includes('.') ? '.sas' : ''
|
sasCodePath += !sasCodePath.includes('.') ? '.sas' : ''
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export * from './file'
|
export * from './file'
|
||||||
export * from './sleep'
|
export * from './sleep'
|
||||||
export * from './upload'
|
export * from './upload'
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ export const makeFilesNamesMap = (files: MulterFile[]) => {
|
|||||||
|
|
||||||
const filesNamesMap: {[key: string]: string} = {}
|
const filesNamesMap: {[key: string]: string} = {}
|
||||||
|
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
filesNamesMap[file.filename] = file.fieldname
|
filesNamesMap[file.filename] = file.fieldname
|
||||||
}
|
}
|
||||||
|
|
||||||
return filesNamesMap
|
return filesNamesMap
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +27,7 @@ export const makeFilesNamesMap = (files: MulterFile[]) => {
|
|||||||
* @param sasUploadFolder name of the folder that is created for the purpose of files in concurrent request
|
* @param sasUploadFolder name of the folder that is created for the purpose of files in concurrent request
|
||||||
* @returns generated sas code
|
* @returns generated sas code
|
||||||
*/
|
*/
|
||||||
export const generateFileUploadSasCode = (
|
export const generateFileUploadSasCode = (
|
||||||
filesNamesMap: any,
|
filesNamesMap: any,
|
||||||
sasSessionFolder: string
|
sasSessionFolder: string
|
||||||
): string => {
|
): string => {
|
||||||
@@ -84,4 +84,4 @@ export const makeFilesNamesMap = (files: MulterFile[]) => {
|
|||||||
uploadSasCode += `\n`
|
uploadSasCode += `\n`
|
||||||
|
|
||||||
return uploadSasCode
|
return uploadSasCode
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user