@sasjs/adapter 4.7.0 → 4.8.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/README.md +6 -1
- package/SASjs.d.ts +11 -0
- package/index-dev.js +2 -2
- package/index.js +1 -1
- package/minified_sas9.js +1 -1
- package/node/SASjs.d.ts +11 -0
- package/node/index.js +1 -1
- package/node/request/RequestClient.d.ts +1 -1
- package/node/types/SASjsConfig.d.ts +4 -0
- package/package.json +1 -1
- package/request/RequestClient.d.ts +1 -1
- package/src/SASjs.ts +23 -2
- package/src/minified/sas9/SASjs.ts +2 -1
- package/src/minified/sas9/WebJobExecutor.ts +0 -1
- package/src/request/RequestClient.ts +4 -1
- package/src/types/SASjsConfig.ts +4 -0
- package/types/SASjsConfig.d.ts +4 -0
|
@@ -40,7 +40,7 @@ export declare class RequestClient implements HttpClient {
|
|
|
40
40
|
protected csrfToken: CsrfToken;
|
|
41
41
|
protected fileUploadCsrfToken: CsrfToken | undefined;
|
|
42
42
|
protected httpClient: AxiosInstance;
|
|
43
|
-
constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number);
|
|
43
|
+
constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: boolean);
|
|
44
44
|
setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
|
|
45
45
|
saveLocalStorageToken(accessToken: string, refreshToken: string): void;
|
|
46
46
|
getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
|
|
@@ -45,6 +45,10 @@ export declare class SASjsConfig {
|
|
|
45
45
|
* Set to `true` to enable additional debugging.
|
|
46
46
|
*/
|
|
47
47
|
debug: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Set to `true` to enable verbose mode that will log a summary of every HTTP response.
|
|
50
|
+
*/
|
|
51
|
+
verbose?: boolean;
|
|
48
52
|
/**
|
|
49
53
|
* The name of the compute context to use when calling the Viya services directly.
|
|
50
54
|
* Example value: 'SAS Job Execution compute context'
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ export declare class RequestClient implements HttpClient {
|
|
|
40
40
|
protected csrfToken: CsrfToken;
|
|
41
41
|
protected fileUploadCsrfToken: CsrfToken | undefined;
|
|
42
42
|
protected httpClient: AxiosInstance;
|
|
43
|
-
constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number);
|
|
43
|
+
constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: boolean);
|
|
44
44
|
setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
|
|
45
45
|
saveLocalStorageToken(accessToken: string, refreshToken: string): void;
|
|
46
46
|
getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
|
package/src/SASjs.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from './job-execution'
|
|
32
32
|
import { ErrorResponse } from './types/errors'
|
|
33
33
|
import { LoginOptions, LoginResult } from './types/Login'
|
|
34
|
+
import { AxiosResponse } from 'axios'
|
|
34
35
|
|
|
35
36
|
interface ExecuteScriptParams {
|
|
36
37
|
linesOfCode: string[]
|
|
@@ -880,7 +881,7 @@ export default class SASjs {
|
|
|
880
881
|
}
|
|
881
882
|
|
|
882
883
|
if (verboseMode) this.requestClient?.enableVerboseMode()
|
|
883
|
-
else this.requestClient?.disableVerboseMode()
|
|
884
|
+
else if (verboseMode === false) this.requestClient?.disableVerboseMode()
|
|
884
885
|
|
|
885
886
|
return this.sasViyaApiClient?.executeComputeJob(
|
|
886
887
|
sasJob,
|
|
@@ -975,7 +976,8 @@ export default class SASjs {
|
|
|
975
976
|
this.requestClient = new RequestClientClass(
|
|
976
977
|
this.sasjsConfig.serverUrl,
|
|
977
978
|
this.sasjsConfig.httpsAgentOptions,
|
|
978
|
-
this.sasjsConfig.requestHistoryLimit
|
|
979
|
+
this.sasjsConfig.requestHistoryLimit,
|
|
980
|
+
this.sasjsConfig.verbose
|
|
979
981
|
)
|
|
980
982
|
} else {
|
|
981
983
|
this.requestClient.setConfig(
|
|
@@ -1139,4 +1141,23 @@ export default class SASjs {
|
|
|
1139
1141
|
)
|
|
1140
1142
|
}
|
|
1141
1143
|
}
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Enables verbose mode that will log a summary of every HTTP response.
|
|
1147
|
+
* @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
|
|
1148
|
+
* @param errorCallBack - function that should be triggered on every HTTP response with the status different from 2**.
|
|
1149
|
+
*/
|
|
1150
|
+
public enableVerboseMode(
|
|
1151
|
+
successCallBack?: (response: AxiosResponse) => AxiosResponse,
|
|
1152
|
+
errorCallBack?: (response: AxiosResponse) => AxiosResponse
|
|
1153
|
+
) {
|
|
1154
|
+
this.requestClient?.enableVerboseMode(successCallBack, errorCallBack)
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Turns off verbose mode to log every HTTP response.
|
|
1159
|
+
*/
|
|
1160
|
+
public disableVerboseMode() {
|
|
1161
|
+
this.requestClient?.disableVerboseMode()
|
|
1162
|
+
}
|
|
1142
1163
|
}
|
|
@@ -233,7 +233,8 @@ export default class SASjs {
|
|
|
233
233
|
this.requestClient = new RequestClient(
|
|
234
234
|
this.sasjsConfig.serverUrl,
|
|
235
235
|
this.sasjsConfig.httpsAgentOptions,
|
|
236
|
-
this.sasjsConfig.requestHistoryLimit
|
|
236
|
+
this.sasjsConfig.requestHistoryLimit,
|
|
237
|
+
this.sasjsConfig.verbose
|
|
237
238
|
)
|
|
238
239
|
} else {
|
|
239
240
|
this.requestClient.setConfig(
|
|
@@ -69,11 +69,14 @@ export class RequestClient implements HttpClient {
|
|
|
69
69
|
constructor(
|
|
70
70
|
protected baseUrl: string,
|
|
71
71
|
httpsAgentOptions?: https.AgentOptions,
|
|
72
|
-
requestsLimit?: number
|
|
72
|
+
requestsLimit?: number,
|
|
73
|
+
verboseMode?: boolean
|
|
73
74
|
) {
|
|
74
75
|
this.createHttpClient(baseUrl, httpsAgentOptions)
|
|
75
76
|
|
|
76
77
|
if (requestsLimit) this.requestsLimit = requestsLimit
|
|
78
|
+
|
|
79
|
+
if (verboseMode) this.enableVerboseMode()
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
public setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions) {
|
package/src/types/SASjsConfig.ts
CHANGED
|
@@ -45,6 +45,10 @@ export class SASjsConfig {
|
|
|
45
45
|
* Set to `true` to enable additional debugging.
|
|
46
46
|
*/
|
|
47
47
|
debug: boolean = true
|
|
48
|
+
/**
|
|
49
|
+
* Set to `true` to enable verbose mode that will log a summary of every HTTP response.
|
|
50
|
+
*/
|
|
51
|
+
verbose?: boolean = true
|
|
48
52
|
/**
|
|
49
53
|
* The name of the compute context to use when calling the Viya services directly.
|
|
50
54
|
* Example value: 'SAS Job Execution compute context'
|
package/types/SASjsConfig.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export declare class SASjsConfig {
|
|
|
45
45
|
* Set to `true` to enable additional debugging.
|
|
46
46
|
*/
|
|
47
47
|
debug: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Set to `true` to enable verbose mode that will log a summary of every HTTP response.
|
|
50
|
+
*/
|
|
51
|
+
verbose?: boolean;
|
|
48
52
|
/**
|
|
49
53
|
* The name of the compute context to use when calling the Viya services directly.
|
|
50
54
|
* Example value: 'SAS Job Execution compute context'
|