mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-19 10:00:06 +00:00
fix: file upload on SASJS SERVER
Also fixed appendRequest when debug on while on SASJS SERVER
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -8,7 +8,7 @@
|
|||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/utils": "2.40.0",
|
"@sasjs/utils": "2.40.1",
|
||||||
"axios": "0.26.0",
|
"axios": "0.26.0",
|
||||||
"axios-cookiejar-support": "1.0.1",
|
"axios-cookiejar-support": "1.0.1",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
@@ -1142,9 +1142,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sasjs/utils": {
|
"node_modules/@sasjs/utils": {
|
||||||
"version": "2.40.0",
|
"version": "2.40.1",
|
||||||
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.1.tgz",
|
||||||
"integrity": "sha512-U0y/eqRlvfkMHmKDlr1xmeN+Rask7TnJPuRpOz71P8QpGYTw1M9AyZvzRSk503p4KCJb8ysdcqXyGVLfhuoM+A==",
|
"integrity": "sha512-wWYElDH71bSZTdZ5V38743vAnw2EPDhzH7+1s7zxINHpaQWK/qrDldI0vgVFLeGpxVU0D7WPZ/ltG6MoE2obeg==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
@@ -13870,9 +13870,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sasjs/utils": {
|
"@sasjs/utils": {
|
||||||
"version": "2.40.0",
|
"version": "2.40.1",
|
||||||
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.1.tgz",
|
||||||
"integrity": "sha512-U0y/eqRlvfkMHmKDlr1xmeN+Rask7TnJPuRpOz71P8QpGYTw1M9AyZvzRSk503p4KCJb8ysdcqXyGVLfhuoM+A==",
|
"integrity": "sha512-wWYElDH71bSZTdZ5V38743vAnw2EPDhzH7+1s7zxINHpaQWK/qrDldI0vgVFLeGpxVU0D7WPZ/ltG6MoE2obeg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
"@types/prompts": "2.0.13",
|
"@types/prompts": "2.0.13",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/utils": "2.40.0",
|
"@sasjs/utils": "2.40.1",
|
||||||
"axios": "0.26.0",
|
"axios": "0.26.0",
|
||||||
"axios-cookiejar-support": "1.0.1",
|
"axios-cookiejar-support": "1.0.1",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
|
|||||||
@@ -99,7 +99,17 @@ export class FileUploader extends BaseJobExecutor {
|
|||||||
? parseWeboutResponse(res.result, uploadUrl)
|
? parseWeboutResponse(res.result, uploadUrl)
|
||||||
: res.result
|
: res.result
|
||||||
break
|
break
|
||||||
|
case ServerType.Sasjs:
|
||||||
|
if (typeof res.result._webout === 'object') {
|
||||||
|
jsonResponse = res.result._webout
|
||||||
|
} else {
|
||||||
|
const webout = parseWeboutResponse(res.result._webout, uploadUrl)
|
||||||
|
jsonResponse = getValidJson(webout)
|
||||||
}
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if (this.serverType === ServerType.Sasjs) {
|
||||||
|
jsonResponse = getValidJson(res.result._webout)
|
||||||
} else {
|
} else {
|
||||||
jsonResponse =
|
jsonResponse =
|
||||||
typeof res.result === 'string'
|
typeof res.result === 'string'
|
||||||
|
|||||||
@@ -131,6 +131,24 @@ export class RequestClient implements HttpClient {
|
|||||||
} else {
|
} else {
|
||||||
sasWork = response.log
|
sasWork = response.log
|
||||||
}
|
}
|
||||||
|
} else if (response?.result?.log) {
|
||||||
|
//In this scenario we know we got the response from SASJS server
|
||||||
|
//Log is array of `{ line: '' }` so we need to convert it back to text
|
||||||
|
//To be able to parse it with current functions.
|
||||||
|
let log: string = ''
|
||||||
|
|
||||||
|
if (typeof log !== 'string') {
|
||||||
|
log = response.result.log.map((logLine: any) => logLine.line).join('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceCode = parseSourceCode(log)
|
||||||
|
generatedCode = parseGeneratedCode(log)
|
||||||
|
|
||||||
|
if (response?.result?._webout) {
|
||||||
|
sasWork = response.result._webout.WORK
|
||||||
|
} else {
|
||||||
|
sasWork = log
|
||||||
|
}
|
||||||
} else if (response?.result) {
|
} else if (response?.result) {
|
||||||
sourceCode = parseSourceCode(response.result)
|
sourceCode = parseSourceCode(response.result)
|
||||||
generatedCode = parseGeneratedCode(response.result)
|
generatedCode = parseGeneratedCode(response.result)
|
||||||
|
|||||||
Reference in New Issue
Block a user