@sasjs/adapter 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SASjs.d.ts +10 -2
- package/index.js +2 -2
- package/node/SASjs.d.ts +10 -2
- package/node/index.js +2 -2
- package/package.json +1 -1
- package/src/SessionManager.ts +1 -1
- package/src/api/viya/pollJobState.ts +4 -3
- package/src/request/RequestClient.ts +9 -6
- package/src/test/SAS_server_app.ts +1 -0
package/package.json
CHANGED
package/src/SessionManager.ts
CHANGED
|
@@ -168,7 +168,7 @@ export class SessionManager {
|
|
|
168
168
|
) {
|
|
169
169
|
if (stateLink) {
|
|
170
170
|
if (this.debug && !this.printedSessionState.printed) {
|
|
171
|
-
logger.info(
|
|
171
|
+
logger.info(`Polling: ${this.serverUrl + stateLink.href}`)
|
|
172
172
|
|
|
173
173
|
this.printedSessionState.printed = true
|
|
174
174
|
}
|
|
@@ -206,10 +206,11 @@ const doPoll = async (
|
|
|
206
206
|
|
|
207
207
|
pollCount++
|
|
208
208
|
|
|
209
|
+
const jobHref = postedJob.links.find((l: Link) => l.rel === 'self')!.href
|
|
210
|
+
|
|
209
211
|
if (pollOptions?.streamLog) {
|
|
210
|
-
const jobUrl = postedJob.links.find((l: Link) => l.rel === 'self')
|
|
211
212
|
const { result: job } = await requestClient.get<Job>(
|
|
212
|
-
|
|
213
|
+
jobHref,
|
|
213
214
|
authConfig?.access_token
|
|
214
215
|
)
|
|
215
216
|
|
|
@@ -231,7 +232,7 @@ const doPoll = async (
|
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
if (debug && printedState !== state) {
|
|
234
|
-
logger.info(
|
|
235
|
+
logger.info(`Polling: ${requestClient.getBaseUrl() + jobHref}/state`)
|
|
235
236
|
logger.info(`Current job state: ${state}`)
|
|
236
237
|
|
|
237
238
|
printedState = state
|
|
@@ -195,9 +195,7 @@ export class RequestClient implements HttpClient {
|
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
197
|
debug
|
|
198
|
-
)
|
|
199
|
-
throw prefixMessage(err, 'Error while handling error. ')
|
|
200
|
-
})
|
|
198
|
+
)
|
|
201
199
|
})
|
|
202
200
|
}
|
|
203
201
|
|
|
@@ -217,6 +215,7 @@ export class RequestClient implements HttpClient {
|
|
|
217
215
|
.post<T>(url, data, { headers, withCredentials: true })
|
|
218
216
|
.then((response) => {
|
|
219
217
|
throwIfError(response)
|
|
218
|
+
|
|
220
219
|
return this.parseResponse<T>(response)
|
|
221
220
|
})
|
|
222
221
|
.catch(async (e) => {
|
|
@@ -466,6 +465,8 @@ export class RequestClient implements HttpClient {
|
|
|
466
465
|
|
|
467
466
|
if (e instanceof LoginRequiredError) {
|
|
468
467
|
this.clearCsrfTokens()
|
|
468
|
+
|
|
469
|
+
throw e
|
|
469
470
|
}
|
|
470
471
|
|
|
471
472
|
if (response?.status === 403 || response?.status === 449) {
|
|
@@ -488,7 +489,8 @@ export class RequestClient implements HttpClient {
|
|
|
488
489
|
else return
|
|
489
490
|
}
|
|
490
491
|
|
|
491
|
-
throw e
|
|
492
|
+
if (e.message) throw e
|
|
493
|
+
else throw prefixMessage(e, 'Error while handling error. ')
|
|
492
494
|
}
|
|
493
495
|
|
|
494
496
|
protected parseResponse<T>(response: AxiosResponse<any>) {
|
|
@@ -540,8 +542,9 @@ export class RequestClient implements HttpClient {
|
|
|
540
542
|
|
|
541
543
|
this.httpClient = createAxiosInstance(baseUrl, httpsAgent)
|
|
542
544
|
|
|
543
|
-
this.httpClient.defaults.validateStatus = (status) =>
|
|
544
|
-
status >= 200 && status
|
|
545
|
+
this.httpClient.defaults.validateStatus = (status) => {
|
|
546
|
+
return status >= 200 && status <= 401
|
|
547
|
+
}
|
|
545
548
|
}
|
|
546
549
|
}
|
|
547
550
|
|