1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-05 03:30:05 +00:00

Merge branch 'master' into issue-186

This commit is contained in:
Mihajlo Medjedovic
2021-01-22 14:46:46 +01:00
4 changed files with 927 additions and 2892 deletions

3771
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -37,28 +37,28 @@
"license": "ISC",
"devDependencies": {
"@types/isomorphic-fetch": "0.0.35",
"@types/jest": "^26.0.15",
"@types/jest": "^26.0.20",
"cp": "^0.2.0",
"dotenv": "^8.2.0",
"jest": "^25.5.4",
"path": "^0.12.7",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.0",
"semantic-release": "^17.3.1",
"terser-webpack-plugin": "^4.2.3",
"ts-jest": "^25.5.1",
"ts-loader": "^8.0.11",
"ts-loader": "^8.0.14",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typedoc": "^0.17.8",
"typedoc": "^0.19.2",
"typedoc-neo-theme": "^1.0.10",
"typedoc-plugin-external-module-name": "^4.0.3",
"typedoc-plugin-external-module-name": "^4.0.6",
"typescript": "^3.9.7",
"webpack": "^4.44.2",
"webpack-cli": "^4.2.0"
"webpack": "^5.13.0",
"webpack-cli": "^4.3.1"
},
"main": "index.js",
"dependencies": {
"@sasjs/utils": "^1.5.0",
"@sasjs/utils": "^2.0.2",
"es6-promise": "^4.2.8",
"form-data": "^3.0.0",
"isomorphic-fetch": "^2.2.1"

View File

@@ -1108,6 +1108,8 @@ export class SASViyaApiClient {
}
return new Promise(async (resolve, _) => {
let printedState = ''
const interval = setInterval(async () => {
if (
postedJobState === 'running' ||
@@ -1115,9 +1117,6 @@ export class SASViyaApiClient {
postedJobState === 'pending'
) {
if (stateLink) {
if (this.debug) {
console.log('Polling job status... \n')
}
const { result: jobState } = await this.request<string>(
`${this.serverUrl}${stateLink.href}?_action=wait&wait=30`,
{
@@ -1127,10 +1126,16 @@ export class SASViyaApiClient {
)
postedJobState = jobState.trim()
if (this.debug) {
console.log(`Current state: ${postedJobState}\n`)
if (this.debug && printedState !== postedJobState) {
console.log('Polling job status...')
console.log(`Current job state: ${postedJobState}`)
printedState = postedJobState
}
pollCount++
if (pollCount >= MAX_POLL_COUNT) {
resolve(postedJobState)
}

View File

@@ -23,6 +23,10 @@ export class SessionManager {
private currentContext: Context | null = null
private csrfToken: CsrfToken | null = null
private _debug: boolean = false
private printedSessionState = {
printed: false,
state: ''
}
public get debug() {
return this._debug
@@ -175,8 +179,10 @@ export class SessionManager {
sessionState === ''
) {
if (stateLink) {
if (this.debug) {
console.log('Polling session status... \n')
if (this.debug && !this.printedSessionState.printed) {
console.log('Polling session status...')
this.printedSessionState.printed = true
}
const { result: state } = await this.requestSessionStatus<string>(
@@ -191,8 +197,11 @@ export class SessionManager {
sessionState = state.trim()
if (this.debug) {
console.log(`Current state is '${sessionState}'\n`)
if (this.debug && this.printedSessionState.state !== sessionState) {
console.log(`Current session state is '${sessionState}'`)
this.printedSessionState.state = sessionState
this.printedSessionState.printed = false
}
// There is an internal error present in SAS Viya 3.5