@sasjs/adapter 4.8.0 → 4.9.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.
@@ -2,45 +2,17 @@
2
2
  import { AxiosInstance, AxiosResponse } from 'axios';
3
3
  import * as https from 'https';
4
4
  import { CsrfToken } from '..';
5
- import { SASjsRequest } from '../types';
6
- export interface HttpClient {
7
- get<T>(url: string, accessToken: string | undefined, contentType: string, overrideHeaders: {
8
- [key: string]: string | number;
9
- }): Promise<{
10
- result: T;
11
- etag: string;
12
- }>;
13
- post<T>(url: string, data: any, accessToken: string | undefined, contentType: string, overrideHeaders: {
14
- [key: string]: string | number;
15
- }): Promise<{
16
- result: T;
17
- etag: string;
18
- }>;
19
- put<T>(url: string, data: any, accessToken: string | undefined, overrideHeaders: {
20
- [key: string]: string | number;
21
- }): Promise<{
22
- result: T;
23
- etag: string;
24
- }>;
25
- delete<T>(url: string, accessToken: string | undefined): Promise<{
26
- result: T;
27
- etag: string;
28
- }>;
29
- getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined;
30
- saveLocalStorageToken(accessToken: string, refreshToken: string): void;
31
- clearCsrfTokens(): void;
32
- clearLocalStorageTokens(): void;
33
- getBaseUrl(): string;
34
- }
5
+ import { SASjsRequest, HttpClient, VerboseMode } from '../types';
35
6
  export declare class RequestClient implements HttpClient {
36
7
  protected baseUrl: string;
37
8
  private requests;
38
9
  private requestsLimit;
39
10
  private httpInterceptor?;
11
+ private verboseMode;
40
12
  protected csrfToken: CsrfToken;
41
13
  protected fileUploadCsrfToken: CsrfToken | undefined;
42
14
  protected httpClient: AxiosInstance;
43
- constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: boolean);
15
+ constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: VerboseMode);
44
16
  setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
45
17
  saveLocalStorageToken(accessToken: string, refreshToken: string): void;
46
18
  getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
@@ -96,6 +68,7 @@ export declare class RequestClient implements HttpClient {
96
68
  authorize: (response: string) => Promise<any>;
97
69
  /**
98
70
  * Adds colors to the string.
71
+ * If verboseMode is set to 'bleached', colors should be disabled
99
72
  * @param str - string to be prettified.
100
73
  * @returns - prettified string
101
74
  */
@@ -107,6 +80,11 @@ export declare class RequestClient implements HttpClient {
107
80
  */
108
81
  private parseInterceptedBody;
109
82
  private defaultInterceptionCallBack;
83
+ /**
84
+ * Sets verbose mode.
85
+ * @param verboseMode - value of the verbose mode, can be true, false or bleached(without extra colors).
86
+ */
87
+ setVerboseMode: (verboseMode: VerboseMode) => void;
110
88
  /**
111
89
  * Turns on verbose mode to log every HTTP response.
112
90
  * @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
@@ -1,12 +1,6 @@
1
1
  import { RequestClient } from './RequestClient';
2
2
  import { AxiosResponse } from 'axios';
3
- export interface SasjsParsedResponse<T> {
4
- result: T;
5
- log: string;
6
- etag: string;
7
- status: number;
8
- printOutput?: string;
9
- }
3
+ import { SasjsParsedResponse } from '../types';
10
4
  /**
11
5
  * Specific request client for SASJS.
12
6
  * Append tokens in headers.
@@ -0,0 +1,46 @@
1
+ import { CsrfToken } from '..';
2
+ export interface HttpClient {
3
+ get<T>(url: string, accessToken: string | undefined, contentType: string, overrideHeaders: {
4
+ [key: string]: string | number;
5
+ }): Promise<{
6
+ result: T;
7
+ etag: string;
8
+ }>;
9
+ post<T>(url: string, data: any, accessToken: string | undefined, contentType: string, overrideHeaders: {
10
+ [key: string]: string | number;
11
+ }): Promise<{
12
+ result: T;
13
+ etag: string;
14
+ }>;
15
+ put<T>(url: string, data: any, accessToken: string | undefined, overrideHeaders: {
16
+ [key: string]: string | number;
17
+ }): Promise<{
18
+ result: T;
19
+ etag: string;
20
+ }>;
21
+ delete<T>(url: string, accessToken: string | undefined): Promise<{
22
+ result: T;
23
+ etag: string;
24
+ }>;
25
+ getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined;
26
+ saveLocalStorageToken(accessToken: string, refreshToken: string): void;
27
+ clearCsrfTokens(): void;
28
+ clearLocalStorageTokens(): void;
29
+ getBaseUrl(): string;
30
+ }
31
+ export interface SASjsRequest {
32
+ serviceLink: string;
33
+ timestamp: Date;
34
+ sourceCode: string;
35
+ generatedCode: string;
36
+ logFile: string;
37
+ SASWORK: any;
38
+ }
39
+ export interface SasjsParsedResponse<T> {
40
+ result: T;
41
+ log: string;
42
+ etag: string;
43
+ status: number;
44
+ printOutput?: string;
45
+ }
46
+ export declare type VerboseMode = boolean | 'bleached';
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import * as https from 'https';
3
3
  import { ServerType } from '@sasjs/utils/types';
4
+ import { VerboseMode } from '../types';
4
5
  /**
5
6
  * Specifies the configuration for the SASjs instance - eg where and how to
6
7
  * connect to SAS.
@@ -48,7 +49,7 @@ export declare class SASjsConfig {
48
49
  /**
49
50
  * Set to `true` to enable verbose mode that will log a summary of every HTTP response.
50
51
  */
51
- verbose?: boolean;
52
+ verbose?: VerboseMode;
52
53
  /**
53
54
  * The name of the compute context to use when calling the Viya services directly.
54
55
  * Example value: 'SAS Job Execution compute context'
@@ -6,10 +6,12 @@ export * from './Job';
6
6
  export * from './JobDefinition';
7
7
  export * from './JobResult';
8
8
  export * from './Link';
9
+ export * from './Login';
9
10
  export * from './SASjsConfig';
10
- export * from './SASjsRequest';
11
+ export * from './RequestClient';
11
12
  export * from './Session';
12
13
  export * from './UploadFile';
13
14
  export * from './PollOptions';
14
15
  export * from './WriteStream';
15
16
  export * from './ExecuteScript';
17
+ export * from './errors';
@@ -1,4 +1,4 @@
1
- import { SASjsRequest } from '../types/SASjsRequest';
1
+ import { SASjsRequest } from '../types';
2
2
  /**
3
3
  * Comparator for SASjs request timestamps.
4
4
  *
package/package.json CHANGED
@@ -84,5 +84,5 @@
84
84
  "https": "1.0.0",
85
85
  "tough-cookie": "4.1.3"
86
86
  },
87
- "version": "4.8.0"
87
+ "version": "4.9.0"
88
88
  }
@@ -2,45 +2,17 @@
2
2
  import { AxiosInstance, AxiosResponse } from 'axios';
3
3
  import * as https from 'https';
4
4
  import { CsrfToken } from '..';
5
- import { SASjsRequest } from '../types';
6
- export interface HttpClient {
7
- get<T>(url: string, accessToken: string | undefined, contentType: string, overrideHeaders: {
8
- [key: string]: string | number;
9
- }): Promise<{
10
- result: T;
11
- etag: string;
12
- }>;
13
- post<T>(url: string, data: any, accessToken: string | undefined, contentType: string, overrideHeaders: {
14
- [key: string]: string | number;
15
- }): Promise<{
16
- result: T;
17
- etag: string;
18
- }>;
19
- put<T>(url: string, data: any, accessToken: string | undefined, overrideHeaders: {
20
- [key: string]: string | number;
21
- }): Promise<{
22
- result: T;
23
- etag: string;
24
- }>;
25
- delete<T>(url: string, accessToken: string | undefined): Promise<{
26
- result: T;
27
- etag: string;
28
- }>;
29
- getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined;
30
- saveLocalStorageToken(accessToken: string, refreshToken: string): void;
31
- clearCsrfTokens(): void;
32
- clearLocalStorageTokens(): void;
33
- getBaseUrl(): string;
34
- }
5
+ import { SASjsRequest, HttpClient, VerboseMode } from '../types';
35
6
  export declare class RequestClient implements HttpClient {
36
7
  protected baseUrl: string;
37
8
  private requests;
38
9
  private requestsLimit;
39
10
  private httpInterceptor?;
11
+ private verboseMode;
40
12
  protected csrfToken: CsrfToken;
41
13
  protected fileUploadCsrfToken: CsrfToken | undefined;
42
14
  protected httpClient: AxiosInstance;
43
- constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: boolean);
15
+ constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number, verboseMode?: VerboseMode);
44
16
  setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
45
17
  saveLocalStorageToken(accessToken: string, refreshToken: string): void;
46
18
  getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
@@ -96,6 +68,7 @@ export declare class RequestClient implements HttpClient {
96
68
  authorize: (response: string) => Promise<any>;
97
69
  /**
98
70
  * Adds colors to the string.
71
+ * If verboseMode is set to 'bleached', colors should be disabled
99
72
  * @param str - string to be prettified.
100
73
  * @returns - prettified string
101
74
  */
@@ -107,6 +80,11 @@ export declare class RequestClient implements HttpClient {
107
80
  */
108
81
  private parseInterceptedBody;
109
82
  private defaultInterceptionCallBack;
83
+ /**
84
+ * Sets verbose mode.
85
+ * @param verboseMode - value of the verbose mode, can be true, false or bleached(without extra colors).
86
+ */
87
+ setVerboseMode: (verboseMode: VerboseMode) => void;
110
88
  /**
111
89
  * Turns on verbose mode to log every HTTP response.
112
90
  * @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
@@ -1,12 +1,6 @@
1
1
  import { RequestClient } from './RequestClient';
2
2
  import { AxiosResponse } from 'axios';
3
- export interface SasjsParsedResponse<T> {
4
- result: T;
5
- log: string;
6
- etag: string;
7
- status: number;
8
- printOutput?: string;
9
- }
3
+ import { SasjsParsedResponse } from '../types';
10
4
  /**
11
5
  * Specific request client for SASJS.
12
6
  * Append tokens in headers.
package/src/SASjs.ts CHANGED
@@ -4,7 +4,12 @@ import {
4
4
  UploadFile,
5
5
  EditContextInput,
6
6
  PollOptions,
7
- LoginMechanism
7
+ LoginMechanism,
8
+ VerboseMode,
9
+ ErrorResponse,
10
+ LoginOptions,
11
+ LoginResult,
12
+ ExecutionQuery
8
13
  } from './types'
9
14
  import { SASViyaApiClient } from './SASViyaApiClient'
10
15
  import { SAS9ApiClient } from './SAS9ApiClient'
@@ -29,8 +34,6 @@ import {
29
34
  Sas9JobExecutor,
30
35
  FileUploader
31
36
  } from './job-execution'
32
- import { ErrorResponse } from './types/errors'
33
- import { LoginOptions, LoginResult } from './types/Login'
34
37
  import { AxiosResponse } from 'axios'
35
38
 
36
39
  interface ExecuteScriptParams {
@@ -158,6 +161,23 @@ export default class SASjs {
158
161
  }
159
162
  }
160
163
 
164
+ /**
165
+ * Executes job on SASJS server.
166
+ * @param query - an object containing job path and debug level.
167
+ * @param appLoc - an application path.
168
+ * @param authConfig - an object for authentication.
169
+ * @returns a promise that resolves into job execution result and log.
170
+ */
171
+ public async executeJob(
172
+ query: ExecutionQuery,
173
+ appLoc: string,
174
+ authConfig?: AuthConfig
175
+ ) {
176
+ this.isMethodSupported('executeScript', [ServerType.Sasjs])
177
+
178
+ return await this.sasJSApiClient?.executeJob(query, appLoc, authConfig)
179
+ }
180
+
161
181
  /**
162
182
  * Gets compute contexts.
163
183
  * @param accessToken - an access token for an authorised user.
@@ -855,7 +875,7 @@ export default class SASjs {
855
875
  * @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { maxPollCount: 24 * 60 * 60, pollInterval: 1000 }. More information available at src/api/viya/pollJobState.ts.
856
876
  * @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
857
877
  * @param variables - an object that represents macro variables.
858
- * @param verboseMode - boolean to enable verbose mode (log every HTTP response).
878
+ * @param verboseMode - boolean or a string equal to 'bleached' to enable verbose mode (log every HTTP response).
859
879
  */
860
880
  public async startComputeJob(
861
881
  sasJob: string,
@@ -866,7 +886,7 @@ export default class SASjs {
866
886
  pollOptions?: PollOptions,
867
887
  printPid = false,
868
888
  variables?: MacroVar,
869
- verboseMode?: boolean
889
+ verboseMode?: VerboseMode
870
890
  ) {
871
891
  config = {
872
892
  ...this.sasjsConfig,
@@ -880,8 +900,10 @@ export default class SASjs {
880
900
  )
881
901
  }
882
902
 
883
- if (verboseMode) this.requestClient?.enableVerboseMode()
884
- else if (verboseMode === false) this.requestClient?.disableVerboseMode()
903
+ if (verboseMode) {
904
+ this.requestClient?.setVerboseMode(verboseMode)
905
+ this.requestClient?.enableVerboseMode()
906
+ } else if (verboseMode === false) this.requestClient?.disableVerboseMode()
885
907
 
886
908
  return this.sasViyaApiClient?.executeComputeJob(
887
909
  sasJob,
@@ -1160,4 +1182,12 @@ export default class SASjs {
1160
1182
  public disableVerboseMode() {
1161
1183
  this.requestClient?.disableVerboseMode()
1162
1184
  }
1185
+
1186
+ /**
1187
+ * Sets verbose mode.
1188
+ * @param verboseMode - value of the verbose mode, can be true, false or bleached(without extra colors).
1189
+ */
1190
+ public setVerboseMode = (verboseMode: VerboseMode) => {
1191
+ this.requestClient?.setVerboseMode(verboseMode)
1192
+ }
1163
1193
  }
@@ -10,7 +10,7 @@ import {
10
10
  JobExecutionError,
11
11
  CertificateError
12
12
  } from '../types/errors'
13
- import { SASjsRequest } from '../types'
13
+ import { SASjsRequest, HttpClient, VerboseMode } from '../types'
14
14
  import { parseWeboutResponse } from '../utils/parseWeboutResponse'
15
15
  import { prefixMessage } from '@sasjs/utils/error'
16
16
  import { SAS9AuthError } from '../types/errors/SAS9AuthError'
@@ -22,45 +22,11 @@ import {
22
22
  import { InvalidSASjsCsrfError } from '../types/errors/InvalidSASjsCsrfError'
23
23
  import { inspect } from 'util'
24
24
 
25
- export interface HttpClient {
26
- get<T>(
27
- url: string,
28
- accessToken: string | undefined,
29
- contentType: string,
30
- overrideHeaders: { [key: string]: string | number }
31
- ): Promise<{ result: T; etag: string }>
32
-
33
- post<T>(
34
- url: string,
35
- data: any,
36
- accessToken: string | undefined,
37
- contentType: string,
38
- overrideHeaders: { [key: string]: string | number }
39
- ): Promise<{ result: T; etag: string }>
40
-
41
- put<T>(
42
- url: string,
43
- data: any,
44
- accessToken: string | undefined,
45
- overrideHeaders: { [key: string]: string | number }
46
- ): Promise<{ result: T; etag: string }>
47
-
48
- delete<T>(
49
- url: string,
50
- accessToken: string | undefined
51
- ): Promise<{ result: T; etag: string }>
52
-
53
- getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined
54
- saveLocalStorageToken(accessToken: string, refreshToken: string): void
55
- clearCsrfTokens(): void
56
- clearLocalStorageTokens(): void
57
- getBaseUrl(): string
58
- }
59
-
60
25
  export class RequestClient implements HttpClient {
61
26
  private requests: SASjsRequest[] = []
62
27
  private requestsLimit: number = 10
63
28
  private httpInterceptor?: number
29
+ private verboseMode: VerboseMode = false
64
30
 
65
31
  protected csrfToken: CsrfToken = { headerName: '', value: '' }
66
32
  protected fileUploadCsrfToken: CsrfToken | undefined
@@ -70,13 +36,16 @@ export class RequestClient implements HttpClient {
70
36
  protected baseUrl: string,
71
37
  httpsAgentOptions?: https.AgentOptions,
72
38
  requestsLimit?: number,
73
- verboseMode?: boolean
39
+ verboseMode?: VerboseMode
74
40
  ) {
75
41
  this.createHttpClient(baseUrl, httpsAgentOptions)
76
42
 
77
43
  if (requestsLimit) this.requestsLimit = requestsLimit
78
44
 
79
- if (verboseMode) this.enableVerboseMode()
45
+ if (verboseMode) {
46
+ this.setVerboseMode(verboseMode)
47
+ this.enableVerboseMode()
48
+ }
80
49
  }
81
50
 
82
51
  public setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions) {
@@ -398,10 +367,12 @@ export class RequestClient implements HttpClient {
398
367
 
399
368
  /**
400
369
  * Adds colors to the string.
370
+ * If verboseMode is set to 'bleached', colors should be disabled
401
371
  * @param str - string to be prettified.
402
372
  * @returns - prettified string
403
373
  */
404
- private prettifyString = (str: any) => inspect(str, { colors: true })
374
+ private prettifyString = (str: any) =>
375
+ inspect(str, { colors: this.verboseMode !== 'bleached' })
405
376
 
406
377
  /**
407
378
  * Formats HTTP request/response body.
@@ -471,6 +442,17 @@ ${resHeaders}${parsedResBody ? `\n\n${parsedResBody}` : ''}
471
442
  return response
472
443
  }
473
444
 
445
+ /**
446
+ * Sets verbose mode.
447
+ * @param verboseMode - value of the verbose mode, can be true, false or bleached(without extra colors).
448
+ */
449
+ public setVerboseMode = (verboseMode: VerboseMode) => {
450
+ this.verboseMode = verboseMode
451
+
452
+ if (this.verboseMode) this.enableVerboseMode()
453
+ else this.disableVerboseMode()
454
+ }
455
+
474
456
  /**
475
457
  * Turns on verbose mode to log every HTTP response.
476
458
  * @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
@@ -1,19 +1,11 @@
1
1
  import { RequestClient } from './RequestClient'
2
2
  import { AxiosResponse } from 'axios'
3
-
4
- export interface SasjsParsedResponse<T> {
5
- result: T
6
- log: string
7
- etag: string
8
- status: number
9
- printOutput?: string
10
- }
3
+ import { SasjsParsedResponse } from '../types'
11
4
 
12
5
  /**
13
6
  * Specific request client for SASJS.
14
7
  * Append tokens in headers.
15
8
  */
16
-
17
9
  export class SasjsRequestClient extends RequestClient {
18
10
  getHeaders = (accessToken: string | undefined, contentType: string) => {
19
11
  const headers: any = {}
@@ -0,0 +1,55 @@
1
+ import { CsrfToken } from '..'
2
+
3
+ export interface HttpClient {
4
+ get<T>(
5
+ url: string,
6
+ accessToken: string | undefined,
7
+ contentType: string,
8
+ overrideHeaders: { [key: string]: string | number }
9
+ ): Promise<{ result: T; etag: string }>
10
+
11
+ post<T>(
12
+ url: string,
13
+ data: any,
14
+ accessToken: string | undefined,
15
+ contentType: string,
16
+ overrideHeaders: { [key: string]: string | number }
17
+ ): Promise<{ result: T; etag: string }>
18
+
19
+ put<T>(
20
+ url: string,
21
+ data: any,
22
+ accessToken: string | undefined,
23
+ overrideHeaders: { [key: string]: string | number }
24
+ ): Promise<{ result: T; etag: string }>
25
+
26
+ delete<T>(
27
+ url: string,
28
+ accessToken: string | undefined
29
+ ): Promise<{ result: T; etag: string }>
30
+
31
+ getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined
32
+ saveLocalStorageToken(accessToken: string, refreshToken: string): void
33
+ clearCsrfTokens(): void
34
+ clearLocalStorageTokens(): void
35
+ getBaseUrl(): string
36
+ }
37
+
38
+ export interface SASjsRequest {
39
+ serviceLink: string
40
+ timestamp: Date
41
+ sourceCode: string
42
+ generatedCode: string
43
+ logFile: string
44
+ SASWORK: any
45
+ }
46
+
47
+ export interface SasjsParsedResponse<T> {
48
+ result: T
49
+ log: string
50
+ etag: string
51
+ status: number
52
+ printOutput?: string
53
+ }
54
+
55
+ export type VerboseMode = boolean | 'bleached'
@@ -1,5 +1,6 @@
1
1
  import * as https from 'https'
2
2
  import { ServerType } from '@sasjs/utils/types'
3
+ import { VerboseMode } from '../types'
3
4
 
4
5
  /**
5
6
  * Specifies the configuration for the SASjs instance - eg where and how to
@@ -48,7 +49,7 @@ export class SASjsConfig {
48
49
  /**
49
50
  * Set to `true` to enable verbose mode that will log a summary of every HTTP response.
50
51
  */
51
- verbose?: boolean = true
52
+ verbose?: VerboseMode = true
52
53
  /**
53
54
  * The name of the compute context to use when calling the Viya services directly.
54
55
  * Example value: 'SAS Job Execution compute context'
@@ -6,10 +6,12 @@ export * from './Job'
6
6
  export * from './JobDefinition'
7
7
  export * from './JobResult'
8
8
  export * from './Link'
9
+ export * from './Login'
9
10
  export * from './SASjsConfig'
10
- export * from './SASjsRequest'
11
+ export * from './RequestClient'
11
12
  export * from './Session'
12
13
  export * from './UploadFile'
13
14
  export * from './PollOptions'
14
15
  export * from './WriteStream'
15
16
  export * from './ExecuteScript'
17
+ export * from './errors'
@@ -1,4 +1,4 @@
1
- import { SASjsRequest } from '../types/SASjsRequest'
1
+ import { SASjsRequest } from '../types'
2
2
 
3
3
  /**
4
4
  * Comparator for SASjs request timestamps.
@@ -0,0 +1,46 @@
1
+ import { CsrfToken } from '..';
2
+ export interface HttpClient {
3
+ get<T>(url: string, accessToken: string | undefined, contentType: string, overrideHeaders: {
4
+ [key: string]: string | number;
5
+ }): Promise<{
6
+ result: T;
7
+ etag: string;
8
+ }>;
9
+ post<T>(url: string, data: any, accessToken: string | undefined, contentType: string, overrideHeaders: {
10
+ [key: string]: string | number;
11
+ }): Promise<{
12
+ result: T;
13
+ etag: string;
14
+ }>;
15
+ put<T>(url: string, data: any, accessToken: string | undefined, overrideHeaders: {
16
+ [key: string]: string | number;
17
+ }): Promise<{
18
+ result: T;
19
+ etag: string;
20
+ }>;
21
+ delete<T>(url: string, accessToken: string | undefined): Promise<{
22
+ result: T;
23
+ etag: string;
24
+ }>;
25
+ getCsrfToken(type: 'general' | 'file'): CsrfToken | undefined;
26
+ saveLocalStorageToken(accessToken: string, refreshToken: string): void;
27
+ clearCsrfTokens(): void;
28
+ clearLocalStorageTokens(): void;
29
+ getBaseUrl(): string;
30
+ }
31
+ export interface SASjsRequest {
32
+ serviceLink: string;
33
+ timestamp: Date;
34
+ sourceCode: string;
35
+ generatedCode: string;
36
+ logFile: string;
37
+ SASWORK: any;
38
+ }
39
+ export interface SasjsParsedResponse<T> {
40
+ result: T;
41
+ log: string;
42
+ etag: string;
43
+ status: number;
44
+ printOutput?: string;
45
+ }
46
+ export declare type VerboseMode = boolean | 'bleached';
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import * as https from 'https';
3
3
  import { ServerType } from '@sasjs/utils/types';
4
+ import { VerboseMode } from '../types';
4
5
  /**
5
6
  * Specifies the configuration for the SASjs instance - eg where and how to
6
7
  * connect to SAS.
@@ -48,7 +49,7 @@ export declare class SASjsConfig {
48
49
  /**
49
50
  * Set to `true` to enable verbose mode that will log a summary of every HTTP response.
50
51
  */
51
- verbose?: boolean;
52
+ verbose?: VerboseMode;
52
53
  /**
53
54
  * The name of the compute context to use when calling the Viya services directly.
54
55
  * Example value: 'SAS Job Execution compute context'
package/types/index.d.ts CHANGED
@@ -6,10 +6,12 @@ export * from './Job';
6
6
  export * from './JobDefinition';
7
7
  export * from './JobResult';
8
8
  export * from './Link';
9
+ export * from './Login';
9
10
  export * from './SASjsConfig';
10
- export * from './SASjsRequest';
11
+ export * from './RequestClient';
11
12
  export * from './Session';
12
13
  export * from './UploadFile';
13
14
  export * from './PollOptions';
14
15
  export * from './WriteStream';
15
16
  export * from './ExecuteScript';
17
+ export * from './errors';
@@ -1,4 +1,4 @@
1
- import { SASjsRequest } from '../types/SASjsRequest';
1
+ import { SASjsRequest } from '../types';
2
2
  /**
3
3
  * Comparator for SASjs request timestamps.
4
4
  *
@@ -1,12 +0,0 @@
1
- /**
2
- * Represents a SASjs request, its response and logs.
3
- *
4
- */
5
- export interface SASjsRequest {
6
- serviceLink: string;
7
- timestamp: Date;
8
- sourceCode: string;
9
- generatedCode: string;
10
- logFile: string;
11
- SASWORK: any;
12
- }